dtable-ui-component 4.3.7 → 4.3.8

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 (120) hide show
  1. package/lib/AutoNumberFormatter/index.js +11 -24
  2. package/lib/ButtonFormatter/index.js +29 -45
  3. package/lib/CTimeFormatter/index.js +17 -32
  4. package/lib/CheckboxEditor/index.js +42 -49
  5. package/lib/CheckboxFormatter/index.js +17 -30
  6. package/lib/CollaboratorEditor/index.js +118 -135
  7. package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +90 -99
  8. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +61 -69
  9. package/lib/CollaboratorFormatter/index.js +26 -42
  10. package/lib/CollaboratorItem/index.js +31 -44
  11. package/lib/CreatorFormatter/index.js +24 -40
  12. package/lib/DTableCustomizeCollaboratorSelect/index.js +80 -99
  13. package/lib/DTableCustomizeCollaboratorSelect/utils.js +12 -13
  14. package/lib/DTableCustomizeSelect/index.js +92 -103
  15. package/lib/DTablePopover/index.js +52 -71
  16. package/lib/DTablePopover/utils.js +1 -1
  17. package/lib/DTableRadio/index.js +9 -7
  18. package/lib/DTableSearchInput/index.js +89 -99
  19. package/lib/DTableSearchInput/utils.js +2 -2
  20. package/lib/DTableSelect/dtable-select-label.js +5 -3
  21. package/lib/DTableSelect/index.js +50 -64
  22. package/lib/DTableSelect/utils.js +36 -41
  23. package/lib/DTableSwitch/index.js +7 -5
  24. package/lib/DateEditor/index.js +88 -94
  25. package/lib/DateEditor/mb-date-editor-popover/index.js +136 -134
  26. package/lib/DateEditor/pc-date-editor-popover.js +70 -77
  27. package/lib/DateFormatter/index.js +15 -28
  28. package/lib/DepartmentSingleSelectFormatter/index.js +9 -9
  29. package/lib/DigitalSignFormatter/index.js +55 -65
  30. package/lib/DigitalSignFormatter/utils.js +9 -8
  31. package/lib/DurationFormatter/index.js +14 -27
  32. package/lib/EditEditorButton/index.js +10 -22
  33. package/lib/EmailFormatter/index.js +11 -24
  34. package/lib/FieldDisplaySetting/field-item.js +18 -20
  35. package/lib/FieldDisplaySetting/index.js +41 -43
  36. package/lib/FileEditor/index.js +18 -29
  37. package/lib/FileFormatter/index.js +29 -43
  38. package/lib/FileItemFormatter/index.js +17 -32
  39. package/lib/FileItemFormatter/utils.js +5 -5
  40. package/lib/FileUploader/index.js +20 -33
  41. package/lib/FormulaFormatter/cell-value-validator.js +23 -8
  42. package/lib/FormulaFormatter/index.js +77 -83
  43. package/lib/FormulaFormatter/utils.js +27 -21
  44. package/lib/GeolocationFormatter/index.js +19 -32
  45. package/lib/HtmlLongTextFormatter/index.js +43 -52
  46. package/lib/HtmlLongTextFormatter/markdown2html.js +2 -2
  47. package/lib/HtmlLongTextFormatter/unified/index.js +1 -1
  48. package/lib/HtmlLongTextFormatter/vfile/core.js +10 -10
  49. package/lib/ImageFormatter/images-lazy-load.js +71 -79
  50. package/lib/ImageFormatter/index.js +86 -97
  51. package/lib/ImageFormatter/utils.js +1 -1
  52. package/lib/ImagePreviewerLightbox/index.js +20 -18
  53. package/lib/ImagePreviewerLightbox/utils.js +3 -3
  54. package/lib/LastModifierFormatter/index.js +24 -40
  55. package/lib/LinkEditor/index.js +163 -167
  56. package/lib/LinkEditor/link-editor-option.js +41 -56
  57. package/lib/LinkEditor/mb-link-editor-popover/index.js +90 -99
  58. package/lib/LinkEditor/pc-link-editor-popover/index.js +63 -71
  59. package/lib/LinkFormatter/index.js +75 -77
  60. package/lib/LongTextFormatter/index.js +5 -3
  61. package/lib/MBEditorHeader/index.js +25 -38
  62. package/lib/MTimeFormatter/index.js +17 -32
  63. package/lib/ModalPortal/index.js +15 -32
  64. package/lib/MultipleSelectEditor/index.js +118 -136
  65. package/lib/MultipleSelectFormatter/index.js +24 -40
  66. package/lib/NotificationPopover/index.js +68 -95
  67. package/lib/NumberEditor/index.js +75 -82
  68. package/lib/NumberFormatter/index.js +15 -28
  69. package/lib/RateFormatter/index.js +29 -45
  70. package/lib/RoleStatusEditor/index.js +20 -22
  71. package/lib/RowExpandEmailFormatter/index.js +24 -37
  72. package/lib/RowExpandFileFormatter/index.js +28 -42
  73. package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +66 -82
  74. package/lib/RowExpandFormatter/index.js +92 -96
  75. package/lib/RowExpandFormulaFormatter/index.js +85 -91
  76. package/lib/RowExpandImageFormatter/index.js +65 -82
  77. package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +71 -84
  78. package/lib/RowExpandImageFormatter/utils.js +1 -1
  79. package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +54 -68
  80. package/lib/RowExpandLinkFormatter/index.js +131 -137
  81. package/lib/RowExpandLinkFormatter/utils.js +23 -17
  82. package/lib/RowExpandLinkFormatter/value-display-utils.js +9 -7
  83. package/lib/RowExpandRateFormatter/index.js +27 -42
  84. package/lib/RowExpandUrlFormatter/index.js +27 -40
  85. package/lib/SelectItem/index.js +17 -33
  86. package/lib/SelectOptionGroup/index.js +141 -159
  87. package/lib/SelectOptionGroup/option.js +24 -40
  88. package/lib/SimpleLongTextFormatter/index.js +55 -67
  89. package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +23 -22
  90. package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +42 -57
  91. package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +31 -46
  92. package/lib/SingleSelectEditor/index.js +108 -119
  93. package/lib/SingleSelectFormatter/index.js +21 -37
  94. package/lib/TextEditor/index.js +45 -51
  95. package/lib/TextFormatter/index.js +17 -32
  96. package/lib/UrlFormatter/index.js +11 -24
  97. package/lib/cellFormatterFactory/index.js +8 -17
  98. package/lib/common/ClickOutside.js +22 -43
  99. package/lib/common/delete-tip.js +40 -65
  100. package/lib/common/modal-portal.js +15 -33
  101. package/lib/constants/index.js +5 -5
  102. package/lib/data/dtable-value.js +4 -4
  103. package/lib/formatterConfig/base-formatter-config.js +24 -3
  104. package/lib/formatterConfig/index.js +5 -4
  105. package/lib/lang/index.js +6 -6
  106. package/lib/locals/de.js +1 -1
  107. package/lib/locals/en.js +1 -1
  108. package/lib/locals/fr.js +1 -1
  109. package/lib/locals/zh-CN.js +1 -1
  110. package/lib/select-editor/mb-select-editor-popover/index.js +126 -137
  111. package/lib/select-editor/pc-select-editor-popover/index.js +75 -83
  112. package/lib/select-editor/select-editor-option.js +41 -56
  113. package/lib/toaster/alert.js +73 -88
  114. package/lib/toaster/index.js +1 -1
  115. package/lib/toaster/toast.js +75 -102
  116. package/lib/toaster/toastManager.js +55 -91
  117. package/lib/toaster/toaster.js +58 -57
  118. package/lib/utils/editor-utils.js +17 -19
  119. package/lib/utils/utils.js +14 -14
  120. package/package.json +4 -4
@@ -1,29 +1,19 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _inherits from "@babel/runtime/helpers/esm/inherits";
4
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
1
  import React from 'react';
6
2
  import { Popover } from 'reactstrap';
7
3
  import { getEventClassName } from './utils';
8
- var DTablePopover = /*#__PURE__*/function (_React$Component) {
9
- _inherits(DTablePopover, _React$Component);
10
- var _super = _createSuper(DTablePopover);
11
- function DTablePopover() {
12
- var _this;
13
- _classCallCheck(this, DTablePopover);
14
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
15
- args[_key] = arguments[_key];
16
- }
17
- _this = _super.call.apply(_super, [this].concat(args));
18
- _this.dtablePopoverRef = null;
19
- _this.onHistoryState = function (e) {
4
+ class DTablePopover extends React.Component {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.dtablePopoverRef = null;
8
+ this.onHistoryState = e => {
20
9
  e.preventDefault();
21
- _this.props.hideDTablePopover(e);
10
+ this.props.hideDTablePopover(e);
22
11
  };
23
- _this.onKeyDown = function (e) {
24
- var _this$props = _this.props,
25
- canHideDTablePopover = _this$props.canHideDTablePopover,
26
- hideDTablePopoverWithEsc = _this$props.hideDTablePopoverWithEsc;
12
+ this.onKeyDown = e => {
13
+ const {
14
+ canHideDTablePopover,
15
+ hideDTablePopoverWithEsc
16
+ } = this.props;
27
17
  if (e.keyCode === 27 && typeof hideDTablePopoverWithEsc === 'function') {
28
18
  e.preventDefault();
29
19
  hideDTablePopoverWithEsc();
@@ -33,62 +23,53 @@ var DTablePopover = /*#__PURE__*/function (_React$Component) {
33
23
  e.stopImmediatePropagation();
34
24
  }
35
25
  };
36
- _this.onMousedown = function (e) {
37
- var canHideDTablePopover = _this.props.canHideDTablePopover;
26
+ this.onMousedown = e => {
27
+ const {
28
+ canHideDTablePopover
29
+ } = this.props;
38
30
  if (!canHideDTablePopover) return;
39
- if (_this.dtablePopoverRef && e && getEventClassName(e).indexOf('popover') === -1 && !_this.dtablePopoverRef.contains(e.target)) {
40
- _this.props.hideDTablePopover(e);
31
+ if (this.dtablePopoverRef && e && getEventClassName(e).indexOf('popover') === -1 && !this.dtablePopoverRef.contains(e.target)) {
32
+ this.props.hideDTablePopover(e);
41
33
  }
42
34
  };
43
- _this.onPopoverInsideClick = function (e) {
35
+ this.onPopoverInsideClick = e => {
44
36
  e.stopPropagation();
45
37
  };
46
- return _this;
47
38
  }
48
- _createClass(DTablePopover, [{
49
- key: "componentDidMount",
50
- value: function componentDidMount() {
51
- document.addEventListener('mousedown', this.onMousedown);
52
- document.addEventListener('keydown', this.onKeyDown);
53
- window.addEventListener('popstate', this.onHistoryState);
54
- }
55
- }, {
56
- key: "componentWillUnmount",
57
- value: function componentWillUnmount() {
58
- document.removeEventListener('mousedown', this.onMousedown);
59
- document.removeEventListener('keydown', this.onKeyDown);
60
- window.removeEventListener('popstate', this.onHistoryState);
61
- }
62
- }, {
63
- key: "render",
64
- value: function render() {
65
- var _this2 = this;
66
- var _this$props2 = this.props,
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;
73
- return /*#__PURE__*/React.createElement(Popover, {
74
- placement: placement,
75
- isOpen: true,
76
- target: target,
77
- fade: false,
78
- hideArrow: hideArrow,
79
- innerClassName: innerClassName,
80
- className: popoverClassName,
81
- modifiers: modifiers
82
- }, /*#__PURE__*/React.createElement("div", {
83
- ref: function ref(_ref) {
84
- return _this2.dtablePopoverRef = _ref;
85
- },
86
- onClick: this.onPopoverInsideClick
87
- }, this.props.children));
88
- }
89
- }]);
90
- return DTablePopover;
91
- }(React.Component);
39
+ componentDidMount() {
40
+ document.addEventListener('mousedown', this.onMousedown);
41
+ document.addEventListener('keydown', this.onKeyDown);
42
+ window.addEventListener('popstate', this.onHistoryState);
43
+ }
44
+ componentWillUnmount() {
45
+ document.removeEventListener('mousedown', this.onMousedown);
46
+ document.removeEventListener('keydown', this.onKeyDown);
47
+ window.removeEventListener('popstate', this.onHistoryState);
48
+ }
49
+ render() {
50
+ const {
51
+ target,
52
+ innerClassName,
53
+ popoverClassName,
54
+ hideArrow,
55
+ modifiers,
56
+ placement
57
+ } = this.props;
58
+ return /*#__PURE__*/React.createElement(Popover, {
59
+ placement: placement,
60
+ isOpen: true,
61
+ target: target,
62
+ fade: false,
63
+ hideArrow: hideArrow,
64
+ innerClassName: innerClassName,
65
+ className: popoverClassName,
66
+ modifiers: modifiers
67
+ }, /*#__PURE__*/React.createElement("div", {
68
+ ref: ref => this.dtablePopoverRef = ref,
69
+ onClick: this.onPopoverInsideClick
70
+ }, this.props.children));
71
+ }
72
+ }
92
73
  DTablePopover.defaultProps = {
93
74
  placement: 'bottom-start',
94
75
  hideArrow: true,
@@ -1,4 +1,4 @@
1
- export var getEventClassName = function getEventClassName(e) {
1
+ export const getEventClassName = e => {
2
2
  // svg mouseEvent event.target.className is an object
3
3
  if (!e || !e.target) return '';
4
4
  return e.target.getAttribute('class') || '';
@@ -1,18 +1,20 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
1
  import React from 'react';
3
2
  import classnames from 'classnames';
4
3
  import './index.css';
5
4
  function DTableRadio(props) {
6
- var className = props.className;
5
+ const {
6
+ className
7
+ } = props;
7
8
  return /*#__PURE__*/React.createElement("label", {
8
- className: classnames('dtable-radio w-100 align-items-center', _defineProperty({
9
- 'dtable-radio-disable': props.disabled
10
- }, className, className))
9
+ className: classnames('dtable-radio w-100 align-items-center', {
10
+ 'dtable-radio-disable': props.disabled,
11
+ [className]: className
12
+ })
11
13
  }, /*#__PURE__*/React.createElement("input", {
12
14
  type: "radio",
13
15
  className: "dtable-radio-input position-absolute",
14
16
  checked: props.isChecked,
15
- onChange: props.disabled ? function () {} : props.onCheckedChange,
17
+ onChange: props.disabled ? () => {} : props.onCheckedChange,
16
18
  name: props.name,
17
19
  value: props.value
18
20
  }), /*#__PURE__*/React.createElement("span", {
@@ -27,6 +29,6 @@ function DTableRadio(props) {
27
29
  DTableRadio.defaultProps = {
28
30
  disabled: false,
29
31
  name: 'dtable-radio-input',
30
- onCheckedChange: function onCheckedChange() {}
32
+ onCheckedChange: () => {}
31
33
  };
32
34
  export default DTableRadio;
@@ -1,134 +1,124 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _inherits from "@babel/runtime/helpers/esm/inherits";
4
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
1
  import React, { Component, Fragment } from 'react';
6
2
  import classnames from 'classnames';
7
3
  import { isFunction } from './utils';
8
- var DtableSearchInput = /*#__PURE__*/function (_Component) {
9
- _inherits(DtableSearchInput, _Component);
10
- var _super = _createSuper(DtableSearchInput);
11
- function DtableSearchInput(props) {
12
- var _this;
13
- _classCallCheck(this, DtableSearchInput);
14
- _this = _super.call(this, props);
15
- _this.onCompositionStart = function () {
16
- _this.isInputtingChinese = true;
4
+ class DtableSearchInput extends Component {
5
+ constructor(props) {
6
+ super(props);
7
+ this.onCompositionStart = () => {
8
+ this.isInputtingChinese = true;
17
9
  };
18
- _this.onChange = function (e) {
19
- _this.timer && clearTimeout(_this.timer);
20
- var _this$props = _this.props,
21
- onChange = _this$props.onChange,
22
- wait = _this$props.wait;
23
- var text = e.target.value;
24
- _this.setState({
10
+ this.onChange = e => {
11
+ this.timer && clearTimeout(this.timer);
12
+ const {
13
+ onChange,
14
+ wait
15
+ } = this.props;
16
+ let text = e.target.value;
17
+ this.setState({
25
18
  searchValue: text || ''
26
- }, function () {
27
- if (_this.isInputtingChinese) return;
28
- _this.timer = setTimeout(function () {
29
- onChange && onChange(_this.state.searchValue.trim());
19
+ }, () => {
20
+ if (this.isInputtingChinese) return;
21
+ this.timer = setTimeout(() => {
22
+ onChange && onChange(this.state.searchValue.trim());
30
23
  }, wait);
31
24
  });
32
25
  };
33
- _this.onCompositionEnd = function (e) {
34
- _this.isInputtingChinese = false;
35
- _this.onChange(e);
26
+ this.onCompositionEnd = e => {
27
+ this.isInputtingChinese = false;
28
+ this.onChange(e);
36
29
  };
37
- _this.clearSearch = function () {
38
- var clearValue = _this.props.clearValue;
39
- _this.setState({
30
+ this.clearSearch = () => {
31
+ const {
32
+ clearValue
33
+ } = this.props;
34
+ this.setState({
40
35
  searchValue: ''
41
- }, function () {
36
+ }, () => {
42
37
  clearValue && clearValue();
43
38
  });
44
39
  };
45
- _this.setFocus = function (isSelectAllText) {
46
- if (_this.inputRef === document.activeElement) return;
47
- _this.inputRef.focus();
40
+ this.setFocus = isSelectAllText => {
41
+ if (this.inputRef === document.activeElement) return;
42
+ this.inputRef.focus();
48
43
  if (isSelectAllText) {
49
- var txtLength = _this.state.searchValue.length;
50
- _this.inputRef.setSelectionRange(0, txtLength);
44
+ const txtLength = this.state.searchValue.length;
45
+ this.inputRef.setSelectionRange(0, txtLength);
51
46
  }
52
47
  };
53
- _this.renderClear = function () {
54
- var _this$props2 = _this.props,
55
- isClearable = _this$props2.isClearable,
56
- clearClassName = _this$props2.clearClassName,
57
- _this$props2$componen = _this$props2.components,
58
- components = _this$props2$componen === void 0 ? {} : _this$props2$componen;
59
- var searchValue = _this.state.searchValue;
48
+ this.renderClear = () => {
49
+ const {
50
+ isClearable,
51
+ clearClassName,
52
+ components = {}
53
+ } = this.props;
54
+ const {
55
+ searchValue
56
+ } = this.state;
60
57
  if (!isClearable || !searchValue) return null;
61
- var ClearIndicator = components.ClearIndicator;
58
+ const {
59
+ ClearIndicator
60
+ } = components;
62
61
  if (React.isValidElement(ClearIndicator)) {
63
62
  return React.cloneElement(ClearIndicator, {
64
- clearValue: _this.clearSearch
63
+ clearValue: this.clearSearch
65
64
  });
66
65
  } else if (isFunction(ClearIndicator)) {
67
66
  return /*#__PURE__*/React.createElement(ClearIndicator, {
68
- clearValue: _this.clearSearch
67
+ clearValue: this.clearSearch
69
68
  });
70
69
  }
71
70
  return /*#__PURE__*/React.createElement("i", {
72
71
  className: classnames('search-text-clear input-icon-addon', clearClassName),
73
- onClick: _this.clearSearch
72
+ onClick: this.clearSearch
74
73
  }, "\xD7");
75
74
  };
76
- _this.state = {
75
+ this.state = {
77
76
  searchValue: props.value
78
77
  };
79
- _this.isInputtingChinese = false;
80
- _this.timer = null;
81
- _this.inputRef = null;
82
- return _this;
78
+ this.isInputtingChinese = false;
79
+ this.timer = null;
80
+ this.inputRef = null;
83
81
  }
84
- _createClass(DtableSearchInput, [{
85
- key: "UNSAFE_componentWillReceiveProps",
86
- value: function UNSAFE_componentWillReceiveProps(nextProps) {
87
- if (nextProps.value !== this.props.value) {
88
- this.setState({
89
- searchValue: nextProps.value
90
- });
91
- }
92
- }
93
- }, {
94
- key: "componentWillUnmount",
95
- value: function componentWillUnmount() {
96
- this.timer && clearTimeout(this.timer);
97
- this.timer = null;
98
- this.inputRef = null;
99
- }
100
- }, {
101
- key: "render",
102
- value: function render() {
103
- var _this2 = this;
104
- var _this$props3 = this.props,
105
- placeholder = _this$props3.placeholder,
106
- autoFocus = _this$props3.autoFocus,
107
- className = _this$props3.className,
108
- onKeyDown = _this$props3.onKeyDown,
109
- disabled = _this$props3.disabled,
110
- style = _this$props3.style;
111
- var searchValue = this.state.searchValue;
112
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("input", {
113
- type: "text",
114
- value: searchValue,
115
- className: classnames('form-control', className),
116
- onChange: this.onChange,
117
- autoFocus: autoFocus,
118
- placeholder: placeholder,
119
- onCompositionStart: this.onCompositionStart,
120
- onCompositionEnd: this.onCompositionEnd,
121
- onKeyDown: onKeyDown,
122
- disabled: disabled,
123
- style: style,
124
- ref: function ref(_ref) {
125
- return _this2.inputRef = _ref;
126
- }
127
- }), this.renderClear());
82
+ UNSAFE_componentWillReceiveProps(nextProps) {
83
+ if (nextProps.value !== this.props.value) {
84
+ this.setState({
85
+ searchValue: nextProps.value
86
+ });
128
87
  }
129
- }]);
130
- return DtableSearchInput;
131
- }(Component);
88
+ }
89
+ componentWillUnmount() {
90
+ this.timer && clearTimeout(this.timer);
91
+ this.timer = null;
92
+ this.inputRef = null;
93
+ }
94
+ render() {
95
+ const {
96
+ placeholder,
97
+ autoFocus,
98
+ className,
99
+ onKeyDown,
100
+ disabled,
101
+ style
102
+ } = this.props;
103
+ const {
104
+ searchValue
105
+ } = this.state;
106
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("input", {
107
+ type: "text",
108
+ value: searchValue,
109
+ className: classnames('form-control', className),
110
+ onChange: this.onChange,
111
+ autoFocus: autoFocus,
112
+ placeholder: placeholder,
113
+ onCompositionStart: this.onCompositionStart,
114
+ onCompositionEnd: this.onCompositionEnd,
115
+ onKeyDown: onKeyDown,
116
+ disabled: disabled,
117
+ style: style,
118
+ ref: ref => this.inputRef = ref
119
+ }), this.renderClear());
120
+ }
121
+ }
132
122
  DtableSearchInput.defaultProps = {
133
123
  wait: 100,
134
124
  disabled: false,
@@ -1,4 +1,4 @@
1
- export var isFunction = function isFunction(functionToCheck) {
2
- var getType = {};
1
+ export const isFunction = functionToCheck => {
2
+ const getType = {};
3
3
  return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
4
4
  };
@@ -1,9 +1,11 @@
1
1
  import React from 'react';
2
2
  import './dtable-select-label.css';
3
3
  function DTableSelectLabel(_ref) {
4
- var classname = _ref.classname,
5
- name = _ref.name,
6
- isSelect = _ref.isSelect;
4
+ let {
5
+ classname,
6
+ name,
7
+ isSelect
8
+ } = _ref;
7
9
  return /*#__PURE__*/React.createElement("div", {
8
10
  className: "".concat(classname, " w-100 d-flex justify-content-between")
9
11
  }, /*#__PURE__*/React.createElement("span", null, name), isSelect && /*#__PURE__*/React.createElement("div", {
@@ -1,68 +1,55 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _inherits from "@babel/runtime/helpers/esm/inherits";
4
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
1
  import React from 'react';
6
2
  import Select from 'react-select';
7
3
  import { MenuSelectStyle, DropdownIndicator, ClearIndicator, MenuList, Option } from './utils';
8
- var DTableSelect = /*#__PURE__*/function (_React$Component) {
9
- _inherits(DTableSelect, _React$Component);
10
- var _super = _createSuper(DTableSelect);
11
- function DTableSelect() {
12
- _classCallCheck(this, DTableSelect);
13
- return _super.apply(this, arguments);
4
+ export default class DTableSelect extends React.Component {
5
+ render() {
6
+ const {
7
+ options,
8
+ onChange,
9
+ value,
10
+ isSearchable,
11
+ placeholder,
12
+ isMulti,
13
+ menuPosition,
14
+ isClearable,
15
+ noOptionsMessage,
16
+ classNamePrefix,
17
+ style,
18
+ innerRef,
19
+ isDisabled,
20
+ form,
21
+ customFilterOption
22
+ } = this.props;
23
+ return /*#__PURE__*/React.createElement(Select, {
24
+ value: value,
25
+ onChange: onChange,
26
+ options: options,
27
+ isMulti: isMulti,
28
+ classNamePrefix: classNamePrefix,
29
+ styles: style || MenuSelectStyle,
30
+ components: {
31
+ Option,
32
+ DropdownIndicator,
33
+ MenuList,
34
+ ClearIndicator
35
+ },
36
+ placeholder: placeholder,
37
+ isSearchable: isSearchable,
38
+ isClearable: isClearable,
39
+ menuPosition: menuPosition || 'fixed' // when use default menuPosition(absolute), menuPortalTarget is unnecessary.
40
+ ,
41
+ menuShouldScrollIntoView: true,
42
+ menuPortalTarget: document.querySelector(this.props.menuPortalTarget),
43
+ captureMenuScroll: false,
44
+ hideSelectedOptions: false,
45
+ noOptionsMessage: noOptionsMessage,
46
+ isDisabled: isDisabled,
47
+ ref: innerRef,
48
+ filterOption: customFilterOption,
49
+ form: form
50
+ });
14
51
  }
15
- _createClass(DTableSelect, [{
16
- key: "render",
17
- value: function render() {
18
- var _this$props = this.props,
19
- options = _this$props.options,
20
- onChange = _this$props.onChange,
21
- value = _this$props.value,
22
- isSearchable = _this$props.isSearchable,
23
- placeholder = _this$props.placeholder,
24
- isMulti = _this$props.isMulti,
25
- menuPosition = _this$props.menuPosition,
26
- isClearable = _this$props.isClearable,
27
- noOptionsMessage = _this$props.noOptionsMessage,
28
- classNamePrefix = _this$props.classNamePrefix,
29
- style = _this$props.style,
30
- innerRef = _this$props.innerRef,
31
- isDisabled = _this$props.isDisabled,
32
- form = _this$props.form,
33
- customFilterOption = _this$props.customFilterOption;
34
- return /*#__PURE__*/React.createElement(Select, {
35
- value: value,
36
- onChange: onChange,
37
- options: options,
38
- isMulti: isMulti,
39
- classNamePrefix: classNamePrefix,
40
- styles: style || MenuSelectStyle,
41
- components: {
42
- Option: Option,
43
- DropdownIndicator: DropdownIndicator,
44
- MenuList: MenuList,
45
- ClearIndicator: ClearIndicator
46
- },
47
- placeholder: placeholder,
48
- isSearchable: isSearchable,
49
- isClearable: isClearable,
50
- menuPosition: menuPosition || 'fixed' // when use default menuPosition(absolute), menuPortalTarget is unnecessary.
51
- ,
52
- menuShouldScrollIntoView: true,
53
- menuPortalTarget: document.querySelector(this.props.menuPortalTarget),
54
- captureMenuScroll: false,
55
- hideSelectedOptions: false,
56
- noOptionsMessage: noOptionsMessage,
57
- isDisabled: isDisabled,
58
- ref: innerRef,
59
- filterOption: customFilterOption,
60
- form: form
61
- });
62
- }
63
- }]);
64
- return DTableSelect;
65
- }(React.Component);
52
+ }
66
53
  DTableSelect.defaultProps = {
67
54
  options: [],
68
55
  value: {},
@@ -72,8 +59,7 @@ DTableSelect.defaultProps = {
72
59
  placeholder: '',
73
60
  isMulti: false,
74
61
  menuPortalTarget: '.modal',
75
- noOptionsMessage: function noOptionsMessage() {
62
+ noOptionsMessage: () => {
76
63
  return null;
77
64
  }
78
- };
79
- export { DTableSelect as default };
65
+ };
@@ -1,13 +1,13 @@
1
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
- var _excluded = ["innerProps"];
4
1
  import React from 'react';
5
2
  import { components } from 'react-select';
6
- var MenuSelectStyle = {
7
- option: function option(provided, state) {
8
- var isDisabled = state.isDisabled,
9
- isFocused = state.isFocused;
10
- return _objectSpread(_objectSpread({}, provided), {}, {
3
+ const MenuSelectStyle = {
4
+ option: (provided, state) => {
5
+ const {
6
+ isDisabled,
7
+ isFocused
8
+ } = state;
9
+ return {
10
+ ...provided,
11
11
  fontSize: '13px',
12
12
  color: '#212529',
13
13
  cursor: isDisabled ? 'default' : 'pointer',
@@ -15,23 +15,21 @@ var MenuSelectStyle = {
15
15
  '.header-icon .dtable-font': {
16
16
  color: '#aaa'
17
17
  }
18
- });
18
+ };
19
19
  },
20
- control: function control(provided) {
21
- return _objectSpread(_objectSpread({}, provided), {}, {
22
- fontSize: '14px',
23
- cursor: 'pointer',
24
- lineHeight: '1.5'
25
- });
26
- },
27
- menuPortal: function menuPortal(base) {
28
- return _objectSpread(_objectSpread({}, base), {}, {
29
- zIndex: 9999
30
- });
31
- },
32
- indicatorSeparator: function indicatorSeparator() {}
20
+ control: provided => ({
21
+ ...provided,
22
+ fontSize: '14px',
23
+ cursor: 'pointer',
24
+ lineHeight: '1.5'
25
+ }),
26
+ menuPortal: base => ({
27
+ ...base,
28
+ zIndex: 9999
29
+ }),
30
+ indicatorSeparator: () => {}
33
31
  };
34
- var DropdownIndicator = function DropdownIndicator(props) {
32
+ const DropdownIndicator = props => {
35
33
  return components.DropdownIndicator && /*#__PURE__*/React.createElement(components.DropdownIndicator, props, /*#__PURE__*/React.createElement("span", {
36
34
  className: "dtable-font dtable-icon-drop-down",
37
35
  style: {
@@ -39,29 +37,26 @@ var DropdownIndicator = function DropdownIndicator(props) {
39
37
  }
40
38
  }));
41
39
  };
42
- var ClearIndicator = function ClearIndicator(_ref) {
43
- var innerProps = _ref.innerProps,
44
- props = _objectWithoutProperties(_ref, _excluded);
45
- var onMouseDown = function onMouseDown(e) {
40
+ const ClearIndicator = _ref => {
41
+ let {
42
+ innerProps,
43
+ ...props
44
+ } = _ref;
45
+ const onMouseDown = e => {
46
46
  e.nativeEvent.stopImmediatePropagation();
47
47
  innerProps.onMouseDown(e);
48
48
  };
49
- props.innerProps = _objectSpread(_objectSpread({}, innerProps), {}, {
50
- onMouseDown: onMouseDown
51
- });
49
+ props.innerProps = {
50
+ ...innerProps,
51
+ onMouseDown
52
+ };
52
53
  return /*#__PURE__*/React.createElement(components.ClearIndicator, props);
53
54
  };
54
- var MenuList = function MenuList(props) {
55
- return /*#__PURE__*/React.createElement("div", {
56
- onClick: function onClick(e) {
57
- return e.nativeEvent.stopImmediatePropagation();
58
- },
59
- onMouseDown: function onMouseDown(e) {
60
- return e.nativeEvent.stopImmediatePropagation();
61
- }
62
- }, /*#__PURE__*/React.createElement(components.MenuList, props, props.children));
63
- };
64
- var Option = function Option(props) {
55
+ const MenuList = props => /*#__PURE__*/React.createElement("div", {
56
+ onClick: e => e.nativeEvent.stopImmediatePropagation(),
57
+ onMouseDown: e => e.nativeEvent.stopImmediatePropagation()
58
+ }, /*#__PURE__*/React.createElement(components.MenuList, props, props.children));
59
+ const Option = props => {
65
60
  return /*#__PURE__*/React.createElement("div", {
66
61
  style: props.data.style
67
62
  }, /*#__PURE__*/React.createElement(components.Option, props));