x25 3.0.0 → 17.0.0
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/Account/Load.js +75 -0
- package/Account/actions.js +15 -0
- package/Account/index.js +20 -0
- package/Account/reducer.js +122 -0
- package/Account/request.js +44 -0
- package/Async/InitModule.js +190 -0
- package/Async/RouteLoading.js +64 -0
- package/Async/SimulatedException.js +44 -0
- package/Async/index.js +95 -0
- package/Async/types.js +1 -0
- package/Company/Load.js +82 -0
- package/Company/actions.js +15 -0
- package/Company/index.js +20 -0
- package/Company/reducer.js +165 -0
- package/Company/request.js +36 -0
- package/Company/util.js +10 -0
- package/Header/AccountOptionsContainer.js +144 -0
- package/Header/AdminSelectCompany.js +109 -0
- package/Header/ClientSelectCompany.js +104 -0
- package/Header/Header.js +127 -0
- package/Header/HeaderContainer.js +39 -0
- package/Header/Logo.js +30 -0
- package/Header/LogoutButton.js +39 -0
- package/Header/index.js +19 -0
- package/Header/request.js +26 -0
- package/Header/types.js +1 -0
- package/Header/util.js +58 -0
- package/Inputs/Business/BankAccount.js +48 -0
- package/Inputs/Business/BankName.js +49 -0
- package/Inputs/Business/CifField.js +112 -0
- package/Inputs/Business/CifFieldContainer.js +157 -0
- package/Inputs/Business/Email.js +37 -0
- package/Inputs/Business/NidField.js +91 -0
- package/Inputs/Business/Phone.js +37 -0
- package/Inputs/Business/index.js +34 -0
- package/Inputs/Business/request.js +39 -0
- package/Inputs/CaptchaBox.js +151 -0
- package/Inputs/DateInput.js +172 -0
- package/Inputs/DateTemplate.js +200 -0
- package/Inputs/DelayInputChange.js +135 -0
- package/Inputs/FocusTemplate.js +47 -0
- package/Inputs/InputTemplate.js +78 -0
- package/Inputs/LabelTemplate.js +59 -0
- package/Inputs/NumericInput.js +139 -0
- package/Inputs/NumericTemplate.js +148 -0
- package/Inputs/Selects/County.js +29 -0
- package/Inputs/Selects/Custom.js +56 -0
- package/Inputs/Selects/Simple.js +75 -0
- package/Inputs/Selects/index.js +52 -0
- package/Inputs/SimpleInput.js +42 -0
- package/Inputs/SimpleTextarea.js +47 -0
- package/Inputs/TextareaTemplate.js +55 -0
- package/Inputs/Tooltip.js +82 -0
- package/Inputs/index.js +185 -0
- package/Messages/Error.js +106 -0
- package/Messages/Loading.js +68 -0
- package/Messages/index.js +29 -0
- package/Modal/Delete.js +240 -0
- package/Modal/Root.js +81 -0
- package/Modal/SimpleModal.js +57 -0
- package/Modal/actions.js +10 -0
- package/Modal/getComponent.js +42 -0
- package/Modal/index.js +22 -0
- package/Modal/reducer.js +53 -0
- package/Modal/types.js +7 -0
- package/Modal/util.js +17 -0
- package/Payment/EstimatePrice/Description.js +92 -0
- package/Payment/EstimatePrice/PayBox.js +220 -0
- package/Payment/EstimatePrice/index.js +92 -0
- package/Payment/EstimatePrice/util.js +21 -0
- package/Payment/MobilpayForm.js +86 -0
- package/Payment/Modal/BankTransfer.js +233 -0
- package/Payment/Modal/CompanyValability.js +28 -0
- package/Payment/Modal/DoneForm.js +222 -0
- package/Payment/Modal/PaymentDone.js +53 -0
- package/Payment/Modal/index.js +27 -0
- package/Payment/actions.js +23 -0
- package/{src/Payment → Payment}/codes.js +19 -16
- package/Payment/index.js +141 -0
- package/Payment/request.js +49 -0
- package/Payment/types.js +1 -0
- package/Payment/util.js +50 -0
- package/Payment/validate.js +23 -0
- package/Sidebar.js +156 -0
- package/Things.js +53 -0
- package/actions.js +73 -0
- package/config.js +10 -0
- package/dev/ErrorBoundary.js +109 -0
- package/dev/TheError.js +113 -0
- package/dev/index.js +132 -0
- package/dev/types.js +1 -0
- package/package.json +13 -13
- package/prod/SentryErrorBoundary.js +150 -0
- package/reducer/captchas.js +51 -0
- package/reducer/counties.js +57 -0
- package/reducer/index.js +38 -0
- package/reducer/module.js +48 -0
- package/style/index.css +1 -0
- package/style/sidebar.css +1 -0
- package/types.js +1 -0
- package/utility/calendar.js +45 -0
- package/utility/date.js +111 -0
- package/utility/index.js +125 -0
- package/utility/language.js +20 -0
- package/utility/mql.js +6 -0
- package/utility/normalize-test.js +54 -0
- package/utility/normalize.js +108 -0
- package/utility/numbers.js +93 -0
- package/utility/numeric.js +103 -0
- package/utility/others.js +142 -0
- package/utility/strings-test.js +216 -0
- package/utility/strings.js +85 -0
- package/utility/validation/common.js +278 -0
- package/utility/validation/index.js +110 -0
- package/utility/validation/specific.js +14 -0
- package/utility/validation/validate/bank-test.js +41 -0
- package/utility/validation/validate/bank.js +176 -0
- package/utility/validation/validate/cif-test.js +37 -0
- package/utility/validation/validate/cif.js +44 -0
- package/utility/validation/validate/cnp-test.js +68 -0
- package/utility/validation/validate/cnp.js +193 -0
- package/{src/utility → utility}/validation/validate/date.js +61 -73
- package/utility/validation/validate/email-test.js +30 -0
- package/utility/validation/validate/email.js +11 -0
- package/utility/validation/validate/index.js +65 -0
- package/.eslintignore +0 -2
- package/.eslintrc.json +0 -275
- package/.flowconfig +0 -23
- package/conf/dev.js +0 -19
- package/conf/dist.js +0 -19
- package/conf/polyfills/tempPolyfills.js +0 -7
- package/src/Account/Load.jsx +0 -79
- package/src/Account/actions.js +0 -10
- package/src/Account/index.js +0 -11
- package/src/Account/reducer.js +0 -139
- package/src/Account/request.js +0 -36
- package/src/Async/InitModule.jsx +0 -114
- package/src/Async/RouteLoading.jsx +0 -52
- package/src/Async/SimulatedException.jsx +0 -19
- package/src/Async/index.jsx +0 -75
- package/src/Async/types.js +0 -39
- package/src/Company/Load.jsx +0 -84
- package/src/Company/actions.js +0 -10
- package/src/Company/index.js +0 -11
- package/src/Company/reducer.js +0 -201
- package/src/Company/request.js +0 -30
- package/src/Company/util.js +0 -7
- package/src/Header/AccountOptionsContainer.jsx +0 -124
- package/src/Header/AdminSelectCompany.jsx +0 -101
- package/src/Header/ClientSelectCompany.jsx +0 -90
- package/src/Header/Header.jsx +0 -120
- package/src/Header/HeaderContainer.jsx +0 -30
- package/src/Header/Logo.jsx +0 -16
- package/src/Header/LogoutButton.jsx +0 -34
- package/src/Header/index.jsx +0 -9
- package/src/Header/request.js +0 -28
- package/src/Header/types.js +0 -6
- package/src/Header/util.jsx +0 -61
- package/src/Inputs/Business/BankAccount.jsx +0 -39
- package/src/Inputs/Business/BankName.jsx +0 -40
- package/src/Inputs/Business/CifField.jsx +0 -93
- package/src/Inputs/Business/CifFieldContainer.jsx +0 -142
- package/src/Inputs/Business/Email.jsx +0 -23
- package/src/Inputs/Business/NidField.jsx +0 -77
- package/src/Inputs/Business/Phone.jsx +0 -23
- package/src/Inputs/Business/index.js +0 -16
- package/src/Inputs/Business/request.js +0 -39
- package/src/Inputs/CaptchaBox.jsx +0 -131
- package/src/Inputs/DateInput.jsx +0 -188
- package/src/Inputs/DateTemplate.jsx +0 -213
- package/src/Inputs/DelayInputChange.jsx +0 -130
- package/src/Inputs/FocusTemplate.jsx +0 -41
- package/src/Inputs/InputTemplate.jsx +0 -79
- package/src/Inputs/LabelTemplate.jsx +0 -47
- package/src/Inputs/NumericInput.jsx +0 -142
- package/src/Inputs/NumericTemplate.jsx +0 -155
- package/src/Inputs/Selects/County.jsx +0 -19
- package/src/Inputs/Selects/Custom.jsx +0 -55
- package/src/Inputs/Selects/Simple.jsx +0 -73
- package/src/Inputs/Selects/index.jsx +0 -37
- package/src/Inputs/SimpleInput.jsx +0 -40
- package/src/Inputs/SimpleTextarea.jsx +0 -55
- package/src/Inputs/TextareaTemplate.jsx +0 -57
- package/src/Inputs/Tooltip.jsx +0 -61
- package/src/Inputs/index.js +0 -22
- package/src/Messages/Error.jsx +0 -83
- package/src/Messages/Loading.jsx +0 -43
- package/src/Messages/index.jsx +0 -4
- package/src/Modal/Delete.jsx +0 -237
- package/src/Modal/Root.jsx +0 -57
- package/src/Modal/SimpleModal.jsx +0 -47
- package/src/Modal/actions.js +0 -7
- package/src/Modal/getComponent.jsx +0 -32
- package/src/Modal/index.jsx +0 -12
- package/src/Modal/reducer.js +0 -40
- package/src/Modal/types.js +0 -6
- package/src/Modal/util.js +0 -15
- package/src/Payment/EstimatePrice/Description.jsx +0 -101
- package/src/Payment/EstimatePrice/PayBox.jsx +0 -173
- package/src/Payment/EstimatePrice/index.jsx +0 -63
- package/src/Payment/EstimatePrice/util.js +0 -15
- package/src/Payment/MobilpayForm.jsx +0 -77
- package/src/Payment/Modal/BankTransfer.jsx +0 -129
- package/src/Payment/Modal/CompanyValability.jsx +0 -14
- package/src/Payment/Modal/DoneForm.jsx +0 -209
- package/src/Payment/Modal/PaymentDone.jsx +0 -27
- package/src/Payment/Modal/index.js +0 -13
- package/src/Payment/actions.jsx +0 -22
- package/src/Payment/index.jsx +0 -124
- package/src/Payment/request.js +0 -50
- package/src/Payment/types.js +0 -14
- package/src/Payment/util.jsx +0 -52
- package/src/Payment/validate.js +0 -25
- package/src/Sidebar.jsx +0 -158
- package/src/Things.jsx +0 -35
- package/src/actions.js +0 -36
- package/src/config.js +0 -7
- package/src/dev/ErrorBoundary.jsx +0 -98
- package/src/dev/TheError.jsx +0 -87
- package/src/dev/index.js +0 -127
- package/src/dev/types.js +0 -10
- package/src/prod/SentryErrorBoundary.jsx +0 -98
- package/src/reducer/captchas.js +0 -44
- package/src/reducer/counties.js +0 -46
- package/src/reducer/index.js +0 -25
- package/src/reducer/module.jsx +0 -43
- package/src/style/.sass-lint.yml +0 -84
- package/src/style/.stylelintrc.json +0 -161
- package/src/style/_fancy-text.scss +0 -37
- package/src/style/_fix_bootstrap_placeholder_color.scss +0 -14
- package/src/style/_header-company.scss +0 -69
- package/src/style/_inputs.scss +0 -12
- package/src/style/_minimal.scss +0 -31
- package/src/style/_navigation.scss +0 -24
- package/src/style/_others.scss +0 -79
- package/src/style/index.scss +0 -7
- package/src/style/sidebar/_animations.scss +0 -21
- package/src/style/sidebar/_dark-theme.scss +0 -77
- package/src/style/sidebar/_scroll.scss +0 -37
- package/src/style/sidebar/_structure.scss +0 -299
- package/src/style/sidebar.scss +0 -4
- package/src/types.js +0 -31
- package/src/utility/calendar.js +0 -39
- package/src/utility/date.js +0 -100
- package/src/utility/index.js +0 -12
- package/src/utility/language.js +0 -17
- package/src/utility/mql.js +0 -3
- package/src/utility/normalize-test.js +0 -58
- package/src/utility/normalize.js +0 -119
- package/src/utility/numbers.js +0 -87
- package/src/utility/numeric.js +0 -114
- package/src/utility/others.jsx +0 -160
- package/src/utility/strings-test.js +0 -136
- package/src/utility/strings.js +0 -80
- package/src/utility/validation/common.js +0 -360
- package/src/utility/validation/index.js +0 -70
- package/src/utility/validation/specific.js +0 -9
- package/src/utility/validation/validate/bank-test.js +0 -129
- package/src/utility/validation/validate/bank.js +0 -176
- package/src/utility/validation/validate/cif-test.js +0 -105
- package/src/utility/validation/validate/cif.js +0 -44
- package/src/utility/validation/validate/cnp-test.js +0 -216
- package/src/utility/validation/validate/cnp.js +0 -261
- package/src/utility/validation/validate/email-test.js +0 -36
- package/src/utility/validation/validate/email.js +0 -6
- package/src/utility/validation/validate/index.js +0 -7
- package/webpack.config.js +0 -90
- package/x25.wiki/Account.md +0 -41
- package/x25.wiki/Company.md +0 -39
- package/x25.wiki/Header.md +0 -21
- package/x25.wiki/Home.md +0 -1
- package/x25.wiki/Inputs.md +0 -33
- package/x25.wiki/Messages.md +0 -27
- package/x25.wiki/Payment.md +0 -42
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
type InputTemplatePropTypes = {
|
|
4
|
-
+autoFocus?: boolean;
|
|
5
|
-
+input: any;
|
|
6
|
-
+label: string;
|
|
7
|
-
+placeholder: string;
|
|
8
|
-
+type: string;
|
|
9
|
-
+divClass?: string;
|
|
10
|
-
+inputClass?:string;
|
|
11
|
-
+meta: {
|
|
12
|
-
touched: boolean;
|
|
13
|
-
error?: any;
|
|
14
|
-
submitting: boolean;
|
|
15
|
-
};
|
|
16
|
-
+tabIndex?: string;
|
|
17
|
-
+left?: string;
|
|
18
|
-
+right?: string;
|
|
19
|
-
|
|
20
|
-
+onRegisterRef?: (callback : (node : any) => void) => void;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
import React from "react";
|
|
24
|
-
import classnames from "classnames";
|
|
25
|
-
|
|
26
|
-
export const InputTemplate = ({
|
|
27
|
-
input,
|
|
28
|
-
type,
|
|
29
|
-
label,
|
|
30
|
-
onRegisterRef,
|
|
31
|
-
autoFocus,
|
|
32
|
-
inputClass,
|
|
33
|
-
divClass,
|
|
34
|
-
placeholder,
|
|
35
|
-
left,
|
|
36
|
-
tabIndex,
|
|
37
|
-
right,
|
|
38
|
-
meta: { submitting, touched, error },
|
|
39
|
-
} : InputTemplatePropTypes) => {
|
|
40
|
-
const
|
|
41
|
-
warningClass = `${touched && error ? " is-invalid" : ""}`,
|
|
42
|
-
customClass = `${inputClass ? ` ${inputClass}` : ""}`,
|
|
43
|
-
classForInput = `form-control ${warningClass}${customClass}`,
|
|
44
|
-
classForDiv = `form-group row ${divClass ? divClass : ""}`;
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<div className={classnames(classForDiv, { "is-invalid": touched && error })}>
|
|
48
|
-
<label
|
|
49
|
-
className={`${left ? left : "col-md-4 text-md-right"} form-control-label`}
|
|
50
|
-
htmlFor={input.name}>
|
|
51
|
-
{label}
|
|
52
|
-
</label>
|
|
53
|
-
<div className={right ? right : "col-md-8"}>
|
|
54
|
-
<input
|
|
55
|
-
{...input}
|
|
56
|
-
aria-label={label}
|
|
57
|
-
autoComplete={input.name}
|
|
58
|
-
autoFocus={autoFocus}
|
|
59
|
-
className={classForInput}
|
|
60
|
-
disabled={submitting}
|
|
61
|
-
id={input.name}
|
|
62
|
-
placeholder={placeholder}
|
|
63
|
-
ref={onRegisterRef ? onRegisterRef : null}
|
|
64
|
-
tabIndex={tabIndex}
|
|
65
|
-
type={type}
|
|
66
|
-
/>
|
|
67
|
-
<div className="invalid-feedback">
|
|
68
|
-
{
|
|
69
|
-
touched && error && (
|
|
70
|
-
<span>
|
|
71
|
-
{error}
|
|
72
|
-
</span>
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
);
|
|
79
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
type LabelTemplatePropTypes = {
|
|
4
|
-
+input: any;
|
|
5
|
-
+label: string;
|
|
6
|
-
+tabIndex?: string;
|
|
7
|
-
+offset?: string;
|
|
8
|
-
+meta: {
|
|
9
|
-
submitting : boolean;
|
|
10
|
-
touched: boolean;
|
|
11
|
-
error?: any;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
import React from "react";
|
|
16
|
-
|
|
17
|
-
export const LabelTemplate = (
|
|
18
|
-
{ input, tabIndex, label, offset, meta: { submitting, touched, error } }: LabelTemplatePropTypes,
|
|
19
|
-
) => (
|
|
20
|
-
<div className="container">
|
|
21
|
-
<div className="form-group row mb-1">
|
|
22
|
-
<div className={`${offset || ""} col custom-control custom-checkbox`}>
|
|
23
|
-
<input
|
|
24
|
-
{...input}
|
|
25
|
-
aria-label={label}
|
|
26
|
-
className="custom-control-input"
|
|
27
|
-
disabled={submitting}
|
|
28
|
-
id={input.name}
|
|
29
|
-
tabIndex={tabIndex}
|
|
30
|
-
type="checkbox"
|
|
31
|
-
/>
|
|
32
|
-
<label className="custom-control-label" htmlFor={input.name}>
|
|
33
|
-
{label}
|
|
34
|
-
</label>
|
|
35
|
-
<div className="invalid-feedback">
|
|
36
|
-
{
|
|
37
|
-
touched && error && (
|
|
38
|
-
<span>
|
|
39
|
-
{error}
|
|
40
|
-
</span>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
);
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
// @flow
|
|
3
|
-
|
|
4
|
-
type NumericPropTypes = {
|
|
5
|
-
+currency?: boolean;
|
|
6
|
-
+optional?: boolean;
|
|
7
|
-
+size?: number;
|
|
8
|
-
+customClass?: any;
|
|
9
|
-
|
|
10
|
-
+input: any;
|
|
11
|
-
+label?: string;
|
|
12
|
-
+meta: {
|
|
13
|
-
error?: string;
|
|
14
|
-
submitting: boolean;
|
|
15
|
-
touched: boolean;
|
|
16
|
-
};
|
|
17
|
-
+tabIndex?: string;
|
|
18
|
-
+placeholder?: string;
|
|
19
|
-
+value?: string;
|
|
20
|
-
|
|
21
|
-
+formatValue: (raw: any, optional?: bool) => string;
|
|
22
|
-
+normalizeValue: (raw: any) => any;
|
|
23
|
-
+onBlur?: () => void;
|
|
24
|
-
+onChange?: (event : any) => void;
|
|
25
|
-
+onRegisterRef?: any;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
type NumericStateTypes = {
|
|
29
|
-
value: any
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
import React from "react";
|
|
33
|
-
import classnames from "classnames";
|
|
34
|
-
|
|
35
|
-
import { formatZeroValue, normalizeFloat, handleBlur, cwrp } from "../utility";
|
|
36
|
-
|
|
37
|
-
export class NumericInput extends React.Component<NumericPropTypes, NumericStateTypes> {
|
|
38
|
-
|
|
39
|
-
static defaultProps = {
|
|
40
|
-
formatValue : formatZeroValue,
|
|
41
|
-
normalizeValue : normalizeFloat,
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
props: NumericPropTypes;
|
|
45
|
-
|
|
46
|
-
state: NumericStateTypes;
|
|
47
|
-
|
|
48
|
-
handleBlur: () => any;
|
|
49
|
-
handleKeyDown: (event : any) => void;
|
|
50
|
-
handleChange: () => void;
|
|
51
|
-
|
|
52
|
-
constructor (props : NumericPropTypes) {
|
|
53
|
-
super();
|
|
54
|
-
|
|
55
|
-
this.state = {
|
|
56
|
-
value: props.input.value,
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
this.handleKeyDown = (event : any) => {
|
|
60
|
-
if (event.key === "Enter") {
|
|
61
|
-
this.handleBlur();
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
this.handleBlur = () => {
|
|
66
|
-
handleBlur(this);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
this.handleChange = ({ target : { value } } : any) => {
|
|
70
|
-
this.props.input.onChange();
|
|
71
|
-
|
|
72
|
-
/*
|
|
73
|
-
* Update the internal state to trigger a re-render
|
|
74
|
-
* using the formatted value
|
|
75
|
-
*/
|
|
76
|
-
this.setState({ value });
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
UNSAFE_componentWillReceiveProps (nextProps : NumericPropTypes) {
|
|
81
|
-
cwrp(this, nextProps);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
render () {
|
|
85
|
-
const {
|
|
86
|
-
customClass,
|
|
87
|
-
input,
|
|
88
|
-
label,
|
|
89
|
-
currency,
|
|
90
|
-
tabIndex,
|
|
91
|
-
onRegisterRef,
|
|
92
|
-
meta: {
|
|
93
|
-
submitting,
|
|
94
|
-
touched,
|
|
95
|
-
error,
|
|
96
|
-
},
|
|
97
|
-
formatValue,
|
|
98
|
-
size,
|
|
99
|
-
placeholder,
|
|
100
|
-
} = this.props;
|
|
101
|
-
|
|
102
|
-
const inputComponent = (
|
|
103
|
-
<input
|
|
104
|
-
aria-label={label}
|
|
105
|
-
className={classnames(`form-control ${(customClass || "")}`, {
|
|
106
|
-
"is-invalid": touched && error,
|
|
107
|
-
})}
|
|
108
|
-
disabled={submitting}
|
|
109
|
-
id={input.name}
|
|
110
|
-
maxLength={size}
|
|
111
|
-
onBlur={this.handleBlur}
|
|
112
|
-
onChange={this.handleChange}
|
|
113
|
-
onFocus={input.onFocus}
|
|
114
|
-
onKeyDown={this.handleKeyDown}
|
|
115
|
-
placeholder={placeholder || label}
|
|
116
|
-
ref={onRegisterRef}
|
|
117
|
-
tabIndex={tabIndex}
|
|
118
|
-
type="text"
|
|
119
|
-
value={formatValue(this.state.value, this.props.optional)}
|
|
120
|
-
/>
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
if (typeof currency === "undefined" || currency === false) {
|
|
124
|
-
return (
|
|
125
|
-
<div className="form-group-inline">
|
|
126
|
-
{inputComponent}
|
|
127
|
-
</div>
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return (
|
|
132
|
-
<div className="input-group">
|
|
133
|
-
{ inputComponent }
|
|
134
|
-
<div className="input-group-append">
|
|
135
|
-
<span className="input-group-text">
|
|
136
|
-
{currency}
|
|
137
|
-
</span>
|
|
138
|
-
</div>
|
|
139
|
-
</div>
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
// @flow
|
|
3
|
-
|
|
4
|
-
type NumericPropTypes = {
|
|
5
|
-
+optional?: boolean;
|
|
6
|
-
+size?: number;
|
|
7
|
-
+customClass?: any;
|
|
8
|
-
+divClass?: any;
|
|
9
|
-
|
|
10
|
-
+input: any;
|
|
11
|
-
+label?: string;
|
|
12
|
-
+meta: {
|
|
13
|
-
error?: string;
|
|
14
|
-
submitting: boolean;
|
|
15
|
-
touched: boolean;
|
|
16
|
-
};
|
|
17
|
-
+placeholder?: string;
|
|
18
|
-
+value?: string;
|
|
19
|
-
+autoFocus?: boolean;
|
|
20
|
-
+type: string;
|
|
21
|
-
+inputClass?:string;
|
|
22
|
-
+left?: string;
|
|
23
|
-
+tabIndex? : string;
|
|
24
|
-
+right?: string;
|
|
25
|
-
|
|
26
|
-
+formatValue: (raw: any, optional?: bool) => string;
|
|
27
|
-
+normalizeValue: (raw: string | null) => any;
|
|
28
|
-
+onBlur?: () => void;
|
|
29
|
-
+onChange?: (event : any) => void;
|
|
30
|
-
+onRegisterRef?: any;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
type NumericStateTypes = {
|
|
34
|
-
value: any;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
import React from "react";
|
|
38
|
-
import classnames from "classnames";
|
|
39
|
-
|
|
40
|
-
import { formatZeroValue, handleBlur, normalizeFloat, cwrp } from "../utility";
|
|
41
|
-
|
|
42
|
-
export class NumericTemplate extends React.Component<NumericPropTypes, NumericStateTypes> {
|
|
43
|
-
|
|
44
|
-
static defaultProps = {
|
|
45
|
-
formatValue : formatZeroValue,
|
|
46
|
-
normalizeValue : normalizeFloat,
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
props: NumericPropTypes;
|
|
50
|
-
|
|
51
|
-
state: NumericStateTypes;
|
|
52
|
-
|
|
53
|
-
handleBlur: () => void;
|
|
54
|
-
handleKeyDown: (event : any) => void;
|
|
55
|
-
handleChange: () => void;
|
|
56
|
-
|
|
57
|
-
constructor (props : NumericPropTypes) {
|
|
58
|
-
super();
|
|
59
|
-
|
|
60
|
-
this.state = {
|
|
61
|
-
value: props.input.value,
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
this.handleKeyDown = (event : any) => {
|
|
65
|
-
if (event.key === "Enter") {
|
|
66
|
-
this.handleBlur();
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
this.handleBlur = () => {
|
|
71
|
-
handleBlur(this);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
this.handleChange = ({ target : { value } } : any) => {
|
|
75
|
-
this.props.input.onChange();
|
|
76
|
-
|
|
77
|
-
/*
|
|
78
|
-
* Update the internal state to trigger a re-render
|
|
79
|
-
* using the formatted value
|
|
80
|
-
*/
|
|
81
|
-
this.setState({ value });
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
UNSAFE_componentWillReceiveProps (nextProps : NumericPropTypes) {
|
|
86
|
-
cwrp(this, nextProps);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
render () {
|
|
90
|
-
const {
|
|
91
|
-
input,
|
|
92
|
-
label,
|
|
93
|
-
onRegisterRef,
|
|
94
|
-
meta: {
|
|
95
|
-
submitting,
|
|
96
|
-
touched,
|
|
97
|
-
error,
|
|
98
|
-
},
|
|
99
|
-
formatValue,
|
|
100
|
-
type,
|
|
101
|
-
autoFocus,
|
|
102
|
-
inputClass,
|
|
103
|
-
placeholder,
|
|
104
|
-
left,
|
|
105
|
-
size,
|
|
106
|
-
right,
|
|
107
|
-
tabIndex,
|
|
108
|
-
divClass,
|
|
109
|
-
} = this.props;
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
warningClass = `${touched && error ? " is-invalid" : ""}`,
|
|
113
|
-
customClass = `${inputClass ? ` ${inputClass}` : ""}`,
|
|
114
|
-
classForInput = `form-control ${warningClass}${customClass}`,
|
|
115
|
-
classForDiv = `form-group row ${divClass ? divClass : ""}`;
|
|
116
|
-
|
|
117
|
-
return (
|
|
118
|
-
<div className={classnames(classForDiv, { "is-invalid": touched && error })}>
|
|
119
|
-
<label
|
|
120
|
-
className={`${left ? left : "col-md-4 text-md-right"} form-control-label`}
|
|
121
|
-
htmlFor={input.name}>
|
|
122
|
-
{label}
|
|
123
|
-
</label>
|
|
124
|
-
<div className={right ? right : "col-md-8"}>
|
|
125
|
-
<input
|
|
126
|
-
aria-label={label}
|
|
127
|
-
autoFocus={autoFocus}
|
|
128
|
-
className={classForInput}
|
|
129
|
-
disabled={submitting}
|
|
130
|
-
id={input.name}
|
|
131
|
-
maxLength={size}
|
|
132
|
-
onBlur={this.handleBlur}
|
|
133
|
-
onChange={this.handleChange}
|
|
134
|
-
onFocus={input.onFocus}
|
|
135
|
-
onKeyDown={this.handleKeyDown}
|
|
136
|
-
placeholder={placeholder}
|
|
137
|
-
ref={onRegisterRef}
|
|
138
|
-
tabIndex={tabIndex}
|
|
139
|
-
type={type}
|
|
140
|
-
value={formatValue(this.state.value, this.props.optional)}
|
|
141
|
-
/>
|
|
142
|
-
<div className="invalid-feedback">
|
|
143
|
-
{
|
|
144
|
-
touched && error && (
|
|
145
|
-
<span>
|
|
146
|
-
{error}
|
|
147
|
-
</span>
|
|
148
|
-
)
|
|
149
|
-
}
|
|
150
|
-
</div>
|
|
151
|
-
</div>
|
|
152
|
-
</div>
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// @flow;
|
|
2
|
-
|
|
3
|
-
import type { State } from "src\\types";
|
|
4
|
-
|
|
5
|
-
import { connect } from "react-redux";
|
|
6
|
-
import { selectors } from "../../reducer";
|
|
7
|
-
|
|
8
|
-
import CustomSelect from "./Custom";
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
mapStateToProps = (state : State) => ({
|
|
12
|
-
data : selectors.getCountiesSorted(state),
|
|
13
|
-
label : "Județ",
|
|
14
|
-
isImmutable : true,
|
|
15
|
-
nameKey : "Name",
|
|
16
|
-
valueKey : "Short",
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
export default connect(mapStateToProps)(CustomSelect);
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
type SelectMonthPropTypes = {
|
|
4
|
-
+disabled: boolean;
|
|
5
|
-
+input: any;
|
|
6
|
-
+valueKey?: string;
|
|
7
|
-
+nameKey?: string;
|
|
8
|
-
+label?: string;
|
|
9
|
-
+isImmutable?: bool;
|
|
10
|
-
+showEmptyOption?: bool;
|
|
11
|
-
+tabIndex?: string;
|
|
12
|
-
+left?: string;
|
|
13
|
-
+inputClass?: string;
|
|
14
|
-
+right?: string;
|
|
15
|
-
+id?: string;
|
|
16
|
-
+data: any;
|
|
17
|
-
+meta: {
|
|
18
|
-
touched: boolean;
|
|
19
|
-
error?: any;
|
|
20
|
-
submitting: boolean;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
import React from "react";
|
|
25
|
-
|
|
26
|
-
import Simple from "./Simple";
|
|
27
|
-
|
|
28
|
-
const CustomSelect = (props : SelectMonthPropTypes) => {
|
|
29
|
-
const { input, meta: { touched, error }, left, right, label, id } = props;
|
|
30
|
-
const customID = `custom-select-${input.name}${id || ""}`;
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<div className="form-group row">
|
|
34
|
-
<label
|
|
35
|
-
className={`${left ? left : "col-md-4 text-md-right"} form-control-label`}
|
|
36
|
-
htmlFor={customID}>
|
|
37
|
-
{label}
|
|
38
|
-
</label>
|
|
39
|
-
<div className={right ? right : "col-md-8"}>
|
|
40
|
-
<Simple {...props} />
|
|
41
|
-
<div className="invalid-feedback">
|
|
42
|
-
{
|
|
43
|
-
touched && error && (
|
|
44
|
-
<span>
|
|
45
|
-
{error}
|
|
46
|
-
</span>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export default CustomSelect;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
type SelectMonthPropTypes = {
|
|
4
|
-
+disabled: boolean;
|
|
5
|
-
+input: any;
|
|
6
|
-
+autoFocus?: bool;
|
|
7
|
-
+valueKey?: string;
|
|
8
|
-
+nameKey?: string;
|
|
9
|
-
+isImmutable?: bool;
|
|
10
|
-
+showEmptyOption?: bool;
|
|
11
|
-
+tabIndex?: string;
|
|
12
|
-
+inputClass?: string;
|
|
13
|
-
+id?: string;
|
|
14
|
-
+data: any;
|
|
15
|
-
+meta: {
|
|
16
|
-
touched: boolean;
|
|
17
|
-
error?: any;
|
|
18
|
-
submitting: boolean;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
import React from "react";
|
|
23
|
-
import classnames from "classnames";
|
|
24
|
-
|
|
25
|
-
const SimpleCustomSelect = ({
|
|
26
|
-
autoFocus,
|
|
27
|
-
isImmutable, showEmptyOption,
|
|
28
|
-
valueKey = "value", nameKey = "name",
|
|
29
|
-
data, meta: { submitting, touched, error }, tabIndex,
|
|
30
|
-
input, id, inputClass } : SelectMonthPropTypes) => {
|
|
31
|
-
const customID = `custom-select-${input.name}${id || ""}`;
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<select
|
|
35
|
-
{...input}
|
|
36
|
-
autoFocus={autoFocus}
|
|
37
|
-
className={classnames(`custom-select ${inputClass || ""}`, {
|
|
38
|
-
"is-invalid": touched && error,
|
|
39
|
-
})}
|
|
40
|
-
disabled={submitting}
|
|
41
|
-
id={customID}
|
|
42
|
-
tabIndex={tabIndex}>
|
|
43
|
-
{
|
|
44
|
-
showEmptyOption ? (
|
|
45
|
-
<option value="">{"Selectează"}</option>
|
|
46
|
-
) : null
|
|
47
|
-
}
|
|
48
|
-
{
|
|
49
|
-
isImmutable ? (
|
|
50
|
-
data.map((current) => {
|
|
51
|
-
const
|
|
52
|
-
value = current.get(valueKey),
|
|
53
|
-
name = current.get(nameKey);
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<option key={value} value={value}>
|
|
57
|
-
{ name }
|
|
58
|
-
</option>
|
|
59
|
-
);
|
|
60
|
-
})
|
|
61
|
-
) : (
|
|
62
|
-
data.map(({ [valueKey] : value, [nameKey] : name }) => (
|
|
63
|
-
<option key={value} value={value}>
|
|
64
|
-
{ name }
|
|
65
|
-
</option>
|
|
66
|
-
))
|
|
67
|
-
)
|
|
68
|
-
}
|
|
69
|
-
</select>
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export default SimpleCustomSelect;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import SelectCounty from "./County";
|
|
4
|
-
import CustomSelect from "./Custom";
|
|
5
|
-
import SimpleCustomSelect from "./Simple";
|
|
6
|
-
|
|
7
|
-
import { months, years, normalizeSelectNumeric } from "../../utility";
|
|
8
|
-
|
|
9
|
-
import { Field } from "redux-form/immutable";
|
|
10
|
-
|
|
11
|
-
import React from "react";
|
|
12
|
-
|
|
13
|
-
const SelectMonth = (props : any) => (
|
|
14
|
-
<Field
|
|
15
|
-
{...props}
|
|
16
|
-
component={props.simple ? SimpleCustomSelect : CustomSelect}
|
|
17
|
-
data={months}
|
|
18
|
-
normalize={normalizeSelectNumeric}
|
|
19
|
-
/>
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
const SelectYear = (props : any) => (
|
|
23
|
-
<Field
|
|
24
|
-
{...props}
|
|
25
|
-
component={props.simple ? SimpleCustomSelect : CustomSelect}
|
|
26
|
-
data={years}
|
|
27
|
-
normalize={normalizeSelectNumeric}
|
|
28
|
-
/>
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
export {
|
|
32
|
-
SelectMonth,
|
|
33
|
-
SelectYear,
|
|
34
|
-
SelectCounty,
|
|
35
|
-
CustomSelect,
|
|
36
|
-
SimpleCustomSelect,
|
|
37
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
export type SimpleInputPropTypes = {
|
|
4
|
-
+customClass?: any;
|
|
5
|
-
+input: any;
|
|
6
|
-
+tabIndex?: string;
|
|
7
|
-
+label?: string;
|
|
8
|
-
+meta: {
|
|
9
|
-
submitting: boolean;
|
|
10
|
-
touched: boolean;
|
|
11
|
-
error?: string;
|
|
12
|
-
};
|
|
13
|
-
+placeholder?: string;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
import React from "react";
|
|
17
|
-
import classnames from "classnames";
|
|
18
|
-
|
|
19
|
-
export const SimpleInput = ({
|
|
20
|
-
customClass,
|
|
21
|
-
input,
|
|
22
|
-
label,
|
|
23
|
-
tabIndex,
|
|
24
|
-
meta: { submitting, touched, error },
|
|
25
|
-
placeholder,
|
|
26
|
-
}: SimpleInputPropTypes) => (
|
|
27
|
-
<input
|
|
28
|
-
{...input}
|
|
29
|
-
aria-label={label}
|
|
30
|
-
autoComplete={input.name}
|
|
31
|
-
className={classnames(`form-control ${customClass || ""}`, {
|
|
32
|
-
"is-invalid": touched && error,
|
|
33
|
-
})}
|
|
34
|
-
disabled={submitting}
|
|
35
|
-
id={input.name}
|
|
36
|
-
placeholder={placeholder || label}
|
|
37
|
-
tabIndex={tabIndex}
|
|
38
|
-
type="text"
|
|
39
|
-
/>
|
|
40
|
-
);
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
type InputTemplatePropTypes = {
|
|
4
|
-
+autoFocus?: boolean;
|
|
5
|
-
+input: any;
|
|
6
|
-
+label: string;
|
|
7
|
-
+placeholder: string;
|
|
8
|
-
+type: string;
|
|
9
|
-
+inputClass?:string;
|
|
10
|
-
+tabIndex?: string;
|
|
11
|
-
+rows?: string;
|
|
12
|
-
+meta: {
|
|
13
|
-
touched: boolean;
|
|
14
|
-
error?: any;
|
|
15
|
-
submitting: boolean;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
+onRegisterRef?: (callback : (node : any) => void) => void;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
import React from "react";
|
|
22
|
-
|
|
23
|
-
export const SimpleTextarea = ({
|
|
24
|
-
input,
|
|
25
|
-
type,
|
|
26
|
-
label,
|
|
27
|
-
onRegisterRef,
|
|
28
|
-
autoFocus,
|
|
29
|
-
inputClass,
|
|
30
|
-
placeholder,
|
|
31
|
-
tabIndex,
|
|
32
|
-
rows,
|
|
33
|
-
meta: { submitting, touched, error },
|
|
34
|
-
} : InputTemplatePropTypes) => {
|
|
35
|
-
const
|
|
36
|
-
warningClass = `${touched && error ? " is-invalid" : ""}`,
|
|
37
|
-
customClass = `${inputClass ? ` ${inputClass}` : ""}`,
|
|
38
|
-
classForInput = `form-control ${warningClass}${customClass}`;
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<textarea
|
|
42
|
-
{...input}
|
|
43
|
-
aria-label={label}
|
|
44
|
-
autoFocus={autoFocus}
|
|
45
|
-
className={classForInput}
|
|
46
|
-
disabled={submitting}
|
|
47
|
-
id={input.name}
|
|
48
|
-
placeholder={placeholder}
|
|
49
|
-
ref={onRegisterRef ? onRegisterRef : null}
|
|
50
|
-
rows={rows}
|
|
51
|
-
tabIndex={tabIndex}
|
|
52
|
-
type={type}
|
|
53
|
-
/>
|
|
54
|
-
);
|
|
55
|
-
};
|