@vtx/components 4.0.0-beta.7 → 4.0.0-beta.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -19
- package/es/index.js +3 -0
- package/es/utils/components/LabelIconTip/index.js +7 -7
- package/es/utils/conversionMomentValue/index.js +25 -25
- package/es/utils/filterSpecialCharacters.js +53 -52
- package/es/utils/genCopyable/index.js +6 -6
- package/es/utils/getFieldPropsOrFormItemProps/index.js +7 -7
- package/es/utils/hooks/useDebounceFn/index.js +4 -4
- package/es/utils/hooks/useDebounceValue/index.js +6 -6
- package/es/utils/hooks/useDeepCompareMemo/index.js +7 -7
- package/es/utils/hooks/useLatest/index.js +2 -2
- package/es/utils/hooks/useRefCallback/index.js +5 -5
- package/es/utils/index.js +1 -2
- package/es/utils/isBrowser/index.js +7 -7
- package/es/utils/isUrl/index.js +4 -4
- package/es/utils/merge/index.js +4 -4
- package/es/utils/nanoid/index.js +4 -4
- package/es/utils/omitBoolean/index.js +4 -4
- package/es/utils/parseValueToMoment/index.js +4 -4
- package/es/utils/proFieldParsingText/index.js +10 -10
- package/es/utils/transformKeySubmitValue/index.js +57 -57
- package/es/utils/useEditableArray/index.js +46 -46
- package/es/utils/useEditableMap/index.js +22 -22
- package/es/utils/useMediaQuery/index.js +5 -5
- package/es/vtx-color-picker/index.js +138 -33
- package/es/vtx-color-picker/style/index.js +36 -12
- package/es/vtx-combogrid/Combogrid.js +16 -10
- package/es/vtx-combogrid/index.js +7 -4
- package/es/vtx-combogrid/style/index.js +4 -4
- package/es/vtx-datagrid/Store/Provide.js +109 -132
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +15 -9
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/es/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
- package/es/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
- package/es/vtx-datagrid/ToolBar/index.js +2 -2
- package/es/vtx-datagrid/columnState.js +64 -0
- package/es/vtx-datagrid/index.js +114 -35
- package/es/vtx-datagrid/mergeComponents.js +15 -0
- package/es/vtx-datagrid/renderColumnButtons.js +30 -11
- package/es/vtx-datagrid/style/index.js +102 -20
- package/es/vtx-datagrid/style/index.less +242 -242
- package/es/vtx-date-picker/QdatePicker.js +1 -1
- package/es/vtx-date-picker/style/index.less +39 -39
- package/es/vtx-descriptions/Descriptions.js +29 -0
- package/es/vtx-descriptions/index.js +3 -0
- package/es/vtx-descriptions/style/index.js +19 -0
- package/es/vtx-ellipsis-text/index.js +7 -2
- package/es/vtx-ellipsis-text/style/index.js +3 -1
- package/es/vtx-export/index.js +33 -33
- package/es/vtx-export-async/History.js +11 -3
- package/es/vtx-export-async/index.js +45 -15
- package/es/vtx-form-layout/Card.js +10 -10
- package/es/vtx-form-layout/Divider.js +1 -1
- package/es/vtx-form-layout/FormItem.js +18 -17
- package/es/vtx-form-layout/Pane.js +23 -12
- package/es/vtx-icon/index.js +54 -45
- package/es/vtx-icon/index.js1 +90 -0
- package/es/vtx-image/Preview.js +11 -6
- package/es/vtx-image/style/index.js +0 -1
- package/es/vtx-import/index.js +155 -43
- package/es/vtx-import/result.js +6 -2
- package/es/vtx-import/style/index.js +16 -1
- package/es/vtx-import2/Content.js +2 -1
- package/es/vtx-import2/index.js +31 -20
- package/es/vtx-import2/style/index.js +60 -9
- package/es/vtx-input/TextArea/index.js +11 -6
- package/es/vtx-modal/index.js +11 -6
- package/es/vtx-modal/style/index.js +5 -3
- package/es/vtx-page-layout/Basic.js +2 -2
- package/es/vtx-page-layout/Content.js +1 -1
- package/es/vtx-page-layout/TabLayout.js +7 -13
- package/es/vtx-page-layout/TableLayout.js +24 -14
- package/es/vtx-page-layout/TableWrap.js +3 -2
- package/es/vtx-page-layout/TreeLayout.js +8 -14
- package/es/vtx-page-layout/container.js +8 -7
- package/es/vtx-page-layout/style/index.js +4 -2
- package/es/vtx-provider/index.js +50 -40
- package/es/vtx-provider/intl.js +9 -9
- package/es/vtx-provider/locale/en_US.js +65 -5
- package/es/vtx-provider/locale/zh_CN.js +75 -5
- package/es/vtx-provider/useStyle/index.js +25 -21
- package/es/vtx-scrollable-row/index.js +38 -28
- package/es/vtx-search/index.js +18 -13
- package/es/vtx-search/style/index.js +2 -1
- package/es/vtx-select/index.js +132 -46
- package/es/vtx-select/style/index.js +11 -56
- package/es/vtx-signature/index.js +5 -4
- package/es/vtx-signature/style/index.js +1 -1
- package/es/vtx-split-pane/Resizer.js +0 -1
- package/es/vtx-split-pane/SplitPane.js +34 -25
- package/es/vtx-split-pane/style/index.js +8 -112
- package/es/vtx-time-picker/index.js +27 -1
- package/es/vtx-transfer/Transfer.js +29 -0
- package/es/vtx-transfer/index.js +3 -0
- package/es/vtx-transfer/style/index.js +19 -0
- package/es/vtx-transfer-select/TransferSelect.js +143 -0
- package/es/vtx-transfer-select/index.js +3 -0
- package/es/vtx-transfer-select/style/index.js +19 -0
- package/es/vtx-tree/index.js +104 -40
- package/es/vtx-tree-select/index.js +75 -105
- package/es/vtx-tree-select/style/index.js +9 -3
- package/es/vtx-upload/FilePreview.js +2 -1
- package/es/vtx-wang-editor/index.js +291 -113
- package/es/vtx-wang-editor/style/index.less +12 -12
- package/es/vtx-wang-editor/wangEditorUtil.js +59 -9
- package/lib/index.js +36 -0
- package/lib/utils/components/LabelIconTip/index.js +7 -7
- package/lib/utils/conversionMomentValue/index.js +25 -25
- package/lib/utils/filterSpecialCharacters.js +54 -52
- package/lib/utils/genCopyable/index.js +6 -6
- package/lib/utils/getFieldPropsOrFormItemProps/index.js +7 -7
- package/lib/utils/hooks/useDebounceFn/index.js +4 -4
- package/lib/utils/hooks/useDebounceValue/index.js +6 -6
- package/lib/utils/hooks/useDeepCompareMemo/index.js +7 -7
- package/lib/utils/hooks/useLatest/index.js +2 -2
- package/lib/utils/hooks/useRefCallback/index.js +5 -5
- package/lib/utils/index.js +0 -7
- package/lib/utils/isBrowser/index.js +7 -7
- package/lib/utils/isUrl/index.js +4 -4
- package/lib/utils/merge/index.js +4 -4
- package/lib/utils/nanoid/index.js +4 -4
- package/lib/utils/omitBoolean/index.js +4 -4
- package/lib/utils/parseValueToMoment/index.js +4 -4
- package/lib/utils/proFieldParsingText/index.js +10 -10
- package/lib/utils/transformKeySubmitValue/index.js +57 -57
- package/lib/utils/useEditableArray/index.js +46 -46
- package/lib/utils/useEditableMap/index.js +22 -22
- package/lib/utils/useMediaQuery/index.js +5 -5
- package/lib/vtx-color-picker/index.js +139 -34
- package/lib/vtx-color-picker/style/index.js +36 -12
- package/lib/vtx-combogrid/Combogrid.js +16 -10
- package/lib/vtx-combogrid/index.js +7 -4
- package/lib/vtx-combogrid/style/index.js +4 -4
- package/lib/vtx-datagrid/Store/Provide.js +116 -138
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +15 -10
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/lib/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
- package/lib/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
- package/lib/vtx-datagrid/ToolBar/index.js +2 -2
- package/lib/vtx-datagrid/columnState.js +73 -0
- package/lib/vtx-datagrid/index.js +115 -35
- package/lib/vtx-datagrid/mergeComponents.js +21 -0
- package/lib/vtx-datagrid/renderColumnButtons.js +30 -11
- package/lib/vtx-datagrid/style/index.js +102 -20
- package/lib/vtx-datagrid/style/index.less +242 -242
- package/lib/vtx-date-picker/QdatePicker.js +1 -1
- package/lib/vtx-date-picker/style/index.less +39 -39
- package/lib/vtx-descriptions/Descriptions.js +38 -0
- package/lib/vtx-descriptions/index.js +15 -0
- package/lib/vtx-descriptions/style/index.js +25 -0
- package/lib/vtx-ellipsis-text/index.js +7 -2
- package/lib/vtx-ellipsis-text/style/index.js +3 -1
- package/lib/vtx-export/index.js +34 -34
- package/lib/vtx-export-async/History.js +11 -3
- package/lib/vtx-export-async/index.js +43 -13
- package/lib/vtx-form-layout/Card.js +9 -9
- package/lib/vtx-form-layout/Divider.js +1 -1
- package/lib/vtx-form-layout/FormItem.js +18 -17
- package/lib/vtx-form-layout/Pane.js +22 -11
- package/lib/vtx-icon/index.js +54 -52
- package/lib/vtx-icon/index.js1 +90 -0
- package/lib/vtx-image/Preview.js +11 -6
- package/lib/vtx-image/style/index.js +0 -1
- package/lib/vtx-import/index.js +154 -42
- package/lib/vtx-import/result.js +6 -2
- package/lib/vtx-import/style/index.js +16 -1
- package/lib/vtx-import2/Content.js +2 -1
- package/lib/vtx-import2/index.js +30 -19
- package/lib/vtx-import2/style/index.js +60 -9
- package/lib/vtx-input/TextArea/index.js +11 -6
- package/lib/vtx-modal/index.js +11 -6
- package/lib/vtx-modal/style/index.js +5 -3
- package/lib/vtx-page-layout/Basic.js +2 -2
- package/lib/vtx-page-layout/Content.js +1 -1
- package/lib/vtx-page-layout/TabLayout.js +8 -14
- package/lib/vtx-page-layout/TableLayout.js +24 -14
- package/lib/vtx-page-layout/TableWrap.js +3 -2
- package/lib/vtx-page-layout/TreeLayout.js +9 -15
- package/lib/vtx-page-layout/container.js +8 -7
- package/lib/vtx-page-layout/style/index.js +4 -2
- package/lib/vtx-provider/index.js +49 -40
- package/lib/vtx-provider/intl.js +9 -9
- package/lib/vtx-provider/locale/en_US.js +65 -5
- package/lib/vtx-provider/locale/zh_CN.js +75 -5
- package/lib/vtx-provider/useStyle/index.js +25 -21
- package/lib/vtx-scrollable-row/index.js +38 -28
- package/lib/vtx-search/index.js +18 -13
- package/lib/vtx-search/style/index.js +2 -1
- package/lib/vtx-select/index.js +134 -48
- package/lib/vtx-select/style/index.js +11 -56
- package/lib/vtx-signature/index.js +4 -3
- package/lib/vtx-signature/style/index.js +1 -1
- package/lib/vtx-split-pane/Resizer.js +0 -1
- package/lib/vtx-split-pane/SplitPane.js +32 -23
- package/lib/vtx-split-pane/style/index.js +8 -112
- package/lib/vtx-time-picker/index.js +27 -1
- package/lib/vtx-transfer/Transfer.js +38 -0
- package/lib/vtx-transfer/index.js +15 -0
- package/lib/vtx-transfer/style/index.js +25 -0
- package/lib/vtx-transfer-select/TransferSelect.js +151 -0
- package/lib/vtx-transfer-select/index.js +15 -0
- package/lib/vtx-transfer-select/style/index.js +25 -0
- package/lib/vtx-tree/index.js +102 -38
- package/lib/vtx-tree-select/index.js +75 -105
- package/lib/vtx-tree-select/style/index.js +9 -3
- package/lib/vtx-upload/FilePreview.js +2 -1
- package/lib/vtx-wang-editor/index.js +289 -113
- package/lib/vtx-wang-editor/style/index.less +12 -12
- package/lib/vtx-wang-editor/wangEditorUtil.js +59 -10
- package/package.json +238 -222
- package/es/utils/hooks/useFetchData/index.js +0 -82
- package/lib/utils/hooks/useFetchData/index.js +0 -89
package/es/vtx-search/index.js
CHANGED
|
@@ -55,10 +55,6 @@ function VtxSearch(props) {
|
|
|
55
55
|
isClearButton = _props$isClearButton === void 0 ? true : _props$isClearButton,
|
|
56
56
|
_props$isMoreButton = props.isMoreButton,
|
|
57
57
|
isMoreButton = _props$isMoreButton === void 0 ? true : _props$isMoreButton,
|
|
58
|
-
_props$confirmText = props.confirmText,
|
|
59
|
-
confirmText = _props$confirmText === void 0 ? intl.getMessage('tableForm.search', '查询') : _props$confirmText,
|
|
60
|
-
_props$clearText = props.clearText,
|
|
61
|
-
clearText = _props$clearText === void 0 ? intl.getMessage('tableForm.reset', '重置') : _props$clearText,
|
|
62
58
|
onConfirm = props.onConfirm,
|
|
63
59
|
onClear = props.onClear,
|
|
64
60
|
renderButtons = props.renderButtons,
|
|
@@ -66,7 +62,15 @@ function VtxSearch(props) {
|
|
|
66
62
|
showAll = _props$showAll === void 0 ? false : _props$showAll,
|
|
67
63
|
onToggleShow = props.onToggleShow,
|
|
68
64
|
_props$customEnumText = props.customEnumText,
|
|
69
|
-
customEnumText = _props$customEnumText === void 0 ? {
|
|
65
|
+
customEnumText = _props$customEnumText === void 0 ? {
|
|
66
|
+
confirmText: intl.getMessage('tableForm.search', '查询'),
|
|
67
|
+
//确认按钮文本
|
|
68
|
+
clearText: intl.getMessage('tableForm.reset', '重置'),
|
|
69
|
+
//情况按钮文本
|
|
70
|
+
collapseText: intl.getMessage('tableForm.expand', '收起'),
|
|
71
|
+
//情况按钮文本
|
|
72
|
+
expandText: intl.getMessage('tableForm.collapsed', '展开') //情况按钮文本
|
|
73
|
+
} : _props$customEnumText;
|
|
70
74
|
var vtxSearchRef = useRef();
|
|
71
75
|
var ref = useRef();
|
|
72
76
|
var size = useColSize(vtxSearchRef);
|
|
@@ -94,7 +98,7 @@ function VtxSearch(props) {
|
|
|
94
98
|
return !!item;
|
|
95
99
|
}) : props === null || props === void 0 ? void 0 : props.children;
|
|
96
100
|
var grid = useMemo(function () {
|
|
97
|
-
var weightArr = props.gridWeight.filter(function (item) {
|
|
101
|
+
var weightArr = (props.gridWeight || []).filter(function (item) {
|
|
98
102
|
return !!item;
|
|
99
103
|
});
|
|
100
104
|
var sum = 0;
|
|
@@ -121,7 +125,7 @@ function VtxSearch(props) {
|
|
|
121
125
|
cumulative: cumulative,
|
|
122
126
|
// 总数量
|
|
123
127
|
len: cumulative[cumulative.length - 1],
|
|
124
|
-
lenWeight: cumulativeWeight[cumulative.length - 2] + weightArr[(weightArr === null || weightArr === void 0 ? void 0 : weightArr.length) - 1],
|
|
128
|
+
lenWeight: cumulativeWeight[Math.max(0, cumulative.length - 2)] + (weightArr[(weightArr === null || weightArr === void 0 ? void 0 : weightArr.length) - 1] || 0),
|
|
125
129
|
// 几个children
|
|
126
130
|
count: count,
|
|
127
131
|
// 兼容的处理
|
|
@@ -218,12 +222,13 @@ function VtxSearch(props) {
|
|
|
218
222
|
} else {
|
|
219
223
|
var chData = [];
|
|
220
224
|
cData.forEach(function (item) {
|
|
221
|
-
if (typeof item
|
|
225
|
+
if (typeof item === 'function') {
|
|
222
226
|
var ite = item();
|
|
223
227
|
if (Array.isArray(ite)) {
|
|
224
228
|
chData.push.apply(chData, _toConsumableArray(ite));
|
|
229
|
+
} else {
|
|
230
|
+
chData.push(ite);
|
|
225
231
|
}
|
|
226
|
-
chData.push(ite);
|
|
227
232
|
return;
|
|
228
233
|
}
|
|
229
234
|
if (Array.isArray(item)) {
|
|
@@ -295,7 +300,7 @@ function VtxSearch(props) {
|
|
|
295
300
|
},
|
|
296
301
|
type: "primary",
|
|
297
302
|
onClick: onConfirm,
|
|
298
|
-
children: confirmText
|
|
303
|
+
children: customEnumText.confirmText
|
|
299
304
|
})
|
|
300
305
|
}), isClearButton && /*#__PURE__*/_jsx("span", {
|
|
301
306
|
"data-type": 'bt',
|
|
@@ -305,7 +310,7 @@ function VtxSearch(props) {
|
|
|
305
310
|
width: '100%'
|
|
306
311
|
},
|
|
307
312
|
onClick: onClear,
|
|
308
|
-
children: clearText
|
|
313
|
+
children: customEnumText.clearText
|
|
309
314
|
})
|
|
310
315
|
}), isMoreButton && grid.len > realColumn - 1 && /*#__PURE__*/_jsx("div", {
|
|
311
316
|
"data-type": 'bt',
|
|
@@ -314,9 +319,9 @@ function VtxSearch(props) {
|
|
|
314
319
|
},
|
|
315
320
|
className: classnames("".concat(prefix, "-more"), hashId),
|
|
316
321
|
children: showMore ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
317
|
-
children: [
|
|
322
|
+
children: [customEnumText.collapseText, /*#__PURE__*/_jsx(UpOutlined, {})]
|
|
318
323
|
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
319
|
-
children: [
|
|
324
|
+
children: [customEnumText.expandText, /*#__PURE__*/_jsx(DownOutlined, {})]
|
|
320
325
|
})
|
|
321
326
|
})]
|
|
322
327
|
})
|
|
@@ -16,7 +16,8 @@ var genVtxStyle = function genVtxStyle(token) {
|
|
|
16
16
|
transitionDuration: token.toggleSpeed,
|
|
17
17
|
transitionProperty: 'height',
|
|
18
18
|
boxSizing: 'border-box',
|
|
19
|
-
overflow: 'hidden'
|
|
19
|
+
overflow: 'hidden',
|
|
20
|
+
color: token.colorText
|
|
20
21
|
}, "".concat(componentCls, "-element"), {}), "".concat(componentCls, "-label_v"), {
|
|
21
22
|
overflow: 'hidden',
|
|
22
23
|
lineHeight: 1,
|
package/es/vtx-select/index.js
CHANGED
|
@@ -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(
|
|
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
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
-
}
|
|
102
|
+
});
|
|
103
|
+
resizeObserver.observe(element);
|
|
76
104
|
return function () {
|
|
77
|
-
|
|
105
|
+
resizeObserver.disconnect();
|
|
78
106
|
};
|
|
79
107
|
}
|
|
80
|
-
}, []);
|
|
81
|
-
var newChildren = 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
|
-
|
|
85
|
-
|
|
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 =
|
|
149
|
+
var key = getSelectedValue(value);
|
|
92
150
|
return child[key] || '';
|
|
93
151
|
};
|
|
94
152
|
return /*#__PURE__*/_jsx("div", {
|
|
95
|
-
className: "
|
|
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
|
|
108
|
-
|
|
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
|
|
124
|
-
|
|
125
|
-
|
|
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
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
|
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
|
|
170
|
-
value: item
|
|
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
|
|
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(
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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('
|
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
14
|
+
height: 300,
|
|
15
15
|
padding: '16px',
|
|
16
16
|
backgroundColor: token.colorBgBase,
|
|
17
17
|
border: "1px solid ".concat(token.colorBorder),
|
|
@@ -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 {
|
|
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 {
|
|
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
|
-
|
|
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
|
|
40
|
+
className: classnames("".concat(prefixCls), hashId),
|
|
31
41
|
ref: splitPane,
|
|
32
42
|
style: style,
|
|
33
|
-
children: /*#__PURE__*/_jsx(
|
|
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
|
-
|
|
37
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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.
|
|
59
|
-
VtxSplitPane.Pane = Panel;
|
|
68
|
+
VtxSplitPane.Pane = Splitter.Panel;
|
|
60
69
|
export default VtxSplitPane;
|