@singularsystems/neo-react 1.0.0-alpha.3 → 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) 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 +132 -123
  17. package/dist/ReactComponents/Card.d.ts +24 -23
  18. package/dist/ReactComponents/Card.js +57 -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 -89
  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 -8
  32. package/dist/ReactComponents/ContextMenu/ContextMenuState.js +23 -24
  33. package/dist/ReactComponents/DatePicker.d.ts +20 -19
  34. package/dist/ReactComponents/DatePicker.js +57 -53
  35. package/dist/ReactComponents/DropDown/AutoCompleteDropDown.d.ts +97 -83
  36. package/dist/ReactComponents/DropDown/AutoCompleteDropDown.js +225 -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 -9
  44. package/dist/ReactComponents/ErrorHandler.js +92 -93
  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 -19
  50. package/dist/ReactComponents/FileManager/FileDropArea.js +66 -66
  51. package/dist/ReactComponents/FileManager/FileInput.d.ts +44 -43
  52. package/dist/ReactComponents/FileManager/FileInput.js +191 -191
  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 -19
  58. package/dist/ReactComponents/Form.js +90 -90
  59. package/dist/ReactComponents/FormContext.d.ts +33 -33
  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 +48 -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 +95 -87
  74. package/dist/ReactComponents/Grid/Grid.js +218 -203
  75. package/dist/ReactComponents/Grid/Row.d.ts +81 -81
  76. package/dist/ReactComponents/Grid/Row.js +200 -202
  77. package/dist/ReactComponents/Grid/StickyTableHeader.d.ts +27 -0
  78. package/dist/ReactComponents/Grid/StickyTableHeader.js +107 -0
  79. package/dist/ReactComponents/Grid/_Exports.d.ts +5 -5
  80. package/dist/ReactComponents/Grid/_Exports.js +5 -5
  81. package/dist/ReactComponents/GridLayout.d.ts +20 -20
  82. package/dist/ReactComponents/GridLayout.js +38 -38
  83. package/dist/ReactComponents/Icons/FontAwesomeIconFactory.d.ts +23 -0
  84. package/dist/ReactComponents/Icons/FontAwesomeIconFactory.js +43 -0
  85. package/dist/ReactComponents/Icons/IIconFactory.d.ts +21 -0
  86. package/dist/ReactComponents/Icons/IIconFactory.js +1 -0
  87. package/dist/ReactComponents/Icons/IconFactory.d.ts +9 -0
  88. package/dist/ReactComponents/Icons/IconFactory.js +45 -0
  89. package/dist/ReactComponents/Icons/index.d.ts +3 -0
  90. package/dist/ReactComponents/Icons/index.js +2 -0
  91. package/dist/ReactComponents/Input.d.ts +45 -45
  92. package/dist/ReactComponents/Input.js +153 -153
  93. package/dist/ReactComponents/InputHelpers.d.ts +6 -5
  94. package/dist/ReactComponents/InputHelpers.js +29 -33
  95. package/dist/ReactComponents/Link.d.ts +13 -13
  96. package/dist/ReactComponents/Link.js +28 -28
  97. package/dist/ReactComponents/Loader.d.ts +18 -18
  98. package/dist/ReactComponents/Loader.js +57 -57
  99. package/dist/ReactComponents/Misc.d.ts +15 -15
  100. package/dist/ReactComponents/Misc.js +28 -28
  101. package/dist/ReactComponents/Modal/Modal.d.ts +11 -11
  102. package/dist/ReactComponents/Modal/Modal.js +133 -129
  103. package/dist/ReactComponents/Modal/ModalContainer.d.ts +17 -17
  104. package/dist/ReactComponents/Modal/ModalContainer.js +37 -37
  105. package/dist/ReactComponents/Modal/ModalPortal.d.ts +16 -16
  106. package/dist/ReactComponents/Modal/ModalPortal.js +27 -27
  107. package/dist/ReactComponents/Notifications/Alert.d.ts +7 -6
  108. package/dist/ReactComponents/Notifications/Alert.js +38 -35
  109. package/dist/ReactComponents/Notifications/Toast.d.ts +9 -8
  110. package/dist/ReactComponents/Notifications/Toast.js +47 -45
  111. package/dist/ReactComponents/Notifications/ToastContainer.d.ts +8 -8
  112. package/dist/ReactComponents/Notifications/ToastContainer.js +18 -18
  113. package/dist/ReactComponents/NumberInput.d.ts +57 -50
  114. package/dist/ReactComponents/NumberInput.js +267 -246
  115. package/dist/ReactComponents/Paging/BasicPagerControls.d.ts +26 -25
  116. package/dist/ReactComponents/Paging/BasicPagerControls.js +57 -55
  117. package/dist/ReactComponents/Paging/PageSizeControl.d.ts +11 -11
  118. package/dist/ReactComponents/Paging/PageSizeControl.js +21 -21
  119. package/dist/ReactComponents/Paging/Pager.d.ts +24 -24
  120. package/dist/ReactComponents/Paging/Pager.js +41 -41
  121. package/dist/ReactComponents/ProgressBar.d.ts +19 -19
  122. package/dist/ReactComponents/ProgressBar.js +52 -52
  123. package/dist/ReactComponents/PropTypes.d.ts +154 -161
  124. package/dist/ReactComponents/PropTypes.js +263 -236
  125. package/dist/ReactComponents/RadioList.d.ts +29 -29
  126. package/dist/ReactComponents/RadioList.js +59 -77
  127. package/dist/ReactComponents/Slider.d.ts +28 -28
  128. package/dist/ReactComponents/Slider.js +76 -76
  129. package/dist/ReactComponents/StateObserver.d.ts +15 -15
  130. package/dist/ReactComponents/StateObserver.js +35 -35
  131. package/dist/ReactComponents/Tabs/Tab.d.ts +42 -41
  132. package/dist/ReactComponents/Tabs/Tab.js +71 -72
  133. package/dist/ReactComponents/Tabs/TabContainer.d.ts +44 -44
  134. package/dist/ReactComponents/Tabs/TabContainer.js +98 -98
  135. package/dist/ReactComponents/Tabs/TabManager.d.ts +62 -62
  136. package/dist/ReactComponents/Tabs/TabManager.js +154 -154
  137. package/dist/ReactComponents/Tooltip.d.ts +20 -20
  138. package/dist/ReactComponents/Tooltip.js +51 -51
  139. package/dist/ReactComponents/TooltipHelper.d.ts +8 -8
  140. package/dist/ReactComponents/TooltipHelper.js +84 -84
  141. package/dist/ReactComponents/TooltipProvider.d.ts +30 -30
  142. package/dist/ReactComponents/TooltipProvider.js +111 -111
  143. package/dist/ReactComponents/ValidationSummary.d.ts +23 -22
  144. package/dist/ReactComponents/ValidationSummary.js +46 -43
  145. package/dist/ReactComponents/_Exports.d.ts +41 -41
  146. package/dist/ReactComponents/_Exports.js +41 -41
  147. package/dist/ReactComponents/_Managers.d.ts +4 -4
  148. package/dist/ReactComponents/_Managers.js +4 -4
  149. package/dist/Routing/BreadCrumbItem.d.ts +14 -14
  150. package/dist/Routing/BreadCrumbItem.js +12 -12
  151. package/dist/Routing/IRouteChangedProps.d.ts +31 -31
  152. package/dist/Routing/IRouteChangedProps.js +1 -1
  153. package/dist/Routing/IRouteParameter.d.ts +22 -22
  154. package/dist/Routing/IRouteParameter.js +9 -9
  155. package/dist/Routing/MenuRoute.d.ts +25 -24
  156. package/dist/Routing/MenuRoute.js +24 -24
  157. package/dist/Routing/NavigationHelper.d.ts +41 -40
  158. package/dist/Routing/NavigationHelper.js +61 -61
  159. package/dist/Routing/PageLeaveHandler.d.ts +13 -13
  160. package/dist/Routing/PageLeaveHandler.js +74 -75
  161. package/dist/Routing/RouteProvider.d.ts +31 -31
  162. package/dist/Routing/RouteProvider.js +92 -92
  163. package/dist/Routing/RouteView.d.ts +50 -50
  164. package/dist/Routing/RouteView.js +143 -143
  165. package/dist/Routing/RoutingState.d.ts +18 -18
  166. package/dist/Routing/RoutingState.js +45 -46
  167. package/dist/Routing/ViewParameter.d.ts +80 -58
  168. package/dist/Routing/ViewParameter.js +116 -96
  169. package/dist/Routing/ViewParameterList.d.ts +53 -53
  170. package/dist/Routing/ViewParameterList.js +163 -145
  171. package/dist/Routing/index.d.ts +9 -9
  172. package/dist/Routing/index.js +6 -6
  173. package/dist/Services/DisposeHelper.d.ts +15 -15
  174. package/dist/Services/DisposeHelper.js +40 -41
  175. package/dist/Services/IDisposeHelper.d.ts +12 -12
  176. package/dist/Services/IDisposeHelper.js +1 -1
  177. package/dist/Views/EmptyViewModel.d.ts +5 -5
  178. package/dist/Views/EmptyViewModel.js +14 -14
  179. package/dist/Views/IViewModel.d.ts +16 -16
  180. package/dist/Views/IViewModel.js +1 -1
  181. package/dist/Views/PersistentViewBase.d.ts +10 -10
  182. package/dist/Views/PersistentViewBase.js +21 -21
  183. package/dist/Views/ViewBase.d.ts +70 -70
  184. package/dist/Views/ViewBase.js +166 -155
  185. package/dist/Views/ViewComponentBase.d.ts +19 -13
  186. package/dist/Views/ViewComponentBase.js +24 -21
  187. package/dist/Views/ViewModelBase.d.ts +57 -56
  188. package/dist/Views/ViewModelBase.js +122 -118
  189. package/dist/Views/ViewState.d.ts +13 -13
  190. package/dist/Views/ViewState.js +9 -9
  191. package/dist/Views/index.d.ts +5 -5
  192. package/dist/Views/index.js +5 -5
  193. package/dist/index.d.ts +11 -10
  194. package/dist/index.js +10 -9
  195. package/package.json +18 -20
  196. package/styles/Card.scss +8 -1
  197. package/styles/DatePicker.scss +13 -2
  198. package/styles/Forms.scss +5 -0
  199. package/styles/Grid.scss +5 -0
  200. package/styles/Validation.scss +0 -9
@@ -1,15 +1,15 @@
1
- export interface ICancellableEvent {
2
- /** Informs the caller to cancel any further actions or processing. */
3
- cancel(): void;
4
- /** Continues with the original action. */
5
- continue(): void;
6
- }
7
- export declare class CancellableEvent implements ICancellableEvent {
8
- private canContinue;
9
- private hasCancelled;
10
- private cancelledAction?;
11
- constructor(canContinue: () => boolean);
12
- cancel(): void;
13
- tryRunAction(action: () => void): void;
14
- continue(): void;
15
- }
1
+ export interface ICancellableEvent {
2
+ /** Informs the caller to cancel any further actions or processing. */
3
+ cancel(): void;
4
+ /** Continues with the original action. */
5
+ continue(): void;
6
+ }
7
+ export declare class CancellableEvent implements ICancellableEvent {
8
+ private canContinue;
9
+ private hasCancelled;
10
+ private cancelledAction?;
11
+ constructor(canContinue: () => boolean);
12
+ cancel(): void;
13
+ tryRunAction(action: () => void): void;
14
+ continue(): void;
15
+ }
@@ -1,28 +1,28 @@
1
- var CancellableEvent = /** @class */ (function () {
2
- function CancellableEvent(canContinue) {
3
- this.canContinue = canContinue;
4
- this.hasCancelled = false;
5
- }
6
- CancellableEvent.prototype.cancel = function () {
7
- this.hasCancelled = true;
8
- };
9
- CancellableEvent.prototype.tryRunAction = function (action) {
10
- if (this.hasCancelled) {
11
- this.cancelledAction = action;
12
- }
13
- else {
14
- action();
15
- }
16
- };
17
- CancellableEvent.prototype.continue = function () {
18
- if (this.cancelledAction === undefined) {
19
- throw Error("continue() cannot be called multiple times, or if the event was not cancelled.");
20
- }
21
- if (this.canContinue()) {
22
- this.cancelledAction();
23
- }
24
- this.cancelledAction = undefined;
25
- };
26
- return CancellableEvent;
27
- }());
28
- export { CancellableEvent };
1
+ var CancellableEvent = /** @class */ (function () {
2
+ function CancellableEvent(canContinue) {
3
+ this.canContinue = canContinue;
4
+ this.hasCancelled = false;
5
+ }
6
+ CancellableEvent.prototype.cancel = function () {
7
+ this.hasCancelled = true;
8
+ };
9
+ CancellableEvent.prototype.tryRunAction = function (action) {
10
+ if (this.hasCancelled) {
11
+ this.cancelledAction = action;
12
+ }
13
+ else {
14
+ action();
15
+ }
16
+ };
17
+ CancellableEvent.prototype.continue = function () {
18
+ if (this.cancelledAction === undefined) {
19
+ throw Error("continue() cannot be called multiple times, or if the event was not cancelled.");
20
+ }
21
+ if (this.canContinue()) {
22
+ this.cancelledAction();
23
+ }
24
+ this.cancelledAction = undefined;
25
+ };
26
+ return CancellableEvent;
27
+ }());
28
+ export { CancellableEvent };
@@ -1,11 +1,11 @@
1
- import * as React from 'react';
2
- import IModalOptions, { IModalOptionsAuto, IModalOptionsModel } from '@singularsystems/neo-core/dist/Components/Modal/ModalOptions';
3
- export default class Modal extends React.Component<IModalOptions | IModalOptionsAuto | IModalOptionsModel> {
4
- private visible;
5
- private hasUnmounted;
6
- private closeTimer;
7
- private onSubmit;
8
- private lastBindValue?;
9
- componentWillUnmount(): void;
10
- render(): false | JSX.Element;
11
- }
1
+ import * as React from 'react';
2
+ import IModalOptions, { IModalOptionsAuto, IModalOptionsModel } from '@singularsystems/neo-core/dist/Components/Modal/ModalOptions';
3
+ export default class Modal extends React.Component<IModalOptions | IModalOptionsAuto | IModalOptionsModel> {
4
+ private visible;
5
+ private hasUnmounted;
6
+ private closeTimer;
7
+ private onSubmit;
8
+ private lastBindValue?;
9
+ componentWillUnmount(): void;
10
+ render(): false | JSX.Element;
11
+ }
@@ -1,129 +1,133 @@
1
- import { __assign, __decorate, __extends, __rest } from "tslib";
2
- import * as React from 'react';
3
- import ModalPortal from './ModalPortal';
4
- import { Misc, Utils } from '@singularsystems/neo-core';
5
- import Button from '../Button';
6
- import { Settings } from '@singularsystems/neo-core/dist/Settings';
7
- import { Neo } from '../..';
8
- import { observer } from 'mobx-react';
9
- var Modal = /** @class */ (function (_super) {
10
- __extends(Modal, _super);
11
- function Modal() {
12
- var _this = _super !== null && _super.apply(this, arguments) || this;
13
- _this.visible = false;
14
- _this.hasUnmounted = false;
15
- return _this;
16
- }
17
- Modal.prototype.componentWillUnmount = function () {
18
- this.hasUnmounted = true;
19
- };
20
- Modal.prototype.render = function () {
21
- var _this = this;
22
- var _a = this.props, closeButton = _a.closeButton, acceptButton = _a.acceptButton, buttons = _a.buttons, showCancelButton = _a.showCancelButton, title = _a.title, size = _a.size, formProps = _a.formProps, suppressForm = _a.suppressForm, className = _a.className, footer = _a.footer, footerContent = _a.footerContent, other = __rest(_a, ["closeButton", "acceptButton", "buttons", "showCancelButton", "title", "size", "formProps", "suppressForm", "className", "footer", "footerContent"]);
23
- var renderOnCollapse = false;
24
- var onClose;
25
- var show;
26
- var propertyInstance = this.props.bind;
27
- if (!propertyInstance) {
28
- propertyInstance = this.props.bindModel;
29
- if (propertyInstance) {
30
- renderOnCollapse = true;
31
- }
32
- }
33
- if (propertyInstance) {
34
- if (propertyInstance.value) {
35
- this.lastBindValue = propertyInstance.value;
36
- }
37
- if (typeof propertyInstance.value === "object") {
38
- formProps = formProps !== null && formProps !== void 0 ? formProps : {};
39
- if (!formProps.model) {
40
- formProps.model = propertyInstance.value;
41
- }
42
- }
43
- show = !!propertyInstance.value;
44
- onClose = function (event) {
45
- if (propertyInstance.value === true) {
46
- propertyInstance.value = false;
47
- }
48
- else {
49
- propertyInstance.value = null;
50
- }
51
- if (_this.props.onClose) {
52
- _this.props.onClose(event);
53
- }
54
- };
55
- }
56
- else {
57
- var manualProps = this.props;
58
- show = manualProps.show;
59
- onClose = manualProps.onClose;
60
- }
61
- if (show) {
62
- this.visible = true;
63
- }
64
- else {
65
- if (this.visible) {
66
- // Fade out
67
- if (!this.closeTimer) {
68
- this.closeTimer = setTimeout(function () {
69
- if (!_this.hasUnmounted) {
70
- _this.visible = false;
71
- _this.forceUpdate();
72
- }
73
- _this.closeTimer = null;
74
- }, Misc.Settings.modalAnimationTimeMs);
75
- }
76
- }
77
- }
78
- if (!buttons) {
79
- buttons = [];
80
- if (acceptButton) {
81
- acceptButton = Utils.populatePartialWithDefaults(acceptButton, __assign({}, Settings.modal.acceptButton));
82
- buttons.push(acceptButton);
83
- if (!suppressForm) {
84
- if (!this.onSubmit) {
85
- this.onSubmit = acceptButton.onClick || onClose;
86
- }
87
- acceptButton.onClick = undefined;
88
- acceptButton.isSubmit = true;
89
- }
90
- }
91
- else {
92
- suppressForm = true;
93
- }
94
- if (closeButton === undefined) {
95
- closeButton = {};
96
- }
97
- if (closeButton) {
98
- buttons.push(Utils.populatePartialWithDefaults(closeButton, __assign(__assign({}, Settings.modal.closeButton), { onClick: onClose })));
99
- }
100
- }
101
- var content = this.visible && React.createElement(React.Fragment, null,
102
- React.createElement("div", { className: "modal-body" }, this.props.children instanceof Function ? (show ? this.props.children(this.lastBindValue) : (renderOnCollapse ? this.props.children(this.lastBindValue) : undefined)) : this.props.children),
103
- React.createElement("div", { className: "modal-footer" }, footer ? footer : React.createElement(React.Fragment, null,
104
- footerContent && React.createElement("div", { className: "modal-footer-content" }, footerContent),
105
- buttons.map(function (buttonProps, index) { return React.createElement(Button, __assign({ key: index }, buttonProps)); }))));
106
- var container;
107
- if (suppressForm) {
108
- container = React.createElement(React.Fragment, null, content);
109
- }
110
- else {
111
- container = React.createElement(Neo.Form, __assign({}, formProps, { onSubmit: function (e) { _this.onSubmit && _this.onSubmit(e); } }), content);
112
- }
113
- return (this.visible &&
114
- React.createElement(ModalPortal, { show: show, onDismiss: onClose, options: this.props },
115
- React.createElement("div", { className: "modal-dialog" + (size ? " modal-" + size : "") + (className ? " " + className : "") },
116
- React.createElement("div", { className: "modal-content" },
117
- React.createElement("div", { className: "modal-header" },
118
- React.createElement("h5", { className: "modal-title" }, this.props.title),
119
- this.props.showCancelButton !== false &&
120
- React.createElement("button", { type: "button", className: "close", "aria-label": "Close", onClick: onClose },
121
- React.createElement("span", { "aria-hidden": "true" }, "\u00D7"))),
122
- container))));
123
- };
124
- Modal = __decorate([
125
- observer
126
- ], Modal);
127
- return Modal;
128
- }(React.Component));
129
- export default Modal;
1
+ import { __assign, __decorate, __extends, __rest } from "tslib";
2
+ import * as React from 'react';
3
+ import ModalPortal from './ModalPortal';
4
+ import { Misc, Utils } from '@singularsystems/neo-core';
5
+ import Button from '../Button';
6
+ import { Settings } from '@singularsystems/neo-core/dist/Settings';
7
+ import { Neo } from '../..';
8
+ import { observer } from 'mobx-react';
9
+ var Modal = /** @class */ (function (_super) {
10
+ __extends(Modal, _super);
11
+ function Modal() {
12
+ var _this = _super !== null && _super.apply(this, arguments) || this;
13
+ _this.visible = false;
14
+ _this.hasUnmounted = false;
15
+ return _this;
16
+ }
17
+ Modal.prototype.componentWillUnmount = function () {
18
+ this.hasUnmounted = true;
19
+ };
20
+ Modal.prototype.render = function () {
21
+ var _this = this;
22
+ var _a = this.props, closeButton = _a.closeButton, acceptButton = _a.acceptButton, buttons = _a.buttons, showCancelButton = _a.showCancelButton, title = _a.title, size = _a.size, formProps = _a.formProps, suppressForm = _a.suppressForm, className = _a.className, footer = _a.footer, footerContent = _a.footerContent, other = __rest(_a, ["closeButton", "acceptButton", "buttons", "showCancelButton", "title", "size", "formProps", "suppressForm", "className", "footer", "footerContent"]);
23
+ var renderOnCollapse = false;
24
+ var onClose;
25
+ var show;
26
+ var propertyInstance = this.props.bind;
27
+ if (!propertyInstance) {
28
+ propertyInstance = this.props.bindModel;
29
+ if (propertyInstance) {
30
+ renderOnCollapse = true;
31
+ }
32
+ }
33
+ if (propertyInstance) {
34
+ if (propertyInstance.value) {
35
+ this.lastBindValue = propertyInstance.value;
36
+ }
37
+ if (typeof propertyInstance.value === "object") {
38
+ formProps = formProps !== null && formProps !== void 0 ? formProps : {};
39
+ if (!formProps.model) {
40
+ formProps.model = propertyInstance.value;
41
+ }
42
+ }
43
+ show = !!propertyInstance.value;
44
+ onClose = function (event) {
45
+ if (propertyInstance.value === true) {
46
+ propertyInstance.value = false;
47
+ }
48
+ else {
49
+ propertyInstance.value = null;
50
+ }
51
+ if (_this.props.onClose) {
52
+ _this.props.onClose(event);
53
+ }
54
+ };
55
+ }
56
+ else {
57
+ var manualProps = this.props;
58
+ show = manualProps.show;
59
+ onClose = manualProps.onClose;
60
+ }
61
+ if (show) {
62
+ this.visible = true;
63
+ }
64
+ else {
65
+ if (this.visible) {
66
+ // Fade out
67
+ if (!this.closeTimer) {
68
+ this.closeTimer = setTimeout(function () {
69
+ if (!_this.hasUnmounted) {
70
+ _this.visible = false;
71
+ _this.forceUpdate();
72
+ }
73
+ if (_this.props.afterClose) {
74
+ _this.props.afterClose();
75
+ }
76
+ ;
77
+ _this.closeTimer = null;
78
+ }, Misc.Settings.modalAnimationTimeMs);
79
+ }
80
+ }
81
+ }
82
+ if (!buttons) {
83
+ buttons = [];
84
+ if (acceptButton) {
85
+ acceptButton = Utils.populatePartialWithDefaults(acceptButton, __assign({}, Settings.modal.acceptButton));
86
+ buttons.push(acceptButton);
87
+ if (!suppressForm) {
88
+ if (!this.onSubmit) {
89
+ this.onSubmit = acceptButton.onClick || onClose;
90
+ }
91
+ acceptButton.onClick = undefined;
92
+ acceptButton.isSubmit = true;
93
+ }
94
+ }
95
+ else {
96
+ suppressForm = true;
97
+ }
98
+ if (closeButton === undefined) {
99
+ closeButton = {};
100
+ }
101
+ if (closeButton) {
102
+ buttons.push(Utils.populatePartialWithDefaults(closeButton, __assign(__assign({}, Settings.modal.closeButton), { onClick: onClose })));
103
+ }
104
+ }
105
+ var content = this.visible && React.createElement(React.Fragment, null,
106
+ React.createElement("div", { className: "modal-body" }, this.props.children instanceof Function ? (show ? this.props.children(this.lastBindValue) : (renderOnCollapse ? this.props.children(this.lastBindValue) : undefined)) : this.props.children),
107
+ React.createElement("div", { className: "modal-footer" }, footer ? footer : React.createElement(React.Fragment, null,
108
+ footerContent && React.createElement("div", { className: "modal-footer-content" }, footerContent),
109
+ buttons.map(function (buttonProps, index) { return React.createElement(Button, __assign({ key: index }, buttonProps)); }))));
110
+ var container;
111
+ if (suppressForm) {
112
+ container = React.createElement(React.Fragment, null, content);
113
+ }
114
+ else {
115
+ container = React.createElement(Neo.Form, __assign({}, formProps, { onSubmit: function (e) { _this.onSubmit && _this.onSubmit(e); } }), content);
116
+ }
117
+ return (this.visible &&
118
+ React.createElement(ModalPortal, { show: show, onDismiss: onClose, options: this.props },
119
+ React.createElement("div", { className: "modal-dialog" + (size ? " modal-" + size : "") + (className ? " " + className : "") },
120
+ React.createElement("div", { className: "modal-content" },
121
+ React.createElement("div", { className: "modal-header" },
122
+ React.createElement("h5", { className: "modal-title" }, this.props.title),
123
+ this.props.showCancelButton !== false &&
124
+ React.createElement("button", { type: "button", className: "close", "aria-label": "Close", onClick: onClose },
125
+ React.createElement("span", { "aria-hidden": "true" }, "\u00D7"))),
126
+ container))));
127
+ };
128
+ Modal = __decorate([
129
+ observer
130
+ ], Modal);
131
+ return Modal;
132
+ }(React.Component));
133
+ export default Modal;
@@ -1,17 +1,17 @@
1
- import React from 'react';
2
- import { IModalContainerOptions } from '@singularsystems/neo-core/dist/Components/Modal/ModalHelper';
3
- interface IModalContainerProps extends IModalContainerOptions {
4
- /**
5
- * By default, the modal container will be added at the root level of the document.
6
- * This prop will make it render in the current position of the ModalContainer component.
7
- */
8
- renderInPlace?: boolean;
9
- }
10
- export default class ModalContainer extends React.Component<IModalContainerProps> {
11
- private modalStore;
12
- private containerRef;
13
- componentDidMount(): void;
14
- componentDidUpdate(): void;
15
- render(): JSX.Element | (0 | JSX.Element)[];
16
- }
17
- export {};
1
+ import React from 'react';
2
+ import { IModalContainerOptions } from '@singularsystems/neo-core/dist/Components/Modal/ModalHelper';
3
+ interface IModalContainerProps extends IModalContainerOptions {
4
+ /**
5
+ * By default, the modal container will be added at the root level of the document.
6
+ * This prop will make it render in the current position of the ModalContainer component.
7
+ */
8
+ renderInPlace?: boolean;
9
+ }
10
+ export default class ModalContainer extends React.Component<IModalContainerProps> {
11
+ private modalStore;
12
+ private containerRef;
13
+ componentDidMount(): void;
14
+ componentDidUpdate(): void;
15
+ render(): JSX.Element | (0 | JSX.Element)[];
16
+ }
17
+ export {};
@@ -1,37 +1,37 @@
1
- import { __assign, __decorate, __extends } from "tslib";
2
- import React from 'react';
3
- import { AppServices, Misc } from '@singularsystems/neo-core';
4
- import Modal from './Modal';
5
- import { observer } from 'mobx-react';
6
- import ModalHelper from '@singularsystems/neo-core/dist/Components/Modal/ModalHelper';
7
- var ModalContainer = /** @class */ (function (_super) {
8
- __extends(ModalContainer, _super);
9
- function ModalContainer() {
10
- var _this = _super !== null && _super.apply(this, arguments) || this;
11
- _this.modalStore = Misc.Globals.appService.get(AppServices.NeoTypes.UI.ModalStore);
12
- _this.containerRef = React.createRef();
13
- return _this;
14
- }
15
- ModalContainer.prototype.componentDidMount = function () {
16
- var _a;
17
- ModalHelper.initialise(this.props, (_a = this.containerRef.current) !== null && _a !== void 0 ? _a : undefined);
18
- };
19
- ModalContainer.prototype.componentDidUpdate = function () {
20
- ModalHelper.appInstance.updateProps(this.props);
21
- };
22
- ModalContainer.prototype.render = function () {
23
- var modalList = this.modalStore.modals.map(function (modal) { return (modal.refreshValue &&
24
- React.createElement(Modal, __assign({ key: modal.id }, modal.options), modal.content)); });
25
- if (this.props.renderInPlace) {
26
- return React.createElement("div", { ref: this.containerRef }, modalList);
27
- }
28
- else {
29
- return modalList;
30
- }
31
- };
32
- ModalContainer = __decorate([
33
- observer
34
- ], ModalContainer);
35
- return ModalContainer;
36
- }(React.Component));
37
- export default ModalContainer;
1
+ import { __assign, __decorate, __extends } from "tslib";
2
+ import React from 'react';
3
+ import { AppServices, Misc } from '@singularsystems/neo-core';
4
+ import Modal from './Modal';
5
+ import { observer } from 'mobx-react';
6
+ import ModalHelper from '@singularsystems/neo-core/dist/Components/Modal/ModalHelper';
7
+ var ModalContainer = /** @class */ (function (_super) {
8
+ __extends(ModalContainer, _super);
9
+ function ModalContainer() {
10
+ var _this = _super !== null && _super.apply(this, arguments) || this;
11
+ _this.modalStore = Misc.Globals.appService.get(AppServices.NeoTypes.UI.ModalStore);
12
+ _this.containerRef = React.createRef();
13
+ return _this;
14
+ }
15
+ ModalContainer.prototype.componentDidMount = function () {
16
+ var _a;
17
+ ModalHelper.initialise(this.props, (_a = this.containerRef.current) !== null && _a !== void 0 ? _a : undefined);
18
+ };
19
+ ModalContainer.prototype.componentDidUpdate = function () {
20
+ ModalHelper.appInstance.updateProps(this.props);
21
+ };
22
+ ModalContainer.prototype.render = function () {
23
+ var modalList = this.modalStore.modals.map(function (modal) { return (modal.refreshValue &&
24
+ React.createElement(Modal, __assign({ key: modal.id }, modal.options), modal.content)); });
25
+ if (this.props.renderInPlace) {
26
+ return React.createElement("div", { ref: this.containerRef }, modalList);
27
+ }
28
+ else {
29
+ return modalList;
30
+ }
31
+ };
32
+ ModalContainer = __decorate([
33
+ observer
34
+ ], ModalContainer);
35
+ return ModalContainer;
36
+ }(React.Component));
37
+ export default ModalContainer;
@@ -1,16 +1,16 @@
1
- import React from 'react';
2
- import { IModalOptionsBase } from '@singularsystems/neo-core/dist/Components/Modal/ModalOptions';
3
- export interface IModalPortalProps {
4
- show: boolean;
5
- onDismiss: (e: any) => void;
6
- options: IModalOptionsBase;
7
- children: React.ReactNode;
8
- }
9
- export default class ModalPortal extends React.Component<IModalPortalProps> {
10
- private modalContainer;
11
- private modalInstance;
12
- constructor(props: IModalPortalProps);
13
- componentDidMount(): void;
14
- componentWillUnmount(): void;
15
- render(): React.ReactPortal;
16
- }
1
+ import React from 'react';
2
+ import { IModalOptionsBase } from '@singularsystems/neo-core/dist/Components/Modal/ModalOptions';
3
+ export interface IModalPortalProps {
4
+ show: boolean;
5
+ onDismiss: (e: any) => void;
6
+ options: IModalOptionsBase;
7
+ children: React.ReactNode;
8
+ }
9
+ export default class ModalPortal extends React.Component<IModalPortalProps> {
10
+ private modalContainer;
11
+ private modalInstance;
12
+ constructor(props: IModalPortalProps);
13
+ componentDidMount(): void;
14
+ componentWillUnmount(): void;
15
+ render(): import("react").ReactPortal;
16
+ }
@@ -1,27 +1,27 @@
1
- import { __extends } from "tslib";
2
- import React from 'react';
3
- import { createPortal } from 'react-dom';
4
- import ModalHelper from '@singularsystems/neo-core/dist/Components/Modal/ModalHelper';
5
- var ModalPortal = /** @class */ (function (_super) {
6
- __extends(ModalPortal, _super);
7
- function ModalPortal(props) {
8
- var _this = _super.call(this, props) || this;
9
- _this.modalContainer = document.createElement("div");
10
- return _this;
11
- }
12
- ModalPortal.prototype.componentDidMount = function () {
13
- var options = this.props.options;
14
- this.modalInstance = ModalHelper.appInstance.addModal(this.modalContainer, options, options.showCancelButton !== false ? this.props.onDismiss : undefined);
15
- };
16
- ModalPortal.prototype.componentWillUnmount = function () {
17
- ModalHelper.appInstance.endRemove(this.modalInstance);
18
- };
19
- ModalPortal.prototype.render = function () {
20
- if (!this.props.show && !this.modalInstance.isRemoving) {
21
- ModalHelper.appInstance.beginRemove(this.modalInstance);
22
- }
23
- return createPortal(this.props.children, this.modalContainer);
24
- };
25
- return ModalPortal;
26
- }(React.Component));
27
- export default ModalPortal;
1
+ import { __extends } from "tslib";
2
+ import React from 'react';
3
+ import { createPortal } from 'react-dom';
4
+ import ModalHelper from '@singularsystems/neo-core/dist/Components/Modal/ModalHelper';
5
+ var ModalPortal = /** @class */ (function (_super) {
6
+ __extends(ModalPortal, _super);
7
+ function ModalPortal(props) {
8
+ var _this = _super.call(this, props) || this;
9
+ _this.modalContainer = document.createElement("div");
10
+ return _this;
11
+ }
12
+ ModalPortal.prototype.componentDidMount = function () {
13
+ var options = this.props.options;
14
+ this.modalInstance = ModalHelper.appInstance.addModal(this.modalContainer, options, options.showCancelButton !== false ? this.props.onDismiss : undefined);
15
+ };
16
+ ModalPortal.prototype.componentWillUnmount = function () {
17
+ ModalHelper.appInstance.endRemove(this.modalInstance);
18
+ };
19
+ ModalPortal.prototype.render = function () {
20
+ if (!this.props.show && !this.modalInstance.isRemoving) {
21
+ ModalHelper.appInstance.beginRemove(this.modalInstance);
22
+ }
23
+ return createPortal(this.props.children, this.modalContainer);
24
+ };
25
+ return ModalPortal;
26
+ }(React.Component));
27
+ export default ModalPortal;
@@ -1,6 +1,7 @@
1
- import React from "react";
2
- import { Components } from "@singularsystems/neo-core";
3
- import CollapsableBase from '../CollapsableBase';
4
- export default class Alert extends CollapsableBase<Components.INotificationOptions & React.HTMLProps<HTMLDivElement>> {
5
- render(): JSX.Element;
6
- }
1
+ import React from "react";
2
+ import { Components } from "@singularsystems/neo-core";
3
+ import CollapsableBase from '../CollapsableBase';
4
+ export default class Alert extends CollapsableBase<Components.INotificationOptions & React.HTMLProps<HTMLDivElement>> {
5
+ private iconFactory;
6
+ render(): JSX.Element;
7
+ }