@unimaze/billing 0.21.4 → 0.21.6
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/attachments/AttachmentModal.js +5 -2
- package/lib/common/components/billing-lines/NewNewBillingLines.d.ts +1 -1
- package/lib/common/components/billing-lines/SingleBillingLine.js +8 -0
- package/lib/common/components/invoice-preview/index.js +2 -1
- package/lib/common/components/supplier/index.js +1 -1
- package/lib/utils/IntlUtility.d.ts +1 -0
- package/lib/utils/IntlUtility.js +33 -10
- package/package.json +1 -1
|
@@ -115,7 +115,7 @@ var AttachmentModal = function (props) {
|
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
117
|
React.useEffect(function () {
|
|
118
|
-
var _isSaveAttachmentsDisabled = props.attachments.some(function (attachment) { return attachment.fieldValidation !== "success" || !attachment.description; });
|
|
118
|
+
var _isSaveAttachmentsDisabled = props.attachments.length > 0 ? props.attachments.some(function (attachment) { return attachment.fieldValidation !== "success" || !attachment.description; }) : true;
|
|
119
119
|
setIsSaveAttachmentsDisabled(_isSaveAttachmentsDisabled);
|
|
120
120
|
}, [props.attachments]);
|
|
121
121
|
var verifyAttachment = function (info, uploadSizeLimit, formInstance) {
|
|
@@ -191,7 +191,10 @@ var AttachmentModal = function (props) {
|
|
|
191
191
|
React.createElement(antd_1.Typography.Text, { type: attachment.file.status === "error" ? "danger" : undefined, style: { width: "100%" } }, attachment.file.name),
|
|
192
192
|
React.createElement(lib_1.Form.Item, { name: ["attachments", "file".concat(index + 1), "file"], initialValue: attachment.file, hidden: true }),
|
|
193
193
|
attachment.file.status === "uploading" ? (React.createElement(icons_1.LoadingOutlined, null)) : (React.createElement(antd_1.Typography.Text, { type: attachment.file.status === "error" ? "danger" : undefined },
|
|
194
|
-
React.createElement(icons_1.DeleteOutlined, { onClick: function () {
|
|
194
|
+
React.createElement(icons_1.DeleteOutlined, { onClick: function () {
|
|
195
|
+
props.formInstance.setFieldValue(["attachments", "file".concat(index + 1), "description"], "");
|
|
196
|
+
props.onRemove(attachment.file);
|
|
197
|
+
} })))),
|
|
195
198
|
attachment.fieldValidation === "success" && (React.createElement(lib_1.Form.Item, __assign({}, formLayout_1.fullWidthInput, { rules: [
|
|
196
199
|
{
|
|
197
200
|
required: true,
|
|
@@ -8,7 +8,7 @@ interface Props extends WrappedComponentProps {
|
|
|
8
8
|
outsideVatScope: boolean;
|
|
9
9
|
}
|
|
10
10
|
declare const BillingLinesWithIntl: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
|
|
11
|
-
forwardedRef?: React.Ref<any
|
|
11
|
+
forwardedRef?: React.Ref<any> | undefined;
|
|
12
12
|
} & React.RefAttributes<any>> & {
|
|
13
13
|
WrappedComponent: React.ComponentType<Props>;
|
|
14
14
|
};
|
|
@@ -107,6 +107,14 @@ var SingleBillingLine = function (props) {
|
|
|
107
107
|
var _h = (0, react_1.useState)(false), isEditing = _h[0], setIsEditing = _h[1];
|
|
108
108
|
var invoiceLines = (0, Form_1.useWatch)(["invoice", "invoiceLines"], props.formInstance);
|
|
109
109
|
var width = (0, react_use_1.useWindowSize)().width;
|
|
110
|
+
(0, react_1.useEffect)(function () {
|
|
111
|
+
if (props.outsideVatScope) {
|
|
112
|
+
setTaxCatType(enums_1.AvailableTaxCategoryTypeEnum.OutsideTaxScope);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
setTaxCatType(enums_1.AvailableTaxCategoryTypeEnum.StandardRated);
|
|
116
|
+
}
|
|
117
|
+
}, [props.outsideVatScope]);
|
|
110
118
|
(0, react_1.useEffect)(function () {
|
|
111
119
|
if (width < 768) {
|
|
112
120
|
setIsMobile(true);
|
|
@@ -356,7 +356,8 @@ var InvoicePreview = function (props) {
|
|
|
356
356
|
react_1.default.createElement(antd_1.Typography.Text, { type: "secondary" }, getPaymentMeansValue(props.form.getFieldValue(["invoice", "paymentMeans", "type"]))),
|
|
357
357
|
props.form.getFieldValue(["invoice", "paymentMeans", "domesticTransfer"]) && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
358
358
|
react_1.default.createElement(antd_1.Typography.Text, { type: "secondary" },
|
|
359
|
-
|
|
359
|
+
props.intl.formatMessage(payment_method_1.translationMessages.paymentMethod_labels_domesticTransfer_accountNo),
|
|
360
|
+
":",
|
|
360
361
|
" ",
|
|
361
362
|
props.form.getFieldValue([
|
|
362
363
|
"invoice",
|
|
@@ -252,7 +252,7 @@ var Supplier = function (props) {
|
|
|
252
252
|
required: true,
|
|
253
253
|
message: props.intl.formatMessage(form_item_2.translationMessages.formItem_required_errorMessage),
|
|
254
254
|
},
|
|
255
|
-
], normalize: formatIdentifierInput, validateTrigger: ["onBlur"] },
|
|
255
|
+
], normalize: formatIdentifierInput, validateTrigger: ["onBlur", "onChange"] },
|
|
256
256
|
React.createElement(__1.UmzInput, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["supplier.identifier"], defaultPlaceholder: props.intl.formatMessage(exports.translationMessages.supplier_identifier), defaultIsRequired: true, disabled: isLoadingParticipantInfo, onChange: function (value) {
|
|
257
257
|
return debouncerSearch(props.rapiBaseUrl, props.rapiApiKey, value.target.value);
|
|
258
258
|
} })),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IntlShape } from "react-intl";
|
|
2
2
|
import { FormatNumberOptions } from "react-intl/src/types";
|
|
3
3
|
declare const icelandicNumberLocaleWorkaroundChrome: (value: number, intl: IntlShape, options?: FormatNumberOptions) => string;
|
|
4
|
+
export declare const convertToIcelandicThousandAndDecimalSeparator: (value: string, minimumFractionDigits?: number, maximumFractionDigits?: number) => string;
|
|
4
5
|
declare const returnDecimalSeparatorForLocale: (locale: string | null) => string | undefined;
|
|
5
6
|
export { icelandicNumberLocaleWorkaroundChrome, returnDecimalSeparatorForLocale };
|
package/lib/utils/IntlUtility.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.returnDecimalSeparatorForLocale = exports.icelandicNumberLocaleWorkaroundChrome = void 0;
|
|
3
|
+
exports.returnDecimalSeparatorForLocale = exports.icelandicNumberLocaleWorkaroundChrome = exports.convertToIcelandicThousandAndDecimalSeparator = void 0;
|
|
4
4
|
var icelandicNumberLocaleWorkaroundChrome = function (value, intl, options) {
|
|
5
5
|
var locale = localStorage.getItem("languageString");
|
|
6
|
+
var cleanedValue = value === null || value === undefined ? 0 : value;
|
|
6
7
|
if (locale) {
|
|
7
8
|
var supportedLocalesArray = Intl.NumberFormat.supportedLocalesOf(locale);
|
|
8
9
|
if (supportedLocalesArray.every(function (x) { return x !== locale; })) {
|
|
@@ -11,39 +12,61 @@ var icelandicNumberLocaleWorkaroundChrome = function (value, intl, options) {
|
|
|
11
12
|
if (options) {
|
|
12
13
|
switch (options.style) {
|
|
13
14
|
case "decimal": {
|
|
14
|
-
|
|
15
|
+
var decimalPart = options.maximumFractionDigits ? options.maximumFractionDigits : options.minimumFractionDigits ? options.minimumFractionDigits : 2;
|
|
16
|
+
return (0, exports.convertToIcelandicThousandAndDecimalSeparator)(Number(cleanedValue).toFixed(decimalPart), options.minimumFractionDigits, options.maximumFractionDigits);
|
|
15
17
|
}
|
|
16
18
|
case "currency": {
|
|
17
19
|
if (!options.currency) {
|
|
18
20
|
throw new Error("options.currency must be specified if options.style = 'currency'");
|
|
19
21
|
}
|
|
20
|
-
var roundedValue = convertToIcelandicThousandAndDecimalSeparator(Math.round(value).toString());
|
|
22
|
+
var roundedValue = (0, exports.convertToIcelandicThousandAndDecimalSeparator)(Math.round(value).toString());
|
|
21
23
|
var suffix = " ".concat(options.currency);
|
|
22
24
|
return roundedValue + suffix;
|
|
23
25
|
}
|
|
24
26
|
case "percent": {
|
|
25
|
-
var roundedValue = convertToIcelandicThousandAndDecimalSeparator(
|
|
27
|
+
var roundedValue = (0, exports.convertToIcelandicThousandAndDecimalSeparator)(cleanedValue.toString());
|
|
26
28
|
var suffix = " %";
|
|
27
29
|
return roundedValue + suffix;
|
|
28
30
|
}
|
|
29
31
|
case "unit": {
|
|
30
|
-
return convertToIcelandicThousandAndDecimalSeparator(value.toString());
|
|
32
|
+
return (0, exports.convertToIcelandicThousandAndDecimalSeparator)(value.toString());
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
|
-
return convertToIcelandicThousandAndDecimalSeparator(value.toString());
|
|
36
|
+
return (0, exports.convertToIcelandicThousandAndDecimalSeparator)(value.toString());
|
|
35
37
|
default:
|
|
36
|
-
return intl.formatNumber(
|
|
38
|
+
return intl.formatNumber(cleanedValue, options);
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
|
-
return intl.formatNumber(
|
|
42
|
+
return intl.formatNumber(cleanedValue, options);
|
|
41
43
|
};
|
|
42
44
|
exports.icelandicNumberLocaleWorkaroundChrome = icelandicNumberLocaleWorkaroundChrome;
|
|
43
|
-
var convertToIcelandicThousandAndDecimalSeparator = function (value) {
|
|
45
|
+
var convertToIcelandicThousandAndDecimalSeparator = function (value, minimumFractionDigits, maximumFractionDigits) {
|
|
46
|
+
var _a;
|
|
44
47
|
var parts = value.split(".");
|
|
45
|
-
|
|
48
|
+
if (parts.length === 1)
|
|
49
|
+
return parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
|
50
|
+
if (maximumFractionDigits === 0) {
|
|
51
|
+
return parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
|
52
|
+
}
|
|
53
|
+
var decimalPart = parts[1];
|
|
54
|
+
if (minimumFractionDigits) {
|
|
55
|
+
if ((decimalPart === null || decimalPart === void 0 ? void 0 : decimalPart.length) < minimumFractionDigits) {
|
|
56
|
+
var minimumFractionDigitsDifference = minimumFractionDigits - ((_a = parts[1]) === null || _a === void 0 ? void 0 : _a.length);
|
|
57
|
+
for (var i = 0; i < minimumFractionDigitsDifference; i++) {
|
|
58
|
+
decimalPart += "0";
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (maximumFractionDigits) {
|
|
63
|
+
if ((decimalPart === null || decimalPart === void 0 ? void 0 : decimalPart.length) > maximumFractionDigits) {
|
|
64
|
+
decimalPart = decimalPart.substring(0, maximumFractionDigits);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".") + ",".concat(decimalPart);
|
|
46
68
|
};
|
|
69
|
+
exports.convertToIcelandicThousandAndDecimalSeparator = convertToIcelandicThousandAndDecimalSeparator;
|
|
47
70
|
var returnDecimalSeparatorForLocale = function (locale) {
|
|
48
71
|
switch (locale) {
|
|
49
72
|
case "is":
|