@vtx/components 4.0.0-beta.7 → 4.0.0-beta.70

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 (161) 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-color-picker/index.js +138 -33
  5. package/es/vtx-color-picker/style/index.js +36 -12
  6. package/es/vtx-combogrid/Combogrid.js +16 -10
  7. package/es/vtx-combogrid/index.js +7 -4
  8. package/es/vtx-combogrid/style/index.js +4 -4
  9. package/es/vtx-datagrid/Store/Provide.js +109 -132
  10. package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +11 -5
  11. package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
  12. package/es/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
  13. package/es/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
  14. package/es/vtx-datagrid/ToolBar/index.js +2 -2
  15. package/es/vtx-datagrid/columnState.js +64 -0
  16. package/es/vtx-datagrid/index.js +114 -35
  17. package/es/vtx-datagrid/mergeComponents.js +15 -0
  18. package/es/vtx-datagrid/renderColumnButtons.js +30 -11
  19. package/es/vtx-datagrid/style/index.js +102 -20
  20. package/es/vtx-date-picker/QdatePicker.js +1 -1
  21. package/es/vtx-descriptions/Descriptions.js +29 -0
  22. package/es/vtx-descriptions/index.js +3 -0
  23. package/es/vtx-descriptions/style/index.js +19 -0
  24. package/es/vtx-ellipsis-text/index.js +7 -2
  25. package/es/vtx-ellipsis-text/style/index.js +3 -1
  26. package/es/vtx-export/index.js +25 -25
  27. package/es/vtx-export-async/History.js +7 -3
  28. package/es/vtx-export-async/index.js +42 -14
  29. package/es/vtx-form-layout/Card.js +10 -10
  30. package/es/vtx-form-layout/Divider.js +1 -1
  31. package/es/vtx-form-layout/FormItem.js +18 -17
  32. package/es/vtx-form-layout/Pane.js +23 -12
  33. package/es/vtx-icon/index.js +54 -45
  34. package/es/vtx-icon/index.js1 +90 -0
  35. package/es/vtx-image/Preview.js +11 -6
  36. package/es/vtx-image/style/index.js +0 -1
  37. package/es/vtx-import/index.js +155 -43
  38. package/es/vtx-import/result.js +6 -2
  39. package/es/vtx-import/style/index.js +16 -1
  40. package/es/vtx-import2/Content.js +2 -1
  41. package/es/vtx-import2/index.js +31 -20
  42. package/es/vtx-import2/style/index.js +60 -9
  43. package/es/vtx-input/TextArea/index.js +11 -6
  44. package/es/vtx-modal/index.js +9 -4
  45. package/es/vtx-modal/style/index.js +5 -3
  46. package/es/vtx-page-layout/Content.js +1 -1
  47. package/es/vtx-page-layout/TabLayout.js +1 -7
  48. package/es/vtx-page-layout/TableLayout.js +14 -4
  49. package/es/vtx-page-layout/TableWrap.js +3 -2
  50. package/es/vtx-page-layout/TreeLayout.js +2 -8
  51. package/es/vtx-page-layout/container.js +6 -5
  52. package/es/vtx-page-layout/style/index.js +4 -2
  53. package/es/vtx-provider/index.js +20 -10
  54. package/es/vtx-provider/locale/en_US.js +65 -5
  55. package/es/vtx-provider/locale/zh_CN.js +75 -5
  56. package/es/vtx-provider/useStyle/index.js +8 -4
  57. package/es/vtx-scrollable-row/index.js +38 -28
  58. package/es/vtx-search/index.js +18 -13
  59. package/es/vtx-search/style/index.js +2 -1
  60. package/es/vtx-select/index.js +132 -46
  61. package/es/vtx-select/style/index.js +11 -56
  62. package/es/vtx-signature/index.js +5 -4
  63. package/es/vtx-signature/style/index.js +1 -1
  64. package/es/vtx-split-pane/Resizer.js +0 -1
  65. package/es/vtx-split-pane/SplitPane.js +34 -25
  66. package/es/vtx-split-pane/style/index.js +8 -112
  67. package/es/vtx-time-picker/index.js +27 -1
  68. package/es/vtx-transfer/Transfer.js +29 -0
  69. package/es/vtx-transfer/index.js +3 -0
  70. package/es/vtx-transfer/style/index.js +19 -0
  71. package/es/vtx-transfer-select/TransferSelect.js +143 -0
  72. package/es/vtx-transfer-select/index.js +3 -0
  73. package/es/vtx-transfer-select/style/index.js +19 -0
  74. package/es/vtx-tree/index.js +104 -40
  75. package/es/vtx-tree-select/index.js +75 -105
  76. package/es/vtx-tree-select/style/index.js +9 -3
  77. package/es/vtx-upload/FilePreview.js +2 -1
  78. package/es/vtx-wang-editor/index.js +291 -113
  79. package/es/vtx-wang-editor/wangEditorUtil.js +59 -9
  80. package/lib/index.js +36 -0
  81. package/lib/utils/filterSpecialCharacters.js +48 -46
  82. package/lib/utils/index.js +0 -7
  83. package/lib/vtx-color-picker/index.js +139 -34
  84. package/lib/vtx-color-picker/style/index.js +36 -12
  85. package/lib/vtx-combogrid/Combogrid.js +16 -10
  86. package/lib/vtx-combogrid/index.js +7 -4
  87. package/lib/vtx-combogrid/style/index.js +4 -4
  88. package/lib/vtx-datagrid/Store/Provide.js +116 -138
  89. package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +11 -6
  90. package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
  91. package/lib/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
  92. package/lib/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
  93. package/lib/vtx-datagrid/ToolBar/index.js +2 -2
  94. package/lib/vtx-datagrid/columnState.js +73 -0
  95. package/lib/vtx-datagrid/index.js +115 -35
  96. package/lib/vtx-datagrid/mergeComponents.js +21 -0
  97. package/lib/vtx-datagrid/renderColumnButtons.js +30 -11
  98. package/lib/vtx-datagrid/style/index.js +102 -20
  99. package/lib/vtx-date-picker/QdatePicker.js +1 -1
  100. package/lib/vtx-descriptions/Descriptions.js +38 -0
  101. package/lib/vtx-descriptions/index.js +15 -0
  102. package/lib/vtx-descriptions/style/index.js +25 -0
  103. package/lib/vtx-ellipsis-text/index.js +7 -2
  104. package/lib/vtx-ellipsis-text/style/index.js +3 -1
  105. package/lib/vtx-export/index.js +26 -26
  106. package/lib/vtx-export-async/History.js +7 -3
  107. package/lib/vtx-export-async/index.js +40 -12
  108. package/lib/vtx-form-layout/Card.js +9 -9
  109. package/lib/vtx-form-layout/Divider.js +1 -1
  110. package/lib/vtx-form-layout/FormItem.js +18 -17
  111. package/lib/vtx-form-layout/Pane.js +22 -11
  112. package/lib/vtx-icon/index.js +54 -52
  113. package/lib/vtx-icon/index.js1 +90 -0
  114. package/lib/vtx-image/Preview.js +11 -6
  115. package/lib/vtx-image/style/index.js +0 -1
  116. package/lib/vtx-import/index.js +154 -42
  117. package/lib/vtx-import/result.js +6 -2
  118. package/lib/vtx-import/style/index.js +16 -1
  119. package/lib/vtx-import2/Content.js +2 -1
  120. package/lib/vtx-import2/index.js +30 -19
  121. package/lib/vtx-import2/style/index.js +60 -9
  122. package/lib/vtx-input/TextArea/index.js +11 -6
  123. package/lib/vtx-modal/index.js +9 -4
  124. package/lib/vtx-modal/style/index.js +5 -3
  125. package/lib/vtx-page-layout/Content.js +1 -1
  126. package/lib/vtx-page-layout/TabLayout.js +3 -9
  127. package/lib/vtx-page-layout/TableLayout.js +14 -4
  128. package/lib/vtx-page-layout/TableWrap.js +3 -2
  129. package/lib/vtx-page-layout/TreeLayout.js +4 -10
  130. package/lib/vtx-page-layout/container.js +6 -5
  131. package/lib/vtx-page-layout/style/index.js +4 -2
  132. package/lib/vtx-provider/index.js +19 -10
  133. package/lib/vtx-provider/locale/en_US.js +65 -5
  134. package/lib/vtx-provider/locale/zh_CN.js +75 -5
  135. package/lib/vtx-provider/useStyle/index.js +8 -4
  136. package/lib/vtx-scrollable-row/index.js +38 -28
  137. package/lib/vtx-search/index.js +18 -13
  138. package/lib/vtx-search/style/index.js +2 -1
  139. package/lib/vtx-select/index.js +134 -48
  140. package/lib/vtx-select/style/index.js +11 -56
  141. package/lib/vtx-signature/index.js +4 -3
  142. package/lib/vtx-signature/style/index.js +1 -1
  143. package/lib/vtx-split-pane/Resizer.js +0 -1
  144. package/lib/vtx-split-pane/SplitPane.js +32 -23
  145. package/lib/vtx-split-pane/style/index.js +8 -112
  146. package/lib/vtx-time-picker/index.js +27 -1
  147. package/lib/vtx-transfer/Transfer.js +38 -0
  148. package/lib/vtx-transfer/index.js +15 -0
  149. package/lib/vtx-transfer/style/index.js +25 -0
  150. package/lib/vtx-transfer-select/TransferSelect.js +151 -0
  151. package/lib/vtx-transfer-select/index.js +15 -0
  152. package/lib/vtx-transfer-select/style/index.js +25 -0
  153. package/lib/vtx-tree/index.js +102 -38
  154. package/lib/vtx-tree-select/index.js +75 -105
  155. package/lib/vtx-tree-select/style/index.js +9 -3
  156. package/lib/vtx-upload/FilePreview.js +2 -1
  157. package/lib/vtx-wang-editor/index.js +289 -113
  158. package/lib/vtx-wang-editor/wangEditorUtil.js +59 -10
  159. package/package.json +44 -28
  160. package/es/utils/hooks/useFetchData/index.js +0 -82
  161. package/lib/utils/hooks/useFetchData/index.js +0 -89
@@ -1,13 +1,18 @@
1
+ var _excluded = ["value", "mode", "size", "onChange", "maxTagCount", "maxTagTextLength", "maxTagPlaceholder", "showAll", "selectStyle", "selectAll", "selectSearchAll", "defaultBindBodyToPopupContainer", "customEnumText", "showSearch", "optionFilterProp", "onSearch"],
2
+ _excluded2 = ["onSearch", "optionFilterProp"];
1
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); }
2
4
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
5
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
6
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
7
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
8
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
6
9
  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; }
7
10
  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; }
8
11
  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; }
9
12
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
10
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
+ 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; }
15
+ 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; }
11
16
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
17
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
18
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -25,13 +30,14 @@ import { VtxProvider, useIntl } from "../vtx-provider";
25
30
  import { jsx as _jsx } from "react/jsx-runtime";
26
31
  import { jsxs as _jsxs } from "react/jsx-runtime";
27
32
  var VtxSelect = /*#__PURE__*/forwardRef(function (props, ref) {
33
+ var _props$options;
28
34
  var intl = useIntl();
29
35
  var _useState = useState(0),
30
36
  _useState2 = _slicedToArray(_useState, 2),
31
37
  popWidth = _useState2[0],
32
38
  setPopWidth = _useState2[1];
33
39
  var elRef = useRef();
34
- var elId = useRef("vtx-select-".concat(Date.now()));
40
+ var elId = useRef("vtx-select-".concat(Math.random().toString(36).substr(2, 9)));
35
41
  var _useState3 = useState(''),
36
42
  _useState4 = _slicedToArray(_useState3, 2),
37
43
  searchValue = _useState4[0],
@@ -57,42 +63,94 @@ var VtxSelect = /*#__PURE__*/forwardRef(function (props, ref) {
57
63
  _props$defaultBindBod = props.defaultBindBodyToPopupContainer,
58
64
  defaultBindBodyToPopupContainer = _props$defaultBindBod === void 0 ? true : _props$defaultBindBod,
59
65
  _props$customEnumText = props.customEnumText,
60
- customEnumText = _props$customEnumText === void 0 ? {} : _props$customEnumText;
66
+ customEnumText = _props$customEnumText === void 0 ? {} : _props$customEnumText,
67
+ showSearch = props.showSearch,
68
+ optionFilterProp = props.optionFilterProp,
69
+ _onSearch = props.onSearch,
70
+ rest = _objectWithoutProperties(props, _excluded);
61
71
  var TextEnum = _objectSpread({
62
72
  selectAllText: intl.getMessage('select.selectAll', '全选'),
63
73
  defaultPlaceholderText: intl.getMessage('tableForm.selectPlaceholder', '请选择'),
64
74
  emptyDescriptionText: intl.getMessage('select.empty', '暂无数据')
65
75
  }, customEnumText);
76
+ var _useContext = useContext(VtxProvider),
77
+ getPrefixCls = _useContext.getPrefixCls;
78
+ var prefixCls = getPrefixCls('select', props.prefixCls);
79
+ var _useStyle = useStyle(prefixCls),
80
+ wrapSSR = _useStyle.wrapSSR,
81
+ hashId = _useStyle.hashId;
66
82
  useEffect(function () {
67
- if (mode === 'multiple' || mode === 'tags') {
68
- var timer = setInterval(function () {
69
- var _elRef$current;
70
- var _width = (_elRef$current = elRef.current) === null || _elRef$current === void 0 ? void 0 : _elRef$current.clientWidth;
71
- if (_width > 0) {
72
- setPopWidth(_width);
73
- clearInterval(timer);
83
+ if ((mode === 'multiple' || mode === 'tags') && elRef.current) {
84
+ var element = elRef.current;
85
+ // 立即设置一次
86
+ setPopWidth(element.clientWidth);
87
+
88
+ // 使用 ResizeObserver 监听尺寸变化
89
+ var resizeObserver = new ResizeObserver(function (entries) {
90
+ var _iterator = _createForOfIteratorHelper(entries),
91
+ _step;
92
+ try {
93
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
94
+ var entry = _step.value;
95
+ setPopWidth(entry.contentRect.width);
96
+ }
97
+ } catch (err) {
98
+ _iterator.e(err);
99
+ } finally {
100
+ _iterator.f();
74
101
  }
75
- }, 1000);
102
+ });
103
+ resizeObserver.observe(element);
76
104
  return function () {
77
- return clearInterval(timer);
105
+ resizeObserver.disconnect();
78
106
  };
79
107
  }
80
- }, []);
81
- var newChildren = props.children ? Array.isArray(props.children) ? props.children : [props.children] : [];
108
+ }, [mode]);
109
+ var newChildren = props.children ? React.Children.toArray(props.children) : ((_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.map(function (v) {
110
+ return _objectSpread(_objectSpread({}, v), {}, {
111
+ key: v.value,
112
+ props: _objectSpread(_objectSpread({}, v), {}, {
113
+ children: v.label
114
+ })
115
+ });
116
+ })) || [];
117
+ var getOptionValue = function getOptionValue(item) {
118
+ var _ref, _itemProps$value;
119
+ var itemProps = (item === null || item === void 0 ? void 0 : item.props) || {};
120
+ return (_ref = (_itemProps$value = itemProps.value) !== null && _itemProps$value !== void 0 ? _itemProps$value : item.value) !== null && _ref !== void 0 ? _ref : item.key;
121
+ };
122
+ var getOptionLabel = function getOptionLabel(item) {
123
+ var _ref2, _itemProps$children;
124
+ var itemProps = (item === null || item === void 0 ? void 0 : item.props) || {};
125
+ return (_ref2 = (_itemProps$children = itemProps.children) !== null && _itemProps$children !== void 0 ? _itemProps$children : itemProps.label) !== null && _ref2 !== void 0 ? _ref2 : item.label;
126
+ };
127
+ var getSelectedValue = function getSelectedValue(item) {
128
+ if (isObject(item)) {
129
+ var _item$value;
130
+ return (_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : item.key;
131
+ }
132
+ return item;
133
+ };
134
+ var normalizedOptions = newChildren.map(function (item) {
135
+ return {
136
+ value: getOptionValue(item),
137
+ label: getOptionLabel(item),
138
+ raw: item
139
+ };
140
+ });
82
141
  var getContent = function getContent() {
83
142
  var child = {};
84
- newChildren.forEach(function (item) {
85
- var _item$props;
86
- child[item.key] = item === null || item === void 0 || (_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.children;
143
+ normalizedOptions.forEach(function (item) {
144
+ child[item.value] = item.label;
87
145
  });
88
146
  var getChildren = function getChildren() {
89
147
  var child = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
90
148
  var value = arguments.length > 1 ? arguments[1] : undefined;
91
- var key = isObject(value) ? value.key : value;
149
+ var key = getSelectedValue(value);
92
150
  return child[key] || '';
93
151
  };
94
152
  return /*#__PURE__*/_jsx("div", {
95
- className: "vtx-all-list",
153
+ className: classnames("".concat(prefixCls, "-all-list"), hashId),
96
154
  children: Array.isArray(value) && value.length ? value.map(function (item, index) {
97
155
  var name = getChildren(child, item);
98
156
  return /*#__PURE__*/_jsx(Tag, {
@@ -104,10 +162,13 @@ var VtxSelect = /*#__PURE__*/forwardRef(function (props, ref) {
104
162
  e.preventDefault();
105
163
  var valueClone = _toConsumableArray(value);
106
164
  valueClone.splice(index, 1);
107
- var options = newChildren.filter(function (ite) {
108
- return valueClone.includes(ite.props.value);
165
+ var selectedValueSet = new Set(valueClone.map(getSelectedValue));
166
+ var options = normalizedOptions.filter(function (ite) {
167
+ return selectedValueSet.has(ite.value);
168
+ }).map(function (ite) {
169
+ return ite.raw;
109
170
  });
110
- _onChange(valueClone, options);
171
+ _onChange && _onChange(valueClone, options);
111
172
  },
112
173
  children: /*#__PURE__*/_jsx(Tooltip, {
113
174
  title: name,
@@ -120,16 +181,51 @@ var VtxSelect = /*#__PURE__*/forwardRef(function (props, ref) {
120
181
  })
121
182
  });
122
183
  };
123
- var newProps = _objectSpread(_objectSpread({
124
- showSearch: true,
125
- optionFilterProp: 'children',
184
+ var defaultOptionFilterProp = ['label', 'children'];
185
+ var handleSearch = function handleSearch(value) {
186
+ setSearchValue(value ? String(value).toLowerCase() : '');
187
+ _onSearch && _onSearch(value);
188
+ };
189
+ var getSearchProps = function getSearchProps() {
190
+ if (showSearch && _typeof(showSearch) === 'object') {
191
+ var showSearchOnSearch = showSearch.onSearch,
192
+ showSearchOptionFilterProp = showSearch.optionFilterProp,
193
+ searchConfig = _objectWithoutProperties(showSearch, _excluded2);
194
+ return {
195
+ showSearch: _objectSpread(_objectSpread({}, searchConfig), {}, {
196
+ optionFilterProp: showSearchOptionFilterProp || optionFilterProp || defaultOptionFilterProp,
197
+ onSearch: function onSearch(value) {
198
+ setSearchValue(value ? String(value).toLowerCase() : '');
199
+ showSearchOnSearch && showSearchOnSearch(value);
200
+ _onSearch && _onSearch(value);
201
+ }
202
+ })
203
+ };
204
+ }
205
+ return {
206
+ showSearch: showSearch === undefined ? true : showSearch,
207
+ optionFilterProp: optionFilterProp || defaultOptionFilterProp
208
+ };
209
+ };
210
+ var newProps = _objectSpread(_objectSpread(_objectSpread({}, getSearchProps()), {}, {
126
211
  placeholder: TextEnum.defaultPlaceholderText,
127
- allowClear: true
128
- }, props), {}, {
129
- onSearch: function onSearch(value) {
130
- setSearchValue(value ? String(value).toLowerCase() : '');
131
- props.onSearch && props.onSearch(value);
132
- },
212
+ allowClear: true,
213
+ value: value,
214
+ mode: mode,
215
+ size: size,
216
+ //同步button大小
217
+ onChange: _onChange,
218
+ maxTagCount: maxTagCount,
219
+ maxTagTextLength: maxTagTextLength,
220
+ maxTagPlaceholder: maxTagPlaceholder,
221
+ showAll: showAll,
222
+ //是否显示全部选项
223
+ selectStyle: selectStyle,
224
+ selectAll: selectAll,
225
+ selectSearchAll: selectSearchAll,
226
+ defaultBindBodyToPopupContainer: defaultBindBodyToPopupContainer
227
+ }, rest), {}, {
228
+ onSearch: handleSearch,
133
229
  onBlur: function onBlur(e) {
134
230
  setSearchValue('');
135
231
  props.onBlur && props.onBlur(e);
@@ -158,7 +254,7 @@ var VtxSelect = /*#__PURE__*/forwardRef(function (props, ref) {
158
254
  if (e.target.checked) {
159
255
  var tempChildren = newChildren.filter(function (item) {
160
256
  if (selectSearchAll && searchValue) {
161
- return String(item.props.children).toLowerCase().indexOf(searchValue) > -1;
257
+ return String(getOptionLabel(item)).toLowerCase().indexOf(searchValue) > -1;
162
258
  }
163
259
  return true;
164
260
  });
@@ -166,13 +262,13 @@ var VtxSelect = /*#__PURE__*/forwardRef(function (props, ref) {
166
262
  if (props.labelInValue) {
167
263
  keys = tempChildren.map(function (item) {
168
264
  return {
169
- label: item.props.children,
170
- value: item.key
265
+ label: getOptionLabel(item),
266
+ value: getOptionValue(item)
171
267
  };
172
268
  });
173
269
  } else {
174
270
  keys = tempChildren.map(function (item) {
175
- return item.key;
271
+ return getOptionValue(item);
176
272
  });
177
273
  }
178
274
  _onChange && _onChange(keys, tempChildren);
@@ -192,21 +288,11 @@ var VtxSelect = /*#__PURE__*/forwardRef(function (props, ref) {
192
288
  });
193
289
  }
194
290
  }
195
- var _useContext = useContext(VtxProvider),
196
- getPrefixCls = _useContext.getPrefixCls;
197
- var prefixCls = getPrefixCls('select', props.prefixCls);
198
- var _useStyle = useStyle(prefixCls),
199
- wrapSSR = _useStyle.wrapSSR,
200
- hashId = _useStyle.hashId;
201
291
  return wrapSSR( /*#__PURE__*/_jsx("div", {
202
- className: classnames(prefixCls, hashId, {
203
- 'vtx-multi-select': mode == 'multiple' || mode == 'tags'
204
- }),
292
+ className: classnames(prefixCls, hashId, _defineProperty({}, "".concat(prefixCls, "-multi"), mode == 'multiple' || mode == 'tags')),
205
293
  id: elId.current,
206
294
  ref: elRef,
207
- style: _objectSpread(_objectSpread({}, props.style), {}, {
208
- paddingRight: (mode == 'multiple' || mode == 'tags') && showAll ? 32 : 0
209
- }),
295
+ style: _objectSpread({}, props.style),
210
296
  children: /*#__PURE__*/_jsxs(Space.Compact, {
211
297
  style: {
212
298
  width: '100%'
@@ -7,66 +7,21 @@ 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 genVtxSelectStyle = function genVtxSelectStyle(token) {
9
9
  var componentCls = token.componentCls;
10
- return _defineProperty(_defineProperty({}, componentCls, {
11
- backgroundColor: 'transparent',
12
- position: 'relative',
13
- display: 'inline-block',
14
- width: '100%',
15
- '.vtx-select-count': {
16
- position: 'absolute',
17
- top: '0',
18
- verticalAlign: 'top'
19
- },
20
- '.vtx-all-list': {
21
- position: 'absolute',
22
- zIndex: 999,
23
- boxSizing: 'border-box',
24
- width: '100%',
25
- padding: '5px',
26
- boxShadow: '0 2px 8px #d9d9d9',
27
- backgroundColor: 'red !important'
28
- },
29
- '.ant-select-selection--multiple': {
30
- maxHeight: '32px',
31
- overflow: 'hidden'
32
- }
33
- }), '.vtx-multi-select', {
34
- position: 'relative',
35
- display: 'inline-block',
36
- width: '100%',
37
- maxHeight: '32px !important',
38
- boxSizing: 'border-box',
39
- '.vtx-select-count': {
40
- position: 'absolute',
41
- top: 0,
42
- right: 0,
43
- verticalAlign: 'top',
44
- borderLeft: 'none',
45
- borderTopLeftRadius: 0,
46
- 'border-bottom-left-radius': 0
47
- },
48
- '.vtx-all-list': {
49
- position: 'absolute',
50
- zIndex: 999,
51
- boxSizing: 'border-box',
52
- width: '100%',
53
- padding: '5px',
54
- boxShadow: '0 2px 8px #d9d9d9'
55
- },
56
- '.ant-select-selector': {
57
- 'border-top-right-radius': 0,
58
- 'border-bottom-right-radius': 0,
59
- maxHeight: '32px !important',
60
- overflow: 'hidden'
61
- },
62
- '.ant-select-selection--multiple': {
63
- maxHeight: '32px',
64
- overflow: 'hidden'
10
+ return _defineProperty(_defineProperty(_defineProperty({}, componentCls, _defineProperty({
11
+ width: "100%"
12
+ }, '.ant-select', {
13
+ overflow: "hidden"
14
+ })), "".concat(componentCls, "-multi"), {
15
+ ".ant-select-content": {
16
+ flexWrap: "nowrap"
65
17
  }
18
+ }), "".concat(componentCls, "-all-list"), {
19
+ maxHeight: 300,
20
+ overflowY: "auto"
66
21
  });
67
22
  };
68
23
  export function useStyle(prefixCls) {
69
- return useAntdStyle('VtxSelect', function (token) {
24
+ return useAntdStyle('', function (token) {
70
25
  var vtxSelectToken = _objectSpread(_objectSpread({}, token), {}, {
71
26
  componentCls: ".".concat(prefixCls)
72
27
  });
@@ -1,4 +1,4 @@
1
- import React, { forwardRef, useRef, useEffect, useContext } from 'react';
1
+ import React, { forwardRef, useRef, useLayoutEffect, useContext } from 'react';
2
2
  import SignaturePad from 'signature_pad';
3
3
  import debounce from 'lodash-es/debounce';
4
4
  import PropTypes from 'prop-types';
@@ -44,7 +44,7 @@ var VtxSignature = /*#__PURE__*/forwardRef(function (props, ref) {
44
44
  clear();
45
45
  }
46
46
  }
47
- useEffect(function () {
47
+ useLayoutEffect(function () {
48
48
  signaturePad.current = new SignaturePad(canvasRef.current, {
49
49
  dotSize: dotSize,
50
50
  minWidth: minWidth,
@@ -65,7 +65,9 @@ var VtxSignature = /*#__PURE__*/forwardRef(function (props, ref) {
65
65
  _onEnd && _onEnd();
66
66
  }
67
67
  });
68
- resizeCanvas();
68
+ setTimeout(function () {
69
+ resizeCanvas();
70
+ }, 0);
69
71
  window.addEventListener('resize', debounce(resizeCanvas, 150));
70
72
  return function () {
71
73
  window.removeEventListener('resize', debounce(resizeCanvas, 150));
@@ -82,7 +84,6 @@ var VtxSignature = /*#__PURE__*/forwardRef(function (props, ref) {
82
84
  };
83
85
  return wrapSSR( /*#__PURE__*/_jsxs("div", {
84
86
  className: classnames(prefixCls, hashId),
85
- ref: ref,
86
87
  children: [/*#__PURE__*/_jsx("div", {
87
88
  className: classnames("".concat(prefixCls, "--body")),
88
89
  children: /*#__PURE__*/_jsx("canvas", {
@@ -11,7 +11,7 @@ var genVtxSignatureStyle = function genVtxSignatureStyle(token) {
11
11
  position: 'relative',
12
12
  display: 'flex',
13
13
  flexDirection: 'column',
14
- height: '300px',
14
+ height: 300,
15
15
  padding: '16px',
16
16
  backgroundColor: token.colorBgBase,
17
17
  border: "1px solid ".concat(token.colorBorder),
@@ -43,5 +43,4 @@ function Resizer(props) {
43
43
  }));
44
44
  }
45
45
  Resizer.propTypes = {};
46
- Resizer.defaultProps = {};
47
46
  export default Resizer;
@@ -1,12 +1,20 @@
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 = ["children", "defaultSize", "minSize", "maxSize", "style"];
3
+ 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
+ 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
+ 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; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ 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
+ 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
+ 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; }
1
10
  import classnames from 'classnames';
2
11
  import React, { cloneElement, useContext, useRef } from 'react';
3
- import { Panel, PanelGroup, PanelResizeHandle } from 'react-resizable-panels';
12
+ import { Splitter } from 'antd';
4
13
  import Resizer from "./Resizer";
5
14
  import { useStyle } from "./style";
6
15
  import { VtxProvider } from "../vtx-provider";
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
16
  import { Fragment as _Fragment } from "react/jsx-runtime";
9
- import { jsxs as _jsxs } from "react/jsx-runtime";
17
+ import { jsx as _jsx } from "react/jsx-runtime";
10
18
  function removeNullChildren(children) {
11
19
  return React.Children.toArray(children).filter(function (c) {
12
20
  return c;
@@ -21,40 +29,41 @@ function VtxSplitPane(props) {
21
29
  hashId = _useStyle.hashId;
22
30
  var splitPane = useRef();
23
31
  var children = props.children,
32
+ defaultSize = props.defaultSize,
33
+ minSize = props.minSize,
34
+ maxSize = props.maxSize,
24
35
  style = props.style,
25
- _props$direction = props.direction,
26
- direction = _props$direction === void 0 ? 'horizontal' : _props$direction;
36
+ rest = _objectWithoutProperties(props, _excluded);
27
37
  var notNullChildren = removeNullChildren(children);
28
38
  var refs = useRef([]);
29
39
  return wrapSSR( /*#__PURE__*/_jsx("div", {
30
- className: classnames("".concat(prefixCls, " ").concat(prefixCls, "-").concat(direction), hashId),
40
+ className: classnames("".concat(prefixCls), hashId),
31
41
  ref: splitPane,
32
42
  style: style,
33
- children: /*#__PURE__*/_jsx(PanelGroup, {
34
- direction: direction,
43
+ children: /*#__PURE__*/_jsx(Splitter, _objectSpread(_objectSpread({}, rest), {}, {
35
44
  children: notNullChildren === null || notNullChildren === void 0 ? void 0 : notNullChildren.map(function (v, index) {
36
- return /*#__PURE__*/_jsxs(_Fragment, {
37
- children: [/*#__PURE__*/cloneElement(notNullChildren[index], {
45
+ var _v$props;
46
+ return /*#__PURE__*/_jsx(_Fragment, {
47
+ children: /*#__PURE__*/cloneElement(notNullChildren[index], _objectSpread(_objectSpread(_objectSpread({
38
48
  ref: function ref(el) {
39
49
  refs.current[index] = el;
40
- },
41
- collapsible: true
42
- }), index !== (notNullChildren === null || notNullChildren === void 0 ? void 0 : notNullChildren.length) - 1 && /*#__PURE__*/_jsx(_Fragment, {
43
- children: /*#__PURE__*/_jsx(PanelResizeHandle, {
44
- className: classnames("".concat(prefixCls, "-outer"), hashId),
45
- children: /*#__PURE__*/_jsx(Resizer, {
46
- refs: refs,
47
- index: index,
48
- direction: direction
49
- })
50
- })
51
- })]
50
+ }
51
+ }, index === 0 ? {
52
+ max: maxSize,
53
+ min: minSize,
54
+ size: defaultSize
55
+ } : {}), v.props), {}, {
56
+ collapsible: _objectSpread({
57
+ start: true,
58
+ end: true,
59
+ showCollapsibleIcon: 'auto'
60
+ }, (_v$props = v.props) === null || _v$props === void 0 ? void 0 : _v$props.collapsible)
61
+ }))
52
62
  });
53
63
  })
54
- })
64
+ }))
55
65
  }));
56
66
  }
57
67
  VtxSplitPane.propTypes = {};
58
- VtxSplitPane.defaultProps = {};
59
- VtxSplitPane.Pane = Panel;
68
+ VtxSplitPane.Pane = Splitter.Panel;
60
69
  export default VtxSplitPane;
@@ -7,121 +7,17 @@ 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 genVtxSplitPaneStyle = function genVtxSplitPaneStyle(token) {
9
9
  var componentCls = token.componentCls;
10
- return _defineProperty(_defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({
10
+ return _defineProperty({}, componentCls, {
11
11
  height: '100%',
12
12
  overflow: 'hidden',
13
- '&-outer': _defineProperty(_defineProperty(_defineProperty(_defineProperty({
14
- backgroundColor: 'transparent',
15
- position: 'relative',
16
- outline: 'none',
17
- '&-resizer': _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
18
- position: 'absolute',
19
- height: '100%',
20
- width: 6,
21
- zIndex: 1
22
- }, '&-left,&-right', {
23
- position: 'absolute',
24
- top: '50%',
25
- zIndex: 1001,
26
- opacity: 0,
27
- width: '16px !important',
28
- height: '24px !important',
29
- backgroundColor: token.colorBorder,
30
- color: token.colorTextSecondary,
31
- borderColor: "transparent !important",
32
- fontSize: 12,
33
- '&:hover': {
34
- color: token.colorTextSecondary,
35
- backgroundColor: "".concat(token.colorPrimaryBg, " !important")
36
- }
37
- }), '&-left', {
38
- transform: 'translate(-16px,-50%)'
39
- }), '&-right', {
40
- transform: 'translate(6px,-50%)'
41
- }), '&::after', {
42
- position: 'absolute',
43
- content: "' '",
44
- left: 0,
45
- top: 0,
46
- bottom: 0,
47
- right: 4,
48
- borderRadius: token.borderRadius
49
- }), '&:hover', _defineProperty({}, '.vtx-split-pane-outer-resizer-left,.vtx-split-pane-outer-resizer-right', {
50
- opacity: 1
51
- })), '.ant-btn-icon', {
52
- color: token.colorTextSecondary
53
- })
54
- }, "&[data-resize-handle-state='hover']", _defineProperty(_defineProperty({}, '.vtx-split-pane-outer-resizer-left,.vtx-split-pane-outer-resizer-right', {
55
- opacity: 1
56
- }), '.vtx-split-pane-outer-resizer::after', {
57
- background: "linear-gradient(to bottom , rgba(0,0,0,0), ".concat(token.colorSplit, ", rgba(0,0,0,0)) !important")
58
- })), "&[data-resize-handle-state='active']", _defineProperty(_defineProperty({}, '.vtx-split-pane-outer-resizer-left,.vtx-split-pane-outer-resizer-right', {
59
- opacity: 1
60
- }), '.vtx-split-pane-outer-resizer::after', {
61
- background: "linear-gradient(to bottom , rgba(0,0,0,0), ".concat(token.colorSplit, ", rgba(0,0,0,0)) !important")
62
- })), "&[data-resize-handle-state='drag']", _defineProperty(_defineProperty({}, '.vtx-split-pane-outer-resizer-left,.vtx-split-pane-outer-resizer-right', {
63
- opacity: 1
64
- }), '.vtx-split-pane-outer-resizer::after', {
65
- background: "linear-gradient(to bottom , rgba(0,0,0,0), ".concat(token.colorSplit, ", rgba(0,0,0,0)) !important")
66
- })), "&[data-resize-handle-state='inactive']", {
67
- backgroundColor: 'transparent'
68
- }),
69
- '&-item': {
70
- position: 'relative',
71
- display: 'inline-block',
72
- height: '100%',
73
- verticalAlign: 'top'
13
+ backgroundColor: token.colorBgLayout,
14
+ '.ant-splitter-bar .ant-splitter-bar-dragger::before': {
15
+ background: 'transparent'
16
+ },
17
+ '.ant-splitter-bar .ant-splitter-bar-dragger-active::before': {
18
+ background: 'var(--ant-control-item-bg-active)'
74
19
  }
75
- }, '&-resizer-left', {
76
- borderRight: "1px solid ".concat(token.colorBorderSecondary),
77
- '&:hover': {
78
- borderRight: "1px solid ".concat(token.colorBorderSecondary),
79
- transition: 'border-right 0.2s ease-in-out'
80
- }
81
- }), '&-resizer-right', {
82
- borderLeft: "1px solid ".concat(token.colorBorderSecondary),
83
- '&:hover': {
84
- borderLeft: "1px solid ".concat(token.colorBorderSecondary),
85
- transition: 'border-right 0.2s ease-in-out'
86
- }
87
- }), '&-resizer.disabled', {
88
- cursor: 'not-allowed'
89
- }), '&-resizer.disabled:hover', {
90
- borderColor: 'transparent'
91
- })), "".concat(componentCls, "-vertical"), _defineProperty({}, "".concat(componentCls, "-outer"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({
92
- '&-resizer': _defineProperty(_defineProperty(_defineProperty(_defineProperty({
93
- width: '100%',
94
- height: 6
95
- }, '&-left,&-right', {
96
- top: 'auto',
97
- left: '50%',
98
- height: '16px !important',
99
- width: '24px !important'
100
- }), '&-left', {
101
- transform: 'translate(-50%,-16px)'
102
- }), '&-right', {
103
- transform: 'translate(-50%, 6px)'
104
- }), '&::after', {
105
- left: 0,
106
- top: 0,
107
- bottom: 4,
108
- right: 0
109
- })
110
- }, "&[data-resize-handle-state='hover']", _defineProperty(_defineProperty({}, '.vtx-split-pane-outer-resizer-left,.vtx-split-pane-outer-resizer-right', {
111
- opacity: 1
112
- }), '.vtx-split-pane-outer-resizer::after', {
113
- background: "linear-gradient(to right , rgba(0,0,0,0), ".concat(token.colorSplit, ", rgba(0,0,0,0)) !important")
114
- })), "&[data-resize-handle-state='active']", _defineProperty(_defineProperty({}, '.vtx-split-pane-outer-resizer-left,.vtx-split-pane-outer-resizer-right', {
115
- opacity: 1
116
- }), '.vtx-split-pane-outer-resizer::after', {
117
- background: "linear-gradient(to right , rgba(0,0,0,0), ".concat(token.colorSplit, ", rgba(0,0,0,0)) !important")
118
- })), "&[data-resize-handle-state='drag']", _defineProperty(_defineProperty({}, '.vtx-split-pane-outer-resizer-left,.vtx-split-pane-outer-resizer-right', {
119
- opacity: 1
120
- }), '.vtx-split-pane-outer-resizer::after', {
121
- background: "linear-gradient(to right , rgba(0,0,0,0), ".concat(token.colorSplit, ", rgba(0,0,0,0)) !important")
122
- })), "&[data-resize-handle-state='inactive']", {
123
- backgroundColor: 'transparent'
124
- })));
20
+ });
125
21
  };
126
22
  export function useStyle(prefixCls) {
127
23
  return useAntdStyle(prefixCls, function (token) {