dtable-ui-component 4.3.1-alpha1 → 4.3.1-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,29 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
export var MenuSelectStyle = {
|
|
3
|
+
option: function option(provided, state) {
|
|
4
|
+
var isDisabled = state.isDisabled,
|
|
5
|
+
isFocused = state.isFocused;
|
|
6
|
+
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
7
|
+
fontSize: '13px',
|
|
8
|
+
color: '#212529',
|
|
9
|
+
cursor: isDisabled ? 'default' : 'pointer',
|
|
10
|
+
backgroundColor: isFocused ? '#f5f5f5' : '#fff',
|
|
11
|
+
'.header-icon .dtable-font': {
|
|
12
|
+
color: '#aaa'
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
},
|
|
16
|
+
control: function control(provided) {
|
|
17
|
+
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
18
|
+
fontSize: '14px',
|
|
19
|
+
cursor: 'pointer',
|
|
20
|
+
lineHeight: '1.5'
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
menuPortal: function menuPortal(base) {
|
|
24
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
25
|
+
zIndex: 9999
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
indicatorSeparator: function indicatorSeparator() {}
|
|
29
|
+
};
|
|
@@ -2,91 +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 _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
6
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
7
|
-
var _excluded = ["innerProps"];
|
|
8
5
|
import React from 'react';
|
|
9
|
-
import Select
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
cursor: isDisabled ? 'default' : 'pointer',
|
|
18
|
-
backgroundColor: isFocused ? '#f5f5f5' : '#fff',
|
|
19
|
-
'.header-icon .dtable-font': {
|
|
20
|
-
color: '#aaa'
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
},
|
|
24
|
-
control: function control(provided) {
|
|
25
|
-
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
26
|
-
fontSize: '14px',
|
|
27
|
-
cursor: 'pointer',
|
|
28
|
-
lineHeight: '1.5'
|
|
29
|
-
});
|
|
30
|
-
},
|
|
31
|
-
menuPortal: function menuPortal(base) {
|
|
32
|
-
return _objectSpread(_objectSpread({}, base), {}, {
|
|
33
|
-
zIndex: 9999
|
|
34
|
-
});
|
|
35
|
-
},
|
|
36
|
-
indicatorSeparator: function indicatorSeparator() {}
|
|
37
|
-
};
|
|
38
|
-
var DropdownIndicator = function DropdownIndicator(props) {
|
|
39
|
-
return components.DropdownIndicator && /*#__PURE__*/React.createElement(components.DropdownIndicator, props, /*#__PURE__*/React.createElement("span", {
|
|
40
|
-
className: "dtable-font dtable-icon-drop-down",
|
|
41
|
-
style: {
|
|
42
|
-
fontSize: '12px'
|
|
43
|
-
}
|
|
44
|
-
}));
|
|
45
|
-
};
|
|
46
|
-
var ClearIndicator = function ClearIndicator(_ref) {
|
|
47
|
-
var innerProps = _ref.innerProps,
|
|
48
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
49
|
-
var onMouseDown = function onMouseDown(e) {
|
|
50
|
-
e.nativeEvent.stopImmediatePropagation();
|
|
51
|
-
innerProps.onMouseDown(e);
|
|
52
|
-
};
|
|
53
|
-
props.innerProps = _objectSpread(_objectSpread({}, innerProps), {}, {
|
|
54
|
-
onMouseDown: onMouseDown
|
|
55
|
-
});
|
|
56
|
-
return /*#__PURE__*/React.createElement(components.ClearIndicator, props);
|
|
57
|
-
};
|
|
58
|
-
var MenuList = function MenuList(props) {
|
|
59
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
60
|
-
onClick: function onClick(e) {
|
|
61
|
-
return e.nativeEvent.stopImmediatePropagation();
|
|
62
|
-
},
|
|
63
|
-
onMouseDown: function onMouseDown(e) {
|
|
64
|
-
return e.nativeEvent.stopImmediatePropagation();
|
|
65
|
-
}
|
|
66
|
-
}, /*#__PURE__*/React.createElement(components.MenuList, props, props.children));
|
|
67
|
-
};
|
|
68
|
-
var Option = function Option(props) {
|
|
69
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
70
|
-
style: props.data.style
|
|
71
|
-
}, /*#__PURE__*/React.createElement(components.Option, props));
|
|
72
|
-
};
|
|
73
|
-
var DtableSelect = /*#__PURE__*/function (_React$Component) {
|
|
74
|
-
_inherits(DtableSelect, _React$Component);
|
|
75
|
-
var _super = _createSuper(DtableSelect);
|
|
76
|
-
function DtableSelect() {
|
|
77
|
-
var _this;
|
|
78
|
-
_classCallCheck(this, DtableSelect);
|
|
79
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
80
|
-
args[_key] = arguments[_key];
|
|
81
|
-
}
|
|
82
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
83
|
-
_this.getMenuPortalTarget = function () {
|
|
84
|
-
var menuPortalTarget = _this.props.menuPortalTarget;
|
|
85
|
-
return document.querySelector(menuPortalTarget);
|
|
86
|
-
};
|
|
87
|
-
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);
|
|
88
14
|
}
|
|
89
|
-
_createClass(
|
|
15
|
+
_createClass(DTableSelect, [{
|
|
90
16
|
key: "render",
|
|
91
17
|
value: function render() {
|
|
92
18
|
var _this$props = this.props,
|
|
@@ -124,7 +50,7 @@ var DtableSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
124
50
|
menuPosition: menuPosition || 'fixed' // when use default menuPosition(absolute), menuPortalTarget is unnecessary.
|
|
125
51
|
,
|
|
126
52
|
menuShouldScrollIntoView: true,
|
|
127
|
-
menuPortalTarget: this.
|
|
53
|
+
menuPortalTarget: document.querySelector(this.props.menuPortalTarget),
|
|
128
54
|
captureMenuScroll: false,
|
|
129
55
|
hideSelectedOptions: false,
|
|
130
56
|
noOptionsMessage: noOptionsMessage,
|
|
@@ -135,9 +61,9 @@ var DtableSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
135
61
|
});
|
|
136
62
|
}
|
|
137
63
|
}]);
|
|
138
|
-
return
|
|
64
|
+
return DTableSelect;
|
|
139
65
|
}(React.Component);
|
|
140
|
-
|
|
66
|
+
DTableSelect.defaultProps = {
|
|
141
67
|
options: [],
|
|
142
68
|
value: {},
|
|
143
69
|
isDisabled: false,
|
|
@@ -150,4 +76,4 @@ DtableSelect.defaultProps = {
|
|
|
150
76
|
return null;
|
|
151
77
|
}
|
|
152
78
|
};
|
|
153
|
-
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 };
|