@thecb/components 7.11.0-beta.1 → 7.11.0-beta.2
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/index.cjs.js
CHANGED
|
@@ -46508,6 +46508,7 @@ var PartialAmountForm = function PartialAmountForm(_ref) {
|
|
|
46508
46508
|
maximum = _ref.maximum,
|
|
46509
46509
|
_ref$minimum = _ref.minimum,
|
|
46510
46510
|
minimum = _ref$minimum === void 0 ? 1 : _ref$minimum,
|
|
46511
|
+
blockPartialPaymentOverpay = _ref.blockPartialPaymentOverpay,
|
|
46511
46512
|
clearOnDismount = _ref.clearOnDismount,
|
|
46512
46513
|
fields = _ref.fields,
|
|
46513
46514
|
actions = _ref.actions,
|
|
@@ -46523,6 +46524,19 @@ var PartialAmountForm = function PartialAmountForm(_ref) {
|
|
|
46523
46524
|
}
|
|
46524
46525
|
|
|
46525
46526
|
var amountErrors = (_amountErrors = {}, _defineProperty(_amountErrors, required.error, "Amount is required"), _defineProperty(_amountErrors, numberGreaterThanOrEqualTo.error, "There is a minimum payment of ".concat(displayCurrency(minimum))), _defineProperty(_amountErrors, numberLessThanOrEqualTo.error, "There is a maximum payment of ".concat(displayCurrency(maximum))), _amountErrors);
|
|
46527
|
+
|
|
46528
|
+
var getPartialAmountFormErrors = function getPartialAmountFormErrors(maximum, itemAmount) {
|
|
46529
|
+
var errorMessages = amountErrors;
|
|
46530
|
+
|
|
46531
|
+
if (blockPartialPaymentOverpay) {
|
|
46532
|
+
var maxAmount = !maximum || itemAmount < maximum ? itemAmount : maximum;
|
|
46533
|
+
var maxAmountError = "There is a maximum payment of ".concat(displayCurrency(maxAmount));
|
|
46534
|
+
errorMessages[numberLessThanOrEqualTo.error] = maxAmountError;
|
|
46535
|
+
}
|
|
46536
|
+
|
|
46537
|
+
return errorMessages;
|
|
46538
|
+
};
|
|
46539
|
+
|
|
46526
46540
|
var lineItemsNew = Array.isArray(lineItems) ? lineItems : [];
|
|
46527
46541
|
return /*#__PURE__*/React__default.createElement(FormContainer$1, {
|
|
46528
46542
|
variant: variant,
|
|
@@ -46541,7 +46555,7 @@ var PartialAmountForm = function PartialAmountForm(_ref) {
|
|
|
46541
46555
|
field: fields[li.id],
|
|
46542
46556
|
fieldActions: actions.fields[li.id],
|
|
46543
46557
|
showErrors: showErrors,
|
|
46544
|
-
errorMessages:
|
|
46558
|
+
errorMessages: getPartialAmountFormErrors(maximum, li.amount),
|
|
46545
46559
|
style: {
|
|
46546
46560
|
textAlign: "right"
|
|
46547
46561
|
},
|