@trionesdev/antd-taro-react 0.0.2-beta.7 → 0.0.2-beta.8

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.
Files changed (87) hide show
  1. package/dist/ActionSheet/ActionSheet.d.ts +25 -0
  2. package/dist/ActionSheet/ActionSheet.js +77 -0
  3. package/dist/ActionSheet/index.d.ts +1 -1
  4. package/dist/ActionSheet/index.js +1 -1
  5. package/dist/ActionSheet/style.scss +52 -0
  6. package/dist/Calendar/calendar-grid.js +0 -1
  7. package/dist/Calendar/calendar.js +5 -5
  8. package/dist/CalendarDatetimePicker/CalendarDatetimePicker.d.ts +4 -4
  9. package/dist/CalendarDatetimePicker/CalendarDatetimePicker.js +42 -159
  10. package/dist/CalendarDatetimePicker/style.scss +13 -51
  11. package/dist/CalendarDatetimePicker/types.d.ts +0 -4
  12. package/dist/CalendarDatetimePicker/types.js +1 -6
  13. package/dist/CalendarDatetimePopup/CalendarDatetimePopup.d.ts +10 -0
  14. package/dist/CalendarDatetimePopup/CalendarDatetimePopup.js +163 -0
  15. package/dist/CalendarDatetimePopup/index.d.ts +3 -0
  16. package/dist/CalendarDatetimePopup/index.js +2 -0
  17. package/dist/CalendarDatetimePopup/style.scss +62 -0
  18. package/dist/CalendarDatetimePopup/types.d.ts +5 -0
  19. package/dist/CalendarDatetimePopup/types.js +6 -0
  20. package/dist/CalendarPopup/CalendarPopup.d.ts +4 -0
  21. package/dist/{CalendarPicker/calendar-picker.js → CalendarPopup/CalendarPopup.js} +4 -3
  22. package/dist/CalendarPopup/CalendarRangePopup.d.ts +4 -0
  23. package/dist/{CalendarPicker/calendar-range-picker.js → CalendarPopup/CalendarRangePopup.js} +5 -4
  24. package/dist/CalendarPopup/index.d.ts +8 -0
  25. package/dist/CalendarPopup/index.js +5 -0
  26. package/dist/{CalendarPicker → CalendarPopup}/style.scss +4 -3
  27. package/dist/{CalendarPicker → CalendarPopup}/types.d.ts +3 -2
  28. package/dist/CalendarPopup/types.js +1 -0
  29. package/dist/CascaderPicker/CascaderPicker.d.ts +25 -0
  30. package/dist/CascaderPicker/CascaderPicker.js +78 -0
  31. package/dist/CascaderPicker/index.d.ts +1 -1
  32. package/dist/CascaderPicker/index.js +1 -1
  33. package/dist/CascaderPicker/style.scss +24 -0
  34. package/dist/CascaderPopup/cascader-popup.d.ts +27 -0
  35. package/dist/CascaderPopup/cascader-popup.js +90 -0
  36. package/dist/CascaderPopup/index.d.ts +3 -0
  37. package/dist/CascaderPopup/index.js +2 -0
  38. package/dist/CascaderPopup/style.scss +45 -0
  39. package/dist/DatePicker/DatePicker.d.ts +15 -0
  40. package/dist/DatePicker/DatePicker.js +85 -0
  41. package/dist/DatePicker/DatePickerPopup.d.ts +18 -0
  42. package/dist/DatePicker/DatePickerPopup.js +329 -0
  43. package/dist/DatePicker/index.d.ts +3 -0
  44. package/dist/DatePicker/index.js +3 -0
  45. package/dist/DatePicker/style.scss +64 -0
  46. package/dist/DatePicker/types.d.ts +1 -0
  47. package/dist/ImagesPreview/ImagesPreview.js +2 -2
  48. package/dist/Overlay/Overlay.d.ts +16 -0
  49. package/dist/Overlay/Overlay.js +95 -0
  50. package/dist/Overlay/index.d.ts +4 -0
  51. package/dist/Overlay/index.js +3 -0
  52. package/dist/Overlay/style.scss +20 -0
  53. package/dist/Picker/Picker.d.ts +19 -0
  54. package/dist/Picker/Picker.js +75 -0
  55. package/dist/Picker/index.d.ts +1 -1
  56. package/dist/Picker/index.js +1 -1
  57. package/dist/Picker/style.scss +41 -0
  58. package/dist/PickerView/PickerView.d.ts +4 -0
  59. package/dist/PickerView/PickerView.js +71 -0
  60. package/dist/PickerView/index.d.ts +2 -2
  61. package/dist/PickerView/index.js +1 -1
  62. package/dist/PickerView/style.scss +13 -0
  63. package/dist/PickerView/types.d.ts +15 -0
  64. package/dist/PickerView/types.js +1 -0
  65. package/dist/Popup/Popup.d.ts +26 -1
  66. package/dist/Popup/Popup.js +66 -18
  67. package/dist/Popup/index.d.ts +2 -2
  68. package/dist/Popup/index.js +1 -0
  69. package/dist/Popup/style.scss +114 -0
  70. package/dist/SideBar/side-bar.js +3 -2
  71. package/dist/Toast/Toast.d.ts +18 -0
  72. package/dist/Toast/Toast.js +112 -0
  73. package/dist/Toast/index.d.ts +1 -1
  74. package/dist/Toast/index.js +1 -1
  75. package/dist/Toast/style.scss +63 -0
  76. package/dist/index.d.ts +9 -4
  77. package/dist/index.js +5 -2
  78. package/package.json +7 -6
  79. package/dist/CalendarPicker/calendar-picker.d.ts +0 -4
  80. package/dist/CalendarPicker/calendar-range-picker.d.ts +0 -4
  81. package/dist/CalendarPicker/index.d.ts +0 -9
  82. package/dist/CalendarPicker/index.js +0 -5
  83. package/dist/Mask/index.d.ts +0 -3
  84. package/dist/Mask/index.js +0 -2
  85. /package/dist/{CalendarDatetimePicker → CalendarDatetimePopup}/DateTimeSwitch.d.ts +0 -0
  86. /package/dist/{CalendarDatetimePicker → CalendarDatetimePopup}/DateTimeSwitch.js +0 -0
  87. /package/dist/{CalendarPicker → DatePicker}/types.js +0 -0
@@ -0,0 +1,163 @@
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 { CustomWrapper, PickerView, PickerViewColumn, View } from '@tarojs/components';
12
+ import Taro from '@tarojs/taro';
13
+ import classNames from 'classnames';
14
+ import React, { useEffect, useRef, useState } from 'react';
15
+ import Calendar from "../Calendar";
16
+ import ConfigProvider from "../ConfigProvider";
17
+ import { useTaro } from "../hooks";
18
+ import Popup from "../Popup";
19
+ import { DateTimeSwitch } from "./DateTimeSwitch";
20
+ import "./style.scss";
21
+ import { cls, Mode } from "./types";
22
+ import { DatetimeUtils } from "../utils/datetime-utils";
23
+ export var CalendarDatetimePopup = function CalendarDatetimePopup(_ref) {
24
+ var _bodyRef$current;
25
+ var open = _ref.open,
26
+ afterOpenChange = _ref.afterOpenChange,
27
+ value = _ref.value,
28
+ onOk = _ref.onOk,
29
+ _onClose = _ref.onClose;
30
+ var _ConfigProvider$useCo = ConfigProvider.useConfig(),
31
+ locale = _ConfigProvider$useCo.locale;
32
+ var _useTaro = useTaro(),
33
+ isTaroEnv = _useTaro.isTaroEnv,
34
+ isTaroWeApp = _useTaro.isTaroWeApp;
35
+ var _useState = useState(Mode.date),
36
+ _useState2 = _slicedToArray(_useState, 2),
37
+ mode = _useState2[0],
38
+ setMode = _useState2[1];
39
+ var valueRef = useRef(value || new Date());
40
+ var bodyRef = useRef(null);
41
+ var datetimeSwitchRef = useRef();
42
+ var _useState3 = useState(300),
43
+ _useState4 = _slicedToArray(_useState3, 2),
44
+ bodyHeight = _useState4[0],
45
+ setBodyHeight = _useState4[1];
46
+ var handleClose = function handleClose() {
47
+ _onClose === null || _onClose === void 0 || _onClose();
48
+ };
49
+ var handleOk = function handleOk() {
50
+ onOk === null || onOk === void 0 || onOk(valueRef.current);
51
+ handleClose();
52
+ };
53
+ var handleComputeBodyHeight = /*#__PURE__*/function () {
54
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
55
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
56
+ while (1) switch (_context.prev = _context.next) {
57
+ case 0:
58
+ if (!(isTaroEnv && isTaroWeApp)) {
59
+ _context.next = 2;
60
+ break;
61
+ }
62
+ return _context.abrupt("return", new Promise(function (resolve) {
63
+ Taro.createSelectorQuery().in(bodyRef.current.ctx).select(".".concat(cls, "-body")).boundingClientRect()
64
+ // .fields({ node: true, size: true })
65
+ .exec(function (res) {
66
+ var _res$;
67
+ console.log(res);
68
+ resolve(res === null || res === void 0 || (_res$ = res[0]) === null || _res$ === void 0 ? void 0 : _res$.height);
69
+ });
70
+ }));
71
+ case 2:
72
+ return _context.abrupt("return", Promise.resolve(bodyRef.current.offsetHeight));
73
+ case 3:
74
+ case "end":
75
+ return _context.stop();
76
+ }
77
+ }, _callee);
78
+ }));
79
+ return function handleComputeBodyHeight() {
80
+ return _ref2.apply(this, arguments);
81
+ };
82
+ }();
83
+ useEffect(function () {
84
+ if (datetimeSwitchRef.current) {
85
+ datetimeSwitchRef.current.setDatetime(valueRef.current);
86
+ }
87
+ }, []);
88
+ var bodyRender = function bodyRender() {
89
+ return /*#__PURE__*/React.createElement(React.Fragment, null, mode === Mode.date && /*#__PURE__*/React.createElement("div", {
90
+ style: {}
91
+ }, /*#__PURE__*/React.createElement(Calendar, {
92
+ mouth: value,
93
+ value: value,
94
+ onChange: function onChange(date) {
95
+ var _datetimeSwitchRef$cu;
96
+ valueRef.current = new Date(date.getFullYear(), date.getMonth(), date.getDate(), valueRef.current.getHours(), valueRef.current.getMinutes());
97
+ (_datetimeSwitchRef$cu = datetimeSwitchRef.current) === null || _datetimeSwitchRef$cu === void 0 || _datetimeSwitchRef$cu.setDatetime(valueRef.current);
98
+ }
99
+ })), mode === Mode.time && /*#__PURE__*/React.createElement("div", {
100
+ style: {
101
+ height: bodyHeight
102
+ }
103
+ }, /*#__PURE__*/React.createElement(PickerView, {
104
+ className: "time-picker",
105
+ indicatorStyle: "height: 32Px;",
106
+ style: {
107
+ height: bodyHeight
108
+ },
109
+ value: [valueRef === null || valueRef === void 0 ? void 0 : valueRef.current.getHours(), valueRef === null || valueRef === void 0 ? void 0 : valueRef.current.getMinutes()],
110
+ onChange: function onChange(e) {
111
+ var _datetimeSwitchRef$cu2;
112
+ var v = e.detail.value;
113
+ valueRef.current = new Date(valueRef.current.getFullYear(), valueRef.current.getMonth(), valueRef.current.getDate(), v[0], v[1]);
114
+ (_datetimeSwitchRef$cu2 = datetimeSwitchRef.current) === null || _datetimeSwitchRef$cu2 === void 0 || _datetimeSwitchRef$cu2.setDatetime(valueRef.current);
115
+ }
116
+ }, /*#__PURE__*/React.createElement(PickerViewColumn, null, Array(24).fill(0).map(function (_, i) {
117
+ return /*#__PURE__*/React.createElement(View, {
118
+ key: "hour-".concat(i),
119
+ className: "time-item"
120
+ }, DatetimeUtils.twoDigits(i));
121
+ })), /*#__PURE__*/React.createElement(PickerViewColumn, null, Array(60).fill(0).map(function (_, i) {
122
+ return /*#__PURE__*/React.createElement(View, {
123
+ key: "minute-".concat(i),
124
+ className: "time-item"
125
+ }, DatetimeUtils.twoDigits(i));
126
+ })))));
127
+ };
128
+ return /*#__PURE__*/React.createElement(Popup, {
129
+ open: open,
130
+ round: true,
131
+ onClose: function onClose() {
132
+ _onClose === null || _onClose === void 0 || _onClose();
133
+ }
134
+ }, /*#__PURE__*/React.createElement("div", {
135
+ className: classNames(cls)
136
+ }, /*#__PURE__*/React.createElement("div", {
137
+ className: "".concat(cls, "-header")
138
+ }, /*#__PURE__*/React.createElement(DateTimeSwitch, {
139
+ ref: datetimeSwitchRef,
140
+ mode: mode,
141
+ value: valueRef.current,
142
+ onDateTabTap: function onDateTabTap() {
143
+ return setMode(Mode.date);
144
+ },
145
+ onTimeTabTap: function onTimeTabTap() {
146
+ handleComputeBodyHeight().then(function (height) {
147
+ setBodyHeight(height);
148
+ setMode(Mode.time);
149
+ });
150
+ }
151
+ }), /*#__PURE__*/React.createElement("a", {
152
+ className: classNames("".concat(cls, "-header-button"), "".concat(cls, "-header-button-ok")),
153
+ onClick: handleOk
154
+ }, locale.common.confirm)), isTaroEnv ? /*#__PURE__*/React.createElement(CustomWrapper, {
155
+ ref: bodyRef
156
+ }, /*#__PURE__*/React.createElement("div", {
157
+ className: "".concat(cls, "-body")
158
+ }, bodyRender())) : /*#__PURE__*/React.createElement("div", {
159
+ className: "".concat(cls, "-body"),
160
+ ref: bodyRef,
161
+ id: (_bodyRef$current = bodyRef.current) === null || _bodyRef$current === void 0 ? void 0 : _bodyRef$current.uid
162
+ }, bodyRender())));
163
+ };
@@ -0,0 +1,3 @@
1
+ import { CalendarDatetimePopup, CalendarDatetimePopupProps } from "./CalendarDatetimePopup";
2
+ export type { CalendarDatetimePopupProps };
3
+ export default CalendarDatetimePopup;
@@ -0,0 +1,2 @@
1
+ import { CalendarDatetimePopup } from "./CalendarDatetimePopup";
2
+ export default CalendarDatetimePopup;
@@ -0,0 +1,62 @@
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
+ &-ok {
46
+ color: variable.$trionesColorPrimary;
47
+ }
48
+ }
49
+ }
50
+
51
+ &-body {
52
+ .time-picker {
53
+ .time-item {
54
+ flex-shrink: 0;
55
+ display: flex;
56
+ align-items: center;
57
+ justify-content: center;
58
+ height: 32Px;
59
+ }
60
+ }
61
+ }
62
+ }
@@ -0,0 +1,5 @@
1
+ export declare const cls = "triones-antm-calendar-datetime-popup";
2
+ export declare enum Mode {
3
+ date = 0,
4
+ time = 1
5
+ }
@@ -0,0 +1,6 @@
1
+ export var cls = 'triones-antm-calendar-datetime-popup';
2
+ export var Mode = /*#__PURE__*/function (Mode) {
3
+ Mode[Mode["date"] = 0] = "date";
4
+ Mode[Mode["time"] = 1] = "time";
5
+ return Mode;
6
+ }({});
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import './style.scss';
3
+ import { CalendarPopupProps } from './types';
4
+ export declare const CalendarPopup: FC<CalendarPopupProps>;
@@ -10,8 +10,8 @@ import Calendar from "../Calendar";
10
10
  import ConfigProvider from "../ConfigProvider";
11
11
  import Popup from "../Popup";
12
12
  import "./style.scss";
13
- var cls = 'triones-antm-calendar-picker';
14
- export var CalendarPicker = /*#__PURE__*/memo(function (_ref) {
13
+ import { cls } from "./types";
14
+ export var CalendarPopup = /*#__PURE__*/memo(function (_ref) {
15
15
  var mouth = _ref.mouth,
16
16
  open = _ref.open,
17
17
  title = _ref.title,
@@ -61,6 +61,7 @@ export var CalendarPicker = /*#__PURE__*/memo(function (_ref) {
61
61
  }, [open]);
62
62
  return /*#__PURE__*/React.createElement(Popup, {
63
63
  open: innerOpen,
64
+ round: true,
64
65
  onClose: function onClose() {
65
66
  setInnerOpen(false);
66
67
  _onClose === null || _onClose === void 0 || _onClose();
@@ -70,7 +71,7 @@ export var CalendarPicker = /*#__PURE__*/memo(function (_ref) {
70
71
  }, /*#__PURE__*/React.createElement("div", {
71
72
  className: classNames("".concat(cls, "-header"))
72
73
  }, /*#__PURE__*/React.createElement("a", {
73
- className: classNames("".concat(cls, "-header-button"), "".concat(cls, "-header-cancel")),
74
+ className: classNames("".concat(cls, "-header-button"), "".concat(cls, "-header-button-cancel")),
74
75
  onClick: handelCancel
75
76
  }, locale.common.cancel), title && /*#__PURE__*/React.createElement("div", {
76
77
  className: classNames("".concat(cls, "-header-title"))
@@ -0,0 +1,4 @@
1
+ import { FC } from "react";
2
+ import "./style.scss";
3
+ import { CalendarPopupRangeProps } from "./types";
4
+ export declare const CalendarRangePopup: FC<CalendarPopupRangeProps>;
@@ -9,9 +9,9 @@ import Popup from "../Popup";
9
9
  import classNames from "classnames";
10
10
  import Calendar from "../Calendar";
11
11
  import "./style.scss";
12
+ import { cls } from "./types";
12
13
  import ConfigProvider from "../ConfigProvider";
13
- var cls = 'triones-antm-calendar-picker';
14
- export var CalendarRangePicker = /*#__PURE__*/memo(function (_ref) {
14
+ export var CalendarRangePopup = /*#__PURE__*/memo(function (_ref) {
15
15
  var mouth = _ref.mouth,
16
16
  open = _ref.open,
17
17
  title = _ref.title,
@@ -60,6 +60,7 @@ export var CalendarRangePicker = /*#__PURE__*/memo(function (_ref) {
60
60
  }, [open]);
61
61
  return /*#__PURE__*/React.createElement(Popup, {
62
62
  open: innerOpen,
63
+ round: true,
63
64
  onClose: function onClose() {
64
65
  setInnerOpen(false);
65
66
  _onClose === null || _onClose === void 0 || _onClose();
@@ -69,12 +70,12 @@ export var CalendarRangePicker = /*#__PURE__*/memo(function (_ref) {
69
70
  }, /*#__PURE__*/React.createElement("div", {
70
71
  className: classNames("".concat(cls, "-header"))
71
72
  }, /*#__PURE__*/React.createElement("a", {
72
- className: classNames("".concat(cls, "-header-button")),
73
+ className: classNames("".concat(cls, "-header-button"), "".concat(cls, "-header-button-cancel")),
73
74
  onClick: handelCancel
74
75
  }, locale.common.cancel), title && /*#__PURE__*/React.createElement("div", {
75
76
  className: classNames("".concat(cls, "-header-title"))
76
77
  }, title), /*#__PURE__*/React.createElement("a", {
77
- className: classNames("".concat(cls, "-header-button")),
78
+ className: classNames("".concat(cls, "-header-button"), "".concat(cls, "-header-button-ok")),
78
79
  onClick: handleOk
79
80
  }, locale.common.confirm)), /*#__PURE__*/React.createElement("div", {
80
81
  className: classNames("".concat(cls, "-body"))
@@ -0,0 +1,8 @@
1
+ import { CalendarPopup as InternalCalendarPopup } from "./CalendarPopup";
2
+ import { CalendarRangePopup } from "./CalendarRangePopup";
3
+ type CompoundedComponent = typeof InternalCalendarPopup & {
4
+ Range: typeof CalendarRangePopup;
5
+ };
6
+ declare const CalendarPopup: CompoundedComponent;
7
+ export type { CalendarPopupProps, CalendarPopupRangeProps } from "./types";
8
+ export default CalendarPopup;
@@ -0,0 +1,5 @@
1
+ import { CalendarPopup as InternalCalendarPopup } from "./CalendarPopup";
2
+ import { CalendarRangePopup } from "./CalendarRangePopup";
3
+ var CalendarPopup = InternalCalendarPopup;
4
+ CalendarPopup.Range = CalendarRangePopup;
5
+ export default CalendarPopup;
@@ -1,8 +1,8 @@
1
1
  @use "../style/variable" as variable;
2
2
 
3
- $calendarPickerCls: 'triones-antm-calendar-picker';
3
+ $calendarPopupCls: 'triones-antm-calendar-popup';
4
4
 
5
- .#{$calendarPickerCls} {
5
+ .#{$calendarPopupCls} {
6
6
  border-top-left-radius: variable.$trionesBorderRadius;
7
7
  border-top-right-radius: variable.$trionesBorderRadius;
8
8
 
@@ -14,7 +14,8 @@ $calendarPickerCls: 'triones-antm-calendar-picker';
14
14
  &-button {
15
15
  padding: 8Px 12Px;
16
16
 
17
- &-cancel {
17
+ &-cancel{
18
+ color: variable.$trionesColorTextSecondary;
18
19
  }
19
20
 
20
21
  &-ok {
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
- export type CalendarPickerProps = {
2
+ export declare const cls = "triones-antm-calendar-popup";
3
+ export type CalendarPopupProps = {
3
4
  mouth?: Date;
4
5
  open?: boolean;
5
6
  title?: React.ReactNode;
@@ -9,7 +10,7 @@ export type CalendarPickerProps = {
9
10
  onCancel?: () => void;
10
11
  onClose?: () => void;
11
12
  };
12
- export type CalendarPickerRangeProps = {
13
+ export type CalendarPopupRangeProps = {
13
14
  mouth?: Date;
14
15
  open?: boolean;
15
16
  title?: React.ReactNode;
@@ -0,0 +1 @@
1
+ export var cls = 'triones-antm-calendar-popup';
@@ -0,0 +1,25 @@
1
+ import React, { FC } from "react";
2
+ import "./style.scss";
3
+ export type CascaderPickerProps = {
4
+ placeholder?: string;
5
+ onChange?: (value: any[]) => void;
6
+ align?: 'left' | 'right' | 'center';
7
+ className?: string;
8
+ style?: React.CSSProperties;
9
+ title?: React.ReactNode;
10
+ options?: any[];
11
+ /**
12
+ * @description 是否把每个选项的 label 包装到 value 中,会把 Select 的 value 类型从 string 变为 { value: string, label: ReactNode } 的格式
13
+ * @default false
14
+ */
15
+ labelInValue?: boolean;
16
+ fieldNames?: {
17
+ value?: string;
18
+ label?: string;
19
+ children?: string;
20
+ };
21
+ columnsCount?: number;
22
+ value?: any[];
23
+ asyncRequest?: (parentValue?: any) => Promise<any>;
24
+ };
25
+ export declare const CascaderPicker: FC<CascaderPickerProps>;
@@ -0,0 +1,78 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["placeholder", "onChange", "align", "value", "labelInValue"];
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
7
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
8
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
9
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
10
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
14
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
15
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
16
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
17
+ import React, { useEffect, useState } from "react";
18
+ import classNames from "classnames";
19
+ import { isEmpty } from "lodash-es";
20
+ import CascaderPopup from "../CascaderPopup";
21
+ import "./style.scss";
22
+ var cls = 'triones-antm-cascader-picker';
23
+ export var CascaderPicker = function CascaderPicker(_ref) {
24
+ var _ref$placeholder = _ref.placeholder,
25
+ placeholder = _ref$placeholder === void 0 ? '请选择' : _ref$placeholder,
26
+ onChange = _ref.onChange,
27
+ _ref$align = _ref.align,
28
+ align = _ref$align === void 0 ? 'left' : _ref$align,
29
+ value = _ref.value,
30
+ _ref$labelInValue = _ref.labelInValue,
31
+ labelInValue = _ref$labelInValue === void 0 ? true : _ref$labelInValue,
32
+ rest = _objectWithoutProperties(_ref, _excluded);
33
+ var mergedFieldNames = _objectSpread({
34
+ value: 'value',
35
+ label: 'label',
36
+ children: 'children'
37
+ }, rest.fieldNames);
38
+ var _useState = useState(false),
39
+ _useState2 = _slicedToArray(_useState, 2),
40
+ open = _useState2[0],
41
+ setOpen = _useState2[1];
42
+ var _useState3 = useState(value || []),
43
+ _useState4 = _slicedToArray(_useState3, 2),
44
+ internalValue = _useState4[0],
45
+ setInternalValue = _useState4[1];
46
+ useEffect(function () {
47
+ if ((value || []) !== (internalValue || [])) {
48
+ setInternalValue(value || []);
49
+ }
50
+ }, [value]);
51
+ var valueText = function valueText() {
52
+ if (labelInValue) {
53
+ return internalValue === null || internalValue === void 0 ? void 0 : internalValue.map(function (item) {
54
+ return item[mergedFieldNames.label];
55
+ }).join('/');
56
+ }
57
+ };
58
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CascaderPopup, _extends({}, rest, {
59
+ open: open,
60
+ value: internalValue,
61
+ labelInValue: labelInValue,
62
+ onCancel: function onCancel() {
63
+ setOpen(false);
64
+ },
65
+ onOk: function onOk(value) {
66
+ setInternalValue(value || []);
67
+ setOpen(false);
68
+ onChange === null || onChange === void 0 || onChange(value || []);
69
+ }
70
+ })), /*#__PURE__*/React.createElement("div", {
71
+ className: classNames(cls, "".concat(cls, "-").concat(align)),
72
+ onClick: function onClick() {
73
+ setOpen(true);
74
+ }
75
+ }, isEmpty(internalValue) ? /*#__PURE__*/React.createElement("div", {
76
+ className: "".concat(cls, "-placeholder")
77
+ }, placeholder) : /*#__PURE__*/React.createElement("div", null, valueText())));
78
+ };
@@ -1,3 +1,3 @@
1
- import { CascaderPicker, CascaderPickerProps } from "@trionesdev/antd-mobile-base-react";
1
+ import { CascaderPicker, CascaderPickerProps } from "./CascaderPicker";
2
2
  export type { CascaderPickerProps };
3
3
  export default CascaderPicker;
@@ -1,2 +1,2 @@
1
- import { CascaderPicker } from "@trionesdev/antd-mobile-base-react";
1
+ import { CascaderPicker } from "./CascaderPicker";
2
2
  export default CascaderPicker;
@@ -0,0 +1,24 @@
1
+ @use "../style/variable" as variable;
2
+ $cascaderPickerCls: 'triones-antm-cascader-picker';
3
+
4
+ .#{$cascaderPickerCls}{
5
+ width: 100%;
6
+ line-height: 1.4;
7
+ display: flex;
8
+
9
+ &-left {
10
+ justify-content: flex-start;
11
+ }
12
+
13
+ &-center {
14
+ justify-content: center;
15
+ }
16
+
17
+ &-right {
18
+ justify-content: flex-end;
19
+ }
20
+
21
+ &-placeholder{
22
+ color: variable.$trionesColorTextPlaceholder;
23
+ }
24
+ }
@@ -0,0 +1,27 @@
1
+ import React, { FC } from 'react';
2
+ import './style.scss';
3
+ export type CascaderPopupProps = {
4
+ className?: string;
5
+ style?: React.CSSProperties;
6
+ open?: boolean;
7
+ afterOpenChange?: (open: boolean) => void;
8
+ title?: React.ReactNode;
9
+ options?: any[];
10
+ /**
11
+ * @description 是否把每个选项的 label 包装到 value 中,会把 Select 的 value 类型从 string 变为 { value: string, label: ReactNode } 的格式
12
+ * @default false
13
+ */
14
+ labelInValue?: boolean;
15
+ fieldNames?: {
16
+ value?: string;
17
+ label?: string;
18
+ children?: string;
19
+ };
20
+ columnsCount?: number;
21
+ value?: any[];
22
+ onOk?: (value?: any[]) => void;
23
+ onCancel?: () => void;
24
+ onClose?: () => void;
25
+ asyncRequest?: (parentValue?: any) => Promise<any>;
26
+ };
27
+ export declare const CascaderPopup: FC<CascaderPopupProps>;