antd-mobile 5.33.0 → 5.33.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/README.md +1 -1
- package/2x/bundle/antd-mobile.cjs.development.js +54 -28
- package/2x/bundle/antd-mobile.cjs.js +9 -9
- package/2x/bundle/antd-mobile.es.development.js +54 -28
- package/2x/bundle/antd-mobile.es.js +1979 -1958
- package/2x/bundle/antd-mobile.umd.development.js +54 -28
- package/2x/bundle/antd-mobile.umd.js +9 -9
- package/2x/bundle/style.css +2 -2
- package/2x/cjs/components/calendar-picker/calendar-picker.d.ts +5 -0
- package/2x/cjs/components/calendar-picker/calendar-picker.js +5 -3
- package/2x/cjs/components/cascader/cascader.js +6 -1
- package/2x/cjs/components/cascader-view/cascader-view.js +4 -1
- package/2x/cjs/components/cascader-view/use-cascader-value-extend.d.ts +3 -2
- package/2x/cjs/components/cascader-view/use-cascader-value-extend.js +9 -5
- package/2x/cjs/components/image-viewer/image-viewer.d.ts +4 -0
- package/2x/cjs/components/image-viewer/image-viewer.js +11 -8
- package/2x/cjs/components/number-keyboard/number-keyboard.js +5 -1
- package/2x/cjs/components/popover/popover-menu.js +3 -1
- package/2x/cjs/components/popover/popover.js +5 -5
- package/2x/cjs/components/popup/popup.js +1 -0
- package/2x/cjs/components/switch/switch.css +2 -2
- package/2x/cjs/components/virtual-input/virtual-input.js +10 -3
- package/2x/es/components/calendar-picker/calendar-picker.d.ts +5 -0
- package/2x/es/components/calendar-picker/calendar-picker.js +5 -3
- package/2x/es/components/cascader/cascader.js +6 -1
- package/2x/es/components/cascader-view/cascader-view.js +4 -1
- package/2x/es/components/cascader-view/use-cascader-value-extend.d.ts +3 -2
- package/2x/es/components/cascader-view/use-cascader-value-extend.js +9 -5
- package/2x/es/components/image-viewer/image-viewer.d.ts +4 -0
- package/2x/es/components/image-viewer/image-viewer.js +11 -8
- package/2x/es/components/number-keyboard/number-keyboard.js +5 -1
- package/2x/es/components/popover/popover-menu.js +3 -1
- package/2x/es/components/popover/popover.js +5 -5
- package/2x/es/components/popup/popup.js +1 -0
- package/2x/es/components/switch/switch.css +2 -2
- package/2x/es/components/virtual-input/virtual-input.js +10 -3
- package/2x/package.json +1 -1
- package/README.md +1 -1
- package/bundle/antd-mobile.cjs.development.js +54 -28
- package/bundle/antd-mobile.cjs.js +9 -9
- package/bundle/antd-mobile.compatible.umd.js +1 -1
- package/bundle/antd-mobile.es.development.js +54 -28
- package/bundle/antd-mobile.es.js +1979 -1958
- package/bundle/antd-mobile.umd.development.js +54 -28
- package/bundle/antd-mobile.umd.js +9 -9
- package/bundle/style.css +1 -1
- package/cjs/components/calendar-picker/calendar-picker.d.ts +5 -0
- package/cjs/components/calendar-picker/calendar-picker.js +5 -3
- package/cjs/components/cascader/cascader.js +6 -1
- package/cjs/components/cascader-view/cascader-view.js +4 -1
- package/cjs/components/cascader-view/use-cascader-value-extend.d.ts +3 -2
- package/cjs/components/cascader-view/use-cascader-value-extend.js +9 -5
- package/cjs/components/image-viewer/image-viewer.d.ts +4 -0
- package/cjs/components/image-viewer/image-viewer.js +11 -8
- package/cjs/components/number-keyboard/number-keyboard.js +5 -1
- package/cjs/components/popover/popover-menu.js +3 -1
- package/cjs/components/popover/popover.js +5 -5
- package/cjs/components/popup/popup.js +1 -0
- package/cjs/components/switch/switch.css +2 -2
- package/cjs/components/virtual-input/virtual-input.js +10 -3
- package/es/components/calendar-picker/calendar-picker.d.ts +5 -0
- package/es/components/calendar-picker/calendar-picker.js +5 -3
- package/es/components/cascader/cascader.js +6 -1
- package/es/components/cascader-view/cascader-view.js +4 -1
- package/es/components/cascader-view/use-cascader-value-extend.d.ts +3 -2
- package/es/components/cascader-view/use-cascader-value-extend.js +9 -5
- package/es/components/image-viewer/image-viewer.d.ts +4 -0
- package/es/components/image-viewer/image-viewer.js +11 -8
- package/es/components/number-keyboard/number-keyboard.js +5 -1
- package/es/components/popover/popover-menu.js +3 -1
- package/es/components/popover/popover.js +5 -5
- package/es/components/popup/popup.js +1 -0
- package/es/components/switch/switch.css +2 -2
- package/es/components/virtual-input/virtual-input.js +10 -3
- package/package.json +1 -1
- package/umd/antd-mobile.js +1 -1
|
@@ -9536,6 +9536,7 @@ const Popup$1 = (p) => {
|
|
|
9536
9536
|
}), React__default.createElement(animated.div, {
|
|
9537
9537
|
className: bodyCls,
|
|
9538
9538
|
style: Object.assign(Object.assign({}, props.bodyStyle), {
|
|
9539
|
+
pointerEvents: percent.to((v) => v === 0 ? "unset" : "none"),
|
|
9539
9540
|
transform: percent.to((v) => {
|
|
9540
9541
|
if (props.position === "bottom") {
|
|
9541
9542
|
return `translate(0, ${v}%)`;
|
|
@@ -10771,8 +10772,9 @@ const CalendarPicker$1 = forwardRef((p, ref) => {
|
|
|
10771
10772
|
closeOnMaskClick,
|
|
10772
10773
|
onClose,
|
|
10773
10774
|
onConfirm,
|
|
10774
|
-
onMaskClick
|
|
10775
|
-
|
|
10775
|
+
onMaskClick,
|
|
10776
|
+
getContainer
|
|
10777
|
+
} = props, calendarViewProps = __rest(props, ["visible", "confirmText", "popupClassName", "popupStyle", "popupBodyStyle", "forceRender", "closeOnMaskClick", "onClose", "onConfirm", "onMaskClick", "getContainer"]);
|
|
10776
10778
|
const footer2 = React__default.createElement("div", {
|
|
10777
10779
|
className: `${classPrefix$1c}-footer`
|
|
10778
10780
|
}, React__default.createElement(Divider, null), React__default.createElement("div", {
|
|
@@ -10810,7 +10812,8 @@ const CalendarPicker$1 = forwardRef((p, ref) => {
|
|
|
10810
10812
|
if (closeOnMaskClick) {
|
|
10811
10813
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
10812
10814
|
}
|
|
10813
|
-
}
|
|
10815
|
+
},
|
|
10816
|
+
getContainer
|
|
10814
10817
|
}, React__default.createElement(CalendarPickerView, Object.assign({
|
|
10815
10818
|
ref: calendarRef
|
|
10816
10819
|
}, calendarViewProps)), footer2)));
|
|
@@ -12559,20 +12562,24 @@ function memoize(func, resolver) {
|
|
|
12559
12562
|
}
|
|
12560
12563
|
memoize.Cache = MapCache;
|
|
12561
12564
|
var memoize_1 = memoize;
|
|
12562
|
-
function useCascaderValueExtend(options) {
|
|
12565
|
+
function useCascaderValueExtend(options, fieldNames) {
|
|
12566
|
+
const {
|
|
12567
|
+
valueName,
|
|
12568
|
+
childrenName
|
|
12569
|
+
} = fieldNames;
|
|
12563
12570
|
const generateItems = useMemo(() => {
|
|
12564
12571
|
return memoize_1((val) => {
|
|
12565
12572
|
const ret = [];
|
|
12566
12573
|
let currentOptions = options;
|
|
12567
12574
|
for (const v of val) {
|
|
12568
|
-
const target = currentOptions.find((option) => option
|
|
12575
|
+
const target = currentOptions.find((option) => option[valueName] === v);
|
|
12569
12576
|
if (!target) {
|
|
12570
12577
|
break;
|
|
12571
12578
|
}
|
|
12572
12579
|
ret.push(target);
|
|
12573
|
-
if (!target
|
|
12580
|
+
if (!target[childrenName])
|
|
12574
12581
|
break;
|
|
12575
|
-
currentOptions = target
|
|
12582
|
+
currentOptions = target[childrenName];
|
|
12576
12583
|
}
|
|
12577
12584
|
return ret;
|
|
12578
12585
|
}, (val) => JSON.stringify(val));
|
|
@@ -12581,7 +12588,7 @@ function useCascaderValueExtend(options) {
|
|
|
12581
12588
|
return memoize_1((val) => {
|
|
12582
12589
|
const children = val.reduce((currentOptions, v) => {
|
|
12583
12590
|
var _a;
|
|
12584
|
-
return ((_a = currentOptions.find((option) => option
|
|
12591
|
+
return ((_a = currentOptions.find((option) => option[valueName] === v)) === null || _a === void 0 ? void 0 : _a[childrenName]) || [];
|
|
12585
12592
|
}, options);
|
|
12586
12593
|
return children.length === 0;
|
|
12587
12594
|
}, (val) => JSON.stringify(val));
|
|
@@ -12661,8 +12668,11 @@ const CascaderView$1 = (p) => {
|
|
|
12661
12668
|
const {
|
|
12662
12669
|
locale
|
|
12663
12670
|
} = useConfig();
|
|
12664
|
-
const generateValueExtend = useCascaderValueExtend(props.options);
|
|
12665
12671
|
const [labelName, valueName, childrenName, disabledName] = useFieldNames(props.fieldNames);
|
|
12672
|
+
const generateValueExtend = useCascaderValueExtend(props.options, {
|
|
12673
|
+
valueName,
|
|
12674
|
+
childrenName
|
|
12675
|
+
});
|
|
12666
12676
|
const [value, setValue2] = usePropsValue(Object.assign(Object.assign({}, props), {
|
|
12667
12677
|
onChange: (val) => {
|
|
12668
12678
|
var _a;
|
|
@@ -12814,7 +12824,11 @@ const Cascader = forwardRef((p, ref) => {
|
|
|
12814
12824
|
(_a2 = props.onConfirm) === null || _a2 === void 0 ? void 0 : _a2.call(props, val, generateValueExtend(val));
|
|
12815
12825
|
}
|
|
12816
12826
|
}));
|
|
12817
|
-
const
|
|
12827
|
+
const [, valueName, childrenName] = useFieldNames(props.fieldNames);
|
|
12828
|
+
const generateValueExtend = useCascaderValueExtend(props.options, {
|
|
12829
|
+
valueName,
|
|
12830
|
+
childrenName
|
|
12831
|
+
});
|
|
12818
12832
|
const [innerValue, setInnerValue] = useState$1(value);
|
|
12819
12833
|
useEffect(() => {
|
|
12820
12834
|
if (!visible) {
|
|
@@ -20975,13 +20989,11 @@ const defaultProps$B = {
|
|
|
20975
20989
|
placement: "top",
|
|
20976
20990
|
defaultVisible: false,
|
|
20977
20991
|
stopPropagation: ["click"],
|
|
20978
|
-
getContainer: () => document.body
|
|
20992
|
+
getContainer: () => document.body,
|
|
20993
|
+
mode: "light"
|
|
20979
20994
|
};
|
|
20980
20995
|
const Popover$1 = forwardRef((p, ref) => {
|
|
20981
20996
|
const props = mergeProps(defaultProps$B, p);
|
|
20982
|
-
const {
|
|
20983
|
-
mode = "light"
|
|
20984
|
-
} = props;
|
|
20985
20997
|
const placement = normalizePlacement(props.placement);
|
|
20986
20998
|
const [visible, setVisible] = usePropsValue({
|
|
20987
20999
|
value: props.visible,
|
|
@@ -20997,7 +21009,9 @@ const Popover$1 = forwardRef((p, ref) => {
|
|
|
20997
21009
|
const floatingRef = useRef(null);
|
|
20998
21010
|
const arrowRef = useRef(null);
|
|
20999
21011
|
const floating = withStopPropagation(props.stopPropagation, withNativeProps(props, React__default.createElement("div", {
|
|
21000
|
-
className: classNames(classPrefix$N, `${classPrefix$N}-${mode}`,
|
|
21012
|
+
className: classNames(classPrefix$N, `${classPrefix$N}-${props.mode}`, {
|
|
21013
|
+
[`${classPrefix$N}-hidden`]: !visible
|
|
21014
|
+
}),
|
|
21001
21015
|
ref: floatingRef
|
|
21002
21016
|
}, React__default.createElement("div", {
|
|
21003
21017
|
className: `${classPrefix$N}-arrow`,
|
|
@@ -21133,7 +21147,9 @@ const PopoverMenu = forwardRef((props, ref) => {
|
|
|
21133
21147
|
var _a;
|
|
21134
21148
|
return React__default.createElement("a", {
|
|
21135
21149
|
key: (_a = action.key) !== null && _a !== void 0 ? _a : index2,
|
|
21136
|
-
className: classNames(`${classPrefix$M}-item`, "adm-plain-anchor",
|
|
21150
|
+
className: classNames(`${classPrefix$M}-item`, "adm-plain-anchor", {
|
|
21151
|
+
[`${classPrefix$M}-item-disabled`]: action.disabled
|
|
21152
|
+
}),
|
|
21137
21153
|
onClick: () => {
|
|
21138
21154
|
var _a2;
|
|
21139
21155
|
if (action.disabled)
|
|
@@ -21844,23 +21860,24 @@ const defaultProps$A = {
|
|
|
21844
21860
|
visible: false
|
|
21845
21861
|
};
|
|
21846
21862
|
const ImageViewer$1 = (p) => {
|
|
21847
|
-
var _a;
|
|
21863
|
+
var _a, _b, _c;
|
|
21848
21864
|
const props = mergeProps(defaultProps$A, p);
|
|
21849
21865
|
const node = React__default.createElement(Mask, {
|
|
21850
21866
|
visible: props.visible,
|
|
21851
21867
|
disableBodyScroll: false,
|
|
21852
21868
|
opacity: "thick",
|
|
21853
21869
|
afterClose: props.afterClose,
|
|
21854
|
-
destroyOnClose: true
|
|
21870
|
+
destroyOnClose: true,
|
|
21871
|
+
className: (_a = props === null || props === void 0 ? void 0 : props.classNames) === null || _a === void 0 ? void 0 : _a.mask
|
|
21855
21872
|
}, React__default.createElement("div", {
|
|
21856
|
-
className: `${classPrefix$H}-content
|
|
21873
|
+
className: classNames(`${classPrefix$H}-content`, (_b = props === null || props === void 0 ? void 0 : props.classNames) === null || _b === void 0 ? void 0 : _b.body)
|
|
21857
21874
|
}, props.image && React__default.createElement(Slide, {
|
|
21858
21875
|
image: props.image,
|
|
21859
21876
|
onTap: props.onClose,
|
|
21860
21877
|
maxZoom: props.maxZoom
|
|
21861
21878
|
})), props.image && React__default.createElement("div", {
|
|
21862
21879
|
className: `${classPrefix$H}-footer`
|
|
21863
|
-
}, (
|
|
21880
|
+
}, (_c = props.renderFooter) === null || _c === void 0 ? void 0 : _c.call(props, props.image), React__default.createElement(SafeArea, {
|
|
21864
21881
|
position: "bottom"
|
|
21865
21882
|
})));
|
|
21866
21883
|
return renderToContainer(props.getContainer, node);
|
|
@@ -21869,7 +21886,7 @@ const multiDefaultProps = Object.assign(Object.assign({}, defaultProps$A), {
|
|
|
21869
21886
|
defaultIndex: 0
|
|
21870
21887
|
});
|
|
21871
21888
|
const MultiImageViewer = forwardRef((p, ref) => {
|
|
21872
|
-
var _a;
|
|
21889
|
+
var _a, _b, _c;
|
|
21873
21890
|
const props = mergeProps(multiDefaultProps, p);
|
|
21874
21891
|
const [index2, setIndex] = useState$1(props.defaultIndex);
|
|
21875
21892
|
const slidesRef = useRef(null);
|
|
@@ -21892,9 +21909,10 @@ const MultiImageViewer = forwardRef((p, ref) => {
|
|
|
21892
21909
|
disableBodyScroll: false,
|
|
21893
21910
|
opacity: "thick",
|
|
21894
21911
|
afterClose: props.afterClose,
|
|
21895
|
-
destroyOnClose: true
|
|
21912
|
+
destroyOnClose: true,
|
|
21913
|
+
className: (_a = props === null || props === void 0 ? void 0 : props.classNames) === null || _a === void 0 ? void 0 : _a.mask
|
|
21896
21914
|
}, React__default.createElement("div", {
|
|
21897
|
-
className: `${classPrefix$H}-content
|
|
21915
|
+
className: classNames(`${classPrefix$H}-content`, (_b = props === null || props === void 0 ? void 0 : props.classNames) === null || _b === void 0 ? void 0 : _b.body)
|
|
21898
21916
|
}, props.images && React__default.createElement(Slides, {
|
|
21899
21917
|
ref: slidesRef,
|
|
21900
21918
|
defaultIndex: index2,
|
|
@@ -21904,7 +21922,7 @@ const MultiImageViewer = forwardRef((p, ref) => {
|
|
|
21904
21922
|
maxZoom: props.maxZoom
|
|
21905
21923
|
})), props.images && React__default.createElement("div", {
|
|
21906
21924
|
className: `${classPrefix$H}-footer`
|
|
21907
|
-
}, (
|
|
21925
|
+
}, (_c = props.renderFooter) === null || _c === void 0 ? void 0 : _c.call(props, props.images[index2], index2), React__default.createElement(SafeArea, {
|
|
21908
21926
|
position: "bottom"
|
|
21909
21927
|
})));
|
|
21910
21928
|
return renderToContainer(props.getContainer, node);
|
|
@@ -23160,7 +23178,7 @@ const NumberKeyboard$1 = (p) => {
|
|
|
23160
23178
|
className: classNames(`${classPrefix$w}-header`, {
|
|
23161
23179
|
[`${classPrefix$w}-header-with-title`]: !!title
|
|
23162
23180
|
})
|
|
23163
|
-
}, React__default.createElement("div", {
|
|
23181
|
+
}, !!title && React__default.createElement("div", {
|
|
23164
23182
|
className: `${classPrefix$w}-title`,
|
|
23165
23183
|
"aria-label": title
|
|
23166
23184
|
}, title), showCloseButton && React__default.createElement("span", {
|
|
@@ -23235,6 +23253,9 @@ const NumberKeyboard$1 = (p) => {
|
|
|
23235
23253
|
onKeyPress(e2, "BACKSPACE");
|
|
23236
23254
|
onBackspacePressEnd();
|
|
23237
23255
|
},
|
|
23256
|
+
onContextMenu: (e2) => {
|
|
23257
|
+
e2.preventDefault();
|
|
23258
|
+
},
|
|
23238
23259
|
title: "BACKSPACE",
|
|
23239
23260
|
role: "grid",
|
|
23240
23261
|
tabIndex: -1
|
|
@@ -26791,9 +26812,14 @@ const VirtualInput$1 = forwardRef((p, ref) => {
|
|
|
26791
26812
|
},
|
|
26792
26813
|
visible: hasFocus,
|
|
26793
26814
|
onClose: () => {
|
|
26794
|
-
var _a, _b, _c;
|
|
26795
|
-
|
|
26796
|
-
(
|
|
26815
|
+
var _a, _b, _c, _d;
|
|
26816
|
+
const activeElement = document.activeElement;
|
|
26817
|
+
if (activeElement && ((_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.contains(activeElement))) {
|
|
26818
|
+
activeElement.blur();
|
|
26819
|
+
} else {
|
|
26820
|
+
(_b = rootRef.current) === null || _b === void 0 ? void 0 : _b.blur();
|
|
26821
|
+
}
|
|
26822
|
+
(_d = (_c = keyboard.props).onClose) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
26797
26823
|
},
|
|
26798
26824
|
getContainer: null
|
|
26799
26825
|
});
|