@nutui/nutui-react-taro 2.5.0 → 2.5.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/CHANGELOG.md +26 -0
- package/README.md +5 -5
- package/dist/esm/Address/style/style.css +1 -1
- package/dist/esm/Address.js +1 -1
- package/dist/esm/Cascader/style/style.css +1 -1
- package/dist/esm/Cascader.js +1 -1
- package/dist/esm/DatePicker.js +1 -1
- package/dist/esm/Ellipsis/style/style.css +1 -1
- package/dist/esm/Ellipsis.js +1 -1
- package/dist/esm/Form/style/style.css +1 -1
- package/dist/esm/FormItem/style/style.css +1 -1
- package/dist/esm/Input.js +1 -1
- package/dist/esm/Popover/style/style.css +1 -1
- package/dist/esm/Popover.js +1 -1
- package/dist/esm/Progress.js +1 -1
- package/dist/esm/Tabs/style/style.css +1 -1
- package/dist/esm/Tabs.js +1 -1
- package/dist/esm/Tour/style/style.css +1 -1
- package/dist/esm/Tour.js +1 -1
- package/dist/esm/Uploader.js +1 -1
- package/dist/esm/{address.taro-CipZMqK4.js → address.taro-CQmN9x1W.js} +1 -1
- package/dist/esm/{cascader.taro-AZEBpBH3.js → cascader.taro-7Xhq98L4.js} +1 -1
- package/dist/esm/{datepicker.taro-DqR52Ivo.js → datepicker.taro-FiLalMAA.js} +14 -3
- package/dist/esm/{ellipsis.taro-cNaaQFyW.js → ellipsis.taro-uVc3En9l.js} +17 -8
- package/dist/esm/{input.taro-BVC8gEuk.js → input.taro-Dh6zXTLQ.js} +10 -3
- package/dist/esm/nutui-react.es.js +10 -10
- package/dist/esm/{popover.taro-BsOaXoWp.js → popover.taro-BG0msyw5.js} +17 -10
- package/dist/esm/progress.taro-rjiPI6mD.js +120 -0
- package/dist/esm/{tabs.taro-BxPmx5n5.js → tabs.taro-A7pOK9IM.js} +4 -20
- package/dist/esm/{tour.taro-wfXuUebD.js → tour.taro-BqlNfxdD.js} +1 -1
- package/dist/esm/{uploader.taro-Bs-cboSU.js → uploader.taro-DMmTl0Cp.js} +1 -1
- package/dist/esm/use-uuid-BvqmbYZ7.js +19 -0
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/tr-TR.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.es.js +159 -54
- package/dist/nutui.react.umd.js +159 -54
- package/dist/packages/ellipsis/ellipsis.scss +1 -1
- package/dist/packages/form/form.scss +4 -2
- package/dist/packages/formitem/formitem.scss +19 -0
- package/dist/packages/popover/popover.scss +0 -23
- package/dist/packages/tabs/tabs.scss +16 -21
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/variables-jmapp.scss +0 -1
- package/dist/styles/variables.scss +4 -8
- package/dist/types/packages/calendar/calendar.d.ts +1 -5
- package/dist/types/packages/calendar/calendar.taro.d.ts +1 -5
- package/dist/types/packages/calendar/types.d.ts +3 -0
- package/dist/types/packages/configprovider/types.d.ts +1 -1
- package/dist/types/packages/progress/progress.taro.d.ts +5 -0
- package/package.json +2 -2
- package/dist/esm/progress.taro-BOHykt7X.js +0 -60
package/dist/nutui.react.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui-react-taro v2.5.
|
|
2
|
+
* @nutui/nutui-react-taro v2.5.1 Fri Mar 29 2024 16:12:06 GMT+0800 (China Standard Time)
|
|
3
3
|
* (c) 2023 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -5324,18 +5324,10 @@ const Tabs = (props) => {
|
|
|
5324
5324
|
return;
|
|
5325
5325
|
let to = 0;
|
|
5326
5326
|
if (props.direction === "vertical") {
|
|
5327
|
-
const
|
|
5328
|
-
const top = titleRects.slice(0, index).reduce(
|
|
5329
|
-
(prev, curr) => prev + curr.height,
|
|
5330
|
-
DEFAULT_PADDING
|
|
5331
|
-
);
|
|
5327
|
+
const top = titleRects.slice(0, index).reduce((prev, curr) => prev + curr.height, 0);
|
|
5332
5328
|
to = top - (navRectRef.current.height - titleRect.height) / 2;
|
|
5333
5329
|
} else {
|
|
5334
|
-
const
|
|
5335
|
-
const left2 = titleRects.slice(0, index).reduce(
|
|
5336
|
-
(prev, curr) => prev + curr.width,
|
|
5337
|
-
DEFAULT_PADDING
|
|
5338
|
-
);
|
|
5330
|
+
const left2 = titleRects.slice(0, index).reduce((prev, curr) => prev + curr.width, 0);
|
|
5339
5331
|
to = left2 - (navRectRef.current.width - titleRect.width) / 2;
|
|
5340
5332
|
to = rtl ? -to : to;
|
|
5341
5333
|
}
|
|
@@ -8599,8 +8591,12 @@ const DatePicker = (props) => {
|
|
|
8599
8591
|
return result;
|
|
8600
8592
|
}
|
|
8601
8593
|
};
|
|
8602
|
-
const
|
|
8594
|
+
const compareDateChange = (currentDate, newDate) => {
|
|
8603
8595
|
var _a;
|
|
8596
|
+
const isEqual = ((_a = new Date(currentDate)) == null ? void 0 : _a.getTime()) === (newDate == null ? void 0 : newDate.getTime());
|
|
8597
|
+
newDate && isDate(newDate) && !isEqual && setSelectedDate(formatValue(newDate));
|
|
8598
|
+
};
|
|
8599
|
+
const handlePickerChange = (selectedOptions, selectedValue, index) => {
|
|
8604
8600
|
const rangeType = type4.toLocaleLowerCase();
|
|
8605
8601
|
if (["date", "datetime", "datehour", "month-day", "year-month"].includes(
|
|
8606
8602
|
rangeType
|
|
@@ -8639,8 +8635,22 @@ const DatePicker = (props) => {
|
|
|
8639
8635
|
} else if (rangeType === "datehour") {
|
|
8640
8636
|
date4 = new Date(year, month, day, Number(formatDate[3]));
|
|
8641
8637
|
}
|
|
8642
|
-
|
|
8643
|
-
|
|
8638
|
+
compareDateChange(selectedDate, date4);
|
|
8639
|
+
} else {
|
|
8640
|
+
const [hour, minute, seconds] = selectedValue;
|
|
8641
|
+
const currentDate = new Date(selectedDate);
|
|
8642
|
+
const year = currentDate.getFullYear();
|
|
8643
|
+
const month = currentDate.getMonth();
|
|
8644
|
+
const day = currentDate.getDate();
|
|
8645
|
+
const date4 = new Date(
|
|
8646
|
+
year,
|
|
8647
|
+
month,
|
|
8648
|
+
day,
|
|
8649
|
+
Number(hour),
|
|
8650
|
+
Number(minute),
|
|
8651
|
+
rangeType === "time" ? Number(seconds) : 0
|
|
8652
|
+
);
|
|
8653
|
+
compareDateChange(selectedDate, date4);
|
|
8644
8654
|
}
|
|
8645
8655
|
props.onChange && props.onChange(selectedOptions, selectedValue, index);
|
|
8646
8656
|
};
|
|
@@ -10279,6 +10289,7 @@ const defaultProps$X = {
|
|
|
10279
10289
|
};
|
|
10280
10290
|
const Input = forwardRef(
|
|
10281
10291
|
(props, ref) => {
|
|
10292
|
+
const rtl = useRtl();
|
|
10282
10293
|
const { locale } = useConfig$1();
|
|
10283
10294
|
const {
|
|
10284
10295
|
type: type4,
|
|
@@ -10414,8 +10425,14 @@ const Input = forwardRef(
|
|
|
10414
10425
|
className: "nut-input-native",
|
|
10415
10426
|
ref: inputRef,
|
|
10416
10427
|
style: {
|
|
10417
|
-
|
|
10418
|
-
|
|
10428
|
+
// eslint-disable-next-line no-nested-ternary
|
|
10429
|
+
textAlign: rtl ? (
|
|
10430
|
+
// eslint-disable-next-line no-nested-ternary
|
|
10431
|
+
align === "right" ? (
|
|
10432
|
+
// eslint-disable-next-line no-nested-ternary
|
|
10433
|
+
"left"
|
|
10434
|
+
) : align === "left" ? "right" : "center"
|
|
10435
|
+
) : align
|
|
10419
10436
|
},
|
|
10420
10437
|
type: inputType(type4),
|
|
10421
10438
|
password: type4 === "password",
|
|
@@ -12630,6 +12647,7 @@ const defaultProps$J = {
|
|
|
12630
12647
|
percent: 0,
|
|
12631
12648
|
showText: false,
|
|
12632
12649
|
animated: false,
|
|
12650
|
+
lazy: false,
|
|
12633
12651
|
delay: 0
|
|
12634
12652
|
};
|
|
12635
12653
|
const Progress = (props) => {
|
|
@@ -12644,6 +12662,7 @@ const Progress = (props) => {
|
|
|
12644
12662
|
showText,
|
|
12645
12663
|
animated,
|
|
12646
12664
|
children,
|
|
12665
|
+
lazy,
|
|
12647
12666
|
delay,
|
|
12648
12667
|
...rest
|
|
12649
12668
|
} = {
|
|
@@ -12664,10 +12683,7 @@ const Progress = (props) => {
|
|
|
12664
12683
|
width: `${displayPercent}%`,
|
|
12665
12684
|
background: color
|
|
12666
12685
|
};
|
|
12667
|
-
|
|
12668
|
-
setDispalyPercent(percent);
|
|
12669
|
-
}, [percent]);
|
|
12670
|
-
useEffect(() => {
|
|
12686
|
+
const handlePercent = () => {
|
|
12671
12687
|
let timer = null;
|
|
12672
12688
|
if (delay) {
|
|
12673
12689
|
setDispalyPercent(0);
|
|
@@ -12676,27 +12692,104 @@ const Progress = (props) => {
|
|
|
12676
12692
|
}, delay);
|
|
12677
12693
|
}
|
|
12678
12694
|
return () => {
|
|
12695
|
+
lazy && resetObserver(Taro.getEnv());
|
|
12679
12696
|
timer && clearTimeout(timer);
|
|
12680
12697
|
};
|
|
12698
|
+
};
|
|
12699
|
+
useEffect(() => {
|
|
12700
|
+
setDispalyPercent(percent);
|
|
12701
|
+
}, [percent]);
|
|
12702
|
+
const [intersecting, setIntersecting] = useState(false);
|
|
12703
|
+
const progressRef = useRef(null);
|
|
12704
|
+
const webObserver = useRef(null);
|
|
12705
|
+
const uuid = useUuid();
|
|
12706
|
+
const selector = `${classPrefix2}-lazy-${uuid}`;
|
|
12707
|
+
const resetObserver = (env, observer = null) => {
|
|
12708
|
+
if (env === "WEB") {
|
|
12709
|
+
webObserver.current.disconnect && webObserver.current.disconnect();
|
|
12710
|
+
} else {
|
|
12711
|
+
observer && observer.disconnect();
|
|
12712
|
+
}
|
|
12713
|
+
};
|
|
12714
|
+
useEffect(() => {
|
|
12715
|
+
if (lazy) {
|
|
12716
|
+
setTimeout(() => {
|
|
12717
|
+
if (intersecting) {
|
|
12718
|
+
setDispalyPercent(percent);
|
|
12719
|
+
} else {
|
|
12720
|
+
setDispalyPercent(0.01);
|
|
12721
|
+
}
|
|
12722
|
+
}, delay);
|
|
12723
|
+
}
|
|
12724
|
+
}, [intersecting]);
|
|
12725
|
+
const handleWebObserver = () => {
|
|
12726
|
+
if (lazy) {
|
|
12727
|
+
webObserver.current = new IntersectionObserver(
|
|
12728
|
+
(entires, self2) => {
|
|
12729
|
+
entires.forEach((item) => {
|
|
12730
|
+
setIntersecting(item.isIntersecting);
|
|
12731
|
+
});
|
|
12732
|
+
},
|
|
12733
|
+
{
|
|
12734
|
+
threshold: [0],
|
|
12735
|
+
rootMargin: "0px"
|
|
12736
|
+
}
|
|
12737
|
+
);
|
|
12738
|
+
webObserver.current.observe(progressRef.current);
|
|
12739
|
+
}
|
|
12740
|
+
handlePercent();
|
|
12741
|
+
};
|
|
12742
|
+
const handleOtherObserver = () => {
|
|
12743
|
+
let observer = null;
|
|
12744
|
+
if (lazy) {
|
|
12745
|
+
observer = Taro.createIntersectionObserver(
|
|
12746
|
+
Taro.getCurrentInstance().page,
|
|
12747
|
+
{
|
|
12748
|
+
thresholds: [0],
|
|
12749
|
+
observeAll: true
|
|
12750
|
+
}
|
|
12751
|
+
);
|
|
12752
|
+
observer.relativeToViewport({ top: 0 }).observe(`#${selector}`, (res) => {
|
|
12753
|
+
setIntersecting(res.intersectionRatio > 0);
|
|
12754
|
+
});
|
|
12755
|
+
}
|
|
12756
|
+
handlePercent();
|
|
12757
|
+
};
|
|
12758
|
+
useEffect(() => {
|
|
12759
|
+
if (Taro.getEnv() === "WEB") {
|
|
12760
|
+
handleWebObserver();
|
|
12761
|
+
} else {
|
|
12762
|
+
handleOtherObserver();
|
|
12763
|
+
}
|
|
12681
12764
|
}, []);
|
|
12682
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
12765
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
12683
12766
|
"div",
|
|
12684
12767
|
{
|
|
12685
|
-
|
|
12686
|
-
|
|
12768
|
+
ref: progressRef,
|
|
12769
|
+
id: selector,
|
|
12770
|
+
className: classNames(classPrefix2, className),
|
|
12771
|
+
style,
|
|
12772
|
+
...rest
|
|
12687
12773
|
},
|
|
12688
|
-
|
|
12774
|
+
/* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-outer`, style: stylesOuter }, /* @__PURE__ */ React__default.createElement("div", { className: classesInner, style: stylesInner }, showText && /* @__PURE__ */ React__default.createElement(
|
|
12689
12775
|
"div",
|
|
12690
12776
|
{
|
|
12691
|
-
className: `${classPrefix2}-text
|
|
12692
|
-
style: {
|
|
12693
|
-
background: color
|
|
12694
|
-
}
|
|
12777
|
+
className: `${classPrefix2}-text`,
|
|
12778
|
+
style: rtl ? { right: `${displayPercent}%` } : { left: `${displayPercent}%` }
|
|
12695
12779
|
},
|
|
12696
|
-
|
|
12697
|
-
|
|
12698
|
-
|
|
12699
|
-
|
|
12780
|
+
children || /* @__PURE__ */ React__default.createElement(
|
|
12781
|
+
"div",
|
|
12782
|
+
{
|
|
12783
|
+
className: `${classPrefix2}-text-inner`,
|
|
12784
|
+
style: {
|
|
12785
|
+
background: color
|
|
12786
|
+
}
|
|
12787
|
+
},
|
|
12788
|
+
percent,
|
|
12789
|
+
"%"
|
|
12790
|
+
)
|
|
12791
|
+
)))
|
|
12792
|
+
);
|
|
12700
12793
|
};
|
|
12701
12794
|
Progress.defaultProps = defaultProps$J;
|
|
12702
12795
|
Progress.displayName = "NutProgress";
|
|
@@ -14392,6 +14485,7 @@ const defaultProps$z = {
|
|
|
14392
14485
|
};
|
|
14393
14486
|
const classPrefix$c = `nut-popover`;
|
|
14394
14487
|
const Popover = (props) => {
|
|
14488
|
+
const rtl = useRtl();
|
|
14395
14489
|
const {
|
|
14396
14490
|
children,
|
|
14397
14491
|
list,
|
|
@@ -14446,9 +14540,9 @@ const Popover = (props) => {
|
|
|
14446
14540
|
setRootPosition({
|
|
14447
14541
|
width: rect.width,
|
|
14448
14542
|
height: rect.height,
|
|
14449
|
-
left: rect.left,
|
|
14543
|
+
left: rtl ? rect.right : rect.left,
|
|
14450
14544
|
top: rect.top + distance,
|
|
14451
|
-
right: rect.right
|
|
14545
|
+
right: rtl ? rect.left : rect.right
|
|
14452
14546
|
});
|
|
14453
14547
|
}).exec();
|
|
14454
14548
|
setTimeout(() => {
|
|
@@ -14502,15 +14596,17 @@ const Popover = (props) => {
|
|
|
14502
14596
|
let cross = 0;
|
|
14503
14597
|
let parallel = 0;
|
|
14504
14598
|
if (Array.isArray(offset) && offset.length === 2) {
|
|
14599
|
+
const rtloffset = rtl ? -offset[0] : offset[0];
|
|
14505
14600
|
cross += +offset[1];
|
|
14506
|
-
parallel += +
|
|
14601
|
+
parallel += +rtloffset;
|
|
14507
14602
|
}
|
|
14508
14603
|
if (width) {
|
|
14604
|
+
const dir = rtl ? "right" : "left";
|
|
14509
14605
|
if (["bottom", "top"].includes(direction)) {
|
|
14510
14606
|
const h2 = direction === "bottom" ? height + cross : -(contentHeight + cross);
|
|
14511
14607
|
styles.top = `${top + h2}px`;
|
|
14512
14608
|
if (!skew) {
|
|
14513
|
-
styles
|
|
14609
|
+
styles[dir] = `${-(contentWidth - width) / 2 + rootPosition[dir] + parallel}px`;
|
|
14514
14610
|
}
|
|
14515
14611
|
if (skew === "start") {
|
|
14516
14612
|
styles.left = `${left2 + parallel}px`;
|
|
@@ -14546,15 +14642,17 @@ const Popover = (props) => {
|
|
|
14546
14642
|
const skew = location.split("-")[1];
|
|
14547
14643
|
const base = 16;
|
|
14548
14644
|
if (props.arrowOffset !== 0) {
|
|
14645
|
+
const dir = rtl ? "right" : "left";
|
|
14646
|
+
const dir2 = rtl ? "left" : "right";
|
|
14549
14647
|
if (["bottom", "top"].includes(direction)) {
|
|
14550
14648
|
if (!skew) {
|
|
14551
|
-
styles
|
|
14649
|
+
styles[dir] = `calc(50% + ${arrowOffset}px)`;
|
|
14552
14650
|
}
|
|
14553
14651
|
if (skew === "start") {
|
|
14554
|
-
styles
|
|
14652
|
+
styles[dir] = `${base + arrowOffset}px`;
|
|
14555
14653
|
}
|
|
14556
14654
|
if (skew === "end") {
|
|
14557
|
-
styles
|
|
14655
|
+
styles[dir2] = `${base - arrowOffset}px`;
|
|
14558
14656
|
}
|
|
14559
14657
|
}
|
|
14560
14658
|
if (["left", "right"].includes(direction)) {
|
|
@@ -14572,12 +14670,13 @@ const Popover = (props) => {
|
|
|
14572
14670
|
return styles;
|
|
14573
14671
|
};
|
|
14574
14672
|
const handleSelect = (item, index) => {
|
|
14673
|
+
var _a;
|
|
14575
14674
|
if (!item.disabled) {
|
|
14576
|
-
onSelect
|
|
14675
|
+
onSelect == null ? void 0 : onSelect(item, index);
|
|
14577
14676
|
}
|
|
14578
14677
|
if (closeOnActionClick) {
|
|
14579
|
-
props.onClick
|
|
14580
|
-
onClose
|
|
14678
|
+
(_a = props.onClick) == null ? void 0 : _a.call(props);
|
|
14679
|
+
onClose == null ? void 0 : onClose();
|
|
14581
14680
|
}
|
|
14582
14681
|
};
|
|
14583
14682
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, !targetId && /* @__PURE__ */ React__default.createElement(
|
|
@@ -16357,9 +16456,14 @@ const Ellipsis = (props) => {
|
|
|
16357
16456
|
const digitReg = /^[0-9]+$/;
|
|
16358
16457
|
const letterUpperReg = /^[A-Z]+$/;
|
|
16359
16458
|
const letterLowerReg = /^[a-z]+$/;
|
|
16459
|
+
const rtl = useRtl();
|
|
16460
|
+
const rtlClasses = classNames({
|
|
16461
|
+
[`${classPrefix$6}-rtl`]: rtl
|
|
16462
|
+
});
|
|
16360
16463
|
const classes = classNames(
|
|
16361
16464
|
classPrefix$6,
|
|
16362
16465
|
width ? `${classPrefix$6}-width` : "",
|
|
16466
|
+
rtlClasses,
|
|
16363
16467
|
className
|
|
16364
16468
|
);
|
|
16365
16469
|
useEffect(() => {
|
|
@@ -16589,18 +16693,19 @@ const Ellipsis = (props) => {
|
|
|
16589
16693
|
width: `${!Number.isNaN(Number(width)) ? `${width}px` : "auto"}`
|
|
16590
16694
|
}
|
|
16591
16695
|
},
|
|
16592
|
-
content
|
|
16593
|
-
|
|
16594
|
-
|
|
16595
|
-
|
|
16596
|
-
|
|
16597
|
-
|
|
16598
|
-
|
|
16599
|
-
|
|
16600
|
-
|
|
16601
|
-
|
|
16602
|
-
|
|
16603
|
-
|
|
16696
|
+
content,
|
|
16697
|
+
expandText ? /* @__PURE__ */ React__default.createElement(
|
|
16698
|
+
"span",
|
|
16699
|
+
{
|
|
16700
|
+
className: "nut-ellipsis-text",
|
|
16701
|
+
onClick: (e2) => {
|
|
16702
|
+
e2.stopPropagation();
|
|
16703
|
+
clickHandle(2);
|
|
16704
|
+
}
|
|
16705
|
+
},
|
|
16706
|
+
collapseText
|
|
16707
|
+
) : null
|
|
16708
|
+
)) : null)
|
|
16604
16709
|
), /* @__PURE__ */ React__default.createElement(
|
|
16605
16710
|
View,
|
|
16606
16711
|
{
|