@vtx/components 4.0.0-beta.8 → 4.0.0-beta.80
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/es/index.js +3 -0
- package/es/utils/filterSpecialCharacters.js +47 -46
- package/es/utils/index.js +1 -2
- package/es/vtx-combogrid/Combogrid.js +5 -4
- package/es/vtx-combogrid/index.js +7 -4
- package/es/vtx-datagrid/Store/Provide.js +106 -137
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -3
- 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/columnState.js +91 -0
- package/es/vtx-datagrid/index.js +124 -32
- 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-date-picker/QdatePicker.js +1 -1
- 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 +25 -25
- package/es/vtx-export-async/History.js +11 -3
- package/es/vtx-export-async/index.js +45 -15
- package/es/vtx-export-async/util.js +16 -5
- 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 +16 -16
- 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 +207 -65
- 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 +30 -19
- package/es/vtx-import2/style/index.js +60 -9
- package/es/vtx-modal/index.js +9 -4
- package/es/vtx-page-layout/style/index.js +4 -2
- package/es/vtx-provider/index.js +7 -3
- package/es/vtx-provider/locale/en_US.js +57 -3
- package/es/vtx-provider/locale/zh_CN.js +57 -3
- package/es/vtx-search/index.js +13 -9
- package/es/vtx-search/style/index.js +2 -1
- package/es/vtx-select/index.js +102 -36
- 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 +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 +98 -35
- package/es/vtx-tree-select/index.js +71 -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 +93 -39
- package/es/vtx-wang-editor/wangEditorUtil.js +4 -0
- package/lib/index.js +36 -0
- package/lib/utils/filterSpecialCharacters.js +48 -46
- package/lib/utils/index.js +0 -7
- package/lib/vtx-combogrid/Combogrid.js +5 -4
- package/lib/vtx-combogrid/index.js +7 -4
- package/lib/vtx-datagrid/Store/Provide.js +113 -143
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -3
- 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/columnState.js +100 -0
- package/lib/vtx-datagrid/index.js +124 -32
- 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-date-picker/QdatePicker.js +1 -1
- 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 +26 -26
- package/lib/vtx-export-async/History.js +11 -3
- package/lib/vtx-export-async/index.js +43 -13
- package/lib/vtx-export-async/util.js +16 -5
- 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 +16 -16
- 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 +205 -63
- 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 -18
- package/lib/vtx-import2/style/index.js +60 -9
- package/lib/vtx-modal/index.js +9 -4
- package/lib/vtx-page-layout/style/index.js +4 -2
- package/lib/vtx-provider/index.js +7 -3
- package/lib/vtx-provider/locale/en_US.js +57 -3
- package/lib/vtx-provider/locale/zh_CN.js +57 -3
- package/lib/vtx-search/index.js +13 -9
- package/lib/vtx-search/style/index.js +2 -1
- package/lib/vtx-select/index.js +104 -38
- 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 +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 +96 -33
- package/lib/vtx-tree-select/index.js +71 -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 +91 -37
- package/lib/vtx-wang-editor/wangEditorUtil.js +4 -0
- package/package.json +47 -32
- package/es/utils/hooks/useFetchData/index.js +0 -82
- package/lib/utils/hooks/useFetchData/index.js +0 -89
package/es/vtx-select/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
var _excluded = ["value", "mode", "size", "onChange", "maxTagCount", "maxTagTextLength", "maxTagPlaceholder", "showAll", "selectStyle", "selectAll", "selectSearchAll", "defaultBindBodyToPopupContainer", "customEnumText", "showSearch", "optionFilterProp", "onSearch"],
|
|
2
|
+
_excluded2 = ["onSearch", "optionFilterProp"];
|
|
1
3
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
4
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
5
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -9,6 +11,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
9
11
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
12
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
11
13
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
14
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
15
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
12
16
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
17
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
18
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -26,6 +30,7 @@ import { VtxProvider, useIntl } from "../vtx-provider";
|
|
|
26
30
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
31
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
32
|
var VtxSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
33
|
+
var _props$options;
|
|
29
34
|
var intl = useIntl();
|
|
30
35
|
var _useState = useState(0),
|
|
31
36
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -58,16 +63,25 @@ var VtxSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
58
63
|
_props$defaultBindBod = props.defaultBindBodyToPopupContainer,
|
|
59
64
|
defaultBindBodyToPopupContainer = _props$defaultBindBod === void 0 ? true : _props$defaultBindBod,
|
|
60
65
|
_props$customEnumText = props.customEnumText,
|
|
61
|
-
customEnumText = _props$customEnumText === void 0 ? {} : _props$customEnumText
|
|
66
|
+
customEnumText = _props$customEnumText === void 0 ? {} : _props$customEnumText,
|
|
67
|
+
showSearch = props.showSearch,
|
|
68
|
+
optionFilterProp = props.optionFilterProp,
|
|
69
|
+
_onSearch = props.onSearch,
|
|
70
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
62
71
|
var TextEnum = _objectSpread({
|
|
63
72
|
selectAllText: intl.getMessage('select.selectAll', '全选'),
|
|
64
73
|
defaultPlaceholderText: intl.getMessage('tableForm.selectPlaceholder', '请选择'),
|
|
65
74
|
emptyDescriptionText: intl.getMessage('select.empty', '暂无数据')
|
|
66
75
|
}, customEnumText);
|
|
76
|
+
var _useContext = useContext(VtxProvider),
|
|
77
|
+
getPrefixCls = _useContext.getPrefixCls;
|
|
78
|
+
var prefixCls = getPrefixCls('select', props.prefixCls);
|
|
79
|
+
var _useStyle = useStyle(prefixCls),
|
|
80
|
+
wrapSSR = _useStyle.wrapSSR,
|
|
81
|
+
hashId = _useStyle.hashId;
|
|
67
82
|
useEffect(function () {
|
|
68
83
|
if ((mode === 'multiple' || mode === 'tags') && elRef.current) {
|
|
69
84
|
var element = elRef.current;
|
|
70
|
-
|
|
71
85
|
// 立即设置一次
|
|
72
86
|
setPopWidth(element.clientWidth);
|
|
73
87
|
|
|
@@ -92,21 +106,51 @@ var VtxSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
92
106
|
};
|
|
93
107
|
}
|
|
94
108
|
}, [mode]);
|
|
95
|
-
var newChildren = props.children ?
|
|
109
|
+
var newChildren = props.children ? React.Children.toArray(props.children) : ((_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.map(function (v) {
|
|
110
|
+
return _objectSpread(_objectSpread({}, v), {}, {
|
|
111
|
+
key: v.value,
|
|
112
|
+
props: _objectSpread(_objectSpread({}, v), {}, {
|
|
113
|
+
children: v.label
|
|
114
|
+
})
|
|
115
|
+
});
|
|
116
|
+
})) || [];
|
|
117
|
+
var getOptionValue = function getOptionValue(item) {
|
|
118
|
+
var _ref, _itemProps$value;
|
|
119
|
+
var itemProps = (item === null || item === void 0 ? void 0 : item.props) || {};
|
|
120
|
+
return (_ref = (_itemProps$value = itemProps.value) !== null && _itemProps$value !== void 0 ? _itemProps$value : item.value) !== null && _ref !== void 0 ? _ref : item.key;
|
|
121
|
+
};
|
|
122
|
+
var getOptionLabel = function getOptionLabel(item) {
|
|
123
|
+
var _ref2, _itemProps$children;
|
|
124
|
+
var itemProps = (item === null || item === void 0 ? void 0 : item.props) || {};
|
|
125
|
+
return (_ref2 = (_itemProps$children = itemProps.children) !== null && _itemProps$children !== void 0 ? _itemProps$children : itemProps.label) !== null && _ref2 !== void 0 ? _ref2 : item.label;
|
|
126
|
+
};
|
|
127
|
+
var getSelectedValue = function getSelectedValue(item) {
|
|
128
|
+
if (isObject(item)) {
|
|
129
|
+
var _item$value;
|
|
130
|
+
return (_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : item.key;
|
|
131
|
+
}
|
|
132
|
+
return item;
|
|
133
|
+
};
|
|
134
|
+
var normalizedOptions = newChildren.map(function (item) {
|
|
135
|
+
return {
|
|
136
|
+
value: getOptionValue(item),
|
|
137
|
+
label: getOptionLabel(item),
|
|
138
|
+
raw: item
|
|
139
|
+
};
|
|
140
|
+
});
|
|
96
141
|
var getContent = function getContent() {
|
|
97
142
|
var child = {};
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
child[item.key] = item === null || item === void 0 || (_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.children;
|
|
143
|
+
normalizedOptions.forEach(function (item) {
|
|
144
|
+
child[item.value] = item.label;
|
|
101
145
|
});
|
|
102
146
|
var getChildren = function getChildren() {
|
|
103
147
|
var child = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
104
148
|
var value = arguments.length > 1 ? arguments[1] : undefined;
|
|
105
|
-
var key =
|
|
149
|
+
var key = getSelectedValue(value);
|
|
106
150
|
return child[key] || '';
|
|
107
151
|
};
|
|
108
152
|
return /*#__PURE__*/_jsx("div", {
|
|
109
|
-
className: "
|
|
153
|
+
className: classnames("".concat(prefixCls, "-all-list"), hashId),
|
|
110
154
|
children: Array.isArray(value) && value.length ? value.map(function (item, index) {
|
|
111
155
|
var name = getChildren(child, item);
|
|
112
156
|
return /*#__PURE__*/_jsx(Tag, {
|
|
@@ -118,10 +162,13 @@ var VtxSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
118
162
|
e.preventDefault();
|
|
119
163
|
var valueClone = _toConsumableArray(value);
|
|
120
164
|
valueClone.splice(index, 1);
|
|
121
|
-
var
|
|
122
|
-
|
|
165
|
+
var selectedValueSet = new Set(valueClone.map(getSelectedValue));
|
|
166
|
+
var options = normalizedOptions.filter(function (ite) {
|
|
167
|
+
return selectedValueSet.has(ite.value);
|
|
168
|
+
}).map(function (ite) {
|
|
169
|
+
return ite.raw;
|
|
123
170
|
});
|
|
124
|
-
_onChange(valueClone, options);
|
|
171
|
+
_onChange && _onChange(valueClone, options);
|
|
125
172
|
},
|
|
126
173
|
children: /*#__PURE__*/_jsx(Tooltip, {
|
|
127
174
|
title: name,
|
|
@@ -134,16 +181,45 @@ var VtxSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
134
181
|
})
|
|
135
182
|
});
|
|
136
183
|
};
|
|
137
|
-
var
|
|
138
|
-
|
|
139
|
-
|
|
184
|
+
var defaultOptionFilterProp = ['label', 'children'];
|
|
185
|
+
var handleSearch = function handleSearch(value) {
|
|
186
|
+
setSearchValue(value ? String(value).toLowerCase() : '');
|
|
187
|
+
_onSearch && _onSearch(value);
|
|
188
|
+
};
|
|
189
|
+
var getSearchProps = function getSearchProps() {
|
|
190
|
+
if (showSearch && _typeof(showSearch) === 'object') {
|
|
191
|
+
var showSearchOnSearch = showSearch.onSearch,
|
|
192
|
+
showSearchOptionFilterProp = showSearch.optionFilterProp,
|
|
193
|
+
searchConfig = _objectWithoutProperties(showSearch, _excluded2);
|
|
194
|
+
return {
|
|
195
|
+
showSearch: _objectSpread(_objectSpread({}, searchConfig), {}, {
|
|
196
|
+
optionFilterProp: showSearchOptionFilterProp || optionFilterProp || defaultOptionFilterProp,
|
|
197
|
+
onSearch: function onSearch(value) {
|
|
198
|
+
setSearchValue(value ? String(value).toLowerCase() : '');
|
|
199
|
+
showSearchOnSearch && showSearchOnSearch(value);
|
|
200
|
+
_onSearch && _onSearch(value);
|
|
201
|
+
}
|
|
202
|
+
})
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
showSearch: showSearch === undefined ? true : showSearch,
|
|
207
|
+
optionFilterProp: optionFilterProp || defaultOptionFilterProp
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
var newProps = _objectSpread(_objectSpread(_objectSpread({}, getSearchProps()), {}, {
|
|
140
211
|
placeholder: TextEnum.defaultPlaceholderText,
|
|
141
|
-
allowClear: true
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
212
|
+
allowClear: true,
|
|
213
|
+
value: value,
|
|
214
|
+
mode: mode,
|
|
215
|
+
size: size,
|
|
216
|
+
//同步button大小
|
|
217
|
+
onChange: _onChange,
|
|
218
|
+
maxTagCount: maxTagCount,
|
|
219
|
+
maxTagTextLength: maxTagTextLength,
|
|
220
|
+
maxTagPlaceholder: maxTagPlaceholder
|
|
221
|
+
}, rest), {}, {
|
|
222
|
+
onSearch: handleSearch,
|
|
147
223
|
onBlur: function onBlur(e) {
|
|
148
224
|
setSearchValue('');
|
|
149
225
|
props.onBlur && props.onBlur(e);
|
|
@@ -172,7 +248,7 @@ var VtxSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
172
248
|
if (e.target.checked) {
|
|
173
249
|
var tempChildren = newChildren.filter(function (item) {
|
|
174
250
|
if (selectSearchAll && searchValue) {
|
|
175
|
-
return String(item
|
|
251
|
+
return String(getOptionLabel(item)).toLowerCase().indexOf(searchValue) > -1;
|
|
176
252
|
}
|
|
177
253
|
return true;
|
|
178
254
|
});
|
|
@@ -180,13 +256,13 @@ var VtxSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
180
256
|
if (props.labelInValue) {
|
|
181
257
|
keys = tempChildren.map(function (item) {
|
|
182
258
|
return {
|
|
183
|
-
label: item
|
|
184
|
-
value: item
|
|
259
|
+
label: getOptionLabel(item),
|
|
260
|
+
value: getOptionValue(item)
|
|
185
261
|
};
|
|
186
262
|
});
|
|
187
263
|
} else {
|
|
188
264
|
keys = tempChildren.map(function (item) {
|
|
189
|
-
return item
|
|
265
|
+
return getOptionValue(item);
|
|
190
266
|
});
|
|
191
267
|
}
|
|
192
268
|
_onChange && _onChange(keys, tempChildren);
|
|
@@ -206,21 +282,11 @@ var VtxSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
206
282
|
});
|
|
207
283
|
}
|
|
208
284
|
}
|
|
209
|
-
var _useContext = useContext(VtxProvider),
|
|
210
|
-
getPrefixCls = _useContext.getPrefixCls;
|
|
211
|
-
var prefixCls = getPrefixCls('select', props.prefixCls);
|
|
212
|
-
var _useStyle = useStyle(prefixCls),
|
|
213
|
-
wrapSSR = _useStyle.wrapSSR,
|
|
214
|
-
hashId = _useStyle.hashId;
|
|
215
285
|
return wrapSSR( /*#__PURE__*/_jsx("div", {
|
|
216
|
-
className: classnames(prefixCls, hashId, {
|
|
217
|
-
'vtx-multi-select': mode == 'multiple' || mode == 'tags'
|
|
218
|
-
}),
|
|
286
|
+
className: classnames(prefixCls, hashId, _defineProperty({}, "".concat(prefixCls, "-multi"), mode == 'multiple' || mode == 'tags')),
|
|
219
287
|
id: elId.current,
|
|
220
288
|
ref: elRef,
|
|
221
|
-
style: _objectSpread(
|
|
222
|
-
paddingRight: (mode == 'multiple' || mode == 'tags') && showAll ? 32 : 0
|
|
223
|
-
}),
|
|
289
|
+
style: _objectSpread({}, props.style),
|
|
224
290
|
children: /*#__PURE__*/_jsxs(Space.Compact, {
|
|
225
291
|
style: {
|
|
226
292
|
width: '100%'
|
|
@@ -7,66 +7,21 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
7
7
|
import { useStyle as useAntdStyle } from "../../vtx-provider";
|
|
8
8
|
var genVtxSelectStyle = function genVtxSelectStyle(token) {
|
|
9
9
|
var componentCls = token.componentCls;
|
|
10
|
-
return _defineProperty(_defineProperty({}, componentCls, {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
top: '0',
|
|
18
|
-
verticalAlign: 'top'
|
|
19
|
-
},
|
|
20
|
-
'.vtx-all-list': {
|
|
21
|
-
position: 'absolute',
|
|
22
|
-
zIndex: 999,
|
|
23
|
-
boxSizing: 'border-box',
|
|
24
|
-
width: '100%',
|
|
25
|
-
padding: '5px',
|
|
26
|
-
boxShadow: '0 2px 8px #d9d9d9',
|
|
27
|
-
backgroundColor: 'red !important'
|
|
28
|
-
},
|
|
29
|
-
'.ant-select-selection--multiple': {
|
|
30
|
-
maxHeight: '32px',
|
|
31
|
-
overflow: 'hidden'
|
|
32
|
-
}
|
|
33
|
-
}), '.vtx-multi-select', {
|
|
34
|
-
position: 'relative',
|
|
35
|
-
display: 'inline-block',
|
|
36
|
-
width: '100%',
|
|
37
|
-
maxHeight: '32px !important',
|
|
38
|
-
boxSizing: 'border-box',
|
|
39
|
-
'.vtx-select-count': {
|
|
40
|
-
position: 'absolute',
|
|
41
|
-
top: 0,
|
|
42
|
-
right: 0,
|
|
43
|
-
verticalAlign: 'top',
|
|
44
|
-
borderLeft: 'none',
|
|
45
|
-
borderTopLeftRadius: 0,
|
|
46
|
-
'border-bottom-left-radius': 0
|
|
47
|
-
},
|
|
48
|
-
'.vtx-all-list': {
|
|
49
|
-
position: 'absolute',
|
|
50
|
-
zIndex: 999,
|
|
51
|
-
boxSizing: 'border-box',
|
|
52
|
-
width: '100%',
|
|
53
|
-
padding: '5px',
|
|
54
|
-
boxShadow: '0 2px 8px #d9d9d9'
|
|
55
|
-
},
|
|
56
|
-
'.ant-select-selector': {
|
|
57
|
-
'border-top-right-radius': 0,
|
|
58
|
-
'border-bottom-right-radius': 0,
|
|
59
|
-
maxHeight: '32px !important',
|
|
60
|
-
overflow: 'hidden'
|
|
61
|
-
},
|
|
62
|
-
'.ant-select-selection--multiple': {
|
|
63
|
-
maxHeight: '32px',
|
|
64
|
-
overflow: 'hidden'
|
|
10
|
+
return _defineProperty(_defineProperty(_defineProperty({}, componentCls, _defineProperty({
|
|
11
|
+
width: "100%"
|
|
12
|
+
}, '.ant-select', {
|
|
13
|
+
overflow: "hidden"
|
|
14
|
+
})), "".concat(componentCls, "-multi"), {
|
|
15
|
+
".ant-select-content": {
|
|
16
|
+
flexWrap: "nowrap"
|
|
65
17
|
}
|
|
18
|
+
}), "".concat(componentCls, "-all-list"), {
|
|
19
|
+
maxHeight: 300,
|
|
20
|
+
overflowY: "auto"
|
|
66
21
|
});
|
|
67
22
|
};
|
|
68
23
|
export function useStyle(prefixCls) {
|
|
69
|
-
return useAntdStyle('
|
|
24
|
+
return useAntdStyle('', function (token) {
|
|
70
25
|
var vtxSelectToken = _objectSpread(_objectSpread({}, token), {}, {
|
|
71
26
|
componentCls: ".".concat(prefixCls)
|
|
72
27
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { forwardRef, useRef,
|
|
1
|
+
import React, { forwardRef, useRef, useLayoutEffect, useContext } from 'react';
|
|
2
2
|
import SignaturePad from 'signature_pad';
|
|
3
3
|
import debounce from 'lodash-es/debounce';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
@@ -44,7 +44,7 @@ var VtxSignature = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
44
44
|
clear();
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
useLayoutEffect(function () {
|
|
48
48
|
signaturePad.current = new SignaturePad(canvasRef.current, {
|
|
49
49
|
dotSize: dotSize,
|
|
50
50
|
minWidth: minWidth,
|
|
@@ -65,7 +65,9 @@ var VtxSignature = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
65
65
|
_onEnd && _onEnd();
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
|
-
|
|
68
|
+
setTimeout(function () {
|
|
69
|
+
resizeCanvas();
|
|
70
|
+
}, 0);
|
|
69
71
|
window.addEventListener('resize', debounce(resizeCanvas, 150));
|
|
70
72
|
return function () {
|
|
71
73
|
window.removeEventListener('resize', debounce(resizeCanvas, 150));
|
|
@@ -82,7 +84,6 @@ var VtxSignature = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
82
84
|
};
|
|
83
85
|
return wrapSSR( /*#__PURE__*/_jsxs("div", {
|
|
84
86
|
className: classnames(prefixCls, hashId),
|
|
85
|
-
ref: ref,
|
|
86
87
|
children: [/*#__PURE__*/_jsx("div", {
|
|
87
88
|
className: classnames("".concat(prefixCls, "--body")),
|
|
88
89
|
children: /*#__PURE__*/_jsx("canvas", {
|
|
@@ -11,7 +11,7 @@ var genVtxSignatureStyle = function genVtxSignatureStyle(token) {
|
|
|
11
11
|
position: 'relative',
|
|
12
12
|
display: 'flex',
|
|
13
13
|
flexDirection: 'column',
|
|
14
|
-
height:
|
|
14
|
+
height: 300,
|
|
15
15
|
padding: '16px',
|
|
16
16
|
backgroundColor: token.colorBgBase,
|
|
17
17
|
border: "1px solid ".concat(token.colorBorder),
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["children", "defaultSize", "minSize", "maxSize", "style", "direction", "orientation", "handle", "draggerIcon"];
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
+
import { Splitter } from 'antd';
|
|
1
11
|
import classnames from 'classnames';
|
|
2
|
-
import React, { cloneElement,
|
|
3
|
-
import { Panel, PanelGroup, PanelResizeHandle } from 'react-resizable-panels';
|
|
4
|
-
import Resizer from "./Resizer";
|
|
5
|
-
import { useStyle } from "./style";
|
|
12
|
+
import React, { cloneElement, Fragment, useContext } from 'react';
|
|
6
13
|
import { VtxProvider } from "../vtx-provider";
|
|
14
|
+
import { useStyle } from "./style";
|
|
7
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
16
|
function removeNullChildren(children) {
|
|
11
17
|
return React.Children.toArray(children).filter(function (c) {
|
|
12
18
|
return c;
|
|
@@ -19,42 +25,44 @@ function VtxSplitPane(props) {
|
|
|
19
25
|
var _useStyle = useStyle(prefixCls),
|
|
20
26
|
wrapSSR = _useStyle.wrapSSR,
|
|
21
27
|
hashId = _useStyle.hashId;
|
|
22
|
-
var splitPane = useRef();
|
|
23
28
|
var children = props.children,
|
|
29
|
+
defaultSize = props.defaultSize,
|
|
30
|
+
minSize = props.minSize,
|
|
31
|
+
maxSize = props.maxSize,
|
|
24
32
|
style = props.style,
|
|
25
|
-
|
|
26
|
-
|
|
33
|
+
direction = props.direction,
|
|
34
|
+
orientation = props.orientation,
|
|
35
|
+
handle = props.handle,
|
|
36
|
+
draggerIcon = props.draggerIcon,
|
|
37
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
27
38
|
var notNullChildren = removeNullChildren(children);
|
|
28
|
-
var
|
|
39
|
+
var mergedOrientation = orientation || direction;
|
|
40
|
+
var mergedDraggerIcon = draggerIcon !== null && draggerIcon !== void 0 ? draggerIcon : handle;
|
|
29
41
|
return wrapSSR( /*#__PURE__*/_jsx("div", {
|
|
30
|
-
className: classnames("".concat(prefixCls
|
|
31
|
-
ref: splitPane,
|
|
42
|
+
className: classnames("".concat(prefixCls), hashId),
|
|
32
43
|
style: style,
|
|
33
|
-
children: /*#__PURE__*/_jsx(
|
|
34
|
-
|
|
44
|
+
children: /*#__PURE__*/_jsx(Splitter, _objectSpread(_objectSpread({}, rest), {}, {
|
|
45
|
+
orientation: mergedOrientation,
|
|
46
|
+
draggerIcon: mergedDraggerIcon,
|
|
35
47
|
children: notNullChildren === null || notNullChildren === void 0 ? void 0 : notNullChildren.map(function (v, index) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
})
|
|
51
|
-
})]
|
|
52
|
-
});
|
|
48
|
+
var _v$props;
|
|
49
|
+
return /*#__PURE__*/_jsx(Fragment, {
|
|
50
|
+
children: /*#__PURE__*/cloneElement(notNullChildren[index], _objectSpread(_objectSpread(_objectSpread({}, index === 0 ? {
|
|
51
|
+
max: maxSize,
|
|
52
|
+
min: minSize,
|
|
53
|
+
defaultSize: defaultSize
|
|
54
|
+
} : {}), v.props), {}, {
|
|
55
|
+
collapsible: _objectSpread({
|
|
56
|
+
start: true,
|
|
57
|
+
end: true,
|
|
58
|
+
showCollapsibleIcon: 'auto'
|
|
59
|
+
}, (_v$props = v.props) === null || _v$props === void 0 ? void 0 : _v$props.collapsible)
|
|
60
|
+
}))
|
|
61
|
+
}, v.key || index);
|
|
53
62
|
})
|
|
54
|
-
})
|
|
63
|
+
}))
|
|
55
64
|
}));
|
|
56
65
|
}
|
|
57
66
|
VtxSplitPane.propTypes = {};
|
|
58
|
-
VtxSplitPane.
|
|
59
|
-
VtxSplitPane.Pane = Panel;
|
|
67
|
+
VtxSplitPane.Pane = Splitter.Panel;
|
|
60
68
|
export default VtxSplitPane;
|
|
@@ -7,121 +7,17 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
7
7
|
import { useStyle as useAntdStyle } from "../../vtx-provider";
|
|
8
8
|
var genVtxSplitPaneStyle = function genVtxSplitPaneStyle(token) {
|
|
9
9
|
var componentCls = token.componentCls;
|
|
10
|
-
return _defineProperty(
|
|
10
|
+
return _defineProperty({}, componentCls, {
|
|
11
11
|
height: '100%',
|
|
12
12
|
overflow: 'hidden',
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
height: '100%',
|
|
20
|
-
width: 6,
|
|
21
|
-
zIndex: 1
|
|
22
|
-
}, '&-left,&-right', {
|
|
23
|
-
position: 'absolute',
|
|
24
|
-
top: '50%',
|
|
25
|
-
zIndex: 1001,
|
|
26
|
-
opacity: 0,
|
|
27
|
-
width: '16px !important',
|
|
28
|
-
height: '24px !important',
|
|
29
|
-
backgroundColor: token.colorBorder,
|
|
30
|
-
color: token.colorTextSecondary,
|
|
31
|
-
borderColor: "transparent !important",
|
|
32
|
-
fontSize: 12,
|
|
33
|
-
'&:hover': {
|
|
34
|
-
color: token.colorTextSecondary,
|
|
35
|
-
backgroundColor: "".concat(token.colorPrimaryBg, " !important")
|
|
36
|
-
}
|
|
37
|
-
}), '&-left', {
|
|
38
|
-
transform: 'translate(-16px,-50%)'
|
|
39
|
-
}), '&-right', {
|
|
40
|
-
transform: 'translate(6px,-50%)'
|
|
41
|
-
}), '&::after', {
|
|
42
|
-
position: 'absolute',
|
|
43
|
-
content: "' '",
|
|
44
|
-
left: 0,
|
|
45
|
-
top: 0,
|
|
46
|
-
bottom: 0,
|
|
47
|
-
right: 4,
|
|
48
|
-
borderRadius: token.borderRadius
|
|
49
|
-
}), '&:hover', _defineProperty({}, '.vtx-split-pane-outer-resizer-left,.vtx-split-pane-outer-resizer-right', {
|
|
50
|
-
opacity: 1
|
|
51
|
-
})), '.ant-btn-icon', {
|
|
52
|
-
color: token.colorTextSecondary
|
|
53
|
-
})
|
|
54
|
-
}, "&[data-resize-handle-state='hover']", _defineProperty(_defineProperty({}, '.vtx-split-pane-outer-resizer-left,.vtx-split-pane-outer-resizer-right', {
|
|
55
|
-
opacity: 1
|
|
56
|
-
}), '.vtx-split-pane-outer-resizer::after', {
|
|
57
|
-
background: "linear-gradient(to bottom , rgba(0,0,0,0), ".concat(token.colorSplit, ", rgba(0,0,0,0)) !important")
|
|
58
|
-
})), "&[data-resize-handle-state='active']", _defineProperty(_defineProperty({}, '.vtx-split-pane-outer-resizer-left,.vtx-split-pane-outer-resizer-right', {
|
|
59
|
-
opacity: 1
|
|
60
|
-
}), '.vtx-split-pane-outer-resizer::after', {
|
|
61
|
-
background: "linear-gradient(to bottom , rgba(0,0,0,0), ".concat(token.colorSplit, ", rgba(0,0,0,0)) !important")
|
|
62
|
-
})), "&[data-resize-handle-state='drag']", _defineProperty(_defineProperty({}, '.vtx-split-pane-outer-resizer-left,.vtx-split-pane-outer-resizer-right', {
|
|
63
|
-
opacity: 1
|
|
64
|
-
}), '.vtx-split-pane-outer-resizer::after', {
|
|
65
|
-
background: "linear-gradient(to bottom , rgba(0,0,0,0), ".concat(token.colorSplit, ", rgba(0,0,0,0)) !important")
|
|
66
|
-
})), "&[data-resize-handle-state='inactive']", {
|
|
67
|
-
backgroundColor: 'transparent'
|
|
68
|
-
}),
|
|
69
|
-
'&-item': {
|
|
70
|
-
position: 'relative',
|
|
71
|
-
display: 'inline-block',
|
|
72
|
-
height: '100%',
|
|
73
|
-
verticalAlign: 'top'
|
|
13
|
+
backgroundColor: token.colorBgLayout,
|
|
14
|
+
'.ant-splitter-bar .ant-splitter-bar-dragger::before': {
|
|
15
|
+
background: 'transparent'
|
|
16
|
+
},
|
|
17
|
+
'.ant-splitter-bar .ant-splitter-bar-dragger-active::before': {
|
|
18
|
+
background: 'var(--ant-control-item-bg-active)'
|
|
74
19
|
}
|
|
75
|
-
}
|
|
76
|
-
borderRight: "1px solid ".concat(token.colorBorderSecondary),
|
|
77
|
-
'&:hover': {
|
|
78
|
-
borderRight: "1px solid ".concat(token.colorBorderSecondary),
|
|
79
|
-
transition: 'border-right 0.2s ease-in-out'
|
|
80
|
-
}
|
|
81
|
-
}), '&-resizer-right', {
|
|
82
|
-
borderLeft: "1px solid ".concat(token.colorBorderSecondary),
|
|
83
|
-
'&:hover': {
|
|
84
|
-
borderLeft: "1px solid ".concat(token.colorBorderSecondary),
|
|
85
|
-
transition: 'border-right 0.2s ease-in-out'
|
|
86
|
-
}
|
|
87
|
-
}), '&-resizer.disabled', {
|
|
88
|
-
cursor: 'not-allowed'
|
|
89
|
-
}), '&-resizer.disabled:hover', {
|
|
90
|
-
borderColor: 'transparent'
|
|
91
|
-
})), "".concat(componentCls, "-vertical"), _defineProperty({}, "".concat(componentCls, "-outer"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
92
|
-
'&-resizer': _defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
93
|
-
width: '100%',
|
|
94
|
-
height: 6
|
|
95
|
-
}, '&-left,&-right', {
|
|
96
|
-
top: 'auto',
|
|
97
|
-
left: '50%',
|
|
98
|
-
height: '16px !important',
|
|
99
|
-
width: '24px !important'
|
|
100
|
-
}), '&-left', {
|
|
101
|
-
transform: 'translate(-50%,-16px)'
|
|
102
|
-
}), '&-right', {
|
|
103
|
-
transform: 'translate(-50%, 6px)'
|
|
104
|
-
}), '&::after', {
|
|
105
|
-
left: 0,
|
|
106
|
-
top: 0,
|
|
107
|
-
bottom: 4,
|
|
108
|
-
right: 0
|
|
109
|
-
})
|
|
110
|
-
}, "&[data-resize-handle-state='hover']", _defineProperty(_defineProperty({}, '.vtx-split-pane-outer-resizer-left,.vtx-split-pane-outer-resizer-right', {
|
|
111
|
-
opacity: 1
|
|
112
|
-
}), '.vtx-split-pane-outer-resizer::after', {
|
|
113
|
-
background: "linear-gradient(to right , rgba(0,0,0,0), ".concat(token.colorSplit, ", rgba(0,0,0,0)) !important")
|
|
114
|
-
})), "&[data-resize-handle-state='active']", _defineProperty(_defineProperty({}, '.vtx-split-pane-outer-resizer-left,.vtx-split-pane-outer-resizer-right', {
|
|
115
|
-
opacity: 1
|
|
116
|
-
}), '.vtx-split-pane-outer-resizer::after', {
|
|
117
|
-
background: "linear-gradient(to right , rgba(0,0,0,0), ".concat(token.colorSplit, ", rgba(0,0,0,0)) !important")
|
|
118
|
-
})), "&[data-resize-handle-state='drag']", _defineProperty(_defineProperty({}, '.vtx-split-pane-outer-resizer-left,.vtx-split-pane-outer-resizer-right', {
|
|
119
|
-
opacity: 1
|
|
120
|
-
}), '.vtx-split-pane-outer-resizer::after', {
|
|
121
|
-
background: "linear-gradient(to right , rgba(0,0,0,0), ".concat(token.colorSplit, ", rgba(0,0,0,0)) !important")
|
|
122
|
-
})), "&[data-resize-handle-state='inactive']", {
|
|
123
|
-
backgroundColor: 'transparent'
|
|
124
|
-
})));
|
|
20
|
+
});
|
|
125
21
|
};
|
|
126
22
|
export function useStyle(prefixCls) {
|
|
127
23
|
return useAntdStyle(prefixCls, function (token) {
|
|
@@ -1,5 +1,6 @@
|
|
|
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 = ["value", "format"]
|
|
2
|
+
var _excluded = ["value", "format"],
|
|
3
|
+
_excluded2 = ["value", "format"];
|
|
3
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
6
|
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; }
|
|
@@ -12,6 +13,7 @@ import { TimePicker } from 'antd';
|
|
|
12
13
|
import dayjs from 'dayjs';
|
|
13
14
|
import PropTypes from 'prop-types';
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
var RangePicker = TimePicker.RangePicker;
|
|
15
17
|
var VtxTimePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
16
18
|
var value = props.value,
|
|
17
19
|
_props$format = props.format,
|
|
@@ -28,7 +30,31 @@ var VtxTimePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
28
30
|
}
|
|
29
31
|
}));
|
|
30
32
|
});
|
|
33
|
+
|
|
34
|
+
// 时间范围选择器
|
|
35
|
+
var VtxTimeRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
36
|
+
var value = props.value,
|
|
37
|
+
_props$format2 = props.format,
|
|
38
|
+
format = _props$format2 === void 0 ? 'HH:mm:ss' : _props$format2,
|
|
39
|
+
rest = _objectWithoutProperties(props, _excluded2);
|
|
40
|
+
var newValue = value && Array.isArray(value) ? value.map(function (item) {
|
|
41
|
+
return item ? dayjs.isDayjs(item) ? item : dayjs(item, format) : null;
|
|
42
|
+
}) : null;
|
|
43
|
+
return /*#__PURE__*/_jsx(RangePicker, _objectSpread(_objectSpread({
|
|
44
|
+
value: newValue,
|
|
45
|
+
format: format
|
|
46
|
+
}, rest), {}, {
|
|
47
|
+
ref: ref,
|
|
48
|
+
style: {
|
|
49
|
+
width: '100%'
|
|
50
|
+
}
|
|
51
|
+
}));
|
|
52
|
+
});
|
|
31
53
|
VtxTimePicker.displayName = 'VtxTimePicker';
|
|
54
|
+
VtxTimeRangePicker.displayName = 'VtxTimeRangePicker';
|
|
55
|
+
|
|
56
|
+
// 将范围选择器作为 VtxTimePicker 的属性
|
|
57
|
+
VtxTimePicker.VtxTimeRangePicker = VtxTimeRangePicker;
|
|
32
58
|
export { VtxTimePicker };
|
|
33
59
|
export default VtxTimePicker;
|
|
34
60
|
VtxTimePicker.propTypes = {
|