@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.esm.js
CHANGED
|
@@ -46500,6 +46500,7 @@ var PartialAmountForm = function PartialAmountForm(_ref) {
|
|
|
46500
46500
|
maximum = _ref.maximum,
|
|
46501
46501
|
_ref$minimum = _ref.minimum,
|
|
46502
46502
|
minimum = _ref$minimum === void 0 ? 1 : _ref$minimum,
|
|
46503
|
+
blockPartialPaymentOverpay = _ref.blockPartialPaymentOverpay,
|
|
46503
46504
|
clearOnDismount = _ref.clearOnDismount,
|
|
46504
46505
|
fields = _ref.fields,
|
|
46505
46506
|
actions = _ref.actions,
|
|
@@ -46515,6 +46516,19 @@ var PartialAmountForm = function PartialAmountForm(_ref) {
|
|
|
46515
46516
|
}
|
|
46516
46517
|
|
|
46517
46518
|
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);
|
|
46519
|
+
|
|
46520
|
+
var getPartialAmountFormErrors = function getPartialAmountFormErrors(maximum, itemAmount) {
|
|
46521
|
+
var errorMessages = amountErrors;
|
|
46522
|
+
|
|
46523
|
+
if (blockPartialPaymentOverpay) {
|
|
46524
|
+
var maxAmount = !maximum || itemAmount < maximum ? itemAmount : maximum;
|
|
46525
|
+
var maxAmountError = "There is a maximum payment of ".concat(displayCurrency(maxAmount));
|
|
46526
|
+
errorMessages[numberLessThanOrEqualTo.error] = maxAmountError;
|
|
46527
|
+
}
|
|
46528
|
+
|
|
46529
|
+
return errorMessages;
|
|
46530
|
+
};
|
|
46531
|
+
|
|
46518
46532
|
var lineItemsNew = Array.isArray(lineItems) ? lineItems : [];
|
|
46519
46533
|
return /*#__PURE__*/React.createElement(FormContainer$1, {
|
|
46520
46534
|
variant: variant,
|
|
@@ -46533,7 +46547,7 @@ var PartialAmountForm = function PartialAmountForm(_ref) {
|
|
|
46533
46547
|
field: fields[li.id],
|
|
46534
46548
|
fieldActions: actions.fields[li.id],
|
|
46535
46549
|
showErrors: showErrors,
|
|
46536
|
-
errorMessages:
|
|
46550
|
+
errorMessages: getPartialAmountFormErrors(maximum, li.amount),
|
|
46537
46551
|
style: {
|
|
46538
46552
|
textAlign: "right"
|
|
46539
46553
|
},
|