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
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DateInput = undefined;
|
|
7
|
+
|
|
8
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
9
|
+
|
|
10
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
11
|
+
|
|
12
|
+
var _react = require("react");
|
|
13
|
+
|
|
14
|
+
var _react2 = _interopRequireDefault(_react);
|
|
15
|
+
|
|
16
|
+
var _classnames = require("classnames");
|
|
17
|
+
|
|
18
|
+
var _classnames2 = _interopRequireDefault(_classnames);
|
|
19
|
+
|
|
20
|
+
var _utility = require("../utility");
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
|
+
|
|
26
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
27
|
+
|
|
28
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
29
|
+
/* eslint-disable */
|
|
30
|
+
|
|
31
|
+
var normalizeRawDate = function normalizeRawDate(raw) {
|
|
32
|
+
|
|
33
|
+
/* eslint-disable no-magic-numbers */
|
|
34
|
+
|
|
35
|
+
if ((0, _utility.isValidDate)(raw)) {
|
|
36
|
+
return (0, _utility.normalizeDate)(raw);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return raw;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
var formatRawDate = function formatRawDate(raw) {
|
|
43
|
+
|
|
44
|
+
/* eslint-disable no-magic-numbers */
|
|
45
|
+
|
|
46
|
+
if (typeof raw !== "undefined") {
|
|
47
|
+
return (0, _utility.formatDate)(raw);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return "";
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
var DateInput = exports.DateInput = function (_React$Component) {
|
|
54
|
+
_inherits(DateInput, _React$Component);
|
|
55
|
+
|
|
56
|
+
function DateInput(props) {
|
|
57
|
+
_classCallCheck(this, DateInput);
|
|
58
|
+
|
|
59
|
+
var _this = _possibleConstructorReturn(this, (DateInput.__proto__ || Object.getPrototypeOf(DateInput)).call(this));
|
|
60
|
+
|
|
61
|
+
_this.state = {
|
|
62
|
+
value: formatRawDate(props.input.value)
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
_this.handleKeyDown = function (event) {
|
|
66
|
+
if (event.key === "Enter") {
|
|
67
|
+
_this.handleBlur();
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
_this.handleBlur = function () {
|
|
72
|
+
var onBlur = _this.props.input.onBlur;
|
|
73
|
+
var _this$props = _this.props,
|
|
74
|
+
input = _this$props.input,
|
|
75
|
+
normalizeValue = _this$props.normalizeValue;
|
|
76
|
+
var currentValue = _this.state.value;
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
var normalizedValue = normalizeValue(currentValue),
|
|
80
|
+
shouldRenderAgain = normalizedValue !== "" && currentValue !== normalizedValue;
|
|
81
|
+
|
|
82
|
+
input.onChange(normalizedValue);
|
|
83
|
+
|
|
84
|
+
/*
|
|
85
|
+
* Swallow the event to prevent Redux Form from
|
|
86
|
+
* extracting the form value
|
|
87
|
+
*/
|
|
88
|
+
onBlur();
|
|
89
|
+
|
|
90
|
+
if (shouldRenderAgain) {
|
|
91
|
+
_this.setState({
|
|
92
|
+
value: (0, _utility.formatDate)(normalizedValue)
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
_this.handleChange = function (_ref) {
|
|
98
|
+
var value = _ref.target.value;
|
|
99
|
+
|
|
100
|
+
_this.props.input.onChange();
|
|
101
|
+
|
|
102
|
+
/*
|
|
103
|
+
* Update the internal state to trigger a re-render
|
|
104
|
+
* using the formatted value
|
|
105
|
+
*/
|
|
106
|
+
_this.setState({ value: value });
|
|
107
|
+
};
|
|
108
|
+
return _this;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
_createClass(DateInput, [{
|
|
112
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
113
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
114
|
+
var newValue = nextProps.input.value;
|
|
115
|
+
var currentValue = this.state.value;
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
var shouldRenderAgain = (0, _utility.isValidDate)(newValue) && currentValue !== newValue;
|
|
119
|
+
|
|
120
|
+
if (newValue === "") {
|
|
121
|
+
this.setState({
|
|
122
|
+
value: ""
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (shouldRenderAgain) {
|
|
127
|
+
this.setState({
|
|
128
|
+
value: (0, _utility.formatDate)(newValue)
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}, {
|
|
133
|
+
key: "render",
|
|
134
|
+
value: function render() {
|
|
135
|
+
var _props = this.props,
|
|
136
|
+
customClass = _props.customClass,
|
|
137
|
+
input = _props.input,
|
|
138
|
+
onRegisterRef = _props.onRegisterRef,
|
|
139
|
+
_props$meta = _props.meta,
|
|
140
|
+
submitting = _props$meta.submitting,
|
|
141
|
+
touched = _props$meta.touched,
|
|
142
|
+
error = _props$meta.error,
|
|
143
|
+
tabIndex = _props.tabIndex,
|
|
144
|
+
formatValue = _props.formatValue,
|
|
145
|
+
placeholder = _props.placeholder;
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
return _react2.default.createElement("input", _extends({}, input, {
|
|
149
|
+
className: (0, _classnames2.default)("form-control " + (customClass || ""), {
|
|
150
|
+
"is-invalid": touched && error
|
|
151
|
+
}),
|
|
152
|
+
disabled: submitting,
|
|
153
|
+
id: input.name,
|
|
154
|
+
onBlur: this.handleBlur,
|
|
155
|
+
onChange: this.handleChange,
|
|
156
|
+
onKeyDown: this.handleKeyDown,
|
|
157
|
+
placeholder: placeholder || "ZZ.LL.ANUL",
|
|
158
|
+
ref: onRegisterRef,
|
|
159
|
+
tabIndex: tabIndex,
|
|
160
|
+
type: "text",
|
|
161
|
+
value: formatValue(this.state.value)
|
|
162
|
+
}));
|
|
163
|
+
}
|
|
164
|
+
}]);
|
|
165
|
+
|
|
166
|
+
return DateInput;
|
|
167
|
+
}(_react2.default.Component);
|
|
168
|
+
|
|
169
|
+
DateInput.defaultProps = {
|
|
170
|
+
formatValue: formatRawDate,
|
|
171
|
+
normalizeValue: normalizeRawDate
|
|
172
|
+
};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DateTemplate = undefined;
|
|
7
|
+
|
|
8
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
9
|
+
|
|
10
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
11
|
+
|
|
12
|
+
var _react = require("react");
|
|
13
|
+
|
|
14
|
+
var _react2 = _interopRequireDefault(_react);
|
|
15
|
+
|
|
16
|
+
var _classnames = require("classnames");
|
|
17
|
+
|
|
18
|
+
var _classnames2 = _interopRequireDefault(_classnames);
|
|
19
|
+
|
|
20
|
+
var _utility = require("../utility");
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
|
+
|
|
26
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
27
|
+
|
|
28
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
29
|
+
/* eslint-disable */
|
|
30
|
+
|
|
31
|
+
var normalizeRawDate = function normalizeRawDate(raw) {
|
|
32
|
+
|
|
33
|
+
/* eslint-disable no-magic-numbers */
|
|
34
|
+
|
|
35
|
+
if ((0, _utility.isValidDate)(raw)) {
|
|
36
|
+
return (0, _utility.normalizeDate)(raw);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return raw;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
var formatRawDate = function formatRawDate(raw) {
|
|
43
|
+
|
|
44
|
+
/* eslint-disable no-magic-numbers */
|
|
45
|
+
|
|
46
|
+
if (typeof raw !== "undefined") {
|
|
47
|
+
return (0, _utility.formatDate)(raw);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return "";
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
var DateTemplate = exports.DateTemplate = function (_React$Component) {
|
|
54
|
+
_inherits(DateTemplate, _React$Component);
|
|
55
|
+
|
|
56
|
+
function DateTemplate(props) {
|
|
57
|
+
_classCallCheck(this, DateTemplate);
|
|
58
|
+
|
|
59
|
+
var _this = _possibleConstructorReturn(this, (DateTemplate.__proto__ || Object.getPrototypeOf(DateTemplate)).call(this));
|
|
60
|
+
|
|
61
|
+
_this.state = {
|
|
62
|
+
value: formatRawDate(props.input.value)
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
_this.handleKeyDown = function (event) {
|
|
66
|
+
if (event.key === "Enter") {
|
|
67
|
+
_this.handleBlur();
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
_this.handleBlur = function () {
|
|
72
|
+
var onBlur = _this.props.input.onBlur;
|
|
73
|
+
var _this$props = _this.props,
|
|
74
|
+
input = _this$props.input,
|
|
75
|
+
normalizeValue = _this$props.normalizeValue;
|
|
76
|
+
var currentValue = _this.state.value;
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
var normalizedValue = normalizeValue(currentValue),
|
|
80
|
+
shouldRenderAgain = normalizedValue !== "" && currentValue !== normalizedValue;
|
|
81
|
+
|
|
82
|
+
input.onChange(normalizedValue);
|
|
83
|
+
|
|
84
|
+
/*
|
|
85
|
+
* Swallow the event to prevent Redux Form from
|
|
86
|
+
* extracting the form value
|
|
87
|
+
*/
|
|
88
|
+
onBlur();
|
|
89
|
+
|
|
90
|
+
if (shouldRenderAgain) {
|
|
91
|
+
_this.setState({
|
|
92
|
+
value: (0, _utility.formatDate)(normalizedValue)
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
_this.handleChange = function (_ref) {
|
|
98
|
+
var value = _ref.target.value;
|
|
99
|
+
|
|
100
|
+
_this.props.input.onChange();
|
|
101
|
+
|
|
102
|
+
/*
|
|
103
|
+
* Update the internal state to trigger a re-render
|
|
104
|
+
* using the formatted value
|
|
105
|
+
*/
|
|
106
|
+
_this.setState({ value: value });
|
|
107
|
+
};
|
|
108
|
+
return _this;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
_createClass(DateTemplate, [{
|
|
112
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
113
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
114
|
+
var newValue = nextProps.input.value;
|
|
115
|
+
var currentValue = this.state.value;
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
var shouldRenderAgain = (0, _utility.isValidDate)(newValue) && currentValue !== newValue;
|
|
119
|
+
|
|
120
|
+
if (newValue === "") {
|
|
121
|
+
this.setState({
|
|
122
|
+
value: ""
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (shouldRenderAgain) {
|
|
127
|
+
this.setState({
|
|
128
|
+
value: (0, _utility.formatDate)(newValue)
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}, {
|
|
133
|
+
key: "render",
|
|
134
|
+
value: function render() {
|
|
135
|
+
var _props = this.props,
|
|
136
|
+
customClass = _props.customClass,
|
|
137
|
+
input = _props.input,
|
|
138
|
+
label = _props.label,
|
|
139
|
+
onRegisterRef = _props.onRegisterRef,
|
|
140
|
+
_props$meta = _props.meta,
|
|
141
|
+
submitting = _props$meta.submitting,
|
|
142
|
+
touched = _props$meta.touched,
|
|
143
|
+
error = _props$meta.error,
|
|
144
|
+
left = _props.left,
|
|
145
|
+
right = _props.right,
|
|
146
|
+
tabIndex = _props.tabIndex,
|
|
147
|
+
formatValue = _props.formatValue,
|
|
148
|
+
placeholder = _props.placeholder;
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
return _react2.default.createElement(
|
|
152
|
+
"div",
|
|
153
|
+
{ className: (0, _classnames2.default)("form-group row", { "is-invalid": touched && error }) },
|
|
154
|
+
_react2.default.createElement(
|
|
155
|
+
"label",
|
|
156
|
+
{
|
|
157
|
+
className: (left ? left : "col-md-4 text-md-right") + " form-control-label",
|
|
158
|
+
htmlFor: input.name },
|
|
159
|
+
label
|
|
160
|
+
),
|
|
161
|
+
_react2.default.createElement(
|
|
162
|
+
"div",
|
|
163
|
+
{ className: right ? right : "col-md-8" },
|
|
164
|
+
_react2.default.createElement("input", _extends({}, input, {
|
|
165
|
+
"aria-label": label,
|
|
166
|
+
className: (0, _classnames2.default)("form-control " + (customClass || ""), {
|
|
167
|
+
"is-invalid": touched && error
|
|
168
|
+
}),
|
|
169
|
+
disabled: submitting,
|
|
170
|
+
id: input.name,
|
|
171
|
+
onBlur: this.handleBlur,
|
|
172
|
+
onChange: this.handleChange,
|
|
173
|
+
onKeyDown: this.handleKeyDown,
|
|
174
|
+
placeholder: placeholder || "ZZ.LL.ANUL",
|
|
175
|
+
ref: onRegisterRef,
|
|
176
|
+
tabIndex: tabIndex,
|
|
177
|
+
type: "text",
|
|
178
|
+
value: formatValue(this.state.value)
|
|
179
|
+
})),
|
|
180
|
+
_react2.default.createElement(
|
|
181
|
+
"div",
|
|
182
|
+
{ className: "invalid-feedback" },
|
|
183
|
+
touched && error && _react2.default.createElement(
|
|
184
|
+
"span",
|
|
185
|
+
null,
|
|
186
|
+
error
|
|
187
|
+
)
|
|
188
|
+
)
|
|
189
|
+
)
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
}]);
|
|
193
|
+
|
|
194
|
+
return DateTemplate;
|
|
195
|
+
}(_react2.default.Component);
|
|
196
|
+
|
|
197
|
+
DateTemplate.defaultProps = {
|
|
198
|
+
formatValue: formatRawDate,
|
|
199
|
+
normalizeValue: normalizeRawDate
|
|
200
|
+
};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DelayInputChange = undefined;
|
|
7
|
+
|
|
8
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
9
|
+
|
|
10
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
11
|
+
|
|
12
|
+
var _react = require("react");
|
|
13
|
+
|
|
14
|
+
var _react2 = _interopRequireDefault(_react);
|
|
15
|
+
|
|
16
|
+
var _Messages = require("../Messages");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21
|
+
|
|
22
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
23
|
+
|
|
24
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
25
|
+
/* eslint-disable */
|
|
26
|
+
|
|
27
|
+
var delay = 700;
|
|
28
|
+
|
|
29
|
+
var DelayInputChange = exports.DelayInputChange = function (_React$Component) {
|
|
30
|
+
_inherits(DelayInputChange, _React$Component);
|
|
31
|
+
|
|
32
|
+
function DelayInputChange(props) {
|
|
33
|
+
_classCallCheck(this, DelayInputChange);
|
|
34
|
+
|
|
35
|
+
var _this = _possibleConstructorReturn(this, (DelayInputChange.__proto__ || Object.getPrototypeOf(DelayInputChange)).call(this, props));
|
|
36
|
+
|
|
37
|
+
_this.timeout = null;
|
|
38
|
+
|
|
39
|
+
_this.state = {
|
|
40
|
+
isWaiting: false,
|
|
41
|
+
value: _this.props.value
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
_this.handleKeyPressed = function (event) {
|
|
45
|
+
if (event.key === "Enter") {
|
|
46
|
+
_this.stopWaiting(_this.state.value);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
_this.stopWaiting = function (value) {
|
|
51
|
+
clearTimeout(_this.timeout);
|
|
52
|
+
|
|
53
|
+
_this.setState({
|
|
54
|
+
isWaiting: false,
|
|
55
|
+
value: value
|
|
56
|
+
}, function () {
|
|
57
|
+
_this.props.change({
|
|
58
|
+
target: {
|
|
59
|
+
value: value
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
_this.delayChange = function (_ref) {
|
|
66
|
+
var value = _ref.target.value;
|
|
67
|
+
|
|
68
|
+
clearTimeout(_this.timeout);
|
|
69
|
+
|
|
70
|
+
if (value === "") {
|
|
71
|
+
_this.stopWaiting(value);
|
|
72
|
+
} else {
|
|
73
|
+
var that = _this;
|
|
74
|
+
|
|
75
|
+
that.setState({
|
|
76
|
+
isWaiting: true,
|
|
77
|
+
value: value
|
|
78
|
+
}, function () {
|
|
79
|
+
|
|
80
|
+
that.timeout = setTimeout(function () {
|
|
81
|
+
that.setState({
|
|
82
|
+
isWaiting: false
|
|
83
|
+
});
|
|
84
|
+
that.props.change({
|
|
85
|
+
target: {
|
|
86
|
+
value: value
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}, _this.props.delay || delay);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
return _this;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
_createClass(DelayInputChange, [{
|
|
97
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
98
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
99
|
+
if (this.props.value !== nextProps.value) {
|
|
100
|
+
this.setState({
|
|
101
|
+
value: nextProps.value
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
key: "shouldComponentUpdate",
|
|
107
|
+
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
108
|
+
return this.props.value !== nextProps.value || this.state.value !== nextState.value || this.state.isWaiting !== nextState.isWaiting;
|
|
109
|
+
}
|
|
110
|
+
}, {
|
|
111
|
+
key: "render",
|
|
112
|
+
value: function render() {
|
|
113
|
+
var _state = this.state,
|
|
114
|
+
value = _state.value,
|
|
115
|
+
isWaiting = _state.isWaiting;
|
|
116
|
+
var tabIndex = this.props.tabIndex;
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
return _react2.default.createElement(
|
|
120
|
+
"div",
|
|
121
|
+
{ className: "delay-input" },
|
|
122
|
+
_react2.default.createElement("input", _extends({}, this.props, {
|
|
123
|
+
change: "",
|
|
124
|
+
onChange: this.delayChange,
|
|
125
|
+
onKeyPress: this.handleKeyPressed,
|
|
126
|
+
tabIndex: tabIndex,
|
|
127
|
+
value: value
|
|
128
|
+
})),
|
|
129
|
+
isWaiting ? _react2.default.createElement(_Messages.LoadingMessage, { className: "loading-spinner d-inline-block", sm: true }) : null
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
}]);
|
|
133
|
+
|
|
134
|
+
return DelayInputChange;
|
|
135
|
+
}(_react2.default.Component);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FocusTemplate = undefined;
|
|
7
|
+
|
|
8
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
9
|
+
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
|
|
12
|
+
var _react2 = _interopRequireDefault(_react);
|
|
13
|
+
|
|
14
|
+
var _InputTemplate = require("./InputTemplate");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
19
|
+
|
|
20
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
21
|
+
|
|
22
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
23
|
+
/* eslint-disable react/prefer-stateless-function, react/require-optimization */
|
|
24
|
+
|
|
25
|
+
var FocusTemplate = exports.FocusTemplate = function (_React$Component) {
|
|
26
|
+
_inherits(FocusTemplate, _React$Component);
|
|
27
|
+
|
|
28
|
+
function FocusTemplate() {
|
|
29
|
+
_classCallCheck(this, FocusTemplate);
|
|
30
|
+
|
|
31
|
+
return _possibleConstructorReturn(this, (FocusTemplate.__proto__ || Object.getPrototypeOf(FocusTemplate)).apply(this, arguments));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_createClass(FocusTemplate, [{
|
|
35
|
+
key: "shouldComponentUpdate",
|
|
36
|
+
value: function shouldComponentUpdate(nextProps) {
|
|
37
|
+
return this.props.input !== nextProps.input || this.props.label !== nextProps.label || this.props.meta.submitting !== nextProps.meta.submitting || this.props.meta.touched !== nextProps.meta.touched || this.props.meta.error !== nextProps.meta.error;
|
|
38
|
+
}
|
|
39
|
+
}, {
|
|
40
|
+
key: "render",
|
|
41
|
+
value: function render() {
|
|
42
|
+
return _react2.default.createElement(_InputTemplate.InputTemplate, this.props);
|
|
43
|
+
}
|
|
44
|
+
}]);
|
|
45
|
+
|
|
46
|
+
return FocusTemplate;
|
|
47
|
+
}(_react2.default.Component);
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.InputTemplate = undefined;
|
|
7
|
+
|
|
8
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
9
|
+
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
|
|
12
|
+
var _react2 = _interopRequireDefault(_react);
|
|
13
|
+
|
|
14
|
+
var _classnames = require("classnames");
|
|
15
|
+
|
|
16
|
+
var _classnames2 = _interopRequireDefault(_classnames);
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
var InputTemplate = exports.InputTemplate = function InputTemplate(_ref) {
|
|
21
|
+
var input = _ref.input,
|
|
22
|
+
type = _ref.type,
|
|
23
|
+
label = _ref.label,
|
|
24
|
+
onRegisterRef = _ref.onRegisterRef,
|
|
25
|
+
autoFocus = _ref.autoFocus,
|
|
26
|
+
inputClass = _ref.inputClass,
|
|
27
|
+
divClass = _ref.divClass,
|
|
28
|
+
placeholder = _ref.placeholder,
|
|
29
|
+
left = _ref.left,
|
|
30
|
+
tabIndex = _ref.tabIndex,
|
|
31
|
+
right = _ref.right,
|
|
32
|
+
_ref$meta = _ref.meta,
|
|
33
|
+
submitting = _ref$meta.submitting,
|
|
34
|
+
touched = _ref$meta.touched,
|
|
35
|
+
error = _ref$meta.error;
|
|
36
|
+
|
|
37
|
+
var warningClass = "" + (touched && error ? " is-invalid" : ""),
|
|
38
|
+
customClass = "" + (inputClass ? " " + inputClass : ""),
|
|
39
|
+
classForInput = "form-control " + warningClass + customClass,
|
|
40
|
+
classForDiv = "form-group row mt-md-2 " + (divClass ? divClass : "");
|
|
41
|
+
|
|
42
|
+
return _react2.default.createElement(
|
|
43
|
+
"div",
|
|
44
|
+
{ className: (0, _classnames2.default)(classForDiv, { "is-invalid": touched && error }) },
|
|
45
|
+
_react2.default.createElement(
|
|
46
|
+
"label",
|
|
47
|
+
{
|
|
48
|
+
className: (left ? left : "col-md-4 text-md-right") + " form-control-label",
|
|
49
|
+
htmlFor: input.name },
|
|
50
|
+
label
|
|
51
|
+
),
|
|
52
|
+
_react2.default.createElement(
|
|
53
|
+
"div",
|
|
54
|
+
{ className: right ? right : "col-md-8" },
|
|
55
|
+
_react2.default.createElement("input", _extends({}, 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
|
+
_react2.default.createElement(
|
|
68
|
+
"div",
|
|
69
|
+
{ className: "invalid-feedback" },
|
|
70
|
+
touched && error && _react2.default.createElement(
|
|
71
|
+
"span",
|
|
72
|
+
null,
|
|
73
|
+
error
|
|
74
|
+
)
|
|
75
|
+
)
|
|
76
|
+
)
|
|
77
|
+
);
|
|
78
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.LabelTemplate = undefined;
|
|
7
|
+
|
|
8
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
9
|
+
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
|
|
12
|
+
var _react2 = _interopRequireDefault(_react);
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
var LabelTemplate = exports.LabelTemplate = function LabelTemplate(_ref) {
|
|
17
|
+
var input = _ref.input,
|
|
18
|
+
tabIndex = _ref.tabIndex,
|
|
19
|
+
label = _ref.label,
|
|
20
|
+
offset = _ref.offset,
|
|
21
|
+
_ref$meta = _ref.meta,
|
|
22
|
+
submitting = _ref$meta.submitting,
|
|
23
|
+
touched = _ref$meta.touched,
|
|
24
|
+
error = _ref$meta.error;
|
|
25
|
+
return _react2.default.createElement(
|
|
26
|
+
"div",
|
|
27
|
+
{ className: "container" },
|
|
28
|
+
_react2.default.createElement(
|
|
29
|
+
"div",
|
|
30
|
+
{ className: "form-group row mb-1" },
|
|
31
|
+
_react2.default.createElement(
|
|
32
|
+
"div",
|
|
33
|
+
{ className: (offset || "") + " col custom-control custom-checkbox" },
|
|
34
|
+
_react2.default.createElement("input", _extends({}, input, {
|
|
35
|
+
"aria-label": label,
|
|
36
|
+
className: "custom-control-input",
|
|
37
|
+
disabled: submitting,
|
|
38
|
+
id: input.name,
|
|
39
|
+
tabIndex: tabIndex,
|
|
40
|
+
type: "checkbox"
|
|
41
|
+
})),
|
|
42
|
+
_react2.default.createElement(
|
|
43
|
+
"label",
|
|
44
|
+
{ className: "custom-control-label", htmlFor: input.name },
|
|
45
|
+
label
|
|
46
|
+
),
|
|
47
|
+
_react2.default.createElement(
|
|
48
|
+
"div",
|
|
49
|
+
{ className: "invalid-feedback" },
|
|
50
|
+
touched && error && _react2.default.createElement(
|
|
51
|
+
"span",
|
|
52
|
+
null,
|
|
53
|
+
error
|
|
54
|
+
)
|
|
55
|
+
)
|
|
56
|
+
)
|
|
57
|
+
)
|
|
58
|
+
);
|
|
59
|
+
};
|