@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
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Watches for when a table header scrolls out of view.
3
+ * When it does, adds a cloned header that is fixed at the top of the scrolling element.
4
+ */
5
+ var StickyTableHeader = /** @class */ (function () {
6
+ /**
7
+ * Creates the instance, and begins listening for scroll events.
8
+ * @param table The table to add sticky headers to.
9
+ * @param fixedElement A fixed element at the top of the screen to use as an anchor, rather than the top of the screen itself.
10
+ */
11
+ function StickyTableHeader(table, fixedElement) {
12
+ this.table = table;
13
+ this.fixedElement = fixedElement;
14
+ this.headerHeight = 0;
15
+ if (!table.tHead) {
16
+ throw Error("Table must have a header section.");
17
+ }
18
+ this.header = table.tHead;
19
+ this.scrollParent = StickyTableHeader.getParentScrollElement(table);
20
+ this.handleScroll = this.handleScroll.bind(this);
21
+ this.onPossibleContentChange = this.onPossibleContentChange.bind(this);
22
+ document.addEventListener("scroll", this.handleScroll);
23
+ if (this.scrollParent) {
24
+ this.scrollParent.addEventListener("scroll", this.handleScroll);
25
+ }
26
+ table.addEventListener("keydown", this.onPossibleContentChange);
27
+ table.addEventListener("mouseup", this.onPossibleContentChange);
28
+ }
29
+ StickyTableHeader.prototype.handleScroll = function () {
30
+ // If the grid is in an element with a scrollbar, then the header should stick to the top of that element,
31
+ // otherwise if there is a fixed (non scrolling) element at the top of the page, then the headers must appear below that.
32
+ // otherwise the headers will stick to the top of the screen.
33
+ var fixedElement = null;
34
+ if (!this.scrollParent && this.fixedElement && getComputedStyle(this.fixedElement).position === "fixed") {
35
+ fixedElement = this.fixedElement;
36
+ }
37
+ var topBoundary = this.scrollParent ? this.scrollParent.getBoundingClientRect().top : (fixedElement ? fixedElement.getBoundingClientRect().bottom : 0);
38
+ var tableBounds = this.table.getBoundingClientRect();
39
+ var tbodyBounds = this.table.tBodies[this.table.tBodies.length - 1].getBoundingClientRect();
40
+ if (tableBounds.top < topBoundary && tbodyBounds.bottom - this.headerHeight > topBoundary) {
41
+ if (!this.headerCopy) {
42
+ // Clone the header, and re-insert it into the table. The table will then have 2 headers.
43
+ // The original headers position is set to "fixed" which makes it float.
44
+ // The column widths of the floating header then need to be synchronised with the header that is still inside the table layout.
45
+ this.headerHeight = this.header.getBoundingClientRect().height;
46
+ this.headerCopy = this.header.cloneNode(true);
47
+ this.table.insertBefore(this.headerCopy, this.header);
48
+ this.header.classList.add("neo-grid-fixed-header");
49
+ this.setColumnWidths();
50
+ }
51
+ this.header.style.left = tableBounds.left + "px";
52
+ this.header.style.top = topBoundary + "px";
53
+ }
54
+ else {
55
+ this.setColumnWidths(true);
56
+ this.removeCopy();
57
+ }
58
+ };
59
+ StickyTableHeader.prototype.removeCopy = function () {
60
+ if (this.headerCopy) {
61
+ this.header.classList.remove("neo-grid-fixed-header");
62
+ this.table.removeChild(this.headerCopy);
63
+ this.headerCopy = undefined;
64
+ }
65
+ };
66
+ StickyTableHeader.prototype.onPossibleContentChange = function () {
67
+ var _this = this;
68
+ setTimeout(function () { return _this.setColumnWidths(); }, 0);
69
+ };
70
+ StickyTableHeader.prototype.setColumnWidths = function (isRemoving) {
71
+ if (isRemoving === void 0) { isRemoving = false; }
72
+ if (this.headerCopy) {
73
+ for (var i = 0; i < this.header.rows.length; i++) {
74
+ var originalRow = this.header.rows[i], copyRow = this.headerCopy.rows[i];
75
+ for (var j = 0; j < originalRow.cells.length; j++) {
76
+ var originalCell = originalRow.cells[j], copyCell = copyRow.cells[j];
77
+ originalCell.style.width = isRemoving ? copyCell.style.width : window.getComputedStyle(copyCell).width;
78
+ }
79
+ }
80
+ }
81
+ };
82
+ StickyTableHeader.prototype.dispose = function () {
83
+ document.removeEventListener("scroll", this.handleScroll);
84
+ if (this.scrollParent) {
85
+ this.scrollParent.removeEventListener("scroll", this.handleScroll);
86
+ }
87
+ this.table.removeEventListener("keydown", this.onPossibleContentChange);
88
+ this.table.removeEventListener("mouseup", this.onPossibleContentChange);
89
+ this.removeCopy();
90
+ };
91
+ /**
92
+ * Returns the first parent element that has a scrollbar.
93
+ */
94
+ StickyTableHeader.getParentScrollElement = function (element) {
95
+ var current = element;
96
+ while (current) {
97
+ if ((current.style.height || current.style.maxHeight) &&
98
+ (current.style.overflow === "scroll" || current.style.overflow === "auto" || current.style.overflowY === "scroll" || current.style.overflowY === "auto")) {
99
+ return current;
100
+ }
101
+ current = current.parentElement;
102
+ }
103
+ return undefined;
104
+ };
105
+ return StickyTableHeader;
106
+ }());
107
+ export { StickyTableHeader };
@@ -1,5 +1,5 @@
1
- import Grid from './Grid';
2
- import Column from './Column';
3
- import Row, { RowGroup, ChildRow } from './Row';
4
- import { ButtonColumn } from './ButtonColumn';
5
- export { Grid, Column, RowGroup, Row, ChildRow, ButtonColumn };
1
+ import Grid from './Grid';
2
+ import Column from './Column';
3
+ import Row, { RowGroup, ChildRow } from './Row';
4
+ import { ButtonColumn } from './ButtonColumn';
5
+ export { Grid, Column, RowGroup, Row, ChildRow, ButtonColumn };
@@ -1,5 +1,5 @@
1
- import Grid from './Grid';
2
- import Column from './Column';
3
- import Row, { RowGroup, ChildRow } from './Row';
4
- import { ButtonColumn } from './ButtonColumn';
5
- export { Grid, Column, RowGroup, Row, ChildRow, ButtonColumn };
1
+ import Grid from './Grid';
2
+ import Column from './Column';
3
+ import Row, { RowGroup, ChildRow } from './Row';
4
+ import { ButtonColumn } from './ButtonColumn';
5
+ export { Grid, Column, RowGroup, Row, ChildRow, ButtonColumn };
@@ -1,20 +1,20 @@
1
- import React from 'react';
2
- import { Components } from '@singularsystems/neo-core';
3
- interface ILayoutGridProps extends Components.IColumnCountBreakpoints {
4
- /** Size of gutters between columns. 1 - 5. */
5
- gutterSize?: Components.gutterSize;
6
- /** Vertical space to insert between rows. Specify using a css dimension. */
7
- verticalSpace?: string;
8
- /** Sets verticalSpace to "1rem" for convenience. */
9
- withGaps?: boolean;
10
- alignItems?: Components.flexItemAlign;
11
- formGroupProps?: Components.IColumnWidthBreakpoints;
12
- }
13
- export declare class FormGroupLayoutContextParams {
14
- formGroupProps?: Components.IColumnWidthBreakpoints;
15
- }
16
- export declare const FormGroupLayoutContext: React.Context<FormGroupLayoutContextParams>;
17
- export default class GridLayout extends React.Component<ILayoutGridProps & React.HTMLProps<HTMLDivElement>> {
18
- render(): JSX.Element;
19
- }
20
- export {};
1
+ import React from 'react';
2
+ import { Components } from '@singularsystems/neo-core';
3
+ interface ILayoutGridProps extends Components.IColumnCountBreakpoints {
4
+ /** Size of gutters between columns. 1 - 5. */
5
+ gutterSize?: Components.gutterSize;
6
+ /** Vertical space to insert between rows. Specify using a css dimension. */
7
+ verticalSpace?: string;
8
+ /** Sets verticalSpace to "1rem" for convenience. */
9
+ withGaps?: boolean;
10
+ alignItems?: Components.flexItemAlign;
11
+ formGroupProps?: Components.IColumnWidthBreakpoints;
12
+ }
13
+ export declare class FormGroupLayoutContextParams {
14
+ formGroupProps?: Components.IColumnWidthBreakpoints;
15
+ }
16
+ export declare const FormGroupLayoutContext: React.Context<FormGroupLayoutContextParams>;
17
+ export default class GridLayout extends React.Component<ILayoutGridProps & React.HTMLProps<HTMLDivElement>> {
18
+ render(): JSX.Element;
19
+ }
20
+ export {};
@@ -1,38 +1,38 @@
1
- import { __assign, __extends, __rest } from "tslib";
2
- import React from 'react';
3
- import { Utils } from '@singularsystems/neo-core';
4
- var FormGroupLayoutContextParams = /** @class */ (function () {
5
- function FormGroupLayoutContextParams() {
6
- }
7
- return FormGroupLayoutContextParams;
8
- }());
9
- export { FormGroupLayoutContextParams };
10
- export var FormGroupLayoutContext = React.createContext(new FormGroupLayoutContextParams());
11
- var GridLayout = /** @class */ (function (_super) {
12
- __extends(GridLayout, _super);
13
- function GridLayout() {
14
- return _super !== null && _super.apply(this, arguments) || this;
15
- }
16
- GridLayout.prototype.render = function () {
17
- var _a = this.props, gutterSize = _a.gutterSize, verticalSpace = _a.verticalSpace, withGaps = _a.withGaps, alignItems = _a.alignItems, formGroupProps = _a.formGroupProps, xs = _a.xs, sm = _a.sm, md = _a.md, lg = _a.lg, xl = _a.xl, xxl = _a.xxl, domProps = __rest(_a, ["gutterSize", "verticalSpace", "withGaps", "alignItems", "formGroupProps", "xs", "sm", "md", "lg", "xl", "xxl"]);
18
- var columnClassName = Utils.joinWithSpaces(gutterSize && "px-" + gutterSize, xs && "col-" + 12 / xs, sm && "col-sm-" + 12 / sm, md && "col-md-" + 12 / md, lg && "col-lg-" + 12 / lg, xl && "col-xl-" + 12 / xl, xxl && "col-xxl-" + 12 / xxl);
19
- if (!(xs || sm || md || lg || xl || xxl)) {
20
- columnClassName = Utils.joinWithSpaces(columnClassName, "col-md-6");
21
- }
22
- var rowClassName = Utils.joinWithSpaces(domProps.className, "row", gutterSize && "mx-n" + this.props.gutterSize, alignItems && "align-items-" + this.props.alignItems);
23
- var containerStyle = domProps.style;
24
- var columnStyle = undefined;
25
- if (withGaps && !verticalSpace) {
26
- verticalSpace = "1rem";
27
- }
28
- if (verticalSpace) {
29
- containerStyle = containerStyle || {};
30
- containerStyle.marginTop = "-" + verticalSpace;
31
- columnStyle = { marginTop: verticalSpace };
32
- }
33
- return (React.createElement(FormGroupLayoutContext.Provider, { value: { formGroupProps: this.props.formGroupProps } },
34
- React.createElement("div", __assign({}, domProps, { className: rowClassName, style: containerStyle }), React.Children.map(this.props.children, function (child) { return (child && React.createElement("div", { className: columnClassName, style: columnStyle }, child)); }))));
35
- };
36
- return GridLayout;
37
- }(React.Component));
38
- export default GridLayout;
1
+ import { __assign, __extends, __rest } from "tslib";
2
+ import React from 'react';
3
+ import { Utils } from '@singularsystems/neo-core';
4
+ var FormGroupLayoutContextParams = /** @class */ (function () {
5
+ function FormGroupLayoutContextParams() {
6
+ }
7
+ return FormGroupLayoutContextParams;
8
+ }());
9
+ export { FormGroupLayoutContextParams };
10
+ export var FormGroupLayoutContext = React.createContext(new FormGroupLayoutContextParams());
11
+ var GridLayout = /** @class */ (function (_super) {
12
+ __extends(GridLayout, _super);
13
+ function GridLayout() {
14
+ return _super !== null && _super.apply(this, arguments) || this;
15
+ }
16
+ GridLayout.prototype.render = function () {
17
+ var _a = this.props, gutterSize = _a.gutterSize, verticalSpace = _a.verticalSpace, withGaps = _a.withGaps, alignItems = _a.alignItems, formGroupProps = _a.formGroupProps, xs = _a.xs, sm = _a.sm, md = _a.md, lg = _a.lg, xl = _a.xl, xxl = _a.xxl, domProps = __rest(_a, ["gutterSize", "verticalSpace", "withGaps", "alignItems", "formGroupProps", "xs", "sm", "md", "lg", "xl", "xxl"]);
18
+ var columnClassName = Utils.joinWithSpaces(gutterSize && "px-" + gutterSize, xs && "col-" + 12 / xs, sm && "col-sm-" + 12 / sm, md && "col-md-" + 12 / md, lg && "col-lg-" + 12 / lg, xl && "col-xl-" + 12 / xl, xxl && "col-xxl-" + 12 / xxl);
19
+ if (!(xs || sm || md || lg || xl || xxl)) {
20
+ columnClassName = Utils.joinWithSpaces(columnClassName, "col-md-6");
21
+ }
22
+ var rowClassName = Utils.joinWithSpaces(domProps.className, "row", gutterSize && "mx-n" + this.props.gutterSize, alignItems && "align-items-" + this.props.alignItems);
23
+ var containerStyle = domProps.style;
24
+ var columnStyle = undefined;
25
+ if (withGaps && !verticalSpace) {
26
+ verticalSpace = "1rem";
27
+ }
28
+ if (verticalSpace) {
29
+ containerStyle = containerStyle || {};
30
+ containerStyle.marginTop = "-" + verticalSpace;
31
+ columnStyle = { marginTop: verticalSpace };
32
+ }
33
+ return (React.createElement(FormGroupLayoutContext.Provider, { value: { formGroupProps: this.props.formGroupProps } },
34
+ React.createElement("div", __assign({}, domProps, { className: rowClassName, style: containerStyle }), React.Children.map(this.props.children, function (child) { return (child && React.createElement("div", { className: columnClassName, style: columnStyle }, child)); }))));
35
+ };
36
+ return GridLayout;
37
+ }(React.Component));
38
+ export default GridLayout;
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ import { IconFactory } from "./IconFactory";
3
+ import { IconStyle } from "./IIconFactory";
4
+ interface IconDefinition {
5
+ iconName: string;
6
+ }
7
+ interface FontAwesomeIconComponentProps {
8
+ icon: any;
9
+ fixedWidth?: boolean;
10
+ spin?: boolean;
11
+ }
12
+ type FontAwesomeComponent = (props: FontAwesomeIconComponentProps) => JSX.Element;
13
+ /** Icon factory supporting font-awesome string, as well as the font-awesome icon definition and component. */
14
+ export declare class FontAwesomeIconFactory extends IconFactory {
15
+ private fontAwesomeComponentType;
16
+ /**
17
+ * Creates a font awesome factory, allowing the use of IconDefinition on any neo icon prop.
18
+ * @param fontAwesomeComponentType import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
19
+ */
20
+ constructor(fontAwesomeComponentType: FontAwesomeComponent);
21
+ protected createIconComponent(iconComponent: IconDefinition | JSX.Element, iconStyle?: IconStyle): React.ReactNode;
22
+ }
23
+ export {};
@@ -0,0 +1,43 @@
1
+ import { __assign, __decorate, __extends, __metadata } from "tslib";
2
+ import React from "react";
3
+ import { injectable } from "inversify";
4
+ import { IconFactory } from "./IconFactory";
5
+ /** Icon factory supporting font-awesome string, as well as the font-awesome icon definition and component. */
6
+ export var FontAwesomeIconFactory = /** @class */ (function (_super) {
7
+ __extends(FontAwesomeIconFactory, _super);
8
+ /**
9
+ * Creates a font awesome factory, allowing the use of IconDefinition on any neo icon prop.
10
+ * @param fontAwesomeComponentType import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
11
+ */
12
+ function FontAwesomeIconFactory(fontAwesomeComponentType) {
13
+ var _this = _super.call(this) || this;
14
+ _this.fontAwesomeComponentType = fontAwesomeComponentType;
15
+ return _this;
16
+ }
17
+ FontAwesomeIconFactory.prototype.createIconComponent = function (iconComponent, iconStyle) {
18
+ if (iconComponent.iconName) {
19
+ // Icon was specified using a font-awesome icon descriptor, return the font-awesome icon component.
20
+ return React.createElement(this.fontAwesomeComponentType, {
21
+ icon: iconComponent,
22
+ fixedWidth: iconStyle === null || iconStyle === void 0 ? void 0 : iconStyle.fixedWidth,
23
+ spin: iconStyle === null || iconStyle === void 0 ? void 0 : iconStyle.spin
24
+ });
25
+ }
26
+ else {
27
+ // Icon was specified as a font-awesome component. Extract the props, and override using the requested style.
28
+ var props = __assign({}, iconComponent.props);
29
+ if (iconStyle === null || iconStyle === void 0 ? void 0 : iconStyle.fixedWidth) {
30
+ props.fixedWidth = iconStyle.fixedWidth;
31
+ }
32
+ if (iconStyle === null || iconStyle === void 0 ? void 0 : iconStyle.spin) {
33
+ props.spin = iconStyle.spin;
34
+ }
35
+ return React.createElement(iconComponent.type, props);
36
+ }
37
+ };
38
+ FontAwesomeIconFactory = __decorate([
39
+ injectable(),
40
+ __metadata("design:paramtypes", [Function])
41
+ ], FontAwesomeIconFactory);
42
+ return FontAwesomeIconFactory;
43
+ }(IconFactory));
@@ -0,0 +1,21 @@
1
+ /// <reference types="react" />
2
+ export interface IconStyle {
3
+ fixedWidth?: boolean;
4
+ spin?: boolean;
5
+ }
6
+ export interface IIconFactory {
7
+ /**
8
+ * Returns a component that renders an icon.
9
+ * @param iconOrName If this is a string, it is treated as an icon name. Otherwise it is treated as the icon component.
10
+ *
11
+ * The default neo icon factory maps icon names to font-awesome icons.
12
+ */
13
+ getIconComponent(iconOrName: any, style?: IconStyle): React.ReactNode | undefined;
14
+ /**
15
+ * Returns the original text, or an icon for specific prefixes.
16
+ * @param textOrIcon If textOrIcon starts with a specific prefix, this will return an icon component, otherwise it will return text.
17
+ *
18
+ * By default the neo icon factory will return a font-awesome icon if the prefix is fa- or far-
19
+ */
20
+ textOrIcon(textOrIcon: string, style?: IconStyle): React.ReactNode | string;
21
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { IconStyle, IIconFactory } from "./IIconFactory";
3
+ /** Default icon factory supporting font-awesome strings. */
4
+ export declare class IconFactory implements IIconFactory {
5
+ getIconComponent(iconOrName: any, style?: IconStyle): React.ReactNode;
6
+ textOrIcon(textOrIcon: string, style?: IconStyle): React.ReactNode;
7
+ protected mapStringToIcon(iconName: string, style?: IconStyle): React.ReactNode;
8
+ protected createIconComponent(iconDescriptor: any, style?: IconStyle): React.ReactNode;
9
+ }
@@ -0,0 +1,45 @@
1
+ import { __decorate } from "tslib";
2
+ import { Utils } from "@singularsystems/neo-core";
3
+ import React from "react";
4
+ import { injectable } from 'inversify';
5
+ /** Default icon factory supporting font-awesome strings. */
6
+ export var IconFactory = /** @class */ (function () {
7
+ function IconFactory() {
8
+ }
9
+ IconFactory.prototype.getIconComponent = function (iconOrName, style) {
10
+ if (iconOrName !== undefined) {
11
+ if (typeof iconOrName === "string") {
12
+ return this.mapStringToIcon(iconOrName, style);
13
+ }
14
+ else {
15
+ return this.createIconComponent(iconOrName, style);
16
+ }
17
+ }
18
+ return undefined;
19
+ };
20
+ IconFactory.prototype.textOrIcon = function (textOrIcon, style) {
21
+ if (textOrIcon.indexOf("fa-") === 0 || textOrIcon.indexOf("far-") === 0) {
22
+ return this.getIconComponent(textOrIcon, style);
23
+ }
24
+ else {
25
+ return textOrIcon;
26
+ }
27
+ };
28
+ IconFactory.prototype.mapStringToIcon = function (iconName, style) {
29
+ var className = Utils.getFontAwesomeClass(iconName);
30
+ if (style === null || style === void 0 ? void 0 : style.fixedWidth) {
31
+ className += " fa-fw";
32
+ }
33
+ if (style === null || style === void 0 ? void 0 : style.spin) {
34
+ className += " fa-spin";
35
+ }
36
+ return React.createElement("i", { className: className });
37
+ };
38
+ IconFactory.prototype.createIconComponent = function (iconDescriptor, style) {
39
+ return iconDescriptor;
40
+ };
41
+ IconFactory = __decorate([
42
+ injectable()
43
+ ], IconFactory);
44
+ return IconFactory;
45
+ }());
@@ -0,0 +1,3 @@
1
+ export { IIconFactory, IconStyle } from './IIconFactory';
2
+ export { IconFactory } from './IconFactory';
3
+ export { FontAwesomeIconFactory } from './FontAwesomeIconFactory';
@@ -0,0 +1,2 @@
1
+ export { IconFactory } from './IconFactory';
2
+ export { FontAwesomeIconFactory } from './FontAwesomeIconFactory';
@@ -1,45 +1,45 @@
1
- import * as React from 'react';
2
- import { IBindableEditorProps } from './PropTypes';
3
- import { Components } from '@singularsystems/neo-core';
4
- import ComponentBase from './ComponentBase';
5
- import { FormContext } from './FormContext';
6
- declare type InputType = "text" | "password" | "checkbox" | "switch";
7
- export interface IInputSpecificProps {
8
- /** Type of input to use */
9
- type?: InputType;
10
- /** Converts input into a textarea if the no of rows is above 1. */
11
- rows?: number;
12
- /** Label for checkbox. */
13
- label?: string | JSX.Element;
14
- /**
15
- * Shows a button which allows the user to view the password characters.
16
- * Automatically sets type to 'password'.
17
- */
18
- showPasswordButton?: boolean | Components.IButtonOptions;
19
- }
20
- export interface IInputProps extends IBindableEditorProps<HTMLInputElement> {
21
- input?: IInputSpecificProps;
22
- }
23
- export default class Input extends ComponentBase<IInputProps> {
24
- static contextType: React.Context<import("./FormContext").FormContextParams>;
25
- context: React.ContextType<typeof FormContext>;
26
- protected baseType?: InputType;
27
- private type;
28
- private domRef;
29
- private showPassword;
30
- constructor(props: IInputProps);
31
- private determineType;
32
- afterRender(): void;
33
- private onChanged;
34
- render(): JSX.Element;
35
- }
36
- export declare class Textbox extends Input {
37
- constructor(props: any);
38
- }
39
- export declare class Passwordbox extends Input {
40
- constructor(props: any);
41
- }
42
- export declare class Checkbox extends Input {
43
- constructor(props: any);
44
- }
45
- export {};
1
+ import * as React from 'react';
2
+ import { IBindableEditorProps } from './PropTypes';
3
+ import { Components } from '@singularsystems/neo-core';
4
+ import ComponentBase from './ComponentBase';
5
+ import { FormContext } from './FormContext';
6
+ type InputType = "text" | "password" | "checkbox" | "switch" | "tel" | "email";
7
+ export interface IInputSpecificProps {
8
+ /** Type of input to use */
9
+ type?: InputType;
10
+ /** Converts input into a textarea if the no of rows is above 1. */
11
+ rows?: number;
12
+ /** Label for checkbox. */
13
+ label?: string | JSX.Element;
14
+ /**
15
+ * Shows a button which allows the user to view the password characters.
16
+ * Automatically sets type to 'password'.
17
+ */
18
+ showPasswordButton?: boolean | Components.IButtonOptions;
19
+ }
20
+ export interface IInputProps extends IBindableEditorProps<HTMLInputElement> {
21
+ input?: IInputSpecificProps;
22
+ }
23
+ export default class Input extends ComponentBase<IInputProps> {
24
+ static contextType: React.Context<import("./FormContext").FormContextParams>;
25
+ context: React.ContextType<typeof FormContext>;
26
+ protected baseType?: InputType;
27
+ private type;
28
+ private domRef;
29
+ private showPassword;
30
+ constructor(props: IInputProps);
31
+ private determineType;
32
+ afterRender(): void;
33
+ private onChanged;
34
+ render(): JSX.Element;
35
+ }
36
+ export declare class Textbox extends Input {
37
+ constructor(props: any);
38
+ }
39
+ export declare class Passwordbox extends Input {
40
+ constructor(props: any);
41
+ }
42
+ export declare class Checkbox extends Input {
43
+ constructor(props: any);
44
+ }
45
+ export {};