@zajno/common 1.4.8 → 1.4.11
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/coverage/clover.xml +52 -52
- package/coverage/coverage-final.json +46 -46
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/src/__tests__/helpers/index.html +1 -1
- package/coverage/lcov-report/src/__tests__/helpers/main.ts.html +1 -1
- package/coverage/lcov-report/src/async/arrays.ts.html +1 -1
- package/coverage/lcov-report/src/async/index.html +1 -1
- package/coverage/lcov-report/src/async/timeout.ts.html +1 -1
- package/coverage/lcov-report/src/cache.ts.html +1 -1
- package/coverage/lcov-report/src/dates/calc.ts.html +1 -1
- package/coverage/lcov-report/src/dates/convert.ts.html +1 -1
- package/coverage/lcov-report/src/dates/datex.ts.html +1 -1
- package/coverage/lcov-report/src/dates/format.ts.html +1 -1
- package/coverage/lcov-report/src/dates/index.html +1 -1
- package/coverage/lcov-report/src/dates/index.ts.html +1 -1
- package/coverage/lcov-report/src/dates/parse.ts.html +1 -1
- package/coverage/lcov-report/src/dates/period.ts.html +1 -1
- package/coverage/lcov-report/src/dates/shift.ts.html +1 -1
- package/coverage/lcov-report/src/dates/types.ts.html +1 -1
- package/coverage/lcov-report/src/dates/yearDate.ts.html +1 -1
- package/coverage/lcov-report/src/disposer.ts.html +1 -1
- package/coverage/lcov-report/src/enumHelper.ts.html +1 -1
- package/coverage/lcov-report/src/event.ts.html +4 -7
- package/coverage/lcov-report/src/fields/index.html +1 -1
- package/coverage/lcov-report/src/fields/update.ts.html +1 -1
- package/coverage/lcov-report/src/functions.ts.html +1 -1
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/lazy.light.ts.html +1 -1
- package/coverage/lcov-report/src/logger/batch.ts.html +1 -1
- package/coverage/lcov-report/src/logger/console.ts.html +1 -1
- package/coverage/lcov-report/src/logger/index.html +1 -1
- package/coverage/lcov-report/src/logger/index.ts.html +1 -1
- package/coverage/lcov-report/src/logger/named.ts.html +1 -1
- package/coverage/lcov-report/src/logger/proxy.ts.html +1 -1
- package/coverage/lcov-report/src/math/arrays.ts.html +1 -1
- package/coverage/lcov-report/src/math/calc.ts.html +1 -1
- package/coverage/lcov-report/src/math/distribution.ts.html +1 -1
- package/coverage/lcov-report/src/math/index.html +1 -1
- package/coverage/lcov-report/src/math/index.ts.html +1 -1
- package/coverage/lcov-report/src/observers.ts.html +368 -0
- package/coverage/lcov-report/src/observersMap.ts.html +1 -1
- package/coverage/lcov-report/src/observingCache.ts.html +1 -1
- package/coverage/lcov-report/src/transitionObserver.ts.html +1 -1
- package/coverage/lcov-report/src/types.ts.html +1 -1
- package/coverage/lcov-report/src/validation/ValidationErrors.ts.html +1 -1
- package/coverage/lcov-report/src/validation/creditCard.ts.html +1 -1
- package/coverage/lcov-report/src/validation/helpers.ts.html +1 -1
- package/coverage/lcov-report/src/validation/index.html +1 -1
- package/coverage/lcov-report/src/validation/index.ts.html +1 -1
- package/coverage/lcov-report/src/validation/types.ts.html +1 -1
- package/coverage/lcov-report/src/validation/validators.ts.html +1 -1
- package/coverage/lcov-report/src/validation/wrappers.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/FlagModel.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/MultiSelectModel.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/NumberModel.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/SelectModel.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/Validatable.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/index.html +1 -1
- package/coverage/lcov-report/src/viewModels/wrappers.ts.html +1 -1
- package/coverage/lcov-report/update.ts.html +374 -0
- package/coverage/lcov.info +6 -6
- package/lib/event.d.ts +1 -1
- package/lib/event.d.ts.map +1 -1
- package/lib/event.js.map +1 -1
- package/lib/services/localization/LocalaziedValidationErrors.d.ts +9 -0
- package/lib/services/localization/LocalaziedValidationErrors.d.ts.map +1 -0
- package/lib/services/localization/LocalaziedValidationErrors.js +27 -0
- package/lib/services/localization/LocalaziedValidationErrors.js.map +1 -0
- package/lib/services/localization/LocalizationManager.d.ts +5 -8
- package/lib/services/localization/LocalizationManager.d.ts.map +1 -1
- package/lib/services/localization/LocalizationManager.js +25 -18
- package/lib/services/localization/LocalizationManager.js.map +1 -1
- package/lib/services/localization/abstractions.d.ts +12 -0
- package/lib/services/localization/abstractions.d.ts.map +1 -0
- package/lib/services/localization/abstractions.js +3 -0
- package/lib/services/localization/abstractions.js.map +1 -0
- package/lib/services/localization/index.d.ts +5 -0
- package/lib/services/localization/index.d.ts.map +1 -0
- package/lib/services/localization/index.js +10 -0
- package/lib/services/localization/index.js.map +1 -0
- package/lib/throttledEvent.d.ts +1 -1
- package/lib/throttledEvent.d.ts.map +1 -1
- package/lib/validation/ValidationErrorsLocalization.d.ts +27 -0
- package/lib/validation/ValidationErrorsLocalization.d.ts.map +1 -0
- package/lib/validation/ValidationErrorsLocalization.js +26 -0
- package/lib/validation/ValidationErrorsLocalization.js.map +1 -0
- package/package.json +1 -1
- package/src/event.ts +2 -3
- package/src/services/localization/LocalaziedValidationErrors.ts +18 -0
- package/src/services/localization/LocalizationManager.ts +23 -22
- package/src/services/localization/abstractions.ts +16 -0
- package/src/services/localization/index.ts +6 -0
- package/src/throttledEvent.ts +1 -1
- package/src/{services/localization/validationErrorsStrings.ts → validation/ValidationErrorsLocalization.ts} +7 -5
- package/yarn-error.log +3709 -0
- package/lib/services/localization/ILocalization.d.ts +0 -32
- package/lib/services/localization/ILocalization.d.ts.map +0 -1
- package/lib/services/localization/ILocalization.js +0 -16
- package/lib/services/localization/ILocalization.js.map +0 -1
- package/lib/services/localization/validationErrorsStrings.d.ts +0 -6
- package/lib/services/localization/validationErrorsStrings.d.ts.map +0 -1
- package/lib/services/localization/validationErrorsStrings.js +0 -24
- package/lib/services/localization/validationErrorsStrings.js.map +0 -1
- package/src/services/localization/ILocalization.ts +0 -17
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LocalaziedValidationErrors = exports.LocalizationManager = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const LocalizationManager_1 = require("./LocalizationManager");
|
|
6
|
+
Object.defineProperty(exports, "LocalizationManager", { enumerable: true, get: function () { return LocalizationManager_1.LocalizationManager; } });
|
|
7
|
+
const LocalaziedValidationErrors_1 = require("./LocalaziedValidationErrors");
|
|
8
|
+
Object.defineProperty(exports, "LocalaziedValidationErrors", { enumerable: true, get: function () { return LocalaziedValidationErrors_1.LocalaziedValidationErrors; } });
|
|
9
|
+
tslib_1.__exportStar(require("./abstractions"), exports);
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/localization/index.ts"],"names":[],"mappings":";;;;AAAA,+DAA4D;AAKnD,oGALA,yCAAmB,OAKA;AAJ5B,6EAA0E;AAI5C,2GAJrB,uDAA0B,OAIqB;AAFxD,yDAA+B"}
|
package/lib/throttledEvent.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"throttledEvent.d.ts","sourceRoot":"","sources":["../src/throttledEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,qBAAa,cAAe,SAAQ,KAAK;IAErC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA2B;IAE9C,UAAU,CAAC,OAAO,EAAE,MAAM;IAK1B,OAAO;IAID,YAAY;
|
|
1
|
+
{"version":3,"file":"throttledEvent.d.ts","sourceRoot":"","sources":["../src/throttledEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,qBAAa,cAAe,SAAQ,KAAK;IAErC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA2B;IAE9C,UAAU,CAAC,OAAO,EAAE,MAAM;IAK1B,OAAO;IAID,YAAY,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;CAGhD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LocalaziedValidationErrors } from '../services/localization/LocalaziedValidationErrors';
|
|
2
|
+
import { ValidationErrors } from './ValidationErrors';
|
|
3
|
+
export declare const ValidationErrorsLocalized: LocalaziedValidationErrors<{
|
|
4
|
+
Ok: string;
|
|
5
|
+
Cancel: string;
|
|
6
|
+
Submit: string;
|
|
7
|
+
ForgotPassword: string;
|
|
8
|
+
Validation: {
|
|
9
|
+
Empty: string;
|
|
10
|
+
Name: string;
|
|
11
|
+
Email: string;
|
|
12
|
+
Password: string;
|
|
13
|
+
EnglishOnly: string;
|
|
14
|
+
Phone: string;
|
|
15
|
+
CreditCard: string;
|
|
16
|
+
CreditCardExpiryDate: string;
|
|
17
|
+
CreditCardCvv: string;
|
|
18
|
+
PasswordsShouldMatch: string;
|
|
19
|
+
FirstName: string;
|
|
20
|
+
LastName: string;
|
|
21
|
+
OnlyDigit: string;
|
|
22
|
+
Website: string;
|
|
23
|
+
Linkedin: string;
|
|
24
|
+
};
|
|
25
|
+
UnknownServerError: string;
|
|
26
|
+
}, ValidationErrors>;
|
|
27
|
+
//# sourceMappingURL=ValidationErrorsLocalization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidationErrorsLocalization.d.ts","sourceRoot":"","sources":["../../src/validation/ValidationErrorsLocalization.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qDAAqD,CAAC;AACjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAuBtD,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;oBAAkF,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidationErrorsLocalized = void 0;
|
|
4
|
+
const LocalaziedValidationErrors_1 = require("../services/localization/LocalaziedValidationErrors");
|
|
5
|
+
const ValidationErrors_1 = require("./ValidationErrors");
|
|
6
|
+
function locationFactory(strings) {
|
|
7
|
+
return {
|
|
8
|
+
[ValidationErrors_1.ValidationErrors.None]: '',
|
|
9
|
+
[ValidationErrors_1.ValidationErrors.ShouldBeNonEmpty]: strings.Validation.Empty,
|
|
10
|
+
[ValidationErrors_1.ValidationErrors.InvalidNameFormat]: strings.Validation.Name,
|
|
11
|
+
[ValidationErrors_1.ValidationErrors.InvalidEmailFormat]: strings.Validation.Email,
|
|
12
|
+
[ValidationErrors_1.ValidationErrors.InvalidPasswordFormat]: strings.Validation.Password,
|
|
13
|
+
[ValidationErrors_1.ValidationErrors.OnlyEnglishLetters]: strings.Validation.EnglishOnly,
|
|
14
|
+
[ValidationErrors_1.ValidationErrors.InvalidPhoneFormat]: strings.Validation.Phone,
|
|
15
|
+
[ValidationErrors_1.ValidationErrors.InvalidCreditCardFormat]: strings.Validation.CreditCard,
|
|
16
|
+
[ValidationErrors_1.ValidationErrors.InvalidCreditCardExpiryDateFormat]: strings.Validation.CreditCardExpiryDate,
|
|
17
|
+
[ValidationErrors_1.ValidationErrors.InvalidCreditCardCvvFormat]: strings.Validation.CreditCardCvv,
|
|
18
|
+
[ValidationErrors_1.ValidationErrors.FirstName]: strings.Validation.FirstName,
|
|
19
|
+
[ValidationErrors_1.ValidationErrors.LastName]: strings.Validation.LastName,
|
|
20
|
+
[ValidationErrors_1.ValidationErrors.OnlyDigit]: strings.Validation.OnlyDigit,
|
|
21
|
+
[ValidationErrors_1.ValidationErrors.Website]: strings.Validation.Website,
|
|
22
|
+
[ValidationErrors_1.ValidationErrors.Linkedin]: strings.Validation.Linkedin,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
exports.ValidationErrorsLocalized = new LocalaziedValidationErrors_1.LocalaziedValidationErrors(locationFactory);
|
|
26
|
+
//# sourceMappingURL=ValidationErrorsLocalization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidationErrorsLocalization.js","sourceRoot":"","sources":["../../src/validation/ValidationErrorsLocalization.ts"],"names":[],"mappings":";;;AAEA,oGAAiG;AACjG,yDAAsD;AAEtD,SAAS,eAAe,CAAC,OAAqB;IAC1C,OAAO;QACH,CAAC,mCAAgB,CAAC,IAAI,CAAC,EAAE,EAAE;QAC3B,CAAC,mCAAgB,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK;QAC7D,CAAC,mCAAgB,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI;QAC7D,CAAC,mCAAgB,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK;QAC/D,CAAC,mCAAgB,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ;QACrE,CAAC,mCAAgB,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,WAAW;QACrE,CAAC,mCAAgB,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK;QAC/D,CAAC,mCAAgB,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,UAAU;QACzE,CAAC,mCAAgB,CAAC,iCAAiC,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,oBAAoB;QAC7F,CAAC,mCAAgB,CAAC,0BAA0B,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,aAAa;QAE/E,CAAC,mCAAgB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,SAAS;QAC1D,CAAC,mCAAgB,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ;QACxD,CAAC,mCAAgB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,SAAS;QAC1D,CAAC,mCAAgB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO;QACtD,CAAC,mCAAgB,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ;KAC3D,CAAC;AACN,CAAC;AAEY,QAAA,yBAAyB,GAAG,IAAI,uDAA0B,CAAiC,eAAe,CAAC,CAAC"}
|
package/package.json
CHANGED
package/src/event.ts
CHANGED
|
@@ -45,17 +45,16 @@ export class Event<T = any> implements IEvent<T> {
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
public async triggerAsync(data?: T): Promise<
|
|
48
|
+
public async triggerAsync(data?: T): Promise<Error[]> {
|
|
49
49
|
const hh = this._handlers.slice(0);
|
|
50
50
|
|
|
51
|
-
const errors = [];
|
|
51
|
+
const errors: Error[] = [];
|
|
52
52
|
|
|
53
53
|
await forEachAsync(hh, async (cb: EventHandler<T>) => {
|
|
54
54
|
try {
|
|
55
55
|
await cb(data);
|
|
56
56
|
} catch (err) {
|
|
57
57
|
this.logError(data, cb, err);
|
|
58
|
-
|
|
59
58
|
errors.push(err);
|
|
60
59
|
}
|
|
61
60
|
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { action, observable } from 'mobx';
|
|
2
|
+
import { IErrorsLocalization, ILocalizationDependency, ValidationErrorsFactory, ValidationErrorsStrings } from './abstractions';
|
|
3
|
+
|
|
4
|
+
export class LocalaziedValidationErrors<TStrings extends { }, TErrors extends string | number>
|
|
5
|
+
implements IErrorsLocalization<TErrors>, ILocalizationDependency<TStrings> {
|
|
6
|
+
|
|
7
|
+
@observable.ref
|
|
8
|
+
private _strings: ValidationErrorsStrings<TErrors> = null;
|
|
9
|
+
|
|
10
|
+
constructor(private readonly factory: ValidationErrorsFactory<TStrings, TErrors>) { }
|
|
11
|
+
|
|
12
|
+
public get Errors(): Partial<Record<TErrors, string>> { return this._strings; }
|
|
13
|
+
|
|
14
|
+
@action
|
|
15
|
+
public updateLocale(strings: TStrings): void {
|
|
16
|
+
this._strings = this.factory(strings);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import { observable,
|
|
2
|
-
import {
|
|
3
|
-
import createValidationErrorsStrings, { ValidationErrorsStrings } from './validationErrorsStrings';
|
|
4
|
-
import { ILocalization } from './ILocalization';
|
|
1
|
+
import { observable, makeObservable, action } from 'mobx';
|
|
2
|
+
import { ILocalization, ILocalizationDependency } from './abstractions';
|
|
5
3
|
|
|
6
|
-
export { ILocalization
|
|
7
|
-
|
|
8
|
-
export default class LocalizationManager<TLocaleType extends string, TStrings extends StringsShape> implements ILocalization<TStrings> {
|
|
4
|
+
export class LocalizationManager<TLocaleType extends string, TStrings extends { }> implements ILocalization<TStrings> {
|
|
9
5
|
@observable
|
|
10
6
|
private _currentLocale: TLocaleType = null;
|
|
11
7
|
|
|
12
|
-
@observable
|
|
8
|
+
@observable.ref
|
|
13
9
|
private _currentStrings: TStrings = null;
|
|
14
10
|
|
|
15
|
-
@observable
|
|
16
|
-
private _validationErrors: ValidationErrorsStrings = null;
|
|
17
|
-
|
|
18
11
|
private readonly _defaultStrings: TStrings = null;
|
|
12
|
+
private readonly _dependants: ILocalizationDependency<TStrings, TLocaleType>[] = [];
|
|
19
13
|
|
|
20
14
|
constructor(
|
|
21
15
|
private readonly _dataSource: { [locale: string]: TStrings },
|
|
@@ -24,21 +18,28 @@ export default class LocalizationManager<TLocaleType extends string, TStrings ex
|
|
|
24
18
|
) {
|
|
25
19
|
makeObservable(this);
|
|
26
20
|
this._defaultStrings = this.getStrings(defaultLocale || initialLocale);
|
|
27
|
-
this.
|
|
21
|
+
this.useLocale(initialLocale);
|
|
28
22
|
}
|
|
29
23
|
|
|
30
|
-
get Locale() { return this._currentLocale; }
|
|
31
|
-
|
|
32
|
-
get Current() { return this._currentStrings; }
|
|
24
|
+
public get Locale() { return this._currentLocale; }
|
|
25
|
+
public get Current() { return this._currentStrings; }
|
|
33
26
|
|
|
34
|
-
|
|
27
|
+
@action
|
|
28
|
+
public useLocale(locale: TLocaleType) {
|
|
29
|
+
this._currentLocale = locale;
|
|
30
|
+
this._currentStrings = this.getStrings(this._currentLocale) || this._defaultStrings;
|
|
31
|
+
this._dependants.forEach(d => d.updateLocale(this._currentStrings, this._currentLocale));
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this.
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
public useDependency(dep: ILocalizationDependency<TStrings, TLocaleType>, remove = false) {
|
|
36
|
+
const i = this._dependants.indexOf(dep);
|
|
37
|
+
if (i >= 0 && !remove) {
|
|
38
|
+
this._dependants.push(dep);
|
|
39
|
+
} else if (i < 0 && remove) {
|
|
40
|
+
this._dependants.splice(i, 1);
|
|
41
|
+
}
|
|
42
|
+
return this;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
private getStrings(locale: string): TStrings {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
export interface ILocalization<TStrings extends { }> {
|
|
3
|
+
readonly Current: Readonly<TStrings>;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface IErrorsLocalization<TErrors extends string | number> {
|
|
7
|
+
readonly Errors: ValidationErrorsStrings<TErrors>
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ILocalizationDependency<TStrings extends { }, TLocale extends string = any> {
|
|
11
|
+
updateLocale(strings: TStrings, locale?: TLocale): void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type ValidationErrorsStrings<T extends string | number> = Partial<Record<T, string>>;
|
|
15
|
+
|
|
16
|
+
export type ValidationErrorsFactory<TStrings extends { }, TErrors extends string | number> = (strings: TStrings) => ValidationErrorsStrings<TErrors>;
|
package/src/throttledEvent.ts
CHANGED
|
@@ -14,7 +14,7 @@ export class ThrottledEvent extends Event {
|
|
|
14
14
|
this._throttle.tryRun(() => super.trigger());
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
public async triggerAsync() {
|
|
17
|
+
public async triggerAsync(): Promise<Error[]> {
|
|
18
18
|
throw new Error('ThrottledEvent does not support triggerAsync');
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { StringsShape } from '
|
|
1
|
+
import { ValidationErrorsStrings } from '../services/localization';
|
|
2
|
+
import { StringsShape } from '../services/localization/defaultShape';
|
|
3
|
+
import { LocalaziedValidationErrors } from '../services/localization/LocalaziedValidationErrors';
|
|
4
|
+
import { ValidationErrors } from './ValidationErrors';
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export default function Create(strings: StringsShape): ValidationErrorsStrings {
|
|
6
|
+
function locationFactory(strings: StringsShape): ValidationErrorsStrings<ValidationErrors> {
|
|
7
7
|
return {
|
|
8
8
|
[ValidationErrors.None]: '',
|
|
9
9
|
[ValidationErrors.ShouldBeNonEmpty]: strings.Validation.Empty,
|
|
@@ -23,3 +23,5 @@ export default function Create(strings: StringsShape): ValidationErrorsStrings {
|
|
|
23
23
|
[ValidationErrors.Linkedin]: strings.Validation.Linkedin,
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
export const ValidationErrorsLocalized = new LocalaziedValidationErrors<StringsShape, ValidationErrors>(locationFactory);
|