@vtx/components 4.0.0-beta.9 → 4.0.0-beta.90
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 +6 -6
- 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-combogrid/Combogrid.js +5 -4
- package/es/vtx-combogrid/index.js +7 -4
- package/es/vtx-datagrid/Store/Provide.js +109 -140
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -6
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/es/vtx-datagrid/ToolBar/index.js +2 -1
- package/es/vtx-datagrid/ToolBar/style.js +6 -3
- package/es/vtx-datagrid/columnState.js +91 -0
- package/es/vtx-datagrid/index.js +134 -37
- package/es/vtx-datagrid/mergeComponents.js +15 -0
- package/es/vtx-datagrid/renderColumnButtons.js +30 -11
- package/es/vtx-datagrid/style/index.js +108 -18
- 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 +2 -2
- package/es/vtx-ellipsis-text/style/index.js +3 -1
- package/es/vtx-export/index.js +33 -38
- package/es/vtx-export-async/History.js +15 -7
- package/es/vtx-export-async/index.js +18 -8
- package/es/vtx-export-async/util.js +16 -5
- package/es/vtx-form-layout/FormItem.js +16 -16
- package/es/vtx-form-layout/style/index.js +6 -4
- package/es/vtx-icon/index.js +54 -45
- package/es/vtx-icon/index.js1 +90 -0
- package/es/vtx-image/style/index.js +0 -1
- package/es/vtx-import/index.js +143 -42
- package/es/vtx-import/result.js +28 -26
- package/es/vtx-import/style/index.js +16 -1
- package/es/vtx-import2/Content.js +2 -1
- package/es/vtx-import2/index.js +29 -19
- package/es/vtx-import2/style/index.js +59 -8
- package/es/vtx-modal/index.js +11 -6
- package/es/vtx-modal/style/index.js +5 -2
- package/es/vtx-page-layout/Basic.js +2 -2
- package/es/vtx-page-layout/TabLayout.js +6 -6
- package/es/vtx-page-layout/TableLayout.js +10 -10
- package/es/vtx-page-layout/TreeLayout.js +6 -6
- package/es/vtx-page-layout/container.js +2 -2
- package/es/vtx-page-layout/style/index.js +4 -2
- package/es/vtx-provider/index.js +33 -31
- package/es/vtx-provider/intl.js +9 -9
- package/es/vtx-provider/locale/en_GB.js +1 -1
- package/es/vtx-provider/locale/en_US.js +58 -4
- package/es/vtx-provider/locale/zh_CN.js +57 -3
- package/es/vtx-provider/useStyle/index.js +17 -17
- package/es/vtx-search/index.js +30 -12
- package/es/vtx-search/style/index.js +6 -3
- package/es/vtx-select/index.js +123 -40
- package/es/vtx-select/style/index.js +11 -56
- package/es/vtx-split-pane/Resizer.js +0 -1
- package/es/vtx-split-pane/SplitPane.js +42 -34
- 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 +27 -9
- package/es/vtx-tree-select/index.js +81 -110
- 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 +41 -32
- package/es/vtx-wang-editor/style/index.less +12 -12
- 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 +6 -6
- 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-combogrid/Combogrid.js +5 -4
- package/lib/vtx-combogrid/index.js +7 -4
- package/lib/vtx-datagrid/Store/Provide.js +112 -142
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -6
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/lib/vtx-datagrid/ToolBar/index.js +2 -1
- package/lib/vtx-datagrid/ToolBar/style.js +6 -3
- package/lib/vtx-datagrid/columnState.js +100 -0
- package/lib/vtx-datagrid/index.js +134 -37
- package/lib/vtx-datagrid/mergeComponents.js +21 -0
- package/lib/vtx-datagrid/renderColumnButtons.js +30 -11
- package/lib/vtx-datagrid/style/index.js +108 -18
- 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 +2 -2
- package/lib/vtx-ellipsis-text/style/index.js +3 -1
- package/lib/vtx-export/index.js +34 -39
- package/lib/vtx-export-async/History.js +14 -8
- package/lib/vtx-export-async/index.js +18 -8
- package/lib/vtx-export-async/util.js +16 -5
- package/lib/vtx-form-layout/FormItem.js +16 -16
- package/lib/vtx-form-layout/style/index.js +6 -4
- package/lib/vtx-icon/index.js +54 -52
- package/lib/vtx-icon/index.js1 +90 -0
- package/lib/vtx-image/style/index.js +0 -1
- package/lib/vtx-import/index.js +141 -43
- package/lib/vtx-import/result.js +29 -27
- package/lib/vtx-import/style/index.js +16 -1
- package/lib/vtx-import2/Content.js +2 -1
- package/lib/vtx-import2/index.js +29 -19
- package/lib/vtx-import2/style/index.js +59 -8
- package/lib/vtx-modal/index.js +11 -6
- package/lib/vtx-modal/style/index.js +5 -2
- package/lib/vtx-page-layout/Basic.js +2 -2
- package/lib/vtx-page-layout/TabLayout.js +6 -6
- package/lib/vtx-page-layout/TableLayout.js +10 -10
- package/lib/vtx-page-layout/TreeLayout.js +6 -6
- package/lib/vtx-page-layout/container.js +2 -2
- package/lib/vtx-page-layout/style/index.js +4 -2
- package/lib/vtx-provider/index.js +33 -31
- package/lib/vtx-provider/intl.js +9 -9
- package/lib/vtx-provider/locale/en_GB.js +1 -1
- package/lib/vtx-provider/locale/en_US.js +58 -4
- package/lib/vtx-provider/locale/zh_CN.js +57 -3
- package/lib/vtx-provider/useStyle/index.js +17 -17
- package/lib/vtx-search/index.js +32 -12
- package/lib/vtx-search/style/index.js +6 -3
- package/lib/vtx-select/index.js +125 -42
- package/lib/vtx-select/style/index.js +11 -56
- package/lib/vtx-split-pane/Resizer.js +0 -1
- package/lib/vtx-split-pane/SplitPane.js +40 -31
- 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 +27 -9
- package/lib/vtx-tree-select/index.js +81 -112
- 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 +39 -30
- package/lib/vtx-wang-editor/style/index.less +12 -12
- package/package.json +239 -238
- package/es/utils/hooks/useFetchData/index.js +0 -82
- package/lib/utils/hooks/useFetchData/index.js +0 -89
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
|
|
8
|
+
import classnames from 'classnames';
|
|
9
|
+
import React, { useContext } from 'react';
|
|
10
|
+
import { Transfer } from 'antd';
|
|
11
|
+
import { useStyle } from "./style";
|
|
12
|
+
import { VtxProvider } from "../vtx-provider";
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
function VtxTransfer(props) {
|
|
15
|
+
var _useContext = useContext(VtxProvider),
|
|
16
|
+
getPrefixCls = _useContext.getPrefixCls;
|
|
17
|
+
var prefixCls = getPrefixCls('VtxTransfer', props.prefixCls);
|
|
18
|
+
var _useStyle = useStyle(prefixCls),
|
|
19
|
+
wrapSSR = _useStyle.wrapSSR,
|
|
20
|
+
hashId = _useStyle.hashId;
|
|
21
|
+
var rest = Object.assign({}, (_objectDestructuringEmpty(props), props));
|
|
22
|
+
return wrapSSR( /*#__PURE__*/_jsx(Transfer, _objectSpread({
|
|
23
|
+
classNames: {
|
|
24
|
+
root: classnames(hashId, prefixCls)
|
|
25
|
+
}
|
|
26
|
+
}, rest)));
|
|
27
|
+
}
|
|
28
|
+
VtxTransfer.propTypes = {};
|
|
29
|
+
export default VtxTransfer;
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
import { useStyle as useAntdStyle } from "../../vtx-provider";
|
|
8
|
+
var genStyle = function genStyle(token) {
|
|
9
|
+
var componentCls = token.componentCls;
|
|
10
|
+
return _defineProperty({}, componentCls, {});
|
|
11
|
+
};
|
|
12
|
+
export function useStyle(prefixCls) {
|
|
13
|
+
return useAntdStyle('', function (token) {
|
|
14
|
+
var _token = _objectSpread(_objectSpread({}, token), {}, {
|
|
15
|
+
componentCls: ".".concat(prefixCls)
|
|
16
|
+
});
|
|
17
|
+
return [genStyle(_token)];
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
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 = ["leftColumns", "rightColumns"],
|
|
3
|
+
_excluded2 = ["popoverProps", "disabled", "leftColumns", "rightColumns", "styles"];
|
|
4
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
|
+
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."); }
|
|
6
|
+
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); }
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
8
|
+
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; } }
|
|
9
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
|
+
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; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
14
|
+
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); }
|
|
15
|
+
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; }
|
|
16
|
+
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; }
|
|
17
|
+
import classnames from 'classnames';
|
|
18
|
+
import React, { useState, useContext } from 'react';
|
|
19
|
+
import { Transfer } from 'antd';
|
|
20
|
+
import { useStyle } from "./style";
|
|
21
|
+
import { VtxProvider } from "../vtx-provider";
|
|
22
|
+
import { Select, Popover, Table } from 'antd';
|
|
23
|
+
import VtxIcon from "../vtx-icon";
|
|
24
|
+
import VtxDatagrid from "../vtx-datagrid";
|
|
25
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
|
+
var mockTags = ['cat', 'dog', 'bird'];
|
|
27
|
+
var mockData = Array.from({
|
|
28
|
+
length: 20
|
|
29
|
+
}).map(function (_, i) {
|
|
30
|
+
return {
|
|
31
|
+
key: i.toString(),
|
|
32
|
+
title: "content".concat(i + 1),
|
|
33
|
+
description: "description of content".concat(i + 1),
|
|
34
|
+
tag: mockTags[i % 3]
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
var TableTransfer = function TableTransfer(props) {
|
|
38
|
+
var leftColumns = props.leftColumns,
|
|
39
|
+
rightColumns = props.rightColumns,
|
|
40
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
41
|
+
return /*#__PURE__*/_jsx(Transfer, _objectSpread(_objectSpread({
|
|
42
|
+
style: {
|
|
43
|
+
width: '100%'
|
|
44
|
+
}
|
|
45
|
+
}, restProps), {}, {
|
|
46
|
+
children: function children(_ref) {
|
|
47
|
+
var direction = _ref.direction,
|
|
48
|
+
filteredItems = _ref.filteredItems,
|
|
49
|
+
onItemSelect = _ref.onItemSelect,
|
|
50
|
+
onItemSelectAll = _ref.onItemSelectAll,
|
|
51
|
+
listSelectedKeys = _ref.selectedKeys,
|
|
52
|
+
listDisabled = _ref.disabled;
|
|
53
|
+
var columns = direction === 'left' ? leftColumns : rightColumns;
|
|
54
|
+
var rowSelection = {
|
|
55
|
+
getCheckboxProps: function getCheckboxProps() {
|
|
56
|
+
return {
|
|
57
|
+
disabled: listDisabled
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
onChange: function onChange(selectedRowKeys) {
|
|
61
|
+
onItemSelectAll(selectedRowKeys, 'replace');
|
|
62
|
+
},
|
|
63
|
+
selectedRowKeys: listSelectedKeys,
|
|
64
|
+
selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT, Table.SELECTION_NONE]
|
|
65
|
+
};
|
|
66
|
+
return /*#__PURE__*/_jsx(Table, {
|
|
67
|
+
rowSelection: rowSelection,
|
|
68
|
+
columns: columns,
|
|
69
|
+
dataSource: filteredItems,
|
|
70
|
+
size: "small",
|
|
71
|
+
style: {
|
|
72
|
+
pointerEvents: listDisabled ? 'none' : undefined
|
|
73
|
+
},
|
|
74
|
+
onRow: function onRow(_ref2) {
|
|
75
|
+
var key = _ref2.key,
|
|
76
|
+
itemDisabled = _ref2.disabled;
|
|
77
|
+
return {
|
|
78
|
+
onClick: function onClick() {
|
|
79
|
+
if (itemDisabled || listDisabled) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
onItemSelect(key, !listSelectedKeys.includes(key));
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}));
|
|
89
|
+
};
|
|
90
|
+
function TransferSelect(props) {
|
|
91
|
+
var _useState = useState(function () {
|
|
92
|
+
return [];
|
|
93
|
+
}),
|
|
94
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
95
|
+
selectedRowKeys = _useState2[0],
|
|
96
|
+
setSelectedRowKeys = _useState2[1];
|
|
97
|
+
var _useState3 = useState([]),
|
|
98
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
99
|
+
targetKeys = _useState4[0],
|
|
100
|
+
setTargetKeys = _useState4[1];
|
|
101
|
+
var onChange = function onChange(nextTargetKeys) {
|
|
102
|
+
setTargetKeys(nextTargetKeys);
|
|
103
|
+
};
|
|
104
|
+
var _useState5 = useState(false),
|
|
105
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
106
|
+
visible = _useState6[0],
|
|
107
|
+
setVisible = _useState6[1];
|
|
108
|
+
var _useContext = useContext(VtxProvider),
|
|
109
|
+
getPrefixCls = _useContext.getPrefixCls;
|
|
110
|
+
var prefixCls = getPrefixCls('VtxTransferSelect', props.prefixCls);
|
|
111
|
+
var _useStyle = useStyle(prefixCls),
|
|
112
|
+
wrapSSR = _useStyle.wrapSSR,
|
|
113
|
+
hashId = _useStyle.hashId;
|
|
114
|
+
var _props$popoverProps = props.popoverProps,
|
|
115
|
+
popoverProps = _props$popoverProps === void 0 ? {} : _props$popoverProps,
|
|
116
|
+
_props$disabled = props.disabled,
|
|
117
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
118
|
+
leftColumns = props.leftColumns,
|
|
119
|
+
rightColumns = props.rightColumns,
|
|
120
|
+
styles = props.styles,
|
|
121
|
+
rest = _objectWithoutProperties(props, _excluded2);
|
|
122
|
+
return wrapSSR( /*#__PURE__*/_jsx(Select, {
|
|
123
|
+
suffixIcon: /*#__PURE__*/_jsx(VtxIcon, {
|
|
124
|
+
type: "downOutlined",
|
|
125
|
+
fileType: "svg"
|
|
126
|
+
}),
|
|
127
|
+
styles: _objectSpread({}, styles),
|
|
128
|
+
popupRender: function popupRender(node) {
|
|
129
|
+
return /*#__PURE__*/_jsx(TableTransfer, {
|
|
130
|
+
classNames: {
|
|
131
|
+
root: classnames(hashId, prefixCls)
|
|
132
|
+
},
|
|
133
|
+
dataSource: mockData,
|
|
134
|
+
onChange: onChange,
|
|
135
|
+
leftColumns: leftColumns,
|
|
136
|
+
rightColumns: rightColumns,
|
|
137
|
+
targetKeys: targetKeys
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}));
|
|
141
|
+
}
|
|
142
|
+
TransferSelect.propTypes = {};
|
|
143
|
+
export default TransferSelect;
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
import { useStyle as useAntdStyle } from "../../vtx-provider";
|
|
8
|
+
var genStyle = function genStyle(token) {
|
|
9
|
+
var componentCls = token.componentCls;
|
|
10
|
+
return _defineProperty({}, componentCls, {});
|
|
11
|
+
};
|
|
12
|
+
export function useStyle(prefixCls) {
|
|
13
|
+
return useAntdStyle('', function (token) {
|
|
14
|
+
var _token = _objectSpread(_objectSpread({}, token), {}, {
|
|
15
|
+
componentCls: ".".concat(prefixCls)
|
|
16
|
+
});
|
|
17
|
+
return [genStyle(_token)];
|
|
18
|
+
});
|
|
19
|
+
}
|
package/es/vtx-tree/index.js
CHANGED
|
@@ -28,6 +28,7 @@ import { parseTreeData } from '@vtx/utils';
|
|
|
28
28
|
import classnames from 'classnames';
|
|
29
29
|
import { useStyle } from "./style/index";
|
|
30
30
|
import { VtxProvider, useIntl } from "../vtx-provider";
|
|
31
|
+
import VtxIcon from "../vtx-icon";
|
|
31
32
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
32
33
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
33
34
|
var getParentKey = function getParentKey(keyValue, key, tree) {
|
|
@@ -193,15 +194,29 @@ var VtxTree = /*#__PURE__*/forwardRef(function (propsAll, ref) {
|
|
|
193
194
|
};
|
|
194
195
|
});
|
|
195
196
|
useEffect(function () {
|
|
196
|
-
var
|
|
197
|
-
|
|
197
|
+
var element = treeRef.current;
|
|
198
|
+
if (!element) return; // 提前返回,避免后续问题
|
|
199
|
+
|
|
200
|
+
var resizeObserver = new ResizeObserver(function (entries) {
|
|
201
|
+
var _iterator2 = _createForOfIteratorHelper(entries),
|
|
202
|
+
_step2;
|
|
203
|
+
try {
|
|
204
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
205
|
+
var entry = _step2.value;
|
|
206
|
+
setHeight(entry.contentRect.height);
|
|
207
|
+
}
|
|
208
|
+
} catch (err) {
|
|
209
|
+
_iterator2.e(err);
|
|
210
|
+
} finally {
|
|
211
|
+
_iterator2.f();
|
|
212
|
+
}
|
|
198
213
|
});
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
setHeight(
|
|
214
|
+
resizeObserver.observe(element, {
|
|
215
|
+
box: 'border-box'
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
// 初始化高度
|
|
219
|
+
setHeight(element.offsetHeight);
|
|
205
220
|
return function () {
|
|
206
221
|
resizeObserver.disconnect();
|
|
207
222
|
};
|
|
@@ -284,7 +299,10 @@ var VtxTree = /*#__PURE__*/forwardRef(function (propsAll, ref) {
|
|
|
284
299
|
ref: treeRef,
|
|
285
300
|
children: /*#__PURE__*/_jsx(Tree, _objectSpread(_objectSpread(_objectSpread({}, props), {}, {
|
|
286
301
|
height: height,
|
|
287
|
-
switcherIcon: /*#__PURE__*/_jsx(
|
|
302
|
+
switcherIcon: /*#__PURE__*/_jsx(VtxIcon, {
|
|
303
|
+
type: "downOutlined",
|
|
304
|
+
fileType: "svg"
|
|
305
|
+
}),
|
|
288
306
|
showLine: {
|
|
289
307
|
showLeafIcon: false
|
|
290
308
|
},
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["multiple", "treeData", "placeholder", "treeCheckable", "disabled", "style"]
|
|
3
|
-
_excluded2 = ["children"];
|
|
2
|
+
var _excluded = ["multiple", "treeData", "placeholder", "treeCheckable", "disabled", "style", "fieldNames", "onChange", "labelInValue"];
|
|
4
3
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
5
4
|
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."); }
|
|
6
5
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
@@ -10,6 +9,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
10
9
|
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; }
|
|
11
10
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
12
11
|
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); }
|
|
12
|
+
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
|
|
13
13
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
14
|
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."); }
|
|
15
15
|
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); }
|
|
@@ -18,15 +18,16 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
18
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
19
|
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; }
|
|
20
20
|
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; }
|
|
21
|
-
import { Button, Empty, Popover, Tag, TreeSelect, ConfigProvider, Space } from 'antd';
|
|
22
|
-
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
23
|
-
import PropTypes from 'prop-types';
|
|
24
21
|
import { DownOutlined, MoreOutlined } from '@ant-design/icons';
|
|
22
|
+
import { useSize } from 'ahooks';
|
|
23
|
+
import { Button, Empty, Popover, Space, Tag, TreeSelect } from 'antd';
|
|
25
24
|
import classnames from 'classnames';
|
|
26
25
|
import pull from 'lodash-es/pull';
|
|
27
|
-
import
|
|
28
|
-
import {
|
|
26
|
+
import PropTypes from 'prop-types';
|
|
27
|
+
import { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
28
|
+
import VtxIcon from "../vtx-icon";
|
|
29
29
|
import { VtxProvider, useIntl } from "../vtx-provider";
|
|
30
|
+
import { useStyle } from "./style/index";
|
|
30
31
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
31
32
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
32
33
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -38,7 +39,18 @@ var VtxTreeSelect = function VtxTreeSelect(_ref) {
|
|
|
38
39
|
_ref$disabled = _ref.disabled,
|
|
39
40
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
40
41
|
style = _ref.style,
|
|
42
|
+
_ref$fieldNames = _ref.fieldNames,
|
|
43
|
+
fieldNames = _ref$fieldNames === void 0 ? {
|
|
44
|
+
label: 'title',
|
|
45
|
+
value: 'value',
|
|
46
|
+
key: 'value',
|
|
47
|
+
children: 'children'
|
|
48
|
+
} : _ref$fieldNames,
|
|
49
|
+
onChange = _ref.onChange,
|
|
50
|
+
labelInValue = _ref.labelInValue,
|
|
41
51
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
52
|
+
// checkable 状态下节点选择完全受控(父子节点选中状态不再关联),会使得 labelInValue 强制为 true
|
|
53
|
+
var _labelInValue = treeCheckable && props.treeCheckStrictly ? true : labelInValue;
|
|
42
54
|
var intl = useIntl();
|
|
43
55
|
var _useContext = useContext(VtxProvider),
|
|
44
56
|
getPrefixCls = _useContext.getPrefixCls;
|
|
@@ -64,11 +76,9 @@ var VtxTreeSelect = function VtxTreeSelect(_ref) {
|
|
|
64
76
|
}
|
|
65
77
|
(function genNodes(nodes) {
|
|
66
78
|
nodes.map(function (item) {
|
|
67
|
-
var
|
|
68
|
-
|
|
69
|
-
keyNodesMapping[item.value
|
|
70
|
-
id: item.value || item.key
|
|
71
|
-
});
|
|
79
|
+
var rest = Object.assign({}, (_objectDestructuringEmpty(item), item));
|
|
80
|
+
var children = item[fieldNames.children];
|
|
81
|
+
keyNodesMapping[item[fieldNames.value]] = _objectSpread(_objectSpread({}, rest), {}, _defineProperty(_defineProperty({}, fieldNames.value, item[fieldNames.value]), fieldNames.label, item[fieldNames.label]));
|
|
72
82
|
if (Array.isArray(children) && children.length > 0) {
|
|
73
83
|
genNodes(children);
|
|
74
84
|
}
|
|
@@ -77,19 +87,17 @@ var VtxTreeSelect = function VtxTreeSelect(_ref) {
|
|
|
77
87
|
return keyNodesMapping;
|
|
78
88
|
}, [treeData]);
|
|
79
89
|
var clear = function clear() {
|
|
80
|
-
|
|
81
|
-
(_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, [], [], {});
|
|
90
|
+
onChangeTreeSelect === null || onChangeTreeSelect === void 0 || onChangeTreeSelect([], [], {});
|
|
82
91
|
};
|
|
83
92
|
var clearKey = function clearKey(id) {
|
|
84
|
-
var _props$onChange2;
|
|
85
93
|
var newValue = _toConsumableArray(props.value);
|
|
86
94
|
pull(newValue, id);
|
|
87
95
|
var label = newValue.map(function (item) {
|
|
88
|
-
return keyNodesMapping[item]
|
|
96
|
+
return keyNodesMapping[item[fieldNames.label]];
|
|
89
97
|
});
|
|
90
|
-
|
|
98
|
+
onChangeTreeSelect === null || onChangeTreeSelect === void 0 || onChangeTreeSelect(newValue, label, {});
|
|
91
99
|
};
|
|
92
|
-
var
|
|
100
|
+
var getSelectedNodes = function getSelectedNodes(value) {
|
|
93
101
|
var value_arr = function (val) {
|
|
94
102
|
if (Array.isArray(val)) {
|
|
95
103
|
return val;
|
|
@@ -98,90 +106,29 @@ var VtxTreeSelect = function VtxTreeSelect(_ref) {
|
|
|
98
106
|
} else {
|
|
99
107
|
return [];
|
|
100
108
|
}
|
|
101
|
-
}(
|
|
109
|
+
}(value);
|
|
102
110
|
var selectedNodes = value_arr.filter(function (k) {
|
|
103
|
-
|
|
111
|
+
if (_labelInValue) {
|
|
112
|
+
return k.value in keyNodesMapping;
|
|
113
|
+
} else {
|
|
114
|
+
return k in keyNodesMapping;
|
|
115
|
+
}
|
|
104
116
|
}).map(function (item) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
};
|
|
117
|
+
if (_labelInValue) {
|
|
118
|
+
return _objectSpread({}, keyNodesMapping[item.value]);
|
|
119
|
+
}
|
|
120
|
+
return _objectSpread({}, keyNodesMapping[item]);
|
|
109
121
|
});
|
|
110
122
|
return selectedNodes;
|
|
123
|
+
};
|
|
124
|
+
var selectedNodes = useMemo(function () {
|
|
125
|
+
return getSelectedNodes(props.value);
|
|
111
126
|
}, [props.value, keyNodesMapping]);
|
|
112
127
|
useEffect(function () {
|
|
113
128
|
if (size !== null && size !== void 0 && size.width) {
|
|
114
129
|
setPopWidth(size === null || size === void 0 ? void 0 : size.width);
|
|
115
130
|
}
|
|
116
131
|
}, [size === null || size === void 0 ? void 0 : size.width]);
|
|
117
|
-
|
|
118
|
-
// let suffixIconObj = {};
|
|
119
|
-
// if (multiple || treeCheckable) {
|
|
120
|
-
// suffixIconObj.suffixIcon = (
|
|
121
|
-
// <Popover
|
|
122
|
-
// content={
|
|
123
|
-
// <>
|
|
124
|
-
// <div
|
|
125
|
-
// className={classnames(`${prefixCls}-count-head`, hashId,)}
|
|
126
|
-
|
|
127
|
-
// >
|
|
128
|
-
// <span>已选择:{selectedNodes.length}</span>
|
|
129
|
-
// <span
|
|
130
|
-
// className={classnames(
|
|
131
|
-
// selectedNodes.length > 0 && !disabled
|
|
132
|
-
// ? 'clear-count'
|
|
133
|
-
// : 'disabled-count',
|
|
134
|
-
// )}
|
|
135
|
-
// onClick={e => {
|
|
136
|
-
// if (!disabled) {
|
|
137
|
-
// e.stopPropagation();
|
|
138
|
-
// clear();
|
|
139
|
-
// }
|
|
140
|
-
// }}
|
|
141
|
-
// >
|
|
142
|
-
// 清空已选项
|
|
143
|
-
// </span>
|
|
144
|
-
// </div>
|
|
145
|
-
// {selectedNodes.length > 0 ? (
|
|
146
|
-
// selectedNodes.map(item => (
|
|
147
|
-
// <Tag
|
|
148
|
-
// key={`tab-${item.id}`}
|
|
149
|
-
// closable={!disabled}
|
|
150
|
-
// onClose={e => {
|
|
151
|
-
// e.stopPropagation();
|
|
152
|
-
// clearKey(item.id);
|
|
153
|
-
// }}
|
|
154
|
-
// style={{ marginBottom: '5px' }}
|
|
155
|
-
// >
|
|
156
|
-
// {item.name && item.name.length > 20
|
|
157
|
-
// ? `${item.name.slice(0, 20)}...`
|
|
158
|
-
// : item.name}
|
|
159
|
-
// </Tag>
|
|
160
|
-
// ))
|
|
161
|
-
// ) : (
|
|
162
|
-
// <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
|
163
|
-
// )}
|
|
164
|
-
// </>
|
|
165
|
-
// }
|
|
166
|
-
// placement="bottomRight"
|
|
167
|
-
// trigger="click"
|
|
168
|
-
// // overlayStyle={{ width: popWidth }}
|
|
169
|
-
// styles={{ root: { width: popWidth } }}
|
|
170
|
-
// >
|
|
171
|
-
// <Button
|
|
172
|
-
// className={classnames(`${prefixCls}-count`, hashId,)}
|
|
173
|
-
|
|
174
|
-
// icon={<MoreOutlined />}
|
|
175
|
-
// size="default"
|
|
176
|
-
// onClick={e => {
|
|
177
|
-
// console.log('click', e)
|
|
178
|
-
// e.stopPropagation();
|
|
179
|
-
// }}
|
|
180
|
-
// />
|
|
181
|
-
// </Popover>
|
|
182
|
-
// );
|
|
183
|
-
// }
|
|
184
|
-
|
|
185
132
|
var popoverContent = /*#__PURE__*/_jsxs(_Fragment, {
|
|
186
133
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
187
134
|
className: classnames("".concat(prefixCls, "-count-head"), hashId),
|
|
@@ -197,22 +144,33 @@ var VtxTreeSelect = function VtxTreeSelect(_ref) {
|
|
|
197
144
|
},
|
|
198
145
|
children: intl.getMessage('treeSelect.clearSelectedItems', '清空已选项')
|
|
199
146
|
})]
|
|
200
|
-
}),
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
147
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
148
|
+
className: classnames("".concat(prefixCls, "-all-list"), hashId),
|
|
149
|
+
children: selectedNodes.length > 0 ? selectedNodes.map(function (item) {
|
|
150
|
+
var _item$fieldNames$labe;
|
|
151
|
+
return /*#__PURE__*/_jsx(Tag, {
|
|
152
|
+
closable: !disabled,
|
|
153
|
+
onClose: function onClose(e) {
|
|
154
|
+
e.stopPropagation();
|
|
155
|
+
clearKey(item[fieldNames.value]);
|
|
156
|
+
},
|
|
157
|
+
styles: {
|
|
158
|
+
root: {
|
|
159
|
+
marginBottom: 5,
|
|
160
|
+
marginRight: 5
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
children: ((_item$fieldNames$labe = item[fieldNames.label]) === null || _item$fieldNames$labe === void 0 ? void 0 : _item$fieldNames$labe.length) > 20 ? "".concat(item[fieldNames.label].slice(0, 20), "...") : item[fieldNames.label]
|
|
164
|
+
}, "tab-".concat(item[fieldNames.value]));
|
|
165
|
+
}) : /*#__PURE__*/_jsx(Empty, {
|
|
166
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE
|
|
167
|
+
})
|
|
214
168
|
})]
|
|
215
169
|
});
|
|
170
|
+
var onChangeTreeSelect = function onChangeTreeSelect(value, label, extra) {
|
|
171
|
+
extra.list = getSelectedNodes(value);
|
|
172
|
+
onChange === null || onChange === void 0 || onChange(value, label, extra);
|
|
173
|
+
};
|
|
216
174
|
return wrapSSR( /*#__PURE__*/_jsx("div", {
|
|
217
175
|
ref: ref,
|
|
218
176
|
style: style,
|
|
@@ -221,14 +179,20 @@ var VtxTreeSelect = function VtxTreeSelect(_ref) {
|
|
|
221
179
|
style: {
|
|
222
180
|
width: '100%'
|
|
223
181
|
},
|
|
224
|
-
children: [/*#__PURE__*/_jsx(TreeSelect, _objectSpread({
|
|
225
|
-
showSearch:
|
|
182
|
+
children: [/*#__PURE__*/_jsx(TreeSelect, _objectSpread(_objectSpread({
|
|
183
|
+
showSearch: {
|
|
184
|
+
treeNodeFilterProp: fieldNames.label
|
|
185
|
+
},
|
|
226
186
|
placeholder: placeholder,
|
|
227
187
|
treeData: treeData,
|
|
228
188
|
treeLine: {
|
|
229
189
|
showLeafIcon: false
|
|
230
190
|
},
|
|
231
191
|
switcherIcon: /*#__PURE__*/_jsx(DownOutlined, {}),
|
|
192
|
+
suffixIcon: /*#__PURE__*/_jsx(VtxIcon, {
|
|
193
|
+
type: "downOutlined",
|
|
194
|
+
fileType: "svg"
|
|
195
|
+
}),
|
|
232
196
|
multiple: multiple,
|
|
233
197
|
treeCheckable: treeCheckable,
|
|
234
198
|
className: classnames("".concat(prefixCls, " ").concat(props.prefixCls), hashId),
|
|
@@ -245,8 +209,15 @@ var VtxTreeSelect = function VtxTreeSelect(_ref) {
|
|
|
245
209
|
popup: classnames("".concat(prefixCls, "-popup"), hashId)
|
|
246
210
|
},
|
|
247
211
|
maxTagCount: "responsive",
|
|
248
|
-
treeDefaultExpandAll: true
|
|
249
|
-
|
|
212
|
+
treeDefaultExpandAll: true,
|
|
213
|
+
fieldNames: fieldNames,
|
|
214
|
+
labelInValue: _labelInValue,
|
|
215
|
+
disabled: disabled
|
|
216
|
+
}, props), {}, {
|
|
217
|
+
onChange: function onChange(value, label, extra) {
|
|
218
|
+
return onChangeTreeSelect(value, label, extra, selectedNodes);
|
|
219
|
+
}
|
|
220
|
+
})), (multiple || treeCheckable) && /*#__PURE__*/_jsx(Popover, {
|
|
250
221
|
open: popOpen,
|
|
251
222
|
onOpenChange: setPopOpen,
|
|
252
223
|
placement: "bottomRight",
|
|
@@ -7,7 +7,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
7
7
|
import { useStyle as useAntdStyle } from "../../vtx-provider";
|
|
8
8
|
var genVtxTreeSelectStyle = function genVtxTreeSelectStyle(token) {
|
|
9
9
|
var componentCls = token.componentCls;
|
|
10
|
-
return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, '&-popover', {
|
|
10
|
+
return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, '&-popover', {
|
|
11
11
|
minWidth: '200px',
|
|
12
12
|
height: '300px',
|
|
13
13
|
overflow: 'auto',
|
|
@@ -28,14 +28,16 @@ var genVtxTreeSelectStyle = function genVtxTreeSelectStyle(token) {
|
|
|
28
28
|
color: '@input-placeholder-color'
|
|
29
29
|
}), '&-count', {
|
|
30
30
|
marginRight: '-12px'
|
|
31
|
-
})), "".concat(componentCls, "-popup"), _defineProperty({}, '&', _defineProperty(_defineProperty({}, '.ant-select-tree .ant-select-tree-treenode:not(.ant-select-tree .ant-select-tree-treenode-disabled).filter-node .ant-select-tree-title', {
|
|
31
|
+
})), "".concat(componentCls, "-popup"), _defineProperty({}, '&', _defineProperty(_defineProperty(_defineProperty({}, '.ant-select-tree .ant-select-tree-treenode:not(.ant-select-tree .ant-select-tree-treenode-disabled).filter-node .ant-select-tree-title', {
|
|
32
32
|
color: '#1890ff'
|
|
33
33
|
}), '.ant-select-tree .ant-select-tree-node-content-wrapper .ant-select-tree-node-selected', {
|
|
34
34
|
backgroundColor: '#e6f7ff'
|
|
35
|
+
}), '.ant-select-tree .ant-select-tree-list-holder-inner .ant-select-tree-treenode .ant-select-tree-node-content-wrapper', {
|
|
36
|
+
flex: 1
|
|
35
37
|
}))), "".concat(componentCls, "-count-head"), {
|
|
36
38
|
display: 'flex',
|
|
37
39
|
justifyContent: 'space-between',
|
|
38
|
-
marginBottom:
|
|
40
|
+
marginBottom: 5,
|
|
39
41
|
'.disabled-count': {
|
|
40
42
|
color: '#aaa',
|
|
41
43
|
cursor: 'not-allowed'
|
|
@@ -45,6 +47,9 @@ var genVtxTreeSelectStyle = function genVtxTreeSelectStyle(token) {
|
|
|
45
47
|
}, '&:hover', {
|
|
46
48
|
color: '#40a9ff'
|
|
47
49
|
})
|
|
50
|
+
}), "".concat(componentCls, "-all-list"), {
|
|
51
|
+
maxHeight: 300,
|
|
52
|
+
overflowY: "auto"
|
|
48
53
|
}), "".concat(componentCls, "-outer"), {
|
|
49
54
|
position: 'relative',
|
|
50
55
|
display: 'inline-flex',
|
|
@@ -57,6 +62,7 @@ var genVtxTreeSelectStyle = function genVtxTreeSelectStyle(token) {
|
|
|
57
62
|
color: token.colorTextDescription,
|
|
58
63
|
display: 'inline-flex',
|
|
59
64
|
alignItems: 'center',
|
|
65
|
+
width: token.controlHeight,
|
|
60
66
|
'&:hover': {
|
|
61
67
|
color: token.colorPrimary
|
|
62
68
|
}
|
|
@@ -10,6 +10,7 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
// import { volume, playbackRate } from 'xgplayer/dist/controls';
|
|
11
11
|
import { Modal, Button } from 'antd';
|
|
12
12
|
import { VtxProvider, useIntl } from "../vtx-provider";
|
|
13
|
+
import VtxModal from "../vtx-modal";
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
16
|
function Preview(props) {
|
|
@@ -77,7 +78,7 @@ function Preview(props) {
|
|
|
77
78
|
timer && clearTimeout(timer);
|
|
78
79
|
onCancel();
|
|
79
80
|
};
|
|
80
|
-
return /*#__PURE__*/_jsxs(
|
|
81
|
+
return /*#__PURE__*/_jsxs(VtxModal, _objectSpread(_objectSpread({}, modalProps), {}, {
|
|
81
82
|
children: [type == 'file' ? /*#__PURE__*/_jsx("iframe", {
|
|
82
83
|
src: url,
|
|
83
84
|
style: {
|