@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
|
@@ -16,13 +16,15 @@ import React, { memo, useEffect, useRef, useState } from 'react';
|
|
|
16
16
|
import { CalendarGrid } from "../Calendar";
|
|
17
17
|
import { RandomUtils } from "../utils/random-utils";
|
|
18
18
|
import classNames from "classnames";
|
|
19
|
+
import dayjs from "dayjs";
|
|
20
|
+
var monthLines = 6;
|
|
19
21
|
/**
|
|
20
22
|
* 可以手势滑动的日历组件
|
|
21
23
|
*/
|
|
22
24
|
export var TouchableCalendarGrid = /*#__PURE__*/memo(function (_ref) {
|
|
23
25
|
var _wrapperRef$current3;
|
|
24
|
-
var _ref$
|
|
25
|
-
|
|
26
|
+
var _ref$month = _ref.month,
|
|
27
|
+
month = _ref$month === void 0 ? dayjs() : _ref$month,
|
|
26
28
|
value = _ref.value,
|
|
27
29
|
defaultValue = _ref.defaultValue,
|
|
28
30
|
onChange = _ref.onChange,
|
|
@@ -30,10 +32,10 @@ export var TouchableCalendarGrid = /*#__PURE__*/memo(function (_ref) {
|
|
|
30
32
|
range = _ref.range;
|
|
31
33
|
var wrapperRef = useRef();
|
|
32
34
|
var wrapperUniqueRef = React.useRef(RandomUtils.random());
|
|
33
|
-
var _useState = useState(
|
|
35
|
+
var _useState = useState(dayjs(month)),
|
|
34
36
|
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
currentMonth = _useState2[0],
|
|
38
|
+
setCurrentMonth = _useState2[1];
|
|
37
39
|
var waiting = false;
|
|
38
40
|
var _useState3 = useState(200),
|
|
39
41
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
@@ -57,8 +59,8 @@ export var TouchableCalendarGrid = /*#__PURE__*/memo(function (_ref) {
|
|
|
57
59
|
setTranslateY = _useState8[1];
|
|
58
60
|
var _useState9 = useState([]),
|
|
59
61
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
months = _useState10[0],
|
|
63
|
+
setMonths = _useState10[1];
|
|
62
64
|
|
|
63
65
|
/**
|
|
64
66
|
* 计算出每个格子的大小
|
|
@@ -105,34 +107,40 @@ export var TouchableCalendarGrid = /*#__PURE__*/memo(function (_ref) {
|
|
|
105
107
|
* 计算出该月的行数
|
|
106
108
|
* @param mouth
|
|
107
109
|
*/
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
};
|
|
110
|
+
// const mouthLines = (mouth: Date) => {
|
|
111
|
+
// const firstDate = new Date(mouth.getFullYear(), mouth.getMonth(), 1);
|
|
112
|
+
// const lastDate = new Date(mouth.getFullYear(), mouth.getMonth() + 1, 0);
|
|
113
|
+
// const beforeDays = firstDate.getDay();
|
|
114
|
+
// const afterDays = 6 - lastDate.getDay();
|
|
115
|
+
// const countDays = beforeDays + lastDate.getDate() + afterDays;
|
|
116
|
+
// return Math.ceil(countDays / 7);
|
|
117
|
+
// };
|
|
118
|
+
|
|
116
119
|
var handleInsertMouth = /*#__PURE__*/function () {
|
|
117
120
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
118
|
-
var firstMouth, insertMouth, newMouths,
|
|
121
|
+
var firstMouth, insertMouth, newMouths, insertMouthHeight;
|
|
119
122
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
120
123
|
while (1) switch (_context3.prev = _context3.next) {
|
|
121
124
|
case 0:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
125
|
+
// if (waiting){
|
|
126
|
+
// return
|
|
127
|
+
// }
|
|
128
|
+
// debugger
|
|
129
|
+
// waiting = true
|
|
130
|
+
firstMouth = months[0];
|
|
131
|
+
insertMouth = dayjs(new Date(firstMouth.year(), firstMouth.month() - 1, 1));
|
|
132
|
+
newMouths = [insertMouth].concat(_toConsumableArray(months));
|
|
133
|
+
setMonths(newMouths);
|
|
134
|
+
// const insertMouthLines = mouthLines(insertMouth);
|
|
135
|
+
_context3.t0 = monthLines;
|
|
136
|
+
_context3.next = 7;
|
|
129
137
|
return cellSize();
|
|
130
|
-
case
|
|
138
|
+
case 7:
|
|
131
139
|
_context3.t1 = _context3.sent;
|
|
132
140
|
insertMouthHeight = _context3.t0 * _context3.t1;
|
|
133
141
|
setTranslateY(translateY - insertMouthHeight);
|
|
134
142
|
// waiting = false
|
|
135
|
-
case
|
|
143
|
+
case 10:
|
|
136
144
|
case "end":
|
|
137
145
|
return _context3.stop();
|
|
138
146
|
}
|
|
@@ -147,29 +155,29 @@ export var TouchableCalendarGrid = /*#__PURE__*/memo(function (_ref) {
|
|
|
147
155
|
// return
|
|
148
156
|
// }
|
|
149
157
|
// waiting = true
|
|
150
|
-
var lastMouth =
|
|
151
|
-
var appendMouth =
|
|
152
|
-
var newMouths = [].concat(_toConsumableArray(
|
|
153
|
-
|
|
158
|
+
var lastMouth = months[months.length - 1];
|
|
159
|
+
var appendMouth = lastMouth.add(1, 'month');
|
|
160
|
+
var newMouths = [].concat(_toConsumableArray(months), [appendMouth]);
|
|
161
|
+
setMonths(newMouths);
|
|
154
162
|
// waiting = false
|
|
155
163
|
};
|
|
156
164
|
useEffect(function () {
|
|
157
|
-
var
|
|
165
|
+
var initMonths = [currentMonth.clone().subtract(1, 'month'), currentMonth.clone(), currentMonth.clone().add(1, 'month')];
|
|
158
166
|
Promise.all([]).then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
159
167
|
var firstMouthHeight;
|
|
160
168
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
161
169
|
while (1) switch (_context4.prev = _context4.next) {
|
|
162
170
|
case 0:
|
|
163
|
-
|
|
171
|
+
setMonths(initMonths);
|
|
164
172
|
_context4.t0 = setMouthHeight;
|
|
165
|
-
_context4.t1 =
|
|
173
|
+
_context4.t1 = monthLines;
|
|
166
174
|
_context4.next = 5;
|
|
167
175
|
return cellSize();
|
|
168
176
|
case 5:
|
|
169
177
|
_context4.t2 = _context4.sent;
|
|
170
178
|
_context4.t3 = _context4.t1 * _context4.t2;
|
|
171
179
|
(0, _context4.t0)(_context4.t3);
|
|
172
|
-
_context4.t4 =
|
|
180
|
+
_context4.t4 = monthLines;
|
|
173
181
|
_context4.next = 11;
|
|
174
182
|
return cellSize();
|
|
175
183
|
case 11:
|
|
@@ -182,15 +190,15 @@ export var TouchableCalendarGrid = /*#__PURE__*/memo(function (_ref) {
|
|
|
182
190
|
}
|
|
183
191
|
}, _callee4);
|
|
184
192
|
})));
|
|
185
|
-
}, [
|
|
193
|
+
}, [currentMonth]);
|
|
186
194
|
useEffect(function () {
|
|
187
|
-
if (
|
|
188
|
-
var newMouth = new Date(
|
|
189
|
-
if (
|
|
190
|
-
|
|
195
|
+
if (month !== undefined) {
|
|
196
|
+
var newMouth = dayjs(new Date(month.year(), month.month(), 1));
|
|
197
|
+
if (currentMonth === null || !(currentMonth !== null && currentMonth !== void 0 && currentMonth.isSame(newMouth, 'month'))) {
|
|
198
|
+
setCurrentMonth(newMouth);
|
|
191
199
|
}
|
|
192
200
|
}
|
|
193
|
-
}, [
|
|
201
|
+
}, [month]);
|
|
194
202
|
useEffect(function () {
|
|
195
203
|
if (value !== undefined) {}
|
|
196
204
|
}, [value]);
|
|
@@ -307,18 +315,18 @@ export var TouchableCalendarGrid = /*#__PURE__*/memo(function (_ref) {
|
|
|
307
315
|
}
|
|
308
316
|
return _context6.abrupt("return");
|
|
309
317
|
case 3:
|
|
310
|
-
console.log(
|
|
318
|
+
console.log(months);
|
|
311
319
|
//region 判断当前月份是否在视窗内
|
|
312
320
|
_mouthHeightSum = 0;
|
|
313
321
|
i = 0;
|
|
314
322
|
case 6:
|
|
315
|
-
if (!(i <
|
|
323
|
+
if (!(i < months.length)) {
|
|
316
324
|
_context6.next = 40;
|
|
317
325
|
break;
|
|
318
326
|
}
|
|
319
327
|
console.log('mouthHeight', mouthHeight);
|
|
320
|
-
console.log('mouths[i]',
|
|
321
|
-
_context6.t0 =
|
|
328
|
+
console.log('mouths[i]', months[i], i);
|
|
329
|
+
_context6.t0 = monthLines;
|
|
322
330
|
_context6.next = 12;
|
|
323
331
|
return cellSize();
|
|
324
332
|
case 12:
|
|
@@ -341,8 +349,8 @@ export var TouchableCalendarGrid = /*#__PURE__*/memo(function (_ref) {
|
|
|
341
349
|
_context6.next = 27;
|
|
342
350
|
break;
|
|
343
351
|
}
|
|
344
|
-
console.log('displayMouth',
|
|
345
|
-
displayMouth =
|
|
352
|
+
console.log('displayMouth', months[i]);
|
|
353
|
+
displayMouth = months[i];
|
|
346
354
|
return _context6.abrupt("break", 40);
|
|
347
355
|
case 27:
|
|
348
356
|
_bottomLineY = 0 - _mouthHeightSum; //该月份区域底部,对于顶点的偏移量
|
|
@@ -359,8 +367,8 @@ export var TouchableCalendarGrid = /*#__PURE__*/memo(function (_ref) {
|
|
|
359
367
|
_context6.next = 37;
|
|
360
368
|
break;
|
|
361
369
|
}
|
|
362
|
-
console.log('displayMouth',
|
|
363
|
-
displayMouth =
|
|
370
|
+
console.log('displayMouth', months[i]);
|
|
371
|
+
displayMouth = months[i];
|
|
364
372
|
return _context6.abrupt("break", 40);
|
|
365
373
|
case 37:
|
|
366
374
|
i++;
|
|
@@ -369,7 +377,7 @@ export var TouchableCalendarGrid = /*#__PURE__*/memo(function (_ref) {
|
|
|
369
377
|
case 40:
|
|
370
378
|
//endregion
|
|
371
379
|
if (displayMouth) {
|
|
372
|
-
|
|
380
|
+
setCurrentMonth(displayMouth);
|
|
373
381
|
onMouthChange === null || onMouthChange === void 0 || onMouthChange(displayMouth);
|
|
374
382
|
}
|
|
375
383
|
case 41:
|
|
@@ -382,10 +390,10 @@ export var TouchableCalendarGrid = /*#__PURE__*/memo(function (_ref) {
|
|
|
382
390
|
return _ref7.apply(this, arguments);
|
|
383
391
|
};
|
|
384
392
|
}())
|
|
385
|
-
},
|
|
393
|
+
}, months.map(function (mouth, index) {
|
|
386
394
|
return /*#__PURE__*/React.createElement(CalendarGrid, {
|
|
387
395
|
key: index,
|
|
388
|
-
|
|
396
|
+
month: mouth,
|
|
389
397
|
value: value,
|
|
390
398
|
defaultValue: defaultValue,
|
|
391
399
|
onChange: onChange,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import './style.scss';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import dayjs from "dayjs";
|
|
4
|
+
export type CalendarDatetimePickerProps = {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
afterOpenChange?: (open: boolean) => void;
|
|
7
|
+
value?: dayjs.Dayjs | Date;
|
|
8
|
+
onOk?: (value?: dayjs.Dayjs) => void;
|
|
9
|
+
onClose?: () => void;
|
|
8
10
|
};
|
|
9
|
-
export declare const CalendarDatetimePicker: FC<
|
|
11
|
+
export declare const CalendarDatetimePicker: FC<CalendarDatetimePickerProps>;
|
|
@@ -1,3 +1,7 @@
|
|
|
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); }); }; }
|
|
1
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
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."); }
|
|
3
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); }
|
|
@@ -5,57 +9,134 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5
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; } }
|
|
6
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
11
|
import classNames from 'classnames';
|
|
8
|
-
import React, { useEffect, useState } from 'react';
|
|
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";
|
|
9
19
|
import "./style.scss";
|
|
10
|
-
import { cls } from "./types";
|
|
11
|
-
import CalendarDatetimePopup from "../CalendarDatetimePopup";
|
|
20
|
+
import { cls, Mode } from "./types";
|
|
12
21
|
import dayjs from "dayjs";
|
|
13
22
|
export var CalendarDatetimePicker = function CalendarDatetimePicker(_ref) {
|
|
14
|
-
var
|
|
15
|
-
|
|
23
|
+
var _bodyRef$current;
|
|
24
|
+
var open = _ref.open,
|
|
25
|
+
afterOpenChange = _ref.afterOpenChange,
|
|
16
26
|
value = _ref.value,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
innerOpen = _React$useState2[0],
|
|
23
|
-
setInnerOpen = _React$useState2[1];
|
|
24
|
-
var _useState = useState(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),
|
|
25
32
|
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
mode = _useState2[0],
|
|
34
|
+
setMode = _useState2[1];
|
|
35
|
+
var valueRef = useRef(dayjs(value));
|
|
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();
|
|
33
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
|
+
}();
|
|
34
65
|
useEffect(function () {
|
|
35
|
-
if (
|
|
36
|
-
|
|
66
|
+
if (open) {
|
|
67
|
+
afterOpenChange === null || afterOpenChange === void 0 || afterOpenChange(true);
|
|
68
|
+
} else {
|
|
69
|
+
afterOpenChange === null || afterOpenChange === void 0 || afterOpenChange(false);
|
|
37
70
|
}
|
|
38
|
-
|
|
39
|
-
|
|
71
|
+
}, [open]);
|
|
72
|
+
useEffect(function () {
|
|
73
|
+
if (datetimeSwitchRef.current) {
|
|
74
|
+
datetimeSwitchRef.current.setDatetime(valueRef.current);
|
|
40
75
|
}
|
|
41
|
-
}, [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
+
month: value,
|
|
82
|
+
value: value,
|
|
83
|
+
onChange: function onChange(date) {
|
|
84
|
+
var _datetimeSwitchRef$cu;
|
|
85
|
+
valueRef.current = dayjs(new Date(date.year(), date.month(), date.date(), valueRef.current.hour(), valueRef.current.minute()));
|
|
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.hour()), "".concat(valueRef === null || valueRef === void 0 ? void 0 : valueRef.current.minute())],
|
|
106
|
+
onChange: function onChange(v) {
|
|
107
|
+
var _datetimeSwitchRef$cu2;
|
|
108
|
+
valueRef.current = dayjs(new Date(valueRef.current.year(), valueRef.current.month(), valueRef.current.date(), 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);
|
|
47
127
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
54
|
-
className: classNames(cls),
|
|
55
|
-
onClick: function onClick() {
|
|
56
|
-
setInnerOpen(true);
|
|
128
|
+
onTimeTabTap: function onTimeTabTap() {
|
|
129
|
+
handleComputeBodyHeight().then(function (height) {
|
|
130
|
+
setBodyHeight(height);
|
|
131
|
+
setMode(Mode.time);
|
|
132
|
+
});
|
|
57
133
|
}
|
|
58
|
-
},
|
|
59
|
-
className: "".concat(cls, "-
|
|
60
|
-
|
|
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())));
|
|
61
142
|
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './style.scss';
|
|
3
3
|
import { Mode } from './types';
|
|
4
|
+
import dayjs from "dayjs";
|
|
4
5
|
export interface DateTimeSwitchHandle {
|
|
5
|
-
setDatetime: (datetime:
|
|
6
|
+
setDatetime: (datetime: dayjs.Dayjs) => void;
|
|
6
7
|
}
|
|
7
8
|
type DateTimeSwitchProps = {
|
|
8
9
|
onDateTabTap?: () => void;
|
|
9
10
|
onTimeTabTap?: () => void;
|
|
10
11
|
mode?: Mode;
|
|
11
|
-
value?:
|
|
12
|
+
value?: dayjs.Dayjs;
|
|
12
13
|
};
|
|
13
14
|
export declare const DateTimeSwitch: React.ForwardRefExoticComponent<DateTimeSwitchProps & React.RefAttributes<DateTimeSwitchHandle>>;
|
|
14
15
|
export {};
|
|
@@ -13,12 +13,13 @@ import React, { forwardRef, useImperativeHandle, useState } from 'react';
|
|
|
13
13
|
import { DatetimeUtils } from "../utils/datetime-utils";
|
|
14
14
|
import "./style.scss";
|
|
15
15
|
import { cls, Mode } from "./types";
|
|
16
|
+
import dayjs from "dayjs";
|
|
16
17
|
export var DateTimeSwitch = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
17
18
|
var onDateTabTap = _ref.onDateTabTap,
|
|
18
19
|
onTimeTabTap = _ref.onTimeTabTap,
|
|
19
20
|
mode = _ref.mode,
|
|
20
21
|
value = _ref.value;
|
|
21
|
-
var _useState = useState(value),
|
|
22
|
+
var _useState = useState(dayjs(value)),
|
|
22
23
|
_useState2 = _slicedToArray(_useState, 2),
|
|
23
24
|
datetime = _useState2[0],
|
|
24
25
|
setDatetime = _useState2[1];
|
|
@@ -32,8 +33,8 @@ export var DateTimeSwitch = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
32
33
|
}, /*#__PURE__*/React.createElement("div", {
|
|
33
34
|
className: classNames("".concat(cls, "-header-display-date"), _defineProperty({}, "".concat(cls, "-header-display-active"), mode === Mode.date)),
|
|
34
35
|
onClick: onDateTabTap
|
|
35
|
-
}, datetime ? "".concat(datetime.
|
|
36
|
+
}, datetime ? "".concat(datetime.year(), "-").concat(DatetimeUtils.twoDigits(datetime.month() + 1), "-").concat(DatetimeUtils.twoDigits(datetime.date())) : ''), /*#__PURE__*/React.createElement("div", {
|
|
36
37
|
className: classNames("".concat(cls, "-header-display-time"), _defineProperty({}, "".concat(cls, "-header-display-active"), mode === Mode.time)),
|
|
37
38
|
onClick: onTimeTabTap
|
|
38
|
-
}, datetime ? "".concat(datetime.
|
|
39
|
+
}, datetime ? "".concat(datetime.hour(), ":").concat(datetime.minute()) : ''));
|
|
39
40
|
});
|
|
@@ -7,7 +7,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { DemoBlock } from "../../DemoBlock";
|
|
9
9
|
import { CalendarDatetimePicker } from "../CalendarDatetimePicker";
|
|
10
|
-
import
|
|
10
|
+
import Button from "../../Button";
|
|
11
|
+
import Toast from "../../Toast";
|
|
11
12
|
export default (function () {
|
|
12
13
|
var toastContainer = React.useRef();
|
|
13
14
|
var _React$useState = React.useState(false),
|
|
@@ -18,8 +19,23 @@ export default (function () {
|
|
|
18
19
|
ref: toastContainer
|
|
19
20
|
}), /*#__PURE__*/React.createElement(DemoBlock, {
|
|
20
21
|
title: "\u65E5\u671F\u65F6\u95F4\u9009\u62E9\u5668"
|
|
21
|
-
}, /*#__PURE__*/React.createElement(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
}, /*#__PURE__*/React.createElement(CalendarDatetimePicker, {
|
|
23
|
+
open: open,
|
|
24
|
+
afterOpenChange: function afterOpenChange(o) {
|
|
25
|
+
setOpen(o);
|
|
26
|
+
},
|
|
27
|
+
onOk: function onOk(date) {
|
|
28
|
+
Toast.show({
|
|
29
|
+
getContainer: function getContainer() {
|
|
30
|
+
return toastContainer.current;
|
|
31
|
+
},
|
|
32
|
+
content: "".concat(date.year(), "-").concat(date.month() + 1, "-").concat(date.date(), " ").concat(date.hour(), ":").concat(date.minute())
|
|
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")));
|
|
25
41
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { CalendarDatetimePicker,
|
|
2
|
-
export type {
|
|
1
|
+
import { CalendarDatetimePicker, CalendarDatetimePickerProps } from "./CalendarDatetimePicker";
|
|
2
|
+
export type { CalendarDatetimePickerProps };
|
|
3
3
|
export default CalendarDatetimePicker;
|
|
@@ -1,10 +1,54 @@
|
|
|
1
1
|
@use "../style/variable" as variable;
|
|
2
|
-
$calendarDatetimePickerCls: 'triones-antm-calendar-datetime-picker';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
+
|
|
9
53
|
}
|
|
10
54
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import './style.scss';
|
|
3
|
+
import dayjs from "dayjs";
|
|
4
|
+
import { CellProps } from "../Cell";
|
|
5
|
+
export type CalendarDatetimePickerCellProps = Omit<CellProps, 'value'> & {
|
|
6
|
+
value?: dayjs.Dayjs | Date;
|
|
7
|
+
format?: string;
|
|
8
|
+
onChange?: (value?: dayjs.Dayjs) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const CalendarDatetimePickerCell: FC<CalendarDatetimePickerCellProps>;
|