@singularsystems/neo-react 0.10.48 → 0.10.49

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.
@@ -1,5 +1,5 @@
1
1
  import { __decorate } from "tslib";
2
- import { Utils, Misc } from '@singularsystems/neo-core';
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 () {
@@ -24,7 +24,10 @@ var AutoRunner = /** @class */ (function () {
24
24
  this.disposerImmediate = reaction(function () { return _this.accessAllValues(model, false, new Map(), ""); }, function () { return _this.runCallback(model, callback, 0); });
25
25
  }
26
26
  AutoRunner.prototype.cancelPending = function () {
27
- Utils.clearDebounce(this);
27
+ DebounceHelper.cancelPending(this);
28
+ };
29
+ AutoRunner.prototype.fireImmediate = function () {
30
+ DebounceHelper.executeImmediate(this);
28
31
  };
29
32
  AutoRunner.prototype.dispose = function () {
30
33
  this.disposerDelayed();
@@ -33,7 +36,7 @@ var AutoRunner = /** @class */ (function () {
33
36
  AutoRunner.prototype.runCallback = function (model, callback, delay) {
34
37
  var _this = this;
35
38
  if (!this.isPaused) {
36
- Utils.debounce(this, function () {
39
+ DebounceHelper.debounce(this, function () {
37
40
  _this.isPaused = true;
38
41
  try {
39
42
  callback(model);
@@ -50,8 +50,9 @@ var AutoCompleteDropDown = /** @class */ (function (_super) {
50
50
  AutoCompleteDropDown.prototype.onItemSelected = function (args, action) {
51
51
  var onItemSelected = this.props.onItemSelected;
52
52
  if (this.props.bindItems) {
53
+ var itemsProperty = this.props.bindItems;
53
54
  // Multi select
54
- var itemList = this.props.bindItems.value;
55
+ var itemList = itemsProperty.value;
55
56
  var bindIdsList = this.props.bindIds;
56
57
  if (action.action === "select-option") {
57
58
  itemList.push({ id: action.option.value, display: action.option.label });
@@ -83,6 +84,7 @@ var AutoCompleteDropDown = /** @class */ (function (_super) {
83
84
  onItemSelected(undefined);
84
85
  }
85
86
  }
87
+ itemsProperty.attachedTo.isSelfDirty = true;
86
88
  }
87
89
  else if (this.props.bind) {
88
90
  // Single select
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Components } from '@singularsystems/neo-core';
3
- export interface IFileComponentProps extends Partial<Components.IBoundFileManagerOptions> {
3
+ export interface IFileComponentProps {
4
4
  /** File manager instance. Props that can be specified in file manager options will be ignored on this component. */
5
5
  fileManager?: Components.IFileManager;
6
6
  /** Upload endpoint. This is required when not using a file manager. */
@@ -10,6 +10,6 @@ export interface IFileContextProps {
10
10
  fileManager?: Components.IFileManager;
11
11
  }
12
12
  export declare const FileContext: React.Context<IFileContextProps>;
13
- export default class FileContextProvider extends React.Component<IFileComponentProps> {
13
+ export default class FileContextProvider extends React.Component<IFileComponentProps & (Partial<Components.IFileManagerOptions> | Partial<Components.IBoundFileManagerOptions>)> {
14
14
  render(): JSX.Element;
15
15
  }
@@ -1,9 +1,10 @@
1
1
  import * as React from 'react';
2
+ import { Components } from '@singularsystems/neo-core';
2
3
  import { FileContext, IFileComponentProps } from './FileContext';
3
4
  import { IButtonOptions } from '@singularsystems/neo-core/dist/Components/ButtonOptions';
4
5
  import ComponentBase from '../ComponentBase';
5
6
  import { AxiosPromise } from 'axios';
6
- export interface IFileEditorProps extends IFileComponentProps {
7
+ export interface IFileEditorProps extends IFileComponentProps, Partial<Components.IBoundFileManagerOptions> {
7
8
  /** Browse button options */
8
9
  browseButton?: IButtonOptions;
9
10
  /** Set this if you want to allow the user to choose a new file. */
@@ -49,8 +49,8 @@ export declare class ViewParameter implements IViewParameter {
49
49
  description: string;
50
50
  asNullableInt(): number | null;
51
51
  asString(): string;
52
- /** Sets the initial value, and returns true if the value changed. */
53
- setInitial(value: string | null): boolean;
52
+ /** Updates the current value, and returns true if the value changed. */
53
+ update(value: string | null): boolean;
54
54
  getParamString(state: {
55
55
  hasQuery: boolean;
56
56
  }): string;
@@ -51,14 +51,13 @@ var ViewParameter = /** @class */ (function () {
51
51
  ViewParameter.prototype.asString = function () {
52
52
  return this._value || "";
53
53
  };
54
- /** Sets the initial value, and returns true if the value changed. */
55
- ViewParameter.prototype.setInitial = function (value) {
54
+ /** Updates the current value, and returns true if the value changed. */
55
+ ViewParameter.prototype.update = function (value) {
56
56
  if (value)
57
57
  value = decodeURIComponent(value);
58
58
  if (value != this._value) {
59
59
  this.hasPendingValue = false;
60
60
  this.pendingValue = value;
61
- this.description = "";
62
61
  this._value = value;
63
62
  return true;
64
63
  }
@@ -93,7 +93,7 @@ var ViewParameterList = /** @class */ (function () {
93
93
  var value = match.params[param];
94
94
  if (value === undefined)
95
95
  value = null;
96
- if (viewParam.setInitial(value))
96
+ if (viewParam.update(value))
97
97
  hasChanged = true;
98
98
  }
99
99
  }
@@ -102,7 +102,7 @@ var ViewParameterList = /** @class */ (function () {
102
102
  for (var _i = 0, _a = this.params; _i < _a.length; _i++) {
103
103
  var viewParam = _a[_i];
104
104
  if (viewParam.routeParameter.isQuery) {
105
- if (viewParam.setInitial(queryParams.get(viewParam.name)))
105
+ if (viewParam.update(queryParams.get(viewParam.name)))
106
106
  hasChanged = true;
107
107
  }
108
108
  }
@@ -125,7 +125,7 @@ var ViewParameterList = /** @class */ (function () {
125
125
  if (typeof value === "number") {
126
126
  value = value.toString();
127
127
  }
128
- viewParam.setInitial(value);
128
+ viewParam.update(value);
129
129
  }
130
130
  }
131
131
  var state = { hasQuery: false };
@@ -73,14 +73,18 @@ var ViewModelBase = /** @class */ (function (_super) {
73
73
  for (var _i = 0; _i < arguments.length; _i++) {
74
74
  fns[_i] = arguments[_i];
75
75
  }
76
- for (var _a = 0, fns_1 = fns; _a < fns_1.length; _a++) {
77
- var fn = fns_1[_a];
78
- if (fn.name) {
79
- this[fn.name] = fn.bind(this);
80
- }
81
- else {
82
- throw "Cannot bind a function without a name.";
76
+ var prototype = this.constructor.prototype;
77
+ var _loop_1 = function (key) {
78
+ if (key !== "constructor" && prototype[key] instanceof Function && !this_1.hasOwnProperty(key)) {
79
+ if (fns.find(function (f) { return f === prototype[key]; })) {
80
+ this_1[key] = prototype[key].bind(this_1);
81
+ }
83
82
  }
83
+ };
84
+ var this_1 = this;
85
+ for (var _a = 0, _b = Object.getOwnPropertyNames(prototype); _a < _b.length; _a++) {
86
+ var key = _b[_a];
87
+ _loop_1(key);
84
88
  }
85
89
  };
86
90
  ViewModelBase.prototype.dispose = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-react",
3
- "version": "0.10.48",
3
+ "version": "0.10.49",
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.50",
36
+ "@singularsystems/neo-core": "^0.10.53",
37
37
  "axios": "^0.21.1",
38
38
  "decimal.js-light": "2.5.1",
39
39
  "history": "4.10.1",