@vtx/components 4.0.0-beta.8 → 4.0.0-beta.80

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.
Files changed (135) hide show
  1. package/es/index.js +3 -0
  2. package/es/utils/filterSpecialCharacters.js +47 -46
  3. package/es/utils/index.js +1 -2
  4. package/es/vtx-combogrid/Combogrid.js +5 -4
  5. package/es/vtx-combogrid/index.js +7 -4
  6. package/es/vtx-datagrid/Store/Provide.js +106 -137
  7. package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -3
  8. package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
  9. package/es/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
  10. package/es/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
  11. package/es/vtx-datagrid/columnState.js +91 -0
  12. package/es/vtx-datagrid/index.js +124 -32
  13. package/es/vtx-datagrid/mergeComponents.js +15 -0
  14. package/es/vtx-datagrid/renderColumnButtons.js +30 -11
  15. package/es/vtx-datagrid/style/index.js +102 -20
  16. package/es/vtx-date-picker/QdatePicker.js +1 -1
  17. package/es/vtx-descriptions/Descriptions.js +29 -0
  18. package/es/vtx-descriptions/index.js +3 -0
  19. package/es/vtx-descriptions/style/index.js +19 -0
  20. package/es/vtx-ellipsis-text/index.js +7 -2
  21. package/es/vtx-ellipsis-text/style/index.js +3 -1
  22. package/es/vtx-export/index.js +25 -25
  23. package/es/vtx-export-async/History.js +11 -3
  24. package/es/vtx-export-async/index.js +45 -15
  25. package/es/vtx-export-async/util.js +16 -5
  26. package/es/vtx-form-layout/Card.js +10 -10
  27. package/es/vtx-form-layout/Divider.js +1 -1
  28. package/es/vtx-form-layout/FormItem.js +16 -16
  29. package/es/vtx-form-layout/Pane.js +23 -12
  30. package/es/vtx-icon/index.js +54 -45
  31. package/es/vtx-icon/index.js1 +90 -0
  32. package/es/vtx-image/Preview.js +11 -6
  33. package/es/vtx-image/style/index.js +0 -1
  34. package/es/vtx-import/index.js +207 -65
  35. package/es/vtx-import/result.js +28 -26
  36. package/es/vtx-import/style/index.js +16 -1
  37. package/es/vtx-import2/Content.js +2 -1
  38. package/es/vtx-import2/index.js +30 -19
  39. package/es/vtx-import2/style/index.js +60 -9
  40. package/es/vtx-modal/index.js +9 -4
  41. package/es/vtx-page-layout/style/index.js +4 -2
  42. package/es/vtx-provider/index.js +7 -3
  43. package/es/vtx-provider/locale/en_US.js +57 -3
  44. package/es/vtx-provider/locale/zh_CN.js +57 -3
  45. package/es/vtx-search/index.js +13 -9
  46. package/es/vtx-search/style/index.js +2 -1
  47. package/es/vtx-select/index.js +102 -36
  48. package/es/vtx-select/style/index.js +11 -56
  49. package/es/vtx-signature/index.js +5 -4
  50. package/es/vtx-signature/style/index.js +1 -1
  51. package/es/vtx-split-pane/Resizer.js +0 -1
  52. package/es/vtx-split-pane/SplitPane.js +42 -34
  53. package/es/vtx-split-pane/style/index.js +8 -112
  54. package/es/vtx-time-picker/index.js +27 -1
  55. package/es/vtx-transfer/Transfer.js +29 -0
  56. package/es/vtx-transfer/index.js +3 -0
  57. package/es/vtx-transfer/style/index.js +19 -0
  58. package/es/vtx-transfer-select/TransferSelect.js +143 -0
  59. package/es/vtx-transfer-select/index.js +3 -0
  60. package/es/vtx-transfer-select/style/index.js +19 -0
  61. package/es/vtx-tree/index.js +98 -35
  62. package/es/vtx-tree-select/index.js +71 -105
  63. package/es/vtx-tree-select/style/index.js +9 -3
  64. package/es/vtx-upload/FilePreview.js +2 -1
  65. package/es/vtx-wang-editor/index.js +93 -39
  66. package/es/vtx-wang-editor/wangEditorUtil.js +4 -0
  67. package/lib/index.js +36 -0
  68. package/lib/utils/filterSpecialCharacters.js +48 -46
  69. package/lib/utils/index.js +0 -7
  70. package/lib/vtx-combogrid/Combogrid.js +5 -4
  71. package/lib/vtx-combogrid/index.js +7 -4
  72. package/lib/vtx-datagrid/Store/Provide.js +113 -143
  73. package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -3
  74. package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
  75. package/lib/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
  76. package/lib/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
  77. package/lib/vtx-datagrid/columnState.js +100 -0
  78. package/lib/vtx-datagrid/index.js +124 -32
  79. package/lib/vtx-datagrid/mergeComponents.js +21 -0
  80. package/lib/vtx-datagrid/renderColumnButtons.js +30 -11
  81. package/lib/vtx-datagrid/style/index.js +102 -20
  82. package/lib/vtx-date-picker/QdatePicker.js +1 -1
  83. package/lib/vtx-descriptions/Descriptions.js +38 -0
  84. package/lib/vtx-descriptions/index.js +15 -0
  85. package/lib/vtx-descriptions/style/index.js +25 -0
  86. package/lib/vtx-ellipsis-text/index.js +7 -2
  87. package/lib/vtx-ellipsis-text/style/index.js +3 -1
  88. package/lib/vtx-export/index.js +26 -26
  89. package/lib/vtx-export-async/History.js +11 -3
  90. package/lib/vtx-export-async/index.js +43 -13
  91. package/lib/vtx-export-async/util.js +16 -5
  92. package/lib/vtx-form-layout/Card.js +9 -9
  93. package/lib/vtx-form-layout/Divider.js +1 -1
  94. package/lib/vtx-form-layout/FormItem.js +16 -16
  95. package/lib/vtx-form-layout/Pane.js +22 -11
  96. package/lib/vtx-icon/index.js +54 -52
  97. package/lib/vtx-icon/index.js1 +90 -0
  98. package/lib/vtx-image/Preview.js +11 -6
  99. package/lib/vtx-image/style/index.js +0 -1
  100. package/lib/vtx-import/index.js +205 -63
  101. package/lib/vtx-import/result.js +29 -27
  102. package/lib/vtx-import/style/index.js +16 -1
  103. package/lib/vtx-import2/Content.js +2 -1
  104. package/lib/vtx-import2/index.js +29 -18
  105. package/lib/vtx-import2/style/index.js +60 -9
  106. package/lib/vtx-modal/index.js +9 -4
  107. package/lib/vtx-page-layout/style/index.js +4 -2
  108. package/lib/vtx-provider/index.js +7 -3
  109. package/lib/vtx-provider/locale/en_US.js +57 -3
  110. package/lib/vtx-provider/locale/zh_CN.js +57 -3
  111. package/lib/vtx-search/index.js +13 -9
  112. package/lib/vtx-search/style/index.js +2 -1
  113. package/lib/vtx-select/index.js +104 -38
  114. package/lib/vtx-select/style/index.js +11 -56
  115. package/lib/vtx-signature/index.js +4 -3
  116. package/lib/vtx-signature/style/index.js +1 -1
  117. package/lib/vtx-split-pane/Resizer.js +0 -1
  118. package/lib/vtx-split-pane/SplitPane.js +40 -31
  119. package/lib/vtx-split-pane/style/index.js +8 -112
  120. package/lib/vtx-time-picker/index.js +27 -1
  121. package/lib/vtx-transfer/Transfer.js +38 -0
  122. package/lib/vtx-transfer/index.js +15 -0
  123. package/lib/vtx-transfer/style/index.js +25 -0
  124. package/lib/vtx-transfer-select/TransferSelect.js +151 -0
  125. package/lib/vtx-transfer-select/index.js +15 -0
  126. package/lib/vtx-transfer-select/style/index.js +25 -0
  127. package/lib/vtx-tree/index.js +96 -33
  128. package/lib/vtx-tree-select/index.js +71 -105
  129. package/lib/vtx-tree-select/style/index.js +9 -3
  130. package/lib/vtx-upload/FilePreview.js +2 -1
  131. package/lib/vtx-wang-editor/index.js +91 -37
  132. package/lib/vtx-wang-editor/wangEditorUtil.js +4 -0
  133. package/package.json +47 -32
  134. package/es/utils/hooks/useFetchData/index.js +0 -82
  135. package/lib/utils/hooks/useFetchData/index.js +0 -89
@@ -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,62 +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
- var VtxIcon = /*#__PURE__*/memo(function (_ref) {
14
- var type = _ref.type,
15
- _ref$size = _ref.size,
16
- size = _ref$size === void 0 ? 16 : _ref$size,
17
- _ref$className = _ref.className,
18
- className = _ref$className === void 0 ? '' : _ref$className,
19
- _ref$style = _ref.style,
20
- style = _ref$style === void 0 ? {} : _ref$style,
21
- color = _ref.color,
22
- _ref$fileType = _ref.fileType,
23
- fileType = _ref$fileType === void 0 ? 'webp' : _ref$fileType,
21
+ var iconComponents = {
22
+ alignRightOutlined: AlignRightOutlined,
23
+ columnHeightOutlined: ColumnHeightOutlined,
24
+ downOutlined: DownOutlined,
25
+ fullscreen: Fullscreen,
26
+ redoOutlined: RedoOutlined,
27
+ rightOutlined: RightOutlined,
28
+ settingOutlined: SettingOutlined
29
+ // 低频图标如果确实需要,可以再考虑 lazy
30
+ };
31
+ var EmptySvg = function EmptySvg(_ref) {
32
+ var width = _ref.width,
33
+ height = _ref.height,
34
+ style = _ref.style,
35
+ className = _ref.className,
24
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);
25
56
  var width = props.width || size;
26
57
  var height = props.height || size;
27
58
  if (!type) {
28
59
  return null;
29
60
  }
30
- var SvgComponent = useMemo(function () {
31
- // 动态导入并缓存结果
32
- return /*#__PURE__*/lazy(function () {
33
- return import( /* @vite-ignore */"./svg/".concat(type, ".js"));
34
- });
35
- }, [type]);
36
61
 
37
62
  // 默认返回空元素
38
63
  if (fileType == 'svg') {
39
- try {
40
- // const SvgComponent = lazy(() => import(`./svg/${type}.js`));
41
- return /*#__PURE__*/_jsx(Suspense, {
42
- fallback: /*#__PURE__*/_jsx("div", {
43
- style: _objectSpread({
44
- width: width,
45
- height: height
46
- }, style)
47
- }),
48
- children: /*#__PURE__*/_jsx(SvgComponent, _objectSpread({
49
- className: className,
50
- style: _objectSpread({
51
- width: width,
52
- height: height
53
- }, style),
54
- fill: color
55
- }, props))
56
- });
57
- } catch (error) {
58
- // 如果动态导入失败,返回空的 SVG 元素
59
- return /*#__PURE__*/_jsx("svg", _objectSpread({
64
+ var SvgComponent = iconComponents[type] || EmptySvg;
65
+ return /*#__PURE__*/_jsx(SvgComponent, _objectSpread({
66
+ className: className,
67
+ style: _objectSpread({
60
68
  width: width,
61
- height: height,
62
- style: style,
63
- className: className
64
- }, props));
65
- }
69
+ height: height
70
+ }, style),
71
+ width: width,
72
+ height: height,
73
+ fill: color
74
+ }, props));
66
75
  } else {
67
76
  return (
68
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;
@@ -22,15 +22,12 @@ var VIEWER = 'viewer';
22
22
  // 多张
23
23
  var GALLERY = 'gallery';
24
24
  function checkMode(x) {
25
- var mode = '';
26
- if (isObject(x)) {
27
- mode = VIEWER;
28
- }
29
25
  if (Array.isArray(x)) {
30
26
  var len = x.length;
31
- mode = len == 0 ? '' : len == 1 ? VIEWER : GALLERY;
27
+ if (len === 0) return null;
28
+ return len === 1 ? VIEWER : GALLERY;
32
29
  }
33
- return mode;
30
+ return isObject(x) ? VIEWER : null;
34
31
  }
35
32
  export default function Preview(props) {
36
33
  var _useState = useState(),
@@ -87,6 +84,9 @@ export default function Preview(props) {
87
84
  setContainer(container);
88
85
  setViewer(viewer);
89
86
  return function () {
87
+ if (container) {
88
+ container.innerHTML = '';
89
+ }
90
90
  viewer && viewer.destroy();
91
91
  };
92
92
  }, []);
@@ -96,6 +96,7 @@ export default function Preview(props) {
96
96
  container.innerHTML = '';
97
97
  }
98
98
  var mode = checkMode(photo);
99
+ if (!mode) return null;
99
100
  var newIndex = index;
100
101
  // 单张
101
102
  if (mode === VIEWER) {
@@ -126,6 +127,10 @@ export default function Preview(props) {
126
127
  }
127
128
  viewer.update();
128
129
  viewer.view(newIndex);
130
+ } else {
131
+ if (container) {
132
+ container.innerHTML = '';
133
+ }
129
134
  }
130
135
  }, [visible]);
131
136
  return /*#__PURE__*/_jsx(_Fragment, {});
@@ -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%',