@singularsystems/neo-core 0.10.79 → 0.10.80

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.
@@ -26,10 +26,13 @@ export declare class DebounceHelper<T = void, TState = any> {
26
26
  * @param state State to pass to debounced method as an array of values for each time debounce was called.
27
27
  */
28
28
  static debounce<T = any, TState = any>(syncInstance: any, callback: (state: TState[]) => T | Promise<T>, delayMs: number, state?: TState): Promise<IDebounceResult<T>>;
29
+ static hasPending(syncInstance: any): boolean;
29
30
  /** Cancels pending execution of the callback. Pending promise will be resolved with cancelled: true. */
30
31
  static cancelPending<TState = any>(syncInstance: any): TState[];
31
32
  /** Fires the latest callback immediately. Pending promise from execute() will also be resolved with the return value of the callback. */
32
33
  static executeImmediate(syncInstance: any): Promise<void>;
34
+ /** Indicates that there is a pending execution. */
35
+ get hasPending(): boolean;
33
36
  /**
34
37
  * Waits the interval defined in the constructor, then executes the callback.
35
38
  * The callback will not execute if execute is called again within the interval.
@@ -32,6 +32,15 @@ var DebounceHelper = /** @class */ (function () {
32
32
  helper.delayMs = delayMs;
33
33
  return helper.execute(state);
34
34
  };
35
+ DebounceHelper.hasPending = function (syncInstance) {
36
+ var helper = syncInstance[stateSymbol];
37
+ if (helper) {
38
+ return helper.hasPending;
39
+ }
40
+ else {
41
+ return false;
42
+ }
43
+ };
35
44
  /** Cancels pending execution of the callback. Pending promise will be resolved with cancelled: true. */
36
45
  DebounceHelper.cancelPending = function (syncInstance) {
37
46
  var helper = syncInstance[stateSymbol];
@@ -52,6 +61,14 @@ var DebounceHelper = /** @class */ (function () {
52
61
  return Promise.resolve();
53
62
  }
54
63
  };
64
+ Object.defineProperty(DebounceHelper.prototype, "hasPending", {
65
+ /** Indicates that there is a pending execution. */
66
+ get: function () {
67
+ return this.currentResolver !== undefined;
68
+ },
69
+ enumerable: false,
70
+ configurable: true
71
+ });
55
72
  /**
56
73
  * Waits the interval defined in the constructor, then executes the callback.
57
74
  * The callback will not execute if execute is called again within the interval.
@@ -54,10 +54,12 @@ export interface IDisposable {
54
54
  dispose(): void;
55
55
  }
56
56
  export interface IAutoRunner extends IDisposable {
57
+ /** Indicates whether there are any pending callbacks. */
58
+ readonly hasPending: boolean;
57
59
  /** Dispose the auto runner. */
58
60
  dispose(): void;
59
- /** Cancels any pending callbacks. */
60
- cancelPending(): void;
61
+ /** Cancels any pending callbacks. Returns true if there were any pending callbacks. */
62
+ cancelPending(): boolean;
61
63
  /** Cancels any pending callbacks, and fires the callback immediately. */
62
64
  fireImmediate(): void;
63
65
  }
@@ -25,7 +25,7 @@ var ObservableProperty = /** @class */ (function () {
25
25
  var model = new ObservableModel();
26
26
  model.value = defaultValue;
27
27
  var propertyInfo = new PropertyInfo("value");
28
- Utils.populatePartialWithDefaults(propertyInfo, options);
28
+ Utils.populatePartialWithDefaults(propertyInfo, options, true);
29
29
  propertyInfo.displayName = displayName;
30
30
  if (isRequired) {
31
31
  propertyInfo.rules.push(new RequiredRule("{0} is required."));
package/dist/Utils.d.ts CHANGED
@@ -55,8 +55,9 @@ export declare class Utils {
55
55
  * Completes a partially populated object using defaults specified in the defaults parameter.
56
56
  * @param partial Partially populated object
57
57
  * @param defaults Defaults object.
58
+ * @param force True if the properties in `partial` must be set even if they have a value.
58
59
  */
59
- static populatePartialWithDefaults<T>(partial: Partial<T> | undefined, defaults: T): T;
60
+ static populatePartialWithDefaults<T>(partial: Partial<T> | undefined, defaults: T, force?: boolean): T;
60
61
  /**
61
62
  * Converts a string like 'user' to 'fa fa-user' or 'fa-user' to 'fa fa-user' or 'far-user' to 'far fa-user'
62
63
  */
package/dist/Utils.js CHANGED
@@ -1,4 +1,4 @@
1
- import { __assign, __spreadArray } from "tslib";
1
+ import { __spreadArray } from "tslib";
2
2
  import { DebounceHelper } from './DebounceHelper';
3
3
  import { ensureTypeInfo } from './Model/NeoTypeInfo';
4
4
  var lut = [];
@@ -101,11 +101,17 @@ var Utils = /** @class */ (function () {
101
101
  * Completes a partially populated object using defaults specified in the defaults parameter.
102
102
  * @param partial Partially populated object
103
103
  * @param defaults Defaults object.
104
+ * @param force True if the properties in `partial` must be set even if they have a value.
104
105
  */
105
- Utils.populatePartialWithDefaults = function (partial, defaults) {
106
+ Utils.populatePartialWithDefaults = function (partial, defaults, force) {
107
+ if (force === void 0) { force = false; }
106
108
  if (!partial)
107
- return defaults;
108
- return __assign(__assign({}, defaults), partial);
109
+ partial = {};
110
+ for (var key in defaults) {
111
+ if (force || !partial[key])
112
+ partial[key] = defaults[key];
113
+ }
114
+ return partial;
109
115
  };
110
116
  /**
111
117
  * Converts a string like 'user' to 'fa fa-user' or 'fa-user' to 'fa fa-user' or 'far-user' to 'far fa-user'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-core",
3
- "version": "0.10.79",
3
+ "version": "0.10.80",
4
4
  "description": "Core functionality for the Neo client library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",