x25 17.5.4 → 17.5.6
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.d.ts +1 -1
- package/Inputs/DateInput.js +5 -5
- package/Inputs/DateTemplate.d.ts +1 -1
- package/Inputs/DateTemplate.js +6 -6
- package/Inputs/InputTemplate.d.ts +1 -1
- package/Inputs/InputTemplate.js +3 -3
- package/Inputs/LabelTemplate.d.ts +1 -1
- package/Inputs/LabelTemplate.js +3 -3
- package/Inputs/NumericInput.d.ts +2 -2
- package/Inputs/NumericInput.js +10 -10
- package/Inputs/NumericInput.js.map +1 -1
- package/Inputs/NumericTemplate.d.ts +1 -1
- package/Inputs/NumericTemplate.js +8 -8
- package/Inputs/Selects/Custom.d.ts +1 -1
- package/Inputs/Selects/Custom.js +1 -1
- package/Inputs/Selects/Simple.d.ts +1 -1
- package/Inputs/Selects/Simple.js +3 -3
- package/Inputs/SimpleInput.d.ts +1 -1
- package/Inputs/SimpleInput.js +3 -3
- package/Inputs/SimpleTextarea.d.ts +1 -1
- package/Inputs/SimpleTextarea.js +2 -2
- package/Inputs/TextareaTemplate.d.ts +1 -1
- package/Inputs/TextareaTemplate.js +2 -2
- package/package.json +3 -2
- package/utility/date.d.ts +2 -1
- package/utility/date.js +13 -3
- package/utility/date.js.map +1 -1
package/Inputs/DateInput.d.ts
CHANGED
package/Inputs/DateInput.js
CHANGED
|
@@ -42,23 +42,23 @@ var addZeroIfNeeded = function (raw) {
|
|
|
42
42
|
return "";
|
|
43
43
|
};
|
|
44
44
|
var DateInput = function (props) {
|
|
45
|
-
var customClass = props.customClass, _a = props.
|
|
45
|
+
var customClass = props.customClass, _a = props.input, input = _a === void 0 ? {} : _a, onRegisterRef = props.onRegisterRef, tabIndex = props.tabIndex, placeholder = props.placeholder, _b = props.meta, meta = _b === void 0 ? {} : _b, _c = react_1.default.useState(input.value), value = _c[0], setValue = _c[1], valueToShow = formatRawDate(value), updateValue = function (targetValue) {
|
|
46
46
|
var normalizedValue = normalizeRawDate(addZeroIfNeeded(targetValue));
|
|
47
47
|
setValue(targetValue);
|
|
48
|
-
|
|
48
|
+
input.onChange(normalizedValue);
|
|
49
49
|
}, handleBlur = function (event) {
|
|
50
50
|
var targetValue = event.target.value, newValue = addZeroIfNeeded(targetValue), hasChanged = targetValue !== newValue;
|
|
51
51
|
if (hasChanged) {
|
|
52
52
|
updateValue(newValue);
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
input.onBlur(event);
|
|
55
55
|
}, handleChange = function (_a) {
|
|
56
56
|
var targetValue = _a.target.value;
|
|
57
57
|
updateValue(targetValue);
|
|
58
58
|
};
|
|
59
|
-
return (react_1.default.createElement("input", __assign({},
|
|
59
|
+
return (react_1.default.createElement("input", __assign({}, input, { className: (0, classnames_1.default)("form-control ".concat(customClass || ""), {
|
|
60
60
|
"is-invalid": meta.touched && meta.error,
|
|
61
|
-
}), disabled: meta.submitting, id:
|
|
61
|
+
}), disabled: meta.submitting, id: input.name, onBlur: handleBlur, onChange: handleChange, placeholder: placeholder || utility_1.words.DateFormat, ref: onRegisterRef, tabIndex: tabIndex, type: "text", value: valueToShow })));
|
|
62
62
|
};
|
|
63
63
|
exports.DateInput = DateInput;
|
|
64
64
|
//# sourceMappingURL=DateInput.js.map
|
package/Inputs/DateTemplate.d.ts
CHANGED
package/Inputs/DateTemplate.js
CHANGED
|
@@ -42,26 +42,26 @@ var addZeroIfNeeded = function (raw) {
|
|
|
42
42
|
return "";
|
|
43
43
|
};
|
|
44
44
|
var DateTemplate = function (props) {
|
|
45
|
-
var customClass = props.customClass, _a = props.
|
|
45
|
+
var customClass = props.customClass, _a = props.input, input = _a === void 0 ? {} : _a, onRegisterRef = props.onRegisterRef, tabIndex = props.tabIndex, placeholder = props.placeholder, _b = props.meta, meta = _b === void 0 ? {} : _b, right = props.right, left = props.left, label = props.label, _c = react_1.default.useState(input.value), value = _c[0], setValue = _c[1], valueToShow = formatRawDate(value), updateValue = function (targetValue) {
|
|
46
46
|
var normalizedValue = normalizeRawDate(addZeroIfNeeded(targetValue));
|
|
47
47
|
setValue(targetValue);
|
|
48
|
-
|
|
48
|
+
input.onChange(normalizedValue);
|
|
49
49
|
}, handleBlur = function (event) {
|
|
50
50
|
var targetValue = event.target.value, newValue = addZeroIfNeeded(targetValue), hasChanged = targetValue !== newValue;
|
|
51
51
|
if (hasChanged) {
|
|
52
52
|
updateValue(newValue);
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
input.onBlur(event);
|
|
55
55
|
}, handleChange = function (_a) {
|
|
56
56
|
var targetValue = _a.target.value;
|
|
57
57
|
updateValue(targetValue);
|
|
58
58
|
};
|
|
59
59
|
return (react_1.default.createElement("div", { className: (0, classnames_1.default)("form-group mt-md-2 row d-flex", { "is-invalid": meta.touched && meta.error }) },
|
|
60
|
-
react_1.default.createElement("label", { className: "".concat(left ? "".concat(left, " align-self-center") : "col-md-4 text-md-end", " form-control-label"), htmlFor:
|
|
60
|
+
react_1.default.createElement("label", { className: "".concat(left ? "".concat(left, " align-self-center") : "col-md-4 text-md-end", " form-control-label"), htmlFor: input.name }, label),
|
|
61
61
|
react_1.default.createElement("div", { className: right ? "".concat(right, " align-self-center") : "col-md-8" },
|
|
62
|
-
react_1.default.createElement("input", __assign({},
|
|
62
|
+
react_1.default.createElement("input", __assign({}, input, { "aria-label": label, className: (0, classnames_1.default)("form-control ".concat(customClass || ""), {
|
|
63
63
|
"is-invalid": meta.touched && meta.error,
|
|
64
|
-
}), disabled: meta.submitting, id:
|
|
64
|
+
}), disabled: meta.submitting, id: input.name, onBlur: handleBlur, onChange: handleChange, placeholder: placeholder || utility_1.words.DateFormat, ref: onRegisterRef, tabIndex: tabIndex, type: "text", value: valueToShow })),
|
|
65
65
|
react_1.default.createElement("div", { className: "invalid-feedback" }, meta.touched && meta.error ? (react_1.default.createElement("span", null, meta.error)) : null))));
|
|
66
66
|
};
|
|
67
67
|
exports.DateTemplate = DateTemplate;
|
package/Inputs/InputTemplate.js
CHANGED
|
@@ -18,13 +18,13 @@ exports.InputTemplate = void 0;
|
|
|
18
18
|
var classnames_1 = __importDefault(require("classnames"));
|
|
19
19
|
var react_1 = __importDefault(require("react"));
|
|
20
20
|
var InputTemplate = function (props) {
|
|
21
|
-
var _a = props.
|
|
21
|
+
var _a = props.input, input = _a === void 0 ? {} : _a, theType = props.theType, label = props.label, inputRef = props.inputRef, autoFocus = props.autoFocus, inputClass = props.inputClass, divClass = props.divClass, placeholder = props.placeholder, left = props.left, tabIndex = props.tabIndex, right = props.right, autoComplete = props.autoComplete, disabled = props.disabled, _b = props.meta, _c = _b === void 0 ? {} : _b, submitting = _c.submitting, touched = _c.touched, error = _c.error, warningClass = "".concat(touched && error ? " is-invalid" : ""), customClass = "".concat(inputClass ? " ".concat(inputClass) : ""), classForInput = "form-control ".concat(warningClass).concat(customClass), classForDiv = "form-group row mt-md-2 ".concat(divClass ? divClass : "");
|
|
22
22
|
return (react_1.default.createElement("div", { className: (0, classnames_1.default)("".concat(classForDiv, " d-flex"), {
|
|
23
23
|
"is-invalid": touched && error,
|
|
24
24
|
}) },
|
|
25
|
-
react_1.default.createElement("label", { className: "".concat(left ? left : "col-md-4 text-md-end", " form-control-label align-self-center"), htmlFor:
|
|
25
|
+
react_1.default.createElement("label", { className: "".concat(left ? left : "col-md-4 text-md-end", " form-control-label align-self-center"), htmlFor: input.name }, label),
|
|
26
26
|
react_1.default.createElement("div", { className: "".concat(right ? right : "col-md-8", " align-self-center") },
|
|
27
|
-
react_1.default.createElement("input", __assign({},
|
|
27
|
+
react_1.default.createElement("input", __assign({}, input, { "aria-label": label, autoComplete: autoComplete, autoFocus: autoFocus, className: classForInput, disabled: submitting || disabled, id: input.name, placeholder: placeholder, ref: inputRef ? inputRef : null, tabIndex: tabIndex, type: theType })),
|
|
28
28
|
react_1.default.createElement("div", { className: "invalid-feedback" }, touched && error ? (react_1.default.createElement("span", null, error)) : null))));
|
|
29
29
|
};
|
|
30
30
|
exports.InputTemplate = InputTemplate;
|
package/Inputs/LabelTemplate.js
CHANGED
|
@@ -17,12 +17,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.LabelTemplate = void 0;
|
|
18
18
|
var react_1 = __importDefault(require("react"));
|
|
19
19
|
var LabelTemplate = function (props) {
|
|
20
|
-
var _a = props.
|
|
20
|
+
var _a = props.input, input = _a === void 0 ? {} : _a, tabIndex = props.tabIndex, label = props.label, offset = props.offset, _b = props.meta, _c = _b === void 0 ? {} : _b, submitting = _c.submitting, touched = _c.touched, error = _c.error;
|
|
21
21
|
return (react_1.default.createElement("div", { className: "container" },
|
|
22
22
|
react_1.default.createElement("div", { className: "form-group mt-md-2 row mb-1" },
|
|
23
23
|
react_1.default.createElement("div", { className: "".concat(offset || "", " col custom-control custom-checkbox") },
|
|
24
|
-
react_1.default.createElement("input", __assign({},
|
|
25
|
-
react_1.default.createElement("label", { className: "custom-control-label", htmlFor:
|
|
24
|
+
react_1.default.createElement("input", __assign({}, input, { "aria-label": label, className: "custom-control-input", disabled: submitting, id: input.name, tabIndex: tabIndex, type: "checkbox" })),
|
|
25
|
+
react_1.default.createElement("label", { className: "custom-control-label", htmlFor: input.name }, label),
|
|
26
26
|
react_1.default.createElement("div", { className: "invalid-feedback" }, touched && error ? (react_1.default.createElement("span", null, error)) : null)))));
|
|
27
27
|
};
|
|
28
28
|
exports.LabelTemplate = LabelTemplate;
|
package/Inputs/NumericInput.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ type NumericPropTypes = {
|
|
|
4
4
|
readonly currency?: boolean;
|
|
5
5
|
readonly customClass?: any;
|
|
6
6
|
readonly disabled?: boolean;
|
|
7
|
-
readonly
|
|
7
|
+
readonly input: any;
|
|
8
8
|
readonly label?: string;
|
|
9
9
|
readonly meta: any;
|
|
10
10
|
readonly onRegisterRef?: any;
|
|
@@ -18,7 +18,7 @@ type NumericPropTypes = {
|
|
|
18
18
|
readonly formatValue: (raw: any, optional?: boolean) => string;
|
|
19
19
|
readonly normalizeValue: (raw: any) => any;
|
|
20
20
|
readonly onBlur?: () => void;
|
|
21
|
-
readonly onChange
|
|
21
|
+
readonly onChange: (event: any) => void;
|
|
22
22
|
readonly onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
23
23
|
readonly onKeyDown?: (event: any) => void;
|
|
24
24
|
};
|
package/Inputs/NumericInput.js
CHANGED
|
@@ -9,40 +9,40 @@ var react_1 = __importDefault(require("react"));
|
|
|
9
9
|
var utility_1 = require("../utility");
|
|
10
10
|
var common_1 = require("./common");
|
|
11
11
|
var NumericInput = function (props) {
|
|
12
|
-
var _a = props.precision, precision = _a === void 0 ? 2 : _a,
|
|
12
|
+
var _a = props.precision, precision = _a === void 0 ? 2 : _a, customClass = props.customClass, input = props.input, label = props.label, disabled = props.disabled, currency = props.currency, tabIndex = props.tabIndex, onRegisterRef = props.onRegisterRef, _b = props.formatValue, formatValue = _b === void 0 ? utility_1.formatZeroValue : _b, size = props.size, placeholder = props.placeholder, _c = props.meta, _d = _c === void 0 ? {} : _c, submitting = _d.submitting, touched = _d.touched, error = _d.error, _e = react_1.default.useState(input.value || ""), value = _e[0], setValue = _e[1], noCurrency = (typeof currency === "undefined" || currency === false), valueToShow = formatValue(value, props.optional), updateValue = function (targetValue) {
|
|
13
13
|
setValue(targetValue);
|
|
14
14
|
var valueToStore = targetValue;
|
|
15
15
|
if ((0, common_1.isFloat)((0, common_1.floatToEnglishComma)(targetValue))) {
|
|
16
16
|
valueToStore = (0, common_1.getFloatValueToStore)(targetValue);
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
input.onChange(valueToStore);
|
|
19
19
|
}, handleBlur = function (_a) {
|
|
20
20
|
var targetValue = _a.target.value;
|
|
21
21
|
var newValue = (0, common_1.clearFloatOnBlur)(value, precision), hasChanged = value !== newValue;
|
|
22
22
|
if (hasChanged) {
|
|
23
23
|
updateValue(newValue);
|
|
24
24
|
}
|
|
25
|
-
if (typeof
|
|
26
|
-
|
|
25
|
+
if (typeof input.onBlur === "function") {
|
|
26
|
+
input.onBlur(targetValue);
|
|
27
27
|
}
|
|
28
28
|
}, handleChange = function (_a) {
|
|
29
29
|
var targetValue = _a.target.value;
|
|
30
30
|
updateValue(targetValue);
|
|
31
31
|
}, handleFocus = function (event) {
|
|
32
|
-
if (typeof
|
|
33
|
-
|
|
32
|
+
if (typeof input.onFocus === "function") {
|
|
33
|
+
input.onFocus(event);
|
|
34
34
|
}
|
|
35
35
|
if (typeof props.onFocus === "function") {
|
|
36
36
|
props.onFocus(event);
|
|
37
37
|
}
|
|
38
38
|
}, inputComponent = (react_1.default.createElement("input", { "aria-label": label, autoFocus: props.autoFocus, className: (0, classnames_1.default)("form-control ".concat(customClass || ""), {
|
|
39
39
|
"is-invalid": touched && error,
|
|
40
|
-
}), disabled: submitting || disabled, id:
|
|
40
|
+
}), disabled: submitting || disabled, id: input.name, inputMode: "decimal", maxLength: size, onBlur: handleBlur, onChange: handleChange, onFocus: handleFocus, onKeyDown: props.onKeyDown, placeholder: placeholder || label, ref: onRegisterRef, tabIndex: tabIndex, type: "text", value: valueToShow }));
|
|
41
41
|
react_1.default.useEffect(function () {
|
|
42
|
-
if ((0, common_1.isFloat)(
|
|
43
|
-
updateValue(
|
|
42
|
+
if ((0, common_1.isFloat)(input.value) || input.value === "") {
|
|
43
|
+
updateValue(input.value);
|
|
44
44
|
}
|
|
45
|
-
}, [
|
|
45
|
+
}, [input.value]);
|
|
46
46
|
if (noCurrency) {
|
|
47
47
|
return inputComponent;
|
|
48
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumericInput.js","sourceRoot":"","sources":["../../src/Inputs/NumericInput.tsx"],"names":[],"mappings":";;;;;;AAGA,0DAAoC;AACpC,gDAA0B;AAC1B,sCAA6C;AAC7C,mCAAgG;
|
|
1
|
+
{"version":3,"file":"NumericInput.js","sourceRoot":"","sources":["../../src/Inputs/NumericInput.tsx"],"names":[],"mappings":";;;;;;AAGA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I,EAAC,MAAM,EACX,KAAK,EAAE,WAAW,GAClB,CACH,CAAC;IAEJ,eAAK,CAAC,SAAS,CAAC;QACd,IAAI,IAAA,gBAAO,EAAC,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,KAAK,EAAE,EAAE,CAAC;YAC/C,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAElB,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,OAAO,CACL,uCAAK,SAAS,EAAC,aAAa;QACzB,cAAc;QACf,uCAAK,SAAS,EAAC,oBAAoB;YACjC,wCAAM,SAAS,EAAC,kBAAkB,IAC/B,QAAQ,CACJ,CACH,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAhGF,QAAA,YAAY,gBAgGV"}
|
|
@@ -9,34 +9,34 @@ var react_1 = __importDefault(require("react"));
|
|
|
9
9
|
var utility_1 = require("../utility");
|
|
10
10
|
var common_1 = require("./common");
|
|
11
11
|
var NumericTemplate = function (props) {
|
|
12
|
-
var _a = props.precision, precision = _a === void 0 ? 2 : _a, _b = props.
|
|
12
|
+
var _a = props.precision, precision = _a === void 0 ? 2 : _a, _b = props.input, input = _b === void 0 ? {} : _b, right = props.right, tabIndex = props.tabIndex, divClass = props.divClass, label = props.label, onRegisterRef = props.onRegisterRef, _c = props.meta, _d = _c === void 0 ? {} : _c, submitting = _d.submitting, touched = _d.touched, error = _d.error, _e = props.formatValue, formatValue = _e === void 0 ? utility_1.formatZeroValue : _e, type = props.type, autoFocus = props.autoFocus, inputClass = props.inputClass, placeholder = props.placeholder, left = props.left, size = props.size, disabled = props.disabled, _f = react_1.default.useState(props.input.value || ""), value = _f[0], setValue = _f[1], valueToShow = formatValue(value, props.optional), updateValue = function (targetValue) {
|
|
13
13
|
setValue(targetValue);
|
|
14
14
|
var valueToStore = targetValue;
|
|
15
15
|
if ((0, common_1.isFloat)((0, common_1.floatToEnglishComma)(targetValue))) {
|
|
16
16
|
valueToStore = (0, common_1.getFloatValueToStore)(targetValue);
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
input.onChange(valueToStore);
|
|
19
19
|
}, handleBlur = function (event) {
|
|
20
20
|
var newValue = (0, common_1.clearFloatOnBlur)(value, precision), hasChanged = value !== newValue;
|
|
21
21
|
if (hasChanged) {
|
|
22
22
|
updateValue(newValue);
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
input.onBlur(event);
|
|
25
25
|
}, handleChange = function (_a) {
|
|
26
26
|
var targetValue = _a.target.value;
|
|
27
27
|
updateValue(targetValue);
|
|
28
28
|
}, warningClass = "".concat(touched && error ? " is-invalid" : ""), customClass = "".concat(inputClass ? " ".concat(inputClass) : ""), classForInput = "form-control ".concat(warningClass).concat(customClass), classForDiv = "form-group mt-md-2 row ".concat(divClass ? divClass : "");
|
|
29
29
|
react_1.default.useEffect(function () {
|
|
30
|
-
if ((0, common_1.isFloat)(
|
|
31
|
-
updateValue(
|
|
30
|
+
if ((0, common_1.isFloat)(input.value) || input.value === "") {
|
|
31
|
+
updateValue(input.value);
|
|
32
32
|
}
|
|
33
|
-
}, [
|
|
33
|
+
}, [input.value]);
|
|
34
34
|
return (react_1.default.createElement("div", { className: (0, classnames_1.default)("".concat(classForDiv, " d-flex"), {
|
|
35
35
|
"is-invalid": touched && error,
|
|
36
36
|
}) },
|
|
37
|
-
react_1.default.createElement("label", { className: "".concat(left ? "".concat(left, " align-self-center") : "col-md-4 text-md-end", " form-control-label align-self-center"), htmlFor:
|
|
37
|
+
react_1.default.createElement("label", { className: "".concat(left ? "".concat(left, " align-self-center") : "col-md-4 text-md-end", " form-control-label align-self-center"), htmlFor: input.name }, label),
|
|
38
38
|
react_1.default.createElement("div", { className: right ? "".concat(right, " align-self-center") : "col-md-8 align-self-center" },
|
|
39
|
-
react_1.default.createElement("input", { "aria-label": label, autoFocus: autoFocus, className: classForInput, disabled: submitting || disabled, id:
|
|
39
|
+
react_1.default.createElement("input", { "aria-label": label, autoFocus: autoFocus, className: classForInput, disabled: submitting || disabled, id: input.name, inputMode: "decimal", maxLength: size, onBlur: handleBlur, onChange: handleChange, onKeyDown: props.onKeyDown, placeholder: placeholder, ref: onRegisterRef, tabIndex: tabIndex, type: type, value: valueToShow }),
|
|
40
40
|
react_1.default.createElement("div", { className: "invalid-feedback" }, touched && error ? (react_1.default.createElement("span", null, error)) : null))));
|
|
41
41
|
};
|
|
42
42
|
exports.NumericTemplate = NumericTemplate;
|
package/Inputs/Selects/Custom.js
CHANGED
|
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
var react_1 = __importDefault(require("react"));
|
|
18
18
|
var Simple_1 = __importDefault(require("./Simple"));
|
|
19
19
|
var CustomSelect = function (props) {
|
|
20
|
-
var _a = props.
|
|
20
|
+
var _a = props.input, input = _a === void 0 ? {} : _a, _b = props.meta, meta = _b === void 0 ? {} : _b, left = props.left, right = props.right, label = props.label, id = props.id, customID = "custom-select-".concat(input.name).concat(id || "");
|
|
21
21
|
return (react_1.default.createElement("div", { className: "form-group row d-flex" },
|
|
22
22
|
react_1.default.createElement("label", { className: "".concat(left ? "".concat(left, " align-self-center") : "col-md-4 text-md-end", " form-control-label align-self-center"), htmlFor: customID }, label),
|
|
23
23
|
react_1.default.createElement("div", { className: right ? "".concat(right, " align-self-center") : "col-md-8 align-self-center" },
|
package/Inputs/Selects/Simple.js
CHANGED
|
@@ -18,10 +18,10 @@ var classnames_1 = __importDefault(require("classnames"));
|
|
|
18
18
|
var react_1 = __importDefault(require("react"));
|
|
19
19
|
var utility_1 = require("../../utility");
|
|
20
20
|
var SimpleCustomSelect = function (props) {
|
|
21
|
-
var autoFocus = props.autoFocus, isImmutable = props.isImmutable, showEmptyOption = props.showEmptyOption, _a = props.valueKey, valueKey = _a === void 0 ? "value" : _a, _b = props.nameKey, nameKey = _b === void 0 ? "name" : _b, data = props.data, tabIndex = props.tabIndex, _c = props.
|
|
21
|
+
var autoFocus = props.autoFocus, isImmutable = props.isImmutable, showEmptyOption = props.showEmptyOption, _a = props.valueKey, valueKey = _a === void 0 ? "value" : _a, _b = props.nameKey, nameKey = _b === void 0 ? "name" : _b, data = props.data, tabIndex = props.tabIndex, _c = props.input, input = _c === void 0 ? {} : _c, id = props.id, inputClass = props.inputClass, disabled = props.disabled, _d = props.meta, _e = _d === void 0 ? {} : _d, touched = _e.touched, error = _e.error, submitting = _e.submitting, theClasses = (0, classnames_1.default)("custom-select ".concat(inputClass || ""), {
|
|
22
22
|
"is-invalid": touched && error,
|
|
23
|
-
}), customID = "custom-select-".concat(
|
|
24
|
-
return (react_1.default.createElement("select", __assign({},
|
|
23
|
+
}), customID = "custom-select-".concat(input.name).concat(id || "");
|
|
24
|
+
return (react_1.default.createElement("select", __assign({}, input, { autoFocus: autoFocus, className: theClasses, disabled: submitting || disabled, id: customID, tabIndex: tabIndex }),
|
|
25
25
|
showEmptyOption ? react_1.default.createElement("option", { value: "" }, utility_1.words.Select) : null,
|
|
26
26
|
isImmutable ? data.map(function (current) {
|
|
27
27
|
var value = current.get(valueKey), name = current.get(nameKey);
|
package/Inputs/SimpleInput.d.ts
CHANGED
package/Inputs/SimpleInput.js
CHANGED
|
@@ -18,10 +18,10 @@ exports.SimpleInput = void 0;
|
|
|
18
18
|
var classnames_1 = __importDefault(require("classnames"));
|
|
19
19
|
var react_1 = __importDefault(require("react"));
|
|
20
20
|
var SimpleInput = function (props) {
|
|
21
|
-
var customClass = props.customClass, _a = props.
|
|
22
|
-
return (react_1.default.createElement("input", __assign({},
|
|
21
|
+
var customClass = props.customClass, _a = props.input, input = _a === void 0 ? {} : _a, label = props.label, autoFocus = props.autoFocus, tabIndex = props.tabIndex, placeholder = props.placeholder, theType = props.theType, inputRef = props.inputRef, autoComplete = props.autoComplete, disabled = props.disabled, _b = props.meta, _c = _b === void 0 ? {} : _b, submitting = _c.submitting, touched = _c.touched, error = _c.error;
|
|
22
|
+
return (react_1.default.createElement("input", __assign({}, input, { "aria-label": label, autoComplete: autoComplete, autoFocus: autoFocus, className: (0, classnames_1.default)("form-control ".concat(customClass || ""), {
|
|
23
23
|
"is-invalid": touched && error,
|
|
24
|
-
}), disabled: submitting || disabled, id:
|
|
24
|
+
}), disabled: submitting || disabled, id: input.name, placeholder: placeholder || label, ref: inputRef ? inputRef : null, tabIndex: tabIndex, type: theType })));
|
|
25
25
|
};
|
|
26
26
|
exports.SimpleInput = SimpleInput;
|
|
27
27
|
//# sourceMappingURL=SimpleInput.js.map
|
package/Inputs/SimpleTextarea.js
CHANGED
|
@@ -17,8 +17,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.SimpleTextarea = void 0;
|
|
18
18
|
var react_1 = __importDefault(require("react"));
|
|
19
19
|
var SimpleTextarea = function (props) {
|
|
20
|
-
var disabled = props.disabled, _a = props.
|
|
21
|
-
return (react_1.default.createElement("textarea", __assign({},
|
|
20
|
+
var disabled = props.disabled, _a = props.input, input = _a === void 0 ? {} : _a, label = props.label, onRegisterRef = props.onRegisterRef, autoFocus = props.autoFocus, inputClass = props.inputClass, placeholder = props.placeholder, tabIndex = props.tabIndex, rows = props.rows, _b = props.meta, _c = _b === void 0 ? {} : _b, submitting = _c.submitting, touched = _c.touched, error = _c.error, warningClass = "".concat(touched && error ? " is-invalid" : ""), customClass = "".concat(inputClass ? " ".concat(inputClass) : ""), classForInput = "form-control ".concat(warningClass).concat(customClass);
|
|
21
|
+
return (react_1.default.createElement("textarea", __assign({}, input, { "aria-label": label, autoFocus: autoFocus, className: classForInput, disabled: disabled || submitting, id: input.name, placeholder: placeholder, ref: onRegisterRef ? onRegisterRef : null, rows: rows, tabIndex: tabIndex })));
|
|
22
22
|
};
|
|
23
23
|
exports.SimpleTextarea = SimpleTextarea;
|
|
24
24
|
//# sourceMappingURL=SimpleTextarea.js.map
|
|
@@ -19,11 +19,11 @@ var classnames_1 = __importDefault(require("classnames"));
|
|
|
19
19
|
var react_1 = __importDefault(require("react"));
|
|
20
20
|
var SimpleTextarea_1 = require("./SimpleTextarea");
|
|
21
21
|
var TextareaTemplate = function (props) {
|
|
22
|
-
var _a = props.
|
|
22
|
+
var _a = props.input, input = _a === void 0 ? {} : _a, label = props.label, left = props.left, right = props.right, _b = props.meta, _c = _b === void 0 ? {} : _b, touched = _c.touched, error = _c.error;
|
|
23
23
|
return (react_1.default.createElement("div", { className: (0, classnames_1.default)("form-group mt-md-2 row d-flex", {
|
|
24
24
|
"is-invalid": touched && error,
|
|
25
25
|
}) },
|
|
26
|
-
react_1.default.createElement("label", { className: "".concat(left ? "".concat(left, " align-self-center") : "col-md-4", " text-md-end form-control-label align-self-center"), htmlFor:
|
|
26
|
+
react_1.default.createElement("label", { className: "".concat(left ? "".concat(left, " align-self-center") : "col-md-4", " text-md-end form-control-label align-self-center"), htmlFor: input.name }, label),
|
|
27
27
|
react_1.default.createElement("div", { className: right ? "".concat(right, " align-self-center") : "col-md-8 align-self-center" },
|
|
28
28
|
react_1.default.createElement(SimpleTextarea_1.SimpleTextarea, __assign({}, props)),
|
|
29
29
|
react_1.default.createElement("div", { className: "invalid-feedback" }, touched && error ? (react_1.default.createElement("span", null, error)) : null))));
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "17.5.
|
|
2
|
+
"version": "17.5.6",
|
|
3
3
|
"name": "x25",
|
|
4
4
|
"description": "x25",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
@@ -120,6 +120,7 @@
|
|
|
120
120
|
"redux": "^4.2.1",
|
|
121
121
|
"reselect": "^4.1.8",
|
|
122
122
|
"superagent": "^8.1.2",
|
|
123
|
-
"vitest": "^
|
|
123
|
+
"vitest": "^1.4.0",
|
|
124
|
+
"x25": "^17.4.70"
|
|
124
125
|
}
|
|
125
126
|
}
|
package/utility/date.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ type MonthAndYear = {
|
|
|
2
2
|
year: string;
|
|
3
3
|
month: string;
|
|
4
4
|
};
|
|
5
|
-
|
|
5
|
+
import moment from "moment";
|
|
6
|
+
export declare const pattern = "y-MM-DDTHH:mm:ss", golangDateToMoment: (input: string) => moment.Moment, dateToGoFormat: (theValue: Date | string) => string, getPreviousMonth: (year: string, month: string) => {
|
|
6
7
|
previousMonth: string;
|
|
7
8
|
previousYear: string;
|
|
8
9
|
};
|
package/utility/date.js
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeDate = exports.formatDate = exports.formatDateObject = exports.getLastMonthAndYear = exports.getPreviousMonth = void 0;
|
|
6
|
+
exports.normalizeDate = exports.formatDate = exports.formatDateObject = exports.getLastMonthAndYear = exports.getPreviousMonth = exports.dateToGoFormat = exports.golangDateToMoment = exports.pattern = void 0;
|
|
7
|
+
var moment_1 = __importDefault(require("moment"));
|
|
4
8
|
var validate_1 = require("./validation/validate");
|
|
5
9
|
var ten = 10;
|
|
6
|
-
var
|
|
10
|
+
var golangDateToMoment = function (input) { return (0, moment_1.default)(String(input).replace("Z", ""), exports.pattern, "Europe/Bucharest"); }, dateToGoFormat = function (theValue) {
|
|
11
|
+
var theMoment = (0, moment_1.default)(theValue);
|
|
12
|
+
if (theMoment.isValid()) {
|
|
13
|
+
return "".concat(theMoment.format("y-MM-DDTHH:mm:ss"), "Z");
|
|
14
|
+
}
|
|
15
|
+
return "";
|
|
16
|
+
}, getPreviousMonth = function (year, month) {
|
|
7
17
|
if (month === "0") {
|
|
8
18
|
return {
|
|
9
19
|
previousMonth: "11",
|
|
@@ -15,7 +25,7 @@ var getPreviousMonth = function (year, month) {
|
|
|
15
25
|
previousYear: String(year),
|
|
16
26
|
};
|
|
17
27
|
};
|
|
18
|
-
exports.getPreviousMonth = getPreviousMonth;
|
|
28
|
+
exports.pattern = "y-MM-DDTHH:mm:ss", exports.golangDateToMoment = golangDateToMoment, exports.dateToGoFormat = dateToGoFormat, exports.getPreviousMonth = getPreviousMonth;
|
|
19
29
|
var getLastMonthAndYear = function () {
|
|
20
30
|
var currentDate = new Date(), currentYear = String(currentDate.getFullYear()), currentMonth = String(currentDate.getMonth()), _a = (0, exports.getPreviousMonth)(currentYear, currentMonth), previousMonth = _a.previousMonth, previousYear = _a.previousYear;
|
|
21
31
|
return {
|
package/utility/date.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../src/utility/date.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../src/utility/date.ts"],"names":[],"mappings":";;;;;;AAIA,kDAA4B;AAC5B,kDAAoD;AAEpD,IAAM,GAAG,GAAG,EAAE,CAAC;AAER,IAEL,kBAAkB,GAAG,UAAC,KAAc,IAAK,OAAA,IAAA,gBAAM,EAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,eAAO,EAAE,kBAAkB,CAAC,EAAnE,CAAmE,EAE5G,cAAc,GAAG,UAAC,QAAwB;IACxC,IAAM,SAAS,GAAG,IAAA,gBAAM,EAAC,QAAQ,CAAC,CAAC;IAEnC,IAAI,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC;QACxB,OAAO,UAAG,SAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,MAAG,CAAC;IACpD,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC,EACD,gBAAgB,GAAG,UAAC,IAAY,EAAE,KAAa;IAC7C,IAAI,KAAK,KAAK,GAAG,EAAE,CAAC;QAClB,OAAO;YACL,aAAa,EAAG,IAAI;YACpB,YAAY,EAAI,MAAM,CAAC,MAAM,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