@singularsystems/neo-core 0.10.49 → 0.10.52
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/ButtonOptions.d.ts +5 -0
- package/dist/Components/ErrorHandler.d.ts +3 -0
- package/dist/Components/FileManager/FileManager.d.ts +6 -3
- package/dist/Components/FileManager/FileManager.js +28 -18
- package/dist/Components/TaskRunner/Decorators.d.ts +6 -0
- package/dist/Components/TaskRunner/Decorators.js +24 -0
- package/dist/Components/TaskRunner/TaskRunner.d.ts +13 -4
- package/dist/Components/TaskRunner/TaskRunner.js +8 -1
- package/dist/Data/Serialiser.js +20 -10
- 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/EnumHelper.d.ts +7 -0
- package/dist/Model/EnumHelper.js +18 -3
- package/dist/Model/IAutoRunner.d.ts +1 -1
- package/dist/Model/IModelBase.d.ts +1 -1
- package/dist/Model/Misc.d.ts +5 -1
- package/dist/Model/ModelBase.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/package.json +1 -1
|
@@ -35,6 +35,11 @@ export interface IButtonOptions {
|
|
|
35
35
|
* If the task runner provided is busy, the button's icon will change to a spinner, and the button will be disabled.
|
|
36
36
|
*/
|
|
37
37
|
task?: ITaskRunner;
|
|
38
|
+
/**
|
|
39
|
+
* If true, the button's icon will change to a spinner, and the button will be disabled.
|
|
40
|
+
* If you are using a task runner, rather use the `task` prop.
|
|
41
|
+
*/
|
|
42
|
+
isBusy?: boolean;
|
|
38
43
|
/**
|
|
39
44
|
* Adds a pulse animation to the button.
|
|
40
45
|
*/
|
|
@@ -6,7 +6,10 @@ export interface IErrorDisplay {
|
|
|
6
6
|
statusText?: string;
|
|
7
7
|
body: any;
|
|
8
8
|
data?: IErrorData;
|
|
9
|
+
/** True if this is a 500 type error from the server. */
|
|
9
10
|
isServerError?: boolean;
|
|
11
|
+
/** Cancels displaying of the error. */
|
|
12
|
+
cancelDisplay?: boolean;
|
|
10
13
|
}
|
|
11
14
|
export interface IErrorData {
|
|
12
15
|
errors: string[];
|
|
@@ -17,7 +17,7 @@ export interface IFileManager<TOptions = IBaseFileManagerOptions> {
|
|
|
17
17
|
/**
|
|
18
18
|
* Checks if file extensions are allowed, then calls onFilesSelected, or uploadFiles.
|
|
19
19
|
*/
|
|
20
|
-
processFiles(files: FileList | File[], options?: IFileUploadOptions):
|
|
20
|
+
processFiles(files: FileList | File[], options?: IFileUploadOptions): Promise<any>;
|
|
21
21
|
/**
|
|
22
22
|
* Uploads files to the uploadEndpoint. Does not perform any checks on file extensions.
|
|
23
23
|
*/
|
|
@@ -43,14 +43,17 @@ export declare abstract class FileManagerBase<TOptions extends IBaseFileManagerO
|
|
|
43
43
|
constructor(options: TOptions);
|
|
44
44
|
get uploadEndpoint(): string | undefined;
|
|
45
45
|
options: TOptions;
|
|
46
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Shows a file dialog and then calls processFiles.
|
|
48
|
+
* onFilesSelected will be called if you need to handle the event.
|
|
49
|
+
*/
|
|
47
50
|
showFileDialog(): void;
|
|
48
51
|
/** Checks if the file extensions are allowed. Shows a modal if not. */
|
|
49
52
|
validateFiles(files: FileList | File[]): boolean;
|
|
50
53
|
/**
|
|
51
54
|
* Checks if file extensions are allowed, then calls onFilesSelected, or uploadFiles
|
|
52
55
|
*/
|
|
53
|
-
processFiles(files: FileList | File[], options?: IFileUploadOptions):
|
|
56
|
+
processFiles(files: FileList | File[], options?: IFileUploadOptions): Promise<any>;
|
|
54
57
|
/**
|
|
55
58
|
* Uploads files to the uploadEndpoint. Does not perform any checks on file extensions.
|
|
56
59
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate, __extends, __metadata } from "tslib";
|
|
1
|
+
import { __awaiter, __decorate, __extends, __generator, __metadata } from "tslib";
|
|
2
2
|
import NeoModel from '../../Model/NeoModel';
|
|
3
3
|
import { ModalUtils } from '../Modal/ModalUtils';
|
|
4
4
|
import { Observable } from '../../Model/Decorators';
|
|
@@ -47,7 +47,10 @@ var FileManagerBase = /** @class */ (function () {
|
|
|
47
47
|
enumerable: true,
|
|
48
48
|
configurable: true
|
|
49
49
|
});
|
|
50
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Shows a file dialog and then calls processFiles.
|
|
52
|
+
* onFilesSelected will be called if you need to handle the event.
|
|
53
|
+
*/
|
|
51
54
|
FileManagerBase.prototype.showFileDialog = function () {
|
|
52
55
|
var fileInput = document.getElementById("neo-file-input");
|
|
53
56
|
if (!fileInput) {
|
|
@@ -59,7 +62,9 @@ var FileManagerBase = /** @class */ (function () {
|
|
|
59
62
|
fileInput.addEventListener("change", function (e) {
|
|
60
63
|
var fileManager = fileInput[fileInputSymbol];
|
|
61
64
|
if (fileInput.files) {
|
|
62
|
-
fileManager.processFiles(fileInput.files, { handleErrors: !fileManager.options.taskRunner })
|
|
65
|
+
fileManager.processFiles(fileInput.files, { handleErrors: !fileManager.options.taskRunner }).finally(function () {
|
|
66
|
+
fileInput.value = "";
|
|
67
|
+
});
|
|
63
68
|
}
|
|
64
69
|
});
|
|
65
70
|
document.body.appendChild(fileInput);
|
|
@@ -84,25 +89,30 @@ var FileManagerBase = /** @class */ (function () {
|
|
|
84
89
|
*/
|
|
85
90
|
FileManagerBase.prototype.processFiles = function (files, options) {
|
|
86
91
|
if (options === void 0) { options = {}; }
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
this.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (
|
|
94
|
-
options.additionalData
|
|
92
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
93
|
+
return __generator(this, function (_a) {
|
|
94
|
+
if (this.validateFiles(files)) {
|
|
95
|
+
if (this.options.onFilesSelected) {
|
|
96
|
+
this.options.onFilesSelected(files, this);
|
|
97
|
+
}
|
|
98
|
+
else if (this.uploadEndpoint) {
|
|
99
|
+
if (!options.additionalData && this.options.additionalData) {
|
|
100
|
+
if (typeof this.options.additionalData === "function") {
|
|
101
|
+
options.additionalData = this.options.additionalData();
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
options.additionalData = this.options.additionalData;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return [2 /*return*/, this.uploadFiles(files, options)];
|
|
95
108
|
}
|
|
96
109
|
else {
|
|
97
|
-
|
|
110
|
+
throw Error("You must specify at least one of uploadEndpoint, or onFilesSelected.");
|
|
98
111
|
}
|
|
99
112
|
}
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
throw Error("You must specify at least one of uploadEndpoint, or onFilesSelected.");
|
|
104
|
-
}
|
|
105
|
-
}
|
|
113
|
+
return [2 /*return*/];
|
|
114
|
+
});
|
|
115
|
+
});
|
|
106
116
|
};
|
|
107
117
|
FileManagerBase.prototype.uploadFiles = function (files, options) {
|
|
108
118
|
var _this = this;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TaskRunnerOptions } from './TaskRunner';
|
|
2
|
+
/**
|
|
3
|
+
* Causes the method to be run in a `taskRunner.run` handler.
|
|
4
|
+
* @param options Task runner options.
|
|
5
|
+
*/
|
|
6
|
+
export declare function runInTask(options?: Partial<TaskRunnerOptions>): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Causes the method to be run in a `taskRunner.run` handler.
|
|
3
|
+
* @param options Task runner options.
|
|
4
|
+
*/
|
|
5
|
+
export function runInTask(options) {
|
|
6
|
+
return function (target, propertyKey, descriptor) {
|
|
7
|
+
var originalFn = descriptor.value;
|
|
8
|
+
descriptor.value = function () {
|
|
9
|
+
var _this = this;
|
|
10
|
+
var args = [];
|
|
11
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
12
|
+
args[_i] = arguments[_i];
|
|
13
|
+
}
|
|
14
|
+
var taskRunner = this["taskRunner"];
|
|
15
|
+
if (!taskRunner) {
|
|
16
|
+
throw "@runInTask requires the instance to have a property called 'taskRunner'.";
|
|
17
|
+
}
|
|
18
|
+
return taskRunner.run(function (localOptions) {
|
|
19
|
+
Object.assign(localOptions, options);
|
|
20
|
+
return originalFn.apply(_this, args);
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { variant } from '..';
|
|
2
2
|
import { AxiosPromise } from 'axios';
|
|
3
|
-
import { IErrorHandler, ErrorDisplayType } from '../ErrorHandler';
|
|
3
|
+
import { IErrorHandler, ErrorDisplayType, IErrorDisplay } from '../ErrorHandler';
|
|
4
4
|
import { ProgressState } from './ProgressState';
|
|
5
5
|
declare type PromiseDictionary = {
|
|
6
6
|
[index: string]: Promise<any>;
|
|
@@ -13,6 +13,12 @@ export declare class TaskRunnerOptions<T = any> {
|
|
|
13
13
|
constructor(taskRunner: TaskRunner);
|
|
14
14
|
/** Specifies how the task runner must handle errors that are raised by your code. */
|
|
15
15
|
errorHandling: ErrorDisplayType;
|
|
16
|
+
/**
|
|
17
|
+
* Callback to run when an error occurs.
|
|
18
|
+
*
|
|
19
|
+
* Setting the `cancelDisplay` property will prevent the error being displayed by the task runner.
|
|
20
|
+
*/
|
|
21
|
+
onError?: (errorInfo: IErrorDisplay) => void;
|
|
16
22
|
/** Loading text to show in the loading bar */
|
|
17
23
|
loadingText: string;
|
|
18
24
|
variant: variant;
|
|
@@ -24,15 +30,17 @@ export declare class TaskRunnerOptions<T = any> {
|
|
|
24
30
|
autoProgress: boolean;
|
|
25
31
|
/**
|
|
26
32
|
* If set, this value will be returned in a resolved promise if an error occurs.
|
|
27
|
-
*
|
|
33
|
+
*
|
|
34
|
+
* The error will still be displayed according to the `errorHandling` property.
|
|
28
35
|
*/
|
|
29
36
|
defaultReturnValue: T;
|
|
30
37
|
get progressState(): ProgressState;
|
|
31
38
|
}
|
|
32
39
|
export declare class WaitForTaskRunnerOptions<T = any> extends TaskRunnerOptions<T> {
|
|
33
40
|
/**
|
|
34
|
-
* Set to true if you want to allow post requests when using waitFor
|
|
35
|
-
*
|
|
41
|
+
* Set to true if you want to allow post requests when using `waitFor`.
|
|
42
|
+
*
|
|
43
|
+
* Usually posts will raise an error warning you use rather use `TaskRunner.run()`. Use this if the post method has no side effects.
|
|
36
44
|
*/
|
|
37
45
|
allowPost: boolean;
|
|
38
46
|
}
|
|
@@ -64,6 +72,7 @@ export interface ITaskRunner {
|
|
|
64
72
|
waitForData<T>(task: AxiosPromise<T>, options?: Partial<WaitForTaskRunnerOptions<T>>): Promise<T>;
|
|
65
73
|
/**
|
|
66
74
|
* Accepts a dictionary of promises, and waits for all of them to resolve.
|
|
75
|
+
*
|
|
67
76
|
* A dictionary with the same keys is returned with the results of each promise.
|
|
68
77
|
*/
|
|
69
78
|
waitForAll<T extends PromiseDictionary>(promises: T, options?: Partial<WaitForTaskRunnerOptions<T>>): Promise<TransformPromises<T>>;
|
|
@@ -185,7 +185,14 @@ var TaskRunner = /** @class */ (function () {
|
|
|
185
185
|
resolve(value);
|
|
186
186
|
})
|
|
187
187
|
.catch(function (e) {
|
|
188
|
-
|
|
188
|
+
var _a;
|
|
189
|
+
var cancel = false;
|
|
190
|
+
if (options.onError !== undefined) {
|
|
191
|
+
var errorInfo = _this.errorHandler.parseError(e);
|
|
192
|
+
options.onError(errorInfo);
|
|
193
|
+
cancel = (_a = errorInfo.cancelDisplay, (_a !== null && _a !== void 0 ? _a : false));
|
|
194
|
+
}
|
|
195
|
+
if (!cancel && options.errorHandling !== ErrorDisplayType.ThrowError) {
|
|
189
196
|
_this.errorHandler.showError(e, options.errorHandling);
|
|
190
197
|
}
|
|
191
198
|
if (options.defaultReturnValue === undefined) {
|
package/dist/Data/Serialiser.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Deserialiser } from './Deserialiser';
|
|
|
3
3
|
import ValueObject from '../Model/ValueObject';
|
|
4
4
|
import DateUtils from '../Dates/DateUtils';
|
|
5
5
|
import Globals from '../Globals';
|
|
6
|
+
var referenceIdKey = Symbol("referenceId");
|
|
6
7
|
var JSFormatter = /** @class */ (function () {
|
|
7
8
|
function JSFormatter() {
|
|
8
9
|
}
|
|
@@ -41,6 +42,7 @@ var Serialiser = /** @class */ (function () {
|
|
|
41
42
|
if (options === void 0) { options = {}; }
|
|
42
43
|
this.options = options;
|
|
43
44
|
var to;
|
|
45
|
+
this.currentID = 1;
|
|
44
46
|
if (fromObject instanceof Array) {
|
|
45
47
|
to = [];
|
|
46
48
|
this.serialiseArray(fromObject, to);
|
|
@@ -57,25 +59,33 @@ var Serialiser = /** @class */ (function () {
|
|
|
57
59
|
*/
|
|
58
60
|
Serialiser.prototype.cleanUpObjects = function () {
|
|
59
61
|
for (var id in this.objectRefs) {
|
|
60
|
-
|
|
62
|
+
var refInfo = this.objectRefs[id];
|
|
63
|
+
delete refInfo.from[referenceIdKey];
|
|
64
|
+
// Remove $id property if object is not referenced by anything.
|
|
65
|
+
if (!refInfo.isReferenced) {
|
|
66
|
+
delete refInfo.to.$id;
|
|
67
|
+
}
|
|
61
68
|
}
|
|
69
|
+
this.objectRefs = {};
|
|
62
70
|
};
|
|
63
71
|
Serialiser.prototype.serialiseObject = function (from, to, isDictionary) {
|
|
64
72
|
if (isDictionary === void 0) { isDictionary = false; }
|
|
65
73
|
//check that this object hasnt already been serialised.
|
|
66
|
-
|
|
67
|
-
|
|
74
|
+
var referenceId = from[referenceIdKey];
|
|
75
|
+
if (!referenceId) {
|
|
76
|
+
referenceId = this.currentID++;
|
|
77
|
+
from[referenceIdKey] = referenceId;
|
|
68
78
|
}
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
if (toReference) {
|
|
79
|
+
var referenceInfo = this.objectRefs[referenceId];
|
|
80
|
+
if (referenceInfo) {
|
|
72
81
|
//already serialised this object
|
|
73
|
-
|
|
74
|
-
|
|
82
|
+
referenceInfo.isReferenced = true;
|
|
83
|
+
to.$ref = referenceInfo.to.$id;
|
|
75
84
|
return;
|
|
76
85
|
}
|
|
77
86
|
else {
|
|
78
|
-
this.objectRefs[
|
|
87
|
+
this.objectRefs[referenceId] = { from: from, to: to };
|
|
88
|
+
to.$id = referenceId.toString();
|
|
79
89
|
}
|
|
80
90
|
//Set tracking state
|
|
81
91
|
if (!this.options.suppressTrackingState && !isDictionary) {
|
|
@@ -115,7 +125,7 @@ var Serialiser = /** @class */ (function () {
|
|
|
115
125
|
}
|
|
116
126
|
}
|
|
117
127
|
else if (isChildObject && !propertyInfo.assignOnDeserialise) {
|
|
118
|
-
if (!fromValue || (propertyInfo.relationType === RelationType.Parent && !fromValue
|
|
128
|
+
if (!fromValue || (propertyInfo.relationType === RelationType.Parent && !fromValue[referenceIdKey])) {
|
|
119
129
|
// Parents must only be included if they reference an already serialised object.
|
|
120
130
|
// Otherwise serialising a leaf node will serialise up the tree and the entire graph will be serialised.
|
|
121
131
|
}
|
|
@@ -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;
|
|
@@ -2,6 +2,7 @@ import { StaticDataSource } from '../Data';
|
|
|
2
2
|
export interface IEnumItem {
|
|
3
3
|
id: number | string;
|
|
4
4
|
name: string;
|
|
5
|
+
description?: string;
|
|
5
6
|
}
|
|
6
7
|
interface IEnumItemDescriptor {
|
|
7
8
|
name: string;
|
|
@@ -43,5 +44,11 @@ export declare class EnumHelper {
|
|
|
43
44
|
* @param enumItem Enum item. E.g. Status.Pending
|
|
44
45
|
*/
|
|
45
46
|
static getItemMetadata<T>(enumType: T, enumItem: T[keyof T]): IEnumItemDescriptor;
|
|
47
|
+
/**
|
|
48
|
+
* Returns `true` if this item looks like an enum item.
|
|
49
|
+
*
|
|
50
|
+
* E.g. has an `id` and `name` property.
|
|
51
|
+
*/
|
|
52
|
+
static isEnumItem(item: any): boolean;
|
|
46
53
|
}
|
|
47
54
|
export {};
|
package/dist/Model/EnumHelper.js
CHANGED
|
@@ -50,18 +50,19 @@ var EnumHelper = /** @class */ (function () {
|
|
|
50
50
|
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
|
|
51
51
|
var key = keys_1[_i];
|
|
52
52
|
var id = enumObject[key];
|
|
53
|
-
var name_1 = void 0;
|
|
53
|
+
var name_1 = void 0, description = void 0;
|
|
54
54
|
var itemDescriptor = descriptorMap[id];
|
|
55
55
|
if (itemDescriptor) {
|
|
56
56
|
name_1 = itemDescriptor.display;
|
|
57
|
+
description = itemDescriptor.description;
|
|
57
58
|
}
|
|
58
59
|
else {
|
|
59
60
|
name_1 = key.readable();
|
|
60
61
|
}
|
|
61
|
-
items.push({ id: id, name: name_1, order: itemDescriptor && itemDescriptor.order !== undefined ? itemDescriptor.order : index });
|
|
62
|
+
items.push({ id: id, name: name_1, description: description, order: itemDescriptor && itemDescriptor.order !== undefined ? itemDescriptor.order : index });
|
|
62
63
|
index += 1;
|
|
63
64
|
}
|
|
64
|
-
return items.sortBy(function (c) { return c.order; }).map(function (item) { return ({ id: item.id, name: item.name }); });
|
|
65
|
+
return items.sortBy(function (c) { return c.order; }).map(function (item) { return ({ id: item.id, name: item.name, description: item.description }); });
|
|
65
66
|
};
|
|
66
67
|
/**
|
|
67
68
|
* Gets the metadata for an enum item.
|
|
@@ -80,6 +81,20 @@ var EnumHelper = /** @class */ (function () {
|
|
|
80
81
|
}
|
|
81
82
|
return itemDescriptor;
|
|
82
83
|
};
|
|
84
|
+
/**
|
|
85
|
+
* Returns `true` if this item looks like an enum item.
|
|
86
|
+
*
|
|
87
|
+
* E.g. has an `id` and `name` property.
|
|
88
|
+
*/
|
|
89
|
+
EnumHelper.isEnumItem = function (item) {
|
|
90
|
+
if (typeof item === "object") {
|
|
91
|
+
var properties = Object.getOwnPropertyNames(item);
|
|
92
|
+
if (properties.length <= 3 && properties.some(function (c) { return c === "id"; }) && properties.some(function (c) { return c === "name"; })) {
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return false;
|
|
97
|
+
};
|
|
83
98
|
return EnumHelper;
|
|
84
99
|
}());
|
|
85
100
|
export { EnumHelper };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IModelBase } from './IModelBase';
|
|
2
2
|
import { IAutoRunner, IAutoRunnerOptions } from './Misc';
|
|
3
3
|
export interface IAutoRunnerFactory {
|
|
4
|
-
create<T extends IModelBase>(model: T, callback: (model: T) => void, options?: IAutoRunnerOptions): IAutoRunner;
|
|
4
|
+
create<T extends IModelBase>(model: T, callback: (model: T) => void, options?: IAutoRunnerOptions<T>): IAutoRunner;
|
|
5
5
|
}
|
|
@@ -58,7 +58,7 @@ export interface INonObservableModelBase extends IBindableBase {
|
|
|
58
58
|
update(jsObject: any): void;
|
|
59
59
|
toQueryObject(): PlainFlatObject<this>;
|
|
60
60
|
toQueryObjectAuto(callback: (queryObject: PlainFlatObject<this>) => void, options?: IDebounceOptions): Misc.IAutoRunner;
|
|
61
|
-
onAnyPropertyChanged(callback: () => void, options?: Misc.IAutoRunnerOptions): Misc.IAutoRunner;
|
|
61
|
+
onAnyPropertyChanged(callback: () => void, options?: Misc.IAutoRunnerOptions<this>): Misc.IAutoRunner;
|
|
62
62
|
/** Icon to display next to toString() text. */
|
|
63
63
|
getIcon(): string;
|
|
64
64
|
}
|
package/dist/Model/Misc.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export interface IAutoRunner extends IDisposable {
|
|
|
59
59
|
/** Cancels any pending callbacks. */
|
|
60
60
|
cancelPending(): void;
|
|
61
61
|
}
|
|
62
|
-
export interface IAutoRunnerOptions extends IDebounceOptions {
|
|
62
|
+
export interface IAutoRunnerOptions<T> extends IDebounceOptions {
|
|
63
63
|
/**
|
|
64
64
|
* True if child objects should be included in addition to value objects.
|
|
65
65
|
*/
|
|
@@ -70,6 +70,10 @@ export interface IAutoRunnerOptions extends IDebounceOptions {
|
|
|
70
70
|
* Removed items will still be observed, and items added to the list will not be observed.
|
|
71
71
|
*/
|
|
72
72
|
includeChildLists?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* If specified, only these properties will be observed.
|
|
75
|
+
*/
|
|
76
|
+
rootProperties?: (Extract<keyof T, string>)[];
|
|
73
77
|
}
|
|
74
78
|
export interface ISelectedItem {
|
|
75
79
|
id: number | string;
|
|
@@ -58,7 +58,7 @@ export default abstract class ModelBase extends BindableBase implements IModelBa
|
|
|
58
58
|
* This is delayed for string and numeric properties.
|
|
59
59
|
* You must call the disposer when you are done with this object.
|
|
60
60
|
*/
|
|
61
|
-
onAnyPropertyChanged(callback: () => void, options?: Misc.IAutoRunnerOptions): Misc.IAutoRunner;
|
|
61
|
+
onAnyPropertyChanged(callback: () => void, options?: Misc.IAutoRunnerOptions<this>): Misc.IAutoRunner;
|
|
62
62
|
/**
|
|
63
63
|
* Converts a plain javascript object graph to a neo model graph.
|
|
64
64
|
* Updates child lists - Items in the child list, but not in jsArray will remain in the list.
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { DebounceHelper } from './DebounceHelper';
|
|
|
10
10
|
import { EnumHelper } from './Model/EnumHelper';
|
|
11
11
|
import { MenuUtils } from './Components/ContextMenu/MenuUtils';
|
|
12
12
|
import FileUtils from "./FileUtils";
|
|
13
|
+
import { runInTask } from './Components/TaskRunner/Decorators';
|
|
13
14
|
import * as Attributes from './Model/Decorators';
|
|
14
15
|
import * as Rules from './Validation/Decorators';
|
|
15
16
|
import * as AppServices from './AppServices';
|
|
@@ -27,6 +28,7 @@ import * as Validation from './Validation';
|
|
|
27
28
|
import * as Views from './Views/IViewBase';
|
|
28
29
|
declare const NotifyUtils: Components.INotificationHelper;
|
|
29
30
|
export { AppServices, Attributes, Components, Data, DateUtils, DebounceHelper, EnumHelper, FileUtils, JsonSchema, Localisation, List, MenuUtils, Misc, ModalUtils, Model, NeoModel, Network, NotifyUtils, NumberUtils, Routing, Rules, Security, SignalR, StringUtils, Validation, Views, };
|
|
31
|
+
export { runInTask };
|
|
30
32
|
export { default as ModelBase } from './Model/ModelBase';
|
|
31
33
|
export { default as ValueObject } from './Model/ValueObject';
|
|
32
34
|
export { LookupBase } from './Model/LookupBase';
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import { DebounceHelper } from './DebounceHelper';
|
|
|
11
11
|
import { EnumHelper } from './Model/EnumHelper';
|
|
12
12
|
import { MenuUtils } from './Components/ContextMenu/MenuUtils';
|
|
13
13
|
import FileUtils from "./FileUtils";
|
|
14
|
+
import { runInTask } from './Components/TaskRunner/Decorators';
|
|
14
15
|
// Namespaced exports from 1 file
|
|
15
16
|
import * as Attributes from './Model/Decorators';
|
|
16
17
|
import * as Rules from './Validation/Decorators';
|
|
@@ -30,7 +31,10 @@ import * as Validation from './Validation';
|
|
|
30
31
|
import * as Views from './Views/IViewBase';
|
|
31
32
|
import { NotificationHelper } from './Components/Notifications/NotificationHelper';
|
|
32
33
|
var NotifyUtils = new NotificationHelper();
|
|
34
|
+
// Types
|
|
33
35
|
export { AppServices, Attributes, Components, Data, DateUtils, DebounceHelper, EnumHelper, FileUtils, JsonSchema, Localisation, List, MenuUtils, Misc, ModalUtils, Model, NeoModel, Network, NotifyUtils, NumberUtils, Routing, Rules, Security, SignalR, StringUtils, Validation, Views, };
|
|
36
|
+
// Functions
|
|
37
|
+
export { runInTask };
|
|
34
38
|
export { default as ModelBase } from './Model/ModelBase';
|
|
35
39
|
export { default as ValueObject } from './Model/ValueObject';
|
|
36
40
|
export { LookupBase } from './Model/LookupBase';
|