@unimaze/billing 0.21.26 → 0.21.27
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/lib/common/components/CommonTranslations.d.ts +4 -0
- package/lib/common/components/CommonTranslations.js +4 -0
- package/lib/common/components/base-information/ProjectReference.js +1 -1
- package/lib/common/components/form-item/index.js +5 -1
- package/lib/common/consts/validationRules.d.ts +3 -0
- package/lib/common/consts/validationRules.js +17 -1
- package/lib/translations/locales/en.json +1 -0
- package/lib/translations/locales/is.json +1 -0
- package/lib/translations/locales.d.ts +2 -0
- package/package.json +1 -1
|
@@ -75,4 +75,8 @@ exports.commonTranslationMessages = (0, react_intl_1.defineMessages)({
|
|
|
75
75
|
id: "missingRequiredData",
|
|
76
76
|
defaultMessage: "Missing required data:",
|
|
77
77
|
},
|
|
78
|
+
noWhitespaceValidation_message: {
|
|
79
|
+
id: "noWhitespaceValidation_message",
|
|
80
|
+
defaultMessage: "This field cannot be empty or just spaces",
|
|
81
|
+
}
|
|
78
82
|
});
|
|
@@ -12,7 +12,7 @@ var __1 = require("..");
|
|
|
12
12
|
var translationMessages = (0, react_intl_1.defineMessages)({
|
|
13
13
|
baseInformation_projectReferenceLabel: {
|
|
14
14
|
id: "baseInformation_projectReferenceLabel",
|
|
15
|
-
defaultMessage: "Project reference",
|
|
15
|
+
defaultMessage: "Project reference", // duplicated translate
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
18
|
var ProjectReference = function (props) {
|
|
@@ -40,6 +40,7 @@ var antd_1 = require("antd");
|
|
|
40
40
|
var RequirementsUtility_1 = require("../../../utils/RequirementsUtility");
|
|
41
41
|
var react_intl_1 = require("react-intl");
|
|
42
42
|
var formLayout_1 = require("../../consts/formLayout");
|
|
43
|
+
var validationRules_1 = require("../../consts/validationRules");
|
|
43
44
|
exports.translationMessages = (0, react_intl_1.defineMessages)({
|
|
44
45
|
formItem_required_errorMessage: {
|
|
45
46
|
id: "formItem_required_errorMessage",
|
|
@@ -53,7 +54,10 @@ var UmzFormItem = function (props) {
|
|
|
53
54
|
{
|
|
54
55
|
required: isRequired,
|
|
55
56
|
message: intl.formatMessage(exports.translationMessages.formItem_required_errorMessage),
|
|
56
|
-
}
|
|
57
|
+
},
|
|
58
|
+
isRequired ? {
|
|
59
|
+
validator: (0, validationRules_1.noWhitespaceValidator)(props.intl)
|
|
60
|
+
} : null
|
|
57
61
|
], (additionalRules || []) // if the array is undefined
|
|
58
62
|
, true), style: style, initialValue: initialValue }, rest), children));
|
|
59
63
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { BillingLineMetadataOverride } from "../types/BillingLineMetadataOverride";
|
|
2
2
|
import { RuleObject } from "rc-field-form/lib/interface";
|
|
3
|
+
import { StoreValue } from 'antd/es/form/interface';
|
|
4
|
+
import { IntlShape } from "react-intl";
|
|
5
|
+
export declare const noWhitespaceValidator: (intl: IntlShape) => (_: RuleObject, value: StoreValue) => Promise<void>;
|
|
3
6
|
export type ValidationRulesObject = {
|
|
4
7
|
[key in keyof Omit<BillingLineMetadataOverride, 'key'>]: RuleObject[];
|
|
5
8
|
};
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validationRules = void 0;
|
|
3
|
+
exports.validationRules = exports.noWhitespaceValidator = void 0;
|
|
4
|
+
var CommonTranslations_1 = require("../components/CommonTranslations");
|
|
5
|
+
var noWhitespaceValidator = function (intl) {
|
|
6
|
+
return function (_, value) {
|
|
7
|
+
if (!value) {
|
|
8
|
+
return Promise.resolve();
|
|
9
|
+
}
|
|
10
|
+
if (typeof value !== 'string') {
|
|
11
|
+
return Promise.resolve();
|
|
12
|
+
}
|
|
13
|
+
else if (value.trim() === '') {
|
|
14
|
+
return Promise.reject(new Error(intl.formatMessage(CommonTranslations_1.commonTranslationMessages.noWhitespaceValidation_message)));
|
|
15
|
+
}
|
|
16
|
+
return Promise.resolve();
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
exports.noWhitespaceValidator = noWhitespaceValidator;
|
|
4
20
|
exports.validationRules = {
|
|
5
21
|
itemNo: [
|
|
6
22
|
{
|
|
@@ -124,6 +124,7 @@
|
|
|
124
124
|
"invoicePreview_lineDiscount": "line discount",
|
|
125
125
|
"invoicePreview_paymentInfoTitle": "Payment information",
|
|
126
126
|
"missingRequiredData": "Missing required data:",
|
|
127
|
+
"noWhitespaceValidation_message": "This field cannot be empty or just spaces",
|
|
127
128
|
"paymentMethod_label": "Account number",
|
|
128
129
|
"paymentMethod_labels_domesticTransfer_accountNo": "Account no",
|
|
129
130
|
"paymentMethod_labels_domesticTransfer_accountType": "Account type",
|
|
@@ -124,6 +124,7 @@
|
|
|
124
124
|
"invoicePreview_lineDiscount": "line discount",
|
|
125
125
|
"invoicePreview_paymentInfoTitle": "Payment information",
|
|
126
126
|
"missingRequiredData": "Vantar skilyrt gögn:",
|
|
127
|
+
"noWhitespaceValidation_message": "Þetta svæði má ekki innihalda eingöngu stafbil",
|
|
127
128
|
"paymentMethod_label": "Reikningsnúmer",
|
|
128
129
|
"paymentMethod_labels_domesticTransfer_accountNo": "Reikningsnúmer",
|
|
129
130
|
"paymentMethod_labels_domesticTransfer_accountType": "Hb",
|
|
@@ -125,6 +125,7 @@ declare const _default: {
|
|
|
125
125
|
invoicePreview_lineDiscount: string;
|
|
126
126
|
invoicePreview_paymentInfoTitle: string;
|
|
127
127
|
missingRequiredData: string;
|
|
128
|
+
noWhitespaceValidation_message: string;
|
|
128
129
|
paymentMethod_label: string;
|
|
129
130
|
paymentMethod_labels_domesticTransfer_accountNo: string;
|
|
130
131
|
paymentMethod_labels_domesticTransfer_accountType: string;
|
|
@@ -313,6 +314,7 @@ declare const _default: {
|
|
|
313
314
|
invoicePreview_lineDiscount: string;
|
|
314
315
|
invoicePreview_paymentInfoTitle: string;
|
|
315
316
|
missingRequiredData: string;
|
|
317
|
+
noWhitespaceValidation_message: string;
|
|
316
318
|
paymentMethod_label: string;
|
|
317
319
|
paymentMethod_labels_domesticTransfer_accountNo: string;
|
|
318
320
|
paymentMethod_labels_domesticTransfer_accountType: string;
|