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,131 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
type CaptchaPropTypes = {
|
|
4
|
-
+type: string;
|
|
5
|
-
+id: string;
|
|
6
|
-
+tabIndex?: string;
|
|
7
|
-
+input: any;
|
|
8
|
-
+label: string;
|
|
9
|
-
+autoFocus?: boolean;
|
|
10
|
-
+left?: string;
|
|
11
|
-
+right?: string;
|
|
12
|
-
+meta: {
|
|
13
|
-
touched: boolean;
|
|
14
|
-
error?: any;
|
|
15
|
-
submitting: boolean;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
type InfoIconStateTypes = {
|
|
20
|
-
showTooltip: boolean;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
import React from "react";
|
|
25
|
-
import { Tooltip } from "reactstrap";
|
|
26
|
-
import classnames from "classnames";
|
|
27
|
-
|
|
28
|
-
class InfoIcon extends React.Component<{}, InfoIconStateTypes> {
|
|
29
|
-
|
|
30
|
-
state: InfoIconStateTypes;
|
|
31
|
-
|
|
32
|
-
toggle: () => void;
|
|
33
|
-
|
|
34
|
-
constructor (props) {
|
|
35
|
-
super(props);
|
|
36
|
-
|
|
37
|
-
this.state = {
|
|
38
|
-
showTooltip: false,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
this.toggle = () => {
|
|
42
|
-
this.setState((prevState : InfoIconStateTypes) => ({
|
|
43
|
-
showTooltip: !prevState.showTooltip,
|
|
44
|
-
}));
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
render () {
|
|
49
|
-
return (
|
|
50
|
-
<div className="d-inline float-right">
|
|
51
|
-
<i
|
|
52
|
-
className="fa fa-info-circle fa-2x text-info pull-right"
|
|
53
|
-
id="TooltipExample"
|
|
54
|
-
/>
|
|
55
|
-
<Tooltip
|
|
56
|
-
isOpen={this.state.showTooltip}
|
|
57
|
-
placement="right"
|
|
58
|
-
target="TooltipExample"
|
|
59
|
-
toggle={this.toggle}>
|
|
60
|
-
{`Scopul acestei verificări este de a deosebi o personă de un robot.
|
|
61
|
-
De obicei, acest cod apare atunci cand se fololește excesiv
|
|
62
|
-
o functionalitate din aplicație`}
|
|
63
|
-
</Tooltip>
|
|
64
|
-
</div>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export const CaptchaBox = (props : CaptchaPropTypes) => {
|
|
70
|
-
const {
|
|
71
|
-
autoFocus,
|
|
72
|
-
id,
|
|
73
|
-
input,
|
|
74
|
-
tabIndex,
|
|
75
|
-
label,
|
|
76
|
-
left,
|
|
77
|
-
right,
|
|
78
|
-
meta: { touched, error, submitting },
|
|
79
|
-
type,
|
|
80
|
-
} = props;
|
|
81
|
-
|
|
82
|
-
if (typeof id === "undefined" || id === "") {
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return (
|
|
87
|
-
<div className="form-group row">
|
|
88
|
-
<label
|
|
89
|
-
className={`${left ? left : "col-md-4 text-md-right"} form-control-label`}
|
|
90
|
-
htmlFor={input.name}>
|
|
91
|
-
{"Verificare "}
|
|
92
|
-
<InfoIcon />
|
|
93
|
-
</label>
|
|
94
|
-
<div className={right ? right : "col-md-8"}>
|
|
95
|
-
<div className="custom-class">
|
|
96
|
-
<span className="custom-control-description text-muted">
|
|
97
|
-
{"Tastează numere din imaginea de mai jos"}
|
|
98
|
-
</span>
|
|
99
|
-
<div className="text-center my-1">
|
|
100
|
-
<img
|
|
101
|
-
alt="CaptchaBox"
|
|
102
|
-
src={`/captcha/${id}.png`}
|
|
103
|
-
/>
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
<input
|
|
107
|
-
{...input}
|
|
108
|
-
aria-label={label}
|
|
109
|
-
autoFocus={autoFocus}
|
|
110
|
-
className={classnames("form-control", {
|
|
111
|
-
"is-invalid": touched && error,
|
|
112
|
-
})}
|
|
113
|
-
disabled={submitting}
|
|
114
|
-
id={input.name}
|
|
115
|
-
placeholder="Tastează numerele"
|
|
116
|
-
tabIndex={tabIndex}
|
|
117
|
-
type={type}
|
|
118
|
-
/>
|
|
119
|
-
<div className="invalid-feedback">
|
|
120
|
-
{
|
|
121
|
-
touched && error ? (
|
|
122
|
-
<span>
|
|
123
|
-
{error}
|
|
124
|
-
</span>
|
|
125
|
-
) : null
|
|
126
|
-
}
|
|
127
|
-
</div>
|
|
128
|
-
</div>
|
|
129
|
-
</div>
|
|
130
|
-
);
|
|
131
|
-
};
|
package/src/Inputs/DateInput.jsx
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
type DateInputPropTypes = {
|
|
5
|
-
+customClass?: any;
|
|
6
|
-
+input: any;
|
|
7
|
-
+meta: {
|
|
8
|
-
error?: string;
|
|
9
|
-
submitting: boolean;
|
|
10
|
-
touched: boolean;
|
|
11
|
-
};
|
|
12
|
-
+placeholder?: string;
|
|
13
|
-
+value?: string;
|
|
14
|
-
+tabIndex?: string;
|
|
15
|
-
+currency?: boolean;
|
|
16
|
-
|
|
17
|
-
+formatValue: (raw: string) => string;
|
|
18
|
-
+normalizeValue: (raw: string) => any;
|
|
19
|
-
+onBlur?: () => void;
|
|
20
|
-
+onChange?: (event : any) => void;
|
|
21
|
-
+onRegisterRef?: (callback : (node : any) => void) => void;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
type DateInputStateTypes = {
|
|
25
|
-
value: string,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
import React from "react";
|
|
29
|
-
import classnames from "classnames";
|
|
30
|
-
|
|
31
|
-
import {
|
|
32
|
-
formatDate,
|
|
33
|
-
isValidDate,
|
|
34
|
-
normalizeDate,
|
|
35
|
-
} from "../utility";
|
|
36
|
-
|
|
37
|
-
const normalizeRawDate = (raw : string) : string => {
|
|
38
|
-
|
|
39
|
-
/* eslint-disable no-magic-numbers */
|
|
40
|
-
|
|
41
|
-
if (isValidDate(raw)) {
|
|
42
|
-
return normalizeDate(raw);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return raw;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const formatRawDate = (raw : string) : string => {
|
|
49
|
-
|
|
50
|
-
/* eslint-disable no-magic-numbers */
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (typeof raw !== "undefined") {
|
|
54
|
-
return formatDate(raw);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return "";
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export class DateInput extends React.Component<DateInputPropTypes, DateInputStateTypes> {
|
|
61
|
-
|
|
62
|
-
static defaultProps = {
|
|
63
|
-
formatValue : formatRawDate,
|
|
64
|
-
normalizeValue : normalizeRawDate,
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
props: DateInputPropTypes;
|
|
68
|
-
|
|
69
|
-
state: DateInputStateTypes;
|
|
70
|
-
|
|
71
|
-
handleBlur: () => void;
|
|
72
|
-
handleKeyDown: (event : any) => void;
|
|
73
|
-
handleChange: () => void;
|
|
74
|
-
|
|
75
|
-
constructor (props : DateInputPropTypes) {
|
|
76
|
-
super();
|
|
77
|
-
|
|
78
|
-
this.state = {
|
|
79
|
-
value: formatRawDate(props.input.value),
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
this.handleKeyDown = (event : any) => {
|
|
83
|
-
if (event.key === "Enter") {
|
|
84
|
-
this.handleBlur();
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
this.handleBlur = () => {
|
|
89
|
-
const { onBlur } = this.props.input;
|
|
90
|
-
|
|
91
|
-
const { input, normalizeValue } = this.props;
|
|
92
|
-
|
|
93
|
-
const { value: currentValue } = this.state;
|
|
94
|
-
|
|
95
|
-
const normalizedValue = normalizeValue(currentValue),
|
|
96
|
-
shouldRenderAgain = (
|
|
97
|
-
(normalizedValue !== "") &&
|
|
98
|
-
(currentValue !== normalizedValue)
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
input.onChange(normalizedValue);
|
|
102
|
-
|
|
103
|
-
/*
|
|
104
|
-
* Swallow the event to prevent Redux Form from
|
|
105
|
-
* extracting the form value
|
|
106
|
-
*/
|
|
107
|
-
onBlur();
|
|
108
|
-
|
|
109
|
-
if (shouldRenderAgain) {
|
|
110
|
-
this.setState({
|
|
111
|
-
value: formatDate(normalizedValue),
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
this.handleChange = ({ target : { value } } : any) => {
|
|
117
|
-
this.props.input.onChange();
|
|
118
|
-
|
|
119
|
-
/*
|
|
120
|
-
* Update the internal state to trigger a re-render
|
|
121
|
-
* using the formatted value
|
|
122
|
-
*/
|
|
123
|
-
this.setState({ value });
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
UNSAFE_componentWillReceiveProps (nextProps : DateInputPropTypes) {
|
|
128
|
-
const {
|
|
129
|
-
input: {
|
|
130
|
-
value: newValue,
|
|
131
|
-
},
|
|
132
|
-
} = nextProps;
|
|
133
|
-
|
|
134
|
-
const { value: currentValue } = this.state;
|
|
135
|
-
|
|
136
|
-
const shouldRenderAgain = (
|
|
137
|
-
isValidDate(newValue) &&
|
|
138
|
-
(currentValue !== newValue)
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
if (newValue === "") {
|
|
142
|
-
this.setState({
|
|
143
|
-
value: "",
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (shouldRenderAgain) {
|
|
148
|
-
this.setState({
|
|
149
|
-
value: formatDate(newValue),
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
render () {
|
|
155
|
-
const {
|
|
156
|
-
customClass,
|
|
157
|
-
input,
|
|
158
|
-
onRegisterRef,
|
|
159
|
-
meta: {
|
|
160
|
-
submitting,
|
|
161
|
-
touched,
|
|
162
|
-
error,
|
|
163
|
-
},
|
|
164
|
-
tabIndex,
|
|
165
|
-
formatValue,
|
|
166
|
-
placeholder,
|
|
167
|
-
} = this.props;
|
|
168
|
-
|
|
169
|
-
return (
|
|
170
|
-
<input
|
|
171
|
-
{...input}
|
|
172
|
-
className={classnames(`form-control ${(customClass || "")}`, {
|
|
173
|
-
"is-invalid": touched && error,
|
|
174
|
-
})}
|
|
175
|
-
disabled={submitting}
|
|
176
|
-
id={input.name}
|
|
177
|
-
onBlur={this.handleBlur}
|
|
178
|
-
onChange={this.handleChange}
|
|
179
|
-
onKeyDown={this.handleKeyDown}
|
|
180
|
-
placeholder={placeholder || "ZZ.LL.ANUL"}
|
|
181
|
-
ref={onRegisterRef}
|
|
182
|
-
tabIndex={tabIndex}
|
|
183
|
-
type="text"
|
|
184
|
-
value={formatValue(this.state.value)}
|
|
185
|
-
/>
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
type DateTemplatePropTypes = {
|
|
5
|
-
+customClass?: any;
|
|
6
|
-
+input: any;
|
|
7
|
-
+label?: string;
|
|
8
|
-
+meta: {
|
|
9
|
-
error?: string;
|
|
10
|
-
submitting: boolean;
|
|
11
|
-
touched: boolean;
|
|
12
|
-
};
|
|
13
|
-
+left?: string;
|
|
14
|
-
+right?: string;
|
|
15
|
-
+placeholder?: string;
|
|
16
|
-
+value?: string;
|
|
17
|
-
+tabIndex?: string;
|
|
18
|
-
+currency?: boolean;
|
|
19
|
-
|
|
20
|
-
+formatValue: (raw: string) => string;
|
|
21
|
-
+normalizeValue: (raw: string) => any;
|
|
22
|
-
+onBlur?: () => void;
|
|
23
|
-
+onChange?: (event : any) => void;
|
|
24
|
-
+onRegisterRef?: (callback : (node : any) => void) => void;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
type DateTemplateStateTypes = {
|
|
28
|
-
value: string,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
import React from "react";
|
|
32
|
-
import classnames from "classnames";
|
|
33
|
-
|
|
34
|
-
import {
|
|
35
|
-
formatDate,
|
|
36
|
-
isValidDate,
|
|
37
|
-
normalizeDate,
|
|
38
|
-
} from "../utility";
|
|
39
|
-
|
|
40
|
-
const normalizeRawDate = (raw : string) : string => {
|
|
41
|
-
|
|
42
|
-
/* eslint-disable no-magic-numbers */
|
|
43
|
-
|
|
44
|
-
if (isValidDate(raw)) {
|
|
45
|
-
return normalizeDate(raw);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return raw;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const formatRawDate = (raw : string) : string => {
|
|
52
|
-
|
|
53
|
-
/* eslint-disable no-magic-numbers */
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (typeof raw !== "undefined") {
|
|
57
|
-
return formatDate(raw);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return "";
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export class DateTemplate extends React.Component<DateTemplatePropTypes, DateTemplateStateTypes> {
|
|
64
|
-
|
|
65
|
-
static defaultProps = {
|
|
66
|
-
formatValue : formatRawDate,
|
|
67
|
-
normalizeValue : normalizeRawDate,
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
props: DateTemplatePropTypes;
|
|
71
|
-
|
|
72
|
-
state: DateTemplateStateTypes;
|
|
73
|
-
|
|
74
|
-
handleBlur: () => void;
|
|
75
|
-
handleKeyDown: (event : any) => void;
|
|
76
|
-
handleChange: () => void;
|
|
77
|
-
|
|
78
|
-
constructor (props : DateTemplatePropTypes) {
|
|
79
|
-
super();
|
|
80
|
-
|
|
81
|
-
this.state = {
|
|
82
|
-
value: formatRawDate(props.input.value),
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
this.handleKeyDown = (event : any) => {
|
|
86
|
-
if (event.key === "Enter") {
|
|
87
|
-
this.handleBlur();
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
this.handleBlur = () => {
|
|
92
|
-
const { onBlur } = this.props.input;
|
|
93
|
-
|
|
94
|
-
const { input, normalizeValue } = this.props;
|
|
95
|
-
|
|
96
|
-
const { value: currentValue } = this.state;
|
|
97
|
-
|
|
98
|
-
const normalizedValue = normalizeValue(currentValue),
|
|
99
|
-
shouldRenderAgain = (
|
|
100
|
-
(normalizedValue !== "") &&
|
|
101
|
-
(currentValue !== normalizedValue)
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
input.onChange(normalizedValue);
|
|
105
|
-
|
|
106
|
-
/*
|
|
107
|
-
* Swallow the event to prevent Redux Form from
|
|
108
|
-
* extracting the form value
|
|
109
|
-
*/
|
|
110
|
-
onBlur();
|
|
111
|
-
|
|
112
|
-
if (shouldRenderAgain) {
|
|
113
|
-
this.setState({
|
|
114
|
-
value: formatDate(normalizedValue),
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
this.handleChange = ({ target : { value } } : any) => {
|
|
120
|
-
this.props.input.onChange();
|
|
121
|
-
|
|
122
|
-
/*
|
|
123
|
-
* Update the internal state to trigger a re-render
|
|
124
|
-
* using the formatted value
|
|
125
|
-
*/
|
|
126
|
-
this.setState({ value });
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
UNSAFE_componentWillReceiveProps (nextProps : DateTemplatePropTypes) {
|
|
131
|
-
const {
|
|
132
|
-
input: {
|
|
133
|
-
value: newValue,
|
|
134
|
-
},
|
|
135
|
-
} = nextProps;
|
|
136
|
-
|
|
137
|
-
const { value: currentValue } = this.state;
|
|
138
|
-
|
|
139
|
-
const shouldRenderAgain = (
|
|
140
|
-
isValidDate(newValue) &&
|
|
141
|
-
(currentValue !== newValue)
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
if (newValue === "") {
|
|
145
|
-
this.setState({
|
|
146
|
-
value: "",
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (shouldRenderAgain) {
|
|
151
|
-
this.setState({
|
|
152
|
-
value: formatDate(newValue),
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
render () {
|
|
158
|
-
const {
|
|
159
|
-
customClass,
|
|
160
|
-
input,
|
|
161
|
-
label,
|
|
162
|
-
onRegisterRef,
|
|
163
|
-
meta: {
|
|
164
|
-
submitting,
|
|
165
|
-
touched,
|
|
166
|
-
error,
|
|
167
|
-
},
|
|
168
|
-
left,
|
|
169
|
-
right,
|
|
170
|
-
tabIndex,
|
|
171
|
-
formatValue,
|
|
172
|
-
placeholder,
|
|
173
|
-
} = this.props;
|
|
174
|
-
|
|
175
|
-
return (
|
|
176
|
-
<div className={classnames("form-group row", { "is-invalid": touched && error })}>
|
|
177
|
-
<label
|
|
178
|
-
className={`${left ? left : "col-md-4 text-md-right"} form-control-label`}
|
|
179
|
-
htmlFor={input.name}>
|
|
180
|
-
{label}
|
|
181
|
-
</label>
|
|
182
|
-
<div className={right ? right : "col-md-8"}>
|
|
183
|
-
<input
|
|
184
|
-
{...input}
|
|
185
|
-
aria-label={label}
|
|
186
|
-
className={classnames(`form-control ${(customClass || "")}`, {
|
|
187
|
-
"is-invalid": touched && error,
|
|
188
|
-
})}
|
|
189
|
-
disabled={submitting}
|
|
190
|
-
id={input.name}
|
|
191
|
-
onBlur={this.handleBlur}
|
|
192
|
-
onChange={this.handleChange}
|
|
193
|
-
onKeyDown={this.handleKeyDown}
|
|
194
|
-
placeholder={placeholder || "ZZ.LL.ANUL"}
|
|
195
|
-
ref={onRegisterRef}
|
|
196
|
-
tabIndex={tabIndex}
|
|
197
|
-
type="text"
|
|
198
|
-
value={formatValue(this.state.value)}
|
|
199
|
-
/>
|
|
200
|
-
<div className="invalid-feedback">
|
|
201
|
-
{
|
|
202
|
-
touched && error && (
|
|
203
|
-
<span>
|
|
204
|
-
{error}
|
|
205
|
-
</span>
|
|
206
|
-
)
|
|
207
|
-
}
|
|
208
|
-
</div>
|
|
209
|
-
</div>
|
|
210
|
-
</div>
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
import React from "react";
|
|
5
|
-
|
|
6
|
-
type TypeInputPropTypes = {
|
|
7
|
-
+change : (event : any) => void;
|
|
8
|
-
+value: any;
|
|
9
|
-
+tabIndex?: string;
|
|
10
|
-
+delay?: number;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
type TypeInputStateTypes = {
|
|
14
|
-
value: string;
|
|
15
|
-
isWaiting: bool;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const delay = 700;
|
|
19
|
-
|
|
20
|
-
import { LoadingMessage } from "../Messages";
|
|
21
|
-
|
|
22
|
-
export class DelayInputChange extends React.Component<TypeInputPropTypes, TypeInputStateTypes> {
|
|
23
|
-
props: TypeInputPropTypes;
|
|
24
|
-
state: TypeInputStateTypes;
|
|
25
|
-
|
|
26
|
-
timeout: any;
|
|
27
|
-
|
|
28
|
-
delayChange: (event : any) => void;
|
|
29
|
-
handleKeyPressed: (event : any) => void;
|
|
30
|
-
stopWaiting: (value : string) => void;
|
|
31
|
-
|
|
32
|
-
constructor (props : TypeInputPropTypes) {
|
|
33
|
-
super(props);
|
|
34
|
-
|
|
35
|
-
this.timeout = null;
|
|
36
|
-
|
|
37
|
-
this.state = {
|
|
38
|
-
isWaiting : false,
|
|
39
|
-
value : this.props.value,
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
this.handleKeyPressed = (event : any) => {
|
|
43
|
-
if (event.key === "Enter") {
|
|
44
|
-
this.stopWaiting(this.state.value);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
this.stopWaiting = (value :string) => {
|
|
49
|
-
clearTimeout(this.timeout);
|
|
50
|
-
|
|
51
|
-
this.setState({
|
|
52
|
-
isWaiting: false,
|
|
53
|
-
value,
|
|
54
|
-
}, () => {
|
|
55
|
-
this.props.change({
|
|
56
|
-
target: {
|
|
57
|
-
value,
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
this.delayChange = ({ target : { value } }) => {
|
|
64
|
-
clearTimeout(this.timeout);
|
|
65
|
-
|
|
66
|
-
if (value === "") {
|
|
67
|
-
this.stopWaiting(value);
|
|
68
|
-
} else {
|
|
69
|
-
const that = this;
|
|
70
|
-
|
|
71
|
-
that.setState({
|
|
72
|
-
isWaiting: true,
|
|
73
|
-
value,
|
|
74
|
-
}, () => {
|
|
75
|
-
|
|
76
|
-
that.timeout = setTimeout(() => {
|
|
77
|
-
that.setState({
|
|
78
|
-
isWaiting: false,
|
|
79
|
-
});
|
|
80
|
-
that.props.change({
|
|
81
|
-
target: {
|
|
82
|
-
value,
|
|
83
|
-
},
|
|
84
|
-
});
|
|
85
|
-
}, this.props.delay || delay);
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
UNSAFE_componentWillReceiveProps (nextProps : TypeInputPropTypes) {
|
|
92
|
-
if (this.props.value !== nextProps.value) {
|
|
93
|
-
this.setState({
|
|
94
|
-
value: nextProps.value,
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
shouldComponentUpdate (nextProps : TypeInputPropTypes, nextState :TypeInputStateTypes) {
|
|
100
|
-
return (
|
|
101
|
-
this.props.value !== nextProps.value ||
|
|
102
|
-
this.state.value !== nextState.value ||
|
|
103
|
-
this.state.isWaiting !== nextState.isWaiting
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
render () {
|
|
108
|
-
const { value, isWaiting } = this.state;
|
|
109
|
-
|
|
110
|
-
const { tabIndex } = this.props;
|
|
111
|
-
|
|
112
|
-
return (
|
|
113
|
-
<div className="delay-input">
|
|
114
|
-
<input
|
|
115
|
-
{...this.props}
|
|
116
|
-
change=""
|
|
117
|
-
onChange={this.delayChange}
|
|
118
|
-
onKeyPress={this.handleKeyPressed}
|
|
119
|
-
tabIndex={tabIndex}
|
|
120
|
-
value={value}
|
|
121
|
-
/>
|
|
122
|
-
{
|
|
123
|
-
isWaiting ? (
|
|
124
|
-
<LoadingMessage className="loading-spinner d-inline-block" sm />
|
|
125
|
-
) : null
|
|
126
|
-
}
|
|
127
|
-
</div>
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
/* eslint-disable react/prefer-stateless-function, react/require-optimization */
|
|
3
|
-
|
|
4
|
-
type FocusTemplatePropTypes = {
|
|
5
|
-
+autoFocus?: boolean;
|
|
6
|
-
+input: any;
|
|
7
|
-
+label: string;
|
|
8
|
-
+placeholder: string;
|
|
9
|
-
+type: string;
|
|
10
|
-
+meta: {
|
|
11
|
-
submitting: boolean;
|
|
12
|
-
touched: boolean;
|
|
13
|
-
error?: any;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
+onRegisterRef: (callback : (node : any) => void) => void;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
import React from "react";
|
|
20
|
-
|
|
21
|
-
import { InputTemplate } from "./InputTemplate";
|
|
22
|
-
|
|
23
|
-
export class FocusTemplate extends React.Component<FocusTemplatePropTypes> {
|
|
24
|
-
props: FocusTemplatePropTypes;
|
|
25
|
-
|
|
26
|
-
shouldComponentUpdate (nextProps: FocusTemplatePropTypes) {
|
|
27
|
-
return (
|
|
28
|
-
this.props.input !== nextProps.input ||
|
|
29
|
-
this.props.label !== nextProps.label ||
|
|
30
|
-
this.props.meta.submitting !== nextProps.meta.submitting ||
|
|
31
|
-
this.props.meta.touched !== nextProps.meta.touched ||
|
|
32
|
-
this.props.meta.error !== nextProps.meta.error
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
render () {
|
|
37
|
-
return (
|
|
38
|
-
<InputTemplate {...this.props} />
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
}
|