@singularsystems/neo-react 1.0.0-beta.7 → 1.0.1
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/CHANGELOG.md +138 -0
- package/dist/Modules/Types.d.ts +13 -0
- package/dist/Modules/Types.js +8 -0
- package/dist/React/AutoRunner.js +5 -1
- package/dist/ReactComponents/Card.d.ts +1 -1
- package/dist/ReactComponents/Collapsable.d.ts +1 -1
- package/dist/ReactComponents/ColorPicker.d.ts +6 -4
- package/dist/ReactComponents/ColorPicker.js +24 -9
- package/dist/ReactComponents/ContextMenu/ContextMenu.d.ts +1 -1
- package/dist/ReactComponents/ContextMenu/ContextMenuContainer.d.ts +1 -1
- package/dist/ReactComponents/ContextMenu/ContextMenuState.js +2 -1
- package/dist/ReactComponents/DatePicker.d.ts +1 -1
- package/dist/ReactComponents/DropDown/AutoCompleteDropDown.d.ts +1 -1
- package/dist/ReactComponents/DropDown/AutoCompleteDropDown.js +1 -2
- package/dist/ReactComponents/DropDown/DropDown.d.ts +1 -1
- package/dist/ReactComponents/DropDown/DropDown.js +11 -7
- package/dist/ReactComponents/DropDown/DropDownBase.d.ts +2 -2
- package/dist/ReactComponents/DropDown/LookupHelper.d.ts +4 -4
- package/dist/ReactComponents/ErrorHandler.js +2 -1
- package/dist/ReactComponents/FileManager/FileBasicInput.d.ts +1 -1
- package/dist/ReactComponents/FileManager/FileBasicInput.js +2 -1
- package/dist/ReactComponents/FileManager/FileContext.d.ts +1 -1
- package/dist/ReactComponents/FileManager/FileDropArea.d.ts +1 -1
- package/dist/ReactComponents/FileManager/FileInput.d.ts +1 -1
- package/dist/ReactComponents/FileManager/FileUploadButton.d.ts +1 -1
- package/dist/ReactComponents/FileManager/FileUploadProgress.d.ts +1 -1
- package/dist/ReactComponents/Form.d.ts +1 -1
- package/dist/ReactComponents/FormContext.d.ts +1 -1
- package/dist/ReactComponents/FormContext.js +2 -1
- package/dist/ReactComponents/FormGroup/FormGroup.d.ts +1 -1
- package/dist/ReactComponents/FormGroup/FormGroup.js +2 -1
- package/dist/ReactComponents/FormGroup/FormGroupFloating.d.ts +1 -1
- package/dist/ReactComponents/FormGroup/FormGroupInline.d.ts +1 -1
- package/dist/ReactComponents/Grid/ButtonColumn.d.ts +1 -1
- package/dist/ReactComponents/Grid/ButtonColumn.js +3 -2
- package/dist/ReactComponents/Grid/Column.d.ts +1 -1
- package/dist/ReactComponents/Grid/Grid.d.ts +2 -2
- package/dist/ReactComponents/Grid/Row.d.ts +2 -2
- package/dist/ReactComponents/Grid/Row.js +4 -2
- package/dist/ReactComponents/GridLayout.d.ts +1 -1
- package/dist/ReactComponents/IColorPicker.d.ts +7 -0
- package/dist/ReactComponents/IColorPicker.js +1 -0
- package/dist/ReactComponents/Icons/FontAwesomeIconFactory.js +2 -1
- package/dist/ReactComponents/Icons/IconFactory.js +2 -1
- package/dist/ReactComponents/Icons/MaterialSymbolsFontFactory.js +1 -2
- package/dist/ReactComponents/Input.d.ts +1 -1
- package/dist/ReactComponents/InputHelpers.d.ts +1 -1
- package/dist/ReactComponents/Link.d.ts +1 -1
- package/dist/ReactComponents/Loader.d.ts +1 -1
- package/dist/ReactComponents/Modal/Modal.d.ts +1 -1
- package/dist/ReactComponents/Modal/ModalContainer.d.ts +1 -1
- package/dist/ReactComponents/Modal/ModalPortal.d.ts +1 -1
- package/dist/ReactComponents/Notifications/Alert.d.ts +1 -1
- package/dist/ReactComponents/Notifications/Toast.d.ts +1 -1
- package/dist/ReactComponents/Notifications/ToastContainer.d.ts +1 -1
- package/dist/ReactComponents/NumberInput.d.ts +1 -1
- package/dist/ReactComponents/Paging/BasicPagerControls.d.ts +1 -1
- package/dist/ReactComponents/Paging/PageSizeControl.d.ts +1 -1
- package/dist/ReactComponents/Paging/Pager.d.ts +1 -1
- package/dist/ReactComponents/ProgressBar.d.ts +1 -1
- package/dist/ReactComponents/PropTypes.d.ts +1 -1
- package/dist/ReactComponents/PropTypes.js +3 -1
- package/dist/ReactComponents/RadioList.d.ts +1 -1
- package/dist/ReactComponents/Slider.d.ts +1 -1
- package/dist/ReactComponents/Slider.js +1 -1
- package/dist/ReactComponents/Tabs/Tab.d.ts +3 -3
- package/dist/ReactComponents/Tabs/Tab.js +1 -2
- package/dist/ReactComponents/Tabs/TabContainer.d.ts +1 -1
- package/dist/ReactComponents/Tooltip.d.ts +7 -3
- package/dist/ReactComponents/TooltipHelper.d.ts +1 -0
- package/dist/ReactComponents/TooltipHelper.js +7 -3
- package/dist/ReactComponents/TooltipProvider.d.ts +1 -1
- package/dist/ReactComponents/ValidationSummary.d.ts +1 -1
- package/dist/Routing/MenuRoute.js +2 -0
- package/dist/Routing/PageLeaveHandler.js +2 -1
- package/dist/Routing/RoutingState.js +2 -1
- package/dist/Routing/ViewParameter.js +2 -1
- package/dist/Routing/ViewParameterList.d.ts +2 -1
- package/dist/Routing/ViewParameterList.js +5 -0
- package/dist/Services/DisposeHelper.js +2 -1
- package/dist/Views/ViewBase.js +1 -1
- package/dist/Views/ViewModelBase.d.ts +3 -1
- package/dist/Views/ViewModelBase.js +1 -5
- package/package.json +12 -10
- package/styles/ColorPicker.scss +1 -2
- package/dist/React/Decorators.d.ts +0 -4
- package/dist/React/Decorators.js +0 -15
- package/dist/React/Utils.d.ts +0 -2
- package/dist/React/Utils.js +0 -15
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Version 1.x
|
|
2
|
+
|
|
3
|
+
Version 1 of neo-react upgrades react to version 18, and mobX to version 6. Both of these are major updates and will require you to make code changes to your project.
|
|
4
|
+
|
|
5
|
+
## Testing
|
|
6
|
+
|
|
7
|
+
In addition to requiring code / syntax changes, both React 18, and Mobx 6 behave differently enough to their previous versions that runtime bugs may be introduced into your project. You should only update to this version when you and the client have enough time to test the project thoroughly. If you find any issues, please report them so this document can be updated.
|
|
8
|
+
|
|
9
|
+
The project changes required are detailed below:
|
|
10
|
+
|
|
11
|
+
## Package changes:
|
|
12
|
+
|
|
13
|
+
* Update all neo packages to the latest 1.x version.
|
|
14
|
+
* Update the following packages to the latest version (these were the latest at time of writing):
|
|
15
|
+
* dependencies
|
|
16
|
+
* `"axios": "1.6.7"`,
|
|
17
|
+
* `"decimal.js-light": "2.5.1"`, - See below for alternative
|
|
18
|
+
* `"mobx": "6.11.0"`,
|
|
19
|
+
* `"mobx-react": "7.6.0"`,
|
|
20
|
+
* `"react": "18.2.0"`,
|
|
21
|
+
* `"react-dom": "18.2.0"`,
|
|
22
|
+
* `"react-router": "5.2.1"`, - Must be version 5.x
|
|
23
|
+
* `"react-router-dom": "5.3.0"`, - Must be version 5.x
|
|
24
|
+
* `"react-select": "5.7.3"`,
|
|
25
|
+
|
|
26
|
+
* devDependencies
|
|
27
|
+
* `"@types/react": "18.2.37"`,
|
|
28
|
+
* `"@types/react-dom": "18.2.15"`,
|
|
29
|
+
* `"@types/react-router": "5.1.17"`, - Must be version 5.x
|
|
30
|
+
* `"@types/react-router-dom": "5.3.3"`, - Must be version 5.x
|
|
31
|
+
* resolutions
|
|
32
|
+
* remove all entries
|
|
33
|
+
* delete yarn.lock, and run `yarn install`
|
|
34
|
+
|
|
35
|
+
## Fix errors
|
|
36
|
+
|
|
37
|
+
If any of your components allow children, React 18 requires to you have an explicit `children` prop. Add this to the props definition of the component:
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
interface MyProps {
|
|
41
|
+
...
|
|
42
|
+
children: React.ReactNode;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// or if the component has no other props:
|
|
46
|
+
|
|
47
|
+
MyComponent extends React.Component<{ children: React.ReactNode }> {
|
|
48
|
+
...
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The React root api has also changed in version 18. Make the following changes to your `index.tsx` file:
|
|
53
|
+
|
|
54
|
+
Your existing code will look something like this:
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import ReactDOM from 'react-dom';
|
|
58
|
+
...
|
|
59
|
+
// React init
|
|
60
|
+
ReactDOM.render(
|
|
61
|
+
renderComponent,
|
|
62
|
+
document.getElementById('root') as HTMLElement
|
|
63
|
+
);
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Change the `ReactDOM` import, and the react init code:
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import ReactDOM from 'react-dom/client';
|
|
70
|
+
...
|
|
71
|
+
// React init
|
|
72
|
+
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
|
|
73
|
+
root.render(renderComponent);
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Mobx
|
|
77
|
+
|
|
78
|
+
Before mobx 6, you could mark a property as being observable by adding an `@observable` decorator to the property. In mobx 6 this no longer works ([read more](https://mobx.js.org/migrating-from-4-or-5.html)).
|
|
79
|
+
|
|
80
|
+
For any class that extends `ModelBase`, `ValueObject`, `ViewModelBase` etc, this change is handled by neo, and you will not need to change any code.
|
|
81
|
+
|
|
82
|
+
For other classes, you will need to add initialisation code to the constructor.
|
|
83
|
+
|
|
84
|
+
* Search for `@observable` in your project. (In most projects this will be in the Sidebar and AppLayout components)
|
|
85
|
+
* In the constructor of the class that contains the property, add:
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
makeObservable(this);
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Decorators on neo models
|
|
92
|
+
|
|
93
|
+
If you try use mobx decorators on any models that extend `ModelBase`, `ValueObject` or `ViewModelBase`, you will receive this error:
|
|
94
|
+
|
|
95
|
+
> [MobX] makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.
|
|
96
|
+
|
|
97
|
+
This is most likely because you have used an `@action` decorator on a method. Neo now marks all methods as actions, so you can remove the `@action` decorator.
|
|
98
|
+
|
|
99
|
+
* Search for `@action` in your project. Remove the decorator **only** if the class extends `ModelBase` (and its decendents e.g. `ValueObject`) or `ViewModelBase`.
|
|
100
|
+
|
|
101
|
+
### Array sorting
|
|
102
|
+
|
|
103
|
+
Mobx no longer allows you to call `sort` on an observable array. You first need to call `slice` to create a copy of the array. This change has been made in the neo `sortBy` method, but will cause unexpected behaviour if you relied on the list being sorted in-place, as this no longer happens.
|
|
104
|
+
|
|
105
|
+
* Search for `.sort` in your project. Change to use the neo `sortBy` method.
|
|
106
|
+
* Search for `.sortBy`. Ensure you use the array returned by this method, and not the array passed in.
|
|
107
|
+
|
|
108
|
+
### Viewmodels
|
|
109
|
+
|
|
110
|
+
You may receive errors such as:
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
Argument of type 'typeof MyVM' is not assignable to parameter of type 'VMConstructor<MyVM>'.
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The `registerViewModel` method on the `ViewModelBase` class now requires the view model passed to it to have a `taskRunner` as the first argument. This task runner instance must be passed to the base constructor.
|
|
117
|
+
|
|
118
|
+
## Decimals
|
|
119
|
+
|
|
120
|
+
Neo no longer includes the `decimal.js-light` package by default. This is to allow for other decimal packages to be used. You will now need to manually register a decimal service in your app module.
|
|
121
|
+
|
|
122
|
+
The easiest would be to continue using `decimal.js-light`:
|
|
123
|
+
|
|
124
|
+
* Ensure your project references `decimal.js-light` directly.
|
|
125
|
+
* In your main app module, add the following code:
|
|
126
|
+
```typescript
|
|
127
|
+
import Decimal from "decimal.js-light";
|
|
128
|
+
...
|
|
129
|
+
container.bind(Types.Neo.Core.DecimalService).toConstantValue(new Numeric.DecimalService(Decimal, Decimal.ROUND_HALF_UP, Decimal.ROUND_DOWN));
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
An alternative is to use `big.js`. This package is slightly smaller than the above, but has less features.
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
import Big from "big.js";
|
|
136
|
+
...
|
|
137
|
+
container.bind(Types.Neo.Core.DecimalService).toConstantValue(new Numeric.DecimalService(Big, Big.roundHalfUp, Big.roundDown))
|
|
138
|
+
```
|
package/dist/Modules/Types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { INavigationHelper } from '../Routing/NavigationHelper';
|
|
|
3
3
|
import { RoutingState } from '../Routing/RoutingState';
|
|
4
4
|
import Slider, { Range } from 'rc-slider';
|
|
5
5
|
import { SketchPicker } from 'react-color';
|
|
6
|
+
import { IColorPicker } from '../ReactComponents/IColorPicker';
|
|
6
7
|
import AsyncSelect from 'react-select/async';
|
|
7
8
|
import { AxiosStatic } from 'axios';
|
|
8
9
|
import Select from 'react-select';
|
|
@@ -12,7 +13,15 @@ declare const NeoReactTypes: {
|
|
|
12
13
|
Components: {
|
|
13
14
|
Slider: AppServices.ServiceIdentifier<typeof Slider>;
|
|
14
15
|
Range: AppServices.ServiceIdentifier<typeof Range>;
|
|
16
|
+
/**
|
|
17
|
+
* Sketchpicker (from 'react-color' package) component used by the color picker.
|
|
18
|
+
* It is recommended to use the `ColorPicker` type and bind to HexColorPicker from the 'react-colorful' package.
|
|
19
|
+
*/
|
|
15
20
|
SketchPicker: AppServices.ServiceIdentifier<typeof SketchPicker>;
|
|
21
|
+
/**
|
|
22
|
+
* Returns a component that renders a color picker that accepts a color input, and onChange event handler.
|
|
23
|
+
*/
|
|
24
|
+
ColorPicker: AppServices.ServiceIdentifier<IColorPicker>;
|
|
16
25
|
ReactSelect: AppServices.ServiceIdentifier<Select>;
|
|
17
26
|
AsyncSelect: AppServices.ServiceIdentifier<AsyncSelect>;
|
|
18
27
|
IconFactory: AppServices.ServiceIdentifier<IIconFactory>;
|
|
@@ -41,6 +50,10 @@ declare const NeoReactTypes: {
|
|
|
41
50
|
Localisation: {
|
|
42
51
|
LocalisationService: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/Localisation").ILocalisationService>;
|
|
43
52
|
};
|
|
53
|
+
Messaging: {
|
|
54
|
+
ConnectionManager: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/ConnectionManager").IConnectionManager>;
|
|
55
|
+
ServerMessageSubscriber: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/SignalR").IServerMessageSubscriber>;
|
|
56
|
+
};
|
|
44
57
|
Security: {
|
|
45
58
|
AuthenticationService: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/Security").IAuthenticationService>;
|
|
46
59
|
AuthorisationService: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/Security").IAuthorisationService>;
|
package/dist/Modules/Types.js
CHANGED
|
@@ -3,7 +3,15 @@ import { AppServices } from '@singularsystems/neo-core';
|
|
|
3
3
|
var NeoReactTypes = __assign(__assign({}, AppServices.NeoTypes), { Components: {
|
|
4
4
|
Slider: new AppServices.ServiceIdentifier("NeoReact.Slider"),
|
|
5
5
|
Range: new AppServices.ServiceIdentifier("NeoReact.Range"),
|
|
6
|
+
/**
|
|
7
|
+
* Sketchpicker (from 'react-color' package) component used by the color picker.
|
|
8
|
+
* It is recommended to use the `ColorPicker` type and bind to HexColorPicker from the 'react-colorful' package.
|
|
9
|
+
*/
|
|
6
10
|
SketchPicker: new AppServices.ServiceIdentifier("NeoReact.SketchPicker"),
|
|
11
|
+
/**
|
|
12
|
+
* Returns a component that renders a color picker that accepts a color input, and onChange event handler.
|
|
13
|
+
*/
|
|
14
|
+
ColorPicker: new AppServices.ServiceIdentifier("NeoReact.ColorPicker"),
|
|
7
15
|
ReactSelect: new AppServices.ServiceIdentifier("NeoReact.ReactSelect"),
|
|
8
16
|
AsyncSelect: new AppServices.ServiceIdentifier("NeoReact.AsyncSelect"),
|
|
9
17
|
IconFactory: new AppServices.ServiceIdentifier("NeoReact.IconFactory")
|
package/dist/React/AutoRunner.js
CHANGED
|
@@ -2,7 +2,7 @@ import { __decorate } from "tslib";
|
|
|
2
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 () {
|
|
6
6
|
function AutoRunnerFactory() {
|
|
7
7
|
}
|
|
8
8
|
AutoRunnerFactory.prototype.create = function (model, callback, options) {
|
|
@@ -13,6 +13,7 @@ export var AutoRunnerFactory = /** @class */ (function () {
|
|
|
13
13
|
], AutoRunnerFactory);
|
|
14
14
|
return AutoRunnerFactory;
|
|
15
15
|
}());
|
|
16
|
+
export { AutoRunnerFactory };
|
|
16
17
|
var AutoRunner = /** @class */ (function () {
|
|
17
18
|
function AutoRunner(model, callback, options) {
|
|
18
19
|
var _this = this;
|
|
@@ -82,15 +83,18 @@ var AutoRunner = /** @class */ (function () {
|
|
|
82
83
|
this.propertyMap[key] = useDelay;
|
|
83
84
|
}
|
|
84
85
|
if (useDelay === delayed) {
|
|
86
|
+
//@ts-ignore
|
|
85
87
|
void instance[propertyInfo.propertyName];
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
90
|
else if (propertyInfo.relationType === Misc.RelationType.ValueObject ||
|
|
89
91
|
(propertyInfo.relationType === Misc.RelationType.ChildObject && this.options.includeChildObjects)) {
|
|
92
|
+
//@ts-ignore
|
|
90
93
|
this.accessAllValues(instance[propertyInfo.propertyName], delayed, trackedInstances, path + propertyInfo.propertyName + ".");
|
|
91
94
|
}
|
|
92
95
|
else if (propertyInfo.relationType === Misc.RelationType.ChildList && this.options.includeChildLists) {
|
|
93
96
|
var index = 0;
|
|
97
|
+
//@ts-ignore
|
|
94
98
|
for (var _c = 0, _d = instance[propertyInfo.propertyName]; _c < _d.length; _c++) {
|
|
95
99
|
var child = _d[_c];
|
|
96
100
|
this.accessAllValues(child, delayed, trackedInstances, "".concat(path).concat(propertyInfo.propertyName, "[").concat(index++, "]."));
|
|
@@ -16,7 +16,7 @@ interface ICollapsableProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
16
16
|
export default class Collapsable extends ComponentBase<ICollapsableProps> {
|
|
17
17
|
protected containerRef: React.RefObject<HTMLDivElement>;
|
|
18
18
|
protected animationHelper?: Components.CollapseAnimationHelper;
|
|
19
|
-
render(): JSX.Element;
|
|
19
|
+
render(): React.JSX.Element;
|
|
20
20
|
afterRender(isInitial: boolean): void;
|
|
21
21
|
componentWillUnmount(): void;
|
|
22
22
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SketchPickerProps } from 'react-color';
|
|
3
3
|
import { Model } from '@singularsystems/neo-core';
|
|
4
4
|
interface IColorPickerProps extends SketchPickerProps {
|
|
5
5
|
bind: Model.IPropertyInstance;
|
|
@@ -14,13 +14,15 @@ export default class ColorPicker extends React.Component<IColorPickerProps, ICol
|
|
|
14
14
|
visible: boolean;
|
|
15
15
|
selectedColor: any;
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
constructor(props: IColorPickerProps);
|
|
18
18
|
componentWillReceiveProps(nextProps: IColorPickerProps): void;
|
|
19
19
|
componentDidMount(): void;
|
|
20
|
-
handleChange: (color:
|
|
20
|
+
handleChange: (color: string) => void;
|
|
21
21
|
visibleToggle: () => void;
|
|
22
22
|
cancel: () => void;
|
|
23
23
|
accept: () => void;
|
|
24
|
-
render(): JSX.Element;
|
|
24
|
+
render(): React.JSX.Element;
|
|
25
|
+
/** Renders the inner color picker components without the modal */
|
|
26
|
+
static render(color: string, onChange: (value: string) => void): JSX.Element;
|
|
25
27
|
}
|
|
26
28
|
export {};
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { __decorate, __extends } from "tslib";
|
|
1
|
+
import { __decorate, __extends, __metadata } from "tslib";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { observer } from 'mobx-react';
|
|
4
4
|
import { NeoReactTypes } from '../Modules/Types';
|
|
5
5
|
import { Misc } from '@singularsystems/neo-core';
|
|
6
6
|
var ColorPicker = /** @class */ (function (_super) {
|
|
7
7
|
__extends(ColorPicker, _super);
|
|
8
|
-
function ColorPicker() {
|
|
9
|
-
var _this = _super
|
|
8
|
+
function ColorPicker(props) {
|
|
9
|
+
var _this = _super.call(this, props) || this;
|
|
10
10
|
_this.state = {
|
|
11
11
|
visible: false,
|
|
12
12
|
selectedColor: _this.props.bind.value
|
|
13
13
|
};
|
|
14
|
-
_this.sketchPickerImplementation = Misc.Globals.appService.get(NeoReactTypes.Components.SketchPicker);
|
|
15
14
|
_this.handleChange = function (color) {
|
|
16
15
|
// Set the color value
|
|
17
|
-
_this.setState({ selectedColor: color
|
|
16
|
+
_this.setState({ selectedColor: color });
|
|
18
17
|
};
|
|
19
18
|
_this.visibleToggle = function () {
|
|
20
19
|
_this.setState({ visible: !_this.state.visible });
|
|
@@ -32,8 +31,10 @@ var ColorPicker = /** @class */ (function (_super) {
|
|
|
32
31
|
_this.props.onChangeEvent();
|
|
33
32
|
}
|
|
34
33
|
};
|
|
34
|
+
_this.handleChange = _this.handleChange.bind(_this);
|
|
35
35
|
return _this;
|
|
36
36
|
}
|
|
37
|
+
ColorPicker_1 = ColorPicker;
|
|
37
38
|
ColorPicker.prototype.componentWillReceiveProps = function (nextProps) {
|
|
38
39
|
if (nextProps.bind.value !== this.state.selectedColor) {
|
|
39
40
|
// Update the state selectedColor if the color that was in the bind was changed
|
|
@@ -54,13 +55,27 @@ var ColorPicker = /** @class */ (function (_super) {
|
|
|
54
55
|
React.createElement("div", { className: "overlay-area", onClick: function () { return _this.cancel(); } }),
|
|
55
56
|
React.createElement("div", { className: "picker-container" },
|
|
56
57
|
React.createElement("div", { className: "picker-block" },
|
|
57
|
-
|
|
58
|
+
ColorPicker_1.render(this.state.selectedColor, this.handleChange),
|
|
58
59
|
React.createElement("div", { className: "action-container" },
|
|
59
60
|
React.createElement("div", { className: "btn btn-primary btn-sm", onClick: function () { return _this.accept(); } }, "Accept"),
|
|
60
|
-
React.createElement("div", { className: "btn btn-secondary btn-sm ml-1
|
|
61
|
+
React.createElement("div", { className: "btn btn-secondary btn-sm ml-1", onClick: function () { return _this.cancel(); } }, "Cancel"))))))));
|
|
61
62
|
};
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
/** Renders the inner color picker components without the modal */
|
|
64
|
+
ColorPicker.render = function (color, onChange) {
|
|
65
|
+
var sketchPicker = Misc.Globals.appService.tryGet(NeoReactTypes.Components.SketchPicker);
|
|
66
|
+
if (sketchPicker) {
|
|
67
|
+
return React.createElement(sketchPicker, { color: color, onChange: function (c) { return onChange(c.hex); } });
|
|
68
|
+
}
|
|
69
|
+
var colorPicker = Misc.Globals.appService.tryGet(NeoReactTypes.Components.ColorPicker);
|
|
70
|
+
if (colorPicker) {
|
|
71
|
+
return React.createElement(colorPicker, { color: color, onChange: onChange });
|
|
72
|
+
}
|
|
73
|
+
return React.createElement("input", { type: "color", value: color, onInput: function (e) { return onChange(e.target.value); } });
|
|
74
|
+
};
|
|
75
|
+
var ColorPicker_1;
|
|
76
|
+
ColorPicker = ColorPicker_1 = __decorate([
|
|
77
|
+
observer,
|
|
78
|
+
__metadata("design:paramtypes", [Object])
|
|
64
79
|
], ColorPicker);
|
|
65
80
|
return ColorPicker;
|
|
66
81
|
}(React.Component));
|
|
@@ -21,5 +21,5 @@ export default class ContextMenu extends ComponentBase<IContextMenuProps> {
|
|
|
21
21
|
private hoverItem;
|
|
22
22
|
mouseEnter(e: React.MouseEvent<HTMLDivElement>, item: Components.IMenuItem): void;
|
|
23
23
|
afterRender(): void;
|
|
24
|
-
render(): JSX.Element;
|
|
24
|
+
render(): React.JSX.Element;
|
|
25
25
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { makeObservable, observable } from "mobx";
|
|
3
|
-
|
|
3
|
+
var ContextMenuState = /** @class */ (function () {
|
|
4
4
|
function ContextMenuState() {
|
|
5
5
|
this.show = false;
|
|
6
6
|
this.items = [];
|
|
@@ -21,3 +21,4 @@ export var ContextMenuState = /** @class */ (function () {
|
|
|
21
21
|
], ContextMenuState.prototype, "position", void 0);
|
|
22
22
|
return ContextMenuState;
|
|
23
23
|
}());
|
|
24
|
+
export { ContextMenuState };
|
|
@@ -92,7 +92,7 @@ export default class AutoCompleteDropDown<T> extends DropDownBase<T, IAutoComple
|
|
|
92
92
|
private onKeyPress;
|
|
93
93
|
private mapTArrayToOptions;
|
|
94
94
|
private onItemSelected;
|
|
95
|
-
render(): JSX.Element;
|
|
95
|
+
render(): React.JSX.Element;
|
|
96
96
|
private getOption;
|
|
97
97
|
}
|
|
98
98
|
export {};
|
|
@@ -11,9 +11,8 @@ import { NeoReactTypes } from '../../Modules/Types';
|
|
|
11
11
|
var AutoCompleteDropDown = /** @class */ (function (_super) {
|
|
12
12
|
__extends(AutoCompleteDropDown, _super);
|
|
13
13
|
function AutoCompleteDropDown(props) {
|
|
14
|
-
var _this = this;
|
|
15
14
|
var _a;
|
|
16
|
-
_this = _super.call(this, props) || this;
|
|
15
|
+
var _this = _super.call(this, props) || this;
|
|
17
16
|
_this.asyncSelectImplementation = Misc.Globals.appService.get(NeoReactTypes.Components.AsyncSelect);
|
|
18
17
|
_this.selectImplementation = Misc.Globals.appService.get(NeoReactTypes.Components.ReactSelect);
|
|
19
18
|
_this.onKeyPress = _this.onKeyPress.bind(_this);
|
|
@@ -36,9 +36,11 @@ var DropDown = /** @class */ (function (_super) {
|
|
|
36
36
|
});
|
|
37
37
|
DropDown.prototype.createLookupIndex = function (list) {
|
|
38
38
|
var _this = this;
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
var index = {};
|
|
40
|
+
//@ts-ignore
|
|
41
|
+
list[this.listIndexSymbol] = index;
|
|
41
42
|
list.forEach(function (item) { return index[item[_this.valueMember]] = item; });
|
|
43
|
+
return index;
|
|
42
44
|
};
|
|
43
45
|
DropDown.prototype.getSelectedOption = function (value) {
|
|
44
46
|
if (!this.sortByValue) {
|
|
@@ -46,16 +48,18 @@ var DropDown = /** @class */ (function (_super) {
|
|
|
46
48
|
}
|
|
47
49
|
if (!this.selectedItem || this.selectedItem[this.valueMember] != value) {
|
|
48
50
|
var list = this.items;
|
|
51
|
+
//@ts-ignore
|
|
52
|
+
var index = list[this.listIndexSymbol];
|
|
49
53
|
var indexJustCreated = false;
|
|
50
|
-
if (!
|
|
51
|
-
this.createLookupIndex(list);
|
|
54
|
+
if (!index) {
|
|
55
|
+
index = this.createLookupIndex(list);
|
|
52
56
|
indexJustCreated = true;
|
|
53
57
|
}
|
|
54
|
-
this.selectedItem =
|
|
58
|
+
this.selectedItem = index[value];
|
|
55
59
|
if (value && !this.selectedItem && !indexJustCreated) {
|
|
56
60
|
// Index may be out of date.
|
|
57
|
-
this.createLookupIndex(list);
|
|
58
|
-
this.selectedItem =
|
|
61
|
+
index = this.createLookupIndex(list);
|
|
62
|
+
this.selectedItem = index[value];
|
|
59
63
|
}
|
|
60
64
|
if (!this.selectedItem) {
|
|
61
65
|
// create default item.
|
|
@@ -2,8 +2,8 @@ import { Data, Model } from '@singularsystems/neo-core';
|
|
|
2
2
|
import ComponentBase from '../ComponentBase';
|
|
3
3
|
export type ItemSource<T> = T[] | Promise<T[]> | Data.IAsyncDataSource<T[]> | Data.IArrayCacheEntry<T>;
|
|
4
4
|
export declare abstract class DropDownBase<T, TProps> extends ComponentBase<TProps> {
|
|
5
|
-
protected valueMember:
|
|
6
|
-
protected displayMember:
|
|
5
|
+
protected valueMember: keyof T;
|
|
6
|
+
protected displayMember: keyof T;
|
|
7
7
|
protected findMembers(item: any): void;
|
|
8
8
|
protected isLoading: boolean;
|
|
9
9
|
protected dataSource: Data.IAsyncDataSource<T[]> | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export interface ILookupMembers {
|
|
2
|
-
valueMember:
|
|
3
|
-
displayMember:
|
|
1
|
+
export interface ILookupMembers<T> {
|
|
2
|
+
valueMember: keyof T;
|
|
3
|
+
displayMember: keyof T;
|
|
4
4
|
}
|
|
5
5
|
export default class LookupHelper {
|
|
6
6
|
/**
|
|
@@ -9,5 +9,5 @@ export default class LookupHelper {
|
|
|
9
9
|
* @param item An object instance
|
|
10
10
|
* @param booleanValuesAllowed True if boolean values are allowed in the value member.
|
|
11
11
|
*/
|
|
12
|
-
static findMembers(item: any, valueMember:
|
|
12
|
+
static findMembers<T>(item: any, valueMember: keyof T, displayMember: keyof T, booleanValuesAllowed?: boolean): ILookupMembers<T>;
|
|
13
13
|
}
|
|
@@ -15,7 +15,7 @@ var ErrorGroup = /** @class */ (function () {
|
|
|
15
15
|
], ErrorGroup.prototype, "count", void 0);
|
|
16
16
|
return ErrorGroup;
|
|
17
17
|
}());
|
|
18
|
-
|
|
18
|
+
var ErrorHandler = /** @class */ (function (_super) {
|
|
19
19
|
__extends(ErrorHandler, _super);
|
|
20
20
|
function ErrorHandler(notifications) {
|
|
21
21
|
var _this = _super.call(this, notifications) || this;
|
|
@@ -90,3 +90,4 @@ export var ErrorHandler = /** @class */ (function (_super) {
|
|
|
90
90
|
], ErrorHandler.prototype, "hidingErrorList", void 0);
|
|
91
91
|
return ErrorHandler;
|
|
92
92
|
}(Components.ErrorHandler));
|
|
93
|
+
export { ErrorHandler };
|
|
@@ -14,9 +14,9 @@ var FileBasicInput = /** @class */ (function (_super) {
|
|
|
14
14
|
return _this;
|
|
15
15
|
}
|
|
16
16
|
FileBasicInput.prototype.onFileSelected = function (e) {
|
|
17
|
-
var _a, _b;
|
|
18
17
|
return __awaiter(this, void 0, void 0, function () {
|
|
19
18
|
var input;
|
|
19
|
+
var _a, _b;
|
|
20
20
|
return __generator(this, function (_c) {
|
|
21
21
|
switch (_c.label) {
|
|
22
22
|
case 0:
|
|
@@ -55,6 +55,7 @@ var FileBasicInput = /** @class */ (function (_super) {
|
|
|
55
55
|
}
|
|
56
56
|
var bindProperty = this.fileManager.options.bind;
|
|
57
57
|
if (bindProperty) {
|
|
58
|
+
// @ts-ignore
|
|
58
59
|
native[BindPropsHelper.DataFieldName] = bindProperty.propertyInfo.propertyName;
|
|
59
60
|
}
|
|
60
61
|
var fileManagerProps = this.fileManager.getFileInputProps();
|
|
@@ -12,5 +12,5 @@ export interface IFileContextProps {
|
|
|
12
12
|
}
|
|
13
13
|
export declare const FileContext: React.Context<IFileContextProps>;
|
|
14
14
|
export default class FileContextProvider extends React.Component<IFileComponentProps & (Partial<Components.IFileManagerOptions> | Partial<Components.IBoundFileManagerOptions>)> {
|
|
15
|
-
render(): JSX.Element;
|
|
15
|
+
render(): React.JSX.Element;
|
|
16
16
|
}
|
|
@@ -32,7 +32,7 @@ export default class FileInput extends ComponentBase<IFileEditorProps> {
|
|
|
32
32
|
private fileManager;
|
|
33
33
|
private gettingDownloadUrl;
|
|
34
34
|
constructor(props: IFileEditorProps);
|
|
35
|
-
render(): JSX.Element;
|
|
35
|
+
render(): React.JSX.Element;
|
|
36
36
|
private getFileDisplayComponent;
|
|
37
37
|
/** Renders when the file is busy uploading. */
|
|
38
38
|
private renderBusy;
|
|
@@ -12,6 +12,6 @@ export default class FileUploadButton extends React.Component<IFileUploadButtonP
|
|
|
12
12
|
private fileInputRef;
|
|
13
13
|
constructor(props: IFileUploadButtonProps & React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>);
|
|
14
14
|
private browseButtonClicked;
|
|
15
|
-
render(): JSX.Element;
|
|
15
|
+
render(): React.JSX.Element;
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -10,5 +10,5 @@ export default class FileUploadProgress extends React.Component<IFileUploadProps
|
|
|
10
10
|
static contextType: React.Context<import("./FileContext").IFileContextProps>;
|
|
11
11
|
context: React.ContextType<typeof FileContext>;
|
|
12
12
|
private fileManager;
|
|
13
|
-
render(): false | JSX.Element;
|
|
13
|
+
render(): false | React.JSX.Element;
|
|
14
14
|
}
|
|
@@ -24,7 +24,7 @@ export var FormContext = React.createContext(new FormContextParams());
|
|
|
24
24
|
/**
|
|
25
25
|
* Allows the attributes of multiple child form controls to be set at a parent level.
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
var FormContextProvider = /** @class */ (function (_super) {
|
|
28
28
|
__extends(FormContextProvider, _super);
|
|
29
29
|
function FormContextProvider() {
|
|
30
30
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
@@ -37,3 +37,4 @@ export var FormContextProvider = /** @class */ (function (_super) {
|
|
|
37
37
|
FormContextProvider.contextType = FormContext;
|
|
38
38
|
return FormContextProvider;
|
|
39
39
|
}(React.Component));
|
|
40
|
+
export { FormContextProvider };
|
|
@@ -31,7 +31,7 @@ export declare class FormGroupBase<T extends IFormGroupProps<TData>, TData> exte
|
|
|
31
31
|
context: React.ContextType<typeof FormContext>;
|
|
32
32
|
protected getFormGroupClasses(domProps: React.HTMLProps<HTMLDivElement>, isCheckBox: boolean): IFormGroupClasses;
|
|
33
33
|
protected hideLabelForCheckboxes(): boolean;
|
|
34
|
-
render(): JSX.Element;
|
|
34
|
+
render(): React.JSX.Element;
|
|
35
35
|
}
|
|
36
36
|
export default class FormGroup<TData> extends FormGroupBase<IFormGroupProps<TData>, TData> {
|
|
37
37
|
}
|
|
@@ -5,7 +5,7 @@ import { BindPropsHelper, CheckboxType } from '../PropTypes';
|
|
|
5
5
|
import { Validation, Utils } from '@singularsystems/neo-core';
|
|
6
6
|
import ComponentBase from '../ComponentBase';
|
|
7
7
|
import { EditorParentType, FormContext } from '../FormContext';
|
|
8
|
-
|
|
8
|
+
var FormGroupBase = /** @class */ (function (_super) {
|
|
9
9
|
__extends(FormGroupBase, _super);
|
|
10
10
|
function FormGroupBase() {
|
|
11
11
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
@@ -70,6 +70,7 @@ export var FormGroupBase = /** @class */ (function (_super) {
|
|
|
70
70
|
FormGroupBase.contextType = FormContext;
|
|
71
71
|
return FormGroupBase;
|
|
72
72
|
}(ComponentBase));
|
|
73
|
+
export { FormGroupBase };
|
|
73
74
|
var FormGroup = /** @class */ (function (_super) {
|
|
74
75
|
__extends(FormGroup, _super);
|
|
75
76
|
function FormGroup() {
|
|
@@ -6,6 +6,6 @@ export default class FormGroupInline<TData> extends FormGroupBase<IInlineFormGro
|
|
|
6
6
|
private contextProps?;
|
|
7
7
|
protected hideLabelForCheckboxes(): boolean;
|
|
8
8
|
protected getFormGroupClasses(domProps: React.HTMLProps<HTMLDivElement>, isCheckBox: boolean): IFormGroupClasses;
|
|
9
|
-
render(): JSX.Element;
|
|
9
|
+
render(): React.JSX.Element;
|
|
10
10
|
}
|
|
11
11
|
export {};
|