@singularsystems/neo-core 0.10.49 → 1.0.0-alpha.1
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/README.md +7 -13
- package/dist/ApiClient/ReadApiClient.d.ts +1 -1
- package/dist/ApiClient/ReadApiClient.js +1 -1
- package/dist/ApiClient/UpdateableApiClient.js +4 -4
- package/dist/AppServices/Config/ConfigModel.js +1 -1
- package/dist/AppServices/Config/ConfigService.js +4 -4
- package/dist/AppServices/ServiceIdentifier.js +1 -1
- package/dist/Components/AnimationHelper.js +1 -1
- package/dist/Components/BootstrapTypes.js +1 -0
- package/dist/Components/ButtonOptions.d.ts +5 -0
- package/dist/Components/ButtonOptions.js +1 -0
- package/dist/Components/ContextMenu/ContextMenu.js +1 -0
- package/dist/Components/DatePicker/DatePicker.js +2 -3
- package/dist/Components/ErrorHandler.d.ts +4 -1
- package/dist/Components/FileManager/FileManager.d.ts +6 -3
- package/dist/Components/FileManager/FileManager.js +32 -22
- package/dist/Components/FileManager/FileUploadBatch.js +3 -3
- package/dist/Components/FileManager/IFileManagerOptions.js +1 -0
- package/dist/Components/FormOptions.js +1 -0
- package/dist/Components/ICollapsableOptions.js +1 -0
- package/dist/Components/Modal/ModalHelper.js +4 -4
- package/dist/Components/Modal/ModalOptions.d.ts +2 -0
- package/dist/Components/Modal/ModalOptions.js +1 -0
- package/dist/Components/Notifications/INotificationHelper.js +1 -0
- package/dist/Components/Notifications/NotificationHelper.js +1 -1
- package/dist/Components/TaskRunner/Decorators.d.ts +6 -0
- package/dist/Components/TaskRunner/Decorators.js +24 -0
- package/dist/Components/TaskRunner/ProgressState.js +1 -1
- package/dist/Components/TaskRunner/TaskRunner.d.ts +13 -4
- package/dist/Components/TaskRunner/TaskRunner.js +17 -11
- package/dist/Components/TooltipOptions.js +1 -0
- package/dist/Components/index.js +1 -0
- package/dist/ConnectionManager.js +2 -2
- package/dist/Data/ApiDataSource.js +2 -2
- package/dist/Data/AsyncDataSource.js +1 -1
- package/dist/Data/DataCacheEntry.js +3 -3
- package/dist/Data/DataView.js +7 -7
- package/dist/Data/Deserialiser.js +4 -5
- package/dist/Data/Paging/PageManager.js +9 -9
- package/dist/Data/Serialiser.js +21 -11
- package/dist/Data/StaticDataSource.js +1 -1
- package/dist/Data/WindowedDataView.js +1 -1
- package/dist/Dates/DateUtils.js +3 -4
- package/dist/Dates/TimeSpan.js +4 -4
- package/dist/Extensions.d.ts +1 -5
- package/dist/Extensions.js +18 -21
- package/dist/Globals.js +5 -5
- package/dist/JsonSchema/JsonSchemaTypes.js +1 -0
- package/dist/JsonSchema/TypeCache.js +2 -2
- package/dist/JsonSchema/TypeMetadata.js +4 -4
- package/dist/Localisation/ILocalisationService.js +1 -0
- package/dist/Localisation/index.js +1 -0
- package/dist/Model/BaseModels/UserEvent.js +1 -1
- package/dist/Model/Decorators.d.ts +1 -1
- package/dist/Model/Decorators.js +1 -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/IAutoRunner.js +1 -0
- package/dist/Model/IModelBase.d.ts +1 -1
- package/dist/Model/IModelBase.js +1 -0
- package/dist/Model/IModelCreatorBase.js +1 -0
- package/dist/Model/List.js +4 -4
- package/dist/Model/Misc.d.ts +5 -1
- package/dist/Model/ModelBase.d.ts +1 -1
- package/dist/Model/ModelBase.js +4 -4
- package/dist/Model/ModelCreatorBase.js +1 -1
- package/dist/Model/ModelGraphTraverser.js +1 -1
- package/dist/Model/NeoTypeInfo.js +9 -10
- package/dist/Model/ObservableValue.js +1 -1
- package/dist/Model/PropertyInfo.js +8 -8
- package/dist/Model/PropertyInstance.js +8 -8
- package/dist/Routing/IMenuItemProvider.js +1 -0
- package/dist/Routing/IMenuRoute.js +1 -0
- package/dist/Routing/INavigationHelper.js +1 -0
- package/dist/Routing/IRoute.js +1 -0
- package/dist/Routing/IRouteSecurityService.js +1 -0
- package/dist/Security/IAuthenticationService.js +1 -0
- package/dist/Security/IAuthorisationService.js +1 -0
- package/dist/Security/ILoginErrorHandler.js +1 -0
- package/dist/Security/ISecurityService.js +1 -0
- package/dist/Security/IUser.js +1 -0
- package/dist/Security/IUserRole.js +1 -0
- package/dist/Security/LoginErrorHandler.js +1 -1
- package/dist/Security/Oidc/OidcAuthService.js +8 -3
- package/dist/Security/Oidc/OidcTypes.js +1 -0
- package/dist/Security/Oidc/OidcUser.js +3 -3
- package/dist/Security/SecurityService.js +2 -2
- package/dist/Security/User.js +2 -2
- package/dist/SignalR/HubBase.js +5 -5
- package/dist/StringUtils.js +1 -1
- package/dist/Utils.js +8 -8
- package/dist/Validation/DisplayHelper.js +2 -2
- package/dist/Validation/RuleContext.js +2 -3
- package/dist/Validation/ValidationHelpers.js +1 -1
- package/dist/Validation/ValidationState.js +2 -2
- package/dist/Validation/Validators/IModelValidator.js +1 -0
- package/dist/Validation/Validators/ModelValidator.js +2 -2
- package/dist/Validation/Validators/PropertyValidator.js +2 -2
- package/dist/Validation/Validators/RuleValidator.js +2 -2
- package/dist/Views/IViewBase.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/package.json +18 -13
package/README.md
CHANGED
|
@@ -12,20 +12,14 @@ To debug the tests, you need to add the following to .vscode\launch.json
|
|
|
12
12
|
{
|
|
13
13
|
"type": "node",
|
|
14
14
|
"request": "launch",
|
|
15
|
-
"name": "
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
],
|
|
15
|
+
"name": "debug tests",
|
|
16
|
+
"cwd": "${workspaceFolder}",
|
|
17
|
+
"runtimeExecutable": "yarn",
|
|
18
|
+
"runtimeArgs": ["run", "--inspect-brk", "test"],
|
|
19
|
+
"args": ["${fileBasename}"],
|
|
20
|
+
"stopOnEntry": true,
|
|
22
21
|
"console": "integratedTerminal",
|
|
23
|
-
|
|
24
|
-
"disableOptimisticBPs": true,
|
|
25
|
-
"windows": {
|
|
26
|
-
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
|
|
27
|
-
}
|
|
28
|
-
}
|
|
22
|
+
}
|
|
29
23
|
]
|
|
30
24
|
}
|
|
31
25
|
```
|
|
@@ -12,5 +12,5 @@ export declare class ReadApiClient<TModel, TKey extends string | number> extends
|
|
|
12
12
|
/** Gets a list of entities */
|
|
13
13
|
get(): AxiosPromise<PlainObject<TModel>[]>;
|
|
14
14
|
/** Gets a single entity using the provided id. */
|
|
15
|
-
getById(id: TKey): AxiosPromise<{ [
|
|
15
|
+
getById(id: TKey): AxiosPromise<{ [P_2 in Exclude<keyof TModel, keyof import("../Model/IModelBase").IModelBase> & { [P_1 in keyof TModel]: TModel[P_1] extends Function ? never : P_1; }[keyof TModel]]: TModel[P_2]; } extends infer T ? { [P in keyof T]: { [P_2 in Exclude<keyof TModel, keyof import("../Model/IModelBase").IModelBase> & { [P_1 in keyof TModel]: TModel[P_1] extends Function ? never : P_1; }[keyof TModel]]: TModel[P_2]; }[P] extends import("..").List<infer I> ? I[] : { [P_2 in Exclude<keyof TModel, keyof import("../Model/IModelBase").IModelBase> & { [P_1 in keyof TModel]: TModel[P_1] extends Function ? never : P_1; }[keyof TModel]]: TModel[P_2]; }[P]; } : never>;
|
|
16
16
|
}
|
|
@@ -17,7 +17,7 @@ var ReadApiClient = /** @class */ (function (_super) {
|
|
|
17
17
|
};
|
|
18
18
|
/** Gets a single entity using the provided id. */
|
|
19
19
|
ReadApiClient.prototype.getById = function (id) {
|
|
20
|
-
return this.axios.get(this.apiPath
|
|
20
|
+
return this.axios.get("".concat(this.apiPath, "/").concat(id));
|
|
21
21
|
};
|
|
22
22
|
return ReadApiClient;
|
|
23
23
|
}(ApiClientBase));
|
|
@@ -10,7 +10,7 @@ var UpdateableApiClient = /** @class */ (function (_super) {
|
|
|
10
10
|
}
|
|
11
11
|
/** Deletes an entity using the provided id. */
|
|
12
12
|
UpdateableApiClient.prototype.delete = function (id) {
|
|
13
|
-
return this.axios.delete(this.apiPath
|
|
13
|
+
return this.axios.delete("".concat(this.apiPath, "/").concat(id));
|
|
14
14
|
};
|
|
15
15
|
/** Inserts the entity. */
|
|
16
16
|
UpdateableApiClient.prototype.post = function (model) {
|
|
@@ -18,15 +18,15 @@ var UpdateableApiClient = /** @class */ (function (_super) {
|
|
|
18
18
|
};
|
|
19
19
|
/** Updates the entity */
|
|
20
20
|
UpdateableApiClient.prototype.put = function (id, model) {
|
|
21
|
-
return this.axios.put(this.apiPath
|
|
21
|
+
return this.axios.put("".concat(this.apiPath, "/").concat(id), model);
|
|
22
22
|
};
|
|
23
23
|
/** Saves the entity, using it's tracking state to determine the operation. */
|
|
24
24
|
UpdateableApiClient.prototype.save = function (model) {
|
|
25
|
-
return this.axios.post(this.apiPath
|
|
25
|
+
return this.axios.post("".concat(this.apiPath, "/Save"), model);
|
|
26
26
|
};
|
|
27
27
|
/** Saves a list of entities, using each entities tracking state to determine the operation. */
|
|
28
28
|
UpdateableApiClient.prototype.saveList = function (model) {
|
|
29
|
-
return this.axios.post(this.apiPath
|
|
29
|
+
return this.axios.post("".concat(this.apiPath, "/SaveList"), model);
|
|
30
30
|
};
|
|
31
31
|
return UpdateableApiClient;
|
|
32
32
|
}(ReadApiClient));
|
|
@@ -14,12 +14,12 @@ var ConfigService = /** @class */ (function () {
|
|
|
14
14
|
case 0:
|
|
15
15
|
baseTag = document.getElementsByTagName('base')[0];
|
|
16
16
|
baseUrl = baseTag ? baseTag.getAttribute("href") || "" : "";
|
|
17
|
-
path =
|
|
17
|
+
path = path !== null && path !== void 0 ? path : "".concat(baseUrl, "/config.json");
|
|
18
18
|
_a.label = 1;
|
|
19
19
|
case 1:
|
|
20
20
|
_a.trys.push([1, 3, , 4]);
|
|
21
21
|
timestamp = new Date().getTime();
|
|
22
|
-
return [4 /*yield*/, Axios.get(path
|
|
22
|
+
return [4 /*yield*/, Axios.get("".concat(path, "?").concat(timestamp))];
|
|
23
23
|
case 2:
|
|
24
24
|
response = _a.sent();
|
|
25
25
|
// The raw parsed json objects properties are copied into the config model.
|
|
@@ -30,7 +30,7 @@ var ConfigService = /** @class */ (function () {
|
|
|
30
30
|
return [2 /*return*/, this.config];
|
|
31
31
|
case 3:
|
|
32
32
|
error_1 = _a.sent();
|
|
33
|
-
throw new Error("ConfigService - Error loading configuration: "
|
|
33
|
+
throw new Error("ConfigService - Error loading configuration: ".concat(error_1));
|
|
34
34
|
case 4: return [2 /*return*/];
|
|
35
35
|
}
|
|
36
36
|
});
|
|
@@ -40,7 +40,7 @@ var ConfigService = /** @class */ (function () {
|
|
|
40
40
|
get: function () {
|
|
41
41
|
return process.env.NODE_ENV === "development";
|
|
42
42
|
},
|
|
43
|
-
enumerable:
|
|
43
|
+
enumerable: false,
|
|
44
44
|
configurable: true
|
|
45
45
|
});
|
|
46
46
|
ConfigService = __decorate([
|
|
@@ -11,7 +11,7 @@ var ServiceIdentifier = /** @class */ (function () {
|
|
|
11
11
|
if (symbol === void 0) { symbol = Symbol(name); }
|
|
12
12
|
this.symbol = symbol;
|
|
13
13
|
if (ServiceIdentifier.typeNames.has(name)) {
|
|
14
|
-
console.error("Warning: Service type "
|
|
14
|
+
console.error("Warning: Service type ".concat(name, " has already been registered!"));
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
17
17
|
ServiceIdentifier.typeNames.add(name);
|
|
@@ -117,7 +117,7 @@ var CollapseAnimationHelper = /** @class */ (function () {
|
|
|
117
117
|
this.afterTransitionedDelegate = this.afterTransitioned.bind(this);
|
|
118
118
|
element.addEventListener("transitionend", this.afterTransitionedDelegate);
|
|
119
119
|
this.afterTransitioned();
|
|
120
|
-
this.defaultOverflow = (_a = window.getComputedStyle(element).overflowY
|
|
120
|
+
this.defaultOverflow = (_a = window.getComputedStyle(element).overflowY) !== null && _a !== void 0 ? _a : "visible";
|
|
121
121
|
}
|
|
122
122
|
/** Restores the element to its normal height. */
|
|
123
123
|
CollapseAnimationHelper.prototype.restore = function (force) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -161,7 +161,6 @@ var DatePicker = /** @class */ (function () {
|
|
|
161
161
|
* @param options New options.
|
|
162
162
|
*/
|
|
163
163
|
DatePicker.prototype.update = function (options, bindProperty, isReadOnly) {
|
|
164
|
-
var _a, _b;
|
|
165
164
|
if (bindProperty && bindProperty !== this.bindProperty) {
|
|
166
165
|
this.bindProperty = bindProperty;
|
|
167
166
|
}
|
|
@@ -170,8 +169,8 @@ var DatePicker = /** @class */ (function () {
|
|
|
170
169
|
}
|
|
171
170
|
this.isReadOnly = isReadOnly;
|
|
172
171
|
this.today = DateUtils.today();
|
|
173
|
-
if (this.currentBindValue !== (
|
|
174
|
-
this.currentBindValue =
|
|
172
|
+
if (this.currentBindValue !== (bindProperty === null || bindProperty === void 0 ? void 0 : bindProperty.value)) {
|
|
173
|
+
this.currentBindValue = bindProperty === null || bindProperty === void 0 ? void 0 : bindProperty.value;
|
|
175
174
|
this.resetCurrentViewDate();
|
|
176
175
|
if (this.options.alwaysShow) {
|
|
177
176
|
if (!this.suspendLayout) {
|
|
@@ -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[];
|
|
@@ -44,7 +47,7 @@ export declare class ErrorHandler implements IErrorHandler {
|
|
|
44
47
|
* @param body Body to include if the responses title is missing.
|
|
45
48
|
* @param error Axios error.
|
|
46
49
|
*/
|
|
47
|
-
parseAxiosError(header: string, body: string, error: AxiosError): IErrorDisplay;
|
|
50
|
+
parseAxiosError(header: string, body: string, error: AxiosError<any>): IErrorDisplay;
|
|
48
51
|
protected getGeneralError(error: any): IErrorDisplay;
|
|
49
52
|
protected displayError(displayType: ErrorDisplayType, error: any, errorDisplay: IErrorDisplay): void;
|
|
50
53
|
protected displayModal(error: any, errorDisplay: IErrorDisplay): void;
|
|
@@ -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';
|
|
@@ -23,7 +23,7 @@ var FileManagerBase = /** @class */ (function () {
|
|
|
23
23
|
get: function () {
|
|
24
24
|
return this.currentUploads.length > 0;
|
|
25
25
|
},
|
|
26
|
-
enumerable:
|
|
26
|
+
enumerable: false,
|
|
27
27
|
configurable: true
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(FileManagerBase.prototype, "uploadPercent", {
|
|
@@ -37,17 +37,20 @@ var FileManagerBase = /** @class */ (function () {
|
|
|
37
37
|
}
|
|
38
38
|
return totalSize === 0 ? 1 : (totalProgress / totalSize);
|
|
39
39
|
},
|
|
40
|
-
enumerable:
|
|
40
|
+
enumerable: false,
|
|
41
41
|
configurable: true
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(FileManagerBase.prototype, "uploadEndpoint", {
|
|
44
44
|
get: function () {
|
|
45
45
|
return this._uploadEndpoint;
|
|
46
46
|
},
|
|
47
|
-
enumerable:
|
|
47
|
+
enumerable: false,
|
|
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,30 +89,35 @@ 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;
|
|
109
|
-
if (options === void 0) { options = {}; }
|
|
110
119
|
var _a;
|
|
120
|
+
if (options === void 0) { options = {}; }
|
|
111
121
|
if (!this.uploadEndpoint) {
|
|
112
122
|
throw Error("uploadFiles() can only be called if an uploadEndpoint has been specified.");
|
|
113
123
|
}
|
|
@@ -15,7 +15,7 @@ var FileUploadBatch = /** @class */ (function () {
|
|
|
15
15
|
get: function () {
|
|
16
16
|
return this.files.reduce(function (p, c) { return p + c.size; }, 0);
|
|
17
17
|
},
|
|
18
|
-
enumerable:
|
|
18
|
+
enumerable: false,
|
|
19
19
|
configurable: true
|
|
20
20
|
});
|
|
21
21
|
/**
|
|
@@ -26,7 +26,7 @@ var FileUploadBatch = /** @class */ (function () {
|
|
|
26
26
|
* @param options Additional options.
|
|
27
27
|
*/
|
|
28
28
|
FileUploadBatch.prototype.createRecords = function (recordType, fileDescriptorKey, fileDescriptorType, options) {
|
|
29
|
-
options =
|
|
29
|
+
options = options !== null && options !== void 0 ? options : {};
|
|
30
30
|
var records = [];
|
|
31
31
|
for (var _i = 0, _a = this.files; _i < _a.length; _i++) {
|
|
32
32
|
var file = _a[_i];
|
|
@@ -59,7 +59,7 @@ var FileUploadBatch = /** @class */ (function () {
|
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
FileUploadBatch.prototype.toString = function () {
|
|
62
|
-
return this.files.length === 1 ? this.files[0].name : this.files.length
|
|
62
|
+
return this.files.length === 1 ? this.files[0].name : "".concat(this.files.length, " files");
|
|
63
63
|
};
|
|
64
64
|
__decorate([
|
|
65
65
|
Observable(),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -7,11 +7,11 @@ var ModalHelper = /** @class */ (function () {
|
|
|
7
7
|
var _a;
|
|
8
8
|
this.modals = [];
|
|
9
9
|
this.rootClassName = "";
|
|
10
|
-
this.rootClassName = (_a = props.className
|
|
10
|
+
this.rootClassName = (_a = props.className) !== null && _a !== void 0 ? _a : "";
|
|
11
11
|
this.rootContainer = document.createElement("div");
|
|
12
12
|
this.rootContainer.className = this.rootClassName;
|
|
13
13
|
this.rootContainer.tabIndex = -1;
|
|
14
|
-
(
|
|
14
|
+
(container !== null && container !== void 0 ? container : Misc.Globals.rootElement).appendChild(this.rootContainer);
|
|
15
15
|
// Create the container for all the modals
|
|
16
16
|
var modalsContainer = document.createElement("div");
|
|
17
17
|
modalsContainer.className = "modal fade";
|
|
@@ -42,7 +42,7 @@ var ModalHelper = /** @class */ (function () {
|
|
|
42
42
|
}
|
|
43
43
|
return ModalHelper._instance;
|
|
44
44
|
},
|
|
45
|
-
enumerable:
|
|
45
|
+
enumerable: false,
|
|
46
46
|
configurable: true
|
|
47
47
|
});
|
|
48
48
|
ModalHelper.initialise = function (props, container) {
|
|
@@ -52,7 +52,7 @@ var ModalHelper = /** @class */ (function () {
|
|
|
52
52
|
};
|
|
53
53
|
ModalHelper.prototype.updateProps = function (props) {
|
|
54
54
|
var _a;
|
|
55
|
-
this.rootClassName = (_a = props.className
|
|
55
|
+
this.rootClassName = (_a = props.className) !== null && _a !== void 0 ? _a : "";
|
|
56
56
|
};
|
|
57
57
|
ModalHelper.prototype.addModal = function (modal, options, onDismiss) {
|
|
58
58
|
modal.className = "modal-container";
|
|
@@ -33,6 +33,7 @@ export default interface IModalOptions extends IModalOptionsBase {
|
|
|
33
33
|
show: boolean;
|
|
34
34
|
/** Callback to handle when the modal is closed by the user. This should cause show to become false. */
|
|
35
35
|
onClose: (event: any) => void;
|
|
36
|
+
children: any;
|
|
36
37
|
}
|
|
37
38
|
export interface IModalOptionsAuto extends IModalOptionsBase {
|
|
38
39
|
/**
|
|
@@ -43,6 +44,7 @@ export interface IModalOptionsAuto extends IModalOptionsBase {
|
|
|
43
44
|
* null if it is non boolean.
|
|
44
45
|
* If the value is an object, it will be used as the forms model. */
|
|
45
46
|
bind: IPropertyInstance;
|
|
47
|
+
children: any;
|
|
46
48
|
}
|
|
47
49
|
export interface IModalOptionsModel extends IModalOptionsBase {
|
|
48
50
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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>>;
|
|
@@ -25,7 +25,7 @@ var TaskRunnerOptions = /** @class */ (function () {
|
|
|
25
25
|
get: function () {
|
|
26
26
|
return this.taskRunner.progressState;
|
|
27
27
|
},
|
|
28
|
-
enumerable:
|
|
28
|
+
enumerable: false,
|
|
29
29
|
configurable: true
|
|
30
30
|
});
|
|
31
31
|
__decorate([
|
|
@@ -129,27 +129,26 @@ var TaskRunner = /** @class */ (function () {
|
|
|
129
129
|
});
|
|
130
130
|
};
|
|
131
131
|
TaskRunner.prototype.waitForData = function (task, options) {
|
|
132
|
-
var _a, _b;
|
|
133
132
|
return __awaiter(this, void 0, void 0, function () {
|
|
134
133
|
var optionsNoDefault, result, e_2;
|
|
135
|
-
return __generator(this, function (
|
|
136
|
-
switch (
|
|
134
|
+
return __generator(this, function (_a) {
|
|
135
|
+
switch (_a.label) {
|
|
137
136
|
case 0:
|
|
138
137
|
optionsNoDefault = __assign(__assign({}, options), { defaultReturnValue: undefined });
|
|
139
|
-
|
|
138
|
+
_a.label = 1;
|
|
140
139
|
case 1:
|
|
141
|
-
|
|
140
|
+
_a.trys.push([1, 3, , 4]);
|
|
142
141
|
return [4 /*yield*/, this.waitFor(task, optionsNoDefault)];
|
|
143
142
|
case 2:
|
|
144
|
-
result =
|
|
143
|
+
result = _a.sent();
|
|
145
144
|
return [2 /*return*/, result.data];
|
|
146
145
|
case 3:
|
|
147
|
-
e_2 =
|
|
148
|
-
if ((
|
|
146
|
+
e_2 = _a.sent();
|
|
147
|
+
if ((options === null || options === void 0 ? void 0 : options.defaultReturnValue) === undefined) {
|
|
149
148
|
throw e_2;
|
|
150
149
|
}
|
|
151
150
|
else {
|
|
152
|
-
return [2 /*return*/,
|
|
151
|
+
return [2 /*return*/, options === null || options === void 0 ? void 0 : options.defaultReturnValue];
|
|
153
152
|
}
|
|
154
153
|
return [3 /*break*/, 4];
|
|
155
154
|
case 4: return [2 /*return*/];
|
|
@@ -185,7 +184,14 @@ var TaskRunner = /** @class */ (function () {
|
|
|
185
184
|
resolve(value);
|
|
186
185
|
})
|
|
187
186
|
.catch(function (e) {
|
|
188
|
-
|
|
187
|
+
var _a;
|
|
188
|
+
var cancel = false;
|
|
189
|
+
if (options.onError !== undefined) {
|
|
190
|
+
var errorInfo = _this.errorHandler.parseError(e);
|
|
191
|
+
options.onError(errorInfo);
|
|
192
|
+
cancel = (_a = errorInfo.cancelDisplay) !== null && _a !== void 0 ? _a : false;
|
|
193
|
+
}
|
|
194
|
+
if (!cancel && options.errorHandling !== ErrorDisplayType.ThrowError) {
|
|
189
195
|
_this.errorHandler.showError(e, options.errorHandling);
|
|
190
196
|
}
|
|
191
197
|
if (options.defaultReturnValue === undefined) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Components/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as AnimationHelper, CollapseAnimationHelper } from './AnimationHelper';
|
|
2
2
|
export { default as BootstrapHelpers } from './BootstrapHelpers';
|
|
3
|
+
export * from "./BootstrapTypes";
|
|
3
4
|
export { default as DatePicker } from './DatePicker/DatePicker';
|
|
4
5
|
export { default as DatePickerOptions, YearsInYearView } from './DatePicker/DatePickerOptions';
|
|
5
6
|
export { ErrorHandler, ErrorDisplayType } from './ErrorHandler';
|
|
@@ -38,14 +38,14 @@ var ConnectionManager = /** @class */ (function () {
|
|
|
38
38
|
get: function () {
|
|
39
39
|
return this.connections.reduce(function (p, c) { return Math.max(p, c.connection.connectionState); }, ConnectionState.NotStarted);
|
|
40
40
|
},
|
|
41
|
-
enumerable:
|
|
41
|
+
enumerable: false,
|
|
42
42
|
configurable: true
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(ConnectionManager.prototype, "connections", {
|
|
45
45
|
get: function () {
|
|
46
46
|
return Array.from(this._connections.values());
|
|
47
47
|
},
|
|
48
|
-
enumerable:
|
|
48
|
+
enumerable: false,
|
|
49
49
|
configurable: true
|
|
50
50
|
});
|
|
51
51
|
__decorate([
|