@vtx/components 4.0.0-beta.9 → 4.0.0-beta.91
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-statistics-column/style/index.js +1 -1
- 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-statistics-column/style/index.js +1 -1
- 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
|
@@ -16,23 +16,23 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
16
16
|
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; }
|
|
17
17
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
18
18
|
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); }
|
|
19
|
-
/**
|
|
20
|
-
* 把一个颜色设置一下透明度
|
|
21
|
-
* @example (#fff, 0.5) => rgba(255, 255, 255, 0.5)
|
|
22
|
-
* @param baseColor {string}
|
|
23
|
-
* @param alpha {0-1}
|
|
24
|
-
* @returns rgba {string}
|
|
19
|
+
/**
|
|
20
|
+
* 把一个颜色设置一下透明度
|
|
21
|
+
* @example (#fff, 0.5) => rgba(255, 255, 255, 0.5)
|
|
22
|
+
* @param baseColor {string}
|
|
23
|
+
* @param alpha {0-1}
|
|
24
|
+
* @returns rgba {string}
|
|
25
25
|
*/
|
|
26
26
|
var setAlpha = exports.setAlpha = function setAlpha(baseColor, alpha) {
|
|
27
27
|
return new _tinycolor.TinyColor(baseColor).setAlpha(alpha).toRgbString();
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
/**
|
|
31
|
-
* 把一个颜色修改一些明度
|
|
32
|
-
* @example (#000, 50) => #808080
|
|
33
|
-
* @param baseColor {string}
|
|
34
|
-
* @param brightness {0-100}
|
|
35
|
-
* @returns hexColor {string}
|
|
30
|
+
/**
|
|
31
|
+
* 把一个颜色修改一些明度
|
|
32
|
+
* @example (#000, 50) => #808080
|
|
33
|
+
* @param baseColor {string}
|
|
34
|
+
* @param brightness {0-100}
|
|
35
|
+
* @returns hexColor {string}
|
|
36
36
|
*/
|
|
37
37
|
var lighten = exports.lighten = function lighten(baseColor, brightness) {
|
|
38
38
|
var instance = new _tinycolor.TinyColor(baseColor);
|
|
@@ -67,11 +67,11 @@ var operationUnit = exports.operationUnit = function operationUnit(token) {
|
|
|
67
67
|
};
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
/**
|
|
71
|
-
* 封装了一下 antd 的 useStyle
|
|
72
|
-
* @param componentName {string} 组件的名字
|
|
73
|
-
* @param styleFn {GenerateStyle} 生成样式的函数
|
|
74
|
-
* @returns UseStyleResult
|
|
70
|
+
/**
|
|
71
|
+
* 封装了一下 antd 的 useStyle
|
|
72
|
+
* @param componentName {string} 组件的名字
|
|
73
|
+
* @param styleFn {GenerateStyle} 生成样式的函数
|
|
74
|
+
* @returns UseStyleResult
|
|
75
75
|
*/
|
|
76
76
|
function useStyle(componentName, styleFn) {
|
|
77
77
|
var _token$vtxComponentsC;
|
package/lib/vtx-search/index.js
CHANGED
|
@@ -11,12 +11,14 @@ var _ahooks = require("ahooks");
|
|
|
11
11
|
var _antd = require("antd");
|
|
12
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
-
var _react = require("react");
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
15
|
var _useColSize = _interopRequireDefault(require("../utils/useColSize"));
|
|
16
16
|
var _TableLayout = require("../vtx-page-layout/TableLayout");
|
|
17
17
|
var _index = require("./style/index");
|
|
18
18
|
var _vtxProvider = require("../vtx-provider");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
+
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); }
|
|
21
|
+
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; }
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
23
|
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; }
|
|
22
24
|
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; }
|
|
@@ -33,6 +35,18 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
33
35
|
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; }
|
|
34
36
|
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; } }
|
|
35
37
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
38
|
+
var hasRenderableChildren = function hasRenderableChildren(children) {
|
|
39
|
+
var result = false;
|
|
40
|
+
_react.Children.forEach(children, function (child) {
|
|
41
|
+
if (result) return;
|
|
42
|
+
if ( /*#__PURE__*/(0, _react.isValidElement)(child) && child.type === _react.Fragment) {
|
|
43
|
+
result = hasRenderableChildren(child.props.children);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
result = child !== null && child !== undefined && typeof child !== 'boolean';
|
|
47
|
+
});
|
|
48
|
+
return result;
|
|
49
|
+
};
|
|
36
50
|
function VtxSearch(props) {
|
|
37
51
|
var intl = (0, _vtxProvider.useIntl)();
|
|
38
52
|
var _useContext = (0, _react.useContext)(_vtxProvider.VtxProvider),
|
|
@@ -61,10 +75,6 @@ function VtxSearch(props) {
|
|
|
61
75
|
isClearButton = _props$isClearButton === void 0 ? true : _props$isClearButton,
|
|
62
76
|
_props$isMoreButton = props.isMoreButton,
|
|
63
77
|
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
78
|
onConfirm = props.onConfirm,
|
|
69
79
|
onClear = props.onClear,
|
|
70
80
|
renderButtons = props.renderButtons,
|
|
@@ -72,7 +82,15 @@ function VtxSearch(props) {
|
|
|
72
82
|
showAll = _props$showAll === void 0 ? false : _props$showAll,
|
|
73
83
|
onToggleShow = props.onToggleShow,
|
|
74
84
|
_props$customEnumText = props.customEnumText,
|
|
75
|
-
customEnumText = _props$customEnumText === void 0 ? {
|
|
85
|
+
customEnumText = _props$customEnumText === void 0 ? {
|
|
86
|
+
confirmText: intl.getMessage('tableForm.search', '查询'),
|
|
87
|
+
//确认按钮文本
|
|
88
|
+
clearText: intl.getMessage('tableForm.reset', '重置'),
|
|
89
|
+
//情况按钮文本
|
|
90
|
+
collapseText: intl.getMessage('tableForm.expand', '收起'),
|
|
91
|
+
//情况按钮文本
|
|
92
|
+
expandText: intl.getMessage('tableForm.collapsed', '展开') //情况按钮文本
|
|
93
|
+
} : _props$customEnumText;
|
|
76
94
|
var vtxSearchRef = (0, _react.useRef)();
|
|
77
95
|
var ref = (0, _react.useRef)();
|
|
78
96
|
var size = (0, _useColSize.default)(vtxSearchRef);
|
|
@@ -134,6 +152,8 @@ function VtxSearch(props) {
|
|
|
134
152
|
cumulativeWeight: cumulativeWeight
|
|
135
153
|
};
|
|
136
154
|
}, [JSON.stringify(props.gridWeight), size]);
|
|
155
|
+
var hasMoreButton = isMoreButton && grid.len > realColumn - 1;
|
|
156
|
+
var hasButtons = renderButtons ? hasRenderableChildren(renderButtons) : isConfirmButton || isClearButton || hasMoreButton;
|
|
137
157
|
|
|
138
158
|
// 需要显示的位置
|
|
139
159
|
var showPosition = (0, _react.useMemo)(function () {
|
|
@@ -285,7 +305,7 @@ function VtxSearch(props) {
|
|
|
285
305
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Row, {
|
|
286
306
|
gutter: 24,
|
|
287
307
|
attr: "row",
|
|
288
|
-
children: [analyzeChildren(newChildren), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Col, {
|
|
308
|
+
children: [analyzeChildren(newChildren), hasButtons && /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Col, {
|
|
289
309
|
span: 24 / realColumn * 1,
|
|
290
310
|
offset: btnOffset,
|
|
291
311
|
className: "vtx-search-buttons-content",
|
|
@@ -302,7 +322,7 @@ function VtxSearch(props) {
|
|
|
302
322
|
},
|
|
303
323
|
type: "primary",
|
|
304
324
|
onClick: onConfirm,
|
|
305
|
-
children: confirmText
|
|
325
|
+
children: customEnumText.confirmText
|
|
306
326
|
})
|
|
307
327
|
}), isClearButton && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
308
328
|
"data-type": 'bt',
|
|
@@ -312,18 +332,18 @@ function VtxSearch(props) {
|
|
|
312
332
|
width: '100%'
|
|
313
333
|
},
|
|
314
334
|
onClick: onClear,
|
|
315
|
-
children: clearText
|
|
335
|
+
children: customEnumText.clearText
|
|
316
336
|
})
|
|
317
|
-
}),
|
|
337
|
+
}), hasMoreButton && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
318
338
|
"data-type": 'bt',
|
|
319
339
|
onClick: function onClick() {
|
|
320
340
|
return setShowMore(!showMore);
|
|
321
341
|
},
|
|
322
342
|
className: (0, _classnames.default)("".concat(_index.prefix, "-more"), hashId),
|
|
323
343
|
children: showMore ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
324
|
-
children: [
|
|
344
|
+
children: [customEnumText.collapseText, /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.UpOutlined, {})]
|
|
325
345
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
326
|
-
children: [
|
|
346
|
+
children: [customEnumText.expandText, /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.DownOutlined, {})]
|
|
327
347
|
})
|
|
328
348
|
})]
|
|
329
349
|
})
|
|
@@ -77,14 +77,17 @@ var genVtxStyle = function genVtxStyle(token) {
|
|
|
77
77
|
alignItems: 'flex-end',
|
|
78
78
|
justifyContent: 'flex-end',
|
|
79
79
|
gap: 12
|
|
80
|
-
})), "".concat(componentCls, "-more"), {
|
|
80
|
+
})), "".concat(componentCls, "-more"), _defineProperty({
|
|
81
81
|
height: 32,
|
|
82
82
|
color: token.colorPrimary,
|
|
83
83
|
cursor: 'pointer',
|
|
84
84
|
whiteSpace: 'nowrap',
|
|
85
85
|
alignItems: 'center',
|
|
86
|
-
display: 'flex'
|
|
87
|
-
|
|
86
|
+
display: 'flex',
|
|
87
|
+
gap: '7px'
|
|
88
|
+
}, '.anticon', {
|
|
89
|
+
fontSize: '10px'
|
|
90
|
+
})));
|
|
88
91
|
};
|
|
89
92
|
function useStyle() {
|
|
90
93
|
return (0, _vtxProvider.useStyle)(prefix, function (token) {
|
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,9 +13,13 @@ 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 = ["key", "value", "children"],
|
|
18
|
+
_excluded3 = ["onSearch", "optionFilterProp"];
|
|
17
19
|
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
20
|
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
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
+
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
23
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
21
24
|
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
25
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
@@ -27,6 +30,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
27
30
|
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; }
|
|
28
31
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
29
32
|
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); }
|
|
33
|
+
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; }
|
|
34
|
+
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; }
|
|
30
35
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
31
36
|
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."); }
|
|
32
37
|
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); }
|
|
@@ -34,6 +39,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
34
39
|
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; } }
|
|
35
40
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
36
41
|
var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
42
|
+
var _props$options;
|
|
37
43
|
var intl = (0, _vtxProvider.useIntl)();
|
|
38
44
|
var _useState = (0, _react.useState)(0),
|
|
39
45
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -66,16 +72,25 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
66
72
|
_props$defaultBindBod = props.defaultBindBodyToPopupContainer,
|
|
67
73
|
defaultBindBodyToPopupContainer = _props$defaultBindBod === void 0 ? true : _props$defaultBindBod,
|
|
68
74
|
_props$customEnumText = props.customEnumText,
|
|
69
|
-
customEnumText = _props$customEnumText === void 0 ? {} : _props$customEnumText
|
|
75
|
+
customEnumText = _props$customEnumText === void 0 ? {} : _props$customEnumText,
|
|
76
|
+
showSearch = props.showSearch,
|
|
77
|
+
optionFilterProp = props.optionFilterProp,
|
|
78
|
+
_onSearch = props.onSearch,
|
|
79
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
70
80
|
var TextEnum = _objectSpread({
|
|
71
81
|
selectAllText: intl.getMessage('select.selectAll', '全选'),
|
|
72
82
|
defaultPlaceholderText: intl.getMessage('tableForm.selectPlaceholder', '请选择'),
|
|
73
83
|
emptyDescriptionText: intl.getMessage('select.empty', '暂无数据')
|
|
74
84
|
}, customEnumText);
|
|
85
|
+
var _useContext = (0, _react.useContext)(_vtxProvider.VtxProvider),
|
|
86
|
+
getPrefixCls = _useContext.getPrefixCls;
|
|
87
|
+
var prefixCls = getPrefixCls('select', props.prefixCls);
|
|
88
|
+
var _useStyle = (0, _style.useStyle)(prefixCls),
|
|
89
|
+
wrapSSR = _useStyle.wrapSSR,
|
|
90
|
+
hashId = _useStyle.hashId;
|
|
75
91
|
(0, _react.useEffect)(function () {
|
|
76
92
|
if ((mode === 'multiple' || mode === 'tags') && elRef.current) {
|
|
77
93
|
var element = elRef.current;
|
|
78
|
-
|
|
79
94
|
// 立即设置一次
|
|
80
95
|
setPopWidth(element.clientWidth);
|
|
81
96
|
|
|
@@ -100,21 +115,67 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
100
115
|
};
|
|
101
116
|
}
|
|
102
117
|
}, [mode]);
|
|
103
|
-
var
|
|
118
|
+
var mergedChildren = Array.isArray(props.children) ? props.children : _react.default.Children.toArray(props.children);
|
|
119
|
+
var optionsAsElements = ((_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.map(function (v) {
|
|
120
|
+
var _v$key;
|
|
121
|
+
return /*#__PURE__*/_react.default.isValidElement(v) ? v : /*#__PURE__*/_react.default.createElement(_antd.Select.Option, {
|
|
122
|
+
key: (_v$key = v.key) !== null && _v$key !== void 0 ? _v$key : v.value,
|
|
123
|
+
value: v.value,
|
|
124
|
+
label: v.label
|
|
125
|
+
});
|
|
126
|
+
})) || [];
|
|
127
|
+
var normalizeChild = function normalizeChild(child) {
|
|
128
|
+
var _ref;
|
|
129
|
+
if (! /*#__PURE__*/_react.default.isValidElement(child)) return child;
|
|
130
|
+
var _child$props = child.props,
|
|
131
|
+
key = _child$props.key,
|
|
132
|
+
value = _child$props.value,
|
|
133
|
+
label = _child$props.children,
|
|
134
|
+
rest = _objectWithoutProperties(_child$props, _excluded2);
|
|
135
|
+
var optionValue = (_ref = value !== null && value !== void 0 ? value : key) !== null && _ref !== void 0 ? _ref : child.key;
|
|
136
|
+
return /*#__PURE__*/_react.default.cloneElement(child, _objectSpread(_objectSpread({}, rest), {}, {
|
|
137
|
+
key: key,
|
|
138
|
+
value: optionValue
|
|
139
|
+
}));
|
|
140
|
+
};
|
|
141
|
+
var finalChildren = [].concat(_toConsumableArray(optionsAsElements), _toConsumableArray(mergedChildren.map(normalizeChild)));
|
|
142
|
+
var getOptionValue = function getOptionValue(item) {
|
|
143
|
+
var _ref2, _itemProps$value;
|
|
144
|
+
var itemProps = (item === null || item === void 0 ? void 0 : item.props) || {};
|
|
145
|
+
return (_ref2 = (_itemProps$value = itemProps.value) !== null && _itemProps$value !== void 0 ? _itemProps$value : item.value) !== null && _ref2 !== void 0 ? _ref2 : item.key;
|
|
146
|
+
};
|
|
147
|
+
var getOptionLabel = function getOptionLabel(item) {
|
|
148
|
+
var _ref3, _itemProps$children;
|
|
149
|
+
var itemProps = (item === null || item === void 0 ? void 0 : item.props) || {};
|
|
150
|
+
return (_ref3 = (_itemProps$children = itemProps.children) !== null && _itemProps$children !== void 0 ? _itemProps$children : itemProps.label) !== null && _ref3 !== void 0 ? _ref3 : item.label;
|
|
151
|
+
};
|
|
152
|
+
var getSelectedValue = function getSelectedValue(item) {
|
|
153
|
+
if ((0, _utils.isObject)(item)) {
|
|
154
|
+
var _item$value;
|
|
155
|
+
return (_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : item.key;
|
|
156
|
+
}
|
|
157
|
+
return item;
|
|
158
|
+
};
|
|
159
|
+
var normalizedOptions = finalChildren.filter(_react.default.isValidElement).map(function (item) {
|
|
160
|
+
return {
|
|
161
|
+
value: getOptionValue(item),
|
|
162
|
+
label: getOptionLabel(item),
|
|
163
|
+
raw: item
|
|
164
|
+
};
|
|
165
|
+
});
|
|
104
166
|
var getContent = function getContent() {
|
|
105
167
|
var child = {};
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
child[item.key] = item === null || item === void 0 || (_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.children;
|
|
168
|
+
normalizedOptions.forEach(function (item) {
|
|
169
|
+
child[item.value] = item.label;
|
|
109
170
|
});
|
|
110
171
|
var getChildren = function getChildren() {
|
|
111
172
|
var child = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
112
173
|
var value = arguments.length > 1 ? arguments[1] : undefined;
|
|
113
|
-
var key = (
|
|
174
|
+
var key = getSelectedValue(value);
|
|
114
175
|
return child[key] || '';
|
|
115
176
|
};
|
|
116
177
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
117
|
-
className: "
|
|
178
|
+
className: (0, _classnames2.default)("".concat(prefixCls, "-all-list"), hashId),
|
|
118
179
|
children: Array.isArray(value) && value.length ? value.map(function (item, index) {
|
|
119
180
|
var name = getChildren(child, item);
|
|
120
181
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tag, {
|
|
@@ -126,10 +187,13 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
126
187
|
e.preventDefault();
|
|
127
188
|
var valueClone = _toConsumableArray(value);
|
|
128
189
|
valueClone.splice(index, 1);
|
|
129
|
-
var
|
|
130
|
-
|
|
190
|
+
var selectedValueSet = new Set(valueClone.map(getSelectedValue));
|
|
191
|
+
var options = normalizedOptions.filter(function (ite) {
|
|
192
|
+
return selectedValueSet.has(ite.value);
|
|
193
|
+
}).map(function (ite) {
|
|
194
|
+
return ite.raw;
|
|
131
195
|
});
|
|
132
|
-
_onChange(valueClone, options);
|
|
196
|
+
_onChange && _onChange(valueClone, options);
|
|
133
197
|
},
|
|
134
198
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
135
199
|
title: name,
|
|
@@ -142,16 +206,45 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
142
206
|
})
|
|
143
207
|
});
|
|
144
208
|
};
|
|
145
|
-
var
|
|
146
|
-
|
|
147
|
-
|
|
209
|
+
var defaultOptionFilterProp = ['label', 'children'];
|
|
210
|
+
var handleSearch = function handleSearch(value) {
|
|
211
|
+
setSearchValue(value ? String(value).toLowerCase() : '');
|
|
212
|
+
_onSearch && _onSearch(value);
|
|
213
|
+
};
|
|
214
|
+
var getSearchProps = function getSearchProps() {
|
|
215
|
+
if (showSearch && _typeof(showSearch) === 'object') {
|
|
216
|
+
var showSearchOnSearch = showSearch.onSearch,
|
|
217
|
+
showSearchOptionFilterProp = showSearch.optionFilterProp,
|
|
218
|
+
searchConfig = _objectWithoutProperties(showSearch, _excluded3);
|
|
219
|
+
return {
|
|
220
|
+
showSearch: _objectSpread(_objectSpread({}, searchConfig), {}, {
|
|
221
|
+
optionFilterProp: showSearchOptionFilterProp || optionFilterProp || defaultOptionFilterProp,
|
|
222
|
+
onSearch: function onSearch(value) {
|
|
223
|
+
setSearchValue(value ? String(value).toLowerCase() : '');
|
|
224
|
+
showSearchOnSearch && showSearchOnSearch(value);
|
|
225
|
+
_onSearch && _onSearch(value);
|
|
226
|
+
}
|
|
227
|
+
})
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
showSearch: showSearch === undefined ? true : showSearch,
|
|
232
|
+
optionFilterProp: optionFilterProp || defaultOptionFilterProp
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
var newProps = _objectSpread(_objectSpread(_objectSpread({}, getSearchProps()), {}, {
|
|
148
236
|
placeholder: TextEnum.defaultPlaceholderText,
|
|
149
|
-
allowClear: true
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
237
|
+
allowClear: true,
|
|
238
|
+
value: value,
|
|
239
|
+
mode: mode,
|
|
240
|
+
size: size,
|
|
241
|
+
//同步button大小
|
|
242
|
+
onChange: _onChange,
|
|
243
|
+
maxTagCount: maxTagCount,
|
|
244
|
+
maxTagTextLength: maxTagTextLength,
|
|
245
|
+
maxTagPlaceholder: maxTagPlaceholder
|
|
246
|
+
}, rest), {}, {
|
|
247
|
+
onSearch: handleSearch,
|
|
155
248
|
onBlur: function onBlur(e) {
|
|
156
249
|
setSearchValue('');
|
|
157
250
|
props.onBlur && props.onBlur(e);
|
|
@@ -174,13 +267,13 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
174
267
|
return e.preventDefault();
|
|
175
268
|
},
|
|
176
269
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Checkbox, {
|
|
177
|
-
indeterminate: valueLength && valueLength <
|
|
178
|
-
checked: valueLength && valueLength ===
|
|
270
|
+
indeterminate: valueLength && valueLength < finalChildren.length,
|
|
271
|
+
checked: valueLength && valueLength === finalChildren.length,
|
|
179
272
|
onChange: function onChange(e) {
|
|
180
273
|
if (e.target.checked) {
|
|
181
|
-
var tempChildren =
|
|
274
|
+
var tempChildren = finalChildren.filter(function (item) {
|
|
182
275
|
if (selectSearchAll && searchValue) {
|
|
183
|
-
return String(item
|
|
276
|
+
return String(getOptionLabel(item)).toLowerCase().indexOf(searchValue) > -1;
|
|
184
277
|
}
|
|
185
278
|
return true;
|
|
186
279
|
});
|
|
@@ -188,13 +281,13 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
188
281
|
if (props.labelInValue) {
|
|
189
282
|
keys = tempChildren.map(function (item) {
|
|
190
283
|
return {
|
|
191
|
-
label: item
|
|
192
|
-
value: item
|
|
284
|
+
label: getOptionLabel(item),
|
|
285
|
+
value: getOptionValue(item)
|
|
193
286
|
};
|
|
194
287
|
});
|
|
195
288
|
} else {
|
|
196
289
|
keys = tempChildren.map(function (item) {
|
|
197
|
-
return item
|
|
290
|
+
return getOptionValue(item);
|
|
198
291
|
});
|
|
199
292
|
}
|
|
200
293
|
_onChange && _onChange(keys, tempChildren);
|
|
@@ -214,21 +307,11 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
214
307
|
});
|
|
215
308
|
}
|
|
216
309
|
}
|
|
217
|
-
var _useContext = (0, _react.useContext)(_vtxProvider.VtxProvider),
|
|
218
|
-
getPrefixCls = _useContext.getPrefixCls;
|
|
219
|
-
var prefixCls = getPrefixCls('select', props.prefixCls);
|
|
220
|
-
var _useStyle = (0, _style.useStyle)(prefixCls),
|
|
221
|
-
wrapSSR = _useStyle.wrapSSR,
|
|
222
|
-
hashId = _useStyle.hashId;
|
|
223
310
|
return wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
224
|
-
className: (0,
|
|
225
|
-
'vtx-multi-select': mode == 'multiple' || mode == 'tags'
|
|
226
|
-
}),
|
|
311
|
+
className: (0, _classnames2.default)(prefixCls, hashId, _defineProperty({}, "".concat(prefixCls, "-multi"), mode == 'multiple' || mode == 'tags')),
|
|
227
312
|
id: elId.current,
|
|
228
313
|
ref: elRef,
|
|
229
|
-
style: _objectSpread(
|
|
230
|
-
paddingRight: (mode == 'multiple' || mode == 'tags') && showAll ? 32 : 0
|
|
231
|
-
}),
|
|
314
|
+
style: _objectSpread({}, props.style),
|
|
232
315
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Space.Compact, {
|
|
233
316
|
style: {
|
|
234
317
|
width: '100%'
|
|
@@ -246,7 +329,7 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
246
329
|
style: _objectSpread({
|
|
247
330
|
width: '100%'
|
|
248
331
|
}, selectStyle),
|
|
249
|
-
children:
|
|
332
|
+
children: finalChildren
|
|
250
333
|
})), (mode == 'multiple' || mode == 'tags') && showAll ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Popover, {
|
|
251
334
|
content: getContent(),
|
|
252
335
|
placement: "bottomRight",
|
|
@@ -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
|
});
|