@singularsystems/neo-react 1.0.22 → 1.1.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/README.md +1 -1
  3. package/dist/Modules/NeoReactModule.js +1 -1
  4. package/dist/Modules/ReactSetup.js +1 -5
  5. package/dist/Modules/Types.d.ts +3 -2
  6. package/dist/Modules/Types.js +1 -1
  7. package/dist/React/ReactModelCreator.js +1 -1
  8. package/dist/ReactComponents/FileManager/FileInput.js +3 -1
  9. package/dist/ReactComponents/Form.js +3 -5
  10. package/dist/ReactComponents/Grid/Grid.js +7 -9
  11. package/dist/ReactComponents/IColorPicker.d.ts +0 -1
  12. package/dist/ReactComponents/Icons/IIconFactory.d.ts +0 -1
  13. package/dist/ReactComponents/Icons/Icon.js +1 -1
  14. package/dist/ReactComponents/Link.d.ts +7 -0
  15. package/dist/ReactComponents/Link.js +39 -6
  16. package/dist/ReactComponents/Modal/Modal.js +2 -2
  17. package/dist/ReactComponents/StateObserver.d.ts +0 -1
  18. package/dist/ReactComponents/Tabs/Tab.js +5 -1
  19. package/dist/ReactComponents/Tabs/TabContainer.d.ts +6 -2
  20. package/dist/ReactComponents/Tabs/TabContainer.js +25 -17
  21. package/dist/ReactComponents/Tabs/TabManager.d.ts +0 -12
  22. package/dist/ReactComponents/Tabs/TabManager.js +3 -3
  23. package/dist/ReactComponents/Transitions/Transition.d.ts +10 -0
  24. package/dist/ReactComponents/Transitions/Transition.js +13 -0
  25. package/dist/ReactComponents/Transitions/TransitionContainer.d.ts +22 -0
  26. package/dist/ReactComponents/Transitions/TransitionContainer.js +34 -0
  27. package/dist/ReactComponents/Transitions/TransitionController.d.ts +33 -0
  28. package/dist/ReactComponents/Transitions/TransitionController.js +231 -0
  29. package/dist/ReactComponents/Transitions/TransitionPanel.d.ts +37 -0
  30. package/dist/ReactComponents/Transitions/TransitionPanel.js +64 -0
  31. package/dist/ReactComponents/Transitions/TransitionReplacer.d.ts +15 -0
  32. package/dist/ReactComponents/Transitions/TransitionReplacer.js +52 -0
  33. package/dist/ReactComponents/Transitions/TransitionSwitcher.d.ts +15 -0
  34. package/dist/ReactComponents/Transitions/TransitionSwitcher.js +55 -0
  35. package/dist/ReactComponents/Transitions/_Exports.d.ts +2 -0
  36. package/dist/ReactComponents/Transitions/_Exports.js +2 -0
  37. package/dist/ReactComponents/_Exports.d.ts +3 -1
  38. package/dist/ReactComponents/_Exports.js +3 -1
  39. package/dist/Routing/BreadCrumbItem.d.ts +0 -1
  40. package/dist/Routing/IRouteChangedProps.d.ts +5 -3
  41. package/dist/Routing/NavigationHelper.d.ts +9 -8
  42. package/dist/Routing/NavigationHelper.js +121 -25
  43. package/dist/Routing/PageLeaveHandler.d.ts +26 -9
  44. package/dist/Routing/PageLeaveHandler.js +16 -39
  45. package/dist/Routing/RouteProvider.d.ts +28 -7
  46. package/dist/Routing/RouteProvider.js +81 -42
  47. package/dist/Routing/RouteView.d.ts +5 -27
  48. package/dist/Routing/RouteView.js +18 -92
  49. package/dist/Routing/RoutingState.d.ts +10 -13
  50. package/dist/Routing/RoutingState.js +35 -18
  51. package/dist/Routing/ViewParameter.d.ts +0 -1
  52. package/dist/Routing/ViewParameterList.d.ts +0 -7
  53. package/dist/Routing/ViewParameterList.js +4 -6
  54. package/dist/Views/ViewBase.d.ts +4 -4
  55. package/dist/Views/ViewBase.js +6 -5
  56. package/dist/index.d.ts +3 -1
  57. package/dist/index.js +3 -1
  58. package/package.json +19 -26
  59. package/styles/Button.scss +6 -0
  60. package/styles/DatePicker.scss +3 -1
  61. package/styles/Forms.scss +3 -1
  62. package/styles/Grid.scss +4 -0
  63. package/styles/Misc.scss +25 -0
@@ -0,0 +1,33 @@
1
+ import { Transition } from "./Transition";
2
+ export declare class TransitionController {
3
+ /** Global default transition. */
4
+ static transition: Transition;
5
+ /**
6
+ * Creates a transition controller.
7
+ * @param initialName Name of the panel to display initially. Not required if `isVisible` props are defined on the panels.
8
+ * @param transition Transition type to use by default on all panels.
9
+ */
10
+ constructor(initialName?: string, transition?: Transition);
11
+ private _selectedName;
12
+ private defaultTransition;
13
+ private direction;
14
+ private isFirstTransition;
15
+ private isTransitioning;
16
+ private panels;
17
+ private panelStates;
18
+ private containerElement?;
19
+ /**
20
+ * Returns the name of the selected panel.
21
+ */
22
+ get selectedPanel(): string;
23
+ /**
24
+ * Begins a transition to the specified panel.
25
+ * @param waitFor A promise on which to wait before showing the to panel. Use if data needs to be loaded.
26
+ */
27
+ transition(toPanelName: string, waitFor?: Promise<any>): void;
28
+ forward(toPanelName?: string, waitFor?: Promise<any>): void;
29
+ back(toPanelName?: string, waitFor?: Promise<any>): void;
30
+ private doTransition;
31
+ private beginRemove;
32
+ private transitionElement;
33
+ }
@@ -0,0 +1,231 @@
1
+ import { __awaiter, __decorate, __generator, __metadata } from "tslib";
2
+ import { Components } from "@singularsystems/neo-core";
3
+ import { Transition } from "./Transition";
4
+ import { makeObservable, observable } from "mobx";
5
+ var TransitionController = /** @class */ (function () {
6
+ /**
7
+ * Creates a transition controller.
8
+ * @param initialName Name of the panel to display initially. Not required if `isVisible` props are defined on the panels.
9
+ * @param transition Transition type to use by default on all panels.
10
+ */
11
+ function TransitionController(initialName, transition) {
12
+ this._selectedName = "";
13
+ this.direction = 1;
14
+ this.isFirstTransition = true;
15
+ this.isTransitioning = false;
16
+ /**
17
+ * @internal
18
+ */
19
+ this.wasAutoCreated = false;
20
+ this.panels = [];
21
+ this.panelStates = [];
22
+ this._selectedName = initialName !== null && initialName !== void 0 ? initialName : "";
23
+ makeObservable(this);
24
+ this.defaultTransition = transition !== null && transition !== void 0 ? transition : TransitionController.transition;
25
+ }
26
+ Object.defineProperty(TransitionController.prototype, "selectedPanel", {
27
+ /**
28
+ * Returns the name of the selected panel.
29
+ */
30
+ get: function () {
31
+ return this._selectedName;
32
+ },
33
+ enumerable: false,
34
+ configurable: true
35
+ });
36
+ /**
37
+ * Begins a transition to the specified panel.
38
+ * @param waitFor A promise on which to wait before showing the to panel. Use if data needs to be loaded.
39
+ */
40
+ TransitionController.prototype.transition = function (toPanelName, waitFor) {
41
+ if (!this.isTransitioning) {
42
+ var currentIndex = this.panels.indexOf(this._selectedName);
43
+ var newIndex = this.panels.indexOf(toPanelName);
44
+ this.doTransition(toPanelName, newIndex - currentIndex, waitFor);
45
+ }
46
+ };
47
+ TransitionController.prototype.forward = function (toPanelName, waitFor) {
48
+ this.doTransition(toPanelName !== null && toPanelName !== void 0 ? toPanelName : "", 1, waitFor);
49
+ };
50
+ TransitionController.prototype.back = function (toPanelName, waitFor) {
51
+ this.doTransition(toPanelName !== null && toPanelName !== void 0 ? toPanelName : "", -1, waitFor);
52
+ };
53
+ /**
54
+ * @internal
55
+ * Called by the container on mount.
56
+ */
57
+ TransitionController.prototype.registerContainer = function (element) {
58
+ this.containerElement = element;
59
+ };
60
+ /**
61
+ * @internal
62
+ * Called by the container on unmount.
63
+ */
64
+ TransitionController.prototype.disposeContainer = function () {
65
+ this.containerElement = undefined;
66
+ };
67
+ /**
68
+ * @internal
69
+ * Called by each panel on mount.
70
+ */
71
+ TransitionController.prototype.registerPanel = function (name, hasVisibleProp) {
72
+ if (this.wasAutoCreated && !hasVisibleProp) {
73
+ throw "Panel with name ".concat(name, " must specify the isVisible prop, or you must pass a TransitionController to the TransitionContainer.");
74
+ }
75
+ if (this.panels.indexOf(name) < 0) {
76
+ this.panels.push(name);
77
+ }
78
+ };
79
+ /**
80
+ * @internal
81
+ * Called by each panel on unmount.
82
+ */
83
+ TransitionController.prototype.disposePanel = function (name) {
84
+ this.panels.remove(name);
85
+ var panelState = this.panelStates.find(function (c) { return c.name === name; });
86
+ if (panelState) {
87
+ clearTimeout(panelState.inTimer);
88
+ clearTimeout(panelState.outTimer);
89
+ }
90
+ };
91
+ /**
92
+ * @internal
93
+ * Called by each panel after render.
94
+ */
95
+ TransitionController.prototype.afterUpdate = function (name, element, transition) {
96
+ if (this._selectedName === name && !this.isTransitioning) {
97
+ var panelState_1 = this.panelStates.find(function (c) { return c.name === name; });
98
+ var transitionIn = false;
99
+ if (!panelState_1) {
100
+ panelState_1 = { name: name, element: element, transition: transition };
101
+ this.panelStates.push(panelState_1);
102
+ transitionIn = true;
103
+ }
104
+ if (panelState_1.outTimer) {
105
+ clearTimeout(panelState_1.outTimer);
106
+ panelState_1.outTimer = undefined;
107
+ transitionIn = true;
108
+ }
109
+ if (transitionIn && !this.isFirstTransition) {
110
+ panelState_1.inTimer = this.transitionElement(panelState_1.element, panelState_1.transition, this.direction > 0, false, function () {
111
+ panelState_1.inTimer = undefined;
112
+ });
113
+ }
114
+ this.isFirstTransition = false;
115
+ }
116
+ };
117
+ /**
118
+ * @internal
119
+ * If the panel is selected, or is busy transitioning.
120
+ */
121
+ TransitionController.prototype.isPanelVisible = function (name) {
122
+ return this._selectedName === name ||
123
+ this.panelStates.find(function (c) { return c.name === name; }) !== undefined;
124
+ };
125
+ TransitionController.prototype.doTransition = function (toName, direction, waitFor) {
126
+ return __awaiter(this, void 0, void 0, function () {
127
+ var e_1, oldKey;
128
+ return __generator(this, function (_a) {
129
+ switch (_a.label) {
130
+ case 0:
131
+ if (!(this._selectedName !== toName)) return [3 /*break*/, 5];
132
+ this.direction = direction;
133
+ this.isTransitioning = true;
134
+ this.beginRemove();
135
+ if (!waitFor) return [3 /*break*/, 4];
136
+ _a.label = 1;
137
+ case 1:
138
+ _a.trys.push([1, 3, , 4]);
139
+ return [4 /*yield*/, waitFor];
140
+ case 2:
141
+ _a.sent();
142
+ return [3 /*break*/, 4];
143
+ case 3:
144
+ e_1 = _a.sent();
145
+ this.isTransitioning = false;
146
+ oldKey = this._selectedName;
147
+ this._selectedName = "";
148
+ this._selectedName = oldKey;
149
+ return [3 /*break*/, 4];
150
+ case 4:
151
+ // This will cause the panel to render, and call registerPanel().
152
+ this._selectedName = toName;
153
+ this.isTransitioning = false;
154
+ _a.label = 5;
155
+ case 5: return [2 /*return*/];
156
+ }
157
+ });
158
+ });
159
+ };
160
+ TransitionController.prototype.beginRemove = function () {
161
+ var _this = this;
162
+ var _loop_1 = function (panelState) {
163
+ if (panelState.inTimer) {
164
+ clearTimeout(panelState.inTimer);
165
+ panelState.inTimer = undefined;
166
+ }
167
+ if (!panelState.outTimer) {
168
+ panelState.outTimer = this_1.transitionElement(panelState.element, panelState.transition, this_1.direction > 0, true, function () {
169
+ _this.panelStates.remove(panelState);
170
+ });
171
+ }
172
+ };
173
+ var this_1 = this;
174
+ for (var _i = 0, _a = this.panelStates; _i < _a.length; _i++) {
175
+ var panelState = _a[_i];
176
+ _loop_1(panelState);
177
+ }
178
+ };
179
+ TransitionController.prototype.transitionElement = function (element, transition, toLeft, out, onComplete) {
180
+ var _this = this;
181
+ transition !== null && transition !== void 0 ? transition : (transition = this.defaultTransition);
182
+ element.style.overflow = "hidden";
183
+ var elementHeight = element.getBoundingClientRect().height;
184
+ if (this.containerElement && !this.containerElement.classList.contains("transitioning")) {
185
+ this.containerElement.style.height = elementHeight + "px";
186
+ this.containerElement.classList.add("transitioning");
187
+ }
188
+ element.style.opacity = out ? "1" : "0";
189
+ transition.setBeforeStyles(element, out, toLeft);
190
+ Components.AnimationHelper.triggerReflow(element);
191
+ element.classList.add("animate-".concat(out ? "out" : "in"));
192
+ Components.AnimationHelper.triggerReflow(element);
193
+ if (!out && this.containerElement) {
194
+ Components.AnimationHelper.triggerReflow(this.containerElement);
195
+ this.containerElement.style.height = elementHeight + "px";
196
+ }
197
+ element.style.opacity = out ? "0" : "1";
198
+ transition.setAfterStyles(element, out, toLeft);
199
+ var duration = parseFloat(window.getComputedStyle(element).transitionDuration) * 1000;
200
+ return setTimeout(function () {
201
+ if (out) {
202
+ // Element will be removed from the dom, no need to cleanup props.
203
+ }
204
+ else {
205
+ element.classList.remove("animate-in");
206
+ element.style.opacity = "";
207
+ element.style.overflow = "";
208
+ transition.cleanup(element);
209
+ }
210
+ onComplete();
211
+ if (_this.containerElement && !_this.panelStates.some(function (c) { return c.inTimer; })) {
212
+ _this.containerElement.classList.remove("transitioning");
213
+ if (_this.panelStates.length > 0) {
214
+ _this.containerElement.style.height = "";
215
+ }
216
+ }
217
+ }, duration);
218
+ };
219
+ /** Global default transition. */
220
+ TransitionController.transition = Transition.leftRight;
221
+ __decorate([
222
+ observable.ref,
223
+ __metadata("design:type", String)
224
+ ], TransitionController.prototype, "_selectedName", void 0);
225
+ __decorate([
226
+ observable.shallow,
227
+ __metadata("design:type", Array)
228
+ ], TransitionController.prototype, "panelStates", void 0);
229
+ return TransitionController;
230
+ }());
231
+ export { TransitionController };
@@ -0,0 +1,37 @@
1
+ import React from "react";
2
+ import { Transition } from "./Transition";
3
+ import { TransitionContext } from "./TransitionContainer";
4
+ interface ITransitionPanelProps<T> {
5
+ /**
6
+ * The panel name unique within a transition container.
7
+ */
8
+ name?: string;
9
+ children: React.ReactNode | ((value: T) => React.ReactNode);
10
+ /**
11
+ * Data which will be passed into a child callback method.
12
+ * Use this to temporarily keep a reference to the data used in the panel while it is transitioned out.
13
+ */
14
+ data?: T | null;
15
+ /**
16
+ * Controls whether the panel is visible.
17
+ * If the value is an object, then it is also used as the `data` prop and will be passed into a child callback method.
18
+ * Not recommended when more than 2 panels are used. In that case, manually control the selected panel using a TransitionController. */
19
+ isVisible?: boolean | T | null;
20
+ /** Override the transition for this panel only. */
21
+ transition?: Transition;
22
+ }
23
+ export default class TransitionPanel<T = any> extends React.Component<ITransitionPanelProps<T>> {
24
+ static contextType: React.Context<import("./TransitionContainer").ITransitionContextState>;
25
+ context: React.ContextType<typeof TransitionContext>;
26
+ constructor(props: ITransitionPanelProps<T>);
27
+ private name;
28
+ private currentData?;
29
+ private panelRef;
30
+ componentDidMount(): void;
31
+ componentDidUpdate(): void;
32
+ private afterRender;
33
+ componentWillUnmount(): void;
34
+ get isVisible(): boolean;
35
+ render(): React.JSX.Element | undefined;
36
+ }
37
+ export {};
@@ -0,0 +1,64 @@
1
+ import { __decorate, __extends, __metadata } from "tslib";
2
+ import { computed, makeObservable } from "mobx";
3
+ import { observer } from "mobx-react";
4
+ import React from "react";
5
+ import { TransitionContext } from "./TransitionContainer";
6
+ import { Utils } from "@singularsystems/neo-core";
7
+ var TransitionPanel = /** @class */ (function (_super) {
8
+ __extends(TransitionPanel, _super);
9
+ function TransitionPanel(props) {
10
+ var _a;
11
+ var _this = _super.call(this, props) || this;
12
+ _this.panelRef = React.createRef();
13
+ makeObservable(_this);
14
+ _this.name = (_a = _this.props.name) !== null && _a !== void 0 ? _a : Utils.uuidv4();
15
+ return _this;
16
+ }
17
+ TransitionPanel.prototype.componentDidMount = function () {
18
+ this.context.controller.registerPanel(this.name, this.props.isVisible !== undefined);
19
+ this.afterRender();
20
+ };
21
+ TransitionPanel.prototype.componentDidUpdate = function () {
22
+ this.afterRender();
23
+ };
24
+ TransitionPanel.prototype.afterRender = function () {
25
+ if (this.props.isVisible) {
26
+ this.context.controller.transition(this.name);
27
+ }
28
+ if (this.panelRef.current) {
29
+ this.context.controller.afterUpdate(this.name, this.panelRef.current, this.props.transition);
30
+ }
31
+ };
32
+ TransitionPanel.prototype.componentWillUnmount = function () {
33
+ this.context.controller.disposePanel(this.name);
34
+ };
35
+ Object.defineProperty(TransitionPanel.prototype, "isVisible", {
36
+ get: function () {
37
+ return this.context.controller.isPanelVisible(this.name);
38
+ },
39
+ enumerable: false,
40
+ configurable: true
41
+ });
42
+ TransitionPanel.prototype.render = function () {
43
+ var _a = this.props, name = _a.name, data = _a.data, isVisible = _a.isVisible, children = _a.children;
44
+ if (data) {
45
+ this.currentData = data;
46
+ }
47
+ else if (isVisible && typeof isVisible === "object") {
48
+ this.currentData = isVisible;
49
+ }
50
+ return this.context.controller.isPanelVisible(this.name) ? (React.createElement("div", { ref: this.panelRef, className: "neo-transition-panel" }, typeof children === "function" ? (this.currentData ? children(this.currentData) : undefined) : children)) : undefined;
51
+ };
52
+ TransitionPanel.contextType = TransitionContext;
53
+ __decorate([
54
+ computed,
55
+ __metadata("design:type", Object),
56
+ __metadata("design:paramtypes", [])
57
+ ], TransitionPanel.prototype, "isVisible", null);
58
+ TransitionPanel = __decorate([
59
+ observer,
60
+ __metadata("design:paramtypes", [Object])
61
+ ], TransitionPanel);
62
+ return TransitionPanel;
63
+ }(React.Component));
64
+ export default TransitionPanel;
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import { Transition } from "./Transition";
3
+ interface ITransitionReplacerProps {
4
+ children: JSX.Element | null;
5
+ forward?: boolean;
6
+ transition?: Transition;
7
+ }
8
+ export declare class TransitionReplacer extends React.Component<ITransitionReplacerProps> {
9
+ private componentA;
10
+ private componentB;
11
+ private transitionController;
12
+ render(): React.JSX.Element;
13
+ private transitionTo;
14
+ }
15
+ export {};
@@ -0,0 +1,52 @@
1
+ import { __extends } from "tslib";
2
+ import React from "react";
3
+ import { TransitionController } from "./TransitionController";
4
+ import TransitionContainer from "./TransitionContainer";
5
+ import TransitionPanel from "./TransitionPanel";
6
+ var TransitionReplacer = /** @class */ (function (_super) {
7
+ __extends(TransitionReplacer, _super);
8
+ function TransitionReplacer() {
9
+ var _this = _super !== null && _super.apply(this, arguments) || this;
10
+ _this.componentA = null;
11
+ _this.componentB = null;
12
+ _this.transitionController = new TransitionController("A", _this.props.transition);
13
+ return _this;
14
+ }
15
+ TransitionReplacer.prototype.render = function () {
16
+ var _a, _b;
17
+ var component = this.props.children;
18
+ if (component && component.type === ((_a = this.componentA) === null || _a === void 0 ? void 0 : _a.type)) {
19
+ if (this.transitionController.selectedPanel === "B") {
20
+ this.transitionTo("A");
21
+ }
22
+ }
23
+ else if (component && component.type === ((_b = this.componentB) === null || _b === void 0 ? void 0 : _b.type)) {
24
+ if (this.transitionController.selectedPanel === "A") {
25
+ this.transitionTo("B");
26
+ }
27
+ }
28
+ else {
29
+ if (this.transitionController.selectedPanel === "A") {
30
+ this.componentB = component;
31
+ this.transitionTo("B");
32
+ }
33
+ else {
34
+ this.componentA = component;
35
+ this.transitionTo("A");
36
+ }
37
+ }
38
+ return React.createElement(TransitionContainer, { controller: this.transitionController },
39
+ React.createElement(TransitionPanel, { name: "A" }, this.componentA),
40
+ React.createElement(TransitionPanel, { name: "B" }, this.componentB));
41
+ };
42
+ TransitionReplacer.prototype.transitionTo = function (panel) {
43
+ if (this.props.forward !== false) {
44
+ this.transitionController.forward(panel);
45
+ }
46
+ else {
47
+ this.transitionController.back(panel);
48
+ }
49
+ };
50
+ return TransitionReplacer;
51
+ }(React.Component));
52
+ export { TransitionReplacer };
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import { Transition } from "./Transition";
3
+ interface ITransitionSwitcherProps {
4
+ children: JSX.Element | null;
5
+ forward?: boolean;
6
+ transition?: Transition;
7
+ }
8
+ export default class TransitionSwitcher extends React.Component<ITransitionSwitcherProps> {
9
+ private componentA;
10
+ private componentB;
11
+ private transitionController;
12
+ render(): React.JSX.Element;
13
+ private transitionTo;
14
+ }
15
+ export {};
@@ -0,0 +1,55 @@
1
+ import { __extends } from "tslib";
2
+ import React from "react";
3
+ import { TransitionController } from "./TransitionController";
4
+ import TransitionContainer from "./TransitionContainer";
5
+ import TransitionPanel from "./TransitionPanel";
6
+ var TransitionSwitcher = /** @class */ (function (_super) {
7
+ __extends(TransitionSwitcher, _super);
8
+ function TransitionSwitcher() {
9
+ var _this = _super !== null && _super.apply(this, arguments) || this;
10
+ _this.componentA = null;
11
+ _this.componentB = null;
12
+ _this.transitionController = new TransitionController("A", _this.props.transition);
13
+ return _this;
14
+ }
15
+ TransitionSwitcher.prototype.render = function () {
16
+ var _a, _b;
17
+ var component = this.props.children;
18
+ if (typeof (component === null || component === void 0 ? void 0 : component.type) === "string") {
19
+ throw "TransitionSwitcher can only have components as children.";
20
+ }
21
+ if (component && component.type === ((_a = this.componentA) === null || _a === void 0 ? void 0 : _a.type)) {
22
+ if (this.transitionController.selectedPanel === "B") {
23
+ this.transitionTo("A");
24
+ }
25
+ }
26
+ else if (component && component.type === ((_b = this.componentB) === null || _b === void 0 ? void 0 : _b.type)) {
27
+ if (this.transitionController.selectedPanel === "A") {
28
+ this.transitionTo("B");
29
+ }
30
+ }
31
+ else {
32
+ if (this.transitionController.selectedPanel === "A") {
33
+ this.componentB = component;
34
+ this.transitionTo("B");
35
+ }
36
+ else {
37
+ this.componentA = component;
38
+ this.transitionTo("A");
39
+ }
40
+ }
41
+ return React.createElement(TransitionContainer, { controller: this.transitionController },
42
+ React.createElement(TransitionPanel, { name: "A" }, this.componentA),
43
+ React.createElement(TransitionPanel, { name: "B" }, this.componentB));
44
+ };
45
+ TransitionSwitcher.prototype.transitionTo = function (panel) {
46
+ if (this.props.forward !== false) {
47
+ this.transitionController.forward(panel);
48
+ }
49
+ else {
50
+ this.transitionController.back(panel);
51
+ }
52
+ };
53
+ return TransitionSwitcher;
54
+ }(React.Component));
55
+ export default TransitionSwitcher;
@@ -0,0 +1,2 @@
1
+ export { Transition } from './Transition';
2
+ export { TransitionController } from './TransitionController';
@@ -0,0 +1,2 @@
1
+ export { Transition } from './Transition';
2
+ export { TransitionController } from './TransitionController';
@@ -33,6 +33,8 @@ import PageSizeControl from './Paging/PageSizeControl';
33
33
  import ProgressBar from './ProgressBar';
34
34
  import RadioList from './RadioList';
35
35
  import Slider from './Slider';
36
+ import TransitionContainer from "./Transitions/TransitionContainer";
37
+ import TransitionPanel from "./Transitions/TransitionPanel";
36
38
  import TabContainer from './Tabs/TabContainer';
37
39
  import Tab from './Tabs/Tab';
38
40
  import Toast from './Notifications/Toast';
@@ -40,4 +42,4 @@ import ToastContainer from './Notifications/ToastContainer';
40
42
  import Tooltip from './Tooltip';
41
43
  import TooltipProvider from './TooltipProvider';
42
44
  import ValidationSummary from './ValidationSummary';
43
- export { Alert, AutoCompleteDropDown, Badge, Button, Card, Checkbox, Collapsable, ColorPicker, ContextMenuContainer, DatePicker, DropDown, FileBasicInput, FileContext, FileDropArea, FileInput, FileUploadButton, FileUploadProgress, Form, FormContext, FormGroup, FormGroupFloating, FormGroupInline, GridLayout, Icon, Input, Link, Loader, Modal, ModalContainer, NumberInput, Pager, PagerControlsBasic, PageSizeControl, Passwordbox, ProgressBar, RadioList, Slider, TabContainer, Tab, Textbox, Toast, ToastContainer, Tooltip, TooltipProvider, ValidationSummary };
45
+ export { Alert, AutoCompleteDropDown, Badge, Button, Card, Checkbox, Collapsable, ColorPicker, ContextMenuContainer, DatePicker, DropDown, FileBasicInput, FileContext, FileDropArea, FileInput, FileUploadButton, FileUploadProgress, Form, FormContext, FormGroup, FormGroupFloating, FormGroupInline, GridLayout, Icon, Input, Link, Loader, Modal, ModalContainer, NumberInput, Pager, PagerControlsBasic, PageSizeControl, Passwordbox, ProgressBar, RadioList, Slider, TabContainer, Tab, Textbox, TransitionContainer, TransitionPanel, Toast, ToastContainer, Tooltip, TooltipProvider, ValidationSummary };
@@ -33,6 +33,8 @@ import PageSizeControl from './Paging/PageSizeControl';
33
33
  import ProgressBar from './ProgressBar';
34
34
  import RadioList from './RadioList';
35
35
  import Slider from './Slider';
36
+ import TransitionContainer from "./Transitions/TransitionContainer";
37
+ import TransitionPanel from "./Transitions/TransitionPanel";
36
38
  import TabContainer from './Tabs/TabContainer';
37
39
  import Tab from './Tabs/Tab';
38
40
  import Toast from './Notifications/Toast';
@@ -40,4 +42,4 @@ import ToastContainer from './Notifications/ToastContainer';
40
42
  import Tooltip from './Tooltip';
41
43
  import TooltipProvider from './TooltipProvider';
42
44
  import ValidationSummary from './ValidationSummary';
43
- export { Alert, AutoCompleteDropDown, Badge, Button, Card, Checkbox, Collapsable, ColorPicker, ContextMenuContainer, DatePicker, DropDown, FileBasicInput, FileContext, FileDropArea, FileInput, FileUploadButton, FileUploadProgress, Form, FormContext, FormGroup, FormGroupFloating, FormGroupInline, GridLayout, Icon, Input, Link, Loader, Modal, ModalContainer, NumberInput, Pager, PagerControlsBasic, PageSizeControl, Passwordbox, ProgressBar, RadioList, Slider, TabContainer, Tab, Textbox, Toast, ToastContainer, Tooltip, TooltipProvider, ValidationSummary };
45
+ export { Alert, AutoCompleteDropDown, Badge, Button, Card, Checkbox, Collapsable, ColorPicker, ContextMenuContainer, DatePicker, DropDown, FileBasicInput, FileContext, FileDropArea, FileInput, FileUploadButton, FileUploadProgress, Form, FormContext, FormGroup, FormGroupFloating, FormGroupInline, GridLayout, Icon, Input, Link, Loader, Modal, ModalContainer, NumberInput, Pager, PagerControlsBasic, PageSizeControl, Passwordbox, ProgressBar, RadioList, Slider, TabContainer, Tab, Textbox, TransitionContainer, TransitionPanel, Toast, ToastContainer, Tooltip, TooltipProvider, ValidationSummary };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare class BreadCrumbItem {
3
2
  /** Text to show in the breadcrumb component. */
4
3
  label: string | (() => string);
@@ -1,5 +1,5 @@
1
1
  import { Misc, Routing, Views } from "@singularsystems/neo-core";
2
- import { match } from "react-router-dom";
2
+ export type RouteChangedLeavePrompt = string | false | Promise<boolean> | Promise<Misc.ModalResult>;
3
3
  export interface IRouteChangedProps {
4
4
  /**
5
5
  * True if the user is navigating to a new view or leaving the site. False if navigating to a sub route in this view.
@@ -20,12 +20,14 @@ export interface IRouteChangedProps {
20
20
  /**
21
21
  * The url match information. Url parameter values can be viewed on this object.
22
22
  */
23
- readonly match?: match;
23
+ readonly params?: {
24
+ [index: string]: any;
25
+ };
24
26
  /**
25
27
  * A leave prompt to show the user before the location is changed.
26
28
  * If you want to display your own prompt, set this to the promise returned by the modal.
27
29
  * If you want to block navigation (with no option for the user to continue), return false.
28
30
  * Note: if `isUnload` is true, the browser will show a native leave prompt regardless of whether you show a custom prompt.
29
31
  */
30
- leavePrompt?: string | false | Promise<boolean> | Promise<Misc.ModalResult> | Promise<void>;
32
+ leavePrompt?: RouteChangedLeavePrompt;
31
33
  }
@@ -1,8 +1,8 @@
1
1
  import ViewBase from '../Views/ViewBase';
2
- import { RouteComponentProps } from 'react-router';
3
2
  import { RoutingState } from './RoutingState';
4
3
  import { INavigationHelper as INeoNavigationHelper } from '@singularsystems/neo-core/dist/Routing/INavigationHelper';
5
4
  import { RouteParameterObject } from './IRouteParameter';
5
+ import type { IPageLeaveHandler } from "./PageLeaveHandler";
6
6
  export type ViewConstructor<TParams extends RouteParameterObject<TParams>> = new (...args: any) => ViewBase<any, TParams>;
7
7
  export type ParamValues<TParams> = {
8
8
  [P in keyof TParams]?: number | string | null;
@@ -25,17 +25,18 @@ export interface INavigationHelper extends INeoNavigationHelper {
25
25
  * Gets the path of the currently rendered view, without parameter components.
26
26
  */
27
27
  getCurrentViewPath(): string;
28
- /**
29
- * Gets the react-router properties for the current route.
30
- */
31
- readonly currentRouteProps: RouteComponentProps;
32
28
  }
33
29
  export default class NavigationHelper implements INavigationHelper {
34
30
  private routingState;
35
- constructor(routingState: RoutingState);
36
- navigateInternal(url: string, replace?: boolean): void;
31
+ private pageLeaveHandler;
32
+ constructor(routingState: RoutingState, pageLeaveHandler: IPageLeaveHandler);
33
+ private prevUrls;
34
+ private isPrompting;
35
+ navigateInternal(url: string, replace?: boolean): Promise<boolean>;
37
36
  navigateToView<TParams extends RouteParameterObject<TParams>>(view: ViewConstructor<TParams>, paramValues?: ParamValues<TParams>): void;
38
37
  getPathForView<TParams extends RouteParameterObject<TParams>>(view: ViewConstructor<TParams>, paramValues?: ParamValues<TParams>): string;
39
38
  getCurrentViewPath(): string;
40
- get currentRouteProps(): import("react-router").RouteComponentProps<{}, import("react-router").StaticContext, unknown>;
39
+ private historyPopState;
40
+ private windowUnload;
41
+ private beforeLocationChanged;
41
42
  }