@nickeylin/antd-mobile-pro 2.0.3 → 2.1.0
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/cjs/components/checkbox/checkbox.d.ts +1 -1
- package/dist/cjs/components/checkbox/index.d.ts +1 -1
- package/dist/cjs/components/index.d.ts +1 -0
- package/dist/cjs/components/index.js +3 -0
- package/dist/cjs/components/input-captcha/input-captcha.d.ts +1 -1
- package/dist/cjs/components/pro-calendar/index.d.ts +10 -0
- package/dist/cjs/components/pro-calendar/index.js +42 -0
- package/dist/cjs/components/pro-calendar/pro-calendar.d.ts +37 -0
- package/dist/cjs/components/pro-calendar/pro-calendar.js +173 -0
- package/dist/cjs/components/pro-calendar/style.less +105 -0
- package/dist/cjs/components/pro-calendar/utils.d.ts +32 -0
- package/dist/cjs/components/pro-calendar/utils.js +175 -0
- package/dist/cjs/components/pro-calendar-picker/index.d.ts +3 -2
- package/dist/cjs/components/pro-calendar-picker/index.js +3 -2
- package/dist/cjs/components/pro-calendar-picker/pro-calendar-picker.d.ts +13 -0
- package/dist/cjs/components/pro-calendar-picker/pro-calendar-picker.js +141 -0
- package/dist/cjs/components/pro-calendar-picker/style.less +38 -0
- package/dist/cjs/components/pro-form/pro-form-item-calendar-picker.d.ts +1 -1
- package/dist/cjs/components/pro-form/pro-form-item-calendar-picker.js +12 -6
- package/dist/cjs/components/styles/global.less +6 -0
- package/dist/cjs/locales/base.d.ts +4 -0
- package/dist/cjs/locales/en-US.d.ts +4 -0
- package/dist/es/components/checkbox/checkbox.d.ts +1 -1
- package/dist/es/components/checkbox/index.d.ts +1 -1
- package/dist/es/components/index.d.ts +1 -0
- package/dist/es/components/index.js +1 -0
- package/dist/es/components/input-captcha/input-captcha.d.ts +1 -1
- package/dist/es/components/pro-calendar/index.d.ts +10 -0
- package/dist/es/components/pro-calendar/index.js +8 -0
- package/dist/es/components/pro-calendar/pro-calendar.d.ts +37 -0
- package/dist/es/components/pro-calendar/pro-calendar.js +138 -0
- package/dist/es/components/pro-calendar/style.less +105 -0
- package/dist/es/components/pro-calendar/utils.d.ts +32 -0
- package/dist/es/components/pro-calendar/utils.js +138 -0
- package/dist/es/components/pro-calendar-picker/index.d.ts +3 -2
- package/dist/es/components/pro-calendar-picker/index.js +2 -1
- package/dist/es/components/pro-calendar-picker/pro-calendar-picker.d.ts +13 -0
- package/dist/es/components/pro-calendar-picker/pro-calendar-picker.js +124 -0
- package/dist/es/components/pro-calendar-picker/style.less +38 -0
- package/dist/es/components/pro-form/pro-form-item-calendar-picker.d.ts +1 -1
- package/dist/es/components/pro-form/pro-form-item-calendar-picker.js +8 -8
- package/dist/es/components/styles/global.less +6 -0
- package/dist/es/locales/base.d.ts +4 -0
- package/dist/es/locales/en-US.d.ts +4 -0
- package/dist/umd/antd-mobile-pro.min.css +1 -1
- package/dist/umd/antd-mobile-pro.min.js +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import dayjs from 'dayjs';
|
|
4
|
+
export var HALF_DAY_PERIOD = /*#__PURE__*/function (HALF_DAY_PERIOD) {
|
|
5
|
+
HALF_DAY_PERIOD[HALF_DAY_PERIOD["ALL"] = 0] = "ALL";
|
|
6
|
+
HALF_DAY_PERIOD[HALF_DAY_PERIOD["AM"] = 1] = "AM";
|
|
7
|
+
HALF_DAY_PERIOD[HALF_DAY_PERIOD["PM"] = 2] = "PM";
|
|
8
|
+
HALF_DAY_PERIOD[HALF_DAY_PERIOD["NIGHT"] = 3] = "NIGHT";
|
|
9
|
+
return HALF_DAY_PERIOD;
|
|
10
|
+
}({});
|
|
11
|
+
export var HALF_DAY_PERIOD_NAMES = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, HALF_DAY_PERIOD.ALL, '全天'), HALF_DAY_PERIOD.AM, '上午'), HALF_DAY_PERIOD.PM, '下午'), HALF_DAY_PERIOD.NIGHT, '晚上');
|
|
12
|
+
/**
|
|
13
|
+
* 将选择的起止日期合并为有效的日期范围
|
|
14
|
+
*/
|
|
15
|
+
export function mergeDates(dates) {
|
|
16
|
+
var sortedDates = dates.slice().sort(function (a, b) {
|
|
17
|
+
return dayjs(a).diff(b, 'day');
|
|
18
|
+
});
|
|
19
|
+
var _sortedDates = _slicedToArray(sortedDates, 2),
|
|
20
|
+
begin = _sortedDates[0],
|
|
21
|
+
end = _sortedDates[1];
|
|
22
|
+
var beginDay = dayjs(begin);
|
|
23
|
+
if (beginDay.isSame(end, 'day')) {
|
|
24
|
+
// 起始和结束在同一天
|
|
25
|
+
|
|
26
|
+
if (!begin.period || !end.period) {
|
|
27
|
+
// 若其中一个为整天,合并为整天
|
|
28
|
+
begin.period = undefined;
|
|
29
|
+
return [end];
|
|
30
|
+
}
|
|
31
|
+
if (begin.period === end.period) {
|
|
32
|
+
// 若时段一样,只取其中一个
|
|
33
|
+
return [begin];
|
|
34
|
+
}
|
|
35
|
+
if ([begin.period, end.period].includes(HALF_DAY_PERIOD.AM)) {
|
|
36
|
+
// 若时段不一样,其中一个为上午,合并为整天(另外一个一定为下午或晚上)
|
|
37
|
+
begin.period = undefined;
|
|
38
|
+
return [begin];
|
|
39
|
+
}
|
|
40
|
+
return sortedDates;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// 不在同一天
|
|
44
|
+
if (begin.period === HALF_DAY_PERIOD.AM) {
|
|
45
|
+
begin.period = undefined;
|
|
46
|
+
}
|
|
47
|
+
if (end.period && end.period >= HALF_DAY_PERIOD.PM) {
|
|
48
|
+
end.period = undefined;
|
|
49
|
+
}
|
|
50
|
+
return [begin, end];
|
|
51
|
+
}
|
|
52
|
+
export function classesForDate(date, rangeValue) {
|
|
53
|
+
var dd = dayjs(date);
|
|
54
|
+
var _rangeValue = _slicedToArray(rangeValue, 2),
|
|
55
|
+
begin = _rangeValue[0],
|
|
56
|
+
end = _rangeValue[1];
|
|
57
|
+
var isAm = false;
|
|
58
|
+
var isPm = false;
|
|
59
|
+
var isNight = false;
|
|
60
|
+
var isAllDay = false;
|
|
61
|
+
var isCover = false;
|
|
62
|
+
var isBegin = false;
|
|
63
|
+
var isEnd = false;
|
|
64
|
+
if (begin) {
|
|
65
|
+
if (dd.isSame(begin, 'day')) {
|
|
66
|
+
isAm = begin.period === HALF_DAY_PERIOD.AM;
|
|
67
|
+
isPm = begin.period === HALF_DAY_PERIOD.PM;
|
|
68
|
+
isNight = begin.period === HALF_DAY_PERIOD.NIGHT;
|
|
69
|
+
isAllDay = !begin.period;
|
|
70
|
+
isBegin = true;
|
|
71
|
+
if (!end) {
|
|
72
|
+
isEnd = true;
|
|
73
|
+
} else if (!begin.period || begin.period === HALF_DAY_PERIOD.AM) {
|
|
74
|
+
isCover = true;
|
|
75
|
+
}
|
|
76
|
+
} else if (end && dd.isSame(end, 'day')) {
|
|
77
|
+
isAm = end.period === HALF_DAY_PERIOD.AM;
|
|
78
|
+
isPm = end.period === HALF_DAY_PERIOD.PM;
|
|
79
|
+
isNight = end.period === HALF_DAY_PERIOD.NIGHT;
|
|
80
|
+
isAllDay = !end.period;
|
|
81
|
+
isEnd = true;
|
|
82
|
+
isCover = !!end.period && end.period >= HALF_DAY_PERIOD.PM;
|
|
83
|
+
} else if (end) {
|
|
84
|
+
isCover = dd.isAfter(begin, 'day') && dd.isBefore(end, 'day');
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
am: isAm,
|
|
89
|
+
pm: isPm,
|
|
90
|
+
night: isNight,
|
|
91
|
+
allday: isAllDay,
|
|
92
|
+
begin: isBegin,
|
|
93
|
+
end: isEnd,
|
|
94
|
+
cover: isCover,
|
|
95
|
+
weekend: dd.day() === 0 || dd.day() === 6
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export function formatProCalendarDate(date) {
|
|
99
|
+
if (!date) {
|
|
100
|
+
return '';
|
|
101
|
+
}
|
|
102
|
+
var dateStr = dayjs(date).format('YYYY-MM-DD');
|
|
103
|
+
var periodStr = !date.period ? '' : HALF_DAY_PERIOD_NAMES[date.period];
|
|
104
|
+
return [dateStr, periodStr].filter(function (v) {
|
|
105
|
+
return !!v;
|
|
106
|
+
}).join(' ');
|
|
107
|
+
}
|
|
108
|
+
export function formatProCalendarDateValues(dates) {
|
|
109
|
+
if (!dates) {
|
|
110
|
+
return '';
|
|
111
|
+
}
|
|
112
|
+
var arr = Array.isArray(dates) ? dates : [dates];
|
|
113
|
+
return arr.map(formatProCalendarDate).join(' ~ ');
|
|
114
|
+
}
|
|
115
|
+
export function computeDays(value) {
|
|
116
|
+
if (!value) {
|
|
117
|
+
return 0;
|
|
118
|
+
}
|
|
119
|
+
var rangeValue = Array.isArray(value) ? value : [value];
|
|
120
|
+
var _rangeValue2 = _slicedToArray(rangeValue, 2),
|
|
121
|
+
begin = _rangeValue2[0],
|
|
122
|
+
end = _rangeValue2[1];
|
|
123
|
+
if (!end) {
|
|
124
|
+
if (!begin.period) return 1;
|
|
125
|
+
if (begin.period === HALF_DAY_PERIOD.NIGHT) return 0;
|
|
126
|
+
return 0.5;
|
|
127
|
+
}
|
|
128
|
+
var days = dayjs(end).diff(dayjs(begin), 'day') + 1;
|
|
129
|
+
if (begin.period === HALF_DAY_PERIOD.PM) {
|
|
130
|
+
days -= 0.5;
|
|
131
|
+
} else if (begin.period === HALF_DAY_PERIOD.NIGHT) {
|
|
132
|
+
days -= 1;
|
|
133
|
+
}
|
|
134
|
+
if (end.period === HALF_DAY_PERIOD.AM) {
|
|
135
|
+
days -= 0.5;
|
|
136
|
+
}
|
|
137
|
+
return days;
|
|
138
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import ProCalendarPicker from './picker';
|
|
1
|
+
import ProCalendarPicker from './pro-calendar-picker';
|
|
2
|
+
import './style.less';
|
|
2
3
|
export default ProCalendarPicker;
|
|
3
|
-
export type { ProCalendarPickerActions, ProCalendarPickerProps, } from './picker';
|
|
4
|
+
export type { ProCalendarPickerActions, ProCalendarPickerProps, } from './pro-calendar-picker';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CalendarRef } from 'antd-mobile';
|
|
2
|
+
import { PickerActions } from 'antd-mobile/es/components/picker';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { ProCalendarDate, ProCalendarProps } from '../pro-calendar';
|
|
5
|
+
export interface ProCalendarPickerActions extends Partial<CalendarRef>, PickerActions {
|
|
6
|
+
}
|
|
7
|
+
export type ProCalendarPickerValue = ProCalendarDate | ProCalendarDate[] | null | undefined;
|
|
8
|
+
export type ProCalendarPickerProps = ProCalendarProps & {
|
|
9
|
+
allowClear?: boolean;
|
|
10
|
+
children?: (value: ProCalendarPickerValue, action: ProCalendarPickerActions) => ReactNode;
|
|
11
|
+
};
|
|
12
|
+
declare const ProCalendarPicker: import("react").ForwardRefExoticComponent<ProCalendarPickerProps & import("react").RefAttributes<ProCalendarPickerActions>>;
|
|
13
|
+
export default ProCalendarPicker;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["children", "allowClear", "selectionMode", "value", "onChange"];
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
import { useControllableValue } from 'ahooks';
|
|
8
|
+
import { Button, Popup, SafeArea } from 'antd-mobile';
|
|
9
|
+
import { CloseOutline } from 'antd-mobile-icons';
|
|
10
|
+
import { pickBy } from 'lodash';
|
|
11
|
+
import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
12
|
+
import { cn } from "../../utils/bem";
|
|
13
|
+
import ProCalendar from "../pro-calendar";
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
17
|
+
var bem = cn('calendar-picker');
|
|
18
|
+
var ProCalendarPickerRaw = function ProCalendarPickerRaw(_ref, ref) {
|
|
19
|
+
var children = _ref.children,
|
|
20
|
+
_ref$allowClear = _ref.allowClear,
|
|
21
|
+
allowClear = _ref$allowClear === void 0 ? false : _ref$allowClear,
|
|
22
|
+
_ref$selectionMode = _ref.selectionMode,
|
|
23
|
+
selectionMode = _ref$selectionMode === void 0 ? 'single' : _ref$selectionMode,
|
|
24
|
+
valueProp = _ref.value,
|
|
25
|
+
onChange = _ref.onChange,
|
|
26
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
27
|
+
var _useControllableValue = useControllableValue(pickBy({
|
|
28
|
+
value: valueProp,
|
|
29
|
+
onChange: onChange
|
|
30
|
+
})),
|
|
31
|
+
_useControllableValue2 = _slicedToArray(_useControllableValue, 2),
|
|
32
|
+
value = _useControllableValue2[0],
|
|
33
|
+
setValue = _useControllableValue2[1];
|
|
34
|
+
var _useState = useState(false),
|
|
35
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
+
visible = _useState2[0],
|
|
37
|
+
setVisible = _useState2[1];
|
|
38
|
+
var _useState3 = useState(valueProp),
|
|
39
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
40
|
+
tempValue = _useState4[0],
|
|
41
|
+
setTempValue = _useState4[1];
|
|
42
|
+
useEffect(function () {
|
|
43
|
+
if (visible) setTempValue(value !== null && value !== void 0 ? value : null);
|
|
44
|
+
}, [value, visible]);
|
|
45
|
+
var calendarRef = useRef(null);
|
|
46
|
+
var action = useMemo(function () {
|
|
47
|
+
return _objectSpread(_objectSpread({}, calendarRef.current), {}, {
|
|
48
|
+
open: function open() {
|
|
49
|
+
setVisible(true);
|
|
50
|
+
},
|
|
51
|
+
close: function close() {
|
|
52
|
+
setVisible(false);
|
|
53
|
+
},
|
|
54
|
+
toggle: function toggle() {
|
|
55
|
+
setVisible(function (v) {
|
|
56
|
+
return !v;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}, []);
|
|
61
|
+
useImperativeHandle(ref, function () {
|
|
62
|
+
return action;
|
|
63
|
+
});
|
|
64
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
65
|
+
children: [children === null || children === void 0 ? void 0 : children(value, action), /*#__PURE__*/_jsxs(Popup, {
|
|
66
|
+
visible: visible,
|
|
67
|
+
onClose: function onClose() {
|
|
68
|
+
return setVisible(false);
|
|
69
|
+
},
|
|
70
|
+
className: bem('popup'),
|
|
71
|
+
destroyOnClose: true,
|
|
72
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
73
|
+
className: bem('popup-head'),
|
|
74
|
+
children: [allowClear && /*#__PURE__*/_jsx(Button, {
|
|
75
|
+
color: "default",
|
|
76
|
+
fill: "none",
|
|
77
|
+
size: "small",
|
|
78
|
+
className: bem('popup-head__clear'),
|
|
79
|
+
onClick: function onClick() {
|
|
80
|
+
setValue(undefined);
|
|
81
|
+
setVisible(false);
|
|
82
|
+
},
|
|
83
|
+
children: "\u6E05\u9664"
|
|
84
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
85
|
+
className: bem('popup-head__title'),
|
|
86
|
+
children: "\u65E5\u671F\u9009\u62E9"
|
|
87
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
88
|
+
color: "default",
|
|
89
|
+
fill: "none",
|
|
90
|
+
size: "small",
|
|
91
|
+
className: bem('popup-head__close'),
|
|
92
|
+
onClick: function onClick() {
|
|
93
|
+
setVisible(false);
|
|
94
|
+
},
|
|
95
|
+
children: /*#__PURE__*/_jsx(CloseOutline, {})
|
|
96
|
+
})]
|
|
97
|
+
}), /*#__PURE__*/_jsx(ProCalendar, _objectSpread(_objectSpread({
|
|
98
|
+
selectionMode: selectionMode,
|
|
99
|
+
value: tempValue !== null && tempValue !== void 0 ? tempValue : null,
|
|
100
|
+
onChange: function onChange(v) {
|
|
101
|
+
setTempValue(v);
|
|
102
|
+
}
|
|
103
|
+
}, props), {}, {
|
|
104
|
+
ref: calendarRef
|
|
105
|
+
})), /*#__PURE__*/_jsxs("div", {
|
|
106
|
+
className: bem('popup-footer'),
|
|
107
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
108
|
+
block: true,
|
|
109
|
+
color: "primary",
|
|
110
|
+
onClick: function onClick() {
|
|
111
|
+
console.log('setValue', tempValue);
|
|
112
|
+
setValue(tempValue);
|
|
113
|
+
setVisible(false);
|
|
114
|
+
},
|
|
115
|
+
children: "\u786E\u5B9A"
|
|
116
|
+
}), /*#__PURE__*/_jsx(SafeArea, {
|
|
117
|
+
position: "bottom"
|
|
118
|
+
})]
|
|
119
|
+
})]
|
|
120
|
+
})]
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
var ProCalendarPicker = /*#__PURE__*/forwardRef(ProCalendarPickerRaw);
|
|
124
|
+
export default ProCalendarPicker;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
@import '../styles/variable.less';
|
|
2
|
+
|
|
3
|
+
@class-prefix-pro-calendar-picker:~ '@{adm-pro-prefix}-calendar-picker';
|
|
4
|
+
.@{class-prefix-pro-calendar-picker} {
|
|
5
|
+
&__popup-head {
|
|
6
|
+
font-size: var(--adm-font-size-9);
|
|
7
|
+
color: var(--adm-color-text);
|
|
8
|
+
position: relative;
|
|
9
|
+
border-bottom: 1px solid var(--adm-color-border);
|
|
10
|
+
margin-bottom: 10px;
|
|
11
|
+
& &__clear {
|
|
12
|
+
position: absolute;
|
|
13
|
+
left: 6px;
|
|
14
|
+
top: 0;
|
|
15
|
+
bottom: 0;
|
|
16
|
+
margin: auto;
|
|
17
|
+
padding: 6px 12px;
|
|
18
|
+
height: 30px;
|
|
19
|
+
}
|
|
20
|
+
&__title {
|
|
21
|
+
text-align: center;
|
|
22
|
+
line-height: 45px;
|
|
23
|
+
}
|
|
24
|
+
& &__close {
|
|
25
|
+
position: absolute;
|
|
26
|
+
right: 6px;
|
|
27
|
+
top: 0;
|
|
28
|
+
bottom: 0;
|
|
29
|
+
margin: auto;
|
|
30
|
+
padding: 6px 12px;
|
|
31
|
+
height: 30px;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
&__popup-footer {
|
|
35
|
+
padding: var(--adm-padding-m) var(--adm-padding-l);
|
|
36
|
+
border-top: 1px solid var(--adm-color-border);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { ProCalendarPickerProps } from '../pro-calendar-picker';
|
|
3
3
|
import { ProFormItemFieldProps } from './pro-form-item';
|
|
4
|
-
export type ProFormCalendarPickerProps = ProFormItemFieldProps<ProCalendarPickerProps> & Pick<ProCalendarPickerProps, '
|
|
4
|
+
export type ProFormCalendarPickerProps = ProFormItemFieldProps<ProCalendarPickerProps> & Pick<ProCalendarPickerProps, 'selectionMode' | 'min' | 'max' | 'enableHalfDay'>;
|
|
5
5
|
declare const ProFormCalendarPicker: FC<ProFormCalendarPickerProps>;
|
|
6
6
|
export default ProFormCalendarPicker;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["fieldProps", "placeholder", "
|
|
3
|
+
var _excluded = ["fieldProps", "placeholder", "selectionMode", "min", "max", "enableHalfDay", "onClick"];
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
import { useConfig } from "../config-provider";
|
|
7
|
+
import ProCalendar from "../pro-calendar";
|
|
7
8
|
import ProCalendarPicker from "../pro-calendar-picker";
|
|
8
9
|
import ProFormItem, { ProFormItemValue } from "./pro-form-item";
|
|
9
10
|
import { useReadonly } from "./utils";
|
|
@@ -14,21 +15,20 @@ var ProFormCalendarPicker = function ProFormCalendarPicker(p) {
|
|
|
14
15
|
var fieldProps = p.fieldProps,
|
|
15
16
|
_p$placeholder = p.placeholder,
|
|
16
17
|
placeholder = _p$placeholder === void 0 ? locale.common.selectPlaceholder : _p$placeholder,
|
|
17
|
-
|
|
18
|
+
selectionMode = p.selectionMode,
|
|
18
19
|
min = p.min,
|
|
19
20
|
max = p.max,
|
|
20
|
-
|
|
21
|
+
enableHalfDay = p.enableHalfDay,
|
|
21
22
|
_onClick = p.onClick,
|
|
22
23
|
props = _objectWithoutProperties(p, _excluded);
|
|
23
24
|
var calendarProps = _objectSpread({
|
|
24
|
-
|
|
25
|
+
selectionMode: selectionMode,
|
|
25
26
|
min: min,
|
|
26
27
|
max: max,
|
|
27
|
-
|
|
28
|
+
enableHalfDay: enableHalfDay
|
|
28
29
|
}, fieldProps);
|
|
29
30
|
var readonly = useReadonly(props);
|
|
30
31
|
return /*#__PURE__*/_jsx(ProFormItem, _objectSpread(_objectSpread({}, props), {}, {
|
|
31
|
-
trigger: "onConfirm",
|
|
32
32
|
onClick: function onClick(e, pickerRef) {
|
|
33
33
|
var _pickerRef$current;
|
|
34
34
|
(_pickerRef$current = pickerRef.current) === null || _pickerRef$current === void 0 || _pickerRef$current.open();
|
|
@@ -36,10 +36,10 @@ var ProFormCalendarPicker = function ProFormCalendarPicker(p) {
|
|
|
36
36
|
},
|
|
37
37
|
children: /*#__PURE__*/_jsx(ProCalendarPicker, _objectSpread(_objectSpread({}, calendarProps), {}, {
|
|
38
38
|
children: function children(val) {
|
|
39
|
-
var value =
|
|
39
|
+
var value = ProCalendar.defaultFormat(val);
|
|
40
40
|
return /*#__PURE__*/_jsx(ProFormItemValue, {
|
|
41
41
|
placeholder: placeholder,
|
|
42
|
-
value: value
|
|
42
|
+
value: value || undefined,
|
|
43
43
|
readonly: readonly
|
|
44
44
|
});
|
|
45
45
|
}
|
|
@@ -12,6 +12,7 @@ declare const base: {
|
|
|
12
12
|
confirm: string;
|
|
13
13
|
start: string;
|
|
14
14
|
end: string;
|
|
15
|
+
startAndEnd: string;
|
|
15
16
|
today: string;
|
|
16
17
|
markItems: string[];
|
|
17
18
|
yearAndMonth: string;
|
|
@@ -112,6 +113,9 @@ declare const base: {
|
|
|
112
113
|
Modal: {
|
|
113
114
|
ok: string;
|
|
114
115
|
};
|
|
116
|
+
NumberKeyboard: {
|
|
117
|
+
backspace: string;
|
|
118
|
+
};
|
|
115
119
|
PasscodeInput: {
|
|
116
120
|
name: string;
|
|
117
121
|
};
|
|
@@ -11,6 +11,7 @@ declare const enUS: {
|
|
|
11
11
|
confirm: string;
|
|
12
12
|
start: string;
|
|
13
13
|
end: string;
|
|
14
|
+
startAndEnd: string;
|
|
14
15
|
today: string;
|
|
15
16
|
markItems: string[];
|
|
16
17
|
yearAndMonth: string;
|
|
@@ -111,6 +112,9 @@ declare const enUS: {
|
|
|
111
112
|
Modal: {
|
|
112
113
|
ok: string;
|
|
113
114
|
};
|
|
115
|
+
NumberKeyboard: {
|
|
116
|
+
backspace: string;
|
|
117
|
+
};
|
|
114
118
|
PasscodeInput: {
|
|
115
119
|
name: string;
|
|
116
120
|
};
|