@nickeylin/antd-mobile-pro 2.0.1 → 2.0.2
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.
|
@@ -34,6 +34,7 @@ __export(picker_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(picker_exports);
|
|
35
35
|
var import_ahooks = require("ahooks");
|
|
36
36
|
var import_antd_mobile = require("antd-mobile");
|
|
37
|
+
var import_lodash = require("lodash");
|
|
37
38
|
var import_react = require("react");
|
|
38
39
|
var import_forward_ref_with_generics = __toESM(require("../../utils/forward-ref-with-generics"));
|
|
39
40
|
var import_config_provider = require("../config-provider");
|
|
@@ -49,13 +50,15 @@ function ActionSheetPickerRaw({
|
|
|
49
50
|
}, ref) {
|
|
50
51
|
const { locale } = (0, import_config_provider.useConfig)();
|
|
51
52
|
const { value: valueKey = "key", text: textKey = "text" } = fieldNames ?? {};
|
|
52
|
-
const [visible, setVisible] = (0, import_ahooks.useControllableValue)(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
const [visible, setVisible] = (0, import_ahooks.useControllableValue)(
|
|
54
|
+
(0, import_lodash.pickBy)({
|
|
55
|
+
value: visibleProp,
|
|
56
|
+
onChange(value2) {
|
|
57
|
+
if (!value2)
|
|
58
|
+
onClose == null ? void 0 : onClose();
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
);
|
|
59
62
|
const [value, setValue] = (0, import_ahooks.useControllableValue)({
|
|
60
63
|
value: valueProp,
|
|
61
64
|
onChange(val) {
|
|
@@ -74,6 +77,7 @@ function ActionSheetPickerRaw({
|
|
|
74
77
|
const actions = (0, import_react.useMemo)(
|
|
75
78
|
() => ({
|
|
76
79
|
open() {
|
|
80
|
+
console.log("open");
|
|
77
81
|
setVisible(true);
|
|
78
82
|
},
|
|
79
83
|
close() {
|
|
@@ -6,6 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
7
|
import { useControllableValue } from 'ahooks';
|
|
8
8
|
import { ActionSheet } from 'antd-mobile';
|
|
9
|
+
import { pickBy } from 'lodash';
|
|
9
10
|
import { useImperativeHandle, useMemo } from 'react';
|
|
10
11
|
import forwardRefWithGenerics from "../../utils/forward-ref-with-generics";
|
|
11
12
|
import { useConfig } from "../config-provider";
|
|
@@ -29,12 +30,12 @@ function ActionSheetPickerRaw(_ref, ref) {
|
|
|
29
30
|
valueKey = _ref2$value === void 0 ? 'key' : _ref2$value,
|
|
30
31
|
_ref2$text = _ref2.text,
|
|
31
32
|
textKey = _ref2$text === void 0 ? 'text' : _ref2$text;
|
|
32
|
-
var _useControllableValue = useControllableValue({
|
|
33
|
+
var _useControllableValue = useControllableValue(pickBy({
|
|
33
34
|
value: visibleProp,
|
|
34
35
|
onChange: function onChange(value) {
|
|
35
36
|
if (!value) onClose === null || onClose === void 0 || onClose();
|
|
36
37
|
}
|
|
37
|
-
}),
|
|
38
|
+
})),
|
|
38
39
|
_useControllableValue2 = _slicedToArray(_useControllableValue, 2),
|
|
39
40
|
visible = _useControllableValue2[0],
|
|
40
41
|
setVisible = _useControllableValue2[1];
|
|
@@ -71,6 +72,7 @@ function ActionSheetPickerRaw(_ref, ref) {
|
|
|
71
72
|
var actions = useMemo(function () {
|
|
72
73
|
return {
|
|
73
74
|
open: function open() {
|
|
75
|
+
console.log('open');
|
|
74
76
|
setVisible(true);
|
|
75
77
|
},
|
|
76
78
|
close: function close() {
|