@singularsystems/neo-core 0.10.78 → 0.10.80
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/Components/ErrorHandler.js +6 -5
- package/dist/Components/FileManager/FileManager.js +2 -1
- package/dist/Components/Modal/ModalUtils.js +21 -9
- package/dist/DebounceHelper.d.ts +3 -0
- package/dist/DebounceHelper.js +17 -0
- package/dist/Localisation/NeoStrings.d.ts +40 -0
- package/dist/Localisation/NeoStrings.js +40 -0
- package/dist/Model/Misc.d.ts +4 -2
- package/dist/Model/ObservableProperty.js +1 -1
- package/dist/Settings.d.ts +5 -0
- package/dist/Settings.js +8 -0
- package/dist/Utils.d.ts +2 -1
- package/dist/Utils.js +4 -2
- package/dist/Validation/Decorators.js +4 -5
- package/dist/Validation/Rules.js +3 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/package.json +1 -1
- package/CHANGELOG.md +0 -15
|
@@ -2,6 +2,7 @@ import { __awaiter, __decorate, __generator, __metadata, __param } from "tslib";
|
|
|
2
2
|
import { injectable, inject } from 'inversify';
|
|
3
3
|
import { ModalUtils } from './Modal/ModalUtils';
|
|
4
4
|
import NeoTypes from '../AppServices/NeoTypes';
|
|
5
|
+
import NeoStrings from '../Localisation/NeoStrings';
|
|
5
6
|
export var ErrorDisplayType;
|
|
6
7
|
(function (ErrorDisplayType) {
|
|
7
8
|
/** Show the error text in a modal. */
|
|
@@ -94,16 +95,16 @@ var ErrorHandler = /** @class */ (function () {
|
|
|
94
95
|
});
|
|
95
96
|
};
|
|
96
97
|
ErrorHandler.prototype.get400Error = function (error) {
|
|
97
|
-
return this.parseAxiosError(
|
|
98
|
+
return this.parseAxiosError(NeoStrings.errors.invalidDataTitle, NeoStrings.errors.invalidDataBody, error);
|
|
98
99
|
};
|
|
99
100
|
ErrorHandler.prototype.get401Error = function (error) {
|
|
100
|
-
return this.parseAxiosError(
|
|
101
|
+
return this.parseAxiosError(NeoStrings.errors.notAuthenticatedTitle, NeoStrings.errors.notAuthenticatedBody, error);
|
|
101
102
|
};
|
|
102
103
|
ErrorHandler.prototype.get403Error = function (error) {
|
|
103
|
-
return this.parseAxiosError(
|
|
104
|
+
return this.parseAxiosError(NeoStrings.errors.unAuthorisedTitle, NeoStrings.errors.unAuthorisedBody, error);
|
|
104
105
|
};
|
|
105
106
|
ErrorHandler.prototype.get409Error = function (error) {
|
|
106
|
-
return this.parseAxiosError(
|
|
107
|
+
return this.parseAxiosError(NeoStrings.errors.concurrencyTitle, NeoStrings.errors.concurrencyBody, error);
|
|
107
108
|
};
|
|
108
109
|
/**
|
|
109
110
|
* Parses an axios response into an IErrorDisplay object.
|
|
@@ -180,7 +181,7 @@ var ErrorHandler = /** @class */ (function () {
|
|
|
180
181
|
};
|
|
181
182
|
ErrorHandler.prototype.getGeneralError = function (error) {
|
|
182
183
|
var errorDescription = error.message ? error.message : error;
|
|
183
|
-
return { header:
|
|
184
|
+
return { header: NeoStrings.errors.generalTitle, body: errorDescription };
|
|
184
185
|
};
|
|
185
186
|
ErrorHandler.prototype.displayError = function (displayType, error, errorDisplay) {
|
|
186
187
|
if (error instanceof Error) {
|
|
@@ -7,6 +7,7 @@ import { NeoTypes } from '../../AppServices';
|
|
|
7
7
|
import { ErrorDisplayType } from '../ErrorHandler';
|
|
8
8
|
import { Settings } from '../../Settings';
|
|
9
9
|
import { FileUploadBatch } from './FileUploadBatch';
|
|
10
|
+
import NeoStrings from '../../Localisation/NeoStrings';
|
|
10
11
|
var fileInputSymbol = Symbol("FileInput");
|
|
11
12
|
var FileManagerBase = /** @class */ (function () {
|
|
12
13
|
function FileManagerBase(uploadEndpointOrOptions, options) {
|
|
@@ -87,7 +88,7 @@ var FileManagerBase = /** @class */ (function () {
|
|
|
87
88
|
return true;
|
|
88
89
|
}
|
|
89
90
|
else {
|
|
90
|
-
ModalUtils.showMessage(
|
|
91
|
+
ModalUtils.showMessage(NeoStrings.fileManager.uploadErrorTitle, NeoStrings.fileManager.uploadErrorBody.format(checkResult.extension));
|
|
91
92
|
return false;
|
|
92
93
|
}
|
|
93
94
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
1
2
|
import Globals from '../../Globals';
|
|
2
3
|
import { NeoTypes } from '../../AppServices';
|
|
4
|
+
import { Settings } from '../../Settings';
|
|
5
|
+
import NeoStrings from '../../Localisation/NeoStrings';
|
|
3
6
|
export var ModalResult;
|
|
4
7
|
(function (ModalResult) {
|
|
5
8
|
ModalResult[ModalResult["Yes"] = 1] = "Yes";
|
|
@@ -12,7 +15,16 @@ var ModalHelpers = /** @class */ (function () {
|
|
|
12
15
|
ModalHelpers.prototype.showMessage = function (title, message, resultValue) {
|
|
13
16
|
var _this = this;
|
|
14
17
|
return new Promise(function (resolve, reject) {
|
|
15
|
-
|
|
18
|
+
var button = { text: NeoStrings.modals.ok, onClick: function () { return resultValue ? resolve(resultValue) : resolve(); } };
|
|
19
|
+
var options = { onClose: resolve };
|
|
20
|
+
if (Settings.modal.okIsAccept) {
|
|
21
|
+
options.acceptButton = button;
|
|
22
|
+
options.closeButton = false;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
options.closeButton = button;
|
|
26
|
+
}
|
|
27
|
+
_this.showModal(title, message, options);
|
|
16
28
|
});
|
|
17
29
|
};
|
|
18
30
|
/**
|
|
@@ -47,8 +59,8 @@ var ModalHelpers = /** @class */ (function () {
|
|
|
47
59
|
_this.showModal(title, message, {
|
|
48
60
|
onClose: function () { return resolve(ModalResult.No); },
|
|
49
61
|
showCancelButton: allowCancel,
|
|
50
|
-
acceptButton: { text:
|
|
51
|
-
closeButton: { text:
|
|
62
|
+
acceptButton: { text: NeoStrings.modals.yes, onClick: onAccept },
|
|
63
|
+
closeButton: { text: NeoStrings.modals.no, onClick: function () { return resolve(ModalResult.No); } }
|
|
52
64
|
});
|
|
53
65
|
});
|
|
54
66
|
};
|
|
@@ -64,9 +76,9 @@ var ModalHelpers = /** @class */ (function () {
|
|
|
64
76
|
return new Promise(function (resolve, reject) {
|
|
65
77
|
_this.showModal(title, message, {
|
|
66
78
|
onClose: function () { return resolve(ModalResult.Cancel); },
|
|
67
|
-
acceptButton: { text:
|
|
68
|
-
closeButton: {
|
|
69
|
-
formProps: { model: model }
|
|
79
|
+
acceptButton: { text: NeoStrings.modals.ok, onClick: function () { return resolve(ModalResult.Yes); } },
|
|
80
|
+
closeButton: __assign(__assign({}, Settings.modal.cancelButton), { text: NeoStrings.modals.cancel, onClick: function () { return resolve(ModalResult.Cancel); } }),
|
|
81
|
+
formProps: { model: model },
|
|
70
82
|
});
|
|
71
83
|
});
|
|
72
84
|
};
|
|
@@ -88,9 +100,9 @@ var ModalHelpers = /** @class */ (function () {
|
|
|
88
100
|
_this.showModal(title, message, {
|
|
89
101
|
onClose: function () { return resolve(ModalResult.Cancel); },
|
|
90
102
|
buttons: [
|
|
91
|
-
{
|
|
92
|
-
{
|
|
93
|
-
{
|
|
103
|
+
__assign(__assign({}, Settings.modal.acceptButton), { text: NeoStrings.modals.yes, onClick: onAccept }),
|
|
104
|
+
__assign(__assign({}, Settings.modal.closeButton), { text: NeoStrings.modals.no, onClick: function () { return resolve(ModalResult.No); } }),
|
|
105
|
+
__assign(__assign({}, Settings.modal.cancelButton), { text: NeoStrings.modals.cancel, onClick: function () { return resolve(ModalResult.Cancel); } })
|
|
94
106
|
]
|
|
95
107
|
});
|
|
96
108
|
});
|
package/dist/DebounceHelper.d.ts
CHANGED
|
@@ -26,10 +26,13 @@ export declare class DebounceHelper<T = void, TState = any> {
|
|
|
26
26
|
* @param state State to pass to debounced method as an array of values for each time debounce was called.
|
|
27
27
|
*/
|
|
28
28
|
static debounce<T = any, TState = any>(syncInstance: any, callback: (state: TState[]) => T | Promise<T>, delayMs: number, state?: TState): Promise<IDebounceResult<T>>;
|
|
29
|
+
static hasPending(syncInstance: any): boolean;
|
|
29
30
|
/** Cancels pending execution of the callback. Pending promise will be resolved with cancelled: true. */
|
|
30
31
|
static cancelPending<TState = any>(syncInstance: any): TState[];
|
|
31
32
|
/** Fires the latest callback immediately. Pending promise from execute() will also be resolved with the return value of the callback. */
|
|
32
33
|
static executeImmediate(syncInstance: any): Promise<void>;
|
|
34
|
+
/** Indicates that there is a pending execution. */
|
|
35
|
+
get hasPending(): boolean;
|
|
33
36
|
/**
|
|
34
37
|
* Waits the interval defined in the constructor, then executes the callback.
|
|
35
38
|
* The callback will not execute if execute is called again within the interval.
|
package/dist/DebounceHelper.js
CHANGED
|
@@ -32,6 +32,15 @@ var DebounceHelper = /** @class */ (function () {
|
|
|
32
32
|
helper.delayMs = delayMs;
|
|
33
33
|
return helper.execute(state);
|
|
34
34
|
};
|
|
35
|
+
DebounceHelper.hasPending = function (syncInstance) {
|
|
36
|
+
var helper = syncInstance[stateSymbol];
|
|
37
|
+
if (helper) {
|
|
38
|
+
return helper.hasPending;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
35
44
|
/** Cancels pending execution of the callback. Pending promise will be resolved with cancelled: true. */
|
|
36
45
|
DebounceHelper.cancelPending = function (syncInstance) {
|
|
37
46
|
var helper = syncInstance[stateSymbol];
|
|
@@ -52,6 +61,14 @@ var DebounceHelper = /** @class */ (function () {
|
|
|
52
61
|
return Promise.resolve();
|
|
53
62
|
}
|
|
54
63
|
};
|
|
64
|
+
Object.defineProperty(DebounceHelper.prototype, "hasPending", {
|
|
65
|
+
/** Indicates that there is a pending execution. */
|
|
66
|
+
get: function () {
|
|
67
|
+
return this.currentResolver !== undefined;
|
|
68
|
+
},
|
|
69
|
+
enumerable: false,
|
|
70
|
+
configurable: true
|
|
71
|
+
});
|
|
55
72
|
/**
|
|
56
73
|
* Waits the interval defined in the constructor, then executes the callback.
|
|
57
74
|
* The callback will not execute if execute is called again within the interval.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
declare const NeoStrings: {
|
|
2
|
+
errors: {
|
|
3
|
+
concurrencyTitle: string;
|
|
4
|
+
concurrencyBody: string;
|
|
5
|
+
generalTitle: string;
|
|
6
|
+
invalidDataTitle: string;
|
|
7
|
+
invalidDataBody: string;
|
|
8
|
+
notAuthenticatedTitle: string;
|
|
9
|
+
notAuthenticatedBody: string;
|
|
10
|
+
unAuthorisedTitle: string;
|
|
11
|
+
unAuthorisedBody: string;
|
|
12
|
+
};
|
|
13
|
+
fileManager: {
|
|
14
|
+
uploadErrorTitle: string;
|
|
15
|
+
/** {0} is the extension of the file */
|
|
16
|
+
uploadErrorBody: string;
|
|
17
|
+
};
|
|
18
|
+
modals: {
|
|
19
|
+
cancel: string;
|
|
20
|
+
no: string;
|
|
21
|
+
ok: string;
|
|
22
|
+
yes: string;
|
|
23
|
+
};
|
|
24
|
+
validation: {
|
|
25
|
+
/** Default text to display for built in rules. */
|
|
26
|
+
rules: {
|
|
27
|
+
/** {0} is the field name */
|
|
28
|
+
required: string;
|
|
29
|
+
/** {0} is the current value */
|
|
30
|
+
emailAddress: string;
|
|
31
|
+
/** {0} is the field name */
|
|
32
|
+
regExp: string;
|
|
33
|
+
/** Displayed when the string is too short */
|
|
34
|
+
stringLengthLessThan: string;
|
|
35
|
+
/** Displayed when the string is too long */
|
|
36
|
+
stringLengthMoreThan: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export default NeoStrings;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var NeoStrings = {
|
|
2
|
+
errors: {
|
|
3
|
+
concurrencyTitle: "Concurrency error",
|
|
4
|
+
concurrencyBody: "Someone else modified the record before you saved it. Please reload it and try again.",
|
|
5
|
+
generalTitle: "Error",
|
|
6
|
+
invalidDataTitle: "Invalid data",
|
|
7
|
+
invalidDataBody: "Cannot continue due to the following validation errors:",
|
|
8
|
+
notAuthenticatedTitle: "Not authenticated",
|
|
9
|
+
notAuthenticatedBody: "You are not logged in. Please reload the page to login again.",
|
|
10
|
+
unAuthorisedTitle: "Unauthorised",
|
|
11
|
+
unAuthorisedBody: "You do not have access to perform this operation."
|
|
12
|
+
},
|
|
13
|
+
fileManager: {
|
|
14
|
+
uploadErrorTitle: "File upload error",
|
|
15
|
+
/** {0} is the extension of the file */
|
|
16
|
+
uploadErrorBody: "File extension: {0} is not allowed."
|
|
17
|
+
},
|
|
18
|
+
modals: {
|
|
19
|
+
cancel: "Cancel",
|
|
20
|
+
no: "No",
|
|
21
|
+
ok: "Ok",
|
|
22
|
+
yes: "Yes",
|
|
23
|
+
},
|
|
24
|
+
validation: {
|
|
25
|
+
/** Default text to display for built in rules. */
|
|
26
|
+
rules: {
|
|
27
|
+
/** {0} is the field name */
|
|
28
|
+
required: "{0} is required",
|
|
29
|
+
/** {0} is the current value */
|
|
30
|
+
emailAddress: "{0} is not a valid email address",
|
|
31
|
+
/** {0} is the field name */
|
|
32
|
+
regExp: "{0} is in an invalid format",
|
|
33
|
+
/** Displayed when the string is too short */
|
|
34
|
+
stringLengthLessThan: "{0} cannot be less than {1} characters in length",
|
|
35
|
+
/** Displayed when the string is too long */
|
|
36
|
+
stringLengthMoreThan: "{0} cannot be more than {1} characters in length"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
export default NeoStrings;
|
package/dist/Model/Misc.d.ts
CHANGED
|
@@ -54,10 +54,12 @@ export interface IDisposable {
|
|
|
54
54
|
dispose(): void;
|
|
55
55
|
}
|
|
56
56
|
export interface IAutoRunner extends IDisposable {
|
|
57
|
+
/** Indicates whether there are any pending callbacks. */
|
|
58
|
+
readonly hasPending: boolean;
|
|
57
59
|
/** Dispose the auto runner. */
|
|
58
60
|
dispose(): void;
|
|
59
|
-
/** Cancels any pending callbacks. */
|
|
60
|
-
cancelPending():
|
|
61
|
+
/** Cancels any pending callbacks. Returns true if there were any pending callbacks. */
|
|
62
|
+
cancelPending(): boolean;
|
|
61
63
|
/** Cancels any pending callbacks, and fires the callback immediately. */
|
|
62
64
|
fireImmediate(): void;
|
|
63
65
|
}
|
|
@@ -25,7 +25,7 @@ var ObservableProperty = /** @class */ (function () {
|
|
|
25
25
|
var model = new ObservableModel();
|
|
26
26
|
model.value = defaultValue;
|
|
27
27
|
var propertyInfo = new PropertyInfo("value");
|
|
28
|
-
Utils.populatePartialWithDefaults(propertyInfo, options);
|
|
28
|
+
Utils.populatePartialWithDefaults(propertyInfo, options, true);
|
|
29
29
|
propertyInfo.displayName = displayName;
|
|
30
30
|
if (isRequired) {
|
|
31
31
|
propertyInfo.rules.push(new RequiredRule("{0} is required."));
|
package/dist/Settings.d.ts
CHANGED
|
@@ -49,8 +49,13 @@ export declare const Settings: {
|
|
|
49
49
|
useStickyHeaders: boolean;
|
|
50
50
|
};
|
|
51
51
|
modal: {
|
|
52
|
+
/** Set to true if ModalUtils.showMessage() should show an accept button instead of close button. */
|
|
53
|
+
okIsAccept: boolean;
|
|
52
54
|
acceptButton: IButtonOptions;
|
|
55
|
+
/** Settings for close button shown in footer. */
|
|
53
56
|
closeButton: IButtonOptions;
|
|
57
|
+
/** Settings for cancel button shown in footer. */
|
|
58
|
+
cancelButton: IButtonOptions;
|
|
54
59
|
};
|
|
55
60
|
pager: {
|
|
56
61
|
firstText: string;
|
package/dist/Settings.js
CHANGED
|
@@ -72,14 +72,22 @@ export var Settings = {
|
|
|
72
72
|
useStickyHeaders: false,
|
|
73
73
|
},
|
|
74
74
|
modal: {
|
|
75
|
+
/** Set to true if ModalUtils.showMessage() should show an accept button instead of close button. */
|
|
76
|
+
okIsAccept: false,
|
|
75
77
|
acceptButton: {
|
|
76
78
|
text: "Ok",
|
|
77
79
|
variant: "primary"
|
|
78
80
|
},
|
|
81
|
+
/** Settings for close button shown in footer. */
|
|
79
82
|
closeButton: {
|
|
80
83
|
text: "Close",
|
|
81
84
|
variant: "secondary"
|
|
82
85
|
},
|
|
86
|
+
/** Settings for cancel button shown in footer. */
|
|
87
|
+
cancelButton: {
|
|
88
|
+
variant: "light",
|
|
89
|
+
isOutline: false,
|
|
90
|
+
},
|
|
83
91
|
},
|
|
84
92
|
pager: {
|
|
85
93
|
firstText: "«",
|
package/dist/Utils.d.ts
CHANGED
|
@@ -55,8 +55,9 @@ export declare class Utils {
|
|
|
55
55
|
* Completes a partially populated object using defaults specified in the defaults parameter.
|
|
56
56
|
* @param partial Partially populated object
|
|
57
57
|
* @param defaults Defaults object.
|
|
58
|
+
* @param force True if the properties in `partial` must be set even if they have a value.
|
|
58
59
|
*/
|
|
59
|
-
static populatePartialWithDefaults<T>(partial: Partial<T> | undefined, defaults: T): T;
|
|
60
|
+
static populatePartialWithDefaults<T>(partial: Partial<T> | undefined, defaults: T, force?: boolean): T;
|
|
60
61
|
/**
|
|
61
62
|
* Converts a string like 'user' to 'fa fa-user' or 'fa-user' to 'fa fa-user' or 'far-user' to 'far fa-user'
|
|
62
63
|
*/
|
package/dist/Utils.js
CHANGED
|
@@ -101,12 +101,14 @@ var Utils = /** @class */ (function () {
|
|
|
101
101
|
* Completes a partially populated object using defaults specified in the defaults parameter.
|
|
102
102
|
* @param partial Partially populated object
|
|
103
103
|
* @param defaults Defaults object.
|
|
104
|
+
* @param force True if the properties in `partial` must be set even if they have a value.
|
|
104
105
|
*/
|
|
105
|
-
Utils.populatePartialWithDefaults = function (partial, defaults) {
|
|
106
|
+
Utils.populatePartialWithDefaults = function (partial, defaults, force) {
|
|
107
|
+
if (force === void 0) { force = false; }
|
|
106
108
|
if (!partial)
|
|
107
109
|
partial = {};
|
|
108
110
|
for (var key in defaults) {
|
|
109
|
-
if (!partial[key])
|
|
111
|
+
if (force || !partial[key])
|
|
110
112
|
partial[key] = defaults[key];
|
|
111
113
|
}
|
|
112
114
|
return partial;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
2
|
import * as Rules from './Rules';
|
|
3
3
|
import { ensureTypeInfo } from '../Model/NeoTypeInfo';
|
|
4
|
+
import NeoStrings from '../Localisation/NeoStrings';
|
|
4
5
|
function addRuleToType(type, propertyName, rule) {
|
|
5
6
|
ensureTypeInfo(type.constructor).neo.addAttributeRule(propertyName, rule);
|
|
6
7
|
}
|
|
7
8
|
export function Required(errorTextOrOptions) {
|
|
8
9
|
return function (type, propertyKey) {
|
|
9
|
-
var options = { errorText:
|
|
10
|
+
var options = { errorText: NeoStrings.validation.rules.required, allowZero: false };
|
|
10
11
|
if (errorTextOrOptions !== undefined) {
|
|
11
12
|
if (typeof errorTextOrOptions === "string") {
|
|
12
13
|
options.errorText = errorTextOrOptions;
|
|
@@ -20,16 +21,14 @@ export function Required(errorTextOrOptions) {
|
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
23
|
export function EmailAddress(errorText) {
|
|
23
|
-
if (errorText === void 0) { errorText = "{0} is not a valid email address"; }
|
|
24
24
|
return function (type, propertyKey) {
|
|
25
|
-
var emailAddressRule = new Rules.EmailAddressRule(errorText);
|
|
25
|
+
var emailAddressRule = new Rules.EmailAddressRule(errorText !== null && errorText !== void 0 ? errorText : NeoStrings.validation.rules.emailAddress);
|
|
26
26
|
addRuleToType(type, propertyKey, emailAddressRule);
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
export function RegExp(expression, errorText) {
|
|
30
|
-
if (errorText === void 0) { errorText = "{0} is in an invalid format"; }
|
|
31
30
|
return function (type, propertyKey) {
|
|
32
|
-
var regExpRule = new Rules.RegExpRule(expression, errorText);
|
|
31
|
+
var regExpRule = new Rules.RegExpRule(expression, errorText !== null && errorText !== void 0 ? errorText : NeoStrings.validation.rules.regExp);
|
|
33
32
|
addRuleToType(type, propertyKey, regExpRule);
|
|
34
33
|
};
|
|
35
34
|
}
|
package/dist/Validation/Rules.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __extends } from "tslib";
|
|
2
2
|
import { RuleSeverity } from './ValidationState';
|
|
3
3
|
import { Utils } from '../Utils';
|
|
4
|
+
import NeoStrings from '../Localisation/NeoStrings';
|
|
4
5
|
var Rule = /** @class */ (function () {
|
|
5
6
|
function Rule() {
|
|
6
7
|
this.ruleId = Utils.uuidv4();
|
|
@@ -40,12 +41,12 @@ var StringLengthRule = /** @class */ (function (_super) {
|
|
|
40
41
|
var errorTextValue = this.errorText;
|
|
41
42
|
if (this.minLength && (!value || value.length < this.minLength)) {
|
|
42
43
|
if (!errorTextValue)
|
|
43
|
-
errorTextValue =
|
|
44
|
+
errorTextValue = NeoStrings.validation.rules.stringLengthLessThan;
|
|
44
45
|
context.addError(errorTextValue.format(propertyInstance.propertyInfo.readableName, this.minLength.toString(), this.maxLength.toString()));
|
|
45
46
|
}
|
|
46
47
|
else if (value && value.length > this.maxLength) {
|
|
47
48
|
if (!errorTextValue)
|
|
48
|
-
errorTextValue =
|
|
49
|
+
errorTextValue = NeoStrings.validation.rules.stringLengthMoreThan;
|
|
49
50
|
context.addError(errorTextValue.format(propertyInstance.propertyInfo.readableName, this.maxLength.toString()));
|
|
50
51
|
}
|
|
51
52
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { MenuUtils } from './Components/ContextMenu/MenuUtils';
|
|
|
12
12
|
import FileUtils from "./FileUtils";
|
|
13
13
|
import { runInTask } from './Components/TaskRunner/Decorators';
|
|
14
14
|
import { createProperty } from "./Model/PropertyInstance";
|
|
15
|
+
import NeoStrings from "./Localisation/NeoStrings";
|
|
15
16
|
import * as Attributes from './Model/Decorators';
|
|
16
17
|
import * as Rules from './Validation/Decorators';
|
|
17
18
|
import * as AppServices from './AppServices';
|
|
@@ -28,7 +29,7 @@ import * as SignalR from './SignalR';
|
|
|
28
29
|
import * as Validation from './Validation';
|
|
29
30
|
import * as Views from './Views/IViewBase';
|
|
30
31
|
declare const NotifyUtils: Components.INotificationHelper;
|
|
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, };
|
|
32
|
+
export { AppServices, Attributes, Components, Data, DateUtils, DebounceHelper, EnumHelper, FileUtils, JsonSchema, Localisation, List, MenuUtils, Misc, ModalUtils, Model, NeoModel, NeoStrings, Network, NotifyUtils, NumberUtils, Routing, Rules, Security, SignalR, StringUtils, Validation, Views, };
|
|
32
33
|
export { runInTask, createProperty };
|
|
33
34
|
export { default as ModelBase } from './Model/ModelBase';
|
|
34
35
|
export { default as ValueObject } from './Model/ValueObject';
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import { MenuUtils } from './Components/ContextMenu/MenuUtils';
|
|
|
13
13
|
import FileUtils from "./FileUtils";
|
|
14
14
|
import { runInTask } from './Components/TaskRunner/Decorators';
|
|
15
15
|
import { createProperty } from "./Model/PropertyInstance";
|
|
16
|
+
import NeoStrings from "./Localisation/NeoStrings";
|
|
16
17
|
// Namespaced exports from 1 file
|
|
17
18
|
import * as Attributes from './Model/Decorators';
|
|
18
19
|
import * as Rules from './Validation/Decorators';
|
|
@@ -33,7 +34,7 @@ import * as Views from './Views/IViewBase';
|
|
|
33
34
|
import { NotificationHelper } from './Components/Notifications/NotificationHelper';
|
|
34
35
|
var NotifyUtils = new NotificationHelper();
|
|
35
36
|
// Types
|
|
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, };
|
|
37
|
+
export { AppServices, Attributes, Components, Data, DateUtils, DebounceHelper, EnumHelper, FileUtils, JsonSchema, Localisation, List, MenuUtils, Misc, ModalUtils, Model, NeoModel, NeoStrings, Network, NotifyUtils, NumberUtils, Routing, Rules, Security, SignalR, StringUtils, Validation, Views, };
|
|
37
38
|
// Functions
|
|
38
39
|
export { runInTask, createProperty };
|
|
39
40
|
export { default as ModelBase } from './Model/ModelBase';
|
package/package.json
CHANGED
package/CHANGELOG.md
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
# Breaking changes
|
|
4
|
-
|
|
5
|
-
## 0.10.65 (6 March 2023)
|
|
6
|
-
|
|
7
|
-
* `IErrorHandler` now requires the return type to be `Promise<IErrorDisplay>` instead of `IErrorDisplay`.
|
|
8
|
-
* Most of the protected methods in `ErrorHandler` have been changed to `async`.
|
|
9
|
-
* These changes were required in order to be able to read errors from axios blob responses.
|
|
10
|
-
|
|
11
|
-
# Change Log
|
|
12
|
-
|
|
13
|
-
## 0.10.65 (6 March 2023)
|
|
14
|
-
|
|
15
|
-
* Fixed error handler not parsing axios responses when response type is `blob`.
|