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,57 +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
|
-
+meta: {
|
|
12
|
-
touched: boolean;
|
|
13
|
-
error?: any;
|
|
14
|
-
submitting: boolean;
|
|
15
|
-
};
|
|
16
|
-
+left?: string;
|
|
17
|
-
+right?: string;
|
|
18
|
-
|
|
19
|
-
+onRegisterRef?: (callback : (node : any) => void) => void;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
import React from "react";
|
|
23
|
-
import classnames from "classnames";
|
|
24
|
-
|
|
25
|
-
import { SimpleTextarea } from "./SimpleTextarea";
|
|
26
|
-
|
|
27
|
-
export const TextareaTemplate = (props : InputTemplatePropTypes) => {
|
|
28
|
-
const {
|
|
29
|
-
input,
|
|
30
|
-
label,
|
|
31
|
-
left,
|
|
32
|
-
right,
|
|
33
|
-
meta: { touched, error },
|
|
34
|
-
} = props;
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<div className={classnames("form-group row", { "is-invalid": touched && error })}>
|
|
38
|
-
<label
|
|
39
|
-
className={`${left ? left : "col-md-4"} text-md-right form-control-label`}
|
|
40
|
-
htmlFor={input.name}>
|
|
41
|
-
{label}
|
|
42
|
-
</label>
|
|
43
|
-
<div className={right ? right : "col-md-8"}>
|
|
44
|
-
<SimpleTextarea {...props} />
|
|
45
|
-
<div className="invalid-feedback">
|
|
46
|
-
{
|
|
47
|
-
touched && error && (
|
|
48
|
-
<span>
|
|
49
|
-
{error}
|
|
50
|
-
</span>
|
|
51
|
-
)
|
|
52
|
-
}
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
);
|
|
57
|
-
};
|
package/src/Inputs/Tooltip.jsx
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
type TooltipPropTypes = {
|
|
4
|
-
+long: any;
|
|
5
|
-
+short: any;
|
|
6
|
-
+target: string;
|
|
7
|
-
+placement?: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
type TooltipStateTypes = {
|
|
11
|
-
tooltipOpen: boolean;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
import React from "react";
|
|
15
|
-
import { Tooltip as ReactstrapTooltip } from "reactstrap";
|
|
16
|
-
|
|
17
|
-
export class Tooltip extends React.Component<TooltipPropTypes, TooltipStateTypes> {
|
|
18
|
-
props: TooltipPropTypes;
|
|
19
|
-
state: TooltipStateTypes;
|
|
20
|
-
|
|
21
|
-
toggle: () => void;
|
|
22
|
-
|
|
23
|
-
constructor (props: TooltipPropTypes) {
|
|
24
|
-
super(props);
|
|
25
|
-
|
|
26
|
-
this.state = {
|
|
27
|
-
tooltipOpen: false,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
this.toggle = () => this.setState((prevState) => ({
|
|
31
|
-
tooltipOpen: !prevState.tooltipOpen,
|
|
32
|
-
}));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
shouldComponentUpdate (nextProps: TooltipPropTypes, nextState : TooltipStateTypes) {
|
|
36
|
-
return (
|
|
37
|
-
this.props.long !== nextProps.long ||
|
|
38
|
-
this.props.short !== nextProps.short ||
|
|
39
|
-
this.props.placement !== nextProps.placement ||
|
|
40
|
-
this.props.target !== nextProps.target ||
|
|
41
|
-
this.state.tooltipOpen !== nextState.tooltipOpen
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
render () {
|
|
46
|
-
const { target, short, placement } = this.props;
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<span>
|
|
50
|
-
<span id={`${target}-tooltip`}>{short}</span>
|
|
51
|
-
<ReactstrapTooltip
|
|
52
|
-
isOpen={this.state.tooltipOpen}
|
|
53
|
-
placement={placement}
|
|
54
|
-
target={`${target}-tooltip`}
|
|
55
|
-
toggle={this.toggle}>
|
|
56
|
-
{this.props.long}
|
|
57
|
-
</ReactstrapTooltip>
|
|
58
|
-
</span>
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
}
|
package/src/Inputs/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
export * from "./SimpleInput";
|
|
4
|
-
export * from "./DelayInputChange";
|
|
5
|
-
export * from "./FocusTemplate";
|
|
6
|
-
export * from "./InputTemplate";
|
|
7
|
-
|
|
8
|
-
export * from "./DateTemplate";
|
|
9
|
-
export * from "./DateInput";
|
|
10
|
-
|
|
11
|
-
export * from "./NumericInput";
|
|
12
|
-
export * from "./NumericTemplate";
|
|
13
|
-
|
|
14
|
-
export * from "./TextareaTemplate";
|
|
15
|
-
export * from "./SimpleTextarea";
|
|
16
|
-
|
|
17
|
-
export * from "./CaptchaBox";
|
|
18
|
-
export * from "./LabelTemplate";
|
|
19
|
-
export * from "./Tooltip";
|
|
20
|
-
|
|
21
|
-
export * from "./Selects";
|
|
22
|
-
export * from "./Business";
|
package/src/Messages/Error.jsx
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
type ErrorMessageProps = {
|
|
4
|
-
+message: string;
|
|
5
|
-
+details?: string;
|
|
6
|
-
+itemNotFound?: boolean;
|
|
7
|
-
|
|
8
|
-
+onRetry?: () => void;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import React from "react";
|
|
13
|
-
|
|
14
|
-
export const ErrorMessage = ({ message, onRetry } : ErrorMessageProps) => (
|
|
15
|
-
<div className="container alert alert-warning">
|
|
16
|
-
<div className="row">
|
|
17
|
-
<div className="col-2 col-sm-1">
|
|
18
|
-
<i className="fa fa-exclamation-triangle fa-2x" />
|
|
19
|
-
</div>
|
|
20
|
-
<div className="col-7 col-sm-8">
|
|
21
|
-
<h5>
|
|
22
|
-
{message}
|
|
23
|
-
</h5>
|
|
24
|
-
</div>
|
|
25
|
-
<div className="col-3 col-sm-3 text-right">
|
|
26
|
-
{
|
|
27
|
-
(typeof onRetry === "undefined") ? null : (
|
|
28
|
-
<button
|
|
29
|
-
className="btn btn-primary btn-sm"
|
|
30
|
-
onClick={onRetry}
|
|
31
|
-
type="button">
|
|
32
|
-
<span className="hidden-sm-down">
|
|
33
|
-
{"Reîncearcă"}
|
|
34
|
-
</span>
|
|
35
|
-
<span className="visible-up d-md-none">
|
|
36
|
-
<i className="fa fa-refresh" />
|
|
37
|
-
</span>
|
|
38
|
-
</button>
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
export const LargeErrorMessage = ({ message, onRetry, details, itemNotFound } : ErrorMessageProps) => (
|
|
47
|
-
<div className="container mt-5" >
|
|
48
|
-
<div className="row">
|
|
49
|
-
<div className="offset-md-1 offset-xl-2 col-md-2 col-xl-1 text-warning text-center">
|
|
50
|
-
<i className="fa fa-exclamation-triangle fa-5x" />
|
|
51
|
-
</div>
|
|
52
|
-
<div className="col-md-8 col-xl-5">
|
|
53
|
-
<h3>
|
|
54
|
-
{message}
|
|
55
|
-
</h3>
|
|
56
|
-
<div className="mt-3 text-muted">
|
|
57
|
-
{
|
|
58
|
-
itemNotFound ? (
|
|
59
|
-
"Este posibil să fi fost șters(ă) sau să nu fi existat vreodată"
|
|
60
|
-
) : (
|
|
61
|
-
details || (
|
|
62
|
-
`Se pare că a apărut o problemă cu serverul sau
|
|
63
|
-
conexiunea ta de Internet a fost întreruptă`
|
|
64
|
-
)
|
|
65
|
-
)
|
|
66
|
-
}
|
|
67
|
-
</div>
|
|
68
|
-
<div className="text-right mt-3">
|
|
69
|
-
{
|
|
70
|
-
(typeof onRetry === "undefined") ? null : (
|
|
71
|
-
<button
|
|
72
|
-
className="btn btn-primary"
|
|
73
|
-
onClick={onRetry}
|
|
74
|
-
type="button">
|
|
75
|
-
{"Reîncearcă"}
|
|
76
|
-
</button>
|
|
77
|
-
)
|
|
78
|
-
}
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
);
|
package/src/Messages/Loading.jsx
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
type LoadingMessagePropTypes = {
|
|
4
|
-
+className? : string;
|
|
5
|
-
+message? : string;
|
|
6
|
-
+sm?: bool;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import React from "react";
|
|
11
|
-
|
|
12
|
-
export const LoadingMessage = ({ message, sm, className } : LoadingMessagePropTypes) => {
|
|
13
|
-
|
|
14
|
-
const isSmall = sm === true;
|
|
15
|
-
|
|
16
|
-
const getMessage = () => {
|
|
17
|
-
if (message === "") {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return message;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
if (isSmall) {
|
|
25
|
-
return (
|
|
26
|
-
<div className={`text-center ${className || ""} mb-1`}>
|
|
27
|
-
<div className="font-weight-bold d-inline">
|
|
28
|
-
{getMessage()}
|
|
29
|
-
</div>
|
|
30
|
-
<div className="loading-sm d-inline-block"><div /><div /><div /><div /></div>
|
|
31
|
-
</div>
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<div className={`text-center my-4 ${className || ""}`}>
|
|
37
|
-
<div className="spinner-border text-primary" role="status">
|
|
38
|
-
<span className="sr-only">{"Se încarcă..."}</span>
|
|
39
|
-
</div>
|
|
40
|
-
<div className="text-fancy mt-1">{message}</div>
|
|
41
|
-
</div>
|
|
42
|
-
);
|
|
43
|
-
};
|
package/src/Messages/index.jsx
DELETED
package/src/Modal/Delete.jsx
DELETED
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
/* eslint-disable handle-callback-err, react/forbid-component-props, no-console */
|
|
3
|
-
|
|
4
|
-
import type { Dispatch } from "src\\types";
|
|
5
|
-
|
|
6
|
-
type onConfirmMethodsTypes = {
|
|
7
|
-
startPerforming: () => void;
|
|
8
|
-
endPerforming: (cb : any) => void;
|
|
9
|
-
closeModal: () => void;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
type ConfirmPropTypes = {
|
|
13
|
-
+cancelButtonLabel: ?string;
|
|
14
|
-
+confirmButtonLabel: ?string;
|
|
15
|
-
+message: any;
|
|
16
|
-
+errMessage?: string;
|
|
17
|
-
+focusButton: boolean;
|
|
18
|
-
+title?: string;
|
|
19
|
-
+confirmButtonColor?: "primary" | "secondary" | "danger" | "success" | "link" | "info" | "warning";
|
|
20
|
-
|
|
21
|
-
+onConfirm: (methods : onConfirmMethodsTypes) => () => void;
|
|
22
|
-
+closeModal: () => void;
|
|
23
|
-
+showError: (message? : string) => void;
|
|
24
|
-
+request: () => Promise<*>;
|
|
25
|
-
+onSuccess: (response : any) => void;
|
|
26
|
-
+isResponseValid: (response : any) => {
|
|
27
|
-
valid: boolean;
|
|
28
|
-
error: string;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
type ConfirmStateTypes = {
|
|
33
|
-
isPerforming: boolean,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
import React from "react";
|
|
37
|
-
import { connect } from "react-redux";
|
|
38
|
-
import { Button, Modal, ModalBody, ModalFooter, ModalHeader } from "reactstrap";
|
|
39
|
-
|
|
40
|
-
import { language } from "../utility";
|
|
41
|
-
|
|
42
|
-
const { message : languageMessage, label } = language;
|
|
43
|
-
|
|
44
|
-
import * as actions from "./actions";
|
|
45
|
-
import * as x25Actions from "../actions";
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
mapDispatchToProps = (dispatch : Dispatch) => ({
|
|
49
|
-
closeModal () {
|
|
50
|
-
dispatch(actions.hideModal());
|
|
51
|
-
},
|
|
52
|
-
showError (errMessage) {
|
|
53
|
-
dispatch(x25Actions.notifyError(errMessage));
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
class Confirm extends React.Component<ConfirmPropTypes, ConfirmStateTypes> {
|
|
58
|
-
|
|
59
|
-
/* eslint-disable max-statements */
|
|
60
|
-
|
|
61
|
-
static defaultProps = {
|
|
62
|
-
errMessage : languageMessage.failPerform,
|
|
63
|
-
title : label.confirmation,
|
|
64
|
-
cancelButtonLabel : label.cancel,
|
|
65
|
-
confirmButtonColor : "danger",
|
|
66
|
-
confirmButtonLabel : label.remove,
|
|
67
|
-
focusButton : true,
|
|
68
|
-
|
|
69
|
-
isResponseValid: (response : any) => ({
|
|
70
|
-
valid : response === "",
|
|
71
|
-
error : response,
|
|
72
|
-
}),
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
props: ConfirmPropTypes;
|
|
76
|
-
|
|
77
|
-
state: ConfirmStateTypes;
|
|
78
|
-
|
|
79
|
-
field: any;
|
|
80
|
-
|
|
81
|
-
endPerforming: () => void;
|
|
82
|
-
handleConfirmation: (startPerforming: any, endPerforming: any) => void;
|
|
83
|
-
handleConfirmButton: (node : any) => void;
|
|
84
|
-
startPerforming: () => void;
|
|
85
|
-
focusConfirmButton: () => any;
|
|
86
|
-
|
|
87
|
-
constructor (props : ConfirmPropTypes) {
|
|
88
|
-
|
|
89
|
-
super(props);
|
|
90
|
-
|
|
91
|
-
const that = this;
|
|
92
|
-
|
|
93
|
-
this.state = {
|
|
94
|
-
isPerforming: false,
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
this.handleConfirmButton = (node : any) => {
|
|
98
|
-
this.field = node;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
this.focusConfirmButton = () => setTimeout(() => {
|
|
102
|
-
const { focusButton } = this.props;
|
|
103
|
-
|
|
104
|
-
if (focusButton) {
|
|
105
|
-
setTimeout(() => {
|
|
106
|
-
const { field } = this;
|
|
107
|
-
|
|
108
|
-
if (field && field !== null) {
|
|
109
|
-
field.focus();
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
this.startPerforming = (cb : any) => {
|
|
116
|
-
this.setState({
|
|
117
|
-
isPerforming: true,
|
|
118
|
-
}, cb);
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
this.endPerforming = (cb : any) => this.setState({
|
|
122
|
-
isPerforming: false,
|
|
123
|
-
}, () => {
|
|
124
|
-
|
|
125
|
-
/* eslint-disable callback-return */
|
|
126
|
-
|
|
127
|
-
that.focusConfirmButton();
|
|
128
|
-
|
|
129
|
-
if (typeof cb === "function") {
|
|
130
|
-
cb();
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
const { startPerforming, endPerforming } = this;
|
|
135
|
-
|
|
136
|
-
this.handleConfirmation = () => {
|
|
137
|
-
const {
|
|
138
|
-
request,
|
|
139
|
-
onSuccess,
|
|
140
|
-
closeModal,
|
|
141
|
-
errMessage,
|
|
142
|
-
showError,
|
|
143
|
-
isResponseValid,
|
|
144
|
-
} = this.props;
|
|
145
|
-
|
|
146
|
-
startPerforming(() => {
|
|
147
|
-
request().
|
|
148
|
-
then((response : string) => {
|
|
149
|
-
const { valid, error } = isResponseValid(response);
|
|
150
|
-
|
|
151
|
-
if (valid) {
|
|
152
|
-
closeModal();
|
|
153
|
-
onSuccess(response);
|
|
154
|
-
} else {
|
|
155
|
-
endPerforming();
|
|
156
|
-
showError(error);
|
|
157
|
-
}
|
|
158
|
-
}).
|
|
159
|
-
catch((exception) => {
|
|
160
|
-
endPerforming();
|
|
161
|
-
showError(errMessage);
|
|
162
|
-
// eslint-disable
|
|
163
|
-
console.log("exception", exception);
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
componentDidMount () {
|
|
170
|
-
this.focusConfirmButton();
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
shouldComponentUpdate (nextProps : ConfirmPropTypes, nextState : ConfirmStateTypes) {
|
|
174
|
-
return (
|
|
175
|
-
this.props.cancelButtonLabel !== nextProps.cancelButtonLabel ||
|
|
176
|
-
this.props.confirmButtonLabel !== nextProps.confirmButtonLabel ||
|
|
177
|
-
this.props.focusButton !== nextProps.focusButton ||
|
|
178
|
-
this.props.title !== nextProps.title ||
|
|
179
|
-
this.props.confirmButtonColor !== nextProps.confirmButtonColor ||
|
|
180
|
-
|
|
181
|
-
this.state.isPerforming !== nextState.isPerforming
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
render () {
|
|
186
|
-
|
|
187
|
-
const { isPerforming } = this.state;
|
|
188
|
-
|
|
189
|
-
const {
|
|
190
|
-
cancelButtonLabel,
|
|
191
|
-
confirmButtonLabel,
|
|
192
|
-
message,
|
|
193
|
-
title,
|
|
194
|
-
confirmButtonColor,
|
|
195
|
-
closeModal,
|
|
196
|
-
} = this.props;
|
|
197
|
-
|
|
198
|
-
const getConfirmButtonText = () => {
|
|
199
|
-
if (isPerforming) {
|
|
200
|
-
return (
|
|
201
|
-
<span>
|
|
202
|
-
<i className="fa fa-refresh fa-spin fa-fw" />
|
|
203
|
-
{" Așteaptă"}
|
|
204
|
-
</span>
|
|
205
|
-
);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return confirmButtonLabel;
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
return (
|
|
212
|
-
<Modal autoFocus={!this.props.focusButton} isOpen toggle={closeModal} zIndex="1061">
|
|
213
|
-
<ModalHeader toggle={closeModal}>
|
|
214
|
-
{title}
|
|
215
|
-
</ModalHeader>
|
|
216
|
-
<ModalBody>
|
|
217
|
-
{message}
|
|
218
|
-
</ModalBody>
|
|
219
|
-
<ModalFooter>
|
|
220
|
-
<Button className="mr-1" color="secondary" onClick={closeModal}>
|
|
221
|
-
{cancelButtonLabel}
|
|
222
|
-
</Button>
|
|
223
|
-
<button
|
|
224
|
-
className={`btn ${confirmButtonColor ? `btn-${confirmButtonColor}` : ""}`}
|
|
225
|
-
disabled={isPerforming}
|
|
226
|
-
onClick={this.handleConfirmation}
|
|
227
|
-
ref={this.handleConfirmButton}
|
|
228
|
-
type="button">
|
|
229
|
-
{getConfirmButtonText()}
|
|
230
|
-
</button>
|
|
231
|
-
</ModalFooter>
|
|
232
|
-
</Modal>
|
|
233
|
-
);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
export default connect(null, mapDispatchToProps)(Confirm);
|
package/src/Modal/Root.jsx
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import type { State } from "src\\types";
|
|
4
|
-
|
|
5
|
-
type ModalRootPropTypes = {
|
|
6
|
-
+list: any;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
import { connect } from "react-redux";
|
|
10
|
-
import React from "react";
|
|
11
|
-
|
|
12
|
-
import getComponent from "./getComponent";
|
|
13
|
-
|
|
14
|
-
import { selectors } from "./reducer";
|
|
15
|
-
|
|
16
|
-
const mapStateToProps = (state : State) => ({
|
|
17
|
-
list: selectors.getModals(state),
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
class ModalRoot extends React.Component<ModalRootPropTypes> {
|
|
21
|
-
|
|
22
|
-
props: ModalRootPropTypes;
|
|
23
|
-
|
|
24
|
-
shouldComponentUpdate (nextProps : ModalRootPropTypes) {
|
|
25
|
-
return this.props.list !== nextProps.list;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
render () {
|
|
29
|
-
const { list } = this.props;
|
|
30
|
-
|
|
31
|
-
if (list.size === 0) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
list.map((current, index) => {
|
|
37
|
-
const
|
|
38
|
-
modalType = current.get("type"),
|
|
39
|
-
Component = getComponent(modalType);
|
|
40
|
-
|
|
41
|
-
if (typeof Component === "undefined") {
|
|
42
|
-
return (
|
|
43
|
-
<div>
|
|
44
|
-
{`No MODAL component for the type [${modalType}] in Modal/components.jsx`}
|
|
45
|
-
</div>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<Component key={index} {...current.get("props").toJS()} />
|
|
51
|
-
);
|
|
52
|
-
})
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export default connect(mapStateToProps)(ModalRoot);
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import type { Dispatch } from "src\\types";
|
|
4
|
-
|
|
5
|
-
type SimpleModalPropTypes = {
|
|
6
|
-
+size?: string;
|
|
7
|
-
+title: string;
|
|
8
|
-
+children: any;
|
|
9
|
-
|
|
10
|
-
+hideModal: () => void;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
import { connect } from "react-redux";
|
|
14
|
-
import React from "react";
|
|
15
|
-
import { Modal, ModalBody, ModalHeader } from "reactstrap";
|
|
16
|
-
|
|
17
|
-
import { hideModal as hideModalAction } from "./actions";
|
|
18
|
-
|
|
19
|
-
import { delay } from "../utility";
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
mapDispatchToProps = (dispatch : Dispatch, { cbHideModal }) => ({
|
|
23
|
-
hideModal () {
|
|
24
|
-
delay().
|
|
25
|
-
then(() => {
|
|
26
|
-
dispatch(hideModalAction());
|
|
27
|
-
}).
|
|
28
|
-
then(() => {
|
|
29
|
-
if (typeof cbHideModal === "function") {
|
|
30
|
-
cbHideModal();
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const SimpleModal = ({ hideModal, children, size, title } : SimpleModalPropTypes) => (
|
|
37
|
-
<Modal autoFocus isOpen size={size} toggle={hideModal} zIndex="1061">
|
|
38
|
-
<ModalHeader toggle={hideModal}>
|
|
39
|
-
{ title }
|
|
40
|
-
</ModalHeader>
|
|
41
|
-
<ModalBody>
|
|
42
|
-
{ children }
|
|
43
|
-
</ModalBody>
|
|
44
|
-
</Modal>
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
export default connect(null, mapDispatchToProps)(SimpleModal);
|
package/src/Modal/actions.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
|
|
5
|
-
import { getModal } from "./util";
|
|
6
|
-
|
|
7
|
-
import { ErrorMessage } from "../Messages";
|
|
8
|
-
import SimpleModal from "./SimpleModal";
|
|
9
|
-
|
|
10
|
-
const NothingSelected = () => (
|
|
11
|
-
<SimpleModal title="Not registred">
|
|
12
|
-
<ErrorMessage
|
|
13
|
-
message="Please define a modal component in Modal/components.jsx"
|
|
14
|
-
/>
|
|
15
|
-
</SimpleModal>
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
/* eslint-disable complexity */
|
|
19
|
-
const getComponent = (type : any) : any => {
|
|
20
|
-
const AutoModal = getModal(type);
|
|
21
|
-
|
|
22
|
-
if (AutoModal !== null) {
|
|
23
|
-
return AutoModal;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
NothingSelected
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default getComponent;
|