x25 5.1.13 → 5.1.16
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/Inputs/DateInput.js +100 -132
- package/Inputs/DateTemplate.js +129 -159
- package/Inputs/NumericInput.js +3 -4
- package/Inputs/NumericTemplate.js +3 -4
- package/package.json +1 -1
package/Inputs/DateInput.js
CHANGED
|
@@ -7,7 +7,27 @@ exports.DateInput = undefined;
|
|
|
7
7
|
|
|
8
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
9
|
|
|
10
|
-
var
|
|
10
|
+
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); /* eslint-disable react/no-unsafe */
|
|
11
|
+
|
|
12
|
+
// type DateInputPropTypes = {
|
|
13
|
+
// readonly customClass?: any;
|
|
14
|
+
// readonly input: any;
|
|
15
|
+
// readonly meta: {
|
|
16
|
+
// error?: string;
|
|
17
|
+
// submitting: boolean;
|
|
18
|
+
// touched: boolean;
|
|
19
|
+
// };
|
|
20
|
+
// readonly placeholder?: string;
|
|
21
|
+
// readonly value?: string;
|
|
22
|
+
// readonly tabIndex?: string;
|
|
23
|
+
// readonly currency?: boolean;
|
|
24
|
+
// readonly formatValue: (raw: string) => string;
|
|
25
|
+
// readonly normalizeValue: (raw: string) => any;
|
|
26
|
+
// readonly onBlur?: () => void;
|
|
27
|
+
// readonly onChange?: (event: any) => void;
|
|
28
|
+
// readonly onRegisterRef?: (callback: (node: any) => void) => void;
|
|
29
|
+
// }
|
|
30
|
+
|
|
11
31
|
|
|
12
32
|
var _react = require("react");
|
|
13
33
|
|
|
@@ -19,30 +39,44 @@ var _classnames2 = _interopRequireDefault(_classnames);
|
|
|
19
39
|
|
|
20
40
|
var _utility = require("../utility");
|
|
21
41
|
|
|
42
|
+
var _validation = require("../utility/validation");
|
|
43
|
+
|
|
22
44
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
45
|
|
|
24
|
-
|
|
46
|
+
var addZeroIfNeeded = function addZeroIfNeeded(raw) {
|
|
25
47
|
|
|
26
|
-
|
|
48
|
+
var nrOfElements = 3,
|
|
49
|
+
canAddZero = typeof raw === "string" && raw.split(".").length === nrOfElements;
|
|
27
50
|
|
|
28
|
-
|
|
29
|
-
|
|
51
|
+
if (!canAddZero) {
|
|
52
|
+
return raw;
|
|
53
|
+
}
|
|
30
54
|
|
|
31
|
-
var
|
|
55
|
+
var perform = function perform(value) {
|
|
56
|
+
return value.length === 1 ? "0" + value : value;
|
|
57
|
+
},
|
|
58
|
+
parts = raw.split("."),
|
|
59
|
+
part1 = perform(parts[0]),
|
|
60
|
+
part2 = perform(parts[1]),
|
|
61
|
+
_parts = _slicedToArray(parts, 3),
|
|
62
|
+
part3 = _parts[2],
|
|
63
|
+
newValue = [part1, part2, part3].join(".");
|
|
32
64
|
|
|
33
|
-
/* eslint-disable no-magic-numbers */
|
|
34
65
|
|
|
35
|
-
if ((0,
|
|
36
|
-
return
|
|
66
|
+
if ((0, _validation.isValidDate)(newValue)) {
|
|
67
|
+
return newValue;
|
|
37
68
|
}
|
|
38
69
|
|
|
39
70
|
return raw;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
71
|
+
},
|
|
72
|
+
normalizeRawDate = function normalizeRawDate(raw) {
|
|
73
|
+
if ((0, _validation.isValidDate)(raw)) {
|
|
74
|
+
return (0, _utility.normalizeDate)(raw);
|
|
75
|
+
}
|
|
45
76
|
|
|
77
|
+
return "";
|
|
78
|
+
},
|
|
79
|
+
formatRawDate = function formatRawDate(raw) {
|
|
46
80
|
if (typeof raw !== "undefined") {
|
|
47
81
|
return (0, _utility.formatDate)(raw);
|
|
48
82
|
}
|
|
@@ -50,123 +84,57 @@ var formatRawDate = function formatRawDate(raw) {
|
|
|
50
84
|
return "";
|
|
51
85
|
};
|
|
52
86
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
}));
|
|
87
|
+
// eslint-disable-next-line no-undef
|
|
88
|
+
var DateInput = exports.DateInput = function DateInput(props) {
|
|
89
|
+
var customClass = props.customClass,
|
|
90
|
+
input = props.input,
|
|
91
|
+
onRegisterRef = props.onRegisterRef,
|
|
92
|
+
tabIndex = props.tabIndex,
|
|
93
|
+
placeholder = props.placeholder,
|
|
94
|
+
_props$meta = props.meta,
|
|
95
|
+
submitting = _props$meta.submitting,
|
|
96
|
+
touched = _props$meta.touched,
|
|
97
|
+
error = _props$meta.error,
|
|
98
|
+
_React$useState = _react2.default.useState(input.value),
|
|
99
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
100
|
+
value = _React$useState2[0],
|
|
101
|
+
setValue = _React$useState2[1],
|
|
102
|
+
valueToShow = formatRawDate(value),
|
|
103
|
+
updateValue = function updateValue(targetValue) {
|
|
104
|
+
|
|
105
|
+
var normalizedValue = normalizeRawDate(addZeroIfNeeded(targetValue));
|
|
106
|
+
|
|
107
|
+
setValue(targetValue);
|
|
108
|
+
props.input.onChange(normalizedValue);
|
|
109
|
+
},
|
|
110
|
+
handleBlur = function handleBlur(_ref) {
|
|
111
|
+
var targetValue = _ref.target.value;
|
|
112
|
+
|
|
113
|
+
var newValue = addZeroIfNeeded(targetValue),
|
|
114
|
+
hasChanged = targetValue !== newValue;
|
|
115
|
+
|
|
116
|
+
if (hasChanged) {
|
|
117
|
+
updateValue(newValue);
|
|
163
118
|
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
119
|
+
},
|
|
120
|
+
handleChange = function handleChange(_ref2) {
|
|
121
|
+
var targetValue = _ref2.target.value;
|
|
122
|
+
|
|
123
|
+
updateValue(targetValue);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
return _react2.default.createElement("input", _extends({}, input, {
|
|
127
|
+
className: (0, _classnames2.default)("form-control " + (customClass || ""), {
|
|
128
|
+
"is-invalid": touched && error
|
|
129
|
+
}),
|
|
130
|
+
disabled: submitting,
|
|
131
|
+
id: input.name,
|
|
132
|
+
onBlur: handleBlur,
|
|
133
|
+
onChange: handleChange,
|
|
134
|
+
placeholder: placeholder || _utility.words.DateFormat,
|
|
135
|
+
ref: onRegisterRef,
|
|
136
|
+
tabIndex: tabIndex,
|
|
137
|
+
type: "text",
|
|
138
|
+
value: valueToShow
|
|
139
|
+
}));
|
|
172
140
|
};
|
package/Inputs/DateTemplate.js
CHANGED
|
@@ -7,7 +7,28 @@ exports.DateTemplate = undefined;
|
|
|
7
7
|
|
|
8
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
9
|
|
|
10
|
-
var
|
|
10
|
+
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); // type DateInputPropTypes = {
|
|
11
|
+
// readonly customClass?: any;
|
|
12
|
+
// readonly input: any;
|
|
13
|
+
// readonly meta: {
|
|
14
|
+
// error?: string;
|
|
15
|
+
// submitting: boolean;
|
|
16
|
+
// touched: boolean;
|
|
17
|
+
// };
|
|
18
|
+
// readonly placeholder?: string;
|
|
19
|
+
// readonly value?: string;
|
|
20
|
+
// readonly tabIndex?: string;
|
|
21
|
+
// readonly currency?: boolean;
|
|
22
|
+
// readonly formatValue: (raw: string) => string;
|
|
23
|
+
// readonly normalizeValue: (raw: string) => any;
|
|
24
|
+
// readonly onBlur?: () => void;
|
|
25
|
+
// readonly onChange?: (event: any) => void;
|
|
26
|
+
// readonly onRegisterRef?: (callback: (node: any) => void) => void;
|
|
27
|
+
// right?: string;
|
|
28
|
+
// left?: string;
|
|
29
|
+
// label:string;
|
|
30
|
+
// }
|
|
31
|
+
|
|
11
32
|
|
|
12
33
|
var _react = require("react");
|
|
13
34
|
|
|
@@ -19,30 +40,43 @@ var _classnames2 = _interopRequireDefault(_classnames);
|
|
|
19
40
|
|
|
20
41
|
var _utility = require("../utility");
|
|
21
42
|
|
|
22
|
-
|
|
43
|
+
var _validation = require("../utility/validation");
|
|
23
44
|
|
|
24
|
-
function
|
|
45
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
46
|
|
|
26
|
-
|
|
47
|
+
var addZeroIfNeeded = function addZeroIfNeeded(raw) {
|
|
48
|
+
var nrOfElements = 3,
|
|
49
|
+
canAddZero = typeof raw === "string" && raw.split(".").length === nrOfElements;
|
|
27
50
|
|
|
28
|
-
|
|
29
|
-
|
|
51
|
+
if (!canAddZero) {
|
|
52
|
+
return raw;
|
|
53
|
+
}
|
|
30
54
|
|
|
31
|
-
var
|
|
55
|
+
var perform = function perform(value) {
|
|
56
|
+
return value.length === 1 ? "0" + value : value;
|
|
57
|
+
},
|
|
58
|
+
parts = raw.split("."),
|
|
59
|
+
part1 = perform(parts[0]),
|
|
60
|
+
part2 = perform(parts[1]),
|
|
61
|
+
_parts = _slicedToArray(parts, 3),
|
|
62
|
+
part3 = _parts[2],
|
|
63
|
+
newValue = [part1, part2, part3].join(".");
|
|
32
64
|
|
|
33
|
-
/* eslint-disable no-magic-numbers */
|
|
34
65
|
|
|
35
|
-
if ((0,
|
|
36
|
-
return
|
|
66
|
+
if ((0, _validation.isValidDate)(newValue)) {
|
|
67
|
+
return newValue;
|
|
37
68
|
}
|
|
38
69
|
|
|
39
70
|
return raw;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
71
|
+
},
|
|
72
|
+
normalizeRawDate = function normalizeRawDate(raw) {
|
|
73
|
+
if ((0, _validation.isValidDate)(raw)) {
|
|
74
|
+
return (0, _utility.normalizeDate)(raw);
|
|
75
|
+
}
|
|
45
76
|
|
|
77
|
+
return "";
|
|
78
|
+
},
|
|
79
|
+
formatRawDate = function formatRawDate(raw) {
|
|
46
80
|
if (typeof raw !== "undefined") {
|
|
47
81
|
return (0, _utility.formatDate)(raw);
|
|
48
82
|
}
|
|
@@ -50,151 +84,87 @@ var formatRawDate = function formatRawDate(raw) {
|
|
|
50
84
|
return "";
|
|
51
85
|
};
|
|
52
86
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
}
|
|
87
|
+
// eslint-disable-next-line no-undef
|
|
88
|
+
var DateTemplate = exports.DateTemplate = function DateTemplate(props) {
|
|
89
|
+
var customClass = props.customClass,
|
|
90
|
+
input = props.input,
|
|
91
|
+
onRegisterRef = props.onRegisterRef,
|
|
92
|
+
tabIndex = props.tabIndex,
|
|
93
|
+
placeholder = props.placeholder,
|
|
94
|
+
_props$meta = props.meta,
|
|
95
|
+
submitting = _props$meta.submitting,
|
|
96
|
+
touched = _props$meta.touched,
|
|
97
|
+
error = _props$meta.error,
|
|
98
|
+
right = props.right,
|
|
99
|
+
left = props.left,
|
|
100
|
+
label = props.label,
|
|
101
|
+
_React$useState = _react2.default.useState(input.value),
|
|
102
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
103
|
+
value = _React$useState2[0],
|
|
104
|
+
setValue = _React$useState2[1],
|
|
105
|
+
valueToShow = formatRawDate(value),
|
|
106
|
+
updateValue = function updateValue(targetValue) {
|
|
107
|
+
|
|
108
|
+
var normalizedValue = normalizeRawDate(addZeroIfNeeded(targetValue));
|
|
109
|
+
|
|
110
|
+
setValue(targetValue);
|
|
111
|
+
props.input.onChange(normalizedValue);
|
|
112
|
+
},
|
|
113
|
+
handleBlur = function handleBlur(_ref) {
|
|
114
|
+
var targetValue = _ref.target.value;
|
|
115
|
+
|
|
116
|
+
var newValue = addZeroIfNeeded(targetValue),
|
|
117
|
+
hasChanged = targetValue !== newValue;
|
|
118
|
+
|
|
119
|
+
if (hasChanged) {
|
|
120
|
+
updateValue(newValue);
|
|
131
121
|
}
|
|
132
|
-
},
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
122
|
+
},
|
|
123
|
+
handleChange = function handleChange(_ref2) {
|
|
124
|
+
var targetValue = _ref2.target.value;
|
|
125
|
+
|
|
126
|
+
updateValue(targetValue);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
return _react2.default.createElement(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
className: (0, _classnames2.default)("form-group row", { "is-invalid": touched && error }) },
|
|
133
|
+
_react2.default.createElement(
|
|
134
|
+
"label",
|
|
135
|
+
{
|
|
136
|
+
className: (left ? left : "col-md-4 text-md-right") + " form-control-label",
|
|
137
|
+
htmlFor: input.name },
|
|
138
|
+
label
|
|
139
|
+
),
|
|
140
|
+
_react2.default.createElement(
|
|
141
|
+
"div",
|
|
142
|
+
{ className: right ? right : "col-md-8" },
|
|
143
|
+
_react2.default.createElement("input", _extends({}, input, {
|
|
144
|
+
"aria-label": label,
|
|
145
|
+
className: (0, _classnames2.default)("form-control " + (customClass || ""), {
|
|
146
|
+
"is-invalid": touched && error
|
|
147
|
+
}),
|
|
148
|
+
disabled: submitting,
|
|
149
|
+
id: input.name,
|
|
150
|
+
onBlur: handleBlur,
|
|
151
|
+
onChange: handleChange,
|
|
152
|
+
placeholder: placeholder || _utility.words.DateFormat,
|
|
153
|
+
ref: onRegisterRef,
|
|
154
|
+
tabIndex: tabIndex,
|
|
155
|
+
type: "text",
|
|
156
|
+
value: valueToShow
|
|
157
|
+
})),
|
|
158
|
+
_react2.default.createElement(
|
|
152
159
|
"div",
|
|
153
|
-
{
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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
|
-
)
|
|
160
|
+
{
|
|
161
|
+
className: "invalid-feedback" },
|
|
162
|
+
touched && error && _react2.default.createElement(
|
|
163
|
+
"span",
|
|
164
|
+
null,
|
|
165
|
+
error
|
|
189
166
|
)
|
|
190
|
-
)
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
return DateTemplate;
|
|
195
|
-
}(_react2.default.Component);
|
|
196
|
-
|
|
197
|
-
DateTemplate.defaultProps = {
|
|
198
|
-
formatValue: formatRawDate,
|
|
199
|
-
normalizeValue: normalizeRawDate
|
|
167
|
+
)
|
|
168
|
+
)
|
|
169
|
+
);
|
|
200
170
|
};
|
package/Inputs/NumericInput.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.NumericInput = undefined;
|
|
6
7
|
|
|
7
8
|
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); /* eslint-disable require-unicode-regexp */
|
|
8
9
|
/* eslint-disable no-magic-numbers */
|
|
@@ -22,7 +23,7 @@ var _common = require("./common");
|
|
|
22
23
|
|
|
23
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
25
|
|
|
25
|
-
var NumericInput = function NumericInput(props) {
|
|
26
|
+
var NumericInput = exports.NumericInput = function NumericInput(props) {
|
|
26
27
|
var customClass = props.customClass,
|
|
27
28
|
input = props.input,
|
|
28
29
|
label = props.label,
|
|
@@ -99,6 +100,4 @@ var NumericInput = function NumericInput(props) {
|
|
|
99
100
|
)
|
|
100
101
|
)
|
|
101
102
|
);
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
exports.default = NumericInput;
|
|
103
|
+
};
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.NumericTemplate = undefined;
|
|
6
7
|
|
|
7
8
|
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
|
8
9
|
/* eslint-disable require-unicode-regexp */
|
|
@@ -21,7 +22,7 @@ var _common = require("./common");
|
|
|
21
22
|
|
|
22
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
24
|
|
|
24
|
-
var NumericTemplate = function NumericTemplate(props) {
|
|
25
|
+
var NumericTemplate = exports.NumericTemplate = function NumericTemplate(props) {
|
|
25
26
|
var input = props.input,
|
|
26
27
|
right = props.right,
|
|
27
28
|
tabIndex = props.tabIndex,
|
|
@@ -107,6 +108,4 @@ var NumericTemplate = function NumericTemplate(props) {
|
|
|
107
108
|
)
|
|
108
109
|
)
|
|
109
110
|
);
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
exports.default = NumericTemplate;
|
|
111
|
+
};
|
package/package.json
CHANGED