dtable-ui-component 0.3.20 → 0.3.21

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 (107) hide show
  1. package/lib/AutoNumberFormatter/index.js +2 -9
  2. package/lib/ButtonFormatter/index.js +4 -17
  3. package/lib/CTimeFormatter/index.js +2 -15
  4. package/lib/CheckboxEditor/index.js +0 -13
  5. package/lib/CheckboxFormatter/index.js +2 -11
  6. package/lib/CollaboratorEditor/index.js +6 -44
  7. package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +2 -27
  8. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +2 -20
  9. package/lib/CollaboratorFormatter/index.js +6 -23
  10. package/lib/CollaboratorItem/index.js +2 -14
  11. package/lib/CreatorFormatter/index.js +6 -22
  12. package/lib/DTableCustomizeCollaboratorSelect/index.js +16 -37
  13. package/lib/DTableCustomizeCollaboratorSelect/utils.js +6 -5
  14. package/lib/DTableCustomizeSelect/index.js +14 -37
  15. package/lib/DTablePopover/index.js +8 -26
  16. package/lib/DTableRadio/index.js +0 -2
  17. package/lib/DTableSearchInput/index.js +12 -36
  18. package/lib/DTableSelect/index.js +13 -27
  19. package/lib/DTableSwitch/index.js +4 -6
  20. package/lib/DateEditor/index.js +8 -27
  21. package/lib/DateEditor/mb-date-editor-popover/index.js +8 -42
  22. package/lib/DateEditor/pc-date-editor-popover.js +7 -27
  23. package/lib/DateFormatter/index.js +3 -12
  24. package/lib/DigitalSignFormatter/index.js +8 -26
  25. package/lib/DigitalSignFormatter/utils.js +3 -6
  26. package/lib/DurationFormatter/index.js +3 -10
  27. package/lib/EditEditorButton/index.js +0 -7
  28. package/lib/EmailFormatter/index.js +2 -9
  29. package/lib/FieldDisplaySetting/field-item.js +6 -20
  30. package/lib/FieldDisplaySetting/index.js +8 -13
  31. package/lib/FileEditor/index.js +0 -8
  32. package/lib/FileFormatter/index.js +3 -14
  33. package/lib/FileItemFormatter/index.js +0 -13
  34. package/lib/FileItemFormatter/utils.js +0 -6
  35. package/lib/FileUploader/index.js +0 -16
  36. package/lib/FormulaFormatter/cell-value-validator.js +0 -10
  37. package/lib/FormulaFormatter/index.js +8 -38
  38. package/lib/FormulaFormatter/utils.js +0 -17
  39. package/lib/GeolocationFormatter/index.js +4 -13
  40. package/lib/HtmlLongTextFormatter/index.js +0 -21
  41. package/lib/HtmlLongTextFormatter/markdown2html.js +2 -17
  42. package/lib/HtmlLongTextFormatter/unified/index.js +29 -102
  43. package/lib/HtmlLongTextFormatter/vfile/core.js +13 -32
  44. package/lib/HtmlLongTextFormatter/vfile/index.js +4 -11
  45. package/lib/ImageFormatter/images-lazy-load.js +5 -35
  46. package/lib/ImageFormatter/index.js +7 -34
  47. package/lib/ImageFormatter/utils.js +0 -1
  48. package/lib/ImagePreviewerLightbox/index.js +11 -13
  49. package/lib/LastModifierFormatter/index.js +6 -22
  50. package/lib/LinkEditor/index.js +23 -69
  51. package/lib/LinkEditor/link-editor-option.js +2 -18
  52. package/lib/LinkEditor/mb-link-editor-popover/index.js +2 -27
  53. package/lib/LinkEditor/pc-link-editor-popover/index.js +2 -20
  54. package/lib/LinkFormatter/index.js +12 -35
  55. package/lib/LongTextFormatter/index.js +2 -6
  56. package/lib/MBEditorHeader/index.js +6 -13
  57. package/lib/MTimeFormatter/index.js +2 -15
  58. package/lib/ModalPortal/index.js +0 -8
  59. package/lib/MultipleSelectEditor/index.js +4 -42
  60. package/lib/MultipleSelectFormatter/index.js +4 -17
  61. package/lib/NotificationPopover/index.js +3 -22
  62. package/lib/NumberEditor/index.js +7 -35
  63. package/lib/NumberFormatter/index.js +3 -12
  64. package/lib/RateFormatter/index.js +10 -25
  65. package/lib/RowExpandEmailFormatter/index.js +2 -13
  66. package/lib/RowExpandFileFormatter/index.js +6 -15
  67. package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +6 -24
  68. package/lib/RowExpandFormatter/index.js +10 -60
  69. package/lib/RowExpandFormulaFormatter/index.js +10 -41
  70. package/lib/RowExpandImageFormatter/index.js +8 -27
  71. package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +11 -27
  72. package/lib/RowExpandImageFormatter/utils.js +0 -1
  73. package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +4 -35
  74. package/lib/RowExpandLinkFormatter/index.js +6 -28
  75. package/lib/RowExpandLinkFormatter/utils.js +0 -4
  76. package/lib/RowExpandLinkFormatter/value-display-utils.js +2 -2
  77. package/lib/RowExpandRateFormatter/index.js +8 -23
  78. package/lib/RowExpandUrlFormatter/index.js +2 -14
  79. package/lib/SelectItem/index.js +2 -13
  80. package/lib/SelectOptionGroup/index.js +13 -42
  81. package/lib/SelectOptionGroup/option.js +0 -14
  82. package/lib/SimpleLongTextFormatter/index.js +0 -26
  83. package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +2 -12
  84. package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +1 -16
  85. package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +0 -17
  86. package/lib/SingleSelectEditor/index.js +4 -37
  87. package/lib/SingleSelectFormatter/index.js +5 -17
  88. package/lib/TextEditor/index.js +3 -22
  89. package/lib/TextFormatter/index.js +2 -15
  90. package/lib/UrlFormatter/index.js +2 -9
  91. package/lib/cellFormatterFactory/index.js +0 -5
  92. package/lib/common/delete-tip.js +4 -16
  93. package/lib/common/modal-portal.js +0 -8
  94. package/lib/formatterConfig/base-formatter-config.js +0 -2
  95. package/lib/formatterConfig/index.js +0 -4
  96. package/lib/index.js +12 -6
  97. package/lib/lang/index.js +0 -7
  98. package/lib/select-editor/mb-select-editor-popover/index.js +6 -38
  99. package/lib/select-editor/pc-select-editor-popover/index.js +3 -25
  100. package/lib/select-editor/select-editor-option.js +2 -17
  101. package/lib/toaster/alert.js +0 -12
  102. package/lib/toaster/toast.js +1 -22
  103. package/lib/toaster/toastManager.js +7 -30
  104. package/lib/toaster/toaster.js +4 -15
  105. package/lib/utils/editor-utils.js +0 -20
  106. package/lib/utils/utils.js +2 -5
  107. package/package.json +5 -5
@@ -7,7 +7,6 @@ import classnames from 'classnames';
7
7
  import CollaboratorItem from '../CollaboratorItem';
8
8
  import DefaultAvatar from '../assets/images/avatar/default_avatar.png';
9
9
  import './index.css';
10
-
11
10
  // there will be there conditions
12
11
  // 1 value is not exist, typeof value is array, but it's length is 0
13
12
  // 2 value is exist, but can't find in collaborators
@@ -15,43 +14,33 @@ import './index.css';
15
14
  // 4 value is exist, typeof value is array
16
15
  var CollaboratorFormatter = /*#__PURE__*/function (_React$PureComponent) {
17
16
  _inherits(CollaboratorFormatter, _React$PureComponent);
18
-
19
17
  var _super = _createSuper(CollaboratorFormatter);
20
-
21
18
  function CollaboratorFormatter() {
22
19
  var _this;
23
-
24
20
  _classCallCheck(this, CollaboratorFormatter);
25
-
26
21
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
27
22
  args[_key] = arguments[_key];
28
23
  }
29
-
30
24
  _this = _super.call.apply(_super, [this].concat(args));
31
-
32
25
  _this.getCollaborators = function () {
33
26
  var _this$props = _this.props,
34
- value = _this$props.value,
35
- collaborators = _this$props.collaborators,
36
- enableDeleteCollaborator = _this$props.enableDeleteCollaborator,
37
- onDeleteCollaborator = _this$props.onDeleteCollaborator;
38
-
27
+ value = _this$props.value,
28
+ collaborators = _this$props.collaborators,
29
+ enableDeleteCollaborator = _this$props.enableDeleteCollaborator,
30
+ onDeleteCollaborator = _this$props.onDeleteCollaborator;
39
31
  if (!Array.isArray(value)) {
40
32
  value = [value];
41
33
  }
42
-
43
34
  return value.map(function (item, index) {
44
35
  var collaborator = collaborators.find(function (collaborator) {
45
36
  return collaborator.email === item;
46
37
  });
47
-
48
38
  if (!collaborator) {
49
39
  collaborator = {
50
40
  name: item,
51
41
  avatar_url: DefaultAvatar
52
42
  };
53
43
  }
54
-
55
44
  return /*#__PURE__*/React.createElement(CollaboratorItem, {
56
45
  key: index,
57
46
  collaborator: collaborator,
@@ -60,34 +49,28 @@ var CollaboratorFormatter = /*#__PURE__*/function (_React$PureComponent) {
60
49
  });
61
50
  });
62
51
  };
63
-
64
52
  return _this;
65
53
  }
66
-
67
54
  _createClass(CollaboratorFormatter, [{
68
55
  key: "render",
69
56
  value: function render() {
70
57
  var _this$props2 = this.props,
71
- containerClassName = _this$props2.containerClassName,
72
- value = _this$props2.value;
58
+ containerClassName = _this$props2.containerClassName,
59
+ value = _this$props2.value;
73
60
  var classname = classnames('dtable-ui cell-formatter-container collaborator-formatter', containerClassName);
74
-
75
61
  if (!value || Array.isArray(value) && value.length === 0) {
76
62
  return /*#__PURE__*/React.createElement("div", {
77
63
  className: classname
78
64
  });
79
65
  }
80
-
81
66
  var collaborators = this.getCollaborators();
82
67
  return /*#__PURE__*/React.createElement("div", {
83
68
  className: classname
84
69
  }, collaborators);
85
70
  }
86
71
  }]);
87
-
88
72
  return CollaboratorFormatter;
89
73
  }(React.PureComponent);
90
-
91
74
  CollaboratorFormatter.defaultProps = {
92
75
  value: []
93
76
  };
@@ -4,38 +4,28 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
6
  import './index.css';
7
-
8
7
  var CollaboratorItem = /*#__PURE__*/function (_React$Component) {
9
8
  _inherits(CollaboratorItem, _React$Component);
10
-
11
9
  var _super = _createSuper(CollaboratorItem);
12
-
13
10
  function CollaboratorItem() {
14
11
  var _this;
15
-
16
12
  _classCallCheck(this, CollaboratorItem);
17
-
18
13
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
19
14
  args[_key] = arguments[_key];
20
15
  }
21
-
22
16
  _this = _super.call.apply(_super, [this].concat(args));
23
-
24
17
  _this.onDeleteCollaborator = function () {
25
18
  var collaborator = _this.props.collaborator;
26
-
27
19
  _this.props.onDeleteCollaborator(collaborator);
28
20
  };
29
-
30
21
  return _this;
31
22
  }
32
-
33
23
  _createClass(CollaboratorItem, [{
34
24
  key: "render",
35
25
  value: function render() {
36
26
  var _this$props = this.props,
37
- collaborator = _this$props.collaborator,
38
- enableDeleteCollaborator = _this$props.enableDeleteCollaborator;
27
+ collaborator = _this$props.collaborator,
28
+ enableDeleteCollaborator = _this$props.enableDeleteCollaborator;
39
29
  return /*#__PURE__*/React.createElement("div", {
40
30
  className: "dtable-ui collaborator-item"
41
31
  }, /*#__PURE__*/React.createElement("span", {
@@ -54,10 +44,8 @@ var CollaboratorItem = /*#__PURE__*/function (_React$Component) {
54
44
  })));
55
45
  }
56
46
  }]);
57
-
58
47
  return CollaboratorItem;
59
48
  }(React.Component);
60
-
61
49
  CollaboratorItem.defaultProps = {
62
50
  enableDelete: false
63
51
  };
@@ -7,7 +7,6 @@ import classnames from 'classnames';
7
7
  import CollaboratorItem from '../CollaboratorItem';
8
8
  import DefaultAvatar from '../assets/images/avatar/default_avatar.png';
9
9
  import './index.css';
10
-
11
10
  // there will be there conditions
12
11
  // 1 value is not exist, typeof value is array, but it's length is 0
13
12
  // 2 value is exist, but can't find in collaborators
@@ -15,75 +14,60 @@ import './index.css';
15
14
  // 4 value is exist, typeof value is array
16
15
  var CreatorFormatter = /*#__PURE__*/function (_React$PureComponent) {
17
16
  _inherits(CreatorFormatter, _React$PureComponent);
18
-
19
17
  var _super = _createSuper(CreatorFormatter);
20
-
21
18
  function CreatorFormatter() {
22
19
  var _this;
23
-
24
20
  _classCallCheck(this, CreatorFormatter);
25
-
26
21
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
27
22
  args[_key] = arguments[_key];
28
23
  }
29
-
30
24
  _this = _super.call.apply(_super, [this].concat(args));
31
-
32
25
  _this.getCollaborators = function () {
33
26
  var _this$props = _this.props,
34
- value = _this$props.value,
35
- collaborators = _this$props.collaborators;
36
-
27
+ value = _this$props.value,
28
+ collaborators = _this$props.collaborators;
37
29
  if (!Array.isArray(value)) {
38
30
  value = [value];
39
31
  }
40
-
41
32
  return value.map(function (item, index) {
42
33
  var collaborator = collaborators.find(function (collaborator) {
43
34
  return collaborator.email === item;
44
- }); // the collaborator can be not exist, because the row created by third app
45
-
35
+ });
36
+ // the collaborator can be not exist, because the row created by third app
46
37
  if (!collaborator) {
47
38
  collaborator = {
48
39
  name: item,
49
40
  avatar_url: DefaultAvatar
50
41
  };
51
42
  }
52
-
53
43
  return /*#__PURE__*/React.createElement(CollaboratorItem, {
54
44
  key: index,
55
45
  collaborator: collaborator
56
46
  });
57
47
  });
58
48
  };
59
-
60
49
  return _this;
61
50
  }
62
-
63
51
  _createClass(CreatorFormatter, [{
64
52
  key: "render",
65
53
  value: function render() {
66
54
  var _this$props2 = this.props,
67
- containerClassName = _this$props2.containerClassName,
68
- value = _this$props2.value;
55
+ containerClassName = _this$props2.containerClassName,
56
+ value = _this$props2.value;
69
57
  var classname = classnames('dtable-ui cell-formatter-container creator-formatter', containerClassName);
70
-
71
58
  if (!value || Array.isArray(value) && value.length === 0) {
72
59
  return /*#__PURE__*/React.createElement("div", {
73
60
  className: classname
74
61
  });
75
62
  }
76
-
77
63
  var collaborators = this.getCollaborators();
78
64
  return /*#__PURE__*/React.createElement("div", {
79
65
  className: classname
80
66
  }, collaborators);
81
67
  }
82
68
  }]);
83
-
84
69
  return CreatorFormatter;
85
70
  }(React.PureComponent);
86
-
87
71
  CreatorFormatter.defaultProps = {
88
72
  value: ''
89
73
  };
@@ -8,75 +8,60 @@ import { Popover } from 'reactstrap';
8
8
  import SelectOptionGroup from '../SelectOptionGroup';
9
9
  import { searchCollaborators } from './utils';
10
10
  import './index.css';
11
-
12
11
  var CollaboratorSelect = /*#__PURE__*/function (_Component) {
13
12
  _inherits(CollaboratorSelect, _Component);
14
-
15
13
  var _super = _createSuper(CollaboratorSelect);
16
-
17
14
  function CollaboratorSelect(props) {
18
15
  var _this;
19
-
20
16
  _classCallCheck(this, CollaboratorSelect);
21
-
22
17
  _this = _super.call(this, props);
23
-
24
18
  _this.onSelectToggle = function (event) {
25
19
  event.preventDefault();
26
20
  /*
27
21
  if select is showing, click events do not need to be monitored by other click events,
28
22
  so it can be closed when other select is clicked.
29
23
  */
30
-
31
24
  if (_this.state.isShowSelectOptions) event.nativeEvent.stopImmediatePropagation();
32
25
  var eventClassName = event.target.className;
33
- if (_this.props.isLocked || eventClassName.indexOf('option-search-control') > -1 || eventClassName === 'option-group-search') return; //Prevent closing by pressing the spacebar in the search input
34
-
26
+ if (_this.props.isLocked || eventClassName.indexOf('option-search-control') > -1 || eventClassName === 'option-group-search') return;
27
+ //Prevent closing by pressing the spacebar in the search input
35
28
  if (event.target.value === '') return;
36
29
  _this.selectedOptionWidth = _this.selectedOptionRef.clientWidth;
37
-
38
30
  _this.setState({
39
31
  isShowSelectOptions: !_this.state.isShowSelectOptions
40
32
  });
41
33
  };
42
-
43
34
  _this.onClick = function (event) {
44
35
  var name = event.target.className;
45
-
46
36
  if (name === 'select-placeholder' || name.includes('icon-fork-number')) {
47
37
  return;
48
38
  }
49
-
50
39
  if (!_this.selector.contains(event.target)) {
51
40
  _this.closeSelect();
52
41
  }
53
42
  };
54
-
55
43
  _this.closeSelect = function () {
56
44
  _this.setState({
57
45
  isShowSelectOptions: false
58
46
  });
59
47
  };
60
-
61
48
  _this.getFilterOptions = function (searchValue) {
62
49
  var _this$props = _this.props,
63
- options = _this$props.options,
64
- searchable = _this$props.searchable;
50
+ options = _this$props.options,
51
+ searchable = _this$props.searchable;
65
52
  if (!searchable) return options || [];
66
53
  return searchCollaborators(options, searchValue);
67
54
  };
68
-
69
55
  _this.renderOptionGroup = function () {
70
56
  var _this$props2 = _this.props,
71
- value = _this$props2.value,
72
- options = _this$props2.options,
73
- searchable = _this$props2.searchable,
74
- searchPlaceholder = _this$props2.searchPlaceholder,
75
- noOptionsPlaceholder = _this$props2.noOptionsPlaceholder,
76
- top = _this$props2.top,
77
- left = _this$props2.left,
78
- isUsePopover = _this$props2.isUsePopover;
79
-
57
+ value = _this$props2.value,
58
+ options = _this$props2.options,
59
+ searchable = _this$props2.searchable,
60
+ searchPlaceholder = _this$props2.searchPlaceholder,
61
+ noOptionsPlaceholder = _this$props2.noOptionsPlaceholder,
62
+ top = _this$props2.top,
63
+ left = _this$props2.left,
64
+ isUsePopover = _this$props2.isUsePopover;
80
65
  if (!isUsePopover) {
81
66
  return /*#__PURE__*/React.createElement(SelectOptionGroup, {
82
67
  value: value,
@@ -96,7 +81,6 @@ var CollaboratorSelect = /*#__PURE__*/function (_Component) {
96
81
  isShowSelected: true
97
82
  });
98
83
  }
99
-
100
84
  return /*#__PURE__*/React.createElement(Popover, {
101
85
  placement: "bottom",
102
86
  isOpen: true,
@@ -122,14 +106,12 @@ var CollaboratorSelect = /*#__PURE__*/function (_Component) {
122
106
  isShowSelected: true
123
107
  }));
124
108
  };
125
-
126
109
  _this.state = {
127
110
  isShowSelectOptions: false
128
111
  };
129
112
  _this.id = 'collaborator-select-' + Math.trunc(Math.random() * 10000);
130
113
  return _this;
131
114
  }
132
-
133
115
  _createClass(CollaboratorSelect, [{
134
116
  key: "componentDidMount",
135
117
  value: function componentDidMount() {
@@ -145,12 +127,11 @@ var CollaboratorSelect = /*#__PURE__*/function (_Component) {
145
127
  key: "render",
146
128
  value: function render() {
147
129
  var _this2 = this;
148
-
149
130
  var _this$props3 = this.props,
150
- className = _this$props3.className,
151
- value = _this$props3.value,
152
- placeholder = _this$props3.placeholder,
153
- isLocked = _this$props3.isLocked;
131
+ className = _this$props3.className,
132
+ value = _this$props3.value,
133
+ placeholder = _this$props3.placeholder,
134
+ isLocked = _this$props3.isLocked;
154
135
  return /*#__PURE__*/React.createElement("button", {
155
136
  ref: function ref(node) {
156
137
  return _this2.selector = node;
@@ -176,10 +157,8 @@ var CollaboratorSelect = /*#__PURE__*/function (_Component) {
176
157
  })), this.state.isShowSelectOptions && this.renderOptionGroup());
177
158
  }
178
159
  }]);
179
-
180
160
  return CollaboratorSelect;
181
161
  }(Component);
182
-
183
162
  CollaboratorSelect.defaultProps = {
184
163
  top: -3,
185
164
  left: -3
@@ -4,17 +4,18 @@ export var searchCollaborators = function searchCollaborators(collaborators, sea
4
4
  if (!validSearchValue) return validCollaborators;
5
5
  return validCollaborators.filter(function (collaborator) {
6
6
  var name = collaborator.name,
7
- _collaborator$name_pi = collaborator.name_pinyin,
8
- name_pinyin = _collaborator$name_pi === void 0 ? '' : _collaborator$name_pi;
7
+ _collaborator$name_pi = collaborator.name_pinyin,
8
+ name_pinyin = _collaborator$name_pi === void 0 ? '' : _collaborator$name_pi;
9
9
  if (name.toString().toLowerCase().indexOf(validSearchValue) > -1) return true;
10
10
  if (!name_pinyin) return false;
11
11
  var validNamePinyin = name_pinyin.toString().toLowerCase();
12
- var validSearchPinyinValue = validSearchValue.replace(/ |'/g, ''); // complete
12
+ var validSearchPinyinValue = validSearchValue.replace(/ |'/g, '');
13
13
 
14
+ // complete
14
15
  if (validNamePinyin.indexOf(validSearchPinyinValue) > -1) return true;
15
16
  if (validNamePinyin.replace(/'/g, '').indexOf(validSearchPinyinValue) > -1) return true;
16
- var validNamePinyinList = validNamePinyin.split('\''); // acronym
17
-
17
+ var validNamePinyinList = validNamePinyin.split('\'');
18
+ // acronym
18
19
  var namePinyinAcronym = validNamePinyinList.map(function (item) {
19
20
  return item && item.trim() ? item.trim().slice(0, 1) : '';
20
21
  });
@@ -6,91 +6,71 @@ import React, { Component } from 'react';
6
6
  import SelectOptionGroup from '../SelectOptionGroup';
7
7
  import classnames from 'classnames';
8
8
  import '../assets/css/DTableCustomSelect.css';
9
-
10
9
  var DTableCustomizeSelect = /*#__PURE__*/function (_Component) {
11
10
  _inherits(DTableCustomizeSelect, _Component);
12
-
13
11
  var _super = _createSuper(DTableCustomizeSelect);
14
-
15
12
  function DTableCustomizeSelect(props) {
16
13
  var _this;
17
-
18
14
  _classCallCheck(this, DTableCustomizeSelect);
19
-
20
15
  _this = _super.call(this, props);
21
-
22
16
  _this.onSelectToggle = function (event) {
23
17
  event.preventDefault();
24
18
  /*
25
19
  if select is showing, click events do not need to be monitored by other click events,
26
20
  so it can be closed when other select is clicked.
27
21
  */
28
-
29
22
  if (_this.state.isShowSelectOptions) event.nativeEvent.stopImmediatePropagation();
30
23
  var eventClassName = event.target.className;
31
- if (_this.props.isLocked || eventClassName.indexOf('option-search-control') > -1 || eventClassName === 'option-group-search') return; //Prevent closing by pressing the spacebar in the search input
32
-
24
+ if (_this.props.isLocked || eventClassName.indexOf('option-search-control') > -1 || eventClassName === 'option-group-search') return;
25
+ //Prevent closing by pressing the spacebar in the search input
33
26
  if (event.target.value === '') return;
34
-
35
27
  _this.setState({
36
28
  isShowSelectOptions: !_this.state.isShowSelectOptions
37
29
  });
38
30
  };
39
-
40
31
  _this.onClick = function (event) {
41
32
  if (_this.props.isShowSelected && event.target.className.includes('icon-fork-number')) {
42
33
  return;
43
34
  }
44
-
45
35
  if (!_this.selector.contains(event.target)) {
46
36
  _this.closeSelect();
47
37
  }
48
38
  };
49
-
50
39
  _this.closeSelect = function () {
51
40
  _this.setState({
52
41
  isShowSelectOptions: false
53
42
  });
54
43
  };
55
-
56
44
  _this.getSelectedOptionTop = function () {
57
45
  if (!_this.selector) return 38;
58
-
59
46
  var _this$selector$getBou = _this.selector.getBoundingClientRect(),
60
- height = _this$selector$getBou.height;
61
-
47
+ height = _this$selector$getBou.height;
62
48
  return height;
63
49
  };
64
-
65
50
  _this.getFilterOptions = function (searchValue) {
66
51
  var _this$props = _this.props,
67
- options = _this$props.options,
68
- searchable = _this$props.searchable;
52
+ options = _this$props.options,
53
+ searchable = _this$props.searchable;
69
54
  if (!searchable) return options || [];
70
55
  var validSearchVal = searchValue.trim().toLowerCase();
71
56
  if (!validSearchVal) return options || [];
72
57
  return options.filter(function (option) {
73
58
  var value = option.value,
74
- name = option.name;
75
-
59
+ name = option.name;
76
60
  if (typeof name === 'string') {
77
61
  return name.toLowerCase().indexOf(validSearchVal) > -1;
78
62
  }
79
-
80
63
  if (typeof value === 'object') {
81
64
  return value.columnOption && value.columnOption.name.toLowerCase().indexOf(validSearchVal) > -1;
82
65
  }
83
-
84
66
  return false;
85
67
  });
86
68
  };
87
-
88
69
  _this.state = {
89
70
  isShowSelectOptions: false
90
71
  };
91
72
  return _this;
92
73
  }
93
-
94
74
  _createClass(DTableCustomizeSelect, [{
95
75
  key: "componentDidMount",
96
76
  value: function componentDidMount() {
@@ -105,16 +85,15 @@ var DTableCustomizeSelect = /*#__PURE__*/function (_Component) {
105
85
  key: "render",
106
86
  value: function render() {
107
87
  var _this2 = this;
108
-
109
88
  var _this$props2 = this.props,
110
- className = _this$props2.className,
111
- value = _this$props2.value,
112
- options = _this$props2.options,
113
- placeholder = _this$props2.placeholder,
114
- searchable = _this$props2.searchable,
115
- searchPlaceholder = _this$props2.searchPlaceholder,
116
- noOptionsPlaceholder = _this$props2.noOptionsPlaceholder,
117
- isLocked = _this$props2.isLocked;
89
+ className = _this$props2.className,
90
+ value = _this$props2.value,
91
+ options = _this$props2.options,
92
+ placeholder = _this$props2.placeholder,
93
+ searchable = _this$props2.searchable,
94
+ searchPlaceholder = _this$props2.searchPlaceholder,
95
+ noOptionsPlaceholder = _this$props2.noOptionsPlaceholder,
96
+ isLocked = _this$props2.isLocked;
118
97
  return /*#__PURE__*/React.createElement("div", {
119
98
  ref: function ref(node) {
120
99
  return _this2.selector = node;
@@ -148,8 +127,6 @@ var DTableCustomizeSelect = /*#__PURE__*/function (_Component) {
148
127
  }));
149
128
  }
150
129
  }]);
151
-
152
130
  return DTableCustomizeSelect;
153
131
  }(Component);
154
-
155
132
  export default DTableCustomizeSelect;
@@ -5,35 +5,25 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
6
  import { Popover } from 'reactstrap';
7
7
  import { getEventClassName } from './utils';
8
-
9
8
  var DTablePopover = /*#__PURE__*/function (_React$Component) {
10
9
  _inherits(DTablePopover, _React$Component);
11
-
12
10
  var _super = _createSuper(DTablePopover);
13
-
14
11
  function DTablePopover() {
15
12
  var _this;
16
-
17
13
  _classCallCheck(this, DTablePopover);
18
-
19
14
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
20
15
  args[_key] = arguments[_key];
21
16
  }
22
-
23
17
  _this = _super.call.apply(_super, [this].concat(args));
24
18
  _this.dtablePopoverRef = null;
25
-
26
19
  _this.onHistoryState = function (e) {
27
20
  e.preventDefault();
28
-
29
21
  _this.props.hideDTablePopover(e);
30
22
  };
31
-
32
23
  _this.onKeyDown = function (e) {
33
24
  var _this$props = _this.props,
34
- canHideDTablePopover = _this$props.canHideDTablePopover,
35
- hideDTablePopoverWithEsc = _this$props.hideDTablePopoverWithEsc;
36
-
25
+ canHideDTablePopover = _this$props.canHideDTablePopover,
26
+ hideDTablePopoverWithEsc = _this$props.hideDTablePopoverWithEsc;
37
27
  if (e.keyCode === 27 && typeof hideDTablePopoverWithEsc === 'function') {
38
28
  e.preventDefault();
39
29
  hideDTablePopoverWithEsc();
@@ -43,23 +33,18 @@ var DTablePopover = /*#__PURE__*/function (_React$Component) {
43
33
  e.stopImmediatePropagation();
44
34
  }
45
35
  };
46
-
47
36
  _this.onClick = function (e) {
48
37
  var canHideDTablePopover = _this.props.canHideDTablePopover;
49
38
  if (!canHideDTablePopover) return;
50
-
51
39
  if (_this.dtablePopoverRef && e && getEventClassName(e).indexOf('popover') === -1 && !_this.dtablePopoverRef.contains(e.target)) {
52
40
  _this.props.hideDTablePopover(e);
53
41
  }
54
42
  };
55
-
56
43
  _this.onPopoverInsideClick = function (e) {
57
44
  e.stopPropagation();
58
45
  };
59
-
60
46
  return _this;
61
47
  }
62
-
63
48
  _createClass(DTablePopover, [{
64
49
  key: "componentDidMount",
65
50
  value: function componentDidMount() {
@@ -78,14 +63,13 @@ var DTablePopover = /*#__PURE__*/function (_React$Component) {
78
63
  key: "render",
79
64
  value: function render() {
80
65
  var _this2 = this;
81
-
82
66
  var _this$props2 = this.props,
83
- target = _this$props2.target,
84
- innerClassName = _this$props2.innerClassName,
85
- popoverClassName = _this$props2.popoverClassName,
86
- hideArrow = _this$props2.hideArrow,
87
- modifiers = _this$props2.modifiers,
88
- placement = _this$props2.placement;
67
+ target = _this$props2.target,
68
+ innerClassName = _this$props2.innerClassName,
69
+ popoverClassName = _this$props2.popoverClassName,
70
+ hideArrow = _this$props2.hideArrow,
71
+ modifiers = _this$props2.modifiers,
72
+ placement = _this$props2.placement;
89
73
  return /*#__PURE__*/React.createElement(Popover, {
90
74
  placement: placement,
91
75
  isOpen: true,
@@ -103,10 +87,8 @@ var DTablePopover = /*#__PURE__*/function (_React$Component) {
103
87
  }, this.props.children));
104
88
  }
105
89
  }]);
106
-
107
90
  return DTablePopover;
108
91
  }(React.Component);
109
-
110
92
  DTablePopover.defaultProps = {
111
93
  placement: 'bottom-start',
112
94
  hideArrow: true,
@@ -2,7 +2,6 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import React from 'react';
3
3
  import classnames from 'classnames';
4
4
  import './index.css';
5
-
6
5
  function DTableRadio(props) {
7
6
  var className = props.className;
8
7
  return /*#__PURE__*/React.createElement("label", {
@@ -25,7 +24,6 @@ function DTableRadio(props) {
25
24
  className: "dtable-radio-description text-truncate ml-2"
26
25
  }, props.label));
27
26
  }
28
-
29
27
  DTableRadio.defaultProps = {
30
28
  disabled: false,
31
29
  name: 'dtable-radio-input',