@singularsystems/neo-core 1.0.9 → 1.0.11

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,7 +1,7 @@
1
1
  import { IAsyncDataSource } from "./AsyncDataSource";
2
2
  export interface IDataCacheEntry {
3
3
  expire(refetch?: boolean): void;
4
- get(): IAsyncDataSource<any>;
4
+ get(clearPreviousError?: boolean): IAsyncDataSource<any>;
5
5
  /**
6
6
  * Will return true if the data has expired, or the data source is loading.
7
7
  */
@@ -1,5 +1,6 @@
1
1
  import { UserEventBase } from './UserEvent';
2
2
  export declare class ReasonedUserEvent extends UserEventBase {
3
+ constructor();
3
4
  reason: string;
4
5
  static None(): ReasonedUserEvent;
5
6
  }
@@ -1,24 +1,21 @@
1
1
  import { __decorate, __extends, __metadata } from "tslib";
2
2
  import { UserEventBase } from './UserEvent';
3
- import NeoModel from '../NeoModel';
4
3
  import { StringLength } from '../../Validation/Decorators';
5
4
  var ReasonedUserEvent = /** @class */ (function (_super) {
6
5
  __extends(ReasonedUserEvent, _super);
7
6
  function ReasonedUserEvent() {
8
- return _super !== null && _super.apply(this, arguments) || this;
7
+ var _this = _super.call(this) || this;
8
+ _this.reason = "";
9
+ _this.makeObservable();
10
+ return _this;
9
11
  }
10
- ReasonedUserEvent_1 = ReasonedUserEvent;
11
12
  ReasonedUserEvent.None = function () {
12
- return new ReasonedUserEvent_1();
13
+ return new ReasonedUserEvent();
13
14
  };
14
- var ReasonedUserEvent_1;
15
15
  __decorate([
16
16
  StringLength(255),
17
17
  __metadata("design:type", String)
18
18
  ], ReasonedUserEvent.prototype, "reason", void 0);
19
- ReasonedUserEvent = ReasonedUserEvent_1 = __decorate([
20
- NeoModel
21
- ], ReasonedUserEvent);
22
19
  return ReasonedUserEvent;
23
20
  }(UserEventBase));
24
21
  export { ReasonedUserEvent };
@@ -5,5 +5,6 @@ export declare abstract class UserEventBase extends ValueObject {
5
5
  get isCompleted(): boolean;
6
6
  }
7
7
  export declare class UserEvent extends UserEventBase {
8
+ constructor();
8
9
  static None(): UserEvent;
9
10
  }
@@ -1,7 +1,6 @@
1
1
  import { __decorate, __extends, __metadata } from "tslib";
2
2
  import ValueObject from '../ValueObject';
3
3
  import { Date as DateAttribute } from '../Decorators';
4
- import NeoModel from '../NeoModel';
5
4
  var UserEventBase = /** @class */ (function (_super) {
6
5
  __extends(UserEventBase, _super);
7
6
  function UserEventBase() {
@@ -27,16 +26,13 @@ export { UserEventBase };
27
26
  var UserEvent = /** @class */ (function (_super) {
28
27
  __extends(UserEvent, _super);
29
28
  function UserEvent() {
30
- return _super !== null && _super.apply(this, arguments) || this;
29
+ var _this = _super.call(this) || this;
30
+ _this.makeObservable();
31
+ return _this;
31
32
  }
32
- UserEvent_1 = UserEvent;
33
33
  UserEvent.None = function () {
34
- return new UserEvent_1();
34
+ return new UserEvent();
35
35
  };
36
- var UserEvent_1;
37
- UserEvent = UserEvent_1 = __decorate([
38
- NeoModel
39
- ], UserEvent);
40
36
  return UserEvent;
41
37
  }(UserEventBase));
42
38
  export { UserEvent };
@@ -32,6 +32,9 @@ export declare class ContainerValidationState extends ValidationState {
32
32
  private displayInfoSome;
33
33
  brokenRules: Array<RuleContextBase>;
34
34
  get hasDetail(): boolean;
35
+ private _isBusy;
36
+ /** Indicates that an async rule is in progress. */
37
+ get isBusy(): boolean;
35
38
  /**
36
39
  * Gets the error display information.
37
40
  * @param canDisplayAll True if the bound controls have de-focused, or the form attempted to submit.
@@ -37,6 +37,7 @@ var ContainerValidationState = /** @class */ (function (_super) {
37
37
  function ContainerValidationState() {
38
38
  var _this = _super !== null && _super.apply(this, arguments) || this;
39
39
  _this.brokenRules = [];
40
+ _this._isBusy = false;
40
41
  return _this;
41
42
  }
42
43
  Object.defineProperty(ContainerValidationState.prototype, "hasDetail", {
@@ -46,6 +47,14 @@ var ContainerValidationState = /** @class */ (function (_super) {
46
47
  enumerable: false,
47
48
  configurable: true
48
49
  });
50
+ Object.defineProperty(ContainerValidationState.prototype, "isBusy", {
51
+ /** Indicates that an async rule is in progress. */
52
+ get: function () {
53
+ return this._isBusy;
54
+ },
55
+ enumerable: false,
56
+ configurable: true
57
+ });
49
58
  /**
50
59
  * Gets the error display information.
51
60
  * @param canDisplayAll True if the bound controls have de-focused, or the form attempted to submit.
@@ -68,6 +77,9 @@ var ContainerValidationState = /** @class */ (function (_super) {
68
77
  ContainerValidationState.prototype.update = function (ruleState) {
69
78
  this.severity = Math.max(this.severity, ruleState.severity);
70
79
  this.forceDisplaySeverity = Math.max(this.forceDisplaySeverity, ruleState.forceDisplaySeverity);
80
+ if (ruleState.severity === RuleSeverity.AsyncBusy || ruleState.forceDisplaySeverity === RuleSeverity.AsyncBusy) {
81
+ this._isBusy = true;
82
+ }
71
83
  };
72
84
  return ContainerValidationState;
73
85
  }(ValidationState));
@@ -8,6 +8,8 @@ export default interface IModelValidator {
8
8
  /** Causes all errors to be displayed regardless of ValidationDisplayMode. */
9
9
  forceShowErrors: boolean;
10
10
  readonly isValid: boolean;
11
+ /** Indicates that an async rule is in progress. */
12
+ readonly isBusy: boolean;
11
13
  /** The max current severity of all rules in this object. */
12
14
  readonly severity: RuleSeverity;
13
15
  /**
@@ -23,6 +23,7 @@ export default class ModelValidator implements IModelValidator {
23
23
  forceShowErrors: boolean;
24
24
  get ruleState(): ContainerValidationState;
25
25
  get isValid(): boolean;
26
+ get isBusy(): boolean;
26
27
  get severity(): import("../ValidationState").RuleSeverity;
27
28
  private checkRules;
28
29
  /**
@@ -63,6 +63,13 @@ var ModelValidator = /** @class */ (function () {
63
63
  enumerable: false,
64
64
  configurable: true
65
65
  });
66
+ Object.defineProperty(ModelValidator.prototype, "isBusy", {
67
+ get: function () {
68
+ return this.ruleState.isBusy;
69
+ },
70
+ enumerable: false,
71
+ configurable: true
72
+ });
66
73
  Object.defineProperty(ModelValidator.prototype, "severity", {
67
74
  get: function () {
68
75
  return this.ruleState.severity;
@@ -14,7 +14,7 @@ export default class PropertyValidator implements IPropertyValidator {
14
14
  get ruleState(): ContainerValidationState;
15
15
  get isValid(): boolean;
16
16
  private checkRules;
17
- /** Infomation about the errors that must be shown on the UI. Independent from whether or not the property is valid. */
17
+ /** Information about the errors that must be shown on the UI. Independent from whether or not the property is valid. */
18
18
  getDisplayState(validationMode: ValidationDisplayMode): ValidationDisplayInfo;
19
19
  /** True if the validation state is final, e.g. the property has blurred, or validation display mode is always. */
20
20
  canDisplayAll(validationMode: ValidationDisplayMode): boolean;
@@ -35,7 +35,7 @@ var PropertyValidator = /** @class */ (function () {
35
35
  }
36
36
  }
37
37
  };
38
- /** Infomation about the errors that must be shown on the UI. Independent from whether or not the property is valid. */
38
+ /** Information about the errors that must be shown on the UI. Independent from whether or not the property is valid. */
39
39
  PropertyValidator.prototype.getDisplayState = function (validationMode) {
40
40
  if (validationMode === ValidationDisplayMode.Never) {
41
41
  return new ValidationDisplayInfo();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-core",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "Core functionality for the Neo client library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",