@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.
Files changed (196) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/README.md +4 -0
  3. package/dist/Modules/NeoReactModule.d.ts +4 -4
  4. package/dist/Modules/NeoReactModule.js +28 -26
  5. package/dist/Modules/ReactSetup.d.ts +2 -2
  6. package/dist/Modules/ReactSetup.js +17 -17
  7. package/dist/Modules/Types.d.ts +63 -61
  8. package/dist/Modules/Types.js +13 -12
  9. package/dist/React/AutoRunner.d.ts +5 -5
  10. package/dist/React/AutoRunner.js +94 -92
  11. package/dist/React/DataView.d.ts +6 -6
  12. package/dist/React/DataView.js +11 -11
  13. package/dist/React/ReactModelCreator.d.ts +11 -11
  14. package/dist/React/ReactModelCreator.js +165 -162
  15. package/dist/ReactComponents/Button.d.ts +24 -23
  16. package/dist/ReactComponents/Button.js +131 -123
  17. package/dist/ReactComponents/Card.d.ts +24 -23
  18. package/dist/ReactComponents/Card.js +56 -54
  19. package/dist/ReactComponents/Collapsable.d.ts +23 -23
  20. package/dist/ReactComponents/Collapsable.js +38 -38
  21. package/dist/ReactComponents/CollapsableBase.d.ts +13 -13
  22. package/dist/ReactComponents/CollapsableBase.js +42 -42
  23. package/dist/ReactComponents/ColorPicker.d.ts +26 -26
  24. package/dist/ReactComponents/ColorPicker.js +67 -67
  25. package/dist/ReactComponents/ComponentBase.d.ts +17 -17
  26. package/dist/ReactComponents/ComponentBase.js +33 -33
  27. package/dist/ReactComponents/ContextMenu/ContextMenu.d.ts +25 -24
  28. package/dist/ReactComponents/ContextMenu/ContextMenu.js +91 -88
  29. package/dist/ReactComponents/ContextMenu/ContextMenuContainer.d.ts +14 -14
  30. package/dist/ReactComponents/ContextMenu/ContextMenuContainer.js +48 -48
  31. package/dist/ReactComponents/ContextMenu/ContextMenuState.d.ts +8 -7
  32. package/dist/ReactComponents/ContextMenu/ContextMenuState.js +23 -23
  33. package/dist/ReactComponents/DatePicker.d.ts +19 -19
  34. package/dist/ReactComponents/DatePicker.js +53 -53
  35. package/dist/ReactComponents/DropDown/AutoCompleteDropDown.d.ts +93 -83
  36. package/dist/ReactComponents/DropDown/AutoCompleteDropDown.js +222 -188
  37. package/dist/ReactComponents/DropDown/DropDown.d.ts +44 -44
  38. package/dist/ReactComponents/DropDown/DropDown.js +138 -134
  39. package/dist/ReactComponents/DropDown/DropDownBase.d.ts +16 -15
  40. package/dist/ReactComponents/DropDown/DropDownBase.js +86 -108
  41. package/dist/ReactComponents/DropDown/LookupHelper.d.ts +13 -0
  42. package/dist/ReactComponents/DropDown/LookupHelper.js +45 -0
  43. package/dist/ReactComponents/ErrorHandler.d.ts +9 -8
  44. package/dist/ReactComponents/ErrorHandler.js +92 -91
  45. package/dist/ReactComponents/FileManager/FileBasicInput.d.ts +20 -20
  46. package/dist/ReactComponents/FileManager/FileBasicInput.js +70 -70
  47. package/dist/ReactComponents/FileManager/FileContext.d.ts +16 -16
  48. package/dist/ReactComponents/FileManager/FileContext.js +24 -24
  49. package/dist/ReactComponents/FileManager/FileDropArea.d.ts +19 -18
  50. package/dist/ReactComponents/FileManager/FileDropArea.js +66 -64
  51. package/dist/ReactComponents/FileManager/FileInput.d.ts +44 -42
  52. package/dist/ReactComponents/FileManager/FileInput.js +191 -189
  53. package/dist/ReactComponents/FileManager/FileUploadButton.d.ts +17 -17
  54. package/dist/ReactComponents/FileManager/FileUploadButton.js +49 -49
  55. package/dist/ReactComponents/FileManager/FileUploadProgress.d.ts +14 -14
  56. package/dist/ReactComponents/FileManager/FileUploadProgress.js +35 -35
  57. package/dist/ReactComponents/Form.d.ts +19 -18
  58. package/dist/ReactComponents/Form.js +90 -90
  59. package/dist/ReactComponents/FormContext.d.ts +33 -31
  60. package/dist/ReactComponents/FormContext.js +39 -40
  61. package/dist/ReactComponents/FormGroup/FormGroup.d.ts +37 -37
  62. package/dist/ReactComponents/FormGroup/FormGroup.js +83 -84
  63. package/dist/ReactComponents/FormGroup/FormGroupFloating.d.ts +19 -19
  64. package/dist/ReactComponents/FormGroup/FormGroupFloating.js +97 -97
  65. package/dist/ReactComponents/FormGroup/FormGroupInline.d.ts +11 -11
  66. package/dist/ReactComponents/FormGroup/FormGroupInline.js +43 -43
  67. package/dist/ReactComponents/Grid/ButtonColumn.d.ts +47 -47
  68. package/dist/ReactComponents/Grid/ButtonColumn.js +81 -82
  69. package/dist/ReactComponents/Grid/Column.d.ts +47 -47
  70. package/dist/ReactComponents/Grid/Column.js +205 -205
  71. package/dist/ReactComponents/Grid/ColumnHelper.d.ts +12 -12
  72. package/dist/ReactComponents/Grid/ColumnHelper.js +19 -19
  73. package/dist/ReactComponents/Grid/Grid.d.ts +87 -90
  74. package/dist/ReactComponents/Grid/Grid.js +203 -203
  75. package/dist/ReactComponents/Grid/Row.d.ts +81 -81
  76. package/dist/ReactComponents/Grid/Row.js +200 -201
  77. package/dist/ReactComponents/Grid/_Exports.d.ts +5 -5
  78. package/dist/ReactComponents/Grid/_Exports.js +5 -5
  79. package/dist/ReactComponents/GridLayout.d.ts +20 -20
  80. package/dist/ReactComponents/GridLayout.js +38 -38
  81. package/dist/ReactComponents/Icons/FontAwesomeIconFactory.d.ts +23 -0
  82. package/dist/ReactComponents/Icons/FontAwesomeIconFactory.js +43 -0
  83. package/dist/ReactComponents/Icons/IIconFactory.d.ts +21 -0
  84. package/dist/ReactComponents/Icons/IIconFactory.js +1 -0
  85. package/dist/ReactComponents/Icons/IconFactory.d.ts +9 -0
  86. package/dist/ReactComponents/Icons/IconFactory.js +45 -0
  87. package/dist/ReactComponents/Icons/index.d.ts +3 -0
  88. package/dist/ReactComponents/Icons/index.js +2 -0
  89. package/dist/ReactComponents/Input.d.ts +45 -45
  90. package/dist/ReactComponents/Input.js +153 -152
  91. package/dist/ReactComponents/InputHelpers.d.ts +6 -5
  92. package/dist/ReactComponents/InputHelpers.js +29 -33
  93. package/dist/ReactComponents/Link.d.ts +13 -13
  94. package/dist/ReactComponents/Link.js +28 -28
  95. package/dist/ReactComponents/Loader.d.ts +18 -18
  96. package/dist/ReactComponents/Loader.js +57 -57
  97. package/dist/ReactComponents/Misc.d.ts +15 -15
  98. package/dist/ReactComponents/Misc.js +28 -28
  99. package/dist/ReactComponents/Modal/Modal.d.ts +11 -11
  100. package/dist/ReactComponents/Modal/Modal.js +129 -129
  101. package/dist/ReactComponents/Modal/ModalContainer.d.ts +17 -17
  102. package/dist/ReactComponents/Modal/ModalContainer.js +37 -37
  103. package/dist/ReactComponents/Modal/ModalPortal.d.ts +16 -15
  104. package/dist/ReactComponents/Modal/ModalPortal.js +27 -27
  105. package/dist/ReactComponents/Notifications/Alert.d.ts +7 -6
  106. package/dist/ReactComponents/Notifications/Alert.js +38 -35
  107. package/dist/ReactComponents/Notifications/Toast.d.ts +9 -8
  108. package/dist/ReactComponents/Notifications/Toast.js +47 -45
  109. package/dist/ReactComponents/Notifications/ToastContainer.d.ts +8 -8
  110. package/dist/ReactComponents/Notifications/ToastContainer.js +18 -18
  111. package/dist/ReactComponents/NumberInput.d.ts +57 -50
  112. package/dist/ReactComponents/NumberInput.js +260 -246
  113. package/dist/ReactComponents/Paging/BasicPagerControls.d.ts +26 -25
  114. package/dist/ReactComponents/Paging/BasicPagerControls.js +57 -55
  115. package/dist/ReactComponents/Paging/PageSizeControl.d.ts +11 -11
  116. package/dist/ReactComponents/Paging/PageSizeControl.js +21 -21
  117. package/dist/ReactComponents/Paging/Pager.d.ts +24 -24
  118. package/dist/ReactComponents/Paging/Pager.js +41 -41
  119. package/dist/ReactComponents/ProgressBar.d.ts +19 -19
  120. package/dist/ReactComponents/ProgressBar.js +52 -52
  121. package/dist/ReactComponents/PropTypes.d.ts +161 -161
  122. package/dist/ReactComponents/PropTypes.js +253 -236
  123. package/dist/ReactComponents/RadioList.d.ts +29 -29
  124. package/dist/ReactComponents/RadioList.js +59 -77
  125. package/dist/ReactComponents/Slider.d.ts +28 -28
  126. package/dist/ReactComponents/Slider.js +76 -76
  127. package/dist/ReactComponents/StateObserver.d.ts +15 -15
  128. package/dist/ReactComponents/StateObserver.js +35 -35
  129. package/dist/ReactComponents/Tabs/Tab.d.ts +42 -41
  130. package/dist/ReactComponents/Tabs/Tab.js +71 -72
  131. package/dist/ReactComponents/Tabs/TabContainer.d.ts +44 -44
  132. package/dist/ReactComponents/Tabs/TabContainer.js +98 -98
  133. package/dist/ReactComponents/Tabs/TabManager.d.ts +62 -62
  134. package/dist/ReactComponents/Tabs/TabManager.js +154 -154
  135. package/dist/ReactComponents/Tooltip.d.ts +20 -19
  136. package/dist/ReactComponents/Tooltip.js +51 -51
  137. package/dist/ReactComponents/TooltipHelper.d.ts +8 -8
  138. package/dist/ReactComponents/TooltipHelper.js +84 -84
  139. package/dist/ReactComponents/TooltipProvider.d.ts +30 -30
  140. package/dist/ReactComponents/TooltipProvider.js +111 -111
  141. package/dist/ReactComponents/ValidationSummary.d.ts +23 -22
  142. package/dist/ReactComponents/ValidationSummary.js +46 -43
  143. package/dist/ReactComponents/_Exports.d.ts +41 -41
  144. package/dist/ReactComponents/_Exports.js +41 -41
  145. package/dist/ReactComponents/_Managers.d.ts +4 -4
  146. package/dist/ReactComponents/_Managers.js +4 -4
  147. package/dist/Routing/BreadCrumbItem.d.ts +14 -14
  148. package/dist/Routing/BreadCrumbItem.js +12 -12
  149. package/dist/Routing/IRouteChangedProps.d.ts +31 -31
  150. package/dist/Routing/IRouteChangedProps.js +1 -1
  151. package/dist/Routing/IRouteParameter.d.ts +22 -22
  152. package/dist/Routing/IRouteParameter.js +9 -9
  153. package/dist/Routing/MenuRoute.d.ts +25 -24
  154. package/dist/Routing/MenuRoute.js +24 -24
  155. package/dist/Routing/NavigationHelper.d.ts +41 -40
  156. package/dist/Routing/NavigationHelper.js +61 -61
  157. package/dist/Routing/PageLeaveHandler.d.ts +13 -13
  158. package/dist/Routing/PageLeaveHandler.js +74 -74
  159. package/dist/Routing/RouteProvider.d.ts +31 -31
  160. package/dist/Routing/RouteProvider.js +92 -92
  161. package/dist/Routing/RouteView.d.ts +50 -50
  162. package/dist/Routing/RouteView.js +143 -144
  163. package/dist/Routing/RoutingState.d.ts +18 -15
  164. package/dist/Routing/RoutingState.js +45 -40
  165. package/dist/Routing/ViewParameter.d.ts +80 -58
  166. package/dist/Routing/ViewParameter.js +116 -95
  167. package/dist/Routing/ViewParameterList.d.ts +53 -53
  168. package/dist/Routing/ViewParameterList.js +163 -145
  169. package/dist/Routing/index.d.ts +9 -9
  170. package/dist/Routing/index.js +6 -6
  171. package/dist/Services/DisposeHelper.d.ts +15 -15
  172. package/dist/Services/DisposeHelper.js +40 -41
  173. package/dist/Services/IDisposeHelper.d.ts +12 -12
  174. package/dist/Services/IDisposeHelper.js +1 -1
  175. package/dist/Views/EmptyViewModel.d.ts +5 -5
  176. package/dist/Views/EmptyViewModel.js +14 -14
  177. package/dist/Views/IViewModel.d.ts +16 -16
  178. package/dist/Views/IViewModel.js +1 -1
  179. package/dist/Views/PersistentViewBase.d.ts +10 -10
  180. package/dist/Views/PersistentViewBase.js +21 -21
  181. package/dist/Views/ViewBase.d.ts +70 -71
  182. package/dist/Views/ViewBase.js +166 -153
  183. package/dist/Views/ViewComponentBase.d.ts +19 -13
  184. package/dist/Views/ViewComponentBase.js +24 -21
  185. package/dist/Views/ViewModelBase.d.ts +57 -56
  186. package/dist/Views/ViewModelBase.js +122 -118
  187. package/dist/Views/ViewState.d.ts +13 -13
  188. package/dist/Views/ViewState.js +9 -9
  189. package/dist/Views/index.d.ts +5 -5
  190. package/dist/Views/index.js +5 -5
  191. package/dist/index.d.ts +11 -10
  192. package/dist/index.js +10 -9
  193. package/package.json +26 -26
  194. package/styles/DatePicker.scss +2 -2
  195. package/styles/Forms.scss +5 -0
  196. package/styles/Validation.scss +0 -9
@@ -1,123 +1,131 @@
1
- import { __decorate, __extends, __metadata, __rest, __spreadArray } from "tslib";
2
- import * as React from 'react';
3
- import ComponentBase from './ComponentBase';
4
- import { Components, Utils } from '@singularsystems/neo-core';
5
- import Tooltip from './Tooltip';
6
- import { observer } from 'mobx-react';
7
- var Button = /** @class */ (function (_super) {
8
- __extends(Button, _super);
9
- function Button(props) {
10
- var _this = _super.call(this, props) || this;
11
- _this.state = { isExpanded: false };
12
- _this.btnGroupDom = React.createRef();
13
- _this.menuDom = React.createRef();
14
- _this.windowClickHandler = _this.windowClicked.bind(_this);
15
- _this.showMenu = _this.showMenu.bind(_this);
16
- return _this;
17
- }
18
- Button.prototype.showMenu = function () {
19
- var _this = this;
20
- if (!this.state.isExpanded) {
21
- this.setState({ isExpanded: true });
22
- setTimeout(function () { return window.addEventListener("click", _this.windowClickHandler); }, 0);
23
- }
24
- };
25
- Button.prototype.hideMenu = function () {
26
- if (this.state.isExpanded) {
27
- this.setState({ isExpanded: false });
28
- }
29
- window.removeEventListener("click", this.windowClickHandler);
30
- };
31
- Button.prototype.menuItemClicked = function (e, data, userEvent) {
32
- this.hideMenu();
33
- e.preventDefault();
34
- if (userEvent) {
35
- userEvent(e, data);
36
- }
37
- else if (this.props.onClick && data !== undefined) {
38
- this.props.onClick(e, data);
39
- }
40
- };
41
- Button.prototype.windowClicked = function (e) {
42
- this.hideMenu();
43
- };
44
- Button.prototype.afterRender = function () {
45
- if (this.btnGroupDom.current && this.menuDom.current) {
46
- Components.PositionHelper.checkScreenBounds(this.btnGroupDom.current, this.menuDom.current, undefined, this.props.menuAlignment === "right");
47
- }
48
- };
49
- Button.prototype.render = function () {
50
- var _this = this;
51
- var _a = this.props, isSubmit = _a.isSubmit, variant = _a.variant, size = _a.size, isOutline = _a.isOutline, icon = _a.icon, iconAlignment = _a.iconAlignment, text = _a.text, menuItems = _a.menuItems, splitMenu = _a.splitMenu, menuAlignment = _a.menuAlignment, buttonGroupClassName = _a.buttonGroupClassName, tooltip = _a.tooltip, task = _a.task, isBusy = _a.isBusy, pulse = _a.pulse, native = __rest(_a, ["isSubmit", "variant", "size", "isOutline", "icon", "iconAlignment", "text", "menuItems", "splitMenu", "menuAlignment", "buttonGroupClassName", "tooltip", "task", "isBusy", "pulse"]);
52
- native.type = isSubmit ? "submit" : "button";
53
- variant = variant !== null && variant !== void 0 ? variant : "primary";
54
- var isDropDown = menuItems && menuItems.length;
55
- var buttonClasses = "btn btn-" + (isOutline ? "outline-" : "") + variant;
56
- if (size)
57
- buttonClasses += " btn-" + size;
58
- if (isDropDown && !splitMenu) {
59
- buttonClasses += " dropdown-toggle";
60
- native.onClick = this.showMenu;
61
- }
62
- if (isBusy || (task === null || task === void 0 ? void 0 : task.isBusy)) {
63
- icon = "fa-circle-notch fa-spin";
64
- native.disabled = true;
65
- }
66
- if (pulse) {
67
- buttonClasses += " ".concat(variant, "-color-pulse");
68
- }
69
- native.className = (native.className || "") + " " + buttonClasses;
70
- // Button text
71
- var innerText = this.props.children;
72
- if (!innerText)
73
- innerText = text;
74
- var iconSpace = icon && innerText ? " " : "";
75
- // Icon
76
- var iconElement = icon ? React.createElement("i", { className: Utils.getFontAwesomeClass(icon) }) : undefined;
77
- // Tooltip
78
- if (tooltip) {
79
- Tooltip.setDomProperties(native, tooltip);
80
- }
81
- var root;
82
- // Main button
83
- var buttonChildren = [];
84
- if (icon && iconAlignment !== "right")
85
- buttonChildren.push(iconElement, iconSpace);
86
- buttonChildren.push(innerText);
87
- if (isDropDown && !splitMenu) {
88
- buttonChildren.push(" ");
89
- }
90
- if (icon && iconAlignment === "right")
91
- buttonChildren.push(iconSpace, iconElement);
92
- var mainButton = React.createElement.apply(React, __spreadArray(["button", native], buttonChildren, false));
93
- var buttonGroupClasses = "btn-group";
94
- // add custom css classes to the button group if applicable
95
- if (buttonGroupClassName) {
96
- buttonGroupClasses = Utils.joinWithSpaces(buttonGroupClasses, buttonGroupClassName);
97
- }
98
- // Button needs a container if this is a drop down button
99
- if (isDropDown) {
100
- var menu = React.createElement("div", { className: "dropdown-menu" + (this.state.isExpanded ? " show" : ""), ref: this.menuDom }, menuItems.map(function (item, index) { return (item.header ? React.createElement("h6", { key: index, className: "dropdown-header" }, item.header)
101
- : item.isDivider ? React.createElement("div", { key: index, className: "dropdown-divider" })
102
- : React.createElement("div", { key: index, className: "dropdown-item", onClick: function (e) { return _this.menuItemClicked(e, item.data, item.onClick); } },
103
- item.icon && React.createElement("i", { className: Utils.getFontAwesomeClass(item.icon) + " fa-fw" }),
104
- " ",
105
- item.text)); }));
106
- root =
107
- React.createElement("div", { className: buttonGroupClasses, ref: this.btnGroupDom },
108
- mainButton,
109
- splitMenu && React.createElement("button", { type: "button", onClick: this.showMenu, className: buttonClasses + " dropdown-toggle dropdown-toggle-split" }),
110
- menu);
111
- }
112
- else {
113
- root = mainButton;
114
- }
115
- return root;
116
- };
117
- Button = __decorate([
118
- observer,
119
- __metadata("design:paramtypes", [Object])
120
- ], Button);
121
- return Button;
122
- }(ComponentBase));
123
- export default Button;
1
+ import { __decorate, __extends, __metadata, __rest, __spreadArray } from "tslib";
2
+ import * as React from 'react';
3
+ import ComponentBase from './ComponentBase';
4
+ import { Components, Misc, Utils } from '@singularsystems/neo-core';
5
+ import Tooltip from './Tooltip';
6
+ import { observer } from 'mobx-react';
7
+ import { NeoReactTypes } from '../Modules/Types';
8
+ var Button = /** @class */ (function (_super) {
9
+ __extends(Button, _super);
10
+ function Button(props) {
11
+ var _this = _super.call(this, props) || this;
12
+ _this.state = { isExpanded: false };
13
+ _this.btnGroupDom = React.createRef();
14
+ _this.menuDom = React.createRef();
15
+ _this.iconFactory = Misc.Globals.appService.get(NeoReactTypes.Components.IconFactory);
16
+ _this.windowClickHandler = _this.windowClicked.bind(_this);
17
+ _this.showMenu = _this.showMenu.bind(_this);
18
+ return _this;
19
+ }
20
+ Button.prototype.showMenu = function () {
21
+ var _this = this;
22
+ if (!this.state.isExpanded) {
23
+ this.setState({ isExpanded: true });
24
+ setTimeout(function () { return window.addEventListener("click", _this.windowClickHandler); }, 0);
25
+ }
26
+ };
27
+ Button.prototype.hideMenu = function () {
28
+ if (this.state.isExpanded) {
29
+ this.setState({ isExpanded: false });
30
+ }
31
+ window.removeEventListener("click", this.windowClickHandler);
32
+ };
33
+ Button.prototype.menuItemClicked = function (e, data, userEvent) {
34
+ this.hideMenu();
35
+ e.preventDefault();
36
+ if (userEvent) {
37
+ userEvent(e, data);
38
+ }
39
+ else if (this.props.onClick && data !== undefined) {
40
+ this.props.onClick(e, data);
41
+ }
42
+ };
43
+ Button.prototype.windowClicked = function (e) {
44
+ this.hideMenu();
45
+ };
46
+ Button.prototype.afterRender = function () {
47
+ if (this.btnGroupDom.current && this.menuDom.current) {
48
+ Components.PositionHelper.checkScreenBounds(this.btnGroupDom.current, this.menuDom.current, undefined, this.props.menuAlignment === "right");
49
+ }
50
+ };
51
+ Button.prototype.render = function () {
52
+ var _this = this;
53
+ var _a = this.props, isSubmit = _a.isSubmit, variant = _a.variant, size = _a.size, isOutline = _a.isOutline, icon = _a.icon, iconAlignment = _a.iconAlignment, text = _a.text, menuItems = _a.menuItems, splitMenu = _a.splitMenu, menuAlignment = _a.menuAlignment, buttonGroupClassName = _a.buttonGroupClassName, tooltip = _a.tooltip, task = _a.task, isBusy = _a.isBusy, pulse = _a.pulse, native = __rest(_a, ["isSubmit", "variant", "size", "isOutline", "icon", "iconAlignment", "text", "menuItems", "splitMenu", "menuAlignment", "buttonGroupClassName", "tooltip", "task", "isBusy", "pulse"]);
54
+ native.type = isSubmit ? "submit" : "button";
55
+ variant = variant !== null && variant !== void 0 ? variant : "primary";
56
+ var isDropDown = menuItems && menuItems.length;
57
+ var buttonClasses = "btn btn-" + (isOutline ? "outline-" : "") + variant;
58
+ if (size)
59
+ buttonClasses += " btn-" + size;
60
+ if (isDropDown && !splitMenu) {
61
+ buttonClasses += " dropdown-toggle";
62
+ native.onClick = this.showMenu;
63
+ }
64
+ var iconStyle = {};
65
+ if (isBusy !== undefined || task !== undefined) {
66
+ iconStyle = { fixedWidth: true };
67
+ }
68
+ if (isBusy || (task === null || task === void 0 ? void 0 : task.isBusy)) {
69
+ iconStyle.fixedWidth = true;
70
+ iconStyle.spin = true;
71
+ icon = Misc.Settings.icons.loadingIcon;
72
+ native.disabled = true;
73
+ }
74
+ if (pulse) {
75
+ buttonClasses += " ".concat(variant, "-color-pulse");
76
+ }
77
+ native.className = (native.className || "") + " " + buttonClasses;
78
+ // Button text
79
+ var innerText = this.props.children;
80
+ if (!innerText)
81
+ innerText = text;
82
+ var iconSpace = icon && innerText ? " " : "";
83
+ // Icon
84
+ var iconElement = this.iconFactory.getIconComponent(icon, iconStyle);
85
+ // Tooltip
86
+ if (tooltip) {
87
+ Tooltip.setDomProperties(native, tooltip);
88
+ }
89
+ var root;
90
+ // Main button
91
+ var buttonChildren = [];
92
+ if (icon && iconAlignment !== "right")
93
+ buttonChildren.push(iconElement, iconSpace);
94
+ buttonChildren.push(innerText);
95
+ if (isDropDown && !splitMenu) {
96
+ buttonChildren.push(" ");
97
+ }
98
+ if (icon && iconAlignment === "right")
99
+ buttonChildren.push(iconSpace, iconElement);
100
+ var mainButton = React.createElement.apply(React, __spreadArray(["button", native], buttonChildren, false));
101
+ var buttonGroupClasses = "btn-group";
102
+ // add custom css classes to the button group if applicable
103
+ if (buttonGroupClassName) {
104
+ buttonGroupClasses = Utils.joinWithSpaces(buttonGroupClasses, buttonGroupClassName);
105
+ }
106
+ // Button needs a container if this is a drop down button
107
+ if (isDropDown) {
108
+ var menu = React.createElement("div", { className: "dropdown-menu" + (this.state.isExpanded ? " show" : ""), ref: this.menuDom }, menuItems.map(function (item, index) { return (item.header ? React.createElement("h6", { key: index, className: "dropdown-header" }, item.header)
109
+ : item.isDivider ? React.createElement("div", { key: index, className: "dropdown-divider" })
110
+ : React.createElement("div", { key: index, className: "dropdown-item", onClick: function (e) { return _this.menuItemClicked(e, item.data, item.onClick); } },
111
+ _this.iconFactory.getIconComponent(item.icon, { fixedWidth: true }),
112
+ " ",
113
+ item.text)); }));
114
+ root =
115
+ React.createElement("div", { className: buttonGroupClasses, ref: this.btnGroupDom },
116
+ mainButton,
117
+ splitMenu && React.createElement("button", { type: "button", onClick: this.showMenu, className: buttonClasses + " dropdown-toggle dropdown-toggle-split" }),
118
+ menu);
119
+ }
120
+ else {
121
+ root = mainButton;
122
+ }
123
+ return root;
124
+ };
125
+ Button = __decorate([
126
+ observer,
127
+ __metadata("design:paramtypes", [Object])
128
+ ], Button);
129
+ return Button;
130
+ }(ComponentBase));
131
+ export default Button;
@@ -1,23 +1,24 @@
1
- import React from 'react';
2
- import { Model } from '@singularsystems/neo-core';
3
- interface ICardProps {
4
- /** Icon to show next to title in header. */
5
- icon?: string;
6
- /** Title to show in header. */
7
- title?: any;
8
- /** Header elements to show on right hand side of header. */
9
- headerElements?: JSX.Element;
10
- /** Use a custom scrollbar instead of the browser scrollbar. */
11
- useCustomScrollbar?: boolean;
12
- /** Causes the card to be collapsible. Adds a collapse icon to the header. */
13
- collapsible?: boolean;
14
- /** Causes the card to be collapsed on first render. Sets the collapsible prop to true. */
15
- initiallyCollapsed?: boolean;
16
- /** Allows the collapse state to be set externally. Sets the collapsible prop to true. */
17
- isExpanded?: Model.IObservableValue<boolean>;
18
- }
19
- export default class Card extends React.Component<ICardProps & React.HTMLProps<HTMLDivElement>> {
20
- private expandState;
21
- render(): JSX.Element;
22
- }
23
- export {};
1
+ import React from 'react';
2
+ import { Model } from '@singularsystems/neo-core';
3
+ interface ICardProps {
4
+ /** Icon to show next to title in header. */
5
+ icon?: string;
6
+ /** Title to show in header. */
7
+ title?: any;
8
+ /** Header elements to show on right hand side of header. */
9
+ headerElements?: JSX.Element;
10
+ /** Use a custom scrollbar instead of the browser scrollbar. */
11
+ useCustomScrollbar?: boolean;
12
+ /** Causes the card to be collapsible. Adds a collapse icon to the header. */
13
+ collapsible?: boolean;
14
+ /** Causes the card to be collapsed on first render. Sets the collapsible prop to true. */
15
+ initiallyCollapsed?: boolean;
16
+ /** Allows the collapse state to be set externally. Sets the collapsible prop to true. */
17
+ isExpanded?: Model.IObservableValue<boolean>;
18
+ }
19
+ export default class Card extends React.Component<ICardProps & React.HTMLProps<HTMLDivElement>> {
20
+ private iconFactory;
21
+ private expandState;
22
+ render(): JSX.Element;
23
+ }
24
+ export {};
@@ -1,54 +1,56 @@
1
- import { __assign, __decorate, __extends, __rest } from "tslib";
2
- import React from 'react';
3
- import { Model, Utils } from '@singularsystems/neo-core';
4
- import { observer } from 'mobx-react';
5
- import Scrollbar from 'react-custom-scrollbars';
6
- import Collapsable from './Collapsable';
7
- var Card = /** @class */ (function (_super) {
8
- __extends(Card, _super);
9
- function Card() {
10
- var _this = _super !== null && _super.apply(this, arguments) || this;
11
- _this.expandState = new Model.ObservableValue(_this.props.initiallyCollapsed === undefined ? true : !_this.props.initiallyCollapsed);
12
- return _this;
13
- }
14
- Card.prototype.render = function () {
15
- var _a = this.props, icon = _a.icon, title = _a.title, children = _a.children, headerElements = _a.headerElements, useCustomScrollbar = _a.useCustomScrollbar, collapsible = _a.collapsible, initiallyCollapsed = _a.initiallyCollapsed, isExpanded = _a.isExpanded, domProps = __rest(_a, ["icon", "title", "children", "headerElements", "useCustomScrollbar", "collapsible", "initiallyCollapsed", "isExpanded"]);
16
- var className = Utils.joinWithSpaces("neo-card card", domProps.className);
17
- var isCollapsible = collapsible || isExpanded !== undefined || initiallyCollapsed !== undefined;
18
- var expandState = isExpanded !== null && isExpanded !== void 0 ? isExpanded : this.expandState;
19
- if (isCollapsible) {
20
- var expandIndicator = React.createElement("i", { onClick: function () { return expandState.value = !expandState.value; }, className: "card-expand-indicator fa fa-fw fa-angle-".concat(expandState.value ? "up" : "down") });
21
- if (headerElements) {
22
- headerElements = React.createElement(React.Fragment, null,
23
- headerElements,
24
- expandIndicator);
25
- }
26
- else {
27
- headerElements = expandIndicator;
28
- }
29
- if (!expandState.value) {
30
- className += " collapsed";
31
- }
32
- }
33
- var body = React.createElement("div", { className: "card-body" },
34
- useCustomScrollbar && React.createElement(Scrollbar, null, children),
35
- !useCustomScrollbar && children);
36
- if (isCollapsible) {
37
- body =
38
- React.createElement(Collapsable, { show: expandState.value }, body);
39
- }
40
- return (React.createElement("div", __assign({}, domProps, { className: className }),
41
- (icon || title) &&
42
- React.createElement("div", { className: "card-header" },
43
- React.createElement("div", { className: "card-header-title" },
44
- icon && React.createElement("i", { className: Utils.getFontAwesomeClass(icon) }),
45
- React.createElement("span", null, title)),
46
- headerElements && React.createElement("div", { className: "card-header-right-section" }, headerElements)),
47
- body));
48
- };
49
- Card = __decorate([
50
- observer
51
- ], Card);
52
- return Card;
53
- }(React.Component));
54
- export default Card;
1
+ import { __assign, __decorate, __extends, __rest } from "tslib";
2
+ import React from 'react';
3
+ import { Misc, Model, Utils } from '@singularsystems/neo-core';
4
+ import { observer } from 'mobx-react';
5
+ import Scrollbar from 'react-custom-scrollbars';
6
+ import Collapsable from './Collapsable';
7
+ import { NeoReactTypes } from '../Modules/Types';
8
+ var Card = /** @class */ (function (_super) {
9
+ __extends(Card, _super);
10
+ function Card() {
11
+ var _this = _super !== null && _super.apply(this, arguments) || this;
12
+ _this.iconFactory = Misc.Globals.appService.get(NeoReactTypes.Components.IconFactory);
13
+ _this.expandState = new Model.ObservableValue(_this.props.initiallyCollapsed === undefined ? true : !_this.props.initiallyCollapsed);
14
+ return _this;
15
+ }
16
+ Card.prototype.render = function () {
17
+ var _a = this.props, icon = _a.icon, title = _a.title, children = _a.children, headerElements = _a.headerElements, useCustomScrollbar = _a.useCustomScrollbar, collapsible = _a.collapsible, initiallyCollapsed = _a.initiallyCollapsed, isExpanded = _a.isExpanded, domProps = __rest(_a, ["icon", "title", "children", "headerElements", "useCustomScrollbar", "collapsible", "initiallyCollapsed", "isExpanded"]);
18
+ var className = Utils.joinWithSpaces("neo-card card", domProps.className);
19
+ var isCollapsible = collapsible || isExpanded !== undefined || initiallyCollapsed !== undefined;
20
+ var expandState = isExpanded !== null && isExpanded !== void 0 ? isExpanded : this.expandState;
21
+ if (isCollapsible) {
22
+ var expandIndicator = React.createElement("i", { onClick: function () { return expandState.value = !expandState.value; }, className: "card-expand-indicator fa fa-fw fa-angle-".concat(expandState.value ? "up" : "down") });
23
+ if (headerElements) {
24
+ headerElements = React.createElement(React.Fragment, null,
25
+ headerElements,
26
+ expandIndicator);
27
+ }
28
+ else {
29
+ headerElements = expandIndicator;
30
+ }
31
+ if (!expandState.value) {
32
+ className += " collapsed";
33
+ }
34
+ }
35
+ var body = React.createElement("div", { className: "card-body" },
36
+ useCustomScrollbar && React.createElement(Scrollbar, null, children),
37
+ !useCustomScrollbar && children);
38
+ if (isCollapsible) {
39
+ body =
40
+ React.createElement(Collapsable, { show: expandState.value }, body);
41
+ }
42
+ return (React.createElement("div", __assign({}, domProps, { className: className }),
43
+ (icon || title) &&
44
+ React.createElement("div", { className: "card-header" },
45
+ React.createElement("div", { className: "card-header-title" },
46
+ this.iconFactory.getIconComponent(icon),
47
+ React.createElement("span", null, title)),
48
+ headerElements && React.createElement("div", { className: "card-header-right-section" }, headerElements)),
49
+ body));
50
+ };
51
+ Card = __decorate([
52
+ observer
53
+ ], Card);
54
+ return Card;
55
+ }(React.Component));
56
+ export default Card;
@@ -1,23 +1,23 @@
1
- import { Components } from '@singularsystems/neo-core';
2
- import React from 'react';
3
- import ComponentBase from './ComponentBase';
4
- interface ICollapsableProps extends React.HTMLProps<HTMLDivElement> {
5
- /**
6
- * True if the div should be visible.
7
- */
8
- show: boolean;
9
- /** Callback to show */
10
- onHidden?: () => void;
11
- }
12
- /**
13
- * Renders a div that shows and hides using a vertical collapse animation.
14
- * Uses the collapsable and collapsed css classes.
15
- */
16
- export default class Collapsable extends ComponentBase<ICollapsableProps> {
17
- protected containerRef: React.RefObject<HTMLDivElement>;
18
- protected animationHelper?: Components.CollapseAnimationHelper;
19
- render(): JSX.Element;
20
- afterRender(isInitial: boolean): void;
21
- componentWillUnmount(): void;
22
- }
23
- export {};
1
+ import { Components } from '@singularsystems/neo-core';
2
+ import React from 'react';
3
+ import ComponentBase from './ComponentBase';
4
+ interface ICollapsableProps extends React.HTMLProps<HTMLDivElement> {
5
+ /**
6
+ * True if the div should be visible.
7
+ */
8
+ show: boolean;
9
+ /** Callback to show */
10
+ onHidden?: () => void;
11
+ }
12
+ /**
13
+ * Renders a div that shows and hides using a vertical collapse animation.
14
+ * Uses the collapsable and collapsed css classes.
15
+ */
16
+ export default class Collapsable extends ComponentBase<ICollapsableProps> {
17
+ protected containerRef: React.RefObject<HTMLDivElement>;
18
+ protected animationHelper?: Components.CollapseAnimationHelper;
19
+ render(): JSX.Element;
20
+ afterRender(isInitial: boolean): void;
21
+ componentWillUnmount(): void;
22
+ }
23
+ export {};
@@ -1,38 +1,38 @@
1
- import { __assign, __extends, __rest } from "tslib";
2
- import { Components, Utils } from '@singularsystems/neo-core';
3
- import React from 'react';
4
- import ComponentBase from './ComponentBase';
5
- /**
6
- * Renders a div that shows and hides using a vertical collapse animation.
7
- * Uses the collapsable and collapsed css classes.
8
- */
9
- var Collapsable = /** @class */ (function (_super) {
10
- __extends(Collapsable, _super);
11
- function Collapsable() {
12
- var _this = _super !== null && _super.apply(this, arguments) || this;
13
- _this.containerRef = React.createRef();
14
- return _this;
15
- }
16
- Collapsable.prototype.render = function () {
17
- var _a = this.props, show = _a.show, hidden = _a.hidden, onHidden = _a.onHidden, domProps = __rest(_a, ["show", "hidden", "onHidden"]);
18
- domProps.className = Utils.joinWithSpaces(domProps.className, "collapsable");
19
- return React.createElement("div", __assign({}, domProps, { ref: this.containerRef }), this.props.children);
20
- };
21
- Collapsable.prototype.afterRender = function (isInitial) {
22
- if (this.containerRef.current) {
23
- if (!this.animationHelper) {
24
- this.animationHelper = new Components.CollapseAnimationHelper(this.containerRef.current, this.props.show, undefined, this.props.onHidden);
25
- }
26
- if (!isInitial) {
27
- this.animationHelper.showHide(this.props.show, isInitial);
28
- }
29
- }
30
- };
31
- Collapsable.prototype.componentWillUnmount = function () {
32
- if (this.animationHelper) {
33
- this.animationHelper.destroy();
34
- }
35
- };
36
- return Collapsable;
37
- }(ComponentBase));
38
- export default Collapsable;
1
+ import { __assign, __extends, __rest } from "tslib";
2
+ import { Components, Utils } from '@singularsystems/neo-core';
3
+ import React from 'react';
4
+ import ComponentBase from './ComponentBase';
5
+ /**
6
+ * Renders a div that shows and hides using a vertical collapse animation.
7
+ * Uses the collapsable and collapsed css classes.
8
+ */
9
+ var Collapsable = /** @class */ (function (_super) {
10
+ __extends(Collapsable, _super);
11
+ function Collapsable() {
12
+ var _this = _super !== null && _super.apply(this, arguments) || this;
13
+ _this.containerRef = React.createRef();
14
+ return _this;
15
+ }
16
+ Collapsable.prototype.render = function () {
17
+ var _a = this.props, show = _a.show, hidden = _a.hidden, onHidden = _a.onHidden, domProps = __rest(_a, ["show", "hidden", "onHidden"]);
18
+ domProps.className = Utils.joinWithSpaces(domProps.className, "collapsable");
19
+ return React.createElement("div", __assign({}, domProps, { ref: this.containerRef }), this.props.children);
20
+ };
21
+ Collapsable.prototype.afterRender = function (isInitial) {
22
+ if (this.containerRef.current) {
23
+ if (!this.animationHelper) {
24
+ this.animationHelper = new Components.CollapseAnimationHelper(this.containerRef.current, this.props.show, undefined, this.props.onHidden);
25
+ }
26
+ if (!isInitial) {
27
+ this.animationHelper.showHide(this.props.show, isInitial);
28
+ }
29
+ }
30
+ };
31
+ Collapsable.prototype.componentWillUnmount = function () {
32
+ if (this.animationHelper) {
33
+ this.animationHelper.destroy();
34
+ }
35
+ };
36
+ return Collapsable;
37
+ }(ComponentBase));
38
+ export default Collapsable;
@@ -1,13 +1,13 @@
1
- import React from 'react';
2
- import { Components } from '@singularsystems/neo-core';
3
- import ComponentBase from './ComponentBase';
4
- export default class CollapsableBase<TProps extends Components.ICollapsableOptions> extends ComponentBase<TProps> {
5
- private timer;
6
- protected containerRef: React.RefObject<HTMLDivElement>;
7
- protected shouldShow: boolean;
8
- protected animationHelper?: Components.CollapseAnimationHelper;
9
- constructor(props: TProps);
10
- onClose(e: React.MouseEvent): void;
11
- afterRender(isInitial: boolean): void;
12
- componentWillUnmount(): void;
13
- }
1
+ import React from 'react';
2
+ import { Components } from '@singularsystems/neo-core';
3
+ import ComponentBase from './ComponentBase';
4
+ export default class CollapsableBase<TProps extends Components.ICollapsableOptions> extends ComponentBase<TProps> {
5
+ private timer;
6
+ protected containerRef: React.RefObject<HTMLDivElement>;
7
+ protected shouldShow: boolean;
8
+ protected animationHelper?: Components.CollapseAnimationHelper;
9
+ constructor(props: TProps);
10
+ onClose(e: React.MouseEvent): void;
11
+ afterRender(isInitial: boolean): void;
12
+ componentWillUnmount(): void;
13
+ }