@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.
Files changed (104) hide show
  1. package/README.md +7 -13
  2. package/dist/ApiClient/ReadApiClient.d.ts +1 -1
  3. package/dist/ApiClient/ReadApiClient.js +1 -1
  4. package/dist/ApiClient/UpdateableApiClient.js +4 -4
  5. package/dist/AppServices/Config/ConfigModel.js +1 -1
  6. package/dist/AppServices/Config/ConfigService.js +4 -4
  7. package/dist/AppServices/ServiceIdentifier.js +1 -1
  8. package/dist/Components/AnimationHelper.js +1 -1
  9. package/dist/Components/BootstrapTypes.js +1 -0
  10. package/dist/Components/ButtonOptions.d.ts +5 -0
  11. package/dist/Components/ButtonOptions.js +1 -0
  12. package/dist/Components/ContextMenu/ContextMenu.js +1 -0
  13. package/dist/Components/DatePicker/DatePicker.js +2 -3
  14. package/dist/Components/ErrorHandler.d.ts +4 -1
  15. package/dist/Components/FileManager/FileManager.d.ts +6 -3
  16. package/dist/Components/FileManager/FileManager.js +32 -22
  17. package/dist/Components/FileManager/FileUploadBatch.js +3 -3
  18. package/dist/Components/FileManager/IFileManagerOptions.js +1 -0
  19. package/dist/Components/FormOptions.js +1 -0
  20. package/dist/Components/ICollapsableOptions.js +1 -0
  21. package/dist/Components/Modal/ModalHelper.js +4 -4
  22. package/dist/Components/Modal/ModalOptions.d.ts +2 -0
  23. package/dist/Components/Modal/ModalOptions.js +1 -0
  24. package/dist/Components/Notifications/INotificationHelper.js +1 -0
  25. package/dist/Components/Notifications/NotificationHelper.js +1 -1
  26. package/dist/Components/TaskRunner/Decorators.d.ts +6 -0
  27. package/dist/Components/TaskRunner/Decorators.js +24 -0
  28. package/dist/Components/TaskRunner/ProgressState.js +1 -1
  29. package/dist/Components/TaskRunner/TaskRunner.d.ts +13 -4
  30. package/dist/Components/TaskRunner/TaskRunner.js +17 -11
  31. package/dist/Components/TooltipOptions.js +1 -0
  32. package/dist/Components/index.js +1 -0
  33. package/dist/ConnectionManager.js +2 -2
  34. package/dist/Data/ApiDataSource.js +2 -2
  35. package/dist/Data/AsyncDataSource.js +1 -1
  36. package/dist/Data/DataCacheEntry.js +3 -3
  37. package/dist/Data/DataView.js +7 -7
  38. package/dist/Data/Deserialiser.js +4 -5
  39. package/dist/Data/Paging/PageManager.js +9 -9
  40. package/dist/Data/Serialiser.js +21 -11
  41. package/dist/Data/StaticDataSource.js +1 -1
  42. package/dist/Data/WindowedDataView.js +1 -1
  43. package/dist/Dates/DateUtils.js +3 -4
  44. package/dist/Dates/TimeSpan.js +4 -4
  45. package/dist/Extensions.d.ts +1 -5
  46. package/dist/Extensions.js +18 -21
  47. package/dist/Globals.js +5 -5
  48. package/dist/JsonSchema/JsonSchemaTypes.js +1 -0
  49. package/dist/JsonSchema/TypeCache.js +2 -2
  50. package/dist/JsonSchema/TypeMetadata.js +4 -4
  51. package/dist/Localisation/ILocalisationService.js +1 -0
  52. package/dist/Localisation/index.js +1 -0
  53. package/dist/Model/BaseModels/UserEvent.js +1 -1
  54. package/dist/Model/Decorators.d.ts +1 -1
  55. package/dist/Model/Decorators.js +1 -1
  56. package/dist/Model/EnumHelper.d.ts +7 -0
  57. package/dist/Model/EnumHelper.js +18 -3
  58. package/dist/Model/IAutoRunner.d.ts +1 -1
  59. package/dist/Model/IAutoRunner.js +1 -0
  60. package/dist/Model/IModelBase.d.ts +1 -1
  61. package/dist/Model/IModelBase.js +1 -0
  62. package/dist/Model/IModelCreatorBase.js +1 -0
  63. package/dist/Model/List.js +4 -4
  64. package/dist/Model/Misc.d.ts +5 -1
  65. package/dist/Model/ModelBase.d.ts +1 -1
  66. package/dist/Model/ModelBase.js +4 -4
  67. package/dist/Model/ModelCreatorBase.js +1 -1
  68. package/dist/Model/ModelGraphTraverser.js +1 -1
  69. package/dist/Model/NeoTypeInfo.js +9 -10
  70. package/dist/Model/ObservableValue.js +1 -1
  71. package/dist/Model/PropertyInfo.js +8 -8
  72. package/dist/Model/PropertyInstance.js +8 -8
  73. package/dist/Routing/IMenuItemProvider.js +1 -0
  74. package/dist/Routing/IMenuRoute.js +1 -0
  75. package/dist/Routing/INavigationHelper.js +1 -0
  76. package/dist/Routing/IRoute.js +1 -0
  77. package/dist/Routing/IRouteSecurityService.js +1 -0
  78. package/dist/Security/IAuthenticationService.js +1 -0
  79. package/dist/Security/IAuthorisationService.js +1 -0
  80. package/dist/Security/ILoginErrorHandler.js +1 -0
  81. package/dist/Security/ISecurityService.js +1 -0
  82. package/dist/Security/IUser.js +1 -0
  83. package/dist/Security/IUserRole.js +1 -0
  84. package/dist/Security/LoginErrorHandler.js +1 -1
  85. package/dist/Security/Oidc/OidcAuthService.js +8 -3
  86. package/dist/Security/Oidc/OidcTypes.js +1 -0
  87. package/dist/Security/Oidc/OidcUser.js +3 -3
  88. package/dist/Security/SecurityService.js +2 -2
  89. package/dist/Security/User.js +2 -2
  90. package/dist/SignalR/HubBase.js +5 -5
  91. package/dist/StringUtils.js +1 -1
  92. package/dist/Utils.js +8 -8
  93. package/dist/Validation/DisplayHelper.js +2 -2
  94. package/dist/Validation/RuleContext.js +2 -3
  95. package/dist/Validation/ValidationHelpers.js +1 -1
  96. package/dist/Validation/ValidationState.js +2 -2
  97. package/dist/Validation/Validators/IModelValidator.js +1 -0
  98. package/dist/Validation/Validators/ModelValidator.js +2 -2
  99. package/dist/Validation/Validators/PropertyValidator.js +2 -2
  100. package/dist/Validation/Validators/RuleValidator.js +2 -2
  101. package/dist/Views/IViewBase.js +1 -0
  102. package/dist/index.d.ts +2 -0
  103. package/dist/index.js +4 -0
  104. 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": "Jest Current File",
16
- "program": "${workspaceFolder}/node_modules/.bin/jest",
17
- "args": [
18
- "${fileBasenameNoExtension}",
19
- "--config",
20
- "jest.config.js"
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
- "internalConsoleOptions": "neverOpen",
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<{ [P_1 in keyof Pick<TModel, Exclude<keyof TModel, "meta" | "update" | "entityIdentifier" | "isSelfDirty" | "isNew" | "isSelfValid" | "isValid" | "isDirty" | "readyToSave" | "isSuspended" | "validator" | "markOld" | "toJSObject" | "toQueryObject" | "toQueryObjectAuto" | "onAnyPropertyChanged" | "getIcon" | "set"> & { [P in keyof TModel]: TModel[P] extends Function ? never : P; }[keyof TModel]>]: Pick<TModel, Exclude<keyof TModel, "meta" | "update" | "entityIdentifier" | "isSelfDirty" | "isNew" | "isSelfValid" | "isValid" | "isDirty" | "readyToSave" | "isSuspended" | "validator" | "markOld" | "toJSObject" | "toQueryObject" | "toQueryObjectAuto" | "onAnyPropertyChanged" | "getIcon" | "set"> & { [P in keyof TModel]: TModel[P] extends Function ? never : P; }[keyof TModel]>[P_1] extends import("..").List<infer I> ? I[] : Pick<TModel, Exclude<keyof TModel, "meta" | "update" | "entityIdentifier" | "isSelfDirty" | "isNew" | "isSelfValid" | "isValid" | "isDirty" | "readyToSave" | "isSuspended" | "validator" | "markOld" | "toJSObject" | "toQueryObject" | "toQueryObjectAuto" | "onAnyPropertyChanged" | "getIcon" | "set"> & { [P in keyof TModel]: TModel[P] extends Function ? never : P; }[keyof TModel]>[P_1]; }>;
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 + "/" + id);
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 + "/" + id);
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 + "/" + id, model);
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 + "/Save", model);
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 + "/SaveList", model);
29
+ return this.axios.post("".concat(this.apiPath, "/SaveList"), model);
30
30
  };
31
31
  return UpdateableApiClient;
32
32
  }(ReadApiClient));
@@ -7,7 +7,7 @@ var ConfigModel = /** @class */ (function () {
7
7
  get: function () {
8
8
  return this.isDevelopment || this.isTest;
9
9
  },
10
- enumerable: true,
10
+ enumerable: false,
11
11
  configurable: true
12
12
  });
13
13
  ConfigModel.prototype.initialise = function () {
@@ -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 = (path !== null && path !== void 0 ? path : baseUrl + "/config.json");
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 + "?" + timestamp)];
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: " + error_1);
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: true,
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 " + name + " has already been registered!");
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, (_a !== null && _a !== void 0 ? _a : "visible"));
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 !== ((_a = bindProperty) === null || _a === void 0 ? void 0 : _a.value)) {
174
- this.currentBindValue = (_b = bindProperty) === null || _b === void 0 ? void 0 : _b.value;
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): void;
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
- /** Shows a file dialog and then calls processFiles. */
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): void;
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: true,
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: true,
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: true,
47
+ enumerable: false,
48
48
  configurable: true
49
49
  });
50
- /** Shows a file dialog and then calls processFiles. */
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
- if (this.validateFiles(files)) {
88
- if (this.options.onFilesSelected) {
89
- this.options.onFilesSelected(files, this);
90
- }
91
- else if (this.uploadEndpoint) {
92
- if (!options.additionalData && this.options.additionalData) {
93
- if (typeof this.options.additionalData === "function") {
94
- options.additionalData = this.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
- options.additionalData = this.options.additionalData;
110
+ throw Error("You must specify at least one of uploadEndpoint, or onFilesSelected.");
98
111
  }
99
112
  }
100
- this.uploadFiles(files, options);
101
- }
102
- else {
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: true,
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 = (options !== null && options !== void 0 ? 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 + " files";
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, (_a !== null && _a !== void 0 ? _a : ""));
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
- ((container !== null && container !== void 0 ? container : Misc.Globals.rootElement)).appendChild(this.rootContainer);
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: true,
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, (_a !== null && _a !== void 0 ? _a : ""));
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 {};
@@ -18,7 +18,7 @@ var NotificationHelper = /** @class */ (function () {
18
18
  }
19
19
  return this._store;
20
20
  },
21
- enumerable: true,
21
+ enumerable: false,
22
22
  configurable: true
23
23
  });
24
24
  /** Adds a notification using the primary style. See `add` for more details */
@@ -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
+ }
@@ -18,7 +18,7 @@ var ProgressState = /** @class */ (function () {
18
18
  this._progress = Math.max(0, Math.min(value, 1));
19
19
  this.stop();
20
20
  },
21
- enumerable: true,
21
+ enumerable: false,
22
22
  configurable: true
23
23
  });
24
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
- * The error will still be displayed according to the errorHandling property.
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
- * Usually posts will raise an error warning you use rather use TaskRunner.run(). Use this if the post method has no side effects.
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: true,
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 (_c) {
136
- switch (_c.label) {
134
+ return __generator(this, function (_a) {
135
+ switch (_a.label) {
137
136
  case 0:
138
137
  optionsNoDefault = __assign(__assign({}, options), { defaultReturnValue: undefined });
139
- _c.label = 1;
138
+ _a.label = 1;
140
139
  case 1:
141
- _c.trys.push([1, 3, , 4]);
140
+ _a.trys.push([1, 3, , 4]);
142
141
  return [4 /*yield*/, this.waitFor(task, optionsNoDefault)];
143
142
  case 2:
144
- result = _c.sent();
143
+ result = _a.sent();
145
144
  return [2 /*return*/, result.data];
146
145
  case 3:
147
- e_2 = _c.sent();
148
- if (((_a = options) === null || _a === void 0 ? void 0 : _a.defaultReturnValue) === undefined) {
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*/, (_b = options) === null || _b === void 0 ? void 0 : _b.defaultReturnValue];
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
- if (options.errorHandling !== ErrorDisplayType.ThrowError) {
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 {};
@@ -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: true,
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: true,
48
+ enumerable: false,
49
49
  configurable: true
50
50
  });
51
51
  __decorate([