dtable-ui-component 4.3.1 → 4.3.2-alpha3
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.
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './dtable-select-label.css';
|
|
3
|
+
function DTableSelectLabel(_ref) {
|
|
4
|
+
var classname = _ref.classname,
|
|
5
|
+
name = _ref.name,
|
|
6
|
+
isSelect = _ref.isSelect;
|
|
7
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
8
|
+
className: "".concat(classname, " w-100 d-flex justify-content-between")
|
|
9
|
+
}, /*#__PURE__*/React.createElement("span", null, name), isSelect && /*#__PURE__*/React.createElement("div", {
|
|
10
|
+
className: "dtable-select-check-icon"
|
|
11
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
12
|
+
className: "dtable-font dtable-icon-check-mark"
|
|
13
|
+
})));
|
|
14
|
+
}
|
|
15
|
+
DTableSelectLabel.defaultProps = {
|
|
16
|
+
classname: '',
|
|
17
|
+
name: '',
|
|
18
|
+
isSelect: false
|
|
19
|
+
};
|
|
20
|
+
export default DTableSelectLabel;
|
|
@@ -2,76 +2,17 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
4
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
6
5
|
import React from 'react';
|
|
7
|
-
import Select
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
backgroundColor: isSelected ? '#20a0ff' : isFocused ? '#f5f5f5' : '#fff',
|
|
16
|
-
'.header-icon .dtable-font': {
|
|
17
|
-
color: isSelected ? '#fff' : '#aaa'
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
},
|
|
21
|
-
control: function control(provided) {
|
|
22
|
-
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
23
|
-
fontSize: '14px',
|
|
24
|
-
cursor: 'pointer',
|
|
25
|
-
lineHeight: '1.5'
|
|
26
|
-
});
|
|
27
|
-
},
|
|
28
|
-
menuPortal: function menuPortal(base) {
|
|
29
|
-
return _objectSpread(_objectSpread({}, base), {}, {
|
|
30
|
-
zIndex: 9999
|
|
31
|
-
});
|
|
32
|
-
},
|
|
33
|
-
indicatorSeparator: function indicatorSeparator() {}
|
|
34
|
-
};
|
|
35
|
-
var DropdownIndicator = function DropdownIndicator(props) {
|
|
36
|
-
return components.DropdownIndicator && /*#__PURE__*/React.createElement(components.DropdownIndicator, props, /*#__PURE__*/React.createElement("span", {
|
|
37
|
-
className: "dtable-font dtable-icon-drop-down",
|
|
38
|
-
style: {
|
|
39
|
-
fontSize: '12px'
|
|
40
|
-
}
|
|
41
|
-
}));
|
|
42
|
-
};
|
|
43
|
-
var MenuList = function MenuList(props) {
|
|
44
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
45
|
-
onClick: function onClick(e) {
|
|
46
|
-
return e.nativeEvent.stopImmediatePropagation();
|
|
47
|
-
},
|
|
48
|
-
onMouseDown: function onMouseDown(e) {
|
|
49
|
-
return e.nativeEvent.stopImmediatePropagation();
|
|
50
|
-
}
|
|
51
|
-
}, /*#__PURE__*/React.createElement(components.MenuList, props, props.children));
|
|
52
|
-
};
|
|
53
|
-
var Option = function Option(props) {
|
|
54
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
55
|
-
style: props.data.style
|
|
56
|
-
}, /*#__PURE__*/React.createElement(components.Option, props));
|
|
57
|
-
};
|
|
58
|
-
var DtableSelect = /*#__PURE__*/function (_React$Component) {
|
|
59
|
-
_inherits(DtableSelect, _React$Component);
|
|
60
|
-
var _super = _createSuper(DtableSelect);
|
|
61
|
-
function DtableSelect() {
|
|
62
|
-
var _this;
|
|
63
|
-
_classCallCheck(this, DtableSelect);
|
|
64
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
65
|
-
args[_key] = arguments[_key];
|
|
66
|
-
}
|
|
67
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
68
|
-
_this.getMenuPortalTarget = function () {
|
|
69
|
-
var menuPortalTarget = _this.props.menuPortalTarget;
|
|
70
|
-
return document.querySelector(menuPortalTarget);
|
|
71
|
-
};
|
|
72
|
-
return _this;
|
|
6
|
+
import Select from 'react-select';
|
|
7
|
+
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);
|
|
73
14
|
}
|
|
74
|
-
_createClass(
|
|
15
|
+
_createClass(DTableSelect, [{
|
|
75
16
|
key: "render",
|
|
76
17
|
value: function render() {
|
|
77
18
|
var _this$props = this.props,
|
|
@@ -85,7 +26,11 @@ var DtableSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
85
26
|
isClearable = _this$props.isClearable,
|
|
86
27
|
noOptionsMessage = _this$props.noOptionsMessage,
|
|
87
28
|
classNamePrefix = _this$props.classNamePrefix,
|
|
88
|
-
style = _this$props.style
|
|
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;
|
|
89
34
|
return /*#__PURE__*/React.createElement(Select, {
|
|
90
35
|
value: value,
|
|
91
36
|
onChange: onChange,
|
|
@@ -96,7 +41,8 @@ var DtableSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
96
41
|
components: {
|
|
97
42
|
Option: Option,
|
|
98
43
|
DropdownIndicator: DropdownIndicator,
|
|
99
|
-
MenuList: MenuList
|
|
44
|
+
MenuList: MenuList,
|
|
45
|
+
ClearIndicator: ClearIndicator
|
|
100
46
|
},
|
|
101
47
|
placeholder: placeholder,
|
|
102
48
|
isSearchable: isSearchable,
|
|
@@ -104,17 +50,23 @@ var DtableSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
104
50
|
menuPosition: menuPosition || 'fixed' // when use default menuPosition(absolute), menuPortalTarget is unnecessary.
|
|
105
51
|
,
|
|
106
52
|
menuShouldScrollIntoView: true,
|
|
107
|
-
menuPortalTarget: this.
|
|
53
|
+
menuPortalTarget: document.querySelector(this.props.menuPortalTarget),
|
|
108
54
|
captureMenuScroll: false,
|
|
109
|
-
|
|
55
|
+
hideSelectedOptions: false,
|
|
56
|
+
noOptionsMessage: noOptionsMessage,
|
|
57
|
+
isDisabled: isDisabled,
|
|
58
|
+
ref: innerRef,
|
|
59
|
+
filterOption: customFilterOption,
|
|
60
|
+
form: form
|
|
110
61
|
});
|
|
111
62
|
}
|
|
112
63
|
}]);
|
|
113
|
-
return
|
|
64
|
+
return DTableSelect;
|
|
114
65
|
}(React.Component);
|
|
115
|
-
|
|
66
|
+
DTableSelect.defaultProps = {
|
|
116
67
|
options: [],
|
|
117
68
|
value: {},
|
|
69
|
+
isDisabled: false,
|
|
118
70
|
isSearchable: false,
|
|
119
71
|
isClearable: false,
|
|
120
72
|
placeholder: '',
|
|
@@ -124,4 +76,4 @@ DtableSelect.defaultProps = {
|
|
|
124
76
|
return null;
|
|
125
77
|
}
|
|
126
78
|
};
|
|
127
|
-
export default
|
|
79
|
+
export { DTableSelect as default };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
var _excluded = ["innerProps"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
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), {}, {
|
|
11
|
+
fontSize: '13px',
|
|
12
|
+
color: '#212529',
|
|
13
|
+
cursor: isDisabled ? 'default' : 'pointer',
|
|
14
|
+
backgroundColor: isFocused ? '#f5f5f5' : '#fff',
|
|
15
|
+
'.header-icon .dtable-font': {
|
|
16
|
+
color: '#aaa'
|
|
17
|
+
}
|
|
18
|
+
});
|
|
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() {}
|
|
33
|
+
};
|
|
34
|
+
var DropdownIndicator = function DropdownIndicator(props) {
|
|
35
|
+
return components.DropdownIndicator && /*#__PURE__*/React.createElement(components.DropdownIndicator, props, /*#__PURE__*/React.createElement("span", {
|
|
36
|
+
className: "dtable-font dtable-icon-drop-down",
|
|
37
|
+
style: {
|
|
38
|
+
fontSize: '12px'
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
};
|
|
42
|
+
var ClearIndicator = function ClearIndicator(_ref) {
|
|
43
|
+
var innerProps = _ref.innerProps,
|
|
44
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
45
|
+
var onMouseDown = function onMouseDown(e) {
|
|
46
|
+
e.nativeEvent.stopImmediatePropagation();
|
|
47
|
+
innerProps.onMouseDown(e);
|
|
48
|
+
};
|
|
49
|
+
props.innerProps = _objectSpread(_objectSpread({}, innerProps), {}, {
|
|
50
|
+
onMouseDown: onMouseDown
|
|
51
|
+
});
|
|
52
|
+
return /*#__PURE__*/React.createElement(components.ClearIndicator, props);
|
|
53
|
+
};
|
|
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) {
|
|
65
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
66
|
+
style: props.data.style
|
|
67
|
+
}, /*#__PURE__*/React.createElement(components.Option, props));
|
|
68
|
+
};
|
|
69
|
+
export { MenuSelectStyle, DropdownIndicator, ClearIndicator, MenuList, Option };
|
package/lib/index.js
CHANGED
|
@@ -61,6 +61,7 @@ export { default as LinkEditor } from './LinkEditor';
|
|
|
61
61
|
export { default as DTablePopover } from './DTablePopover';
|
|
62
62
|
export { default as NotificationPopover } from './NotificationPopover';
|
|
63
63
|
export { default as DTableSelect } from './DTableSelect';
|
|
64
|
+
export { default as DTableSelectLabel } from './DTableSelect/dtable-select-label';
|
|
64
65
|
export { default as DTableSwitch } from './DTableSwitch';
|
|
65
66
|
export { default as DTableCustomizeSelect } from './DTableCustomizeSelect';
|
|
66
67
|
export { default as DTableCustomizeCollaboratorSelect } from './DTableCustomizeCollaboratorSelect';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-ui-component",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.2-alpha3",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@seafile/react-image-lightbox": "2.0.5",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"classnames": "^2.3.2",
|
|
12
12
|
"dayjs": "1.10.7",
|
|
13
13
|
"deepmerge": "^2.1.0",
|
|
14
|
-
"dtable-utils": "4.3.
|
|
14
|
+
"dtable-utils": "4.3.5",
|
|
15
15
|
"glamor": "^2.20.40",
|
|
16
16
|
"hast-util-sanitize": "^1.1.2",
|
|
17
17
|
"hast-util-to-html": "3.1.0",
|