@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/lib/vtx-search/index.js
CHANGED
|
@@ -61,10 +61,6 @@ function VtxSearch(props) {
|
|
|
61
61
|
isClearButton = _props$isClearButton === void 0 ? true : _props$isClearButton,
|
|
62
62
|
_props$isMoreButton = props.isMoreButton,
|
|
63
63
|
isMoreButton = _props$isMoreButton === void 0 ? true : _props$isMoreButton,
|
|
64
|
-
_props$confirmText = props.confirmText,
|
|
65
|
-
confirmText = _props$confirmText === void 0 ? intl.getMessage('tableForm.search', '查询') : _props$confirmText,
|
|
66
|
-
_props$clearText = props.clearText,
|
|
67
|
-
clearText = _props$clearText === void 0 ? intl.getMessage('tableForm.reset', '重置') : _props$clearText,
|
|
68
64
|
onConfirm = props.onConfirm,
|
|
69
65
|
onClear = props.onClear,
|
|
70
66
|
renderButtons = props.renderButtons,
|
|
@@ -72,7 +68,15 @@ function VtxSearch(props) {
|
|
|
72
68
|
showAll = _props$showAll === void 0 ? false : _props$showAll,
|
|
73
69
|
onToggleShow = props.onToggleShow,
|
|
74
70
|
_props$customEnumText = props.customEnumText,
|
|
75
|
-
customEnumText = _props$customEnumText === void 0 ? {
|
|
71
|
+
customEnumText = _props$customEnumText === void 0 ? {
|
|
72
|
+
confirmText: intl.getMessage('tableForm.search', '查询'),
|
|
73
|
+
//确认按钮文本
|
|
74
|
+
clearText: intl.getMessage('tableForm.reset', '重置'),
|
|
75
|
+
//情况按钮文本
|
|
76
|
+
collapseText: intl.getMessage('tableForm.expand', '收起'),
|
|
77
|
+
//情况按钮文本
|
|
78
|
+
expandText: intl.getMessage('tableForm.collapsed', '展开') //情况按钮文本
|
|
79
|
+
} : _props$customEnumText;
|
|
76
80
|
var vtxSearchRef = (0, _react.useRef)();
|
|
77
81
|
var ref = (0, _react.useRef)();
|
|
78
82
|
var size = (0, _useColSize.default)(vtxSearchRef);
|
|
@@ -100,7 +104,7 @@ function VtxSearch(props) {
|
|
|
100
104
|
return !!item;
|
|
101
105
|
}) : props === null || props === void 0 ? void 0 : props.children;
|
|
102
106
|
var grid = (0, _react.useMemo)(function () {
|
|
103
|
-
var weightArr = props.gridWeight.filter(function (item) {
|
|
107
|
+
var weightArr = (props.gridWeight || []).filter(function (item) {
|
|
104
108
|
return !!item;
|
|
105
109
|
});
|
|
106
110
|
var sum = 0;
|
|
@@ -127,7 +131,7 @@ function VtxSearch(props) {
|
|
|
127
131
|
cumulative: cumulative,
|
|
128
132
|
// 总数量
|
|
129
133
|
len: cumulative[cumulative.length - 1],
|
|
130
|
-
lenWeight: cumulativeWeight[cumulative.length - 2] + weightArr[(weightArr === null || weightArr === void 0 ? void 0 : weightArr.length) - 1],
|
|
134
|
+
lenWeight: cumulativeWeight[Math.max(0, cumulative.length - 2)] + (weightArr[(weightArr === null || weightArr === void 0 ? void 0 : weightArr.length) - 1] || 0),
|
|
131
135
|
// 几个children
|
|
132
136
|
count: count,
|
|
133
137
|
// 兼容的处理
|
|
@@ -224,12 +228,13 @@ function VtxSearch(props) {
|
|
|
224
228
|
} else {
|
|
225
229
|
var chData = [];
|
|
226
230
|
cData.forEach(function (item) {
|
|
227
|
-
if (typeof item
|
|
231
|
+
if (typeof item === 'function') {
|
|
228
232
|
var ite = item();
|
|
229
233
|
if (Array.isArray(ite)) {
|
|
230
234
|
chData.push.apply(chData, _toConsumableArray(ite));
|
|
235
|
+
} else {
|
|
236
|
+
chData.push(ite);
|
|
231
237
|
}
|
|
232
|
-
chData.push(ite);
|
|
233
238
|
return;
|
|
234
239
|
}
|
|
235
240
|
if (Array.isArray(item)) {
|
|
@@ -301,7 +306,7 @@ function VtxSearch(props) {
|
|
|
301
306
|
},
|
|
302
307
|
type: "primary",
|
|
303
308
|
onClick: onConfirm,
|
|
304
|
-
children: confirmText
|
|
309
|
+
children: customEnumText.confirmText
|
|
305
310
|
})
|
|
306
311
|
}), isClearButton && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
307
312
|
"data-type": 'bt',
|
|
@@ -311,7 +316,7 @@ function VtxSearch(props) {
|
|
|
311
316
|
width: '100%'
|
|
312
317
|
},
|
|
313
318
|
onClick: onClear,
|
|
314
|
-
children: clearText
|
|
319
|
+
children: customEnumText.clearText
|
|
315
320
|
})
|
|
316
321
|
}), isMoreButton && grid.len > realColumn - 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
317
322
|
"data-type": 'bt',
|
|
@@ -320,9 +325,9 @@ function VtxSearch(props) {
|
|
|
320
325
|
},
|
|
321
326
|
className: (0, _classnames.default)("".concat(_index.prefix, "-more"), hashId),
|
|
322
327
|
children: showMore ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
323
|
-
children: [
|
|
328
|
+
children: [customEnumText.collapseText, /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.UpOutlined, {})]
|
|
324
329
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
325
|
-
children: [
|
|
330
|
+
children: [customEnumText.expandText, /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.DownOutlined, {})]
|
|
326
331
|
})
|
|
327
332
|
})]
|
|
328
333
|
})
|
|
@@ -23,7 +23,8 @@ var genVtxStyle = function genVtxStyle(token) {
|
|
|
23
23
|
transitionDuration: token.toggleSpeed,
|
|
24
24
|
transitionProperty: 'height',
|
|
25
25
|
boxSizing: 'border-box',
|
|
26
|
-
overflow: 'hidden'
|
|
26
|
+
overflow: 'hidden',
|
|
27
|
+
color: token.colorText
|
|
27
28
|
}, "".concat(componentCls, "-element"), {}), "".concat(componentCls, "-label_v"), {
|
|
28
29
|
overflow: 'hidden',
|
|
29
30
|
lineHeight: 1,
|
package/lib/vtx-select/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = exports.VtxSelect = void 0;
|
|
8
7
|
var _antd = require("antd");
|
|
9
|
-
var
|
|
8
|
+
var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
10
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
10
|
var _style = require("./style");
|
|
12
11
|
var _icons = require("@ant-design/icons");
|
|
@@ -14,18 +13,24 @@ var _vtxIcon = _interopRequireDefault(require("../vtx-icon"));
|
|
|
14
13
|
var _utils = require("../utils");
|
|
15
14
|
var _vtxProvider = require("../vtx-provider");
|
|
16
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
var _excluded = ["value", "mode", "size", "onChange", "maxTagCount", "maxTagTextLength", "maxTagPlaceholder", "showAll", "selectStyle", "selectAll", "selectSearchAll", "defaultBindBodyToPopupContainer", "customEnumText", "showSearch", "optionFilterProp", "onSearch"],
|
|
17
|
+
_excluded2 = ["onSearch", "optionFilterProp"];
|
|
17
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
18
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
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); }
|
|
20
22
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
21
23
|
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."); }
|
|
22
24
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
23
25
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
26
|
+
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; } } }; }
|
|
24
27
|
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; }
|
|
25
28
|
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; }
|
|
26
29
|
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; }
|
|
27
30
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
28
31
|
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); }
|
|
32
|
+
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; }
|
|
33
|
+
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; }
|
|
29
34
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
30
35
|
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."); }
|
|
31
36
|
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); }
|
|
@@ -33,13 +38,14 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
33
38
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
34
39
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
35
40
|
var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
41
|
+
var _props$options;
|
|
36
42
|
var intl = (0, _vtxProvider.useIntl)();
|
|
37
43
|
var _useState = (0, _react.useState)(0),
|
|
38
44
|
_useState2 = _slicedToArray(_useState, 2),
|
|
39
45
|
popWidth = _useState2[0],
|
|
40
46
|
setPopWidth = _useState2[1];
|
|
41
47
|
var elRef = (0, _react.useRef)();
|
|
42
|
-
var elId = (0, _react.useRef)("vtx-select-".concat(
|
|
48
|
+
var elId = (0, _react.useRef)("vtx-select-".concat(Math.random().toString(36).substr(2, 9)));
|
|
43
49
|
var _useState3 = (0, _react.useState)(''),
|
|
44
50
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
45
51
|
searchValue = _useState4[0],
|
|
@@ -65,42 +71,94 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
65
71
|
_props$defaultBindBod = props.defaultBindBodyToPopupContainer,
|
|
66
72
|
defaultBindBodyToPopupContainer = _props$defaultBindBod === void 0 ? true : _props$defaultBindBod,
|
|
67
73
|
_props$customEnumText = props.customEnumText,
|
|
68
|
-
customEnumText = _props$customEnumText === void 0 ? {} : _props$customEnumText
|
|
74
|
+
customEnumText = _props$customEnumText === void 0 ? {} : _props$customEnumText,
|
|
75
|
+
showSearch = props.showSearch,
|
|
76
|
+
optionFilterProp = props.optionFilterProp,
|
|
77
|
+
_onSearch = props.onSearch,
|
|
78
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
69
79
|
var TextEnum = _objectSpread({
|
|
70
80
|
selectAllText: intl.getMessage('select.selectAll', '全选'),
|
|
71
81
|
defaultPlaceholderText: intl.getMessage('tableForm.selectPlaceholder', '请选择'),
|
|
72
82
|
emptyDescriptionText: intl.getMessage('select.empty', '暂无数据')
|
|
73
83
|
}, customEnumText);
|
|
84
|
+
var _useContext = (0, _react.useContext)(_vtxProvider.VtxProvider),
|
|
85
|
+
getPrefixCls = _useContext.getPrefixCls;
|
|
86
|
+
var prefixCls = getPrefixCls('select', props.prefixCls);
|
|
87
|
+
var _useStyle = (0, _style.useStyle)(prefixCls),
|
|
88
|
+
wrapSSR = _useStyle.wrapSSR,
|
|
89
|
+
hashId = _useStyle.hashId;
|
|
74
90
|
(0, _react.useEffect)(function () {
|
|
75
|
-
if (mode === 'multiple' || mode === 'tags') {
|
|
76
|
-
var
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
91
|
+
if ((mode === 'multiple' || mode === 'tags') && elRef.current) {
|
|
92
|
+
var element = elRef.current;
|
|
93
|
+
// 立即设置一次
|
|
94
|
+
setPopWidth(element.clientWidth);
|
|
95
|
+
|
|
96
|
+
// 使用 ResizeObserver 监听尺寸变化
|
|
97
|
+
var resizeObserver = new ResizeObserver(function (entries) {
|
|
98
|
+
var _iterator = _createForOfIteratorHelper(entries),
|
|
99
|
+
_step;
|
|
100
|
+
try {
|
|
101
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
102
|
+
var entry = _step.value;
|
|
103
|
+
setPopWidth(entry.contentRect.width);
|
|
104
|
+
}
|
|
105
|
+
} catch (err) {
|
|
106
|
+
_iterator.e(err);
|
|
107
|
+
} finally {
|
|
108
|
+
_iterator.f();
|
|
82
109
|
}
|
|
83
|
-
}
|
|
110
|
+
});
|
|
111
|
+
resizeObserver.observe(element);
|
|
84
112
|
return function () {
|
|
85
|
-
|
|
113
|
+
resizeObserver.disconnect();
|
|
86
114
|
};
|
|
87
115
|
}
|
|
88
|
-
}, []);
|
|
89
|
-
var newChildren = props.children ?
|
|
116
|
+
}, [mode]);
|
|
117
|
+
var newChildren = props.children ? _react.default.Children.toArray(props.children) : ((_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.map(function (v) {
|
|
118
|
+
return _objectSpread(_objectSpread({}, v), {}, {
|
|
119
|
+
key: v.value,
|
|
120
|
+
props: _objectSpread(_objectSpread({}, v), {}, {
|
|
121
|
+
children: v.label
|
|
122
|
+
})
|
|
123
|
+
});
|
|
124
|
+
})) || [];
|
|
125
|
+
var getOptionValue = function getOptionValue(item) {
|
|
126
|
+
var _ref, _itemProps$value;
|
|
127
|
+
var itemProps = (item === null || item === void 0 ? void 0 : item.props) || {};
|
|
128
|
+
return (_ref = (_itemProps$value = itemProps.value) !== null && _itemProps$value !== void 0 ? _itemProps$value : item.value) !== null && _ref !== void 0 ? _ref : item.key;
|
|
129
|
+
};
|
|
130
|
+
var getOptionLabel = function getOptionLabel(item) {
|
|
131
|
+
var _ref2, _itemProps$children;
|
|
132
|
+
var itemProps = (item === null || item === void 0 ? void 0 : item.props) || {};
|
|
133
|
+
return (_ref2 = (_itemProps$children = itemProps.children) !== null && _itemProps$children !== void 0 ? _itemProps$children : itemProps.label) !== null && _ref2 !== void 0 ? _ref2 : item.label;
|
|
134
|
+
};
|
|
135
|
+
var getSelectedValue = function getSelectedValue(item) {
|
|
136
|
+
if ((0, _utils.isObject)(item)) {
|
|
137
|
+
var _item$value;
|
|
138
|
+
return (_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : item.key;
|
|
139
|
+
}
|
|
140
|
+
return item;
|
|
141
|
+
};
|
|
142
|
+
var normalizedOptions = newChildren.map(function (item) {
|
|
143
|
+
return {
|
|
144
|
+
value: getOptionValue(item),
|
|
145
|
+
label: getOptionLabel(item),
|
|
146
|
+
raw: item
|
|
147
|
+
};
|
|
148
|
+
});
|
|
90
149
|
var getContent = function getContent() {
|
|
91
150
|
var child = {};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
child[item.key] = item === null || item === void 0 || (_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.children;
|
|
151
|
+
normalizedOptions.forEach(function (item) {
|
|
152
|
+
child[item.value] = item.label;
|
|
95
153
|
});
|
|
96
154
|
var getChildren = function getChildren() {
|
|
97
155
|
var child = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
98
156
|
var value = arguments.length > 1 ? arguments[1] : undefined;
|
|
99
|
-
var key = (
|
|
157
|
+
var key = getSelectedValue(value);
|
|
100
158
|
return child[key] || '';
|
|
101
159
|
};
|
|
102
160
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
103
|
-
className: "
|
|
161
|
+
className: (0, _classnames2.default)("".concat(prefixCls, "-all-list"), hashId),
|
|
104
162
|
children: Array.isArray(value) && value.length ? value.map(function (item, index) {
|
|
105
163
|
var name = getChildren(child, item);
|
|
106
164
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tag, {
|
|
@@ -112,10 +170,13 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
112
170
|
e.preventDefault();
|
|
113
171
|
var valueClone = _toConsumableArray(value);
|
|
114
172
|
valueClone.splice(index, 1);
|
|
115
|
-
var
|
|
116
|
-
|
|
173
|
+
var selectedValueSet = new Set(valueClone.map(getSelectedValue));
|
|
174
|
+
var options = normalizedOptions.filter(function (ite) {
|
|
175
|
+
return selectedValueSet.has(ite.value);
|
|
176
|
+
}).map(function (ite) {
|
|
177
|
+
return ite.raw;
|
|
117
178
|
});
|
|
118
|
-
_onChange(valueClone, options);
|
|
179
|
+
_onChange && _onChange(valueClone, options);
|
|
119
180
|
},
|
|
120
181
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
121
182
|
title: name,
|
|
@@ -128,16 +189,51 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
128
189
|
})
|
|
129
190
|
});
|
|
130
191
|
};
|
|
131
|
-
var
|
|
132
|
-
|
|
133
|
-
|
|
192
|
+
var defaultOptionFilterProp = ['label', 'children'];
|
|
193
|
+
var handleSearch = function handleSearch(value) {
|
|
194
|
+
setSearchValue(value ? String(value).toLowerCase() : '');
|
|
195
|
+
_onSearch && _onSearch(value);
|
|
196
|
+
};
|
|
197
|
+
var getSearchProps = function getSearchProps() {
|
|
198
|
+
if (showSearch && _typeof(showSearch) === 'object') {
|
|
199
|
+
var showSearchOnSearch = showSearch.onSearch,
|
|
200
|
+
showSearchOptionFilterProp = showSearch.optionFilterProp,
|
|
201
|
+
searchConfig = _objectWithoutProperties(showSearch, _excluded2);
|
|
202
|
+
return {
|
|
203
|
+
showSearch: _objectSpread(_objectSpread({}, searchConfig), {}, {
|
|
204
|
+
optionFilterProp: showSearchOptionFilterProp || optionFilterProp || defaultOptionFilterProp,
|
|
205
|
+
onSearch: function onSearch(value) {
|
|
206
|
+
setSearchValue(value ? String(value).toLowerCase() : '');
|
|
207
|
+
showSearchOnSearch && showSearchOnSearch(value);
|
|
208
|
+
_onSearch && _onSearch(value);
|
|
209
|
+
}
|
|
210
|
+
})
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
return {
|
|
214
|
+
showSearch: showSearch === undefined ? true : showSearch,
|
|
215
|
+
optionFilterProp: optionFilterProp || defaultOptionFilterProp
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
var newProps = _objectSpread(_objectSpread(_objectSpread({}, getSearchProps()), {}, {
|
|
134
219
|
placeholder: TextEnum.defaultPlaceholderText,
|
|
135
|
-
allowClear: true
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
220
|
+
allowClear: true,
|
|
221
|
+
value: value,
|
|
222
|
+
mode: mode,
|
|
223
|
+
size: size,
|
|
224
|
+
//同步button大小
|
|
225
|
+
onChange: _onChange,
|
|
226
|
+
maxTagCount: maxTagCount,
|
|
227
|
+
maxTagTextLength: maxTagTextLength,
|
|
228
|
+
maxTagPlaceholder: maxTagPlaceholder,
|
|
229
|
+
showAll: showAll,
|
|
230
|
+
//是否显示全部选项
|
|
231
|
+
selectStyle: selectStyle,
|
|
232
|
+
selectAll: selectAll,
|
|
233
|
+
selectSearchAll: selectSearchAll,
|
|
234
|
+
defaultBindBodyToPopupContainer: defaultBindBodyToPopupContainer
|
|
235
|
+
}, rest), {}, {
|
|
236
|
+
onSearch: handleSearch,
|
|
141
237
|
onBlur: function onBlur(e) {
|
|
142
238
|
setSearchValue('');
|
|
143
239
|
props.onBlur && props.onBlur(e);
|
|
@@ -166,7 +262,7 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
166
262
|
if (e.target.checked) {
|
|
167
263
|
var tempChildren = newChildren.filter(function (item) {
|
|
168
264
|
if (selectSearchAll && searchValue) {
|
|
169
|
-
return String(item
|
|
265
|
+
return String(getOptionLabel(item)).toLowerCase().indexOf(searchValue) > -1;
|
|
170
266
|
}
|
|
171
267
|
return true;
|
|
172
268
|
});
|
|
@@ -174,13 +270,13 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
174
270
|
if (props.labelInValue) {
|
|
175
271
|
keys = tempChildren.map(function (item) {
|
|
176
272
|
return {
|
|
177
|
-
label: item
|
|
178
|
-
value: item
|
|
273
|
+
label: getOptionLabel(item),
|
|
274
|
+
value: getOptionValue(item)
|
|
179
275
|
};
|
|
180
276
|
});
|
|
181
277
|
} else {
|
|
182
278
|
keys = tempChildren.map(function (item) {
|
|
183
|
-
return item
|
|
279
|
+
return getOptionValue(item);
|
|
184
280
|
});
|
|
185
281
|
}
|
|
186
282
|
_onChange && _onChange(keys, tempChildren);
|
|
@@ -200,21 +296,11 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
200
296
|
});
|
|
201
297
|
}
|
|
202
298
|
}
|
|
203
|
-
var _useContext = (0, _react.useContext)(_vtxProvider.VtxProvider),
|
|
204
|
-
getPrefixCls = _useContext.getPrefixCls;
|
|
205
|
-
var prefixCls = getPrefixCls('select', props.prefixCls);
|
|
206
|
-
var _useStyle = (0, _style.useStyle)(prefixCls),
|
|
207
|
-
wrapSSR = _useStyle.wrapSSR,
|
|
208
|
-
hashId = _useStyle.hashId;
|
|
209
299
|
return wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
210
|
-
className: (0,
|
|
211
|
-
'vtx-multi-select': mode == 'multiple' || mode == 'tags'
|
|
212
|
-
}),
|
|
300
|
+
className: (0, _classnames2.default)(prefixCls, hashId, _defineProperty({}, "".concat(prefixCls, "-multi"), mode == 'multiple' || mode == 'tags')),
|
|
213
301
|
id: elId.current,
|
|
214
302
|
ref: elRef,
|
|
215
|
-
style: _objectSpread(
|
|
216
|
-
paddingRight: (mode == 'multiple' || mode == 'tags') && showAll ? 32 : 0
|
|
217
|
-
}),
|
|
303
|
+
style: _objectSpread({}, props.style),
|
|
218
304
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Space.Compact, {
|
|
219
305
|
style: {
|
|
220
306
|
width: '100%'
|
|
@@ -13,66 +13,21 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
13
13
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
14
14
|
var genVtxSelectStyle = function genVtxSelectStyle(token) {
|
|
15
15
|
var componentCls = token.componentCls;
|
|
16
|
-
return _defineProperty(_defineProperty({}, componentCls, {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
top: '0',
|
|
24
|
-
verticalAlign: 'top'
|
|
25
|
-
},
|
|
26
|
-
'.vtx-all-list': {
|
|
27
|
-
position: 'absolute',
|
|
28
|
-
zIndex: 999,
|
|
29
|
-
boxSizing: 'border-box',
|
|
30
|
-
width: '100%',
|
|
31
|
-
padding: '5px',
|
|
32
|
-
boxShadow: '0 2px 8px #d9d9d9',
|
|
33
|
-
backgroundColor: 'red !important'
|
|
34
|
-
},
|
|
35
|
-
'.ant-select-selection--multiple': {
|
|
36
|
-
maxHeight: '32px',
|
|
37
|
-
overflow: 'hidden'
|
|
38
|
-
}
|
|
39
|
-
}), '.vtx-multi-select', {
|
|
40
|
-
position: 'relative',
|
|
41
|
-
display: 'inline-block',
|
|
42
|
-
width: '100%',
|
|
43
|
-
maxHeight: '32px !important',
|
|
44
|
-
boxSizing: 'border-box',
|
|
45
|
-
'.vtx-select-count': {
|
|
46
|
-
position: 'absolute',
|
|
47
|
-
top: 0,
|
|
48
|
-
right: 0,
|
|
49
|
-
verticalAlign: 'top',
|
|
50
|
-
borderLeft: 'none',
|
|
51
|
-
borderTopLeftRadius: 0,
|
|
52
|
-
'border-bottom-left-radius': 0
|
|
53
|
-
},
|
|
54
|
-
'.vtx-all-list': {
|
|
55
|
-
position: 'absolute',
|
|
56
|
-
zIndex: 999,
|
|
57
|
-
boxSizing: 'border-box',
|
|
58
|
-
width: '100%',
|
|
59
|
-
padding: '5px',
|
|
60
|
-
boxShadow: '0 2px 8px #d9d9d9'
|
|
61
|
-
},
|
|
62
|
-
'.ant-select-selector': {
|
|
63
|
-
'border-top-right-radius': 0,
|
|
64
|
-
'border-bottom-right-radius': 0,
|
|
65
|
-
maxHeight: '32px !important',
|
|
66
|
-
overflow: 'hidden'
|
|
67
|
-
},
|
|
68
|
-
'.ant-select-selection--multiple': {
|
|
69
|
-
maxHeight: '32px',
|
|
70
|
-
overflow: 'hidden'
|
|
16
|
+
return _defineProperty(_defineProperty(_defineProperty({}, componentCls, _defineProperty({
|
|
17
|
+
width: "100%"
|
|
18
|
+
}, '.ant-select', {
|
|
19
|
+
overflow: "hidden"
|
|
20
|
+
})), "".concat(componentCls, "-multi"), {
|
|
21
|
+
".ant-select-content": {
|
|
22
|
+
flexWrap: "nowrap"
|
|
71
23
|
}
|
|
24
|
+
}), "".concat(componentCls, "-all-list"), {
|
|
25
|
+
maxHeight: 300,
|
|
26
|
+
overflowY: "auto"
|
|
72
27
|
});
|
|
73
28
|
};
|
|
74
29
|
function useStyle(prefixCls) {
|
|
75
|
-
return (0, _vtxProvider.useStyle)('
|
|
30
|
+
return (0, _vtxProvider.useStyle)('', function (token) {
|
|
76
31
|
var vtxSelectToken = _objectSpread(_objectSpread({}, token), {}, {
|
|
77
32
|
componentCls: ".".concat(prefixCls)
|
|
78
33
|
});
|
|
@@ -53,7 +53,7 @@ var VtxSignature = exports.VtxSignature = /*#__PURE__*/(0, _react.forwardRef)(fu
|
|
|
53
53
|
clear();
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
(0, _react.
|
|
56
|
+
(0, _react.useLayoutEffect)(function () {
|
|
57
57
|
signaturePad.current = new _signature_pad.default(canvasRef.current, {
|
|
58
58
|
dotSize: dotSize,
|
|
59
59
|
minWidth: minWidth,
|
|
@@ -74,7 +74,9 @@ var VtxSignature = exports.VtxSignature = /*#__PURE__*/(0, _react.forwardRef)(fu
|
|
|
74
74
|
_onEnd && _onEnd();
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
|
-
|
|
77
|
+
setTimeout(function () {
|
|
78
|
+
resizeCanvas();
|
|
79
|
+
}, 0);
|
|
78
80
|
window.addEventListener('resize', (0, _debounce.default)(resizeCanvas, 150));
|
|
79
81
|
return function () {
|
|
80
82
|
window.removeEventListener('resize', (0, _debounce.default)(resizeCanvas, 150));
|
|
@@ -91,7 +93,6 @@ var VtxSignature = exports.VtxSignature = /*#__PURE__*/(0, _react.forwardRef)(fu
|
|
|
91
93
|
};
|
|
92
94
|
return wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
93
95
|
className: (0, _classnames.default)(prefixCls, hashId),
|
|
94
|
-
ref: ref,
|
|
95
96
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
96
97
|
className: (0, _classnames.default)("".concat(prefixCls, "--body")),
|
|
97
98
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("canvas", {
|
|
@@ -17,7 +17,7 @@ var genVtxSignatureStyle = function genVtxSignatureStyle(token) {
|
|
|
17
17
|
position: 'relative',
|
|
18
18
|
display: 'flex',
|
|
19
19
|
flexDirection: 'column',
|
|
20
|
-
height:
|
|
20
|
+
height: 300,
|
|
21
21
|
padding: '16px',
|
|
22
22
|
backgroundColor: token.colorBgBase,
|
|
23
23
|
border: "1px solid ".concat(token.colorBorder),
|
|
@@ -7,14 +7,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var
|
|
10
|
+
var _antd = require("antd");
|
|
11
11
|
var _Resizer = _interopRequireDefault(require("./Resizer"));
|
|
12
12
|
var _style = require("./style");
|
|
13
13
|
var _vtxProvider = require("../vtx-provider");
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
var _excluded = ["children", "defaultSize", "minSize", "maxSize", "style"];
|
|
15
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
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; }
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
23
|
+
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); }
|
|
24
|
+
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; }
|
|
25
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
18
26
|
function removeNullChildren(children) {
|
|
19
27
|
return _react.default.Children.toArray(children).filter(function (c) {
|
|
20
28
|
return c;
|
|
@@ -29,40 +37,41 @@ function VtxSplitPane(props) {
|
|
|
29
37
|
hashId = _useStyle.hashId;
|
|
30
38
|
var splitPane = (0, _react.useRef)();
|
|
31
39
|
var children = props.children,
|
|
40
|
+
defaultSize = props.defaultSize,
|
|
41
|
+
minSize = props.minSize,
|
|
42
|
+
maxSize = props.maxSize,
|
|
32
43
|
style = props.style,
|
|
33
|
-
|
|
34
|
-
direction = _props$direction === void 0 ? 'horizontal' : _props$direction;
|
|
44
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
35
45
|
var notNullChildren = removeNullChildren(children);
|
|
36
46
|
var refs = (0, _react.useRef)([]);
|
|
37
47
|
return wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
38
|
-
className: (0, _classnames.default)("".concat(prefixCls
|
|
48
|
+
className: (0, _classnames.default)("".concat(prefixCls), hashId),
|
|
39
49
|
ref: splitPane,
|
|
40
50
|
style: style,
|
|
41
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
42
|
-
direction: direction,
|
|
51
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Splitter, _objectSpread(_objectSpread({}, rest), {}, {
|
|
43
52
|
children: notNullChildren === null || notNullChildren === void 0 ? void 0 : notNullChildren.map(function (v, index) {
|
|
44
|
-
|
|
45
|
-
|
|
53
|
+
var _v$props;
|
|
54
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
55
|
+
children: /*#__PURE__*/(0, _react.cloneElement)(notNullChildren[index], _objectSpread(_objectSpread(_objectSpread({
|
|
46
56
|
ref: function ref(el) {
|
|
47
57
|
refs.current[index] = el;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
})
|
|
59
|
-
})
|
|
58
|
+
}
|
|
59
|
+
}, index === 0 ? {
|
|
60
|
+
max: maxSize,
|
|
61
|
+
min: minSize,
|
|
62
|
+
size: defaultSize
|
|
63
|
+
} : {}), v.props), {}, {
|
|
64
|
+
collapsible: _objectSpread({
|
|
65
|
+
start: true,
|
|
66
|
+
end: true,
|
|
67
|
+
showCollapsibleIcon: 'auto'
|
|
68
|
+
}, (_v$props = v.props) === null || _v$props === void 0 ? void 0 : _v$props.collapsible)
|
|
69
|
+
}))
|
|
60
70
|
});
|
|
61
71
|
})
|
|
62
|
-
})
|
|
72
|
+
}))
|
|
63
73
|
}));
|
|
64
74
|
}
|
|
65
75
|
VtxSplitPane.propTypes = {};
|
|
66
|
-
VtxSplitPane.
|
|
67
|
-
VtxSplitPane.Pane = _reactResizablePanels.Panel;
|
|
76
|
+
VtxSplitPane.Pane = _antd.Splitter.Panel;
|
|
68
77
|
var _default = exports.default = VtxSplitPane;
|