@singularsystems/neo-core 1.0.0-beta.9 → 1.0.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/CHANGELOG.md +15 -0
- package/README.md +4 -0
- package/dist/AppServices/AppService.d.ts +5 -0
- package/dist/AppServices/AppService.js +10 -0
- package/dist/AppServices/Config/ConfigService.js +2 -1
- package/dist/AppServices/NeoTypes.d.ts +6 -0
- package/dist/AppServices/NeoTypes.js +7 -1
- package/dist/AppServices/ServiceIdentifier.js +2 -1
- package/dist/AxiosUtils.js +8 -9
- package/dist/Components/ErrorHandler.d.ts +1 -5
- package/dist/Components/ErrorHandler.js +5 -6
- package/dist/Components/FileManager/FileManager.js +5 -4
- package/dist/Components/FileManager/FileUploadBatch.js +2 -1
- package/dist/Components/Notifications/Notification.js +2 -1
- package/dist/Components/Notifications/NotificationHelper.js +2 -1
- package/dist/Components/Notifications/NotificationStore.js +2 -1
- package/dist/Components/TaskRunner/ProgressState.js +2 -1
- package/dist/Components/TaskRunner/TaskRunner.js +2 -1
- package/dist/ConnectionManager.js +2 -1
- package/dist/Data/ApiDataSource.d.ts +25 -26
- package/dist/Data/ApiDataSource.js +87 -97
- package/dist/Data/AsyncDataSource.d.ts +6 -2
- package/dist/Data/AsyncDataSource.js +22 -2
- package/dist/Data/CacheService.d.ts +4 -7
- package/dist/Data/CacheService.js +7 -5
- package/dist/Data/DataCacheEntry.d.ts +0 -4
- package/dist/Data/DataCacheEntry.js +0 -6
- package/dist/Data/DataView.js +4 -2
- package/dist/Data/Paging/PageManager.js +9 -8
- package/dist/Data/Paging/PageRequest.js +2 -1
- package/dist/Data/Serialiser.js +1 -0
- package/dist/Data/StaticDataSource.d.ts +1 -2
- package/dist/Data/StaticDataSource.js +0 -3
- package/dist/Data/WindowedDataView.js +2 -1
- package/dist/Data/index.d.ts +1 -1
- package/dist/Data/index.js +1 -1
- package/dist/Dates/DateUtils.js +2 -1
- package/dist/Extensions.d.ts +0 -4
- package/dist/Extensions.js +1 -1
- package/dist/IndexDb/IDbSet.d.ts +2 -0
- package/dist/JsonSchema/JsonSchemaTypes.d.ts +1 -0
- package/dist/Model/BaseModels/AuditValues.js +4 -2
- package/dist/Model/BaseModels/CriteriaBase.js +2 -1
- package/dist/Model/BaseModels/ReasonedUserEvent.js +2 -1
- package/dist/Model/BaseModels/UserEvent.js +4 -2
- package/dist/Model/BindableBase.js +2 -1
- package/dist/Model/IModelBase.d.ts +3 -3
- package/dist/Model/ModelCreatorBase.js +2 -1
- package/dist/Model/ModelFieldInfo.js +2 -1
- package/dist/Model/ObservableValue.js +2 -1
- package/dist/NumberUtils.d.ts +3 -1
- package/dist/NumberUtils.js +2 -2
- package/dist/Routing/MenuItemProvider.js +2 -1
- package/dist/Routing/RouteSecurityService.js +2 -1
- package/dist/Security/LoginErrorHandler.js +2 -1
- package/dist/Security/SecurityService.js +2 -1
- package/dist/SignalR/IServerMessageSubscriber.d.ts +4 -0
- package/dist/SignalR/index.d.ts +1 -0
- package/dist/Validation/DisplayHelper.d.ts +3 -1
- package/dist/Validation/RuleContext.d.ts +4 -0
- package/dist/Validation/RuleContext.js +4 -0
- package/package.json +9 -7
- package/dist/Decimal/DecimalService.d.ts +0 -23
- package/dist/Decimal/DecimalService.js +0 -38
- package/dist/Decimal/IDecimal.d.ts +0 -25
- package/dist/Numeric/IDecimal.d.ts +0 -25
- package/dist/Numeric/IDecimal.js +0 -1
- /package/dist/{Decimal/IDecimal.js → SignalR/IServerMessageSubscriber.js} +0 -0
|
@@ -2,7 +2,7 @@ import { __decorate, __extends, __metadata } from "tslib";
|
|
|
2
2
|
import ValueObject from '../ValueObject';
|
|
3
3
|
import { Date as DateAttribute } from '../Decorators';
|
|
4
4
|
import NeoModel from '../NeoModel';
|
|
5
|
-
|
|
5
|
+
var UserEventBase = /** @class */ (function (_super) {
|
|
6
6
|
__extends(UserEventBase, _super);
|
|
7
7
|
function UserEventBase() {
|
|
8
8
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
@@ -23,7 +23,8 @@ export var UserEventBase = /** @class */ (function (_super) {
|
|
|
23
23
|
], UserEventBase.prototype, "on", void 0);
|
|
24
24
|
return UserEventBase;
|
|
25
25
|
}(ValueObject));
|
|
26
|
-
export
|
|
26
|
+
export { UserEventBase };
|
|
27
|
+
var UserEvent = /** @class */ (function (_super) {
|
|
27
28
|
__extends(UserEvent, _super);
|
|
28
29
|
function UserEvent() {
|
|
29
30
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
@@ -38,3 +39,4 @@ export var UserEvent = /** @class */ (function (_super) {
|
|
|
38
39
|
], UserEvent);
|
|
39
40
|
return UserEvent;
|
|
40
41
|
}(UserEventBase));
|
|
42
|
+
export { UserEvent };
|
|
@@ -4,7 +4,7 @@ import { JSFormatter } from '../Data/Serialiser';
|
|
|
4
4
|
import { NeoTypeInfo } from './NeoTypeInfo';
|
|
5
5
|
import { Utils } from '../Utils';
|
|
6
6
|
import { SerialiseType } from './Misc';
|
|
7
|
-
|
|
7
|
+
var BindableBase = /** @class */ (function () {
|
|
8
8
|
function BindableBase() {
|
|
9
9
|
this.entityIdentifier = Utils.uuidv4();
|
|
10
10
|
}
|
|
@@ -80,3 +80,4 @@ export var BindableBase = /** @class */ (function () {
|
|
|
80
80
|
], BindableBase.prototype, "entityIdentifier", void 0);
|
|
81
81
|
return BindableBase;
|
|
82
82
|
}());
|
|
83
|
+
export { BindableBase };
|
|
@@ -55,11 +55,11 @@ export interface IMakeBindableOptions {
|
|
|
55
55
|
*/
|
|
56
56
|
makeObservable?: boolean;
|
|
57
57
|
/**
|
|
58
|
-
* Specifies whether methods should be converted to mobx actions.
|
|
58
|
+
* Specifies whether methods should be converted to mobx actions.
|
|
59
59
|
* Use `Attributes.Action()` to override this per method. */
|
|
60
60
|
autoActions?: boolean;
|
|
61
61
|
/**
|
|
62
|
-
* If `true`, this instance will not be converted. In
|
|
62
|
+
* If `true`, this instance will not be converted. In inheritance hierarchies, use this to ensure only the last derived type converts the instance.
|
|
63
63
|
*/
|
|
64
64
|
skipConversion?: boolean;
|
|
65
65
|
}
|
|
@@ -68,7 +68,7 @@ export interface IDebounceOptions {
|
|
|
68
68
|
}
|
|
69
69
|
export interface IBindableBase {
|
|
70
70
|
meta: {
|
|
71
|
-
[
|
|
71
|
+
[key: string]: IPropertyInstance;
|
|
72
72
|
};
|
|
73
73
|
set(jsObject: any): void;
|
|
74
74
|
}
|
|
@@ -6,7 +6,7 @@ import { ChildList, ChildObject } from './Decorators';
|
|
|
6
6
|
import ValueObject from './ValueObject';
|
|
7
7
|
import { BindableBase } from './BindableBase';
|
|
8
8
|
var nonActionMethods = ["addBusinessRules", "toString"];
|
|
9
|
-
|
|
9
|
+
var ModelCreatorBase = /** @class */ (function () {
|
|
10
10
|
function ModelCreatorBase() {
|
|
11
11
|
this.alwaysInitialiseMembers = false;
|
|
12
12
|
}
|
|
@@ -89,3 +89,4 @@ export var ModelCreatorBase = /** @class */ (function () {
|
|
|
89
89
|
], ModelCreatorBase);
|
|
90
90
|
return ModelCreatorBase;
|
|
91
91
|
}());
|
|
92
|
+
export { ModelCreatorBase };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __extends, __metadata } from "tslib";
|
|
2
2
|
import ValueObject from "./ValueObject";
|
|
3
3
|
import NeoModel from './NeoModel';
|
|
4
|
-
|
|
4
|
+
var ModelFieldInfo = /** @class */ (function (_super) {
|
|
5
5
|
__extends(ModelFieldInfo, _super);
|
|
6
6
|
function ModelFieldInfo(displayName, valueString) {
|
|
7
7
|
var _this = _super.call(this) || this;
|
|
@@ -33,3 +33,4 @@ export var ModelFieldInfo = /** @class */ (function (_super) {
|
|
|
33
33
|
], ModelFieldInfo);
|
|
34
34
|
return ModelFieldInfo;
|
|
35
35
|
}(ValueObject));
|
|
36
|
+
export { ModelFieldInfo };
|
|
@@ -2,7 +2,7 @@ import { __decorate, __metadata } from "tslib";
|
|
|
2
2
|
import NeoModel from './NeoModel';
|
|
3
3
|
import { Observable } from './Decorators';
|
|
4
4
|
import { Utils } from '../Utils';
|
|
5
|
-
|
|
5
|
+
var ObservableValue = /** @class */ (function () {
|
|
6
6
|
function ObservableValue(initialValue) {
|
|
7
7
|
this.value = initialValue;
|
|
8
8
|
}
|
|
@@ -23,3 +23,4 @@ export var ObservableValue = /** @class */ (function () {
|
|
|
23
23
|
], ObservableValue);
|
|
24
24
|
return ObservableValue;
|
|
25
25
|
}());
|
|
26
|
+
export { ObservableValue };
|
package/dist/NumberUtils.d.ts
CHANGED
|
@@ -18,7 +18,9 @@ export default class NumberUtils {
|
|
|
18
18
|
/** Set this to `","` if you want to allow a comma as a decimal separator when parsing string input. */
|
|
19
19
|
static allowAsDecimalSeparator?: string;
|
|
20
20
|
static defaultCurrencySymbol: string;
|
|
21
|
-
static numberFormats: {
|
|
21
|
+
static numberFormats: {
|
|
22
|
+
[key: number]: string;
|
|
23
|
+
};
|
|
22
24
|
/** If values typed into numeric editors should be divided by 100 when stored. */
|
|
23
25
|
static transformPercent: boolean;
|
|
24
26
|
static initialise(): void;
|
package/dist/NumberUtils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Globals from "./Globals";
|
|
2
2
|
import { NeoTypes } from "./AppServices";
|
|
3
3
|
import { DataType } from "./Model/Misc";
|
|
4
4
|
export var NumberFormat;
|
|
@@ -19,7 +19,7 @@ var NumberUtils = /** @class */ (function () {
|
|
|
19
19
|
/** Decimal service used internally by neo. Project code should use the chosen decimal package directly. */
|
|
20
20
|
get: function () {
|
|
21
21
|
if (!this._decimalService) {
|
|
22
|
-
this._decimalService =
|
|
22
|
+
this._decimalService = Globals.appService.get(NeoTypes.Core.DecimalService);
|
|
23
23
|
}
|
|
24
24
|
return this._decimalService;
|
|
25
25
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign, __decorate, __metadata, __param } from "tslib";
|
|
2
2
|
import { injectable, inject } from 'inversify';
|
|
3
3
|
import NeoTypes from '../AppServices/NeoTypes';
|
|
4
|
-
|
|
4
|
+
var MenuItemProvider = /** @class */ (function () {
|
|
5
5
|
function MenuItemProvider(routeSecurityService) {
|
|
6
6
|
this.routeSecurityService = routeSecurityService;
|
|
7
7
|
}
|
|
@@ -51,3 +51,4 @@ export var MenuItemProvider = /** @class */ (function () {
|
|
|
51
51
|
], MenuItemProvider);
|
|
52
52
|
return MenuItemProvider;
|
|
53
53
|
}());
|
|
54
|
+
export { MenuItemProvider };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __metadata, __param } from "tslib";
|
|
2
2
|
import { inject, injectable } from "inversify";
|
|
3
3
|
import NeoTypes from '../AppServices/NeoTypes';
|
|
4
|
-
|
|
4
|
+
var RouteSecurityService = /** @class */ (function () {
|
|
5
5
|
function RouteSecurityService(authorisationService) {
|
|
6
6
|
this.authorisationService = authorisationService;
|
|
7
7
|
}
|
|
@@ -33,3 +33,4 @@ export var RouteSecurityService = /** @class */ (function () {
|
|
|
33
33
|
], RouteSecurityService);
|
|
34
34
|
return RouteSecurityService;
|
|
35
35
|
}());
|
|
36
|
+
export { RouteSecurityService };
|
|
@@ -3,7 +3,7 @@ import { Utils } from "../Utils";
|
|
|
3
3
|
import { ModalUtils } from "../Components/Modal/ModalUtils";
|
|
4
4
|
import { inject, injectable } from "inversify";
|
|
5
5
|
import NeoTypes from "../AppServices/NeoTypes";
|
|
6
|
-
|
|
6
|
+
var NeoLoginErrorHandler = /** @class */ (function () {
|
|
7
7
|
function NeoLoginErrorHandler(authenticationService, navigationHelper) {
|
|
8
8
|
this.authenticationService = authenticationService;
|
|
9
9
|
this.navigationHelper = navigationHelper;
|
|
@@ -95,3 +95,4 @@ export var NeoLoginErrorHandler = /** @class */ (function () {
|
|
|
95
95
|
], NeoLoginErrorHandler);
|
|
96
96
|
return NeoLoginErrorHandler;
|
|
97
97
|
}());
|
|
98
|
+
export { NeoLoginErrorHandler };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __metadata, __param } from "tslib";
|
|
2
2
|
import { injectable, inject } from 'inversify';
|
|
3
3
|
import NeoTypes from '../AppServices/NeoTypes';
|
|
4
|
-
|
|
4
|
+
var SecurityService = /** @class */ (function () {
|
|
5
5
|
function SecurityService(authentication, authorisation) {
|
|
6
6
|
this.authentication = authentication;
|
|
7
7
|
this.authorisation = authorisation;
|
|
@@ -31,3 +31,4 @@ export var SecurityService = /** @class */ (function () {
|
|
|
31
31
|
], SecurityService);
|
|
32
32
|
return SecurityService;
|
|
33
33
|
}());
|
|
34
|
+
export { SecurityService };
|
package/dist/SignalR/index.d.ts
CHANGED
|
@@ -12,7 +12,9 @@ export declare class ValidationDisplayInfo {
|
|
|
12
12
|
variant: variant;
|
|
13
13
|
get displayText(): string;
|
|
14
14
|
get editorClassName(): string;
|
|
15
|
-
applyToDom(elementProps: React.HTMLProps<HTMLElement
|
|
15
|
+
applyToDom(elementProps: React.HTMLProps<HTMLElement> & {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}, addTooltip: boolean): void;
|
|
16
18
|
}
|
|
17
19
|
export default class ValidationDisplayHelper {
|
|
18
20
|
static getDisplayInfo(ruleState: ValidationState, canDisplayAll: boolean): ValidationDisplayInfo;
|
|
@@ -81,6 +81,10 @@ export declare class RuleContext extends RuleContextBase implements IRuleContext
|
|
|
81
81
|
export declare class AsyncRuleContext extends RuleContextBase implements IAsyncRuleContext {
|
|
82
82
|
private initiator;
|
|
83
83
|
constructor(initiator: RuleContext, ruleValidator: RuleValidator);
|
|
84
|
+
/**
|
|
85
|
+
* Indicates that the async operation has completed.
|
|
86
|
+
* This does not need to be called if the method returns a promise (or uses the async keyword).
|
|
87
|
+
*/
|
|
84
88
|
endAsync(): void;
|
|
85
89
|
}
|
|
86
90
|
export {};
|
|
@@ -111,6 +111,10 @@ var AsyncRuleContext = /** @class */ (function (_super) {
|
|
|
111
111
|
_this.initiator = initiator;
|
|
112
112
|
return _this;
|
|
113
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Indicates that the async operation has completed.
|
|
116
|
+
* This does not need to be called if the method returns a promise (or uses the async keyword).
|
|
117
|
+
*/
|
|
114
118
|
AsyncRuleContext.prototype.endAsync = function () {
|
|
115
119
|
var _this = this;
|
|
116
120
|
if (this.ruleValidator.asyncContext && this.ruleValidator.asyncContext === this.initiator && this.ruleValidator.asyncStage === AsyncStage.Busy) {
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@singularsystems/neo-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Core functionality for the Neo client library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
|
-
"dist"
|
|
8
|
+
"dist",
|
|
9
|
+
"CHANGELOG.md"
|
|
9
10
|
],
|
|
10
11
|
"scripts": {
|
|
11
12
|
"build": "tsc",
|
|
@@ -15,16 +16,17 @@
|
|
|
15
16
|
"license": "ISC",
|
|
16
17
|
"devDependencies": {
|
|
17
18
|
"@types/jest": "29.5.1",
|
|
18
|
-
"@types/node": "
|
|
19
|
+
"@types/node": "20.11.24",
|
|
19
20
|
"@types/react": "18.2.4",
|
|
21
|
+
"decimal.js-light": "2.5.1",
|
|
20
22
|
"jest": "29.5.0",
|
|
21
23
|
"ts-jest": "29.1.0",
|
|
22
|
-
"typescript": "5.
|
|
24
|
+
"typescript": "5.4.2"
|
|
23
25
|
},
|
|
24
26
|
"dependencies": {
|
|
25
27
|
"@microsoft/signalr": "^6.0.1",
|
|
26
|
-
"axios": "1.
|
|
27
|
-
"inversify": "^6.0.
|
|
28
|
+
"axios": "1.6.7",
|
|
29
|
+
"inversify": "^6.0.2",
|
|
28
30
|
"reflect-metadata": "0.1.13",
|
|
29
31
|
"tslib": "2.5.0"
|
|
30
32
|
},
|
|
@@ -32,5 +34,5 @@
|
|
|
32
34
|
"axios": ">=1.4.0",
|
|
33
35
|
"inversify": ">=5.0.1"
|
|
34
36
|
},
|
|
35
|
-
"packageManager": "yarn@
|
|
37
|
+
"packageManager": "yarn@4.1.1"
|
|
36
38
|
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { IDecimal, IDecimalService } from "./IDecimal";
|
|
2
|
-
interface IMikeMCLDecimal extends IDecimal {
|
|
3
|
-
toNumber(): number;
|
|
4
|
-
round(precision: number, roundingType: number): IMikeMCLDecimal;
|
|
5
|
-
cmp(to: IMikeMCLDecimal): 0 | 1 | -1;
|
|
6
|
-
plus(number: IMikeMCLDecimal): IMikeMCLDecimal;
|
|
7
|
-
div(number: IMikeMCLDecimal | number): IMikeMCLDecimal;
|
|
8
|
-
}
|
|
9
|
-
export declare class DecimalService<T extends IMikeMCLDecimal> implements IDecimalService<T> {
|
|
10
|
-
private decimalType;
|
|
11
|
-
private roundHalfUpValue;
|
|
12
|
-
private roundDownValue;
|
|
13
|
-
constructor(decimalType: T, roundHalfUpValue: number, roundDownValue: number);
|
|
14
|
-
isDecimal(value: any): value is IMikeMCLDecimal;
|
|
15
|
-
createDecimal(value: number | string): T;
|
|
16
|
-
toNumber(value: number | T): number;
|
|
17
|
-
round(value: T, precision: number): T;
|
|
18
|
-
truncate(value: T): T;
|
|
19
|
-
compare(value1: T, value2: T): 0 | 1 | -1;
|
|
20
|
-
sum(values: T[]): T;
|
|
21
|
-
divideBy(value: T, divisor: number | T): T;
|
|
22
|
-
}
|
|
23
|
-
export {};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
var DecimalService = /** @class */ (function () {
|
|
2
|
-
function DecimalService(decimalType, roundHalfUpValue, roundDownValue) {
|
|
3
|
-
this.decimalType = decimalType;
|
|
4
|
-
this.roundHalfUpValue = roundHalfUpValue;
|
|
5
|
-
this.roundDownValue = roundDownValue;
|
|
6
|
-
}
|
|
7
|
-
DecimalService.prototype.isDecimal = function (value) {
|
|
8
|
-
return value instanceof this.decimalType;
|
|
9
|
-
};
|
|
10
|
-
DecimalService.prototype.createDecimal = function (value) {
|
|
11
|
-
return new this.decimalType(value);
|
|
12
|
-
};
|
|
13
|
-
DecimalService.prototype.toNumber = function (value) {
|
|
14
|
-
if (this.isDecimal(value)) {
|
|
15
|
-
return value.toNumber();
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
return value;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
DecimalService.prototype.round = function (value, precision) {
|
|
22
|
-
return value.round(precision, this.roundHalfUpValue);
|
|
23
|
-
};
|
|
24
|
-
DecimalService.prototype.truncate = function (value) {
|
|
25
|
-
return value.round(0, this.roundDownValue);
|
|
26
|
-
};
|
|
27
|
-
DecimalService.prototype.compare = function (value1, value2) {
|
|
28
|
-
return value1.cmp(value2);
|
|
29
|
-
};
|
|
30
|
-
DecimalService.prototype.sum = function (values) {
|
|
31
|
-
return values.reduce(function (total, item) { return total.plus(item); }, this.createDecimal(0));
|
|
32
|
-
};
|
|
33
|
-
DecimalService.prototype.divideBy = function (value, divisor) {
|
|
34
|
-
return value.div(divisor);
|
|
35
|
-
};
|
|
36
|
-
return DecimalService;
|
|
37
|
-
}());
|
|
38
|
-
export { DecimalService };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export interface IDecimal {
|
|
2
|
-
new (value: number | string): IDecimal;
|
|
3
|
-
}
|
|
4
|
-
export interface IDecimalService<T extends IDecimal = IDecimal> {
|
|
5
|
-
/** Returns true if the provided value is a decimal instance. */
|
|
6
|
-
isDecimal(value: any): value is IDecimal;
|
|
7
|
-
/** Creates a decimal instance from a javascript number. */
|
|
8
|
-
createDecimal(value: number | string): T;
|
|
9
|
-
/** If the provided value is a decimal, converts it to a number, otherwise returns the number passed in. */
|
|
10
|
-
toNumber(value: number | T): number;
|
|
11
|
-
/** Rounds a number. */
|
|
12
|
-
round(value: T, precision: number): T;
|
|
13
|
-
/** Removes decimal places from the value. Equivalent to round down with zero decimal places. */
|
|
14
|
-
truncate(value: T): T;
|
|
15
|
-
/** Compares 2 decimals.
|
|
16
|
-
* Returns 1 if value1 > value2
|
|
17
|
-
* Returns -1 if value1 < value2
|
|
18
|
-
* Returns 0 if equal
|
|
19
|
-
*/
|
|
20
|
-
compare(value1: T, value2: T): 0 | 1 | -1;
|
|
21
|
-
/** Sums a list of decimals and returns the total as a decimal. */
|
|
22
|
-
sum(values: T[]): T;
|
|
23
|
-
/** Divides value by divisor and returns the result. */
|
|
24
|
-
divideBy(value: T, divisor: number | T): T;
|
|
25
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export interface IDecimal {
|
|
2
|
-
toNumber(): number;
|
|
3
|
-
}
|
|
4
|
-
export interface IDecimalService<T = IDecimal> {
|
|
5
|
-
/** Returns true if the provided value is a decimal instance. */
|
|
6
|
-
isDecimal(value: any): value is IDecimal;
|
|
7
|
-
/** Creates a decimal instance from a javascript number. */
|
|
8
|
-
createDecimal(value: number | string): T;
|
|
9
|
-
/** If the provided value is a decimal, converts it to a number, otherwise returns the number passed in. */
|
|
10
|
-
toNumber(value: number | T): number;
|
|
11
|
-
/** Rounds a number using .net like midpoint away from zero rounding. */
|
|
12
|
-
round(value: T, precision: number): T;
|
|
13
|
-
/** Removes decimal places from the value. Equivalent to round down with zero decimal places. */
|
|
14
|
-
truncate(value: T): T;
|
|
15
|
-
/** Compares 2 decimals.
|
|
16
|
-
* Returns 1 if value1 > value2
|
|
17
|
-
* Returns -1 if value1 < value2
|
|
18
|
-
* Returns 0 if equal
|
|
19
|
-
*/
|
|
20
|
-
compare(value1: T, value2: T): 0 | 1 | -1;
|
|
21
|
-
/** Sums a list of decimals and returns the total as a decimal. */
|
|
22
|
-
sum(values: T[]): T;
|
|
23
|
-
/** Divides value by divisor and returns the result. */
|
|
24
|
-
divideBy(value: T, divisor: number | T): T;
|
|
25
|
-
}
|
package/dist/Numeric/IDecimal.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|