@singularsystems/neo-core 0.10.49 → 1.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -13
- package/dist/ApiClient/ReadApiClient.d.ts +1 -1
- package/dist/ApiClient/ReadApiClient.js +1 -1
- package/dist/ApiClient/UpdateableApiClient.js +4 -4
- package/dist/AppServices/Config/ConfigModel.js +1 -1
- package/dist/AppServices/Config/ConfigService.js +4 -4
- package/dist/AppServices/ServiceIdentifier.js +1 -1
- package/dist/Components/AnimationHelper.js +1 -1
- package/dist/Components/BootstrapTypes.js +1 -0
- package/dist/Components/ButtonOptions.d.ts +5 -0
- package/dist/Components/ButtonOptions.js +1 -0
- package/dist/Components/ContextMenu/ContextMenu.js +1 -0
- package/dist/Components/DatePicker/DatePicker.js +2 -3
- package/dist/Components/ErrorHandler.d.ts +4 -1
- package/dist/Components/FileManager/FileManager.d.ts +6 -3
- package/dist/Components/FileManager/FileManager.js +32 -22
- package/dist/Components/FileManager/FileUploadBatch.js +3 -3
- package/dist/Components/FileManager/IFileManagerOptions.js +1 -0
- package/dist/Components/FormOptions.js +1 -0
- package/dist/Components/ICollapsableOptions.js +1 -0
- package/dist/Components/Modal/ModalHelper.js +4 -4
- package/dist/Components/Modal/ModalOptions.d.ts +2 -0
- package/dist/Components/Modal/ModalOptions.js +1 -0
- package/dist/Components/Notifications/INotificationHelper.js +1 -0
- package/dist/Components/Notifications/NotificationHelper.js +1 -1
- package/dist/Components/TaskRunner/Decorators.d.ts +6 -0
- package/dist/Components/TaskRunner/Decorators.js +24 -0
- package/dist/Components/TaskRunner/ProgressState.js +1 -1
- package/dist/Components/TaskRunner/TaskRunner.d.ts +13 -4
- package/dist/Components/TaskRunner/TaskRunner.js +17 -11
- package/dist/Components/TooltipOptions.js +1 -0
- package/dist/Components/index.js +1 -0
- package/dist/ConnectionManager.js +2 -2
- package/dist/Data/ApiDataSource.js +2 -2
- package/dist/Data/AsyncDataSource.js +1 -1
- package/dist/Data/DataCacheEntry.js +3 -3
- package/dist/Data/DataView.js +7 -7
- package/dist/Data/Deserialiser.js +4 -5
- package/dist/Data/Paging/PageManager.js +9 -9
- package/dist/Data/Serialiser.js +21 -11
- package/dist/Data/StaticDataSource.js +1 -1
- package/dist/Data/WindowedDataView.js +1 -1
- package/dist/Dates/DateUtils.js +3 -4
- package/dist/Dates/TimeSpan.js +4 -4
- package/dist/Extensions.d.ts +1 -5
- package/dist/Extensions.js +18 -21
- package/dist/Globals.js +5 -5
- package/dist/JsonSchema/JsonSchemaTypes.js +1 -0
- package/dist/JsonSchema/TypeCache.js +2 -2
- package/dist/JsonSchema/TypeMetadata.js +4 -4
- package/dist/Localisation/ILocalisationService.js +1 -0
- package/dist/Localisation/index.js +1 -0
- package/dist/Model/BaseModels/UserEvent.js +1 -1
- package/dist/Model/Decorators.d.ts +1 -1
- package/dist/Model/Decorators.js +1 -1
- package/dist/Model/EnumHelper.d.ts +7 -0
- package/dist/Model/EnumHelper.js +18 -3
- package/dist/Model/IAutoRunner.d.ts +1 -1
- package/dist/Model/IAutoRunner.js +1 -0
- package/dist/Model/IModelBase.d.ts +1 -1
- package/dist/Model/IModelBase.js +1 -0
- package/dist/Model/IModelCreatorBase.js +1 -0
- package/dist/Model/List.js +4 -4
- package/dist/Model/Misc.d.ts +5 -1
- package/dist/Model/ModelBase.d.ts +1 -1
- package/dist/Model/ModelBase.js +4 -4
- package/dist/Model/ModelCreatorBase.js +1 -1
- package/dist/Model/ModelGraphTraverser.js +1 -1
- package/dist/Model/NeoTypeInfo.js +9 -10
- package/dist/Model/ObservableValue.js +1 -1
- package/dist/Model/PropertyInfo.js +8 -8
- package/dist/Model/PropertyInstance.js +8 -8
- package/dist/Routing/IMenuItemProvider.js +1 -0
- package/dist/Routing/IMenuRoute.js +1 -0
- package/dist/Routing/INavigationHelper.js +1 -0
- package/dist/Routing/IRoute.js +1 -0
- package/dist/Routing/IRouteSecurityService.js +1 -0
- package/dist/Security/IAuthenticationService.js +1 -0
- package/dist/Security/IAuthorisationService.js +1 -0
- package/dist/Security/ILoginErrorHandler.js +1 -0
- package/dist/Security/ISecurityService.js +1 -0
- package/dist/Security/IUser.js +1 -0
- package/dist/Security/IUserRole.js +1 -0
- package/dist/Security/LoginErrorHandler.js +1 -1
- package/dist/Security/Oidc/OidcAuthService.js +8 -3
- package/dist/Security/Oidc/OidcTypes.js +1 -0
- package/dist/Security/Oidc/OidcUser.js +3 -3
- package/dist/Security/SecurityService.js +2 -2
- package/dist/Security/User.js +2 -2
- package/dist/SignalR/HubBase.js +5 -5
- package/dist/StringUtils.js +1 -1
- package/dist/Utils.js +8 -8
- package/dist/Validation/DisplayHelper.js +2 -2
- package/dist/Validation/RuleContext.js +2 -3
- package/dist/Validation/ValidationHelpers.js +1 -1
- package/dist/Validation/ValidationState.js +2 -2
- package/dist/Validation/Validators/IModelValidator.js +1 -0
- package/dist/Validation/Validators/ModelValidator.js +2 -2
- package/dist/Validation/Validators/PropertyValidator.js +2 -2
- package/dist/Validation/Validators/RuleValidator.js +2 -2
- package/dist/Views/IViewBase.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/package.json +18 -13
|
@@ -56,7 +56,7 @@ function unwrapAxiosPromise(axiosPromise) {
|
|
|
56
56
|
var ApiClientDataSource = /** @class */ (function (_super) {
|
|
57
57
|
__extends(ApiClientDataSource, _super);
|
|
58
58
|
function ApiClientDataSource(getMethod, defaultData) {
|
|
59
|
-
var _this = _super.call(this,
|
|
59
|
+
var _this = _super.call(this, defaultData !== null && defaultData !== void 0 ? defaultData : []) || this;
|
|
60
60
|
_this.getMethod = getMethod;
|
|
61
61
|
_this.defaultData = defaultData;
|
|
62
62
|
return _this;
|
|
@@ -84,7 +84,7 @@ export { ApiClientDataSource };
|
|
|
84
84
|
var ApiClientLookupDataSource = /** @class */ (function (_super) {
|
|
85
85
|
__extends(ApiClientLookupDataSource, _super);
|
|
86
86
|
function ApiClientLookupDataSource(getMethod, deserialiseType, defaultData) {
|
|
87
|
-
var _this = _super.call(this,
|
|
87
|
+
var _this = _super.call(this, defaultData !== null && defaultData !== void 0 ? defaultData : []) || this;
|
|
88
88
|
_this.getMethod = getMethod;
|
|
89
89
|
_this.deserialiseType = deserialiseType;
|
|
90
90
|
_this.defaultData = defaultData;
|
|
@@ -8,14 +8,14 @@ var DataCacheEntry = /** @class */ (function () {
|
|
|
8
8
|
get: function () {
|
|
9
9
|
return Date.now() >= this.expiryDate.getTime();
|
|
10
10
|
},
|
|
11
|
-
enumerable:
|
|
11
|
+
enumerable: false,
|
|
12
12
|
configurable: true
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(DataCacheEntry.prototype, "willLoad", {
|
|
15
15
|
get: function () {
|
|
16
16
|
return this.dataSource.willLoad || this.isExpired;
|
|
17
17
|
},
|
|
18
|
-
enumerable:
|
|
18
|
+
enumerable: false,
|
|
19
19
|
configurable: true
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(DataCacheEntry.prototype, "currentData", {
|
|
@@ -26,7 +26,7 @@ var DataCacheEntry = /** @class */ (function () {
|
|
|
26
26
|
get: function () {
|
|
27
27
|
return this.dataSource.data;
|
|
28
28
|
},
|
|
29
|
-
enumerable:
|
|
29
|
+
enumerable: false,
|
|
30
30
|
configurable: true
|
|
31
31
|
});
|
|
32
32
|
/**
|
package/dist/Data/DataView.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate, __extends, __metadata,
|
|
1
|
+
import { __decorate, __extends, __metadata, __spreadArray } from "tslib";
|
|
2
2
|
import NeoModel from '../Model/NeoModel';
|
|
3
3
|
import { Observable, Computed } from '../Model/Decorators';
|
|
4
4
|
import { SortOperation } from './SortOperation';
|
|
@@ -33,10 +33,10 @@ var DataViewBase = /** @class */ (function () {
|
|
|
33
33
|
var existing = this.sortInfo.find(function (c) { return c.column === property; });
|
|
34
34
|
if (existing) {
|
|
35
35
|
existing.sortAscending = !existing.sortAscending;
|
|
36
|
-
this.sortInfo =
|
|
36
|
+
this.sortInfo = __spreadArray([], this.sortInfo, true);
|
|
37
37
|
}
|
|
38
38
|
else {
|
|
39
|
-
this.sortInfo =
|
|
39
|
+
this.sortInfo = __spreadArray(__spreadArray([], this.sortInfo, true), [new SortOperation(property, sortAscending !== null && sortAscending !== void 0 ? sortAscending : SortOperation.getDefaultSortAscending(property))], false);
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
Object.defineProperty(DataViewBase.prototype, "rawItems", {
|
|
@@ -44,7 +44,7 @@ var DataViewBase = /** @class */ (function () {
|
|
|
44
44
|
get: function () {
|
|
45
45
|
return this.originalSource;
|
|
46
46
|
},
|
|
47
|
-
enumerable:
|
|
47
|
+
enumerable: false,
|
|
48
48
|
configurable: true
|
|
49
49
|
});
|
|
50
50
|
/**
|
|
@@ -76,14 +76,14 @@ var DataViewBase = /** @class */ (function () {
|
|
|
76
76
|
get: function () {
|
|
77
77
|
return this.getFilteredItems();
|
|
78
78
|
},
|
|
79
|
-
enumerable:
|
|
79
|
+
enumerable: false,
|
|
80
80
|
configurable: true
|
|
81
81
|
});
|
|
82
82
|
Object.defineProperty(DataViewBase.prototype, "sortedItems", {
|
|
83
83
|
get: function () {
|
|
84
84
|
return this.getSortedItems();
|
|
85
85
|
},
|
|
86
|
-
enumerable:
|
|
86
|
+
enumerable: false,
|
|
87
87
|
configurable: true
|
|
88
88
|
});
|
|
89
89
|
DataViewBase.prototype.getSortedItems = function () {
|
|
@@ -118,7 +118,7 @@ var DataViewBase = /** @class */ (function () {
|
|
|
118
118
|
for (var i = sortFns.length - 1; i >= 0; i--) {
|
|
119
119
|
itemsToSort.sortBy(sortFns[i].valueFn, sortFns[i].direction, sortFns[i].property.propertyType);
|
|
120
120
|
}
|
|
121
|
-
return
|
|
121
|
+
return __spreadArray(__spreadArray([], itemsToSort, true), endItems, true);
|
|
122
122
|
}
|
|
123
123
|
return filtered;
|
|
124
124
|
}
|
|
@@ -11,12 +11,11 @@ var Deserialiser = /** @class */ (function () {
|
|
|
11
11
|
* Called before an object is deserialised. Object tracking should be suspended here. Must return the property info list.
|
|
12
12
|
*/
|
|
13
13
|
Deserialiser.prototype.beginObjectDeserialise = function (object) {
|
|
14
|
-
var _a;
|
|
15
14
|
var neoTypeInfo = object.constructor.neo;
|
|
16
15
|
if (!neoTypeInfo) {
|
|
17
16
|
throw "Tried to deserialise into an object without @NeoModel decorator.";
|
|
18
17
|
}
|
|
19
|
-
var propertyMap =
|
|
18
|
+
var propertyMap = neoTypeInfo === null || neoTypeInfo === void 0 ? void 0 : neoTypeInfo.propertyMap;
|
|
20
19
|
if (propertyMap && object.isSuspended !== undefined) {
|
|
21
20
|
object.isSuspended = true;
|
|
22
21
|
this.suspendedObjects.push(object);
|
|
@@ -49,7 +48,7 @@ var Deserialiser = /** @class */ (function () {
|
|
|
49
48
|
});
|
|
50
49
|
}
|
|
51
50
|
catch (error) {
|
|
52
|
-
throw "Deserialise error. "
|
|
51
|
+
throw "Deserialise error. ".concat(error);
|
|
53
52
|
}
|
|
54
53
|
finally {
|
|
55
54
|
this.cleanUp();
|
|
@@ -216,7 +215,7 @@ var Deserialiser = /** @class */ (function () {
|
|
|
216
215
|
}
|
|
217
216
|
}
|
|
218
217
|
catch (error) {
|
|
219
|
-
throw "Error deserialising property '"
|
|
218
|
+
throw "Error deserialising property '".concat(key, "' on type '").concat(typeName, "': ").concat(error);
|
|
220
219
|
}
|
|
221
220
|
}
|
|
222
221
|
}
|
|
@@ -247,7 +246,7 @@ var Deserialiser = /** @class */ (function () {
|
|
|
247
246
|
Deserialiser.prototype.getReferencedObject = function (id) {
|
|
248
247
|
var found = this.objectRefs[id];
|
|
249
248
|
if (!found) {
|
|
250
|
-
throw "Cannot find $id: "
|
|
249
|
+
throw "Cannot find $id: ".concat(id, ".");
|
|
251
250
|
}
|
|
252
251
|
return found.to;
|
|
253
252
|
};
|
|
@@ -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) {
|
|
@@ -2,6 +2,7 @@ import { StaticDataSource } from '../Data';
|
|
|
2
2
|
export interface IEnumItem {
|
|
3
3
|
id: number | string;
|
|
4
4
|
name: string;
|
|
5
|
+
description?: string;
|
|
5
6
|
}
|
|
6
7
|
interface IEnumItemDescriptor {
|
|
7
8
|
name: string;
|
|
@@ -43,5 +44,11 @@ export declare class EnumHelper {
|
|
|
43
44
|
* @param enumItem Enum item. E.g. Status.Pending
|
|
44
45
|
*/
|
|
45
46
|
static getItemMetadata<T>(enumType: T, enumItem: T[keyof T]): IEnumItemDescriptor;
|
|
47
|
+
/**
|
|
48
|
+
* Returns `true` if this item looks like an enum item.
|
|
49
|
+
*
|
|
50
|
+
* E.g. has an `id` and `name` property.
|
|
51
|
+
*/
|
|
52
|
+
static isEnumItem(item: any): boolean;
|
|
46
53
|
}
|
|
47
54
|
export {};
|