@singularsystems/neo-react 0.10.51 → 0.10.53

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.
@@ -13,7 +13,7 @@ interface IDeleteButtonOptions extends IButtonOptions {
13
13
  */
14
14
  onDeleteExisting?: (item: any) => Promise<boolean>;
15
15
  }
16
- interface IButtonColumnProps extends INeoCommonColumnProps, React.HTMLProps<HTMLTableCellElement> {
16
+ export interface IButtonColumnProps extends INeoCommonColumnProps, React.HTMLProps<HTMLTableCellElement> {
17
17
  /** Item to pass to edit and delete callbacks. Defaults to the current rows item */
18
18
  item?: any;
19
19
  /** Text to show in the header. */
@@ -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) {
@@ -68,7 +68,7 @@ interface IEditorSelectorProps<T> {
68
68
  /** Date props if this editor is a date editor */
69
69
  dateProps?: Components.IPartialDateProps;
70
70
  /** Radio list props if this is a radio button list. */
71
- radioList?: IRadioListSpecificProps;
71
+ radioList?: IRadioListSpecificProps<T>;
72
72
  /** File props if this editor is a file editor */
73
73
  fileProps?: IFileEditorProps;
74
74
  }
@@ -127,7 +127,7 @@ export declare class BindPropsHelper {
127
127
  * Gets the correct input control type based on the props. E.g. Input / DatePicker / Select
128
128
  * @param props Props passed to a multi type input container. E.g. FormGroup / Column
129
129
  */
130
- static getFormControl(props: IEditorNormalisedProps<any, any>): React.CElement<import("./DatePicker").INeoDatePickerProps, DatePicker> | React.CElement<import("./NumberInput").INumberInputProps, NumberInput> | React.CElement<import("./DropDown/DropDown").IDropDownProps<unknown>, DropDown<unknown>> | React.CElement<IFileEditorProps, FileInput> | React.CElement<import("./Input").IInputProps, Input> | React.CElement<import("./RadioList").IRadioListProps, RadioList>;
130
+ static getFormControl(props: IEditorNormalisedProps<any, any>): React.CElement<import("./DatePicker").INeoDatePickerProps, DatePicker> | React.CElement<import("./NumberInput").INumberInputProps, NumberInput> | React.CElement<import("./DropDown/DropDown").IDropDownProps<unknown>, DropDown<unknown>> | React.CElement<IFileEditorProps, FileInput> | React.CElement<import("./Input").IInputProps, Input> | React.CElement<import("./RadioList").IRadioListProps<unknown>, RadioList<unknown>>;
131
131
  static getControlType(props: IEditorNormalisedProps<any, any>): ControlType;
132
132
  static getCheckBoxType(props: IEditorNormalisedProps<any, any>, instance?: any): CheckboxType;
133
133
  /**
@@ -2,22 +2,22 @@ import React from 'react';
2
2
  import { IBindableEditorProps } from './PropTypes';
3
3
  import ComponentBase from './ComponentBase';
4
4
  import { FormContext } from './FormContext';
5
- export interface IRadioListSpecificProps {
5
+ export interface IRadioListSpecificProps<T> {
6
6
  /** List of items to show. */
7
- items?: any[];
7
+ items?: T[];
8
8
  /** Enum to show as a radio button list. */
9
9
  enumType?: any;
10
10
  /** True if the radio buttons should be displayed inline (horizontally). */
11
11
  inline?: boolean;
12
12
  /** Property name to use for the id. Only applies when using items. */
13
- valueMember?: string | undefined;
13
+ valueMember?: keyof T;
14
14
  /** Property name to use for the radio button text. Only applies when using items. */
15
- displayMember?: string | undefined;
15
+ displayMember?: keyof T;
16
16
  }
17
- export interface IRadioListProps extends IBindableEditorProps<HTMLSelectElement> {
18
- radioList: IRadioListSpecificProps;
17
+ export interface IRadioListProps<T> extends IBindableEditorProps<HTMLSelectElement> {
18
+ radioList: IRadioListSpecificProps<T>;
19
19
  }
20
- export default class RadioList extends ComponentBase<IRadioListProps> {
20
+ export default class RadioList<T> extends ComponentBase<IRadioListProps<T>> {
21
21
  static contextType: React.Context<import("./FormContext").FormContextParams>;
22
22
  context: React.ContextType<typeof FormContext>;
23
23
  private previousList?;
@@ -1,8 +1,9 @@
1
1
  import ViewBase from '../Views/ViewBase';
2
2
  import { Routing } from '@singularsystems/neo-core';
3
+ import { RouteParameterObject } from './IRouteParameter';
3
4
  export interface IMenuRoute extends Routing.IMenuRoute {
4
5
  }
5
- export declare class MenuRoute<TParams> implements IMenuRoute {
6
+ export declare class MenuRoute<TParams extends RouteParameterObject<TParams>> implements IMenuRoute {
6
7
  /**
7
8
  * Creates a menu route with view parameters specified.
8
9
  * @param baseRoute Path and component
@@ -2,7 +2,8 @@ import ViewBase from '../Views/ViewBase';
2
2
  import { RouteComponentProps } from 'react-router';
3
3
  import { RoutingState } from './RoutingState';
4
4
  import { INavigationHelper as INeoNavigationHelper } from '@singularsystems/neo-core/dist/Routing/INavigationHelper';
5
- export declare type ViewConstructor<TParams> = new (...args: any) => ViewBase<any, TParams>;
5
+ import { RouteParameterObject } from './IRouteParameter';
6
+ export declare type ViewConstructor<TParams extends RouteParameterObject<TParams>> = new (...args: any) => ViewBase<any, TParams>;
6
7
  export declare type ParamValues<TParams> = {
7
8
  [P in keyof TParams]?: number | string | null;
8
9
  };
@@ -13,13 +14,13 @@ export interface INavigationHelper extends INeoNavigationHelper {
13
14
  * @param view View component which inherits from view base.
14
15
  * @param paramValues View params to include in the url to pass to the view.
15
16
  */
16
- navigateToView<TParams>(view: ViewConstructor<TParams>, paramValues?: ParamValues<TParams>): void;
17
+ navigateToView<TParams extends RouteParameterObject<TParams>>(view: ViewConstructor<TParams>, paramValues?: ParamValues<TParams>): void;
17
18
  /**
18
19
  * Gets the full path for a view including view parameter values.
19
20
  * @param view View component which inherits from view base.
20
21
  * @param paramValues View params to include in the url to pass to the view.
21
22
  */
22
- getPathForView<TParams>(view: ViewConstructor<TParams>, paramValues?: ParamValues<TParams>): string;
23
+ getPathForView<TParams extends RouteParameterObject<TParams>>(view: ViewConstructor<TParams>, paramValues?: ParamValues<TParams>): string;
23
24
  /**
24
25
  * Gets the path of the currently rendered view, without parameter components.
25
26
  */
@@ -33,8 +34,8 @@ export default class NavigationHelper implements INavigationHelper {
33
34
  private routingState;
34
35
  constructor(routingState: RoutingState);
35
36
  navigateInternal(url: string, replace?: boolean): void;
36
- navigateToView<TParams>(view: ViewConstructor<TParams>, paramValues?: ParamValues<TParams>): void;
37
- getPathForView<TParams>(view: ViewConstructor<TParams>, paramValues?: ParamValues<TParams>): string;
37
+ navigateToView<TParams extends RouteParameterObject<TParams>>(view: ViewConstructor<TParams>, paramValues?: ParamValues<TParams>): void;
38
+ getPathForView<TParams extends RouteParameterObject<TParams>>(view: ViewConstructor<TParams>, paramValues?: ParamValues<TParams>): string;
38
39
  getCurrentViewPath(): string;
39
40
  get currentRouteProps(): RouteComponentProps<{}, import("react-router").StaticContext, import("history").History.PoorMansUnknown>;
40
41
  }
@@ -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.51",
3
+ "version": "0.10.53",
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",