@singularsystems/neo-core 0.10.51 → 0.10.53
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.
- package/dist/Components/FileManager/FileManager.d.ts +2 -0
- package/dist/Components/FileManager/FileManager.js +18 -0
- package/dist/Data/Paging/PageManager.js +1 -0
- package/dist/DebounceHelper.d.ts +8 -2
- package/dist/DebounceHelper.js +52 -25
- package/dist/Model/BaseModels/ReasonedUserEvent.d.ts +1 -0
- package/dist/Model/BaseModels/ReasonedUserEvent.js +6 -1
- package/dist/Model/BaseModels/UserEvent.d.ts +1 -0
- package/dist/Model/BaseModels/UserEvent.js +6 -1
- package/dist/Model/Misc.d.ts +2 -0
- package/dist/Utils.d.ts +1 -0
- package/dist/Utils.js +1 -0
- package/package.json +1 -1
|
@@ -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);
|
|
@@ -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.
|
package/dist/DebounceHelper.d.ts
CHANGED
|
@@ -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.
|
|
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
|
-
|
|
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
|
}
|
package/dist/DebounceHelper.js
CHANGED
|
@@ -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.
|
|
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.
|
|
57
|
-
|
|
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
|
-
|
|
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 };
|
|
@@ -7,11 +7,16 @@ var ReasonedUserEvent = /** @class */ (function (_super) {
|
|
|
7
7
|
function ReasonedUserEvent() {
|
|
8
8
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
9
9
|
}
|
|
10
|
+
ReasonedUserEvent_1 = ReasonedUserEvent;
|
|
11
|
+
ReasonedUserEvent.None = function () {
|
|
12
|
+
return new ReasonedUserEvent_1();
|
|
13
|
+
};
|
|
14
|
+
var ReasonedUserEvent_1;
|
|
10
15
|
__decorate([
|
|
11
16
|
StringLength(255),
|
|
12
17
|
__metadata("design:type", String)
|
|
13
18
|
], ReasonedUserEvent.prototype, "reason", void 0);
|
|
14
|
-
ReasonedUserEvent = __decorate([
|
|
19
|
+
ReasonedUserEvent = ReasonedUserEvent_1 = __decorate([
|
|
15
20
|
NeoModel
|
|
16
21
|
], ReasonedUserEvent);
|
|
17
22
|
return ReasonedUserEvent;
|
|
@@ -24,7 +24,12 @@ var UserEvent = /** @class */ (function (_super) {
|
|
|
24
24
|
function UserEvent() {
|
|
25
25
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
UserEvent_1 = UserEvent;
|
|
28
|
+
UserEvent.None = function () {
|
|
29
|
+
return new UserEvent_1();
|
|
30
|
+
};
|
|
31
|
+
var UserEvent_1;
|
|
32
|
+
UserEvent = UserEvent_1 = __decorate([
|
|
28
33
|
NeoModel
|
|
29
34
|
], UserEvent);
|
|
30
35
|
return UserEvent;
|
package/dist/Model/Misc.d.ts
CHANGED
|
@@ -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
|
/**
|
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
|
};
|