@singularsystems/neo-react 0.10.48 → 0.10.50
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/dist/Modules/NeoReactModule.js +2 -0
- package/dist/Modules/Types.d.ts +2 -0
- package/dist/Modules/Types.js +1 -0
- package/dist/React/AutoRunner.js +6 -3
- package/dist/ReactComponents/Button.d.ts +1 -0
- package/dist/ReactComponents/Button.js +12 -4
- package/dist/ReactComponents/Card.d.ts +1 -0
- package/dist/ReactComponents/Card.js +4 -2
- package/dist/ReactComponents/ContextMenu/ContextMenu.d.ts +1 -0
- package/dist/ReactComponents/ContextMenu/ContextMenu.js +5 -3
- package/dist/ReactComponents/DropDown/AutoCompleteDropDown.js +3 -1
- package/dist/ReactComponents/FileManager/FileContext.d.ts +2 -2
- package/dist/ReactComponents/FileManager/FileInput.d.ts +2 -1
- package/dist/ReactComponents/IconFactory.d.ts +27 -0
- package/dist/ReactComponents/IconFactory.js +46 -0
- package/dist/ReactComponents/Icons/FontAwesomeIconFactory.d.ts +11 -0
- package/dist/ReactComponents/Icons/FontAwesomeIconFactory.js +35 -0
- package/dist/ReactComponents/Icons/IIconFactory.d.ts +21 -0
- package/dist/ReactComponents/Icons/IIconFactory.js +0 -0
- package/dist/ReactComponents/Icons/IconFactory.d.ts +9 -0
- package/dist/ReactComponents/Icons/IconFactory.js +47 -0
- package/dist/ReactComponents/Icons/index.d.ts +3 -0
- package/dist/ReactComponents/Icons/index.js +2 -0
- package/dist/ReactComponents/InputHelpers.d.ts +1 -0
- package/dist/ReactComponents/InputHelpers.js +7 -11
- package/dist/ReactComponents/Notifications/Alert.d.ts +1 -0
- package/dist/ReactComponents/Notifications/Alert.js +6 -3
- package/dist/ReactComponents/Notifications/Toast.d.ts +1 -0
- package/dist/ReactComponents/Notifications/Toast.js +4 -2
- package/dist/ReactComponents/Paging/BasicPagerControls.d.ts +1 -0
- package/dist/ReactComponents/Paging/BasicPagerControls.js +8 -6
- package/dist/ReactComponents/Tabs/Tab.d.ts +1 -0
- package/dist/ReactComponents/Tabs/Tab.js +6 -7
- package/dist/ReactComponents/ValidationSummary.d.ts +1 -0
- package/dist/ReactComponents/ValidationSummary.js +7 -4
- package/dist/Routing/ViewParameter.d.ts +2 -2
- package/dist/Routing/ViewParameter.js +2 -3
- package/dist/Routing/ViewParameterList.js +3 -3
- package/dist/Views/ViewModelBase.js +11 -7
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/package.json +3 -2
- package/styles/Validation.scss +0 -9
|
@@ -11,6 +11,7 @@ import { RoutingState } from '../Routing/RoutingState';
|
|
|
11
11
|
import { ContextMenuState } from '../ReactComponents/ContextMenu/ContextMenuState';
|
|
12
12
|
import { DisposeHelper } from '../Services/DisposeHelper';
|
|
13
13
|
import Decimal from 'decimal.js-light';
|
|
14
|
+
import { IconFactory } from '../ReactComponents/Icons/IconFactory';
|
|
14
15
|
var neoReactModule = new AppServices.Module("neo-react", function (container) {
|
|
15
16
|
container.bind(AppServices.NeoTypes.Core.AutoRunnerFactory).to(AutoRunnerFactory).inSingletonScope();
|
|
16
17
|
container.bind(AppServices.NeoTypes.Core.ModelCreator).to(ReactModelCreator).inTransientScope();
|
|
@@ -18,6 +19,7 @@ var neoReactModule = new AppServices.Module("neo-react", function (container) {
|
|
|
18
19
|
container.bind(AppServices.NeoTypes.UI.ErrorHandler).to(ErrorHandler).inSingletonScope();
|
|
19
20
|
container.bind(AppServices.NeoTypes.UI.GlobalContextMenuState).toConstantValue(new ContextMenuState());
|
|
20
21
|
container.bind(AppServices.NeoTypes.Routing.PageLeaveHandler).to(PageLeaveHandler).inSingletonScope();
|
|
22
|
+
container.bind(NeoReactTypes.Components.IconFactory).to(IconFactory).inSingletonScope();
|
|
21
23
|
container.bind(NeoReactTypes.Routing.GlobalRoutingState).to(RoutingState).inSingletonScope();
|
|
22
24
|
container.bind(NeoReactTypes.Routing.NavigationHelper).to(NavigationHelper).inSingletonScope();
|
|
23
25
|
container.bind(NeoReactTypes.Services.DisposeHelper).to(DisposeHelper).inTransientScope();
|
package/dist/Modules/Types.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { AxiosStatic } from 'axios';
|
|
|
8
8
|
import Decimal from 'decimal.js-light';
|
|
9
9
|
import Select from 'react-select';
|
|
10
10
|
import { IDisposeHelper } from '../Services/IDisposeHelper';
|
|
11
|
+
import { IIconFactory } from '../ReactComponents/Icons/IIconFactory';
|
|
11
12
|
declare const NeoReactTypes: {
|
|
12
13
|
Components: {
|
|
13
14
|
Slider: AppServices.ServiceIdentifier<typeof Slider>;
|
|
@@ -15,6 +16,7 @@ declare const NeoReactTypes: {
|
|
|
15
16
|
SketchPicker: AppServices.ServiceIdentifier<typeof SketchPicker>;
|
|
16
17
|
ReactSelect: AppServices.ServiceIdentifier<typeof Select>;
|
|
17
18
|
AsyncSelect: AppServices.ServiceIdentifier<typeof AsyncSelect>;
|
|
19
|
+
IconFactory: AppServices.ServiceIdentifier<IIconFactory>;
|
|
18
20
|
};
|
|
19
21
|
Routing: {
|
|
20
22
|
NavigationHelper: AppServices.ServiceIdentifier<INavigationHelper>;
|
package/dist/Modules/Types.js
CHANGED
|
@@ -6,6 +6,7 @@ var NeoReactTypes = __assign(__assign({}, AppServices.NeoTypes), { Components: {
|
|
|
6
6
|
SketchPicker: new AppServices.ServiceIdentifier("NeoReact.SketchPicker"),
|
|
7
7
|
ReactSelect: new AppServices.ServiceIdentifier("NeoReact.ReactSelect"),
|
|
8
8
|
AsyncSelect: new AppServices.ServiceIdentifier("NeoReact.AsyncSelect"),
|
|
9
|
+
IconFactory: new AppServices.ServiceIdentifier("NeoReact.IconFactory")
|
|
9
10
|
}, Routing: __assign(__assign({}, AppServices.NeoTypes.Routing), { NavigationHelper: AppServices.NeoTypes.Routing.NavigationHelper.asType(), GlobalRoutingState: new AppServices.ServiceIdentifier("NeoReact.GlobalRoutingState") }), Services: {
|
|
10
11
|
DisposeHelper: new AppServices.ServiceIdentifier("NeoReact.DisposeHelper")
|
|
11
12
|
} });
|
package/dist/React/AutoRunner.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { Misc, DebounceHelper } from '@singularsystems/neo-core';
|
|
3
3
|
import { reaction } from 'mobx';
|
|
4
4
|
import { injectable } from 'inversify';
|
|
5
5
|
var AutoRunnerFactory = /** @class */ (function () {
|
|
@@ -24,7 +24,10 @@ var AutoRunner = /** @class */ (function () {
|
|
|
24
24
|
this.disposerImmediate = reaction(function () { return _this.accessAllValues(model, false, new Map(), ""); }, function () { return _this.runCallback(model, callback, 0); });
|
|
25
25
|
}
|
|
26
26
|
AutoRunner.prototype.cancelPending = function () {
|
|
27
|
-
|
|
27
|
+
DebounceHelper.cancelPending(this);
|
|
28
|
+
};
|
|
29
|
+
AutoRunner.prototype.fireImmediate = function () {
|
|
30
|
+
DebounceHelper.executeImmediate(this);
|
|
28
31
|
};
|
|
29
32
|
AutoRunner.prototype.dispose = function () {
|
|
30
33
|
this.disposerDelayed();
|
|
@@ -33,7 +36,7 @@ var AutoRunner = /** @class */ (function () {
|
|
|
33
36
|
AutoRunner.prototype.runCallback = function (model, callback, delay) {
|
|
34
37
|
var _this = this;
|
|
35
38
|
if (!this.isPaused) {
|
|
36
|
-
|
|
39
|
+
DebounceHelper.debounce(this, function () {
|
|
37
40
|
_this.isPaused = true;
|
|
38
41
|
try {
|
|
39
42
|
callback(model);
|
|
@@ -11,6 +11,7 @@ export default class Button extends ComponentBase<IButtonProps, IButtonState> {
|
|
|
11
11
|
};
|
|
12
12
|
btnGroupDom: React.RefObject<HTMLDivElement>;
|
|
13
13
|
menuDom: React.RefObject<HTMLDivElement>;
|
|
14
|
+
private iconFactory;
|
|
14
15
|
private windowClickHandler;
|
|
15
16
|
constructor(props: IButtonProps);
|
|
16
17
|
private showMenu;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { __decorate, __extends, __metadata, __rest, __spreadArrays } from "tslib";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import ComponentBase from './ComponentBase';
|
|
4
|
-
import { Components, Utils } from '@singularsystems/neo-core';
|
|
4
|
+
import { Components, Misc, Utils } from '@singularsystems/neo-core';
|
|
5
5
|
import Tooltip from './Tooltip';
|
|
6
6
|
import { observer } from 'mobx-react';
|
|
7
|
+
import { NeoReactTypes } from '../Modules/Types';
|
|
7
8
|
var Button = /** @class */ (function (_super) {
|
|
8
9
|
__extends(Button, _super);
|
|
9
10
|
function Button(props) {
|
|
@@ -11,6 +12,7 @@ var Button = /** @class */ (function (_super) {
|
|
|
11
12
|
_this.state = { isExpanded: false };
|
|
12
13
|
_this.btnGroupDom = React.createRef();
|
|
13
14
|
_this.menuDom = React.createRef();
|
|
15
|
+
_this.iconFactory = Misc.Globals.appService.get(NeoReactTypes.Components.IconFactory);
|
|
14
16
|
_this.windowClickHandler = _this.windowClicked.bind(_this);
|
|
15
17
|
_this.showMenu = _this.showMenu.bind(_this);
|
|
16
18
|
return _this;
|
|
@@ -60,8 +62,14 @@ var Button = /** @class */ (function (_super) {
|
|
|
60
62
|
buttonClasses += " dropdown-toggle";
|
|
61
63
|
native.onClick = this.showMenu;
|
|
62
64
|
}
|
|
65
|
+
var iconStyle = {};
|
|
66
|
+
if (isBusy !== undefined || task !== undefined) {
|
|
67
|
+
iconStyle = { fixedWidth: true };
|
|
68
|
+
}
|
|
63
69
|
if (isBusy || ((_a = task) === null || _a === void 0 ? void 0 : _a.isBusy)) {
|
|
64
|
-
|
|
70
|
+
iconStyle.fixedWidth = true;
|
|
71
|
+
iconStyle.spin = true;
|
|
72
|
+
icon = Misc.Settings.icons.loadingIcon;
|
|
65
73
|
native.disabled = true;
|
|
66
74
|
}
|
|
67
75
|
if (pulse) {
|
|
@@ -74,7 +82,7 @@ var Button = /** @class */ (function (_super) {
|
|
|
74
82
|
innerText = text;
|
|
75
83
|
var iconSpace = icon && innerText ? " " : "";
|
|
76
84
|
// Icon
|
|
77
|
-
var iconElement =
|
|
85
|
+
var iconElement = this.iconFactory.getIconComponent(icon, iconStyle);
|
|
78
86
|
// Tooltip
|
|
79
87
|
if (tooltip) {
|
|
80
88
|
Tooltip.setDomProperties(native, tooltip);
|
|
@@ -101,7 +109,7 @@ var Button = /** @class */ (function (_super) {
|
|
|
101
109
|
var menu = React.createElement("div", { className: "dropdown-menu" + (this.state.isExpanded ? " show" : ""), ref: this.menuDom }, menuItems.map(function (item, index) { return (item.header ? React.createElement("h6", { key: index, className: "dropdown-header" }, item.header)
|
|
102
110
|
: item.isDivider ? React.createElement("div", { key: index, className: "dropdown-divider" })
|
|
103
111
|
: React.createElement("div", { key: index, className: "dropdown-item", onClick: function (e) { return _this.menuItemClicked(e, item.data, item.onClick); } },
|
|
104
|
-
item.icon
|
|
112
|
+
_this.iconFactory.getIconComponent(item.icon, { fixedWidth: true }),
|
|
105
113
|
" ",
|
|
106
114
|
item.text)); }));
|
|
107
115
|
root =
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { __assign, __decorate, __extends, __rest } from "tslib";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { Model, Utils } from '@singularsystems/neo-core';
|
|
3
|
+
import { Misc, Model, Utils } from '@singularsystems/neo-core';
|
|
4
4
|
import { observer } from 'mobx-react';
|
|
5
5
|
import Scrollbar from 'react-custom-scrollbars';
|
|
6
6
|
import Collapsable from './Collapsable';
|
|
7
|
+
import { NeoReactTypes } from '../Modules/Types';
|
|
7
8
|
var Card = /** @class */ (function (_super) {
|
|
8
9
|
__extends(Card, _super);
|
|
9
10
|
function Card() {
|
|
10
11
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
12
|
+
_this.iconFactory = Misc.Globals.appService.get(NeoReactTypes.Components.IconFactory);
|
|
11
13
|
_this.expandState = new Model.ObservableValue(_this.props.initiallyCollapsed === undefined ? true : !_this.props.initiallyCollapsed);
|
|
12
14
|
return _this;
|
|
13
15
|
}
|
|
@@ -41,7 +43,7 @@ var Card = /** @class */ (function (_super) {
|
|
|
41
43
|
(icon || title) &&
|
|
42
44
|
React.createElement("div", { className: "card-header" },
|
|
43
45
|
React.createElement("div", { className: "card-header-title" },
|
|
44
|
-
|
|
46
|
+
this.iconFactory.getIconComponent(icon),
|
|
45
47
|
React.createElement("span", null, title)),
|
|
46
48
|
headerElements && React.createElement("div", { className: "card-header-right-section" }, headerElements)),
|
|
47
49
|
body));
|
|
@@ -16,6 +16,7 @@ export interface IContextMenuProps {
|
|
|
16
16
|
}
|
|
17
17
|
export default class ContextMenu extends ComponentBase<IContextMenuProps> {
|
|
18
18
|
constructor(props: IContextMenuProps);
|
|
19
|
+
private iconFactory;
|
|
19
20
|
private menuRef;
|
|
20
21
|
private hoverItem;
|
|
21
22
|
mouseEnter(e: React.MouseEvent<HTMLDivElement>, item: Components.IMenuItem): void;
|
|
@@ -2,12 +2,14 @@ import { __decorate, __extends, __metadata } from "tslib";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { observable } from 'mobx';
|
|
4
4
|
import { observer } from 'mobx-react';
|
|
5
|
-
import {
|
|
5
|
+
import { Misc } from '@singularsystems/neo-core';
|
|
6
6
|
import ComponentBase from '../ComponentBase';
|
|
7
|
+
import { NeoReactTypes } from '../../Modules/Types';
|
|
7
8
|
var ContextMenu = /** @class */ (function (_super) {
|
|
8
9
|
__extends(ContextMenu, _super);
|
|
9
10
|
function ContextMenu(props) {
|
|
10
11
|
var _this = _super.call(this, props) || this;
|
|
12
|
+
_this.iconFactory = Misc.Globals.appService.get(NeoReactTypes.Components.IconFactory);
|
|
11
13
|
_this.menuRef = React.createRef();
|
|
12
14
|
_this.hoverItem = null;
|
|
13
15
|
_this.mouseEnter = _this.mouseEnter.bind(_this);
|
|
@@ -67,8 +69,8 @@ var ContextMenu = /** @class */ (function (_super) {
|
|
|
67
69
|
} },
|
|
68
70
|
item.isDivider && React.createElement("hr", null),
|
|
69
71
|
!item.isDivider && React.createElement(React.Fragment, null,
|
|
70
|
-
!item.icon &&
|
|
71
|
-
item.icon &&
|
|
72
|
+
!item.icon && _this.iconFactory.getIconComponent("", { fixedWidth: true }),
|
|
73
|
+
item.icon && _this.iconFactory.getIconComponent(item.icon, { fixedWidth: true }),
|
|
72
74
|
item.text && React.createElement("span", { className: "neo-context-menu-text" }, item.text),
|
|
73
75
|
item.header && React.createElement("span", { className: "neo-context-menu-text" }, item.header),
|
|
74
76
|
item.items && React.createElement("i", { className: "fa-fw fa fa-angle-right child-indicator" }),
|
|
@@ -50,8 +50,9 @@ var AutoCompleteDropDown = /** @class */ (function (_super) {
|
|
|
50
50
|
AutoCompleteDropDown.prototype.onItemSelected = function (args, action) {
|
|
51
51
|
var onItemSelected = this.props.onItemSelected;
|
|
52
52
|
if (this.props.bindItems) {
|
|
53
|
+
var itemsProperty = this.props.bindItems;
|
|
53
54
|
// Multi select
|
|
54
|
-
var itemList =
|
|
55
|
+
var itemList = itemsProperty.value;
|
|
55
56
|
var bindIdsList = this.props.bindIds;
|
|
56
57
|
if (action.action === "select-option") {
|
|
57
58
|
itemList.push({ id: action.option.value, display: action.option.label });
|
|
@@ -83,6 +84,7 @@ var AutoCompleteDropDown = /** @class */ (function (_super) {
|
|
|
83
84
|
onItemSelected(undefined);
|
|
84
85
|
}
|
|
85
86
|
}
|
|
87
|
+
itemsProperty.attachedTo.isSelfDirty = true;
|
|
86
88
|
}
|
|
87
89
|
else if (this.props.bind) {
|
|
88
90
|
// Single select
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Components } from '@singularsystems/neo-core';
|
|
3
|
-
export interface IFileComponentProps
|
|
3
|
+
export interface IFileComponentProps {
|
|
4
4
|
/** File manager instance. Props that can be specified in file manager options will be ignored on this component. */
|
|
5
5
|
fileManager?: Components.IFileManager;
|
|
6
6
|
/** Upload endpoint. This is required when not using a file manager. */
|
|
@@ -10,6 +10,6 @@ export interface IFileContextProps {
|
|
|
10
10
|
fileManager?: Components.IFileManager;
|
|
11
11
|
}
|
|
12
12
|
export declare const FileContext: React.Context<IFileContextProps>;
|
|
13
|
-
export default class FileContextProvider extends React.Component<IFileComponentProps> {
|
|
13
|
+
export default class FileContextProvider extends React.Component<IFileComponentProps & (Partial<Components.IFileManagerOptions> | Partial<Components.IBoundFileManagerOptions>)> {
|
|
14
14
|
render(): JSX.Element;
|
|
15
15
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { Components } from '@singularsystems/neo-core';
|
|
2
3
|
import { FileContext, IFileComponentProps } from './FileContext';
|
|
3
4
|
import { IButtonOptions } from '@singularsystems/neo-core/dist/Components/ButtonOptions';
|
|
4
5
|
import ComponentBase from '../ComponentBase';
|
|
5
6
|
import { AxiosPromise } from 'axios';
|
|
6
|
-
export interface IFileEditorProps extends IFileComponentProps {
|
|
7
|
+
export interface IFileEditorProps extends IFileComponentProps, Partial<Components.IBoundFileManagerOptions> {
|
|
7
8
|
/** Browse button options */
|
|
8
9
|
browseButton?: IButtonOptions;
|
|
9
10
|
/** Set this if you want to allow the user to choose a new file. */
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "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
|
+
}
|
|
22
|
+
export declare class IconFactory implements IIconFactory {
|
|
23
|
+
getIconComponent(iconOrName: any, style?: IconStyle): import("history").History.PoorMansUnknown;
|
|
24
|
+
textOrIcon(textOrIcon: string, style?: IconStyle): import("history").History.PoorMansUnknown;
|
|
25
|
+
protected mapStringToIcon(iconName: string, style?: IconStyle): React.ReactNode;
|
|
26
|
+
protected createIconComponent(iconDescriptor: any, style?: IconStyle): React.ReactNode;
|
|
27
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { Utils } from "@singularsystems/neo-core";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { injectable } from 'inversify';
|
|
5
|
+
var IconFactory = /** @class */ (function () {
|
|
6
|
+
function IconFactory() {
|
|
7
|
+
}
|
|
8
|
+
IconFactory.prototype.getIconComponent = function (iconOrName, style) {
|
|
9
|
+
if (iconOrName) {
|
|
10
|
+
if (typeof iconOrName === "string") {
|
|
11
|
+
return this.mapStringToIcon(iconOrName, style);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
return this.createIconComponent(iconOrName, style);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return undefined;
|
|
18
|
+
};
|
|
19
|
+
IconFactory.prototype.textOrIcon = function (textOrIcon, style) {
|
|
20
|
+
if (textOrIcon.indexOf("fa-") === 0 || textOrIcon.indexOf("far-") === 0) {
|
|
21
|
+
return this.getIconComponent(textOrIcon, style);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return textOrIcon;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
IconFactory.prototype.mapStringToIcon = function (iconName, style) {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
var className = Utils.getFontAwesomeClass(iconName);
|
|
30
|
+
if ((_a = style) === null || _a === void 0 ? void 0 : _a.fixedWidth) {
|
|
31
|
+
className += " fa-fw";
|
|
32
|
+
}
|
|
33
|
+
if ((_b = style) === null || _b === void 0 ? void 0 : _b.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
|
+
}());
|
|
46
|
+
export { IconFactory };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IconFactory } from "./IconFactory";
|
|
3
|
+
import { IconStyle } from "./IIconFactory";
|
|
4
|
+
interface IconDefinition {
|
|
5
|
+
icon: string;
|
|
6
|
+
}
|
|
7
|
+
/** Icon factory supporting font-awesome string, as well as the font-awesome icon definition and component. */
|
|
8
|
+
export declare class FontAwesomeIconFactory extends IconFactory {
|
|
9
|
+
protected createIconComponent(iconComponent: IconDefinition | JSX.Element, iconStyle?: IconStyle): React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { __assign, __decorate, __extends } from "tslib";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
4
|
+
import { injectable } from "inversify";
|
|
5
|
+
import { IconFactory } from "./IconFactory";
|
|
6
|
+
/** Icon factory supporting font-awesome string, as well as the font-awesome icon definition and component. */
|
|
7
|
+
var FontAwesomeIconFactory = /** @class */ (function (_super) {
|
|
8
|
+
__extends(FontAwesomeIconFactory, _super);
|
|
9
|
+
function FontAwesomeIconFactory() {
|
|
10
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
11
|
+
}
|
|
12
|
+
FontAwesomeIconFactory.prototype.createIconComponent = function (iconComponent, iconStyle) {
|
|
13
|
+
var _a, _b, _c, _d;
|
|
14
|
+
if (iconComponent.icon) {
|
|
15
|
+
// Icon was specified using a font-awesome icon descriptor, return the font-awesome icon component.
|
|
16
|
+
return React.createElement(FontAwesomeIcon, { icon: iconComponent, fixedWidth: (_a = iconStyle) === null || _a === void 0 ? void 0 : _a.fixedWidth, spin: (_b = iconStyle) === null || _b === void 0 ? void 0 : _b.spin });
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
// Icon was specified as a font-awesome component. Extract the props, and override using the requested style.
|
|
20
|
+
var props = __assign({}, iconComponent.props);
|
|
21
|
+
if ((_c = iconStyle) === null || _c === void 0 ? void 0 : _c.fixedWidth) {
|
|
22
|
+
props.fixedWidth = iconStyle.fixedWidth;
|
|
23
|
+
}
|
|
24
|
+
if ((_d = iconStyle) === null || _d === void 0 ? void 0 : _d.spin) {
|
|
25
|
+
props.spin = iconStyle.spin;
|
|
26
|
+
}
|
|
27
|
+
return React.createElement(iconComponent.type, props);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
FontAwesomeIconFactory = __decorate([
|
|
31
|
+
injectable()
|
|
32
|
+
], FontAwesomeIconFactory);
|
|
33
|
+
return FontAwesomeIconFactory;
|
|
34
|
+
}(IconFactory));
|
|
35
|
+
export { FontAwesomeIconFactory };
|
|
@@ -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
|
+
}
|
|
File without changes
|
|
@@ -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): import("history").History.PoorMansUnknown;
|
|
6
|
+
textOrIcon(textOrIcon: string, style?: IconStyle): import("history").History.PoorMansUnknown;
|
|
7
|
+
protected mapStringToIcon(iconName: string, style?: IconStyle): React.ReactNode;
|
|
8
|
+
protected createIconComponent(iconDescriptor: any, style?: IconStyle): React.ReactNode;
|
|
9
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
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 _a, _b;
|
|
30
|
+
var className = Utils.getFontAwesomeClass(iconName);
|
|
31
|
+
if ((_a = style) === null || _a === void 0 ? void 0 : _a.fixedWidth) {
|
|
32
|
+
className += " fa-fw";
|
|
33
|
+
}
|
|
34
|
+
if ((_b = style) === null || _b === void 0 ? void 0 : _b.spin) {
|
|
35
|
+
className += " fa-spin";
|
|
36
|
+
}
|
|
37
|
+
return React.createElement("i", { className: className });
|
|
38
|
+
};
|
|
39
|
+
IconFactory.prototype.createIconComponent = function (iconDescriptor, style) {
|
|
40
|
+
return iconDescriptor;
|
|
41
|
+
};
|
|
42
|
+
IconFactory = __decorate([
|
|
43
|
+
injectable()
|
|
44
|
+
], IconFactory);
|
|
45
|
+
return IconFactory;
|
|
46
|
+
}());
|
|
47
|
+
export { IconFactory };
|
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Misc } from '@singularsystems/neo-core';
|
|
3
|
+
import { NeoReactTypes } from '../Modules/Types';
|
|
3
4
|
var InputHelpers = /** @class */ (function () {
|
|
4
5
|
function InputHelpers() {
|
|
5
6
|
}
|
|
6
7
|
InputHelpers.surroundWithInputGroup = function (element, props) {
|
|
8
|
+
if (!this.iconFactory) {
|
|
9
|
+
this.iconFactory = Misc.Globals.appService.get(NeoReactTypes.Components.IconFactory);
|
|
10
|
+
}
|
|
7
11
|
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
12
|
return (React.createElement("div", { className: "input-group" },
|
|
17
13
|
(props.prependText || props.prepend) &&
|
|
18
14
|
React.createElement("div", { className: "input-group-prepend" },
|
|
19
15
|
props.prepend && (props.prepend instanceof Function ? props.prepend() : props.prepend),
|
|
20
|
-
props.prependText && React.createElement("span", { className: "input-group-text" },
|
|
16
|
+
props.prependText && React.createElement("span", { className: "input-group-text" }, this.iconFactory.textOrIcon(props.prependText))),
|
|
21
17
|
element,
|
|
22
18
|
(props.appendText || props.append) &&
|
|
23
19
|
React.createElement("div", { className: "input-group-append" },
|
|
24
20
|
props.append && (props.append instanceof Function ? props.append() : props.append),
|
|
25
|
-
props.appendText && React.createElement("span", { className: "input-group-text" },
|
|
21
|
+
props.appendText && React.createElement("span", { className: "input-group-text" }, this.iconFactory.textOrIcon(props.appendText)))));
|
|
26
22
|
}
|
|
27
23
|
else {
|
|
28
24
|
return element;
|
|
@@ -2,5 +2,6 @@ import React from "react";
|
|
|
2
2
|
import { Components } from "@singularsystems/neo-core";
|
|
3
3
|
import CollapsableBase from '../CollapsableBase';
|
|
4
4
|
export default class Alert extends CollapsableBase<Components.INotificationOptions & React.HTMLProps<HTMLDivElement>> {
|
|
5
|
+
private iconFactory;
|
|
5
6
|
render(): JSX.Element;
|
|
6
7
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { __assign, __decorate, __extends, __rest } from "tslib";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { Utils } from "@singularsystems/neo-core";
|
|
3
|
+
import { Misc, Utils } from "@singularsystems/neo-core";
|
|
4
4
|
import { observer } from 'mobx-react';
|
|
5
5
|
import CollapsableBase from '../CollapsableBase';
|
|
6
|
+
import { NeoReactTypes } from "../../Modules/Types";
|
|
6
7
|
var Alert = /** @class */ (function (_super) {
|
|
7
8
|
__extends(Alert, _super);
|
|
8
9
|
function Alert() {
|
|
9
|
-
|
|
10
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
11
|
+
_this.iconFactory = Misc.Globals.appService.get(NeoReactTypes.Components.IconFactory);
|
|
12
|
+
return _this;
|
|
10
13
|
}
|
|
11
14
|
Alert.prototype.render = function () {
|
|
12
15
|
var _a = this.props, variant = _a.variant, heading = _a.heading, show = _a.show, bindShow = _a.bindShow, autoCloseTimeout = _a.autoCloseTimeout, animateInitial = _a.animateInitial, state = _a.state, onHidden = _a.onHidden, refreshValue = _a.refreshValue, icon = _a.icon, native = __rest(_a, ["variant", "heading", "show", "bindShow", "autoCloseTimeout", "animateInitial", "state", "onHidden", "refreshValue", "icon"]);
|
|
@@ -20,7 +23,7 @@ var Alert = /** @class */ (function (_super) {
|
|
|
20
23
|
React.createElement("h6", null, heading),
|
|
21
24
|
icon &&
|
|
22
25
|
React.createElement("div", { className: "notification-icon-container" },
|
|
23
|
-
|
|
26
|
+
this.iconFactory.getIconComponent(icon),
|
|
24
27
|
React.createElement("div", null, this.props.children)),
|
|
25
28
|
!icon && this.props.children,
|
|
26
29
|
bindShow &&
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import CollapsableBase from '../CollapsableBase';
|
|
3
3
|
import { Components } from '@singularsystems/neo-core';
|
|
4
4
|
export default class Toast extends CollapsableBase<Components.INotificationOptions & React.HTMLProps<HTMLDivElement>> {
|
|
5
|
+
private iconFactory;
|
|
5
6
|
countDownRef: React.RefObject<HTMLDivElement>;
|
|
6
7
|
afterRender(isInitial: boolean): void;
|
|
7
8
|
render(): JSX.Element;
|
|
@@ -2,11 +2,13 @@ import { __decorate, __extends } from "tslib";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import CollapsableBase from '../CollapsableBase';
|
|
4
4
|
import { observer } from 'mobx-react';
|
|
5
|
-
import { Components,
|
|
5
|
+
import { Components, Misc } from '@singularsystems/neo-core';
|
|
6
|
+
import { NeoReactTypes } from '../../Modules/Types';
|
|
6
7
|
var Toast = /** @class */ (function (_super) {
|
|
7
8
|
__extends(Toast, _super);
|
|
8
9
|
function Toast() {
|
|
9
10
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
11
|
+
_this.iconFactory = Misc.Globals.appService.get(NeoReactTypes.Components.IconFactory);
|
|
10
12
|
_this.countDownRef = React.createRef();
|
|
11
13
|
return _this;
|
|
12
14
|
}
|
|
@@ -33,7 +35,7 @@ var Toast = /** @class */ (function (_super) {
|
|
|
33
35
|
this.props.autoCloseTimeout && React.createElement("div", { className: "toast-count-down toast-count-down-" + variant, ref: this.countDownRef }),
|
|
34
36
|
React.createElement("div", { className: "toast-body" },
|
|
35
37
|
icon && React.createElement("div", { className: "notification-icon-container" },
|
|
36
|
-
|
|
38
|
+
this.iconFactory.getIconComponent(icon),
|
|
37
39
|
React.createElement("div", null, this.props.children)),
|
|
38
40
|
!icon && this.props.children)));
|
|
39
41
|
};
|
|
@@ -21,5 +21,6 @@ export interface IPagerControlsProps extends React.HTMLProps<HTMLUListElement> {
|
|
|
21
21
|
pageSizeLabel?: string | JSX.Element;
|
|
22
22
|
}
|
|
23
23
|
export default class SimplePagerControls extends React.Component<IPagerControlsProps> {
|
|
24
|
+
private iconFactory;
|
|
24
25
|
render(): false | JSX.Element;
|
|
25
26
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { __assign, __decorate, __extends, __rest } from "tslib";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Misc, Utils } from "@singularsystems/neo-core";
|
|
4
|
-
import { ReactHelpers } from '../ReactHelpers';
|
|
5
4
|
import { observer } from "mobx-react";
|
|
6
5
|
import PageSizeControl from './PageSizeControl';
|
|
6
|
+
import { NeoReactTypes } from '../../Modules/Types';
|
|
7
7
|
var SimplePagerControls = /** @class */ (function (_super) {
|
|
8
8
|
__extends(SimplePagerControls, _super);
|
|
9
9
|
function SimplePagerControls() {
|
|
10
|
-
|
|
10
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
11
|
+
_this.iconFactory = Misc.Globals.appService.get(NeoReactTypes.Components.IconFactory);
|
|
12
|
+
return _this;
|
|
11
13
|
}
|
|
12
14
|
SimplePagerControls.prototype.render = function () {
|
|
13
15
|
var _a = this.props, pageManager = _a.pageManager, noOfButtons = _a.noOfButtons, alignment = _a.alignment, firstText = _a.firstText, prevText = _a.prevText, nextText = _a.nextText, lastText = _a.lastText, autoHide = _a.autoHide, pageSizeLabel = _a.pageSizeLabel, domProps = __rest(_a, ["pageManager", "noOfButtons", "alignment", "firstText", "prevText", "nextText", "lastText", "autoHide", "pageSizeLabel"]);
|
|
@@ -38,14 +40,14 @@ var SimplePagerControls = /** @class */ (function (_super) {
|
|
|
38
40
|
pageSizeLabel && React.createElement(PageSizeControl, { pageManager: this.props.pageManager, label: pageSizeLabel }),
|
|
39
41
|
React.createElement("ul", __assign({}, domProps, { className: "pagination" }),
|
|
40
42
|
React.createElement("li", { className: "page-item" + (pageManager.pageNo === 1 ? " disabled" : "") },
|
|
41
|
-
React.createElement("a", { className: "page-link", href: "#", onClick: function (e) { e.preventDefault(); pageManager.firstPage(); } },
|
|
43
|
+
React.createElement("a", { className: "page-link", href: "#", onClick: function (e) { e.preventDefault(); pageManager.firstPage(); } }, this.iconFactory.textOrIcon(firstText))),
|
|
42
44
|
React.createElement("li", { className: "page-item" + (pageManager.pageNo === 1 ? " disabled" : "") },
|
|
43
|
-
React.createElement("a", { className: "page-link", href: "#", onClick: function (e) { e.preventDefault(); pageManager.previousPage(); } },
|
|
45
|
+
React.createElement("a", { className: "page-link", href: "#", onClick: function (e) { e.preventDefault(); pageManager.previousPage(); } }, this.iconFactory.textOrIcon(prevText))),
|
|
44
46
|
buttons,
|
|
45
47
|
React.createElement("li", { className: "page-item" + (pageManager.pageNo === pageManager.totalPages ? " disabled" : "") },
|
|
46
|
-
React.createElement("a", { className: "page-link", href: "#", onClick: function (e) { e.preventDefault(); pageManager.nextPage(); } },
|
|
48
|
+
React.createElement("a", { className: "page-link", href: "#", onClick: function (e) { e.preventDefault(); pageManager.nextPage(); } }, this.iconFactory.textOrIcon(nextText))),
|
|
47
49
|
React.createElement("li", { className: "page-item" + (pageManager.pageNo === pageManager.totalPages ? " disabled" : "") },
|
|
48
|
-
React.createElement("a", { className: "page-link", href: "#", onClick: function (e) { e.preventDefault(); pageManager.lastPage(); } },
|
|
50
|
+
React.createElement("a", { className: "page-link", href: "#", onClick: function (e) { e.preventDefault(); pageManager.lastPage(); } }, this.iconFactory.textOrIcon(lastText))))));
|
|
49
51
|
};
|
|
50
52
|
SimplePagerControls = __decorate([
|
|
51
53
|
observer
|
|
@@ -2,13 +2,15 @@ import { __decorate, __extends, __metadata } from "tslib";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { observer } from "mobx-react";
|
|
4
4
|
import { TabContext } from "./TabContainer";
|
|
5
|
-
import {
|
|
5
|
+
import { Misc } from "@singularsystems/neo-core";
|
|
6
|
+
import { NeoReactTypes } from "../../Modules/Types";
|
|
6
7
|
var Tab = /** @class */ (function (_super) {
|
|
7
8
|
__extends(Tab, _super);
|
|
8
9
|
function Tab(props) {
|
|
9
10
|
var _a;
|
|
10
11
|
var _this = _super.call(this, props) || this;
|
|
11
12
|
_this.hasRenderedContents = false;
|
|
13
|
+
_this.iconFactory = Misc.Globals.appService.get(NeoReactTypes.Components.IconFactory);
|
|
12
14
|
_this.onClick = _this.onClick.bind(_this);
|
|
13
15
|
var tabKey = (_a = _this.props.id, (_a !== null && _a !== void 0 ? _a : _this.props.name));
|
|
14
16
|
if (!tabKey) {
|
|
@@ -44,14 +46,11 @@ var Tab = /** @class */ (function (_super) {
|
|
|
44
46
|
}
|
|
45
47
|
};
|
|
46
48
|
Tab.prototype.renderHeader = function (isSelected) {
|
|
47
|
-
var
|
|
48
|
-
if (this.props.icon) {
|
|
49
|
-
iconClass = Utils.getFontAwesomeClass(this.props.icon);
|
|
50
|
-
}
|
|
49
|
+
var hasIcon = this.props.icon !== undefined;
|
|
51
50
|
return (React.createElement("li", { className: "nav-item" },
|
|
52
51
|
React.createElement("a", { className: "nav-link" + (isSelected ? " active" : "") + (this.props.disabled ? " disabled" : ""), href: "#", onClick: this.onClick },
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
hasIcon && this.iconFactory.getIconComponent(this.props.icon),
|
|
53
|
+
hasIcon && " ",
|
|
55
54
|
this.props.header)));
|
|
56
55
|
};
|
|
57
56
|
Tab.prototype.renderBody = function (isSelected) {
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { __extends } from "tslib";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { Validation,
|
|
3
|
+
import { Validation, Misc } from '@singularsystems/neo-core';
|
|
4
|
+
import { NeoReactTypes } from '../Modules/Types';
|
|
4
5
|
var ValidationSummary = /** @class */ (function (_super) {
|
|
5
6
|
__extends(ValidationSummary, _super);
|
|
6
7
|
function ValidationSummary() {
|
|
7
|
-
|
|
8
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
9
|
+
_this.iconFactory = Misc.Globals.appService.get(NeoReactTypes.Components.IconFactory);
|
|
10
|
+
return _this;
|
|
8
11
|
}
|
|
9
12
|
ValidationSummary.prototype.getRules = function (modelInfo) {
|
|
10
13
|
return modelInfo.objectDisplayInfo.concat(modelInfo.propertyRules)
|
|
@@ -26,12 +29,12 @@ var ValidationSummary = /** @class */ (function (_super) {
|
|
|
26
29
|
return (React.createElement("div", { className: "validation-summary" }, graph && models.map(function (modelInfo, index) { return (React.createElement("div", { key: index, className: "validation-summary-model" },
|
|
27
30
|
_this.props.hideTopLevelTitle !== true &&
|
|
28
31
|
React.createElement("div", { className: "validation-summary-model-title" },
|
|
29
|
-
|
|
32
|
+
_this.iconFactory.getIconComponent(modelInfo.model.getIcon()),
|
|
30
33
|
" ",
|
|
31
34
|
modelInfo.model.toString()),
|
|
32
35
|
React.createElement("div", { className: "validation-summary-model-body" + (_this.props.hideTopLevelTitle === true ? " no-title" : "") },
|
|
33
36
|
React.createElement("div", { className: "validation-summary-model-rules" }, _this.getRules(modelInfo).map(function (rule, index) { return (React.createElement("div", { key: index, className: rule.displayInfo.additionalClassName },
|
|
34
|
-
|
|
37
|
+
_this.iconFactory.getIconComponent(rule.displayInfo.icon, { fixedWidth: true, spin: !!rule.displayInfo.asyncBusyText }),
|
|
35
38
|
" ",
|
|
36
39
|
rule.displayInfo.displayText)); })),
|
|
37
40
|
React.createElement(ValidationSummary, { graph: modelInfo.valueObjects }),
|
|
@@ -49,8 +49,8 @@ export declare class ViewParameter implements IViewParameter {
|
|
|
49
49
|
description: string;
|
|
50
50
|
asNullableInt(): number | null;
|
|
51
51
|
asString(): string;
|
|
52
|
-
/**
|
|
53
|
-
|
|
52
|
+
/** Updates the current value, and returns true if the value changed. */
|
|
53
|
+
update(value: string | null): boolean;
|
|
54
54
|
getParamString(state: {
|
|
55
55
|
hasQuery: boolean;
|
|
56
56
|
}): string;
|
|
@@ -51,14 +51,13 @@ var ViewParameter = /** @class */ (function () {
|
|
|
51
51
|
ViewParameter.prototype.asString = function () {
|
|
52
52
|
return this._value || "";
|
|
53
53
|
};
|
|
54
|
-
/**
|
|
55
|
-
ViewParameter.prototype.
|
|
54
|
+
/** Updates the current value, and returns true if the value changed. */
|
|
55
|
+
ViewParameter.prototype.update = function (value) {
|
|
56
56
|
if (value)
|
|
57
57
|
value = decodeURIComponent(value);
|
|
58
58
|
if (value != this._value) {
|
|
59
59
|
this.hasPendingValue = false;
|
|
60
60
|
this.pendingValue = value;
|
|
61
|
-
this.description = "";
|
|
62
61
|
this._value = value;
|
|
63
62
|
return true;
|
|
64
63
|
}
|
|
@@ -93,7 +93,7 @@ var ViewParameterList = /** @class */ (function () {
|
|
|
93
93
|
var value = match.params[param];
|
|
94
94
|
if (value === undefined)
|
|
95
95
|
value = null;
|
|
96
|
-
if (viewParam.
|
|
96
|
+
if (viewParam.update(value))
|
|
97
97
|
hasChanged = true;
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -102,7 +102,7 @@ var ViewParameterList = /** @class */ (function () {
|
|
|
102
102
|
for (var _i = 0, _a = this.params; _i < _a.length; _i++) {
|
|
103
103
|
var viewParam = _a[_i];
|
|
104
104
|
if (viewParam.routeParameter.isQuery) {
|
|
105
|
-
if (viewParam.
|
|
105
|
+
if (viewParam.update(queryParams.get(viewParam.name)))
|
|
106
106
|
hasChanged = true;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
@@ -125,7 +125,7 @@ var ViewParameterList = /** @class */ (function () {
|
|
|
125
125
|
if (typeof value === "number") {
|
|
126
126
|
value = value.toString();
|
|
127
127
|
}
|
|
128
|
-
viewParam.
|
|
128
|
+
viewParam.update(value);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
var state = { hasQuery: false };
|
|
@@ -73,14 +73,18 @@ var ViewModelBase = /** @class */ (function (_super) {
|
|
|
73
73
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
74
74
|
fns[_i] = arguments[_i];
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
throw "Cannot bind a function without a name.";
|
|
76
|
+
var prototype = this.constructor.prototype;
|
|
77
|
+
var _loop_1 = function (key) {
|
|
78
|
+
if (key !== "constructor" && prototype[key] instanceof Function && !this_1.hasOwnProperty(key)) {
|
|
79
|
+
if (fns.find(function (f) { return f === prototype[key]; })) {
|
|
80
|
+
this_1[key] = prototype[key].bind(this_1);
|
|
81
|
+
}
|
|
83
82
|
}
|
|
83
|
+
};
|
|
84
|
+
var this_1 = this;
|
|
85
|
+
for (var _a = 0, _b = Object.getOwnPropertyNames(prototype); _a < _b.length; _a++) {
|
|
86
|
+
var key = _b[_a];
|
|
87
|
+
_loop_1(key);
|
|
84
88
|
}
|
|
85
89
|
};
|
|
86
90
|
ViewModelBase.prototype.dispose = function () {
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ import * as NeoGrid from './ReactComponents/Grid/_Exports';
|
|
|
5
5
|
import * as Routing from './Routing';
|
|
6
6
|
import * as Views from './Views/';
|
|
7
7
|
import * as Managers from './ReactComponents/_Managers';
|
|
8
|
+
import * as Icons from './ReactComponents/Icons';
|
|
8
9
|
import { TooltipHelper } from './ReactComponents/TooltipHelper';
|
|
9
10
|
export * from './React/Decorators';
|
|
10
|
-
export { Managers, NeoReactModule, NeoReactTypes, Neo, NeoGrid, Routing, Views, TooltipHelper, };
|
|
11
|
+
export { Icons, Managers, NeoReactModule, NeoReactTypes, Neo, NeoGrid, Routing, Views, TooltipHelper, };
|
|
11
12
|
export { ICancellableEvent } from './ReactComponents/Misc';
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import * as NeoGrid from './ReactComponents/Grid/_Exports';
|
|
|
5
5
|
import * as Routing from './Routing';
|
|
6
6
|
import * as Views from './Views/';
|
|
7
7
|
import * as Managers from './ReactComponents/_Managers';
|
|
8
|
+
import * as Icons from './ReactComponents/Icons';
|
|
8
9
|
import { TooltipHelper } from './ReactComponents/TooltipHelper';
|
|
9
10
|
export * from './React/Decorators';
|
|
10
|
-
export { Managers, NeoReactModule, NeoReactTypes, Neo, NeoGrid, Routing, Views, TooltipHelper, };
|
|
11
|
+
export { Icons, Managers, NeoReactModule, NeoReactTypes, Neo, NeoGrid, Routing, Views, TooltipHelper, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@singularsystems/neo-react",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.50",
|
|
4
4
|
"description": "React application logic and components for the Neo client library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -30,10 +30,11 @@
|
|
|
30
30
|
"tslib": "2.3.1"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
+
"@fortawesome/react-fontawesome": "0.2.0",
|
|
33
34
|
"@types/rc-slider": "^8.6.5",
|
|
34
35
|
"@types/react-color": "^3.0.1",
|
|
35
36
|
"@types/react-select": "3.1.0",
|
|
36
|
-
"@singularsystems/neo-core": "^0.10.
|
|
37
|
+
"@singularsystems/neo-core": "^0.10.54",
|
|
37
38
|
"axios": "^0.21.1",
|
|
38
39
|
"decimal.js-light": "2.5.1",
|
|
39
40
|
"history": "4.10.1",
|
package/styles/Validation.scss
CHANGED
|
@@ -147,15 +147,6 @@ select.form-control.is-invalid {
|
|
|
147
147
|
color: $validation-color-info;
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
i {
|
|
151
|
-
width: 1rem;
|
|
152
|
-
height: 1rem;
|
|
153
|
-
text-align: center;
|
|
154
|
-
|
|
155
|
-
&.spinner-grow {
|
|
156
|
-
animation: spinner-grow 1s linear infinite;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
150
|
}
|
|
160
151
|
|
|
161
152
|
.neo-error-modal-body {
|