@unimaze/billing 0.21.26 → 0.21.28
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/attachments/Attachment.js +1 -0
- package/lib/common/components/attachments/AttachmentModal.js +6 -2
- 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
|
});
|
|
@@ -82,6 +82,7 @@ var translationMessages = (0, react_intl_1.defineMessages)({
|
|
|
82
82
|
defaultMessage: "File failed to upload",
|
|
83
83
|
},
|
|
84
84
|
});
|
|
85
|
+
// TODO consider removing this component (not used)
|
|
85
86
|
var Attachment = function (props) {
|
|
86
87
|
var fieldName = props.fieldName;
|
|
87
88
|
var handleRemoveFile = function () {
|
|
@@ -50,6 +50,7 @@ var icons_1 = require("@ant-design/icons");
|
|
|
50
50
|
var FileUploadUtility_1 = require("../../../utils/FileUploadUtility");
|
|
51
51
|
var lib_1 = require("antd/lib");
|
|
52
52
|
var formLayout_1 = require("../../consts/formLayout");
|
|
53
|
+
var validationRules_1 = require("../../consts/validationRules");
|
|
53
54
|
var translationMessages = (0, react_intl_1.defineMessages)({
|
|
54
55
|
attachment_title: {
|
|
55
56
|
id: "attachment_title",
|
|
@@ -115,7 +116,7 @@ var AttachmentModal = function (props) {
|
|
|
115
116
|
}
|
|
116
117
|
};
|
|
117
118
|
React.useEffect(function () {
|
|
118
|
-
var _isSaveAttachmentsDisabled = props.attachments.length > 0 ? props.attachments.some(function (attachment) { return attachment.fieldValidation !== "success" || !attachment.description; }) : true;
|
|
119
|
+
var _isSaveAttachmentsDisabled = props.attachments.length > 0 ? props.attachments.some(function (attachment) { return attachment.fieldValidation !== "success" || (!attachment.description.trim()); }) : true;
|
|
119
120
|
setIsSaveAttachmentsDisabled(_isSaveAttachmentsDisabled);
|
|
120
121
|
}, [props.attachments]);
|
|
121
122
|
var verifyAttachment = function (info, uploadSizeLimit, formInstance) {
|
|
@@ -184,7 +185,7 @@ var AttachmentModal = function (props) {
|
|
|
184
185
|
props.attachments.length > 0 && (React.createElement(antd_1.Flex, { vertical: true },
|
|
185
186
|
React.createElement(antd_1.Typography.Text, null, props.intl.formatMessage(translationMessages.attachment_title)),
|
|
186
187
|
React.createElement("hr", null),
|
|
187
|
-
props.attachments.map(function (attachment, index) { return (React.createElement(antd_1.Flex, { gap: "middle", vertical: true },
|
|
188
|
+
props.attachments.map(function (attachment, index) { return (React.createElement(antd_1.Flex, { gap: "middle", vertical: true, key: attachment.uid + index },
|
|
188
189
|
React.createElement(antd_1.Flex, { gap: "middle", justify: "space-between" },
|
|
189
190
|
React.createElement(antd_1.Typography.Text, { type: attachment.file.status === "error" ? "danger" : undefined },
|
|
190
191
|
React.createElement(icons_1.PaperClipOutlined, null)),
|
|
@@ -200,6 +201,9 @@ var AttachmentModal = function (props) {
|
|
|
200
201
|
required: true,
|
|
201
202
|
message: props.intl.formatMessage(translationMessages.attachment_labels_Description_requiredMessage),
|
|
202
203
|
},
|
|
204
|
+
{
|
|
205
|
+
validator: (0, validationRules_1.noWhitespaceValidator)(props.intl)
|
|
206
|
+
}
|
|
203
207
|
], name: ["attachments", "file".concat(index + 1), "description"] }),
|
|
204
208
|
React.createElement(antd_1.Input, { prefix: React.createElement(antd_1.Typography.Text, { type: "danger" }, "*"), placeholder: props.intl.formatMessage(translationMessages.attachment_labels_Description), onChange: function (e) { return updateFile(attachment.file, { description: e.target.value }); } }))))); })))));
|
|
205
209
|
};
|
|
@@ -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;
|