@thecb/components 8.4.12-beta.2 → 8.4.13-beta.1
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 +1575 -435
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1576 -435
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/molecules/partial-amount-form/PartialAmountForm.state.js +22 -40
- package/src/components/molecules/partial-amount-form/index.js +2 -9
- package/src/components/molecules/payment-details/PaymentDetails.js +36 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thecb/components",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.13-beta.1",
|
|
4
4
|
"description": "Common lib for CityBase react components",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -90,6 +90,6 @@
|
|
|
90
90
|
"ramda": "^0.27.0",
|
|
91
91
|
"react-aria-modal": "^4.0.0",
|
|
92
92
|
"react-pose": "^4.0.10",
|
|
93
|
-
"redux-freeform": "^5.
|
|
93
|
+
"redux-freeform": "^5.6.0"
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -14,13 +14,28 @@ export const createPartialAmountFormState = (
|
|
|
14
14
|
blockPartialPaymentOverpay = false
|
|
15
15
|
) => {
|
|
16
16
|
const formConfig = lineItems.reduce((acc, item) => {
|
|
17
|
-
const validators =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
const validators = [
|
|
18
|
+
required(),
|
|
19
|
+
validateSum(
|
|
20
|
+
numberGreaterThanOrEqualTo(minimum),
|
|
21
|
+
lineItems
|
|
22
|
+
.filter(lineItem => lineItem != item)
|
|
23
|
+
.reduce((acc, curr) => [...acc, curr.id], [])
|
|
24
|
+
)
|
|
25
|
+
];
|
|
26
|
+
if (!!maximum) {
|
|
27
|
+
validators.push(
|
|
28
|
+
validateSum(
|
|
29
|
+
numberLessThanOrEqualTo(maximum),
|
|
30
|
+
lineItems
|
|
31
|
+
.filter(lineItem => lineItem != item)
|
|
32
|
+
.reduce((acc, curr) => [...acc, curr.id], [])
|
|
33
|
+
)
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
if (blockPartialPaymentOverpay) {
|
|
37
|
+
validators.push(numberLessThanOrEqualTo(item.amount));
|
|
38
|
+
}
|
|
24
39
|
return {
|
|
25
40
|
...acc,
|
|
26
41
|
[item.id]: {
|
|
@@ -39,36 +54,3 @@ export const createPartialAmountFormState = (
|
|
|
39
54
|
partialAmountFormMapDispatchToProps: mapDispatchToProps
|
|
40
55
|
};
|
|
41
56
|
};
|
|
42
|
-
|
|
43
|
-
export const createPartialAmountFormValidators = (
|
|
44
|
-
item,
|
|
45
|
-
lineItems,
|
|
46
|
-
maximum,
|
|
47
|
-
minimum = 1,
|
|
48
|
-
blockPartialPaymentOverpay = false
|
|
49
|
-
) => {
|
|
50
|
-
const validators = [
|
|
51
|
-
required(),
|
|
52
|
-
validateSum(
|
|
53
|
-
numberGreaterThanOrEqualTo(minimum),
|
|
54
|
-
lineItems
|
|
55
|
-
.filter(lineItem => lineItem != item)
|
|
56
|
-
.reduce((acc, curr) => [...acc, curr.id], [])
|
|
57
|
-
)
|
|
58
|
-
];
|
|
59
|
-
if (!!maximum) {
|
|
60
|
-
validators.push(
|
|
61
|
-
validateSum(
|
|
62
|
-
numberLessThanOrEqualTo(maximum),
|
|
63
|
-
lineItems
|
|
64
|
-
.filter(lineItem => lineItem != item)
|
|
65
|
-
.reduce((acc, curr) => [...acc, curr.id], [])
|
|
66
|
-
)
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
if (blockPartialPaymentOverpay) {
|
|
70
|
-
validators.push(numberLessThanOrEqualTo(item.amount));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return validators;
|
|
74
|
-
};
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import PartialAmountForm from "./PartialAmountForm";
|
|
2
|
-
import {
|
|
3
|
-
createPartialAmountFormState,
|
|
4
|
-
createPartialAmountFormValidators
|
|
5
|
-
} from "./PartialAmountForm.state";
|
|
2
|
+
import { createPartialAmountFormState } from "./PartialAmountForm.state";
|
|
6
3
|
|
|
7
|
-
export {
|
|
8
|
-
PartialAmountForm,
|
|
9
|
-
createPartialAmountFormState,
|
|
10
|
-
createPartialAmountFormValidators
|
|
11
|
-
};
|
|
4
|
+
export { PartialAmountForm, createPartialAmountFormState };
|
|
@@ -13,6 +13,7 @@ import { displayCurrency } from "../../../util/general";
|
|
|
13
13
|
import { themeComponent } from "../../../util/themeUtils";
|
|
14
14
|
import CollapsibleSection from "../collapsible-section";
|
|
15
15
|
|
|
16
|
+
import LoadingLine from "../../atoms/loading-line";
|
|
16
17
|
import LabeledAmount from "../../atoms/labeled-amount";
|
|
17
18
|
import LineItem from "../../atoms/line-item";
|
|
18
19
|
import Title from "../../atoms/title";
|
|
@@ -120,22 +121,41 @@ const PaymentDetailsContent = ({
|
|
|
120
121
|
);
|
|
121
122
|
|
|
122
123
|
const LoadingDetails = () => (
|
|
123
|
-
<Box
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
124
|
+
<Box padding="0" minHeight="196px">
|
|
125
|
+
<Box
|
|
126
|
+
padding="0"
|
|
127
|
+
extraStyles={`position: absolute;
|
|
128
|
+
height: 238px;
|
|
129
|
+
width: 100%;
|
|
130
|
+
display: flex;
|
|
131
|
+
justify-content: center;
|
|
132
|
+
align-items: center;`}
|
|
133
|
+
>
|
|
134
|
+
<Spinner size="100" centerSpinner />
|
|
135
|
+
</Box>
|
|
136
|
+
<Stack childGap="16px">
|
|
137
|
+
<Cluster nowrap justify="space-between" align="start">
|
|
138
|
+
<LoadingLine exactWidth="110px" height="27px" />
|
|
139
|
+
<LoadingLine exactWidth="60px" height="27px" />
|
|
140
|
+
</Cluster>
|
|
141
|
+
<SolidDivider />
|
|
142
|
+
<Box padding="0.5rem 0">
|
|
143
|
+
<Stack direction="row">
|
|
144
|
+
<LoadingLine exactWidth="80px" height="27px" />
|
|
145
|
+
<LoadingLine exactWidth="60px" height="27px" />
|
|
146
|
+
</Stack>
|
|
147
|
+
<Box padding="4px 0" />
|
|
148
|
+
<Stack direction="row">
|
|
149
|
+
<LoadingLine exactWidth="160px" height="27px" />
|
|
150
|
+
<LoadingLine exactWidth="50px" height="27px" />
|
|
151
|
+
</Stack>
|
|
152
|
+
</Box>
|
|
153
|
+
<SolidDivider />
|
|
154
|
+
<Stack direction="row">
|
|
155
|
+
<LoadingLine exactWidth="100px" height="30px" />
|
|
156
|
+
<LoadingLine exactWidth="70px" height="30px" />
|
|
157
|
+
</Stack>
|
|
158
|
+
</Stack>
|
|
139
159
|
</Box>
|
|
140
160
|
);
|
|
141
161
|
|