@trionesdev/antd-mobile-react 0.0.2-beta.11 → 0.0.2-beta.13
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/Calendar/calendar-grid.d.ts +10 -9
- package/dist/Calendar/calendar-grid.js +41 -64
- package/dist/Calendar/calendar-header.d.ts +3 -2
- package/dist/Calendar/calendar-header.js +6 -6
- package/dist/Calendar/calendar-range.d.ts +4 -3
- package/dist/Calendar/calendar-range.js +12 -11
- package/dist/Calendar/calendar.d.ts +5 -4
- package/dist/Calendar/calendar.js +23 -15
- package/dist/Calendar/touchable-calendar-grid.d.ts +6 -5
- package/dist/Calendar/touchable-calendar-grid.js +58 -50
- package/dist/CalendarDatetimePicker/CalendarDatetimePicker.d.ts +8 -6
- package/dist/CalendarDatetimePicker/CalendarDatetimePicker.js +123 -42
- package/dist/{CalendarDatetimePopup → CalendarDatetimePicker}/DateTimeSwitch.d.ts +3 -2
- package/dist/{CalendarDatetimePopup → CalendarDatetimePicker}/DateTimeSwitch.js +4 -3
- package/dist/CalendarDatetimePicker/demo/base.js +21 -5
- package/dist/CalendarDatetimePicker/index.d.ts +2 -2
- package/dist/CalendarDatetimePicker/style.scss +50 -6
- package/dist/CalendarDatetimePicker/types.d.ts +5 -1
- package/dist/CalendarDatetimePicker/types.js +6 -1
- package/dist/CalendarDatetimePickerCell/CalendarDatetimePickerCell.d.ts +10 -0
- package/dist/CalendarDatetimePickerCell/CalendarDatetimePickerCell.js +60 -0
- package/dist/{CalendarDatetimePopup → CalendarDatetimePickerCell}/demo/base.js +5 -22
- package/dist/CalendarDatetimePickerCell/index.d.ts +3 -0
- package/dist/CalendarDatetimePickerCell/index.js +2 -0
- package/dist/CalendarDatetimePickerCell/style.scss +10 -0
- package/dist/CalendarDatetimePickerCell/types.d.ts +1 -0
- package/dist/CalendarDatetimePickerCell/types.js +1 -0
- package/dist/CalendarPicker/calendar-picker.d.ts +4 -0
- package/dist/{CalendarPopup/calendar-popup.js → CalendarPicker/calendar-picker.js} +4 -4
- package/dist/CalendarPicker/calendar-range-picker.d.ts +4 -0
- package/dist/{CalendarPopup/calendar-range-popup.js → CalendarPicker/calendar-range-picker.js} +7 -6
- package/dist/{CalendarPopup → CalendarPicker}/demo/base.js +3 -3
- package/dist/CalendarPicker/index.d.ts +9 -0
- package/dist/CalendarPicker/index.js +5 -0
- package/dist/{CalendarPopup → CalendarPicker}/style.scss +2 -2
- package/dist/{CalendarPopup → CalendarPicker}/types.d.ts +9 -8
- 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/demo/base.d.ts +3 -0
- package/dist/CalendarPickerCell/demo/base.js +33 -0
- package/dist/CalendarPickerCell/index.d.ts +8 -0
- package/dist/CalendarPickerCell/index.js +5 -0
- package/dist/{CascaderPopup/cascader-popup.d.ts → CascaderPicker/cascader-picker.d.ts} +2 -2
- package/dist/{CascaderPopup/cascader-popup.js → CascaderPicker/cascader-picker.js} +8 -8
- package/dist/CascaderPicker/demo/base.js +16 -7
- package/dist/CascaderPicker/index.d.ts +1 -1
- package/dist/CascaderPicker/index.js +1 -1
- package/dist/CascaderPicker/style.scss +33 -12
- package/dist/{CascaderPicker/CascaderPicker.d.ts → CascaderPickerCell/CascaderPickerCell.d.ts} +4 -8
- package/dist/{CascaderPicker/CascaderPicker.js → CascaderPickerCell/CascaderPickerCell.js} +7 -15
- package/dist/{CascaderPopup → CascaderPickerCell}/demo/base.js +6 -16
- package/dist/CascaderPickerCell/index.d.ts +3 -0
- package/dist/CascaderPickerCell/index.js +2 -0
- package/dist/CascaderPickerCell/style.scss +24 -0
- package/dist/Picker/picker.d.ts +1 -0
- package/dist/Picker/picker.js +3 -6
- package/dist/index.d.ts +10 -6
- package/dist/index.js +5 -3
- package/dist/utils/dayjs.d.ts +4 -0
- package/dist/utils/dayjs.js +42 -0
- package/package.json +4 -4
- package/dist/CalendarDatetimePopup/CalendarDatetimePopup.d.ts +0 -10
- package/dist/CalendarDatetimePopup/CalendarDatetimePopup.js +0 -142
- package/dist/CalendarDatetimePopup/index.d.ts +0 -3
- package/dist/CalendarDatetimePopup/index.js +0 -2
- package/dist/CalendarDatetimePopup/style.scss +0 -54
- package/dist/CalendarDatetimePopup/types.d.ts +0 -5
- package/dist/CalendarDatetimePopup/types.js +0 -6
- package/dist/CalendarPopup/calendar-popup.d.ts +0 -4
- package/dist/CalendarPopup/calendar-range-popup.d.ts +0 -4
- package/dist/CalendarPopup/index.d.ts +0 -9
- package/dist/CalendarPopup/index.js +0 -5
- package/dist/CascaderPopup/index.d.ts +0 -3
- package/dist/CascaderPopup/index.js +0 -2
- package/dist/CascaderPopup/style.scss +0 -45
- /package/dist/{CalendarDatetimePopup → CalendarDatetimePickerCell}/demo/base.d.ts +0 -0
- /package/dist/{CalendarPopup → CalendarPicker}/demo/base.d.ts +0 -0
- /package/dist/{CalendarPopup → CalendarPicker}/types.js +0 -0
- /package/dist/{CascaderPopup → CascaderPickerCell}/demo/base.d.ts +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var _excluded = ["value", "format", "onChange"];
|
|
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, useState } from 'react';
|
|
12
|
+
import "./style.scss";
|
|
13
|
+
import dayjs from "dayjs";
|
|
14
|
+
import Cell from "../Cell";
|
|
15
|
+
import CalendarDatetimePicker from "../CalendarDatetimePicker";
|
|
16
|
+
export var CalendarDatetimePickerCell = function CalendarDatetimePickerCell(_ref) {
|
|
17
|
+
var value = _ref.value,
|
|
18
|
+
_ref$format = _ref.format,
|
|
19
|
+
format = _ref$format === void 0 ? 'YYYY-MM-DD HH:mm' : _ref$format,
|
|
20
|
+
onChange = _ref.onChange,
|
|
21
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
+
var _React$useState = React.useState(false),
|
|
23
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
24
|
+
innerOpen = _React$useState2[0],
|
|
25
|
+
setInnerOpen = _React$useState2[1];
|
|
26
|
+
var _useState = useState(value),
|
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
+
internalValue = _useState2[0],
|
|
29
|
+
setInternalValue = _useState2[1];
|
|
30
|
+
var handleValueRender = function handleValueRender() {
|
|
31
|
+
if (internalValue) {
|
|
32
|
+
return dayjs(internalValue).format(format);
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
};
|
|
36
|
+
useEffect(function () {
|
|
37
|
+
if (value === undefined) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (value !== internalValue) {
|
|
41
|
+
setInternalValue(value);
|
|
42
|
+
}
|
|
43
|
+
}, [value]);
|
|
44
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CalendarDatetimePicker, {
|
|
45
|
+
open: innerOpen,
|
|
46
|
+
value: internalValue,
|
|
47
|
+
onClose: function onClose() {
|
|
48
|
+
setInnerOpen(false);
|
|
49
|
+
},
|
|
50
|
+
onOk: function onOk(date) {
|
|
51
|
+
setInternalValue(date);
|
|
52
|
+
setInnerOpen(false);
|
|
53
|
+
onChange === null || onChange === void 0 || onChange(date);
|
|
54
|
+
}
|
|
55
|
+
}), /*#__PURE__*/React.createElement(Cell, _extends({
|
|
56
|
+
onClick: function onClick() {
|
|
57
|
+
setInnerOpen(true);
|
|
58
|
+
}
|
|
59
|
+
}, rest), handleValueRender()));
|
|
60
|
+
};
|
|
@@ -6,9 +6,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { DemoBlock } from "../../DemoBlock";
|
|
9
|
-
import {
|
|
10
|
-
import Button from "../../Button";
|
|
11
|
-
import Toast from "../../Toast";
|
|
9
|
+
import { CalendarDatetimePickerCell } from "../CalendarDatetimePickerCell";
|
|
12
10
|
export default (function () {
|
|
13
11
|
var toastContainer = React.useRef();
|
|
14
12
|
var _React$useState = React.useState(false),
|
|
@@ -19,23 +17,8 @@ export default (function () {
|
|
|
19
17
|
ref: toastContainer
|
|
20
18
|
}), /*#__PURE__*/React.createElement(DemoBlock, {
|
|
21
19
|
title: "\u65E5\u671F\u65F6\u95F4\u9009\u62E9\u5668"
|
|
22
|
-
}, /*#__PURE__*/React.createElement(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
onOk: function onOk(date) {
|
|
28
|
-
Toast.show({
|
|
29
|
-
getContainer: function getContainer() {
|
|
30
|
-
return toastContainer.current;
|
|
31
|
-
},
|
|
32
|
-
content: "".concat(date.getFullYear(), "-").concat(date.getMonth() + 1, "-").concat(date.getDate(), " ").concat(date.getHours(), ":").concat(date.getMinutes())
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}), /*#__PURE__*/React.createElement(Button, {
|
|
36
|
-
block: true,
|
|
37
|
-
onClick: function onClick() {
|
|
38
|
-
setOpen(true);
|
|
39
|
-
}
|
|
40
|
-
}, "\u65E5\u671F\u65F6\u95F4\u9009\u62E9\u5668")));
|
|
20
|
+
}, /*#__PURE__*/React.createElement(CalendarDatetimePickerCell, {
|
|
21
|
+
label: '日期时间',
|
|
22
|
+
wrapperAlign: "right"
|
|
23
|
+
})));
|
|
41
24
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cls = "triones-antm-calendar-datetime-picker";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var cls = 'triones-antm-calendar-datetime-picker';
|
|
@@ -10,9 +10,9 @@ import Calendar from "../Calendar";
|
|
|
10
10
|
import "./style.scss";
|
|
11
11
|
import ConfigProvider from "../ConfigProvider";
|
|
12
12
|
import Popup from "../Popup";
|
|
13
|
-
var cls = 'triones-antm-calendar-
|
|
14
|
-
export var
|
|
15
|
-
var
|
|
13
|
+
var cls = 'triones-antm-calendar-picker';
|
|
14
|
+
export var CalendarPicker = /*#__PURE__*/memo(function (_ref) {
|
|
15
|
+
var month = _ref.month,
|
|
16
16
|
open = _ref.open,
|
|
17
17
|
title = _ref.title,
|
|
18
18
|
afterOpenChange = _ref.afterOpenChange,
|
|
@@ -78,7 +78,7 @@ export var CalendarPopup = /*#__PURE__*/memo(function (_ref) {
|
|
|
78
78
|
}, locale.common.confirm)), /*#__PURE__*/React.createElement("div", {
|
|
79
79
|
className: classNames("".concat(cls, "-body"))
|
|
80
80
|
}, /*#__PURE__*/React.createElement(Calendar, {
|
|
81
|
-
|
|
81
|
+
month: month,
|
|
82
82
|
value: value,
|
|
83
83
|
onChange: function onChange(date) {
|
|
84
84
|
valueRef.current = date;
|
package/dist/{CalendarPopup/calendar-range-popup.js → CalendarPicker/calendar-range-picker.js}
RENAMED
|
@@ -10,9 +10,10 @@ import Calendar from "../Calendar";
|
|
|
10
10
|
import ConfigProvider from "../ConfigProvider";
|
|
11
11
|
import Popup from "../Popup";
|
|
12
12
|
import "./style.scss";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
import { isSameArray, toDayjsArray } from "../utils/dayjs";
|
|
14
|
+
var cls = 'triones-antm-calendar-picker';
|
|
15
|
+
export var CalendarRangePicker = /*#__PURE__*/memo(function (_ref) {
|
|
16
|
+
var month = _ref.month,
|
|
16
17
|
open = _ref.open,
|
|
17
18
|
title = _ref.title,
|
|
18
19
|
afterOpenChange = _ref.afterOpenChange,
|
|
@@ -44,8 +45,8 @@ export var CalendarRangePopup = /*#__PURE__*/memo(function (_ref) {
|
|
|
44
45
|
}, [innerOpen]);
|
|
45
46
|
useEffect(function () {
|
|
46
47
|
if (value !== undefined) {
|
|
47
|
-
if (value
|
|
48
|
-
valueRef.current = value;
|
|
48
|
+
if (!isSameArray(value, valueRef.current, 'day')) {
|
|
49
|
+
valueRef.current = toDayjsArray(value);
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
}, [value]);
|
|
@@ -79,7 +80,7 @@ export var CalendarRangePopup = /*#__PURE__*/memo(function (_ref) {
|
|
|
79
80
|
}, locale.common.confirm)), /*#__PURE__*/React.createElement("div", {
|
|
80
81
|
className: classNames("".concat(cls, "-body"))
|
|
81
82
|
}, /*#__PURE__*/React.createElement(Calendar.Range, {
|
|
82
|
-
|
|
83
|
+
month: month,
|
|
83
84
|
value: value,
|
|
84
85
|
onChange: function onChange(date) {
|
|
85
86
|
valueRef.current = date;
|
|
@@ -33,7 +33,7 @@ export default (function () {
|
|
|
33
33
|
getContainer: function getContainer() {
|
|
34
34
|
return toastContainer.current;
|
|
35
35
|
},
|
|
36
|
-
content: "".concat(date.
|
|
36
|
+
content: "".concat(date.year(), "-").concat(date.month() + 1, "-").concat(date.date())
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
}), /*#__PURE__*/React.createElement(Button, {
|
|
@@ -49,12 +49,12 @@ export default (function () {
|
|
|
49
49
|
setOpen2(o);
|
|
50
50
|
},
|
|
51
51
|
onOk: function onOk(date) {
|
|
52
|
-
var _$
|
|
52
|
+
var _$month, _$month2;
|
|
53
53
|
Toast.show({
|
|
54
54
|
getContainer: function getContainer() {
|
|
55
55
|
return toastContainer.current;
|
|
56
56
|
},
|
|
57
|
-
content: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "".concat(date[0].
|
|
57
|
+
content: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "".concat(date[0].year(), "-").concat((_$month = date[0].month()) !== null && _$month !== void 0 ? _$month : +1, "-").concat(date[0].date())), /*#__PURE__*/React.createElement("div", null, "".concat(date[1].year(), "-").concat((_$month2 = date[1].month()) !== null && _$month2 !== void 0 ? _$month2 : +1, "-").concat(date[1].date())))
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
}), /*#__PURE__*/React.createElement(Button, {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CalendarPicker as InternalCalendarPicker } from "./calendar-picker";
|
|
2
|
+
import { CalendarRangePicker } from "./calendar-range-picker";
|
|
3
|
+
import { CalendarPickerProps } from "./types";
|
|
4
|
+
type CompoundedComponent = typeof InternalCalendarPicker & {
|
|
5
|
+
Range: typeof CalendarRangePicker;
|
|
6
|
+
};
|
|
7
|
+
declare const CalendarPopup: CompoundedComponent;
|
|
8
|
+
export type { CalendarPickerProps };
|
|
9
|
+
export default CalendarPopup;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
@use "../style/variable" as variable;
|
|
2
2
|
|
|
3
|
-
$
|
|
3
|
+
$calendarPickerCls: 'triones-antm-calendar-picker';
|
|
4
4
|
|
|
5
|
-
.#{$
|
|
5
|
+
.#{$calendarPickerCls} {
|
|
6
6
|
border-top-left-radius: variable.$trionesBorderRadius;
|
|
7
7
|
border-top-right-radius: variable.$trionesBorderRadius;
|
|
8
8
|
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
export type CalendarPickerProps = {
|
|
4
|
+
month?: Date | dayjs.Dayjs;
|
|
4
5
|
open?: boolean;
|
|
5
6
|
title?: React.ReactNode;
|
|
6
7
|
afterOpenChange?: (open: boolean) => void;
|
|
7
|
-
value?: Date;
|
|
8
|
-
onOk?: (value?:
|
|
8
|
+
value?: Date | dayjs.Dayjs;
|
|
9
|
+
onOk?: (value?: dayjs.Dayjs) => void;
|
|
9
10
|
onCancel?: () => void;
|
|
10
11
|
onClose?: () => void;
|
|
11
12
|
};
|
|
12
|
-
export type
|
|
13
|
-
|
|
13
|
+
export type CalendarRangePickerProps = {
|
|
14
|
+
month?: Date | dayjs.Dayjs;
|
|
14
15
|
open?: boolean;
|
|
15
16
|
title?: React.ReactNode;
|
|
16
17
|
afterOpenChange?: (open: boolean) => void;
|
|
17
|
-
value?: Date[];
|
|
18
|
-
onOk?: (value?:
|
|
18
|
+
value?: (Date | dayjs.Dayjs)[];
|
|
19
|
+
onOk?: (value?: dayjs.Dayjs[]) => void;
|
|
19
20
|
onCancel?: () => void;
|
|
20
21
|
onClose?: () => void;
|
|
21
22
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FC } from "react";
|
|
3
|
+
import dayjs from "dayjs";
|
|
4
|
+
import { CellProps } from "../Cell";
|
|
5
|
+
export type CalendarPickerCellProps = Omit<CellProps, 'value'> & {
|
|
6
|
+
month?: dayjs.Dayjs | Date;
|
|
7
|
+
title?: React.ReactNode;
|
|
8
|
+
value?: dayjs.Dayjs | Date;
|
|
9
|
+
onChange?: (date?: dayjs.Dayjs) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const CalendarPickerCell: FC<CalendarPickerCellProps>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var _excluded = ["month", "title", "value", "onChange"];
|
|
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, { useState } from "react";
|
|
12
|
+
import dayjs from "dayjs";
|
|
13
|
+
import Cell from "../Cell";
|
|
14
|
+
import CalendarPicker from "../CalendarPicker";
|
|
15
|
+
export var CalendarPickerCell = function CalendarPickerCell(_ref) {
|
|
16
|
+
var month = _ref.month,
|
|
17
|
+
title = _ref.title,
|
|
18
|
+
value = _ref.value,
|
|
19
|
+
onChange = _ref.onChange,
|
|
20
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
+
var _React$useState = React.useState(false),
|
|
22
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
23
|
+
innerOpen = _React$useState2[0],
|
|
24
|
+
setInnerOpen = _React$useState2[1];
|
|
25
|
+
var _useState = useState(value ? dayjs(value) : undefined),
|
|
26
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
+
internalValue = _useState2[0],
|
|
28
|
+
setInternalValue = _useState2[1];
|
|
29
|
+
var handleValueRender = function handleValueRender() {
|
|
30
|
+
if (internalValue) {
|
|
31
|
+
return internalValue.format('YYYY-MM-DD');
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
};
|
|
35
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CalendarPicker, {
|
|
36
|
+
month: month,
|
|
37
|
+
value: internalValue,
|
|
38
|
+
open: innerOpen,
|
|
39
|
+
afterOpenChange: function afterOpenChange(o) {
|
|
40
|
+
setInnerOpen(o);
|
|
41
|
+
},
|
|
42
|
+
onClose: function onClose() {
|
|
43
|
+
setInnerOpen(false);
|
|
44
|
+
},
|
|
45
|
+
onOk: function onOk(date) {
|
|
46
|
+
setInternalValue(date);
|
|
47
|
+
onChange === null || onChange === void 0 || onChange(date);
|
|
48
|
+
}
|
|
49
|
+
}), /*#__PURE__*/React.createElement(Cell, _extends({
|
|
50
|
+
onClick: function onClick() {
|
|
51
|
+
setInnerOpen(true);
|
|
52
|
+
}
|
|
53
|
+
}, rest), handleValueRender()));
|
|
54
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FC } from "react";
|
|
3
|
+
import dayjs from "dayjs";
|
|
4
|
+
import { CellProps } from "../Cell";
|
|
5
|
+
export type CalendarRangePickerCellProps = Omit<CellProps, 'value'> & {
|
|
6
|
+
month?: dayjs.Dayjs;
|
|
7
|
+
title?: React.ReactNode;
|
|
8
|
+
value?: (dayjs.Dayjs | Date)[];
|
|
9
|
+
onChange?: (date?: (dayjs.Dayjs | Date)[]) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const CalendarRangePickerCell: FC<CalendarRangePickerCellProps>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var _excluded = ["month", "title", "value", "onChange"];
|
|
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, { useState } from "react";
|
|
12
|
+
import Cell from "../Cell";
|
|
13
|
+
import CalendarPicker from "../CalendarPicker";
|
|
14
|
+
import { toDayjsArray } from "../utils/dayjs";
|
|
15
|
+
export var CalendarRangePickerCell = function CalendarRangePickerCell(_ref) {
|
|
16
|
+
var month = _ref.month,
|
|
17
|
+
title = _ref.title,
|
|
18
|
+
value = _ref.value,
|
|
19
|
+
onChange = _ref.onChange,
|
|
20
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
+
var _React$useState = React.useState(false),
|
|
22
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
23
|
+
innerOpen = _React$useState2[0],
|
|
24
|
+
setInnerOpen = _React$useState2[1];
|
|
25
|
+
var _useState = useState(toDayjsArray(value)),
|
|
26
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
+
internalValue = _useState2[0],
|
|
28
|
+
setInternalValue = _useState2[1];
|
|
29
|
+
var handleValueRender = function handleValueRender() {
|
|
30
|
+
if (internalValue && internalValue.length > 1) {
|
|
31
|
+
return internalValue.map(function (date) {
|
|
32
|
+
return date.format('YYYY-MM-DD');
|
|
33
|
+
}).join(' ~ ');
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
};
|
|
37
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CalendarPicker.Range, {
|
|
38
|
+
month: month,
|
|
39
|
+
value: internalValue,
|
|
40
|
+
open: innerOpen,
|
|
41
|
+
afterOpenChange: function afterOpenChange(o) {
|
|
42
|
+
setInnerOpen(o);
|
|
43
|
+
},
|
|
44
|
+
onClose: function onClose() {
|
|
45
|
+
setInnerOpen(false);
|
|
46
|
+
},
|
|
47
|
+
onOk: function onOk(date) {
|
|
48
|
+
setInternalValue(date);
|
|
49
|
+
onChange === null || onChange === void 0 || onChange(date);
|
|
50
|
+
}
|
|
51
|
+
}), /*#__PURE__*/React.createElement(Cell, _extends({
|
|
52
|
+
onClick: function onClick() {
|
|
53
|
+
setInnerOpen(true);
|
|
54
|
+
}
|
|
55
|
+
}, rest), handleValueRender()));
|
|
56
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { DemoBlock } from "../../DemoBlock";
|
|
9
|
+
import CalendarPickerCell from "../index";
|
|
10
|
+
export default (function () {
|
|
11
|
+
var toastContainer = React.useRef();
|
|
12
|
+
var _React$useState = React.useState(false),
|
|
13
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
14
|
+
open = _React$useState2[0],
|
|
15
|
+
setOpen = _React$useState2[1];
|
|
16
|
+
var _React$useState3 = React.useState(false),
|
|
17
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
18
|
+
open2 = _React$useState4[0],
|
|
19
|
+
setOpen2 = _React$useState4[1];
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DemoBlock, {
|
|
21
|
+
title: "\u65E5\u5386\u9009\u62E9"
|
|
22
|
+
}, /*#__PURE__*/React.createElement(CalendarPickerCell, {
|
|
23
|
+
label: "\u9009\u8C01\u65E5\u671F",
|
|
24
|
+
wrapperAlign: "right",
|
|
25
|
+
placeholder: "\u8BF7\u9009\u62E9\u65E5\u671F"
|
|
26
|
+
})), /*#__PURE__*/React.createElement(DemoBlock, {
|
|
27
|
+
title: "\u65E5\u5386\u9009\u62E9(\u533A\u95F4)"
|
|
28
|
+
}, /*#__PURE__*/React.createElement(CalendarPickerCell.Range, {
|
|
29
|
+
label: "\u9009\u8C01\u65E5\u671F\u533A\u95F4",
|
|
30
|
+
wrapperAlign: "right",
|
|
31
|
+
placeholder: "\u8BF7\u9009\u62E9\u65E5\u671F"
|
|
32
|
+
})));
|
|
33
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CalendarPickerCell as InternalCalendarPickerCell, CalendarPickerCellProps } from "./CalendarPickerCell";
|
|
2
|
+
import { CalendarRangePickerCell, CalendarRangePickerCellProps } from "./CalendarRangePickerCell";
|
|
3
|
+
type CompoundedComponent = typeof InternalCalendarPickerCell & {
|
|
4
|
+
Range: typeof CalendarRangePickerCell;
|
|
5
|
+
};
|
|
6
|
+
declare const CalendarPickerCell: CompoundedComponent;
|
|
7
|
+
export type { CalendarPickerCellProps, CalendarRangePickerCellProps };
|
|
8
|
+
export default CalendarPickerCell;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CalendarPickerCell as InternalCalendarPickerCell } from "./CalendarPickerCell";
|
|
2
|
+
import { CalendarRangePickerCell } from "./CalendarRangePickerCell";
|
|
3
|
+
var CalendarPickerCell = InternalCalendarPickerCell;
|
|
4
|
+
CalendarPickerCell.Range = CalendarRangePickerCell;
|
|
5
|
+
export default CalendarPickerCell;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
2
|
import './style.scss';
|
|
3
|
-
export type
|
|
3
|
+
export type CascaderPickerProps = {
|
|
4
4
|
className?: string;
|
|
5
5
|
style?: React.CSSProperties;
|
|
6
6
|
open?: boolean;
|
|
@@ -24,4 +24,4 @@ export type CascaderPopupProps = {
|
|
|
24
24
|
onClose?: () => void;
|
|
25
25
|
asyncRequest?: (parentValue?: any) => Promise<any>;
|
|
26
26
|
};
|
|
27
|
-
export declare const
|
|
27
|
+
export declare const CascaderPicker: FC<CascaderPickerProps>;
|
|
@@ -5,8 +5,8 @@ import CascaderView from "../CascaderView";
|
|
|
5
5
|
import ConfigProvider from "../ConfigProvider";
|
|
6
6
|
import Popup from "../Popup";
|
|
7
7
|
import "./style.scss";
|
|
8
|
-
var
|
|
9
|
-
export var
|
|
8
|
+
var cascaderPickerCls = 'triones-antm-cascader-picker';
|
|
9
|
+
export var CascaderPicker = /*#__PURE__*/React.memo(function (_ref) {
|
|
10
10
|
var className = _ref.className,
|
|
11
11
|
style = _ref.style,
|
|
12
12
|
_ref$open = _ref.open,
|
|
@@ -57,20 +57,20 @@ export var CascaderPopup = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
}, /*#__PURE__*/React.createElement("div", {
|
|
60
|
-
className: classNames(
|
|
60
|
+
className: classNames(cascaderPickerCls, className),
|
|
61
61
|
style: style
|
|
62
62
|
}, /*#__PURE__*/React.createElement("div", {
|
|
63
|
-
className: classNames("".concat(
|
|
63
|
+
className: classNames("".concat(cascaderPickerCls, "-header"))
|
|
64
64
|
}, /*#__PURE__*/React.createElement("a", {
|
|
65
|
-
className: classNames("".concat(
|
|
65
|
+
className: classNames("".concat(cascaderPickerCls, "-header-button"), "".concat(cascaderPickerCls, "-header-button-cancel")),
|
|
66
66
|
onClick: handelCancel
|
|
67
67
|
}, locale.common.cancel), title && /*#__PURE__*/React.createElement("div", {
|
|
68
|
-
className: classNames("".concat(
|
|
68
|
+
className: classNames("".concat(cascaderPickerCls, "-header-title"))
|
|
69
69
|
}, title), /*#__PURE__*/React.createElement("a", {
|
|
70
|
-
className: classNames("".concat(
|
|
70
|
+
className: classNames("".concat(cascaderPickerCls, "-header-button"), "".concat(cascaderPickerCls, "-header-button-ok")),
|
|
71
71
|
onClick: handleOk
|
|
72
72
|
}, locale.common.confirm)), /*#__PURE__*/React.createElement("div", {
|
|
73
|
-
className: classNames("".concat(
|
|
73
|
+
className: classNames("".concat(cascaderPickerCls, "-body"))
|
|
74
74
|
}, /*#__PURE__*/React.createElement(CascaderView
|
|
75
75
|
// open={ open}
|
|
76
76
|
, {
|
|
@@ -6,8 +6,8 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import React from "react";
|
|
8
8
|
import { DemoBlock } from "../../DemoBlock";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
9
|
+
import Button from "../../Button";
|
|
10
|
+
import { CascaderPicker } from "../cascader-picker";
|
|
11
11
|
export default (function () {
|
|
12
12
|
var _React$useState = React.useState(false),
|
|
13
13
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -64,10 +64,19 @@ export default (function () {
|
|
|
64
64
|
}];
|
|
65
65
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DemoBlock, {
|
|
66
66
|
title: "\u57FA\u672C\u4F7F\u7528"
|
|
67
|
-
}, /*#__PURE__*/React.createElement(Cell, {
|
|
68
|
-
label: 'Label',
|
|
69
|
-
wrapperAlign: "right"
|
|
70
67
|
}, /*#__PURE__*/React.createElement(CascaderPicker, {
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
open: open,
|
|
69
|
+
options: options,
|
|
70
|
+
onOk: function onOk(value) {
|
|
71
|
+
console.log(value);
|
|
72
|
+
},
|
|
73
|
+
onClose: function onClose() {
|
|
74
|
+
setOpen(false);
|
|
75
|
+
}
|
|
76
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
77
|
+
block: true,
|
|
78
|
+
onClick: function onClick() {
|
|
79
|
+
setOpen(true);
|
|
80
|
+
}
|
|
81
|
+
}, "\u7EA7\u8054\u9009\u62E9")));
|
|
73
82
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CascaderPicker } from "./
|
|
1
|
+
import { CascaderPicker } from "./cascader-picker";
|
|
2
2
|
export default CascaderPicker;
|