@thecb/components 7.11.0-beta.4 → 7.11.0-beta.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/dist/index.cjs.js
CHANGED
|
@@ -46578,17 +46578,19 @@ var PartialAmountForm = function PartialAmountForm(_ref) {
|
|
|
46578
46578
|
var createPartialAmountFormState = function createPartialAmountFormState(lineItems, maximum) {
|
|
46579
46579
|
var minimum = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
46580
46580
|
var blockPartialPaymentOverpay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
46581
|
-
var formConfig = lineItems.reduce(function (acc, item) {
|
|
46582
|
-
console.log("maximum is", maximum);
|
|
46583
|
-
console.log("item amount is", item.amount);
|
|
46584
|
-
console.log("block payment overpay", blockPartialPaymentOverpay);
|
|
46585
|
-
var paymentMax = maximum;
|
|
46586
46581
|
|
|
46582
|
+
var getPaymentMax = function getPaymentMax(maximum, itemAmount) {
|
|
46587
46583
|
if (blockPartialPaymentOverpay) {
|
|
46588
|
-
|
|
46584
|
+
return !maximum || itemAmount < maximum ? itemAmount : maximum;
|
|
46589
46585
|
}
|
|
46590
46586
|
|
|
46591
|
-
|
|
46587
|
+
return maximum;
|
|
46588
|
+
};
|
|
46589
|
+
|
|
46590
|
+
var formConfig = lineItems.reduce(function (acc, item) {
|
|
46591
|
+
console.log("maximum is", maximum);
|
|
46592
|
+
console.log("item amount is", item.amount);
|
|
46593
|
+
console.log("block payment overpay", blockPartialPaymentOverpay);
|
|
46592
46594
|
var validators = [required(), validateSum(numberGreaterThanOrEqualTo(minimum), lineItems.filter(function (lineItem) {
|
|
46593
46595
|
return lineItem != item;
|
|
46594
46596
|
}).reduce(function (acc, curr) {
|
|
@@ -46596,7 +46598,7 @@ var createPartialAmountFormState = function createPartialAmountFormState(lineIte
|
|
|
46596
46598
|
}, []))];
|
|
46597
46599
|
|
|
46598
46600
|
if (!!maximum || blockPartialPaymentOverpay) {
|
|
46599
|
-
validators.push(validateSum(numberLessThanOrEqualTo(
|
|
46601
|
+
validators.push(validateSum(numberLessThanOrEqualTo(getPaymentMax(maximum, item.amount)), lineItems.filter(function (lineItem) {
|
|
46600
46602
|
return lineItem != item;
|
|
46601
46603
|
}).reduce(function (acc, curr) {
|
|
46602
46604
|
return [].concat(_toConsumableArray(acc), [curr.id]);
|