@para-ui/core 3.0.28 → 3.0.30
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/AutoBox/index.js +48 -88
- package/AutoTips/index.js +25 -32
- package/Breadcrumbs/index.js +43 -63
- package/Button/SplitButton.d.ts +1 -1
- package/Button/index.d.ts +1 -1
- package/Button/index.js +88 -118
- package/ButtonGroup/index.js +27 -36
- package/Carousel/index.d.ts +2 -2
- package/Carousel/index.js +27 -28
- package/Cascader/index.js +52 -64
- package/Checkbox/index.js +23 -39
- package/CheckboxGroup/index.js +31 -48
- package/Collapse/collapsePanel.d.ts +1 -1
- package/Collapse/index.d.ts +1 -1
- package/Collapse/index.js +9 -29
- package/Collapse/util.d.ts +2 -2
- package/CollapseBox/index.js +45 -56
- package/CollapseLayout/index.js +35 -54
- package/ComboSelect/index.js +222 -349
- package/ComboSelect/interface.d.ts +3 -3
- package/Container/index.js +17 -20
- package/DatePicker/generatePicker/index.d.ts +17 -17
- package/DatePicker/index.d.ts +4 -4
- package/DatePicker/index.js +111 -167
- package/Desktop/index.js +62 -173
- package/Drawer/index.js +65 -58
- package/Drawer/interface.d.ts +7 -3
- package/Dropdown/index.d.ts +1 -1
- package/Dropdown/index.js +3 -3
- package/Empty/index.js +17 -22
- package/Form/index.d.ts +1 -1
- package/Form/index.js +38 -80
- package/FormItem/index.d.ts +1 -1
- package/FormItem/index.js +11 -11
- package/FormItem/validateFunction.d.ts +1 -1
- package/FunctionModal/index.js +11 -11
- package/GlobalContext/index.js +3 -3
- package/GlobalContext/usePopupContainer.d.ts +1 -1
- package/Help/index.js +11 -11
- package/HelperText/index.js +11 -12
- package/InputLang/index.js +47 -80
- package/InputNumber/index.js +65 -100
- package/Label/index.js +15 -16
- package/Loading/index.js +6 -7
- package/Menu/index.js +148 -328
- package/Menu/interface.d.ts +2 -2
- package/Menu/verticalMenuList.d.ts +1 -1
- package/Message/index.d.ts +1 -1
- package/Message/index.js +45 -64
- package/Modal/Confirm/index.d.ts +2 -2
- package/Modal/index.d.ts +1 -1
- package/Modal/index.js +119 -152
- package/MultiBox/index.js +44 -76
- package/Notification/index.d.ts +2 -2
- package/Notification/index.js +51 -72
- package/OperateBtn/index.js +42 -70
- package/PageHeader/index.js +120 -286
- package/PageHeader/interface.d.ts +1 -1
- package/Pagination/index.d.ts +2 -2
- package/Pagination/index.js +79 -131
- package/ParauiProvider/index.js +2 -3
- package/PasswordRules/index.js +12 -30
- package/PopConfirm/index.d.ts +1 -1
- package/PopConfirm/index.js +52 -59
- package/Popover/index.js +8 -9
- package/Progress/index.d.ts +6 -6
- package/Progress/index.js +50 -89
- package/Querying/index.js +14 -17
- package/README.md +813 -800
- package/Radio/index.js +21 -33
- package/RadioGroup/index.js +32 -47
- package/Search/index.js +44 -66
- package/Select/index.js +176 -343
- package/SelectInput/index.js +8 -9
- package/Selector/index.js +285 -681
- package/SelectorPicker/index.js +62 -97
- package/SingleBox/index.js +30 -55
- package/Slider/index.d.ts +1 -1
- package/Slider/index.js +29 -41
- package/Slider/interface.d.ts +2 -2
- package/Split/index.js +10 -23
- package/Status/index.js +8 -7
- package/Stepper/index.d.ts +1 -1
- package/Stepper/index.js +20 -25
- package/Styles/form.scss +5 -5
- package/Styles/index.scss +37 -37
- package/Styles/normalize.scss +348 -348
- package/Styles/scrollbar.scss +223 -223
- package/Styles/theme.scss +74 -74
- package/Switch/index.d.ts +2 -2
- package/Switch/index.js +19 -20
- package/Table/index.js +568 -1019
- package/Table/interface.d.ts +5 -5
- package/Tabs/index.d.ts +3 -3
- package/Tabs/index.js +47 -65
- package/Tag/TagGroup.d.ts +1 -1
- package/Tag/index.d.ts +2 -2
- package/Tag/index.js +72 -107
- package/TextEditor/index.d.ts +2 -2
- package/TextEditor/index.js +81 -105
- package/TextField/index.js +141 -220
- package/TimePicker/index.d.ts +1 -1
- package/TimePicker/index.js +12 -15
- package/Timeline/index.js +42 -52
- package/Title/index.js +10 -9
- package/ToggleButton/ToggleButtonGroup.d.ts +1 -1
- package/ToggleButton/index.js +50 -70
- package/Tooltip/index.js +64 -98
- package/Tooltip/interface.d.ts +1 -1
- package/Transfer/index.d.ts +1 -1
- package/Transfer/index.js +114 -137
- package/Transfer/useClick.d.ts +1 -1
- package/Tree/index.js +10 -10
- package/Tree/interface.d.ts +6 -6
- package/Upload/Dragger/index.d.ts +1 -1
- package/Upload/ImageUpload/index.d.ts +1 -1
- package/Upload/ImgCrop/EasyCrop.d.ts +1 -1
- package/Upload/index.d.ts +1 -1
- package/Upload/index.js +283 -475
- package/Upload/interface.d.ts +2 -2
- package/_verture/{constant-bf34e6fa.js → constant-66aa48a1.js} +0 -1
- package/_verture/defineProperty-62acccfc.js +34 -0
- package/_verture/{index-342379c6.js → index-06fea29b.js} +79 -124
- package/_verture/{index-48875ffd.js → index-131f8fe5.js} +80 -181
- package/_verture/{index-31ce5a11.js → index-92144ad3.js} +238 -445
- package/_verture/{index-bbed73a3.js → index-be4faaee.js} +19 -61
- package/_verture/{intl-336570e4.js → intl-5cbb940c.js} +4 -12
- package/_verture/{modalContext-d646d9db.js → modalContext-c749e1c6.js} +18 -43
- package/_verture/{slicedToArray-d7722f4b.js → slicedToArray-77980792.js} +23 -25
- package/_verture/{toConsumableArray-f8047a75.js → toConsumableArray-87c7d895.js} +1 -1
- package/_verture/{useFormatMessage-f4452258.js → useFormatMessage-703f8b20.js} +1 -3
- package/_verture/{useGlobalProps-af9a2af6.js → useGlobalProps-1b846a65.js} +1 -2
- package/_verture/{usePopupContainer-b8ab7cab.js → usePopupContainer-87febeb9.js} +10 -25
- package/_verture/{util-a77b261e.js → util-7e1fb1e2.js} +2 -3
- package/index.d.ts +2 -4
- package/index.js +15 -16
- package/package.json +167 -168
- package/Test/index.d.ts +0 -3
- package/Test/index.js +0 -9
- package/_verture/defineProperty-0590dc61.js +0 -16
package/DatePicker/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import dayjsGenerateConfig from 'rc-picker/es/generate/dayjs';
|
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { Button } from '../Button/index.js';
|
|
4
4
|
import { Tag } from '../Tag/index.js';
|
|
5
|
-
import { _ as _defineProperty } from '../_verture/defineProperty-
|
|
5
|
+
import { a as _toPropertyKey, _ as _defineProperty } from '../_verture/defineProperty-62acccfc.js';
|
|
6
6
|
import { _ as _typeof } from '../_verture/typeof-498dd2b1.js';
|
|
7
7
|
import { _ as __rest } from '../_verture/tslib.es6-55ed4bd2.js';
|
|
8
8
|
import React__default from 'react';
|
|
@@ -11,15 +11,15 @@ import RCPicker, { RangePicker } from 'rc-picker';
|
|
|
11
11
|
import CloseCircle from '@para-ui/icons/CloseCircle';
|
|
12
12
|
import DateIcon from '@para-ui/icons/Calendar';
|
|
13
13
|
import TimeIcon from '@para-ui/icons/Time';
|
|
14
|
-
import { g as getTimeProps, a as getPlaceholder, m as mergedLocale, f as formatPickerValue, b as getPopupContainer, i as isolationPopupPollution, c as getRangePlaceholder } from '../_verture/index-
|
|
14
|
+
import { g as getTimeProps, a as getPlaceholder, m as mergedLocale, f as formatPickerValue, b as getPopupContainer, i as isolationPopupPollution, c as getRangePlaceholder } from '../_verture/index-be4faaee.js';
|
|
15
15
|
import CalendarLocale from 'rc-picker/lib/locale/en_US';
|
|
16
16
|
import CalendarLocale$1 from 'rc-picker/lib/locale/zh_CN';
|
|
17
17
|
import GlobalContext from '@para-ui/core/GlobalContext';
|
|
18
18
|
import Label from '../Label/index.js';
|
|
19
19
|
import HelperText from '../HelperText/index.js';
|
|
20
|
-
import { $ as $prefixCls } from '../_verture/constant-
|
|
20
|
+
import { $ as $prefixCls } from '../_verture/constant-66aa48a1.js';
|
|
21
21
|
import { UUID } from '@paraview/lib';
|
|
22
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-
|
|
22
|
+
import { _ as _slicedToArray } from '../_verture/slicedToArray-77980792.js';
|
|
23
23
|
import PickerArrowIcon from '@para-ui/icons/SortRight';
|
|
24
24
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
25
25
|
import '@para-ui/icons/LoadingF';
|
|
@@ -28,12 +28,12 @@ import '../Tooltip/index.js';
|
|
|
28
28
|
import 'rc-tooltip';
|
|
29
29
|
import 'rc-tooltip/lib/placements';
|
|
30
30
|
import '@para-ui/icons/Down';
|
|
31
|
-
import '../_verture/useFormatMessage-
|
|
31
|
+
import '../_verture/useFormatMessage-703f8b20.js';
|
|
32
32
|
import 'rc-dropdown';
|
|
33
|
-
import '../_verture/usePopupContainer-
|
|
33
|
+
import '../_verture/usePopupContainer-87febeb9.js';
|
|
34
34
|
import 'dayjs';
|
|
35
35
|
import '@para-ui/icons/Close';
|
|
36
|
-
import '../_verture/toConsumableArray-
|
|
36
|
+
import '../_verture/toConsumableArray-87c7d895.js';
|
|
37
37
|
import '../AutoTips/index.js';
|
|
38
38
|
import '@para-ui/icons/Plus';
|
|
39
39
|
import '../Help/index.js';
|
|
@@ -66,10 +66,9 @@ function _defineProperties(target, props) {
|
|
|
66
66
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
67
67
|
descriptor.configurable = true;
|
|
68
68
|
if ("value" in descriptor) descriptor.writable = true;
|
|
69
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
69
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
|
|
73
72
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
74
73
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
75
74
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
@@ -83,7 +82,6 @@ function _assertThisInitialized(self) {
|
|
|
83
82
|
if (self === void 0) {
|
|
84
83
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
85
84
|
}
|
|
86
|
-
|
|
87
85
|
return self;
|
|
88
86
|
}
|
|
89
87
|
|
|
@@ -99,7 +97,6 @@ function _inherits(subClass, superClass) {
|
|
|
99
97
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
100
98
|
throw new TypeError("Super expression must either be null or a function");
|
|
101
99
|
}
|
|
102
|
-
|
|
103
100
|
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
104
101
|
constructor: {
|
|
105
102
|
value: subClass,
|
|
@@ -119,7 +116,6 @@ function _possibleConstructorReturn(self, call) {
|
|
|
119
116
|
} else if (call !== void 0) {
|
|
120
117
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
121
118
|
}
|
|
122
|
-
|
|
123
119
|
return _assertThisInitialized(self);
|
|
124
120
|
}
|
|
125
121
|
|
|
@@ -135,6 +131,7 @@ var locale$3 = {
|
|
|
135
131
|
rangePlaceholder: ['Start time', 'End time']
|
|
136
132
|
};
|
|
137
133
|
|
|
134
|
+
// Merge into a locale object
|
|
138
135
|
var locale$2 = {
|
|
139
136
|
lang: Object.assign(Object.assign({
|
|
140
137
|
placeholder: 'Select date',
|
|
@@ -159,6 +156,7 @@ var locale$1 = {
|
|
|
159
156
|
rangePlaceholder: ['开始时间', '结束时间']
|
|
160
157
|
};
|
|
161
158
|
|
|
159
|
+
// 统一合并为完整的 Locale
|
|
162
160
|
var locale = {
|
|
163
161
|
lang: Object.assign(Object.assign({
|
|
164
162
|
placeholder: '请选择日期',
|
|
@@ -186,80 +184,68 @@ var ELocale = {
|
|
|
186
184
|
};
|
|
187
185
|
|
|
188
186
|
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
189
|
-
|
|
190
187
|
function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
191
|
-
|
|
188
|
+
//picker
|
|
192
189
|
function generatePicker$1(generateConfig) {
|
|
193
190
|
//生成picker
|
|
194
191
|
function getPicker(picker, displayName) {
|
|
195
192
|
var Picker = /*#__PURE__*/function (_React$Component) {
|
|
196
193
|
_inherits(Picker, _React$Component);
|
|
197
|
-
|
|
198
194
|
var _super = _createSuper$1(Picker);
|
|
199
|
-
|
|
200
195
|
function Picker(props) {
|
|
201
196
|
var _this;
|
|
202
|
-
|
|
203
197
|
_classCallCheck(this, Picker);
|
|
204
|
-
|
|
205
198
|
_this = _super.call(this, props);
|
|
206
199
|
_this.pickerRef = /*#__PURE__*/React__default.createRef();
|
|
207
200
|
_this.wrapRef = /*#__PURE__*/React__default.createRef();
|
|
208
201
|
_this.popupRecord = null;
|
|
209
202
|
_this.uuidRef = '';
|
|
210
|
-
|
|
211
203
|
_this.focus = function () {
|
|
212
204
|
if (_this.pickerRef.current) {
|
|
213
205
|
_this.pickerRef.current.focus();
|
|
214
206
|
}
|
|
215
207
|
};
|
|
216
|
-
|
|
217
208
|
_this.blur = function () {
|
|
218
209
|
if (_this.pickerRef.current) {
|
|
219
210
|
_this.pickerRef.current.blur();
|
|
220
211
|
}
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
|
|
212
|
+
};
|
|
213
|
+
//渲染
|
|
224
214
|
_this.renderPicker = function (locale) {
|
|
225
215
|
var _clsx;
|
|
226
|
-
|
|
227
216
|
var _a = _this.props,
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
217
|
+
className = _a.className;
|
|
218
|
+
_a.size;
|
|
219
|
+
var _a$bordered = _a.bordered,
|
|
220
|
+
bordered = _a$bordered === void 0 ? true : _a$bordered,
|
|
221
|
+
placeholder = _a.placeholder,
|
|
222
|
+
_a$error = _a.error,
|
|
223
|
+
error = _a$error === void 0 ? false : _a$error,
|
|
224
|
+
helperText = _a.helperText,
|
|
225
|
+
style = _a.style,
|
|
226
|
+
value = _a.value,
|
|
227
|
+
defaultValue = _a.defaultValue,
|
|
228
|
+
_a$label = _a.label,
|
|
229
|
+
label = _a$label === void 0 ? '' : _a$label,
|
|
230
|
+
labelTooltip = _a.labelTooltip,
|
|
231
|
+
_a$required = _a.required,
|
|
232
|
+
required = _a$required === void 0 ? false : _a$required,
|
|
233
|
+
customizeContainer = _a.getPopupContainer,
|
|
234
|
+
_a$isolationPopupOnHi = _a.isolationPopupOnHide,
|
|
235
|
+
isolationPopupOnHide = _a$isolationPopupOnHi === void 0 ? false : _a$isolationPopupOnHi,
|
|
236
|
+
restProps = __rest(_a, ["className", "size", "bordered", "placeholder", "error", "helperText", "style", "value", "defaultValue", "label", "labelTooltip", "required", "getPopupContainer", "isolationPopupOnHide"]);
|
|
249
237
|
var _this$props = _this.props,
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
238
|
+
format = _this$props.format,
|
|
239
|
+
showTime = _this$props.showTime,
|
|
240
|
+
use12Hours = _this$props.use12Hours;
|
|
253
241
|
var prefixCls = "".concat($prefixCls, "-picker");
|
|
254
242
|
var additionalProps = {
|
|
255
243
|
showToday: true
|
|
256
244
|
};
|
|
257
245
|
var additionalOverrideProps = {};
|
|
258
|
-
|
|
259
246
|
if (picker) {
|
|
260
247
|
additionalOverrideProps.picker = picker;
|
|
261
248
|
}
|
|
262
|
-
|
|
263
249
|
var mergedPicker = picker || _this.props.picker;
|
|
264
250
|
additionalOverrideProps = Object.assign(Object.assign(Object.assign({}, additionalOverrideProps), showTime ? getTimeProps(Object.assign({
|
|
265
251
|
format: format,
|
|
@@ -269,14 +255,13 @@ function generatePicker$1(generateConfig) {
|
|
|
269
255
|
}, _this.props), {
|
|
270
256
|
picker: mergedPicker
|
|
271
257
|
})) : {});
|
|
272
|
-
if (additionalOverrideProps.style) delete additionalOverrideProps.style;
|
|
273
|
-
|
|
258
|
+
if (additionalOverrideProps.style) delete additionalOverrideProps.style;
|
|
259
|
+
//格式化value
|
|
274
260
|
var getValue = function getValue(value) {
|
|
275
261
|
var innerFormat = format !== null && format !== void 0 ? format : pickerFormatMap[mergedPicker];
|
|
276
262
|
return formatPickerValue(value, innerFormat);
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
|
|
263
|
+
};
|
|
264
|
+
//渲染label
|
|
280
265
|
var renderLabel = function renderLabel() {
|
|
281
266
|
if (label || required) {
|
|
282
267
|
return jsx(Label, Object.assign({
|
|
@@ -284,27 +269,21 @@ function generatePicker$1(generateConfig) {
|
|
|
284
269
|
required: required
|
|
285
270
|
}, labelTooltip));
|
|
286
271
|
}
|
|
287
|
-
|
|
288
272
|
return null;
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
|
|
273
|
+
};
|
|
274
|
+
//处理浮层渲染容器
|
|
292
275
|
var handlePopupContainer = function handlePopupContainer(triggerNode) {
|
|
293
276
|
return getPopupContainer(triggerNode, customizeContainer, _assertThisInitialized(_this));
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
|
|
277
|
+
};
|
|
278
|
+
//open change
|
|
297
279
|
var handleOpenChange = function handleOpenChange(open) {
|
|
298
280
|
var _a;
|
|
299
|
-
|
|
300
281
|
(_a = restProps.onOpenChange) === null || _a === void 0 ? void 0 : _a.call(restProps, open);
|
|
301
|
-
|
|
302
282
|
if (isolationPopupOnHide) {
|
|
303
283
|
//关闭时隔离dom污染
|
|
304
284
|
isolationPopupPollution(open, _this.uuidRef);
|
|
305
285
|
}
|
|
306
286
|
};
|
|
307
|
-
|
|
308
287
|
return jsxs("div", Object.assign({
|
|
309
288
|
ref: _this.wrapRef,
|
|
310
289
|
className: clsx("".concat(prefixCls, "-wrapper"), className),
|
|
@@ -346,11 +325,9 @@ function generatePicker$1(generateConfig) {
|
|
|
346
325
|
})]
|
|
347
326
|
}));
|
|
348
327
|
};
|
|
349
|
-
|
|
350
328
|
_this.uuidRef = UUID();
|
|
351
329
|
return _this;
|
|
352
330
|
}
|
|
353
|
-
|
|
354
331
|
_createClass(Picker, [{
|
|
355
332
|
key: "componentWillUnmount",
|
|
356
333
|
value: function componentWillUnmount() {
|
|
@@ -361,16 +338,14 @@ function generatePicker$1(generateConfig) {
|
|
|
361
338
|
value: function render() {
|
|
362
339
|
//国际化
|
|
363
340
|
var _this$context = this.context,
|
|
364
|
-
|
|
365
|
-
|
|
341
|
+
language = _this$context.language,
|
|
342
|
+
locale = _this$context.locale;
|
|
366
343
|
var outerLocale = {};
|
|
367
|
-
|
|
368
344
|
if (locale) {
|
|
369
345
|
var t = locale[language || 'zh'];
|
|
370
346
|
if (t) outerLocale = t['DatePicker'];
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
|
|
347
|
+
}
|
|
348
|
+
//默认locale
|
|
374
349
|
var defaultLocale = ELocale[language || 'zh'];
|
|
375
350
|
var newLocale = mergedLocale(outerLocale, defaultLocale);
|
|
376
351
|
return jsx(Fragment, {
|
|
@@ -378,14 +353,11 @@ function generatePicker$1(generateConfig) {
|
|
|
378
353
|
});
|
|
379
354
|
}
|
|
380
355
|
}]);
|
|
381
|
-
|
|
382
356
|
return Picker;
|
|
383
357
|
}(React__default.Component);
|
|
384
|
-
|
|
385
358
|
Picker.contextType = GlobalContext;
|
|
386
359
|
return Picker;
|
|
387
360
|
}
|
|
388
|
-
|
|
389
361
|
var DatePicker = getPicker();
|
|
390
362
|
var WeekPicker = getPicker('week');
|
|
391
363
|
var MonthPicker = getPicker('month');
|
|
@@ -403,72 +375,62 @@ function generatePicker$1(generateConfig) {
|
|
|
403
375
|
}
|
|
404
376
|
|
|
405
377
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
406
|
-
|
|
407
378
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
408
|
-
|
|
379
|
+
//范围选择器
|
|
409
380
|
function generateRangePicker(generateConfig) {
|
|
410
381
|
var RangePicker$1 = /*#__PURE__*/function (_React$Component) {
|
|
411
382
|
_inherits(RangePicker$1, _React$Component);
|
|
412
|
-
|
|
413
383
|
var _super = _createSuper(RangePicker$1);
|
|
414
|
-
|
|
415
384
|
function RangePicker$1(props) {
|
|
416
385
|
var _this;
|
|
417
|
-
|
|
418
386
|
_classCallCheck(this, RangePicker$1);
|
|
419
|
-
|
|
420
387
|
_this = _super.call(this, props);
|
|
421
388
|
_this.pickerRef = /*#__PURE__*/React__default.createRef();
|
|
422
389
|
_this.wrapRef = /*#__PURE__*/React__default.createRef();
|
|
423
390
|
_this.popupRecord = null;
|
|
424
391
|
_this.uuidRef = '';
|
|
425
|
-
|
|
426
392
|
_this.focus = function () {
|
|
427
393
|
if (_this.pickerRef.current) {
|
|
428
394
|
_this.pickerRef.current.focus();
|
|
429
395
|
}
|
|
430
396
|
};
|
|
431
|
-
|
|
432
397
|
_this.blur = function () {
|
|
433
398
|
if (_this.pickerRef.current) {
|
|
434
399
|
_this.pickerRef.current.blur();
|
|
435
400
|
}
|
|
436
401
|
};
|
|
437
|
-
|
|
438
402
|
_this.renderPicker = function (locale) {
|
|
439
403
|
var _clsx, _clsx2;
|
|
440
|
-
|
|
441
404
|
var _a = _this.props,
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
405
|
+
className = _a.className;
|
|
406
|
+
_a.size;
|
|
407
|
+
var _a$bordered = _a.bordered,
|
|
408
|
+
bordered = _a$bordered === void 0 ? true : _a$bordered,
|
|
409
|
+
placeholder = _a.placeholder,
|
|
410
|
+
_a$error = _a.error,
|
|
411
|
+
error = _a$error === void 0 ? false : _a$error,
|
|
412
|
+
helperText = _a.helperText,
|
|
413
|
+
style = _a.style,
|
|
414
|
+
value = _a.value,
|
|
415
|
+
defaultValue = _a.defaultValue,
|
|
416
|
+
_a$label = _a.label,
|
|
417
|
+
label = _a$label === void 0 ? '' : _a$label,
|
|
418
|
+
labelTooltip = _a.labelTooltip,
|
|
419
|
+
_a$required = _a.required,
|
|
420
|
+
required = _a$required === void 0 ? false : _a$required,
|
|
421
|
+
shortcuts = _a.shortcuts,
|
|
422
|
+
ranges = _a.ranges,
|
|
423
|
+
_a$shortcutsPlacement = _a.shortcutsPlacement,
|
|
424
|
+
shortcutsPlacement = _a$shortcutsPlacement === void 0 ? 'right' : _a$shortcutsPlacement,
|
|
425
|
+
customizeContainer = _a.getPopupContainer,
|
|
426
|
+
_a$isolationPopupOnHi = _a.isolationPopupOnHide,
|
|
427
|
+
isolationPopupOnHide = _a$isolationPopupOnHi === void 0 ? false : _a$isolationPopupOnHi,
|
|
428
|
+
restProps = __rest(_a, ["className", "size", "bordered", "placeholder", "error", "helperText", "style", "value", "defaultValue", "label", "labelTooltip", "required", "shortcuts", "ranges", "shortcutsPlacement", "getPopupContainer", "isolationPopupOnHide"]);
|
|
467
429
|
var _this$props = _this.props,
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
430
|
+
format = _this$props.format,
|
|
431
|
+
showTime = _this$props.showTime,
|
|
432
|
+
picker = _this$props.picker,
|
|
433
|
+
use12Hours = _this$props.use12Hours;
|
|
472
434
|
var prefixCls = "".concat($prefixCls, "-picker");
|
|
473
435
|
var additionalOverrideProps = {};
|
|
474
436
|
additionalOverrideProps = Object.assign(Object.assign(Object.assign({}, additionalOverrideProps), showTime ? getTimeProps(Object.assign({
|
|
@@ -479,17 +441,16 @@ function generateRangePicker(generateConfig) {
|
|
|
479
441
|
}, _this.props), {
|
|
480
442
|
picker: picker
|
|
481
443
|
})) : {});
|
|
482
|
-
if (additionalOverrideProps.style) delete additionalOverrideProps.style;
|
|
483
|
-
|
|
444
|
+
if (additionalOverrideProps.style) delete additionalOverrideProps.style;
|
|
445
|
+
//格式化value
|
|
484
446
|
var getValue = function getValue(value) {
|
|
485
447
|
if (!Array.isArray(value)) return value;
|
|
486
448
|
var innerFormat = format !== null && format !== void 0 ? format : pickerFormatMap[picker];
|
|
487
449
|
return value.map(function (v) {
|
|
488
450
|
return formatPickerValue(v, innerFormat);
|
|
489
451
|
});
|
|
490
|
-
};
|
|
491
|
-
|
|
492
|
-
|
|
452
|
+
};
|
|
453
|
+
//渲染label
|
|
493
454
|
var renderLabel = function renderLabel() {
|
|
494
455
|
if (label || required) {
|
|
495
456
|
return jsx(Label, Object.assign({
|
|
@@ -497,32 +458,27 @@ function generateRangePicker(generateConfig) {
|
|
|
497
458
|
required: required
|
|
498
459
|
}, labelTooltip));
|
|
499
460
|
}
|
|
500
|
-
|
|
501
461
|
return null;
|
|
502
|
-
};
|
|
503
|
-
|
|
504
|
-
|
|
462
|
+
};
|
|
463
|
+
//预设时间快捷选择
|
|
505
464
|
var rangesObj = Object.assign({}, ranges);
|
|
506
|
-
|
|
507
465
|
if (shortcuts) {
|
|
508
466
|
shortcuts.forEach(function (_ref) {
|
|
509
467
|
var text = _ref.text,
|
|
510
|
-
|
|
468
|
+
value = _ref.value;
|
|
511
469
|
rangesObj[text] = value;
|
|
512
470
|
});
|
|
513
471
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
472
|
+
var hasShortcuts = !!Object.keys(rangesObj).length;
|
|
473
|
+
//dropdown cls
|
|
474
|
+
var dropdownCls = clsx(_this.uuidRef, restProps.dropdownClassName, "".concat($prefixCls, "-scrollbar-small"), (_clsx = {}, _defineProperty(_clsx, "".concat(prefixCls, "-use12Hours"), use12Hours), _defineProperty(_clsx, "".concat(prefixCls, "-shortcuts-").concat(shortcutsPlacement), hasShortcuts), _clsx));
|
|
475
|
+
//自定义面板渲染
|
|
519
476
|
var customPanelRender = function customPanelRender(originPanel) {
|
|
520
477
|
if (!hasShortcuts || shortcutsPlacement === 'bottom' || !showTime) return originPanel;
|
|
521
478
|
return React__default.Children.map(originPanel, function (panel) {
|
|
522
479
|
return React__default.Children.map(panel.props.children, function (child, idx) {
|
|
523
480
|
var _panel$props$children = _slicedToArray(panel.props.children, 2),
|
|
524
|
-
|
|
525
|
-
|
|
481
|
+
c2 = _panel$props$children[1];
|
|
526
482
|
if (idx === 0) {
|
|
527
483
|
//picker-panels
|
|
528
484
|
return jsxs("div", Object.assign({
|
|
@@ -531,29 +487,23 @@ function generateRangePicker(generateConfig) {
|
|
|
531
487
|
children: [child, c2]
|
|
532
488
|
}));
|
|
533
489
|
}
|
|
534
|
-
|
|
535
490
|
return child;
|
|
536
491
|
});
|
|
537
492
|
});
|
|
538
|
-
};
|
|
539
|
-
|
|
540
|
-
|
|
493
|
+
};
|
|
494
|
+
//处理浮层渲染容器
|
|
541
495
|
var handlePopupContainer = function handlePopupContainer(triggerNode) {
|
|
542
496
|
return getPopupContainer(triggerNode, customizeContainer, _assertThisInitialized(_this));
|
|
543
|
-
};
|
|
544
|
-
|
|
545
|
-
|
|
497
|
+
};
|
|
498
|
+
//open change
|
|
546
499
|
var handleOpenChange = function handleOpenChange(open) {
|
|
547
500
|
var _a;
|
|
548
|
-
|
|
549
501
|
(_a = restProps.onOpenChange) === null || _a === void 0 ? void 0 : _a.call(restProps, open);
|
|
550
|
-
|
|
551
502
|
if (isolationPopupOnHide) {
|
|
552
503
|
//关闭时隔离dom污染
|
|
553
504
|
isolationPopupPollution(open, _this.uuidRef);
|
|
554
505
|
}
|
|
555
506
|
};
|
|
556
|
-
|
|
557
507
|
return jsxs("div", Object.assign({
|
|
558
508
|
ref: _this.wrapRef,
|
|
559
509
|
className: clsx("".concat(prefixCls, "-wrapper"), className),
|
|
@@ -605,11 +555,9 @@ function generateRangePicker(generateConfig) {
|
|
|
605
555
|
})]
|
|
606
556
|
}));
|
|
607
557
|
};
|
|
608
|
-
|
|
609
558
|
_this.uuidRef = UUID();
|
|
610
559
|
return _this;
|
|
611
560
|
}
|
|
612
|
-
|
|
613
561
|
_createClass(RangePicker$1, [{
|
|
614
562
|
key: "componentWillUnmount",
|
|
615
563
|
value: function componentWillUnmount() {
|
|
@@ -620,16 +568,14 @@ function generateRangePicker(generateConfig) {
|
|
|
620
568
|
value: function render() {
|
|
621
569
|
//国际化
|
|
622
570
|
var _this$context = this.context,
|
|
623
|
-
|
|
624
|
-
|
|
571
|
+
language = _this$context.language,
|
|
572
|
+
locale = _this$context.locale;
|
|
625
573
|
var outerLocale = {};
|
|
626
|
-
|
|
627
574
|
if (locale) {
|
|
628
575
|
var t = locale[language || 'zh'];
|
|
629
576
|
if (t) outerLocale = t['DatePicker'];
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
|
|
577
|
+
}
|
|
578
|
+
//默认locale
|
|
633
579
|
var defaultLocale = ELocale[language || 'zh'];
|
|
634
580
|
var newLocale = mergedLocale(outerLocale, defaultLocale);
|
|
635
581
|
return jsx(Fragment, {
|
|
@@ -637,39 +583,37 @@ function generateRangePicker(generateConfig) {
|
|
|
637
583
|
});
|
|
638
584
|
}
|
|
639
585
|
}]);
|
|
640
|
-
|
|
641
586
|
return RangePicker$1;
|
|
642
587
|
}(React__default.Component);
|
|
643
|
-
|
|
644
588
|
RangePicker$1.contextType = GlobalContext;
|
|
645
589
|
return RangePicker$1;
|
|
646
590
|
}
|
|
647
591
|
|
|
592
|
+
//内部自定义组件
|
|
648
593
|
var Components = {
|
|
649
594
|
button: PickerButton,
|
|
650
595
|
rangeItem: PickerTag
|
|
651
|
-
};
|
|
652
|
-
|
|
596
|
+
};
|
|
597
|
+
//format map
|
|
653
598
|
var pickerFormatMap = {
|
|
654
599
|
'year': 'YYYY',
|
|
655
600
|
'quarter': 'YYYY-QQ',
|
|
656
601
|
'month': 'YYYY-MM',
|
|
657
602
|
'week': 'YYYY-WW',
|
|
658
603
|
'time': 'HH:mm:ss'
|
|
659
|
-
};
|
|
660
|
-
|
|
604
|
+
};
|
|
605
|
+
//picker 生成器
|
|
661
606
|
function generatePicker(generateConfig) {
|
|
662
607
|
var _generateSinglePicker = generatePicker$1(generateConfig),
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
608
|
+
DatePicker = _generateSinglePicker.DatePicker,
|
|
609
|
+
WeekPicker = _generateSinglePicker.WeekPicker,
|
|
610
|
+
MonthPicker = _generateSinglePicker.MonthPicker,
|
|
611
|
+
YearPicker = _generateSinglePicker.YearPicker,
|
|
612
|
+
TimePicker = _generateSinglePicker.TimePicker,
|
|
613
|
+
QuarterPicker = _generateSinglePicker.QuarterPicker;
|
|
614
|
+
//Range Picker
|
|
615
|
+
var RangePicker = generateRangePicker(generateConfig);
|
|
616
|
+
//合并类型
|
|
673
617
|
var MergedDatePicker = DatePicker;
|
|
674
618
|
MergedDatePicker.WeekPicker = WeekPicker;
|
|
675
619
|
MergedDatePicker.MonthPicker = MonthPicker;
|