dtable-ui-component 6.0.110-oot.14 → 6.0.110-oot.15
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.
|
@@ -55,6 +55,22 @@ class DTableCustomizeSearchInput extends _react.Component {
|
|
|
55
55
|
this.inputRef.setSelectionRange(0, txtLength);
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
+
this.renderLeftIcon = () => {
|
|
59
|
+
const {
|
|
60
|
+
leftIcon,
|
|
61
|
+
leftIconClassName
|
|
62
|
+
} = this.props;
|
|
63
|
+
if (!leftIcon) return null;
|
|
64
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
65
|
+
className: (0, _classnames.default)('search-left-icon input-icon-addon', leftIconClassName),
|
|
66
|
+
style: {
|
|
67
|
+
fontSize: '12px'
|
|
68
|
+
},
|
|
69
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableIcon.default, {
|
|
70
|
+
symbol: leftIcon
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
};
|
|
58
74
|
this.renderClear = () => {
|
|
59
75
|
const {
|
|
60
76
|
isClearable,
|
|
@@ -109,15 +125,21 @@ class DTableCustomizeSearchInput extends _react.Component {
|
|
|
109
125
|
onKeyDown,
|
|
110
126
|
disabled = false,
|
|
111
127
|
style = {},
|
|
112
|
-
isClearable
|
|
128
|
+
isClearable,
|
|
129
|
+
leftIcon
|
|
113
130
|
} = this.props;
|
|
114
131
|
const {
|
|
115
132
|
searchValue
|
|
116
133
|
} = this.state;
|
|
117
|
-
|
|
134
|
+
let inputWidth = '100%';
|
|
135
|
+
if (isClearable && searchValue) {
|
|
136
|
+
inputWidth = leftIcon ? 'calc(100% - 80px)' : 'calc(100% - 40px)';
|
|
137
|
+
} else if (leftIcon) {
|
|
138
|
+
inputWidth = 'calc(100% - 40px)';
|
|
139
|
+
}
|
|
118
140
|
style.width = inputWidth;
|
|
119
141
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
|
|
120
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
142
|
+
children: [this.renderLeftIcon(), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
121
143
|
type: "text",
|
|
122
144
|
name: "search-input",
|
|
123
145
|
value: searchValue,
|