@trionesdev/antd-taro-react 0.0.2-beta.2 → 0.0.2-beta.21
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/dist/ActionSheet/ActionSheet.d.ts +25 -0
- package/dist/ActionSheet/ActionSheet.js +77 -0
- package/dist/ActionSheet/index.d.ts +1 -1
- package/dist/ActionSheet/index.js +1 -1
- package/dist/ActionSheet/style.scss +52 -0
- package/dist/Button/button.d.ts +2 -1
- package/dist/Button/button.js +2 -3
- package/dist/Button/style.scss +65 -50
- package/dist/Calendar/calendar-grid.d.ts +10 -9
- package/dist/Calendar/calendar-grid.js +37 -62
- package/dist/Calendar/calendar-header.d.ts +3 -2
- package/dist/Calendar/calendar-header.js +9 -6
- package/dist/Calendar/calendar-range.d.ts +4 -3
- package/dist/Calendar/calendar-range.js +22 -18
- package/dist/Calendar/calendar.d.ts +5 -4
- package/dist/Calendar/calendar.js +30 -17
- package/dist/Calendar/style.scss +8 -5
- package/dist/Calendar/touchable-calendar-grid.d.ts +6 -5
- package/dist/Calendar/touchable-calendar-grid.js +87 -86
- package/dist/CalendarDatetimePicker/CalendarDatetimePicker.d.ts +3 -2
- package/dist/CalendarDatetimePicker/CalendarDatetimePicker.js +40 -57
- package/dist/CalendarDatetimePicker/DateTimeSwitch.d.ts +3 -2
- package/dist/CalendarDatetimePicker/DateTimeSwitch.js +2 -2
- package/dist/CalendarDatetimePicker/style.scss +11 -3
- package/dist/CalendarDatetimePickerCell/CalendarDatetimePickerCell.d.ts +9 -0
- package/dist/CalendarDatetimePickerCell/CalendarDatetimePickerCell.js +60 -0
- package/dist/CalendarDatetimePickerCell/index.d.ts +3 -0
- package/dist/CalendarDatetimePickerCell/index.js +2 -0
- package/dist/CalendarPicker/{calendar-picker.js → CalendarPicker.js} +10 -6
- package/dist/CalendarPicker/{calendar-range-picker.js → CalendarRangePicker.js} +8 -6
- package/dist/CalendarPicker/index.d.ts +3 -4
- package/dist/CalendarPicker/index.js +2 -2
- package/dist/CalendarPicker/style.scss +7 -6
- package/dist/CalendarPicker/types.d.ts +8 -6
- package/dist/CalendarPicker/types.js +1 -1
- package/dist/CalendarPickerCell/CalendarPickerCell.d.ts +11 -0
- package/dist/CalendarPickerCell/CalendarPickerCell.js +54 -0
- package/dist/CalendarPickerCell/CalendarRangePickerCell.d.ts +11 -0
- package/dist/CalendarPickerCell/CalendarRangePickerCell.js +56 -0
- package/dist/CalendarPickerCell/index.d.ts +8 -0
- package/dist/CalendarPickerCell/index.js +5 -0
- package/dist/CascaderPicker/cascader-picker.d.ts +27 -0
- package/dist/CascaderPicker/cascader-picker.js +90 -0
- package/dist/CascaderPicker/index.d.ts +1 -1
- package/dist/CascaderPicker/index.js +1 -1
- package/dist/CascaderPicker/style.scss +45 -0
- package/dist/CascaderPickerCell/CascaderPickerCell.d.ts +20 -0
- package/dist/CascaderPickerCell/CascaderPickerCell.js +70 -0
- package/dist/CascaderPickerCell/index.d.ts +3 -0
- package/dist/CascaderPickerCell/index.js +2 -0
- package/dist/DatePicker/DatePicker.d.ts +18 -0
- package/dist/DatePicker/DatePicker.js +310 -0
- package/dist/DatePicker/index.d.ts +4 -0
- package/dist/DatePicker/index.js +3 -0
- package/dist/DatePicker/style.scss +41 -0
- package/dist/DatePicker/types.d.ts +1 -0
- package/dist/DatePicker/types.js +1 -0
- package/dist/DatePickerCell/DatePickerCell.d.ts +16 -0
- package/dist/DatePickerCell/DatePickerCell.js +78 -0
- package/dist/DatePickerCell/index.d.ts +3 -0
- package/dist/DatePickerCell/index.js +2 -0
- package/dist/FetchPicker/FetchPicker.d.ts +78 -0
- package/dist/FetchPicker/FetchPicker.js +310 -0
- package/dist/FetchPicker/index.d.ts +4 -0
- package/dist/FetchPicker/index.js +3 -0
- package/dist/FetchPicker/styles.scss +130 -0
- package/dist/FloatButton/FloatButton.d.ts +19 -0
- package/dist/FloatButton/FloatButton.js +60 -0
- package/dist/FloatButton/FloatButtonGroup.d.ts +21 -0
- package/dist/FloatButton/FloatButtonGroup.js +141 -0
- package/dist/FloatButton/context.d.ts +10 -0
- package/dist/FloatButton/context.js +2 -0
- package/dist/FloatButton/index.d.ts +10 -0
- package/dist/FloatButton/index.js +5 -0
- package/dist/FloatButton/style.scss +126 -0
- package/dist/Form/FormItem/form-item-content.d.ts +17 -0
- package/dist/Form/FormItem/form-item-content.js +39 -0
- package/dist/Form/FormItem/form-item-label.d.ts +13 -0
- package/dist/Form/FormItem/form-item-label.js +29 -0
- package/dist/Form/FormItem/form-item.d.ts +23 -0
- package/dist/Form/FormItem/form-item.js +77 -0
- package/dist/Form/FormItem/index.d.ts +5 -0
- package/dist/Form/FormItem/index.js +3 -0
- package/dist/Form/index.d.ts +9 -2
- package/dist/Form/index.js +5 -1
- package/dist/Form/style.scss +100 -0
- package/dist/FormCell/index.d.ts +3 -0
- package/dist/FormCell/index.js +2 -0
- package/dist/ImagesPreview/ImagesPreview.js +4 -3
- package/dist/ImagesWall/ImagesWall.js +1 -1
- package/dist/Input/index.d.ts +17 -2
- package/dist/Input/index.js +13 -1
- package/dist/Input/index.scss +282 -0
- package/dist/Input/input-affix-wrapper.d.ts +13 -0
- package/dist/Input/input-affix-wrapper.js +37 -0
- package/dist/Input/input-digit.d.ts +7 -0
- package/dist/Input/input-digit.js +53 -0
- package/dist/Input/input-number.d.ts +7 -0
- package/dist/Input/input-number.js +50 -0
- package/dist/Input/input-opt.d.ts +16 -0
- package/dist/Input/input-opt.js +87 -0
- package/dist/Input/input-password.d.ts +8 -0
- package/dist/Input/input-password.js +49 -0
- package/dist/Input/input.d.ts +3 -0
- package/dist/Input/input.js +7 -0
- package/dist/Input/taro-input.d.ts +8 -0
- package/dist/Input/taro-input.js +70 -0
- package/dist/Input/textarea.d.ts +15 -0
- package/dist/Input/textarea.js +52 -0
- package/dist/Input/types.d.ts +20 -0
- package/dist/Input/types.js +2 -0
- package/dist/Loading/index.d.ts +4 -0
- package/dist/Loading/index.js +3 -0
- package/dist/Overlay/Overlay.d.ts +17 -0
- package/dist/Overlay/Overlay.js +100 -0
- package/dist/Overlay/index.d.ts +4 -0
- package/dist/Overlay/index.js +3 -0
- package/dist/Overlay/style.scss +20 -0
- package/dist/Picker/Picker.d.ts +27 -0
- package/dist/Picker/Picker.js +100 -0
- package/dist/Picker/index.d.ts +1 -1
- package/dist/Picker/index.js +1 -1
- package/dist/Picker/style.scss +41 -0
- package/dist/PickerView/PickerView.d.ts +4 -0
- package/dist/PickerView/PickerView.js +71 -0
- package/dist/PickerView/index.d.ts +2 -2
- package/dist/PickerView/index.js +1 -1
- package/dist/PickerView/style.scss +13 -0
- package/dist/PickerView/types.d.ts +15 -0
- package/dist/PickerView/types.js +1 -0
- package/dist/Popup/Popup.d.ts +48 -0
- package/dist/Popup/Popup.js +135 -0
- package/dist/Popup/index.d.ts +2 -1
- package/dist/Popup/index.js +2 -1
- package/dist/Popup/style.scss +126 -0
- package/dist/Progress/index.d.ts +1 -1
- package/dist/Progress/index.js +1 -1
- package/dist/Segmented/index.d.ts +3 -0
- package/dist/Segmented/index.js +2 -0
- package/dist/SideBar/side-bar.js +3 -2
- package/dist/SideBar/style.scss +6 -6
- package/dist/Stepper/index.d.ts +3 -0
- package/dist/Stepper/index.js +2 -0
- package/dist/Toast/Toast.d.ts +18 -0
- package/dist/Toast/Toast.js +112 -0
- package/dist/Toast/index.d.ts +1 -1
- package/dist/Toast/index.js +1 -1
- package/dist/Toast/style.scss +63 -0
- package/dist/VerificationCodeInput/index.d.ts +2 -2
- package/dist/VerificationCodeInput/index.js +1 -1
- package/dist/VerificationCodeInput/style.scss +20 -0
- package/dist/VerificationCodeInput/verification-code-input.d.ts +24 -0
- package/dist/VerificationCodeInput/verification-code-input.js +99 -0
- package/dist/index.d.ts +28 -7
- package/dist/index.js +12 -2
- package/dist/style/variable.scss +33 -0
- package/dist/types.d.ts +0 -1
- package/dist/utils/dayjs.d.ts +4 -0
- package/dist/utils/dayjs.js +42 -0
- package/package.json +25 -30
- package/dist/Mask/index.d.ts +0 -3
- package/dist/Mask/index.js +0 -2
- package/dist/Progress/Progress.d.ts +0 -38
- package/dist/Progress/Progress.js +0 -53
- package/dist/Progress/ProgressCircle.d.ts +0 -16
- package/dist/Progress/ProgressCircle.js +0 -147
- package/dist/Progress/ProgressLine.d.ts +0 -15
- package/dist/Progress/ProgressLine.js +0 -87
- package/dist/Progress/style.scss +0 -33
- package/dist/Progress/types.d.ts +0 -4
- package/dist/Progress/types.js +0 -2
- package/dist/SpinLoading/index.d.ts +0 -3
- package/dist/SpinLoading/index.js +0 -2
- /package/dist/CalendarPicker/{calendar-picker.d.ts → CalendarPicker.d.ts} +0 -0
- /package/dist/CalendarPicker/{calendar-range-picker.d.ts → CalendarRangePicker.d.ts} +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
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 = ["placeholder", "onChange", "value", "labelInValue"];
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
8
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
9
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
10
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
16
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
17
|
+
import React, { useEffect, useState } from "react";
|
|
18
|
+
import CascaderPopup from "../CascaderPicker";
|
|
19
|
+
import FormCell from "../FormCell";
|
|
20
|
+
export var CascaderPickerCell = function CascaderPickerCell(_ref) {
|
|
21
|
+
var _ref$placeholder = _ref.placeholder,
|
|
22
|
+
placeholder = _ref$placeholder === void 0 ? '请选择' : _ref$placeholder,
|
|
23
|
+
onChange = _ref.onChange,
|
|
24
|
+
value = _ref.value,
|
|
25
|
+
_ref$labelInValue = _ref.labelInValue,
|
|
26
|
+
labelInValue = _ref$labelInValue === void 0 ? true : _ref$labelInValue,
|
|
27
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
+
var mergedFieldNames = _objectSpread({
|
|
29
|
+
value: 'value',
|
|
30
|
+
label: 'label',
|
|
31
|
+
children: 'children'
|
|
32
|
+
}, rest.fieldNames);
|
|
33
|
+
var _useState = useState(false),
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
open = _useState2[0],
|
|
36
|
+
setOpen = _useState2[1];
|
|
37
|
+
var _useState3 = useState(value || []),
|
|
38
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
39
|
+
internalValue = _useState4[0],
|
|
40
|
+
setInternalValue = _useState4[1];
|
|
41
|
+
useEffect(function () {
|
|
42
|
+
if ((value || []) !== (internalValue || [])) {
|
|
43
|
+
setInternalValue(value || []);
|
|
44
|
+
}
|
|
45
|
+
}, [value]);
|
|
46
|
+
var valueText = function valueText() {
|
|
47
|
+
if (labelInValue) {
|
|
48
|
+
return internalValue === null || internalValue === void 0 ? void 0 : internalValue.map(function (item) {
|
|
49
|
+
return item[mergedFieldNames.label];
|
|
50
|
+
}).join('/');
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CascaderPopup, _extends({}, rest, {
|
|
54
|
+
open: open,
|
|
55
|
+
value: internalValue,
|
|
56
|
+
labelInValue: labelInValue,
|
|
57
|
+
onCancel: function onCancel() {
|
|
58
|
+
setOpen(false);
|
|
59
|
+
},
|
|
60
|
+
onOk: function onOk(value) {
|
|
61
|
+
setInternalValue(value || []);
|
|
62
|
+
setOpen(false);
|
|
63
|
+
onChange === null || onChange === void 0 || onChange(value || []);
|
|
64
|
+
}
|
|
65
|
+
})), /*#__PURE__*/React.createElement(FormCell, _extends({}, rest, {
|
|
66
|
+
onClick: function onClick() {
|
|
67
|
+
setOpen(true);
|
|
68
|
+
}
|
|
69
|
+
}), valueText()));
|
|
70
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Mode } from "./types";
|
|
4
|
+
import dayjs from "dayjs";
|
|
5
|
+
export type DatePickerPops = {
|
|
6
|
+
open?: boolean;
|
|
7
|
+
onClose?: () => void;
|
|
8
|
+
title?: React.ReactNode;
|
|
9
|
+
mode?: Mode;
|
|
10
|
+
showTime?: boolean | {
|
|
11
|
+
format?: string;
|
|
12
|
+
};
|
|
13
|
+
value?: dayjs.Dayjs;
|
|
14
|
+
onOk?: (value: dayjs.Dayjs) => void;
|
|
15
|
+
minDate?: dayjs.Dayjs;
|
|
16
|
+
maxDate?: dayjs.Dayjs;
|
|
17
|
+
};
|
|
18
|
+
export declare const DatePicker: FC<DatePickerPops>;
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
5
|
+
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); }
|
|
6
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7
|
+
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."); }
|
|
8
|
+
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); }
|
|
9
|
+
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; }
|
|
10
|
+
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; } }
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
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); }
|
|
13
|
+
import { useEffect, useMemo, useState } from "react";
|
|
14
|
+
import Popup from "../Popup";
|
|
15
|
+
import PickerView from "../PickerView";
|
|
16
|
+
import React from "react";
|
|
17
|
+
import classNames from "classnames";
|
|
18
|
+
import ConfigProvider from "../ConfigProvider";
|
|
19
|
+
import { isEqual } from "lodash-es";
|
|
20
|
+
import dayjs from "dayjs";
|
|
21
|
+
var cls = 'triones-antm-date-picker';
|
|
22
|
+
export var DatePicker = function DatePicker(_ref) {
|
|
23
|
+
var open = _ref.open,
|
|
24
|
+
onClose = _ref.onClose,
|
|
25
|
+
title = _ref.title,
|
|
26
|
+
_ref$mode = _ref.mode,
|
|
27
|
+
mode = _ref$mode === void 0 ? 'date' : _ref$mode,
|
|
28
|
+
showTime = _ref.showTime,
|
|
29
|
+
value = _ref.value,
|
|
30
|
+
onOk = _ref.onOk,
|
|
31
|
+
minDate = _ref.minDate,
|
|
32
|
+
maxDate = _ref.maxDate;
|
|
33
|
+
var cleanTimeFormat = useMemo(function () {
|
|
34
|
+
if (_typeof(showTime) === 'object' && showTime !== null && showTime !== void 0 && showTime.format) {
|
|
35
|
+
return showTime.format.replace(/\[([^\]]+)\]/g, '');
|
|
36
|
+
}
|
|
37
|
+
return '';
|
|
38
|
+
}, [showTime]);
|
|
39
|
+
var hasHour = cleanTimeFormat === null || cleanTimeFormat === void 0 ? void 0 : cleanTimeFormat.includes('H');
|
|
40
|
+
var hasMinute = cleanTimeFormat === null || cleanTimeFormat === void 0 ? void 0 : cleanTimeFormat.includes('m');
|
|
41
|
+
var hasSecond = cleanTimeFormat === null || cleanTimeFormat === void 0 ? void 0 : cleanTimeFormat.includes('s');
|
|
42
|
+
var _ConfigProvider$useCo = ConfigProvider.useConfig(),
|
|
43
|
+
locale = _ConfigProvider$useCo.locale;
|
|
44
|
+
var _useState = useState({
|
|
45
|
+
year: (value === null || value === void 0 ? void 0 : value.year()) || dayjs().year(),
|
|
46
|
+
mouth: ((value === null || value === void 0 ? void 0 : value.month()) || dayjs().month()) + 1,
|
|
47
|
+
date: (value === null || value === void 0 ? void 0 : value.date()) || dayjs().date(),
|
|
48
|
+
hour: (value === null || value === void 0 ? void 0 : value.hour()) || dayjs().hour(),
|
|
49
|
+
minute: (value === null || value === void 0 ? void 0 : value.minute()) || dayjs().minute(),
|
|
50
|
+
second: (value === null || value === void 0 ? void 0 : value.second()) || dayjs().second()
|
|
51
|
+
}),
|
|
52
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
53
|
+
internalValue = _useState2[0],
|
|
54
|
+
setInternalValue = _useState2[1];
|
|
55
|
+
var years = useMemo(function () {
|
|
56
|
+
var startYear = dayjs().year() - 50;
|
|
57
|
+
var endYear = dayjs().year() + 50;
|
|
58
|
+
if (minDate && maxDate) {
|
|
59
|
+
startYear = minDate.year();
|
|
60
|
+
endYear = maxDate.year();
|
|
61
|
+
}
|
|
62
|
+
if (minDate) {
|
|
63
|
+
startYear = minDate.year();
|
|
64
|
+
}
|
|
65
|
+
if (maxDate) {
|
|
66
|
+
endYear = maxDate.year();
|
|
67
|
+
}
|
|
68
|
+
return Array.from({
|
|
69
|
+
length: endYear - startYear + 1
|
|
70
|
+
}, function (_, i) {
|
|
71
|
+
return startYear + i;
|
|
72
|
+
});
|
|
73
|
+
}, [internalValue.year, minDate, maxDate]);
|
|
74
|
+
var mouths = useMemo(function () {
|
|
75
|
+
var start = 0;
|
|
76
|
+
var end = 11;
|
|
77
|
+
if (minDate && minDate.year() === internalValue.year) {
|
|
78
|
+
start = minDate.month();
|
|
79
|
+
}
|
|
80
|
+
if (maxDate && maxDate.year() === internalValue.year) {
|
|
81
|
+
end = maxDate.month();
|
|
82
|
+
}
|
|
83
|
+
return Array.from({
|
|
84
|
+
length: end - start
|
|
85
|
+
}, function (_, i) {
|
|
86
|
+
return start + i + 1;
|
|
87
|
+
});
|
|
88
|
+
}, [internalValue.year, minDate, maxDate]);
|
|
89
|
+
var days = useMemo(function () {
|
|
90
|
+
var start = 1;
|
|
91
|
+
var end = dayjs().year(internalValue.year || dayjs().year()).month((internalValue.mouth || 1) - 1).daysInMonth();
|
|
92
|
+
if (minDate && minDate.year() === internalValue.year && minDate.month() + 1 === internalValue.mouth) {
|
|
93
|
+
start = minDate.date();
|
|
94
|
+
}
|
|
95
|
+
if (maxDate && maxDate.year() === internalValue.year && maxDate.month() + 1 === internalValue.mouth) {
|
|
96
|
+
end = maxDate.date();
|
|
97
|
+
}
|
|
98
|
+
return Array.from({
|
|
99
|
+
length: end - start + 1
|
|
100
|
+
}, function (_, i) {
|
|
101
|
+
return start + i;
|
|
102
|
+
});
|
|
103
|
+
}, [internalValue.year, internalValue.mouth, minDate, maxDate]);
|
|
104
|
+
var hours = Array.from({
|
|
105
|
+
length: 24
|
|
106
|
+
}, function (_, i) {
|
|
107
|
+
return i;
|
|
108
|
+
});
|
|
109
|
+
var minutes = Array.from({
|
|
110
|
+
length: 60
|
|
111
|
+
}, function (_, i) {
|
|
112
|
+
return i;
|
|
113
|
+
});
|
|
114
|
+
var seconds = Array.from({
|
|
115
|
+
length: 60
|
|
116
|
+
}, function (_, i) {
|
|
117
|
+
return i;
|
|
118
|
+
});
|
|
119
|
+
var columns = useMemo(function () {
|
|
120
|
+
if (mode === 'date') {
|
|
121
|
+
var dateColumns = [];
|
|
122
|
+
dateColumns.push(years.map(function (v) {
|
|
123
|
+
return {
|
|
124
|
+
label: "".concat(v, "\u5E74"),
|
|
125
|
+
value: v
|
|
126
|
+
};
|
|
127
|
+
}), mouths.map(function (v) {
|
|
128
|
+
return {
|
|
129
|
+
label: "".concat(v, "\u6708"),
|
|
130
|
+
value: v
|
|
131
|
+
};
|
|
132
|
+
}), days.map(function (v) {
|
|
133
|
+
return {
|
|
134
|
+
label: "".concat(v, "\u65E5"),
|
|
135
|
+
value: v
|
|
136
|
+
};
|
|
137
|
+
}));
|
|
138
|
+
if (Boolean(showTime)) {
|
|
139
|
+
if (cleanTimeFormat) {
|
|
140
|
+
if (hasHour) {
|
|
141
|
+
dateColumns.push(hours.map(function (v) {
|
|
142
|
+
return {
|
|
143
|
+
label: "".concat(v, "\u65F6"),
|
|
144
|
+
value: v
|
|
145
|
+
};
|
|
146
|
+
}));
|
|
147
|
+
}
|
|
148
|
+
if (hasMinute) {
|
|
149
|
+
dateColumns.push(minutes.map(function (v) {
|
|
150
|
+
return {
|
|
151
|
+
label: "".concat(v, "\u5206"),
|
|
152
|
+
value: v
|
|
153
|
+
};
|
|
154
|
+
}));
|
|
155
|
+
}
|
|
156
|
+
if (hasSecond) {
|
|
157
|
+
dateColumns.push(seconds.map(function (v) {
|
|
158
|
+
return {
|
|
159
|
+
label: "".concat(v, "\u79D2"),
|
|
160
|
+
value: v
|
|
161
|
+
};
|
|
162
|
+
}));
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
dateColumns.push(hours.map(function (v) {
|
|
166
|
+
return {
|
|
167
|
+
label: "".concat(v, "\u65F6"),
|
|
168
|
+
value: v
|
|
169
|
+
};
|
|
170
|
+
}), minutes.map(function (v) {
|
|
171
|
+
return {
|
|
172
|
+
label: "".concat(v, "\u5206"),
|
|
173
|
+
value: v
|
|
174
|
+
};
|
|
175
|
+
}), seconds.map(function (v) {
|
|
176
|
+
return {
|
|
177
|
+
label: "".concat(v, "\u79D2"),
|
|
178
|
+
value: v
|
|
179
|
+
};
|
|
180
|
+
}));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return dateColumns;
|
|
184
|
+
} else if (mode === 'time') {
|
|
185
|
+
var timeColumns = [];
|
|
186
|
+
if (cleanTimeFormat) {
|
|
187
|
+
if (hasHour) {
|
|
188
|
+
timeColumns.push(hours.map(function (v) {
|
|
189
|
+
return {
|
|
190
|
+
label: "".concat(v, "\u65F6"),
|
|
191
|
+
value: v
|
|
192
|
+
};
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
if (hasMinute) {
|
|
196
|
+
timeColumns.push(minutes.map(function (v) {
|
|
197
|
+
return {
|
|
198
|
+
label: "".concat(v, "\u5206"),
|
|
199
|
+
value: v
|
|
200
|
+
};
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
203
|
+
if (hasSecond) {
|
|
204
|
+
timeColumns.push(seconds.map(function (v) {
|
|
205
|
+
return {
|
|
206
|
+
label: "".concat(v, "\u79D2"),
|
|
207
|
+
value: v
|
|
208
|
+
};
|
|
209
|
+
}));
|
|
210
|
+
}
|
|
211
|
+
} else {
|
|
212
|
+
timeColumns.push(hours.map(function (v) {
|
|
213
|
+
return {
|
|
214
|
+
label: "".concat(v, "\u65F6"),
|
|
215
|
+
value: v
|
|
216
|
+
};
|
|
217
|
+
}), minutes.map(function (v) {
|
|
218
|
+
return {
|
|
219
|
+
label: "".concat(v, "\u5206"),
|
|
220
|
+
value: v
|
|
221
|
+
};
|
|
222
|
+
}), seconds.map(function (v) {
|
|
223
|
+
return {
|
|
224
|
+
label: "".concat(v, "\u79D2"),
|
|
225
|
+
value: v
|
|
226
|
+
};
|
|
227
|
+
}));
|
|
228
|
+
}
|
|
229
|
+
return timeColumns;
|
|
230
|
+
}
|
|
231
|
+
return [];
|
|
232
|
+
}, [mode, showTime, years, days]);
|
|
233
|
+
var handleOk = function handleOk() {
|
|
234
|
+
var now = dayjs();
|
|
235
|
+
onOk === null || onOk === void 0 || onOk(dayjs(new Date(internalValue.year || now.year(), (internalValue.mouth || now.month()) - 1, internalValue.date || now.date(), internalValue.hour || now.hour(), internalValue.minute || now.minute())));
|
|
236
|
+
onClose === null || onClose === void 0 || onClose();
|
|
237
|
+
};
|
|
238
|
+
var handelCancel = function handelCancel() {
|
|
239
|
+
onClose === null || onClose === void 0 || onClose();
|
|
240
|
+
};
|
|
241
|
+
var handleValueChange = function handleValueChange(value) {
|
|
242
|
+
var changedValue = _objectSpread({}, internalValue);
|
|
243
|
+
if (mode === 'date') {
|
|
244
|
+
changedValue.year = value[0];
|
|
245
|
+
changedValue.mouth = value[1];
|
|
246
|
+
changedValue.date = value[2];
|
|
247
|
+
if (showTime) {
|
|
248
|
+
changedValue.hour = value[3];
|
|
249
|
+
changedValue.minute = value[4];
|
|
250
|
+
}
|
|
251
|
+
} else if (mode === 'time') {
|
|
252
|
+
changedValue.hour = value[0];
|
|
253
|
+
changedValue.minute = value[1];
|
|
254
|
+
}
|
|
255
|
+
if (!isEqual(internalValue, changedValue)) {
|
|
256
|
+
setInternalValue(changedValue);
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
useEffect(function () {
|
|
260
|
+
if (value === undefined) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
if (value.year() !== internalValue.year || value.month() + 1 !== internalValue.mouth || value.date() !== internalValue.date || value.hour() !== internalValue.hour || value.minute() !== internalValue.minute || value.second() !== internalValue.second) {
|
|
264
|
+
setInternalValue({
|
|
265
|
+
year: value.year(),
|
|
266
|
+
mouth: value.month() + 1,
|
|
267
|
+
date: value.date(),
|
|
268
|
+
hour: value.hour(),
|
|
269
|
+
minute: value.minute(),
|
|
270
|
+
second: value.second()
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}, [value]);
|
|
274
|
+
var pickerValue = useMemo(function () {
|
|
275
|
+
if (mode === 'time') {
|
|
276
|
+
return [internalValue.hour, internalValue.minute, internalValue.second];
|
|
277
|
+
} else if (mode === 'date') {
|
|
278
|
+
if (showTime) {
|
|
279
|
+
return [internalValue.year, internalValue.mouth, internalValue.date, internalValue.hour, internalValue.minute, internalValue.second];
|
|
280
|
+
} else {
|
|
281
|
+
return [internalValue.year, internalValue.mouth, internalValue.date];
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}, [internalValue]);
|
|
285
|
+
return /*#__PURE__*/React.createElement(Popup, {
|
|
286
|
+
open: open,
|
|
287
|
+
onClose: onClose,
|
|
288
|
+
round: true
|
|
289
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
290
|
+
className: classNames("".concat(cls))
|
|
291
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
292
|
+
className: classNames("".concat(cls, "-header"))
|
|
293
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
294
|
+
className: classNames("".concat(cls, "-header-button"), "".concat(cls, "-header-button-cancel")),
|
|
295
|
+
onClick: handelCancel
|
|
296
|
+
}, locale.common.cancel), title && /*#__PURE__*/React.createElement("div", {
|
|
297
|
+
className: classNames("".concat(cls, "-header-title"))
|
|
298
|
+
}, title), /*#__PURE__*/React.createElement("a", {
|
|
299
|
+
className: classNames("".concat(cls, "-header-button"), "".concat(cls, "-header-button-ok")),
|
|
300
|
+
onClick: handleOk
|
|
301
|
+
}, locale.common.confirm)), /*#__PURE__*/React.createElement("div", {
|
|
302
|
+
className: classNames("".concat(cls, "-body"))
|
|
303
|
+
}, /*#__PURE__*/React.createElement(PickerView, {
|
|
304
|
+
columns: columns,
|
|
305
|
+
value: pickerValue,
|
|
306
|
+
onChange: function onChange(v) {
|
|
307
|
+
handleValueChange(v);
|
|
308
|
+
}
|
|
309
|
+
}))));
|
|
310
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
@use "../style/variable" as variable;
|
|
2
|
+
|
|
3
|
+
$datePickerCls: 'triones-antm-date-picker';
|
|
4
|
+
|
|
5
|
+
.#{$datePickerCls} {
|
|
6
|
+
border-top-left-radius: variable.$trionesBorderRadius;
|
|
7
|
+
border-top-right-radius: variable.$trionesBorderRadius;
|
|
8
|
+
|
|
9
|
+
&-header {
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
align-items: center;
|
|
13
|
+
padding: 4Px;
|
|
14
|
+
border-bottom: 1Px solid variable.$trionesBorderColor;
|
|
15
|
+
&-title {
|
|
16
|
+
font-size: 16Px;
|
|
17
|
+
padding: 8Px;
|
|
18
|
+
text-align: center;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&-button {
|
|
22
|
+
padding: 8Px 12Px;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
&-cancel{
|
|
25
|
+
color: variable.$trionesColorTextSecondary;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&-body {
|
|
31
|
+
.time-picker {
|
|
32
|
+
.time-item {
|
|
33
|
+
flex-shrink: 0;
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
height: 32Px;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Mode = 'date' | 'time';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
import { Mode } from "../DatePicker/types";
|
|
4
|
+
import { CellProps } from "../Cell";
|
|
5
|
+
export type DatePickerCellPops = Omit<CellProps, 'value'> & {
|
|
6
|
+
value?: dayjs.Dayjs;
|
|
7
|
+
format?: string;
|
|
8
|
+
onChange?: (value?: dayjs.Dayjs) => void;
|
|
9
|
+
mode?: Mode;
|
|
10
|
+
showTime?: boolean | {
|
|
11
|
+
format?: string;
|
|
12
|
+
};
|
|
13
|
+
minDate?: dayjs.Dayjs;
|
|
14
|
+
maxDate?: dayjs.Dayjs;
|
|
15
|
+
};
|
|
16
|
+
export declare const DatePickerCell: FC<DatePickerCellPops>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
var _excluded = ["value", "format", "onChange", "mode", "showTime", "minDate", "maxDate"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
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."); }
|
|
5
|
+
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); }
|
|
6
|
+
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; }
|
|
7
|
+
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; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
import React, { useEffect, useMemo, useState } from "react";
|
|
12
|
+
import dayjs from "dayjs";
|
|
13
|
+
import DatePicker from "../DatePicker";
|
|
14
|
+
import Cell from "../Cell";
|
|
15
|
+
export var DatePickerCell = function DatePickerCell(_ref) {
|
|
16
|
+
var value = _ref.value,
|
|
17
|
+
format = _ref.format,
|
|
18
|
+
onChange = _ref.onChange,
|
|
19
|
+
_ref$mode = _ref.mode,
|
|
20
|
+
mode = _ref$mode === void 0 ? 'date' : _ref$mode,
|
|
21
|
+
_ref$showTime = _ref.showTime,
|
|
22
|
+
showTime = _ref$showTime === void 0 ? false : _ref$showTime,
|
|
23
|
+
minDate = _ref.minDate,
|
|
24
|
+
maxDate = _ref.maxDate,
|
|
25
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
+
var _React$useState = React.useState(false),
|
|
27
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
28
|
+
innerOpen = _React$useState2[0],
|
|
29
|
+
setInnerOpen = _React$useState2[1];
|
|
30
|
+
var _useState = useState(value),
|
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
+
internalValue = _useState2[0],
|
|
33
|
+
setInternalValue = _useState2[1];
|
|
34
|
+
var renderFormat = useMemo(function () {
|
|
35
|
+
if (format) {
|
|
36
|
+
return format;
|
|
37
|
+
}
|
|
38
|
+
if (mode === 'date') {
|
|
39
|
+
return showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD';
|
|
40
|
+
} else if (mode === 'time') {
|
|
41
|
+
return 'HH:mm:ss';
|
|
42
|
+
}
|
|
43
|
+
return 'YYYY-MM-DD';
|
|
44
|
+
}, [mode, format, showTime]);
|
|
45
|
+
var handleValueRender = function handleValueRender() {
|
|
46
|
+
if (internalValue) {
|
|
47
|
+
return dayjs(internalValue).format(renderFormat);
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
};
|
|
51
|
+
useEffect(function () {
|
|
52
|
+
if (value === undefined) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (value !== internalValue) {
|
|
56
|
+
setInternalValue(value);
|
|
57
|
+
}
|
|
58
|
+
}, [value]);
|
|
59
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DatePicker, {
|
|
60
|
+
open: innerOpen,
|
|
61
|
+
onClose: function onClose() {
|
|
62
|
+
setInnerOpen(false);
|
|
63
|
+
},
|
|
64
|
+
mode: mode,
|
|
65
|
+
showTime: showTime,
|
|
66
|
+
minDate: minDate,
|
|
67
|
+
maxDate: maxDate,
|
|
68
|
+
value: internalValue,
|
|
69
|
+
onOk: function onOk(value) {
|
|
70
|
+
setInternalValue(value);
|
|
71
|
+
onChange === null || onChange === void 0 || onChange(value);
|
|
72
|
+
}
|
|
73
|
+
}), /*#__PURE__*/React.createElement(Cell, _extends({
|
|
74
|
+
onClick: function onClick() {
|
|
75
|
+
setInnerOpen(true);
|
|
76
|
+
}
|
|
77
|
+
}, rest), handleValueRender()));
|
|
78
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PopupProps } from "../Popup";
|
|
3
|
+
type LabeledValue = {
|
|
4
|
+
label?: string;
|
|
5
|
+
value?: string | number;
|
|
6
|
+
};
|
|
7
|
+
type PickerValue = string | string[] | number | number[] | LabeledValue | LabeledValue[];
|
|
8
|
+
export type FetchPickerProps = Omit<PopupProps, ''> & {
|
|
9
|
+
/**
|
|
10
|
+
* @description 是否全屏
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
fullScreen?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* @description 搜索框
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
showSearch?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* @description 搜索框占位符
|
|
21
|
+
* @default 搜索
|
|
22
|
+
*/
|
|
23
|
+
searchPlaceholder?: string;
|
|
24
|
+
value?: PickerValue;
|
|
25
|
+
/**
|
|
26
|
+
* @description 是否多选
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
multiple?: boolean;
|
|
30
|
+
labelInValue?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* @description 弹窗标题
|
|
33
|
+
*/
|
|
34
|
+
title?: React.ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* @description 取消按钮文字,fullScreen 为 false 时生效
|
|
37
|
+
* @default 取消
|
|
38
|
+
*/
|
|
39
|
+
cancelText?: string;
|
|
40
|
+
/**
|
|
41
|
+
* @description 确定按钮文字,fullScreen 为 false 时生效
|
|
42
|
+
* @default 确定
|
|
43
|
+
*/
|
|
44
|
+
okText?: string;
|
|
45
|
+
onCancel?: () => void;
|
|
46
|
+
onOk?: (value?: PickerValue, option?: any | any[]) => void;
|
|
47
|
+
/**
|
|
48
|
+
* @description 请求
|
|
49
|
+
* @default
|
|
50
|
+
*/
|
|
51
|
+
fetch?: (params: {
|
|
52
|
+
page?: number;
|
|
53
|
+
size?: number;
|
|
54
|
+
wd?: string;
|
|
55
|
+
}) => Promise<any[]>;
|
|
56
|
+
fieldNames?: {
|
|
57
|
+
label?: string;
|
|
58
|
+
value?: string;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* @description 空状态
|
|
62
|
+
* @default 暂无数据
|
|
63
|
+
*/
|
|
64
|
+
empty?: React.ReactNode;
|
|
65
|
+
/**
|
|
66
|
+
* @description 是否分页
|
|
67
|
+
* @default false
|
|
68
|
+
*/
|
|
69
|
+
pageable?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* @description 每页大小,pageable 为 true 时生效
|
|
72
|
+
* @default 20
|
|
73
|
+
*/
|
|
74
|
+
pageSize?: number;
|
|
75
|
+
optionRender?: (option: any, selected: boolean) => React.ReactNode;
|
|
76
|
+
};
|
|
77
|
+
export declare const FetchPicker: React.FC<FetchPickerProps>;
|
|
78
|
+
export {};
|