tenjin-ui-kit 0.3.15 → 0.3.17
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.
|
@@ -21,7 +21,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
21
21
|
// import Select from "../select";
|
|
22
22
|
|
|
23
23
|
var EditableField = function EditableField(props) {
|
|
24
|
-
var _useState = (0, _react.useState)(props.editableData),
|
|
24
|
+
var _useState = (0, _react.useState)(props.editableData || "N/A"),
|
|
25
25
|
_useState2 = _slicedToArray(_useState, 2),
|
|
26
26
|
name = _useState2[0],
|
|
27
27
|
setName = _useState2[1];
|
|
@@ -34,15 +34,24 @@ var EditableField = function EditableField(props) {
|
|
|
34
34
|
show = _useState6[0],
|
|
35
35
|
isShow = _useState6[1];
|
|
36
36
|
var handleKeyDown = function handleKeyDown(event) {
|
|
37
|
-
if (
|
|
38
|
-
|
|
37
|
+
// if (name?.length > 0 || typeof name === "number") {
|
|
38
|
+
// if (event.key === "Enter") {
|
|
39
|
+
// setIsNameFocused(false);
|
|
40
|
+
// isShow(false);
|
|
41
|
+
// }
|
|
42
|
+
// } else {
|
|
43
|
+
// window.alert("Sorry, data should be there");
|
|
44
|
+
// setName(props.editableData ?? <Text>Please, enter some data</Text>);
|
|
45
|
+
// }
|
|
46
|
+
if (event.key === "Enter") {
|
|
47
|
+
if ((name === null || name === void 0 ? void 0 : name.length) > 0) {
|
|
39
48
|
setIsNameFocused(false);
|
|
40
49
|
isShow(false);
|
|
50
|
+
} else {
|
|
51
|
+
var _props$editableData;
|
|
52
|
+
window.alert("Sorry, data should be there");
|
|
53
|
+
setName((_props$editableData = props.editableData) !== null && _props$editableData !== void 0 ? _props$editableData : /*#__PURE__*/_react.default.createElement(_text.default, null, "Please, enter some data"));
|
|
41
54
|
}
|
|
42
|
-
} else {
|
|
43
|
-
var _props$editableData;
|
|
44
|
-
window.alert("Sorry, data should be there");
|
|
45
|
-
setName((_props$editableData = props.editableData) !== null && _props$editableData !== void 0 ? _props$editableData : /*#__PURE__*/_react.default.createElement(_text.default, null, "Please, enter some data"));
|
|
46
55
|
}
|
|
47
56
|
};
|
|
48
57
|
var onBLurHandeler = function onBLurHandeler() {
|
|
@@ -99,12 +108,14 @@ var EditableField = function EditableField(props) {
|
|
|
99
108
|
padding: "0.5rem"
|
|
100
109
|
}
|
|
101
110
|
}, name))) : props.isSelect ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", null, "Select")) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_material.TextField, {
|
|
111
|
+
placeholder: props.placeholder || "Please Enter Some Value",
|
|
102
112
|
id: "standard-basic",
|
|
103
113
|
variant: "standard",
|
|
104
114
|
autoFocus: true,
|
|
105
115
|
value: name,
|
|
106
116
|
onChange: function onChange(e) {
|
|
107
|
-
|
|
117
|
+
setName(e.target.value);
|
|
118
|
+
props.onChange(e.target.value);
|
|
108
119
|
},
|
|
109
120
|
onBlur: onBLurHandeler,
|
|
110
121
|
onKeyDown: handleKeyDown,
|
|
@@ -155,21 +155,14 @@ var SimpleSelect = function SimpleSelect(_ref) {
|
|
|
155
155
|
color: "red"
|
|
156
156
|
}
|
|
157
157
|
}, " * ") : "")), /*#__PURE__*/_react.default.createElement(_material.Select, _extends({}, rest, {
|
|
158
|
-
displayEmpty
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}, placeholder || "Select an option");
|
|
167
|
-
}
|
|
168
|
-
var selectedOption = options === null || options === void 0 ? void 0 : options.find(function (option) {
|
|
169
|
-
return (option === null || option === void 0 ? void 0 : option.value) === selected;
|
|
170
|
-
});
|
|
171
|
-
return selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label;
|
|
172
|
-
},
|
|
158
|
+
// displayEmpty // To display the placeholder
|
|
159
|
+
// renderValue={(selected) => {
|
|
160
|
+
// if (!selected) {
|
|
161
|
+
// return <span style={{ color: "#acacac" }}>{placeholder || "Select an option"}</span>;
|
|
162
|
+
// }
|
|
163
|
+
// const selectedOption = options?.find((option) => option?.value === selected);
|
|
164
|
+
// return selectedOption?.label;
|
|
165
|
+
// }}
|
|
173
166
|
fullWidth: true,
|
|
174
167
|
onClose: function onClose() {
|
|
175
168
|
return setSearchText("");
|