@singularsystems/neo-react 0.10.38 → 0.10.41

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.
@@ -10,9 +10,11 @@ import { AutoRunnerFactory } from '../React/AutoRunner';
10
10
  import { RoutingState } from '../Routing/RoutingState';
11
11
  import { ContextMenuState } from '../ReactComponents/ContextMenu/ContextMenuState';
12
12
  import { DisposeHelper } from '../Services/DisposeHelper';
13
+ import Decimal from 'decimal.js-light';
13
14
  var neoReactModule = new AppServices.Module("neo-react", function (container) {
14
15
  container.bind(AppServices.NeoTypes.Core.AutoRunnerFactory).to(AutoRunnerFactory).inSingletonScope();
15
16
  container.bind(AppServices.NeoTypes.Core.ModelCreator).to(ReactModelCreator).inTransientScope();
17
+ container.bind(AppServices.NeoTypes.Misc.DecimalType).toConstantValue(Decimal);
16
18
  container.bind(AppServices.NeoTypes.UI.ErrorHandler).to(ErrorHandler).inSingletonScope();
17
19
  container.bind(AppServices.NeoTypes.UI.GlobalContextMenuState).toConstantValue(new ContextMenuState());
18
20
  container.bind(AppServices.NeoTypes.Routing.PageLeaveHandler).to(PageLeaveHandler).inSingletonScope();
@@ -5,6 +5,7 @@ import Slider, { Range } from 'rc-slider';
5
5
  import { SketchPicker } from 'react-color';
6
6
  import AsyncSelect from 'react-select/async';
7
7
  import { AxiosStatic } from 'axios';
8
+ import Decimal from 'decimal.js-light';
8
9
  import Select from 'react-select';
9
10
  import { IDisposeHelper } from '../Services/IDisposeHelper';
10
11
  declare const NeoReactTypes: {
@@ -38,6 +39,9 @@ declare const NeoReactTypes: {
38
39
  Localisation: {
39
40
  LocalisationService: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/Localisation").ILocalisationService>;
40
41
  };
42
+ Misc: {
43
+ DecimalType: AppServices.ServiceIdentifier<typeof Decimal>;
44
+ };
41
45
  Security: {
42
46
  AuthenticationService: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/Security").IAuthenticationService>;
43
47
  AuthorisationService: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/Security").IAuthorisationService>;
@@ -80,7 +80,7 @@ var DropDown = /** @class */ (function (_super) {
80
80
  };
81
81
  DropDown.prototype.render = function () {
82
82
  var _this = this;
83
- var _a, _b, _c, _d, _e;
83
+ var _a, _b, _c, _d, _e, _f;
84
84
  var splitProps = BindPropsHelper.normaliseEditorProps(this, this.props);
85
85
  var domProps = BindPropsHelper.autoSetDomProperties(splitProps, this.context);
86
86
  domProps.className = Utils.joinWithSpaces(domProps.className, splitProps.isBootstrap ? "form-control" : "neo-forms-editor");
@@ -116,9 +116,10 @@ var DropDown = /** @class */ (function (_super) {
116
116
  domProps.disabled = true;
117
117
  }
118
118
  var valueIsBlank = value === undefined || value === null;
119
+ var nullText = (valueIsBlank || ((_d = splitProps.select) === null || _d === void 0 ? void 0 : _d.deSelectText) === undefined) ? (_e = splitProps.select) === null || _e === void 0 ? void 0 : _e.nullText : (_f = splitProps.select) === null || _f === void 0 ? void 0 : _f.deSelectText;
119
120
  control =
120
121
  React.createElement("select", __assign({ value: valueIsBlank ? "" : value, onChange: this.onItemSelected, ref: splitProps.editor.inputElement }, domProps),
121
- addBlankItem && React.createElement("option", null, valueIsBlank ? (_d = splitProps.select) === null || _d === void 0 ? void 0 : _d.nullText : (_e = splitProps.select) === null || _e === void 0 ? void 0 : _e.deSelectText),
122
+ addBlankItem && React.createElement("option", null, nullText),
122
123
  items.map(function (item) { return (React.createElement("option", { value: item[_this.valueMember], key: item[_this.valueMember] }, item[_this.displayMember])); }));
123
124
  }
124
125
  return (InputHelpers.surroundWithInputGroup(control, splitProps.editor));
@@ -32,8 +32,11 @@ var FileUploadButton = /** @class */ (function (_super) {
32
32
  buttonProps = {};
33
33
  if (!buttonProps.variant)
34
34
  buttonProps.variant = "light";
35
+ if (this.fileManager.isUploading && !this.fileManager.options.allowConcurrent) {
36
+ buttonProps.disabled = true;
37
+ }
35
38
  return (React.createElement(React.Fragment, null,
36
- React.createElement(Button, __assign({}, buttonProps, { disabled: !this.fileManager.options.allowConcurrent && this.fileManager.isUploading, onClick: this.browseButtonClicked }), this.props.children),
39
+ React.createElement(Button, __assign({}, buttonProps, { onClick: this.browseButtonClicked }), this.props.children),
37
40
  React.createElement(FileBasicInput, { fileManager: this.fileManager, isHidden: true, inputRef: this.fileInputRef })));
38
41
  };
39
42
  FileUploadButton.contextType = FileContext;
@@ -41,13 +41,16 @@ var Modal = /** @class */ (function (_super) {
41
41
  }
42
42
  }
43
43
  show = !!propertyInstance.value;
44
- onClose = function () {
44
+ onClose = function (event) {
45
45
  if (propertyInstance.value === true) {
46
46
  propertyInstance.value = false;
47
47
  }
48
48
  else {
49
49
  propertyInstance.value = null;
50
50
  }
51
+ if (_this.props.onClose) {
52
+ _this.props.onClose(event);
53
+ }
51
54
  };
52
55
  }
53
56
  else {
@@ -85,6 +88,9 @@ var Modal = /** @class */ (function (_super) {
85
88
  acceptButton.isSubmit = true;
86
89
  }
87
90
  }
91
+ else {
92
+ suppressForm = true;
93
+ }
88
94
  if (closeButton === undefined) {
89
95
  closeButton = {};
90
96
  }
@@ -45,7 +45,7 @@ var FormatState = /** @class */ (function () {
45
45
  return this.zeroText;
46
46
  }
47
47
  if (value !== undefined && value !== null) {
48
- if (value instanceof Decimal) {
48
+ if (value instanceof Misc.Globals.decimalType) {
49
49
  value = value.toNumber();
50
50
  }
51
51
  if (typeof value === "number") {
@@ -65,6 +65,8 @@ var FormatState = /** @class */ (function () {
65
65
  return FormatState;
66
66
  }());
67
67
  export { FormatState };
68
+ // Taken from https://github.com/MikeMcl/decimal.js-light/blob/master/decimal.js since it is not exported.
69
+ var validDecimalRegex = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
68
70
  var NumberInput = /** @class */ (function (_super) {
69
71
  __extends(NumberInput, _super);
70
72
  function NumberInput(props) {
@@ -85,6 +87,9 @@ var NumberInput = /** @class */ (function (_super) {
85
87
  if (e.target.value !== "" && isNaN(parseFloat(e.target.value))) {
86
88
  return;
87
89
  }
90
+ else if (!validDecimalRegex.test(e.target.value)) {
91
+ return;
92
+ }
88
93
  if (e.target.value == "") {
89
94
  newValue = this.props.bind.propertyInfo.allowNulls ? null : new Decimal(0);
90
95
  }
@@ -122,7 +127,7 @@ var NumberInput = /** @class */ (function (_super) {
122
127
  };
123
128
  NumberInput.prototype.getBindValueAsNumber = function () {
124
129
  var propertyValue = this.props.bind.value;
125
- if (propertyValue instanceof Decimal) {
130
+ if (propertyValue instanceof Misc.Globals.decimalType) {
126
131
  return propertyValue.toNumber();
127
132
  }
128
133
  else {
@@ -19,6 +19,7 @@ export default abstract class ViewModelBase extends ModelBase implements IViewMo
19
19
  registerReaction<T>(expression: () => T, effect: (value: T) => void): IReactionDisposer;
20
20
  /**
21
21
  * Instantiates, and registers a child view model that will be disposed when this view model is disposed.
22
+ * The task runner will be passed to the new vm from this one.
22
23
  * @param viewModel View model type.
23
24
  */
24
25
  registerViewModel<TViewModel extends IViewModel>(viewModel: new () => TViewModel, options?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-react",
3
- "version": "0.10.38",
3
+ "version": "0.10.41",
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.44",
36
+ "@singularsystems/neo-core": "^0.10.49",
37
37
  "axios": "^0.21.1",
38
38
  "decimal.js-light": "2.5.1",
39
39
  "history": "4.10.1",
package/styles/Modal.scss CHANGED
@@ -14,16 +14,12 @@ body.has-modal-scroll-fix {
14
14
  .modal-container {
15
15
  position: relative;
16
16
  outline: none;
17
+ transition: opacity .3s linear;
17
18
 
18
19
  &.modal-container-additional {
19
- transition: transform .3s ease-out, opacity .3s linear;
20
- transform: translate(0, -50%);
20
+ transition: transform .3s ease-out, opacity .3s linear, margin .3s ease;
21
21
  opacity: 0;
22
-
23
- &.show {
24
- transform: translate(0, 0);
25
-
26
- }
22
+
27
23
  &.show:not(.inactive) {
28
24
  opacity: 1;
29
25
  }