dtable-ui-component 7.0.1 → 7.0.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 (32) hide show
  1. package/lib/AsyncUserSelect/index.css +38 -28
  2. package/lib/AsyncUserSelect/index.js +32 -19
  3. package/lib/DTableCustomizeSearchInput/index.css +75 -0
  4. package/lib/DTableCustomizeSearchInput/index.js +133 -0
  5. package/lib/DTableCustomizeSelect/index.css +120 -42
  6. package/lib/DTableCustomizeSelect/index.js +12 -6
  7. package/lib/DTableFiltersPopover/utils/filter-item-utils.js +7 -19
  8. package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.js +5 -9
  9. package/lib/DTableFiltersPopover/widgets/filter-item.js +15 -7
  10. package/lib/DTableFiltersPopover/widgets/filter-list/index.css +3 -3
  11. package/lib/DTableSelect/dtable-select-label.css +8 -3
  12. package/lib/DTableSelect/dtable-select-label.js +1 -1
  13. package/lib/DTableSelect/index.js +3 -3
  14. package/lib/DTableSelect/select-dropdown-indicator/index.css +16 -0
  15. package/lib/DTableSelect/select-dropdown-indicator/index.js +24 -0
  16. package/lib/DTableSelect/user-select.css +7 -46
  17. package/lib/DTableSelect/utils.js +170 -79
  18. package/lib/SelectOptionGroup/KeyCodes.js +96 -4
  19. package/lib/SelectOptionGroup/index.css +44 -54
  20. package/lib/SelectOptionGroup/index.js +35 -18
  21. package/lib/SelectOptionGroup/option.js +16 -4
  22. package/lib/assets/icons/close.svg +1 -0
  23. package/lib/assets/icons/down.svg +3 -0
  24. package/lib/index.js +3 -10
  25. package/package.json +1 -1
  26. package/lib/DTableCustomizeCollaboratorSelect/index.css +0 -86
  27. package/lib/DTableCustomizeCollaboratorSelect/index.js +0 -158
  28. package/lib/DTableGroupSelect/index.css +0 -96
  29. package/lib/DTableGroupSelect/index.js +0 -131
  30. package/lib/DTableGroupSelect/option.js +0 -42
  31. package/lib/DTableGroupSelect/select-option-group.css +0 -54
  32. package/lib/DTableGroupSelect/select-option-group.js +0 -227
@@ -8,8 +8,10 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.default = void 0;
9
9
  var _react = _interopRequireWildcard(require("react"));
10
10
  var _SelectOptionGroup = _interopRequireDefault(require("../SelectOptionGroup"));
11
+ var _DTableIcon = _interopRequireDefault(require("../DTableIcon"));
11
12
  var _classnames = _interopRequireDefault(require("classnames"));
12
13
  var _ModalPortal = _interopRequireDefault(require("../ModalPortal"));
14
+ var _utils = require("../utils/utils");
13
15
  require("./index.css");
14
16
  var _jsxRuntime = require("react/jsx-runtime");
15
17
  class DTableCustomizeSelect extends _react.Component {
@@ -22,8 +24,8 @@ class DTableCustomizeSelect extends _react.Component {
22
24
  so it can be closed when other select is clicked.
23
25
  */
24
26
  if (this.state.isShowSelectOptions) event.stopPropagation();
25
- let eventClassName = event.target.className;
26
- if (this.props.isLocked || eventClassName.indexOf('option-search-control') > -1 || eventClassName === 'option-group-search') return;
27
+ const eventClassName = (0, _utils.getEventClassName)(event);
28
+ if (this.props.isLocked || eventClassName.indexOf('option-search-control') > -1 || eventClassName === 'seatable-select-search') return;
27
29
  // Prevent closing by pressing the spacebar in the search input
28
30
  if (event.target.value === '') return;
29
31
  this.setState({
@@ -31,7 +33,7 @@ class DTableCustomizeSelect extends _react.Component {
31
33
  });
32
34
  };
33
35
  this.onClick = event => {
34
- if (this.props.isShowSelected && event.target.className.includes('icon-fork-number')) {
36
+ if (this.props.isShowSelected && (0, _utils.getEventClassName)(event).includes('icon-fork-number')) {
35
37
  return;
36
38
  }
37
39
  if (!this.selector.contains(event.target)) {
@@ -93,7 +95,7 @@ class DTableCustomizeSelect extends _react.Component {
93
95
  component = _this$props2.component;
94
96
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
95
97
  ref: node => this.selector = node,
96
- className: (0, _classnames.default)('dtable-select custom-select', {
98
+ className: (0, _classnames.default)('seatable-customize-select custom-select', {
97
99
  'focus': this.state.isShowSelectOptions
98
100
  }, {
99
101
  'disabled': isLocked
@@ -107,8 +109,12 @@ class DTableCustomizeSelect extends _react.Component {
107
109
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
108
110
  className: "select-placeholder",
109
111
  children: placeholder
110
- }), !isLocked && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
111
- className: "dtable-font dtable-icon-down3"
112
+ }), !isLocked && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
113
+ className: "d-inline-flex align-items-center",
114
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableIcon.default, {
115
+ symbol: "down",
116
+ color: "var(--bs-icon-color)"
117
+ })
112
118
  })]
113
119
  }), this.state.isShowSelectOptions && !isInModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectOptionGroup.default, {
114
120
  value: value,
@@ -91,9 +91,9 @@ class FilterItemUtils {
91
91
  value: {
92
92
  columnOption: option
93
93
  },
94
- label: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
94
+ label: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
95
95
  className: "select-option-name single-select-option-name",
96
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
96
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
97
97
  className: "single-select-option",
98
98
  style: {
99
99
  background: option.color,
@@ -102,23 +102,16 @@ class FilterItemUtils {
102
102
  title: option.name,
103
103
  "aria-label": option.name,
104
104
  children: option.name
105
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
106
- className: "single-select-check-icon",
107
- children: (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.id) === option.id && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
108
- className: "option-edit dtable-font dtable-icon-check-mark"
109
- })
110
- })]
105
+ })
111
106
  })
112
107
  };
113
108
  }
114
109
  static generatorMultipleSelectOption(option, filterTerm) {
115
110
  return {
116
- value: {
117
- columnOption: option
118
- },
119
- label: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
111
+ value: option,
112
+ label: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
120
113
  className: "select-option-name multiple-option-name",
121
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
114
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
122
115
  className: "multiple-select-option",
123
116
  style: {
124
117
  background: option.color,
@@ -127,12 +120,7 @@ class FilterItemUtils {
127
120
  title: option.name,
128
121
  "aria-label": option.name,
129
122
  children: option.name
130
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
131
- className: "multiple-check-icon",
132
- children: filterTerm.indexOf(option.id) > -1 && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
133
- className: "option-edit dtable-font dtable-icon-check-mark"
134
- })
135
- })]
123
+ })
136
124
  })
137
125
  };
138
126
  }
@@ -16,16 +16,15 @@ class CollaboratorFilter extends _react.Component {
16
16
  super(props);
17
17
  this.createCollaboratorOptions = (filterIndex, collaborators, filterTerm) => {
18
18
  return collaborators.map(collaborator => {
19
- let isSelected = filterTerm.findIndex(item => item === collaborator.email) > -1;
20
19
  return {
21
20
  value: {
22
21
  filterIndex,
23
22
  columnOption: collaborator
24
23
  },
25
24
  label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Fragment, {
26
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
25
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
27
26
  className: "select-option-name option-collaborator",
28
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
27
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
29
28
  className: "collaborator-container",
30
29
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
31
30
  className: "collaborator",
@@ -46,12 +45,7 @@ class CollaboratorFilter extends _react.Component {
46
45
  children: collaborator.name
47
46
  })]
48
47
  })
49
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
50
- className: "collaborator-check-icon",
51
- children: isSelected && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
52
- className: "option-edit dtable-font dtable-icon-check-mark"
53
- })
54
- })]
48
+ })
55
49
  })
56
50
  })
57
51
  };
@@ -106,7 +100,9 @@ class CollaboratorFilter extends _react.Component {
106
100
  })]
107
101
  }, item);
108
102
  });
103
+ let selectCollaborators = Array.isArray(filterTerm) && filterTerm.length > 0 ? collaborators.filter(col => filterTerm.includes(col.email)) : [];
109
104
  let value = selectedCollaborators ? {
105
+ value: selectCollaborators,
110
106
  label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
111
107
  children: selectedCollaborators
112
108
  })
@@ -128,8 +128,7 @@ class FilterItem extends _react.default.Component {
128
128
  const _this$props5 = this.props,
129
129
  index = _this$props5.index,
130
130
  filter = _this$props5.filter;
131
- const option = value.columnOption;
132
- let newFilter = (0, _utils.getUpdatedFilterBySelectMultiple)(filter, option);
131
+ let newFilter = (0, _utils.getUpdatedFilterBySelectMultiple)(filter, value);
133
132
  this.resetState(newFilter);
134
133
  this.props.updateFilter(index, newFilter);
135
134
  };
@@ -137,8 +136,7 @@ class FilterItem extends _react.default.Component {
137
136
  const _this$props6 = this.props,
138
137
  index = _this$props6.index,
139
138
  filter = _this$props6.filter;
140
- const collaborator = value.columnOption;
141
- let newFilter = (0, _utils.getUpdatedFilterByCollaborator)(filter, collaborator);
139
+ let newFilter = (0, _utils.getUpdatedFilterByCollaborator)(filter, value);
142
140
  this.resetState(newFilter);
143
141
  this.props.updateFilter(index, newFilter);
144
142
  };
@@ -146,7 +144,10 @@ class FilterItem extends _react.default.Component {
146
144
  const _this$props7 = this.props,
147
145
  index = _this$props7.index,
148
146
  filter = _this$props7.filter;
149
- const collaborator = value.columnOption;
147
+ const collaborator = value && (value.columnOption || value.value || value);
148
+ if (!collaborator || !collaborator.email) {
149
+ return;
150
+ }
150
151
  let newFilter = (0, _utils.getUpdatedFilterByCreator)(filter, collaborator);
151
152
  // the predicate is 'is' or 'is not'
152
153
  if (!newFilter) {
@@ -294,11 +295,12 @@ class FilterItem extends _react.default.Component {
294
295
  }
295
296
  const className = 'select-option-name multiple-select-option';
296
297
  let labelArray = [];
298
+ let valueArray = [];
297
299
  if (Array.isArray(options) && Array.isArray(filterTerm)) {
298
300
  filterTerm.forEach(item => {
299
301
  let inOption = options.find(option => option.id === item);
300
302
  let optionStyle = {
301
- margin: '0 10px 0 0'
303
+ margin: '0 4px 0 0'
302
304
  };
303
305
  let optionName = null;
304
306
  if (inOption) {
@@ -309,6 +311,7 @@ class FilterItem extends _react.default.Component {
309
311
  optionStyle.background = _constants.DELETED_OPTION_BACKGROUND_COLOR;
310
312
  optionName = (0, _lang.getLocale)(_constants.DELETED_OPTION_TIPS);
311
313
  }
314
+ valueArray.push(inOption);
312
315
  labelArray.push(/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
313
316
  className: className,
314
317
  style: optionStyle,
@@ -319,6 +322,7 @@ class FilterItem extends _react.default.Component {
319
322
  });
320
323
  }
321
324
  const selectedOptionNames = labelArray.length > 0 ? {
325
+ value: valueArray,
322
326
  label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Fragment, {
323
327
  children: labelArray
324
328
  })
@@ -425,6 +429,9 @@ class FilterItem extends _react.default.Component {
425
429
  color: selectedOption.textColor || null
426
430
  };
427
431
  selectedOptionName = {
432
+ value: {
433
+ columnOption: selectedOption
434
+ },
428
435
  label: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
429
436
  className: className,
430
437
  style: style,
@@ -507,7 +514,8 @@ class FilterItem extends _react.default.Component {
507
514
  collaborators: creators,
508
515
  onSelectCollaborator: this.onSelectCreator,
509
516
  isInModal: this.props.isInModal,
510
- readOnly: readOnly
517
+ readOnly: readOnly,
518
+ filter_predicate: filter_predicate
511
519
  });
512
520
  }
513
521
  case _dtableUtils.CellType.RATE:
@@ -333,7 +333,7 @@
333
333
  display: inline-flex;
334
334
  align-items: center;
335
335
  height: 20px;
336
- margin-right: 10px;
336
+ margin-right: 4px;
337
337
  padding: 0 8px 0 2px;
338
338
  font-size: 13px;
339
339
  border-radius: 10px;
@@ -412,14 +412,14 @@
412
412
 
413
413
  .filter-header-icon {
414
414
  display: inline-block;
415
- padding: 0 0.3125rem;
415
+ padding-right: 0.5rem;
416
416
  margin-left: -0.3125rem;
417
417
  }
418
418
 
419
419
  .filter-header-icon .dtable-font,
420
420
  .filter-header-icon .multicolor-icon {
421
421
  font-size: 14px;
422
- color: #aaa;
422
+ color: var(--bs-icon-secondary-color);
423
423
  cursor: default;
424
424
  }
425
425
 
@@ -1,10 +1,15 @@
1
1
  .dtable-select-check-icon {
2
- width: 20px;
3
- height: 20px;
2
+ width: 14px;
3
+ height: 14px;
4
4
  text-align: center;
5
5
  }
6
6
 
7
7
  .dtable-select-check-icon .dtable-font {
8
+ font-size: 14px;
9
+ color: var(--bs-icon-color);
10
+ }
11
+
12
+ .seatable-option .select-option-name .seatable-tip-default {
8
13
  font-size: 12px;
9
- color: #798d99;
14
+ margin-top: 4px
10
15
  }
@@ -22,7 +22,7 @@ function DTableSelectLabel(_ref) {
22
22
  }), isSelect && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
23
23
  className: "dtable-select-check-icon",
24
24
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
25
- className: "dtable-font dtable-icon-check-mark"
25
+ className: "dtable-font dtable-icon-check"
26
26
  })
27
27
  })]
28
28
  });
@@ -39,10 +39,11 @@ class DTableSelect extends _react.default.Component {
39
39
  MenuList: _utils.MenuList,
40
40
  ClearIndicator: _utils.ClearIndicator
41
41
  }, userComponents);
42
+ const processedOptions = (0, _utils.processOptionsWithClear)(options, isClearable);
42
43
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.default, {
43
44
  value: value,
44
- onChange: onChange,
45
- options: options,
45
+ onChange: (0, _utils.createHandleChange)(onChange),
46
+ options: processedOptions,
46
47
  isMulti: isMulti,
47
48
  className: className,
48
49
  classNamePrefix: classNamePrefix,
@@ -50,7 +51,6 @@ class DTableSelect extends _react.default.Component {
50
51
  components: mergedComponents,
51
52
  placeholder: placeholder,
52
53
  isSearchable: isSearchable,
53
- isClearable: isClearable,
54
54
  menuPosition: menuPosition || 'fixed' // when use default menuPosition(absolute), menuPortalTarget is unnecessary.
55
55
  ,
56
56
  menuShouldScrollIntoView: true,
@@ -0,0 +1,16 @@
1
+ .select-dropdown-indicator {
2
+ position: absolute;
3
+ top: 50%;
4
+ right: 18px;
5
+ transform: translateY(-50%);
6
+ margin-left: -2px;
7
+ }
8
+
9
+ .select-dropdown-indicator svg {
10
+ width: 12px;
11
+ height: 12px;
12
+ }
13
+
14
+ .dis-multicolor-icon-down {
15
+ opacity: 0.65 !important;
16
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _DTableIcon = _interopRequireDefault(require("../../DTableIcon"));
10
+ require("./index.css");
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ const SelectDropdownIndicator = _ref => {
13
+ let isDisabled = _ref.isDisabled;
14
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
15
+ className: "select-dropdown-indicator d-flex align-items-center",
16
+ "aria-hidden": "true",
17
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableIcon.default, {
18
+ symbol: "down",
19
+ color: "var(--bs-icon-color)",
20
+ className: isDisabled ? 'dis-multicolor-icon-down' : ''
21
+ })
22
+ });
23
+ };
24
+ var _default = exports.default = SelectDropdownIndicator;
@@ -1,51 +1,12 @@
1
- .user-select .select-module-container {
2
- display: flex;
3
- align-items: center;
1
+ /* hide checkbox in select value container */
2
+ .seatable-select-value-container .seatable-multicolor-icon-check {
3
+ display: none;
4
4
  }
5
5
 
6
- .user-select .select-module.select-module-avatar {
7
- height: 24px;
8
- width: 24px;
9
- border-radius: 50%;
6
+ .seatable-select-value-container .select-option-label {
7
+ font-size: 14px !important;
10
8
  }
11
9
 
12
- .user-select .select-module.select-module-name {
13
- color: #212529;
14
- font-size: 14px;
15
- }
16
-
17
- .user-select .true__value-container .select-module-container {
18
- display: block;
19
- }
20
-
21
- .user-select .true__value-container .select-module.select-module-avatar {
22
- height: 16px;
23
- width: 16px;
24
- border-radius: 50%;
25
- }
26
-
27
- .user-select .true__value-container .true__multi-value__label {
28
- padding: 0px;
29
- }
30
-
31
- .user-select .true__value-container .true__multi-value__label .select-module.select-module-avatar {
32
- transform: translateY(-2px);
33
- }
34
-
35
- .user-select .true__value-container .select-module.select-module-name {
36
- font-size: 13px;
37
- overflow: hidden;
38
- text-overflow: ellipsis;
39
- white-space: nowrap;
40
- flex: 1 1;
41
- line-height: 20px;
42
- margin-left: 5px;
43
- }
44
-
45
- .user-select .true__control.true__control--is-focused,
46
- .user-select .true__control.true__control--is-focused:hover {
47
- background-color: #ffffff;
48
- border-color: #1991eb;
49
- outline: 0;
50
- box-shadow: 0 0 0 2px rgba(70, 127, 207, 0.25);
10
+ .seatable-check-color {
11
+ color: var(--bs-icon-secondary-color);
51
12
  }