antd-mobile 5.40.0 → 5.41.0-alpha.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/bundle/antd-mobile.cjs.development.js +225 -85
- package/2x/bundle/antd-mobile.cjs.js +6 -6
- package/2x/bundle/antd-mobile.es.development.js +225 -85
- package/2x/bundle/antd-mobile.es.js +2218 -2144
- package/2x/bundle/antd-mobile.umd.development.js +225 -85
- package/2x/bundle/antd-mobile.umd.js +7 -7
- package/2x/bundle/style.css +4 -1
- package/2x/cjs/components/calendar/calendar.d.ts +4 -1
- package/2x/cjs/components/calendar/calendar.js +18 -11
- package/2x/cjs/components/date-picker/date-picker-week-utils.js +2 -1
- package/2x/cjs/components/ellipsis/ellipsis.d.ts +3 -0
- package/2x/cjs/components/ellipsis/ellipsis.js +10 -2
- package/2x/cjs/components/swiper/swiper.js +1 -1
- package/2x/cjs/components/tabs/tabs.js +45 -13
- package/2x/cjs/components/virtual-input/virtual-input.css +4 -1
- package/2x/cjs/components/virtual-input/virtual-input.d.ts +6 -0
- package/2x/cjs/components/virtual-input/virtual-input.js +105 -8
- package/2x/es/components/calendar/calendar.d.ts +4 -1
- package/2x/es/components/calendar/calendar.js +19 -12
- package/2x/es/components/date-picker/date-picker-week-utils.js +2 -1
- package/2x/es/components/ellipsis/ellipsis.d.ts +3 -0
- package/2x/es/components/ellipsis/ellipsis.js +10 -2
- package/2x/es/components/swiper/swiper.js +1 -1
- package/2x/es/components/tabs/tabs.js +44 -12
- package/2x/es/components/virtual-input/virtual-input.css +4 -1
- package/2x/es/components/virtual-input/virtual-input.d.ts +6 -0
- package/2x/es/components/virtual-input/virtual-input.js +105 -8
- package/2x/package.json +3 -3
- package/bundle/antd-mobile.cjs.development.js +225 -85
- package/bundle/antd-mobile.cjs.js +6 -6
- package/bundle/antd-mobile.compatible.umd.js +1 -1
- package/bundle/antd-mobile.es.development.js +225 -85
- package/bundle/antd-mobile.es.js +2218 -2144
- package/bundle/antd-mobile.umd.development.js +225 -85
- package/bundle/antd-mobile.umd.js +7 -7
- package/bundle/style.css +1 -1
- package/cjs/components/calendar/calendar.d.ts +4 -1
- package/cjs/components/calendar/calendar.js +18 -11
- package/cjs/components/date-picker/date-picker-week-utils.js +2 -1
- package/cjs/components/ellipsis/ellipsis.d.ts +3 -0
- package/cjs/components/ellipsis/ellipsis.js +10 -2
- package/cjs/components/swiper/swiper.js +1 -1
- package/cjs/components/tabs/tabs.js +45 -13
- package/cjs/components/virtual-input/virtual-input.css +3 -1
- package/cjs/components/virtual-input/virtual-input.d.ts +6 -0
- package/cjs/components/virtual-input/virtual-input.js +105 -8
- package/es/components/calendar/calendar.d.ts +4 -1
- package/es/components/calendar/calendar.js +19 -12
- package/es/components/date-picker/date-picker-week-utils.js +2 -1
- package/es/components/ellipsis/ellipsis.d.ts +3 -0
- package/es/components/ellipsis/ellipsis.js +10 -2
- package/es/components/swiper/swiper.js +1 -1
- package/es/components/tabs/tabs.js +44 -12
- package/es/components/virtual-input/virtual-input.css +3 -1
- package/es/components/virtual-input/virtual-input.d.ts +6 -0
- package/es/components/virtual-input/virtual-input.js +105 -8
- package/package.json +3 -3
- package/umd/antd-mobile.js +1 -1
- package/2x/cjs/components/ellipsis/~ellipsis.d.ts +0 -15
- package/2x/cjs/components/ellipsis/~ellipsis.js +0 -161
- package/2x/es/components/ellipsis/~ellipsis.d.ts +0 -15
- package/2x/es/components/ellipsis/~ellipsis.js +0 -151
- package/cjs/components/ellipsis/~ellipsis.d.ts +0 -15
- package/cjs/components/ellipsis/~ellipsis.js +0 -161
- package/es/components/ellipsis/~ellipsis.d.ts +0 -15
- package/es/components/ellipsis/~ellipsis.js +0 -151
|
@@ -9667,6 +9667,73 @@ const Button = forwardRef((p, ref2) => {
|
|
|
9667
9667
|
className: `${classPrefix$1h}-loading-wrapper`
|
|
9668
9668
|
}, props.loadingIcon, props.loadingText) : React__default.createElement("span", null, props.children)));
|
|
9669
9669
|
});
|
|
9670
|
+
var isoWeek$1 = { exports: {} };
|
|
9671
|
+
(function(module, exports) {
|
|
9672
|
+
!function(e2, t) {
|
|
9673
|
+
module.exports = t();
|
|
9674
|
+
}(commonjsGlobal, function() {
|
|
9675
|
+
var e2 = "day";
|
|
9676
|
+
return function(t, i2, s) {
|
|
9677
|
+
var a = function(t2) {
|
|
9678
|
+
return t2.add(4 - t2.isoWeekday(), e2);
|
|
9679
|
+
}, d = i2.prototype;
|
|
9680
|
+
d.isoWeekYear = function() {
|
|
9681
|
+
return a(this).year();
|
|
9682
|
+
}, d.isoWeek = function(t2) {
|
|
9683
|
+
if (!this.$utils().u(t2))
|
|
9684
|
+
return this.add(7 * (t2 - this.isoWeek()), e2);
|
|
9685
|
+
var i3, d2, n3, o, r = a(this), u = (i3 = this.isoWeekYear(), d2 = this.$u, n3 = (d2 ? s.utc : s)().year(i3).startOf("year"), o = 4 - n3.isoWeekday(), n3.isoWeekday() > 4 && (o += 7), n3.add(o, e2));
|
|
9686
|
+
return r.diff(u, "week") + 1;
|
|
9687
|
+
}, d.isoWeekday = function(e3) {
|
|
9688
|
+
return this.$utils().u(e3) ? this.day() || 7 : this.day(this.day() % 7 ? e3 : e3 - 7);
|
|
9689
|
+
};
|
|
9690
|
+
var n2 = d.startOf;
|
|
9691
|
+
d.startOf = function(e3, t2) {
|
|
9692
|
+
var i3 = this.$utils(), s2 = !!i3.u(t2) || t2;
|
|
9693
|
+
return "isoweek" === i3.p(e3) ? s2 ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : n2.bind(this)(e3, t2);
|
|
9694
|
+
};
|
|
9695
|
+
};
|
|
9696
|
+
});
|
|
9697
|
+
})(isoWeek$1);
|
|
9698
|
+
var isoWeekExports = isoWeek$1.exports;
|
|
9699
|
+
const isoWeek = /* @__PURE__ */ getDefaultExportFromCjs(isoWeekExports);
|
|
9700
|
+
function devWarning(component, message) {
|
|
9701
|
+
{
|
|
9702
|
+
console.warn(`[antd-mobile: ${component}] ${message}`);
|
|
9703
|
+
}
|
|
9704
|
+
}
|
|
9705
|
+
function devError(component, message) {
|
|
9706
|
+
{
|
|
9707
|
+
console.error(`[antd-mobile: ${component}] ${message}`);
|
|
9708
|
+
}
|
|
9709
|
+
}
|
|
9710
|
+
function replaceMessage$1(template, kv) {
|
|
9711
|
+
return template.replace(/\$\{\w+\}/g, (str) => {
|
|
9712
|
+
const key = str.slice(2, -1);
|
|
9713
|
+
return kv[key];
|
|
9714
|
+
});
|
|
9715
|
+
}
|
|
9716
|
+
function usePropsValue(options) {
|
|
9717
|
+
const {
|
|
9718
|
+
value,
|
|
9719
|
+
defaultValue,
|
|
9720
|
+
onChange
|
|
9721
|
+
} = options;
|
|
9722
|
+
const update2 = useUpdate$1();
|
|
9723
|
+
const stateRef = useRef(value !== void 0 ? value : defaultValue);
|
|
9724
|
+
if (value !== void 0) {
|
|
9725
|
+
stateRef.current = value;
|
|
9726
|
+
}
|
|
9727
|
+
const setState = useMemoizedFn((v, forceTrigger = false) => {
|
|
9728
|
+
const nextValue = typeof v === "function" ? v(stateRef.current) : v;
|
|
9729
|
+
if (!forceTrigger && nextValue === stateRef.current)
|
|
9730
|
+
return;
|
|
9731
|
+
stateRef.current = nextValue;
|
|
9732
|
+
update2();
|
|
9733
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(nextValue);
|
|
9734
|
+
});
|
|
9735
|
+
return [stateRef.current, setState];
|
|
9736
|
+
}
|
|
9670
9737
|
const ArrowLeft = () => {
|
|
9671
9738
|
return React__default.createElement("svg", {
|
|
9672
9739
|
height: "1em",
|
|
@@ -9721,73 +9788,6 @@ const ArrowLeftDouble = () => {
|
|
|
9721
9788
|
d: "M19.5305114,17.0699744 C19.0173831,17.5315665 18.9752295,18.3220903 19.436308,18.8357433 C19.4660129,18.8688164 19.4974585,18.9002801 19.5305113,18.9300007 L29.4833057,27.2801611 C30.1234001,27.8559077 30.1759552,28.8420707 29.6007967,29.4827774 C29.0256382,30.1235263 28.0404824,30.1761351 27.400388,29.6003885 L17.4475937,21.2502703 C17.3320874,21.1463692 17.2222026,21.036372 17.1184079,20.920748 C15.5069703,19.1256817 15.6543605,16.3628317 17.4475933,14.7497465 L27.4003877,6.39962828 C28.0404821,5.82383957 29.0256378,5.87649058 29.6007963,6.51723942 C30.1759548,7.1579461 30.1233997,8.14410915 29.4833053,8.7198557 L19.5305114,17.0699744 Z"
|
|
9722
9789
|
}))))));
|
|
9723
9790
|
};
|
|
9724
|
-
var isoWeek$1 = { exports: {} };
|
|
9725
|
-
(function(module, exports) {
|
|
9726
|
-
!function(e2, t) {
|
|
9727
|
-
module.exports = t();
|
|
9728
|
-
}(commonjsGlobal, function() {
|
|
9729
|
-
var e2 = "day";
|
|
9730
|
-
return function(t, i2, s) {
|
|
9731
|
-
var a = function(t2) {
|
|
9732
|
-
return t2.add(4 - t2.isoWeekday(), e2);
|
|
9733
|
-
}, d = i2.prototype;
|
|
9734
|
-
d.isoWeekYear = function() {
|
|
9735
|
-
return a(this).year();
|
|
9736
|
-
}, d.isoWeek = function(t2) {
|
|
9737
|
-
if (!this.$utils().u(t2))
|
|
9738
|
-
return this.add(7 * (t2 - this.isoWeek()), e2);
|
|
9739
|
-
var i3, d2, n3, o, r = a(this), u = (i3 = this.isoWeekYear(), d2 = this.$u, n3 = (d2 ? s.utc : s)().year(i3).startOf("year"), o = 4 - n3.isoWeekday(), n3.isoWeekday() > 4 && (o += 7), n3.add(o, e2));
|
|
9740
|
-
return r.diff(u, "week") + 1;
|
|
9741
|
-
}, d.isoWeekday = function(e3) {
|
|
9742
|
-
return this.$utils().u(e3) ? this.day() || 7 : this.day(this.day() % 7 ? e3 : e3 - 7);
|
|
9743
|
-
};
|
|
9744
|
-
var n2 = d.startOf;
|
|
9745
|
-
d.startOf = function(e3, t2) {
|
|
9746
|
-
var i3 = this.$utils(), s2 = !!i3.u(t2) || t2;
|
|
9747
|
-
return "isoweek" === i3.p(e3) ? s2 ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : n2.bind(this)(e3, t2);
|
|
9748
|
-
};
|
|
9749
|
-
};
|
|
9750
|
-
});
|
|
9751
|
-
})(isoWeek$1);
|
|
9752
|
-
var isoWeekExports = isoWeek$1.exports;
|
|
9753
|
-
const isoWeek = /* @__PURE__ */ getDefaultExportFromCjs(isoWeekExports);
|
|
9754
|
-
function usePropsValue(options) {
|
|
9755
|
-
const {
|
|
9756
|
-
value,
|
|
9757
|
-
defaultValue,
|
|
9758
|
-
onChange
|
|
9759
|
-
} = options;
|
|
9760
|
-
const update2 = useUpdate$1();
|
|
9761
|
-
const stateRef = useRef(value !== void 0 ? value : defaultValue);
|
|
9762
|
-
if (value !== void 0) {
|
|
9763
|
-
stateRef.current = value;
|
|
9764
|
-
}
|
|
9765
|
-
const setState = useMemoizedFn((v, forceTrigger = false) => {
|
|
9766
|
-
const nextValue = typeof v === "function" ? v(stateRef.current) : v;
|
|
9767
|
-
if (!forceTrigger && nextValue === stateRef.current)
|
|
9768
|
-
return;
|
|
9769
|
-
stateRef.current = nextValue;
|
|
9770
|
-
update2();
|
|
9771
|
-
return onChange === null || onChange === void 0 ? void 0 : onChange(nextValue);
|
|
9772
|
-
});
|
|
9773
|
-
return [stateRef.current, setState];
|
|
9774
|
-
}
|
|
9775
|
-
function replaceMessage$1(template, kv) {
|
|
9776
|
-
return template.replace(/\$\{\w+\}/g, (str) => {
|
|
9777
|
-
const key = str.slice(2, -1);
|
|
9778
|
-
return kv[key];
|
|
9779
|
-
});
|
|
9780
|
-
}
|
|
9781
|
-
function devWarning(component, message) {
|
|
9782
|
-
{
|
|
9783
|
-
console.warn(`[antd-mobile: ${component}] ${message}`);
|
|
9784
|
-
}
|
|
9785
|
-
}
|
|
9786
|
-
function devError(component, message) {
|
|
9787
|
-
{
|
|
9788
|
-
console.error(`[antd-mobile: ${component}] ${message}`);
|
|
9789
|
-
}
|
|
9790
|
-
}
|
|
9791
9791
|
function convertValueToRange$1(selectionMode, value) {
|
|
9792
9792
|
if (selectionMode === void 0 || value === null)
|
|
9793
9793
|
return null;
|
|
@@ -9929,7 +9929,7 @@ const Calendar = forwardRef((p, ref2) => {
|
|
|
9929
9929
|
}
|
|
9930
9930
|
const inThisMonth = d.month() === current.month();
|
|
9931
9931
|
const disabled = props.shouldDisableDate ? props.shouldDisableDate(d.toDate()) : maxDay && d.isAfter(maxDay, "day") || minDay && d.isBefore(minDay, "day");
|
|
9932
|
-
|
|
9932
|
+
const originalCell = React__default.createElement("div", {
|
|
9933
9933
|
key: d.valueOf(),
|
|
9934
9934
|
className: classNames(`${classPrefix$1g}-cell`, (disabled || !inThisMonth) && `${classPrefix$1g}-cell-disabled`, inThisMonth && {
|
|
9935
9935
|
[`${classPrefix$1g}-cell-today`]: d.isSame(today, "day"),
|
|
@@ -9987,7 +9987,13 @@ const Calendar = forwardRef((p, ref2) => {
|
|
|
9987
9987
|
className: `${classPrefix$1g}-cell-top`
|
|
9988
9988
|
}, props.renderDate ? props.renderDate(d.toDate()) : d.date()), React__default.createElement("div", {
|
|
9989
9989
|
className: `${classPrefix$1g}-cell-bottom`
|
|
9990
|
-
}, (_a = props.renderLabel) === null || _a === void 0 ? void 0 : _a.call(props, d.toDate())))
|
|
9990
|
+
}, (_a = props.renderLabel) === null || _a === void 0 ? void 0 : _a.call(props, d.toDate())));
|
|
9991
|
+
const cellWithKey = props.cellRender ? React__default.createElement(React__default.Fragment, {
|
|
9992
|
+
key: d.valueOf()
|
|
9993
|
+
}, props.cellRender(originalCell, {
|
|
9994
|
+
date: d.toDate()
|
|
9995
|
+
})) : originalCell;
|
|
9996
|
+
cells.push(cellWithKey);
|
|
9991
9997
|
iterator = iterator.add(1, "day");
|
|
9992
9998
|
}
|
|
9993
9999
|
return cells;
|
|
@@ -12232,6 +12238,7 @@ const Tabs$1 = (p) => {
|
|
|
12232
12238
|
const props = mergeProps(defaultProps$S, p);
|
|
12233
12239
|
const tabListContainerRef = useRef(null);
|
|
12234
12240
|
const activeLineRef = useRef(null);
|
|
12241
|
+
const tabRefs = useRef({});
|
|
12235
12242
|
const keyToIndexRecord = {};
|
|
12236
12243
|
let firstActiveKey = null;
|
|
12237
12244
|
const panes = [];
|
|
@@ -12371,7 +12378,7 @@ const Tabs$1 = (p) => {
|
|
|
12371
12378
|
});
|
|
12372
12379
|
const {
|
|
12373
12380
|
run: updateMask
|
|
12374
|
-
} = useThrottleFn((immediate
|
|
12381
|
+
} = useThrottleFn((immediate) => {
|
|
12375
12382
|
const container = tabListContainerRef.current;
|
|
12376
12383
|
if (!container)
|
|
12377
12384
|
return;
|
|
@@ -12398,6 +12405,35 @@ const Tabs$1 = (p) => {
|
|
|
12398
12405
|
useIsomorphicLayoutEffect$3(() => {
|
|
12399
12406
|
updateMask(true);
|
|
12400
12407
|
}, []);
|
|
12408
|
+
const handleKeyDown = (e2) => {
|
|
12409
|
+
const keys2 = Object.keys(keyToIndexRecord);
|
|
12410
|
+
const currentIndex = keyToIndexRecord[activeKey];
|
|
12411
|
+
const isNext = isRTL2 ? e2.key === "ArrowLeft" : e2.key === "ArrowRight";
|
|
12412
|
+
const isPrev = isRTL2 ? e2.key === "ArrowRight" : e2.key === "ArrowLeft";
|
|
12413
|
+
const offsetDirection = isNext ? 1 : -1;
|
|
12414
|
+
const findNextEnabledTab = (startIndex, direction) => {
|
|
12415
|
+
const length = keys2.length;
|
|
12416
|
+
for (let i2 = 0; i2 < length; i2++) {
|
|
12417
|
+
const index2 = (startIndex + direction * (i2 + 1) + length) % length;
|
|
12418
|
+
const key = keys2[index2];
|
|
12419
|
+
const pane = panes.find((p2) => p2.key === key);
|
|
12420
|
+
if (!(pane === null || pane === void 0 ? void 0 : pane.props.disabled))
|
|
12421
|
+
return key;
|
|
12422
|
+
}
|
|
12423
|
+
return keys2[startIndex];
|
|
12424
|
+
};
|
|
12425
|
+
const currentKey = findNextEnabledTab(currentIndex, offsetDirection);
|
|
12426
|
+
if (isNext || isPrev) {
|
|
12427
|
+
e2.preventDefault();
|
|
12428
|
+
setActiveKey(currentKey);
|
|
12429
|
+
}
|
|
12430
|
+
};
|
|
12431
|
+
useEffect(() => {
|
|
12432
|
+
var _a2;
|
|
12433
|
+
if (activeKey && tabRefs.current[activeKey]) {
|
|
12434
|
+
(_a2 = tabRefs.current[activeKey]) === null || _a2 === void 0 ? void 0 : _a2.focus();
|
|
12435
|
+
}
|
|
12436
|
+
}, [activeKey]);
|
|
12401
12437
|
return withNativeProps(props, React__default.createElement("div", {
|
|
12402
12438
|
className: classPrefix$15,
|
|
12403
12439
|
style: {
|
|
@@ -12420,6 +12456,7 @@ const Tabs$1 = (p) => {
|
|
|
12420
12456
|
ref: tabListContainerRef,
|
|
12421
12457
|
scrollLeft,
|
|
12422
12458
|
onScroll: updateMask,
|
|
12459
|
+
onKeyDown: handleKeyDown,
|
|
12423
12460
|
role: "tablist"
|
|
12424
12461
|
}, React__default.createElement(animated.div, {
|
|
12425
12462
|
ref: activeLineRef,
|
|
@@ -12434,6 +12471,10 @@ const Tabs$1 = (p) => {
|
|
|
12434
12471
|
[`${classPrefix$15}-tab-wrapper-stretch`]: props.stretch
|
|
12435
12472
|
})
|
|
12436
12473
|
}, React__default.createElement("div", {
|
|
12474
|
+
role: "tab",
|
|
12475
|
+
"aria-selected": pane.key === activeKey,
|
|
12476
|
+
tabIndex: pane.key === activeKey ? 0 : -1,
|
|
12477
|
+
ref: (el) => tabRefs.current[pane.key] = el,
|
|
12437
12478
|
onClick: () => {
|
|
12438
12479
|
const {
|
|
12439
12480
|
key
|
|
@@ -12448,9 +12489,7 @@ const Tabs$1 = (p) => {
|
|
|
12448
12489
|
className: classNames(`${classPrefix$15}-tab`, {
|
|
12449
12490
|
[`${classPrefix$15}-tab-active`]: pane.key === activeKey,
|
|
12450
12491
|
[`${classPrefix$15}-tab-disabled`]: pane.props.disabled
|
|
12451
|
-
})
|
|
12452
|
-
role: "tab",
|
|
12453
|
-
"aria-selected": pane.key === activeKey
|
|
12492
|
+
})
|
|
12454
12493
|
}, pane.props.title)))))), panes.map((pane) => {
|
|
12455
12494
|
if (pane.props.children === void 0) {
|
|
12456
12495
|
return null;
|
|
@@ -13838,7 +13877,7 @@ function convertStringArrayToDate$1(value) {
|
|
|
13838
13877
|
const yearString = (_a = value[0]) !== null && _a !== void 0 ? _a : "1900";
|
|
13839
13878
|
const weekString = (_b = value[1]) !== null && _b !== void 0 ? _b : "1";
|
|
13840
13879
|
const weekdayString = (_c = value[2]) !== null && _c !== void 0 ? _c : "1";
|
|
13841
|
-
const day = dayjs(`${parseInt(yearString)}-01-
|
|
13880
|
+
const day = dayjs(`${parseInt(yearString)}-01-04`).isoWeek(parseInt(weekString)).isoWeekday(parseInt(weekdayString)).hour(0).minute(0).second(0);
|
|
13842
13881
|
return day.toDate();
|
|
13843
13882
|
}
|
|
13844
13883
|
const precisionLengthRecord = {
|
|
@@ -14565,13 +14604,21 @@ const Ellipsis = (p) => {
|
|
|
14565
14604
|
const rootRef = React__default.useRef(null);
|
|
14566
14605
|
const [expanded, setExpanded] = React__default.useState(defaultExpanded);
|
|
14567
14606
|
const expandNode = expandText ? withStopPropagation(stopPropagationForActionButtons, React__default.createElement("a", {
|
|
14568
|
-
onClick: () => {
|
|
14607
|
+
onClick: (e2) => {
|
|
14608
|
+
var _a;
|
|
14569
14609
|
setExpanded(true);
|
|
14610
|
+
(_a = props.onExpand) === null || _a === void 0 ? void 0 : _a.call(props, true, {
|
|
14611
|
+
event: e2
|
|
14612
|
+
});
|
|
14570
14613
|
}
|
|
14571
14614
|
}, expandText)) : null;
|
|
14572
14615
|
const collapseNode = collapseText ? withStopPropagation(stopPropagationForActionButtons, React__default.createElement("a", {
|
|
14573
|
-
onClick: () => {
|
|
14616
|
+
onClick: (e2) => {
|
|
14617
|
+
var _a;
|
|
14574
14618
|
setExpanded(false);
|
|
14619
|
+
(_a = props.onExpand) === null || _a === void 0 ? void 0 : _a.call(props, false, {
|
|
14620
|
+
event: e2
|
|
14621
|
+
});
|
|
14575
14622
|
}
|
|
14576
14623
|
}, collapseText)) : null;
|
|
14577
14624
|
const [measureNodes, forceResize] = useMeasure(rootRef, content, rows, direction, expanded, expandNode, collapseNode);
|
|
@@ -26588,7 +26635,7 @@ const Swiper = forwardRef(staged_1((p, ref2) => {
|
|
|
26588
26635
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
26589
26636
|
className: `${classPrefix$a}-slide-placeholder`,
|
|
26590
26637
|
style: {
|
|
26591
|
-
width: `${startIndex * 100}%`
|
|
26638
|
+
[isVertical ? "height" : "width"]: `${startIndex * 100}%`
|
|
26592
26639
|
}
|
|
26593
26640
|
}), items);
|
|
26594
26641
|
}
|
|
@@ -27459,7 +27506,10 @@ const index = attachPropertiesToComponent(TreeSelect, {
|
|
|
27459
27506
|
});
|
|
27460
27507
|
const classPrefix$2 = "adm-virtual-input";
|
|
27461
27508
|
const defaultProps$2 = {
|
|
27462
|
-
defaultValue: ""
|
|
27509
|
+
defaultValue: "",
|
|
27510
|
+
cursor: {
|
|
27511
|
+
movable: false
|
|
27512
|
+
}
|
|
27463
27513
|
};
|
|
27464
27514
|
const VirtualInput = forwardRef((props, ref2) => {
|
|
27465
27515
|
const {
|
|
@@ -27472,6 +27522,13 @@ const VirtualInput = forwardRef((props, ref2) => {
|
|
|
27472
27522
|
const contentRef = useRef(null);
|
|
27473
27523
|
const [hasFocus, setHasFocus] = useState(false);
|
|
27474
27524
|
const [caretPosition, setCaretPosition] = useState(value.length);
|
|
27525
|
+
const keyboardDataRef = useRef({});
|
|
27526
|
+
const touchDataRef = useRef();
|
|
27527
|
+
const charRef = useRef(null);
|
|
27528
|
+
const charWidthRef = useRef(0);
|
|
27529
|
+
const caretRef = useRef(null);
|
|
27530
|
+
const [isCaretDragging, setIsCaretDragging] = useState(false);
|
|
27531
|
+
const touchMoveTimeoutRef = useRef();
|
|
27475
27532
|
const clearIcon = mergeProp(React__default.createElement(CloseCircleFill, null), componentConfig.clearIcon, props.clearIcon);
|
|
27476
27533
|
function scrollToEnd() {
|
|
27477
27534
|
const root2 = rootRef.current;
|
|
@@ -27485,6 +27542,22 @@ const VirtualInput = forwardRef((props, ref2) => {
|
|
|
27485
27542
|
return;
|
|
27486
27543
|
content.scrollLeft = content.clientWidth;
|
|
27487
27544
|
}
|
|
27545
|
+
useEffect(() => {
|
|
27546
|
+
if (charRef.current) {
|
|
27547
|
+
charWidthRef.current = charRef.current.getBoundingClientRect().width;
|
|
27548
|
+
}
|
|
27549
|
+
}, [value]);
|
|
27550
|
+
useEffect(() => {
|
|
27551
|
+
if (value === keyboardDataRef.current.newValue) {
|
|
27552
|
+
if (keyboardDataRef.current.mode === "input") {
|
|
27553
|
+
setCaretPosition((c) => c + 1);
|
|
27554
|
+
} else if (keyboardDataRef.current.mode === "delete") {
|
|
27555
|
+
setCaretPosition((c) => c - 1);
|
|
27556
|
+
}
|
|
27557
|
+
} else {
|
|
27558
|
+
setCaretPosition(value.length);
|
|
27559
|
+
}
|
|
27560
|
+
}, [value]);
|
|
27488
27561
|
useIsomorphicLayoutEffect$3(() => {
|
|
27489
27562
|
scrollToEnd();
|
|
27490
27563
|
}, [value]);
|
|
@@ -27518,8 +27591,11 @@ const VirtualInput = forwardRef((props, ref2) => {
|
|
|
27518
27591
|
onInput: (v) => {
|
|
27519
27592
|
var _a, _b;
|
|
27520
27593
|
const newValue = value.substring(0, caretPosition) + v + value.substring(caretPosition);
|
|
27594
|
+
keyboardDataRef.current = {
|
|
27595
|
+
newValue,
|
|
27596
|
+
mode: "input"
|
|
27597
|
+
};
|
|
27521
27598
|
setValue(newValue);
|
|
27522
|
-
setCaretPosition((c) => c + 1);
|
|
27523
27599
|
(_b = (_a = keyboard.props).onInput) === null || _b === void 0 ? void 0 : _b.call(_a, v);
|
|
27524
27600
|
},
|
|
27525
27601
|
onDelete: () => {
|
|
@@ -27527,8 +27603,11 @@ const VirtualInput = forwardRef((props, ref2) => {
|
|
|
27527
27603
|
if (caretPosition === 0)
|
|
27528
27604
|
return;
|
|
27529
27605
|
const newValue = value.substring(0, caretPosition - 1) + value.substring(caretPosition);
|
|
27606
|
+
keyboardDataRef.current = {
|
|
27607
|
+
newValue,
|
|
27608
|
+
mode: "delete"
|
|
27609
|
+
};
|
|
27530
27610
|
setValue(newValue);
|
|
27531
|
-
setCaretPosition(caretPosition - 1);
|
|
27532
27611
|
(_b = (_a = keyboard.props).onDelete) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
27533
27612
|
},
|
|
27534
27613
|
visible: hasFocus,
|
|
@@ -27545,21 +27624,78 @@ const VirtualInput = forwardRef((props, ref2) => {
|
|
|
27545
27624
|
getContainer: null
|
|
27546
27625
|
});
|
|
27547
27626
|
const setCaretPositionToEnd = () => {
|
|
27548
|
-
|
|
27627
|
+
var _a, _b;
|
|
27628
|
+
if (caretPosition !== value.length) {
|
|
27629
|
+
setCaretPosition(value.length);
|
|
27630
|
+
(_b = (_a = mergedProps.cursor) === null || _a === void 0 ? void 0 : _a.onMove) === null || _b === void 0 ? void 0 : _b.call(_a, value.length);
|
|
27631
|
+
}
|
|
27549
27632
|
};
|
|
27550
27633
|
const changeCaretPosition = (index2) => (e2) => {
|
|
27634
|
+
var _a, _b, _c;
|
|
27635
|
+
if (mergedProps.disabled || !((_a = mergedProps.cursor) === null || _a === void 0 ? void 0 : _a.movable))
|
|
27636
|
+
return;
|
|
27551
27637
|
e2.stopPropagation();
|
|
27552
27638
|
const rect = e2.target.getBoundingClientRect();
|
|
27553
27639
|
const midX = rect.left + rect.width / 2;
|
|
27554
27640
|
const clickX = e2.clientX;
|
|
27555
27641
|
const isRight = clickX > midX;
|
|
27556
|
-
|
|
27642
|
+
const newCaretPosition = isRight ? index2 + 1 : index2;
|
|
27643
|
+
setCaretPosition(newCaretPosition);
|
|
27644
|
+
(_c = (_b = mergedProps.cursor) === null || _b === void 0 ? void 0 : _b.onMove) === null || _c === void 0 ? void 0 : _c.call(_b, newCaretPosition);
|
|
27645
|
+
};
|
|
27646
|
+
const handleTouchStart = (e2) => {
|
|
27647
|
+
var _a;
|
|
27648
|
+
if (mergedProps.disabled || !((_a = mergedProps.cursor) === null || _a === void 0 ? void 0 : _a.movable))
|
|
27649
|
+
return;
|
|
27650
|
+
if (!caretRef.current)
|
|
27651
|
+
return;
|
|
27652
|
+
const touch = e2.touches[0];
|
|
27653
|
+
const caretRect = caretRef.current.getBoundingClientRect();
|
|
27654
|
+
const distance = Math.abs(touch.clientX - (caretRect.left + caretRect.width / 2));
|
|
27655
|
+
if (distance < 20) {
|
|
27656
|
+
touchDataRef.current = {
|
|
27657
|
+
startX: touch.clientX,
|
|
27658
|
+
startCaretPosition: caretPosition
|
|
27659
|
+
};
|
|
27660
|
+
} else {
|
|
27661
|
+
touchDataRef.current = null;
|
|
27662
|
+
}
|
|
27663
|
+
};
|
|
27664
|
+
const handleTouchMove = (e2) => {
|
|
27665
|
+
var _a, _b, _c;
|
|
27666
|
+
if (!touchDataRef.current || !((_a = mergedProps.cursor) === null || _a === void 0 ? void 0 : _a.movable))
|
|
27667
|
+
return;
|
|
27668
|
+
setIsCaretDragging(true);
|
|
27669
|
+
const touch = e2.touches[0];
|
|
27670
|
+
const deltaX = touch.clientX - touchDataRef.current.startX;
|
|
27671
|
+
const charWidth = charWidthRef.current;
|
|
27672
|
+
const moveChars = Math.round(deltaX / charWidth);
|
|
27673
|
+
let newCaretPosition = touchDataRef.current.startCaretPosition + moveChars;
|
|
27674
|
+
newCaretPosition = Math.max(0, Math.min(newCaretPosition, value.length));
|
|
27675
|
+
setCaretPosition(newCaretPosition);
|
|
27676
|
+
(_c = (_b = mergedProps.cursor) === null || _b === void 0 ? void 0 : _b.onMove) === null || _c === void 0 ? void 0 : _c.call(_b, newCaretPosition);
|
|
27677
|
+
if (touchMoveTimeoutRef.current) {
|
|
27678
|
+
clearTimeout(touchMoveTimeoutRef.current);
|
|
27679
|
+
}
|
|
27680
|
+
touchMoveTimeoutRef.current = setTimeout(() => {
|
|
27681
|
+
setIsCaretDragging(false);
|
|
27682
|
+
touchMoveTimeoutRef.current = null;
|
|
27683
|
+
}, 500);
|
|
27684
|
+
};
|
|
27685
|
+
const handleTouchEnd = () => {
|
|
27686
|
+
touchDataRef.current = null;
|
|
27687
|
+
setIsCaretDragging(false);
|
|
27688
|
+
if (touchMoveTimeoutRef.current) {
|
|
27689
|
+
clearTimeout(touchMoveTimeoutRef.current);
|
|
27690
|
+
touchMoveTimeoutRef.current = null;
|
|
27691
|
+
}
|
|
27557
27692
|
};
|
|
27558
27693
|
const chars = (value + "").split("");
|
|
27559
27694
|
return withNativeProps(mergedProps, React__default.createElement("div", {
|
|
27560
27695
|
ref: rootRef,
|
|
27561
27696
|
className: classNames(classPrefix$2, {
|
|
27562
|
-
[`${classPrefix$2}-disabled`]: mergedProps.disabled
|
|
27697
|
+
[`${classPrefix$2}-disabled`]: mergedProps.disabled,
|
|
27698
|
+
[`${classPrefix$2}-caret-dragging`]: isCaretDragging
|
|
27563
27699
|
}),
|
|
27564
27700
|
tabIndex: mergedProps.disabled ? void 0 : 0,
|
|
27565
27701
|
role: "textbox",
|
|
@@ -27571,13 +27707,18 @@ const VirtualInput = forwardRef((props, ref2) => {
|
|
|
27571
27707
|
ref: contentRef,
|
|
27572
27708
|
"aria-disabled": mergedProps.disabled,
|
|
27573
27709
|
"aria-label": mergedProps.placeholder,
|
|
27574
|
-
onClick: setCaretPositionToEnd
|
|
27710
|
+
onClick: setCaretPositionToEnd,
|
|
27711
|
+
onTouchStart: handleTouchStart,
|
|
27712
|
+
onTouchMove: handleTouchMove,
|
|
27713
|
+
onTouchEnd: handleTouchEnd
|
|
27575
27714
|
}, chars.slice(0, caretPosition).map((i2, index2) => React__default.createElement("span", {
|
|
27715
|
+
ref: index2 === 0 ? charRef : void 0,
|
|
27576
27716
|
key: index2,
|
|
27577
27717
|
onClick: changeCaretPosition(index2)
|
|
27578
27718
|
}, i2)), React__default.createElement("div", {
|
|
27579
27719
|
className: `${classPrefix$2}-caret-container`
|
|
27580
27720
|
}, hasFocus && React__default.createElement("div", {
|
|
27721
|
+
ref: caretRef,
|
|
27581
27722
|
className: `${classPrefix$2}-caret`
|
|
27582
27723
|
})), chars.slice(caretPosition).map((i2, index2) => React__default.createElement("span", {
|
|
27583
27724
|
key: index2,
|
|
@@ -27588,7 +27729,6 @@ const VirtualInput = forwardRef((props, ref2) => {
|
|
|
27588
27729
|
var _a;
|
|
27589
27730
|
e2.stopPropagation();
|
|
27590
27731
|
setValue("");
|
|
27591
|
-
setCaretPosition(0);
|
|
27592
27732
|
(_a = mergedProps.onClear) === null || _a === void 0 ? void 0 : _a.call(mergedProps);
|
|
27593
27733
|
},
|
|
27594
27734
|
role: "button",
|