@singularsystems/neo-core 0.10.52 → 0.10.54

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.
@@ -11,8 +11,8 @@ export interface IButtonOptions {
11
11
  /** Bootstrap outline */
12
12
  isOutline?: boolean;
13
13
  onClick?: (event: any, data?: any) => void;
14
- /** Font-awesome icon. Don't specify fa- */
15
- icon?: string;
14
+ /** Specify a string name if using font-awesome. No need to specify fa- */
15
+ icon?: any;
16
16
  /** Alignment of icon relative to text. Left by default. */
17
17
  iconAlignment?: "left" | "right";
18
18
  /** Button text. This should be set by providing html in the button tag itself. */
@@ -48,8 +48,8 @@ export interface IButtonOptions {
48
48
  export interface IButtonDropDownItem {
49
49
  /** Menu item text or component */
50
50
  text?: ElementOrText;
51
- /** Font awesome icon to show. */
52
- icon?: string;
51
+ /** Specify a string name if using font-awesome. No need to specify fa- */
52
+ icon?: any;
53
53
  /** Make this a non clickable header item. */
54
54
  header?: string;
55
55
  /** True if this should be a divider to seperate items. */
@@ -43,6 +43,7 @@ export declare abstract class FileManagerBase<TOptions extends IBaseFileManagerO
43
43
  constructor(options: TOptions);
44
44
  get uploadEndpoint(): string | undefined;
45
45
  options: TOptions;
46
+ protected get allowMultiple(): boolean;
46
47
  /**
47
48
  * Shows a file dialog and then calls processFiles.
48
49
  * onFilesSelected will be called if you need to handle the event.
@@ -74,5 +75,6 @@ export interface IFileManagerOptions extends IBaseFileManagerOptions {
74
75
  }
75
76
  export default class FileManager extends FileManagerBase<IFileManagerOptions> {
76
77
  getFileInputProps(): Partial<HTMLInputElement>;
78
+ protected get allowMultiple(): boolean;
77
79
  }
78
80
  export {};
@@ -47,6 +47,13 @@ var FileManagerBase = /** @class */ (function () {
47
47
  enumerable: true,
48
48
  configurable: true
49
49
  });
50
+ Object.defineProperty(FileManagerBase.prototype, "allowMultiple", {
51
+ get: function () {
52
+ return false;
53
+ },
54
+ enumerable: true,
55
+ configurable: true
56
+ });
50
57
  /**
51
58
  * Shows a file dialog and then calls processFiles.
52
59
  * onFilesSelected will be called if you need to handle the event.
@@ -91,6 +98,9 @@ var FileManagerBase = /** @class */ (function () {
91
98
  if (options === void 0) { options = {}; }
92
99
  return __awaiter(this, void 0, void 0, function () {
93
100
  return __generator(this, function (_a) {
101
+ if (files.length > 1 && !this.allowMultiple) {
102
+ files = [Array.from(files)[0]];
103
+ }
94
104
  if (this.validateFiles(files)) {
95
105
  if (this.options.onFilesSelected) {
96
106
  this.options.onFilesSelected(files, this);
@@ -249,6 +259,14 @@ var FileManager = /** @class */ (function (_super) {
249
259
  props.multiple = this.options.multiple === true;
250
260
  return props;
251
261
  };
262
+ Object.defineProperty(FileManager.prototype, "allowMultiple", {
263
+ get: function () {
264
+ var _a;
265
+ return _a = this.options.multiple, (_a !== null && _a !== void 0 ? _a : false);
266
+ },
267
+ enumerable: true,
268
+ configurable: true
269
+ });
252
270
  FileManager = __decorate([
253
271
  NeoModel
254
272
  ], FileManager);
@@ -8,8 +8,8 @@ export interface INotificationOptions extends ICollapsableOptions {
8
8
  show?: boolean;
9
9
  /** Refresh value which can be used to reset the auto close timer. */
10
10
  refreshValue?: number;
11
- /** Font awesome icon name. */
12
- icon?: string;
11
+ /** Specify a string name if using font-awesome. No need to specify fa- */
12
+ icon?: any;
13
13
  }
14
14
  export interface INotification {
15
15
  hide(): void;
@@ -230,6 +230,7 @@ var PageManager = /** @class */ (function (_super) {
230
230
  PageManager.prototype.reset = function () {
231
231
  this.initialFetchState = "none";
232
232
  this.data.set([]);
233
+ this._totalRecords = 0;
233
234
  };
234
235
  /**
235
236
  * Resets the sort properties. A new sort property can be provided.
@@ -9,6 +9,7 @@ export declare class DebounceHelper<T = void, TState = any> {
9
9
  private timer;
10
10
  private state;
11
11
  private currentResolver?;
12
+ private currentRejection?;
12
13
  /**
13
14
  * Creates a debounce helper instance.
14
15
  * @param callback Callback function to run. All state passed to the execute method from current and previous calls will be passed to the callback.
@@ -25,14 +26,19 @@ export declare class DebounceHelper<T = void, TState = any> {
25
26
  * @param state State to pass to debounced method as an array of values for each time debounce was called.
26
27
  */
27
28
  static debounce<T = any, TState = any>(syncInstance: any, callback: (state: TState[]) => T | Promise<T>, delayMs: number, state?: TState): Promise<IDebounceResult<T>>;
28
- /** Cancels pending execution of the callback. Any pending promises will be resolved with cancelled: true. */
29
+ /** Cancels pending execution of the callback. Pending promise will be resolved with cancelled: true. */
29
30
  static cancelPending<TState = any>(syncInstance: any): TState[];
31
+ /** Fires the latest callback immediately. Pending promise from execute() will also be resolved with the return value of the callback. */
32
+ static executeImmediate(syncInstance: any): Promise<void>;
30
33
  /**
31
34
  * Waits the interval defined in the constructor, then executes the callback.
32
35
  * The callback will not execute if execute is called again within the interval.
33
36
  * @param state State to pass to the callback.
34
37
  */
35
38
  execute(state?: TState): Promise<IDebounceResult<T>>;
36
- /** Cancels pending execution of the callback. Any pending promises will be resolved with cancelled: true. */
39
+ private executeCallback;
40
+ /** Cancels pending execution of the callback. Pending promise will be resolved with cancelled: true. */
37
41
  cancelPending(): TState[];
42
+ /** Fires the latest callback immediately. Pending promise from execute() will also be resolved with the return value of the callback. */
43
+ executeImmediate(): Promise<void>;
38
44
  }
@@ -11,6 +11,7 @@ var DebounceHelper = /** @class */ (function () {
11
11
  this.callback = callback;
12
12
  this.delayMs = delayMs;
13
13
  this.state = [];
14
+ this.executeCallback = this.executeCallback.bind(this);
14
15
  }
15
16
  /**
16
17
  * Debounce a function so that it is only called after a period of inactivity.
@@ -31,7 +32,7 @@ var DebounceHelper = /** @class */ (function () {
31
32
  helper.delayMs = delayMs;
32
33
  return helper.execute(state);
33
34
  };
34
- /** Cancels pending execution of the callback. Any pending promises will be resolved with cancelled: true. */
35
+ /** Cancels pending execution of the callback. Pending promise will be resolved with cancelled: true. */
35
36
  DebounceHelper.cancelPending = function (syncInstance) {
36
37
  var helper = syncInstance[stateSymbol];
37
38
  if (helper) {
@@ -41,6 +42,16 @@ var DebounceHelper = /** @class */ (function () {
41
42
  return [];
42
43
  }
43
44
  };
45
+ /** Fires the latest callback immediately. Pending promise from execute() will also be resolved with the return value of the callback. */
46
+ DebounceHelper.executeImmediate = function (syncInstance) {
47
+ var helper = syncInstance[stateSymbol];
48
+ if (helper) {
49
+ return helper.executeImmediate();
50
+ }
51
+ else {
52
+ return Promise.resolve();
53
+ }
54
+ };
44
55
  /**
45
56
  * Waits the interval defined in the constructor, then executes the callback.
46
57
  * The callback will not execute if execute is called again within the interval.
@@ -53,32 +64,41 @@ var DebounceHelper = /** @class */ (function () {
53
64
  this.state.push(state);
54
65
  return new Promise(function (resolve, reject) {
55
66
  _this.currentResolver = resolve;
56
- _this.timer = setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
57
- var returnValue, e_1;
58
- return __generator(this, function (_a) {
59
- switch (_a.label) {
60
- case 0:
61
- _a.trys.push([0, 2, 3, 4]);
62
- return [4 /*yield*/, Promise.resolve(this.callback(this.state))];
63
- case 1:
64
- returnValue = _a.sent();
65
- resolve({ cancelled: false, value: returnValue });
66
- return [3 /*break*/, 4];
67
- case 2:
68
- e_1 = _a.sent();
69
- reject(e_1);
70
- return [3 /*break*/, 4];
71
- case 3:
72
- this.currentResolver = undefined;
73
- this.state = [];
74
- return [7 /*endfinally*/];
75
- case 4: return [2 /*return*/];
76
- }
77
- });
78
- }); }, _this.delayMs);
67
+ _this.currentRejection = reject;
68
+ _this.timer = setTimeout(_this.executeCallback, _this.delayMs);
79
69
  });
80
70
  };
81
- /** Cancels pending execution of the callback. Any pending promises will be resolved with cancelled: true. */
71
+ DebounceHelper.prototype.executeCallback = function () {
72
+ return __awaiter(this, void 0, void 0, function () {
73
+ var returnValue, e_1;
74
+ return __generator(this, function (_a) {
75
+ switch (_a.label) {
76
+ case 0:
77
+ _a.trys.push([0, 2, 3, 4]);
78
+ return [4 /*yield*/, Promise.resolve(this.callback(this.state))];
79
+ case 1:
80
+ returnValue = _a.sent();
81
+ if (this.currentResolver) {
82
+ this.currentResolver({ cancelled: false, value: returnValue });
83
+ }
84
+ return [3 /*break*/, 4];
85
+ case 2:
86
+ e_1 = _a.sent();
87
+ if (this.currentRejection) {
88
+ this.currentRejection(e_1);
89
+ }
90
+ return [3 /*break*/, 4];
91
+ case 3:
92
+ this.currentResolver = undefined;
93
+ this.currentRejection = undefined;
94
+ this.state = [];
95
+ return [7 /*endfinally*/];
96
+ case 4: return [2 /*return*/];
97
+ }
98
+ });
99
+ });
100
+ };
101
+ /** Cancels pending execution of the callback. Pending promise will be resolved with cancelled: true. */
82
102
  DebounceHelper.prototype.cancelPending = function () {
83
103
  if (this.timer)
84
104
  clearTimeout(this.timer);
@@ -86,10 +106,17 @@ var DebounceHelper = /** @class */ (function () {
86
106
  if (this.currentResolver) {
87
107
  this.currentResolver({ cancelled: true });
88
108
  this.currentResolver = undefined;
109
+ this.currentRejection = undefined;
89
110
  this.state = [];
90
111
  }
91
112
  return state;
92
113
  };
114
+ /** Fires the latest callback immediately. Pending promise from execute() will also be resolved with the return value of the callback. */
115
+ DebounceHelper.prototype.executeImmediate = function () {
116
+ if (this.timer)
117
+ clearTimeout(this.timer);
118
+ return this.executeCallback();
119
+ };
93
120
  return DebounceHelper;
94
121
  }());
95
122
  export { DebounceHelper };
@@ -58,6 +58,8 @@ export interface IAutoRunner extends IDisposable {
58
58
  dispose(): void;
59
59
  /** Cancels any pending callbacks. */
60
60
  cancelPending(): void;
61
+ /** Cancels any pending callbacks, and fires the callback immediately. */
62
+ fireImmediate(): void;
61
63
  }
62
64
  export interface IAutoRunnerOptions<T> extends IDebounceOptions {
63
65
  /**
@@ -14,5 +14,5 @@ export interface IMenuRoute extends IRoute {
14
14
  /** Children to show as sub menu items. The breadCrumbParent property of each child will also be set to this item. */
15
15
  children?: IMenuRoute[];
16
16
  /** Icon to show on the menu. */
17
- icon?: string;
17
+ icon?: any;
18
18
  }
@@ -9,6 +9,12 @@ export declare const Settings: {
9
9
  form: {
10
10
  validationDisplayMode: ValidationDisplayMode;
11
11
  };
12
+ icons: {
13
+ loadingIcon: any;
14
+ errorIcon: any;
15
+ warningIcon: any;
16
+ infoIcon: any;
17
+ };
12
18
  /** Grid default settings */
13
19
  grid: {
14
20
  /** When specified, the default bootstrap table borders (sides and cells) will be added */
package/dist/Settings.js CHANGED
@@ -8,6 +8,12 @@ export var Settings = {
8
8
  form: {
9
9
  validationDisplayMode: ValidationDisplayMode.AfterBlur,
10
10
  },
11
+ icons: {
12
+ loadingIcon: "fa-circle-notch",
13
+ errorIcon: "fa-exclamation-triangle",
14
+ warningIcon: "fa-exclamation-triangle",
15
+ infoIcon: "fa-exclamation-circle"
16
+ },
11
17
  /** Grid default settings */
12
18
  grid: {
13
19
  /** When specified, the default bootstrap table borders (sides and cells) will be added */
package/dist/Utils.d.ts CHANGED
@@ -71,6 +71,7 @@ export declare class Utils {
71
71
  * @param state State to pass to debounced method as an array of values for each time debounce was called.
72
72
  */
73
73
  static debounce<T = any, TState = any>(syncInstance: any, callback: (state: TState[]) => T | Promise<T>, delayMs: number, state?: TState): Promise<IDebounceResult<T>>;
74
+ /** Cancels pending execution of the callback. */
74
75
  static clearDebounce<TState = any>(syncInstance: any): TState[];
75
76
  /**
76
77
  * Gets a list of property values in query string format. Does not include the leading ?.
package/dist/Utils.js CHANGED
@@ -151,6 +151,7 @@ var Utils = /** @class */ (function () {
151
151
  Utils.debounce = function (syncInstance, callback, delayMs, state) {
152
152
  return DebounceHelper.debounce(syncInstance, callback, delayMs, state);
153
153
  };
154
+ /** Cancels pending execution of the callback. */
154
155
  Utils.clearDebounce = function (syncInstance) {
155
156
  return DebounceHelper.cancelPending(syncInstance);
156
157
  };
@@ -2,7 +2,7 @@ import { RuleSeverity, ValidationState } from './ValidationState';
2
2
  import { variant } from '../Components';
3
3
  export declare class ValidationDisplayInfo {
4
4
  additionalClassName: string;
5
- iconClass: string;
5
+ icon: any;
6
6
  errorText: string;
7
7
  asyncBusyText: string;
8
8
  warningText: string;
@@ -1,9 +1,9 @@
1
1
  import { RuleSeverity } from './ValidationState';
2
2
  import { Utils } from '../Utils';
3
+ import { Settings } from '../Settings';
3
4
  var ValidationDisplayInfo = /** @class */ (function () {
4
5
  function ValidationDisplayInfo() {
5
6
  this.additionalClassName = "";
6
- this.iconClass = "";
7
7
  this.errorText = "";
8
8
  this.asyncBusyText = "";
9
9
  this.warningText = "";
@@ -71,22 +71,22 @@ var ValidationDisplayHelper = /** @class */ (function () {
71
71
  switch (displayInfo.severity) {
72
72
  case RuleSeverity.Error:
73
73
  displayInfo.additionalClassName = "error";
74
- displayInfo.iconClass = "fa fa-exclamation-triangle";
74
+ displayInfo.icon = Settings.icons.errorIcon;
75
75
  displayInfo.variant = "danger";
76
76
  break;
77
77
  case RuleSeverity.AsyncBusy:
78
78
  displayInfo.additionalClassName = "busy";
79
- displayInfo.iconClass = "spinner-grow";
79
+ displayInfo.icon = Settings.icons.loadingIcon;
80
80
  displayInfo.variant = "info";
81
81
  break;
82
82
  case RuleSeverity.Warning:
83
83
  displayInfo.additionalClassName = "warning";
84
- displayInfo.iconClass = "fa fa-exclamation-triangle";
84
+ displayInfo.icon = Settings.icons.warningIcon;
85
85
  displayInfo.variant = "warning";
86
86
  break;
87
87
  case RuleSeverity.Info:
88
88
  displayInfo.additionalClassName = "info";
89
- displayInfo.iconClass = "fa fa-exclamation-circle";
89
+ displayInfo.icon = Settings.icons.infoIcon;
90
90
  displayInfo.variant = "info";
91
91
  break;
92
92
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-core",
3
- "version": "0.10.52",
3
+ "version": "0.10.54",
4
4
  "description": "Core functionality for the Neo client library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",