@nutui/nutui-react-taro 2.3.7 → 2.3.8-beta.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/dist/esm/Address/style/style.css +1 -1
- package/dist/esm/Address.js +3 -3
- package/dist/esm/AvatarCropper.js +1 -1
- package/dist/esm/Cascader/style/style.css +1 -1
- package/dist/esm/Cascader.js +2 -2
- package/dist/esm/Collapse.js +2 -2
- package/dist/esm/CollapseItem.js +1 -1
- package/dist/esm/DatePicker.js +3 -2
- package/dist/esm/Ellipsis.js +2 -1
- package/dist/esm/NavBar/style/style.css +1 -1
- package/dist/esm/NavBar.js +4 -1
- package/dist/esm/Picker.js +2 -1
- package/dist/esm/Popover.js +1 -1
- package/dist/esm/Radio.js +1 -1
- package/dist/esm/RadioGroup.js +1 -1
- package/dist/esm/Rate/style/style.css +1 -1
- package/dist/esm/Rate.js +5 -1
- package/dist/esm/Step/style/style.css +1 -1
- package/dist/esm/Step.js +2 -1
- package/dist/esm/Steps/style/style.css +1 -1
- package/dist/esm/Steps.js +1 -1
- package/dist/esm/Tabs/style/style.css +1 -1
- package/dist/esm/Tabs.js +1 -1
- package/dist/esm/Tour.js +2 -2
- package/dist/esm/Video.js +1 -2
- package/dist/esm/{address.taro-TWHlPzXv.js → address.taro-LCSSqsR-.js} +1 -1
- package/dist/esm/{avatarcropper.taro-_IENn5QL.js → avatarcropper.taro-GIZxzMJ_.js} +2 -2
- package/dist/esm/{cascader.taro-QW13vwKb.js → cascader.taro-x_X9F_pH.js} +1 -1
- package/dist/esm/{collapse.taro-l21-Cvji.js → collapse.taro-sZibDygv.js} +1 -1
- package/dist/esm/{collapseitem.taro-9w-h_UP6.js → collapseitem.taro-AaQ_msgd.js} +2 -2
- package/dist/esm/{datepicker.taro-OrqtwJFM.js → datepicker.taro-S111IvJO.js} +1 -1
- package/dist/esm/{ellipsis.taro-ov_C4kbs.js → ellipsis.taro-VApVqS_j.js} +39 -45
- package/dist/esm/navbar.taro-AuKPDCaW.js +105 -0
- package/dist/esm/nutui-react.es.js +18 -17
- package/dist/esm/{picker.taro-_bT5c-BS.js → picker.taro-RAYmFSC0.js} +1 -11
- package/dist/esm/{popover.taro-ScQymuJC.js → popover.taro-MUrnn7xY.js} +1 -1
- package/dist/esm/{radio.taro-mZvB2wwi.js → radio.taro-EKJXMjnX.js} +7 -6
- package/dist/esm/rate.taro-_5Mjd_EO.js +146 -0
- package/dist/esm/{step.taro-kCAQ4Q3-.js → step.taro-_DEZqFGb.js} +6 -5
- package/dist/esm/{steps.taro-n6BT6nWE.js → steps.taro-PH0qWPla.js} +5 -4
- package/dist/esm/{tabs.taro-aR3XROu9.js → tabs.taro-w8ra49Qb.js} +3 -3
- package/dist/esm/{tour.taro-GabSljal.js → tour.taro-HLsDVf9g.js} +3 -3
- package/dist/esm/types/src/packages/navbar/navbar.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/radio/index.d.ts +2 -1
- package/dist/esm/types/src/packages/radio/index.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/radio/radio.d.ts +1 -2
- package/dist/esm/types/src/packages/radio/radio.taro.d.ts +1 -2
- package/dist/esm/types/src/packages/radio/types.d.ts +2 -0
- package/dist/esm/types/src/packages/radiogroup/context.d.ts +2 -0
- package/dist/esm/types/src/packages/radiogroup/index.d.ts +1 -0
- package/dist/esm/types/src/packages/radiogroup/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/radiogroup/radiogroup.d.ts +4 -6
- package/dist/esm/types/src/packages/radiogroup/radiogroup.taro.d.ts +4 -6
- package/dist/esm/types/src/packages/radiogroup/types.d.ts +4 -0
- package/dist/esm/types/src/packages/rate/rate.d.ts +2 -0
- package/dist/esm/types/src/packages/rate/rate.taro.d.ts +2 -0
- package/dist/esm/types/src/packages/video/video.taro.d.ts +4 -5
- package/dist/esm/use-refs-IdrY0ww3.js +15 -0
- package/dist/esm/{video.taro-MDBF77xf.js → video.taro-csvHwS2v.js} +5 -7
- 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 +174 -71
- package/dist/nutui.react.umd.js +167 -64
- package/dist/packages/navbar/navbar.scss +7 -0
- package/dist/packages/rate/rate.scss +6 -0
- package/dist/packages/step/step.scss +5 -4
- package/dist/packages/tabs/tabs.scss +1 -0
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/types/packages/navbar/navbar.taro.d.ts +2 -1
- package/dist/types/packages/overlay/overlay.taro.d.ts +5 -1
- package/dist/types/packages/radio/index.d.ts +2 -1
- package/dist/types/packages/radio/index.taro.d.ts +2 -1
- package/dist/types/packages/radio/radio.d.ts +1 -2
- package/dist/types/packages/radio/radio.taro.d.ts +1 -2
- package/dist/types/packages/radio/types.d.ts +2 -0
- package/dist/types/packages/radiogroup/context.d.ts +2 -0
- package/dist/types/packages/radiogroup/index.d.ts +1 -0
- package/dist/types/packages/radiogroup/index.taro.d.ts +1 -0
- package/dist/types/packages/radiogroup/radiogroup.d.ts +4 -6
- package/dist/types/packages/radiogroup/radiogroup.taro.d.ts +8 -6
- package/dist/types/packages/radiogroup/types.d.ts +4 -0
- package/dist/types/packages/rate/rate.d.ts +2 -0
- package/dist/types/packages/rate/rate.taro.d.ts +2 -0
- package/dist/types/packages/video/video.taro.d.ts +4 -5
- package/package.json +1 -1
- package/dist/esm/navbar.taro-v0VHQWR4.js +0 -63
- package/dist/esm/rate.taro-ZkOVGSDs.js +0 -77
package/dist/nutui.react.es.js
CHANGED
|
@@ -5,13 +5,13 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
/*!
|
|
8
|
-
* @nutui/nutui-react-taro v2.3.
|
|
8
|
+
* @nutui/nutui-react-taro v2.3.8-beta.0 Fri Jan 26 2024 15:05:58 GMT+0800 (China Standard Time)
|
|
9
9
|
* (c) 2023 @jdf2e.
|
|
10
10
|
* Released under the MIT License.
|
|
11
11
|
*/
|
|
12
12
|
import * as React from "react";
|
|
13
13
|
import React__default, { useCallback, createContext, useContext, useState, useRef, useEffect, useMemo as useMemo$1, useImperativeHandle, isValidElement, forwardRef, Component, Children } from "react";
|
|
14
|
-
import Taro, { getEnv, createSelectorQuery, usePageScroll, getSystemInfoSync, pageScrollTo, nextTick, ENV_TYPE, canvasToTempFilePath, uploadFile, chooseMedia, chooseImage, Events, getCurrentInstance,
|
|
14
|
+
import Taro, { getEnv, createSelectorQuery, usePageScroll, getSystemInfoSync, pageScrollTo, nextTick, ENV_TYPE, useReady, canvasToTempFilePath, uploadFile, chooseMedia, chooseImage, Events, getCurrentInstance, createInnerAudioContext, getSystemInfo, createOffscreenCanvas } from "@tarojs/taro";
|
|
15
15
|
import { Image as Image$2, View, ScrollView, PickerView, PickerViewColumn, Input as Input$1, Textarea, Swiper as Swiper$1, SwiperItem as SwiperItem$1, Video as Video$1, Canvas } from "@tarojs/components";
|
|
16
16
|
import ReactDOM, { createPortal } from "react-dom";
|
|
17
17
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
@@ -4487,24 +4487,64 @@ const NavBar = (props) => {
|
|
|
4487
4487
|
zIndex
|
|
4488
4488
|
};
|
|
4489
4489
|
};
|
|
4490
|
+
const leftRef = useRef(null);
|
|
4491
|
+
const rightRef = useRef(null);
|
|
4492
|
+
const wrapperRef = useRef(null);
|
|
4493
|
+
const [contentWidth, setContentWidth] = useState("50%");
|
|
4494
|
+
const getNodeWidth = async (node) => {
|
|
4495
|
+
if (node) {
|
|
4496
|
+
const refe = await getRectByTaro(node);
|
|
4497
|
+
return refe.width;
|
|
4498
|
+
}
|
|
4499
|
+
return 0;
|
|
4500
|
+
};
|
|
4501
|
+
useEffect(() => {
|
|
4502
|
+
if (titleAlign === "left") {
|
|
4503
|
+
return;
|
|
4504
|
+
}
|
|
4505
|
+
if (!(back || left2 || right2)) {
|
|
4506
|
+
setContentWidth("100%");
|
|
4507
|
+
}
|
|
4508
|
+
const init = async () => {
|
|
4509
|
+
const leftRectWidth = await getNodeWidth(leftRef == null ? void 0 : leftRef.current);
|
|
4510
|
+
const rightRectWidth = await getNodeWidth(rightRef == null ? void 0 : rightRef.current);
|
|
4511
|
+
const wrapperWidth = await getNodeWidth(wrapperRef == null ? void 0 : wrapperRef.current);
|
|
4512
|
+
let centerWidth = wrapperWidth / 2;
|
|
4513
|
+
if (leftRectWidth && rightRectWidth) {
|
|
4514
|
+
centerWidth = wrapperWidth - (leftRectWidth > rightRectWidth ? leftRectWidth * 2 : rightRectWidth * 2);
|
|
4515
|
+
} else {
|
|
4516
|
+
centerWidth = wrapperWidth - leftRectWidth * 2 - rightRectWidth * 2;
|
|
4517
|
+
}
|
|
4518
|
+
setContentWidth(centerWidth.toFixed(2));
|
|
4519
|
+
};
|
|
4520
|
+
init();
|
|
4521
|
+
}, [left2, right2, back]);
|
|
4490
4522
|
const renderLeft = () => {
|
|
4491
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
4492
|
-
|
|
4523
|
+
return back || left2 ? /* @__PURE__ */ React__default.createElement(View, { className: `${classPrefix2}-left`, ref: leftRef }, back && /* @__PURE__ */ React__default.createElement(
|
|
4524
|
+
View,
|
|
4493
4525
|
{
|
|
4494
4526
|
className: `${classPrefix2}-left-back`,
|
|
4495
4527
|
onClick: (e2) => onBackClick(e2)
|
|
4496
4528
|
},
|
|
4497
4529
|
back
|
|
4498
|
-
), left2);
|
|
4530
|
+
), left2) : null;
|
|
4499
4531
|
};
|
|
4500
4532
|
const renderContent = () => {
|
|
4501
|
-
|
|
4533
|
+
let titleStyle = {};
|
|
4534
|
+
if (titleAlign === "center") {
|
|
4535
|
+
const contentRealWidth = `${contentWidth}${/%$/i.test(contentWidth) ? "" : "px"}`;
|
|
4536
|
+
titleStyle = {
|
|
4537
|
+
minWidth: contentRealWidth,
|
|
4538
|
+
width: contentRealWidth
|
|
4539
|
+
};
|
|
4540
|
+
}
|
|
4541
|
+
return /* @__PURE__ */ React__default.createElement(View, { className: `${classPrefix2}-title`, style: titleStyle }, children);
|
|
4502
4542
|
};
|
|
4503
4543
|
const renderRight = () => {
|
|
4504
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
4544
|
+
return /* @__PURE__ */ React__default.createElement(View, { className: `${classPrefix2}-right`, ref: rightRef }, right2);
|
|
4505
4545
|
};
|
|
4506
4546
|
const renderWrapper = () => {
|
|
4507
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
4547
|
+
return /* @__PURE__ */ React__default.createElement(View, { className: cls, style: styles(), ref: wrapperRef }, renderLeft(), renderContent(), renderRight());
|
|
4508
4548
|
};
|
|
4509
4549
|
const classes = classNames({
|
|
4510
4550
|
[`${classPrefix2}-fixed`]: fixed,
|
|
@@ -4512,7 +4552,7 @@ const NavBar = (props) => {
|
|
|
4512
4552
|
[`${classPrefix2}-title-align-${titleAlign}`]: true
|
|
4513
4553
|
});
|
|
4514
4554
|
const cls = classNames(classPrefix2, classes, className);
|
|
4515
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, fixed && placeholder ? /* @__PURE__ */ React__default.createElement(
|
|
4555
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, fixed && placeholder ? /* @__PURE__ */ React__default.createElement(View, { className: `${classPrefix2}-placeholder` }, renderWrapper()) : renderWrapper());
|
|
4516
4556
|
};
|
|
4517
4557
|
NavBar.defaultProps = defaultProps$1h;
|
|
4518
4558
|
NavBar.displayName = "NutNavBar";
|
|
@@ -5195,14 +5235,14 @@ const Tabs = (props) => {
|
|
|
5195
5235
|
};
|
|
5196
5236
|
const getRect2 = (selector) => {
|
|
5197
5237
|
return new Promise((resolve) => {
|
|
5198
|
-
|
|
5238
|
+
createSelectorQuery().select(selector).boundingClientRect().exec((rect = []) => {
|
|
5199
5239
|
resolve(rect[0]);
|
|
5200
5240
|
});
|
|
5201
5241
|
});
|
|
5202
5242
|
};
|
|
5203
5243
|
const getAllRect = (selector) => {
|
|
5204
5244
|
return new Promise((resolve) => {
|
|
5205
|
-
|
|
5245
|
+
createSelectorQuery().selectAll(selector).boundingClientRect().exec((rect = []) => {
|
|
5206
5246
|
resolve(rect[0]);
|
|
5207
5247
|
});
|
|
5208
5248
|
});
|
|
@@ -11116,6 +11156,7 @@ const RadioGroup = React__default.forwardRef(
|
|
|
11116
11156
|
value,
|
|
11117
11157
|
defaultValue,
|
|
11118
11158
|
onChange,
|
|
11159
|
+
shape,
|
|
11119
11160
|
labelPosition,
|
|
11120
11161
|
direction,
|
|
11121
11162
|
options,
|
|
@@ -11151,6 +11192,7 @@ const RadioGroup = React__default.forwardRef(
|
|
|
11151
11192
|
value: {
|
|
11152
11193
|
labelPosition: labelPosition || "right",
|
|
11153
11194
|
disabled,
|
|
11195
|
+
shape,
|
|
11154
11196
|
value: val2State,
|
|
11155
11197
|
check: (value2) => {
|
|
11156
11198
|
setVal2State(value2);
|
|
@@ -11278,11 +11320,11 @@ const Radio = (props) => {
|
|
|
11278
11320
|
className: classNames(color())
|
|
11279
11321
|
}) : /* @__PURE__ */ React__default.createElement(I$1, { className: classNames(color()) });
|
|
11280
11322
|
};
|
|
11323
|
+
const renderByShape = (shape2) => {
|
|
11324
|
+
return shape2 === "button" ? renderButton() : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderIcon(), renderLabel());
|
|
11325
|
+
};
|
|
11281
11326
|
const renderRadioItem = () => {
|
|
11282
|
-
|
|
11283
|
-
return renderButton();
|
|
11284
|
-
}
|
|
11285
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderIcon(), renderLabel());
|
|
11327
|
+
return renderByShape(context && context.shape ? context.shape : shape);
|
|
11286
11328
|
};
|
|
11287
11329
|
const handleClick = (e2) => {
|
|
11288
11330
|
if (disabled || checkedStatement)
|
|
@@ -11624,7 +11666,8 @@ const defaultProps$P = {
|
|
|
11624
11666
|
uncheckedIcon: null,
|
|
11625
11667
|
disabled: false,
|
|
11626
11668
|
readOnly: false,
|
|
11627
|
-
allowHalf: false
|
|
11669
|
+
allowHalf: false,
|
|
11670
|
+
touchable: false
|
|
11628
11671
|
};
|
|
11629
11672
|
const Rate = (props) => {
|
|
11630
11673
|
const {
|
|
@@ -11639,13 +11682,17 @@ const Rate = (props) => {
|
|
|
11639
11682
|
disabled,
|
|
11640
11683
|
readOnly,
|
|
11641
11684
|
allowHalf,
|
|
11642
|
-
|
|
11685
|
+
touchable,
|
|
11686
|
+
onChange,
|
|
11687
|
+
onTouchEnd
|
|
11643
11688
|
} = {
|
|
11644
11689
|
...defaultProps$P,
|
|
11645
11690
|
...props
|
|
11646
11691
|
};
|
|
11647
11692
|
const classPrefix2 = "nut-rate";
|
|
11648
11693
|
const [countArray, setCountArray] = useState([1, 2, 3, 4, 5]);
|
|
11694
|
+
const [refs, setRefs] = useRefs();
|
|
11695
|
+
const rateRects = useRef([]);
|
|
11649
11696
|
const [score, setScore] = usePropsValue({
|
|
11650
11697
|
value,
|
|
11651
11698
|
defaultValue: Math.max(defaultValue || 0, min),
|
|
@@ -11682,8 +11729,70 @@ const Rate = (props) => {
|
|
|
11682
11729
|
const value2 = Math.max(min, n - 0.5);
|
|
11683
11730
|
setScore(value2);
|
|
11684
11731
|
};
|
|
11732
|
+
const getScoreByPosition = (x) => {
|
|
11733
|
+
var _a;
|
|
11734
|
+
if ((_a = rateRects.current) == null ? void 0 : _a.length) {
|
|
11735
|
+
for (let index = rateRects.current.length - 1; index >= 0; index--) {
|
|
11736
|
+
const item = rateRects.current[index];
|
|
11737
|
+
if (item && x > item.left) {
|
|
11738
|
+
return allowHalf ? index + (x > item.left + item.width / 2 ? 1 : 0.5) : index + 1;
|
|
11739
|
+
}
|
|
11740
|
+
}
|
|
11741
|
+
return 0;
|
|
11742
|
+
}
|
|
11743
|
+
};
|
|
11744
|
+
const updateRects = () => {
|
|
11745
|
+
for (let index = 0; index < refs.length; index++) {
|
|
11746
|
+
const item = refs[index];
|
|
11747
|
+
if (item) {
|
|
11748
|
+
getRectByTaro(item).then((res) => {
|
|
11749
|
+
rateRects.current[index] = res;
|
|
11750
|
+
});
|
|
11751
|
+
}
|
|
11752
|
+
}
|
|
11753
|
+
};
|
|
11754
|
+
useReady(() => {
|
|
11755
|
+
updateRects();
|
|
11756
|
+
});
|
|
11757
|
+
const handleTouchStart = (e2) => {
|
|
11758
|
+
if (!touchable || readOnly || disabled) {
|
|
11759
|
+
return;
|
|
11760
|
+
}
|
|
11761
|
+
if (e2.cancelable) {
|
|
11762
|
+
e2.preventDefault();
|
|
11763
|
+
}
|
|
11764
|
+
e2.stopPropagation();
|
|
11765
|
+
updateRects();
|
|
11766
|
+
};
|
|
11767
|
+
const handleTouchMove = (e2) => {
|
|
11768
|
+
if (!touchable || readOnly || disabled) {
|
|
11769
|
+
return;
|
|
11770
|
+
}
|
|
11771
|
+
if (e2.cancelable) {
|
|
11772
|
+
e2.preventDefault();
|
|
11773
|
+
}
|
|
11774
|
+
e2.stopPropagation();
|
|
11775
|
+
const val = getScoreByPosition(e2.touches[0].clientX);
|
|
11776
|
+
if (val !== void 0) {
|
|
11777
|
+
setScore(Math.max(min, val));
|
|
11778
|
+
}
|
|
11779
|
+
};
|
|
11780
|
+
const handleTouchEnd = (e2) => {
|
|
11781
|
+
if (!touchable || readOnly || disabled) {
|
|
11782
|
+
return;
|
|
11783
|
+
}
|
|
11784
|
+
if (e2.cancelable) {
|
|
11785
|
+
e2.preventDefault();
|
|
11786
|
+
}
|
|
11787
|
+
e2.stopPropagation();
|
|
11788
|
+
const val = getScoreByPosition(e2.changedTouches[0].clientX);
|
|
11789
|
+
if (val !== void 0) {
|
|
11790
|
+
setScore(Math.max(min, val));
|
|
11791
|
+
onTouchEnd && onTouchEnd(e2, Math.max(min, val));
|
|
11792
|
+
}
|
|
11793
|
+
};
|
|
11685
11794
|
return /* @__PURE__ */ React__default.createElement(
|
|
11686
|
-
|
|
11795
|
+
View,
|
|
11687
11796
|
{
|
|
11688
11797
|
className: classNames(
|
|
11689
11798
|
classPrefix2,
|
|
@@ -11693,14 +11802,20 @@ const Rate = (props) => {
|
|
|
11693
11802
|
},
|
|
11694
11803
|
className
|
|
11695
11804
|
),
|
|
11696
|
-
|
|
11805
|
+
catchMove: true,
|
|
11806
|
+
style,
|
|
11807
|
+
onTouchStart: handleTouchStart,
|
|
11808
|
+
onTouchMove: handleTouchMove,
|
|
11809
|
+
onTouchEnd: handleTouchEnd,
|
|
11810
|
+
onTouchCancel: handleTouchEnd
|
|
11697
11811
|
},
|
|
11698
|
-
countArray.map((n) => {
|
|
11812
|
+
countArray.map((n, index) => {
|
|
11699
11813
|
return /* @__PURE__ */ React__default.createElement(
|
|
11700
11814
|
"div",
|
|
11701
11815
|
{
|
|
11702
11816
|
className: `${classPrefix2}-item`,
|
|
11703
11817
|
key: n,
|
|
11818
|
+
ref: setRefs(index),
|
|
11704
11819
|
onClick: (event) => onClick(event, n)
|
|
11705
11820
|
},
|
|
11706
11821
|
/* @__PURE__ */ React__default.createElement(
|
|
@@ -14277,7 +14392,7 @@ const Popover = (props) => {
|
|
|
14277
14392
|
};
|
|
14278
14393
|
const getRectTaro = async (targetId2) => {
|
|
14279
14394
|
return new Promise((resolve) => {
|
|
14280
|
-
const query =
|
|
14395
|
+
const query = createSelectorQuery();
|
|
14281
14396
|
query.select(`#${targetId2}`) && query.select(`#${targetId2}`).boundingClientRect();
|
|
14282
14397
|
query.exec((res) => {
|
|
14283
14398
|
resolve(res[0]);
|
|
@@ -15713,7 +15828,7 @@ const CollapseItem = (props) => {
|
|
|
15713
15828
|
);
|
|
15714
15829
|
const getRect2 = (selector) => {
|
|
15715
15830
|
return new Promise((resolve) => {
|
|
15716
|
-
|
|
15831
|
+
createSelectorQuery().select(selector).boundingClientRect().exec((rect = []) => {
|
|
15717
15832
|
resolve(rect[0]);
|
|
15718
15833
|
});
|
|
15719
15834
|
});
|
|
@@ -16157,10 +16272,10 @@ const Ellipsis = (props) => {
|
|
|
16157
16272
|
const [contentCopy, setContentCopy] = useState(content);
|
|
16158
16273
|
const lineH = useRef(0);
|
|
16159
16274
|
const originHeight = useRef(0);
|
|
16160
|
-
const refRandomId = Math.random().toString(36).slice(-8);
|
|
16275
|
+
const refRandomId = useRef(Math.random().toString(36).slice(-8));
|
|
16161
16276
|
const widthRef = useRef("auto");
|
|
16162
|
-
|
|
16163
|
-
|
|
16277
|
+
const widthBase = useRef([14, 10, 7, 8.4, 10]);
|
|
16278
|
+
const symbolTextWidth = useRef(widthBase.current[0] * 0.7921);
|
|
16164
16279
|
const chineseReg = /^[\u4e00-\u9fa5]+$/;
|
|
16165
16280
|
const digitReg = /^[0-9]+$/;
|
|
16166
16281
|
const letterUpperReg = /^[A-Z]+$/;
|
|
@@ -16170,23 +16285,16 @@ const Ellipsis = (props) => {
|
|
|
16170
16285
|
width ? `${classPrefix$6}-width` : "",
|
|
16171
16286
|
className
|
|
16172
16287
|
);
|
|
16173
|
-
|
|
16174
|
-
setExceeded(false);
|
|
16175
|
-
setExpanded(false);
|
|
16288
|
+
useEffect(() => {
|
|
16176
16289
|
setContentCopy(content);
|
|
16177
16290
|
nextTick(() => {
|
|
16178
16291
|
getSymbolInfo();
|
|
16179
16292
|
getReference();
|
|
16180
16293
|
});
|
|
16181
|
-
};
|
|
16182
|
-
useReady(() => init());
|
|
16183
|
-
useEffect(
|
|
16184
|
-
() => init(),
|
|
16185
|
-
[content, lineH.current, maxHeight.current, originHeight.current]
|
|
16186
|
-
);
|
|
16294
|
+
}, [content]);
|
|
16187
16295
|
const getSymbolInfo = async () => {
|
|
16188
16296
|
const refe = await getRectByTaro(symbolContain == null ? void 0 : symbolContain.current);
|
|
16189
|
-
symbolTextWidth = refe.width ? Math.ceil(refe.width) : Math.ceil(widthBase[0] * 0.7921);
|
|
16297
|
+
symbolTextWidth.current = refe.width ? Math.ceil(refe.width) : Math.ceil(widthBase.current[0] * 0.7921);
|
|
16190
16298
|
};
|
|
16191
16299
|
const symbolText = () => {
|
|
16192
16300
|
if (direction === "end" || direction === "middle") {
|
|
@@ -16195,9 +16303,8 @@ const Ellipsis = (props) => {
|
|
|
16195
16303
|
return `${symbol}${expandText}${symbol}`;
|
|
16196
16304
|
};
|
|
16197
16305
|
const getReference = async () => {
|
|
16198
|
-
const element = root2.current;
|
|
16199
16306
|
const query = createSelectorQuery();
|
|
16200
|
-
query.select(
|
|
16307
|
+
query.select(`#root${refRandomId.current}`) && query.select(`#root${refRandomId.current}`).fields(
|
|
16201
16308
|
{
|
|
16202
16309
|
computedStyle: [
|
|
16203
16310
|
"width",
|
|
@@ -16220,7 +16327,7 @@ const Ellipsis = (props) => {
|
|
|
16220
16327
|
originHeight.current = pxToNumber(res.height);
|
|
16221
16328
|
widthRef.current = res.width;
|
|
16222
16329
|
const bsize = pxToNumber(res.fontSize);
|
|
16223
|
-
widthBase = [
|
|
16330
|
+
widthBase.current = [
|
|
16224
16331
|
bsize,
|
|
16225
16332
|
bsize * 0.72,
|
|
16226
16333
|
bsize * 0.53,
|
|
@@ -16291,7 +16398,7 @@ const Ellipsis = (props) => {
|
|
|
16291
16398
|
setContentCopy(newContent);
|
|
16292
16399
|
};
|
|
16293
16400
|
const tailorContent = (left2, right2, type4 = "") => {
|
|
16294
|
-
const threeDotWidth = symbolTextWidth;
|
|
16401
|
+
const threeDotWidth = symbolTextWidth.current;
|
|
16295
16402
|
const direc = direction === "middle" && type4 ? type4 : direction;
|
|
16296
16403
|
setExceeded(true);
|
|
16297
16404
|
let widthPart = -1;
|
|
@@ -16311,15 +16418,15 @@ const Ellipsis = (props) => {
|
|
|
16311
16418
|
while (widthPart < contentPartWidth) {
|
|
16312
16419
|
const zi = content[marking];
|
|
16313
16420
|
if (chineseReg.test(zi)) {
|
|
16314
|
-
widthPart = Number(widthPart + widthBase[0]);
|
|
16421
|
+
widthPart = Number(widthPart + widthBase.current[0]);
|
|
16315
16422
|
} else if (letterUpperReg.test(zi)) {
|
|
16316
|
-
widthPart = Number(widthPart + widthBase[1]);
|
|
16423
|
+
widthPart = Number(widthPart + widthBase.current[1]);
|
|
16317
16424
|
} else if (letterLowerReg.test(zi)) {
|
|
16318
|
-
widthPart = Number(widthPart + widthBase[2]);
|
|
16425
|
+
widthPart = Number(widthPart + widthBase.current[2]);
|
|
16319
16426
|
} else if (digitReg.test(zi)) {
|
|
16320
|
-
widthPart = Number(widthPart + widthBase[3]);
|
|
16427
|
+
widthPart = Number(widthPart + widthBase.current[3]);
|
|
16321
16428
|
} else {
|
|
16322
|
-
widthPart = Number(widthPart + widthBase[4]);
|
|
16429
|
+
widthPart = Number(widthPart + widthBase.current[4]);
|
|
16323
16430
|
}
|
|
16324
16431
|
cutoff = marking;
|
|
16325
16432
|
direc === "end" ? marking++ : marking--;
|
|
@@ -16353,20 +16460,22 @@ const Ellipsis = (props) => {
|
|
|
16353
16460
|
className: classes,
|
|
16354
16461
|
onClick: handleClick,
|
|
16355
16462
|
ref: root2,
|
|
16356
|
-
id: `root${refRandomId}`,
|
|
16463
|
+
id: `root${refRandomId.current}`,
|
|
16357
16464
|
...rest
|
|
16358
16465
|
},
|
|
16359
|
-
/* @__PURE__ */ React__default.createElement(
|
|
16360
|
-
|
|
16466
|
+
/* @__PURE__ */ React__default.createElement(View, null, !exceeded ? /* @__PURE__ */ React__default.createElement(
|
|
16467
|
+
View,
|
|
16361
16468
|
{
|
|
16362
16469
|
className: "nut-ellipsis-wordbreak",
|
|
16363
16470
|
style: {
|
|
16364
|
-
width: `${!Number.isNaN(Number(width)) ? `${width}px` : "auto"}
|
|
16471
|
+
width: `${!Number.isNaN(Number(width)) ? `${width}px` : "auto"}`,
|
|
16472
|
+
height: "20px",
|
|
16473
|
+
overflow: "hidden"
|
|
16365
16474
|
}
|
|
16366
16475
|
},
|
|
16367
16476
|
content
|
|
16368
|
-
) : null, exceeded && !expanded ? /* @__PURE__ */ React__default.createElement(
|
|
16369
|
-
|
|
16477
|
+
) : null, exceeded && !expanded ? /* @__PURE__ */ React__default.createElement(
|
|
16478
|
+
View,
|
|
16370
16479
|
{
|
|
16371
16480
|
className: "nut-ellipsis-wordbreak",
|
|
16372
16481
|
style: {
|
|
@@ -16388,8 +16497,8 @@ const Ellipsis = (props) => {
|
|
|
16388
16497
|
) : null,
|
|
16389
16498
|
((_c = ellipsis.current) == null ? void 0 : _c.tailing) && symbol,
|
|
16390
16499
|
(_d = ellipsis.current) == null ? void 0 : _d.tailing
|
|
16391
|
-
)
|
|
16392
|
-
|
|
16500
|
+
) : null, exceeded && expanded ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
16501
|
+
View,
|
|
16393
16502
|
{
|
|
16394
16503
|
style: {
|
|
16395
16504
|
width: `${!Number.isNaN(Number(width)) ? `${width}px` : "auto"}`
|
|
@@ -16408,20 +16517,20 @@ const Ellipsis = (props) => {
|
|
|
16408
16517
|
collapseText
|
|
16409
16518
|
) : null) : null)
|
|
16410
16519
|
), /* @__PURE__ */ React__default.createElement(
|
|
16411
|
-
|
|
16520
|
+
View,
|
|
16412
16521
|
{
|
|
16413
16522
|
className: "nut-ellipsis-copy",
|
|
16414
16523
|
ref: rootContain,
|
|
16415
|
-
id: `rootContain${refRandomId}`,
|
|
16524
|
+
id: `rootContain${refRandomId.current}`,
|
|
16416
16525
|
style: { width: `${widthRef}` }
|
|
16417
16526
|
},
|
|
16418
|
-
/* @__PURE__ */ React__default.createElement(
|
|
16527
|
+
/* @__PURE__ */ React__default.createElement(View, null, contentCopy)
|
|
16419
16528
|
), /* @__PURE__ */ React__default.createElement(
|
|
16420
|
-
|
|
16529
|
+
View,
|
|
16421
16530
|
{
|
|
16422
16531
|
className: "nut-ellipsis-copy",
|
|
16423
16532
|
ref: symbolContain,
|
|
16424
|
-
id: `symbolContain${refRandomId}`,
|
|
16533
|
+
id: `symbolContain${refRandomId.current}`,
|
|
16425
16534
|
style: { display: "inline" }
|
|
16426
16535
|
},
|
|
16427
16536
|
symbolText()
|
|
@@ -17120,7 +17229,7 @@ const Step = (props) => {
|
|
|
17120
17229
|
}
|
|
17121
17230
|
return `${classPrefix2}-icon`;
|
|
17122
17231
|
};
|
|
17123
|
-
return /* @__PURE__ */ React__default.createElement("div", { className: classes, ...restProps, onClick: handleClickStep }, /* @__PURE__ */ React__default.createElement(
|
|
17232
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: classes, ...restProps, onClick: handleClickStep }, /* @__PURE__ */ React__default.createElement(View, { className: "nut-step-head" }, /* @__PURE__ */ React__default.createElement(View, { className: "nut-step-line" }), /* @__PURE__ */ React__default.createElement(View, { className: renderIconClass() }, icon || !dot && /* @__PURE__ */ React__default.createElement("span", { className: "nut-step-inner" }, value))), (title || description) && /* @__PURE__ */ React__default.createElement(View, { className: "nut-step-main" }, /* @__PURE__ */ React__default.createElement("span", { className: "nut-step-title" }, title), description && /* @__PURE__ */ React__default.createElement("span", { className: "nut-step-description" }, description)));
|
|
17124
17233
|
};
|
|
17125
17234
|
Step.defaultProps = defaultProps$d;
|
|
17126
17235
|
Step.displayName = "NutStep";
|
|
@@ -17153,14 +17262,7 @@ const Steps = (props) => {
|
|
|
17153
17262
|
},
|
|
17154
17263
|
className
|
|
17155
17264
|
);
|
|
17156
|
-
return /* @__PURE__ */ React__default.createElement(DataContext.Provider, { value: parentSteps }, React__default.createElement(
|
|
17157
|
-
"div",
|
|
17158
|
-
{
|
|
17159
|
-
className: classes,
|
|
17160
|
-
...restProps
|
|
17161
|
-
},
|
|
17162
|
-
children
|
|
17163
|
-
));
|
|
17265
|
+
return /* @__PURE__ */ React__default.createElement(DataContext.Provider, { value: parentSteps }, /* @__PURE__ */ React__default.createElement("div", { className: classes, ...restProps }, children));
|
|
17164
17266
|
};
|
|
17165
17267
|
Steps.defaultProps = defaultProps$c;
|
|
17166
17268
|
Steps.displayName = "NutSteps";
|
|
@@ -17501,7 +17603,7 @@ const getTaroRectById = (id) => {
|
|
|
17501
17603
|
}
|
|
17502
17604
|
reject();
|
|
17503
17605
|
} else {
|
|
17504
|
-
const query =
|
|
17606
|
+
const query = createSelectorQuery();
|
|
17505
17607
|
query.select(`#${id}`).boundingClientRect().exec(function(rect) {
|
|
17506
17608
|
if (rect[0]) {
|
|
17507
17609
|
resolve(rect[0]);
|
|
@@ -17691,7 +17793,6 @@ const Tour = (props) => {
|
|
|
17691
17793
|
Tour.defaultProps = defaultProps$9;
|
|
17692
17794
|
Tour.displayName = "NutTour";
|
|
17693
17795
|
const defaultProps$8 = {
|
|
17694
|
-
...ComponentDefaults,
|
|
17695
17796
|
source: {
|
|
17696
17797
|
type: {},
|
|
17697
17798
|
src: ""
|
|
@@ -17713,6 +17814,7 @@ const Video = (props) => {
|
|
|
17713
17814
|
source,
|
|
17714
17815
|
options,
|
|
17715
17816
|
className,
|
|
17817
|
+
style,
|
|
17716
17818
|
onPlay,
|
|
17717
17819
|
onPause,
|
|
17718
17820
|
onPlayEnd,
|
|
@@ -17722,7 +17824,7 @@ const Video = (props) => {
|
|
|
17722
17824
|
...props
|
|
17723
17825
|
};
|
|
17724
17826
|
const classes = classNames(classPrefix$2, className);
|
|
17725
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
17827
|
+
return /* @__PURE__ */ React__default.createElement(View, { className: classes, style }, /* @__PURE__ */ React__default.createElement(
|
|
17726
17828
|
Video$1,
|
|
17727
17829
|
{
|
|
17728
17830
|
className: "nut-video-player",
|
|
@@ -17734,7 +17836,8 @@ const Video = (props) => {
|
|
|
17734
17836
|
src: source.src,
|
|
17735
17837
|
onPlay,
|
|
17736
17838
|
onPause,
|
|
17737
|
-
onEnded: onPlayEnd
|
|
17839
|
+
onEnded: onPlayEnd,
|
|
17840
|
+
...restProps
|
|
17738
17841
|
}
|
|
17739
17842
|
));
|
|
17740
17843
|
};
|
|
@@ -18587,7 +18690,7 @@ const AvatarCropper = (props) => {
|
|
|
18587
18690
|
useReady(() => {
|
|
18588
18691
|
if (showAlipayCanvas2D) {
|
|
18589
18692
|
const { canvasId } = canvasAll;
|
|
18590
|
-
|
|
18693
|
+
createSelectorQuery().select(`#${canvasId}`).node(({ node: canvas }) => {
|
|
18591
18694
|
canvas.width = state.displayWidth;
|
|
18592
18695
|
canvas.height = state.displayHeight;
|
|
18593
18696
|
setCanvasAll({ ...canvasAll, cropperCanvas: canvas });
|