@trionesdev/antd-taro-react 0.0.2-beta.11 → 0.0.2-beta.12
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.js +0 -3
- package/dist/Picker/Picker.js +30 -4
- package/package.json +2 -2
|
@@ -39,9 +39,6 @@ export var Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref,
|
|
|
39
39
|
setCurrentMonth(dayjs(month));
|
|
40
40
|
}
|
|
41
41
|
}, [month]);
|
|
42
|
-
useEffect(function () {
|
|
43
|
-
console.log('calendar value', value);
|
|
44
|
-
}, [value]);
|
|
45
42
|
return /*#__PURE__*/React.createElement("div", {
|
|
46
43
|
ref: ref,
|
|
47
44
|
className: classNames("".concat(calendarCls))
|
package/dist/Picker/Picker.js
CHANGED
|
@@ -5,7 +5,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5
5
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import classNames from 'classnames';
|
|
8
|
-
import
|
|
8
|
+
import { size } from 'lodash-es';
|
|
9
|
+
import React, { useEffect, useState } from 'react';
|
|
9
10
|
import ConfigProvider from "../ConfigProvider";
|
|
10
11
|
import PickerView from "../PickerView";
|
|
11
12
|
import Popup from "../Popup";
|
|
@@ -15,7 +16,8 @@ export var Picker = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
15
16
|
var open = _ref.open,
|
|
16
17
|
afterOpenChange = _ref.afterOpenChange,
|
|
17
18
|
title = _ref.title,
|
|
18
|
-
columns = _ref.columns,
|
|
19
|
+
_ref$columns = _ref.columns,
|
|
20
|
+
columns = _ref$columns === void 0 ? [] : _ref$columns,
|
|
19
21
|
_ref$labelInValue = _ref.labelInValue,
|
|
20
22
|
labelInValue = _ref$labelInValue === void 0 ? false : _ref$labelInValue,
|
|
21
23
|
value = _ref.value,
|
|
@@ -24,7 +26,7 @@ export var Picker = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
24
26
|
onClose = _ref.onClose;
|
|
25
27
|
var _ConfigProvider$useCo = ConfigProvider.useConfig(),
|
|
26
28
|
locale = _ConfigProvider$useCo.locale;
|
|
27
|
-
var _useState = useState([]),
|
|
29
|
+
var _useState = useState(value || []),
|
|
28
30
|
_useState2 = _slicedToArray(_useState, 2),
|
|
29
31
|
internalValue = _useState2[0],
|
|
30
32
|
setInternalValue = _useState2[1];
|
|
@@ -39,6 +41,30 @@ export var Picker = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
39
41
|
onCancel === null || onCancel === void 0 || onCancel();
|
|
40
42
|
handleClose();
|
|
41
43
|
};
|
|
44
|
+
useEffect(function () {
|
|
45
|
+
if (!value || size(value) === 0 || size(value) !== size(columns)) {
|
|
46
|
+
if (labelInValue) {
|
|
47
|
+
setInternalValue(columns.map(function (column, index) {
|
|
48
|
+
if (index < size(value)) {
|
|
49
|
+
return column.find(function (option) {
|
|
50
|
+
return option.value === value[index].value;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return column[0];
|
|
54
|
+
}));
|
|
55
|
+
} else {
|
|
56
|
+
setInternalValue(columns.map(function (column, index) {
|
|
57
|
+
if (index < size(value)) {
|
|
58
|
+
var _column$find;
|
|
59
|
+
return (_column$find = column.find(function (option) {
|
|
60
|
+
return option.value === value[index];
|
|
61
|
+
})) === null || _column$find === void 0 ? void 0 : _column$find.value;
|
|
62
|
+
}
|
|
63
|
+
return column[0].value;
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}, [columns]);
|
|
42
68
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
43
69
|
open: open,
|
|
44
70
|
onClose: function onClose() {
|
|
@@ -55,7 +81,7 @@ export var Picker = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
55
81
|
}, /*#__PURE__*/React.createElement("div", {
|
|
56
82
|
className: classNames("".concat(pickerCls, "-header"))
|
|
57
83
|
}, /*#__PURE__*/React.createElement("a", {
|
|
58
|
-
className: classNames("".concat(pickerCls, "-header-button")),
|
|
84
|
+
className: classNames("".concat(pickerCls, "-header-button"), "".concat(pickerCls, "-header-button-cancel")),
|
|
59
85
|
onClick: handelCancel
|
|
60
86
|
}, locale.common.cancel), title && /*#__PURE__*/React.createElement("div", {
|
|
61
87
|
className: classNames("".concat(pickerCls, "-header-title"))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trionesdev/antd-taro-react",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.12",
|
|
4
4
|
"description": "antd taro react",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@tarojs/components": "^4.1.8",
|
|
59
|
-
"@trionesdev/antd-mobile-base-react": "^0.0.2-beta.
|
|
59
|
+
"@trionesdev/antd-mobile-base-react": "^0.0.2-beta.12",
|
|
60
60
|
"crypto-js": "^4.2.0",
|
|
61
61
|
"dayjs": "^1.11.19",
|
|
62
62
|
"rc-field-form": "^2.7.0",
|