dtable-ui-component 6.0.40 → 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.
@@ -1,6 +1,6 @@
1
1
  @import url('../css/cell-formatter.css');
2
2
 
3
- .dtable-ui.checkbox-formatter .checkbox-checked-mark {
3
+ .dtable-ui.checkbox-formatter .dtable-ui-checkbox-check-mark {
4
4
  color: #20c933;
5
5
  display: flex;
6
6
  align-items: center;
@@ -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.startsWith('dtable-icon') ? /*#__PURE__*/_react.default.createElement("span", {
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 = {
@@ -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 needScaleIcons = ['check', 'dot', 'cross'];
12
- const SvgIcon = props => {
13
- const {
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
- } = props;
18
- let iconClass = "dtable-ui-multicolor-icon multicolor-icon-".concat(symbol, " ").concat(className || '');
19
- if (needScaleIcons.includes(symbol) && _constants.isMobile) {
20
- iconClass += ' scale-icon';
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
- "aria-hidden": "true"
25
- }, /*#__PURE__*/_react.default.createElement("use", {
26
- fill: color,
27
- xlinkHref: "#".concat(symbol)
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>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "6.0.40",
3
+ "version": "6.0.41",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "4.0.2",