antd-mobile 5.9.4 → 5.10.1
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/2x/cjs/components/capsule-tabs/capsule-tabs.js +3 -3
- package/2x/cjs/components/collapse/collapse.js +3 -3
- package/2x/cjs/components/divider/divider.css +19 -8
- package/2x/cjs/components/divider/divider.d.ts +1 -0
- package/2x/cjs/components/divider/divider.js +3 -2
- package/2x/cjs/components/form/form-item.js +3 -1
- package/2x/cjs/components/form/form.js +3 -2
- package/2x/cjs/components/image-uploader/image-uploader.d.ts +2 -0
- package/2x/cjs/components/image-uploader/image-uploader.js +4 -1
- package/2x/cjs/components/image-uploader/preview-item.d.ts +2 -0
- package/2x/cjs/components/image-uploader/preview-item.js +3 -2
- package/2x/cjs/components/index-bar/index-bar.js +3 -3
- package/2x/cjs/components/jumbo-tabs/jumbo-tabs.js +3 -3
- package/2x/cjs/components/number-keyboard/number-keyboard.js +0 -5
- package/2x/cjs/components/picker-view/picker-view.d.ts +1 -0
- package/2x/cjs/components/picker-view/wheel.js +3 -1
- package/2x/cjs/components/popover/popover-menu.js +2 -1
- package/2x/cjs/components/side-bar/side-bar.js +3 -3
- package/2x/cjs/components/stepper/stepper.js +16 -9
- package/2x/cjs/components/swiper/swiper.js +1 -0
- package/2x/cjs/components/tab-bar/tab-bar.js +3 -3
- package/2x/cjs/components/tabs/tabs.js +3 -3
- package/2x/cjs/components/tree-select/multiple.js +2 -1
- package/2x/cjs/utils/traverse-react-node.d.ts +2 -0
- package/2x/cjs/utils/traverse-react-node.js +29 -0
- package/2x/cjs/utils/undefined-fallback.d.ts +3 -0
- package/2x/cjs/utils/undefined-fallback.js +16 -0
- package/2x/es/components/capsule-tabs/capsule-tabs.js +2 -1
- package/2x/es/components/collapse/collapse.js +2 -1
- package/2x/es/components/divider/divider.css +19 -8
- package/2x/es/components/divider/divider.d.ts +1 -0
- package/2x/es/components/divider/divider.js +3 -2
- package/2x/es/components/form/form-item.js +2 -1
- package/2x/es/components/form/form.js +2 -1
- package/2x/es/components/image-uploader/image-uploader.d.ts +2 -0
- package/2x/es/components/image-uploader/image-uploader.js +4 -1
- package/2x/es/components/image-uploader/preview-item.d.ts +2 -0
- package/2x/es/components/image-uploader/preview-item.js +3 -2
- package/2x/es/components/index-bar/index-bar.js +2 -1
- package/2x/es/components/jumbo-tabs/jumbo-tabs.js +2 -1
- package/2x/es/components/number-keyboard/number-keyboard.js +0 -5
- package/2x/es/components/picker-view/picker-view.d.ts +1 -0
- package/2x/es/components/picker-view/wheel.js +3 -1
- package/2x/es/components/popover/popover-menu.js +2 -1
- package/2x/es/components/side-bar/side-bar.js +2 -1
- package/2x/es/components/stepper/stepper.js +15 -9
- package/2x/es/components/swiper/swiper.js +1 -0
- package/2x/es/components/tab-bar/tab-bar.js +2 -1
- package/2x/es/components/tabs/tabs.js +2 -1
- package/2x/es/components/tree-select/multiple.js +2 -1
- package/2x/es/utils/traverse-react-node.d.ts +2 -0
- package/2x/es/utils/traverse-react-node.js +18 -0
- package/2x/es/utils/undefined-fallback.d.ts +3 -0
- package/2x/es/utils/undefined-fallback.js +9 -0
- package/2x/package.json +5 -1
- package/bundle/antd-mobile.cjs.js +61 -29
- package/bundle/antd-mobile.es.js +60 -29
- package/bundle/style.css +18 -8
- package/cjs/components/capsule-tabs/capsule-tabs.js +3 -3
- package/cjs/components/collapse/collapse.js +3 -3
- package/cjs/components/divider/divider.css +18 -8
- package/cjs/components/divider/divider.d.ts +1 -0
- package/cjs/components/divider/divider.js +3 -2
- package/cjs/components/form/form-item.js +3 -1
- package/cjs/components/form/form.js +3 -2
- package/cjs/components/image-uploader/image-uploader.d.ts +2 -0
- package/cjs/components/image-uploader/image-uploader.js +4 -1
- package/cjs/components/image-uploader/preview-item.d.ts +2 -0
- package/cjs/components/image-uploader/preview-item.js +3 -2
- package/cjs/components/index-bar/index-bar.js +3 -3
- package/cjs/components/jumbo-tabs/jumbo-tabs.js +3 -3
- package/cjs/components/number-keyboard/number-keyboard.js +0 -5
- package/cjs/components/picker-view/picker-view.d.ts +1 -0
- package/cjs/components/picker-view/wheel.js +3 -1
- package/cjs/components/popover/popover-menu.js +2 -1
- package/cjs/components/side-bar/side-bar.js +3 -3
- package/cjs/components/stepper/stepper.js +16 -9
- package/cjs/components/swiper/swiper.js +1 -0
- package/cjs/components/tab-bar/tab-bar.js +3 -3
- package/cjs/components/tabs/tabs.js +3 -3
- package/cjs/components/tree-select/multiple.js +2 -1
- package/cjs/utils/traverse-react-node.d.ts +2 -0
- package/cjs/utils/traverse-react-node.js +29 -0
- package/cjs/utils/undefined-fallback.d.ts +3 -0
- package/cjs/utils/undefined-fallback.js +16 -0
- package/es/components/capsule-tabs/capsule-tabs.js +2 -1
- package/es/components/collapse/collapse.js +2 -1
- package/es/components/divider/divider.css +18 -8
- package/es/components/divider/divider.d.ts +1 -0
- package/es/components/divider/divider.js +3 -2
- package/es/components/form/form-item.js +2 -1
- package/es/components/form/form.js +2 -1
- package/es/components/image-uploader/image-uploader.d.ts +2 -0
- package/es/components/image-uploader/image-uploader.js +4 -1
- package/es/components/image-uploader/preview-item.d.ts +2 -0
- package/es/components/image-uploader/preview-item.js +3 -2
- package/es/components/index-bar/index-bar.js +2 -1
- package/es/components/jumbo-tabs/jumbo-tabs.js +2 -1
- package/es/components/number-keyboard/number-keyboard.js +0 -5
- package/es/components/picker-view/picker-view.d.ts +1 -0
- package/es/components/picker-view/wheel.js +3 -1
- package/es/components/popover/popover-menu.js +2 -1
- package/es/components/side-bar/side-bar.js +2 -1
- package/es/components/stepper/stepper.js +15 -9
- package/es/components/swiper/swiper.js +1 -0
- package/es/components/tab-bar/tab-bar.js +2 -1
- package/es/components/tabs/tabs.js +2 -1
- package/es/components/tree-select/multiple.js +2 -1
- package/es/utils/traverse-react-node.d.ts +2 -0
- package/es/utils/traverse-react-node.js +18 -0
- package/es/utils/undefined-fallback.d.ts +3 -0
- package/es/utils/undefined-fallback.js +9 -0
- package/package.json +5 -1
- package/umd/antd-mobile.js +1 -1
- package/umd/antd-mobile.js.LICENSE.txt +9 -0
|
@@ -6,11 +6,13 @@ var classNames = require("classnames");
|
|
|
6
6
|
var ahooks = require("ahooks");
|
|
7
7
|
var web = require("@react-spring/web");
|
|
8
8
|
var dayjs = require("dayjs");
|
|
9
|
+
var reactIs = require("react-is");
|
|
9
10
|
var react = require("@use-gesture/react");
|
|
10
11
|
var antdMobileIcons = require("antd-mobile-icons");
|
|
11
12
|
var stagedComponents = require("staged-components");
|
|
12
13
|
var RcForm = require("rc-field-form");
|
|
13
14
|
var dom = require("@floating-ui/dom");
|
|
15
|
+
var Big = require("big.js");
|
|
14
16
|
function _interopDefaultLegacy(e) {
|
|
15
17
|
return e && typeof e === "object" && "default" in e ? e : { "default": e };
|
|
16
18
|
}
|
|
@@ -18,6 +20,7 @@ var React__default = /* @__PURE__ */ _interopDefaultLegacy(React$1);
|
|
|
18
20
|
var classNames__default = /* @__PURE__ */ _interopDefaultLegacy(classNames);
|
|
19
21
|
var dayjs__default = /* @__PURE__ */ _interopDefaultLegacy(dayjs);
|
|
20
22
|
var RcForm__default = /* @__PURE__ */ _interopDefaultLegacy(RcForm);
|
|
23
|
+
var Big__default = /* @__PURE__ */ _interopDefaultLegacy(Big);
|
|
21
24
|
var global$1 = "";
|
|
22
25
|
const canUseDom = !!(typeof window !== "undefined" && typeof document !== "undefined" && window.document && window.document.createElement);
|
|
23
26
|
if (canUseDom) {
|
|
@@ -9144,6 +9147,20 @@ const ScrollMask = (props) => {
|
|
|
9144
9147
|
}
|
|
9145
9148
|
}));
|
|
9146
9149
|
};
|
|
9150
|
+
function traverseReactNode(children, fn) {
|
|
9151
|
+
let i = 0;
|
|
9152
|
+
function handle(target) {
|
|
9153
|
+
React__default["default"].Children.forEach(target, (child) => {
|
|
9154
|
+
if (!reactIs.isFragment(child)) {
|
|
9155
|
+
fn(child, i);
|
|
9156
|
+
i += 1;
|
|
9157
|
+
} else {
|
|
9158
|
+
handle(child.props.children);
|
|
9159
|
+
}
|
|
9160
|
+
});
|
|
9161
|
+
}
|
|
9162
|
+
handle(children);
|
|
9163
|
+
}
|
|
9147
9164
|
const classPrefix$15 = `adm-capsule-tabs`;
|
|
9148
9165
|
const CapsuleTab = () => {
|
|
9149
9166
|
return null;
|
|
@@ -9155,7 +9172,7 @@ const CapsuleTabs = (props) => {
|
|
|
9155
9172
|
const keyToIndexRecord = {};
|
|
9156
9173
|
let firstActiveKey = null;
|
|
9157
9174
|
const panes = [];
|
|
9158
|
-
|
|
9175
|
+
traverseReactNode(props.children, (child, index2) => {
|
|
9159
9176
|
if (!React__default["default"].isValidElement(child))
|
|
9160
9177
|
return;
|
|
9161
9178
|
const key = child.key;
|
|
@@ -9673,6 +9690,7 @@ const Wheel = React$1.memo((props) => {
|
|
|
9673
9690
|
className: `${classPrefix$13}-column-wheel`,
|
|
9674
9691
|
"aria-hidden": true
|
|
9675
9692
|
}, column.map((item, index2) => {
|
|
9693
|
+
var _a;
|
|
9676
9694
|
const selected = props.value === item.value;
|
|
9677
9695
|
if (selected)
|
|
9678
9696
|
selectedIndex = index2;
|
|
@@ -9681,7 +9699,7 @@ const Wheel = React$1.memo((props) => {
|
|
|
9681
9699
|
scrollSelect(index2);
|
|
9682
9700
|
}
|
|
9683
9701
|
return React__default["default"].createElement("div", {
|
|
9684
|
-
key: item.value,
|
|
9702
|
+
key: (_a = item.key) !== null && _a !== void 0 ? _a : item.value,
|
|
9685
9703
|
"data-selected": item.value === value,
|
|
9686
9704
|
className: `${classPrefix$13}-column-item`,
|
|
9687
9705
|
onClick: handleClick,
|
|
@@ -10058,7 +10076,7 @@ const Tabs$1 = (p) => {
|
|
|
10058
10076
|
const keyToIndexRecord = {};
|
|
10059
10077
|
let firstActiveKey = null;
|
|
10060
10078
|
const panes = [];
|
|
10061
|
-
|
|
10079
|
+
traverseReactNode(props.children, (child, index2) => {
|
|
10062
10080
|
if (!React__default["default"].isValidElement(child))
|
|
10063
10081
|
return;
|
|
10064
10082
|
const key = child.key;
|
|
@@ -10921,7 +10939,7 @@ const CollapsePanelContent = (props) => {
|
|
|
10921
10939
|
const Collapse = (props) => {
|
|
10922
10940
|
var _a;
|
|
10923
10941
|
const panels = [];
|
|
10924
|
-
|
|
10942
|
+
traverseReactNode(props.children, (child) => {
|
|
10925
10943
|
if (!React__default["default"].isValidElement(child))
|
|
10926
10944
|
return;
|
|
10927
10945
|
const key = child.key;
|
|
@@ -11733,12 +11751,13 @@ var index$b = attachPropertiesToComponent(Dialog, {
|
|
|
11733
11751
|
var divider = "";
|
|
11734
11752
|
const classPrefix$R = `adm-divider`;
|
|
11735
11753
|
const defaultProps$E = {
|
|
11736
|
-
contentPosition: "center"
|
|
11754
|
+
contentPosition: "center",
|
|
11755
|
+
direction: "horizontal"
|
|
11737
11756
|
};
|
|
11738
11757
|
const Divider = (p) => {
|
|
11739
11758
|
const props = mergeProps(defaultProps$E, p);
|
|
11740
11759
|
return withNativeProps(props, React__default["default"].createElement("div", {
|
|
11741
|
-
className: classNames__default["default"](classPrefix$R, `${classPrefix$R}-${props.contentPosition}`)
|
|
11760
|
+
className: classNames__default["default"](classPrefix$R, `${classPrefix$R}-${props.direction}`, `${classPrefix$R}-${props.contentPosition}`)
|
|
11742
11761
|
}, props.children && React__default["default"].createElement("div", {
|
|
11743
11762
|
className: `${classPrefix$R}-content`
|
|
11744
11763
|
}, props.children)));
|
|
@@ -12891,7 +12910,7 @@ const Form$1 = React$1.forwardRef((p, ref) => {
|
|
|
12891
12910
|
}, items));
|
|
12892
12911
|
items = [];
|
|
12893
12912
|
}
|
|
12894
|
-
|
|
12913
|
+
traverseReactNode(props.children, (child) => {
|
|
12895
12914
|
if (React__default["default"].isValidElement(child)) {
|
|
12896
12915
|
if (child.type === Header) {
|
|
12897
12916
|
collect();
|
|
@@ -13331,6 +13350,14 @@ const PopoverMenu = React$1.forwardRef((props, ref) => {
|
|
|
13331
13350
|
var Popover = attachPropertiesToComponent(Popover$1, {
|
|
13332
13351
|
Menu: PopoverMenu
|
|
13333
13352
|
});
|
|
13353
|
+
function undefinedFallback(...items) {
|
|
13354
|
+
let i;
|
|
13355
|
+
for (i = 0; i < items.length; i++) {
|
|
13356
|
+
if (items[i] !== void 0)
|
|
13357
|
+
break;
|
|
13358
|
+
}
|
|
13359
|
+
return items[i];
|
|
13360
|
+
}
|
|
13334
13361
|
const NAME_SPLIT = "__SPLIT__";
|
|
13335
13362
|
const classPrefix$H = `adm-form-item`;
|
|
13336
13363
|
const MemoInput = React__default["default"].memo(({
|
|
@@ -13450,7 +13477,7 @@ const FormItem = (props) => {
|
|
|
13450
13477
|
const {
|
|
13451
13478
|
validateTrigger: contextValidateTrigger
|
|
13452
13479
|
} = React$1.useContext(default_1);
|
|
13453
|
-
const mergedValidateTrigger = validateTrigger
|
|
13480
|
+
const mergedValidateTrigger = undefinedFallback(validateTrigger, contextValidateTrigger, trigger);
|
|
13454
13481
|
const updateRef = React__default["default"].useRef(0);
|
|
13455
13482
|
updateRef.current += 1;
|
|
13456
13483
|
const [subMetas, setSubMetas] = React$1.useState({});
|
|
@@ -14014,7 +14041,8 @@ const PreviewItem = (props) => {
|
|
|
14014
14041
|
url,
|
|
14015
14042
|
file,
|
|
14016
14043
|
deletable,
|
|
14017
|
-
onDelete
|
|
14044
|
+
onDelete,
|
|
14045
|
+
imageFit
|
|
14018
14046
|
} = props;
|
|
14019
14047
|
const src = React$1.useMemo(() => {
|
|
14020
14048
|
if (url) {
|
|
@@ -14049,7 +14077,7 @@ const PreviewItem = (props) => {
|
|
|
14049
14077
|
}, React__default["default"].createElement(Image$1, {
|
|
14050
14078
|
className: `${classPrefix$B}-cell-image`,
|
|
14051
14079
|
src,
|
|
14052
|
-
fit:
|
|
14080
|
+
fit: imageFit,
|
|
14053
14081
|
onClick: props.onClick
|
|
14054
14082
|
}), renderLoading(), renderDelete());
|
|
14055
14083
|
};
|
|
@@ -14089,7 +14117,8 @@ const defaultProps$t = {
|
|
|
14089
14117
|
defaultValue: [],
|
|
14090
14118
|
accept: "image/*",
|
|
14091
14119
|
preview: true,
|
|
14092
|
-
showFailed: true
|
|
14120
|
+
showFailed: true,
|
|
14121
|
+
imageFit: "cover"
|
|
14093
14122
|
};
|
|
14094
14123
|
const ImageUploader = (p) => {
|
|
14095
14124
|
const props = mergeProps(defaultProps$t, p);
|
|
@@ -14215,6 +14244,7 @@ const ImageUploader = (p) => {
|
|
|
14215
14244
|
key: (_a = fileItem.key) !== null && _a !== void 0 ? _a : index2,
|
|
14216
14245
|
url: (_b = fileItem.thumbnailUrl) !== null && _b !== void 0 ? _b : fileItem.url,
|
|
14217
14246
|
deletable: props.deletable,
|
|
14247
|
+
imageFit: props.imageFit,
|
|
14218
14248
|
onClick: () => {
|
|
14219
14249
|
if (props.preview) {
|
|
14220
14250
|
previewImage(index2);
|
|
@@ -14238,6 +14268,7 @@ const ImageUploader = (p) => {
|
|
|
14238
14268
|
file: task.file,
|
|
14239
14269
|
deletable: task.status !== "pending",
|
|
14240
14270
|
status: task.status,
|
|
14271
|
+
imageFit: props.imageFit,
|
|
14241
14272
|
onDelete: () => {
|
|
14242
14273
|
setTasks(tasks.filter((x) => x.id !== task.id));
|
|
14243
14274
|
}
|
|
@@ -14335,7 +14366,7 @@ const IndexBar = React$1.forwardRef((p, ref) => {
|
|
|
14335
14366
|
const bodyRef = React$1.useRef(null);
|
|
14336
14367
|
const indexItems = [];
|
|
14337
14368
|
const panels = [];
|
|
14338
|
-
|
|
14369
|
+
traverseReactNode(props.children, (child) => {
|
|
14339
14370
|
var _a;
|
|
14340
14371
|
if (!React__default["default"].isValidElement(child))
|
|
14341
14372
|
return;
|
|
@@ -14603,7 +14634,7 @@ const JumboTabs = (props) => {
|
|
|
14603
14634
|
const keyToIndexRecord = {};
|
|
14604
14635
|
let firstActiveKey = null;
|
|
14605
14636
|
const panes = [];
|
|
14606
|
-
|
|
14637
|
+
traverseReactNode(props.children, (child, index2) => {
|
|
14607
14638
|
if (!React__default["default"].isValidElement(child))
|
|
14608
14639
|
return;
|
|
14609
14640
|
const key = child.key;
|
|
@@ -15135,9 +15166,6 @@ const NumberKeyboard = (p) => {
|
|
|
15135
15166
|
onBackspacePressEnd();
|
|
15136
15167
|
}
|
|
15137
15168
|
},
|
|
15138
|
-
onMouseUp: (e) => {
|
|
15139
|
-
onKeyPress(e, key);
|
|
15140
|
-
},
|
|
15141
15169
|
title: key,
|
|
15142
15170
|
role: "button"
|
|
15143
15171
|
}, key === "BACKSPACE" ? React__default["default"].createElement(antdMobileIcons.TextDeletionOutline, null) : key);
|
|
@@ -15173,13 +15201,11 @@ const NumberKeyboard = (p) => {
|
|
|
15173
15201
|
onKeyPress(e, "BACKSPACE");
|
|
15174
15202
|
onBackspacePressEnd();
|
|
15175
15203
|
},
|
|
15176
|
-
onMouseUp: (e) => onKeyPress(e, "BACKSPACE"),
|
|
15177
15204
|
title: "BACKSPACE",
|
|
15178
15205
|
role: "button"
|
|
15179
15206
|
}, React__default["default"].createElement(antdMobileIcons.TextDeletionOutline, null)), React__default["default"].createElement("div", {
|
|
15180
15207
|
className: `${classPrefix$r}-key extra-key ok-key`,
|
|
15181
15208
|
onTouchEnd: (e) => onKeyPress(e, "OK"),
|
|
15182
|
-
onMouseUp: (e) => onKeyPress(e, "OK"),
|
|
15183
15209
|
role: "button"
|
|
15184
15210
|
}, confirmText))), props.safeArea && React__default["default"].createElement("div", {
|
|
15185
15211
|
className: `${classPrefix$r}-footer`
|
|
@@ -15906,7 +15932,7 @@ const SideBar = (props) => {
|
|
|
15906
15932
|
var _a;
|
|
15907
15933
|
let firstActiveKey = null;
|
|
15908
15934
|
const items = [];
|
|
15909
|
-
|
|
15935
|
+
traverseReactNode(props.children, (child, index2) => {
|
|
15910
15936
|
if (!React__default["default"].isValidElement(child))
|
|
15911
15937
|
return;
|
|
15912
15938
|
const key = child.key;
|
|
@@ -16282,12 +16308,12 @@ const Stepper = (p) => {
|
|
|
16282
16308
|
inputReadOnly
|
|
16283
16309
|
} = props;
|
|
16284
16310
|
const [value, setValue] = usePropsValue(props);
|
|
16285
|
-
const [inputValue, setInputValue] = React$1.useState(() => convertValueToText(value));
|
|
16311
|
+
const [inputValue, setInputValue] = React$1.useState(() => convertValueToText(value, props.digits));
|
|
16286
16312
|
function setValueWithCheck(v) {
|
|
16287
16313
|
if (isNaN(v))
|
|
16288
16314
|
return;
|
|
16289
16315
|
let target = bound(v, props.min, props.max);
|
|
16290
|
-
if (props.digits
|
|
16316
|
+
if (props.digits !== void 0) {
|
|
16291
16317
|
target = parseFloat(target.toFixed(props.digits));
|
|
16292
16318
|
}
|
|
16293
16319
|
setValue(target);
|
|
@@ -16295,14 +16321,14 @@ const Stepper = (p) => {
|
|
|
16295
16321
|
const [hasFocus, setHasFocus] = React$1.useState(false);
|
|
16296
16322
|
React$1.useEffect(() => {
|
|
16297
16323
|
if (!hasFocus) {
|
|
16298
|
-
setInputValue(convertValueToText(value));
|
|
16324
|
+
setInputValue(convertValueToText(value, props.digits));
|
|
16299
16325
|
}
|
|
16300
16326
|
}, [hasFocus]);
|
|
16301
16327
|
React$1.useEffect(() => {
|
|
16302
16328
|
if (!hasFocus) {
|
|
16303
|
-
setInputValue(convertValueToText(value));
|
|
16329
|
+
setInputValue(convertValueToText(value, props.digits));
|
|
16304
16330
|
}
|
|
16305
|
-
}, [value]);
|
|
16331
|
+
}, [value, props.digits]);
|
|
16306
16332
|
const handleInputChange = (v) => {
|
|
16307
16333
|
setInputValue(v);
|
|
16308
16334
|
const value2 = convertTextToValue(v);
|
|
@@ -16317,10 +16343,10 @@ const Stepper = (p) => {
|
|
|
16317
16343
|
}
|
|
16318
16344
|
};
|
|
16319
16345
|
const handleMinus = () => {
|
|
16320
|
-
setValueWithCheck((value !== null && value !== void 0 ? value : 0)
|
|
16346
|
+
setValueWithCheck(Big__default["default"](value !== null && value !== void 0 ? value : 0).minus(step).toNumber());
|
|
16321
16347
|
};
|
|
16322
16348
|
const handlePlus = () => {
|
|
16323
|
-
setValueWithCheck((value !== null && value !== void 0 ? value : 0)
|
|
16349
|
+
setValueWithCheck(Big__default["default"](value !== null && value !== void 0 ? value : 0).add(step).toNumber());
|
|
16324
16350
|
};
|
|
16325
16351
|
const minusDisabled = () => {
|
|
16326
16352
|
if (disabled)
|
|
@@ -16382,10 +16408,14 @@ const Stepper = (p) => {
|
|
|
16382
16408
|
color: "primary"
|
|
16383
16409
|
}, React__default["default"].createElement(antdMobileIcons.AddOutline, null))));
|
|
16384
16410
|
};
|
|
16385
|
-
function convertValueToText(value) {
|
|
16411
|
+
function convertValueToText(value, digits) {
|
|
16386
16412
|
if (value === null)
|
|
16387
16413
|
return "";
|
|
16388
|
-
|
|
16414
|
+
if (digits !== void 0) {
|
|
16415
|
+
return value.toFixed(digits);
|
|
16416
|
+
} else {
|
|
16417
|
+
return value.toString();
|
|
16418
|
+
}
|
|
16389
16419
|
}
|
|
16390
16420
|
function convertTextToValue(text) {
|
|
16391
16421
|
if (text === "")
|
|
@@ -16726,6 +16756,8 @@ const Swiper = React$1.forwardRef(stagedComponents.staged((p, ref) => {
|
|
|
16726
16756
|
onRest: () => {
|
|
16727
16757
|
if (draggingRef.current)
|
|
16728
16758
|
return;
|
|
16759
|
+
if (!loop)
|
|
16760
|
+
return;
|
|
16729
16761
|
const rawX = position.get();
|
|
16730
16762
|
const totalWidth = 100 * count;
|
|
16731
16763
|
const standardPosition = modulus(rawX, totalWidth);
|
|
@@ -16977,7 +17009,7 @@ const TabBar = (p) => {
|
|
|
16977
17009
|
const props = mergeProps(defaultProps$7, p);
|
|
16978
17010
|
let firstActiveKey = null;
|
|
16979
17011
|
const items = [];
|
|
16980
|
-
|
|
17012
|
+
traverseReactNode(props.children, (child, index2) => {
|
|
16981
17013
|
if (!React__default["default"].isValidElement(child))
|
|
16982
17014
|
return;
|
|
16983
17015
|
const key = child.key;
|
package/bundle/antd-mobile.es.js
CHANGED
|
@@ -4,11 +4,13 @@ import classNames from "classnames";
|
|
|
4
4
|
import { useUnmountedRef, useUpdate, useMemoizedFn, useUpdateEffect, useIsomorphicLayoutEffect, createUpdateEffect, useThrottleFn, useDebounceEffect, useMount, useInViewport, useClickAway, useUnmount, useLockFn, useTimeout } from "ahooks";
|
|
5
5
|
import { useSpring, animated, to } from "@react-spring/web";
|
|
6
6
|
import dayjs from "dayjs";
|
|
7
|
+
import { isFragment } from "react-is";
|
|
7
8
|
import { useDrag, createUseGesture, dragAction, pinchAction } from "@use-gesture/react";
|
|
8
9
|
import { RightOutline, CheckOutline, DownOutline, PictureOutline, PictureWrongOutline, DownFill, QuestionCircleOutline, CloseOutline, AddOutline, CloseCircleFill, LeftOutline, SoundOutline, TextDeletionOutline, StarFill, CheckCircleFill, InformationCircleFill, ClockCircleFill, ExclamationCircleFill, SearchOutline, MinusOutline } from "antd-mobile-icons";
|
|
9
10
|
import { staged } from "staged-components";
|
|
10
11
|
import RcForm, { List as List$2, Field, useForm } from "rc-field-form";
|
|
11
12
|
import { computePosition, offset, shift, limitShift, flip, hide, arrow, autoUpdate } from "@floating-ui/dom";
|
|
13
|
+
import Big from "big.js";
|
|
12
14
|
var global$1 = "";
|
|
13
15
|
const canUseDom = !!(typeof window !== "undefined" && typeof document !== "undefined" && window.document && window.document.createElement);
|
|
14
16
|
if (canUseDom) {
|
|
@@ -9135,6 +9137,20 @@ const ScrollMask = (props) => {
|
|
|
9135
9137
|
}
|
|
9136
9138
|
}));
|
|
9137
9139
|
};
|
|
9140
|
+
function traverseReactNode(children, fn) {
|
|
9141
|
+
let i = 0;
|
|
9142
|
+
function handle(target) {
|
|
9143
|
+
React$1.Children.forEach(target, (child) => {
|
|
9144
|
+
if (!isFragment(child)) {
|
|
9145
|
+
fn(child, i);
|
|
9146
|
+
i += 1;
|
|
9147
|
+
} else {
|
|
9148
|
+
handle(child.props.children);
|
|
9149
|
+
}
|
|
9150
|
+
});
|
|
9151
|
+
}
|
|
9152
|
+
handle(children);
|
|
9153
|
+
}
|
|
9138
9154
|
const classPrefix$15 = `adm-capsule-tabs`;
|
|
9139
9155
|
const CapsuleTab = () => {
|
|
9140
9156
|
return null;
|
|
@@ -9146,7 +9162,7 @@ const CapsuleTabs = (props) => {
|
|
|
9146
9162
|
const keyToIndexRecord = {};
|
|
9147
9163
|
let firstActiveKey = null;
|
|
9148
9164
|
const panes = [];
|
|
9149
|
-
|
|
9165
|
+
traverseReactNode(props.children, (child, index2) => {
|
|
9150
9166
|
if (!React$1.isValidElement(child))
|
|
9151
9167
|
return;
|
|
9152
9168
|
const key = child.key;
|
|
@@ -9664,6 +9680,7 @@ const Wheel = memo((props) => {
|
|
|
9664
9680
|
className: `${classPrefix$13}-column-wheel`,
|
|
9665
9681
|
"aria-hidden": true
|
|
9666
9682
|
}, column.map((item, index2) => {
|
|
9683
|
+
var _a;
|
|
9667
9684
|
const selected = props.value === item.value;
|
|
9668
9685
|
if (selected)
|
|
9669
9686
|
selectedIndex = index2;
|
|
@@ -9672,7 +9689,7 @@ const Wheel = memo((props) => {
|
|
|
9672
9689
|
scrollSelect(index2);
|
|
9673
9690
|
}
|
|
9674
9691
|
return React$1.createElement("div", {
|
|
9675
|
-
key: item.value,
|
|
9692
|
+
key: (_a = item.key) !== null && _a !== void 0 ? _a : item.value,
|
|
9676
9693
|
"data-selected": item.value === value,
|
|
9677
9694
|
className: `${classPrefix$13}-column-item`,
|
|
9678
9695
|
onClick: handleClick,
|
|
@@ -10049,7 +10066,7 @@ const Tabs$1 = (p) => {
|
|
|
10049
10066
|
const keyToIndexRecord = {};
|
|
10050
10067
|
let firstActiveKey = null;
|
|
10051
10068
|
const panes = [];
|
|
10052
|
-
|
|
10069
|
+
traverseReactNode(props.children, (child, index2) => {
|
|
10053
10070
|
if (!React$1.isValidElement(child))
|
|
10054
10071
|
return;
|
|
10055
10072
|
const key = child.key;
|
|
@@ -10912,7 +10929,7 @@ const CollapsePanelContent = (props) => {
|
|
|
10912
10929
|
const Collapse = (props) => {
|
|
10913
10930
|
var _a;
|
|
10914
10931
|
const panels = [];
|
|
10915
|
-
|
|
10932
|
+
traverseReactNode(props.children, (child) => {
|
|
10916
10933
|
if (!React$1.isValidElement(child))
|
|
10917
10934
|
return;
|
|
10918
10935
|
const key = child.key;
|
|
@@ -11724,12 +11741,13 @@ var index$b = attachPropertiesToComponent(Dialog, {
|
|
|
11724
11741
|
var divider = "";
|
|
11725
11742
|
const classPrefix$R = `adm-divider`;
|
|
11726
11743
|
const defaultProps$E = {
|
|
11727
|
-
contentPosition: "center"
|
|
11744
|
+
contentPosition: "center",
|
|
11745
|
+
direction: "horizontal"
|
|
11728
11746
|
};
|
|
11729
11747
|
const Divider = (p) => {
|
|
11730
11748
|
const props = mergeProps(defaultProps$E, p);
|
|
11731
11749
|
return withNativeProps(props, React$1.createElement("div", {
|
|
11732
|
-
className: classNames(classPrefix$R, `${classPrefix$R}-${props.contentPosition}`)
|
|
11750
|
+
className: classNames(classPrefix$R, `${classPrefix$R}-${props.direction}`, `${classPrefix$R}-${props.contentPosition}`)
|
|
11733
11751
|
}, props.children && React$1.createElement("div", {
|
|
11734
11752
|
className: `${classPrefix$R}-content`
|
|
11735
11753
|
}, props.children)));
|
|
@@ -12882,7 +12900,7 @@ const Form$1 = forwardRef((p, ref) => {
|
|
|
12882
12900
|
}, items));
|
|
12883
12901
|
items = [];
|
|
12884
12902
|
}
|
|
12885
|
-
|
|
12903
|
+
traverseReactNode(props.children, (child) => {
|
|
12886
12904
|
if (React$1.isValidElement(child)) {
|
|
12887
12905
|
if (child.type === Header) {
|
|
12888
12906
|
collect();
|
|
@@ -13322,6 +13340,14 @@ const PopoverMenu = forwardRef((props, ref) => {
|
|
|
13322
13340
|
var Popover = attachPropertiesToComponent(Popover$1, {
|
|
13323
13341
|
Menu: PopoverMenu
|
|
13324
13342
|
});
|
|
13343
|
+
function undefinedFallback(...items) {
|
|
13344
|
+
let i;
|
|
13345
|
+
for (i = 0; i < items.length; i++) {
|
|
13346
|
+
if (items[i] !== void 0)
|
|
13347
|
+
break;
|
|
13348
|
+
}
|
|
13349
|
+
return items[i];
|
|
13350
|
+
}
|
|
13325
13351
|
const NAME_SPLIT = "__SPLIT__";
|
|
13326
13352
|
const classPrefix$H = `adm-form-item`;
|
|
13327
13353
|
const MemoInput = React$1.memo(({
|
|
@@ -13441,7 +13467,7 @@ const FormItem = (props) => {
|
|
|
13441
13467
|
const {
|
|
13442
13468
|
validateTrigger: contextValidateTrigger
|
|
13443
13469
|
} = useContext(default_1);
|
|
13444
|
-
const mergedValidateTrigger = validateTrigger
|
|
13470
|
+
const mergedValidateTrigger = undefinedFallback(validateTrigger, contextValidateTrigger, trigger);
|
|
13445
13471
|
const updateRef = React$1.useRef(0);
|
|
13446
13472
|
updateRef.current += 1;
|
|
13447
13473
|
const [subMetas, setSubMetas] = useState({});
|
|
@@ -14005,7 +14031,8 @@ const PreviewItem = (props) => {
|
|
|
14005
14031
|
url,
|
|
14006
14032
|
file,
|
|
14007
14033
|
deletable,
|
|
14008
|
-
onDelete
|
|
14034
|
+
onDelete,
|
|
14035
|
+
imageFit
|
|
14009
14036
|
} = props;
|
|
14010
14037
|
const src = useMemo(() => {
|
|
14011
14038
|
if (url) {
|
|
@@ -14040,7 +14067,7 @@ const PreviewItem = (props) => {
|
|
|
14040
14067
|
}, React$1.createElement(Image$1, {
|
|
14041
14068
|
className: `${classPrefix$B}-cell-image`,
|
|
14042
14069
|
src,
|
|
14043
|
-
fit:
|
|
14070
|
+
fit: imageFit,
|
|
14044
14071
|
onClick: props.onClick
|
|
14045
14072
|
}), renderLoading(), renderDelete());
|
|
14046
14073
|
};
|
|
@@ -14080,7 +14107,8 @@ const defaultProps$t = {
|
|
|
14080
14107
|
defaultValue: [],
|
|
14081
14108
|
accept: "image/*",
|
|
14082
14109
|
preview: true,
|
|
14083
|
-
showFailed: true
|
|
14110
|
+
showFailed: true,
|
|
14111
|
+
imageFit: "cover"
|
|
14084
14112
|
};
|
|
14085
14113
|
const ImageUploader = (p) => {
|
|
14086
14114
|
const props = mergeProps(defaultProps$t, p);
|
|
@@ -14206,6 +14234,7 @@ const ImageUploader = (p) => {
|
|
|
14206
14234
|
key: (_a = fileItem.key) !== null && _a !== void 0 ? _a : index2,
|
|
14207
14235
|
url: (_b = fileItem.thumbnailUrl) !== null && _b !== void 0 ? _b : fileItem.url,
|
|
14208
14236
|
deletable: props.deletable,
|
|
14237
|
+
imageFit: props.imageFit,
|
|
14209
14238
|
onClick: () => {
|
|
14210
14239
|
if (props.preview) {
|
|
14211
14240
|
previewImage(index2);
|
|
@@ -14229,6 +14258,7 @@ const ImageUploader = (p) => {
|
|
|
14229
14258
|
file: task.file,
|
|
14230
14259
|
deletable: task.status !== "pending",
|
|
14231
14260
|
status: task.status,
|
|
14261
|
+
imageFit: props.imageFit,
|
|
14232
14262
|
onDelete: () => {
|
|
14233
14263
|
setTasks(tasks.filter((x) => x.id !== task.id));
|
|
14234
14264
|
}
|
|
@@ -14326,7 +14356,7 @@ const IndexBar = forwardRef((p, ref) => {
|
|
|
14326
14356
|
const bodyRef = useRef(null);
|
|
14327
14357
|
const indexItems = [];
|
|
14328
14358
|
const panels = [];
|
|
14329
|
-
|
|
14359
|
+
traverseReactNode(props.children, (child) => {
|
|
14330
14360
|
var _a;
|
|
14331
14361
|
if (!React$1.isValidElement(child))
|
|
14332
14362
|
return;
|
|
@@ -14594,7 +14624,7 @@ const JumboTabs = (props) => {
|
|
|
14594
14624
|
const keyToIndexRecord = {};
|
|
14595
14625
|
let firstActiveKey = null;
|
|
14596
14626
|
const panes = [];
|
|
14597
|
-
|
|
14627
|
+
traverseReactNode(props.children, (child, index2) => {
|
|
14598
14628
|
if (!React$1.isValidElement(child))
|
|
14599
14629
|
return;
|
|
14600
14630
|
const key = child.key;
|
|
@@ -15126,9 +15156,6 @@ const NumberKeyboard = (p) => {
|
|
|
15126
15156
|
onBackspacePressEnd();
|
|
15127
15157
|
}
|
|
15128
15158
|
},
|
|
15129
|
-
onMouseUp: (e) => {
|
|
15130
|
-
onKeyPress(e, key);
|
|
15131
|
-
},
|
|
15132
15159
|
title: key,
|
|
15133
15160
|
role: "button"
|
|
15134
15161
|
}, key === "BACKSPACE" ? React$1.createElement(TextDeletionOutline, null) : key);
|
|
@@ -15164,13 +15191,11 @@ const NumberKeyboard = (p) => {
|
|
|
15164
15191
|
onKeyPress(e, "BACKSPACE");
|
|
15165
15192
|
onBackspacePressEnd();
|
|
15166
15193
|
},
|
|
15167
|
-
onMouseUp: (e) => onKeyPress(e, "BACKSPACE"),
|
|
15168
15194
|
title: "BACKSPACE",
|
|
15169
15195
|
role: "button"
|
|
15170
15196
|
}, React$1.createElement(TextDeletionOutline, null)), React$1.createElement("div", {
|
|
15171
15197
|
className: `${classPrefix$r}-key extra-key ok-key`,
|
|
15172
15198
|
onTouchEnd: (e) => onKeyPress(e, "OK"),
|
|
15173
|
-
onMouseUp: (e) => onKeyPress(e, "OK"),
|
|
15174
15199
|
role: "button"
|
|
15175
15200
|
}, confirmText))), props.safeArea && React$1.createElement("div", {
|
|
15176
15201
|
className: `${classPrefix$r}-footer`
|
|
@@ -15897,7 +15922,7 @@ const SideBar = (props) => {
|
|
|
15897
15922
|
var _a;
|
|
15898
15923
|
let firstActiveKey = null;
|
|
15899
15924
|
const items = [];
|
|
15900
|
-
|
|
15925
|
+
traverseReactNode(props.children, (child, index2) => {
|
|
15901
15926
|
if (!React$1.isValidElement(child))
|
|
15902
15927
|
return;
|
|
15903
15928
|
const key = child.key;
|
|
@@ -16273,12 +16298,12 @@ const Stepper = (p) => {
|
|
|
16273
16298
|
inputReadOnly
|
|
16274
16299
|
} = props;
|
|
16275
16300
|
const [value, setValue] = usePropsValue(props);
|
|
16276
|
-
const [inputValue, setInputValue] = useState(() => convertValueToText(value));
|
|
16301
|
+
const [inputValue, setInputValue] = useState(() => convertValueToText(value, props.digits));
|
|
16277
16302
|
function setValueWithCheck(v) {
|
|
16278
16303
|
if (isNaN(v))
|
|
16279
16304
|
return;
|
|
16280
16305
|
let target = bound(v, props.min, props.max);
|
|
16281
|
-
if (props.digits
|
|
16306
|
+
if (props.digits !== void 0) {
|
|
16282
16307
|
target = parseFloat(target.toFixed(props.digits));
|
|
16283
16308
|
}
|
|
16284
16309
|
setValue(target);
|
|
@@ -16286,14 +16311,14 @@ const Stepper = (p) => {
|
|
|
16286
16311
|
const [hasFocus, setHasFocus] = useState(false);
|
|
16287
16312
|
useEffect(() => {
|
|
16288
16313
|
if (!hasFocus) {
|
|
16289
|
-
setInputValue(convertValueToText(value));
|
|
16314
|
+
setInputValue(convertValueToText(value, props.digits));
|
|
16290
16315
|
}
|
|
16291
16316
|
}, [hasFocus]);
|
|
16292
16317
|
useEffect(() => {
|
|
16293
16318
|
if (!hasFocus) {
|
|
16294
|
-
setInputValue(convertValueToText(value));
|
|
16319
|
+
setInputValue(convertValueToText(value, props.digits));
|
|
16295
16320
|
}
|
|
16296
|
-
}, [value]);
|
|
16321
|
+
}, [value, props.digits]);
|
|
16297
16322
|
const handleInputChange = (v) => {
|
|
16298
16323
|
setInputValue(v);
|
|
16299
16324
|
const value2 = convertTextToValue(v);
|
|
@@ -16308,10 +16333,10 @@ const Stepper = (p) => {
|
|
|
16308
16333
|
}
|
|
16309
16334
|
};
|
|
16310
16335
|
const handleMinus = () => {
|
|
16311
|
-
setValueWithCheck((value !== null && value !== void 0 ? value : 0)
|
|
16336
|
+
setValueWithCheck(Big(value !== null && value !== void 0 ? value : 0).minus(step).toNumber());
|
|
16312
16337
|
};
|
|
16313
16338
|
const handlePlus = () => {
|
|
16314
|
-
setValueWithCheck((value !== null && value !== void 0 ? value : 0)
|
|
16339
|
+
setValueWithCheck(Big(value !== null && value !== void 0 ? value : 0).add(step).toNumber());
|
|
16315
16340
|
};
|
|
16316
16341
|
const minusDisabled = () => {
|
|
16317
16342
|
if (disabled)
|
|
@@ -16373,10 +16398,14 @@ const Stepper = (p) => {
|
|
|
16373
16398
|
color: "primary"
|
|
16374
16399
|
}, React$1.createElement(AddOutline, null))));
|
|
16375
16400
|
};
|
|
16376
|
-
function convertValueToText(value) {
|
|
16401
|
+
function convertValueToText(value, digits) {
|
|
16377
16402
|
if (value === null)
|
|
16378
16403
|
return "";
|
|
16379
|
-
|
|
16404
|
+
if (digits !== void 0) {
|
|
16405
|
+
return value.toFixed(digits);
|
|
16406
|
+
} else {
|
|
16407
|
+
return value.toString();
|
|
16408
|
+
}
|
|
16380
16409
|
}
|
|
16381
16410
|
function convertTextToValue(text) {
|
|
16382
16411
|
if (text === "")
|
|
@@ -16717,6 +16746,8 @@ const Swiper = forwardRef(staged((p, ref) => {
|
|
|
16717
16746
|
onRest: () => {
|
|
16718
16747
|
if (draggingRef.current)
|
|
16719
16748
|
return;
|
|
16749
|
+
if (!loop)
|
|
16750
|
+
return;
|
|
16720
16751
|
const rawX = position.get();
|
|
16721
16752
|
const totalWidth = 100 * count;
|
|
16722
16753
|
const standardPosition = modulus(rawX, totalWidth);
|
|
@@ -16968,7 +16999,7 @@ const TabBar = (p) => {
|
|
|
16968
16999
|
const props = mergeProps(defaultProps$7, p);
|
|
16969
17000
|
let firstActiveKey = null;
|
|
16970
17001
|
const items = [];
|
|
16971
|
-
|
|
17002
|
+
traverseReactNode(props.children, (child, index2) => {
|
|
16972
17003
|
if (!React$1.isValidElement(child))
|
|
16973
17004
|
return;
|
|
16974
17005
|
const key = child.key;
|
package/bundle/style.css
CHANGED
|
@@ -1191,24 +1191,24 @@ a.adm-list-item:active:not(.adm-list-item-disabled)::after {
|
|
|
1191
1191
|
transform: translate(-50%, -50%);
|
|
1192
1192
|
color: var(--adm-color-weak);
|
|
1193
1193
|
}
|
|
1194
|
-
.adm-divider {
|
|
1194
|
+
.adm-divider-horizontal {
|
|
1195
1195
|
display: flex;
|
|
1196
1196
|
align-items: center;
|
|
1197
1197
|
margin: 16px 0;
|
|
1198
|
-
color: var(--adm-color-weak);
|
|
1199
|
-
font-size: 14px;
|
|
1200
1198
|
border-width: 0;
|
|
1201
1199
|
border-color: var(--adm-border-color);
|
|
1202
1200
|
border-style: solid;
|
|
1201
|
+
color: var(--adm-color-weak);
|
|
1202
|
+
font-size: 14px;
|
|
1203
1203
|
}
|
|
1204
|
-
.adm-divider-left.adm-divider::before {
|
|
1204
|
+
.adm-divider-left.adm-divider-horizontal::before {
|
|
1205
1205
|
max-width: 10%;
|
|
1206
1206
|
}
|
|
1207
|
-
.adm-divider-right.adm-divider::after {
|
|
1207
|
+
.adm-divider-right.adm-divider-horizontal::after {
|
|
1208
1208
|
max-width: 10%;
|
|
1209
1209
|
}
|
|
1210
|
-
.adm-divider::after,
|
|
1211
|
-
.adm-divider::before {
|
|
1210
|
+
.adm-divider-horizontal::after,
|
|
1211
|
+
.adm-divider-horizontal::before {
|
|
1212
1212
|
flex: auto;
|
|
1213
1213
|
display: block;
|
|
1214
1214
|
content: '';
|
|
@@ -1216,10 +1216,20 @@ a.adm-list-item:active:not(.adm-list-item-disabled)::after {
|
|
|
1216
1216
|
border-color: inherit;
|
|
1217
1217
|
border-width: 1px 0 0;
|
|
1218
1218
|
}
|
|
1219
|
-
.adm-divider-content {
|
|
1219
|
+
.adm-divider-horizontal .adm-divider-content {
|
|
1220
1220
|
flex: none;
|
|
1221
1221
|
padding: 0 16px;
|
|
1222
1222
|
}
|
|
1223
|
+
.adm-divider-vertical {
|
|
1224
|
+
position: relative;
|
|
1225
|
+
top: -0.06em;
|
|
1226
|
+
display: inline-block;
|
|
1227
|
+
height: 0.9em;
|
|
1228
|
+
margin: 0 16px;
|
|
1229
|
+
vertical-align: middle;
|
|
1230
|
+
border-top: 0;
|
|
1231
|
+
border-left: 1px solid var(--adm-border-color);
|
|
1232
|
+
}
|
|
1223
1233
|
.adm-dropdown {
|
|
1224
1234
|
background-color: white;
|
|
1225
1235
|
}
|
|
@@ -23,6 +23,8 @@ var _scrollMask = _interopRequireDefault(require("../scroll-mask"));
|
|
|
23
23
|
|
|
24
24
|
var _shouldRender = require("../../utils/should-render");
|
|
25
25
|
|
|
26
|
+
var _traverseReactNode = require("../../utils/traverse-react-node");
|
|
27
|
+
|
|
26
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
29
|
|
|
28
30
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -45,8 +47,7 @@ const CapsuleTabs = props => {
|
|
|
45
47
|
const keyToIndexRecord = {};
|
|
46
48
|
let firstActiveKey = null;
|
|
47
49
|
const panes = [];
|
|
48
|
-
|
|
49
|
-
_react.default.Children.forEach(props.children, (child, index) => {
|
|
50
|
+
(0, _traverseReactNode.traverseReactNode)(props.children, (child, index) => {
|
|
50
51
|
if (!_react.default.isValidElement(child)) return;
|
|
51
52
|
const key = child.key;
|
|
52
53
|
if (typeof key !== 'string') return;
|
|
@@ -58,7 +59,6 @@ const CapsuleTabs = props => {
|
|
|
58
59
|
const length = panes.push(child);
|
|
59
60
|
keyToIndexRecord[key] = length - 1;
|
|
60
61
|
});
|
|
61
|
-
|
|
62
62
|
const [activeKey, setActiveKey] = (0, _usePropsValue.usePropsValue)({
|
|
63
63
|
value: props.activeKey,
|
|
64
64
|
defaultValue: (_a = props.defaultActiveKey) !== null && _a !== void 0 ? _a : firstActiveKey,
|