@singularsystems/neo-react 1.0.0-alpha.2 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +98 -0
- package/README.md +4 -0
- package/dist/Modules/NeoReactModule.d.ts +4 -4
- package/dist/Modules/NeoReactModule.js +28 -26
- package/dist/Modules/ReactSetup.d.ts +2 -2
- package/dist/Modules/ReactSetup.js +17 -17
- package/dist/Modules/Types.d.ts +63 -61
- package/dist/Modules/Types.js +13 -12
- package/dist/React/AutoRunner.d.ts +5 -5
- package/dist/React/AutoRunner.js +94 -92
- package/dist/React/DataView.d.ts +6 -6
- package/dist/React/DataView.js +11 -11
- package/dist/React/ReactModelCreator.d.ts +11 -11
- package/dist/React/ReactModelCreator.js +165 -162
- package/dist/ReactComponents/Button.d.ts +24 -23
- package/dist/ReactComponents/Button.js +131 -123
- package/dist/ReactComponents/Card.d.ts +24 -23
- package/dist/ReactComponents/Card.js +56 -54
- package/dist/ReactComponents/Collapsable.d.ts +23 -23
- package/dist/ReactComponents/Collapsable.js +38 -38
- package/dist/ReactComponents/CollapsableBase.d.ts +13 -13
- package/dist/ReactComponents/CollapsableBase.js +42 -42
- package/dist/ReactComponents/ColorPicker.d.ts +26 -26
- package/dist/ReactComponents/ColorPicker.js +67 -67
- package/dist/ReactComponents/ComponentBase.d.ts +17 -17
- package/dist/ReactComponents/ComponentBase.js +33 -33
- package/dist/ReactComponents/ContextMenu/ContextMenu.d.ts +25 -24
- package/dist/ReactComponents/ContextMenu/ContextMenu.js +91 -88
- package/dist/ReactComponents/ContextMenu/ContextMenuContainer.d.ts +14 -14
- package/dist/ReactComponents/ContextMenu/ContextMenuContainer.js +48 -48
- package/dist/ReactComponents/ContextMenu/ContextMenuState.d.ts +8 -7
- package/dist/ReactComponents/ContextMenu/ContextMenuState.js +23 -23
- package/dist/ReactComponents/DatePicker.d.ts +19 -19
- package/dist/ReactComponents/DatePicker.js +53 -53
- package/dist/ReactComponents/DropDown/AutoCompleteDropDown.d.ts +93 -83
- package/dist/ReactComponents/DropDown/AutoCompleteDropDown.js +222 -188
- package/dist/ReactComponents/DropDown/DropDown.d.ts +44 -44
- package/dist/ReactComponents/DropDown/DropDown.js +138 -134
- package/dist/ReactComponents/DropDown/DropDownBase.d.ts +16 -15
- package/dist/ReactComponents/DropDown/DropDownBase.js +86 -108
- package/dist/ReactComponents/DropDown/LookupHelper.d.ts +13 -0
- package/dist/ReactComponents/DropDown/LookupHelper.js +45 -0
- package/dist/ReactComponents/ErrorHandler.d.ts +9 -8
- package/dist/ReactComponents/ErrorHandler.js +92 -91
- package/dist/ReactComponents/FileManager/FileBasicInput.d.ts +20 -20
- package/dist/ReactComponents/FileManager/FileBasicInput.js +70 -70
- package/dist/ReactComponents/FileManager/FileContext.d.ts +16 -16
- package/dist/ReactComponents/FileManager/FileContext.js +24 -24
- package/dist/ReactComponents/FileManager/FileDropArea.d.ts +19 -18
- package/dist/ReactComponents/FileManager/FileDropArea.js +66 -64
- package/dist/ReactComponents/FileManager/FileInput.d.ts +44 -42
- package/dist/ReactComponents/FileManager/FileInput.js +191 -189
- package/dist/ReactComponents/FileManager/FileUploadButton.d.ts +17 -17
- package/dist/ReactComponents/FileManager/FileUploadButton.js +49 -49
- package/dist/ReactComponents/FileManager/FileUploadProgress.d.ts +14 -14
- package/dist/ReactComponents/FileManager/FileUploadProgress.js +35 -35
- package/dist/ReactComponents/Form.d.ts +19 -18
- package/dist/ReactComponents/Form.js +90 -90
- package/dist/ReactComponents/FormContext.d.ts +33 -31
- package/dist/ReactComponents/FormContext.js +39 -40
- package/dist/ReactComponents/FormGroup/FormGroup.d.ts +37 -37
- package/dist/ReactComponents/FormGroup/FormGroup.js +83 -84
- package/dist/ReactComponents/FormGroup/FormGroupFloating.d.ts +19 -19
- package/dist/ReactComponents/FormGroup/FormGroupFloating.js +97 -97
- package/dist/ReactComponents/FormGroup/FormGroupInline.d.ts +11 -11
- package/dist/ReactComponents/FormGroup/FormGroupInline.js +43 -43
- package/dist/ReactComponents/Grid/ButtonColumn.d.ts +47 -47
- package/dist/ReactComponents/Grid/ButtonColumn.js +81 -82
- package/dist/ReactComponents/Grid/Column.d.ts +47 -47
- package/dist/ReactComponents/Grid/Column.js +205 -205
- package/dist/ReactComponents/Grid/ColumnHelper.d.ts +12 -12
- package/dist/ReactComponents/Grid/ColumnHelper.js +19 -19
- package/dist/ReactComponents/Grid/Grid.d.ts +87 -90
- package/dist/ReactComponents/Grid/Grid.js +203 -203
- package/dist/ReactComponents/Grid/Row.d.ts +81 -81
- package/dist/ReactComponents/Grid/Row.js +200 -201
- package/dist/ReactComponents/Grid/_Exports.d.ts +5 -5
- package/dist/ReactComponents/Grid/_Exports.js +5 -5
- package/dist/ReactComponents/GridLayout.d.ts +20 -20
- package/dist/ReactComponents/GridLayout.js +38 -38
- package/dist/ReactComponents/Icons/FontAwesomeIconFactory.d.ts +23 -0
- package/dist/ReactComponents/Icons/FontAwesomeIconFactory.js +43 -0
- package/dist/ReactComponents/Icons/IIconFactory.d.ts +21 -0
- package/dist/ReactComponents/Icons/IIconFactory.js +1 -0
- package/dist/ReactComponents/Icons/IconFactory.d.ts +9 -0
- package/dist/ReactComponents/Icons/IconFactory.js +45 -0
- package/dist/ReactComponents/Icons/index.d.ts +3 -0
- package/dist/ReactComponents/Icons/index.js +2 -0
- package/dist/ReactComponents/Input.d.ts +45 -45
- package/dist/ReactComponents/Input.js +153 -152
- package/dist/ReactComponents/InputHelpers.d.ts +6 -5
- package/dist/ReactComponents/InputHelpers.js +29 -33
- package/dist/ReactComponents/Link.d.ts +13 -13
- package/dist/ReactComponents/Link.js +28 -28
- package/dist/ReactComponents/Loader.d.ts +18 -18
- package/dist/ReactComponents/Loader.js +57 -57
- package/dist/ReactComponents/Misc.d.ts +15 -15
- package/dist/ReactComponents/Misc.js +28 -28
- package/dist/ReactComponents/Modal/Modal.d.ts +11 -11
- package/dist/ReactComponents/Modal/Modal.js +129 -129
- package/dist/ReactComponents/Modal/ModalContainer.d.ts +17 -17
- package/dist/ReactComponents/Modal/ModalContainer.js +37 -37
- package/dist/ReactComponents/Modal/ModalPortal.d.ts +16 -15
- package/dist/ReactComponents/Modal/ModalPortal.js +27 -27
- package/dist/ReactComponents/Notifications/Alert.d.ts +7 -6
- package/dist/ReactComponents/Notifications/Alert.js +38 -35
- package/dist/ReactComponents/Notifications/Toast.d.ts +9 -8
- package/dist/ReactComponents/Notifications/Toast.js +47 -45
- package/dist/ReactComponents/Notifications/ToastContainer.d.ts +8 -8
- package/dist/ReactComponents/Notifications/ToastContainer.js +18 -18
- package/dist/ReactComponents/NumberInput.d.ts +57 -50
- package/dist/ReactComponents/NumberInput.js +260 -246
- package/dist/ReactComponents/Paging/BasicPagerControls.d.ts +26 -25
- package/dist/ReactComponents/Paging/BasicPagerControls.js +57 -55
- package/dist/ReactComponents/Paging/PageSizeControl.d.ts +11 -11
- package/dist/ReactComponents/Paging/PageSizeControl.js +21 -21
- package/dist/ReactComponents/Paging/Pager.d.ts +24 -24
- package/dist/ReactComponents/Paging/Pager.js +41 -41
- package/dist/ReactComponents/ProgressBar.d.ts +19 -19
- package/dist/ReactComponents/ProgressBar.js +52 -52
- package/dist/ReactComponents/PropTypes.d.ts +161 -161
- package/dist/ReactComponents/PropTypes.js +253 -236
- package/dist/ReactComponents/RadioList.d.ts +29 -29
- package/dist/ReactComponents/RadioList.js +59 -77
- package/dist/ReactComponents/Slider.d.ts +28 -28
- package/dist/ReactComponents/Slider.js +76 -76
- package/dist/ReactComponents/StateObserver.d.ts +15 -15
- package/dist/ReactComponents/StateObserver.js +35 -35
- package/dist/ReactComponents/Tabs/Tab.d.ts +42 -41
- package/dist/ReactComponents/Tabs/Tab.js +71 -72
- package/dist/ReactComponents/Tabs/TabContainer.d.ts +44 -44
- package/dist/ReactComponents/Tabs/TabContainer.js +98 -98
- package/dist/ReactComponents/Tabs/TabManager.d.ts +62 -62
- package/dist/ReactComponents/Tabs/TabManager.js +154 -154
- package/dist/ReactComponents/Tooltip.d.ts +20 -19
- package/dist/ReactComponents/Tooltip.js +51 -51
- package/dist/ReactComponents/TooltipHelper.d.ts +8 -8
- package/dist/ReactComponents/TooltipHelper.js +84 -84
- package/dist/ReactComponents/TooltipProvider.d.ts +30 -30
- package/dist/ReactComponents/TooltipProvider.js +111 -111
- package/dist/ReactComponents/ValidationSummary.d.ts +23 -22
- package/dist/ReactComponents/ValidationSummary.js +46 -43
- package/dist/ReactComponents/_Exports.d.ts +41 -41
- package/dist/ReactComponents/_Exports.js +41 -41
- package/dist/ReactComponents/_Managers.d.ts +4 -4
- package/dist/ReactComponents/_Managers.js +4 -4
- package/dist/Routing/BreadCrumbItem.d.ts +14 -14
- package/dist/Routing/BreadCrumbItem.js +12 -12
- package/dist/Routing/IRouteChangedProps.d.ts +31 -31
- package/dist/Routing/IRouteChangedProps.js +1 -1
- package/dist/Routing/IRouteParameter.d.ts +22 -22
- package/dist/Routing/IRouteParameter.js +9 -9
- package/dist/Routing/MenuRoute.d.ts +25 -24
- package/dist/Routing/MenuRoute.js +24 -24
- package/dist/Routing/NavigationHelper.d.ts +41 -40
- package/dist/Routing/NavigationHelper.js +61 -61
- package/dist/Routing/PageLeaveHandler.d.ts +13 -13
- package/dist/Routing/PageLeaveHandler.js +74 -74
- package/dist/Routing/RouteProvider.d.ts +31 -31
- package/dist/Routing/RouteProvider.js +92 -92
- package/dist/Routing/RouteView.d.ts +50 -50
- package/dist/Routing/RouteView.js +143 -144
- package/dist/Routing/RoutingState.d.ts +18 -15
- package/dist/Routing/RoutingState.js +45 -40
- package/dist/Routing/ViewParameter.d.ts +80 -58
- package/dist/Routing/ViewParameter.js +116 -95
- package/dist/Routing/ViewParameterList.d.ts +53 -53
- package/dist/Routing/ViewParameterList.js +163 -145
- package/dist/Routing/index.d.ts +9 -9
- package/dist/Routing/index.js +6 -6
- package/dist/Services/DisposeHelper.d.ts +15 -15
- package/dist/Services/DisposeHelper.js +40 -41
- package/dist/Services/IDisposeHelper.d.ts +12 -12
- package/dist/Services/IDisposeHelper.js +1 -1
- package/dist/Views/EmptyViewModel.d.ts +5 -5
- package/dist/Views/EmptyViewModel.js +14 -14
- package/dist/Views/IViewModel.d.ts +16 -16
- package/dist/Views/IViewModel.js +1 -1
- package/dist/Views/PersistentViewBase.d.ts +10 -10
- package/dist/Views/PersistentViewBase.js +21 -21
- package/dist/Views/ViewBase.d.ts +70 -71
- package/dist/Views/ViewBase.js +166 -153
- package/dist/Views/ViewComponentBase.d.ts +19 -13
- package/dist/Views/ViewComponentBase.js +24 -21
- package/dist/Views/ViewModelBase.d.ts +57 -56
- package/dist/Views/ViewModelBase.js +122 -118
- package/dist/Views/ViewState.d.ts +13 -13
- package/dist/Views/ViewState.js +9 -9
- package/dist/Views/index.d.ts +5 -5
- package/dist/Views/index.js +5 -5
- package/dist/index.d.ts +11 -10
- package/dist/index.js +10 -9
- package/package.json +26 -26
- package/styles/DatePicker.scss +2 -2
- package/styles/Forms.scss +5 -0
- package/styles/Validation.scss +0 -9
|
@@ -1,72 +1,71 @@
|
|
|
1
|
-
import { __decorate, __extends, __metadata } from "tslib";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { observer } from "mobx-react";
|
|
4
|
-
import { TabContext } from "./TabContainer";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
_this
|
|
13
|
-
_this.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
Tab
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
export default Tab;
|
|
1
|
+
import { __decorate, __extends, __metadata } from "tslib";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { observer } from "mobx-react";
|
|
4
|
+
import { TabContext } from "./TabContainer";
|
|
5
|
+
import { Misc } from "@singularsystems/neo-core";
|
|
6
|
+
import { NeoReactTypes } from "../../Modules/Types";
|
|
7
|
+
var Tab = /** @class */ (function (_super) {
|
|
8
|
+
__extends(Tab, _super);
|
|
9
|
+
function Tab(props) {
|
|
10
|
+
var _this = this;
|
|
11
|
+
var _a;
|
|
12
|
+
_this = _super.call(this, props) || this;
|
|
13
|
+
_this.hasRenderedContents = false;
|
|
14
|
+
_this.iconFactory = Misc.Globals.appService.get(NeoReactTypes.Components.IconFactory);
|
|
15
|
+
_this.onClick = _this.onClick.bind(_this);
|
|
16
|
+
var tabKey = (_a = _this.props.id) !== null && _a !== void 0 ? _a : _this.props.name;
|
|
17
|
+
if (!tabKey) {
|
|
18
|
+
if (typeof _this.props.header === "string") {
|
|
19
|
+
tabKey = _this.props.header;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
throw Error("'Name' prop must be specified on tab when it's header is a component.");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
_this.tabKey = tabKey;
|
|
26
|
+
return _this;
|
|
27
|
+
}
|
|
28
|
+
Tab.prototype.componentDidMount = function () {
|
|
29
|
+
if (this.props.onInitialise) {
|
|
30
|
+
this.context.tabManager.onTabInitialise(this.tabKey, this.props.onInitialise);
|
|
31
|
+
}
|
|
32
|
+
if (this.props.onDisplayed) {
|
|
33
|
+
this.context.tabManager.onTabDisplayed(this.tabKey, this.props.onDisplayed);
|
|
34
|
+
}
|
|
35
|
+
this.context.tabManager.tabMounted(this.tabKey, this.props.onLeave);
|
|
36
|
+
};
|
|
37
|
+
Tab.prototype.render = function () {
|
|
38
|
+
if (this.isHeader === undefined)
|
|
39
|
+
this.isHeader = this.context.inHeader;
|
|
40
|
+
var isSelected = this.context.tabManager.selectedTab.toLowerCase() === this.tabKey.toLowerCase();
|
|
41
|
+
return this.isHeader ? this.renderHeader(isSelected) : this.renderBody(isSelected);
|
|
42
|
+
};
|
|
43
|
+
Tab.prototype.onClick = function (e) {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
if (!this.props.disabled) {
|
|
46
|
+
this.context.tabManager.selectedTab = this.tabKey;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
Tab.prototype.renderHeader = function (isSelected) {
|
|
50
|
+
var hasIcon = this.props.icon !== undefined;
|
|
51
|
+
return (React.createElement("li", { className: "nav-item" },
|
|
52
|
+
React.createElement("a", { className: "nav-link" + (isSelected ? " active" : "") + (this.props.disabled ? " disabled" : ""), href: "#", onClick: this.onClick },
|
|
53
|
+
hasIcon && this.iconFactory.getIconComponent(this.props.icon),
|
|
54
|
+
hasIcon && " ",
|
|
55
|
+
this.props.header)));
|
|
56
|
+
};
|
|
57
|
+
Tab.prototype.renderBody = function (isSelected) {
|
|
58
|
+
var forceRender = this.context.keepMounted === true && this.hasRenderedContents;
|
|
59
|
+
if (isSelected) {
|
|
60
|
+
this.hasRenderedContents = true;
|
|
61
|
+
}
|
|
62
|
+
return ((isSelected || forceRender) && React.createElement("div", { className: "tab-pane" + (isSelected ? " show active" : "") }, this.props.children));
|
|
63
|
+
};
|
|
64
|
+
Tab.contextType = TabContext;
|
|
65
|
+
Tab = __decorate([
|
|
66
|
+
observer,
|
|
67
|
+
__metadata("design:paramtypes", [Object])
|
|
68
|
+
], Tab);
|
|
69
|
+
return Tab;
|
|
70
|
+
}(React.Component));
|
|
71
|
+
export default Tab;
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Components } from "@singularsystems/neo-core";
|
|
3
|
-
import { IObservableValue } from "@singularsystems/neo-core/dist/Model/ObservableValue";
|
|
4
|
-
import { TabManager, ITabManagerInternal } from './TabManager';
|
|
5
|
-
export interface ITabContainerProps {
|
|
6
|
-
/**
|
|
7
|
-
* Optional tab manager for managing selected tab / tab change events.
|
|
8
|
-
*/
|
|
9
|
-
tabManager?: TabManager;
|
|
10
|
-
/**
|
|
11
|
-
* Optional selected tab property for binding the selected tab. Leave undefined if tabManager is specified.
|
|
12
|
-
*/
|
|
13
|
-
selectedTab?: IObservableValue<string>;
|
|
14
|
-
variant?: "tabs" | "pills" | "none" | "flat";
|
|
15
|
-
fillMode?: "fill" | "justified";
|
|
16
|
-
align?: Components.flexItemAlign;
|
|
17
|
-
/**
|
|
18
|
-
* Causes the tabs to stack vertically. These sizes define how many columns the tab selectors fill at each screen size. The tab content will fill the remaining columns.
|
|
19
|
-
*/
|
|
20
|
-
verticalSizes?: Components.IColumnWidthBreakpoints;
|
|
21
|
-
/**
|
|
22
|
-
* If set, will cause tabs to remain mounted after they are activated. The tab content will be hidden using css.
|
|
23
|
-
* Use this if you want ui state e.g. scroll positions to remain on switch of tabs.
|
|
24
|
-
*/
|
|
25
|
-
keepMounted?: boolean;
|
|
26
|
-
}
|
|
27
|
-
export declare class TabContextParams {
|
|
28
|
-
tabManager: ITabManagerInternal;
|
|
29
|
-
/**
|
|
30
|
-
* True if the tab manager was passed in to the tab container.
|
|
31
|
-
*/
|
|
32
|
-
isUserTabManager: boolean;
|
|
33
|
-
inHeader: boolean;
|
|
34
|
-
keepMounted?: boolean;
|
|
35
|
-
}
|
|
36
|
-
export declare const TabContext: React.Context<TabContextParams>;
|
|
37
|
-
export default class TabContainer extends React.Component<ITabContainerProps & React.HTMLProps<HTMLDivElement>> {
|
|
38
|
-
private tabContext;
|
|
39
|
-
private tabManager;
|
|
40
|
-
constructor(props: ITabContainerProps & React.HTMLProps<HTMLDivElement>);
|
|
41
|
-
componentDidMount(): void;
|
|
42
|
-
componentWillUnmount(): void;
|
|
43
|
-
render(): JSX.Element;
|
|
44
|
-
}
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Components } from "@singularsystems/neo-core";
|
|
3
|
+
import { IObservableValue } from "@singularsystems/neo-core/dist/Model/ObservableValue";
|
|
4
|
+
import { TabManager, ITabManagerInternal } from './TabManager';
|
|
5
|
+
export interface ITabContainerProps {
|
|
6
|
+
/**
|
|
7
|
+
* Optional tab manager for managing selected tab / tab change events.
|
|
8
|
+
*/
|
|
9
|
+
tabManager?: TabManager;
|
|
10
|
+
/**
|
|
11
|
+
* Optional selected tab property for binding the selected tab. Leave undefined if tabManager is specified.
|
|
12
|
+
*/
|
|
13
|
+
selectedTab?: IObservableValue<string>;
|
|
14
|
+
variant?: "tabs" | "pills" | "none" | "flat";
|
|
15
|
+
fillMode?: "fill" | "justified";
|
|
16
|
+
align?: Components.flexItemAlign;
|
|
17
|
+
/**
|
|
18
|
+
* Causes the tabs to stack vertically. These sizes define how many columns the tab selectors fill at each screen size. The tab content will fill the remaining columns.
|
|
19
|
+
*/
|
|
20
|
+
verticalSizes?: Components.IColumnWidthBreakpoints;
|
|
21
|
+
/**
|
|
22
|
+
* If set, will cause tabs to remain mounted after they are activated. The tab content will be hidden using css.
|
|
23
|
+
* Use this if you want ui state e.g. scroll positions to remain on switch of tabs.
|
|
24
|
+
*/
|
|
25
|
+
keepMounted?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare class TabContextParams {
|
|
28
|
+
tabManager: ITabManagerInternal;
|
|
29
|
+
/**
|
|
30
|
+
* True if the tab manager was passed in to the tab container.
|
|
31
|
+
*/
|
|
32
|
+
isUserTabManager: boolean;
|
|
33
|
+
inHeader: boolean;
|
|
34
|
+
keepMounted?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export declare const TabContext: React.Context<TabContextParams>;
|
|
37
|
+
export default class TabContainer extends React.Component<ITabContainerProps & React.HTMLProps<HTMLDivElement>> {
|
|
38
|
+
private tabContext;
|
|
39
|
+
private tabManager;
|
|
40
|
+
constructor(props: ITabContainerProps & React.HTMLProps<HTMLDivElement>);
|
|
41
|
+
componentDidMount(): void;
|
|
42
|
+
componentWillUnmount(): void;
|
|
43
|
+
render(): JSX.Element;
|
|
44
|
+
}
|
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { Components, Utils } from "@singularsystems/neo-core";
|
|
4
|
-
import { ObservableValue } from "@singularsystems/neo-core/dist/Model/ObservableValue";
|
|
5
|
-
import { TabManager } from './TabManager';
|
|
6
|
-
var TabContextParams = /** @class */ (function () {
|
|
7
|
-
function TabContextParams() {
|
|
8
|
-
/**
|
|
9
|
-
* True if the tab manager was passed in to the tab container.
|
|
10
|
-
*/
|
|
11
|
-
this.isUserTabManager = false;
|
|
12
|
-
this.inHeader = true;
|
|
13
|
-
}
|
|
14
|
-
return TabContextParams;
|
|
15
|
-
}());
|
|
16
|
-
export { TabContextParams };
|
|
17
|
-
export var TabContext = React.createContext(new TabContextParams());
|
|
18
|
-
var TabContainer = /** @class */ (function (_super) {
|
|
19
|
-
__extends(TabContainer, _super);
|
|
20
|
-
function TabContainer(props) {
|
|
21
|
-
var _this = this;
|
|
22
|
-
var _a;
|
|
23
|
-
_this = _super.call(this, props) || this;
|
|
24
|
-
_this.tabContext = new TabContextParams();
|
|
25
|
-
var tabManager;
|
|
26
|
-
if (_this.props.tabManager) {
|
|
27
|
-
tabManager = _this.props.tabManager;
|
|
28
|
-
_this.tabContext.isUserTabManager = true;
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
tabManager = new TabManager("", true);
|
|
32
|
-
tabManager.observable = (_a = _this.props.selectedTab) !== null && _a !== void 0 ? _a : new ObservableValue("");
|
|
33
|
-
}
|
|
34
|
-
_this.tabManager = tabManager;
|
|
35
|
-
_this.tabContext.tabManager = _this.tabManager;
|
|
36
|
-
return _this;
|
|
37
|
-
}
|
|
38
|
-
TabContainer.prototype.componentDidMount = function () {
|
|
39
|
-
this.tabManager.initialise();
|
|
40
|
-
};
|
|
41
|
-
TabContainer.prototype.componentWillUnmount = function () {
|
|
42
|
-
this.tabManager.destroy();
|
|
43
|
-
};
|
|
44
|
-
TabContainer.prototype.render = function () {
|
|
45
|
-
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"]);
|
|
46
|
-
this.tabContext.keepMounted = keepMounted;
|
|
47
|
-
if (!verticalSizes)
|
|
48
|
-
verticalSizes = {};
|
|
49
|
-
if (!verticalSizes.xs)
|
|
50
|
-
verticalSizes.xs = 12;
|
|
51
|
-
var isCardMode = (variant === "tabs" || !variant);
|
|
52
|
-
if (variant === "flat") {
|
|
53
|
-
variant = "tabs";
|
|
54
|
-
}
|
|
55
|
-
var _b = Components.BootstrapHelpers.getInverseBreakpointClasses(verticalSizes), cols = _b.cols, inverseCols = _b.inverseCols;
|
|
56
|
-
domProps.className = Utils.joinWithSpaces(domProps.className, "row neo-tab-container", isCardMode ? "neo-tab-card-mode" : undefined);
|
|
57
|
-
return (React.createElement(TabContext.Provider, { value: this.tabContext },
|
|
58
|
-
React.createElement("div", __assign({}, domProps),
|
|
59
|
-
React.createElement("div", { className: "tabs-header " + cols },
|
|
60
|
-
React.createElement(TabSection, { isHeader: true, containerProps: { verticalSizes: verticalSizes, variant: variant, fillMode: fillMode, align: align } }, this.props.children)),
|
|
61
|
-
React.createElement("div", { className: inverseCols },
|
|
62
|
-
React.createElement(TabSection, { isHeader: false }, this.props.children)))));
|
|
63
|
-
};
|
|
64
|
-
return TabContainer;
|
|
65
|
-
}(React.Component));
|
|
66
|
-
export default TabContainer;
|
|
67
|
-
var TabSection = /** @class */ (function (_super) {
|
|
68
|
-
__extends(TabSection, _super);
|
|
69
|
-
function TabSection() {
|
|
70
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
71
|
-
}
|
|
72
|
-
TabSection.prototype.render = function () {
|
|
73
|
-
this.context.inHeader = this.props.isHeader;
|
|
74
|
-
var headerClassName = "nav ";
|
|
75
|
-
if (this.props.isHeader) {
|
|
76
|
-
var containerProps = this.props.containerProps;
|
|
77
|
-
if (containerProps.verticalSizes) {
|
|
78
|
-
var breakpoint = Components.BootstrapHelpers.getFirstBreakpoint(containerProps.verticalSizes);
|
|
79
|
-
if (breakpoint)
|
|
80
|
-
headerClassName += " flex-" + breakpoint + "-column";
|
|
81
|
-
}
|
|
82
|
-
if (containerProps.variant !== "none") {
|
|
83
|
-
headerClassName += " nav-" + (containerProps.variant || "tabs");
|
|
84
|
-
}
|
|
85
|
-
if (containerProps.fillMode) {
|
|
86
|
-
headerClassName += " nav-" + containerProps.fillMode;
|
|
87
|
-
}
|
|
88
|
-
if (containerProps.align) {
|
|
89
|
-
headerClassName += " justify-content-" + containerProps.align;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return (this.props.isHeader ?
|
|
93
|
-
React.createElement("ul", { className: headerClassName }, this.props.children) :
|
|
94
|
-
React.createElement("div", { className: "tab-content" }, this.props.children));
|
|
95
|
-
};
|
|
96
|
-
TabSection.contextType = TabContext;
|
|
97
|
-
return TabSection;
|
|
98
|
-
}(React.PureComponent));
|
|
1
|
+
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Components, Utils } from "@singularsystems/neo-core";
|
|
4
|
+
import { ObservableValue } from "@singularsystems/neo-core/dist/Model/ObservableValue";
|
|
5
|
+
import { TabManager } from './TabManager';
|
|
6
|
+
var TabContextParams = /** @class */ (function () {
|
|
7
|
+
function TabContextParams() {
|
|
8
|
+
/**
|
|
9
|
+
* True if the tab manager was passed in to the tab container.
|
|
10
|
+
*/
|
|
11
|
+
this.isUserTabManager = false;
|
|
12
|
+
this.inHeader = true;
|
|
13
|
+
}
|
|
14
|
+
return TabContextParams;
|
|
15
|
+
}());
|
|
16
|
+
export { TabContextParams };
|
|
17
|
+
export var TabContext = React.createContext(new TabContextParams());
|
|
18
|
+
var TabContainer = /** @class */ (function (_super) {
|
|
19
|
+
__extends(TabContainer, _super);
|
|
20
|
+
function TabContainer(props) {
|
|
21
|
+
var _this = this;
|
|
22
|
+
var _a;
|
|
23
|
+
_this = _super.call(this, props) || this;
|
|
24
|
+
_this.tabContext = new TabContextParams();
|
|
25
|
+
var tabManager;
|
|
26
|
+
if (_this.props.tabManager) {
|
|
27
|
+
tabManager = _this.props.tabManager;
|
|
28
|
+
_this.tabContext.isUserTabManager = true;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
tabManager = new TabManager("", true);
|
|
32
|
+
tabManager.observable = (_a = _this.props.selectedTab) !== null && _a !== void 0 ? _a : new ObservableValue("");
|
|
33
|
+
}
|
|
34
|
+
_this.tabManager = tabManager;
|
|
35
|
+
_this.tabContext.tabManager = _this.tabManager;
|
|
36
|
+
return _this;
|
|
37
|
+
}
|
|
38
|
+
TabContainer.prototype.componentDidMount = function () {
|
|
39
|
+
this.tabManager.initialise();
|
|
40
|
+
};
|
|
41
|
+
TabContainer.prototype.componentWillUnmount = function () {
|
|
42
|
+
this.tabManager.destroy();
|
|
43
|
+
};
|
|
44
|
+
TabContainer.prototype.render = function () {
|
|
45
|
+
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"]);
|
|
46
|
+
this.tabContext.keepMounted = keepMounted;
|
|
47
|
+
if (!verticalSizes)
|
|
48
|
+
verticalSizes = {};
|
|
49
|
+
if (!verticalSizes.xs)
|
|
50
|
+
verticalSizes.xs = 12;
|
|
51
|
+
var isCardMode = (variant === "tabs" || !variant);
|
|
52
|
+
if (variant === "flat") {
|
|
53
|
+
variant = "tabs";
|
|
54
|
+
}
|
|
55
|
+
var _b = Components.BootstrapHelpers.getInverseBreakpointClasses(verticalSizes), cols = _b.cols, inverseCols = _b.inverseCols;
|
|
56
|
+
domProps.className = Utils.joinWithSpaces(domProps.className, "row neo-tab-container", isCardMode ? "neo-tab-card-mode" : undefined);
|
|
57
|
+
return (React.createElement(TabContext.Provider, { value: this.tabContext },
|
|
58
|
+
React.createElement("div", __assign({}, domProps),
|
|
59
|
+
React.createElement("div", { className: "tabs-header " + cols },
|
|
60
|
+
React.createElement(TabSection, { isHeader: true, containerProps: { verticalSizes: verticalSizes, variant: variant, fillMode: fillMode, align: align } }, this.props.children)),
|
|
61
|
+
React.createElement("div", { className: inverseCols },
|
|
62
|
+
React.createElement(TabSection, { isHeader: false }, this.props.children)))));
|
|
63
|
+
};
|
|
64
|
+
return TabContainer;
|
|
65
|
+
}(React.Component));
|
|
66
|
+
export default TabContainer;
|
|
67
|
+
var TabSection = /** @class */ (function (_super) {
|
|
68
|
+
__extends(TabSection, _super);
|
|
69
|
+
function TabSection() {
|
|
70
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
71
|
+
}
|
|
72
|
+
TabSection.prototype.render = function () {
|
|
73
|
+
this.context.inHeader = this.props.isHeader;
|
|
74
|
+
var headerClassName = "nav ";
|
|
75
|
+
if (this.props.isHeader) {
|
|
76
|
+
var containerProps = this.props.containerProps;
|
|
77
|
+
if (containerProps.verticalSizes) {
|
|
78
|
+
var breakpoint = Components.BootstrapHelpers.getFirstBreakpoint(containerProps.verticalSizes);
|
|
79
|
+
if (breakpoint)
|
|
80
|
+
headerClassName += " flex-" + breakpoint + "-column";
|
|
81
|
+
}
|
|
82
|
+
if (containerProps.variant !== "none") {
|
|
83
|
+
headerClassName += " nav-" + (containerProps.variant || "tabs");
|
|
84
|
+
}
|
|
85
|
+
if (containerProps.fillMode) {
|
|
86
|
+
headerClassName += " nav-" + containerProps.fillMode;
|
|
87
|
+
}
|
|
88
|
+
if (containerProps.align) {
|
|
89
|
+
headerClassName += " justify-content-" + containerProps.align;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return (this.props.isHeader ?
|
|
93
|
+
React.createElement("ul", { className: headerClassName }, this.props.children) :
|
|
94
|
+
React.createElement("div", { className: "tab-content" }, this.props.children));
|
|
95
|
+
};
|
|
96
|
+
TabSection.contextType = TabContext;
|
|
97
|
+
return TabSection;
|
|
98
|
+
}(React.PureComponent));
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import { Model } from '@singularsystems/neo-core';
|
|
2
|
-
import { ICancellableEvent } from '../Misc';
|
|
3
|
-
export interface ITabManager {
|
|
4
|
-
selectedTab: string;
|
|
5
|
-
/**
|
|
6
|
-
* Registers a callback to run when the tab is first displayed, or when reset is called with reInitialise=true.
|
|
7
|
-
*/
|
|
8
|
-
onTabInitialise(tabKey: string, callback: () => void): ITabManager;
|
|
9
|
-
/**
|
|
10
|
-
* Registers a callback to run whenever the tab with this tab key is displayed.
|
|
11
|
-
*/
|
|
12
|
-
onTabDisplayed(tabKey: string, callback: () => void): ITabManager;
|
|
13
|
-
}
|
|
14
|
-
export interface ITabManagerInternal extends ITabManager {
|
|
15
|
-
initialise(): void;
|
|
16
|
-
tabMounted(tabKey: string, onLeave?: (e: ICancellableEvent) => void): void;
|
|
17
|
-
destroy(): void;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Tab manager used to manage a tab component.
|
|
21
|
-
* @param T string union type of tab names.
|
|
22
|
-
*/
|
|
23
|
-
export declare class TabManager<T extends string = string> {
|
|
24
|
-
private autoSelectFirstTab;
|
|
25
|
-
observable: Model.ObservableValue<T>;
|
|
26
|
-
/**
|
|
27
|
-
* Creates a tab manager used to bind to a tab container.
|
|
28
|
-
* @param selectedTab Initially selected tab.
|
|
29
|
-
* @param autoSelectFirstTab Set to true if the first child tab should become selected.
|
|
30
|
-
*/
|
|
31
|
-
constructor(selectedTab?: T, autoSelectFirstTab?: boolean);
|
|
32
|
-
/** Called by tab container. */
|
|
33
|
-
private initialise;
|
|
34
|
-
/** Called by tab container. */
|
|
35
|
-
private destroy;
|
|
36
|
-
get selectedTab(): T;
|
|
37
|
-
set selectedTab(value: T);
|
|
38
|
-
/**
|
|
39
|
-
* Registers a callback to run when the tab is first displayed, or when reset is called with reInitialise=true.
|
|
40
|
-
*/
|
|
41
|
-
onTabInitialise(tabKey: T, callback: () => void): this;
|
|
42
|
-
/**
|
|
43
|
-
* Registers a callback to run whenever the tab with this tab key is displayed.
|
|
44
|
-
*/
|
|
45
|
-
onTabDisplayed(tabKey: T, callback: () => void): this;
|
|
46
|
-
private tabMounted;
|
|
47
|
-
private getTab;
|
|
48
|
-
/**
|
|
49
|
-
* Marks the tab as 'initial'.
|
|
50
|
-
* @param reInitialise True if the tabs onInitialise() should be invoked.
|
|
51
|
-
*/
|
|
52
|
-
reset(tabKey: T, reInitialise?: boolean): void;
|
|
53
|
-
/** Calls onInitialise() if the tab has not yet initialised. */
|
|
54
|
-
initialiseTab(tabKey: T): void;
|
|
55
|
-
/**
|
|
56
|
-
* Marks all tabs as 'initial', causing onInitialise() to be called the next time each is displayed.
|
|
57
|
-
* @param reInitialise True if the onInitialise() should be called on the currently displayed tab.
|
|
58
|
-
*/
|
|
59
|
-
resetAll(reInitialise?: boolean): void;
|
|
60
|
-
private tabs;
|
|
61
|
-
private onTabChanged;
|
|
62
|
-
}
|
|
1
|
+
import { Model } from '@singularsystems/neo-core';
|
|
2
|
+
import { ICancellableEvent } from '../Misc';
|
|
3
|
+
export interface ITabManager {
|
|
4
|
+
selectedTab: string;
|
|
5
|
+
/**
|
|
6
|
+
* Registers a callback to run when the tab is first displayed, or when reset is called with reInitialise=true.
|
|
7
|
+
*/
|
|
8
|
+
onTabInitialise(tabKey: string, callback: () => void): ITabManager;
|
|
9
|
+
/**
|
|
10
|
+
* Registers a callback to run whenever the tab with this tab key is displayed.
|
|
11
|
+
*/
|
|
12
|
+
onTabDisplayed(tabKey: string, callback: () => void): ITabManager;
|
|
13
|
+
}
|
|
14
|
+
export interface ITabManagerInternal extends ITabManager {
|
|
15
|
+
initialise(): void;
|
|
16
|
+
tabMounted(tabKey: string, onLeave?: (e: ICancellableEvent) => void): void;
|
|
17
|
+
destroy(): void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Tab manager used to manage a tab component.
|
|
21
|
+
* @param T string union type of tab names.
|
|
22
|
+
*/
|
|
23
|
+
export declare class TabManager<T extends string = string> {
|
|
24
|
+
private autoSelectFirstTab;
|
|
25
|
+
observable: Model.ObservableValue<T>;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a tab manager used to bind to a tab container.
|
|
28
|
+
* @param selectedTab Initially selected tab.
|
|
29
|
+
* @param autoSelectFirstTab Set to true if the first child tab should become selected.
|
|
30
|
+
*/
|
|
31
|
+
constructor(selectedTab?: T, autoSelectFirstTab?: boolean);
|
|
32
|
+
/** Called by tab container. */
|
|
33
|
+
private initialise;
|
|
34
|
+
/** Called by tab container. */
|
|
35
|
+
private destroy;
|
|
36
|
+
get selectedTab(): T;
|
|
37
|
+
set selectedTab(value: T);
|
|
38
|
+
/**
|
|
39
|
+
* Registers a callback to run when the tab is first displayed, or when reset is called with reInitialise=true.
|
|
40
|
+
*/
|
|
41
|
+
onTabInitialise(tabKey: T, callback: () => void): this;
|
|
42
|
+
/**
|
|
43
|
+
* Registers a callback to run whenever the tab with this tab key is displayed.
|
|
44
|
+
*/
|
|
45
|
+
onTabDisplayed(tabKey: T, callback: () => void): this;
|
|
46
|
+
private tabMounted;
|
|
47
|
+
private getTab;
|
|
48
|
+
/**
|
|
49
|
+
* Marks the tab as 'initial'.
|
|
50
|
+
* @param reInitialise True if the tabs onInitialise() should be invoked.
|
|
51
|
+
*/
|
|
52
|
+
reset(tabKey: T, reInitialise?: boolean): void;
|
|
53
|
+
/** Calls onInitialise() if the tab has not yet initialised. */
|
|
54
|
+
initialiseTab(tabKey: T): void;
|
|
55
|
+
/**
|
|
56
|
+
* Marks all tabs as 'initial', causing onInitialise() to be called the next time each is displayed.
|
|
57
|
+
* @param reInitialise True if the onInitialise() should be called on the currently displayed tab.
|
|
58
|
+
*/
|
|
59
|
+
resetAll(reInitialise?: boolean): void;
|
|
60
|
+
private tabs;
|
|
61
|
+
private onTabChanged;
|
|
62
|
+
}
|