@vtx/components 4.0.0-beta.62 → 4.0.0-beta.64

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.
@@ -244,7 +244,6 @@ var CheckboxList = function CheckboxList(_ref3) {
244
244
  var dropPosition = info.dropPosition,
245
245
  dropToGap = info.dropToGap;
246
246
  var position = dropPosition === -1 || !dropToGap ? dropPosition + 1 : dropPosition;
247
- console.log('newMap info', dragKey, dropKey, position);
248
247
  move(dragKey, dropKey, position);
249
248
  },
250
249
  treeIcon: false,
@@ -7,7 +7,6 @@ import { Fragment as _Fragment } from "react/jsx-runtime";
7
7
  function Density() {
8
8
  var counter = useContext(TableContext);
9
9
  var TextEnum = counter.TextEnum;
10
- console.log('tableSize', counter.tableSize);
11
10
  return /*#__PURE__*/_jsx(_Fragment, {
12
11
  children: /*#__PURE__*/_jsx(Dropdown, {
13
12
  menu: {
@@ -24,7 +23,6 @@ function Density() {
24
23
  onClick: function onClick(_ref) {
25
24
  var _counter$setTableSize;
26
25
  var key = _ref.key;
27
- console.log('counter', counter, key);
28
26
  (_counter$setTableSize = counter.setTableSize) === null || _counter$setTableSize === void 0 || _counter$setTableSize.call(counter, key);
29
27
  },
30
28
  selectedKeys: [counter.tableSize]
@@ -61,7 +61,6 @@ export default function FormItem(props) {
61
61
  }
62
62
  });
63
63
  var initPlaceholder = function initPlaceholder(placeholder, label, type) {
64
- console.log('label, placeholder', placeholder, type === null || type === void 0 ? void 0 : type.displayName);
65
64
  if (placeholder) {
66
65
  return placeholder;
67
66
  }
@@ -81,14 +80,12 @@ export default function FormItem(props) {
81
80
  var renderItem = function renderItem(child) {
82
81
  if ( /*#__PURE__*/isValidElement(child)) {
83
82
  var _child$props;
84
- console.log('initPlaceholder', child, label);
85
83
  return /*#__PURE__*/React.cloneElement(child, _objectSpread(_objectSpread({}, child.props), {}, {
86
84
  placeholder: initPlaceholder(child === null || child === void 0 || (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.placeholder, label, child === null || child === void 0 ? void 0 : child.type)
87
85
  }));
88
86
  }
89
87
  return child;
90
88
  };
91
- console.log('disableHtmlFor', disableHtmlFor, props.children);
92
89
  return /*#__PURE__*/_jsx(Col, {
93
90
  span: SPAN * weights / cols,
94
91
  className: "".concat(prefixCls, "-col"),
@@ -1,5 +1,6 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["type", "size", "className", "style", "color", "fileType"];
2
+ var _excluded = ["width", "height", "style", "className"],
3
+ _excluded2 = ["type", "size", "className", "style", "color", "fileType"];
3
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
6
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -7,99 +8,70 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
7
8
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
9
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
10
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
- import { lazy, memo, Suspense, useMemo } from 'react';
11
+ import { memo } from 'react';
12
+ import AlignRightOutlined from "./svg/alignRightOutlined.js";
13
+ import ColumnHeightOutlined from "./svg/columnHeightOutlined.js";
14
+ import DownOutlined from "./svg/downOutlined.js";
15
+ import Fullscreen from "./svg/fullscreen.js";
16
+ import RedoOutlined from "./svg/redoOutlined.js";
17
+ import RightOutlined from "./svg/rightOutlined.js";
18
+ import SettingOutlined from "./svg/settingOutlined.js";
11
19
  import { jsx as _jsx } from "react/jsx-runtime";
12
20
  import { Fragment as _Fragment } from "react/jsx-runtime";
13
21
  var iconComponents = {
14
- // 核心:添加你需要的所有图标, 动态导入有的组件会失败
15
- alignRightOutlined: /*#__PURE__*/lazy(function () {
16
- return import("./svg/alignRightOutlined.js");
17
- }),
18
- columnHeightOutlined: /*#__PURE__*/lazy(function () {
19
- return import("./svg/columnHeightOutlined.js");
20
- }),
21
- downOutlined: /*#__PURE__*/lazy(function () {
22
- return import("./svg/downOutlined.js");
23
- }),
24
- fullscreen: /*#__PURE__*/lazy(function () {
25
- return import("./svg/fullscreen.js");
26
- }),
27
- redoOutlined: /*#__PURE__*/lazy(function () {
28
- return import("./svg/redoOutlined.js");
29
- }),
30
- rightOutlined: /*#__PURE__*/lazy(function () {
31
- return import("./svg/rightOutlined.js");
32
- }),
33
- settingOutlined: /*#__PURE__*/lazy(function () {
34
- return import("./svg/settingOutlined.js");
35
- })
36
- // 新增其他图标...
22
+ alignRightOutlined: AlignRightOutlined,
23
+ columnHeightOutlined: ColumnHeightOutlined,
24
+ downOutlined: DownOutlined,
25
+ fullscreen: Fullscreen,
26
+ redoOutlined: RedoOutlined,
27
+ rightOutlined: RightOutlined,
28
+ settingOutlined: SettingOutlined
29
+ // 低频图标如果确实需要,可以再考虑 lazy
37
30
  };
38
- var VtxIcon = /*#__PURE__*/memo(function (_ref) {
39
- var type = _ref.type,
40
- _ref$size = _ref.size,
41
- size = _ref$size === void 0 ? 16 : _ref$size,
42
- _ref$className = _ref.className,
43
- className = _ref$className === void 0 ? '' : _ref$className,
44
- _ref$style = _ref.style,
45
- style = _ref$style === void 0 ? {} : _ref$style,
46
- color = _ref.color,
47
- _ref$fileType = _ref.fileType,
48
- fileType = _ref$fileType === void 0 ? 'webp' : _ref$fileType,
31
+ var EmptySvg = function EmptySvg(_ref) {
32
+ var width = _ref.width,
33
+ height = _ref.height,
34
+ style = _ref.style,
35
+ className = _ref.className,
49
36
  props = _objectWithoutProperties(_ref, _excluded);
37
+ return /*#__PURE__*/_jsx("svg", _objectSpread({
38
+ width: width,
39
+ height: height,
40
+ style: style,
41
+ className: className
42
+ }, props));
43
+ };
44
+ var VtxIcon = /*#__PURE__*/memo(function (_ref2) {
45
+ var type = _ref2.type,
46
+ _ref2$size = _ref2.size,
47
+ size = _ref2$size === void 0 ? 16 : _ref2$size,
48
+ _ref2$className = _ref2.className,
49
+ className = _ref2$className === void 0 ? '' : _ref2$className,
50
+ _ref2$style = _ref2.style,
51
+ style = _ref2$style === void 0 ? {} : _ref2$style,
52
+ color = _ref2.color,
53
+ _ref2$fileType = _ref2.fileType,
54
+ fileType = _ref2$fileType === void 0 ? 'webp' : _ref2$fileType,
55
+ props = _objectWithoutProperties(_ref2, _excluded2);
50
56
  var width = props.width || size;
51
57
  var height = props.height || size;
52
58
  if (!type) {
53
59
  return null;
54
60
  }
55
- // const SvgComponent = useMemo(() => {
56
- // // 动态导入并缓存结果
57
- // return lazy(() => import(/* @vite-ignore */`./svg/${type}.js`));
58
- // }, [type]);
59
-
60
- var SvgComponent = useMemo(function () {
61
- // 兜底:找不到对应图标时,返回一个空组件(避免报错)
62
- return iconComponents[type] || /*#__PURE__*/lazy(function () {
63
- return Promise.resolve({
64
- default: function _default() {
65
- return /*#__PURE__*/_jsx("svg", {
66
- width: width,
67
- height: height
68
- });
69
- }
70
- });
71
- });
72
- }, [type, width, height]);
73
61
 
74
62
  // 默认返回空元素
75
63
  if (fileType == 'svg') {
76
- try {
77
- // const SvgComponent = lazy(() => import(`./svg/${type}.js`));
78
- return /*#__PURE__*/_jsx(Suspense, {
79
- fallback: /*#__PURE__*/_jsx("div", {
80
- style: _objectSpread({
81
- width: width,
82
- height: height
83
- }, style)
84
- }),
85
- children: /*#__PURE__*/_jsx(SvgComponent, _objectSpread({
86
- className: className,
87
- style: _objectSpread({
88
- width: width,
89
- height: height
90
- }, style),
91
- fill: color
92
- }, props))
93
- });
94
- } catch (error) {
95
- // 如果动态导入失败,返回空的 SVG 元素
96
- return /*#__PURE__*/_jsx("svg", _objectSpread({
64
+ var SvgComponent = iconComponents[type] || EmptySvg;
65
+ return /*#__PURE__*/_jsx(SvgComponent, _objectSpread({
66
+ className: className,
67
+ style: _objectSpread({
97
68
  width: width,
98
- height: height,
99
- style: style,
100
- className: className
101
- }, props));
102
- }
69
+ height: height
70
+ }, style),
71
+ width: width,
72
+ height: height,
73
+ fill: color
74
+ }, props));
103
75
  } else {
104
76
  return (
105
77
  /*#__PURE__*/
@@ -0,0 +1,90 @@
1
+ import { lazy, memo, Suspense, useMemo } from 'react';
2
+ import AlignRightOutlined from './svg/alignRightOutlined.js';
3
+ import ColumnHeightOutlined from './svg/columnHeightOutlined.js';
4
+ import DownOutlined from './svg/downOutlined.js';
5
+ import Fullscreen from './svg/fullscreen.js';
6
+ import RedoOutlined from './svg/redoOutlined.js';
7
+ import RightOutlined from './svg/rightOutlined.js';
8
+ import SettingOutlined from './svg/settingOutlined.js';
9
+
10
+
11
+ const iconComponents = {
12
+ alignRightOutlined: AlignRightOutlined,
13
+ columnHeightOutlined: ColumnHeightOutlined,
14
+ downOutlined: DownOutlined,
15
+ fullscreen: Fullscreen,
16
+ redoOutlined: RedoOutlined,
17
+ rightOutlined: RightOutlined,
18
+ settingOutlined: SettingOutlined,
19
+ // 低频图标如果确实需要,可以再考虑 lazy
20
+ };
21
+
22
+ // const iconComponents = {
23
+ // // 核心:添加你需要的所有图标, 动态导入有的组件会失败
24
+ // alignRightOutlined: lazy(() => import('./svg/alignRightOutlined.js')),
25
+ // columnHeightOutlined: lazy(() => import('./svg/columnHeightOutlined.js')),
26
+ // downOutlined: lazy(() => import('./svg/downOutlined.js')),
27
+ // fullscreen: lazy(() => import('./svg/fullscreen.js')),
28
+ // redoOutlined: lazy(() => import('./svg/redoOutlined.js')),
29
+ // rightOutlined: lazy(() => import('./svg/rightOutlined.js')),
30
+ // settingOutlined: lazy(() => import('./svg/settingOutlined.js')),
31
+ // // 新增其他图标...
32
+ // };
33
+
34
+
35
+ const VtxIcon = memo(({
36
+ type,
37
+ size = 16,
38
+ className = '',
39
+ style = {},
40
+ color,
41
+ fileType = 'webp',
42
+ ...props
43
+ }) => {
44
+ const width = props.width || size;
45
+ const height = props.height || size;
46
+ if (!type) {
47
+ return null;
48
+ }
49
+ // const SvgComponent = useMemo(() => {
50
+ // // 动态导入并缓存结果
51
+ // return lazy(() => import(/* @vite-ignore */`./svg/${type}.js`));
52
+ // }, [type]);
53
+
54
+ const SvgComponent = useMemo(() => {
55
+ // 兜底:找不到对应图标时,返回一个空组件(避免报错)
56
+ return iconComponents[type] || lazy(() => Promise.resolve({ default: () => <svg width={width} height={height} /> }));
57
+ }, [type, width, height]);
58
+
59
+ // 默认返回空元素
60
+ if (fileType == 'svg') {
61
+ try {
62
+ // const SvgComponent = lazy(() => import(`./svg/${type}.js`));
63
+ return (
64
+ <Suspense fallback={<div style={{ width, height, ...style }} />}>
65
+ <SvgComponent
66
+ className={className}
67
+ style={{ width, height, ...style }}
68
+ fill={color}
69
+ {...props}
70
+ />
71
+ </Suspense>
72
+ );
73
+ } catch (error) {
74
+ // 如果动态导入失败,返回空的 SVG 元素
75
+ return (
76
+ <svg width={width} height={height} style={style} className={className} {...props} />
77
+ );
78
+ }
79
+ } else {
80
+ return (
81
+ // <img
82
+ // src={require(`./assets/${type}.${fileType}`)}
83
+ // style={{ width, height, ...style }}
84
+ // />
85
+ <></>
86
+ );
87
+ }
88
+ });
89
+ export { VtxIcon }
90
+ export default VtxIcon;
@@ -20,7 +20,6 @@ var center = function center() {
20
20
  };
21
21
  var genVtxImageStyle = function genVtxImageStyle(token) {
22
22
  var componentCls = token.componentCls;
23
- console.log('componentCls', componentCls);
24
23
  return _defineProperty(_defineProperty(_defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, '&-aspectFit', {
25
24
  position: 'relative',
26
25
  height: '100%',
@@ -7,7 +7,6 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
7
7
  import { useStyle as useAntdStyle } from "../../vtx-provider";
8
8
  var genVtxImport2Style = function genVtxImport2Style(token) {
9
9
  var componentCls = token.componentCls;
10
- console.log('componentCls', componentCls);
11
10
  return _defineProperty(_defineProperty(_defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, '&-modal-header-title', {
12
11
  color: token.colorText
13
12
  }), '&-modal-header-text', {
@@ -251,9 +251,6 @@ function VtxSearch(props) {
251
251
  return (realColumn - grid.len - 1) * (24 / realColumn);
252
252
  }
253
253
  } else {
254
- console.log('grid.lenWeight', grid.lenWeight);
255
- console.log('realColumn', realColumn);
256
- console.log('showPosition', showPosition);
257
254
  if (grid.lenWeight > realColumn - 1) {
258
255
  var _total = Math.ceil((grid.lenWeight + 1) / realColumn);
259
256
  return (_total * realColumn - grid.lenWeight - 1) * (24 / realColumn);
@@ -93,7 +93,6 @@ var VtxSelect = /*#__PURE__*/forwardRef(function (props, ref) {
93
93
  };
94
94
  }
95
95
  }, [mode]);
96
- console.log(props.options, props.children);
97
96
  var newChildren = props.children ? Array.isArray(props.children) ? props.children : [props.children] : ((_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.map(function (v) {
98
97
  return _objectSpread(_objectSpread({}, v), {}, {
99
98
  key: v.value,
@@ -106,7 +106,6 @@ var VtxTreeSelect = function VtxTreeSelect(_ref) {
106
106
  return [];
107
107
  }
108
108
  }(value);
109
- console.log('value_arr', value_arr, keyNodesMapping);
110
109
  var selectedNodes = value_arr.filter(function (k) {
111
110
  if (_labelInValue) {
112
111
  return k.value in keyNodesMapping;
@@ -122,7 +121,6 @@ var VtxTreeSelect = function VtxTreeSelect(_ref) {
122
121
  return selectedNodes;
123
122
  };
124
123
  var selectedNodes = useMemo(function () {
125
- console.log('selectedNodes', props);
126
124
  return getSelectedNodes(props.value);
127
125
  }, [props.value, keyNodesMapping]);
128
126
  useEffect(function () {
@@ -7,7 +7,6 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
7
7
  import { useStyle as useAntdStyle } from "../../vtx-provider";
8
8
  var genVtxTreeSelectStyle = function genVtxTreeSelectStyle(token) {
9
9
  var componentCls = token.componentCls;
10
- console.log('token.controlHeight', token.controlHeight);
11
10
  return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, '&-popover', {
12
11
  minWidth: '200px',
13
12
  height: '300px',
@@ -342,7 +342,6 @@ var VtxWangEditor = function VtxWangEditor(props) {
342
342
  try {
343
343
  if (res.result == 0) {
344
344
  res.data.map(function (item) {
345
- console.log('插入附件:', item, insertFn);
346
345
  insertFn(item.fileName, "".concat(downloadUrl).concat(item.id));
347
346
  });
348
347
  } else {
@@ -248,7 +248,6 @@ var CheckboxList = function CheckboxList(_ref3) {
248
248
  var dropPosition = info.dropPosition,
249
249
  dropToGap = info.dropToGap;
250
250
  var position = dropPosition === -1 || !dropToGap ? dropPosition + 1 : dropPosition;
251
- console.log('newMap info', dragKey, dropKey, position);
252
251
  move(dragKey, dropKey, position);
253
252
  },
254
253
  treeIcon: false,
@@ -13,7 +13,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
13
13
  function Density() {
14
14
  var counter = (0, _react.useContext)(_Provide.TableContext);
15
15
  var TextEnum = counter.TextEnum;
16
- console.log('tableSize', counter.tableSize);
17
16
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
18
17
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Dropdown, {
19
18
  menu: {
@@ -30,7 +29,6 @@ function Density() {
30
29
  onClick: function onClick(_ref) {
31
30
  var _counter$setTableSize;
32
31
  var key = _ref.key;
33
- console.log('counter', counter, key);
34
32
  (_counter$setTableSize = counter.setTableSize) === null || _counter$setTableSize === void 0 || _counter$setTableSize.call(counter, key);
35
33
  },
36
34
  selectedKeys: [counter.tableSize]
@@ -67,7 +67,6 @@ function FormItem(props) {
67
67
  }
68
68
  });
69
69
  var initPlaceholder = function initPlaceholder(placeholder, label, type) {
70
- console.log('label, placeholder', placeholder, type === null || type === void 0 ? void 0 : type.displayName);
71
70
  if (placeholder) {
72
71
  return placeholder;
73
72
  }
@@ -87,14 +86,12 @@ function FormItem(props) {
87
86
  var renderItem = function renderItem(child) {
88
87
  if ( /*#__PURE__*/(0, _react.isValidElement)(child)) {
89
88
  var _child$props;
90
- console.log('initPlaceholder', child, label);
91
89
  return /*#__PURE__*/_react.default.cloneElement(child, _objectSpread(_objectSpread({}, child.props), {}, {
92
90
  placeholder: initPlaceholder(child === null || child === void 0 || (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.placeholder, label, child === null || child === void 0 ? void 0 : child.type)
93
91
  }));
94
92
  }
95
93
  return child;
96
94
  };
97
- console.log('disableHtmlFor', disableHtmlFor, props.children);
98
95
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Col, {
99
96
  span: SPAN * weights / cols,
100
97
  className: "".concat(prefixCls, "-col"),
@@ -1,13 +1,22 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = exports.VtxIcon = void 0;
7
8
  var _react = require("react");
9
+ var _alignRightOutlined = _interopRequireDefault(require("./svg/alignRightOutlined.js"));
10
+ var _columnHeightOutlined = _interopRequireDefault(require("./svg/columnHeightOutlined.js"));
11
+ var _downOutlined = _interopRequireDefault(require("./svg/downOutlined.js"));
12
+ var _fullscreen = _interopRequireDefault(require("./svg/fullscreen.js"));
13
+ var _redoOutlined = _interopRequireDefault(require("./svg/redoOutlined.js"));
14
+ var _rightOutlined = _interopRequireDefault(require("./svg/rightOutlined.js"));
15
+ var _settingOutlined = _interopRequireDefault(require("./svg/settingOutlined.js"));
8
16
  var _jsxRuntime = require("react/jsx-runtime");
9
- var _excluded = ["type", "size", "className", "style", "color", "fileType"];
10
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
17
+ var _excluded = ["width", "height", "style", "className"],
18
+ _excluded2 = ["type", "size", "className", "style", "color", "fileType"];
19
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
20
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
21
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
22
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -15,112 +24,60 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
15
24
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
16
25
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
17
26
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
18
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
19
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
20
27
  var iconComponents = {
21
- // 核心:添加你需要的所有图标, 动态导入有的组件会失败
22
- alignRightOutlined: /*#__PURE__*/(0, _react.lazy)(function () {
23
- return Promise.resolve().then(function () {
24
- return _interopRequireWildcard(require("./svg/alignRightOutlined.js"));
25
- });
26
- }),
27
- columnHeightOutlined: /*#__PURE__*/(0, _react.lazy)(function () {
28
- return Promise.resolve().then(function () {
29
- return _interopRequireWildcard(require("./svg/columnHeightOutlined.js"));
30
- });
31
- }),
32
- downOutlined: /*#__PURE__*/(0, _react.lazy)(function () {
33
- return Promise.resolve().then(function () {
34
- return _interopRequireWildcard(require("./svg/downOutlined.js"));
35
- });
36
- }),
37
- fullscreen: /*#__PURE__*/(0, _react.lazy)(function () {
38
- return Promise.resolve().then(function () {
39
- return _interopRequireWildcard(require("./svg/fullscreen.js"));
40
- });
41
- }),
42
- redoOutlined: /*#__PURE__*/(0, _react.lazy)(function () {
43
- return Promise.resolve().then(function () {
44
- return _interopRequireWildcard(require("./svg/redoOutlined.js"));
45
- });
46
- }),
47
- rightOutlined: /*#__PURE__*/(0, _react.lazy)(function () {
48
- return Promise.resolve().then(function () {
49
- return _interopRequireWildcard(require("./svg/rightOutlined.js"));
50
- });
51
- }),
52
- settingOutlined: /*#__PURE__*/(0, _react.lazy)(function () {
53
- return Promise.resolve().then(function () {
54
- return _interopRequireWildcard(require("./svg/settingOutlined.js"));
55
- });
56
- })
57
- // 新增其他图标...
28
+ alignRightOutlined: _alignRightOutlined.default,
29
+ columnHeightOutlined: _columnHeightOutlined.default,
30
+ downOutlined: _downOutlined.default,
31
+ fullscreen: _fullscreen.default,
32
+ redoOutlined: _redoOutlined.default,
33
+ rightOutlined: _rightOutlined.default,
34
+ settingOutlined: _settingOutlined.default
35
+ // 低频图标如果确实需要,可以再考虑 lazy
58
36
  };
59
- var VtxIcon = exports.VtxIcon = /*#__PURE__*/(0, _react.memo)(function (_ref) {
60
- var type = _ref.type,
61
- _ref$size = _ref.size,
62
- size = _ref$size === void 0 ? 16 : _ref$size,
63
- _ref$className = _ref.className,
64
- className = _ref$className === void 0 ? '' : _ref$className,
65
- _ref$style = _ref.style,
66
- style = _ref$style === void 0 ? {} : _ref$style,
67
- color = _ref.color,
68
- _ref$fileType = _ref.fileType,
69
- fileType = _ref$fileType === void 0 ? 'webp' : _ref$fileType,
37
+ var EmptySvg = function EmptySvg(_ref) {
38
+ var width = _ref.width,
39
+ height = _ref.height,
40
+ style = _ref.style,
41
+ className = _ref.className,
70
42
  props = _objectWithoutProperties(_ref, _excluded);
43
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", _objectSpread({
44
+ width: width,
45
+ height: height,
46
+ style: style,
47
+ className: className
48
+ }, props));
49
+ };
50
+ var VtxIcon = exports.VtxIcon = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
51
+ var type = _ref2.type,
52
+ _ref2$size = _ref2.size,
53
+ size = _ref2$size === void 0 ? 16 : _ref2$size,
54
+ _ref2$className = _ref2.className,
55
+ className = _ref2$className === void 0 ? '' : _ref2$className,
56
+ _ref2$style = _ref2.style,
57
+ style = _ref2$style === void 0 ? {} : _ref2$style,
58
+ color = _ref2.color,
59
+ _ref2$fileType = _ref2.fileType,
60
+ fileType = _ref2$fileType === void 0 ? 'webp' : _ref2$fileType,
61
+ props = _objectWithoutProperties(_ref2, _excluded2);
71
62
  var width = props.width || size;
72
63
  var height = props.height || size;
73
64
  if (!type) {
74
65
  return null;
75
66
  }
76
- // const SvgComponent = useMemo(() => {
77
- // // 动态导入并缓存结果
78
- // return lazy(() => import(/* @vite-ignore */`./svg/${type}.js`));
79
- // }, [type]);
80
-
81
- var SvgComponent = (0, _react.useMemo)(function () {
82
- // 兜底:找不到对应图标时,返回一个空组件(避免报错)
83
- return iconComponents[type] || /*#__PURE__*/(0, _react.lazy)(function () {
84
- return Promise.resolve({
85
- default: function _default() {
86
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
87
- width: width,
88
- height: height
89
- });
90
- }
91
- });
92
- });
93
- }, [type, width, height]);
94
67
 
95
68
  // 默认返回空元素
96
69
  if (fileType == 'svg') {
97
- try {
98
- // const SvgComponent = lazy(() => import(`./svg/${type}.js`));
99
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Suspense, {
100
- fallback: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
101
- style: _objectSpread({
102
- width: width,
103
- height: height
104
- }, style)
105
- }),
106
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(SvgComponent, _objectSpread({
107
- className: className,
108
- style: _objectSpread({
109
- width: width,
110
- height: height
111
- }, style),
112
- fill: color
113
- }, props))
114
- });
115
- } catch (error) {
116
- // 如果动态导入失败,返回空的 SVG 元素
117
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", _objectSpread({
70
+ var SvgComponent = iconComponents[type] || EmptySvg;
71
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(SvgComponent, _objectSpread({
72
+ className: className,
73
+ style: _objectSpread({
118
74
  width: width,
119
- height: height,
120
- style: style,
121
- className: className
122
- }, props));
123
- }
75
+ height: height
76
+ }, style),
77
+ width: width,
78
+ height: height,
79
+ fill: color
80
+ }, props));
124
81
  } else {
125
82
  return (
126
83
  /*#__PURE__*/
@@ -132,4 +89,4 @@ var VtxIcon = exports.VtxIcon = /*#__PURE__*/(0, _react.memo)(function (_ref) {
132
89
  );
133
90
  }
134
91
  });
135
- var _default2 = exports.default = VtxIcon;
92
+ var _default = exports.default = VtxIcon;
@@ -0,0 +1,90 @@
1
+ import { lazy, memo, Suspense, useMemo } from 'react';
2
+ import AlignRightOutlined from './svg/alignRightOutlined.js';
3
+ import ColumnHeightOutlined from './svg/columnHeightOutlined.js';
4
+ import DownOutlined from './svg/downOutlined.js';
5
+ import Fullscreen from './svg/fullscreen.js';
6
+ import RedoOutlined from './svg/redoOutlined.js';
7
+ import RightOutlined from './svg/rightOutlined.js';
8
+ import SettingOutlined from './svg/settingOutlined.js';
9
+
10
+
11
+ const iconComponents = {
12
+ alignRightOutlined: AlignRightOutlined,
13
+ columnHeightOutlined: ColumnHeightOutlined,
14
+ downOutlined: DownOutlined,
15
+ fullscreen: Fullscreen,
16
+ redoOutlined: RedoOutlined,
17
+ rightOutlined: RightOutlined,
18
+ settingOutlined: SettingOutlined,
19
+ // 低频图标如果确实需要,可以再考虑 lazy
20
+ };
21
+
22
+ // const iconComponents = {
23
+ // // 核心:添加你需要的所有图标, 动态导入有的组件会失败
24
+ // alignRightOutlined: lazy(() => import('./svg/alignRightOutlined.js')),
25
+ // columnHeightOutlined: lazy(() => import('./svg/columnHeightOutlined.js')),
26
+ // downOutlined: lazy(() => import('./svg/downOutlined.js')),
27
+ // fullscreen: lazy(() => import('./svg/fullscreen.js')),
28
+ // redoOutlined: lazy(() => import('./svg/redoOutlined.js')),
29
+ // rightOutlined: lazy(() => import('./svg/rightOutlined.js')),
30
+ // settingOutlined: lazy(() => import('./svg/settingOutlined.js')),
31
+ // // 新增其他图标...
32
+ // };
33
+
34
+
35
+ const VtxIcon = memo(({
36
+ type,
37
+ size = 16,
38
+ className = '',
39
+ style = {},
40
+ color,
41
+ fileType = 'webp',
42
+ ...props
43
+ }) => {
44
+ const width = props.width || size;
45
+ const height = props.height || size;
46
+ if (!type) {
47
+ return null;
48
+ }
49
+ // const SvgComponent = useMemo(() => {
50
+ // // 动态导入并缓存结果
51
+ // return lazy(() => import(/* @vite-ignore */`./svg/${type}.js`));
52
+ // }, [type]);
53
+
54
+ const SvgComponent = useMemo(() => {
55
+ // 兜底:找不到对应图标时,返回一个空组件(避免报错)
56
+ return iconComponents[type] || lazy(() => Promise.resolve({ default: () => <svg width={width} height={height} /> }));
57
+ }, [type, width, height]);
58
+
59
+ // 默认返回空元素
60
+ if (fileType == 'svg') {
61
+ try {
62
+ // const SvgComponent = lazy(() => import(`./svg/${type}.js`));
63
+ return (
64
+ <Suspense fallback={<div style={{ width, height, ...style }} />}>
65
+ <SvgComponent
66
+ className={className}
67
+ style={{ width, height, ...style }}
68
+ fill={color}
69
+ {...props}
70
+ />
71
+ </Suspense>
72
+ );
73
+ } catch (error) {
74
+ // 如果动态导入失败,返回空的 SVG 元素
75
+ return (
76
+ <svg width={width} height={height} style={style} className={className} {...props} />
77
+ );
78
+ }
79
+ } else {
80
+ return (
81
+ // <img
82
+ // src={require(`./assets/${type}.${fileType}`)}
83
+ // style={{ width, height, ...style }}
84
+ // />
85
+ <></>
86
+ );
87
+ }
88
+ });
89
+ export { VtxIcon }
90
+ export default VtxIcon;
@@ -26,7 +26,6 @@ var center = function center() {
26
26
  };
27
27
  var genVtxImageStyle = function genVtxImageStyle(token) {
28
28
  var componentCls = token.componentCls;
29
- console.log('componentCls', componentCls);
30
29
  return _defineProperty(_defineProperty(_defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, '&-aspectFit', {
31
30
  position: 'relative',
32
31
  height: '100%',
@@ -13,7 +13,6 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
13
13
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
14
14
  var genVtxImport2Style = function genVtxImport2Style(token) {
15
15
  var componentCls = token.componentCls;
16
- console.log('componentCls', componentCls);
17
16
  return _defineProperty(_defineProperty(_defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, '&-modal-header-title', {
18
17
  color: token.colorText
19
18
  }), '&-modal-header-text', {
@@ -257,9 +257,6 @@ function VtxSearch(props) {
257
257
  return (realColumn - grid.len - 1) * (24 / realColumn);
258
258
  }
259
259
  } else {
260
- console.log('grid.lenWeight', grid.lenWeight);
261
- console.log('realColumn', realColumn);
262
- console.log('showPosition', showPosition);
263
260
  if (grid.lenWeight > realColumn - 1) {
264
261
  var _total = Math.ceil((grid.lenWeight + 1) / realColumn);
265
262
  return (_total * realColumn - grid.lenWeight - 1) * (24 / realColumn);
@@ -101,7 +101,6 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
101
101
  };
102
102
  }
103
103
  }, [mode]);
104
- console.log(props.options, props.children);
105
104
  var newChildren = props.children ? Array.isArray(props.children) ? props.children : [props.children] : ((_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.map(function (v) {
106
105
  return _objectSpread(_objectSpread({}, v), {}, {
107
106
  key: v.value,
@@ -113,7 +113,6 @@ var VtxTreeSelect = exports.VtxTreeSelect = function VtxTreeSelect(_ref) {
113
113
  return [];
114
114
  }
115
115
  }(value);
116
- console.log('value_arr', value_arr, keyNodesMapping);
117
116
  var selectedNodes = value_arr.filter(function (k) {
118
117
  if (_labelInValue) {
119
118
  return k.value in keyNodesMapping;
@@ -129,7 +128,6 @@ var VtxTreeSelect = exports.VtxTreeSelect = function VtxTreeSelect(_ref) {
129
128
  return selectedNodes;
130
129
  };
131
130
  var selectedNodes = (0, _react.useMemo)(function () {
132
- console.log('selectedNodes', props);
133
131
  return getSelectedNodes(props.value);
134
132
  }, [props.value, keyNodesMapping]);
135
133
  (0, _react.useEffect)(function () {
@@ -13,7 +13,6 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
13
13
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
14
14
  var genVtxTreeSelectStyle = function genVtxTreeSelectStyle(token) {
15
15
  var componentCls = token.componentCls;
16
- console.log('token.controlHeight', token.controlHeight);
17
16
  return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, '&-popover', {
18
17
  minWidth: '200px',
19
18
  height: '300px',
@@ -347,7 +347,6 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
347
347
  try {
348
348
  if (res.result == 0) {
349
349
  res.data.map(function (item) {
350
- console.log('插入附件:', item, insertFn);
351
350
  insertFn(item.fileName, "".concat(downloadUrl).concat(item.id));
352
351
  });
353
352
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtx/components",
3
- "version": "4.0.0-beta.62",
3
+ "version": "4.0.0-beta.64",
4
4
  "description": "React components for Vortex",
5
5
  "keywords": [
6
6
  "react",