@sprucelabs/heartwood-view-controllers 129.4.3 → 129.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/navigation.schema.js +8 -0
- package/build/.spruce/schemas/schemas.types.d.ts +12 -0
- package/build/esm/.spruce/schemas/heartwoodViewControllers/v2021_02_11/navigation.schema.js +8 -0
- package/build/esm/.spruce/schemas/schemas.types.d.ts +12 -0
- package/build/esm/schemas/v2021_02_11/navigation.builder.d.ts +9 -0
- package/build/esm/schemas/v2021_02_11/navigation.builder.js +9 -0
- package/build/esm/tests/utilities/navigationAssert.d.ts +2 -0
- package/build/esm/tests/utilities/navigationAssert.js +33 -0
- package/build/esm/types/heartwood.types.d.ts +3 -2
- package/build/esm/viewControllers/navigation/Navigation.vc.d.ts +4 -1
- package/build/esm/viewControllers/navigation/Navigation.vc.js +18 -1
- package/build/schemas/v2021_02_11/navigation.builder.d.ts +9 -0
- package/build/schemas/v2021_02_11/navigation.builder.js +9 -0
- package/build/tests/utilities/navigationAssert.d.ts +2 -0
- package/build/tests/utilities/navigationAssert.js +20 -0
- package/build/types/heartwood.types.d.ts +3 -2
- package/build/viewControllers/navigation/Navigation.vc.d.ts +4 -1
- package/build/viewControllers/navigation/Navigation.vc.js +9 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
<h1 align="center">
|
|
4
4
|
Spruce XP Documentation
|
|
5
5
|
</h1>
|
|
6
|
+
|
|
7
|
+
[](https://regressionproof.ai)
|
|
6
8
|
<h3 align="center">Spruce XP is an Experience Platform built to create unforgettable experiences and long-lasting relationships.
|
|
7
9
|
</h3>
|
|
8
10
|
<p align="center">
|
|
@@ -19,6 +21,4 @@ Spruce XP Documentation
|
|
|
19
21
|
</p>
|
|
20
22
|
|
|
21
23
|
### Dependencies
|
|
22
|
-
[Arkit diagram here](docs/dependencies.md).
|
|
23
|
-
|
|
24
|
-
[](https://regressionproof.ai)
|
|
24
|
+
[Arkit diagram here](docs/dependencies.md).
|
|
@@ -39,6 +39,14 @@ const navigationSchema = {
|
|
|
39
39
|
isArray: true,
|
|
40
40
|
options: { valueType: `HeartwoodTypes.NavigationItem`, }
|
|
41
41
|
},
|
|
42
|
+
/** Set refresh permissions handler. The handler you pass here will be called when the navigation asks to refresh permissions. */
|
|
43
|
+
'setRefreshPermissionsHandler': {
|
|
44
|
+
label: 'Set refresh permissions handler',
|
|
45
|
+
type: 'raw',
|
|
46
|
+
isRequired: true,
|
|
47
|
+
hint: 'The handler you pass here will be called when the navigation asks to refresh permissions.',
|
|
48
|
+
options: { valueType: `(cb: HeartwoodTypes.RefreshNavigationPermissionsHandler) => void`, }
|
|
49
|
+
},
|
|
42
50
|
/** . */
|
|
43
51
|
'additionalValidRoutes': {
|
|
44
52
|
type: 'schema',
|
|
@@ -4264,6 +4264,8 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
|
|
|
4264
4264
|
/** Controller. */
|
|
4265
4265
|
'controller'?: (HeartwoodTypes.ViewController<HeartwoodTypes.Navigation>) | undefined | null;
|
|
4266
4266
|
'buttons'?: (HeartwoodTypes.NavigationItem)[] | undefined | null;
|
|
4267
|
+
/** Set refresh permissions handler. The handler you pass here will be called when the navigation asks to refresh permissions. */
|
|
4268
|
+
'setRefreshPermissionsHandler': ((cb: HeartwoodTypes.RefreshNavigationPermissionsHandler) => void);
|
|
4267
4269
|
'additionalValidRoutes'?: SpruceSchemas.HeartwoodViewControllers.v2021_02_11.NavigationRoute[] | undefined | null;
|
|
4268
4270
|
}
|
|
4269
4271
|
interface NavigationSchema extends SpruceSchema.Schema {
|
|
@@ -4304,6 +4306,16 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
|
|
|
4304
4306
|
valueType: `HeartwoodTypes.NavigationItem`;
|
|
4305
4307
|
};
|
|
4306
4308
|
};
|
|
4309
|
+
/** Set refresh permissions handler. The handler you pass here will be called when the navigation asks to refresh permissions. */
|
|
4310
|
+
'setRefreshPermissionsHandler': {
|
|
4311
|
+
label: 'Set refresh permissions handler';
|
|
4312
|
+
type: 'raw';
|
|
4313
|
+
isRequired: true;
|
|
4314
|
+
hint: 'The handler you pass here will be called when the navigation asks to refresh permissions.';
|
|
4315
|
+
options: {
|
|
4316
|
+
valueType: `(cb: HeartwoodTypes.RefreshNavigationPermissionsHandler) => void`;
|
|
4317
|
+
};
|
|
4318
|
+
};
|
|
4307
4319
|
/** . */
|
|
4308
4320
|
'additionalValidRoutes': {
|
|
4309
4321
|
type: 'schema';
|
|
@@ -34,6 +34,14 @@ const navigationSchema = {
|
|
|
34
34
|
isArray: true,
|
|
35
35
|
options: { valueType: `HeartwoodTypes.NavigationItem`, }
|
|
36
36
|
},
|
|
37
|
+
/** Set refresh permissions handler. The handler you pass here will be called when the navigation asks to refresh permissions. */
|
|
38
|
+
'setRefreshPermissionsHandler': {
|
|
39
|
+
label: 'Set refresh permissions handler',
|
|
40
|
+
type: 'raw',
|
|
41
|
+
isRequired: true,
|
|
42
|
+
hint: 'The handler you pass here will be called when the navigation asks to refresh permissions.',
|
|
43
|
+
options: { valueType: `(cb: HeartwoodTypes.RefreshNavigationPermissionsHandler) => void`, }
|
|
44
|
+
},
|
|
37
45
|
/** . */
|
|
38
46
|
'additionalValidRoutes': {
|
|
39
47
|
type: 'schema',
|
|
@@ -4264,6 +4264,8 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
|
|
|
4264
4264
|
/** Controller. */
|
|
4265
4265
|
'controller'?: (HeartwoodTypes.ViewController<HeartwoodTypes.Navigation>) | undefined | null;
|
|
4266
4266
|
'buttons'?: (HeartwoodTypes.NavigationItem)[] | undefined | null;
|
|
4267
|
+
/** Set refresh permissions handler. The handler you pass here will be called when the navigation asks to refresh permissions. */
|
|
4268
|
+
'setRefreshPermissionsHandler': ((cb: HeartwoodTypes.RefreshNavigationPermissionsHandler) => void);
|
|
4267
4269
|
'additionalValidRoutes'?: SpruceSchemas.HeartwoodViewControllers.v2021_02_11.NavigationRoute[] | undefined | null;
|
|
4268
4270
|
}
|
|
4269
4271
|
interface NavigationSchema extends SpruceSchema.Schema {
|
|
@@ -4304,6 +4306,16 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
|
|
|
4304
4306
|
valueType: `HeartwoodTypes.NavigationItem`;
|
|
4305
4307
|
};
|
|
4306
4308
|
};
|
|
4309
|
+
/** Set refresh permissions handler. The handler you pass here will be called when the navigation asks to refresh permissions. */
|
|
4310
|
+
'setRefreshPermissionsHandler': {
|
|
4311
|
+
label: 'Set refresh permissions handler';
|
|
4312
|
+
type: 'raw';
|
|
4313
|
+
isRequired: true;
|
|
4314
|
+
hint: 'The handler you pass here will be called when the navigation asks to refresh permissions.';
|
|
4315
|
+
options: {
|
|
4316
|
+
valueType: `(cb: HeartwoodTypes.RefreshNavigationPermissionsHandler) => void`;
|
|
4317
|
+
};
|
|
4318
|
+
};
|
|
4307
4319
|
/** . */
|
|
4308
4320
|
'additionalValidRoutes': {
|
|
4309
4321
|
type: 'schema';
|
|
@@ -28,6 +28,15 @@ declare const _default: {
|
|
|
28
28
|
valueType: string;
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
+
setRefreshPermissionsHandler: {
|
|
32
|
+
type: "raw";
|
|
33
|
+
label: string;
|
|
34
|
+
hint: string;
|
|
35
|
+
isRequired: true;
|
|
36
|
+
options: {
|
|
37
|
+
valueType: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
31
40
|
additionalValidRoutes: {
|
|
32
41
|
type: "schema";
|
|
33
42
|
isArray: true;
|
|
@@ -35,6 +35,15 @@ export default buildSchema({
|
|
|
35
35
|
valueType: 'HeartwoodTypes.NavigationItem',
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
|
+
setRefreshPermissionsHandler: {
|
|
39
|
+
type: 'raw',
|
|
40
|
+
label: 'Set refresh permissions handler',
|
|
41
|
+
hint: 'The handler you pass here will be called when the navigation asks to refresh permissions.',
|
|
42
|
+
isRequired: true,
|
|
43
|
+
options: {
|
|
44
|
+
valueType: '(cb: HeartwoodTypes.RefreshNavigationPermissionsHandler) => void',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
38
47
|
additionalValidRoutes: {
|
|
39
48
|
type: 'schema',
|
|
40
49
|
isArray: true,
|
|
@@ -21,6 +21,8 @@ declare const navigationAssert: {
|
|
|
21
21
|
hasAdditionalValidRoutes(vc: ViewController<Navigation>, routes: NavigationRoute[]): void;
|
|
22
22
|
isHidden(vc: ViewController<Navigation>): void;
|
|
23
23
|
isVisible(vc: ViewController<Navigation>): void;
|
|
24
|
+
assertActionDoesNotRefreshPermissions(vc: ViewController<Navigation>, action: () => Promise<void> | void): Promise<void>;
|
|
25
|
+
assertActionRefreshesPermissions(vc: ViewController<Navigation>, action: () => Promise<void> | void): Promise<void>;
|
|
24
26
|
};
|
|
25
27
|
export default navigationAssert;
|
|
26
28
|
export declare function getButtonFromNav(vc: ViewController<Navigation>, id: string): any;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import { assertOptions } from '@sprucelabs/schema';
|
|
2
11
|
import { assert } from '@sprucelabs/test-utils';
|
|
3
12
|
import renderUtil from '../../utilities/render.utility.js';
|
|
@@ -86,6 +95,30 @@ const navigationAssert = {
|
|
|
86
95
|
const isVisible = typeof model.isVisible === 'undefined' || model.isVisible;
|
|
87
96
|
assert.isTruthy(isVisible, `Your navigation should be visible! Try calling 'this.navigationVc.show()'.`);
|
|
88
97
|
},
|
|
98
|
+
assertActionDoesNotRefreshPermissions(vc, action) {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
assertOptions({ vc, action }, ['vc', 'action']);
|
|
101
|
+
try {
|
|
102
|
+
yield this.assertActionRefreshesPermissions(vc, action);
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
assert.fail('I expected the action to not refresh permissions but it did! Make sure you are calling the "setRefreshPermissionsHandler" function in your navigation\'s view model and that you call the provided function to trigger a permissions refresh.');
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
assertActionRefreshesPermissions(vc, action) {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
assertOptions({ vc, action }, ['vc', 'action']);
|
|
113
|
+
const model = renderUtil.render(vc);
|
|
114
|
+
let didRefresh = false;
|
|
115
|
+
model.setRefreshPermissionsHandler(() => {
|
|
116
|
+
didRefresh = true;
|
|
117
|
+
});
|
|
118
|
+
yield action();
|
|
119
|
+
assert.isTrue(didRefresh, `I expected the action to refresh permissions but it did not! Make sure you are calling the 'setRefreshPermissionsHandler' function in your navigation's view model and that you call the provided function to trigger a permissions refresh.`);
|
|
120
|
+
});
|
|
121
|
+
},
|
|
89
122
|
};
|
|
90
123
|
export default navigationAssert;
|
|
91
124
|
export function getButtonFromNav(vc, id) {
|
|
@@ -30,7 +30,7 @@ import ListViewController, { ListViewControllerOptions } from '../viewController
|
|
|
30
30
|
import ListRowViewController from '../viewControllers/list/ListRow.vc';
|
|
31
31
|
import LoginCardViewController, { LoginCardViewControllerOptions } from '../viewControllers/LoginCard.vc';
|
|
32
32
|
import MapViewController, { MapViewControllerOptions } from '../viewControllers/Map.vc';
|
|
33
|
-
import NavigationViewController from '../viewControllers/navigation/Navigation.vc';
|
|
33
|
+
import NavigationViewController, { NavigationViewControllerOptions } from '../viewControllers/navigation/Navigation.vc';
|
|
34
34
|
import PagerViewController, { PagerViewControllerOptions } from '../viewControllers/pagers/Pager.vc';
|
|
35
35
|
import PolarAreaViewController, { PolarAreaViewControllerOptions } from '../viewControllers/PolarAreaViewController.vc';
|
|
36
36
|
import ProgressNavigatorViewController, { ProgressNavigatorViewControllerOptions } from '../viewControllers/progressNavigator/ProgressNavigator.vc';
|
|
@@ -403,7 +403,7 @@ export interface ViewControllerOptionsMap {
|
|
|
403
403
|
form: FormViewControllerOptions<any>;
|
|
404
404
|
list: ListViewControllerOptions;
|
|
405
405
|
map: MapViewControllerOptions;
|
|
406
|
-
navigation:
|
|
406
|
+
navigation: NavigationViewControllerOptions;
|
|
407
407
|
pager: PagerViewControllerOptions;
|
|
408
408
|
progress: ProgressViewControllerOptions;
|
|
409
409
|
ratings: RatingsViewControllerOptions;
|
|
@@ -667,3 +667,4 @@ export interface AppControllerLoadOptions {
|
|
|
667
667
|
export interface ChartViewController<ViewModel extends Record<string, any>> extends ViewController<ViewModel> {
|
|
668
668
|
setDataSets(dataSets: ChartDataSet[]): void;
|
|
669
669
|
}
|
|
670
|
+
export type RefreshNavigationPermissionsHandler = () => void | Promise<void>;
|
|
@@ -2,11 +2,14 @@ import { Navigation, NavigationButton, NavigationItem, ViewControllerOptions } f
|
|
|
2
2
|
import AbstractViewController from '../Abstract.vc';
|
|
3
3
|
export default class NavigationViewController extends AbstractViewController<Navigation> {
|
|
4
4
|
private model;
|
|
5
|
-
|
|
5
|
+
private refreshPermissionsHandler?;
|
|
6
|
+
constructor(options: ViewControllerOptions & NavigationViewControllerOptions);
|
|
6
7
|
hide(): void;
|
|
7
8
|
show(): void;
|
|
8
9
|
setButtons(buttons: NavigationButton[]): void;
|
|
9
10
|
setShouldRenderButtonLabels(shouldRender: boolean): void;
|
|
10
11
|
updateButton(id: string, updates: Partial<NavigationItem>): void;
|
|
12
|
+
refreshPermissions(): Promise<void>;
|
|
11
13
|
render(): Navigation;
|
|
12
14
|
}
|
|
15
|
+
export type NavigationViewControllerOptions = Omit<Navigation, 'setRefreshPermissionsHandler'>;
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import SpruceError from '../../errors/SpruceError.js';
|
|
2
11
|
import removeUniversalViewOptions from '../../utilities/removeUniversalViewOptions.js';
|
|
3
12
|
import AbstractViewController from '../Abstract.vc.js';
|
|
4
13
|
export default class NavigationViewController extends AbstractViewController {
|
|
5
14
|
constructor(options) {
|
|
6
15
|
super(options);
|
|
7
|
-
this.model = removeUniversalViewOptions(options)
|
|
16
|
+
this.model = Object.assign(Object.assign({}, removeUniversalViewOptions(options)), { setRefreshPermissionsHandler: (cb) => {
|
|
17
|
+
this.refreshPermissionsHandler = cb;
|
|
18
|
+
} });
|
|
8
19
|
}
|
|
9
20
|
hide() {
|
|
10
21
|
this.model.isVisible = false;
|
|
@@ -37,6 +48,12 @@ export default class NavigationViewController extends AbstractViewController {
|
|
|
37
48
|
buttons[idx] = button;
|
|
38
49
|
this.triggerRender();
|
|
39
50
|
}
|
|
51
|
+
refreshPermissions() {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
var _a;
|
|
54
|
+
yield ((_a = this.refreshPermissionsHandler) === null || _a === void 0 ? void 0 : _a.call(this));
|
|
55
|
+
});
|
|
56
|
+
}
|
|
40
57
|
render() {
|
|
41
58
|
return Object.assign({ controller: this }, this.model);
|
|
42
59
|
}
|
|
@@ -28,6 +28,15 @@ declare const _default: {
|
|
|
28
28
|
valueType: string;
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
+
setRefreshPermissionsHandler: {
|
|
32
|
+
type: "raw";
|
|
33
|
+
label: string;
|
|
34
|
+
hint: string;
|
|
35
|
+
isRequired: true;
|
|
36
|
+
options: {
|
|
37
|
+
valueType: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
31
40
|
additionalValidRoutes: {
|
|
32
41
|
type: "schema";
|
|
33
42
|
isArray: true;
|
|
@@ -40,6 +40,15 @@ exports.default = (0, schema_1.buildSchema)({
|
|
|
40
40
|
valueType: 'HeartwoodTypes.NavigationItem',
|
|
41
41
|
},
|
|
42
42
|
},
|
|
43
|
+
setRefreshPermissionsHandler: {
|
|
44
|
+
type: 'raw',
|
|
45
|
+
label: 'Set refresh permissions handler',
|
|
46
|
+
hint: 'The handler you pass here will be called when the navigation asks to refresh permissions.',
|
|
47
|
+
isRequired: true,
|
|
48
|
+
options: {
|
|
49
|
+
valueType: '(cb: HeartwoodTypes.RefreshNavigationPermissionsHandler) => void',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
43
52
|
additionalValidRoutes: {
|
|
44
53
|
type: 'schema',
|
|
45
54
|
isArray: true,
|
|
@@ -21,6 +21,8 @@ declare const navigationAssert: {
|
|
|
21
21
|
hasAdditionalValidRoutes(vc: ViewController<Navigation>, routes: NavigationRoute[]): void;
|
|
22
22
|
isHidden(vc: ViewController<Navigation>): void;
|
|
23
23
|
isVisible(vc: ViewController<Navigation>): void;
|
|
24
|
+
assertActionDoesNotRefreshPermissions(vc: ViewController<Navigation>, action: () => Promise<void> | void): Promise<void>;
|
|
25
|
+
assertActionRefreshesPermissions(vc: ViewController<Navigation>, action: () => Promise<void> | void): Promise<void>;
|
|
24
26
|
};
|
|
25
27
|
export default navigationAssert;
|
|
26
28
|
export declare function getButtonFromNav(vc: ViewController<Navigation>, id: string): any;
|
|
@@ -86,6 +86,26 @@ const navigationAssert = {
|
|
|
86
86
|
const isVisible = typeof model.isVisible === 'undefined' || model.isVisible;
|
|
87
87
|
test_utils_1.assert.isTruthy(isVisible, `Your navigation should be visible! Try calling 'this.navigationVc.show()'.`);
|
|
88
88
|
},
|
|
89
|
+
async assertActionDoesNotRefreshPermissions(vc, action) {
|
|
90
|
+
(0, schema_1.assertOptions)({ vc, action }, ['vc', 'action']);
|
|
91
|
+
try {
|
|
92
|
+
await this.assertActionRefreshesPermissions(vc, action);
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
test_utils_1.assert.fail('I expected the action to not refresh permissions but it did! Make sure you are calling the "setRefreshPermissionsHandler" function in your navigation\'s view model and that you call the provided function to trigger a permissions refresh.');
|
|
98
|
+
},
|
|
99
|
+
async assertActionRefreshesPermissions(vc, action) {
|
|
100
|
+
(0, schema_1.assertOptions)({ vc, action }, ['vc', 'action']);
|
|
101
|
+
const model = render_utility_1.default.render(vc);
|
|
102
|
+
let didRefresh = false;
|
|
103
|
+
model.setRefreshPermissionsHandler(() => {
|
|
104
|
+
didRefresh = true;
|
|
105
|
+
});
|
|
106
|
+
await action();
|
|
107
|
+
test_utils_1.assert.isTrue(didRefresh, `I expected the action to refresh permissions but it did not! Make sure you are calling the 'setRefreshPermissionsHandler' function in your navigation's view model and that you call the provided function to trigger a permissions refresh.`);
|
|
108
|
+
},
|
|
89
109
|
};
|
|
90
110
|
exports.default = navigationAssert;
|
|
91
111
|
function getButtonFromNav(vc, id) {
|
|
@@ -30,7 +30,7 @@ import ListViewController, { ListViewControllerOptions } from '../viewController
|
|
|
30
30
|
import ListRowViewController from '../viewControllers/list/ListRow.vc';
|
|
31
31
|
import LoginCardViewController, { LoginCardViewControllerOptions } from '../viewControllers/LoginCard.vc';
|
|
32
32
|
import MapViewController, { MapViewControllerOptions } from '../viewControllers/Map.vc';
|
|
33
|
-
import NavigationViewController from '../viewControllers/navigation/Navigation.vc';
|
|
33
|
+
import NavigationViewController, { NavigationViewControllerOptions } from '../viewControllers/navigation/Navigation.vc';
|
|
34
34
|
import PagerViewController, { PagerViewControllerOptions } from '../viewControllers/pagers/Pager.vc';
|
|
35
35
|
import PolarAreaViewController, { PolarAreaViewControllerOptions } from '../viewControllers/PolarAreaViewController.vc';
|
|
36
36
|
import ProgressNavigatorViewController, { ProgressNavigatorViewControllerOptions } from '../viewControllers/progressNavigator/ProgressNavigator.vc';
|
|
@@ -403,7 +403,7 @@ export interface ViewControllerOptionsMap {
|
|
|
403
403
|
form: FormViewControllerOptions<any>;
|
|
404
404
|
list: ListViewControllerOptions;
|
|
405
405
|
map: MapViewControllerOptions;
|
|
406
|
-
navigation:
|
|
406
|
+
navigation: NavigationViewControllerOptions;
|
|
407
407
|
pager: PagerViewControllerOptions;
|
|
408
408
|
progress: ProgressViewControllerOptions;
|
|
409
409
|
ratings: RatingsViewControllerOptions;
|
|
@@ -667,3 +667,4 @@ export interface AppControllerLoadOptions {
|
|
|
667
667
|
export interface ChartViewController<ViewModel extends Record<string, any>> extends ViewController<ViewModel> {
|
|
668
668
|
setDataSets(dataSets: ChartDataSet[]): void;
|
|
669
669
|
}
|
|
670
|
+
export type RefreshNavigationPermissionsHandler = () => void | Promise<void>;
|
|
@@ -2,11 +2,14 @@ import { Navigation, NavigationButton, NavigationItem, ViewControllerOptions } f
|
|
|
2
2
|
import AbstractViewController from '../Abstract.vc';
|
|
3
3
|
export default class NavigationViewController extends AbstractViewController<Navigation> {
|
|
4
4
|
private model;
|
|
5
|
-
|
|
5
|
+
private refreshPermissionsHandler?;
|
|
6
|
+
constructor(options: ViewControllerOptions & NavigationViewControllerOptions);
|
|
6
7
|
hide(): void;
|
|
7
8
|
show(): void;
|
|
8
9
|
setButtons(buttons: NavigationButton[]): void;
|
|
9
10
|
setShouldRenderButtonLabels(shouldRender: boolean): void;
|
|
10
11
|
updateButton(id: string, updates: Partial<NavigationItem>): void;
|
|
12
|
+
refreshPermissions(): Promise<void>;
|
|
11
13
|
render(): Navigation;
|
|
12
14
|
}
|
|
15
|
+
export type NavigationViewControllerOptions = Omit<Navigation, 'setRefreshPermissionsHandler'>;
|
|
@@ -9,7 +9,12 @@ const Abstract_vc_1 = __importDefault(require("../Abstract.vc"));
|
|
|
9
9
|
class NavigationViewController extends Abstract_vc_1.default {
|
|
10
10
|
constructor(options) {
|
|
11
11
|
super(options);
|
|
12
|
-
this.model =
|
|
12
|
+
this.model = {
|
|
13
|
+
...(0, removeUniversalViewOptions_1.default)(options),
|
|
14
|
+
setRefreshPermissionsHandler: (cb) => {
|
|
15
|
+
this.refreshPermissionsHandler = cb;
|
|
16
|
+
},
|
|
17
|
+
};
|
|
13
18
|
}
|
|
14
19
|
hide() {
|
|
15
20
|
this.model.isVisible = false;
|
|
@@ -44,6 +49,9 @@ class NavigationViewController extends Abstract_vc_1.default {
|
|
|
44
49
|
buttons[idx] = button;
|
|
45
50
|
this.triggerRender();
|
|
46
51
|
}
|
|
52
|
+
async refreshPermissions() {
|
|
53
|
+
await this.refreshPermissionsHandler?.();
|
|
54
|
+
}
|
|
47
55
|
render() {
|
|
48
56
|
return { controller: this, ...this.model };
|
|
49
57
|
}
|
package/package.json
CHANGED