@singularsystems/neo-react 0.10.64 → 0.10.65

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 (67) hide show
  1. package/dist/React/AutoRunner.js +5 -5
  2. package/dist/ReactComponents/Button.js +7 -7
  3. package/dist/ReactComponents/Card.js +2 -2
  4. package/dist/ReactComponents/DropDown/AutoCompleteDropDown.js +17 -17
  5. package/dist/ReactComponents/DropDown/DropDown.js +3 -3
  6. package/dist/ReactComponents/ErrorHandler.js +1 -1
  7. package/dist/ReactComponents/FileManager/FileBasicInput.js +1 -1
  8. package/dist/ReactComponents/FileManager/FileInput.js +2 -2
  9. package/dist/ReactComponents/Form.js +1 -1
  10. package/dist/ReactComponents/FormGroup/FormGroup.js +1 -1
  11. package/dist/ReactComponents/Grid/ButtonColumn.js +1 -1
  12. package/dist/ReactComponents/Grid/Column.js +2 -3
  13. package/dist/ReactComponents/Grid/ColumnHelper.d.ts +1 -1
  14. package/dist/ReactComponents/Grid/ColumnHelper.js +3 -3
  15. package/dist/ReactComponents/Grid/Grid.js +9 -9
  16. package/dist/ReactComponents/Grid/Row.js +2 -2
  17. package/dist/ReactComponents/Icons/FontAwesomeIconFactory.js +4 -5
  18. package/dist/ReactComponents/Icons/IIconFactory.d.ts +6 -0
  19. package/dist/ReactComponents/Icons/IIconFactory.js +1 -0
  20. package/dist/ReactComponents/Icons/Icon.d.ts +13 -0
  21. package/dist/ReactComponents/Icons/Icon.js +27 -0
  22. package/dist/ReactComponents/Icons/IconFactory.d.ts +2 -2
  23. package/dist/ReactComponents/Icons/IconFactory.js +9 -4
  24. package/dist/ReactComponents/Icons/MaterialSymbolsFontFactory.d.ts +21 -0
  25. package/dist/ReactComponents/Icons/MaterialSymbolsFontFactory.js +113 -0
  26. package/dist/ReactComponents/Icons/index.d.ts +2 -1
  27. package/dist/ReactComponents/Icons/index.js +1 -0
  28. package/dist/ReactComponents/Input.js +4 -4
  29. package/dist/ReactComponents/InputHelpers.js +2 -2
  30. package/dist/ReactComponents/Link.js +1 -1
  31. package/dist/ReactComponents/Modal/Modal.js +1 -1
  32. package/dist/ReactComponents/Modal/ModalContainer.js +1 -1
  33. package/dist/ReactComponents/NumberInput.js +6 -7
  34. package/dist/ReactComponents/Paging/PageSizeControl.js +1 -1
  35. package/dist/ReactComponents/Paging/Pager.d.ts +1 -0
  36. package/dist/ReactComponents/Paging/Pager.js +3 -0
  37. package/dist/ReactComponents/PropTypes.d.ts +2 -2
  38. package/dist/ReactComponents/PropTypes.js +18 -13
  39. package/dist/ReactComponents/RadioList.js +3 -3
  40. package/dist/ReactComponents/Slider.js +3 -3
  41. package/dist/ReactComponents/Tabs/Tab.js +1 -1
  42. package/dist/ReactComponents/Tabs/TabContainer.js +1 -1
  43. package/dist/ReactComponents/Tabs/TabManager.js +2 -3
  44. package/dist/ReactComponents/TooltipProvider.js +2 -1
  45. package/dist/ReactComponents/_Exports.d.ts +2 -1
  46. package/dist/ReactComponents/_Exports.js +2 -1
  47. package/dist/Routing/IRouteChangedProps.js +1 -0
  48. package/dist/Routing/NavigationHelper.d.ts +1 -1
  49. package/dist/Routing/NavigationHelper.js +1 -1
  50. package/dist/Routing/RouteProvider.js +2 -2
  51. package/dist/Routing/RouteView.js +6 -6
  52. package/dist/Routing/RoutingState.d.ts +4 -0
  53. package/dist/Routing/RoutingState.js +37 -7
  54. package/dist/Routing/ViewParameter.js +3 -3
  55. package/dist/Routing/ViewParameterList.d.ts +9 -3
  56. package/dist/Routing/ViewParameterList.js +9 -6
  57. package/dist/Services/IDisposeHelper.js +1 -0
  58. package/dist/Views/IViewModel.js +1 -0
  59. package/dist/Views/ViewBase.d.ts +4 -2
  60. package/dist/Views/ViewBase.js +17 -10
  61. package/dist/Views/ViewModelBase.d.ts +1 -1
  62. package/dist/Views/ViewModelBase.js +1 -2
  63. package/package.json +19 -10
  64. package/dist/ReactComponents/IconFactory.d.ts +0 -27
  65. package/dist/ReactComponents/IconFactory.js +0 -46
  66. package/dist/ReactComponents/ReactHelpers.d.ts +0 -5
  67. package/dist/ReactComponents/ReactHelpers.js +0 -17
@@ -1,11 +1,27 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
2
  import { injectable } from 'inversify';
3
- import { observable } from 'mobx';
4
- import { ViewBase } from '../Views';
3
+ import { computed, observable } from 'mobx';
5
4
  var RoutingState = /** @class */ (function () {
6
5
  function RoutingState() {
7
6
  this.observableRoute = null;
7
+ this.currentView = null;
8
8
  }
9
+ Object.defineProperty(RoutingState.prototype, "currentViewFullScreen", {
10
+ get: function () {
11
+ var _a;
12
+ return ((_a = this.currentView) === null || _a === void 0 ? void 0 : _a.fullScreen) === true;
13
+ },
14
+ enumerable: false,
15
+ configurable: true
16
+ });
17
+ Object.defineProperty(RoutingState.prototype, "taskRunner", {
18
+ get: function () {
19
+ var _a;
20
+ return (_a = this.currentView) === null || _a === void 0 ? void 0 : _a.taskRunner;
21
+ },
22
+ enumerable: false,
23
+ configurable: true
24
+ });
9
25
  RoutingState.prototype.setCurrentRoute = function (routeProps, route) {
10
26
  this.currentRouteProps = routeProps;
11
27
  this.currentRoute = route;
@@ -14,17 +30,17 @@ var RoutingState = /** @class */ (function () {
14
30
  var _a, _b;
15
31
  if (this.previousRoute !== this.currentRoute) {
16
32
  this.previousRoute = this.currentRoute;
17
- this.observableRoute = (_a = this.currentRoute, (_a !== null && _a !== void 0 ? _a : null));
18
- if (((_b = ViewBase.currentView) === null || _b === void 0 ? void 0 : _b.constructor) !== this.currentRoute.component) {
19
- ViewBase.currentView = null;
33
+ this.observableRoute = (_a = this.currentRoute) !== null && _a !== void 0 ? _a : null;
34
+ if (((_b = this.currentView) === null || _b === void 0 ? void 0 : _b.constructor) !== this.currentRoute.component) {
35
+ this.currentView = null;
20
36
  }
21
37
  // Scroll back to top as if the browser had actually loaded a new page.
22
38
  window.scrollTo(0, 0);
23
39
  }
24
40
  else {
25
41
  // Same route, but parameters must have changed.
26
- if (ViewBase.currentView) {
27
- ViewBase.currentView.updateViewParams(this.currentRouteProps.match);
42
+ if (this.currentView) {
43
+ this.currentView.updateViewParams(this.currentRouteProps.match);
28
44
  }
29
45
  }
30
46
  };
@@ -32,6 +48,20 @@ var RoutingState = /** @class */ (function () {
32
48
  observable.ref,
33
49
  __metadata("design:type", Object)
34
50
  ], RoutingState.prototype, "observableRoute", void 0);
51
+ __decorate([
52
+ observable.ref,
53
+ __metadata("design:type", Object)
54
+ ], RoutingState.prototype, "currentView", void 0);
55
+ __decorate([
56
+ computed,
57
+ __metadata("design:type", Object),
58
+ __metadata("design:paramtypes", [])
59
+ ], RoutingState.prototype, "currentViewFullScreen", null);
60
+ __decorate([
61
+ computed,
62
+ __metadata("design:type", Object),
63
+ __metadata("design:paramtypes", [])
64
+ ], RoutingState.prototype, "taskRunner", null);
35
65
  RoutingState = __decorate([
36
66
  injectable()
37
67
  ], RoutingState);
@@ -32,7 +32,7 @@ var ViewParameter = /** @class */ (function () {
32
32
  this.parent.setUrl(this);
33
33
  }
34
34
  },
35
- enumerable: true,
35
+ enumerable: false,
36
36
  configurable: true
37
37
  });
38
38
  ViewParameter.prototype.reset = function () {
@@ -52,7 +52,7 @@ var ViewParameter = /** @class */ (function () {
52
52
  }
53
53
  this._description = value;
54
54
  },
55
- enumerable: true,
55
+ enumerable: false,
56
56
  configurable: true
57
57
  });
58
58
  ViewParameter.prototype.setDescription = function (description, getPrefixes) {
@@ -104,7 +104,7 @@ var ViewParameter = /** @class */ (function () {
104
104
  get: function () {
105
105
  return this.hasPendingValue ? this.pendingValue : this._value;
106
106
  },
107
- enumerable: true,
107
+ enumerable: false,
108
108
  configurable: true
109
109
  });
110
110
  __decorate([
@@ -6,6 +6,12 @@ import { IViewBase } from '../Views/ViewBase';
6
6
  export declare type TransformParamsType<T> = {
7
7
  [P in keyof T]: IViewParameter;
8
8
  };
9
+ interface ISetValuesOptions {
10
+ /** True if the url should be set even if none of the values have changed. */
11
+ force?: boolean;
12
+ /** True if the url should be replaced instead of added to the history. This prevents the back button returning the params to the current state. */
13
+ replace?: boolean;
14
+ }
9
15
  export interface IViewParameterList {
10
16
  /**
11
17
  * Returns the breadcrumb items for all url parameters which have a value.
@@ -16,11 +22,10 @@ export interface IViewParameterListOfT<TParams extends RouteParameterObject<TPar
16
22
  /**
17
23
  * Set the view params for each of the provided values. Only 1 navigation event will occur.
18
24
  * @param values New values.
19
- * @param force True if the url should be set even if none of the values have changed.
20
25
  */
21
26
  setValues(values: {
22
27
  [P in keyof TParams]?: number | string | null;
23
- }, force?: boolean): void;
28
+ }, options?: ISetValuesOptions | boolean): void;
24
29
  }
25
30
  export interface IViewParameterListInternal extends IViewParameterList {
26
31
  update(match: match): boolean;
@@ -38,7 +43,7 @@ export declare class ViewParameterList<TParams extends RouteParameterObject<TPar
38
43
  private getQueryString;
39
44
  setValues(values: {
40
45
  [P in keyof TParams]?: number | string | null;
41
- }, force?: boolean): void;
46
+ }, options?: ISetValuesOptions | boolean): void;
42
47
  setUrl(viewParameter: ViewParameter | null, replace?: boolean): void;
43
48
  /**
44
49
  * Updates the parameter values from the values in the url. Returns true if any of the values have changed.
@@ -51,3 +56,4 @@ export declare class ViewParameterList<TParams extends RouteParameterObject<TPar
51
56
  */
52
57
  static getPathForValues<TParams extends RouteParameterObject<TParams>>(basePath: string, params: TParams, values: {}): string;
53
58
  }
59
+ export {};
@@ -45,7 +45,7 @@ var ViewParameterList = /** @class */ (function () {
45
45
  }
46
46
  }
47
47
  paramPath += viewParam.getParamString(state);
48
- if ((_a = viewParam.routeParameter.selection, (_a !== null && _a !== void 0 ? _a : BreadCrumbSelectMode.Default)) === BreadCrumbSelectMode.Default) {
48
+ if (((_a = viewParam.routeParameter.selection) !== null && _a !== void 0 ? _a : BreadCrumbSelectMode.Default) === BreadCrumbSelectMode.Default) {
49
49
  selectablePath = paramPath;
50
50
  }
51
51
  if (viewParam.description || (upTo && viewParam.latestValue !== null)) {
@@ -69,17 +69,20 @@ var ViewParameterList = /** @class */ (function () {
69
69
  }
70
70
  return queryPath;
71
71
  };
72
- ViewParameterList.prototype.setValues = function (values, force) {
73
- if (force === void 0) { force = false; }
72
+ ViewParameterList.prototype.setValues = function (values, options) {
74
73
  var _a;
75
74
  this.suppressNavigation = true;
76
75
  this.hasSuppressedNavigation = false;
76
+ options !== null && options !== void 0 ? options : (options = {});
77
+ if (typeof options === "boolean") {
78
+ options = { force: true }; // parameter used to be named 'force'- backwards compatibility.
79
+ }
77
80
  for (var paramName in values) {
78
- this[paramName].value = (_a = values[paramName], (_a !== null && _a !== void 0 ? _a : null));
81
+ this[paramName].value = (_a = values[paramName]) !== null && _a !== void 0 ? _a : null;
79
82
  }
80
83
  this.suppressNavigation = false;
81
- if (this.hasSuppressedNavigation || force) {
82
- this.setUrl(this.params[this.params.length - 1]);
84
+ if (this.hasSuppressedNavigation || options.force) {
85
+ this.setUrl(this.params[this.params.length - 1], options.replace);
83
86
  }
84
87
  };
85
88
  ViewParameterList.prototype.setUrl = function (viewParameter, replace) {
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -10,6 +10,7 @@ import EmptyViewModel from './EmptyViewModel';
10
10
  import { IRouteChangedProps } from '../Routing/IRouteChangedProps';
11
11
  import { valueOrLazy } from './ViewModelBase';
12
12
  export interface IViewBase extends Views.IViewBase {
13
+ readonly fullScreen: boolean;
13
14
  viewParams: IViewParameterList;
14
15
  updateViewParams(match: match): void;
15
16
  getBreadCrumbList(): BreadCrumbItem[];
@@ -21,9 +22,10 @@ export interface IViewBaseConstructor {
21
22
  params?: RouteParameterObject<any>;
22
23
  }
23
24
  export default abstract class ViewBase<TViewModel extends IViewModel = EmptyViewModel, TParams extends RouteParameterObject<TParams> = {}> extends React.Component implements IViewBase {
24
- /** Represents the view that is currently being displayed */
25
- static currentView: IViewBase | null;
26
25
  viewName: string;
26
+ /** Indicates that the view requests to be displayed full screen. Up to the main layout to accommodate this. */
27
+ fullScreen: boolean;
28
+ static get currentView(): IViewBase | null;
27
29
  private routingState;
28
30
  navigation: import("../Routing").INavigationHelper;
29
31
  private breadCrumbStartItems?;
@@ -18,6 +18,8 @@ var ViewBase = /** @class */ (function (_super) {
18
18
  function ViewBase(viewName, viewModel, props) {
19
19
  var _this = _super.call(this, props) || this;
20
20
  _this.viewName = "";
21
+ /** Indicates that the view requests to be displayed full screen. Up to the main layout to accommodate this. */
22
+ _this.fullScreen = false;
21
23
  _this.routingState = Misc.Globals.appService.get(NeoReactTypes.Routing.GlobalRoutingState);
22
24
  _this.navigation = Misc.Globals.appService.get(NeoReactTypes.Routing.NavigationHelper);
23
25
  if (typeof viewName !== "string") {
@@ -25,28 +27,36 @@ var ViewBase = /** @class */ (function (_super) {
25
27
  }
26
28
  _this.viewName = viewName;
27
29
  _this.viewState = _this.getStoredViewState(viewModel);
28
- ViewBase.currentView = _this;
30
+ _this.routingState.currentView = _this;
29
31
  return _this;
30
32
  }
33
+ Object.defineProperty(ViewBase, "currentView", {
34
+ // For backwards compatibility
35
+ get: function () {
36
+ return Misc.Globals.appService.get(NeoReactTypes.Routing.GlobalRoutingState).currentView;
37
+ },
38
+ enumerable: false,
39
+ configurable: true
40
+ });
31
41
  Object.defineProperty(ViewBase.prototype, "viewModel", {
32
42
  get: function () {
33
43
  return this.viewState.viewModel;
34
44
  },
35
- enumerable: true,
45
+ enumerable: false,
36
46
  configurable: true
37
47
  });
38
48
  Object.defineProperty(ViewBase.prototype, "taskRunner", {
39
49
  get: function () {
40
50
  return this.viewModel.taskRunner;
41
51
  },
42
- enumerable: true,
52
+ enumerable: false,
43
53
  configurable: true
44
54
  });
45
55
  Object.defineProperty(ViewBase.prototype, "viewParams", {
46
56
  get: function () {
47
57
  return this.viewState.viewParams;
48
58
  },
49
- enumerable: true,
59
+ enumerable: false,
50
60
  configurable: true
51
61
  });
52
62
  ViewBase.prototype.getStoredViewState = function (viewModel) {
@@ -102,7 +112,6 @@ var ViewBase = /** @class */ (function (_super) {
102
112
  /** Gets the parent breadcrumbs, and the breadcrumb for this view. */
103
113
  ViewBase.prototype.getBreadCrumbStart = function () {
104
114
  var _this = this;
105
- var _a;
106
115
  var items = [];
107
116
  // Get parent items
108
117
  var menuRoute = this.routingState.currentRoute;
@@ -113,7 +122,7 @@ var ViewBase = /** @class */ (function (_super) {
113
122
  }
114
123
  // Add view name
115
124
  var firstParam = this.viewState.viewParams.params[0];
116
- items.push(new BreadCrumbItem(function () { return _this.viewName; }, ((_a = firstParam) === null || _a === void 0 ? void 0 : _a.routeParameter.required) ? "" : this.navigation.getCurrentViewPath()));
125
+ items.push(new BreadCrumbItem(function () { return _this.viewName; }, (firstParam === null || firstParam === void 0 ? void 0 : firstParam.routeParameter.required) ? "" : this.navigation.getCurrentViewPath()));
117
126
  return items;
118
127
  };
119
128
  /**
@@ -150,16 +159,14 @@ var ViewBase = /** @class */ (function (_super) {
150
159
  */
151
160
  ViewBase.prototype.beforeRouteChanged = function (props) {
152
161
  };
153
- /** Represents the view that is currently being displayed */
154
- ViewBase.currentView = null;
155
162
  __decorate([
156
163
  observable.ref,
157
164
  __metadata("design:type", String)
158
165
  ], ViewBase.prototype, "viewName", void 0);
159
166
  __decorate([
160
167
  observable.ref,
161
- __metadata("design:type", Object)
162
- ], ViewBase, "currentView", void 0);
168
+ __metadata("design:type", Boolean)
169
+ ], ViewBase.prototype, "fullScreen", void 0);
163
170
  return ViewBase;
164
171
  }(React.Component));
165
172
  export default ViewBase;
@@ -1,9 +1,9 @@
1
1
  import { ModelBase, Misc, Model, ITaskRunner } from '@singularsystems/neo-core';
2
2
  import { IViewModel } from './IViewModel';
3
3
  import { IReactionDisposer } from 'mobx';
4
- import { BindableBase } from '@singularsystems/neo-core/dist/Model/BindableBase';
5
4
  import { AxiosPromise } from 'axios';
6
5
  import { WaitForTaskRunnerOptions } from '@singularsystems/neo-core/dist/Components/TaskRunner/TaskRunner';
6
+ import { BindableBase } from '@singularsystems/neo-core/dist/Model/BindableBase';
7
7
  export declare type valueOrLazy<T> = T | (() => T) | (new () => T);
8
8
  export default abstract class ViewModelBase extends ModelBase implements IViewModel {
9
9
  taskRunner: ITaskRunner;
@@ -23,9 +23,8 @@ var ViewModelBase = /** @class */ (function (_super) {
23
23
  return this.disposeHelper.registerReaction(expression, effect);
24
24
  };
25
25
  ViewModelBase.prototype.registerViewModel = function (viewModel, options) {
26
- var _a;
27
26
  var viewModelInstance = ViewModelBase.create(viewModel, this.taskRunner);
28
- if ((_a = options) === null || _a === void 0 ? void 0 : _a.initialise) {
27
+ if (options === null || options === void 0 ? void 0 : options.initialise) {
29
28
  viewModelInstance.initialise();
30
29
  }
31
30
  this.trackedViewModels.push(viewModelInstance);
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-react",
3
- "version": "0.10.64",
3
+ "version": "0.10.65",
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",
7
7
  "scripts": {
8
8
  "build": "tsc -p tsconfig.build.json",
9
- "test": "react-scripts test"
9
+ "test": "react-scripts test --watchAll=false --runInBand"
10
10
  },
11
11
  "files": [
12
12
  "dist",
@@ -15,25 +15,27 @@
15
15
  "author": "Singular Systems",
16
16
  "license": "ISC",
17
17
  "devDependencies": {
18
- "@types/jest": "^24.0.15",
18
+ "@types/history": "4.7.4",
19
+ "@types/jest": "29.5.3",
19
20
  "@types/memoize-one": "4.1.1",
20
21
  "@types/node": "12.0.8",
21
22
  "@types/prop-types": "15.7.0",
22
23
  "@types/react": "^16.9.51",
23
24
  "@types/react-custom-scrollbars": "^4.0.6",
24
25
  "@types/react-dom": "^16.9.8",
26
+ "@types/react-router": "5.1.0",
25
27
  "@types/react-router-dom": "5.1.0",
26
- "react-scripts": "3.3.0",
28
+ "react-scripts": "5.0.1",
27
29
  "react-testing-library": "^7.0.1",
28
- "ts-jest": "26.5.3",
29
- "typescript": "3.7.5",
30
- "tslib": "2.3.1"
30
+ "ts-jest": "29.1.1",
31
+ "tslib": "2.3.1",
32
+ "typescript": "4.5.5"
31
33
  },
32
34
  "dependencies": {
35
+ "@singularsystems/neo-core": "0.10.77",
33
36
  "@types/rc-slider": "^8.6.5",
34
37
  "@types/react-color": "^3.0.1",
35
38
  "@types/react-select": "3.1.0",
36
- "@singularsystems/neo-core": "^0.10.75",
37
39
  "axios": "^0.21.1",
38
40
  "decimal.js-light": "2.5.1",
39
41
  "history": "4.10.1",
@@ -44,15 +46,22 @@
44
46
  "react": "^16.13.1",
45
47
  "react-custom-scrollbars": "^4.2.1",
46
48
  "react-dom": "^16.13.1",
49
+ "react-router": "5.1.0",
47
50
  "react-router-dom": "5.1.0"
48
51
  },
49
52
  "peerDependencies": {
50
- "@singularsystems/neo-core": ">=0.10.74",
53
+ "@singularsystems/neo-core": ">=0.10.77",
51
54
  "axios": ">=0.21.1",
52
55
  "inversify": ">=5.0.1",
53
56
  "react": ">=16.13.1",
54
57
  "react-dom": ">=16.13.1",
55
58
  "react-router": "^5.0.0",
56
59
  "react-router-dom": "^5.0.0"
57
- }
60
+ },
61
+ "resolutions": {
62
+ "@singularsystems/neo-core": "portal:../core",
63
+ "@types/react": "16.9.4",
64
+ "@types/react-router": "5.1.0"
65
+ },
66
+ "packageManager": "yarn@3.6.1"
58
67
  }
@@ -1,27 +0,0 @@
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
- }
@@ -1,46 +0,0 @@
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 };
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- export declare class ReactHelpers {
3
- /** If a string starts with fa- or far-, this will return an 'i' tag with the font-awesome class name. Otherwise it will return the passed in string. */
4
- static textOrIcon(textOrIcon: string): string | JSX.Element;
5
- }
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import { Utils } from '@singularsystems/neo-core';
3
- var ReactHelpers = /** @class */ (function () {
4
- function ReactHelpers() {
5
- }
6
- /** If a string starts with fa- or far-, this will return an 'i' tag with the font-awesome class name. Otherwise it will return the passed in string. */
7
- ReactHelpers.textOrIcon = function (textOrIcon) {
8
- if (textOrIcon.indexOf("fa-") === 0 || textOrIcon.indexOf("far-") === 0) {
9
- return React.createElement("i", { className: Utils.getFontAwesomeClass(textOrIcon) });
10
- }
11
- else {
12
- return textOrIcon;
13
- }
14
- };
15
- return ReactHelpers;
16
- }());
17
- export { ReactHelpers };