dtable-ui-component 4.3.6 → 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.
- package/lib/AutoNumberFormatter/index.js +11 -24
- package/lib/ButtonFormatter/index.js +29 -45
- package/lib/CTimeFormatter/index.js +17 -32
- package/lib/CheckboxEditor/index.js +42 -49
- package/lib/CheckboxFormatter/index.js +17 -30
- package/lib/CollaboratorEditor/index.js +118 -135
- package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +90 -99
- package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +61 -69
- package/lib/CollaboratorFormatter/index.js +26 -42
- package/lib/CollaboratorItem/index.js +31 -44
- package/lib/CreatorFormatter/index.js +24 -40
- package/lib/DTableCustomizeCollaboratorSelect/index.js +80 -99
- package/lib/DTableCustomizeCollaboratorSelect/utils.js +12 -13
- package/lib/DTableCustomizeSelect/index.css +22 -59
- package/lib/DTableCustomizeSelect/index.js +99 -95
- package/lib/DTablePopover/index.js +52 -71
- package/lib/DTablePopover/utils.js +1 -1
- package/lib/DTableRadio/index.js +9 -7
- package/lib/DTableSearchInput/index.js +89 -99
- package/lib/DTableSearchInput/utils.js +2 -2
- package/lib/DTableSelect/dtable-select-label.js +5 -3
- package/lib/DTableSelect/index.js +50 -64
- package/lib/DTableSelect/utils.js +36 -41
- package/lib/DTableSwitch/index.js +7 -5
- package/lib/DateEditor/index.js +88 -94
- package/lib/DateEditor/mb-date-editor-popover/index.js +136 -134
- package/lib/DateEditor/pc-date-editor-popover.js +70 -77
- package/lib/DateFormatter/index.js +15 -28
- package/lib/DepartmentSingleSelectFormatter/index.js +9 -9
- package/lib/DigitalSignFormatter/index.js +55 -65
- package/lib/DigitalSignFormatter/utils.js +9 -8
- package/lib/DurationFormatter/index.js +14 -27
- package/lib/EditEditorButton/index.js +10 -22
- package/lib/EmailFormatter/index.js +11 -24
- package/lib/FieldDisplaySetting/field-item.js +18 -20
- package/lib/FieldDisplaySetting/index.js +41 -43
- package/lib/FileEditor/index.js +18 -29
- package/lib/FileFormatter/index.js +29 -43
- package/lib/FileItemFormatter/index.js +17 -32
- package/lib/FileItemFormatter/utils.js +5 -5
- package/lib/FileUploader/index.js +20 -33
- package/lib/FormulaFormatter/cell-value-validator.js +23 -8
- package/lib/FormulaFormatter/index.js +77 -83
- package/lib/FormulaFormatter/utils.js +27 -21
- package/lib/GeolocationFormatter/index.js +19 -32
- package/lib/HtmlLongTextFormatter/index.js +43 -52
- package/lib/HtmlLongTextFormatter/markdown2html.js +2 -2
- package/lib/HtmlLongTextFormatter/unified/index.js +1 -1
- package/lib/HtmlLongTextFormatter/vfile/core.js +10 -10
- package/lib/ImageFormatter/images-lazy-load.js +71 -79
- package/lib/ImageFormatter/index.js +86 -97
- package/lib/ImageFormatter/utils.js +1 -1
- package/lib/ImagePreviewerLightbox/index.js +20 -18
- package/lib/ImagePreviewerLightbox/utils.js +3 -3
- package/lib/LastModifierFormatter/index.js +24 -40
- package/lib/LinkEditor/index.js +163 -167
- package/lib/LinkEditor/link-editor-option.js +41 -56
- package/lib/LinkEditor/mb-link-editor-popover/index.js +90 -99
- package/lib/LinkEditor/pc-link-editor-popover/index.js +63 -71
- package/lib/LinkFormatter/index.js +75 -77
- package/lib/LongTextFormatter/index.js +5 -3
- package/lib/MBEditorHeader/index.js +25 -38
- package/lib/MTimeFormatter/index.js +17 -32
- package/lib/ModalPortal/index.js +15 -32
- package/lib/MultipleSelectEditor/index.js +118 -136
- package/lib/MultipleSelectFormatter/index.js +24 -40
- package/lib/NotificationPopover/index.js +68 -95
- package/lib/NumberEditor/index.js +75 -82
- package/lib/NumberFormatter/index.js +15 -28
- package/lib/RateFormatter/index.js +29 -45
- package/lib/RoleStatusEditor/index.js +20 -22
- package/lib/RowExpandEmailFormatter/index.js +24 -37
- package/lib/RowExpandFileFormatter/index.js +28 -42
- package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +66 -82
- package/lib/RowExpandFormatter/index.js +92 -96
- package/lib/RowExpandFormulaFormatter/index.js +85 -91
- package/lib/RowExpandImageFormatter/index.js +65 -82
- package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +71 -84
- package/lib/RowExpandImageFormatter/utils.js +1 -1
- package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +54 -68
- package/lib/RowExpandLinkFormatter/index.js +131 -137
- package/lib/RowExpandLinkFormatter/utils.js +23 -17
- package/lib/RowExpandLinkFormatter/value-display-utils.js +9 -7
- package/lib/RowExpandRateFormatter/index.js +27 -42
- package/lib/RowExpandUrlFormatter/index.js +27 -40
- package/lib/SelectItem/index.js +17 -33
- package/lib/SelectOptionGroup/index.css +103 -0
- package/lib/SelectOptionGroup/index.js +157 -135
- package/lib/SelectOptionGroup/option.js +31 -38
- package/lib/SimpleLongTextFormatter/index.js +55 -67
- package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +23 -22
- package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +42 -57
- package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +31 -46
- package/lib/SingleSelectEditor/index.js +108 -119
- package/lib/SingleSelectFormatter/index.js +21 -37
- package/lib/TextEditor/index.js +45 -51
- package/lib/TextFormatter/index.js +17 -32
- package/lib/UrlFormatter/index.js +11 -24
- package/lib/cellFormatterFactory/index.js +8 -17
- package/lib/common/ClickOutside.js +28 -0
- package/lib/common/delete-tip.js +40 -65
- package/lib/common/modal-portal.js +15 -33
- package/lib/constants/index.js +5 -5
- package/lib/data/dtable-value.js +4 -4
- package/lib/formatterConfig/base-formatter-config.js +24 -3
- package/lib/formatterConfig/index.js +5 -4
- package/lib/lang/index.js +6 -6
- package/lib/locals/de.js +1 -1
- package/lib/locals/en.js +1 -1
- package/lib/locals/fr.js +1 -1
- package/lib/locals/zh-CN.js +1 -1
- package/lib/select-editor/mb-select-editor-popover/index.js +126 -137
- package/lib/select-editor/pc-select-editor-popover/index.js +75 -83
- package/lib/select-editor/select-editor-option.js +41 -56
- package/lib/toaster/alert.js +73 -88
- package/lib/toaster/index.js +1 -1
- package/lib/toaster/toast.js +75 -102
- package/lib/toaster/toastManager.js +55 -91
- package/lib/toaster/toaster.js +58 -57
- package/lib/utils/editor-utils.js +17 -19
- package/lib/utils/utils.js +14 -14
- 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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
10
|
+
this.props.hideDTablePopover(e);
|
|
22
11
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
canHideDTablePopover
|
|
26
|
-
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
|
-
|
|
37
|
-
|
|
26
|
+
this.onMousedown = e => {
|
|
27
|
+
const {
|
|
28
|
+
canHideDTablePopover
|
|
29
|
+
} = this.props;
|
|
38
30
|
if (!canHideDTablePopover) return;
|
|
39
|
-
if (
|
|
40
|
-
|
|
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
|
-
|
|
35
|
+
this.onPopoverInsideClick = e => {
|
|
44
36
|
e.stopPropagation();
|
|
45
37
|
};
|
|
46
|
-
return _this;
|
|
47
38
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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,
|
package/lib/DTableRadio/index.js
CHANGED
|
@@ -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
|
-
|
|
5
|
+
const {
|
|
6
|
+
className
|
|
7
|
+
} = props;
|
|
7
8
|
return /*#__PURE__*/React.createElement("label", {
|
|
8
|
-
className: classnames('dtable-radio w-100 align-items-center',
|
|
9
|
-
'dtable-radio-disable': props.disabled
|
|
10
|
-
|
|
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 ?
|
|
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:
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
onChange
|
|
22
|
-
wait
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
},
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
onChange && onChange(
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
this.onCompositionEnd = e => {
|
|
27
|
+
this.isInputtingChinese = false;
|
|
28
|
+
this.onChange(e);
|
|
36
29
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
this.clearSearch = () => {
|
|
31
|
+
const {
|
|
32
|
+
clearValue
|
|
33
|
+
} = this.props;
|
|
34
|
+
this.setState({
|
|
40
35
|
searchValue: ''
|
|
41
|
-
},
|
|
36
|
+
}, () => {
|
|
42
37
|
clearValue && clearValue();
|
|
43
38
|
});
|
|
44
39
|
};
|
|
45
|
-
|
|
46
|
-
if (
|
|
47
|
-
|
|
40
|
+
this.setFocus = isSelectAllText => {
|
|
41
|
+
if (this.inputRef === document.activeElement) return;
|
|
42
|
+
this.inputRef.focus();
|
|
48
43
|
if (isSelectAllText) {
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
const txtLength = this.state.searchValue.length;
|
|
45
|
+
this.inputRef.setSelectionRange(0, txtLength);
|
|
51
46
|
}
|
|
52
47
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
isClearable
|
|
56
|
-
clearClassName
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
58
|
+
const {
|
|
59
|
+
ClearIndicator
|
|
60
|
+
} = components;
|
|
62
61
|
if (React.isValidElement(ClearIndicator)) {
|
|
63
62
|
return React.cloneElement(ClearIndicator, {
|
|
64
|
-
clearValue:
|
|
63
|
+
clearValue: this.clearSearch
|
|
65
64
|
});
|
|
66
65
|
} else if (isFunction(ClearIndicator)) {
|
|
67
66
|
return /*#__PURE__*/React.createElement(ClearIndicator, {
|
|
68
|
-
clearValue:
|
|
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:
|
|
72
|
+
onClick: this.clearSearch
|
|
74
73
|
}, "\xD7");
|
|
75
74
|
};
|
|
76
|
-
|
|
75
|
+
this.state = {
|
|
77
76
|
searchValue: props.value
|
|
78
77
|
};
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return _this;
|
|
78
|
+
this.isInputtingChinese = false;
|
|
79
|
+
this.timer = null;
|
|
80
|
+
this.inputRef = null;
|
|
83
81
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
-
|
|
131
|
-
|
|
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,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './dtable-select-label.css';
|
|
3
3
|
function DTableSelectLabel(_ref) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
7
|
-
option:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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 =
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
props.innerProps = {
|
|
50
|
+
...innerProps,
|
|
51
|
+
onMouseDown
|
|
52
|
+
};
|
|
52
53
|
return /*#__PURE__*/React.createElement(components.ClearIndicator, props);
|
|
53
54
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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));
|