@singularsystems/neo-react 1.0.0-alpha.2 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +98 -0
- package/README.md +4 -0
- package/dist/Modules/NeoReactModule.d.ts +4 -4
- package/dist/Modules/NeoReactModule.js +28 -26
- package/dist/Modules/ReactSetup.d.ts +2 -2
- package/dist/Modules/ReactSetup.js +17 -17
- package/dist/Modules/Types.d.ts +63 -61
- package/dist/Modules/Types.js +13 -12
- package/dist/React/AutoRunner.d.ts +5 -5
- package/dist/React/AutoRunner.js +94 -92
- package/dist/React/DataView.d.ts +6 -6
- package/dist/React/DataView.js +11 -11
- package/dist/React/ReactModelCreator.d.ts +11 -11
- package/dist/React/ReactModelCreator.js +165 -162
- package/dist/ReactComponents/Button.d.ts +24 -23
- package/dist/ReactComponents/Button.js +131 -123
- package/dist/ReactComponents/Card.d.ts +24 -23
- package/dist/ReactComponents/Card.js +56 -54
- package/dist/ReactComponents/Collapsable.d.ts +23 -23
- package/dist/ReactComponents/Collapsable.js +38 -38
- package/dist/ReactComponents/CollapsableBase.d.ts +13 -13
- package/dist/ReactComponents/CollapsableBase.js +42 -42
- package/dist/ReactComponents/ColorPicker.d.ts +26 -26
- package/dist/ReactComponents/ColorPicker.js +67 -67
- package/dist/ReactComponents/ComponentBase.d.ts +17 -17
- package/dist/ReactComponents/ComponentBase.js +33 -33
- package/dist/ReactComponents/ContextMenu/ContextMenu.d.ts +25 -24
- package/dist/ReactComponents/ContextMenu/ContextMenu.js +91 -88
- package/dist/ReactComponents/ContextMenu/ContextMenuContainer.d.ts +14 -14
- package/dist/ReactComponents/ContextMenu/ContextMenuContainer.js +48 -48
- package/dist/ReactComponents/ContextMenu/ContextMenuState.d.ts +8 -7
- package/dist/ReactComponents/ContextMenu/ContextMenuState.js +23 -23
- package/dist/ReactComponents/DatePicker.d.ts +19 -19
- package/dist/ReactComponents/DatePicker.js +53 -53
- package/dist/ReactComponents/DropDown/AutoCompleteDropDown.d.ts +93 -83
- package/dist/ReactComponents/DropDown/AutoCompleteDropDown.js +222 -188
- package/dist/ReactComponents/DropDown/DropDown.d.ts +44 -44
- package/dist/ReactComponents/DropDown/DropDown.js +138 -134
- package/dist/ReactComponents/DropDown/DropDownBase.d.ts +16 -15
- package/dist/ReactComponents/DropDown/DropDownBase.js +86 -108
- package/dist/ReactComponents/DropDown/LookupHelper.d.ts +13 -0
- package/dist/ReactComponents/DropDown/LookupHelper.js +45 -0
- package/dist/ReactComponents/ErrorHandler.d.ts +9 -8
- package/dist/ReactComponents/ErrorHandler.js +92 -91
- package/dist/ReactComponents/FileManager/FileBasicInput.d.ts +20 -20
- package/dist/ReactComponents/FileManager/FileBasicInput.js +70 -70
- package/dist/ReactComponents/FileManager/FileContext.d.ts +16 -16
- package/dist/ReactComponents/FileManager/FileContext.js +24 -24
- package/dist/ReactComponents/FileManager/FileDropArea.d.ts +19 -18
- package/dist/ReactComponents/FileManager/FileDropArea.js +66 -64
- package/dist/ReactComponents/FileManager/FileInput.d.ts +44 -42
- package/dist/ReactComponents/FileManager/FileInput.js +191 -189
- package/dist/ReactComponents/FileManager/FileUploadButton.d.ts +17 -17
- package/dist/ReactComponents/FileManager/FileUploadButton.js +49 -49
- package/dist/ReactComponents/FileManager/FileUploadProgress.d.ts +14 -14
- package/dist/ReactComponents/FileManager/FileUploadProgress.js +35 -35
- package/dist/ReactComponents/Form.d.ts +19 -18
- package/dist/ReactComponents/Form.js +90 -90
- package/dist/ReactComponents/FormContext.d.ts +33 -31
- package/dist/ReactComponents/FormContext.js +39 -40
- package/dist/ReactComponents/FormGroup/FormGroup.d.ts +37 -37
- package/dist/ReactComponents/FormGroup/FormGroup.js +83 -84
- package/dist/ReactComponents/FormGroup/FormGroupFloating.d.ts +19 -19
- package/dist/ReactComponents/FormGroup/FormGroupFloating.js +97 -97
- package/dist/ReactComponents/FormGroup/FormGroupInline.d.ts +11 -11
- package/dist/ReactComponents/FormGroup/FormGroupInline.js +43 -43
- package/dist/ReactComponents/Grid/ButtonColumn.d.ts +47 -47
- package/dist/ReactComponents/Grid/ButtonColumn.js +81 -82
- package/dist/ReactComponents/Grid/Column.d.ts +47 -47
- package/dist/ReactComponents/Grid/Column.js +205 -205
- package/dist/ReactComponents/Grid/ColumnHelper.d.ts +12 -12
- package/dist/ReactComponents/Grid/ColumnHelper.js +19 -19
- package/dist/ReactComponents/Grid/Grid.d.ts +87 -90
- package/dist/ReactComponents/Grid/Grid.js +203 -203
- package/dist/ReactComponents/Grid/Row.d.ts +81 -81
- package/dist/ReactComponents/Grid/Row.js +200 -201
- package/dist/ReactComponents/Grid/_Exports.d.ts +5 -5
- package/dist/ReactComponents/Grid/_Exports.js +5 -5
- package/dist/ReactComponents/GridLayout.d.ts +20 -20
- package/dist/ReactComponents/GridLayout.js +38 -38
- package/dist/ReactComponents/Icons/FontAwesomeIconFactory.d.ts +23 -0
- package/dist/ReactComponents/Icons/FontAwesomeIconFactory.js +43 -0
- package/dist/ReactComponents/Icons/IIconFactory.d.ts +21 -0
- package/dist/ReactComponents/Icons/IIconFactory.js +1 -0
- package/dist/ReactComponents/Icons/IconFactory.d.ts +9 -0
- package/dist/ReactComponents/Icons/IconFactory.js +45 -0
- package/dist/ReactComponents/Icons/index.d.ts +3 -0
- package/dist/ReactComponents/Icons/index.js +2 -0
- package/dist/ReactComponents/Input.d.ts +45 -45
- package/dist/ReactComponents/Input.js +153 -152
- package/dist/ReactComponents/InputHelpers.d.ts +6 -5
- package/dist/ReactComponents/InputHelpers.js +29 -33
- package/dist/ReactComponents/Link.d.ts +13 -13
- package/dist/ReactComponents/Link.js +28 -28
- package/dist/ReactComponents/Loader.d.ts +18 -18
- package/dist/ReactComponents/Loader.js +57 -57
- package/dist/ReactComponents/Misc.d.ts +15 -15
- package/dist/ReactComponents/Misc.js +28 -28
- package/dist/ReactComponents/Modal/Modal.d.ts +11 -11
- package/dist/ReactComponents/Modal/Modal.js +129 -129
- package/dist/ReactComponents/Modal/ModalContainer.d.ts +17 -17
- package/dist/ReactComponents/Modal/ModalContainer.js +37 -37
- package/dist/ReactComponents/Modal/ModalPortal.d.ts +16 -15
- package/dist/ReactComponents/Modal/ModalPortal.js +27 -27
- package/dist/ReactComponents/Notifications/Alert.d.ts +7 -6
- package/dist/ReactComponents/Notifications/Alert.js +38 -35
- package/dist/ReactComponents/Notifications/Toast.d.ts +9 -8
- package/dist/ReactComponents/Notifications/Toast.js +47 -45
- package/dist/ReactComponents/Notifications/ToastContainer.d.ts +8 -8
- package/dist/ReactComponents/Notifications/ToastContainer.js +18 -18
- package/dist/ReactComponents/NumberInput.d.ts +57 -50
- package/dist/ReactComponents/NumberInput.js +260 -246
- package/dist/ReactComponents/Paging/BasicPagerControls.d.ts +26 -25
- package/dist/ReactComponents/Paging/BasicPagerControls.js +57 -55
- package/dist/ReactComponents/Paging/PageSizeControl.d.ts +11 -11
- package/dist/ReactComponents/Paging/PageSizeControl.js +21 -21
- package/dist/ReactComponents/Paging/Pager.d.ts +24 -24
- package/dist/ReactComponents/Paging/Pager.js +41 -41
- package/dist/ReactComponents/ProgressBar.d.ts +19 -19
- package/dist/ReactComponents/ProgressBar.js +52 -52
- package/dist/ReactComponents/PropTypes.d.ts +161 -161
- package/dist/ReactComponents/PropTypes.js +253 -236
- package/dist/ReactComponents/RadioList.d.ts +29 -29
- package/dist/ReactComponents/RadioList.js +59 -77
- package/dist/ReactComponents/Slider.d.ts +28 -28
- package/dist/ReactComponents/Slider.js +76 -76
- package/dist/ReactComponents/StateObserver.d.ts +15 -15
- package/dist/ReactComponents/StateObserver.js +35 -35
- package/dist/ReactComponents/Tabs/Tab.d.ts +42 -41
- package/dist/ReactComponents/Tabs/Tab.js +71 -72
- package/dist/ReactComponents/Tabs/TabContainer.d.ts +44 -44
- package/dist/ReactComponents/Tabs/TabContainer.js +98 -98
- package/dist/ReactComponents/Tabs/TabManager.d.ts +62 -62
- package/dist/ReactComponents/Tabs/TabManager.js +154 -154
- package/dist/ReactComponents/Tooltip.d.ts +20 -19
- package/dist/ReactComponents/Tooltip.js +51 -51
- package/dist/ReactComponents/TooltipHelper.d.ts +8 -8
- package/dist/ReactComponents/TooltipHelper.js +84 -84
- package/dist/ReactComponents/TooltipProvider.d.ts +30 -30
- package/dist/ReactComponents/TooltipProvider.js +111 -111
- package/dist/ReactComponents/ValidationSummary.d.ts +23 -22
- package/dist/ReactComponents/ValidationSummary.js +46 -43
- package/dist/ReactComponents/_Exports.d.ts +41 -41
- package/dist/ReactComponents/_Exports.js +41 -41
- package/dist/ReactComponents/_Managers.d.ts +4 -4
- package/dist/ReactComponents/_Managers.js +4 -4
- package/dist/Routing/BreadCrumbItem.d.ts +14 -14
- package/dist/Routing/BreadCrumbItem.js +12 -12
- package/dist/Routing/IRouteChangedProps.d.ts +31 -31
- package/dist/Routing/IRouteChangedProps.js +1 -1
- package/dist/Routing/IRouteParameter.d.ts +22 -22
- package/dist/Routing/IRouteParameter.js +9 -9
- package/dist/Routing/MenuRoute.d.ts +25 -24
- package/dist/Routing/MenuRoute.js +24 -24
- package/dist/Routing/NavigationHelper.d.ts +41 -40
- package/dist/Routing/NavigationHelper.js +61 -61
- package/dist/Routing/PageLeaveHandler.d.ts +13 -13
- package/dist/Routing/PageLeaveHandler.js +74 -74
- package/dist/Routing/RouteProvider.d.ts +31 -31
- package/dist/Routing/RouteProvider.js +92 -92
- package/dist/Routing/RouteView.d.ts +50 -50
- package/dist/Routing/RouteView.js +143 -144
- package/dist/Routing/RoutingState.d.ts +18 -15
- package/dist/Routing/RoutingState.js +45 -40
- package/dist/Routing/ViewParameter.d.ts +80 -58
- package/dist/Routing/ViewParameter.js +116 -95
- package/dist/Routing/ViewParameterList.d.ts +53 -53
- package/dist/Routing/ViewParameterList.js +163 -145
- package/dist/Routing/index.d.ts +9 -9
- package/dist/Routing/index.js +6 -6
- package/dist/Services/DisposeHelper.d.ts +15 -15
- package/dist/Services/DisposeHelper.js +40 -41
- package/dist/Services/IDisposeHelper.d.ts +12 -12
- package/dist/Services/IDisposeHelper.js +1 -1
- package/dist/Views/EmptyViewModel.d.ts +5 -5
- package/dist/Views/EmptyViewModel.js +14 -14
- package/dist/Views/IViewModel.d.ts +16 -16
- package/dist/Views/IViewModel.js +1 -1
- package/dist/Views/PersistentViewBase.d.ts +10 -10
- package/dist/Views/PersistentViewBase.js +21 -21
- package/dist/Views/ViewBase.d.ts +70 -71
- package/dist/Views/ViewBase.js +166 -153
- package/dist/Views/ViewComponentBase.d.ts +19 -13
- package/dist/Views/ViewComponentBase.js +24 -21
- package/dist/Views/ViewModelBase.d.ts +57 -56
- package/dist/Views/ViewModelBase.js +122 -118
- package/dist/Views/ViewState.d.ts +13 -13
- package/dist/Views/ViewState.js +9 -9
- package/dist/Views/index.d.ts +5 -5
- package/dist/Views/index.js +5 -5
- package/dist/index.d.ts +11 -10
- package/dist/index.js +10 -9
- package/package.json +26 -26
- package/styles/DatePicker.scss +2 -2
- package/styles/Forms.scss +5 -0
- package/styles/Validation.scss +0 -9
|
@@ -1,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
|
+
}());
|
|
@@ -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
|
-
|
|
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 {};
|
|
@@ -1,152 +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 { 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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
var
|
|
63
|
-
var
|
|
64
|
-
var
|
|
65
|
-
var
|
|
66
|
-
displayInfo.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
domProps.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
domProps.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
splitProps.editor.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
Input
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
_this
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
_this
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
_this
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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 };
|