@trionesdev/antd-mobile-react 0.0.2-beta.12 → 0.0.2-beta.14
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/FloatButton/FloatButton.d.ts +21 -0
- package/dist/FloatButton/FloatButton.js +66 -0
- package/dist/FloatButton/FloatButtonGroup.d.ts +21 -0
- package/dist/FloatButton/FloatButtonGroup.js +120 -0
- package/dist/FloatButton/context.d.ts +13 -0
- package/dist/FloatButton/context.js +2 -0
- package/dist/FloatButton/demo/base.d.ts +3 -0
- package/dist/FloatButton/demo/base.js +10 -0
- package/dist/FloatButton/demo/group.d.ts +3 -0
- package/dist/FloatButton/demo/group.js +20 -0
- package/dist/FloatButton/demo/square.d.ts +3 -0
- package/dist/FloatButton/demo/square.js +12 -0
- package/dist/FloatButton/index.d.ts +10 -0
- package/dist/FloatButton/index.js +5 -0
- package/dist/FloatButton/style.scss +123 -0
- package/dist/Picker/picker.d.ts +1 -0
- package/dist/Picker/picker.js +3 -6
- package/dist/Segmented/demo/base.d.ts +3 -0
- package/dist/Segmented/demo/base.js +33 -0
- package/dist/Segmented/index.d.ts +3 -0
- package/dist/Segmented/index.js +2 -0
- package/dist/index.d.ts +14 -6
- package/dist/index.js +7 -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
package/dist/Picker/picker.d.ts
CHANGED
package/dist/Picker/picker.js
CHANGED
|
@@ -15,6 +15,8 @@ var pickerCls = 'triones-antm-picker';
|
|
|
15
15
|
export var Picker = /*#__PURE__*/React.memo(function (_ref) {
|
|
16
16
|
var open = _ref.open,
|
|
17
17
|
afterOpenChange = _ref.afterOpenChange,
|
|
18
|
+
_ref$round = _ref.round,
|
|
19
|
+
round = _ref$round === void 0 ? true : _ref$round,
|
|
18
20
|
title = _ref.title,
|
|
19
21
|
columns = _ref.columns,
|
|
20
22
|
_ref$labelInValue = _ref.labelInValue,
|
|
@@ -66,12 +68,7 @@ export var Picker = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
66
68
|
onClose: function onClose() {
|
|
67
69
|
setInnerOpen(false);
|
|
68
70
|
},
|
|
69
|
-
|
|
70
|
-
body: {
|
|
71
|
-
borderTopLeftRadius: 6,
|
|
72
|
-
borderTopRightRadius: 6
|
|
73
|
-
}
|
|
74
|
-
}
|
|
71
|
+
round: round
|
|
75
72
|
}, /*#__PURE__*/React.createElement("div", {
|
|
76
73
|
className: classNames(pickerCls)
|
|
77
74
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Segmented } from "@trionesdev/antd-mobile-base-react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { DemoBlock } from "../../DemoBlock";
|
|
4
|
+
export default (function () {
|
|
5
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DemoBlock, {
|
|
6
|
+
title: "\u57FA\u672C\u4F7F\u7528"
|
|
7
|
+
}, /*#__PURE__*/React.createElement(Segmented, {
|
|
8
|
+
options: [{
|
|
9
|
+
label: '选项1',
|
|
10
|
+
value: '1'
|
|
11
|
+
}, {
|
|
12
|
+
label: '选项2',
|
|
13
|
+
value: '2'
|
|
14
|
+
}, {
|
|
15
|
+
label: '选项3',
|
|
16
|
+
value: '3'
|
|
17
|
+
}]
|
|
18
|
+
})), /*#__PURE__*/React.createElement(DemoBlock, {
|
|
19
|
+
title: "block \u5C5E\u6027\u4F7F\u5176\u9002\u5408\u7236\u5143\u7D20\u5BBD\u5EA6"
|
|
20
|
+
}, /*#__PURE__*/React.createElement(Segmented, {
|
|
21
|
+
block: true,
|
|
22
|
+
options: [{
|
|
23
|
+
label: '选项1',
|
|
24
|
+
value: '1'
|
|
25
|
+
}, {
|
|
26
|
+
label: '选项2',
|
|
27
|
+
value: '2'
|
|
28
|
+
}, {
|
|
29
|
+
label: '选项3',
|
|
30
|
+
value: '3'
|
|
31
|
+
}]
|
|
32
|
+
})));
|
|
33
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -10,16 +10,20 @@ export { default as Button } from './Button';
|
|
|
10
10
|
export type { ButtonProps } from './Button';
|
|
11
11
|
export { default as Calendar, CalendarGrid, TouchableCalendarGrid, } from './Calendar';
|
|
12
12
|
export type { CalendarGridProps, CalendarProps } from './Calendar';
|
|
13
|
-
export { default as
|
|
14
|
-
export type {
|
|
15
|
-
export { default as
|
|
16
|
-
export type {
|
|
13
|
+
export { default as CalendarDatetimePicker } from './CalendarDatetimePicker';
|
|
14
|
+
export type { CalendarDatetimePickerProps } from './CalendarDatetimePicker';
|
|
15
|
+
export { default as CalendarDatetimePickerCell } from './CalendarDatetimePickerCell';
|
|
16
|
+
export type { CalendarDatetimePickerCellProps } from './CalendarDatetimePickerCell';
|
|
17
|
+
export { default as CalendarPicker } from './CalendarPicker';
|
|
18
|
+
export type { CalendarPickerProps } from './CalendarPicker';
|
|
19
|
+
export { default as CalendarPickerCell } from './CalendarPickerCell';
|
|
20
|
+
export type { CalendarPickerCellProps, CalendarRangePickerCellProps } from './CalendarPickerCell';
|
|
17
21
|
export { default as Card } from './Card';
|
|
18
22
|
export type { CardProps } from './Card';
|
|
23
|
+
export { default as CascaderPickerCell } from './CascaderPickerCell';
|
|
24
|
+
export type { CascaderPickerCellProps } from './CascaderPickerCell';
|
|
19
25
|
export { default as CascaderPicker } from './CascaderPicker';
|
|
20
26
|
export type { CascaderPickerProps } from './CascaderPicker';
|
|
21
|
-
export { default as CascaderPopup } from './CascaderPopup';
|
|
22
|
-
export type { CascaderPopupProps } from './CascaderPopup';
|
|
23
27
|
export { default as CascaderView } from './CascaderView';
|
|
24
28
|
export type { CascaderViewProps } from './CascaderView';
|
|
25
29
|
export { default as Cell } from './Cell';
|
|
@@ -38,6 +42,8 @@ export { default as Empty } from './Empty';
|
|
|
38
42
|
export type { EmptyProps } from './Empty';
|
|
39
43
|
export { default as ErrorBlock } from './ErrorBlock';
|
|
40
44
|
export type { ErrorBlockStatus, ErrorBlockProps } from './ErrorBlock';
|
|
45
|
+
export { default as FloatButton } from './FloatButton';
|
|
46
|
+
export type { FloatButtonProps, FloatButtonGroupProps } from './FloatButton';
|
|
41
47
|
export { default as Footer } from './Footer';
|
|
42
48
|
export type { FooterProps } from './Footer';
|
|
43
49
|
export { default as Form } from './Form';
|
|
@@ -82,6 +88,8 @@ export { default as Scaffold } from './Scaffold';
|
|
|
82
88
|
export type { ScaffoldProps } from './Scaffold';
|
|
83
89
|
export { default as ScrollView } from './ScrollView';
|
|
84
90
|
export type { ScrollViewProps } from './ScrollView';
|
|
91
|
+
export { default as Segmented } from './Segmented';
|
|
92
|
+
export type { SegmentedProps } from './Segmented';
|
|
85
93
|
export { default as SideBar } from './SideBar';
|
|
86
94
|
export type { SideBarProps } from './SideBar';
|
|
87
95
|
export { default as Space } from './Space';
|
package/dist/index.js
CHANGED
|
@@ -4,11 +4,13 @@ export { default as Avatar } from "./Avatar";
|
|
|
4
4
|
export { default as Badge } from "./Badge";
|
|
5
5
|
export { default as Button } from "./Button";
|
|
6
6
|
export { default as Calendar, CalendarGrid, TouchableCalendarGrid } from "./Calendar";
|
|
7
|
-
export { default as
|
|
8
|
-
export { default as
|
|
7
|
+
export { default as CalendarDatetimePicker } from "./CalendarDatetimePicker";
|
|
8
|
+
export { default as CalendarDatetimePickerCell } from "./CalendarDatetimePickerCell";
|
|
9
|
+
export { default as CalendarPicker } from "./CalendarPicker";
|
|
10
|
+
export { default as CalendarPickerCell } from "./CalendarPickerCell";
|
|
9
11
|
export { default as Card } from "./Card";
|
|
12
|
+
export { default as CascaderPickerCell } from "./CascaderPickerCell";
|
|
10
13
|
export { default as CascaderPicker } from "./CascaderPicker";
|
|
11
|
-
export { default as CascaderPopup } from "./CascaderPopup";
|
|
12
14
|
export { default as CascaderView } from "./CascaderView";
|
|
13
15
|
export { default as Cell } from "./Cell";
|
|
14
16
|
export { default as Checkbox } from "./Checkbox";
|
|
@@ -18,6 +20,7 @@ export { default as Divider } from "./Divider";
|
|
|
18
20
|
export { default as Ellipsis } from "./Ellipsis";
|
|
19
21
|
export { default as Empty } from "./Empty";
|
|
20
22
|
export { default as ErrorBlock } from "./ErrorBlock";
|
|
23
|
+
export { default as FloatButton } from "./FloatButton";
|
|
21
24
|
export { default as Footer } from "./Footer";
|
|
22
25
|
export { default as Form } from "./Form";
|
|
23
26
|
export { default as Grid } from "./Grid";
|
|
@@ -40,6 +43,7 @@ export { default as Result } from "./Result";
|
|
|
40
43
|
export { default as SafeArea } from "./SafeArea";
|
|
41
44
|
export { default as Scaffold } from "./Scaffold";
|
|
42
45
|
export { default as ScrollView } from "./ScrollView";
|
|
46
|
+
export { default as Segmented } from "./Segmented";
|
|
43
47
|
export { default as SideBar } from "./SideBar";
|
|
44
48
|
export { default as Space } from "./Space";
|
|
45
49
|
export { default as SpinLoading } from "./SpinLoading";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import dayjs, { OpUnitType } from "dayjs";
|
|
2
|
+
export declare const toDayjsArray: (dateArr?: (dayjs.Dayjs | Date)[]) => dayjs.Dayjs[] | undefined;
|
|
3
|
+
export declare const isSame: (x?: dayjs.Dayjs | Date, y?: dayjs.Dayjs | Date, unit?: OpUnitType) => boolean;
|
|
4
|
+
export declare const isSameArray: (x?: (dayjs.Dayjs | Date)[], y?: (dayjs.Dayjs | Date)[], unit?: OpUnitType) => boolean;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
import { isEmpty, isNil } from "lodash-es";
|
|
3
|
+
export var toDayjsArray = function toDayjsArray(dateArr) {
|
|
4
|
+
if (isNil(dateArr)) {
|
|
5
|
+
return dateArr;
|
|
6
|
+
}
|
|
7
|
+
if (isEmpty(dateArr)) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
return dateArr === null || dateArr === void 0 ? void 0 : dateArr.map(function (date) {
|
|
11
|
+
if (isNil(date)) {
|
|
12
|
+
return date;
|
|
13
|
+
} else {
|
|
14
|
+
return dayjs(date);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
export var isSame = function isSame(x, y, unit) {
|
|
19
|
+
if (isNil(x) && isNil(y)) {
|
|
20
|
+
return true;
|
|
21
|
+
} else if (isNil(x) && !isNil(y)) {
|
|
22
|
+
return false;
|
|
23
|
+
} else if (!isNil(x) && isNil(y)) {
|
|
24
|
+
return false;
|
|
25
|
+
} else {
|
|
26
|
+
var _dayjs;
|
|
27
|
+
return Boolean((_dayjs = dayjs(x)) === null || _dayjs === void 0 ? void 0 : _dayjs.isSame(y, unit));
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export var isSameArray = function isSameArray(x, y, unit) {
|
|
31
|
+
var xa = x !== null && x !== void 0 ? x : [];
|
|
32
|
+
var ya = y !== null && y !== void 0 ? y : [];
|
|
33
|
+
if (xa.length === 0 && ya.length === 0) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
if (xa.length !== ya.length) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
return xa.every(function (date, index) {
|
|
40
|
+
return isSame(date, ya[index], unit);
|
|
41
|
+
});
|
|
42
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trionesdev/antd-mobile-react",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.14",
|
|
4
4
|
"description": "antd mobile react ",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"stylelint": "^16.12.0"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@trionesdev/antd-mobile-base-react": "^0.0.2-beta.
|
|
92
|
+
"@trionesdev/antd-mobile-base-react": "^0.0.2-beta.14",
|
|
93
93
|
"ahooks": "^3.8.4",
|
|
94
94
|
"crypto-js": "^4.2.0",
|
|
95
95
|
"dayjs": "^1.11.19",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
},
|
|
98
98
|
"optionalDependencies": {
|
|
99
99
|
"@trionesdev/antd-mobile-base-react": "workspace:*",
|
|
100
|
-
"@trionesdev/antd-mobile-icons-react": "0.0.2-beta.
|
|
100
|
+
"@trionesdev/antd-mobile-icons-react": "0.0.2-beta.14"
|
|
101
101
|
},
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "5d9e7dbf380ca19c5e35509f0a31865ec5bdcc06"
|
|
103
103
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import './style.scss';
|
|
3
|
-
export type CalendarDatetimePopupProps = {
|
|
4
|
-
open?: boolean;
|
|
5
|
-
afterOpenChange?: (open: boolean) => void;
|
|
6
|
-
value?: Date;
|
|
7
|
-
onOk?: (value?: Date) => void;
|
|
8
|
-
onClose?: () => void;
|
|
9
|
-
};
|
|
10
|
-
export declare const CalendarDatetimePopup: FC<CalendarDatetimePopupProps>;
|
|
@@ -1,142 +0,0 @@
|
|
|
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
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
-
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."); }
|
|
7
|
-
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); }
|
|
8
|
-
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; }
|
|
9
|
-
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; } }
|
|
10
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
-
import classNames from 'classnames';
|
|
12
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
13
|
-
import Calendar from "../Calendar";
|
|
14
|
-
import ConfigProvider from "../ConfigProvider";
|
|
15
|
-
import PickerView from "../PickerView";
|
|
16
|
-
import Popup from "../Popup";
|
|
17
|
-
import { DatetimeUtils } from "../utils/datetime-utils";
|
|
18
|
-
import { DateTimeSwitch } from "./DateTimeSwitch";
|
|
19
|
-
import "./style.scss";
|
|
20
|
-
import { cls, Mode } from "./types";
|
|
21
|
-
export var CalendarDatetimePopup = function CalendarDatetimePopup(_ref) {
|
|
22
|
-
var _bodyRef$current;
|
|
23
|
-
var open = _ref.open,
|
|
24
|
-
afterOpenChange = _ref.afterOpenChange,
|
|
25
|
-
_ref$value = _ref.value,
|
|
26
|
-
value = _ref$value === void 0 ? new Date() : _ref$value,
|
|
27
|
-
onOk = _ref.onOk,
|
|
28
|
-
onClose = _ref.onClose;
|
|
29
|
-
var _ConfigProvider$useCo = ConfigProvider.useConfig(),
|
|
30
|
-
locale = _ConfigProvider$useCo.locale;
|
|
31
|
-
var _useState = useState(Mode.date),
|
|
32
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
-
mode = _useState2[0],
|
|
34
|
-
setMode = _useState2[1];
|
|
35
|
-
var valueRef = useRef(value || new Date());
|
|
36
|
-
var bodyRef = useRef(null);
|
|
37
|
-
var datetimeSwitchRef = useRef();
|
|
38
|
-
var _useState3 = useState(300),
|
|
39
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
40
|
-
bodyHeight = _useState4[0],
|
|
41
|
-
setBodyHeight = _useState4[1];
|
|
42
|
-
var handleClose = function handleClose() {
|
|
43
|
-
onClose === null || onClose === void 0 || onClose();
|
|
44
|
-
};
|
|
45
|
-
var handleOk = function handleOk() {
|
|
46
|
-
onOk === null || onOk === void 0 || onOk(valueRef.current);
|
|
47
|
-
handleClose();
|
|
48
|
-
};
|
|
49
|
-
var handleComputeBodyHeight = /*#__PURE__*/function () {
|
|
50
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
51
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
52
|
-
while (1) switch (_context.prev = _context.next) {
|
|
53
|
-
case 0:
|
|
54
|
-
return _context.abrupt("return", Promise.resolve(bodyRef.current.offsetHeight));
|
|
55
|
-
case 1:
|
|
56
|
-
case "end":
|
|
57
|
-
return _context.stop();
|
|
58
|
-
}
|
|
59
|
-
}, _callee);
|
|
60
|
-
}));
|
|
61
|
-
return function handleComputeBodyHeight() {
|
|
62
|
-
return _ref2.apply(this, arguments);
|
|
63
|
-
};
|
|
64
|
-
}();
|
|
65
|
-
useEffect(function () {
|
|
66
|
-
if (open) {
|
|
67
|
-
afterOpenChange === null || afterOpenChange === void 0 || afterOpenChange(true);
|
|
68
|
-
} else {
|
|
69
|
-
afterOpenChange === null || afterOpenChange === void 0 || afterOpenChange(false);
|
|
70
|
-
}
|
|
71
|
-
}, [open]);
|
|
72
|
-
useEffect(function () {
|
|
73
|
-
if (datetimeSwitchRef.current) {
|
|
74
|
-
datetimeSwitchRef.current.setDatetime(valueRef.current);
|
|
75
|
-
}
|
|
76
|
-
}, []);
|
|
77
|
-
var bodyRender = function bodyRender() {
|
|
78
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, mode === Mode.date && /*#__PURE__*/React.createElement("div", {
|
|
79
|
-
style: {}
|
|
80
|
-
}, /*#__PURE__*/React.createElement(Calendar, {
|
|
81
|
-
mouth: value,
|
|
82
|
-
value: value,
|
|
83
|
-
onChange: function onChange(date) {
|
|
84
|
-
var _datetimeSwitchRef$cu;
|
|
85
|
-
valueRef.current = date ? new Date(date === null || date === void 0 ? void 0 : date.getFullYear(), date === null || date === void 0 ? void 0 : date.getMonth(), date === null || date === void 0 ? void 0 : date.getDate(), valueRef.current.getHours(), valueRef.current.getMinutes()) : new Date();
|
|
86
|
-
(_datetimeSwitchRef$cu = datetimeSwitchRef.current) === null || _datetimeSwitchRef$cu === void 0 || _datetimeSwitchRef$cu.setDatetime(valueRef.current);
|
|
87
|
-
}
|
|
88
|
-
})), mode === Mode.time && /*#__PURE__*/React.createElement("div", {
|
|
89
|
-
style: {
|
|
90
|
-
height: bodyHeight
|
|
91
|
-
}
|
|
92
|
-
}, /*#__PURE__*/React.createElement(PickerView, {
|
|
93
|
-
columns: [Array(24).fill(0).map(function (_, i) {
|
|
94
|
-
return {
|
|
95
|
-
label: "".concat(DatetimeUtils.twoDigits(i)),
|
|
96
|
-
value: "".concat(i)
|
|
97
|
-
};
|
|
98
|
-
}), Array(60).fill(0).map(function (_, i) {
|
|
99
|
-
return {
|
|
100
|
-
label: "".concat(DatetimeUtils.twoDigits(i)),
|
|
101
|
-
value: "".concat(i)
|
|
102
|
-
};
|
|
103
|
-
})],
|
|
104
|
-
labelInValue: false,
|
|
105
|
-
value: ["".concat(valueRef === null || valueRef === void 0 ? void 0 : valueRef.current.getHours()), "".concat(valueRef === null || valueRef === void 0 ? void 0 : valueRef.current.getMinutes())],
|
|
106
|
-
onChange: function onChange(v) {
|
|
107
|
-
var _valueRef$current, _valueRef$current2, _valueRef$current3, _datetimeSwitchRef$cu2;
|
|
108
|
-
valueRef.current = new Date((_valueRef$current = valueRef.current) === null || _valueRef$current === void 0 ? void 0 : _valueRef$current.getFullYear(), (_valueRef$current2 = valueRef.current) === null || _valueRef$current2 === void 0 ? void 0 : _valueRef$current2.getMonth(), (_valueRef$current3 = valueRef.current) === null || _valueRef$current3 === void 0 ? void 0 : _valueRef$current3.getDate(), v[0], v[1]);
|
|
109
|
-
(_datetimeSwitchRef$cu2 = datetimeSwitchRef.current) === null || _datetimeSwitchRef$cu2 === void 0 || _datetimeSwitchRef$cu2.setDatetime(valueRef.current);
|
|
110
|
-
}
|
|
111
|
-
})));
|
|
112
|
-
};
|
|
113
|
-
return /*#__PURE__*/React.createElement(Popup, {
|
|
114
|
-
open: open,
|
|
115
|
-
onClose: onClose,
|
|
116
|
-
round: true
|
|
117
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
118
|
-
className: classNames(cls)
|
|
119
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
120
|
-
className: "".concat(cls, "-header")
|
|
121
|
-
}, /*#__PURE__*/React.createElement(DateTimeSwitch, {
|
|
122
|
-
ref: datetimeSwitchRef,
|
|
123
|
-
mode: mode,
|
|
124
|
-
value: valueRef.current,
|
|
125
|
-
onDateTabTap: function onDateTabTap() {
|
|
126
|
-
return setMode(Mode.date);
|
|
127
|
-
},
|
|
128
|
-
onTimeTabTap: function onTimeTabTap() {
|
|
129
|
-
handleComputeBodyHeight().then(function (height) {
|
|
130
|
-
setBodyHeight(height);
|
|
131
|
-
setMode(Mode.time);
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
}), /*#__PURE__*/React.createElement("a", {
|
|
135
|
-
className: classNames("".concat(cls, "-header-button"), "".concat(cls, "-header-button-ok")),
|
|
136
|
-
onClick: handleOk
|
|
137
|
-
}, locale.common.confirm)), /*#__PURE__*/React.createElement("div", {
|
|
138
|
-
className: "".concat(cls, "-body"),
|
|
139
|
-
ref: bodyRef,
|
|
140
|
-
id: (_bodyRef$current = bodyRef.current) === null || _bodyRef$current === void 0 ? void 0 : _bodyRef$current.uid
|
|
141
|
-
}, bodyRender())));
|
|
142
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
@use "../style/variable" as variable;
|
|
2
|
-
|
|
3
|
-
$calendarDatetimePopupCls: 'triones-antm-calendar-datetime-popup';
|
|
4
|
-
|
|
5
|
-
.#{$calendarDatetimePopupCls} {
|
|
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
|
-
border-bottom: 1Px solid variable.$trionesBorderColor;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
&-display {
|
|
16
|
-
display: flex;
|
|
17
|
-
padding-left: 8Px;
|
|
18
|
-
|
|
19
|
-
&-date {
|
|
20
|
-
padding-inline: 8Px;
|
|
21
|
-
cursor: default;
|
|
22
|
-
display: flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
&-time {
|
|
27
|
-
padding-inline: 12Px;
|
|
28
|
-
display: flex;
|
|
29
|
-
align-items: center;
|
|
30
|
-
cursor: default;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&-active {
|
|
34
|
-
color: variable.$trionesColorText;
|
|
35
|
-
font-weight: bold;
|
|
36
|
-
background-color: variable.$trionesColorBgTextActive;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
&-button {
|
|
41
|
-
padding: 12Px 16Px;
|
|
42
|
-
|
|
43
|
-
&-cancel {
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
&-ok {
|
|
47
|
-
color: variable.$trionesColorPrimary;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
&-body {
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CalendarPopup as InternalCalendarPopup } from "./calendar-popup";
|
|
2
|
-
import { CalendarRangePopup } from "./calendar-range-popup";
|
|
3
|
-
import { CalendarPopupProps } from "./types";
|
|
4
|
-
type CompoundedComponent = typeof InternalCalendarPopup & {
|
|
5
|
-
Range: typeof CalendarRangePopup;
|
|
6
|
-
};
|
|
7
|
-
declare const CalendarPopup: CompoundedComponent;
|
|
8
|
-
export type { CalendarPopupProps };
|
|
9
|
-
export default CalendarPopup;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
@use "../style/variable" as variable;
|
|
2
|
-
$cascaderPopupCls: 'triones-antm-cascader-popup';
|
|
3
|
-
|
|
4
|
-
.#{$cascaderPopupCls} {
|
|
5
|
-
width: 100%;
|
|
6
|
-
height: 300Px;
|
|
7
|
-
overflow: hidden;
|
|
8
|
-
position: relative;
|
|
9
|
-
display: flex;
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
|
|
12
|
-
&-header {
|
|
13
|
-
display: flex;
|
|
14
|
-
justify-content: space-between;
|
|
15
|
-
align-items: center;
|
|
16
|
-
border-bottom: 1Px solid variable.$trionesBorderColor;
|
|
17
|
-
padding: 4Px;
|
|
18
|
-
|
|
19
|
-
&-button {
|
|
20
|
-
|
|
21
|
-
padding: 8Px;
|
|
22
|
-
font-size: 12Px;
|
|
23
|
-
&-cancel{
|
|
24
|
-
color: variable.$trionesColorTextSecondary;
|
|
25
|
-
}
|
|
26
|
-
&-ok{
|
|
27
|
-
color: variable.$trionesColorPrimary;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
&-title {
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&-body {
|
|
36
|
-
flex: 1 1;
|
|
37
|
-
width: 100%;
|
|
38
|
-
pointer-events: unset;
|
|
39
|
-
overflow: hidden;
|
|
40
|
-
}
|
|
41
|
-
&-view{
|
|
42
|
-
--height: 100%;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|