dtable-ui-component 6.0.39 → 6.0.41
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/CheckboxFormatter/index.css +1 -1
- package/lib/CheckboxFormatter/index.js +24 -10
- package/lib/InputItem/custom-input.js +3 -1
- package/lib/RowExpandEditor/single-select-editor/mb-editor/index.js +3 -1
- package/lib/SelectItem/index.css +24 -0
- package/lib/SelectItem/index.js +8 -26
- package/lib/SingleSelectFormatter/index.js +1 -4
- package/lib/SvgIcon/index.js +20 -15
- package/lib/assets/icons/check.svg +12 -0
- package/lib/assets/icons/cross.svg +13 -0
- package/lib/assets/icons/dot.svg +9 -0
- package/package.json +1 -1
|
@@ -11,6 +11,29 @@ var _SvgIcon = _interopRequireDefault(require("../SvgIcon"));
|
|
|
11
11
|
var _constants = require("../constants");
|
|
12
12
|
require("./index.css");
|
|
13
13
|
class CheckboxFormatter extends _react.default.PureComponent {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.renderIcon = (symbol, color) => {
|
|
17
|
+
let className = 'dtable-ui-checkbox-check-mark';
|
|
18
|
+
if (symbol.startsWith('dtable-icon')) {
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
20
|
+
className: "dtable-font ".concat(symbol, " ").concat(className || ''),
|
|
21
|
+
style: {
|
|
22
|
+
color
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
className = (0, _classnames.default)(className, {
|
|
27
|
+
'dtable-ui-checkbox-check-svg': !(symbol !== null && symbol !== void 0 && symbol.startsWith('dtable-icon')),
|
|
28
|
+
'scale-icon': _constants.isMobile
|
|
29
|
+
});
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement(_SvgIcon.default, {
|
|
31
|
+
className: className,
|
|
32
|
+
symbol: symbol,
|
|
33
|
+
color: color
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
}
|
|
14
37
|
render() {
|
|
15
38
|
let {
|
|
16
39
|
value,
|
|
@@ -25,16 +48,7 @@ class CheckboxFormatter extends _react.default.PureComponent {
|
|
|
25
48
|
const classname = (0, _classnames.default)('dtable-ui cell-formatter-container checkbox-formatter d-flex align-items-center justify-content-center', containerClassName);
|
|
26
49
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
27
50
|
className: classname
|
|
28
|
-
}, checkboxStyle.type.
|
|
29
|
-
className: "dtable-font ".concat(checkboxStyle.type, " checkbox-checked-mark"),
|
|
30
|
-
style: {
|
|
31
|
-
color: checkboxStyle.color
|
|
32
|
-
}
|
|
33
|
-
}) : /*#__PURE__*/_react.default.createElement(_SvgIcon.default, {
|
|
34
|
-
className: "dtable-ui-checkbox-check-svg",
|
|
35
|
-
symbol: checkboxStyle.type,
|
|
36
|
-
color: checkboxStyle.color
|
|
37
|
-
}));
|
|
51
|
+
}, this.renderIcon(checkboxStyle.type, checkboxStyle.color));
|
|
38
52
|
}
|
|
39
53
|
}
|
|
40
54
|
CheckboxFormatter.defaultProps = {
|
|
@@ -262,7 +262,9 @@ class NumberInput extends React.Component {
|
|
|
262
262
|
getContainer: () => this.getContainer()
|
|
263
263
|
}, this.getComponent());
|
|
264
264
|
} else {
|
|
265
|
-
|
|
265
|
+
const container = this.getContainer();
|
|
266
|
+
const root = ReactDOM.createRoot(container);
|
|
267
|
+
root.render(this.getComponent());
|
|
266
268
|
}
|
|
267
269
|
}
|
|
268
270
|
renderPortal() {
|
|
@@ -58,7 +58,9 @@ class RowExpandMBSingleSelectEditor extends _react.default.Component {
|
|
|
58
58
|
};
|
|
59
59
|
this.onChange = option => {
|
|
60
60
|
let newValue = option[this.key];
|
|
61
|
-
if (this.state.value === newValue)
|
|
61
|
+
if (this.state.value === newValue) {
|
|
62
|
+
newValue = null;
|
|
63
|
+
}
|
|
62
64
|
this.setState({
|
|
63
65
|
value: newValue
|
|
64
66
|
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.dtable-ui.dtable-ui-select-item {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
padding: 0px 10px;
|
|
5
|
+
height: 20px;
|
|
6
|
+
line-height: 20px;
|
|
7
|
+
text-align: center;
|
|
8
|
+
border-radius: 10px;
|
|
9
|
+
width: min-content;
|
|
10
|
+
max-width: 300px;
|
|
11
|
+
margin: 5px 10px 5px 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.dtable-ui.dtable-ui-select-item .dtable-ui-select-item-remove-btn {
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
margin-left: 5px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.dtable-ui.dtable-ui-select-item .dtable-ui-select-item-remove-btn .dtable-icon-fork-number {
|
|
20
|
+
font-size: 12px;
|
|
21
|
+
transform: scale(0.8);
|
|
22
|
+
display: inline-block;
|
|
23
|
+
line-height: 12px;
|
|
24
|
+
}
|
package/lib/SelectItem/index.js
CHANGED
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
require("./index.css");
|
|
11
12
|
const SelectItem = _ref => {
|
|
12
13
|
let {
|
|
13
14
|
option,
|
|
@@ -16,50 +17,31 @@ const SelectItem = _ref => {
|
|
|
16
17
|
isShowRemove,
|
|
17
18
|
onRemove
|
|
18
19
|
} = _ref;
|
|
19
|
-
const
|
|
20
|
+
const selectItemStyle = (0, _react.useMemo)(() => {
|
|
20
21
|
return {
|
|
21
|
-
display: 'flex',
|
|
22
|
-
alignItems: 'center',
|
|
23
|
-
padding: '0px 10px',
|
|
24
|
-
marginRight: 8,
|
|
25
|
-
height: 20,
|
|
26
|
-
lineHeight: '20px',
|
|
27
|
-
textAlign: 'center',
|
|
28
|
-
borderRadius: 10,
|
|
29
|
-
width: 'min-content',
|
|
30
|
-
maxWidth: 300,
|
|
31
|
-
margin: '5px 10px 5px 0',
|
|
32
22
|
fontSize: fontSize || 13,
|
|
33
23
|
backgroundColor: option.color,
|
|
34
24
|
color: option.textColor || null
|
|
35
25
|
};
|
|
36
26
|
}, [option, fontSize]);
|
|
37
|
-
const
|
|
27
|
+
const removeBtnStyle = (0, _react.useMemo)(() => {
|
|
38
28
|
const textColor = option.textColor || null;
|
|
39
29
|
return {
|
|
40
|
-
|
|
41
|
-
color: textColor === '#FFFFFF' ? '#FFFFFF' : '#909090',
|
|
42
|
-
marginLeft: 5
|
|
30
|
+
color: textColor === '#FFFFFF' ? '#FFFFFF' : '#909090'
|
|
43
31
|
};
|
|
44
32
|
}, [option]);
|
|
45
33
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
46
34
|
className: (0, _classnames.default)('dtable-ui dtable-ui-select-item', className),
|
|
47
|
-
style:
|
|
35
|
+
style: selectItemStyle
|
|
48
36
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
49
37
|
className: "dtable-ui-select-item-name text-truncate",
|
|
50
38
|
title: option.name
|
|
51
39
|
}, option.name), isShowRemove && /*#__PURE__*/_react.default.createElement("div", {
|
|
52
|
-
className: "dtable-ui-select-item-
|
|
53
|
-
style:
|
|
40
|
+
className: "dtable-ui-select-item-remove-btn",
|
|
41
|
+
style: removeBtnStyle,
|
|
54
42
|
onClick: onRemove
|
|
55
43
|
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
56
|
-
className: "dtable-font dtable-icon-fork-number"
|
|
57
|
-
style: {
|
|
58
|
-
fontSize: '12px',
|
|
59
|
-
transform: 'scale(0.8)',
|
|
60
|
-
display: 'inline-block',
|
|
61
|
-
lineHeight: '12px'
|
|
62
|
-
}
|
|
44
|
+
className: "dtable-font dtable-icon-fork-number"
|
|
63
45
|
})));
|
|
64
46
|
};
|
|
65
47
|
var _default = exports.default = SelectItem;
|
|
@@ -15,7 +15,7 @@ class SingleSelectFormatter extends _react.default.PureComponent {
|
|
|
15
15
|
this.getOption = () => {
|
|
16
16
|
let {
|
|
17
17
|
value,
|
|
18
|
-
options,
|
|
18
|
+
options = [],
|
|
19
19
|
fontSize
|
|
20
20
|
} = this.props;
|
|
21
21
|
let option = options.find(item => item.id === value || item.name === value);
|
|
@@ -38,7 +38,4 @@ class SingleSelectFormatter extends _react.default.PureComponent {
|
|
|
38
38
|
}, value ? this.getOption() : '');
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
SingleSelectFormatter.defaultProps = {
|
|
42
|
-
options: []
|
|
43
|
-
};
|
|
44
41
|
var _default = exports.default = SingleSelectFormatter;
|
package/lib/SvgIcon/index.js
CHANGED
|
@@ -6,25 +6,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _constants = require("../constants");
|
|
10
9
|
require("./index.css");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
10
|
+
const iconComponents = {};
|
|
11
|
+
const requireContext = require.context('../assets/icons', false, /\.svg$/);
|
|
12
|
+
requireContext.keys().forEach(path => {
|
|
13
|
+
const iconName = path.replace(/^\.\/(.*?)\.svg$/, '$1').toLowerCase();
|
|
14
|
+
iconComponents[iconName] = requireContext(path).default;
|
|
15
|
+
});
|
|
16
|
+
const SvgIcon = _ref => {
|
|
17
|
+
let {
|
|
14
18
|
className,
|
|
15
19
|
symbol,
|
|
16
20
|
color
|
|
17
|
-
} =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
return /*#__PURE__*/_react.default.createElement("svg", {
|
|
21
|
+
} = _ref;
|
|
22
|
+
if (!symbol) return null;
|
|
23
|
+
const iconClass = "dtable-ui-multicolor-icon multicolor-icon-".concat(symbol, " ").concat(className || '');
|
|
24
|
+
const props = {
|
|
23
25
|
className: iconClass,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
26
|
+
style: {
|
|
27
|
+
fill: color
|
|
28
|
+
},
|
|
29
|
+
ariaHidden: 'true'
|
|
30
|
+
};
|
|
31
|
+
const IconComponent = iconComponents[symbol];
|
|
32
|
+
if (!IconComponent) return null;
|
|
33
|
+
return /*#__PURE__*/_react.default.createElement(IconComponent, props);
|
|
29
34
|
};
|
|
30
35
|
var _default = exports.default = SvgIcon;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
+
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
4
|
+
viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">
|
|
5
|
+
<title>check</title>
|
|
6
|
+
<g id="check">
|
|
7
|
+
<g id="路径" transform="translate(0.020249, 4.178564)">
|
|
8
|
+
<path d="M27.9,0.7L12,18.1L4.1,8.9C3.2,7.9,1.8,7.6,0.7,8.6c-1,0.8-0.9,2.5,0,3.6c6.5,7.3,9.8,11,9.8,11
|
|
9
|
+
c1,0.9,1.9,1,2.8,0l17.9-19c1-1,1-2.5,0.2-3.4C30.4-0.4,28.8-0.2,27.9,0.7z"/>
|
|
10
|
+
</g>
|
|
11
|
+
</g>
|
|
12
|
+
</svg>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
+
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
4
|
+
viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">
|
|
5
|
+
<title>x-check-box</title>
|
|
6
|
+
<g id="x-check-box">
|
|
7
|
+
<g id="fork-number">
|
|
8
|
+
<path id="路径" d="M18.8,16l8.5-8.5c0.8-0.8,0.8-2.1,0-2.8s-2.1-0.8-2.8,0L16,13.2L7.5,4.6c-0.8-0.8-2.1-0.8-2.8,0
|
|
9
|
+
s-0.8,2.1,0,2.8l8.5,8.5l-8.5,8.5c-0.8,0.8-0.8,2.1,0,2.8c0.8,0.7,2.1,0.8,2.8,0l8.5-8.5l8.5,8.5c0.8,0.8,2.1,0.8,2.8,0
|
|
10
|
+
c0.8-0.8,0.8-2.1,0-2.8l0,0L18.8,16z"/>
|
|
11
|
+
</g>
|
|
12
|
+
</g>
|
|
13
|
+
</svg>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
+
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
4
|
+
viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">
|
|
5
|
+
<title>dot</title>
|
|
6
|
+
<g id="dot">
|
|
7
|
+
<circle id="椭圆形" cx="16" cy="16" r="9"/>
|
|
8
|
+
</g>
|
|
9
|
+
</svg>
|