@singularsystems/neo-react 1.0.22 → 1.1.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 +15 -1
- package/README.md +1 -1
- package/dist/Modules/NeoReactModule.js +1 -1
- package/dist/Modules/ReactSetup.js +1 -5
- package/dist/Modules/Types.d.ts +3 -2
- package/dist/Modules/Types.js +1 -1
- package/dist/React/ReactModelCreator.js +1 -1
- package/dist/ReactComponents/FileManager/FileInput.js +3 -1
- package/dist/ReactComponents/Form.js +3 -5
- package/dist/ReactComponents/Grid/Grid.js +7 -9
- package/dist/ReactComponents/IColorPicker.d.ts +0 -1
- package/dist/ReactComponents/Icons/IIconFactory.d.ts +0 -1
- package/dist/ReactComponents/Icons/Icon.js +1 -1
- package/dist/ReactComponents/Link.d.ts +7 -0
- package/dist/ReactComponents/Link.js +39 -6
- package/dist/ReactComponents/Modal/Modal.js +2 -2
- package/dist/ReactComponents/StateObserver.d.ts +0 -1
- package/dist/ReactComponents/Tabs/Tab.js +5 -1
- package/dist/ReactComponents/Tabs/TabContainer.d.ts +6 -2
- package/dist/ReactComponents/Tabs/TabContainer.js +25 -17
- package/dist/ReactComponents/Tabs/TabManager.d.ts +0 -12
- package/dist/ReactComponents/Tabs/TabManager.js +3 -3
- package/dist/ReactComponents/Transitions/Transition.d.ts +10 -0
- package/dist/ReactComponents/Transitions/Transition.js +13 -0
- package/dist/ReactComponents/Transitions/TransitionContainer.d.ts +22 -0
- package/dist/ReactComponents/Transitions/TransitionContainer.js +34 -0
- package/dist/ReactComponents/Transitions/TransitionController.d.ts +33 -0
- package/dist/ReactComponents/Transitions/TransitionController.js +231 -0
- package/dist/ReactComponents/Transitions/TransitionPanel.d.ts +37 -0
- package/dist/ReactComponents/Transitions/TransitionPanel.js +64 -0
- package/dist/ReactComponents/Transitions/TransitionReplacer.d.ts +15 -0
- package/dist/ReactComponents/Transitions/TransitionReplacer.js +52 -0
- package/dist/ReactComponents/Transitions/TransitionSwitcher.d.ts +15 -0
- package/dist/ReactComponents/Transitions/TransitionSwitcher.js +55 -0
- package/dist/ReactComponents/Transitions/_Exports.d.ts +2 -0
- package/dist/ReactComponents/Transitions/_Exports.js +2 -0
- package/dist/ReactComponents/_Exports.d.ts +3 -1
- package/dist/ReactComponents/_Exports.js +3 -1
- package/dist/Routing/BreadCrumbItem.d.ts +0 -1
- package/dist/Routing/IRouteChangedProps.d.ts +5 -3
- package/dist/Routing/NavigationHelper.d.ts +9 -8
- package/dist/Routing/NavigationHelper.js +121 -25
- package/dist/Routing/PageLeaveHandler.d.ts +26 -9
- package/dist/Routing/PageLeaveHandler.js +16 -39
- package/dist/Routing/RouteProvider.d.ts +28 -7
- package/dist/Routing/RouteProvider.js +81 -42
- package/dist/Routing/RouteView.d.ts +5 -27
- package/dist/Routing/RouteView.js +18 -92
- package/dist/Routing/RoutingState.d.ts +10 -13
- package/dist/Routing/RoutingState.js +35 -18
- package/dist/Routing/ViewParameter.d.ts +0 -1
- package/dist/Routing/ViewParameterList.d.ts +0 -7
- package/dist/Routing/ViewParameterList.js +3 -5
- package/dist/Views/ViewBase.d.ts +4 -4
- package/dist/Views/ViewBase.js +6 -5
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/package.json +19 -26
- package/styles/Button.scss +6 -0
- package/styles/DatePicker.scss +3 -1
- package/styles/Forms.scss +3 -1
- package/styles/Grid.scss +4 -0
- package/styles/Misc.scss +25 -0
|
@@ -1,113 +1,39 @@
|
|
|
1
1
|
import { __extends } from "tslib";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { matchPath } from 'react-router';
|
|
4
3
|
import { AppServices, Misc } from '@singularsystems/neo-core';
|
|
5
4
|
import { NeoReactTypes } from '../Modules/Types';
|
|
6
|
-
import {
|
|
5
|
+
import { reaction } from "mobx";
|
|
7
6
|
var RouteView = /** @class */ (function (_super) {
|
|
8
7
|
__extends(RouteView, _super);
|
|
9
|
-
function RouteView(props) {
|
|
8
|
+
function RouteView(props, routeProvider) {
|
|
10
9
|
var _this = _super.call(this, props) || this;
|
|
10
|
+
_this.routeProvider = routeProvider;
|
|
11
|
+
_this.hasMounted = false;
|
|
11
12
|
_this.securityService = Misc.Globals.appService.get(AppServices.NeoTypes.Security.SecurityService);
|
|
12
13
|
_this.routeSecurityService = Misc.Globals.appService.get(AppServices.NeoTypes.Routing.RouteSecurityService);
|
|
13
14
|
_this.routingState = Misc.Globals.appService.get(NeoReactTypes.Routing.GlobalRoutingState);
|
|
14
15
|
_this.state = {};
|
|
15
|
-
_this.routingState.
|
|
16
|
+
_this.routingState.appRouteProvider = routeProvider;
|
|
17
|
+
reaction(function () { return _this.routingState.currentRouteBase; }, function () { return _this.forceUpdate(); });
|
|
16
18
|
return _this;
|
|
17
19
|
}
|
|
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
20
|
RouteView.prototype.componentDidMount = function () {
|
|
30
|
-
this.
|
|
31
|
-
this.routingState.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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;
|
|
21
|
+
this.hasMounted = true;
|
|
22
|
+
var basePath = this.routingState.basePath;
|
|
23
|
+
var path = window.location.pathname + window.location.search;
|
|
24
|
+
if (basePath && !window.location.pathname.startsWith(basePath)) {
|
|
25
|
+
console.warn("Base path is ".concat(basePath, " but the app is being served at ").concat(window.location.pathname, "."));
|
|
100
26
|
}
|
|
27
|
+
Misc.Globals.appService.get(NeoReactTypes.Routing.NavigationHelper).navigateInternal(path, true);
|
|
101
28
|
};
|
|
102
29
|
RouteView.prototype.render = function () {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
_this.routingState.setCurrentRoute(props, route);
|
|
107
|
-
return React.createElement(Observer, null, function () { return _this.getRouteComponent(route, props.location.pathname + props.location.search); });
|
|
108
|
-
} })); })]);
|
|
30
|
+
return this.routingState.currentRoute ?
|
|
31
|
+
this.getRouteComponent(this.routingState.currentRoute) :
|
|
32
|
+
(this.hasMounted && this.routeProvider.notFoundComponent ? React.createElement(this.routeProvider.notFoundComponent) : null);
|
|
109
33
|
};
|
|
110
|
-
RouteView.prototype.getRouteComponent = function (
|
|
34
|
+
RouteView.prototype.getRouteComponent = function (match) {
|
|
35
|
+
var route = match.route;
|
|
36
|
+
var path = match.path + window.location.search;
|
|
111
37
|
if (!route.allowAnonymous) {
|
|
112
38
|
if (this.securityService.isAuthenticated) {
|
|
113
39
|
if (!this.isAuthorised(route)) {
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { RouteComponentProps } from 'react-router-dom';
|
|
1
|
+
import { AppServices } from '@singularsystems/neo-core';
|
|
3
2
|
import { IViewBase } from '../Views/ViewBase';
|
|
4
|
-
import RouteProvider, { IProcessedRoute } from './RouteProvider';
|
|
5
|
-
import RouteView from './RouteView';
|
|
3
|
+
import RouteProvider, { IMatchedRoute, IProcessedRoute } from './RouteProvider';
|
|
6
4
|
export declare class RoutingState {
|
|
5
|
+
constructor(config: AppServices.IConfigModel);
|
|
6
|
+
readonly basePath: string;
|
|
7
7
|
appRouteProvider: RouteProvider;
|
|
8
|
-
|
|
9
|
-
currentRoute
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
/** Gets the route which last matched */
|
|
9
|
+
currentRoute: IMatchedRoute | null;
|
|
10
|
+
/** Base route which last matched. This will not change when view parameters are updated. */
|
|
11
|
+
currentRouteBase: IProcessedRoute | null;
|
|
12
|
+
direction: number;
|
|
13
|
+
/** Returns the current view instance. */
|
|
13
14
|
currentView: IViewBase | null;
|
|
14
15
|
get currentViewFullScreen(): boolean;
|
|
15
16
|
get taskRunner(): import("@singularsystems/neo-core").ITaskRunner | undefined;
|
|
16
|
-
constructor();
|
|
17
|
-
setCurrentRoute(routeProps: RouteComponentProps, route: IProcessedRoute): void;
|
|
18
|
-
private previousRoute?;
|
|
19
|
-
onRouteChanged(): void;
|
|
20
17
|
}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { __decorate, __metadata, __param } from "tslib";
|
|
2
|
+
import { AppServices } from '@singularsystems/neo-core';
|
|
3
|
+
import { inject, injectable } from 'inversify';
|
|
4
|
+
import { computed, makeObservable, observable, runInAction } from 'mobx';
|
|
4
5
|
var RoutingState = /** @class */ (function () {
|
|
5
|
-
function RoutingState() {
|
|
6
|
-
|
|
6
|
+
function RoutingState(config) {
|
|
7
|
+
/** Gets the route which last matched */
|
|
8
|
+
this.currentRoute = null;
|
|
9
|
+
/** Base route which last matched. This will not change when view parameters are updated. */
|
|
10
|
+
this.currentRouteBase = null;
|
|
11
|
+
this.direction = 0;
|
|
12
|
+
/** Returns the current view instance. */
|
|
7
13
|
this.currentView = null;
|
|
8
14
|
makeObservable(this);
|
|
15
|
+
this.basePath = config.baseUrl;
|
|
9
16
|
}
|
|
10
17
|
Object.defineProperty(RoutingState.prototype, "currentViewFullScreen", {
|
|
11
18
|
get: function () {
|
|
@@ -23,16 +30,21 @@ var RoutingState = /** @class */ (function () {
|
|
|
23
30
|
enumerable: false,
|
|
24
31
|
configurable: true
|
|
25
32
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
};
|
|
30
|
-
RoutingState.prototype.onRouteChanged = function () {
|
|
33
|
+
/** @internal */
|
|
34
|
+
RoutingState.prototype.updateRoute = function (match) {
|
|
35
|
+
var _this = this;
|
|
31
36
|
var _a, _b;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
var prevRoute = (_a = this.currentRoute) === null || _a === void 0 ? void 0 : _a.route;
|
|
38
|
+
runInAction(function () {
|
|
39
|
+
var _a;
|
|
40
|
+
_this.currentRoute = match;
|
|
41
|
+
_this.currentRouteBase = (_a = match === null || match === void 0 ? void 0 : match.route) !== null && _a !== void 0 ? _a : null;
|
|
42
|
+
});
|
|
43
|
+
if (prevRoute !== (match === null || match === void 0 ? void 0 : match.route)) {
|
|
44
|
+
var prevIndex = prevRoute ? this.appRouteProvider.allRoutes.indexOf(prevRoute) : -1;
|
|
45
|
+
var newIndex = match ? this.appRouteProvider.allRoutes.indexOf(match.route) : -1;
|
|
46
|
+
this.direction = newIndex - prevIndex;
|
|
47
|
+
if (((_b = this.currentView) === null || _b === void 0 ? void 0 : _b.constructor) !== (match === null || match === void 0 ? void 0 : match.route.component)) {
|
|
36
48
|
this.currentView = null;
|
|
37
49
|
}
|
|
38
50
|
// Scroll back to top as if the browser had actually loaded a new page.
|
|
@@ -40,15 +52,19 @@ var RoutingState = /** @class */ (function () {
|
|
|
40
52
|
}
|
|
41
53
|
else {
|
|
42
54
|
// Same route, but parameters must have changed.
|
|
43
|
-
if (this.currentView) {
|
|
44
|
-
this.currentView.updateViewParams(this.
|
|
55
|
+
if (this.currentView && this.currentRoute) {
|
|
56
|
+
this.currentView.updateViewParams(this.currentRoute);
|
|
45
57
|
}
|
|
46
58
|
}
|
|
47
59
|
};
|
|
48
60
|
__decorate([
|
|
49
61
|
observable.ref,
|
|
50
62
|
__metadata("design:type", Object)
|
|
51
|
-
], RoutingState.prototype, "
|
|
63
|
+
], RoutingState.prototype, "currentRoute", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
observable.ref,
|
|
66
|
+
__metadata("design:type", Object)
|
|
67
|
+
], RoutingState.prototype, "currentRouteBase", void 0);
|
|
52
68
|
__decorate([
|
|
53
69
|
observable.ref,
|
|
54
70
|
__metadata("design:type", Object)
|
|
@@ -65,7 +81,8 @@ var RoutingState = /** @class */ (function () {
|
|
|
65
81
|
], RoutingState.prototype, "taskRunner", null);
|
|
66
82
|
RoutingState = __decorate([
|
|
67
83
|
injectable(),
|
|
68
|
-
|
|
84
|
+
__param(0, inject(AppServices.NeoTypes.Config.ConfigModel.symbol)),
|
|
85
|
+
__metadata("design:paramtypes", [Object])
|
|
69
86
|
], RoutingState);
|
|
70
87
|
return RoutingState;
|
|
71
88
|
}());
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ViewParameter, IViewParameter } from './ViewParameter';
|
|
2
2
|
import { RouteParameterObject } from './IRouteParameter';
|
|
3
|
-
import { match } from 'react-router';
|
|
4
3
|
import { BreadCrumbItem } from './BreadCrumbItem';
|
|
5
4
|
import { IViewBase } from '../Views/ViewBase';
|
|
6
5
|
import { ParamValues } from "./NavigationHelper";
|
|
@@ -29,10 +28,8 @@ export interface IViewParameterListOfT<TParams extends RouteParameterObject<TPar
|
|
|
29
28
|
}, options?: ISetValuesOptions | boolean): void;
|
|
30
29
|
}
|
|
31
30
|
export interface IViewParameterListInternal extends IViewParameterList {
|
|
32
|
-
update(match: match): boolean;
|
|
33
31
|
setUrl(viewParameter: ViewParameter | null, replace?: boolean): void;
|
|
34
32
|
view?: IViewBase;
|
|
35
|
-
readonly params: ViewParameter[];
|
|
36
33
|
}
|
|
37
34
|
export declare class ViewParameterList<TParams extends RouteParameterObject<TParams>> implements IViewParameterListInternal, IViewParameterListOfT<TParams> {
|
|
38
35
|
readonly view?: IViewBase | undefined;
|
|
@@ -46,10 +43,6 @@ export declare class ViewParameterList<TParams extends RouteParameterObject<TPar
|
|
|
46
43
|
[P in keyof TParams]?: number | string | string[] | null;
|
|
47
44
|
}, options?: ISetValuesOptions | boolean): void;
|
|
48
45
|
setUrl(viewParameter: ViewParameter | null, replace?: boolean): void;
|
|
49
|
-
/**
|
|
50
|
-
* Updates the parameter values from the values in the url. Returns true if any of the values have changed.
|
|
51
|
-
*/
|
|
52
|
-
update(match: match): boolean;
|
|
53
46
|
/**
|
|
54
47
|
* Gets a url for an object with view params specified.
|
|
55
48
|
* @param basePath Base path without parameters
|
|
@@ -2,7 +2,7 @@ import { ViewParameter } from './ViewParameter';
|
|
|
2
2
|
import { BreadCrumbSelectMode } from './IRouteParameter';
|
|
3
3
|
import { BreadCrumbItem } from './BreadCrumbItem';
|
|
4
4
|
import { Misc } from '@singularsystems/neo-core';
|
|
5
|
-
import { NeoReactTypes } from '
|
|
5
|
+
import { NeoReactTypes } from '../Modules/Types';
|
|
6
6
|
var ViewParameterList = /** @class */ (function () {
|
|
7
7
|
function ViewParameterList(routeParameterObject, view) {
|
|
8
8
|
this.view = view;
|
|
@@ -107,6 +107,7 @@ var ViewParameterList = /** @class */ (function () {
|
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
/**
|
|
110
|
+
* @internal
|
|
110
111
|
* Updates the parameter values from the values in the url. Returns true if any of the values have changed.
|
|
111
112
|
*/
|
|
112
113
|
ViewParameterList.prototype.update = function (match) {
|
|
@@ -116,11 +117,8 @@ var ViewParameterList = /** @class */ (function () {
|
|
|
116
117
|
//@ts-ignore
|
|
117
118
|
var viewParam = this[param];
|
|
118
119
|
if (viewParam) {
|
|
119
|
-
// @ts-ignore
|
|
120
120
|
var value = match.params[param];
|
|
121
|
-
if (value
|
|
122
|
-
value = null;
|
|
123
|
-
if (viewParam.update(value))
|
|
121
|
+
if (viewParam.update(value !== null && value !== void 0 ? value : null))
|
|
124
122
|
hasChanged = true;
|
|
125
123
|
}
|
|
126
124
|
}
|
package/dist/Views/ViewBase.d.ts
CHANGED
|
@@ -2,17 +2,17 @@ import React from 'react';
|
|
|
2
2
|
import { Views, ITaskRunner } from '@singularsystems/neo-core';
|
|
3
3
|
import { RouteParameterObject } from '../Routing/IRouteParameter';
|
|
4
4
|
import { TransformParamsType, IViewParameterList, IViewParameterListOfT } from '../Routing/ViewParameterList';
|
|
5
|
-
import { match } from 'react-router';
|
|
6
5
|
import { ViewState } from './ViewState';
|
|
7
6
|
import { BreadCrumbItem } from '../Routing/BreadCrumbItem';
|
|
8
7
|
import { IViewModel } from './IViewModel';
|
|
9
8
|
import EmptyViewModel from './EmptyViewModel';
|
|
10
9
|
import { IRouteChangedProps } from '../Routing/IRouteChangedProps';
|
|
11
10
|
import { valueOrLazy } from './ViewModelBase';
|
|
11
|
+
import { IMatchedRoute } from "../Routing/RouteProvider";
|
|
12
12
|
export interface IViewBase extends Views.IViewBase {
|
|
13
13
|
readonly fullScreen: boolean;
|
|
14
14
|
viewParams: IViewParameterList;
|
|
15
|
-
updateViewParams(match:
|
|
15
|
+
updateViewParams(match: IMatchedRoute): void;
|
|
16
16
|
getBreadCrumbList(): BreadCrumbItem[];
|
|
17
17
|
onLeave(): string | undefined;
|
|
18
18
|
beforeRouteChanged(props: IRouteChangedProps): void;
|
|
@@ -46,7 +46,7 @@ export default abstract class ViewBase<TViewModel extends IViewModel = EmptyView
|
|
|
46
46
|
protected createViewState(viewModel: valueOrLazy<TViewModel>): ViewState<TViewModel, TParams>;
|
|
47
47
|
componentDidMount(): Promise<void>;
|
|
48
48
|
componentWillUnmount(): void;
|
|
49
|
-
updateViewParams(match:
|
|
49
|
+
updateViewParams(match: IMatchedRoute): void;
|
|
50
50
|
/**
|
|
51
51
|
* viewParamsUpdated() is called when the component is mounted, and whenever a route parameter or query parameter gets a changed value.
|
|
52
52
|
*/
|
|
@@ -69,7 +69,7 @@ export default abstract class ViewBase<TViewModel extends IViewModel = EmptyView
|
|
|
69
69
|
/**
|
|
70
70
|
* Called whenever the route changes. Including navigating to a new view, leaving the site, or changing a route parameter in this view.
|
|
71
71
|
* Note: if props.leavePrompt is set, onLeave() will not be called.
|
|
72
|
-
* @param props
|
|
72
|
+
* @param props Set leavePrompt to `false`, a `string`, or a promise from a modal.
|
|
73
73
|
*/
|
|
74
74
|
beforeRouteChanged(props: IRouteChangedProps): void;
|
|
75
75
|
}
|
package/dist/Views/ViewBase.js
CHANGED
|
@@ -77,7 +77,7 @@ var ViewBase = /** @class */ (function (_super) {
|
|
|
77
77
|
return __generator(this, function (_a) {
|
|
78
78
|
switch (_a.label) {
|
|
79
79
|
case 0:
|
|
80
|
-
paramsUpdated = this.
|
|
80
|
+
paramsUpdated = this.routingState.currentRoute ? (this.viewState.viewParams).update(this.routingState.currentRoute) : false;
|
|
81
81
|
if (!!this.viewState.hasSetup) return [3 /*break*/, 2];
|
|
82
82
|
this.viewState.hasSetup = true;
|
|
83
83
|
return [4 /*yield*/, this.initialise()];
|
|
@@ -106,8 +106,8 @@ var ViewBase = /** @class */ (function (_super) {
|
|
|
106
106
|
return __generator(this, function (_a) {
|
|
107
107
|
switch (_a.label) {
|
|
108
108
|
case 0:
|
|
109
|
-
if (!this.viewState.viewParams.update(match)) return [3 /*break*/, 2];
|
|
110
|
-
return [4 /*yield*/,
|
|
109
|
+
if (!(this.viewState.viewParams).update(match)) return [3 /*break*/, 2];
|
|
110
|
+
return [4 /*yield*/, this.viewParamsUpdated()];
|
|
111
111
|
case 1:
|
|
112
112
|
_a.sent();
|
|
113
113
|
_a.label = 2;
|
|
@@ -124,9 +124,10 @@ var ViewBase = /** @class */ (function (_super) {
|
|
|
124
124
|
/** Gets the parent breadcrumbs, and the breadcrumb for this view. */
|
|
125
125
|
ViewBase.prototype.getBreadCrumbStart = function () {
|
|
126
126
|
var _this = this;
|
|
127
|
+
var _a;
|
|
127
128
|
var items = [];
|
|
128
129
|
// Get parent items
|
|
129
|
-
var menuRoute = this.routingState.currentRoute;
|
|
130
|
+
var menuRoute = (_a = this.routingState.currentRoute) === null || _a === void 0 ? void 0 : _a.route;
|
|
130
131
|
var parent = menuRoute.breadCrumbParent;
|
|
131
132
|
while (parent) {
|
|
132
133
|
items.splice(0, 0, new BreadCrumbItem(parent.name, parent.path));
|
|
@@ -167,7 +168,7 @@ var ViewBase = /** @class */ (function (_super) {
|
|
|
167
168
|
/**
|
|
168
169
|
* Called whenever the route changes. Including navigating to a new view, leaving the site, or changing a route parameter in this view.
|
|
169
170
|
* Note: if props.leavePrompt is set, onLeave() will not be called.
|
|
170
|
-
* @param props
|
|
171
|
+
* @param props Set leavePrompt to `false`, a `string`, or a promise from a modal.
|
|
171
172
|
*/
|
|
172
173
|
ViewBase.prototype.beforeRouteChanged = function (props) {
|
|
173
174
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -7,5 +7,7 @@ import * as Views from './Views/';
|
|
|
7
7
|
import * as Managers from './ReactComponents/_Managers';
|
|
8
8
|
import * as Icons from './ReactComponents/Icons';
|
|
9
9
|
import { TooltipHelper } from './ReactComponents/TooltipHelper';
|
|
10
|
-
export { Icons, Managers, NeoReactModule, NeoReactTypes, Neo, NeoGrid, Routing, Views, TooltipHelper
|
|
10
|
+
export { Icons, Managers, NeoReactModule, NeoReactTypes, Neo, NeoGrid, Routing, Views, TooltipHelper };
|
|
11
|
+
export { Transition } from './ReactComponents/Transitions/Transition';
|
|
12
|
+
export { TransitionController } from './ReactComponents/Transitions/TransitionController';
|
|
11
13
|
export { ICancellableEvent } from './ReactComponents/Misc';
|
package/dist/index.js
CHANGED
|
@@ -7,4 +7,6 @@ import * as Views from './Views/';
|
|
|
7
7
|
import * as Managers from './ReactComponents/_Managers';
|
|
8
8
|
import * as Icons from './ReactComponents/Icons';
|
|
9
9
|
import { TooltipHelper } from './ReactComponents/TooltipHelper';
|
|
10
|
-
export { Icons, Managers, NeoReactModule, NeoReactTypes, Neo, NeoGrid, Routing, Views, TooltipHelper
|
|
10
|
+
export { Icons, Managers, NeoReactModule, NeoReactTypes, Neo, NeoGrid, Routing, Views, TooltipHelper };
|
|
11
|
+
export { Transition } from './ReactComponents/Transitions/Transition';
|
|
12
|
+
export { TransitionController } from './ReactComponents/Transitions/TransitionController';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@singularsystems/neo-react",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "React application logic and components for the Neo client library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -16,50 +16,43 @@
|
|
|
16
16
|
"author": "Singular Systems",
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@testing-library/
|
|
20
|
-
"@
|
|
21
|
-
"@types/jest": "29.5.
|
|
19
|
+
"@testing-library/dom": "10.4.0",
|
|
20
|
+
"@testing-library/react": "16.0.1",
|
|
21
|
+
"@types/jest": "29.5.13",
|
|
22
22
|
"@types/memoize-one": "5.1.2",
|
|
23
|
-
"@types/node": "
|
|
24
|
-
"@types/react": "18.
|
|
23
|
+
"@types/node": "22.7.4",
|
|
24
|
+
"@types/react": "18.3.11",
|
|
25
25
|
"@types/react-custom-scrollbars": "^4.0.6",
|
|
26
|
-
"@types/react-dom": "18.
|
|
27
|
-
"@types/react-router": "5.1.18",
|
|
28
|
-
"@types/react-router-dom": "5.3.3",
|
|
26
|
+
"@types/react-dom": "18.3.0",
|
|
29
27
|
"decimal.js-light": "2.5.1",
|
|
30
28
|
"react-scripts": "5.0.1",
|
|
31
|
-
"typescript": "5.
|
|
29
|
+
"typescript": "5.5.2"
|
|
32
30
|
},
|
|
33
31
|
"dependencies": {
|
|
34
|
-
"@singularsystems/neo-core": "1.0
|
|
32
|
+
"@singularsystems/neo-core": "1.1.0",
|
|
35
33
|
"@types/rc-slider": "^8.6.5",
|
|
36
34
|
"@types/react-color": "^3.0.1",
|
|
37
35
|
"axios": "1.7.7",
|
|
38
|
-
"
|
|
39
|
-
"inversify": "^6.0.2",
|
|
36
|
+
"inversify": "6.0.2",
|
|
40
37
|
"memoize-one": "6.0.0",
|
|
41
|
-
"mobx": "6.
|
|
42
|
-
"mobx-react": "
|
|
43
|
-
"react": "18.
|
|
44
|
-
"react-custom-scrollbars": "
|
|
45
|
-
"react-dom": "18.
|
|
46
|
-
"react-router": "5.3.3",
|
|
47
|
-
"react-router-dom": "5.3.3",
|
|
38
|
+
"mobx": "6.13.3",
|
|
39
|
+
"mobx-react": "9.1.1",
|
|
40
|
+
"react": "18.3.1",
|
|
41
|
+
"react-custom-scrollbars": "4.2.1",
|
|
42
|
+
"react-dom": "18.3.1",
|
|
48
43
|
"react-select": "5.8.1",
|
|
49
|
-
"tslib": "2.
|
|
44
|
+
"tslib": "2.7.0"
|
|
50
45
|
},
|
|
51
46
|
"peerDependencies": {
|
|
52
|
-
"@singularsystems/neo-core": ">=1.0
|
|
47
|
+
"@singularsystems/neo-core": ">=1.1.0",
|
|
53
48
|
"axios": ">=1.6.2",
|
|
54
49
|
"inversify": ">=5.0.1",
|
|
55
50
|
"mobx": ">=6.9.0",
|
|
56
51
|
"mobx-react": ">=7.6.0",
|
|
57
52
|
"react": ">=18.2.0",
|
|
58
|
-
"react-dom": ">=18.2.0"
|
|
59
|
-
"react-router": "^5.0.0",
|
|
60
|
-
"react-router-dom": "^5.0.0"
|
|
53
|
+
"react-dom": ">=18.2.0"
|
|
61
54
|
},
|
|
62
|
-
"packageManager": "yarn@4.
|
|
55
|
+
"packageManager": "yarn@4.5.0",
|
|
63
56
|
"resolutions": {
|
|
64
57
|
"@singularsystems/neo-core": "portal:../core"
|
|
65
58
|
}
|
package/styles/Button.scss
CHANGED
package/styles/DatePicker.scss
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use 'sass:color';
|
|
2
|
+
|
|
1
3
|
$neo-include-datepicker: true !default;
|
|
2
4
|
|
|
3
5
|
@if $neo-include-datepicker {
|
|
@@ -123,7 +125,7 @@ $neo-include-datepicker: true !default;
|
|
|
123
125
|
|
|
124
126
|
&.selectable:hover {
|
|
125
127
|
cursor: pointer;
|
|
126
|
-
background-color:
|
|
128
|
+
background-color: color.adjust($form-focused-border, $lightness: 15%);
|
|
127
129
|
}
|
|
128
130
|
|
|
129
131
|
&.today {
|
package/styles/Forms.scss
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use 'sass:color';
|
|
2
|
+
|
|
1
3
|
// Numeric input
|
|
2
4
|
.numeric-input {
|
|
3
5
|
text-align: right;
|
|
@@ -59,7 +61,7 @@ div.neo-form-group-floating {
|
|
|
59
61
|
transform: scale(1);
|
|
60
62
|
}
|
|
61
63
|
label.neo-floating-label {
|
|
62
|
-
color:
|
|
64
|
+
color: color.adjust($form-focused-border, $lightness: -15%);
|
|
63
65
|
}
|
|
64
66
|
.neo-forms-editor {
|
|
65
67
|
border-bottom: 1px solid $form-focused-border;
|
package/styles/Grid.scss
CHANGED
package/styles/Misc.scss
CHANGED
|
@@ -153,4 +153,29 @@ div.tabs-header {
|
|
|
153
153
|
left: -0.5rem;
|
|
154
154
|
font-size: 1.5rem;
|
|
155
155
|
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Transitions
|
|
159
|
+
|
|
160
|
+
.neo-transition-container {
|
|
161
|
+
position: relative;
|
|
162
|
+
|
|
163
|
+
&.transitioning {
|
|
164
|
+
overflow: hidden;
|
|
165
|
+
transition: height 0.2s ease-in-out;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.neo-transition-panel {
|
|
169
|
+
&.animate-out {
|
|
170
|
+
transition: all 0.2s ease-in-out;
|
|
171
|
+
position: absolute;
|
|
172
|
+
top: 0;
|
|
173
|
+
overflow: hidden;
|
|
174
|
+
width: 100%;
|
|
175
|
+
}
|
|
176
|
+
&.animate-in {
|
|
177
|
+
transition: all 0.25s ease-in-out;
|
|
178
|
+
position: relative;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
156
181
|
}
|