@singularsystems/neo-react 0.10.52 → 0.10.54
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/ReactComponents/DropDown/AutoCompleteDropDown.d.ts +2 -0
- package/dist/ReactComponents/DropDown/AutoCompleteDropDown.js +7 -3
- package/dist/ReactComponents/Grid/ButtonColumn.d.ts +1 -1
- package/dist/ReactComponents/Input.d.ts +1 -1
- package/dist/ReactComponents/NumberInput.d.ts +4 -1
- package/dist/ReactComponents/NumberInput.js +14 -12
- package/dist/ReactComponents/PropTypes.d.ts +2 -2
- package/dist/ReactComponents/PropTypes.js +24 -8
- package/dist/ReactComponents/RadioList.d.ts +7 -7
- package/dist/Routing/MenuRoute.d.ts +2 -1
- package/dist/Routing/NavigationHelper.d.ts +6 -5
- package/dist/Views/ViewComponentBase.d.ts +7 -1
- package/dist/Views/ViewComponentBase.js +8 -5
- package/dist/Views/ViewModelBase.d.ts +1 -0
- package/package.json +11 -2
|
@@ -8,6 +8,7 @@ import { FormContext } from '../FormContext';
|
|
|
8
8
|
interface IOption {
|
|
9
9
|
value: string | number;
|
|
10
10
|
label: string;
|
|
11
|
+
item?: any;
|
|
11
12
|
}
|
|
12
13
|
interface IAutoCompleteCommonProps<T> extends ICommonEditorProps, Props<IOption, true> {
|
|
13
14
|
/**
|
|
@@ -74,6 +75,7 @@ export default class AutoCompleteDropDown<T> extends DropDownBase<T, IAutoComple
|
|
|
74
75
|
private asyncSelectImplementation;
|
|
75
76
|
private selectImplementation;
|
|
76
77
|
constructor(props: IAutoCompleteProps<T> | IAutoCompleteMultiSelectProps<T>);
|
|
78
|
+
static getBindProp<T>(props: IAutoCompleteProps<T> | IAutoCompleteMultiSelectProps<T>): any;
|
|
77
79
|
private onKeyPress;
|
|
78
80
|
private mapTArrayToOptions;
|
|
79
81
|
private onItemSelected;
|
|
@@ -18,6 +18,10 @@ var AutoCompleteDropDown = /** @class */ (function (_super) {
|
|
|
18
18
|
_this.onItemSelected = _this.onItemSelected.bind(_this);
|
|
19
19
|
return _this;
|
|
20
20
|
}
|
|
21
|
+
AutoCompleteDropDown.getBindProp = function (props) {
|
|
22
|
+
var _a;
|
|
23
|
+
return _a = props.bind, (_a !== null && _a !== void 0 ? _a : props.bindItems);
|
|
24
|
+
};
|
|
21
25
|
AutoCompleteDropDown.prototype.onKeyPress = function (searchValue, dataReceived) {
|
|
22
26
|
var _this = this;
|
|
23
27
|
var _a, _b;
|
|
@@ -45,7 +49,7 @@ var AutoCompleteDropDown = /** @class */ (function (_super) {
|
|
|
45
49
|
if (items.length) {
|
|
46
50
|
this.findMembers(items[0]);
|
|
47
51
|
}
|
|
48
|
-
return items.map(function (item) { return (__assign(__assign({}, item), { value: item[_this.valueMember], label: item[_this.displayMember] })); });
|
|
52
|
+
return items.map(function (item) { return (__assign(__assign({}, item), { item: item, value: item[_this.valueMember], label: item[_this.displayMember] })); });
|
|
49
53
|
};
|
|
50
54
|
AutoCompleteDropDown.prototype.onItemSelected = function (args, action) {
|
|
51
55
|
var onItemSelected = this.props.onItemSelected;
|
|
@@ -60,7 +64,7 @@ var AutoCompleteDropDown = /** @class */ (function (_super) {
|
|
|
60
64
|
bindIdsList.push(action.option.value);
|
|
61
65
|
}
|
|
62
66
|
if (onItemSelected) {
|
|
63
|
-
onItemSelected(action.option);
|
|
67
|
+
onItemSelected(action.option.item);
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
70
|
else if (action.action === "remove-value") {
|
|
@@ -93,7 +97,7 @@ var AutoCompleteDropDown = /** @class */ (function (_super) {
|
|
|
93
97
|
this.props.bindDisplay.value = args ? args.label : "";
|
|
94
98
|
}
|
|
95
99
|
if (onItemSelected) {
|
|
96
|
-
onItemSelected(
|
|
100
|
+
onItemSelected(action.option.item);
|
|
97
101
|
}
|
|
98
102
|
}
|
|
99
103
|
};
|
|
@@ -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. */
|
|
@@ -3,7 +3,7 @@ import { IBindableEditorProps } from './PropTypes';
|
|
|
3
3
|
import { Components } from '@singularsystems/neo-core';
|
|
4
4
|
import ComponentBase from './ComponentBase';
|
|
5
5
|
import { FormContext } from './FormContext';
|
|
6
|
-
declare type InputType = "text" | "password" | "checkbox" | "switch";
|
|
6
|
+
declare type InputType = "text" | "password" | "checkbox" | "switch" | "tel" | "email";
|
|
7
7
|
export interface IInputSpecificProps {
|
|
8
8
|
/** Type of input to use */
|
|
9
9
|
type?: InputType;
|
|
@@ -15,6 +15,8 @@ export interface INumberInputSpecificProps {
|
|
|
15
15
|
autoRound?: boolean;
|
|
16
16
|
/** Text to display if the value is zero or null. E.g. '-' */
|
|
17
17
|
zeroText?: string;
|
|
18
|
+
/** Set to true to use the browsers native numeric input control. Note: only decimal place formatting is supported in this mode. */
|
|
19
|
+
native?: boolean;
|
|
18
20
|
}
|
|
19
21
|
export interface INumberInputProps extends IBindableEditorProps<HTMLInputElement> {
|
|
20
22
|
numProps?: INumberInputSpecificProps;
|
|
@@ -24,7 +26,8 @@ export declare class FormatState {
|
|
|
24
26
|
hasExternalPercentSymbol: boolean;
|
|
25
27
|
formatString: string;
|
|
26
28
|
zeroText?: string | undefined;
|
|
27
|
-
|
|
29
|
+
useNative?: boolean | undefined;
|
|
30
|
+
constructor(isPercent: boolean, hasExternalPercentSymbol: boolean, formatString: string, zeroText?: string | undefined, useNative?: boolean | undefined);
|
|
28
31
|
static create(numericType: Misc.DataType, numProps?: INumberInputSpecificProps, appendText?: string): FormatState;
|
|
29
32
|
getFormattedValue(value?: number | Decimal | null): string;
|
|
30
33
|
}
|
|
@@ -9,14 +9,15 @@ import { observer } from 'mobx-react';
|
|
|
9
9
|
import memoize from 'memoize-one';
|
|
10
10
|
import ComponentBase from './ComponentBase';
|
|
11
11
|
var FormatState = /** @class */ (function () {
|
|
12
|
-
function FormatState(isPercent, hasExternalPercentSymbol, formatString, zeroText) {
|
|
12
|
+
function FormatState(isPercent, hasExternalPercentSymbol, formatString, zeroText, useNative) {
|
|
13
13
|
this.isPercent = isPercent;
|
|
14
14
|
this.hasExternalPercentSymbol = hasExternalPercentSymbol;
|
|
15
15
|
this.formatString = formatString;
|
|
16
16
|
this.zeroText = zeroText;
|
|
17
|
+
this.useNative = useNative;
|
|
17
18
|
}
|
|
18
19
|
FormatState.create = function (numericType, numProps, appendText) {
|
|
19
|
-
var _a, _b, _c;
|
|
20
|
+
var _a, _b, _c, _d;
|
|
20
21
|
var isPercent = false;
|
|
21
22
|
var hasExternalPercentSymbol = false;
|
|
22
23
|
var formatString = numProps ? numProps.formatString : "";
|
|
@@ -38,7 +39,7 @@ var FormatState = /** @class */ (function () {
|
|
|
38
39
|
if (formatString.indexOf("%") >= 0 || appendText === "%") {
|
|
39
40
|
isPercent = true;
|
|
40
41
|
}
|
|
41
|
-
return new FormatState(isPercent, hasExternalPercentSymbol, formatString, (_c = numProps) === null || _c === void 0 ? void 0 : _c.zeroText);
|
|
42
|
+
return new FormatState(isPercent, hasExternalPercentSymbol, formatString, (_c = numProps) === null || _c === void 0 ? void 0 : _c.zeroText, (_d = numProps) === null || _d === void 0 ? void 0 : _d.native);
|
|
42
43
|
};
|
|
43
44
|
FormatState.prototype.getFormattedValue = function (value) {
|
|
44
45
|
if (!value && this.zeroText !== undefined) {
|
|
@@ -52,7 +53,7 @@ var FormatState = /** @class */ (function () {
|
|
|
52
53
|
if (this.hasExternalPercentSymbol) {
|
|
53
54
|
value *= 100;
|
|
54
55
|
}
|
|
55
|
-
return NumberUtils.format(value, this.formatString);
|
|
56
|
+
return this.useNative ? NumberUtils.formatRaw(value, this.formatString, false) : NumberUtils.format(value, this.formatString);
|
|
56
57
|
}
|
|
57
58
|
else {
|
|
58
59
|
return value;
|
|
@@ -141,13 +142,8 @@ var NumberInput = /** @class */ (function (_super) {
|
|
|
141
142
|
this.hasFocus = true;
|
|
142
143
|
var numberValue = this.getBindValueAsNumber();
|
|
143
144
|
var stringValue;
|
|
144
|
-
if (
|
|
145
|
-
|
|
146
|
-
stringValue = "0";
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
stringValue = "";
|
|
150
|
-
}
|
|
145
|
+
if (numberValue === null || numberValue === undefined) {
|
|
146
|
+
stringValue = "";
|
|
151
147
|
}
|
|
152
148
|
else {
|
|
153
149
|
if (element.readOnly || !this.props.numProps || this.props.numProps.autoRound !== false) {
|
|
@@ -218,10 +214,12 @@ var NumberInput = /** @class */ (function (_super) {
|
|
|
218
214
|
}
|
|
219
215
|
};
|
|
220
216
|
NumberInput.prototype.render = function () {
|
|
217
|
+
var _a;
|
|
221
218
|
var splitProps = BindPropsHelper.normaliseEditorProps(this, this.props);
|
|
222
219
|
var domProps = BindPropsHelper.autoSetDomProperties(splitProps, this.context, this.onBlur, this.onFocus);
|
|
223
220
|
domProps.className = Utils.joinWithSpaces(domProps.className, splitProps.isBootstrap ? "form-control" : "neo-forms-editor", "numeric-input");
|
|
224
221
|
var editorProps = splitProps.editor;
|
|
222
|
+
var useNative = (_a = splitProps.numProps) === null || _a === void 0 ? void 0 : _a.native;
|
|
225
223
|
var displayInfo = this.props.bind.validator.getDisplayState(this.context.validationDisplayMode);
|
|
226
224
|
displayInfo.applyToDom(domProps, !splitProps.inGroup);
|
|
227
225
|
this.formatState = this.recalcFormatState(this.numericType, splitProps.numProps, editorProps.appendText);
|
|
@@ -235,7 +233,11 @@ var NumberInput = /** @class */ (function (_super) {
|
|
|
235
233
|
this.inputElement.current.value = this.formatState.getFormattedValue(editorProps.bind.value);
|
|
236
234
|
}
|
|
237
235
|
}
|
|
238
|
-
|
|
236
|
+
if (useNative && !domProps.step) {
|
|
237
|
+
var decimals = NumberUtils.getDecimalPlaces(this.formatState.formatString);
|
|
238
|
+
domProps.step = decimals === 0 ? "1" : "0." + "0".repeat(decimals - 1) + "1";
|
|
239
|
+
}
|
|
240
|
+
return (InputHelpers.surroundWithInputGroup(React.createElement("input", __assign({}, domProps, { defaultValue: this.formatState.getFormattedValue(editorProps.bind.value), type: useNative ? "number" : "text", onChange: this.onChanged, ref: this.inputElement })), editorProps));
|
|
239
241
|
};
|
|
240
242
|
NumberInput.contextType = FormContext;
|
|
241
243
|
NumberInput = __decorate([
|
|
@@ -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
|
|
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
|
/**
|
|
@@ -113,18 +113,34 @@ var BindPropsHelper = /** @class */ (function () {
|
|
|
113
113
|
BindPropsHelper.normaliseContainerProps = function (component, props, inGroup, isBootstrap) {
|
|
114
114
|
// Split flattened props into components.
|
|
115
115
|
if (isBootstrap === void 0) { isBootstrap = true; }
|
|
116
|
-
var _a, _b;
|
|
116
|
+
var _a, _b, _c, _d, _e;
|
|
117
117
|
var splitProps = this.splitCommonEditorProps(props);
|
|
118
|
-
var
|
|
118
|
+
var _f = splitProps.rest,
|
|
119
119
|
// Bindable editor props
|
|
120
|
-
bind =
|
|
120
|
+
bind = _f.bind, display = _f.display, placeholder = _f.placeholder,
|
|
121
121
|
// Editor selector props
|
|
122
|
-
select =
|
|
122
|
+
select = _f.select, input = _f.input, dateProps = _f.dateProps, numProps = _f.numProps, fileProps = _f.fileProps, radioList = _f.radioList,
|
|
123
123
|
// Common container props
|
|
124
|
-
label =
|
|
124
|
+
label = _f.label, editorProps = _f.editorProps, editorTooltip = _f.editorTooltip, editorClassName = _f.editorClassName, editorStyle = _f.editorStyle, suppressDefaultContent = _f.suppressDefaultContent, bindContext = _f.bindContext,
|
|
125
125
|
// Container dom
|
|
126
|
-
containerDom = __rest(
|
|
126
|
+
containerDom = __rest(_f, ["bind", "display", "placeholder", "select", "input", "dateProps", "numProps", "fileProps", "radioList", "label", "editorProps", "editorTooltip", "editorClassName", "editorStyle", "suppressDefaultContent", "bindContext"]);
|
|
127
127
|
var bindOrDisplay = BindPropsHelper.getBindProperty(props);
|
|
128
|
+
if (!bindOrDisplay) {
|
|
129
|
+
var child = containerDom.children;
|
|
130
|
+
var childBind = void 0;
|
|
131
|
+
if (child) {
|
|
132
|
+
if ((_a = child.type) === null || _a === void 0 ? void 0 : _a.getBindProp) {
|
|
133
|
+
childBind = (_b = child.type) === null || _b === void 0 ? void 0 : _b.getBindProp(child.props);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
childBind = (_c = child.props) === null || _c === void 0 ? void 0 : _c.bind;
|
|
137
|
+
}
|
|
138
|
+
if (childBind) {
|
|
139
|
+
bindOrDisplay = childBind;
|
|
140
|
+
bindContext = bindOrDisplay;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
128
144
|
if (bindOrDisplay && bindOrDisplay.propertyInfo.isReadOnly)
|
|
129
145
|
splitProps.editor.isReadOnly = true;
|
|
130
146
|
if (!props.bind && props.display)
|
|
@@ -145,7 +161,7 @@ var BindPropsHelper = /** @class */ (function () {
|
|
|
145
161
|
}
|
|
146
162
|
return {
|
|
147
163
|
bind: bindOrDisplay,
|
|
148
|
-
editor: __assign({ bind: bindOrDisplay, placeholder: this.getPlaceholderText(placeholder, (
|
|
164
|
+
editor: __assign({ bind: bindOrDisplay, placeholder: this.getPlaceholderText(placeholder, (_d = bindOrDisplay) === null || _d === void 0 ? void 0 : _d.propertyInfo) }, splitProps.editor),
|
|
149
165
|
editorDom: editorProps,
|
|
150
166
|
container: { label: label, editorTooltip: editorTooltip, editorClassName: editorClassName, editorStyle: editorStyle, bindContext: bindContext, suppressDefaultContent: suppressDefaultContent },
|
|
151
167
|
select: select,
|
|
@@ -155,7 +171,7 @@ var BindPropsHelper = /** @class */ (function () {
|
|
|
155
171
|
fileProps: fileProps,
|
|
156
172
|
radioList: radioList,
|
|
157
173
|
inGroup: inGroup,
|
|
158
|
-
uniqueID: ((
|
|
174
|
+
uniqueID: ((_e = bindOrDisplay) === null || _e === void 0 ? void 0 : _e.uniqueID) + "!" + component.uniqueId,
|
|
159
175
|
containerDom: containerDom,
|
|
160
176
|
isBootstrap: isBootstrap
|
|
161
177
|
};
|
|
@@ -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?:
|
|
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?:
|
|
13
|
+
valueMember?: keyof T;
|
|
14
14
|
/** Property name to use for the radio button text. Only applies when using items. */
|
|
15
|
-
displayMember?:
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
37
|
-
getPathForView<TParams
|
|
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
|
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ITaskRunner } from '@singularsystems/neo-core';
|
|
3
3
|
import { IViewModel } from './IViewModel';
|
|
4
|
+
import { valueOrLazy } from './ViewModelBase';
|
|
4
5
|
interface IComponentProps {
|
|
5
6
|
taskRunner?: ITaskRunner;
|
|
6
7
|
}
|
|
7
8
|
export default class ViewComponentBase<TProps extends IComponentProps, TViewModel extends IViewModel> extends React.Component<TProps> {
|
|
8
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Creates a view component.
|
|
11
|
+
* @param props Component props.
|
|
12
|
+
* @param viewModel Instance of view model, or view model type, or callback which returns a view model. Taskrunner will be set only if passing in VM type.
|
|
13
|
+
*/
|
|
14
|
+
constructor(props: TProps, viewModel: valueOrLazy<TViewModel>);
|
|
9
15
|
viewModel: TViewModel;
|
|
10
16
|
componentDidMount(): void;
|
|
11
17
|
componentWillUnmount(): void;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { __extends } from "tslib";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import ViewModelBase from './ViewModelBase';
|
|
3
4
|
var ViewComponentBase = /** @class */ (function (_super) {
|
|
4
5
|
__extends(ViewComponentBase, _super);
|
|
5
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Creates a view component.
|
|
8
|
+
* @param props Component props.
|
|
9
|
+
* @param viewModel Instance of view model, or view model type, or callback which returns a view model. Taskrunner will be set only if passing in VM type.
|
|
10
|
+
*/
|
|
11
|
+
function ViewComponentBase(props, viewModel) {
|
|
6
12
|
var _this = _super.call(this, props) || this;
|
|
7
|
-
_this.viewModel =
|
|
8
|
-
if (props.taskRunner) {
|
|
9
|
-
_this.viewModel.taskRunner = props.taskRunner;
|
|
10
|
-
}
|
|
13
|
+
_this.viewModel = ViewModelBase.create(viewModel, props.taskRunner);
|
|
11
14
|
return _this;
|
|
12
15
|
}
|
|
13
16
|
ViewComponentBase.prototype.componentDidMount = function () {
|
|
@@ -27,6 +27,7 @@ export default abstract class ViewModelBase extends ModelBase implements IViewMo
|
|
|
27
27
|
}): TViewModel;
|
|
28
28
|
/**
|
|
29
29
|
* Registers a child view model that will be disposed when this view model is disposed.
|
|
30
|
+
* You must manually pass the current VMs task runner to the new viewmodel instance.
|
|
30
31
|
*/
|
|
31
32
|
registerViewModel<TViewModel extends IViewModel>(viewModel: TViewModel): TViewModel;
|
|
32
33
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@singularsystems/neo-react",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.54",
|
|
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",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@types/rc-slider": "^8.6.5",
|
|
34
34
|
"@types/react-color": "^3.0.1",
|
|
35
35
|
"@types/react-select": "3.1.0",
|
|
36
|
-
"@singularsystems/neo-core": "^0.10.
|
|
36
|
+
"@singularsystems/neo-core": "^0.10.58",
|
|
37
37
|
"axios": "^0.21.1",
|
|
38
38
|
"decimal.js-light": "2.5.1",
|
|
39
39
|
"history": "4.10.1",
|
|
@@ -45,5 +45,14 @@
|
|
|
45
45
|
"react-custom-scrollbars": "^4.2.1",
|
|
46
46
|
"react-dom": "^16.13.1",
|
|
47
47
|
"react-router-dom": "5.1.0"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"@singularsystems/neo-core": ">=0.10.58",
|
|
51
|
+
"axios": ">=0.21.1",
|
|
52
|
+
"inversify": ">=5.0.1",
|
|
53
|
+
"react": ">=16.13.1",
|
|
54
|
+
"react-dom": ">=16.13.1",
|
|
55
|
+
"react-router": "^5.0.0",
|
|
56
|
+
"react-router-dom": "^5.0.0"
|
|
48
57
|
}
|
|
49
58
|
}
|