@singularsystems/neo-react 1.0.21 → 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.
Files changed (69) 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/Button.js +3 -1
  9. package/dist/ReactComponents/FileManager/FileInput.js +3 -1
  10. package/dist/ReactComponents/Form.js +3 -5
  11. package/dist/ReactComponents/Grid/Column.d.ts +2 -2
  12. package/dist/ReactComponents/Grid/Column.js +3 -2
  13. package/dist/ReactComponents/Grid/Grid.js +7 -9
  14. package/dist/ReactComponents/Grid/StickyTableHeader.js +4 -0
  15. package/dist/ReactComponents/GridLayout.d.ts +3 -0
  16. package/dist/ReactComponents/GridLayout.js +22 -9
  17. package/dist/ReactComponents/IColorPicker.d.ts +0 -1
  18. package/dist/ReactComponents/Icons/IIconFactory.d.ts +0 -1
  19. package/dist/ReactComponents/Icons/Icon.js +1 -1
  20. package/dist/ReactComponents/Link.d.ts +7 -0
  21. package/dist/ReactComponents/Link.js +39 -6
  22. package/dist/ReactComponents/Modal/Modal.js +2 -2
  23. package/dist/ReactComponents/StateObserver.d.ts +0 -1
  24. package/dist/ReactComponents/Tabs/Tab.js +5 -1
  25. package/dist/ReactComponents/Tabs/TabContainer.d.ts +6 -2
  26. package/dist/ReactComponents/Tabs/TabContainer.js +25 -17
  27. package/dist/ReactComponents/Tabs/TabManager.d.ts +0 -12
  28. package/dist/ReactComponents/Tabs/TabManager.js +3 -3
  29. package/dist/ReactComponents/Transitions/Transition.d.ts +10 -0
  30. package/dist/ReactComponents/Transitions/Transition.js +13 -0
  31. package/dist/ReactComponents/Transitions/TransitionContainer.d.ts +22 -0
  32. package/dist/ReactComponents/Transitions/TransitionContainer.js +34 -0
  33. package/dist/ReactComponents/Transitions/TransitionController.d.ts +33 -0
  34. package/dist/ReactComponents/Transitions/TransitionController.js +231 -0
  35. package/dist/ReactComponents/Transitions/TransitionPanel.d.ts +37 -0
  36. package/dist/ReactComponents/Transitions/TransitionPanel.js +64 -0
  37. package/dist/ReactComponents/Transitions/TransitionReplacer.d.ts +15 -0
  38. package/dist/ReactComponents/Transitions/TransitionReplacer.js +52 -0
  39. package/dist/ReactComponents/Transitions/TransitionSwitcher.d.ts +15 -0
  40. package/dist/ReactComponents/Transitions/TransitionSwitcher.js +55 -0
  41. package/dist/ReactComponents/Transitions/_Exports.d.ts +2 -0
  42. package/dist/ReactComponents/Transitions/_Exports.js +2 -0
  43. package/dist/ReactComponents/_Exports.d.ts +3 -1
  44. package/dist/ReactComponents/_Exports.js +3 -1
  45. package/dist/Routing/BreadCrumbItem.d.ts +0 -1
  46. package/dist/Routing/IRouteChangedProps.d.ts +5 -3
  47. package/dist/Routing/NavigationHelper.d.ts +9 -8
  48. package/dist/Routing/NavigationHelper.js +121 -25
  49. package/dist/Routing/PageLeaveHandler.d.ts +26 -9
  50. package/dist/Routing/PageLeaveHandler.js +16 -39
  51. package/dist/Routing/RouteProvider.d.ts +28 -7
  52. package/dist/Routing/RouteProvider.js +81 -42
  53. package/dist/Routing/RouteView.d.ts +5 -27
  54. package/dist/Routing/RouteView.js +18 -92
  55. package/dist/Routing/RoutingState.d.ts +10 -13
  56. package/dist/Routing/RoutingState.js +35 -18
  57. package/dist/Routing/ViewParameter.d.ts +0 -1
  58. package/dist/Routing/ViewParameterList.d.ts +0 -7
  59. package/dist/Routing/ViewParameterList.js +3 -5
  60. package/dist/Views/ViewBase.d.ts +4 -4
  61. package/dist/Views/ViewBase.js +6 -5
  62. package/dist/index.d.ts +3 -1
  63. package/dist/index.js +3 -1
  64. package/package.json +21 -28
  65. package/styles/Button.scss +13 -0
  66. package/styles/DatePicker.scss +3 -1
  67. package/styles/Forms.scss +3 -1
  68. package/styles/Grid.scss +4 -0
  69. package/styles/Misc.scss +25 -1
package/CHANGELOG.md CHANGED
@@ -1,4 +1,18 @@
1
- # Version 1.x
1
+ # Version 1.1
2
+
3
+ Version 1.1 removes the `react-router` dependency. This requires updates to your project which are explained in [this guide](./docs/RemoveReactRouter.md).
4
+
5
+ It also fixes some issues preventing projects from upgrading to `mobx-react` v9.x.
6
+
7
+ ## Version 1.0.22
8
+
9
+ React-select dependency was updated which has a breaking change in its types. You will need to update the version of this package in your project to at least:
10
+
11
+ ```json
12
+ "react-select": "5.8.1",
13
+ ```
14
+
15
+ # Version 1.0
2
16
 
3
17
  Version 1 of neo-react upgrades react to version 18, and mobX to version 6. Both of these are major updates and will require you to make code changes to your project.
4
18
 
package/README.md CHANGED
@@ -4,7 +4,7 @@ This project contains the react/mobx implementation of the neo client library.
4
4
 
5
5
  It also contains UI components built for react.
6
6
 
7
- ## Changelog
7
+ ## Changelog / Breaking changes
8
8
 
9
9
  View the changelog [here](./CHANGELOG.md).
10
10
 
@@ -16,7 +16,7 @@ var neoReactModule = new AppServices.Module("neo-react", function (container) {
16
16
  container.bind(AppServices.NeoTypes.Core.ModelCreator).to(ReactModelCreator).inTransientScope();
17
17
  container.bind(AppServices.NeoTypes.UI.ErrorHandler).to(ErrorHandler).inSingletonScope();
18
18
  container.bind(AppServices.NeoTypes.UI.GlobalContextMenuState).toConstantValue(new ContextMenuState());
19
- container.bind(AppServices.NeoTypes.Routing.PageLeaveHandler).to(PageLeaveHandler).inSingletonScope();
19
+ container.bind(NeoReactTypes.Routing.PageLeaveHandler).to(PageLeaveHandler).inSingletonScope();
20
20
  container.bind(NeoReactTypes.Components.IconFactory).to(IconFactory).inSingletonScope();
21
21
  container.bind(NeoReactTypes.Routing.GlobalRoutingState).to(RoutingState).inSingletonScope();
22
22
  container.bind(NeoReactTypes.Routing.NavigationHelper).to(NavigationHelper).inSingletonScope();
@@ -1,7 +1,6 @@
1
- import { AppServices, Utils } from '@singularsystems/neo-core';
1
+ import { Utils } from '@singularsystems/neo-core';
2
2
  import { configure, isObservableArray, runInAction, untracked } from 'mobx';
3
3
  import React from 'react';
4
- import { NeoReactTypes } from './Types';
5
4
  export function runReactSetup(container) {
6
5
  Utils.peek = function (target, propertyName) {
7
6
  return untracked(function () { return target[propertyName]; });
@@ -16,8 +15,5 @@ export function runReactSetup(container) {
16
15
  }
17
16
  return array;
18
17
  };
19
- window.addEventListener("beforeunload", function (e) {
20
- container.get(AppServices.NeoTypes.Routing.PageLeaveHandler).onWindowUnload(container.get(NeoReactTypes.Routing.GlobalRoutingState).currentView, e);
21
- });
22
18
  configure({ enforceActions: "never", useProxies: "never" });
23
19
  }
@@ -9,6 +9,7 @@ import { AxiosStatic } from 'axios';
9
9
  import type Select from 'react-select';
10
10
  import { IDisposeHelper } from '../Services/IDisposeHelper';
11
11
  import { IIconFactory } from '../ReactComponents/Icons/IIconFactory';
12
+ import { IPageLeaveHandler } from "../Routing/PageLeaveHandler";
12
13
  declare const NeoReactTypes: {
13
14
  Components: {
14
15
  Slider: AppServices.ServiceIdentifier<typeof Slider>;
@@ -27,16 +28,16 @@ declare const NeoReactTypes: {
27
28
  IconFactory: AppServices.ServiceIdentifier<IIconFactory>;
28
29
  };
29
30
  Routing: {
31
+ PageLeaveHandler: AppServices.ServiceIdentifier<IPageLeaveHandler>;
30
32
  NavigationHelper: AppServices.ServiceIdentifier<INavigationHelper>;
31
33
  GlobalRoutingState: AppServices.ServiceIdentifier<RoutingState>;
32
34
  MenuItemProvider: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/Routing").IMenuItemProvider<import("@singularsystems/neo-core/dist/Routing").IMenuRoute>>;
33
- PageLeaveHandler: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/Routing").IPageLeaveHandler>;
34
35
  RouteSecurityService: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/Routing").IRouteSecurityService>;
35
36
  };
36
37
  Services: {
37
38
  DisposeHelper: AppServices.ServiceIdentifier<IDisposeHelper>;
38
39
  };
39
- Axios: AppServices.ServiceIdentifier<AxiosStatic>;
40
+ Axios: AppServices.ServiceIdentifier<import("axios").AxiosStatic>;
40
41
  Config: {
41
42
  ConfigModel: AppServices.ServiceIdentifier<AppServices.IConfigModel>;
42
43
  ConfigService: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/AppServices/Config/ConfigService").IConfigService>;
@@ -15,7 +15,7 @@ var NeoReactTypes = __assign(__assign({}, AppServices.NeoTypes), { Components: {
15
15
  ReactSelect: new AppServices.ServiceIdentifier("NeoReact.ReactSelect"),
16
16
  AsyncSelect: new AppServices.ServiceIdentifier("NeoReact.AsyncSelect"),
17
17
  IconFactory: new AppServices.ServiceIdentifier("NeoReact.IconFactory")
18
- }, Routing: __assign(__assign({}, AppServices.NeoTypes.Routing), { NavigationHelper: AppServices.NeoTypes.Routing.NavigationHelper.asType(), GlobalRoutingState: new AppServices.ServiceIdentifier("NeoReact.GlobalRoutingState") }), Services: {
18
+ }, Routing: __assign(__assign({}, AppServices.NeoTypes.Routing), { PageLeaveHandler: new AppServices.ServiceIdentifier("NeoReact.PageLeaveHandler"), NavigationHelper: AppServices.NeoTypes.Routing.NavigationHelper.asType(), GlobalRoutingState: new AppServices.ServiceIdentifier("NeoReact.GlobalRoutingState") }), Services: {
19
19
  DisposeHelper: new AppServices.ServiceIdentifier("NeoReact.DisposeHelper")
20
20
  } });
21
21
  export { NeoReactTypes };
@@ -63,7 +63,7 @@ var ReactModelCreator = /** @class */ (function (_super) {
63
63
  }
64
64
  }
65
65
  // Run mobx's setup for this instance.
66
- makeObservable(object, annotations, { proxy: false });
66
+ makeObservable(object, annotations);
67
67
  // Setup once properties have been converted to observables.
68
68
  for (var propertyKey in observables) {
69
69
  try {
@@ -121,7 +121,9 @@ var Button = /** @class */ (function (_super) {
121
121
  : React.createElement("div", { key: index, className: Utils.joinWithSpaces("dropdown-item", item.disabled ? " disabled" : "", item.className), onClick: function (e) { return !item.disabled ? _this.menuItemClicked(e, item.data, item.onClick) : undefined; } },
122
122
  _this.iconFactory.getIconComponent(item.icon, { fixedWidth: true }),
123
123
  " ",
124
- item.text)); }));
124
+ item.text,
125
+ " ",
126
+ item.subText && React.createElement("div", { className: "dropdown-subtext" }, item.subText))); }));
125
127
  root =
126
128
  React.createElement("div", { className: buttonGroupClasses, ref: this.btnGroupDom },
127
129
  mainButton,
@@ -4,10 +4,12 @@ import { Components, Utils, Misc, Validation } from '@singularsystems/neo-core';
4
4
  import { observer } from 'mobx-react';
5
5
  import FileUploadButton from './FileUploadButton';
6
6
  import { FileContext } from './FileContext';
7
- import { ProgressBar, Button, FileDropArea } from '../_Exports';
8
7
  import ComponentBase from '../ComponentBase';
9
8
  import { BindPropsHelper } from '../PropTypes';
10
9
  import { makeObservable, observable } from 'mobx';
10
+ import ProgressBar from "../ProgressBar";
11
+ import FileDropArea from "./FileDropArea";
12
+ import Button from "../Button";
11
13
  /**
12
14
  * The file manager component manages uploading, and binding of files to a model.
13
15
  */
@@ -80,11 +80,9 @@ var Form = /** @class */ (function (_super) {
80
80
  if (closeButton) {
81
81
  closeButton.onClick = onClose;
82
82
  }
83
- codeModal_1 = ModalUtils.showModal(_this.props.invalidSummaryTitle || "Invalid data", React.createElement(Observer, null, function () {
84
- return React.createElement("div", null,
85
- _this.props.invalidSummaryText || "Cannot continue due to the following issues:",
86
- React.createElement(ValidationSummary, { graph: Validation.getValidationSummary(modelOrModels), hideTopLevelTitle: !(modelOrModels instanceof Array) }));
87
- }), { onClose: onClose, closeButton: closeButton });
83
+ codeModal_1 = ModalUtils.showModal(_this.props.invalidSummaryTitle || "Invalid data", React.createElement("div", null,
84
+ _this.props.invalidSummaryText || "Cannot continue due to the following issues:",
85
+ React.createElement(Observer, null, function () { return React.createElement(ValidationSummary, { graph: Validation.getValidationSummary(modelOrModels), hideTopLevelTitle: !(modelOrModels instanceof Array) }); })), { onClose: onClose, closeButton: closeButton });
88
86
  }
89
87
  if (someBusy()) {
90
88
  // Async rule is busy, listen for when isBusy changes to false.
@@ -11,8 +11,8 @@ export interface INeoColumnProps<TData> extends INeoCommonColumnProps, IEditorCo
11
11
  headerTooltip?: string;
12
12
  /** Tooltip to show in cells. If you want the tooltip to show on the cells as well, use 'data-tip'. */
13
13
  cellTooltip?: string;
14
- /** Allows you to disable sorting on a column, or make clicking a column heading sort a specific property. */
15
- sort?: Model.IPropertyInstance | false;
14
+ /** Allows you to override the default allow sorting setting of the datasource, or make clicking a column heading sort a specific property. */
15
+ sort?: Model.IPropertyInstance | boolean;
16
16
  /** True if this column must have a total cell. */
17
17
  sum?: boolean;
18
18
  /** Content callback to show in the footer. The filtered list of the grid is passed into the callback. */
@@ -35,8 +35,9 @@ var Column = /** @class */ (function (_super) {
35
35
  this.isFooter = this.context.section === "footer";
36
36
  };
37
37
  Column.prototype.getSortProperty = function () {
38
- if (this.props.sort !== false && this.context.dataView.allowSort) {
39
- if (this.props.sort) {
38
+ var _a, _b;
39
+ if ((_b = (_a = this.props.sort) !== null && _a !== void 0 ? _a : this.context.dataView.allowSort) !== null && _b !== void 0 ? _b : true) {
40
+ if (typeof this.props.sort === "object") {
40
41
  return this.props.sort;
41
42
  }
42
43
  else {
@@ -1,7 +1,7 @@
1
1
  import { __assign, __decorate, __extends, __metadata, __rest } from "tslib";
2
2
  import * as React from 'react';
3
3
  import { Data, Utils, Misc } from '@singularsystems/neo-core';
4
- import { observer, Observer } from 'mobx-react';
4
+ import { observer } from 'mobx-react';
5
5
  import NeoButton from '../Button';
6
6
  import { DataViewContext } from '../../React/DataView';
7
7
  import { StickyTableHeader } from './StickyTableHeader';
@@ -103,14 +103,12 @@ var Grid = /** @class */ (function (_super) {
103
103
  React.createElement(GridContext.Provider, { value: this.gridContext },
104
104
  React.createElement(TableSection, { type: "header" }, this.headerItem && this.props.children(this.headerItem, this.headerItem.meta, true, -1)),
105
105
  React.createElement(TableSection, { type: "body" }, this.gridContext.dataView.getItems().map(function (item, index) { return (React.createElement(ItemGroup, { index: enableRowIndexes ? index : 0, item: item, key: keyProperty ? item[keyProperty] : item.entityIdentifier, template: _this.props.children })); })),
106
- React.createElement(Observer, null, function () {
107
- return React.createElement(React.Fragment, null, (showAddButton || addButton || footerButtons || _this.gridContext.hasSummaries || footerContent !== undefined) &&
108
- React.createElement(TableSection, { type: "footer" },
109
- _this.gridContext.hasSummaries && _this.headerItem && _this.props.children(_this.headerItem, _this.headerItem.meta, true, -1),
110
- footerContent !== undefined && footerContent(_this.gridContext.dataView.getItems()),
111
- (showAddButton || addButton || footerButtons) &&
112
- React.createElement(AddButtonRow, { addButton: addButton, showAddButton: showAddButton, additionalContent: footerButtons })));
113
- }))));
106
+ (showAddButton || addButton || footerButtons || this.gridContext.hasSummaries || footerContent !== undefined) &&
107
+ React.createElement(TableSection, { type: "footer" },
108
+ this.gridContext.hasSummaries && this.headerItem && this.props.children(this.headerItem, this.headerItem.meta, true, -1),
109
+ footerContent !== undefined && footerContent(this.gridContext.dataView.getItems()),
110
+ (showAddButton || addButton || footerButtons) &&
111
+ React.createElement(AddButtonRow, { addButton: addButton, showAddButton: showAddButton, additionalContent: footerButtons })))));
114
112
  };
115
113
  Grid.prototype.setInitialSort = function (initialSort, initialSortAscending) {
116
114
  var _a;
@@ -79,6 +79,8 @@ var StickyTableHeader = /** @class */ (function () {
79
79
  this.restoreColumnWidths();
80
80
  this.header.classList.remove("neo-grid-fixed-header");
81
81
  this.header.style.clipPath = "";
82
+ this.header.style.left = "";
83
+ this.header.style.top = "";
82
84
  this.table.removeChild(this.headerCopy);
83
85
  this.headerCopy = undefined;
84
86
  }
@@ -99,6 +101,8 @@ var StickyTableHeader = /** @class */ (function () {
99
101
  for (var j = 0; j < originalRow.cells.length; j++) {
100
102
  var originalCell = originalRow.cells[j], copyCell = copyRow.cells[j];
101
103
  originalCell.style.width = window.getComputedStyle(copyCell).width;
104
+ originalCell.style.minWidth = originalCell.style.width;
105
+ originalCell.style.maxWidth = originalCell.style.width;
102
106
  }
103
107
  }
104
108
  }
@@ -7,7 +7,10 @@ interface ILayoutGridProps extends Components.IColumnCountBreakpoints {
7
7
  verticalSpace?: string;
8
8
  /** Sets verticalSpace to "1rem" for convenience. */
9
9
  withGaps?: boolean;
10
+ /** Alignment of items vertically */
10
11
  alignItems?: Components.flexItemAlign;
12
+ /** Sets dynamic horizontal spacing. If this is set, normal column spacing is ignored. */
13
+ justifyContent?: Components.flexJustifyContent;
11
14
  formGroupProps?: Components.IColumnWidthBreakpoints;
12
15
  }
13
16
  export declare class FormGroupLayoutContextParams {
@@ -15,25 +15,38 @@ var GridLayout = /** @class */ (function (_super) {
15
15
  return _super !== null && _super.apply(this, arguments) || this;
16
16
  }
17
17
  GridLayout.prototype.render = function () {
18
- var _a = this.props, gutterSize = _a.gutterSize, verticalSpace = _a.verticalSpace, withGaps = _a.withGaps, alignItems = _a.alignItems, formGroupProps = _a.formGroupProps, xs = _a.xs, sm = _a.sm, md = _a.md, lg = _a.lg, xl = _a.xl, xxl = _a.xxl, domProps = __rest(_a, ["gutterSize", "verticalSpace", "withGaps", "alignItems", "formGroupProps", "xs", "sm", "md", "lg", "xl", "xxl"]);
18
+ var _a = this.props, gutterSize = _a.gutterSize, verticalSpace = _a.verticalSpace, withGaps = _a.withGaps, alignItems = _a.alignItems, justifyContent = _a.justifyContent, formGroupProps = _a.formGroupProps, xs = _a.xs, sm = _a.sm, md = _a.md, lg = _a.lg, xl = _a.xl, xxl = _a.xxl, domProps = __rest(_a, ["gutterSize", "verticalSpace", "withGaps", "alignItems", "justifyContent", "formGroupProps", "xs", "sm", "md", "lg", "xl", "xxl"]);
19
19
  var isBsPre5 = BootstrapUtils.isPre5;
20
- var columnClassName = Utils.joinWithSpaces((gutterSize !== undefined && isBsPre5) ? "px-" + gutterSize : undefined, xs && "col-" + 12 / xs, sm && "col-sm-" + 12 / sm, md && "col-md-" + 12 / md, lg && "col-lg-" + 12 / lg, xl && "col-xl-" + 12 / xl, xxl && "col-xxl-" + 12 / xxl);
21
- if (!(xs || sm || md || lg || xl || xxl)) {
22
- columnClassName = Utils.joinWithSpaces(columnClassName, "col-md-6");
20
+ var hasColumns = (xs || sm || md || lg || xl || xxl);
21
+ var columnClassName = undefined;
22
+ var isJustifyBetween = justifyContent === "between";
23
+ var baseRowClassName = "row";
24
+ if (!justifyContent) {
25
+ columnClassName = Utils.joinWithSpaces((gutterSize !== undefined && isBsPre5) ? "px-" + gutterSize : undefined, xs && "col-" + 12 / xs, sm && "col-sm-" + 12 / sm, md && "col-md-" + 12 / md, lg && "col-lg-" + 12 / lg, xl && "col-xl-" + 12 / xl, xxl && "col-xxl-" + 12 / xxl);
26
+ if (!hasColumns) {
27
+ columnClassName = Utils.joinWithSpaces(columnClassName, "col-md-6");
28
+ }
23
29
  }
24
- var rowClassName = Utils.joinWithSpaces(domProps.className, "row", gutterSize && (isBsPre5 ? "mx-n" : "gx-") + this.props.gutterSize, alignItems && "align-items-" + this.props.alignItems);
30
+ else {
31
+ if (hasColumns) {
32
+ console.error("GridLayout: Columns should not be specified if justifyContent is specified.");
33
+ }
34
+ baseRowClassName = "d-flex justify-content-" + justifyContent;
35
+ }
36
+ var rowClassName = Utils.joinWithSpaces(domProps.className, baseRowClassName, gutterSize && (isBsPre5 ? "mx-n" : "gx-") + gutterSize, alignItems && "align-items-" + alignItems);
25
37
  var containerStyle = domProps.style;
26
- var columnStyle = undefined;
38
+ var columnStyle = { marginLeft: "auto" };
27
39
  if (withGaps && !verticalSpace) {
28
40
  verticalSpace = "1rem";
29
41
  }
30
42
  if (verticalSpace) {
31
43
  containerStyle = containerStyle || {};
32
44
  containerStyle.marginTop = "-" + verticalSpace;
33
- columnStyle = { marginTop: verticalSpace };
45
+ columnStyle = { marginTop: verticalSpace, marginLeft: "auto" };
34
46
  }
35
- return (React.createElement(FormGroupLayoutContext.Provider, { value: { formGroupProps: this.props.formGroupProps } },
36
- React.createElement("div", __assign({}, domProps, { className: rowClassName, style: containerStyle }), React.Children.map(this.props.children, function (child) { return (child && React.createElement("div", { className: columnClassName, style: columnStyle }, child)); }))));
47
+ var childCount = React.Children.count(this.props.children);
48
+ return (React.createElement(FormGroupLayoutContext.Provider, { value: { formGroupProps: formGroupProps } },
49
+ React.createElement("div", __assign({}, domProps, { className: rowClassName, style: containerStyle }), React.Children.map(this.props.children, function (child, index) { return (child && React.createElement("div", { className: columnClassName, style: __assign(__assign({}, columnStyle), { marginLeft: childCount === 2 && index === 1 && isJustifyBetween ? "auto" : undefined }) }, child)); }))));
37
50
  };
38
51
  return GridLayout;
39
52
  }(React.Component));
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  interface ColorPickerProps {
3
2
  color: string;
4
3
  onChange: (newColor: string) => void;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface IconStyle {
3
2
  /** True if the icon should be fixed width */
4
3
  fixedWidth?: boolean;
@@ -1,7 +1,7 @@
1
1
  import { __extends, __rest } from "tslib";
2
2
  import { Misc } from "@singularsystems/neo-core";
3
3
  import React from "react";
4
- import { NeoReactTypes } from "../..";
4
+ import { NeoReactTypes } from "../../Modules/Types";
5
5
  /** Renders an icon using the icon factory specified at startup. */
6
6
  var Icon = /** @class */ (function (_super) {
7
7
  __extends(Icon, _super);
@@ -1,11 +1,18 @@
1
1
  import React from 'react';
2
2
  interface ILinkProps extends React.HTMLProps<HTMLAnchorElement> {
3
+ /** Internal path to navigate to. */
4
+ to?: string;
5
+ /** Indicates that this link is part of a navigation structure, and will be active if it matches the current url. */
6
+ isNav?: boolean;
7
+ /** If `isNav` is set, then this will cause the url to match exactly instead of using startswith. */
8
+ exact?: boolean;
3
9
  }
4
10
  /**
5
11
  * Renders an anchor tag with an href of '/' unless otherwise specified.
6
12
  * The onClick event will call preventDefault() so that the anchor acts like a button instead of a link to a url.
7
13
  */
8
14
  export default class Link extends React.Component<ILinkProps> {
15
+ private basePath;
9
16
  constructor(props: ILinkProps);
10
17
  private onClick;
11
18
  render(): React.JSX.Element;
@@ -1,5 +1,8 @@
1
- import { __assign, __extends } from "tslib";
1
+ import { __assign, __decorate, __extends, __metadata, __rest } from "tslib";
2
+ import { AppServices, Misc, Utils } from "@singularsystems/neo-core";
2
3
  import React from 'react';
4
+ import { NeoReactTypes } from "../Modules/Types";
5
+ import { observer } from "mobx-react";
3
6
  /**
4
7
  * Renders an anchor tag with an href of '/' unless otherwise specified.
5
8
  * The onClick event will call preventDefault() so that the anchor acts like a button instead of a link to a url.
@@ -9,20 +12,50 @@ var Link = /** @class */ (function (_super) {
9
12
  function Link(props) {
10
13
  var _this = _super.call(this, props) || this;
11
14
  _this.onClick = _this.onClick.bind(_this);
15
+ _this.basePath = Misc.Globals.appService.get(NeoReactTypes.Routing.GlobalRoutingState).basePath;
12
16
  return _this;
13
17
  }
14
18
  Link.prototype.onClick = function (e) {
15
- e.preventDefault();
16
19
  if (this.props.onClick) {
17
20
  this.props.onClick(e);
18
21
  }
22
+ if (!e.defaultPrevented) {
23
+ e.preventDefault();
24
+ if (this.props.to) {
25
+ Misc.Globals.appService.get(AppServices.NeoTypes.Routing.NavigationHelper).navigateInternal(this.props.to);
26
+ }
27
+ }
19
28
  };
20
29
  Link.prototype.render = function () {
21
- var _a;
22
- var props = this.props;
23
- var href = (_a = props.href) !== null && _a !== void 0 ? _a : "/";
24
- return React.createElement("a", __assign({}, props, { href: href, onClick: this.onClick }), this.props.children);
30
+ var _a = this.props, to = _a.to, href = _a.href, isNav = _a.isNav, exact = _a.exact, rest = __rest(_a, ["to", "href", "isNav", "exact"]);
31
+ href !== null && href !== void 0 ? href : (href = "/");
32
+ if (to) {
33
+ if (to.startsWith("/") && !to.startsWith(this.basePath)) {
34
+ to = this.basePath + to;
35
+ }
36
+ href = to;
37
+ if (isNav) {
38
+ // Cause re-render if current route changes.
39
+ void Misc.Globals.appService.get(NeoReactTypes.Routing.GlobalRoutingState).currentRoute;
40
+ var path = window.location.pathname.toLowerCase();
41
+ var toLc = to.toLowerCase();
42
+ if (path.endsWith("/")) {
43
+ path = path.substring(0, path.length - 1);
44
+ }
45
+ var isMatch = exact === true ?
46
+ toLc === path :
47
+ path.startsWith(toLc);
48
+ if (isMatch) {
49
+ rest.className = Utils.joinWithSpaces(rest.className, "active");
50
+ }
51
+ }
52
+ }
53
+ return React.createElement("a", __assign({}, rest, { href: href, onClick: this.onClick }), this.props.children);
25
54
  };
55
+ Link = __decorate([
56
+ observer,
57
+ __metadata("design:paramtypes", [Object])
58
+ ], Link);
26
59
  return Link;
27
60
  }(React.Component));
28
61
  export default Link;
@@ -4,9 +4,9 @@ import ModalPortal from './ModalPortal';
4
4
  import { Misc, Utils } from '@singularsystems/neo-core';
5
5
  import Button from '../Button';
6
6
  import { Settings } from '@singularsystems/neo-core/dist/Settings';
7
- import { Neo } from '../..';
8
7
  import { observer } from 'mobx-react';
9
8
  import BootstrapUtils from "../BootstrapUtils";
9
+ import Form from "../Form";
10
10
  var Modal = /** @class */ (function (_super) {
11
11
  __extends(Modal, _super);
12
12
  function Modal() {
@@ -114,7 +114,7 @@ var Modal = /** @class */ (function (_super) {
114
114
  container = React.createElement(React.Fragment, null, content);
115
115
  }
116
116
  else {
117
- container = React.createElement(Neo.Form, __assign({}, formProps, { onSubmit: function (e) { _this.onSubmit && _this.onSubmit(e); } }), content);
117
+ container = React.createElement(Form, __assign({}, formProps, { onSubmit: function (e) { _this.onSubmit && _this.onSubmit(e); } }), content);
118
118
  }
119
119
  return (this.visible &&
120
120
  React.createElement(ModalPortal, { show: show, onDismiss: onClose, options: this.props },
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * Watches all observables accessed during the getState callback.
4
3
  * When any of the value of these observables change, forceUpdate is called on the component.
@@ -4,6 +4,7 @@ import { observer } from "mobx-react";
4
4
  import { TabContext } from "./TabContainer";
5
5
  import { Misc } from "@singularsystems/neo-core";
6
6
  import { NeoReactTypes } from "../../Modules/Types";
7
+ import TransitionPanel from "../Transitions/TransitionPanel";
7
8
  var Tab = /** @class */ (function (_super) {
8
9
  __extends(Tab, _super);
9
10
  function Tab(props) {
@@ -58,7 +59,10 @@ var Tab = /** @class */ (function (_super) {
58
59
  if (isSelected) {
59
60
  this.hasRenderedContents = true;
60
61
  }
61
- return ((isSelected || forceRender) && React.createElement("div", { className: "tab-pane" + (isSelected ? " show active" : "") }, this.props.children));
62
+ var tabPane = React.createElement("div", { className: "tab-pane" + (isSelected ? " show active" : "") }, this.props.children);
63
+ return this.context.animate ?
64
+ React.createElement(TransitionPanel, { isVisible: isSelected }, tabPane) :
65
+ (isSelected || forceRender) && tabPane;
62
66
  };
63
67
  Tab.contextType = TabContext;
64
68
  Tab = __decorate([
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
2
  import { Components } from "@singularsystems/neo-core";
3
3
  import { IObservableValue } from "@singularsystems/neo-core/dist/Model/ObservableValue";
4
- import { TabManager, ITabManagerInternal } from './TabManager';
4
+ import { TabManager } from './TabManager';
5
+ import { Transition } from "../Transitions/Transition";
5
6
  export interface ITabContainerProps {
6
7
  /**
7
8
  * Optional tab manager for managing selected tab / tab change events.
@@ -23,15 +24,18 @@ export interface ITabContainerProps {
23
24
  * Use this if you want ui state e.g. scroll positions to remain on switch of tabs.
24
25
  */
25
26
  keepMounted?: boolean;
27
+ /** True if switching tabs should animate. */
28
+ animate?: boolean | Transition;
26
29
  }
27
30
  export declare class TabContextParams {
28
- tabManager: ITabManagerInternal;
31
+ tabManager: TabManager;
29
32
  /**
30
33
  * True if the tab manager was passed in to the tab container.
31
34
  */
32
35
  isUserTabManager: boolean;
33
36
  inHeader: boolean;
34
37
  keepMounted?: boolean;
38
+ animate?: boolean;
35
39
  }
36
40
  export declare const TabContext: React.Context<TabContextParams>;
37
41
  export default class TabContainer extends React.Component<ITabContainerProps & React.HTMLProps<HTMLDivElement>> {
@@ -1,7 +1,9 @@
1
1
  import { __assign, __extends, __rest } from "tslib";
2
2
  import React from "react";
3
- import { Components, Utils } from "@singularsystems/neo-core";
3
+ import { Components, Misc, Utils } from "@singularsystems/neo-core";
4
4
  import { TabManager } from './TabManager';
5
+ import { TransitionContainer } from "../_Exports";
6
+ import { Transition } from "../Transitions/Transition";
5
7
  var TabContextParams = /** @class */ (function () {
6
8
  function TabContextParams() {
7
9
  /**
@@ -19,15 +21,13 @@ var TabContainer = /** @class */ (function (_super) {
19
21
  function TabContainer(props) {
20
22
  var _this = _super.call(this, props) || this;
21
23
  _this.tabContext = new TabContextParams();
22
- var tabManager;
23
24
  if (_this.props.tabManager) {
24
- tabManager = _this.props.tabManager;
25
+ _this.tabManager = _this.props.tabManager;
25
26
  _this.tabContext.isUserTabManager = true;
26
27
  }
27
28
  else {
28
- tabManager = new TabManager("", true, _this.props.selectedTab);
29
+ _this.tabManager = new TabManager("", true, _this.props.selectedTab);
29
30
  }
30
- _this.tabManager = tabManager;
31
31
  _this.tabContext.tabManager = _this.tabManager;
32
32
  return _this;
33
33
  }
@@ -38,24 +38,22 @@ var TabContainer = /** @class */ (function (_super) {
38
38
  this.tabManager.onUnmount();
39
39
  };
40
40
  TabContainer.prototype.render = function () {
41
- var _a = this.props, tabManager = _a.tabManager, selectedTab = _a.selectedTab, variant = _a.variant, fillMode = _a.fillMode, align = _a.align, verticalSizes = _a.verticalSizes, keepMounted = _a.keepMounted, domProps = __rest(_a, ["tabManager", "selectedTab", "variant", "fillMode", "align", "verticalSizes", "keepMounted"]);
41
+ var _a = this.props, tabManager = _a.tabManager, selectedTab = _a.selectedTab, variant = _a.variant, fillMode = _a.fillMode, align = _a.align, verticalSizes = _a.verticalSizes, keepMounted = _a.keepMounted, animate = _a.animate, domProps = __rest(_a, ["tabManager", "selectedTab", "variant", "fillMode", "align", "verticalSizes", "keepMounted", "animate"]);
42
42
  this.tabContext.keepMounted = keepMounted;
43
+ this.tabContext.animate = (animate !== null && animate !== void 0 ? animate : Misc.Settings.tabs.animate) !== false;
43
44
  if (!verticalSizes)
44
45
  verticalSizes = {};
45
46
  if (!verticalSizes.xs)
46
47
  verticalSizes.xs = 12;
47
48
  var isCardMode = (variant === "tabs" || !variant);
48
- if (variant === "flat") {
49
- variant = "tabs";
50
- }
51
49
  var _b = Components.BootstrapHelpers.getInverseBreakpointClasses(verticalSizes), cols = _b.cols, inverseCols = _b.inverseCols;
52
50
  domProps.className = Utils.joinWithSpaces(domProps.className, "row neo-tab-container", isCardMode ? "neo-tab-card-mode" : undefined);
53
51
  return (React.createElement(TabContext.Provider, { value: this.tabContext },
54
52
  React.createElement("div", __assign({}, domProps),
55
53
  React.createElement("div", { className: "tabs-header " + cols },
56
- React.createElement(TabSection, { isHeader: true, containerProps: { verticalSizes: verticalSizes, variant: variant, fillMode: fillMode, align: align } }, this.props.children)),
54
+ React.createElement(TabSection, { isHeader: true, containerProps: this.props }, this.props.children)),
57
55
  React.createElement("div", { className: inverseCols },
58
- React.createElement(TabSection, { isHeader: false }, this.props.children)))));
56
+ React.createElement(TabSection, { isHeader: false, containerProps: this.props }, this.props.children)))));
59
57
  };
60
58
  return TabContainer;
61
59
  }(React.Component));
@@ -66,17 +64,21 @@ var TabSection = /** @class */ (function (_super) {
66
64
  return _super !== null && _super.apply(this, arguments) || this;
67
65
  }
68
66
  TabSection.prototype.render = function () {
69
- this.context.inHeader = this.props.isHeader;
70
- var headerClassName = "nav ";
67
+ var _a = this.props, isHeader = _a.isHeader, containerProps = _a.containerProps;
68
+ this.context.inHeader = isHeader;
69
+ var headerClassName = "nav";
71
70
  if (this.props.isHeader) {
72
- var containerProps = this.props.containerProps;
71
+ var variant = containerProps.variant;
72
+ if (variant === "flat") {
73
+ variant = "tabs";
74
+ }
73
75
  if (containerProps.verticalSizes) {
74
76
  var breakpoint = Components.BootstrapHelpers.getFirstBreakpoint(containerProps.verticalSizes);
75
77
  if (breakpoint)
76
78
  headerClassName += " flex-" + breakpoint + "-column";
77
79
  }
78
- if (containerProps.variant !== "none") {
79
- headerClassName += " nav-" + (containerProps.variant || "tabs");
80
+ if (variant !== "none") {
81
+ headerClassName += " nav-" + (variant || "tabs");
80
82
  }
81
83
  if (containerProps.fillMode) {
82
84
  headerClassName += " nav-" + containerProps.fillMode;
@@ -85,9 +87,15 @@ var TabSection = /** @class */ (function (_super) {
85
87
  headerClassName += " justify-content-" + containerProps.align;
86
88
  }
87
89
  }
90
+ var transition = typeof containerProps.animate === "object" ? containerProps.animate : undefined;
91
+ if (!transition && containerProps.verticalSizes) {
92
+ transition = Transition.upDown;
93
+ }
88
94
  return (this.props.isHeader ?
89
95
  React.createElement("ul", { className: headerClassName }, this.props.children) :
90
- React.createElement("div", { className: "tab-content" }, this.props.children));
96
+ React.createElement("div", { className: "tab-content" }, this.context.animate ?
97
+ React.createElement(TransitionContainer, { transition: transition }, this.props.children) :
98
+ this.props.children));
91
99
  };
92
100
  TabSection.contextType = TabContext;
93
101
  return TabSection;
@@ -1,5 +1,4 @@
1
1
  import { Misc, Model } from '@singularsystems/neo-core';
2
- import { ICancellableEvent } from '../Misc';
3
2
  export interface ITabManager {
4
3
  selectedTab: string;
5
4
  /**
@@ -11,11 +10,6 @@ export interface ITabManager {
11
10
  */
12
11
  onTabDisplayed(tabKey: string, callback: () => void): ITabManager;
13
12
  }
14
- export interface ITabManagerInternal extends ITabManager {
15
- initialise(): void;
16
- tabMounted(tabKey: string, onLeave?: (e: ICancellableEvent) => void): void;
17
- onUnmount(): void;
18
- }
19
13
  /**
20
14
  * Tab manager used to manage a tab component.
21
15
  * @param T string union type of tab names.
@@ -30,10 +24,6 @@ export declare class TabManager<T extends string = string> implements Misc.IDisp
30
24
  * @param autoSelectFirstTab Set to true if the first child tab should become selected.
31
25
  */
32
26
  constructor(selectedTab?: T, autoSelectFirstTab?: boolean, observable?: Model.IObservableValue<T>);
33
- /** Called by tab container. */
34
- private initialise;
35
- /** Called by tab container. */
36
- private onUnmount;
37
27
  get selectedTab(): T;
38
28
  set selectedTab(value: T);
39
29
  /**
@@ -44,8 +34,6 @@ export declare class TabManager<T extends string = string> implements Misc.IDisp
44
34
  * Registers a callback to run whenever the tab with this tab key is displayed.
45
35
  */
46
36
  onTabDisplayed(tabKey: T, callback: () => void): this;
47
- /** Called by tab container. */
48
- private tabMounted;
49
37
  private getTab;
50
38
  /**
51
39
  * Marks the tab as 'initial'.