dtable-ui-component 0.3.27 → 0.3.29
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.
|
@@ -31,7 +31,7 @@ var CollaboratorSelect = /*#__PURE__*/function (_Component) {
|
|
|
31
31
|
isShowSelectOptions: !_this.state.isShowSelectOptions
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
-
_this.
|
|
34
|
+
_this.onMousedown = function (event) {
|
|
35
35
|
var name = event.target.className;
|
|
36
36
|
if (name === 'select-placeholder' || name.includes('icon-fork-number')) {
|
|
37
37
|
return;
|
|
@@ -115,13 +115,13 @@ var CollaboratorSelect = /*#__PURE__*/function (_Component) {
|
|
|
115
115
|
_createClass(CollaboratorSelect, [{
|
|
116
116
|
key: "componentDidMount",
|
|
117
117
|
value: function componentDidMount() {
|
|
118
|
-
document.addEventListener('
|
|
118
|
+
document.addEventListener('mousedown', this.onMousedown);
|
|
119
119
|
this.btnWidth = this.selector.clientWidth;
|
|
120
120
|
}
|
|
121
121
|
}, {
|
|
122
122
|
key: "componentWillUnmount",
|
|
123
123
|
value: function componentWillUnmount() {
|
|
124
|
-
document.removeEventListener('
|
|
124
|
+
document.removeEventListener('mousedown', this.onMousedown);
|
|
125
125
|
}
|
|
126
126
|
}, {
|
|
127
127
|
key: "render",
|
|
@@ -28,7 +28,7 @@ var DTableCustomizeSelect = /*#__PURE__*/function (_Component) {
|
|
|
28
28
|
isShowSelectOptions: !_this.state.isShowSelectOptions
|
|
29
29
|
});
|
|
30
30
|
};
|
|
31
|
-
_this.
|
|
31
|
+
_this.onMousedown = function (event) {
|
|
32
32
|
if (_this.props.isShowSelected && event.target.className.includes('icon-fork-number')) {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
@@ -74,12 +74,12 @@ var DTableCustomizeSelect = /*#__PURE__*/function (_Component) {
|
|
|
74
74
|
_createClass(DTableCustomizeSelect, [{
|
|
75
75
|
key: "componentDidMount",
|
|
76
76
|
value: function componentDidMount() {
|
|
77
|
-
document.addEventListener('
|
|
77
|
+
document.addEventListener('mousedown', this.onMousedown);
|
|
78
78
|
}
|
|
79
79
|
}, {
|
|
80
80
|
key: "componentWillUnmount",
|
|
81
81
|
value: function componentWillUnmount() {
|
|
82
|
-
document.removeEventListener('
|
|
82
|
+
document.removeEventListener('mousedown', this.onMousedown);
|
|
83
83
|
}
|
|
84
84
|
}, {
|
|
85
85
|
key: "render",
|
|
@@ -33,7 +33,7 @@ var DTablePopover = /*#__PURE__*/function (_React$Component) {
|
|
|
33
33
|
e.stopImmediatePropagation();
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
_this.
|
|
36
|
+
_this.onMousedown = function (e) {
|
|
37
37
|
var canHideDTablePopover = _this.props.canHideDTablePopover;
|
|
38
38
|
if (!canHideDTablePopover) return;
|
|
39
39
|
if (_this.dtablePopoverRef && e && getEventClassName(e).indexOf('popover') === -1 && !_this.dtablePopoverRef.contains(e.target)) {
|
|
@@ -48,14 +48,14 @@ var DTablePopover = /*#__PURE__*/function (_React$Component) {
|
|
|
48
48
|
_createClass(DTablePopover, [{
|
|
49
49
|
key: "componentDidMount",
|
|
50
50
|
value: function componentDidMount() {
|
|
51
|
-
document.addEventListener('
|
|
51
|
+
document.addEventListener('mousedown', this.onMousedown);
|
|
52
52
|
document.addEventListener('keydown', this.onKeyDown);
|
|
53
53
|
window.addEventListener('popstate', this.onHistoryState);
|
|
54
54
|
}
|
|
55
55
|
}, {
|
|
56
56
|
key: "componentWillUnmount",
|
|
57
57
|
value: function componentWillUnmount() {
|
|
58
|
-
document.removeEventListener('
|
|
58
|
+
document.removeEventListener('mousedown', this.onMousedown);
|
|
59
59
|
document.removeEventListener('keydown', this.onKeyDown);
|
|
60
60
|
window.removeEventListener('popstate', this.onHistoryState);
|
|
61
61
|
}
|
|
@@ -47,20 +47,14 @@ var FILEEXT_ICON_MAP = {
|
|
|
47
47
|
default: 'file.png'
|
|
48
48
|
};
|
|
49
49
|
export var getFileIconUrl = function getFileIconUrl(filename, direntType) {
|
|
50
|
-
if (direntType === 'dir') {
|
|
51
|
-
|
|
52
|
-
return _iconUrl;
|
|
50
|
+
if (typeof direntType === 'string' && direntType === 'dir') {
|
|
51
|
+
return 'assets/folder/' + FILEEXT_ICON_MAP['folder'];
|
|
53
52
|
}
|
|
54
|
-
var
|
|
55
|
-
if (
|
|
56
|
-
|
|
57
|
-
return iconUrl;
|
|
58
|
-
}
|
|
59
|
-
var file_ext = filename.substr(filename.lastIndexOf('.') + 1).toLowerCase();
|
|
60
|
-
if (FILEEXT_ICON_MAP[file_ext]) {
|
|
61
|
-
iconUrl = 'assets/file/192/' + FILEEXT_ICON_MAP[file_ext];
|
|
62
|
-
} else {
|
|
63
|
-
iconUrl = 'assets/file/192/' + FILEEXT_ICON_MAP['default'];
|
|
53
|
+
var identifierIndex = typeof filename === 'string' && filename.lastIndexOf('.');
|
|
54
|
+
if (identifierIndex === -1) {
|
|
55
|
+
return 'assets/file/192/' + FILEEXT_ICON_MAP['default'];
|
|
64
56
|
}
|
|
57
|
+
var file_ext = typeof filename === 'string' && filename.slice(identifierIndex + 1).toLowerCase() || 'default';
|
|
58
|
+
var iconUrl = FILEEXT_ICON_MAP[file_ext] ? 'assets/file/192/' + FILEEXT_ICON_MAP[file_ext] : 'assets/file/192/' + FILEEXT_ICON_MAP['default'];
|
|
65
59
|
return iconUrl;
|
|
66
60
|
};
|