dtable-ui-component 6.0.124 → 6.0.125-nsk.2

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.
Files changed (40) hide show
  1. package/lib/AsyncUserSelect/index.css +46 -14
  2. package/lib/AsyncUserSelect/index.js +22 -18
  3. package/lib/DTableCustomizeSearchInput/index.css +81 -0
  4. package/lib/DTableCustomizeSearchInput/index.js +141 -0
  5. package/lib/DTableCustomizeSelect/index.css +67 -43
  6. package/lib/DTableCustomizeSelect/index.js +16 -10
  7. package/lib/DTableCustomizeSelect/util.js +12 -0
  8. package/lib/DTableFiltersPopover/utils/filter-item-utils.js +2 -2
  9. package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.js +1 -1
  10. package/lib/DTableFiltersPopover/widgets/filter-list/index.css +5 -5
  11. package/lib/DTableGroupSelect/index.css +31 -5
  12. package/lib/DTableGroupSelect/index.js +2 -2
  13. package/lib/DTableGroupSelect/select-option-group.css +11 -15
  14. package/lib/DTableGroupSelect/select-option-group.js +11 -8
  15. package/lib/DTableSelect/dtable-select-label.css +4 -4
  16. package/lib/DTableSelect/dtable-select-label.js +1 -1
  17. package/lib/DTableSelect/index.js +3 -3
  18. package/lib/DTableSelect/select-dropdown-indicator/index.css +16 -0
  19. package/lib/DTableSelect/select-dropdown-indicator/index.js +26 -0
  20. package/lib/DTableSelect/select-style.js +133 -0
  21. package/lib/DTableSelect/user-select.css +7 -46
  22. package/lib/DTableSelect/utils.js +166 -77
  23. package/lib/ImagePreviewerLightbox/index.js +2 -2
  24. package/lib/SelectOptionGroup/KeyCodes.js +96 -4
  25. package/lib/SelectOptionGroup/index.css +75 -54
  26. package/lib/SelectOptionGroup/index.js +38 -34
  27. package/lib/SelectOptionGroup/option.js +16 -4
  28. package/lib/assets/icons/close.svg +1 -0
  29. package/lib/assets/icons/down.svg +3 -0
  30. package/lib/index.js +3 -3
  31. package/lib/locales/de.json +2 -2
  32. package/lib/locales/en.json +2 -2
  33. package/lib/locales/es.json +2 -2
  34. package/lib/locales/fr.json +2 -2
  35. package/lib/locales/pt.json +2 -2
  36. package/lib/locales/ru.json +2 -2
  37. package/lib/locales/zh-CN.json +2 -2
  38. package/package.json +1 -1
  39. package/lib/DTableCustomizeCollaboratorSelect/index.css +0 -86
  40. package/lib/DTableCustomizeCollaboratorSelect/index.js +0 -161
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.default = void 0;
9
9
  var _react = _interopRequireWildcard(require("react"));
10
10
  var _classnames = _interopRequireDefault(require("classnames"));
11
+ var _ClickOutside = _interopRequireDefault(require("../ClickOutside"));
12
+ var _DTableCustomizeSearchInput = _interopRequireDefault(require("../DTableCustomizeSearchInput"));
11
13
  var _option = _interopRequireDefault(require("./option"));
12
- var _DTableSearchInput = _interopRequireDefault(require("../DTableSearchInput"));
13
14
  var _KeyCodes = _interopRequireDefault(require("./KeyCodes"));
14
- var _ClickOutside = _interopRequireDefault(require("../ClickOutside"));
15
15
  require("./index.css");
16
16
  var _jsxRuntime = require("react/jsx-runtime");
17
17
  const OPTION_HEIGHT = 32;
@@ -19,25 +19,19 @@ class SelectOptionGroup extends _react.Component {
19
19
  constructor(props) {
20
20
  super(props);
21
21
  this.resetMenuStyle = () => {
22
- if (!this.optionGroupRef) return;
23
22
  const {
24
23
  isInModal,
25
24
  position
26
25
  } = this.props;
27
26
  const {
28
27
  top,
29
- height,
30
- width
28
+ height
31
29
  } = this.optionGroupRef.getBoundingClientRect();
32
30
  if (isInModal) {
33
31
  if (position.y + position.height + height > window.innerHeight) {
34
32
  this.optionGroupRef.style.top = position.y - height + 'px';
35
33
  }
36
- if (position && position.x + width > window.innerWidth) {
37
- this.optionGroupRef.style.left = window.innerWidth - width - 10 + 'px';
38
- }
39
34
  this.optionGroupRef.style.opacity = 1;
40
- this.searchInputRef.current && this.searchInputRef.current.inputRef.focus();
41
35
  } else {
42
36
  if (height + top > window.innerHeight) {
43
37
  const borderWidth = 2;
@@ -89,10 +83,6 @@ class SelectOptionGroup extends _react.Component {
89
83
  if (isInModal) {
90
84
  e.stopPropagation();
91
85
  e.nativeEvent.stopImmediatePropagation();
92
-
93
- // ClickOutside set isClickedInside to true via mouse down capture first
94
- // Set isClickedInside to false after mouse down
95
- this.clickOutsideRef && this.clickOutsideRef.setClickedInsideStatus(false);
96
86
  }
97
87
  };
98
88
  this.scrollContent = () => {
@@ -132,10 +122,17 @@ class SelectOptionGroup extends _react.Component {
132
122
  });
133
123
  }
134
124
  };
125
+ this.clearSearch = () => {
126
+ this.setState({
127
+ searchVal: '',
128
+ activeIndex: -1
129
+ });
130
+ };
135
131
  this.renderOptGroup = searchVal => {
136
132
  let {
137
133
  noOptionsPlaceholder,
138
- onSelectOption
134
+ onSelectOption,
135
+ value
139
136
  } = this.props;
140
137
  this.filterOptions = this.props.getFilterOptions(searchVal);
141
138
  if (this.filterOptions.length === 0) {
@@ -147,7 +144,16 @@ class SelectOptionGroup extends _react.Component {
147
144
  return this.filterOptions.map((opt, i) => {
148
145
  let key = opt.value.column ? opt.value.column.key : i;
149
146
  let isActive = this.state.activeIndex === i;
150
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_option.default, {
147
+ let isSelected = false;
148
+ if (value) {
149
+ // Handle both single value and array of values
150
+ if (Array.isArray(value.value)) {
151
+ isSelected = value.value.includes(opt.value);
152
+ } else {
153
+ isSelected = opt.value === value.value || JSON.stringify(opt.value) === JSON.stringify(value.value);
154
+ }
155
+ }
156
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_option.default, {
151
157
  index: i,
152
158
  isActive: isActive,
153
159
  value: opt.value,
@@ -155,8 +161,13 @@ class SelectOptionGroup extends _react.Component {
155
161
  changeIndex: this.changeIndex,
156
162
  supportMultipleSelect: this.props.supportMultipleSelect,
157
163
  disableHover: this.state.disableHover,
158
- children: opt.label
159
- }, "".concat(key, "-").concat(i));
164
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
165
+ className: "select-label",
166
+ children: opt.label
167
+ }), isSelected && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
168
+ className: "dtable-font dtable-icon-check seatable-check-color"
169
+ })]
170
+ }, key);
160
171
  });
161
172
  };
162
173
  this.state = {
@@ -166,7 +177,6 @@ class SelectOptionGroup extends _react.Component {
166
177
  };
167
178
  this.filterOptions = null;
168
179
  this.timer = null;
169
- this.searchInputRef = /*#__PURE__*/_react.default.createRef();
170
180
  }
171
181
  componentDidMount() {
172
182
  window.addEventListener('keydown', this.onHotKey);
@@ -190,13 +200,8 @@ class SelectOptionGroup extends _react.Component {
190
200
  isShowSelected,
191
201
  isInModal,
192
202
  position,
193
- className,
194
- addOptionAble,
195
- component
203
+ className
196
204
  } = this.props;
197
- const {
198
- AddOption
199
- } = component || {};
200
205
  let {
201
206
  searchVal
202
207
  } = this.state;
@@ -221,12 +226,10 @@ class SelectOptionGroup extends _react.Component {
221
226
  };
222
227
  }
223
228
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClickOutside.default, {
224
- ref: ref => this.clickOutsideRef = ref,
225
229
  onClickOutside: this.props.onClickOutside,
226
230
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
227
- className: (0, _classnames.default)('option-group', className ? 'option-group-' + className : '', {
228
- 'pt-0': isShowSelected,
229
- 'create-new-option-group': addOptionAble
231
+ className: (0, _classnames.default)('seatable-option-group', className ? 'seatable-option-group-' + className : '', {
232
+ 'pt-0': isShowSelected
230
233
  }),
231
234
  ref: ref => this.optionGroupRef = ref,
232
235
  style: style,
@@ -235,20 +238,21 @@ class SelectOptionGroup extends _react.Component {
235
238
  className: "editor-list-delete mb-2",
236
239
  onClick: e => e.stopPropagation(),
237
240
  children: value.label || ''
238
- }), searchable && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
239
- className: "option-group-search",
240
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableSearchInput.default, {
241
+ }), searchable && this.props.options && this.props.options.length > 10 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
242
+ className: "seatable-option-group-search",
243
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableCustomizeSearchInput.default, {
241
244
  className: "option-search-control",
242
245
  placeholder: searchPlaceholder,
243
246
  onChange: this.onChangeSearch,
247
+ clearValue: this.clearSearch,
244
248
  autoFocus: true,
245
- ref: this.searchInputRef
249
+ isClearable: true
246
250
  })
247
251
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
248
- className: "option-group-content",
252
+ className: "seatable-option-group-content",
249
253
  ref: ref => this.optionGroupContentRef = ref,
250
254
  children: this.renderOptGroup(searchVal)
251
- }), addOptionAble && AddOption]
255
+ })]
252
256
  })
253
257
  });
254
258
  }
@@ -1,20 +1,22 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
8
9
  var _react = _interopRequireWildcard(require("react"));
10
+ var _classnames = _interopRequireDefault(require("classnames"));
9
11
  var _jsxRuntime = require("react/jsx-runtime");
10
12
  class Option extends _react.Component {
11
13
  constructor() {
12
14
  super(...arguments);
13
- this.onSelectOption = (value, event) => {
15
+ this.onSelectOption = event => {
14
16
  if (this.props.supportMultipleSelect) {
15
17
  event.stopPropagation();
16
18
  }
17
- this.props.onSelectOption(value, event);
19
+ this.props.onSelectOption(this.props.value, event);
18
20
  };
19
21
  this.onMouseEnter = () => {
20
22
  if (!this.props.disableHover) {
@@ -26,11 +28,21 @@ class Option extends _react.Component {
26
28
  this.props.changeIndex(-1);
27
29
  }
28
30
  };
31
+ this.onKeyDown = e => {
32
+ if (e.key === 'Enter' || e.key === 'Space') {
33
+ e.target.click();
34
+ }
35
+ };
29
36
  }
30
37
  render() {
31
38
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
32
- className: this.props.isActive ? 'option option-active' : 'option',
33
- onClick: this.onSelectOption.bind(this, this.props.value),
39
+ className: (0, _classnames.default)('seatable-select-option', {
40
+ 'seatable-select-option-active': this.props.isActive
41
+ }),
42
+ tabIndex: "0",
43
+ role: "menuitem",
44
+ onClick: this.onSelectOption,
45
+ onKeyDown: this.onKeyDown,
34
46
  onMouseEnter: this.onMouseEnter,
35
47
  onMouseLeave: this.onMouseLeave,
36
48
  children: this.props.children
@@ -0,0 +1 @@
1
+ <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1718937171668" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="18368" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M489.6 444.8l294.4-294.4 67.2 67.2-294.4 294.4 294.4 294.4-67.2 67.2-294.4-294.4-272 272-67.2-67.2 272-272-272-272 67.2-67.2z" p-id="18369" fill="currentColor"></path></svg>
@@ -0,0 +1,3 @@
1
+ <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M3.27148 11.2718L6.09991 8.44336L15.9994 18.3429L25.8989 8.44336L28.7273 11.2718L15.9994 23.9997L3.27148 11.2718Z" fill="currentColor"/>
3
+ </svg>
package/lib/index.js CHANGED
@@ -118,10 +118,10 @@ Object.defineProperty(exports, "DTableCustomFooter", {
118
118
  return _DTableCustomFooter.default;
119
119
  }
120
120
  });
121
- Object.defineProperty(exports, "DTableCustomizeCollaboratorSelect", {
121
+ Object.defineProperty(exports, "DTableCustomizeSearchInput", {
122
122
  enumerable: true,
123
123
  get: function () {
124
- return _DTableCustomizeCollaboratorSelect.default;
124
+ return _DTableCustomizeSearchInput.default;
125
125
  }
126
126
  });
127
127
  Object.defineProperty(exports, "DTableCustomizeSelect", {
@@ -722,8 +722,8 @@ var _index = _interopRequireDefault(require("./DTableGroupSelect/index"));
722
722
  var _dtableSelectLabel = _interopRequireDefault(require("./DTableSelect/dtable-select-label"));
723
723
  var _DTableSwitch = _interopRequireDefault(require("./DTableSwitch"));
724
724
  var _DTableCustomizeSelect = _interopRequireDefault(require("./DTableCustomizeSelect"));
725
- var _DTableCustomizeCollaboratorSelect = _interopRequireDefault(require("./DTableCustomizeCollaboratorSelect"));
726
725
  var _DTableSearchInput = _interopRequireDefault(require("./DTableSearchInput"));
726
+ var _DTableCustomizeSearchInput = _interopRequireDefault(require("./DTableCustomizeSearchInput"));
727
727
  var _DTableColorPicker = _interopRequireDefault(require("./DTableColorPicker"));
728
728
  var _ModalPortal = _interopRequireDefault(require("./ModalPortal"));
729
729
  var _RoleStatusEditor = _interopRequireDefault(require("./RoleStatusEditor"));
@@ -12,8 +12,8 @@
12
12
  "Rotate_image": "Rotate image",
13
13
  "Delete_image": "delete image",
14
14
  "Download_image": "Download image",
15
- "Pre_Line": "previous Line",
16
- "Next_Line": "next Line",
15
+ "Previous_record": "Vorheriger Eintrag",
16
+ "Next_record": "Nächster Eintrag",
17
17
  "Zoom_in": "Zoom in",
18
18
  "Zoom_out": "Zoom out",
19
19
  "Choose_a_collaborator": "Wählen Sie einen Mitarbeiter",
@@ -12,8 +12,8 @@
12
12
  "Rotate_image": "Rotate image",
13
13
  "Delete_image": "delete image",
14
14
  "Download_image": "Download image",
15
- "Pre_Line": "previous Line",
16
- "Next_Line": "next Line",
15
+ "Previous_record": "Previous record",
16
+ "Next_record": "Next record",
17
17
  "Zoom_in": "Zoom in",
18
18
  "Zoom_out": "Zoom out",
19
19
  "Choose_a_collaborator": "Choose a collaborator",
@@ -12,8 +12,8 @@
12
12
  "Rotate_image": "Rotate image",
13
13
  "Delete_image": "delete image",
14
14
  "Download_image": "Download image",
15
- "Pre_Line": "previous Line",
16
- "Next_Line": "next Line",
15
+ "Previous_record": "Registro previo",
16
+ "Next_record": "Próximo registro",
17
17
  "Zoom_in": "Zoom in",
18
18
  "Zoom_out": "Zoom out",
19
19
  "Choose_a_collaborator": "Choose a collaborator",
@@ -12,8 +12,8 @@
12
12
  "Rotate_image": "Rotate image",
13
13
  "Delete_image": "delete image",
14
14
  "Download_image": "Download image",
15
- "Pre_Line": "previous Line",
16
- "Next_Line": "next Line",
15
+ "Previous_record": "Enregistrement précédent",
16
+ "Next_record": "Enregistrement suivant",
17
17
  "Zoom_in": "Zoom in",
18
18
  "Zoom_out": "Zoom out",
19
19
  "Choose_a_collaborator": "Choisissez un collaborateur",
@@ -12,8 +12,8 @@
12
12
  "Rotate_image": "Rotate image",
13
13
  "Delete_image": "delete image",
14
14
  "Download_image": "Download image",
15
- "Pre_Line": "previous Line",
16
- "Next_Line": "next Line",
15
+ "Previous_record": "Registro anterior",
16
+ "Next_record": "Próximo registro",
17
17
  "Zoom_in": "Zoom in",
18
18
  "Zoom_out": "Zoom out",
19
19
  "Choose_a_collaborator": "Choose a collaborator",
@@ -12,8 +12,8 @@
12
12
  "Rotate_image": "Rotate image",
13
13
  "Delete_image": "delete image",
14
14
  "Download_image": "Download image",
15
- "Pre_Line": "previous Line",
16
- "Next_Line": "next Line",
15
+ "Previous_record": "Предыдущая запись",
16
+ "Next_record": "Следующая запись",
17
17
  "Zoom_in": "Zoom in",
18
18
  "Zoom_out": "Zoom out",
19
19
  "Choose_a_collaborator": "Choose a collaborator",
@@ -12,8 +12,8 @@
12
12
  "Rotate_image": "旋转",
13
13
  "Delete_image": "删除",
14
14
  "Download_image": "下载",
15
- "Pre_Line": "上一行",
16
- "Next_Line": "下一行",
15
+ "Previous_record": "前一行",
16
+ "Next_record": "后一行",
17
17
  "Zoom_in": "放大",
18
18
  "Zoom_out": "缩小",
19
19
  "Choose_a_collaborator": "选择一个协作人",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "6.0.124",
3
+ "version": "6.0.125nsk.2",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "5.0.9",
@@ -1,86 +0,0 @@
1
- .dtable-customize-collaborator-select.dtable-select {
2
- position: unset;
3
- }
4
-
5
- .dtable-customize-collaborator-select .collaborator-avatar {
6
- width: 16px;
7
- height: 16px;
8
- transform: translateY(-1px);
9
- }
10
-
11
- .dtable-customize-collaborator-select .selected-option-show {
12
- width: calc(100% - 20px);
13
- height: 20px;
14
- }
15
-
16
- .dtable-customize-collaborator-select .selected-option {
17
- width: auto;
18
- overflow-x: auto;
19
- }
20
-
21
- .dtable-customize-collaborator-select .dtable-icon-down3 {
22
- margin-left: .5rem;
23
- }
24
-
25
- .dtable-customize-collaborator-select .option-collaborator {
26
- display: flex;
27
- }
28
-
29
- .dtable-customize-collaborator-select .collaborator-container {
30
- flex: 1 1;
31
- }
32
-
33
- .dtable-customize-collaborator-select .editor-list-delete .collaborator-container {
34
- flex: 1 1;
35
- display: inline;
36
- }
37
-
38
- .dtable-customize-collaborator-select .multiple-check-icon {
39
- display: inline-flex;
40
- width: 20px;
41
- text-align: center;
42
- }
43
-
44
- .dtable-customize-collaborator-select .collaborator-check-icon .dtable-icon-check-mark,
45
- .dtable-customize-collaborator-select .multiple-check-icon .dtable-icon-check-mark {
46
- font-size: 12px;
47
- color: #798d99;
48
- }
49
-
50
- .dtable-customize-collaborator-select.dtable-select .option-active,
51
- .dtable-customize-collaborator-select.dtable-select .option:hover {
52
- color: #212529;
53
- background-color: #f5f5f5;
54
- }
55
-
56
- .dtable-customize-collaborator-select.dtable-select .option.option-active .select-option-name {
57
- color: #212529;
58
- }
59
-
60
- .collaborator-select .option-group-content .collaborator,
61
- .dtable-customize-collaborator-select .option-group .option-group-content .collaborator {
62
- background: none;
63
- }
64
-
65
- .dtable-customize-collaborator-select .collaborator-avatar-container {
66
- width: 16px;
67
- }
68
-
69
- .dtable-customize-collaborator-select .option-group-content .remove-container {
70
- display: none;
71
- }
72
-
73
- .dtable-customize-collaborator-select .collaborator-container {
74
- display: flex;
75
- justify-content: space-between;
76
- }
77
-
78
- .collaborator-container .collaborator-name {
79
- margin-left: 5px;
80
- max-width: 200px;
81
- color: #212529;
82
- }
83
-
84
- .collaborator-select .option-group {
85
- max-height: fit-content;
86
- }
@@ -1,161 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
- var _react = _interopRequireWildcard(require("react"));
10
- var _classnames = _interopRequireDefault(require("classnames"));
11
- var _reactstrap = require("reactstrap");
12
- var _dtableUtils = require("dtable-utils");
13
- var _SelectOptionGroup = _interopRequireDefault(require("../SelectOptionGroup"));
14
- require("./index.css");
15
- var _jsxRuntime = require("react/jsx-runtime");
16
- class CollaboratorSelect extends _react.Component {
17
- constructor(props) {
18
- super(props);
19
- this.onSelectToggle = event => {
20
- event.preventDefault();
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
- */
25
- if (this.state.isShowSelectOptions) event.nativeEvent.stopImmediatePropagation();
26
- let eventClassName = event.target.className;
27
- if (this.props.isLocked || eventClassName.indexOf('option-search-control') > -1 || eventClassName === 'option-group-search') return;
28
- // Prevent closing by pressing the spacebar in the search input
29
- if (event.target.value === '') return;
30
- this.selectedOptionWidth = this.selectedOptionRef.clientWidth;
31
- this.setState({
32
- isShowSelectOptions: !this.state.isShowSelectOptions
33
- });
34
- };
35
- this.onMousedown = event => {
36
- const name = event.target.className;
37
- if (name === 'select-placeholder' || name.includes('icon-fork-number')) {
38
- return;
39
- }
40
- if (!this.selector.contains(event.target)) {
41
- this.closeSelect();
42
- }
43
- };
44
- this.closeSelect = () => {
45
- this.setState({
46
- isShowSelectOptions: false
47
- });
48
- };
49
- this.getFilterOptions = searchValue => {
50
- const {
51
- options,
52
- searchable
53
- } = this.props;
54
- if (!searchable) return options || [];
55
- return (0, _dtableUtils.searchCollaborators)(options, searchValue);
56
- };
57
- this.renderOptionGroup = () => {
58
- const {
59
- value,
60
- options,
61
- searchable,
62
- searchPlaceholder,
63
- noOptionsPlaceholder,
64
- top,
65
- left,
66
- isUsePopover
67
- } = this.props;
68
- if (!isUsePopover) {
69
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectOptionGroup.default, {
70
- value: value,
71
- top: top,
72
- left: left,
73
- minWidth: this.btnWidth + 8 // 8px is padding
74
- ,
75
- options: options,
76
- onSelectOption: this.props.onSelectOption,
77
- searchable: searchable,
78
- searchPlaceholder: searchPlaceholder,
79
- noOptionsPlaceholder: noOptionsPlaceholder,
80
- closeSelect: this.closeSelect,
81
- getFilterOptions: this.getFilterOptions,
82
- supportMultipleSelect: this.props.supportMultipleSelect,
83
- stopClickEvent: true,
84
- isShowSelected: true
85
- });
86
- }
87
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Popover, {
88
- placement: "bottom",
89
- isOpen: true,
90
- target: this.id,
91
- fade: false,
92
- hideArrow: true,
93
- className: "dtable-customize-collaborator-select dtable-select",
94
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectOptionGroup.default, {
95
- value: value,
96
- top: top,
97
- left: left,
98
- minWidth: this.btnWidth + 8 // 8px is padding
99
- ,
100
- options: options,
101
- onSelectOption: this.props.onSelectOption,
102
- searchable: searchable,
103
- searchPlaceholder: searchPlaceholder,
104
- noOptionsPlaceholder: noOptionsPlaceholder,
105
- closeSelect: this.closeSelect,
106
- getFilterOptions: this.getFilterOptions,
107
- supportMultipleSelect: this.props.supportMultipleSelect,
108
- stopClickEvent: true,
109
- isShowSelected: true
110
- })
111
- });
112
- };
113
- this.state = {
114
- isShowSelectOptions: false
115
- };
116
- this.id = 'collaborator-select-' + Math.trunc(Math.random() * 10000);
117
- }
118
- componentDidMount() {
119
- document.addEventListener('mousedown', this.onMousedown);
120
- this.btnWidth = this.selector.clientWidth;
121
- }
122
- componentWillUnmount() {
123
- document.removeEventListener('mousedown', this.onMousedown);
124
- }
125
- render() {
126
- let {
127
- className,
128
- value,
129
- placeholder,
130
- isLocked
131
- } = this.props;
132
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
133
- ref: node => this.selector = node,
134
- className: (0, _classnames.default)('dtable-select custom-select collaborator-select', {
135
- 'focus': this.state.isShowSelectOptions
136
- }, {
137
- 'disabled': isLocked
138
- }, className),
139
- id: this.id,
140
- onClick: this.onSelectToggle,
141
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
142
- className: "selected-option",
143
- ref: node => this.selectedOptionRef = node,
144
- children: [value.label ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
145
- className: "selected-option-show",
146
- children: value.label
147
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
148
- className: "select-placeholder",
149
- children: placeholder
150
- }), !isLocked && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
151
- className: "dtable-font dtable-icon-down3"
152
- })]
153
- }), this.state.isShowSelectOptions && this.renderOptionGroup()]
154
- });
155
- }
156
- }
157
- CollaboratorSelect.defaultProps = {
158
- top: -3,
159
- left: -3
160
- };
161
- var _default = exports.default = CollaboratorSelect;