@singularsystems/neo-core 1.0.0-alpha.4 → 1.0.0-beta.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 +1 -1
- package/dist/ApiClient/ReadApiClient.d.ts +1 -1
- package/dist/ApiClient/ReadApiClient.js +1 -1
- package/dist/Components/ButtonOptions.d.ts +4 -0
- package/dist/Components/DatePicker/DatePicker.d.ts +2 -1
- package/dist/Components/DatePicker/DatePicker.js +32 -23
- package/dist/Components/DatePicker/DatePickerOptions.d.ts +2 -0
- package/dist/Components/ErrorHandler.d.ts +5 -1
- package/dist/Components/ErrorHandler.js +5 -4
- package/dist/Components/Modal/ModalOptions.d.ts +2 -0
- package/dist/Data/Paging/PageManager.d.ts +8 -0
- package/dist/Data/Paging/PageManager.js +31 -1
- package/dist/Dates/DateUtils.js +8 -0
- package/dist/Model/BindableBase.d.ts +1 -1
- package/dist/Model/BindableBase.js +5 -2
- package/dist/Model/Decorators.d.ts +3 -0
- package/dist/Model/Decorators.js +8 -1
- package/dist/Model/IModelBase.d.ts +9 -0
- package/dist/Model/MethodInfo.d.ts +8 -0
- package/dist/Model/MethodInfo.js +7 -0
- package/dist/Model/ModelCreatorBase.d.ts +0 -1
- package/dist/Model/ModelCreatorBase.js +5 -6
- package/dist/Model/NeoTypeInfo.d.ts +3 -0
- package/dist/Model/NeoTypeInfo.js +23 -4
- package/dist/Model/PropertyInfo.js +0 -1
- package/dist/NumberUtils.d.ts +7 -3
- package/dist/NumberUtils.js +22 -11
- package/dist/Settings.d.ts +7 -0
- package/dist/Settings.js +8 -1
- package/dist/SignalR/HubBase.d.ts +4 -1
- package/dist/SignalR/HubBase.js +4 -0
- package/dist/Utils.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxiosPromise } from 'axios';
|
|
2
|
-
import { PlainObject } from '../Model/IModelBase';
|
|
3
2
|
import { ApiClientBase } from './ApiClientBase';
|
|
3
|
+
import { PlainObject } from '../Model/IModelBase';
|
|
4
4
|
export interface IReadApiClient<TModel, TKey extends string | number> {
|
|
5
5
|
/** Gets a list of entities. */
|
|
6
6
|
get(): AxiosPromise<PlainObject<TModel>[]>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __extends } from "tslib";
|
|
2
|
+
import { ApiClientBase } from './ApiClientBase';
|
|
2
3
|
import { Globals } from '../Misc';
|
|
3
4
|
import { NeoTypes } from '../AppServices';
|
|
4
|
-
import { ApiClientBase } from './ApiClientBase';
|
|
5
5
|
var ReadApiClient = /** @class */ (function (_super) {
|
|
6
6
|
__extends(ReadApiClient, _super);
|
|
7
7
|
function ReadApiClient(apiPath, axios) {
|
|
@@ -46,6 +46,10 @@ export interface IButtonOptions {
|
|
|
46
46
|
* Adds a pulse animation to the button.
|
|
47
47
|
*/
|
|
48
48
|
pulse?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Set a custom variant for when a standard variant is not provided.
|
|
51
|
+
*/
|
|
52
|
+
customVariant?: string;
|
|
49
53
|
}
|
|
50
54
|
export interface IButtonDropDownItem {
|
|
51
55
|
/** Menu item text or component */
|
|
@@ -10,7 +10,6 @@ export default class DatePicker {
|
|
|
10
10
|
private headerAnimationHelper;
|
|
11
11
|
private inputHasChanged;
|
|
12
12
|
private canAutoSetDate;
|
|
13
|
-
private suspendLayout;
|
|
14
13
|
private input;
|
|
15
14
|
private popup;
|
|
16
15
|
private headerContainer;
|
|
@@ -25,6 +24,7 @@ export default class DatePicker {
|
|
|
25
24
|
private today;
|
|
26
25
|
private currentViewDate;
|
|
27
26
|
constructor(container: HTMLDivElement, options?: IPartialDateProps);
|
|
27
|
+
static mustShowInput(options?: IPartialDateProps): boolean | undefined;
|
|
28
28
|
inputFocused(e: FocusEvent): void;
|
|
29
29
|
inputBlurred(): void;
|
|
30
30
|
onInputBlurred(closePopup: boolean): void;
|
|
@@ -65,6 +65,7 @@ export default class DatePicker {
|
|
|
65
65
|
private previousClick;
|
|
66
66
|
private nextClick;
|
|
67
67
|
private moveCurrent;
|
|
68
|
+
private autoSetDay;
|
|
68
69
|
private createAndAppend;
|
|
69
70
|
destroy(): void;
|
|
70
71
|
}
|
|
@@ -2,7 +2,6 @@ import DateUtils from '../../Dates/DateUtils';
|
|
|
2
2
|
import AnimationHelper from '../AnimationHelper';
|
|
3
3
|
import { YearsInYearView, ProcessedDatePickerOptions } from './DatePickerOptions';
|
|
4
4
|
import PositionHelper from '../PositionHelper';
|
|
5
|
-
import { Utils } from '../../Utils';
|
|
6
5
|
// TODO: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
|
|
7
6
|
// TODO: Allow input to be shown with inline picker, and specify position.
|
|
8
7
|
var ViewType;
|
|
@@ -17,7 +16,6 @@ var DatePicker = /** @class */ (function () {
|
|
|
17
16
|
this.isReadOnly = false;
|
|
18
17
|
this.inputHasChanged = false;
|
|
19
18
|
this.canAutoSetDate = false;
|
|
20
|
-
this.suspendLayout = false;
|
|
21
19
|
this.currentBindValue = null;
|
|
22
20
|
this.boundDateNoTime = null;
|
|
23
21
|
this.options = ProcessedDatePickerOptions.fromPartial(options || {});
|
|
@@ -25,7 +23,7 @@ var DatePicker = /** @class */ (function () {
|
|
|
25
23
|
this.inputBlurred = this.inputBlurred.bind(this);
|
|
26
24
|
this.inputChanged = this.inputChanged.bind(this);
|
|
27
25
|
this.inputKeyDown = this.inputKeyDown.bind(this);
|
|
28
|
-
if (
|
|
26
|
+
if (DatePicker.mustShowInput(options)) {
|
|
29
27
|
this.input = this.container.getElementsByTagName('input')[0];
|
|
30
28
|
this.input.addEventListener("focus", this.inputFocused);
|
|
31
29
|
this.input.addEventListener("mousedown", this.inputFocused);
|
|
@@ -36,7 +34,13 @@ var DatePicker = /** @class */ (function () {
|
|
|
36
34
|
this.input.placeholder = "hh:mm" + (this.options.formatString.indexOf("s") > 0 ? ":ss" : "");
|
|
37
35
|
}
|
|
38
36
|
}
|
|
37
|
+
if (this.options.alwaysShow) {
|
|
38
|
+
container.classList.add("neo-datepicker-always-show");
|
|
39
|
+
}
|
|
39
40
|
}
|
|
41
|
+
DatePicker.mustShowInput = function (options) {
|
|
42
|
+
return !options || !options.alwaysShow || options.showInput;
|
|
43
|
+
};
|
|
40
44
|
DatePicker.prototype.inputFocused = function (e) {
|
|
41
45
|
if (!this.popup && !this.isReadOnly) {
|
|
42
46
|
this.show();
|
|
@@ -111,7 +115,7 @@ var DatePicker = /** @class */ (function () {
|
|
|
111
115
|
}
|
|
112
116
|
};
|
|
113
117
|
DatePicker.prototype.removePopup = function (animate) {
|
|
114
|
-
if (this.popup) {
|
|
118
|
+
if (this.popup && !this.options.alwaysShow) {
|
|
115
119
|
if (animate) {
|
|
116
120
|
AnimationHelper.scale(this.popup, DatePicker.AnimationClassName, 1, 0);
|
|
117
121
|
AnimationHelper.beginRemove(this.container, this.popup);
|
|
@@ -134,26 +138,26 @@ var DatePicker = /** @class */ (function () {
|
|
|
134
138
|
// Note: this may have the side effect of calling update().
|
|
135
139
|
this.setBindProperty(dateValue, false);
|
|
136
140
|
this.setInputValue();
|
|
137
|
-
if (
|
|
141
|
+
if (options.close) {
|
|
138
142
|
this.removePopup(true);
|
|
139
143
|
}
|
|
144
|
+
if (!options.close || this.options.alwaysShow) {
|
|
145
|
+
this.resetCurrentViewDate();
|
|
146
|
+
this.populateContentContainer(true);
|
|
147
|
+
}
|
|
140
148
|
};
|
|
141
149
|
DatePicker.prototype.setBindProperty = function (dateValue, suspend) {
|
|
142
|
-
var _this = this;
|
|
143
150
|
if (dateValue) {
|
|
144
151
|
dateValue = DateUtils.max(DateUtils.min(dateValue, this.options.maxDate), this.options.minDate);
|
|
145
152
|
}
|
|
146
|
-
|
|
147
|
-
this.suspendLayout = true;
|
|
153
|
+
this.currentBindValue = dateValue;
|
|
148
154
|
this.bindProperty.value = dateValue;
|
|
149
|
-
if (suspend)
|
|
150
|
-
Utils.nextTick(function () { return _this.suspendLayout = false; });
|
|
151
155
|
if (this.options.onDateSelected !== undefined) {
|
|
152
156
|
this.options.onDateSelected(!suspend);
|
|
153
157
|
}
|
|
154
158
|
};
|
|
155
159
|
DatePicker.prototype.setInputValue = function () {
|
|
156
|
-
if (
|
|
160
|
+
if (this.input) {
|
|
157
161
|
var displayValue = "";
|
|
158
162
|
if (this.bindProperty.value) {
|
|
159
163
|
displayValue = DateUtils.format(this.bindProperty.value, this.options.formatString);
|
|
@@ -191,13 +195,9 @@ var DatePicker = /** @class */ (function () {
|
|
|
191
195
|
this.currentBindValue = bindProperty === null || bindProperty === void 0 ? void 0 : bindProperty.value;
|
|
192
196
|
this.resetCurrentViewDate();
|
|
193
197
|
if (this.options.alwaysShow) {
|
|
194
|
-
|
|
195
|
-
this.createComponents();
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
this.setInputValue();
|
|
198
|
+
this.createComponents();
|
|
200
199
|
}
|
|
200
|
+
this.setInputValue();
|
|
201
201
|
}
|
|
202
202
|
};
|
|
203
203
|
DatePicker.prototype.resetCurrentViewDate = function () {
|
|
@@ -312,13 +312,7 @@ var DatePicker = /** @class */ (function () {
|
|
|
312
312
|
var currentDate = new Date(this.currentViewDate);
|
|
313
313
|
var lastDayOfMonth = DateUtils.monthEnd(currentDate);
|
|
314
314
|
this.prevButton.disabled = this.options.minDateNoTime.getTime() >= currentDate.getTime();
|
|
315
|
-
if (this.canAutoSetDate && this.options.autoChangeDate == "start") {
|
|
316
|
-
this.setBindProperty(currentDate, true);
|
|
317
|
-
}
|
|
318
315
|
this.nextButton.disabled = this.options.maxDateNoTime.getTime() <= lastDayOfMonth.getTime();
|
|
319
|
-
if (this.canAutoSetDate && this.options.autoChangeDate == "end") {
|
|
320
|
-
this.setBindProperty(lastDayOfMonth, true);
|
|
321
|
-
}
|
|
322
316
|
// Start with the first Sunday before the first of the month.
|
|
323
317
|
currentDate.setDate(currentDate.getDate() - currentDate.getDay());
|
|
324
318
|
var first = true;
|
|
@@ -471,6 +465,7 @@ var DatePicker = /** @class */ (function () {
|
|
|
471
465
|
if (this.currentViewType == ViewType.Days) {
|
|
472
466
|
this.canAutoSetDate = true;
|
|
473
467
|
this.currentViewDate.setMonth(this.currentViewDate.getMonth() + delta, 1);
|
|
468
|
+
this.autoSetDay();
|
|
474
469
|
}
|
|
475
470
|
else {
|
|
476
471
|
this.currentViewDate.setFullYear(this.currentViewDate.getFullYear() + delta * (this.currentViewType == ViewType.Months ? 1 : YearsInYearView));
|
|
@@ -478,6 +473,20 @@ var DatePicker = /** @class */ (function () {
|
|
|
478
473
|
this.populateContentContainer(false, true);
|
|
479
474
|
this.contentAnimationHelper.slide(delta, true);
|
|
480
475
|
};
|
|
476
|
+
DatePicker.prototype.autoSetDay = function () {
|
|
477
|
+
var autoDate = null;
|
|
478
|
+
if (this.options.autoChangeDate === "end") {
|
|
479
|
+
// Forward
|
|
480
|
+
autoDate = DateUtils.monthEnd(this.currentViewDate);
|
|
481
|
+
}
|
|
482
|
+
else if (this.options.autoChangeDate === "start") {
|
|
483
|
+
// Back
|
|
484
|
+
autoDate = this.currentViewDate;
|
|
485
|
+
}
|
|
486
|
+
if (autoDate) {
|
|
487
|
+
this.setBindValue(autoDate, { preserveTime: true, close: false });
|
|
488
|
+
}
|
|
489
|
+
};
|
|
481
490
|
DatePicker.prototype.createAndAppend = function (parent, elementType, className) {
|
|
482
491
|
if (className === void 0) { className = ""; }
|
|
483
492
|
var newElement = document.createElement(elementType);
|
|
@@ -13,6 +13,8 @@ export default class DatePickerOptions {
|
|
|
13
13
|
timeOnly: boolean;
|
|
14
14
|
/** Displays the picker inline and without an input control */
|
|
15
15
|
alwaysShow: boolean;
|
|
16
|
+
/** Shows the input when using `alwaysShow`. */
|
|
17
|
+
showInput: boolean;
|
|
16
18
|
minDate: Date;
|
|
17
19
|
maxDate: Date;
|
|
18
20
|
/** Automatically sets the date to the start or end of the displayed month when scrolling through months. */
|
|
@@ -33,7 +33,11 @@ export declare enum ErrorDisplayType {
|
|
|
33
33
|
}
|
|
34
34
|
export declare class ErrorHandler implements IErrorHandler {
|
|
35
35
|
private notifications;
|
|
36
|
-
|
|
36
|
+
private blobType;
|
|
37
|
+
constructor(notifications: INotificationHelper, blobType?: {
|
|
38
|
+
new (blobParts?: BlobPart[] | undefined, options?: BlobPropertyBag | undefined): Blob;
|
|
39
|
+
prototype: Blob;
|
|
40
|
+
});
|
|
37
41
|
showError(error: any, displayType: ErrorDisplayType): Promise<void>;
|
|
38
42
|
parseError(error: any): Promise<IErrorDisplay>;
|
|
39
43
|
protected getAxiosError(error: AxiosError, response?: AxiosResponse): Promise<IErrorDisplay>;
|
|
@@ -2,7 +2,6 @@ import { __awaiter, __decorate, __generator, __metadata, __param } from "tslib";
|
|
|
2
2
|
import { injectable, inject } from 'inversify';
|
|
3
3
|
import { ModalUtils } from './Modal/ModalUtils';
|
|
4
4
|
import NeoTypes from '../AppServices/NeoTypes';
|
|
5
|
-
import { Blob } from 'buffer';
|
|
6
5
|
export var ErrorDisplayType;
|
|
7
6
|
(function (ErrorDisplayType) {
|
|
8
7
|
/** Show the error text in a modal. */
|
|
@@ -13,8 +12,10 @@ export var ErrorDisplayType;
|
|
|
13
12
|
ErrorDisplayType[ErrorDisplayType["ThrowError"] = 2] = "ThrowError";
|
|
14
13
|
})(ErrorDisplayType || (ErrorDisplayType = {}));
|
|
15
14
|
export var ErrorHandler = /** @class */ (function () {
|
|
16
|
-
function ErrorHandler(notifications) {
|
|
15
|
+
function ErrorHandler(notifications, blobType) {
|
|
16
|
+
if (blobType === void 0) { blobType = Blob; }
|
|
17
17
|
this.notifications = notifications;
|
|
18
|
+
this.blobType = blobType;
|
|
18
19
|
}
|
|
19
20
|
ErrorHandler.prototype.showError = function (error, displayType) {
|
|
20
21
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -163,7 +164,7 @@ export var ErrorHandler = /** @class */ (function () {
|
|
|
163
164
|
return __generator(this, function (_a) {
|
|
164
165
|
switch (_a.label) {
|
|
165
166
|
case 0:
|
|
166
|
-
if (!(responseData instanceof
|
|
167
|
+
if (!(responseData instanceof this.blobType)) return [3 /*break*/, 2];
|
|
167
168
|
return [4 /*yield*/, responseData.text()];
|
|
168
169
|
case 1:
|
|
169
170
|
errorText = _a.sent();
|
|
@@ -204,7 +205,7 @@ export var ErrorHandler = /** @class */ (function () {
|
|
|
204
205
|
ErrorHandler = __decorate([
|
|
205
206
|
injectable(),
|
|
206
207
|
__param(0, inject(NeoTypes.UI.GlobalNotifications.symbol)),
|
|
207
|
-
__metadata("design:paramtypes", [Object])
|
|
208
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
208
209
|
], ErrorHandler);
|
|
209
210
|
return ErrorHandler;
|
|
210
211
|
}());
|
|
@@ -27,6 +27,8 @@ export interface IModalOptionsBase {
|
|
|
27
27
|
footerContent?: any;
|
|
28
28
|
/** Callback to handle when the modal is closed / cancelled by the user. Not called on accept. */
|
|
29
29
|
onClose?: (event: any) => void;
|
|
30
|
+
/** Called after the modal animation completes. */
|
|
31
|
+
afterClose?: () => void;
|
|
30
32
|
}
|
|
31
33
|
export default interface IModalOptions extends IModalOptionsBase {
|
|
32
34
|
/** Controls the visibility of the modal. */
|
|
@@ -79,6 +79,10 @@ export interface IPageManager {
|
|
|
79
79
|
* @param taskRunner Optional alternate task runner to use.
|
|
80
80
|
*/
|
|
81
81
|
refreshData(getCount?: boolean, taskRunner?: ITaskRunner): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Refresh the data only if the page manager has initialised.
|
|
84
|
+
*/
|
|
85
|
+
invalidateData(taskRunner?: ITaskRunner): Promise<void>;
|
|
82
86
|
/**
|
|
83
87
|
* Refresh the data by calling the api endpoint with the current criteria.
|
|
84
88
|
* This will not reset the page index, and will not update the total record count, therefore should only be called if your criteria has not changed since the last full fetch using refreshData().
|
|
@@ -128,6 +132,10 @@ export declare class PageManager<TCriteria extends ValueObject, TModel extends I
|
|
|
128
132
|
* @param taskRunner Optional alternate task runner to use.
|
|
129
133
|
*/
|
|
130
134
|
refreshData(getCount?: boolean, taskRunner?: ITaskRunner): Promise<void>;
|
|
135
|
+
/**
|
|
136
|
+
* Refresh the data only if the page manager has initialised.
|
|
137
|
+
*/
|
|
138
|
+
invalidateData(taskRunner?: ITaskRunner): Promise<void>;
|
|
131
139
|
/**
|
|
132
140
|
* Refresh the data by calling the api endpoint with the current criteria.
|
|
133
141
|
* This will not reset the page index, and will not update the total record count, therefore should only be called if your criteria has not changed since the last full fetch using refreshData().
|
|
@@ -166,13 +166,43 @@ export var PageManager = /** @class */ (function (_super) {
|
|
|
166
166
|
});
|
|
167
167
|
});
|
|
168
168
|
};
|
|
169
|
+
/**
|
|
170
|
+
* Refresh the data only if the page manager has initialised.
|
|
171
|
+
*/
|
|
172
|
+
PageManager.prototype.invalidateData = function (taskRunner) {
|
|
173
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
174
|
+
return __generator(this, function (_a) {
|
|
175
|
+
switch (_a.label) {
|
|
176
|
+
case 0:
|
|
177
|
+
if (!this.hasInitialised) return [3 /*break*/, 2];
|
|
178
|
+
return [4 /*yield*/, this.refreshData(true, taskRunner)];
|
|
179
|
+
case 1:
|
|
180
|
+
_a.sent();
|
|
181
|
+
_a.label = 2;
|
|
182
|
+
case 2: return [2 /*return*/];
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
};
|
|
169
187
|
/**
|
|
170
188
|
* Refresh the data by calling the api endpoint with the current criteria.
|
|
171
189
|
* This will not reset the page index, and will not update the total record count, therefore should only be called if your criteria has not changed since the last full fetch using refreshData().
|
|
172
190
|
* @param taskRunner Optional alternate task runner to use.
|
|
173
191
|
*/
|
|
174
192
|
PageManager.prototype.refreshPage = function (taskRunner) {
|
|
175
|
-
return this
|
|
193
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
194
|
+
return __generator(this, function (_a) {
|
|
195
|
+
switch (_a.label) {
|
|
196
|
+
case 0:
|
|
197
|
+
if (!this.hasInitialised) return [3 /*break*/, 2];
|
|
198
|
+
return [4 /*yield*/, this.refreshData(false, taskRunner)];
|
|
199
|
+
case 1:
|
|
200
|
+
_a.sent();
|
|
201
|
+
_a.label = 2;
|
|
202
|
+
case 2: return [2 /*return*/];
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
});
|
|
176
206
|
};
|
|
177
207
|
PageManager.prototype.fetchAndSetData = function (request) {
|
|
178
208
|
var _a;
|
package/dist/Dates/DateUtils.js
CHANGED
|
@@ -187,6 +187,14 @@ var DateUtils = /** @class */ (function () {
|
|
|
187
187
|
var newDate = new Date();
|
|
188
188
|
newDate.setFullYear(date.getFullYear() + ((_a = timeSpan.years) !== null && _a !== void 0 ? _a : 0), date.getMonth() + ((_b = timeSpan.months) !== null && _b !== void 0 ? _b : 0), date.getDate() + ((_c = timeSpan.days) !== null && _c !== void 0 ? _c : 0));
|
|
189
189
|
newDate.setHours(date.getHours() + ((_d = timeSpan.hours) !== null && _d !== void 0 ? _d : 0), date.getMinutes() + ((_e = timeSpan.minutes) !== null && _e !== void 0 ? _e : 0), date.getSeconds() + ((_f = timeSpan.seconds) !== null && _f !== void 0 ? _f : 0), date.getMilliseconds() + ((_g = timeSpan.milliseconds) !== null && _g !== void 0 ? _g : 0));
|
|
190
|
+
if (timeSpan.months && !timeSpan.days) {
|
|
191
|
+
// 31 May - 1 month == 31 April == 1 May, this will fix that:
|
|
192
|
+
var newMonth = newDate.getMonth();
|
|
193
|
+
var oldMonth = date.getMonth();
|
|
194
|
+
if (newMonth !== oldMonth + (timeSpan.months % 12)) {
|
|
195
|
+
newDate.setDate(0);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
190
198
|
return newDate;
|
|
191
199
|
};
|
|
192
200
|
/**
|
|
@@ -29,7 +29,7 @@ export declare abstract class BindableBase {
|
|
|
29
29
|
* Must be called in the constructor, preferably directly after the super() call.
|
|
30
30
|
* This method can be used as an alternative to the @NeoModel decorator.
|
|
31
31
|
*/
|
|
32
|
-
protected makeObservable(): void;
|
|
32
|
+
protected makeObservable(options?: IMakeBindableOptions): void;
|
|
33
33
|
/**
|
|
34
34
|
* Makes the model bindable (and observable if it inherits from ModelBase) by creating its 'meta' object.
|
|
35
35
|
* Must be called in the constructor, preferably directly after the super() call.
|
|
@@ -41,8 +41,11 @@ export var BindableBase = /** @class */ (function () {
|
|
|
41
41
|
* Must be called in the constructor, preferably directly after the super() call.
|
|
42
42
|
* This method can be used as an alternative to the @NeoModel decorator.
|
|
43
43
|
*/
|
|
44
|
-
BindableBase.prototype.makeObservable = function () {
|
|
45
|
-
|
|
44
|
+
BindableBase.prototype.makeObservable = function (options) {
|
|
45
|
+
var _a;
|
|
46
|
+
options !== null && options !== void 0 ? options : (options = {});
|
|
47
|
+
(_a = options.makeObservable) !== null && _a !== void 0 ? _a : (options.makeObservable = true);
|
|
48
|
+
this.makeBindable(options);
|
|
46
49
|
};
|
|
47
50
|
/**
|
|
48
51
|
* Makes the model bindable (and observable if it inherits from ModelBase) by creating its 'meta' object.
|
|
@@ -43,5 +43,8 @@ export declare function OnChanged<T>(callback: (target: T) => (oldValue: any, ne
|
|
|
43
43
|
export declare function Debounce(value?: boolean): (type: any, propertyKey: string) => void;
|
|
44
44
|
/** Converts a getter into a computed. Note, when using NeoModel you do not need to do this. */
|
|
45
45
|
export declare function Computed(isComputed?: boolean): (type: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
46
|
+
/** Specifies whether a method is a mobx action. By default all methods are actions.
|
|
47
|
+
* Use this decorator to suppress this behaviour (by passing in false), or change the default behaviour in the makeObservable options passed to makeObservable. */
|
|
48
|
+
export declare function Action(isAction?: boolean): (type: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
46
49
|
/** Sets this property as the display member to be used in drop downs / radio lists etc. */
|
|
47
50
|
export declare function DisplayMember(): (type: any, propertyKey: string) => void;
|
package/dist/Model/Decorators.js
CHANGED
|
@@ -173,10 +173,17 @@ export function Computed(isComputed) {
|
|
|
173
173
|
ensureTypeInfo(type.constructor).neo.addComputed(propertyKey, descriptor, isComputed);
|
|
174
174
|
};
|
|
175
175
|
}
|
|
176
|
+
/** Specifies whether a method is a mobx action. By default all methods are actions.
|
|
177
|
+
* Use this decorator to suppress this behaviour (by passing in false), or change the default behaviour in the makeObservable options passed to makeObservable. */
|
|
178
|
+
export function Action(isAction) {
|
|
179
|
+
return function (type, propertyKey, descriptor) {
|
|
180
|
+
ensureTypeInfo(type.constructor).neo.addMethod(propertyKey).isAction = isAction;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
176
183
|
/** Sets this property as the display member to be used in drop downs / radio lists etc. */
|
|
177
184
|
export function DisplayMember() {
|
|
178
185
|
return function (type, propertyKey) {
|
|
179
186
|
var pi = getOrAddPropertyInfo(type, propertyKey);
|
|
180
|
-
type.constructor.neo.displayMember = pi;
|
|
187
|
+
ensureTypeInfo(type.constructor).neo.displayMember = pi;
|
|
181
188
|
};
|
|
182
189
|
}
|
|
@@ -26,15 +26,20 @@ type RemoveChildren<T> = Pick<T, {
|
|
|
26
26
|
export type PartialOrNull<T> = {
|
|
27
27
|
[P in keyof T]?: T[P] | null;
|
|
28
28
|
};
|
|
29
|
+
/** Removes ModelBase properties (isNew, isDirty etc), removes methods, and changes list types to arrays. */
|
|
29
30
|
export type PlainObject<T> = TransformLists<NoModelBase<T>>;
|
|
31
|
+
/** PlainObject plus tracking state and entity identifier. */
|
|
30
32
|
export type PlainTrackedObject<T> = PlainObject<T> & {
|
|
31
33
|
trackingState?: Misc.TrackingState;
|
|
32
34
|
entityIdentifier?: string;
|
|
33
35
|
};
|
|
36
|
+
/** Plain object with no tracking state, and no lists. */
|
|
34
37
|
export type PlainFlatObject<T> = Pick<T, Exclude<keyof T, keyof IModelBase> & keyof RemoveMethods<T> & keyof RemoveChildren<T>>;
|
|
38
|
+
/** Plain object where the meta property is not allowed. Used to accept any Plain* object. */
|
|
35
39
|
export type PartialPlainObject<T> = Partial<PlainObject<T>> & {
|
|
36
40
|
meta?: never;
|
|
37
41
|
};
|
|
42
|
+
/** Plain object where the meta and tracking state properties are not allowed. Used to accept PlainObject and PlainFlatObject. */
|
|
38
43
|
export type PartialPlainNonTrackedObject<T> = PartialPlainObject<T> & {
|
|
39
44
|
trackingState?: never;
|
|
40
45
|
};
|
|
@@ -49,6 +54,10 @@ export interface IMakeBindableOptions {
|
|
|
49
54
|
* * If `undefined`, only types that inherit from `ModelBase` will be observable by default.
|
|
50
55
|
*/
|
|
51
56
|
makeObservable?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Specifies whether methods should be converted to mobx actions. This is `true` by default.
|
|
59
|
+
* Use `Attributes.Action()` to override this per method. */
|
|
60
|
+
autoActions?: boolean;
|
|
52
61
|
/**
|
|
53
62
|
* If `true`, this instance will not be converted. In inheritence heirarchies, use this to ensure only the last derived type converts the instance.
|
|
54
63
|
*/
|
|
@@ -19,6 +19,5 @@ export declare abstract class ModelCreatorBase implements IModelCreatorBase {
|
|
|
19
19
|
*/
|
|
20
20
|
protected ensureChildInfo(instance: {}, propertyInfo: PropertyInfo): void;
|
|
21
21
|
protected addMethodInfo(methodName: string, method: Function): void;
|
|
22
|
-
protected addProperty(propertyName: string, descriptor: PropertyDescriptor): void;
|
|
23
22
|
abstract convertInstance(instance: {}, options: IMakeBindableOptions): {};
|
|
24
23
|
}
|
|
@@ -5,6 +5,7 @@ import { RelationType } from './Misc';
|
|
|
5
5
|
import { ChildList, ChildObject } from './Decorators';
|
|
6
6
|
import ValueObject from './ValueObject';
|
|
7
7
|
import { BindableBase } from './BindableBase';
|
|
8
|
+
var nonActionMethods = ["addBusinessRules", "toString"];
|
|
8
9
|
export var ModelCreatorBase = /** @class */ (function () {
|
|
9
10
|
function ModelCreatorBase() {
|
|
10
11
|
this.alwaysInitialiseMembers = false;
|
|
@@ -49,10 +50,6 @@ export var ModelCreatorBase = /** @class */ (function () {
|
|
|
49
50
|
if (this.typeInfo.inheritsBindableBase) {
|
|
50
51
|
this.typeInfo.addComputed(propertyName, descriptor);
|
|
51
52
|
}
|
|
52
|
-
else {
|
|
53
|
-
// for general objects, getters must explicitly define @Computed to become computed properties.
|
|
54
|
-
this.addProperty(propertyName, descriptor);
|
|
55
|
-
}
|
|
56
53
|
}
|
|
57
54
|
}
|
|
58
55
|
}
|
|
@@ -82,8 +79,10 @@ export var ModelCreatorBase = /** @class */ (function () {
|
|
|
82
79
|
}
|
|
83
80
|
};
|
|
84
81
|
ModelCreatorBase.prototype.addMethodInfo = function (methodName, method) {
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
var methodInfo = this.typeInfo.addMethod(methodName);
|
|
83
|
+
if (nonActionMethods.indexOf(methodInfo.name) >= 0) {
|
|
84
|
+
methodInfo.isAction = false;
|
|
85
|
+
}
|
|
87
86
|
};
|
|
88
87
|
ModelCreatorBase = __decorate([
|
|
89
88
|
injectable()
|
|
@@ -2,6 +2,7 @@ import { Rule } from '../Validation/Rules';
|
|
|
2
2
|
import { PropertyInstanceMap } from './PropertyInstance';
|
|
3
3
|
import PropertyInfo, { PropertyInfoMap } from './PropertyInfo';
|
|
4
4
|
import { NeoModelConstructor, IModelBase, IMetaItem, IMakeBindableOptions } from './IModelBase';
|
|
5
|
+
import MethodInfo from './MethodInfo';
|
|
5
6
|
export declare class NeoTypeInfo {
|
|
6
7
|
private modelCreator;
|
|
7
8
|
private objectConstructor;
|
|
@@ -11,6 +12,7 @@ export declare class NeoTypeInfo {
|
|
|
11
12
|
private _metaItem;
|
|
12
13
|
properties: PropertyInfo[];
|
|
13
14
|
propertyMap: PropertyInfoMap;
|
|
15
|
+
methods: Map<string, MethodInfo>;
|
|
14
16
|
children: PropertyInfo[];
|
|
15
17
|
parentProperties: PropertyInfo[];
|
|
16
18
|
parentProperty?: PropertyInfo;
|
|
@@ -24,6 +26,7 @@ export declare class NeoTypeInfo {
|
|
|
24
26
|
private addPropertyInfo;
|
|
25
27
|
getOrAddProperty(propertyName: string): PropertyInfo;
|
|
26
28
|
addComputed(propertyName: string, descriptor: PropertyDescriptor, isComputed?: boolean): void;
|
|
29
|
+
addMethod(methodName: string): MethodInfo;
|
|
27
30
|
addAttributeRule(propertyName: string, rule: Rule): void;
|
|
28
31
|
/**
|
|
29
32
|
* Ensures the type has all the information it needs in order to convert instances of this type.
|
|
@@ -7,7 +7,7 @@ import { ValidationRules } from '../Validation/ValidationRules';
|
|
|
7
7
|
import ModelProxy from '../Validation/ModelProxy';
|
|
8
8
|
import NeoTypes from '../AppServices/NeoTypes';
|
|
9
9
|
import { RelationType } from './Misc';
|
|
10
|
-
|
|
10
|
+
import MethodInfo from './MethodInfo';
|
|
11
11
|
var inversifyMetadataKey = "inversify:tagged";
|
|
12
12
|
var hasConvertedSymbol = Symbol("hasConvertedModel");
|
|
13
13
|
var NeoTypeInfo = /** @class */ (function () {
|
|
@@ -18,6 +18,7 @@ var NeoTypeInfo = /** @class */ (function () {
|
|
|
18
18
|
this.properties = [];
|
|
19
19
|
// Property info dictionary for easy lookup.
|
|
20
20
|
this.propertyMap = {};
|
|
21
|
+
this.methods = new Map();
|
|
21
22
|
// Properties of type List<T>, or marked with the ChildList or ChildObject decorator.
|
|
22
23
|
this.children = [];
|
|
23
24
|
// Properties marked with the parent decorator, multiple if a class can be child of more than one type.
|
|
@@ -80,6 +81,9 @@ var NeoTypeInfo = /** @class */ (function () {
|
|
|
80
81
|
pi.isReadOnly = descriptor.set === undefined;
|
|
81
82
|
pi.descriptor = descriptor;
|
|
82
83
|
};
|
|
84
|
+
NeoTypeInfo.prototype.addMethod = function (methodName) {
|
|
85
|
+
return this.methods.getOrAdd(methodName, function () { return new MethodInfo(methodName); });
|
|
86
|
+
};
|
|
83
87
|
NeoTypeInfo.prototype.addAttributeRule = function (propertyName, rule) {
|
|
84
88
|
this.getOrAddProperty(propertyName).addAttributeRule(rule);
|
|
85
89
|
};
|
|
@@ -99,13 +103,22 @@ var NeoTypeInfo = /** @class */ (function () {
|
|
|
99
103
|
}
|
|
100
104
|
this.modelCreator.initialise(this, this.objectConstructor);
|
|
101
105
|
if (instance && this.modelCreator.shouldInitialiseAllMembers) {
|
|
102
|
-
|
|
106
|
+
var allProperties = __spreadArray([], this.properties, true);
|
|
107
|
+
var ownProperties = [];
|
|
108
|
+
for (var _i = 0, _a = Object.keys(instance); _i < _a.length; _i++) {
|
|
103
109
|
var propertyName = _a[_i];
|
|
104
|
-
if (
|
|
110
|
+
if (!(typeof instance[propertyName] === "function")) {
|
|
105
111
|
var pi = this.getOrAddProperty(propertyName);
|
|
106
112
|
pi.setupFromInstance(instance);
|
|
113
|
+
// Properties with decorators will be added before own properties.
|
|
114
|
+
// Mobx as of version 6 deletes properties, and re-adds them,
|
|
115
|
+
// causing future Object.keys evaulations to return the keys in the order they are passed to mobX.
|
|
116
|
+
// This will preserve the order of the keys as they were defined in the object.
|
|
117
|
+
allProperties.remove(pi);
|
|
118
|
+
ownProperties.push(pi);
|
|
107
119
|
}
|
|
108
120
|
}
|
|
121
|
+
this.properties = __spreadArray(__spreadArray([], ownProperties, true), allProperties, true);
|
|
109
122
|
}
|
|
110
123
|
if (instance)
|
|
111
124
|
this.addRules(instance);
|
|
@@ -247,7 +260,13 @@ var NeoTypeInfo = /** @class */ (function () {
|
|
|
247
260
|
else {
|
|
248
261
|
instance[hasConvertedSymbol] = true;
|
|
249
262
|
}
|
|
250
|
-
|
|
263
|
+
try {
|
|
264
|
+
return this.modelCreator.convertInstance(instance, options);
|
|
265
|
+
}
|
|
266
|
+
catch (e) {
|
|
267
|
+
console.error("Error converting model type " + instance.constructor.name);
|
|
268
|
+
throw e;
|
|
269
|
+
}
|
|
251
270
|
}
|
|
252
271
|
return instance;
|
|
253
272
|
};
|
|
@@ -7,7 +7,6 @@ var PropertyInfo = /** @class */ (function () {
|
|
|
7
7
|
this.attributeRules = [];
|
|
8
8
|
/** Name to use on labels for this property */
|
|
9
9
|
this.displayName = "";
|
|
10
|
-
// TODO: noTrack and Observable should be combined and use an enum?
|
|
11
10
|
/** True if the property does not cause the object to become dirty. */
|
|
12
11
|
this.noTrack = false;
|
|
13
12
|
/**
|
package/dist/NumberUtils.d.ts
CHANGED
|
@@ -11,12 +11,16 @@ export declare enum NumberFormat {
|
|
|
11
11
|
}
|
|
12
12
|
export default class NumberUtils {
|
|
13
13
|
static thousandsSeparator: string;
|
|
14
|
+
static decimalSeparator?: string;
|
|
15
|
+
/** Set this to `","` if you want to allow a comma as a decimal separator when parsing string input. */
|
|
16
|
+
static allowAsDecimalSeparator?: string;
|
|
14
17
|
static defaultCurrencySymbol: string;
|
|
15
|
-
static numberFormats: {
|
|
16
|
-
[key in NumberFormat]: string;
|
|
17
|
-
};
|
|
18
|
+
static numberFormats: {};
|
|
18
19
|
/** If values typed into numeric editors should be divided by 100 when stored. */
|
|
19
20
|
static transformPercent: boolean;
|
|
21
|
+
static initialise(): void;
|
|
22
|
+
/** Uses the users local decimal separator when formatting and parsing numbers. */
|
|
23
|
+
static useLocaleDecimalSeparator(): void;
|
|
20
24
|
/** Gets a format string for the pre-defined number format.
|
|
21
25
|
* @param displayDecimals No of decimals to display if using a decimals format.
|
|
22
26
|
*/
|
package/dist/NumberUtils.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
var _a;
|
|
2
1
|
import Decimal from "decimal.js-light";
|
|
3
2
|
import { DataType } from "./Model/Misc";
|
|
4
3
|
import Globals from './Globals';
|
|
5
4
|
export var NumberFormat;
|
|
6
5
|
(function (NumberFormat) {
|
|
7
|
-
// Mask is [Thousands
|
|
6
|
+
// Mask is [Thousands Separator, Decimals (2 places), Percent, Currency Symbol]
|
|
8
7
|
NumberFormat[NumberFormat["None"] = 0] = "None";
|
|
9
8
|
NumberFormat[NumberFormat["NoDecimals"] = 4096] = "NoDecimals";
|
|
10
9
|
NumberFormat[NumberFormat["Decimals"] = 4352] = "Decimals";
|
|
@@ -16,6 +15,22 @@ export var NumberFormat;
|
|
|
16
15
|
var NumberUtils = /** @class */ (function () {
|
|
17
16
|
function NumberUtils() {
|
|
18
17
|
}
|
|
18
|
+
NumberUtils.initialise = function () {
|
|
19
|
+
NumberUtils.numberFormats[NumberFormat.None] = "#";
|
|
20
|
+
NumberUtils.numberFormats[NumberFormat.NoDecimals] = "#,##0;(#,##0)";
|
|
21
|
+
NumberUtils.numberFormats[NumberFormat.Decimals] = "#,##0.00;(#,##0.00)";
|
|
22
|
+
NumberUtils.numberFormats[NumberFormat.PercentNoDecimals] = "#,##0%;(#,##0)%";
|
|
23
|
+
NumberUtils.numberFormats[NumberFormat.PercentDecimals] = "#,##0.00%;(#,##0.00%)";
|
|
24
|
+
NumberUtils.numberFormats[NumberFormat.CurrencyNoDecimals] = "_#,##0;(_#,##0)";
|
|
25
|
+
NumberUtils.numberFormats[NumberFormat.CurrencyDecimals] = "_#,##0.00;(_#,##0.00)";
|
|
26
|
+
};
|
|
27
|
+
/** Uses the users local decimal separator when formatting and parsing numbers. */
|
|
28
|
+
NumberUtils.useLocaleDecimalSeparator = function () {
|
|
29
|
+
this.decimalSeparator = 1.1.toLocaleString().substring(1, 2);
|
|
30
|
+
if (this.decimalSeparator !== ".") {
|
|
31
|
+
this.allowAsDecimalSeparator = this.decimalSeparator;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
19
34
|
/** Gets a format string for the pre-defined number format.
|
|
20
35
|
* @param displayDecimals No of decimals to display if using a decimals format.
|
|
21
36
|
*/
|
|
@@ -224,6 +239,9 @@ var NumberUtils = /** @class */ (function () {
|
|
|
224
239
|
}
|
|
225
240
|
numberStrings[0] = str;
|
|
226
241
|
}
|
|
242
|
+
if (this.decimalSeparator) {
|
|
243
|
+
decimal = this.decimalSeparator;
|
|
244
|
+
}
|
|
227
245
|
numberStrings[1] = (numberParts[1] && numberStrings[1]) ? decimal + numberStrings[1] : "";
|
|
228
246
|
numberStrings[0] = numberStrings[0].replace(/,/g, NumberUtils.thousandsSeparator);
|
|
229
247
|
return beforeText + numberStrings[0] + numberStrings[1] + afterText; //put back any negation and combine integer and fraction.
|
|
@@ -231,17 +249,10 @@ var NumberUtils = /** @class */ (function () {
|
|
|
231
249
|
;
|
|
232
250
|
NumberUtils.thousandsSeparator = "\xA0"; // non breaking space.
|
|
233
251
|
NumberUtils.defaultCurrencySymbol = "R";
|
|
234
|
-
NumberUtils.numberFormats =
|
|
235
|
-
_a[NumberFormat.None] = "#",
|
|
236
|
-
_a[NumberFormat.NoDecimals] = "#,##0;(#,##0)",
|
|
237
|
-
_a[NumberFormat.Decimals] = "#,##0.00;(#,##0.00)",
|
|
238
|
-
_a[NumberFormat.PercentNoDecimals] = "#,##0%;(#,##0)%",
|
|
239
|
-
_a[NumberFormat.PercentDecimals] = "#,##0.00%;(#,##0.00%)",
|
|
240
|
-
_a[NumberFormat.CurrencyNoDecimals] = "_#,##0;(_#,##0)",
|
|
241
|
-
_a[NumberFormat.CurrencyDecimals] = "_#,##0.00;(_#,##0.00)",
|
|
242
|
-
_a);
|
|
252
|
+
NumberUtils.numberFormats = {};
|
|
243
253
|
/** If values typed into numeric editors should be divided by 100 when stored. */
|
|
244
254
|
NumberUtils.transformPercent = true;
|
|
245
255
|
return NumberUtils;
|
|
246
256
|
}());
|
|
247
257
|
export default NumberUtils;
|
|
258
|
+
NumberUtils.initialise();
|
package/dist/Settings.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { ValidationDisplayMode } from './Validation/Misc';
|
|
|
2
2
|
import { IButtonOptions } from './Components/ButtonOptions';
|
|
3
3
|
import { DataType } from './Model/Misc';
|
|
4
4
|
export declare const Settings: {
|
|
5
|
+
/** Specify this if your app has a header that is fixed to the top of the screen. */
|
|
6
|
+
fixedAppHeaderElement: (() => HTMLElement | null) | null;
|
|
5
7
|
/**
|
|
6
8
|
* Time the css animation takes to show / hide a modal. Note: This must match the css animation time.
|
|
7
9
|
*/
|
|
@@ -38,6 +40,11 @@ export declare const Settings: {
|
|
|
38
40
|
expandButton: IButtonOptions;
|
|
39
41
|
boolTrueClass: string;
|
|
40
42
|
boolFalseClass: string;
|
|
43
|
+
/**
|
|
44
|
+
* Will cause headers to stick to the top of the screen / scroll element when scrolling.
|
|
45
|
+
* This will apply to all NeoGrids, but can be overridden per grid.
|
|
46
|
+
*/
|
|
47
|
+
useStickyHeaders: boolean;
|
|
41
48
|
};
|
|
42
49
|
modal: {
|
|
43
50
|
acceptButton: IButtonOptions;
|
package/dist/Settings.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ValidationDisplayMode } from './Validation/Misc';
|
|
2
2
|
import { DataType } from './Model/Misc';
|
|
3
3
|
export var Settings = {
|
|
4
|
+
/** Specify this if your app has a header that is fixed to the top of the screen. */
|
|
5
|
+
fixedAppHeaderElement: null,
|
|
4
6
|
/**
|
|
5
7
|
* Time the css animation takes to show / hide a modal. Note: This must match the css animation time.
|
|
6
8
|
*/
|
|
@@ -60,7 +62,12 @@ export var Settings = {
|
|
|
60
62
|
tabIndex: -1
|
|
61
63
|
},
|
|
62
64
|
boolTrueClass: "far fa-lg fa-check-square",
|
|
63
|
-
boolFalseClass: "far fa-lg fa-square text-light"
|
|
65
|
+
boolFalseClass: "far fa-lg fa-square text-light",
|
|
66
|
+
/**
|
|
67
|
+
* Will cause headers to stick to the top of the screen / scroll element when scrolling.
|
|
68
|
+
* This will apply to all NeoGrids, but can be overridden per grid.
|
|
69
|
+
*/
|
|
70
|
+
useStickyHeaders: false,
|
|
64
71
|
},
|
|
65
72
|
modal: {
|
|
66
73
|
acceptButton: {
|
|
@@ -2,6 +2,7 @@ import * as signalR from '@microsoft/signalr';
|
|
|
2
2
|
import { IHubReceiver } from "./HubReceiver";
|
|
3
3
|
import { AppServices } from '../';
|
|
4
4
|
import { IConnection, ConnectionState } from '../ConnectionManager';
|
|
5
|
+
import { IDisposable } from '../Misc';
|
|
5
6
|
export interface IHubBase extends IConnection {
|
|
6
7
|
/**
|
|
7
8
|
* Connects to the server hub if the connection state is disconnected.
|
|
@@ -31,7 +32,7 @@ export interface IHubOptions {
|
|
|
31
32
|
/** Log level in production. Defaults to Error. */
|
|
32
33
|
releaseLogLevel: signalR.LogLevel;
|
|
33
34
|
}
|
|
34
|
-
export declare class HubBase implements IHubBase {
|
|
35
|
+
export declare class HubBase implements IHubBase, IDisposable {
|
|
35
36
|
private url;
|
|
36
37
|
private authenticationService;
|
|
37
38
|
private connection;
|
|
@@ -53,6 +54,8 @@ export declare class HubBase implements IHubBase {
|
|
|
53
54
|
connect(): Promise<boolean>;
|
|
54
55
|
connectIfAuthenticated(): Promise<boolean>;
|
|
55
56
|
disconnect(): Promise<void>;
|
|
57
|
+
/** Disconnects the hub client from the hub. Subscriptions are not disposed. */
|
|
58
|
+
dispose(): void;
|
|
56
59
|
/**
|
|
57
60
|
* Invokes a method on the server hub, returning a promise.
|
|
58
61
|
* The Promise is resolved with the return value (if any) when the method on the server returns.
|
package/dist/SignalR/HubBase.js
CHANGED
|
@@ -119,6 +119,10 @@ var HubBase = /** @class */ (function () {
|
|
|
119
119
|
HubBase.prototype.disconnect = function () {
|
|
120
120
|
return this.connection.stop();
|
|
121
121
|
};
|
|
122
|
+
/** Disconnects the hub client from the hub. Subscriptions are not disposed. */
|
|
123
|
+
HubBase.prototype.dispose = function () {
|
|
124
|
+
this.disconnect();
|
|
125
|
+
};
|
|
122
126
|
/**
|
|
123
127
|
* Invokes a method on the server hub, returning a promise.
|
|
124
128
|
* The Promise is resolved with the return value (if any) when the method on the server returns.
|
package/dist/Utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __spreadArray } from "tslib";
|
|
2
2
|
import { DebounceHelper } from './DebounceHelper';
|
|
3
|
+
import { ensureTypeInfo } from './Model/NeoTypeInfo';
|
|
3
4
|
var lut = [];
|
|
4
5
|
for (var i = 0; i < 256; i++) {
|
|
5
6
|
lut[i] = (i < 16 ? '0' : '') + (i).toString(16);
|
|
@@ -76,7 +77,7 @@ var Utils = /** @class */ (function () {
|
|
|
76
77
|
args[_i - 1] = arguments[_i];
|
|
77
78
|
}
|
|
78
79
|
if (type.prototype.constructor.neo) {
|
|
79
|
-
return type.
|
|
80
|
+
return ensureTypeInfo(type).neo.createInstance(args);
|
|
80
81
|
}
|
|
81
82
|
else {
|
|
82
83
|
throw "Cannot instantiate '".concat(type.name, "' because it does not have an @NeoModel attribute.");
|