@singularsystems/neo-core 0.10.50 → 1.0.0-alpha.2
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.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 +1 -1
- package/dist/Components/FileManager/FileManager.js +4 -4
- 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/ProgressState.js +1 -1
- package/dist/Components/TaskRunner/TaskRunner.js +10 -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.d.ts +1 -10
- package/dist/Data/DataView.js +19 -19
- 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/IAutoRunner.js +1 -0
- package/dist/Model/IModelBase.js +1 -0
- package/dist/Model/IModelCreatorBase.js +1 -0
- package/dist/Model/List.d.ts +1 -1
- package/dist/Model/List.js +4 -22
- 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/package.json +18 -13
|
@@ -47,7 +47,7 @@ var PageManager = /** @class */ (function (_super) {
|
|
|
47
47
|
set: function (value) {
|
|
48
48
|
this.pageRequest.criteria = value;
|
|
49
49
|
},
|
|
50
|
-
enumerable:
|
|
50
|
+
enumerable: false,
|
|
51
51
|
configurable: true
|
|
52
52
|
});
|
|
53
53
|
Object.defineProperty(PageManager.prototype, "hasFetched", {
|
|
@@ -61,7 +61,7 @@ var PageManager = /** @class */ (function (_super) {
|
|
|
61
61
|
}
|
|
62
62
|
return this.initialFetchState === "complete";
|
|
63
63
|
},
|
|
64
|
-
enumerable:
|
|
64
|
+
enumerable: false,
|
|
65
65
|
configurable: true
|
|
66
66
|
});
|
|
67
67
|
Object.defineProperty(PageManager.prototype, "pageNo", {
|
|
@@ -78,7 +78,7 @@ var PageManager = /** @class */ (function (_super) {
|
|
|
78
78
|
this.refreshData(false);
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
|
-
enumerable:
|
|
81
|
+
enumerable: false,
|
|
82
82
|
configurable: true
|
|
83
83
|
});
|
|
84
84
|
Object.defineProperty(PageManager.prototype, "pageSize", {
|
|
@@ -97,14 +97,14 @@ var PageManager = /** @class */ (function (_super) {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
|
-
enumerable:
|
|
100
|
+
enumerable: false,
|
|
101
101
|
configurable: true
|
|
102
102
|
});
|
|
103
103
|
Object.defineProperty(PageManager.prototype, "totalRecords", {
|
|
104
104
|
get: function () {
|
|
105
105
|
return this._totalRecords;
|
|
106
106
|
},
|
|
107
|
-
enumerable:
|
|
107
|
+
enumerable: false,
|
|
108
108
|
configurable: true
|
|
109
109
|
});
|
|
110
110
|
Object.defineProperty(PageManager.prototype, "totalPages", {
|
|
@@ -117,7 +117,7 @@ var PageManager = /** @class */ (function (_super) {
|
|
|
117
117
|
return Math.ceil(this.totalRecords / this.pageRequest.pageSize);
|
|
118
118
|
}
|
|
119
119
|
},
|
|
120
|
-
enumerable:
|
|
120
|
+
enumerable: false,
|
|
121
121
|
configurable: true
|
|
122
122
|
});
|
|
123
123
|
/**
|
|
@@ -264,7 +264,7 @@ var PageManager = /** @class */ (function (_super) {
|
|
|
264
264
|
get: function () {
|
|
265
265
|
return this.currentData;
|
|
266
266
|
},
|
|
267
|
-
enumerable:
|
|
267
|
+
enumerable: false,
|
|
268
268
|
configurable: true
|
|
269
269
|
});
|
|
270
270
|
PageManager.prototype.getItems = function () {
|
|
@@ -277,14 +277,14 @@ var PageManager = /** @class */ (function (_super) {
|
|
|
277
277
|
get: function () {
|
|
278
278
|
return this.currentData;
|
|
279
279
|
},
|
|
280
|
-
enumerable:
|
|
280
|
+
enumerable: false,
|
|
281
281
|
configurable: true
|
|
282
282
|
});
|
|
283
283
|
Object.defineProperty(PageManager.prototype, "pageSizeOptions", {
|
|
284
284
|
get: function () {
|
|
285
285
|
return this.options.pageSizeOptions;
|
|
286
286
|
},
|
|
287
|
-
enumerable:
|
|
287
|
+
enumerable: false,
|
|
288
288
|
configurable: true
|
|
289
289
|
});
|
|
290
290
|
PageManager.prototype.getMetaItem = function () {
|
package/dist/Data/Serialiser.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Deserialiser } from './Deserialiser';
|
|
|
3
3
|
import ValueObject from '../Model/ValueObject';
|
|
4
4
|
import DateUtils from '../Dates/DateUtils';
|
|
5
5
|
import Globals from '../Globals';
|
|
6
|
+
var referenceIdKey = Symbol("referenceId");
|
|
6
7
|
var JSFormatter = /** @class */ (function () {
|
|
7
8
|
function JSFormatter() {
|
|
8
9
|
}
|
|
@@ -41,6 +42,7 @@ var Serialiser = /** @class */ (function () {
|
|
|
41
42
|
if (options === void 0) { options = {}; }
|
|
42
43
|
this.options = options;
|
|
43
44
|
var to;
|
|
45
|
+
this.currentID = 1;
|
|
44
46
|
if (fromObject instanceof Array) {
|
|
45
47
|
to = [];
|
|
46
48
|
this.serialiseArray(fromObject, to);
|
|
@@ -57,25 +59,33 @@ var Serialiser = /** @class */ (function () {
|
|
|
57
59
|
*/
|
|
58
60
|
Serialiser.prototype.cleanUpObjects = function () {
|
|
59
61
|
for (var id in this.objectRefs) {
|
|
60
|
-
|
|
62
|
+
var refInfo = this.objectRefs[id];
|
|
63
|
+
delete refInfo.from[referenceIdKey];
|
|
64
|
+
// Remove $id property if object is not referenced by anything.
|
|
65
|
+
if (!refInfo.isReferenced) {
|
|
66
|
+
delete refInfo.to.$id;
|
|
67
|
+
}
|
|
61
68
|
}
|
|
69
|
+
this.objectRefs = {};
|
|
62
70
|
};
|
|
63
71
|
Serialiser.prototype.serialiseObject = function (from, to, isDictionary) {
|
|
64
72
|
if (isDictionary === void 0) { isDictionary = false; }
|
|
65
73
|
//check that this object hasnt already been serialised.
|
|
66
|
-
|
|
67
|
-
|
|
74
|
+
var referenceId = from[referenceIdKey];
|
|
75
|
+
if (!referenceId) {
|
|
76
|
+
referenceId = this.currentID++;
|
|
77
|
+
from[referenceIdKey] = referenceId;
|
|
68
78
|
}
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
if (toReference) {
|
|
79
|
+
var referenceInfo = this.objectRefs[referenceId];
|
|
80
|
+
if (referenceInfo) {
|
|
72
81
|
//already serialised this object
|
|
73
|
-
|
|
74
|
-
|
|
82
|
+
referenceInfo.isReferenced = true;
|
|
83
|
+
to.$ref = referenceInfo.to.$id;
|
|
75
84
|
return;
|
|
76
85
|
}
|
|
77
86
|
else {
|
|
78
|
-
this.objectRefs[
|
|
87
|
+
this.objectRefs[referenceId] = { from: from, to: to };
|
|
88
|
+
to.$id = referenceId.toString();
|
|
79
89
|
}
|
|
80
90
|
//Set tracking state
|
|
81
91
|
if (!this.options.suppressTrackingState && !isDictionary) {
|
|
@@ -115,7 +125,7 @@ var Serialiser = /** @class */ (function () {
|
|
|
115
125
|
}
|
|
116
126
|
}
|
|
117
127
|
else if (isChildObject && !propertyInfo.assignOnDeserialise) {
|
|
118
|
-
if (!fromValue || (propertyInfo.relationType === RelationType.Parent && !fromValue
|
|
128
|
+
if (!fromValue || (propertyInfo.relationType === RelationType.Parent && !fromValue[referenceIdKey])) {
|
|
119
129
|
// Parents must only be included if they reference an already serialised object.
|
|
120
130
|
// Otherwise serialising a leaf node will serialise up the tree and the entire graph will be serialised.
|
|
121
131
|
}
|
|
@@ -147,7 +157,7 @@ var Serialiser = /** @class */ (function () {
|
|
|
147
157
|
}
|
|
148
158
|
}
|
|
149
159
|
catch (error) {
|
|
150
|
-
throw "Error serialising property '"
|
|
160
|
+
throw "Error serialising property '".concat(key, "' on type '").concat(from.constructor.name, "': ").concat(error);
|
|
151
161
|
}
|
|
152
162
|
}
|
|
153
163
|
}
|
|
@@ -17,7 +17,7 @@ var WindowedDataView = /** @class */ (function (_super) {
|
|
|
17
17
|
set: function (value) {
|
|
18
18
|
this._position = Math.max(0, Math.min(value, this.sortedItems.length - this.maxItems));
|
|
19
19
|
},
|
|
20
|
-
enumerable:
|
|
20
|
+
enumerable: false,
|
|
21
21
|
configurable: true
|
|
22
22
|
});
|
|
23
23
|
WindowedDataView.prototype.getItems = function () {
|
package/dist/Dates/DateUtils.js
CHANGED
|
@@ -5,10 +5,9 @@ var DateUtils = /** @class */ (function () {
|
|
|
5
5
|
}
|
|
6
6
|
DateUtils.format = function (dateOrDateProperty, formatString, utc) {
|
|
7
7
|
if (utc === void 0) { utc = false; }
|
|
8
|
-
var _a;
|
|
9
8
|
var date = dateOrDateProperty;
|
|
10
9
|
var dateProperty = dateOrDateProperty;
|
|
11
|
-
if (
|
|
10
|
+
if (dateProperty === null || dateProperty === void 0 ? void 0 : dateProperty.propertyInfo) {
|
|
12
11
|
date = dateProperty.value;
|
|
13
12
|
formatString = dateProperty.propertyInfo.timeZoneSerialisation === Misc.TimeZoneFormat.None ? DateUtils.defaultFormatString : DateUtils.defaultFormatStringWithTime;
|
|
14
13
|
}
|
|
@@ -186,8 +185,8 @@ var DateUtils = /** @class */ (function () {
|
|
|
186
185
|
DateUtils.add = function (date, timeSpan) {
|
|
187
186
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
188
187
|
var newDate = new Date();
|
|
189
|
-
newDate.setFullYear(date.getFullYear() + (_a = timeSpan.years
|
|
190
|
-
newDate.setHours(date.getHours() + (_d = timeSpan.hours
|
|
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
|
+
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));
|
|
191
190
|
return newDate;
|
|
192
191
|
};
|
|
193
192
|
/**
|
package/dist/Dates/TimeSpan.js
CHANGED
|
@@ -17,28 +17,28 @@ var TimeSpan = /** @class */ (function () {
|
|
|
17
17
|
get: function () {
|
|
18
18
|
return Math.floor(this.totalMilliseconds / msPerSecond);
|
|
19
19
|
},
|
|
20
|
-
enumerable:
|
|
20
|
+
enumerable: false,
|
|
21
21
|
configurable: true
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(TimeSpan.prototype, "totalMinutes", {
|
|
24
24
|
get: function () {
|
|
25
25
|
return Math.floor(this.totalMilliseconds / msPerMinute);
|
|
26
26
|
},
|
|
27
|
-
enumerable:
|
|
27
|
+
enumerable: false,
|
|
28
28
|
configurable: true
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(TimeSpan.prototype, "totalHours", {
|
|
31
31
|
get: function () {
|
|
32
32
|
return Math.floor(this.totalMilliseconds / msPerHour);
|
|
33
33
|
},
|
|
34
|
-
enumerable:
|
|
34
|
+
enumerable: false,
|
|
35
35
|
configurable: true
|
|
36
36
|
});
|
|
37
37
|
Object.defineProperty(TimeSpan.prototype, "totalDays", {
|
|
38
38
|
get: function () {
|
|
39
39
|
return Math.floor(this.totalMilliseconds / msPerDay);
|
|
40
40
|
},
|
|
41
|
-
enumerable:
|
|
41
|
+
enumerable: false,
|
|
42
42
|
configurable: true
|
|
43
43
|
});
|
|
44
44
|
return TimeSpan;
|
package/dist/Extensions.d.ts
CHANGED
|
@@ -31,14 +31,10 @@ declare global {
|
|
|
31
31
|
sortBy(valueFn: (item: T) => any, direction?: "asc" | "desc", dataType?: DataType): Array<T>;
|
|
32
32
|
/** Removes the item if found in the array. */
|
|
33
33
|
remove(item: T): void;
|
|
34
|
-
/**
|
|
35
|
-
* Returns the sum of the values returned by the selector function.
|
|
36
|
-
*/
|
|
37
|
-
sum(selector: (item: T) => number): number;
|
|
38
34
|
/**
|
|
39
35
|
* Returns the sum for a given property.
|
|
40
36
|
*/
|
|
41
|
-
sum<V extends number | Decimal = number>(propertyName: keyof T | IPropertyInstance<V> | PropertyInfo): V;
|
|
37
|
+
sum<V extends number | Decimal = number>(propertyName: keyof T | IPropertyInstance<V> | PropertyInfo | ((item: T) => number)): V;
|
|
42
38
|
/**
|
|
43
39
|
* Returns the sum for a given property.
|
|
44
40
|
*/
|
package/dist/Extensions.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __spreadArray } from "tslib";
|
|
2
2
|
import { DataType } from './Misc';
|
|
3
3
|
import Decimal from 'decimal.js-light';
|
|
4
4
|
//#region Strings
|
|
@@ -109,7 +109,18 @@ function getPropertyName(property) {
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
Array.prototype.sum = function (property) {
|
|
112
|
-
|
|
112
|
+
if (property instanceof Function) {
|
|
113
|
+
return this.reduce(function (total, item) { return total + property(item); }, 0);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
var propertyInfo_1 = getPropertyName(property);
|
|
117
|
+
if (propertyInfo_1.isDecimal) {
|
|
118
|
+
return sumDecimal(this, propertyInfo_1.key);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
return this.reduce(function (total, item) { return total + item[propertyInfo_1.key]; }, 0);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
113
124
|
};
|
|
114
125
|
Array.prototype.sumDecimal = function (property) {
|
|
115
126
|
if (property instanceof Function) {
|
|
@@ -120,25 +131,11 @@ Array.prototype.sumDecimal = function (property) {
|
|
|
120
131
|
return sumDecimal(this, propertyInfo.key);
|
|
121
132
|
}
|
|
122
133
|
};
|
|
123
|
-
function sum(items, property) {
|
|
124
|
-
if (property instanceof Function) {
|
|
125
|
-
return items.reduce(function (total, item) { return total + property(item); }, 0);
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
var propertyInfo_1 = getPropertyName(property);
|
|
129
|
-
if (propertyInfo_1.isDecimal) {
|
|
130
|
-
return sumDecimal(items, propertyInfo_1.key);
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
return items.reduce(function (total, item) { return total + item[propertyInfo_1.key]; }, 0);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
134
|
function sumDecimal(items, propertyName) {
|
|
138
135
|
return items.reduce(function (total, item) { return total.add(item[propertyName]); }, new Decimal(0));
|
|
139
136
|
}
|
|
140
137
|
Array.prototype.average = function (property) {
|
|
141
|
-
return this.length === 0 ? 0 : sum(
|
|
138
|
+
return this.length === 0 ? 0 : this.sum(property) / this.length;
|
|
142
139
|
};
|
|
143
140
|
Array.prototype.groupBy = function (key, selector) {
|
|
144
141
|
var keyIsFn = typeof key === "function";
|
|
@@ -162,16 +159,16 @@ Array.prototype.groupBy = function (key, selector) {
|
|
|
162
159
|
};
|
|
163
160
|
Array.prototype.toDictionary = function (keyFn, valueFn) {
|
|
164
161
|
if (valueFn) {
|
|
165
|
-
return Object.assign.apply(Object,
|
|
162
|
+
return Object.assign.apply(Object, __spreadArray([{}], this.map(function (item) {
|
|
166
163
|
var _a;
|
|
167
164
|
return (_a = {}, _a[keyFn(item)] = valueFn(item), _a);
|
|
168
|
-
})));
|
|
165
|
+
}), false));
|
|
169
166
|
}
|
|
170
167
|
else {
|
|
171
|
-
return Object.assign.apply(Object,
|
|
168
|
+
return Object.assign.apply(Object, __spreadArray([{}], this.map(function (item) {
|
|
172
169
|
var _a;
|
|
173
170
|
return (_a = {}, _a[keyFn(item)] = item, _a);
|
|
174
|
-
})));
|
|
171
|
+
}), false));
|
|
175
172
|
}
|
|
176
173
|
};
|
|
177
174
|
//#endregion
|
package/dist/Globals.js
CHANGED
|
@@ -9,9 +9,9 @@ var Globals = /** @class */ (function () {
|
|
|
9
9
|
*/
|
|
10
10
|
get: function () {
|
|
11
11
|
var _a;
|
|
12
|
-
return _a = this.shadowRoot
|
|
12
|
+
return (_a = this.shadowRoot) !== null && _a !== void 0 ? _a : window.document;
|
|
13
13
|
},
|
|
14
|
-
enumerable:
|
|
14
|
+
enumerable: false,
|
|
15
15
|
configurable: true
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(Globals, "rootElement", {
|
|
@@ -21,9 +21,9 @@ var Globals = /** @class */ (function () {
|
|
|
21
21
|
*/
|
|
22
22
|
get: function () {
|
|
23
23
|
var _a;
|
|
24
|
-
return _a = this.shadowRoot
|
|
24
|
+
return (_a = this.shadowRoot) !== null && _a !== void 0 ? _a : window.document.body;
|
|
25
25
|
},
|
|
26
|
-
enumerable:
|
|
26
|
+
enumerable: false,
|
|
27
27
|
configurable: true
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(Globals, "decimalType", {
|
|
@@ -33,7 +33,7 @@ var Globals = /** @class */ (function () {
|
|
|
33
33
|
}
|
|
34
34
|
return this._decimalType;
|
|
35
35
|
},
|
|
36
|
-
enumerable:
|
|
36
|
+
enumerable: false,
|
|
37
37
|
configurable: true
|
|
38
38
|
});
|
|
39
39
|
return Globals;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -10,14 +10,14 @@ var TypeCache = /** @class */ (function () {
|
|
|
10
10
|
get: function () {
|
|
11
11
|
return this._root;
|
|
12
12
|
},
|
|
13
|
-
enumerable:
|
|
13
|
+
enumerable: false,
|
|
14
14
|
configurable: true
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(TypeCache.prototype, "objects", {
|
|
17
17
|
get: function () {
|
|
18
18
|
return this._objects;
|
|
19
19
|
},
|
|
20
|
-
enumerable:
|
|
20
|
+
enumerable: false,
|
|
21
21
|
configurable: true
|
|
22
22
|
});
|
|
23
23
|
TypeCache.prototype.getOrAddType = function (name) {
|
|
@@ -29,7 +29,7 @@ var TypeMetadata = /** @class */ (function () {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
TypeMetadata.prototype.parse = function (schema, cache) {
|
|
32
|
-
var _a
|
|
32
|
+
var _a;
|
|
33
33
|
if (schema.items) {
|
|
34
34
|
var innerType = TypeMetadata.create(schema.items, cache);
|
|
35
35
|
if (innerType.basicType !== "unknown") {
|
|
@@ -48,7 +48,7 @@ var TypeMetadata = /** @class */ (function () {
|
|
|
48
48
|
var types = schema.oneOf;
|
|
49
49
|
var basicType = types.find(function (c) { return c.type; });
|
|
50
50
|
var refType = types.find(function (c) { return c.$ref; });
|
|
51
|
-
if ((
|
|
51
|
+
if ((basicType === null || basicType === void 0 ? void 0 : basicType.type) === "null" && refType) {
|
|
52
52
|
this.parse(refType, cache);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -56,10 +56,10 @@ var TypeMetadata = /** @class */ (function () {
|
|
|
56
56
|
var types = schema.allOf;
|
|
57
57
|
var basicType = types.find(function (c) { return c.type; });
|
|
58
58
|
var refType = types.find(function (c) { return c.$ref; });
|
|
59
|
-
if ((
|
|
59
|
+
if ((basicType === null || basicType === void 0 ? void 0 : basicType.type) === "object" && refType) {
|
|
60
60
|
this.parse(refType, cache);
|
|
61
61
|
this.customType = this.customType.clone();
|
|
62
|
-
(
|
|
62
|
+
(_a = this.customType) === null || _a === void 0 ? void 0 : _a.loadMetaData(basicType, cache);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
else if (schema.type) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SerialiseType, DataType, TimeZoneFormat } from './Misc';
|
|
2
2
|
export declare function Display(name: string): (type: any, propertyKey: string) => void;
|
|
3
3
|
/** Indicates that this is a date property. Json strings will be converted to date objects on deserialisation. */
|
|
4
|
-
export declare function Date(timeZoneSerialisation?: TimeZoneFormat): (type: any, propertyKey: string, descriptor?: PropertyDescriptor
|
|
4
|
+
export declare function Date(timeZoneSerialisation?: TimeZoneFormat): (type: any, propertyKey: string, descriptor?: PropertyDescriptor) => void;
|
|
5
5
|
/** Indicates that this is an integer number property. Editors will be restricted to integer numeric input. */
|
|
6
6
|
export declare function Integer(): (type: any, propertyKey: string) => void;
|
|
7
7
|
/** Indicates that this is a float number property. Editors will be restricted to float numeric input. */
|
package/dist/Model/Decorators.js
CHANGED
|
@@ -94,7 +94,7 @@ export function ChildObject(childType, isValueObject) {
|
|
|
94
94
|
return function (type, propertyKey) {
|
|
95
95
|
var pi = getOrAddPropertyInfo(type, propertyKey);
|
|
96
96
|
if (childType === undefined) {
|
|
97
|
-
throw Error("Unknown child type on "
|
|
97
|
+
throw Error("Unknown child type on ".concat(type.constructor.name, ".").concat(propertyKey, ", you may have a circular dependency. Try use @Attributes.ChildObject(() => Type)"));
|
|
98
98
|
}
|
|
99
99
|
pi.setPropertyType(childType);
|
|
100
100
|
if (pi.relationType === RelationType.None) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Model/IModelBase.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Model/List.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export default class List<T> extends Array<T> {
|
|
|
13
13
|
* This is needed because vue / mobx changes the prototype to its own.
|
|
14
14
|
*/
|
|
15
15
|
static copyMethods(toInstance: any): void;
|
|
16
|
-
setupProxy(proxy: any, attachedTo: any
|
|
16
|
+
setupProxy(proxy: any, attachedTo: any): void;
|
|
17
17
|
/**
|
|
18
18
|
* Converts the neo models to plain javascript objects without tracking state.
|
|
19
19
|
* @param options Serialisation options.
|
package/dist/Model/List.js
CHANGED
|
@@ -15,7 +15,7 @@ var List = /** @class */ (function (_super) {
|
|
|
15
15
|
get: function () {
|
|
16
16
|
return this._deletedList.value;
|
|
17
17
|
},
|
|
18
|
-
enumerable:
|
|
18
|
+
enumerable: false,
|
|
19
19
|
configurable: true
|
|
20
20
|
});
|
|
21
21
|
/**
|
|
@@ -41,28 +41,10 @@ var List = /** @class */ (function (_super) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
List.prototype.setupProxy = function (proxy, attachedTo
|
|
44
|
+
List.prototype.setupProxy = function (proxy, attachedTo) {
|
|
45
45
|
proxy.childObjectType = this.childObjectType;
|
|
46
46
|
proxy._deletedList = new ObservableValue([]);
|
|
47
47
|
proxy.attachedTo = attachedTo;
|
|
48
|
-
// Prevent direct writes to properties of type List.
|
|
49
|
-
Object.defineProperty(attachedTo, propertyKey, { set: function (value) {
|
|
50
|
-
if (!value) {
|
|
51
|
-
proxy.length = 0;
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
if (value.childObjectType && value.setParent) {
|
|
55
|
-
// Cannot re-assign this property, so we have to clear the array, and copy the items from the source array.
|
|
56
|
-
Utils.batchUpdate(function () {
|
|
57
|
-
proxy.length = 0;
|
|
58
|
-
proxy.push.apply(proxy, value);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
throw "Do not assign a plain array to a List property. Either call " + propertyKey + ".set(...) or " + propertyKey + ".update(...)";
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
} });
|
|
66
48
|
};
|
|
67
49
|
List.prototype.toJSArray = function (options) {
|
|
68
50
|
if (options === void 0) { options = {}; }
|
|
@@ -193,7 +175,7 @@ var List = /** @class */ (function (_super) {
|
|
|
193
175
|
}
|
|
194
176
|
return true;
|
|
195
177
|
},
|
|
196
|
-
enumerable:
|
|
178
|
+
enumerable: false,
|
|
197
179
|
configurable: true
|
|
198
180
|
});
|
|
199
181
|
Object.defineProperty(List.prototype, "isDirty", {
|
|
@@ -208,7 +190,7 @@ var List = /** @class */ (function (_super) {
|
|
|
208
190
|
}
|
|
209
191
|
return false;
|
|
210
192
|
},
|
|
211
|
-
enumerable:
|
|
193
|
+
enumerable: false,
|
|
212
194
|
configurable: true
|
|
213
195
|
});
|
|
214
196
|
return List;
|
package/dist/Model/ModelBase.js
CHANGED
|
@@ -38,14 +38,14 @@ var ModelBase = /** @class */ (function (_super) {
|
|
|
38
38
|
}
|
|
39
39
|
}).flag;
|
|
40
40
|
},
|
|
41
|
-
enumerable:
|
|
41
|
+
enumerable: false,
|
|
42
42
|
configurable: true
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(ModelBase.prototype, "isSelfValid", {
|
|
45
45
|
get: function () {
|
|
46
46
|
return this.validator.isValid;
|
|
47
47
|
},
|
|
48
|
-
enumerable:
|
|
48
|
+
enumerable: false,
|
|
49
49
|
configurable: true
|
|
50
50
|
});
|
|
51
51
|
Object.defineProperty(ModelBase.prototype, "isValid", {
|
|
@@ -57,7 +57,7 @@ var ModelBase = /** @class */ (function (_super) {
|
|
|
57
57
|
}
|
|
58
58
|
}).flag;
|
|
59
59
|
},
|
|
60
|
-
enumerable:
|
|
60
|
+
enumerable: false,
|
|
61
61
|
configurable: true
|
|
62
62
|
});
|
|
63
63
|
Object.defineProperty(ModelBase.prototype, "readyToSave", {
|
|
@@ -67,7 +67,7 @@ var ModelBase = /** @class */ (function (_super) {
|
|
|
67
67
|
get: function () {
|
|
68
68
|
return this.isDirty && this.isValid;
|
|
69
69
|
},
|
|
70
|
-
enumerable:
|
|
70
|
+
enumerable: false,
|
|
71
71
|
configurable: true
|
|
72
72
|
});
|
|
73
73
|
/** Recursively sets isSelfDirty, and isNew to false on this object and its children. */
|
|
@@ -17,7 +17,7 @@ var ModelCreatorBase = /** @class */ (function () {
|
|
|
17
17
|
get: function () {
|
|
18
18
|
return this.typeInfo.inheritsBindableBase || this.alwaysInitialiseMembers;
|
|
19
19
|
},
|
|
20
|
-
enumerable:
|
|
20
|
+
enumerable: false,
|
|
21
21
|
configurable: true
|
|
22
22
|
});
|
|
23
23
|
ModelCreatorBase.prototype.isBindableBase = function (type) {
|
|
@@ -89,7 +89,7 @@ function invokeOnSelfAndChildren(model, state, callback, listCallback, relationT
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
catch (error) {
|
|
92
|
-
throw "Error on property '"
|
|
92
|
+
throw "Error on property '".concat(cpi.propertyName, "' on type '").concat(model.constructor.name, "': ").concat(error);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __spreadArray } from "tslib";
|
|
2
2
|
import { ExpressionRule, CallbackRule } from '../Validation/Rules';
|
|
3
3
|
import PropertyInstance from './PropertyInstance';
|
|
4
4
|
import PropertyInfo from './PropertyInfo';
|
|
@@ -32,14 +32,14 @@ var NeoTypeInfo = /** @class */ (function () {
|
|
|
32
32
|
get: function () {
|
|
33
33
|
return this._inheritsBindableBase;
|
|
34
34
|
},
|
|
35
|
-
enumerable:
|
|
35
|
+
enumerable: false,
|
|
36
36
|
configurable: true
|
|
37
37
|
});
|
|
38
38
|
Object.defineProperty(NeoTypeInfo.prototype, "inheritsModelBase", {
|
|
39
39
|
get: function () {
|
|
40
40
|
return this._inheritsModelBase;
|
|
41
41
|
},
|
|
42
|
-
enumerable:
|
|
42
|
+
enumerable: false,
|
|
43
43
|
configurable: true
|
|
44
44
|
});
|
|
45
45
|
Object.defineProperty(NeoTypeInfo.prototype, "metaItem", {
|
|
@@ -50,7 +50,7 @@ var NeoTypeInfo = /** @class */ (function () {
|
|
|
50
50
|
}
|
|
51
51
|
return this._metaItem;
|
|
52
52
|
},
|
|
53
|
-
enumerable:
|
|
53
|
+
enumerable: false,
|
|
54
54
|
configurable: true
|
|
55
55
|
});
|
|
56
56
|
NeoTypeInfo.prototype.initialise = function (objectConstructor) {
|
|
@@ -115,7 +115,7 @@ var NeoTypeInfo = /** @class */ (function () {
|
|
|
115
115
|
var validationRules = new ValidationRules();
|
|
116
116
|
instance.addBusinessRules(validationRules);
|
|
117
117
|
if (validationRules.rules.some(function (c) { return c instanceof CallbackRule && c.hasBoundFunction; })) {
|
|
118
|
-
console.error("Warning: "
|
|
118
|
+
console.error("Warning: ".concat(this.objectConstructor.name, " has rules which have been added using a bound function, or arrow function."));
|
|
119
119
|
}
|
|
120
120
|
var modelProxy = new ModelProxy(instance);
|
|
121
121
|
for (var _i = 0, _a = validationRules.rules; _i < _a.length; _i++) {
|
|
@@ -169,10 +169,9 @@ var NeoTypeInfo = /** @class */ (function () {
|
|
|
169
169
|
};
|
|
170
170
|
/** Gets the override constructor which can setup a neo model. */
|
|
171
171
|
NeoTypeInfo.prototype.getOverrideConstructor = function () {
|
|
172
|
-
var _a;
|
|
173
172
|
var self = this;
|
|
174
173
|
var baseType = Object.getPrototypeOf(self.objectConstructor);
|
|
175
|
-
if ((
|
|
174
|
+
if ((baseType === null || baseType === void 0 ? void 0 : baseType.name) === "neoConstructor") {
|
|
176
175
|
return function () {
|
|
177
176
|
throw Error(self.objectConstructor.name + " cannot inherit from a model decorated with @NeoModel.");
|
|
178
177
|
};
|
|
@@ -183,14 +182,14 @@ var NeoTypeInfo = /** @class */ (function () {
|
|
|
183
182
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
184
183
|
args[_i] = arguments[_i];
|
|
185
184
|
}
|
|
186
|
-
var instance = new ((_a = self.objectConstructor).bind.apply(_a,
|
|
185
|
+
var instance = new ((_a = self.objectConstructor).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
187
186
|
return self.makeObservable(instance);
|
|
188
187
|
};
|
|
189
188
|
// Copy statics from the original constructor, and all base classes to the new constructor.
|
|
190
189
|
baseType = this.objectConstructor;
|
|
191
190
|
while (baseType && baseType !== Function.prototype) {
|
|
192
|
-
for (var _i = 0,
|
|
193
|
-
var propertyName =
|
|
191
|
+
for (var _i = 0, _a = Object.getOwnPropertyNames(baseType); _i < _a.length; _i++) {
|
|
192
|
+
var propertyName = _a[_i];
|
|
194
193
|
if (propertyName !== "prototype" && propertyName !== "caller" && propertyName !== "arguments" && propertyName !== "neo") {
|
|
195
194
|
if (newConstructor[propertyName] === undefined) {
|
|
196
195
|
var descriptor = Object.getOwnPropertyDescriptor(baseType, propertyName);
|