@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,153 +1,153 @@
1
- import { __assign, __decorate, __extends, __metadata } from "tslib";
2
- import * as React from 'react';
3
- import { observer } from 'mobx-react';
4
- import { BindPropsHelper } from './PropTypes';
5
- import { InputHelpers } from './InputHelpers';
6
- import { Misc, Utils } from '@singularsystems/neo-core';
7
- import ComponentBase from './ComponentBase';
8
- import { FormContext } from './FormContext';
9
- import { Button } from './_Exports';
10
- import { makeObservable, observable } from 'mobx';
11
- var Input = /** @class */ (function (_super) {
12
- __extends(Input, _super);
13
- function Input(props) {
14
- var _this = _super.call(this, props) || this;
15
- _this.domRef = React.createRef();
16
- _this.showPassword = false;
17
- _this.onChanged = _this.onChanged.bind(_this);
18
- makeObservable(_this);
19
- return _this;
20
- }
21
- Input.prototype.determineType = function () {
22
- var type = null;
23
- if (this.baseType) {
24
- type = this.baseType;
25
- }
26
- if (!type && this.props.input) {
27
- if (this.props.input.showPasswordButton) {
28
- type = this.showPassword ? "text" : "password";
29
- }
30
- else if (this.props.input.type) {
31
- type = this.props.input.type;
32
- }
33
- }
34
- if (!type) {
35
- if (typeof this.props.bind.value === "boolean" || this.props.bind.propertyInfo.propertyType === Misc.DataType.NullableBoolean) {
36
- type = "checkbox";
37
- }
38
- else {
39
- type = "text";
40
- }
41
- }
42
- return type;
43
- };
44
- Input.prototype.afterRender = function () {
45
- if (this.domRef.current && this.type === "checkbox") {
46
- this.domRef.current.indeterminate = this.props.bind.value === null;
47
- }
48
- };
49
- Input.prototype.onChanged = function (e) {
50
- if (this.props.bind.propertyInfo.propertyType === Misc.DataType.NullableBoolean) {
51
- if (e.target.checked && this.props.bind.value === false) {
52
- this.props.bind.value = null;
53
- return;
54
- }
55
- }
56
- this.props.bind.value = this.type == "checkbox" ? e.target.checked : e.target.value;
57
- };
58
- Input.prototype.render = function () {
59
- var _this = this;
60
- var _a;
61
- this.type = this.determineType();
62
- var splitProps = BindPropsHelper.normaliseEditorProps(this, this.props);
63
- var domProps = BindPropsHelper.autoSetDomProperties(splitProps, this.context);
64
- var inputProps = (_a = splitProps.input) !== null && _a !== void 0 ? _a : {};
65
- var showPasswordButton = inputProps === null || inputProps === void 0 ? void 0 : inputProps.showPasswordButton;
66
- var displayInfo = this.props.bind.validator.getDisplayState(this.context.validationDisplayMode);
67
- displayInfo.applyToDom(domProps, !splitProps.inGroup);
68
- var bindValue = this.props.bind.value;
69
- if (this.type === "checkbox" || this.type === "switch") {
70
- domProps.checked = bindValue === true;
71
- domProps.className = " custom-control-input";
72
- // Bootstrap custom checkboxes don't honour the readonly attribute.
73
- if (domProps.readOnly) {
74
- domProps.disabled = true;
75
- }
76
- if (this.props.label) {
77
- inputProps.label = this.props.label;
78
- }
79
- this.type = "checkbox";
80
- }
81
- else {
82
- domProps.value = (bindValue === undefined || bindValue === null) ? "" : bindValue;
83
- domProps.className = Utils.joinWithSpaces(domProps.className, splitProps.isBootstrap ? "form-control" : "neo-forms-editor");
84
- }
85
- var isInput = (!inputProps.rows || inputProps.rows == 1);
86
- domProps.onChange = this.onChanged;
87
- var inputElement;
88
- if (splitProps.editor.inputElement)
89
- this.domRef = splitProps.editor.inputElement;
90
- if (isInput) {
91
- inputElement = React.createElement("input", __assign({}, domProps, { ref: this.domRef, type: this.type }));
92
- }
93
- else {
94
- inputElement = React.createElement("textarea", __assign({}, domProps, { ref: this.domRef, rows: inputProps.rows }));
95
- }
96
- if (this.type === "checkbox") {
97
- inputElement = React.createElement("div", { className: "custom-control custom-" + ((inputProps === null || inputProps === void 0 ? void 0 : inputProps.type) === "switch" ? "switch" : "checkbox") },
98
- inputElement,
99
- React.createElement("label", { htmlFor: domProps.id, className: "custom-control-label" }, (inputProps.label ? inputProps.label : "")));
100
- }
101
- if (showPasswordButton) {
102
- var buttonOptions = { variant: "primary", isOutline: true };
103
- if (typeof showPasswordButton === "object") {
104
- buttonOptions = showPasswordButton;
105
- }
106
- splitProps.editor.requiresGroup = true;
107
- splitProps.editor.append = this.props.bind.value ?
108
- React.createElement(Button, __assign({ size: "sm" }, buttonOptions, { icon: !this.showPassword ? "far-eye fa-fw" : "far-eye-slash fa-fw", onClick: function () { return _this.showPassword = !_this.showPassword; } })) : null;
109
- }
110
- return (InputHelpers.surroundWithInputGroup(inputElement, splitProps.editor));
111
- };
112
- Input.contextType = FormContext;
113
- __decorate([
114
- observable.ref,
115
- __metadata("design:type", Object)
116
- ], Input.prototype, "showPassword", void 0);
117
- Input = __decorate([
118
- observer,
119
- __metadata("design:paramtypes", [Object])
120
- ], Input);
121
- return Input;
122
- }(ComponentBase));
123
- export default Input;
124
- var Textbox = /** @class */ (function (_super) {
125
- __extends(Textbox, _super);
126
- function Textbox(props) {
127
- var _this = _super.call(this, props) || this;
128
- _this.baseType = "text";
129
- return _this;
130
- }
131
- return Textbox;
132
- }(Input));
133
- export { Textbox };
134
- var Passwordbox = /** @class */ (function (_super) {
135
- __extends(Passwordbox, _super);
136
- function Passwordbox(props) {
137
- var _this = _super.call(this, props) || this;
138
- _this.baseType = "password";
139
- return _this;
140
- }
141
- return Passwordbox;
142
- }(Input));
143
- export { Passwordbox };
144
- var Checkbox = /** @class */ (function (_super) {
145
- __extends(Checkbox, _super);
146
- function Checkbox(props) {
147
- var _this = _super.call(this, props) || this;
148
- _this.baseType = "checkbox";
149
- return _this;
150
- }
151
- return Checkbox;
152
- }(Input));
153
- export { Checkbox };
1
+ import { __assign, __decorate, __extends, __metadata } from "tslib";
2
+ import * as React from 'react';
3
+ import { observer } from 'mobx-react';
4
+ import { BindPropsHelper } from './PropTypes';
5
+ import { InputHelpers } from './InputHelpers';
6
+ import { Misc, Utils } from '@singularsystems/neo-core';
7
+ import ComponentBase from './ComponentBase';
8
+ import { FormContext } from './FormContext';
9
+ import { Button } from './_Exports';
10
+ import { makeObservable, observable } from 'mobx';
11
+ var Input = /** @class */ (function (_super) {
12
+ __extends(Input, _super);
13
+ function Input(props) {
14
+ var _this = _super.call(this, props) || this;
15
+ _this.domRef = React.createRef();
16
+ _this.showPassword = false;
17
+ _this.onChanged = _this.onChanged.bind(_this);
18
+ makeObservable(_this);
19
+ return _this;
20
+ }
21
+ Input.prototype.determineType = function () {
22
+ var type = null;
23
+ if (this.baseType) {
24
+ type = this.baseType;
25
+ }
26
+ if (!type && this.props.input) {
27
+ if (this.props.input.showPasswordButton) {
28
+ type = this.showPassword ? "text" : "password";
29
+ }
30
+ else if (this.props.input.type) {
31
+ type = this.props.input.type;
32
+ }
33
+ }
34
+ if (!type) {
35
+ if (typeof this.props.bind.value === "boolean" || this.props.bind.propertyInfo.propertyType === Misc.DataType.NullableBoolean) {
36
+ type = "checkbox";
37
+ }
38
+ else {
39
+ type = "text";
40
+ }
41
+ }
42
+ return type;
43
+ };
44
+ Input.prototype.afterRender = function () {
45
+ if (this.domRef.current && this.type === "checkbox") {
46
+ this.domRef.current.indeterminate = this.props.bind.value === null;
47
+ }
48
+ };
49
+ Input.prototype.onChanged = function (e) {
50
+ if (this.props.bind.propertyInfo.propertyType === Misc.DataType.NullableBoolean) {
51
+ if (e.target.checked && this.props.bind.value === false) {
52
+ this.props.bind.value = null;
53
+ return;
54
+ }
55
+ }
56
+ this.props.bind.value = this.type == "checkbox" ? e.target.checked : e.target.value;
57
+ };
58
+ Input.prototype.render = function () {
59
+ var _this = this;
60
+ var _a;
61
+ this.type = this.determineType();
62
+ var splitProps = BindPropsHelper.normaliseEditorProps(this, this.props);
63
+ var domProps = BindPropsHelper.autoSetDomProperties(splitProps, this.context);
64
+ var inputProps = (_a = splitProps.input) !== null && _a !== void 0 ? _a : {};
65
+ var showPasswordButton = inputProps === null || inputProps === void 0 ? void 0 : inputProps.showPasswordButton;
66
+ var displayInfo = this.props.bind.validator.getDisplayState(this.context.validationDisplayMode);
67
+ displayInfo.applyToDom(domProps, !splitProps.inGroup);
68
+ var bindValue = this.props.bind.value;
69
+ if (this.type === "checkbox" || this.type === "switch") {
70
+ domProps.checked = bindValue === true;
71
+ domProps.className = " custom-control-input";
72
+ // Bootstrap custom checkboxes don't honour the readonly attribute.
73
+ if (domProps.readOnly) {
74
+ domProps.disabled = true;
75
+ }
76
+ if (this.props.label) {
77
+ inputProps.label = this.props.label;
78
+ }
79
+ this.type = "checkbox";
80
+ }
81
+ else {
82
+ domProps.value = (bindValue === undefined || bindValue === null) ? "" : bindValue;
83
+ domProps.className = Utils.joinWithSpaces(domProps.className, splitProps.isBootstrap ? "form-control" : "neo-forms-editor");
84
+ }
85
+ var isInput = (!inputProps.rows || inputProps.rows == 1);
86
+ domProps.onChange = this.onChanged;
87
+ var inputElement;
88
+ if (splitProps.editor.inputElement)
89
+ this.domRef = splitProps.editor.inputElement;
90
+ if (isInput) {
91
+ inputElement = React.createElement("input", __assign({}, domProps, { ref: this.domRef, type: this.type }));
92
+ }
93
+ else {
94
+ inputElement = React.createElement("textarea", __assign({}, domProps, { ref: this.domRef, rows: inputProps.rows }));
95
+ }
96
+ if (this.type === "checkbox") {
97
+ inputElement = React.createElement("div", { className: "custom-control custom-" + ((inputProps === null || inputProps === void 0 ? void 0 : inputProps.type) === "switch" ? "switch" : "checkbox") },
98
+ inputElement,
99
+ React.createElement("label", { htmlFor: domProps.id, className: "custom-control-label" }, (inputProps.label ? inputProps.label : "")));
100
+ }
101
+ if (showPasswordButton) {
102
+ var buttonOptions = { variant: "primary", isOutline: true };
103
+ if (typeof showPasswordButton === "object") {
104
+ buttonOptions = showPasswordButton;
105
+ }
106
+ splitProps.editor.requiresGroup = true;
107
+ splitProps.editor.append = this.props.bind.value ?
108
+ React.createElement(Button, __assign({ size: "sm" }, buttonOptions, { icon: !this.showPassword ? "far-eye fa-fw" : "far-eye-slash fa-fw", onClick: function () { return _this.showPassword = !_this.showPassword; } })) : null;
109
+ }
110
+ return (InputHelpers.surroundWithInputGroup(inputElement, splitProps.editor, this.domRef));
111
+ };
112
+ Input.contextType = FormContext;
113
+ __decorate([
114
+ observable.ref,
115
+ __metadata("design:type", Object)
116
+ ], Input.prototype, "showPassword", void 0);
117
+ Input = __decorate([
118
+ observer,
119
+ __metadata("design:paramtypes", [Object])
120
+ ], Input);
121
+ return Input;
122
+ }(ComponentBase));
123
+ export default Input;
124
+ var Textbox = /** @class */ (function (_super) {
125
+ __extends(Textbox, _super);
126
+ function Textbox(props) {
127
+ var _this = _super.call(this, props) || this;
128
+ _this.baseType = "text";
129
+ return _this;
130
+ }
131
+ return Textbox;
132
+ }(Input));
133
+ export { Textbox };
134
+ var Passwordbox = /** @class */ (function (_super) {
135
+ __extends(Passwordbox, _super);
136
+ function Passwordbox(props) {
137
+ var _this = _super.call(this, props) || this;
138
+ _this.baseType = "password";
139
+ return _this;
140
+ }
141
+ return Passwordbox;
142
+ }(Input));
143
+ export { Passwordbox };
144
+ var Checkbox = /** @class */ (function (_super) {
145
+ __extends(Checkbox, _super);
146
+ function Checkbox(props) {
147
+ var _this = _super.call(this, props) || this;
148
+ _this.baseType = "checkbox";
149
+ return _this;
150
+ }
151
+ return Checkbox;
152
+ }(Input));
153
+ export { Checkbox };
@@ -1,5 +1,6 @@
1
- import * as React from 'react';
2
- import { ICommonEditorProps } from './PropTypes';
3
- export declare class InputHelpers {
4
- static surroundWithInputGroup<T extends React.ReactNode>(element: T, props: ICommonEditorProps): JSX.Element | T;
5
- }
1
+ import * as React from 'react';
2
+ import { ICommonEditorProps } from './PropTypes';
3
+ export declare class InputHelpers {
4
+ private static iconFactory?;
5
+ static surroundWithInputGroup<T extends React.ReactNode>(element: T, props: ICommonEditorProps, inputRef?: React.RefObject<HTMLElement>): JSX.Element | T;
6
+ }
@@ -1,33 +1,29 @@
1
- import * as React from 'react';
2
- import { Utils } from '@singularsystems/neo-core';
3
- var InputHelpers = /** @class */ (function () {
4
- function InputHelpers() {
5
- }
6
- InputHelpers.surroundWithInputGroup = function (element, props) {
7
- if (props.requiresGroup) {
8
- var preIcon = void 0;
9
- var appendIcon = void 0;
10
- if (props.prependText && (props.prependText.startsWith("fa-") || props.prependText.startsWith("far-"))) {
11
- preIcon = Utils.getFontAwesomeClass(props.prependText);
12
- }
13
- if (props.appendText && (props.appendText.startsWith("fa-") || props.appendText.startsWith("far-"))) {
14
- appendIcon = Utils.getFontAwesomeClass(props.appendText);
15
- }
16
- return (React.createElement("div", { className: "input-group" },
17
- (props.prependText || props.prepend) &&
18
- React.createElement("div", { className: "input-group-prepend" },
19
- props.prepend && (props.prepend instanceof Function ? props.prepend() : props.prepend),
20
- props.prependText && React.createElement("span", { className: "input-group-text" }, preIcon ? React.createElement("i", { className: preIcon }) : props.prependText)),
21
- element,
22
- (props.appendText || props.append) &&
23
- React.createElement("div", { className: "input-group-append" },
24
- props.append && (props.append instanceof Function ? props.append() : props.append),
25
- props.appendText && React.createElement("span", { className: "input-group-text" }, appendIcon ? React.createElement("i", { className: appendIcon }) : props.appendText))));
26
- }
27
- else {
28
- return element;
29
- }
30
- };
31
- return InputHelpers;
32
- }());
33
- export { InputHelpers };
1
+ import * as React from 'react';
2
+ import { Misc } from '@singularsystems/neo-core';
3
+ import { NeoReactTypes } from '../Modules/Types';
4
+ var InputHelpers = /** @class */ (function () {
5
+ function InputHelpers() {
6
+ }
7
+ InputHelpers.surroundWithInputGroup = function (element, props, inputRef) {
8
+ if (!this.iconFactory) {
9
+ this.iconFactory = Misc.Globals.appService.get(NeoReactTypes.Components.IconFactory);
10
+ }
11
+ if (props.requiresGroup) {
12
+ return (React.createElement("div", { className: "input-group" },
13
+ (props.prependText || props.prepend) &&
14
+ React.createElement("div", { className: "input-group-prepend" },
15
+ props.prepend && (props.prepend instanceof Function ? props.prepend() : props.prepend),
16
+ props.prependText && React.createElement("span", { className: "input-group-text", onClick: function () { var _a; return (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); } }, this.iconFactory.textOrIcon(props.prependText))),
17
+ element,
18
+ (props.appendText || props.append) &&
19
+ React.createElement("div", { className: "input-group-append" },
20
+ props.append && (props.append instanceof Function ? props.append() : props.append),
21
+ props.appendText && React.createElement("span", { className: "input-group-text", onClick: function () { var _a; return (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); } }, this.iconFactory.textOrIcon(props.appendText)))));
22
+ }
23
+ else {
24
+ return element;
25
+ }
26
+ };
27
+ return InputHelpers;
28
+ }());
29
+ export { InputHelpers };
@@ -1,13 +1,13 @@
1
- import React from 'react';
2
- interface ILinkProps extends React.HTMLProps<HTMLAnchorElement> {
3
- }
4
- /**
5
- * Renders an anchor tag with an href of '/' unless otherwise specified.
6
- * The onClick event will call preventDefault() so that the anchor acts like a button instead of a link to a url.
7
- */
8
- export default class Link extends React.Component<ILinkProps> {
9
- constructor(props: ILinkProps);
10
- private onClick;
11
- render(): JSX.Element;
12
- }
13
- export {};
1
+ import React from 'react';
2
+ interface ILinkProps extends React.HTMLProps<HTMLAnchorElement> {
3
+ }
4
+ /**
5
+ * Renders an anchor tag with an href of '/' unless otherwise specified.
6
+ * The onClick event will call preventDefault() so that the anchor acts like a button instead of a link to a url.
7
+ */
8
+ export default class Link extends React.Component<ILinkProps> {
9
+ constructor(props: ILinkProps);
10
+ private onClick;
11
+ render(): JSX.Element;
12
+ }
13
+ export {};
@@ -1,28 +1,28 @@
1
- import { __assign, __extends } from "tslib";
2
- import React from 'react';
3
- /**
4
- * Renders an anchor tag with an href of '/' unless otherwise specified.
5
- * The onClick event will call preventDefault() so that the anchor acts like a button instead of a link to a url.
6
- */
7
- var Link = /** @class */ (function (_super) {
8
- __extends(Link, _super);
9
- function Link(props) {
10
- var _this = _super.call(this, props) || this;
11
- _this.onClick = _this.onClick.bind(_this);
12
- return _this;
13
- }
14
- Link.prototype.onClick = function (e) {
15
- e.preventDefault();
16
- if (this.props.onClick) {
17
- this.props.onClick(e);
18
- }
19
- };
20
- Link.prototype.render = function () {
21
- var _a;
22
- var props = this.props;
23
- var href = (_a = props.href) !== null && _a !== void 0 ? _a : "/";
24
- return React.createElement("a", __assign({}, props, { href: href, onClick: this.onClick }), this.props.children);
25
- };
26
- return Link;
27
- }(React.Component));
28
- export default Link;
1
+ import { __assign, __extends } from "tslib";
2
+ import React from 'react';
3
+ /**
4
+ * Renders an anchor tag with an href of '/' unless otherwise specified.
5
+ * The onClick event will call preventDefault() so that the anchor acts like a button instead of a link to a url.
6
+ */
7
+ var Link = /** @class */ (function (_super) {
8
+ __extends(Link, _super);
9
+ function Link(props) {
10
+ var _this = _super.call(this, props) || this;
11
+ _this.onClick = _this.onClick.bind(_this);
12
+ return _this;
13
+ }
14
+ Link.prototype.onClick = function (e) {
15
+ e.preventDefault();
16
+ if (this.props.onClick) {
17
+ this.props.onClick(e);
18
+ }
19
+ };
20
+ Link.prototype.render = function () {
21
+ var _a;
22
+ var props = this.props;
23
+ var href = (_a = props.href) !== null && _a !== void 0 ? _a : "/";
24
+ return React.createElement("a", __assign({}, props, { href: href, onClick: this.onClick }), this.props.children);
25
+ };
26
+ return Link;
27
+ }(React.Component));
28
+ export default Link;
@@ -1,18 +1,18 @@
1
- import React from "react";
2
- import { ITaskRunner } from '@singularsystems/neo-core';
3
- import ComponentBase from './ComponentBase';
4
- interface ILoaderProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
5
- show?: boolean;
6
- task?: ITaskRunner;
7
- showSpinner?: boolean;
8
- /** Set to override the normal size of the spinner. */
9
- size?: "small";
10
- }
11
- export default class Loader extends ComponentBase<ILoaderProps> {
12
- overlayRef: React.RefObject<HTMLDivElement>;
13
- isShowing: boolean;
14
- hasAnimated: boolean;
15
- render(): JSX.Element;
16
- afterRender(): void;
17
- }
18
- export {};
1
+ import React from "react";
2
+ import { ITaskRunner } from '@singularsystems/neo-core';
3
+ import ComponentBase from './ComponentBase';
4
+ interface ILoaderProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
5
+ show?: boolean;
6
+ task?: ITaskRunner;
7
+ showSpinner?: boolean;
8
+ /** Set to override the normal size of the spinner. */
9
+ size?: "small";
10
+ }
11
+ export default class Loader extends ComponentBase<ILoaderProps> {
12
+ overlayRef: React.RefObject<HTMLDivElement>;
13
+ isShowing: boolean;
14
+ hasAnimated: boolean;
15
+ render(): JSX.Element;
16
+ afterRender(): void;
17
+ }
18
+ export {};
@@ -1,57 +1,57 @@
1
- import { __assign, __decorate, __extends, __rest } from "tslib";
2
- import React from "react";
3
- import { observer } from 'mobx-react';
4
- import { Components, Utils } from '@singularsystems/neo-core';
5
- import ComponentBase from './ComponentBase';
6
- var Loader = /** @class */ (function (_super) {
7
- __extends(Loader, _super);
8
- function Loader() {
9
- var _this = _super !== null && _super.apply(this, arguments) || this;
10
- _this.overlayRef = React.createRef();
11
- _this.isShowing = false;
12
- _this.hasAnimated = false;
13
- return _this;
14
- }
15
- Loader.prototype.render = function () {
16
- var _a = this.props, show = _a.show, task = _a.task, showSpinner = _a.showSpinner, size = _a.size, native = __rest(_a, ["show", "task", "showSpinner", "size"]);
17
- show = show || (task && task.isBusy);
18
- var style = {};
19
- if (show) {
20
- if (!this.isShowing && (!task || !task.progressState.hasAnimated)) {
21
- // Start the fade animation the first time this renders
22
- this.isShowing = true;
23
- this.hasAnimated = false;
24
- if (task)
25
- task.progressState.hasAnimated = true;
26
- style.opacity = 0;
27
- }
28
- else {
29
- style.opacity = 1;
30
- }
31
- style.display = "flex";
32
- }
33
- else {
34
- this.isShowing = false;
35
- style.display = "none";
36
- }
37
- native.className = Utils.joinWithSpaces("loader-container", native.className, size);
38
- var showInner = showSpinner !== false || (task && task.options.loadingText);
39
- return (React.createElement("div", __assign({}, native),
40
- this.props.children,
41
- React.createElement("div", { className: "loader-overlay", ref: this.overlayRef, style: style }, showInner && React.createElement("div", { className: "loader-inner" },
42
- showSpinner !== false && React.createElement("div", { className: "spinner-border" }),
43
- React.createElement("span", { className: "loader-text" }, task && task.options.loadingText)))));
44
- };
45
- Loader.prototype.afterRender = function () {
46
- if (this.overlayRef.current && !this.hasAnimated) {
47
- this.hasAnimated = true;
48
- Components.AnimationHelper.triggerReflow(this.overlayRef.current);
49
- this.overlayRef.current.style.opacity = "1";
50
- }
51
- };
52
- Loader = __decorate([
53
- observer
54
- ], Loader);
55
- return Loader;
56
- }(ComponentBase));
57
- export default Loader;
1
+ import { __assign, __decorate, __extends, __rest } from "tslib";
2
+ import React from "react";
3
+ import { observer } from 'mobx-react';
4
+ import { Components, Utils } from '@singularsystems/neo-core';
5
+ import ComponentBase from './ComponentBase';
6
+ var Loader = /** @class */ (function (_super) {
7
+ __extends(Loader, _super);
8
+ function Loader() {
9
+ var _this = _super !== null && _super.apply(this, arguments) || this;
10
+ _this.overlayRef = React.createRef();
11
+ _this.isShowing = false;
12
+ _this.hasAnimated = false;
13
+ return _this;
14
+ }
15
+ Loader.prototype.render = function () {
16
+ var _a = this.props, show = _a.show, task = _a.task, showSpinner = _a.showSpinner, size = _a.size, native = __rest(_a, ["show", "task", "showSpinner", "size"]);
17
+ show = show || (task && task.isBusy);
18
+ var style = {};
19
+ if (show) {
20
+ if (!this.isShowing && (!task || !task.progressState.hasAnimated)) {
21
+ // Start the fade animation the first time this renders
22
+ this.isShowing = true;
23
+ this.hasAnimated = false;
24
+ if (task)
25
+ task.progressState.hasAnimated = true;
26
+ style.opacity = 0;
27
+ }
28
+ else {
29
+ style.opacity = 1;
30
+ }
31
+ style.display = "flex";
32
+ }
33
+ else {
34
+ this.isShowing = false;
35
+ style.display = "none";
36
+ }
37
+ native.className = Utils.joinWithSpaces("loader-container", native.className, size);
38
+ var showInner = showSpinner !== false || (task && task.options.loadingText);
39
+ return (React.createElement("div", __assign({}, native),
40
+ this.props.children,
41
+ React.createElement("div", { className: "loader-overlay", ref: this.overlayRef, style: style }, showInner && React.createElement("div", { className: "loader-inner" },
42
+ showSpinner !== false && React.createElement("div", { className: "spinner-border" }),
43
+ React.createElement("span", { className: "loader-text" }, task && task.options.loadingText)))));
44
+ };
45
+ Loader.prototype.afterRender = function () {
46
+ if (this.overlayRef.current && !this.hasAnimated) {
47
+ this.hasAnimated = true;
48
+ Components.AnimationHelper.triggerReflow(this.overlayRef.current);
49
+ this.overlayRef.current.style.opacity = "1";
50
+ }
51
+ };
52
+ Loader = __decorate([
53
+ observer
54
+ ], Loader);
55
+ return Loader;
56
+ }(ComponentBase));
57
+ export default Loader;