antd-mobile 5.23.0 → 5.24.0
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/bundle/antd-mobile.cjs.development.js +167 -15
- package/2x/bundle/antd-mobile.cjs.js +8 -8
- package/2x/bundle/antd-mobile.compatible.umd.js +5364 -5241
- package/2x/bundle/antd-mobile.es.development.js +167 -15
- package/2x/bundle/antd-mobile.es.js +4345 -4242
- package/2x/bundle/antd-mobile.umd.development.js +167 -15
- package/2x/bundle/antd-mobile.umd.js +8 -8
- package/2x/bundle/style.css +9 -4
- package/2x/cjs/components/calendar/calendar.d.ts +3 -5
- package/2x/cjs/components/calendar/calendar.js +27 -5
- package/2x/cjs/components/calendar/convert.d.ts +6 -0
- package/2x/cjs/components/calendar/convert.js +9 -0
- package/2x/cjs/components/ellipsis/ellipsis.js +16 -7
- package/2x/cjs/components/form/form-item.css +0 -1
- package/2x/cjs/components/form/form.css +9 -3
- package/2x/cjs/components/form/form.d.ts +2 -2
- package/2x/cjs/components/form/index.css +9 -4
- package/2x/cjs/components/form/index.d.ts +1 -1
- package/2x/cjs/components/popover/popover.js +2 -2
- package/2x/cjs/components/stepper/stepper.js +2 -1
- package/2x/cjs/components/swiper/swiper.js +9 -0
- package/2x/es/components/calendar/calendar.d.ts +3 -5
- package/2x/es/components/calendar/calendar.js +29 -6
- package/2x/es/components/calendar/convert.d.ts +6 -0
- package/2x/es/components/calendar/convert.js +4 -0
- package/2x/es/components/ellipsis/ellipsis.js +14 -8
- package/2x/es/components/form/form-item.css +0 -1
- package/2x/es/components/form/form.css +9 -3
- package/2x/es/components/form/form.d.ts +2 -2
- package/2x/es/components/form/index.css +9 -4
- package/2x/es/components/form/index.d.ts +1 -1
- package/2x/es/components/popover/popover.js +2 -2
- package/2x/es/components/stepper/stepper.js +2 -1
- package/2x/es/components/swiper/swiper.js +9 -0
- package/2x/package.json +2 -1
- package/2x/umd/antd-mobile.js +5364 -5241
- package/bundle/antd-mobile.cjs.development.js +167 -15
- package/bundle/antd-mobile.cjs.js +8 -8
- package/bundle/antd-mobile.compatible.umd.js +5364 -5241
- package/bundle/antd-mobile.es.development.js +167 -15
- package/bundle/antd-mobile.es.js +4345 -4242
- package/bundle/antd-mobile.umd.development.js +167 -15
- package/bundle/antd-mobile.umd.js +8 -8
- package/bundle/style.css +1 -1
- package/cjs/components/calendar/calendar.d.ts +3 -5
- package/cjs/components/calendar/calendar.js +27 -5
- package/cjs/components/calendar/convert.d.ts +6 -0
- package/cjs/components/calendar/convert.js +9 -0
- package/cjs/components/ellipsis/ellipsis.js +16 -7
- package/cjs/components/form/form-item.css +0 -1
- package/cjs/components/form/form.css +8 -3
- package/cjs/components/form/form.d.ts +2 -2
- package/cjs/components/form/index.css +8 -4
- package/cjs/components/form/index.d.ts +1 -1
- package/cjs/components/popover/popover.js +2 -2
- package/cjs/components/stepper/stepper.js +2 -1
- package/cjs/components/swiper/swiper.js +9 -0
- package/es/components/calendar/calendar.d.ts +3 -5
- package/es/components/calendar/calendar.js +29 -6
- package/es/components/calendar/convert.d.ts +6 -0
- package/es/components/calendar/convert.js +4 -0
- package/es/components/ellipsis/ellipsis.js +14 -8
- package/es/components/form/form-item.css +0 -1
- package/es/components/form/form.css +8 -3
- package/es/components/form/form.d.ts +2 -2
- package/es/components/form/index.css +8 -4
- package/es/components/form/index.d.ts +1 -1
- package/es/components/popover/popover.js +2 -2
- package/es/components/stepper/stepper.js +2 -1
- package/es/components/swiper/swiper.js +9 -0
- package/package.json +2 -1
- package/umd/antd-mobile.js +1 -1
|
@@ -8455,6 +8455,9 @@ function convertValueToRange(selectionMode, value) {
|
|
|
8455
8455
|
}
|
|
8456
8456
|
return [value, value];
|
|
8457
8457
|
}
|
|
8458
|
+
function convertPageToDayjs(page) {
|
|
8459
|
+
return dayjs().year(page.year).month(page.month - 1).date(1);
|
|
8460
|
+
}
|
|
8458
8461
|
dayjs.extend(isoWeek);
|
|
8459
8462
|
const classPrefix$1b = "adm-calendar";
|
|
8460
8463
|
const defaultProps$Y = {
|
|
@@ -8507,35 +8510,51 @@ const Calendar = React$1.forwardRef((p, ref) => {
|
|
|
8507
8510
|
} else {
|
|
8508
8511
|
page = pageOrPageGenerator;
|
|
8509
8512
|
}
|
|
8510
|
-
setCurrent(
|
|
8513
|
+
setCurrent(convertPageToDayjs(page));
|
|
8511
8514
|
},
|
|
8512
8515
|
jumpToToday: () => {
|
|
8513
8516
|
setCurrent(dayjs().date(1));
|
|
8514
8517
|
}
|
|
8515
8518
|
}));
|
|
8519
|
+
const handlePageChange = (action, num, type4) => {
|
|
8520
|
+
const nxtCurrent = current[action](num, type4);
|
|
8521
|
+
if (action === "subtract" && props.minPage) {
|
|
8522
|
+
const minPage = convertPageToDayjs(props.minPage);
|
|
8523
|
+
if (nxtCurrent.isBefore(minPage, type4)) {
|
|
8524
|
+
return;
|
|
8525
|
+
}
|
|
8526
|
+
}
|
|
8527
|
+
if (action === "add" && props.maxPage) {
|
|
8528
|
+
const maxPage = convertPageToDayjs(props.maxPage);
|
|
8529
|
+
if (nxtCurrent.isAfter(maxPage, type4)) {
|
|
8530
|
+
return;
|
|
8531
|
+
}
|
|
8532
|
+
}
|
|
8533
|
+
setCurrent(current[action](num, type4));
|
|
8534
|
+
};
|
|
8516
8535
|
const header = React__default.default.createElement("div", {
|
|
8517
8536
|
className: `${classPrefix$1b}-header`
|
|
8518
8537
|
}, React__default.default.createElement("a", {
|
|
8519
8538
|
className: `${classPrefix$1b}-arrow-button ${classPrefix$1b}-arrow-button-year`,
|
|
8520
8539
|
onClick: () => {
|
|
8521
|
-
|
|
8540
|
+
handlePageChange("subtract", 1, "year");
|
|
8522
8541
|
}
|
|
8523
8542
|
}, props.prevYearButton), React__default.default.createElement("a", {
|
|
8524
8543
|
className: `${classPrefix$1b}-arrow-button ${classPrefix$1b}-arrow-button-month`,
|
|
8525
8544
|
onClick: () => {
|
|
8526
|
-
|
|
8545
|
+
handlePageChange("subtract", 1, "month");
|
|
8527
8546
|
}
|
|
8528
8547
|
}, props.prevMonthButton), React__default.default.createElement("div", {
|
|
8529
8548
|
className: `${classPrefix$1b}-title`
|
|
8530
8549
|
}, locale.Calendar.renderYearAndMonth(current.year(), current.month() + 1)), React__default.default.createElement("a", {
|
|
8531
8550
|
className: classNames(`${classPrefix$1b}-arrow-button`, `${classPrefix$1b}-arrow-button-right`, `${classPrefix$1b}-arrow-button-right-month`),
|
|
8532
8551
|
onClick: () => {
|
|
8533
|
-
|
|
8552
|
+
handlePageChange("add", 1, "month");
|
|
8534
8553
|
}
|
|
8535
8554
|
}, props.nextMonthButton), React__default.default.createElement("a", {
|
|
8536
8555
|
className: classNames(`${classPrefix$1b}-arrow-button`, `${classPrefix$1b}-arrow-button-right`, `${classPrefix$1b}-arrow-button-right-year`),
|
|
8537
8556
|
onClick: () => {
|
|
8538
|
-
|
|
8557
|
+
handlePageChange("add", 1, "year");
|
|
8539
8558
|
}
|
|
8540
8559
|
}, props.nextYearButton));
|
|
8541
8560
|
const maxDay = React$1.useMemo(() => props.max && dayjs(props.max), [props.max]);
|
|
@@ -13585,6 +13604,126 @@ const index$c = attachPropertiesToComponent(Dropdown, {
|
|
|
13585
13604
|
Item
|
|
13586
13605
|
});
|
|
13587
13606
|
const ellipsis = "";
|
|
13607
|
+
var runes$1 = { exports: {} };
|
|
13608
|
+
const HIGH_SURROGATE_START = 55296;
|
|
13609
|
+
const HIGH_SURROGATE_END = 56319;
|
|
13610
|
+
const LOW_SURROGATE_START = 56320;
|
|
13611
|
+
const REGIONAL_INDICATOR_START = 127462;
|
|
13612
|
+
const REGIONAL_INDICATOR_END = 127487;
|
|
13613
|
+
const FITZPATRICK_MODIFIER_START = 127995;
|
|
13614
|
+
const FITZPATRICK_MODIFIER_END = 127999;
|
|
13615
|
+
const VARIATION_MODIFIER_START = 65024;
|
|
13616
|
+
const VARIATION_MODIFIER_END = 65039;
|
|
13617
|
+
const DIACRITICAL_MARKS_START = 8400;
|
|
13618
|
+
const DIACRITICAL_MARKS_END = 8447;
|
|
13619
|
+
const ZWJ = 8205;
|
|
13620
|
+
const GRAPHEMS = [
|
|
13621
|
+
776,
|
|
13622
|
+
2359,
|
|
13623
|
+
2359,
|
|
13624
|
+
2367,
|
|
13625
|
+
2367,
|
|
13626
|
+
2984,
|
|
13627
|
+
3007,
|
|
13628
|
+
3021,
|
|
13629
|
+
3633,
|
|
13630
|
+
3635,
|
|
13631
|
+
3648,
|
|
13632
|
+
3657,
|
|
13633
|
+
4352,
|
|
13634
|
+
4449,
|
|
13635
|
+
4520
|
|
13636
|
+
];
|
|
13637
|
+
function runes(string3) {
|
|
13638
|
+
if (typeof string3 !== "string") {
|
|
13639
|
+
throw new Error("string cannot be undefined or null");
|
|
13640
|
+
}
|
|
13641
|
+
const result2 = [];
|
|
13642
|
+
let i = 0;
|
|
13643
|
+
let increment = 0;
|
|
13644
|
+
while (i < string3.length) {
|
|
13645
|
+
increment += nextUnits(i + increment, string3);
|
|
13646
|
+
if (isGraphem(string3[i + increment])) {
|
|
13647
|
+
increment++;
|
|
13648
|
+
}
|
|
13649
|
+
if (isVariationSelector(string3[i + increment])) {
|
|
13650
|
+
increment++;
|
|
13651
|
+
}
|
|
13652
|
+
if (isDiacriticalMark(string3[i + increment])) {
|
|
13653
|
+
increment++;
|
|
13654
|
+
}
|
|
13655
|
+
if (isZeroWidthJoiner(string3[i + increment])) {
|
|
13656
|
+
increment++;
|
|
13657
|
+
continue;
|
|
13658
|
+
}
|
|
13659
|
+
result2.push(string3.substring(i, i + increment));
|
|
13660
|
+
i += increment;
|
|
13661
|
+
increment = 0;
|
|
13662
|
+
}
|
|
13663
|
+
return result2;
|
|
13664
|
+
}
|
|
13665
|
+
function nextUnits(i, string3) {
|
|
13666
|
+
const current = string3[i];
|
|
13667
|
+
if (!isFirstOfSurrogatePair(current) || i === string3.length - 1) {
|
|
13668
|
+
return 1;
|
|
13669
|
+
}
|
|
13670
|
+
const currentPair = current + string3[i + 1];
|
|
13671
|
+
let nextPair = string3.substring(i + 2, i + 5);
|
|
13672
|
+
if (isRegionalIndicator(currentPair) && isRegionalIndicator(nextPair)) {
|
|
13673
|
+
return 4;
|
|
13674
|
+
}
|
|
13675
|
+
if (isFitzpatrickModifier(nextPair)) {
|
|
13676
|
+
return 4;
|
|
13677
|
+
}
|
|
13678
|
+
return 2;
|
|
13679
|
+
}
|
|
13680
|
+
function isFirstOfSurrogatePair(string3) {
|
|
13681
|
+
return string3 && betweenInclusive(string3[0].charCodeAt(0), HIGH_SURROGATE_START, HIGH_SURROGATE_END);
|
|
13682
|
+
}
|
|
13683
|
+
function isRegionalIndicator(string3) {
|
|
13684
|
+
return betweenInclusive(codePointFromSurrogatePair(string3), REGIONAL_INDICATOR_START, REGIONAL_INDICATOR_END);
|
|
13685
|
+
}
|
|
13686
|
+
function isFitzpatrickModifier(string3) {
|
|
13687
|
+
return betweenInclusive(codePointFromSurrogatePair(string3), FITZPATRICK_MODIFIER_START, FITZPATRICK_MODIFIER_END);
|
|
13688
|
+
}
|
|
13689
|
+
function isVariationSelector(string3) {
|
|
13690
|
+
return typeof string3 === "string" && betweenInclusive(string3.charCodeAt(0), VARIATION_MODIFIER_START, VARIATION_MODIFIER_END);
|
|
13691
|
+
}
|
|
13692
|
+
function isDiacriticalMark(string3) {
|
|
13693
|
+
return typeof string3 === "string" && betweenInclusive(string3.charCodeAt(0), DIACRITICAL_MARKS_START, DIACRITICAL_MARKS_END);
|
|
13694
|
+
}
|
|
13695
|
+
function isGraphem(string3) {
|
|
13696
|
+
return typeof string3 === "string" && GRAPHEMS.indexOf(string3.charCodeAt(0)) !== -1;
|
|
13697
|
+
}
|
|
13698
|
+
function isZeroWidthJoiner(string3) {
|
|
13699
|
+
return typeof string3 === "string" && string3.charCodeAt(0) === ZWJ;
|
|
13700
|
+
}
|
|
13701
|
+
function codePointFromSurrogatePair(pair) {
|
|
13702
|
+
const highOffset = pair.charCodeAt(0) - HIGH_SURROGATE_START;
|
|
13703
|
+
const lowOffset = pair.charCodeAt(1) - LOW_SURROGATE_START;
|
|
13704
|
+
return (highOffset << 10) + lowOffset + 65536;
|
|
13705
|
+
}
|
|
13706
|
+
function betweenInclusive(value, lower, upper) {
|
|
13707
|
+
return value >= lower && value <= upper;
|
|
13708
|
+
}
|
|
13709
|
+
function substring(string3, start2, width) {
|
|
13710
|
+
const chars = runes(string3);
|
|
13711
|
+
if (start2 === void 0) {
|
|
13712
|
+
return string3;
|
|
13713
|
+
}
|
|
13714
|
+
if (start2 >= chars.length) {
|
|
13715
|
+
return "";
|
|
13716
|
+
}
|
|
13717
|
+
const rest = chars.length - start2;
|
|
13718
|
+
const stringWidth = width === void 0 ? rest : width;
|
|
13719
|
+
let endIndex = start2 + stringWidth;
|
|
13720
|
+
if (endIndex > start2 + rest) {
|
|
13721
|
+
endIndex = void 0;
|
|
13722
|
+
}
|
|
13723
|
+
return chars.slice(start2, endIndex).join("");
|
|
13724
|
+
}
|
|
13725
|
+
runes$1.exports = runes;
|
|
13726
|
+
runes$1.exports.substr = substring;
|
|
13588
13727
|
const classPrefix$S = `adm-ellipsis`;
|
|
13589
13728
|
const defaultProps$G = {
|
|
13590
13729
|
direction: "end",
|
|
@@ -13601,6 +13740,10 @@ const Ellipsis = (p) => {
|
|
|
13601
13740
|
const [ellipsised, setEllipsised] = React$1.useState({});
|
|
13602
13741
|
const [expanded, setExpanded] = React$1.useState(false);
|
|
13603
13742
|
const [exceeded, setExceeded] = React$1.useState(false);
|
|
13743
|
+
const chars = React$1.useMemo(() => runes$1.exports(props.content), [props.content]);
|
|
13744
|
+
function getSubString(start2, end) {
|
|
13745
|
+
return chars.slice(start2, end).join("");
|
|
13746
|
+
}
|
|
13604
13747
|
function calcEllipsised() {
|
|
13605
13748
|
const root2 = rootRef.current;
|
|
13606
13749
|
if (!root2)
|
|
@@ -13635,19 +13778,19 @@ const Ellipsis = (p) => {
|
|
|
13635
13778
|
if (right - left <= 1) {
|
|
13636
13779
|
if (props.direction === "end") {
|
|
13637
13780
|
return {
|
|
13638
|
-
leading:
|
|
13781
|
+
leading: getSubString(0, left) + "..."
|
|
13639
13782
|
};
|
|
13640
13783
|
} else {
|
|
13641
13784
|
return {
|
|
13642
|
-
tailing: "..." +
|
|
13785
|
+
tailing: "..." + getSubString(right, end)
|
|
13643
13786
|
};
|
|
13644
13787
|
}
|
|
13645
13788
|
}
|
|
13646
13789
|
const middle2 = Math.round((left + right) / 2);
|
|
13647
13790
|
if (props.direction === "end") {
|
|
13648
|
-
container.innerText =
|
|
13791
|
+
container.innerText = getSubString(0, middle2) + "..." + actionText;
|
|
13649
13792
|
} else {
|
|
13650
|
-
container.innerText = actionText + "..." +
|
|
13793
|
+
container.innerText = actionText + "..." + getSubString(middle2, end);
|
|
13651
13794
|
}
|
|
13652
13795
|
if (container.offsetHeight <= maxHeight) {
|
|
13653
13796
|
if (props.direction === "end") {
|
|
@@ -13665,13 +13808,13 @@ const Ellipsis = (p) => {
|
|
|
13665
13808
|
}, checkMiddle = function(leftPart, rightPart) {
|
|
13666
13809
|
if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
|
|
13667
13810
|
return {
|
|
13668
|
-
leading:
|
|
13669
|
-
tailing: "..." +
|
|
13811
|
+
leading: getSubString(0, leftPart[0]) + "...",
|
|
13812
|
+
tailing: "..." + getSubString(rightPart[1], end)
|
|
13670
13813
|
};
|
|
13671
13814
|
}
|
|
13672
13815
|
const leftPartMiddle = Math.floor((leftPart[0] + leftPart[1]) / 2);
|
|
13673
13816
|
const rightPartMiddle = Math.ceil((rightPart[0] + rightPart[1]) / 2);
|
|
13674
|
-
container.innerText =
|
|
13817
|
+
container.innerText = getSubString(0, leftPartMiddle) + "..." + actionText + "..." + getSubString(rightPartMiddle, end);
|
|
13675
13818
|
if (container.offsetHeight <= maxHeight) {
|
|
13676
13819
|
return checkMiddle([leftPartMiddle, leftPart[1]], [rightPart[0], rightPartMiddle]);
|
|
13677
13820
|
} else {
|
|
@@ -20238,10 +20381,10 @@ const Popover$1 = React$1.forwardRef((p, ref) => {
|
|
|
20238
20381
|
if (!props.trigger)
|
|
20239
20382
|
return;
|
|
20240
20383
|
setVisible(false);
|
|
20241
|
-
}, () => {
|
|
20384
|
+
}, [() => {
|
|
20242
20385
|
var _a;
|
|
20243
20386
|
return (_a = targetRef.current) === null || _a === void 0 ? void 0 : _a.element;
|
|
20244
|
-
});
|
|
20387
|
+
}, floatingRef], ["click", "touchmove"]);
|
|
20245
20388
|
const shouldRender = useShouldRender(visible, false, props.destroyOnHide);
|
|
20246
20389
|
return React__default.default.createElement(React__default.default.Fragment, null, React__default.default.createElement(Wrapper, {
|
|
20247
20390
|
ref: targetRef
|
|
@@ -24161,7 +24304,8 @@ const Stepper = (p) => {
|
|
|
24161
24304
|
role: "spinbutton",
|
|
24162
24305
|
"aria-valuenow": Number(inputValue),
|
|
24163
24306
|
"aria-valuemax": max2,
|
|
24164
|
-
"aria-valuemin": min2
|
|
24307
|
+
"aria-valuemin": min2,
|
|
24308
|
+
inputMode: "decimal"
|
|
24165
24309
|
})), React__default.default.createElement(Button, {
|
|
24166
24310
|
className: `${classPrefix$e}-plus`,
|
|
24167
24311
|
onClick: handlePlus,
|
|
@@ -24476,8 +24620,10 @@ const defaultProps$a = {
|
|
|
24476
24620
|
stuckAtBoundary: true,
|
|
24477
24621
|
rubberband: true
|
|
24478
24622
|
};
|
|
24623
|
+
let currentUid;
|
|
24479
24624
|
const Swiper = React$1.forwardRef(staged_1((p, ref) => {
|
|
24480
24625
|
const props = mergeProps(defaultProps$a, p);
|
|
24626
|
+
const [uid] = React$1.useState({});
|
|
24481
24627
|
const isVertical = props.direction === "vertical";
|
|
24482
24628
|
const slideRatio = props.slideSize / 100;
|
|
24483
24629
|
const offsetRatio = props.trackOffset / 100;
|
|
@@ -24567,6 +24713,12 @@ const Swiper = React$1.forwardRef(staged_1((p, ref) => {
|
|
|
24567
24713
|
dragCancelRef.current = state.cancel;
|
|
24568
24714
|
if (!state.intentional)
|
|
24569
24715
|
return;
|
|
24716
|
+
if (state.first && !currentUid) {
|
|
24717
|
+
currentUid = uid;
|
|
24718
|
+
}
|
|
24719
|
+
if (currentUid !== uid)
|
|
24720
|
+
return;
|
|
24721
|
+
currentUid = state.last ? void 0 : uid;
|
|
24570
24722
|
const slidePixels = getSlidePixels();
|
|
24571
24723
|
if (!slidePixels)
|
|
24572
24724
|
return;
|