dtable-ui-component 7.0.0-ahn.12 → 7.0.0-ahn.14

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.
@@ -16,30 +16,23 @@ var _jsxRuntime = require("react/jsx-runtime");
16
16
  class DTableCustomizeSelect extends _react.Component {
17
17
  constructor(props) {
18
18
  super(props);
19
- this.getEventClassName = target => {
20
- const className = target.className;
21
- if (!className) return '';
22
- if (typeof className === 'string') return className;
23
- if (typeof className === 'object' && typeof className.baseVal === 'string') return className.baseVal;
24
- return '';
25
- };
26
19
  this.onSelectToggle = event => {
27
20
  event.preventDefault();
28
- // When open, swallow the click so the outside-click listener doesn't immediately close it.
21
+ /*
22
+ if select is showing, click events do not need to be monitored by other click events,
23
+ so it can be closed when other select is clicked.
24
+ */
29
25
  if (this.state.isShowSelectOptions) event.stopPropagation();
30
- if (this.props.isLocked) return;
31
- const tagName = (event.target.tagName || '').toLowerCase();
32
- const eventClassName = this.getEventClassName(event.target);
33
- if (tagName === 'input' && event.target.value === '') return;
34
- if (event.target.closest && event.target.closest('.option-search-control')) return;
35
- if (eventClassName === 'seatable-select-search') return;
26
+ let eventClassName = event.target.className;
27
+ if (this.props.isLocked || eventClassName.indexOf('option-search-control') > -1 || eventClassName === 'seatable-select-search') return;
28
+ // Prevent closing by pressing the spacebar in the search input
29
+ if (event.target.value === '') return;
36
30
  this.setState({
37
31
  isShowSelectOptions: !this.state.isShowSelectOptions
38
32
  });
39
33
  };
40
34
  this.onClick = event => {
41
- const eventClassName = this.getEventClassName(event.target);
42
- if (this.props.isShowSelected && eventClassName.indexOf('icon-fork-number') > -1) {
35
+ if (this.props.isShowSelected && event.target.className.includes('icon-fork-number')) {
43
36
  return;
44
37
  }
45
38
  if (!this.selector.contains(event.target)) {
@@ -64,7 +64,8 @@ class DTableSelect extends _react.default.Component {
64
64
  ref: innerRef,
65
65
  filterOption: customFilterOption,
66
66
  form: form,
67
- autoFocus: autoFocus
67
+ autoFocus: autoFocus,
68
+ menuIsOpen: true
68
69
  });
69
70
  }
70
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "7.0.0ahn.12",
3
+ "version": "7.0.0ahn.14",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "5.0.9",