@singularsystems/neo-react 0.10.50 → 0.10.52

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.
@@ -62,7 +62,7 @@ var Row = /** @class */ (function (_super) {
62
62
  var expandButtonOptions = __assign({}, Misc.Settings.grid.expandButton);
63
63
  if (inBody && this.expandProperty) {
64
64
  expandButtonOptions.onClick = this.onExpandClick;
65
- expandButtonOptions.icon = expandButtonOptions.icon.replace("plus", "$").replace("minus", "$").replace("$", (this.expandProperty.value ? "minus" : "plus"));
65
+ expandButtonOptions.icon = this.expandProperty.value ? Misc.Settings.icons.expanded : Misc.Settings.icons.collapsed;
66
66
  }
67
67
  if (!inBody) {
68
68
  if (onHeaderClick) {
@@ -2,10 +2,22 @@ import React from "react";
2
2
  import { IconFactory } from "./IconFactory";
3
3
  import { IconStyle } from "./IIconFactory";
4
4
  interface IconDefinition {
5
- icon: string;
5
+ iconName: string;
6
6
  }
7
+ interface FontAwesomeIconComponentProps {
8
+ icon: any;
9
+ fixedWidth?: boolean;
10
+ spin?: boolean;
11
+ }
12
+ declare type FontAwesomeComponent = (props: FontAwesomeIconComponentProps) => JSX.Element;
7
13
  /** Icon factory supporting font-awesome string, as well as the font-awesome icon definition and component. */
8
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);
9
21
  protected createIconComponent(iconComponent: IconDefinition | JSX.Element, iconStyle?: IconStyle): React.ReactNode;
10
22
  }
11
23
  export {};
@@ -1,19 +1,28 @@
1
- import { __assign, __decorate, __extends } from "tslib";
1
+ import { __assign, __decorate, __extends, __metadata } from "tslib";
2
2
  import React from "react";
3
- import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
4
3
  import { injectable } from "inversify";
5
4
  import { IconFactory } from "./IconFactory";
6
5
  /** Icon factory supporting font-awesome string, as well as the font-awesome icon definition and component. */
7
6
  var FontAwesomeIconFactory = /** @class */ (function (_super) {
8
7
  __extends(FontAwesomeIconFactory, _super);
9
- function FontAwesomeIconFactory() {
10
- return _super !== null && _super.apply(this, arguments) || this;
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;
11
16
  }
12
17
  FontAwesomeIconFactory.prototype.createIconComponent = function (iconComponent, iconStyle) {
13
18
  var _a, _b, _c, _d;
14
- if (iconComponent.icon) {
19
+ if (iconComponent.iconName) {
15
20
  // 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 });
21
+ return React.createElement(this.fontAwesomeComponentType, {
22
+ icon: iconComponent,
23
+ fixedWidth: (_a = iconStyle) === null || _a === void 0 ? void 0 : _a.fixedWidth,
24
+ spin: (_b = iconStyle) === null || _b === void 0 ? void 0 : _b.spin
25
+ });
17
26
  }
18
27
  else {
19
28
  // Icon was specified as a font-awesome component. Extract the props, and override using the requested style.
@@ -28,7 +37,8 @@ var FontAwesomeIconFactory = /** @class */ (function (_super) {
28
37
  }
29
38
  };
30
39
  FontAwesomeIconFactory = __decorate([
31
- injectable()
40
+ injectable(),
41
+ __metadata("design:paramtypes", [Function])
32
42
  ], FontAwesomeIconFactory);
33
43
  return FontAwesomeIconFactory;
34
44
  }(IconFactory));
@@ -46,7 +46,9 @@ export declare class ViewParameter implements IViewParameter {
46
46
  get value(): number | string | null;
47
47
  set value(value: number | string | null);
48
48
  reset(): void;
49
- description: string;
49
+ _description: string;
50
+ get description(): string;
51
+ set description(value: string);
50
52
  asNullableInt(): number | null;
51
53
  asString(): string;
52
54
  /** Updates the current value, and returns true if the value changed. */
@@ -8,7 +8,7 @@ var ViewParameter = /** @class */ (function () {
8
8
  this.hasPendingValue = false;
9
9
  this.pendingValue = null;
10
10
  this._value = null;
11
- this.description = "";
11
+ this._description = "";
12
12
  }
13
13
  ViewParameter.prototype.bindTo = function (propertyOrCallback) {
14
14
  var _this = this;
@@ -28,7 +28,7 @@ var ViewParameter = /** @class */ (function () {
28
28
  if (stringValue !== this._value) {
29
29
  this.hasPendingValue = true;
30
30
  this.pendingValue = stringValue;
31
- this.description = "";
31
+ this._description = "";
32
32
  this.parent.setUrl(this);
33
33
  }
34
34
  },
@@ -42,6 +42,19 @@ var ViewParameter = /** @class */ (function () {
42
42
  this.parent.setUrl(this, true);
43
43
  }
44
44
  };
45
+ Object.defineProperty(ViewParameter.prototype, "description", {
46
+ get: function () {
47
+ return this._description;
48
+ },
49
+ set: function (value) {
50
+ if (this.hasPendingValue) {
51
+ console.warn("Do not set view parameter description directly after setting value. Description should be set in the viewParamsUpdated() method.");
52
+ }
53
+ this._description = value;
54
+ },
55
+ enumerable: true,
56
+ configurable: true
57
+ });
45
58
  ViewParameter.prototype.asNullableInt = function () {
46
59
  if (this._value) {
47
60
  return parseInt(this._value, 10);
@@ -58,6 +71,7 @@ var ViewParameter = /** @class */ (function () {
58
71
  if (value != this._value) {
59
72
  this.hasPendingValue = false;
60
73
  this.pendingValue = value;
74
+ this._description = "";
61
75
  this._value = value;
62
76
  return true;
63
77
  }
@@ -88,7 +102,7 @@ var ViewParameter = /** @class */ (function () {
88
102
  __decorate([
89
103
  observable.ref,
90
104
  __metadata("design:type", String)
91
- ], ViewParameter.prototype, "description", void 0);
105
+ ], ViewParameter.prototype, "_description", void 0);
92
106
  return ViewParameter;
93
107
  }());
94
108
  export { ViewParameter };
@@ -27,12 +27,14 @@ var ViewParameterList = /** @class */ (function () {
27
27
  var selectablePath = basePath;
28
28
  for (var _i = 0, _b = this.params; _i < _b.length; _i++) {
29
29
  var viewParam = _b[_i];
30
- if (!viewParam.routeParameter.isQuery && (viewParam.description || upTo) && viewParam.latestValue !== null) {
30
+ if (!viewParam.routeParameter.isQuery) {
31
31
  paramPath += viewParam.getParamString(state);
32
32
  if ((_a = viewParam.routeParameter.selection, (_a !== null && _a !== void 0 ? _a : BreadCrumbSelectMode.Default)) === BreadCrumbSelectMode.Default) {
33
33
  selectablePath = paramPath;
34
34
  }
35
- breadCrumbs.push(new BreadCrumbItem(viewParam.description, (!upTo && viewParam.routeParameter.selection === BreadCrumbSelectMode.None) ? "" : (selectablePath + queryPath)));
35
+ if (viewParam.description || (upTo && viewParam.latestValue !== null)) {
36
+ breadCrumbs.push(new BreadCrumbItem(viewParam.description, (!upTo && viewParam.routeParameter.selection === BreadCrumbSelectMode.None) ? "" : (selectablePath + queryPath)));
37
+ }
36
38
  }
37
39
  if (upTo && upTo === viewParam) {
38
40
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-react",
3
- "version": "0.10.50",
3
+ "version": "0.10.52",
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,7 +30,6 @@
30
30
  "tslib": "2.3.1"
31
31
  },
32
32
  "dependencies": {
33
- "@fortawesome/react-fontawesome": "0.2.0",
34
33
  "@types/rc-slider": "^8.6.5",
35
34
  "@types/react-color": "^3.0.1",
36
35
  "@types/react-select": "3.1.0",