dtable-ui-component 6.0.110-pmy.4 → 6.0.110-ppd.1

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.
@@ -118,7 +118,7 @@
118
118
  box-shadow: none !important;
119
119
  }
120
120
 
121
- .seatable-group-select .option-group-content .dtable-icon-check {
121
+ .option-group-content .dtable-icon-check {
122
122
  color: #666666;
123
123
  font-size: 14px;
124
124
  }
@@ -136,3 +136,19 @@
136
136
  .seatable-group-select .seatable-icon-btn:not(.disabled):hover {
137
137
  background-color:#FFFFFF;
138
138
  }
139
+
140
+ .option-group-dtable-filter-select-column .seatable-icon-btn {
141
+ height: 12px !important;
142
+ width: 12px !important;
143
+ font-size: 12px !important;
144
+ }
145
+
146
+ .option-group-dtable-filter-select-column .clear-search-text {
147
+ position: absolute;
148
+ display: inline-block;
149
+ height: 12px;
150
+ width: 12px;
151
+ line-height: 12px;
152
+ top: 12px;
153
+ right: 18px;
154
+ }
@@ -232,7 +232,7 @@ exports.Option = Option;
232
232
  const processOptionsWithClear = (options, isClearable) => {
233
233
  if (isClearable && options && options.length > 0) {
234
234
  return [{
235
- label: '——',
235
+ label: '--',
236
236
  value: '__clear__'
237
237
  }, ...options];
238
238
  }
@@ -20,6 +20,12 @@
20
20
  padding: 0 0 8px 0 !important;
21
21
  }
22
22
 
23
+ .option-group .option-group-content .label-space {
24
+ display: flex;
25
+ justify-content: space-between;
26
+ align-items: center;
27
+ }
28
+
23
29
  .option-group-search .form-control {
24
30
  height: 32px;
25
31
  }
@@ -12,6 +12,8 @@ var _option = _interopRequireDefault(require("./option"));
12
12
  var _DTableSearchInput = _interopRequireDefault(require("../DTableSearchInput"));
13
13
  var _KeyCodes = _interopRequireDefault(require("./KeyCodes"));
14
14
  var _ClickOutside = _interopRequireDefault(require("../ClickOutside"));
15
+ var _IconButton = _interopRequireDefault(require("../IconButton"));
16
+ var _lang = require("../lang");
15
17
  require("./index.css");
16
18
  var _jsxRuntime = require("react/jsx-runtime");
17
19
  const OPTION_HEIGHT = 32;
@@ -81,6 +83,11 @@ class SelectOptionGroup extends _react.Component {
81
83
  });
82
84
  }
83
85
  };
86
+ this.isEqual = (obj1, obj2) => {
87
+ if (obj1 === obj2) return true;
88
+ if (!obj1 || !obj2) return false;
89
+ return JSON.stringify(obj1) === JSON.stringify(obj2);
90
+ };
84
91
  this.onMouseDown = e => {
85
92
  const {
86
93
  isInModal
@@ -135,7 +142,8 @@ class SelectOptionGroup extends _react.Component {
135
142
  this.renderOptGroup = searchVal => {
136
143
  let {
137
144
  noOptionsPlaceholder,
138
- onSelectOption
145
+ onSelectOption,
146
+ value
139
147
  } = this.props;
140
148
  this.filterOptions = this.props.getFilterOptions(searchVal);
141
149
  if (this.filterOptions.length === 0) {
@@ -147,6 +155,7 @@ class SelectOptionGroup extends _react.Component {
147
155
  return this.filterOptions.map((opt, i) => {
148
156
  let key = opt.value.column ? opt.value.column.key : i;
149
157
  let isActive = this.state.activeIndex === i;
158
+ let isSelected = value && (typeof value === 'object' && this.isEqual(value.value, opt.value) || typeof value === 'string' && value === opt.value);
150
159
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_option.default, {
151
160
  index: i,
152
161
  isActive: isActive,
@@ -155,10 +164,23 @@ class SelectOptionGroup extends _react.Component {
155
164
  changeIndex: this.changeIndex,
156
165
  supportMultipleSelect: this.props.supportMultipleSelect,
157
166
  disableHover: this.state.disableHover,
158
- children: opt.label
167
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
168
+ className: "label-space",
169
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
170
+ children: [" ", opt.label]
171
+ }), isSelected && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
172
+ className: "dtable-font dtable-icon-check"
173
+ })]
174
+ })
159
175
  }, `${key}-${i}`);
160
176
  });
161
177
  };
178
+ this.clearValue = () => {
179
+ this.setState({
180
+ searchVal: '',
181
+ activeIndex: -1
182
+ });
183
+ };
162
184
  this.state = {
163
185
  searchVal: '',
164
186
  activeIndex: -1,
@@ -243,7 +265,22 @@ class SelectOptionGroup extends _react.Component {
243
265
  placeholder: searchPlaceholder,
244
266
  onChange: this.onChangeSearch,
245
267
  autoFocus: true,
246
- ref: this.searchInputRef
268
+ ref: this.searchInputRef,
269
+ clearValue: this.clearValue,
270
+ isClearable: true,
271
+ components: {
272
+ ClearIndicator: props => {
273
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
274
+ className: "clear-search-text",
275
+ onClick: props.clearValue,
276
+ title: (0, _lang.getLocale)('Clear_search_text'),
277
+ "aria-label": (0, _lang.getLocale)('Clear_search_text'),
278
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
279
+ icon: "x"
280
+ })
281
+ });
282
+ }
283
+ }
247
284
  })
248
285
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
249
286
  className: `option-group-content ${!searchable && !supportMultipleSelect ? 'option-group-top' : ''}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "6.0.110-pmy.4",
3
+ "version": "6.0.110-ppd.1",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "^5.0.4",