@singularsystems/neo-core 0.10.67 → 0.10.70
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/dist/Model/Decorators.d.ts +6 -3
- package/dist/Model/Decorators.js +9 -4
- package/dist/Model/ModelBase.d.ts +1 -1
- package/dist/Model/ModelBase.js +1 -1
- package/dist/Model/PropertyInfo.d.ts +2 -0
- package/dist/Model/PropertyInstance.d.ts +35 -1
- package/dist/Model/PropertyInstance.js +58 -0
- package/dist/Model/index.d.ts +2 -1
- package/dist/Model/index.js +2 -1
- package/dist/NumberUtils.d.ts +12 -5
- package/dist/NumberUtils.js +46 -11
- package/dist/Validation/Validators/IModelValidator.d.ts +6 -2
- package/dist/Validation/Validators/ModelValidator.d.ts +1 -0
- package/dist/Validation/Validators/ModelValidator.js +7 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/package.json +1 -1
|
@@ -4,9 +4,12 @@ export declare function Display(name: string): (type: any, propertyKey: string)
|
|
|
4
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
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Indicates that this is a float number property.
|
|
9
|
+
* Editors will be restricted to float numeric input.
|
|
10
|
+
* @param decimals No of decimals allowed when storing this value. Used when binding to this property from a supporting ui component. If not specified, this will be determined from the format string. */
|
|
11
|
+
export declare function Float(decimals?: number): (type: any, propertyKey: string) => void;
|
|
12
|
+
/** Indicates that this is a decimal property (decimal type from the decimal.js-light package). */
|
|
10
13
|
export declare function Decimal(): (type: any, propertyKey: string) => void;
|
|
11
14
|
/** Indicates that this is a nullable boolean property. */
|
|
12
15
|
export declare function NullableBoolean(): (type: any, propertyKey: string) => void;
|
package/dist/Model/Decorators.js
CHANGED
|
@@ -24,13 +24,18 @@ export function Integer() {
|
|
|
24
24
|
getOrAddPropertyInfo(type, propertyKey).propertyType = DataType.Int;
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
/**
|
|
28
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Indicates that this is a float number property.
|
|
29
|
+
* Editors will be restricted to float numeric input.
|
|
30
|
+
* @param decimals No of decimals allowed when storing this value. Used when binding to this property from a supporting ui component. If not specified, this will be determined from the format string. */
|
|
31
|
+
export function Float(decimals) {
|
|
29
32
|
return function (type, propertyKey) {
|
|
30
|
-
getOrAddPropertyInfo(type, propertyKey)
|
|
33
|
+
var propertyInfo = getOrAddPropertyInfo(type, propertyKey);
|
|
34
|
+
propertyInfo.propertyType = DataType.Float;
|
|
35
|
+
propertyInfo.allowedDecimals = decimals;
|
|
31
36
|
};
|
|
32
37
|
}
|
|
33
|
-
/** Indicates that this is a decimal property. */
|
|
38
|
+
/** Indicates that this is a decimal property (decimal type from the decimal.js-light package). */
|
|
34
39
|
export function Decimal() {
|
|
35
40
|
return function (type, propertyKey) {
|
|
36
41
|
getOrAddPropertyInfo(type, propertyKey).propertyType = DataType.Decimal;
|
|
@@ -83,6 +83,6 @@ export default abstract class ModelBase extends BindableBase implements IModelBa
|
|
|
83
83
|
* Add custom business rules. Note, this will be called once per type and should be treated as static.
|
|
84
84
|
*/
|
|
85
85
|
protected addBusinessRules(validationRules: ValidationRules<this>): void;
|
|
86
|
-
/** The server side
|
|
86
|
+
/** The server side type name used to find this type. Include the namespace if there is more than one type with the same name. */
|
|
87
87
|
static typeName: string | null;
|
|
88
88
|
}
|
package/dist/Model/ModelBase.js
CHANGED
|
@@ -147,7 +147,7 @@ var ModelBase = /** @class */ (function (_super) {
|
|
|
147
147
|
*/
|
|
148
148
|
ModelBase.prototype.addBusinessRules = function (validationRules) {
|
|
149
149
|
};
|
|
150
|
-
/** The server side
|
|
150
|
+
/** The server side type name used to find this type. Include the namespace if there is more than one type with the same name. */
|
|
151
151
|
ModelBase.typeName = null;
|
|
152
152
|
__decorate([
|
|
153
153
|
NoTracking(SerialiseType.Never),
|
|
@@ -33,6 +33,8 @@ export default class PropertyInfo {
|
|
|
33
33
|
relationType: RelationType;
|
|
34
34
|
/** Data type of the property. */
|
|
35
35
|
propertyType: DataType;
|
|
36
|
+
/** No of decimals to allow when binding to this property from a supporting ui component. If not specified, this will be determined from the format string. */
|
|
37
|
+
allowedDecimals?: number;
|
|
36
38
|
/** This will change the default behaviour about how a control sets this properties value. */
|
|
37
39
|
allowNulls: boolean;
|
|
38
40
|
/** Options for the onChanged event */
|
|
@@ -37,7 +37,7 @@ export declare class PropertyAccessor implements IPropertyInstance {
|
|
|
37
37
|
attachedTo: any;
|
|
38
38
|
propertyInfo: PropertyInfo;
|
|
39
39
|
private propertyName;
|
|
40
|
-
|
|
40
|
+
protected constructor(attachedTo: any, propertyInfo: PropertyInfo);
|
|
41
41
|
sortValue: any;
|
|
42
42
|
get uniqueID(): string;
|
|
43
43
|
get validator(): IPropertyValidator;
|
|
@@ -46,3 +46,37 @@ export declare class PropertyAccessor implements IPropertyInstance {
|
|
|
46
46
|
get peek(): any;
|
|
47
47
|
static create<T>(model: T, property: keyof T): PropertyAccessor;
|
|
48
48
|
}
|
|
49
|
+
interface ITemporaryPropertyOptions<TValue> {
|
|
50
|
+
/** Name of the property. Should be a valid js property name. */
|
|
51
|
+
name?: string;
|
|
52
|
+
/** Label to show in editors using this property. */
|
|
53
|
+
label?: string;
|
|
54
|
+
/** On changed function if you want the property to be writable. */
|
|
55
|
+
onChanged?: (value: TValue) => void;
|
|
56
|
+
}
|
|
57
|
+
export declare class TemporaryProperty<TValue = any> extends PropertyAccessor {
|
|
58
|
+
private valueAccessor;
|
|
59
|
+
private onChanged?;
|
|
60
|
+
constructor(attachedTo: any, valueAccessor: () => TValue, options?: ITemporaryPropertyOptions<TValue>);
|
|
61
|
+
get value(): TValue;
|
|
62
|
+
set value(value: TValue);
|
|
63
|
+
get peek(): TValue;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Creates a temporary property if you need a neo editor to show a computed value, and cannot use the meta object on a neo model.
|
|
67
|
+
* The property should be attached to a component class instance, and the property should be passed as the editors `bind` prop.
|
|
68
|
+
*
|
|
69
|
+
* E.g.
|
|
70
|
+
* In component class:
|
|
71
|
+
* ```typescript
|
|
72
|
+
* this.myProperty = createProperty(this, ...);
|
|
73
|
+
* ```
|
|
74
|
+
* In render method:
|
|
75
|
+
* ```jsx
|
|
76
|
+
* <Neo.FormGroup bind={this.myProperty} />
|
|
77
|
+
* ```
|
|
78
|
+
* @param host The instance this property is stored on, usually `this`.
|
|
79
|
+
* @param valueAccessor Function that returns the property value.
|
|
80
|
+
*/
|
|
81
|
+
export declare function createProperty<TValue>(host: any, valueAccessor: () => TValue, options?: ITemporaryPropertyOptions<TValue>): TemporaryProperty<TValue>;
|
|
82
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __extends } from "tslib";
|
|
1
2
|
import { EmptyValidator } from '../Validation/Validators/IPropertyValidator';
|
|
2
3
|
import PropertyInfo from './PropertyInfo';
|
|
3
4
|
import { Utils } from '../Utils';
|
|
@@ -111,3 +112,60 @@ var PropertyAccessor = /** @class */ (function () {
|
|
|
111
112
|
return PropertyAccessor;
|
|
112
113
|
}());
|
|
113
114
|
export { PropertyAccessor };
|
|
115
|
+
var TemporaryProperty = /** @class */ (function (_super) {
|
|
116
|
+
__extends(TemporaryProperty, _super);
|
|
117
|
+
function TemporaryProperty(attachedTo, valueAccessor, options) {
|
|
118
|
+
var _this = this;
|
|
119
|
+
var _a, _b;
|
|
120
|
+
var propertyInfo = new PropertyInfo((_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : Utils.uuidv4());
|
|
121
|
+
propertyInfo.displayName = (_b = options === null || options === void 0 ? void 0 : options.label) !== null && _b !== void 0 ? _b : "";
|
|
122
|
+
propertyInfo.isReadOnly = (options === null || options === void 0 ? void 0 : options.onChanged) === undefined;
|
|
123
|
+
_this = _super.call(this, attachedTo, propertyInfo) || this;
|
|
124
|
+
_this.valueAccessor = valueAccessor;
|
|
125
|
+
_this.onChanged = options === null || options === void 0 ? void 0 : options.onChanged;
|
|
126
|
+
return _this;
|
|
127
|
+
}
|
|
128
|
+
Object.defineProperty(TemporaryProperty.prototype, "value", {
|
|
129
|
+
get: function () {
|
|
130
|
+
return this.valueAccessor();
|
|
131
|
+
},
|
|
132
|
+
set: function (value) {
|
|
133
|
+
if (this.onChanged) {
|
|
134
|
+
this.onChanged(value);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
throw Error("Cannot set value of temporary property ".concat(this.propertyInfo.propertyName));
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
enumerable: false,
|
|
141
|
+
configurable: true
|
|
142
|
+
});
|
|
143
|
+
Object.defineProperty(TemporaryProperty.prototype, "peek", {
|
|
144
|
+
get: function () {
|
|
145
|
+
return this.value;
|
|
146
|
+
},
|
|
147
|
+
enumerable: false,
|
|
148
|
+
configurable: true
|
|
149
|
+
});
|
|
150
|
+
return TemporaryProperty;
|
|
151
|
+
}(PropertyAccessor));
|
|
152
|
+
export { TemporaryProperty };
|
|
153
|
+
/**
|
|
154
|
+
* Creates a temporary property if you need a neo editor to show a computed value, and cannot use the meta object on a neo model.
|
|
155
|
+
* The property should be attached to a component class instance, and the property should be passed as the editors `bind` prop.
|
|
156
|
+
*
|
|
157
|
+
* E.g.
|
|
158
|
+
* In component class:
|
|
159
|
+
* ```typescript
|
|
160
|
+
* this.myProperty = createProperty(this, ...);
|
|
161
|
+
* ```
|
|
162
|
+
* In render method:
|
|
163
|
+
* ```jsx
|
|
164
|
+
* <Neo.FormGroup bind={this.myProperty} />
|
|
165
|
+
* ```
|
|
166
|
+
* @param host The instance this property is stored on, usually `this`.
|
|
167
|
+
* @param valueAccessor Function that returns the property value.
|
|
168
|
+
*/
|
|
169
|
+
export function createProperty(host, valueAccessor, options) {
|
|
170
|
+
return new TemporaryProperty(host, valueAccessor, options);
|
|
171
|
+
}
|
package/dist/Model/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export { IBindableBase, IModelBase, NeoModelConstructor, PlainObject, PlainTrackedObject, PartialPlainObject, PartialPlainNonTrackedObject, TransformMetaType, IMakeBindableOptions } from './IModelBase';
|
|
2
2
|
export { ILookupBase } from './LookupBase';
|
|
3
3
|
export { IPropertyInstance, PropertyAccessor } from './PropertyInstance';
|
|
4
|
+
import PropertyInfo from './PropertyInfo';
|
|
4
5
|
export { IObservableValue, ObservableValue } from './ObservableValue';
|
|
5
6
|
export { ObservableProperty } from './ObservableProperty';
|
|
6
7
|
export { ISelectedItem } from './Misc';
|
|
7
8
|
export { ModelFieldInfo, IModelFieldInfoContainer } from './ModelFieldInfo';
|
|
8
9
|
import * as GraphTraverser from './ModelGraphTraverser';
|
|
9
|
-
export { GraphTraverser };
|
|
10
|
+
export { GraphTraverser, PropertyInfo };
|
|
10
11
|
export { AuditValues, AuditValuesBase } from './BaseModels/AuditValues';
|
|
11
12
|
export { FileDescriptorBase } from './BaseModels/FileDescriptorBase';
|
|
12
13
|
export { ReasonedUserEvent } from './BaseModels/ReasonedUserEvent';
|
package/dist/Model/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export { PropertyAccessor } from './PropertyInstance';
|
|
2
|
+
import PropertyInfo from './PropertyInfo';
|
|
2
3
|
export { ObservableValue } from './ObservableValue';
|
|
3
4
|
export { ObservableProperty } from './ObservableProperty';
|
|
4
5
|
export { ModelFieldInfo } from './ModelFieldInfo';
|
|
5
6
|
import * as GraphTraverser from './ModelGraphTraverser';
|
|
6
|
-
export { GraphTraverser };
|
|
7
|
+
export { GraphTraverser, PropertyInfo };
|
|
7
8
|
// Base Models
|
|
8
9
|
export { AuditValues, AuditValuesBase } from './BaseModels/AuditValues';
|
|
9
10
|
export { FileDescriptorBase } from './BaseModels/FileDescriptorBase';
|
package/dist/NumberUtils.d.ts
CHANGED
|
@@ -16,26 +16,33 @@ export default class NumberUtils {
|
|
|
16
16
|
/** If values typed into numeric editors should be divided by 100 when stored. */
|
|
17
17
|
static transformPercent: boolean;
|
|
18
18
|
static initialise(): void;
|
|
19
|
-
/** Gets a format string for the pre-defined number format.
|
|
20
|
-
|
|
19
|
+
/** Gets a format string for the pre-defined number format.
|
|
20
|
+
* @param displayDecimals No of decimals to display if using a decimals format.
|
|
21
|
+
*/
|
|
22
|
+
static getFormatString(format: NumberFormat, currencySymbol?: string, displayDecimals?: number): string;
|
|
21
23
|
/**
|
|
22
24
|
* Formats a number into a string that can be parsed back to a number. E.g. without currency symbol or group separators
|
|
23
25
|
* @param number js number
|
|
24
26
|
* @param format Format string including group separators / currency symbol. This is used to get the number of decimal to display.
|
|
25
27
|
* @param hasExternalPercentSymbol True if this is a percent, but the format string doesn't contain a % symbol.
|
|
28
|
+
* @param maxDecimals Max no of decimals supported by the value. For percentages this should be 2 more than the no of displayed decimals.
|
|
26
29
|
*/
|
|
27
|
-
static formatRaw(number: number, format: string, hasExternalPercentSymbol?: boolean): string;
|
|
30
|
+
static formatRaw(number: number, format: string, hasExternalPercentSymbol?: boolean, maxDecimals?: number): string;
|
|
28
31
|
/**
|
|
29
32
|
* Rounds a number, getting the precision from the format string
|
|
30
33
|
* @param hasExternalPercentSymbol True if this is a percent, but the format string doesn't contain a % symbol.
|
|
31
34
|
*/
|
|
32
|
-
static roundUsingFormat
|
|
35
|
+
static roundUsingFormat(number: number, formatString: string, hasExternalPercentSymbol?: boolean): number;
|
|
36
|
+
/**
|
|
37
|
+
* Rounds a number to the nearest no of decimals.
|
|
38
|
+
*/
|
|
39
|
+
static round<T extends number | Decimal>(number: T, decimals: number): T;
|
|
33
40
|
/**
|
|
34
41
|
* Returns the number of decimal places in a format string.
|
|
35
42
|
* @param formatString Format string.
|
|
36
43
|
* @param value Value if the negative format string is different to positive.
|
|
37
44
|
*/
|
|
38
|
-
static getDecimalPlaces
|
|
45
|
+
static getDecimalPlaces(formatString: string, value?: number): number;
|
|
39
46
|
private static getDecimalsFormatPart;
|
|
40
47
|
/**
|
|
41
48
|
* Converts a number to a string using the specified format.
|
package/dist/NumberUtils.js
CHANGED
|
@@ -24,9 +24,23 @@ var NumberUtils = /** @class */ (function () {
|
|
|
24
24
|
NumberUtils.numberFormats[NumberFormat.CurrencyNoDecimals] = "_#,##0;(_#,##0)";
|
|
25
25
|
NumberUtils.numberFormats[NumberFormat.CurrencyDecimals] = "_#,##0.00;(_#,##0.00)";
|
|
26
26
|
};
|
|
27
|
-
/** Gets a format string for the pre-defined number format.
|
|
28
|
-
|
|
27
|
+
/** Gets a format string for the pre-defined number format.
|
|
28
|
+
* @param displayDecimals No of decimals to display if using a decimals format.
|
|
29
|
+
*/
|
|
30
|
+
NumberUtils.getFormatString = function (format, currencySymbol, displayDecimals) {
|
|
31
|
+
if (displayDecimals === void 0) { displayDecimals = 2; }
|
|
29
32
|
var formatString = NumberUtils.numberFormats[format];
|
|
33
|
+
if ((format & 0x0100) === 0x0100) {
|
|
34
|
+
if (displayDecimals === 0) {
|
|
35
|
+
formatString = formatString.replace(/.00/g, "");
|
|
36
|
+
}
|
|
37
|
+
else if (displayDecimals === 1) {
|
|
38
|
+
formatString = formatString.replace(/.00/g, ".0");
|
|
39
|
+
}
|
|
40
|
+
else if (displayDecimals > 2) {
|
|
41
|
+
formatString = formatString.replace(/.00/g, ".00" + "#".repeat(displayDecimals - 2));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
30
44
|
return formatString.replace(/_/g, currencySymbol || NumberUtils.defaultCurrencySymbol);
|
|
31
45
|
};
|
|
32
46
|
/**
|
|
@@ -34,15 +48,19 @@ var NumberUtils = /** @class */ (function () {
|
|
|
34
48
|
* @param number js number
|
|
35
49
|
* @param format Format string including group separators / currency symbol. This is used to get the number of decimal to display.
|
|
36
50
|
* @param hasExternalPercentSymbol True if this is a percent, but the format string doesn't contain a % symbol.
|
|
51
|
+
* @param maxDecimals Max no of decimals supported by the value. For percentages this should be 2 more than the no of displayed decimals.
|
|
37
52
|
*/
|
|
38
|
-
NumberUtils.formatRaw = function (number, format, hasExternalPercentSymbol) {
|
|
53
|
+
NumberUtils.formatRaw = function (number, format, hasExternalPercentSymbol, maxDecimals) {
|
|
39
54
|
var parts = format.split(";");
|
|
40
55
|
var isPercent = format.indexOf("%") >= 0 || hasExternalPercentSymbol;
|
|
41
56
|
if (isPercent && NumberUtils.transformPercent) {
|
|
42
57
|
number *= 100;
|
|
43
58
|
isPercent = false; //Don't allow extra precision below.
|
|
59
|
+
if (maxDecimals !== undefined) {
|
|
60
|
+
maxDecimals -= 2;
|
|
61
|
+
}
|
|
44
62
|
}
|
|
45
|
-
var positive = "#0" + NumberUtils.getDecimalsFormatPart(parts[0], isPercent), negative = "-#0" + NumberUtils.getDecimalsFormatPart(parts[1] ? parts[1] : parts[0], isPercent);
|
|
63
|
+
var positive = "#0" + NumberUtils.getDecimalsFormatPart(parts[0], isPercent, maxDecimals), negative = "-#0" + NumberUtils.getDecimalsFormatPart(parts[1] ? parts[1] : parts[0], isPercent, maxDecimals);
|
|
46
64
|
return NumberUtils.format(number, positive + ";" + negative);
|
|
47
65
|
};
|
|
48
66
|
/**
|
|
@@ -54,6 +72,12 @@ var NumberUtils = /** @class */ (function () {
|
|
|
54
72
|
if (formatString.indexOf("%") >= 0 || hasExternalPercentSymbol) {
|
|
55
73
|
decimals += 2;
|
|
56
74
|
}
|
|
75
|
+
return this.round(number, decimals);
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Rounds a number to the nearest no of decimals.
|
|
79
|
+
*/
|
|
80
|
+
NumberUtils.round = function (number, decimals) {
|
|
57
81
|
if (number instanceof Globals.decimalType) {
|
|
58
82
|
// Round away from zero.
|
|
59
83
|
return number.toDecimalPlaces(decimals, Decimal.ROUND_HALF_UP);
|
|
@@ -82,16 +106,27 @@ var NumberUtils = /** @class */ (function () {
|
|
|
82
106
|
}
|
|
83
107
|
return 0;
|
|
84
108
|
};
|
|
85
|
-
NumberUtils.getDecimalsFormatPart = function (formatString, isPercent) {
|
|
109
|
+
NumberUtils.getDecimalsFormatPart = function (formatString, isPercent, maxDecimals) {
|
|
86
110
|
if (isPercent === void 0) { isPercent = false; }
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
111
|
+
var decimalsPart = "";
|
|
112
|
+
var startIndex = formatString.indexOf(".");
|
|
113
|
+
var endIndex = Math.max(formatString.lastIndexOf("0"), formatString.lastIndexOf("#"));
|
|
114
|
+
if (startIndex >= 0 && endIndex > 0) {
|
|
115
|
+
decimalsPart = formatString.substring(startIndex, endIndex + 1) + (isPercent ? "##" : "");
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
decimalsPart = isPercent ? ".##" : "";
|
|
119
|
+
}
|
|
120
|
+
if (maxDecimals !== undefined && maxDecimals > 0) {
|
|
121
|
+
// If the format string has less decimals than maxDecimals, then add # characters on the end.
|
|
122
|
+
if (!decimalsPart) {
|
|
123
|
+
decimalsPart = ".";
|
|
124
|
+
}
|
|
125
|
+
if (decimalsPart.length - 1 < maxDecimals) {
|
|
126
|
+
decimalsPart += "#".repeat(maxDecimals - (decimalsPart.length - 1));
|
|
92
127
|
}
|
|
93
128
|
}
|
|
94
|
-
return
|
|
129
|
+
return decimalsPart;
|
|
95
130
|
};
|
|
96
131
|
NumberUtils.format = function (number, format, currencySymbol) {
|
|
97
132
|
if (number instanceof Globals.decimalType) {
|
|
@@ -3,11 +3,15 @@ import { ValidationDisplayMode } from '../Misc';
|
|
|
3
3
|
import { IInvalidObject } from './ModelValidator';
|
|
4
4
|
import { IRule } from '../Rules';
|
|
5
5
|
import { IRuleResult } from '../RuleContext';
|
|
6
|
+
import { RuleSeverity } from '../ValidationState';
|
|
6
7
|
export default interface IModelValidator {
|
|
8
|
+
/** Causes all errors to be displayed regardless of ValidationDisplayMode. */
|
|
7
9
|
forceShowErrors: boolean;
|
|
8
|
-
isValid: boolean;
|
|
10
|
+
readonly isValid: boolean;
|
|
11
|
+
/** The max current severity of all rules in this object. */
|
|
12
|
+
readonly severity: RuleSeverity;
|
|
9
13
|
/**
|
|
10
|
-
* Gets the broken rules for this object. If you need the summary for an object graph, use Validation.getValidationSummary()
|
|
14
|
+
* Gets the broken rules for this object (not it's children). If you need the summary for an object graph, use Validation.getValidationSummary()
|
|
11
15
|
*/
|
|
12
16
|
getBrokenRules(): IInvalidObject;
|
|
13
17
|
/**
|
|
@@ -23,6 +23,7 @@ export default class ModelValidator implements IModelValidator {
|
|
|
23
23
|
forceShowErrors: boolean;
|
|
24
24
|
get ruleState(): ContainerValidationState;
|
|
25
25
|
get isValid(): boolean;
|
|
26
|
+
get severity(): import("../ValidationState").RuleSeverity;
|
|
26
27
|
private checkRules;
|
|
27
28
|
/**
|
|
28
29
|
* Gets the broken rules for this object. If you need the summary for an object graph, use Validation.getValidationSummary()
|
|
@@ -63,6 +63,13 @@ var ModelValidator = /** @class */ (function () {
|
|
|
63
63
|
enumerable: false,
|
|
64
64
|
configurable: true
|
|
65
65
|
});
|
|
66
|
+
Object.defineProperty(ModelValidator.prototype, "severity", {
|
|
67
|
+
get: function () {
|
|
68
|
+
return this.ruleState.severity;
|
|
69
|
+
},
|
|
70
|
+
enumerable: false,
|
|
71
|
+
configurable: true
|
|
72
|
+
});
|
|
66
73
|
ModelValidator.prototype.checkRules = function () {
|
|
67
74
|
var _this = this;
|
|
68
75
|
this._ruleState = new ContainerValidationState();
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { EnumHelper } from './Model/EnumHelper';
|
|
|
11
11
|
import { MenuUtils } from './Components/ContextMenu/MenuUtils';
|
|
12
12
|
import FileUtils from "./FileUtils";
|
|
13
13
|
import { runInTask } from './Components/TaskRunner/Decorators';
|
|
14
|
+
import { createProperty } from "./Model/PropertyInstance";
|
|
14
15
|
import * as Attributes from './Model/Decorators';
|
|
15
16
|
import * as Rules from './Validation/Decorators';
|
|
16
17
|
import * as AppServices from './AppServices';
|
|
@@ -28,7 +29,7 @@ import * as Validation from './Validation';
|
|
|
28
29
|
import * as Views from './Views/IViewBase';
|
|
29
30
|
declare const NotifyUtils: Components.INotificationHelper;
|
|
30
31
|
export { AppServices, Attributes, Components, Data, DateUtils, DebounceHelper, EnumHelper, FileUtils, JsonSchema, Localisation, List, MenuUtils, Misc, ModalUtils, Model, NeoModel, Network, NotifyUtils, NumberUtils, Routing, Rules, Security, SignalR, StringUtils, Validation, Views, };
|
|
31
|
-
export { runInTask };
|
|
32
|
+
export { runInTask, createProperty };
|
|
32
33
|
export { default as ModelBase } from './Model/ModelBase';
|
|
33
34
|
export { default as ValueObject } from './Model/ValueObject';
|
|
34
35
|
export { LookupBase } from './Model/LookupBase';
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import { EnumHelper } from './Model/EnumHelper';
|
|
|
12
12
|
import { MenuUtils } from './Components/ContextMenu/MenuUtils';
|
|
13
13
|
import FileUtils from "./FileUtils";
|
|
14
14
|
import { runInTask } from './Components/TaskRunner/Decorators';
|
|
15
|
+
import { createProperty } from "./Model/PropertyInstance";
|
|
15
16
|
// Namespaced exports from 1 file
|
|
16
17
|
import * as Attributes from './Model/Decorators';
|
|
17
18
|
import * as Rules from './Validation/Decorators';
|
|
@@ -34,7 +35,7 @@ var NotifyUtils = new NotificationHelper();
|
|
|
34
35
|
// Types
|
|
35
36
|
export { AppServices, Attributes, Components, Data, DateUtils, DebounceHelper, EnumHelper, FileUtils, JsonSchema, Localisation, List, MenuUtils, Misc, ModalUtils, Model, NeoModel, Network, NotifyUtils, NumberUtils, Routing, Rules, Security, SignalR, StringUtils, Validation, Views, };
|
|
36
37
|
// Functions
|
|
37
|
-
export { runInTask };
|
|
38
|
+
export { runInTask, createProperty };
|
|
38
39
|
export { default as ModelBase } from './Model/ModelBase';
|
|
39
40
|
export { default as ValueObject } from './Model/ValueObject';
|
|
40
41
|
export { LookupBase } from './Model/LookupBase';
|