@singularsystems/neo-react 1.0.0-alpha.2 → 1.0.0-beta.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/CHANGELOG.md +98 -0
- package/README.md +4 -0
- package/dist/Modules/NeoReactModule.d.ts +4 -4
- package/dist/Modules/NeoReactModule.js +28 -26
- package/dist/Modules/ReactSetup.d.ts +2 -2
- package/dist/Modules/ReactSetup.js +17 -17
- package/dist/Modules/Types.d.ts +63 -61
- package/dist/Modules/Types.js +13 -12
- package/dist/React/AutoRunner.d.ts +5 -5
- package/dist/React/AutoRunner.js +94 -92
- package/dist/React/DataView.d.ts +6 -6
- package/dist/React/DataView.js +11 -11
- package/dist/React/ReactModelCreator.d.ts +11 -11
- package/dist/React/ReactModelCreator.js +165 -162
- package/dist/ReactComponents/Button.d.ts +24 -23
- package/dist/ReactComponents/Button.js +131 -123
- package/dist/ReactComponents/Card.d.ts +24 -23
- package/dist/ReactComponents/Card.js +56 -54
- package/dist/ReactComponents/Collapsable.d.ts +23 -23
- package/dist/ReactComponents/Collapsable.js +38 -38
- package/dist/ReactComponents/CollapsableBase.d.ts +13 -13
- package/dist/ReactComponents/CollapsableBase.js +42 -42
- package/dist/ReactComponents/ColorPicker.d.ts +26 -26
- package/dist/ReactComponents/ColorPicker.js +67 -67
- package/dist/ReactComponents/ComponentBase.d.ts +17 -17
- package/dist/ReactComponents/ComponentBase.js +33 -33
- package/dist/ReactComponents/ContextMenu/ContextMenu.d.ts +25 -24
- package/dist/ReactComponents/ContextMenu/ContextMenu.js +91 -88
- package/dist/ReactComponents/ContextMenu/ContextMenuContainer.d.ts +14 -14
- package/dist/ReactComponents/ContextMenu/ContextMenuContainer.js +48 -48
- package/dist/ReactComponents/ContextMenu/ContextMenuState.d.ts +8 -7
- package/dist/ReactComponents/ContextMenu/ContextMenuState.js +23 -23
- package/dist/ReactComponents/DatePicker.d.ts +19 -19
- package/dist/ReactComponents/DatePicker.js +53 -53
- package/dist/ReactComponents/DropDown/AutoCompleteDropDown.d.ts +93 -83
- package/dist/ReactComponents/DropDown/AutoCompleteDropDown.js +222 -188
- package/dist/ReactComponents/DropDown/DropDown.d.ts +44 -44
- package/dist/ReactComponents/DropDown/DropDown.js +138 -134
- package/dist/ReactComponents/DropDown/DropDownBase.d.ts +16 -15
- package/dist/ReactComponents/DropDown/DropDownBase.js +86 -108
- package/dist/ReactComponents/DropDown/LookupHelper.d.ts +13 -0
- package/dist/ReactComponents/DropDown/LookupHelper.js +45 -0
- package/dist/ReactComponents/ErrorHandler.d.ts +9 -8
- package/dist/ReactComponents/ErrorHandler.js +92 -91
- package/dist/ReactComponents/FileManager/FileBasicInput.d.ts +20 -20
- package/dist/ReactComponents/FileManager/FileBasicInput.js +70 -70
- package/dist/ReactComponents/FileManager/FileContext.d.ts +16 -16
- package/dist/ReactComponents/FileManager/FileContext.js +24 -24
- package/dist/ReactComponents/FileManager/FileDropArea.d.ts +19 -18
- package/dist/ReactComponents/FileManager/FileDropArea.js +66 -64
- package/dist/ReactComponents/FileManager/FileInput.d.ts +44 -42
- package/dist/ReactComponents/FileManager/FileInput.js +191 -189
- package/dist/ReactComponents/FileManager/FileUploadButton.d.ts +17 -17
- package/dist/ReactComponents/FileManager/FileUploadButton.js +49 -49
- package/dist/ReactComponents/FileManager/FileUploadProgress.d.ts +14 -14
- package/dist/ReactComponents/FileManager/FileUploadProgress.js +35 -35
- package/dist/ReactComponents/Form.d.ts +19 -18
- package/dist/ReactComponents/Form.js +90 -90
- package/dist/ReactComponents/FormContext.d.ts +33 -31
- package/dist/ReactComponents/FormContext.js +39 -40
- package/dist/ReactComponents/FormGroup/FormGroup.d.ts +37 -37
- package/dist/ReactComponents/FormGroup/FormGroup.js +83 -84
- package/dist/ReactComponents/FormGroup/FormGroupFloating.d.ts +19 -19
- package/dist/ReactComponents/FormGroup/FormGroupFloating.js +97 -97
- package/dist/ReactComponents/FormGroup/FormGroupInline.d.ts +11 -11
- package/dist/ReactComponents/FormGroup/FormGroupInline.js +43 -43
- package/dist/ReactComponents/Grid/ButtonColumn.d.ts +47 -47
- package/dist/ReactComponents/Grid/ButtonColumn.js +81 -82
- package/dist/ReactComponents/Grid/Column.d.ts +47 -47
- package/dist/ReactComponents/Grid/Column.js +205 -205
- package/dist/ReactComponents/Grid/ColumnHelper.d.ts +12 -12
- package/dist/ReactComponents/Grid/ColumnHelper.js +19 -19
- package/dist/ReactComponents/Grid/Grid.d.ts +87 -90
- package/dist/ReactComponents/Grid/Grid.js +203 -203
- package/dist/ReactComponents/Grid/Row.d.ts +81 -81
- package/dist/ReactComponents/Grid/Row.js +200 -201
- package/dist/ReactComponents/Grid/_Exports.d.ts +5 -5
- package/dist/ReactComponents/Grid/_Exports.js +5 -5
- package/dist/ReactComponents/GridLayout.d.ts +20 -20
- package/dist/ReactComponents/GridLayout.js +38 -38
- package/dist/ReactComponents/Icons/FontAwesomeIconFactory.d.ts +23 -0
- package/dist/ReactComponents/Icons/FontAwesomeIconFactory.js +43 -0
- package/dist/ReactComponents/Icons/IIconFactory.d.ts +21 -0
- package/dist/ReactComponents/Icons/IIconFactory.js +1 -0
- package/dist/ReactComponents/Icons/IconFactory.d.ts +9 -0
- package/dist/ReactComponents/Icons/IconFactory.js +45 -0
- package/dist/ReactComponents/Icons/index.d.ts +3 -0
- package/dist/ReactComponents/Icons/index.js +2 -0
- package/dist/ReactComponents/Input.d.ts +45 -45
- package/dist/ReactComponents/Input.js +153 -152
- package/dist/ReactComponents/InputHelpers.d.ts +6 -5
- package/dist/ReactComponents/InputHelpers.js +29 -33
- package/dist/ReactComponents/Link.d.ts +13 -13
- package/dist/ReactComponents/Link.js +28 -28
- package/dist/ReactComponents/Loader.d.ts +18 -18
- package/dist/ReactComponents/Loader.js +57 -57
- package/dist/ReactComponents/Misc.d.ts +15 -15
- package/dist/ReactComponents/Misc.js +28 -28
- package/dist/ReactComponents/Modal/Modal.d.ts +11 -11
- package/dist/ReactComponents/Modal/Modal.js +129 -129
- package/dist/ReactComponents/Modal/ModalContainer.d.ts +17 -17
- package/dist/ReactComponents/Modal/ModalContainer.js +37 -37
- package/dist/ReactComponents/Modal/ModalPortal.d.ts +16 -15
- package/dist/ReactComponents/Modal/ModalPortal.js +27 -27
- package/dist/ReactComponents/Notifications/Alert.d.ts +7 -6
- package/dist/ReactComponents/Notifications/Alert.js +38 -35
- package/dist/ReactComponents/Notifications/Toast.d.ts +9 -8
- package/dist/ReactComponents/Notifications/Toast.js +47 -45
- package/dist/ReactComponents/Notifications/ToastContainer.d.ts +8 -8
- package/dist/ReactComponents/Notifications/ToastContainer.js +18 -18
- package/dist/ReactComponents/NumberInput.d.ts +57 -50
- package/dist/ReactComponents/NumberInput.js +260 -246
- package/dist/ReactComponents/Paging/BasicPagerControls.d.ts +26 -25
- package/dist/ReactComponents/Paging/BasicPagerControls.js +57 -55
- package/dist/ReactComponents/Paging/PageSizeControl.d.ts +11 -11
- package/dist/ReactComponents/Paging/PageSizeControl.js +21 -21
- package/dist/ReactComponents/Paging/Pager.d.ts +24 -24
- package/dist/ReactComponents/Paging/Pager.js +41 -41
- package/dist/ReactComponents/ProgressBar.d.ts +19 -19
- package/dist/ReactComponents/ProgressBar.js +52 -52
- package/dist/ReactComponents/PropTypes.d.ts +161 -161
- package/dist/ReactComponents/PropTypes.js +253 -236
- package/dist/ReactComponents/RadioList.d.ts +29 -29
- package/dist/ReactComponents/RadioList.js +59 -77
- package/dist/ReactComponents/Slider.d.ts +28 -28
- package/dist/ReactComponents/Slider.js +76 -76
- package/dist/ReactComponents/StateObserver.d.ts +15 -15
- package/dist/ReactComponents/StateObserver.js +35 -35
- package/dist/ReactComponents/Tabs/Tab.d.ts +42 -41
- package/dist/ReactComponents/Tabs/Tab.js +71 -72
- package/dist/ReactComponents/Tabs/TabContainer.d.ts +44 -44
- package/dist/ReactComponents/Tabs/TabContainer.js +98 -98
- package/dist/ReactComponents/Tabs/TabManager.d.ts +62 -62
- package/dist/ReactComponents/Tabs/TabManager.js +154 -154
- package/dist/ReactComponents/Tooltip.d.ts +20 -19
- package/dist/ReactComponents/Tooltip.js +51 -51
- package/dist/ReactComponents/TooltipHelper.d.ts +8 -8
- package/dist/ReactComponents/TooltipHelper.js +84 -84
- package/dist/ReactComponents/TooltipProvider.d.ts +30 -30
- package/dist/ReactComponents/TooltipProvider.js +111 -111
- package/dist/ReactComponents/ValidationSummary.d.ts +23 -22
- package/dist/ReactComponents/ValidationSummary.js +46 -43
- package/dist/ReactComponents/_Exports.d.ts +41 -41
- package/dist/ReactComponents/_Exports.js +41 -41
- package/dist/ReactComponents/_Managers.d.ts +4 -4
- package/dist/ReactComponents/_Managers.js +4 -4
- package/dist/Routing/BreadCrumbItem.d.ts +14 -14
- package/dist/Routing/BreadCrumbItem.js +12 -12
- package/dist/Routing/IRouteChangedProps.d.ts +31 -31
- package/dist/Routing/IRouteChangedProps.js +1 -1
- package/dist/Routing/IRouteParameter.d.ts +22 -22
- package/dist/Routing/IRouteParameter.js +9 -9
- package/dist/Routing/MenuRoute.d.ts +25 -24
- package/dist/Routing/MenuRoute.js +24 -24
- package/dist/Routing/NavigationHelper.d.ts +41 -40
- package/dist/Routing/NavigationHelper.js +61 -61
- package/dist/Routing/PageLeaveHandler.d.ts +13 -13
- package/dist/Routing/PageLeaveHandler.js +74 -74
- package/dist/Routing/RouteProvider.d.ts +31 -31
- package/dist/Routing/RouteProvider.js +92 -92
- package/dist/Routing/RouteView.d.ts +50 -50
- package/dist/Routing/RouteView.js +143 -144
- package/dist/Routing/RoutingState.d.ts +18 -15
- package/dist/Routing/RoutingState.js +45 -40
- package/dist/Routing/ViewParameter.d.ts +80 -58
- package/dist/Routing/ViewParameter.js +116 -95
- package/dist/Routing/ViewParameterList.d.ts +53 -53
- package/dist/Routing/ViewParameterList.js +163 -145
- package/dist/Routing/index.d.ts +9 -9
- package/dist/Routing/index.js +6 -6
- package/dist/Services/DisposeHelper.d.ts +15 -15
- package/dist/Services/DisposeHelper.js +40 -41
- package/dist/Services/IDisposeHelper.d.ts +12 -12
- package/dist/Services/IDisposeHelper.js +1 -1
- package/dist/Views/EmptyViewModel.d.ts +5 -5
- package/dist/Views/EmptyViewModel.js +14 -14
- package/dist/Views/IViewModel.d.ts +16 -16
- package/dist/Views/IViewModel.js +1 -1
- package/dist/Views/PersistentViewBase.d.ts +10 -10
- package/dist/Views/PersistentViewBase.js +21 -21
- package/dist/Views/ViewBase.d.ts +70 -71
- package/dist/Views/ViewBase.js +166 -153
- package/dist/Views/ViewComponentBase.d.ts +19 -13
- package/dist/Views/ViewComponentBase.js +24 -21
- package/dist/Views/ViewModelBase.d.ts +57 -56
- package/dist/Views/ViewModelBase.js +122 -118
- package/dist/Views/ViewState.d.ts +13 -13
- package/dist/Views/ViewState.js +9 -9
- package/dist/Views/index.d.ts +5 -5
- package/dist/Views/index.js +5 -5
- package/dist/index.d.ts +11 -10
- package/dist/index.js +10 -9
- package/package.json +26 -26
- package/styles/DatePicker.scss +2 -2
- package/styles/Forms.scss +5 -0
- package/styles/Validation.scss +0 -9
|
@@ -1,144 +1,143 @@
|
|
|
1
|
-
import { __extends } from "tslib";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { matchPath } from 'react-router';
|
|
4
|
-
import { AppServices, Misc } from '@singularsystems/neo-core';
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
_this.
|
|
13
|
-
_this.
|
|
14
|
-
_this.
|
|
15
|
-
_this.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
this.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* @param
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
var
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
_this.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
*
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
export default RouteView;
|
|
1
|
+
import { __extends } from "tslib";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { matchPath } from 'react-router';
|
|
4
|
+
import { AppServices, Misc } from '@singularsystems/neo-core';
|
|
5
|
+
import { NeoReactTypes } from '../Modules/Types';
|
|
6
|
+
import { Observer } from 'mobx-react';
|
|
7
|
+
var RouteView = /** @class */ (function (_super) {
|
|
8
|
+
__extends(RouteView, _super);
|
|
9
|
+
function RouteView(props) {
|
|
10
|
+
var _this = _super.call(this, props) || this;
|
|
11
|
+
_this.securityService = Misc.Globals.appService.get(AppServices.NeoTypes.Security.SecurityService);
|
|
12
|
+
_this.routeSecurityService = Misc.Globals.appService.get(AppServices.NeoTypes.Routing.RouteSecurityService);
|
|
13
|
+
_this.routingState = Misc.Globals.appService.get(NeoReactTypes.Routing.GlobalRoutingState);
|
|
14
|
+
_this.state = {};
|
|
15
|
+
_this.routingState.currentRouteView = _this;
|
|
16
|
+
return _this;
|
|
17
|
+
}
|
|
18
|
+
Object.defineProperty(RouteView.prototype, "routes", {
|
|
19
|
+
get: function () {
|
|
20
|
+
return this._routes;
|
|
21
|
+
},
|
|
22
|
+
set: function (value) {
|
|
23
|
+
this._routes = value;
|
|
24
|
+
this.routingState.appRouteProvider = value;
|
|
25
|
+
},
|
|
26
|
+
enumerable: false,
|
|
27
|
+
configurable: true
|
|
28
|
+
});
|
|
29
|
+
RouteView.prototype.componentDidMount = function () {
|
|
30
|
+
this.historyBlockDisposer = this.props.history.block(this.beforeLocationChanged.bind(this));
|
|
31
|
+
this.routingState.onRouteChanged();
|
|
32
|
+
};
|
|
33
|
+
RouteView.prototype.componentDidUpdate = function () {
|
|
34
|
+
this.routingState.onRouteChanged();
|
|
35
|
+
};
|
|
36
|
+
RouteView.prototype.componentWillUnmount = function () {
|
|
37
|
+
if (this.historyListenDisposer) {
|
|
38
|
+
this.historyListenDisposer();
|
|
39
|
+
}
|
|
40
|
+
if (this.historyBlockDisposer) {
|
|
41
|
+
this.historyBlockDisposer();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
RouteView.prototype.beforeLocationChanged = function (location, action, isUnload) {
|
|
45
|
+
var _a;
|
|
46
|
+
var currentRoute = this.routingState.currentRoute;
|
|
47
|
+
var match = location ? this.getMatch(location) : undefined;
|
|
48
|
+
var changeProps = {
|
|
49
|
+
isNewView: !currentRoute || !match || match.route !== currentRoute,
|
|
50
|
+
isUnload: isUnload !== null && isUnload !== void 0 ? isUnload : false,
|
|
51
|
+
currentView: (_a = this.routingState.currentView) !== null && _a !== void 0 ? _a : undefined,
|
|
52
|
+
newRoute: match === null || match === void 0 ? void 0 : match.route,
|
|
53
|
+
match: match === null || match === void 0 ? void 0 : match.match
|
|
54
|
+
};
|
|
55
|
+
if (this.routingState.currentView) {
|
|
56
|
+
this.routingState.currentView.beforeRouteChanged(changeProps);
|
|
57
|
+
if (changeProps.leavePrompt === undefined && (changeProps.isNewView || changeProps.isUnload)) {
|
|
58
|
+
changeProps.leavePrompt = this.routingState.currentView.onLeave();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
this.beforeRouteChanged(changeProps);
|
|
62
|
+
if (changeProps.leavePrompt === undefined) {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
else if (typeof changeProps.leavePrompt === "string") {
|
|
66
|
+
return changeProps.leavePrompt;
|
|
67
|
+
}
|
|
68
|
+
else if (changeProps.leavePrompt === false) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
this.routingState.leavePromise = changeProps.leavePrompt;
|
|
73
|
+
return "";
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Called when the url changes, before the router renders the new view.
|
|
78
|
+
* Return a string to block navigation.
|
|
79
|
+
* @param isNewView True if the view is changing. False if a view parameter value is changing.
|
|
80
|
+
* @param currentView The current view before change.
|
|
81
|
+
*/
|
|
82
|
+
RouteView.prototype.beforeRouteChanged = function (props) {
|
|
83
|
+
};
|
|
84
|
+
RouteView.prototype.getMatch = function (location) {
|
|
85
|
+
for (var _i = 0, _a = this._routes.flattenedRoutes; _i < _a.length; _i++) {
|
|
86
|
+
var route = _a[_i];
|
|
87
|
+
var match = matchPath(location.pathname, { path: route.routePath, exact: RouteView.isExact(route) });
|
|
88
|
+
if (match) {
|
|
89
|
+
return { match: match, route: route };
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
};
|
|
94
|
+
RouteView.isExact = function (route) {
|
|
95
|
+
if (route.exact === undefined) {
|
|
96
|
+
return route.path === "/" || (route.path !== undefined && route.children !== undefined);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
return route.exact;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
RouteView.prototype.render = function () {
|
|
103
|
+
var _this = this;
|
|
104
|
+
return React.createElement(this.switchComponent, {}, [this.routes.flattenedRoutes.map(function (route) { return (React.createElement(_this.routeComponent, { key: route.key, path: route.routePath, exact: RouteView.isExact(route),
|
|
105
|
+
render: function (props) {
|
|
106
|
+
_this.routingState.setCurrentRoute(props, route);
|
|
107
|
+
return React.createElement(Observer, null, function () { return _this.getRouteComponent(route, props.location.pathname + props.location.search); });
|
|
108
|
+
} })); })]);
|
|
109
|
+
};
|
|
110
|
+
RouteView.prototype.getRouteComponent = function (route, path) {
|
|
111
|
+
if (!route.allowAnonymous) {
|
|
112
|
+
if (this.securityService.isAuthenticated) {
|
|
113
|
+
if (!this.isAuthorised(route)) {
|
|
114
|
+
//Render forbidden
|
|
115
|
+
return this.getForbiddenComponent(route);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
//Redirect
|
|
120
|
+
void this.securityService.authentication.beginSignIn(path);
|
|
121
|
+
return this.getSigningInComponent(route);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return this.getAuthorisedComponent(route, path);
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Creates the routes component after authentication and authorisation checks have been done.
|
|
128
|
+
* This can be used to override all routes to display pages like terms and conditions.
|
|
129
|
+
* To redirect to a route, return a react router <Redirect to= /> component.
|
|
130
|
+
*/
|
|
131
|
+
RouteView.prototype.getAuthorisedComponent = function (route, path) {
|
|
132
|
+
return React.createElement(route.component, null);
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Checks if the user is authorised to access this route.
|
|
136
|
+
* Component from getForbiddenComponent() is returned if not.
|
|
137
|
+
*/
|
|
138
|
+
RouteView.prototype.isAuthorised = function (route) {
|
|
139
|
+
return this.routeSecurityService.routeAllowed(route);
|
|
140
|
+
};
|
|
141
|
+
return RouteView;
|
|
142
|
+
}(React.Component));
|
|
143
|
+
export default RouteView;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import { Misc } from '@singularsystems/neo-core';
|
|
2
|
-
import { RouteComponentProps } from 'react-router-dom';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { Misc } from '@singularsystems/neo-core';
|
|
2
|
+
import { RouteComponentProps } from 'react-router-dom';
|
|
3
|
+
import { IViewBase } from '../Views/ViewBase';
|
|
4
|
+
import RouteProvider, { IProcessedRoute } from './RouteProvider';
|
|
5
|
+
import RouteView from './RouteView';
|
|
6
|
+
export declare class RoutingState {
|
|
7
|
+
appRouteProvider: RouteProvider;
|
|
8
|
+
currentRouteProps: RouteComponentProps;
|
|
9
|
+
currentRoute?: IProcessedRoute;
|
|
10
|
+
currentRouteView?: RouteView;
|
|
11
|
+
leavePromise?: Promise<boolean> | Promise<Misc.ModalResult> | Promise<void>;
|
|
12
|
+
observableRoute: IProcessedRoute | null;
|
|
13
|
+
currentView: IViewBase | null;
|
|
14
|
+
constructor();
|
|
15
|
+
setCurrentRoute(routeProps: RouteComponentProps, route: IProcessedRoute): void;
|
|
16
|
+
private previousRoute?;
|
|
17
|
+
onRouteChanged(): void;
|
|
18
|
+
}
|
|
@@ -1,40 +1,45 @@
|
|
|
1
|
-
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import { injectable } from 'inversify';
|
|
3
|
-
import { observable } from 'mobx';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
this.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
this.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
RoutingState
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { injectable } from 'inversify';
|
|
3
|
+
import { makeObservable, observable } from 'mobx';
|
|
4
|
+
export var RoutingState = /** @class */ (function () {
|
|
5
|
+
function RoutingState() {
|
|
6
|
+
this.observableRoute = null;
|
|
7
|
+
this.currentView = null;
|
|
8
|
+
makeObservable(this);
|
|
9
|
+
}
|
|
10
|
+
RoutingState.prototype.setCurrentRoute = function (routeProps, route) {
|
|
11
|
+
this.currentRouteProps = routeProps;
|
|
12
|
+
this.currentRoute = route;
|
|
13
|
+
};
|
|
14
|
+
RoutingState.prototype.onRouteChanged = function () {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
if (this.previousRoute !== this.currentRoute) {
|
|
17
|
+
this.previousRoute = this.currentRoute;
|
|
18
|
+
this.observableRoute = (_a = this.currentRoute) !== null && _a !== void 0 ? _a : null;
|
|
19
|
+
if (((_b = this.currentView) === null || _b === void 0 ? void 0 : _b.constructor) !== this.currentRoute.component) {
|
|
20
|
+
this.currentView = null;
|
|
21
|
+
}
|
|
22
|
+
// Scroll back to top as if the browser had actually loaded a new page.
|
|
23
|
+
window.scrollTo(0, 0);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
// Same route, but parameters must have changed.
|
|
27
|
+
if (this.currentView) {
|
|
28
|
+
this.currentView.updateViewParams(this.currentRouteProps.match);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
__decorate([
|
|
33
|
+
observable.ref,
|
|
34
|
+
__metadata("design:type", Object)
|
|
35
|
+
], RoutingState.prototype, "observableRoute", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
observable.ref,
|
|
38
|
+
__metadata("design:type", Object)
|
|
39
|
+
], RoutingState.prototype, "currentView", void 0);
|
|
40
|
+
RoutingState = __decorate([
|
|
41
|
+
injectable(),
|
|
42
|
+
__metadata("design:paramtypes", [])
|
|
43
|
+
], RoutingState);
|
|
44
|
+
return RoutingState;
|
|
45
|
+
}());
|
|
@@ -1,58 +1,80 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IRouteParameter } from './IRouteParameter';
|
|
3
|
+
import { IViewParameterListInternal } from './ViewParameterList';
|
|
4
|
+
import { Model } from '@singularsystems/neo-core';
|
|
5
|
+
export interface IViewParameter {
|
|
6
|
+
/**
|
|
7
|
+
* Gets or sets the current parameter value.
|
|
8
|
+
*/
|
|
9
|
+
value: number | string | null;
|
|
10
|
+
/**
|
|
11
|
+
* Clears the value, replacing the url instead of adding to the history.
|
|
12
|
+
* This prevents the back button returning the params to the current state.
|
|
13
|
+
*/
|
|
14
|
+
reset(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Gets or sets the description which corresponds with the value.
|
|
17
|
+
* Used by the breadcrumb.
|
|
18
|
+
*/
|
|
19
|
+
description: string;
|
|
20
|
+
/**
|
|
21
|
+
* Sets the description, and an optional list of prefixes.
|
|
22
|
+
* @param description Description of the current value.
|
|
23
|
+
* @param prefixes Function that returns prefixes for this breadcrumb item. The previous prefixes are passed into the function.
|
|
24
|
+
*/
|
|
25
|
+
setDescription(description: string, getPrefixes?: (currentPrefixes: IViewParameterPrefix[]) => IViewParameterPrefix[]): void;
|
|
26
|
+
/**
|
|
27
|
+
* Returns value as a nullable int.
|
|
28
|
+
*/
|
|
29
|
+
asNullableInt(): number | null;
|
|
30
|
+
/**
|
|
31
|
+
* Returns the value as a string. String will be empty if the underlying value is null.
|
|
32
|
+
*/
|
|
33
|
+
asString(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Allows this view parameter to automatically update when the provided properties value changes.
|
|
36
|
+
* This is one way, you will still need to set the property value in viewParamsUpdated()
|
|
37
|
+
*/
|
|
38
|
+
bindTo(property: Model.IPropertyInstance): void;
|
|
39
|
+
/**
|
|
40
|
+
* Allows this view parameter to automatically update when the value returned in the provided callback changes.
|
|
41
|
+
*/
|
|
42
|
+
bindTo(callback: () => (string | number | null | undefined)): void;
|
|
43
|
+
}
|
|
44
|
+
export declare class ViewParameter implements IViewParameter {
|
|
45
|
+
private parent;
|
|
46
|
+
name: string;
|
|
47
|
+
routeParameter: IRouteParameter;
|
|
48
|
+
private hasPendingValue;
|
|
49
|
+
private pendingValue;
|
|
50
|
+
private _value;
|
|
51
|
+
prefixes: IViewParameterPrefix[];
|
|
52
|
+
constructor(parent: IViewParameterListInternal, name: string, routeParameter: IRouteParameter);
|
|
53
|
+
bindTo(propertyOrCallback: Model.IPropertyInstance | (() => (string | number | null | undefined))): void;
|
|
54
|
+
get value(): number | string | null;
|
|
55
|
+
set value(value: number | string | null);
|
|
56
|
+
reset(): void;
|
|
57
|
+
_description: string;
|
|
58
|
+
get description(): string;
|
|
59
|
+
set description(value: string);
|
|
60
|
+
setDescription(description: string, getPrefixes?: (currentPrefixes: IViewParameterPrefix[]) => IViewParameterPrefix[]): void;
|
|
61
|
+
asNullableInt(): number | null;
|
|
62
|
+
asString(): string;
|
|
63
|
+
/** Updates the current value, and returns true if the value changed. */
|
|
64
|
+
update(value: string | null): boolean;
|
|
65
|
+
getParamString(state: {
|
|
66
|
+
hasQuery: boolean;
|
|
67
|
+
}): string;
|
|
68
|
+
get latestValue(): string | null;
|
|
69
|
+
}
|
|
70
|
+
interface IViewParameterPrefix {
|
|
71
|
+
/** Label to show on breadcrumb. */
|
|
72
|
+
label: string;
|
|
73
|
+
/** Value to use in the breadcrumb link. Clicking on the link will set the view parameter to this value. */
|
|
74
|
+
value?: number | string | null;
|
|
75
|
+
/** Custom link to use in the breadcrumb. */
|
|
76
|
+
link?: string;
|
|
77
|
+
/** Click event for the breadcrumb. */
|
|
78
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
79
|
+
}
|
|
80
|
+
export {};
|