@nutui/nutui-react-taro 2.3.2 → 2.3.3
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 +15 -0
- package/dist/esm/ActionSheet/style/style.css +1 -1
- package/dist/esm/Address.js +3 -3
- package/dist/esm/Audio/style/style.css +1 -1
- package/dist/esm/Button/style/style.css +1 -1
- package/dist/esm/Calendar.js +2 -2
- package/dist/esm/CalendarItem.js +1 -1
- package/dist/esm/Cascader.js +2 -2
- package/dist/esm/Checkbox/style/style.css +1 -1
- package/dist/esm/CountDown.js +2 -1
- package/dist/esm/DatePicker.js +3 -2
- package/dist/esm/Dialog/style/style.css +1 -1
- package/dist/esm/Empty.js +1 -1
- package/dist/esm/Form.js +1 -0
- package/dist/esm/InfiniteLoading.js +1 -1
- package/dist/esm/InputNumber.js +1 -1
- package/dist/esm/Menu/style/style.css +1 -1
- package/dist/esm/MenuItem/style/style.css +1 -1
- package/dist/esm/Picker.js +1 -1
- package/dist/esm/PullToRefresh.js +2 -1
- package/dist/esm/Radio/style/style.css +1 -1
- package/dist/esm/Tabbar.js +2 -2
- package/dist/esm/TabbarItem.js +1 -1
- package/dist/esm/Table/style/style.css +1 -1
- package/dist/esm/Table.js +1 -1
- package/dist/esm/Tabs.js +1 -1
- package/dist/esm/{address.taro-DwplktN_.js → address.taro-sTqrtuxC.js} +1 -1
- package/dist/esm/{calendar.taro-Tuy-Kr-q.js → calendar.taro-Kf91Qo5t.js} +1 -1
- package/dist/esm/{calendaritem.taro-22chQZnN.js → calendaritem.taro-G5BaVw8e.js} +9 -3
- package/dist/esm/{cascader.taro-gspYp5PT.js → cascader.taro-DYMZD6ik.js} +18 -4
- package/dist/esm/{countdown.taro-_7iZfeff.js → countdown.taro-rJngrZUZ.js} +1 -7
- package/dist/esm/{datepicker.taro-a2BIZNUH.js → datepicker.taro-7xNSgNRT.js} +53 -73
- package/dist/esm/{empty.taro-9bGPftO1.js → empty.taro-CE-H96el.js} +212 -220
- package/dist/esm/{infiniteloading.taro-cQRDXtbb.js → infiniteloading.taro-eSS7cIsT.js} +2 -2
- package/dist/esm/{inputnumber.taro-XcwIk4rB.js → inputnumber.taro-7QptygT3.js} +2 -2
- package/dist/esm/nutui-react.es.js +16 -15
- package/dist/esm/pad-zero-iY-0-oys.js +10 -0
- package/dist/esm/{picker.taro-4lJuJ4rX.js → picker.taro-pRzPNgyZ.js} +1 -1
- package/dist/esm/{pulltorefresh.taro-GxK5LBIE.js → pulltorefresh.taro-h0P58sPG.js} +12 -18
- package/dist/esm/{tabbar.taro-lM7-vxOz.js → tabbar.taro-QE0rjSKE.js} +13 -13
- package/dist/esm/{tabbaritem.taro-Q5uY6b9_.js → tabbaritem.taro-t9C07OYX.js} +23 -8
- package/dist/esm/table.taro-Zyemar_o.js +184 -0
- package/dist/esm/{tabs.taro-HezOZhRs.js → tabs.taro-uXbRqGVo.js} +22 -7
- package/dist/esm/types/src/packages/cascader/cascader.d.ts +4 -0
- package/dist/esm/types/src/packages/cascader/cascader.taro.d.ts +4 -0
- package/dist/esm/types/src/packages/configprovider/types.d.ts +1 -1
- package/dist/esm/types/src/packages/pulltorefresh/pulltorefresh.d.ts +1 -0
- package/dist/esm/types/src/packages/pulltorefresh/pulltorefresh.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/tabbar/context.d.ts +9 -0
- package/dist/esm/types/src/packages/tabbar/index.d.ts +1 -0
- package/dist/esm/types/src/packages/tabbar/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/tabbaritem/tabbaritem.d.ts +0 -5
- package/dist/esm/types/src/packages/tabbaritem/tabbaritem.taro.d.ts +0 -5
- package/dist/esm/types/src/packages/table/types.d.ts +2 -0
- package/dist/esm/types/src/packages/table/useTableSticky.d.ts +8 -0
- package/dist/esm/types/src/utils/is-date.d.ts +1 -0
- package/dist/esm/types/src/utils/pad-zero.d.ts +1 -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 +1525 -1463
- package/dist/nutui.react.umd.js +1534 -1472
- package/dist/packages/checkbox/checkbox.scss +3 -0
- package/dist/packages/menuitem/menuitem.scss +1 -1
- package/dist/packages/table/table.scss +82 -9
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/variables-jmapp.scss +9 -2
- package/dist/styles/variables.scss +10 -3
- package/dist/types/packages/cascader/cascader.d.ts +4 -0
- package/dist/types/packages/cascader/cascader.taro.d.ts +4 -0
- package/dist/types/packages/configprovider/types.d.ts +1 -1
- package/dist/types/packages/pulltorefresh/pulltorefresh.d.ts +1 -0
- package/dist/types/packages/pulltorefresh/pulltorefresh.taro.d.ts +7 -2
- package/dist/types/packages/tabbar/context.d.ts +9 -0
- package/dist/types/packages/tabbar/index.d.ts +1 -0
- package/dist/types/packages/tabbar/index.taro.d.ts +1 -0
- package/dist/types/packages/tabbaritem/tabbaritem.d.ts +0 -5
- package/dist/types/packages/tabbaritem/tabbaritem.taro.d.ts +0 -5
- package/dist/types/packages/table/types.d.ts +2 -0
- package/dist/types/packages/table/useTableSticky.d.ts +8 -0
- package/dist/types/utils/is-date.d.ts +1 -0
- package/dist/types/utils/pad-zero.d.ts +1 -0
- package/package.json +2 -2
- package/dist/esm/table.taro-NO-C8ayh.js +0 -109
|
@@ -58,10 +58,10 @@ const InfiniteLoading = (props) => {
|
|
|
58
58
|
isTouching.current = false;
|
|
59
59
|
};
|
|
60
60
|
const scrollAction = (e) => {
|
|
61
|
+
var _a;
|
|
62
|
+
scrollTop.current = (_a = e.target) == null ? void 0 : _a.scrollTop;
|
|
61
63
|
if (e.target.scrollTop <= 0) {
|
|
62
64
|
e.target.scrollTop = 0;
|
|
63
|
-
} else if (e.target.scrollTop >= scrollHeight.current) {
|
|
64
|
-
e.target.scrollTop = scrollHeight.current;
|
|
65
65
|
}
|
|
66
66
|
onScroll && onScroll(e.target.scrollTop);
|
|
67
67
|
};
|
|
@@ -180,13 +180,13 @@ const InputNumber = (props) => {
|
|
|
180
180
|
React__default.createElement(
|
|
181
181
|
"div",
|
|
182
182
|
{ className: "nut-input-minus" },
|
|
183
|
-
React__default.createElement(Minus, { className: iconMinusClasses, onClick: reduceNumber })
|
|
183
|
+
React__default.createElement(Minus, { className: iconMinusClasses, onClick: (e) => reduceNumber(e) })
|
|
184
184
|
),
|
|
185
185
|
React__default.createElement(React__default.Fragment, null, formatter ? React__default.createElement("input", { className: "nut-number-input", type: "text", min, max, disabled, readOnly, value: _checked, onInput: changeFormatValue, onBlur: burFormatValue, onFocus: focusValue }) : React__default.createElement("input", { className: "nut-number-input", type: "digit", min, max, disabled, readOnly, value: _checked, onInput: changeValue, onBlur: burValue, onFocus: focusValue })),
|
|
186
186
|
React__default.createElement(
|
|
187
187
|
"div",
|
|
188
188
|
{ className: "nut-input-add" },
|
|
189
|
-
React__default.createElement(Plus, { className: iconAddClasses, onClick: addNumber })
|
|
189
|
+
React__default.createElement(Plus, { className: iconAddClasses, onClick: (e) => addNumber(e) })
|
|
190
190
|
)
|
|
191
191
|
);
|
|
192
192
|
};
|
|
@@ -20,25 +20,25 @@ import { N } from "./navbar.taro-v0VHQWR4.js";
|
|
|
20
20
|
import { S as S4 } from "./sidenavbar.taro-J5SEKQIh.js";
|
|
21
21
|
import { S as S5 } from "./sidenavbaritem.taro-AxJNRAdi.js";
|
|
22
22
|
import { S as S6 } from "./subsidenavbar.taro-Zy52MDDG.js";
|
|
23
|
-
import { T } from "./tabbar.taro-
|
|
24
|
-
import { T as T2 } from "./tabbaritem.taro-
|
|
23
|
+
import { T } from "./tabbar.taro-QE0rjSKE.js";
|
|
24
|
+
import { T as T2 } from "./tabbaritem.taro-t9C07OYX.js";
|
|
25
25
|
import { T as T3 } from "./tabpane.taro-5k7wWimS.js";
|
|
26
|
-
import { T as T4 } from "./tabs.taro-
|
|
27
|
-
import { A } from "./address.taro-
|
|
28
|
-
import { C as C5 } from "./calendar.taro-
|
|
29
|
-
import { C as C6 } from "./calendaritem.taro-
|
|
26
|
+
import { T as T4 } from "./tabs.taro-uXbRqGVo.js";
|
|
27
|
+
import { A } from "./address.taro-sTqrtuxC.js";
|
|
28
|
+
import { C as C5 } from "./calendar.taro-Kf91Qo5t.js";
|
|
29
|
+
import { C as C6 } from "./calendaritem.taro-G5BaVw8e.js";
|
|
30
30
|
import { C as C7 } from "./calendarcard.taro-QStCLFET.js";
|
|
31
|
-
import { C as C8 } from "./cascader.taro-
|
|
31
|
+
import { C as C8 } from "./cascader.taro-DYMZD6ik.js";
|
|
32
32
|
import { C as C9, a } from "./checkbox.taro-doAmyAh6.js";
|
|
33
|
-
import { D as D2 } from "./datepicker.taro-
|
|
33
|
+
import { D as D2 } from "./datepicker.taro-7xNSgNRT.js";
|
|
34
34
|
import { default as default2 } from "./Form.js";
|
|
35
35
|
import { F as F2 } from "./formitem.taro-4ofczzxA.js";
|
|
36
36
|
import { I as I2 } from "./input.taro-8gs046AH.js";
|
|
37
|
-
import { I as I3 } from "./inputnumber.taro-
|
|
37
|
+
import { I as I3 } from "./inputnumber.taro-7QptygT3.js";
|
|
38
38
|
import { M } from "./menu.taro-ODwHYGFM.js";
|
|
39
39
|
import { M as M2 } from "./menuitem.taro-9nyTDLpt.js";
|
|
40
40
|
import { N as N2 } from "./numberkeyboard.taro-gJhSoXsl.js";
|
|
41
|
-
import { P } from "./picker.taro-
|
|
41
|
+
import { P } from "./picker.taro-pRzPNgyZ.js";
|
|
42
42
|
import { R as R2, a as a2 } from "./radio.taro-mZvB2wwi.js";
|
|
43
43
|
import { R as R3 } from "./range.taro-S6WTiP1X.js";
|
|
44
44
|
import { R as R4 } from "./rate.taro-ZkOVGSDs.js";
|
|
@@ -52,14 +52,14 @@ import { A as A2 } from "./actionsheet.taro-gfhQciJ4.js";
|
|
|
52
52
|
import { B as B3 } from "./badge.taro-993L861f.js";
|
|
53
53
|
import { B as B4 } from "./dialog.taro-UQN2mJZR.js";
|
|
54
54
|
import { D as D3 } from "./drag.taro-BwcleRuB.js";
|
|
55
|
-
import { E as E2 } from "./empty.taro-
|
|
56
|
-
import { I as I4 } from "./infiniteloading.taro-
|
|
55
|
+
import { E as E2 } from "./empty.taro-CE-H96el.js";
|
|
56
|
+
import { I as I4 } from "./infiniteloading.taro-eSS7cIsT.js";
|
|
57
57
|
import { L as L2 } from "./loading.taro-aHN6xLIT.js";
|
|
58
58
|
import { N as N3 } from "./noticebar.taro-bHnEzTvL.js";
|
|
59
59
|
import { N as N4 } from "./notify.taro-mA9KS8qh.js";
|
|
60
60
|
import { P as P2 } from "./popover.taro-N1dZfUxf.js";
|
|
61
61
|
import { P as P3 } from "./popup.taro-2FdJu1kg.js";
|
|
62
|
-
import { P as P4 } from "./pulltorefresh.taro-
|
|
62
|
+
import { P as P4 } from "./pulltorefresh.taro-h0P58sPG.js";
|
|
63
63
|
import { S as S11 } from "./skeleton.taro-Pg7WtP0e.js";
|
|
64
64
|
import { S as S12 } from "./swipe.taro-p2ONOq1o.js";
|
|
65
65
|
import { T as T6 } from "./toast.taro-xnEQSCDJ.js";
|
|
@@ -71,7 +71,7 @@ import { A as A6 } from "./avatargroup.taro-h6dpv6UX.js";
|
|
|
71
71
|
import { C as C10 } from "./circleprogress.taro-myZgamBw.js";
|
|
72
72
|
import { C as C11 } from "./collapse.taro-l21-Cvji.js";
|
|
73
73
|
import { C as C12 } from "./collapseitem.taro-9w-h_UP6.js";
|
|
74
|
-
import { C as C13 } from "./countdown.taro-
|
|
74
|
+
import { C as C13 } from "./countdown.taro-rJngrZUZ.js";
|
|
75
75
|
import { E as E3 } from "./ellipsis.taro-ov_C4kbs.js";
|
|
76
76
|
import { I as I5 } from "./imagepreview.taro-DKFWoFNy.js";
|
|
77
77
|
import { I as I6 } from "./indicator.taro-ZH6MICsS.js";
|
|
@@ -82,7 +82,7 @@ import { S as S13 } from "./step.taro-kCAQ4Q3-.js";
|
|
|
82
82
|
import { S as S14 } from "./steps.taro-n6BT6nWE.js";
|
|
83
83
|
import { default as default4 } from "./Swiper.js";
|
|
84
84
|
import { S as S15 } from "./swiperitem.taro-BC1CE0T-.js";
|
|
85
|
-
import { T as T7 } from "./table.taro-
|
|
85
|
+
import { T as T7 } from "./table.taro-Zyemar_o.js";
|
|
86
86
|
import { T as T8 } from "./tag.taro-5KC_wObY.js";
|
|
87
87
|
import { T as T9 } from "./tour.taro-_3C-szH1.js";
|
|
88
88
|
import { V } from "./video.taro-MDBF77xf.js";
|
|
@@ -112,6 +112,7 @@ import "./use-props-value-vKr0R0AX.js";
|
|
|
112
112
|
import "./use-force-update-0oEVD8Nr.js";
|
|
113
113
|
import "./raf-UzmDvMUW.js";
|
|
114
114
|
import "./date-nxKOxj5-.js";
|
|
115
|
+
import "./pad-zero-iY-0-oys.js";
|
|
115
116
|
import "./index-YvHA__3D.js";
|
|
116
117
|
import "./use-custom-event-XvsODK8c.js";
|
|
117
118
|
import "react-dom";
|
|
@@ -342,7 +342,7 @@ const InternalPicker = (props, ref) => {
|
|
|
342
342
|
};
|
|
343
343
|
useEffect(() => {
|
|
344
344
|
setInnerValue(innerValue !== selectedValue ? selectedValue : innerValue);
|
|
345
|
-
}, [innerVisible]);
|
|
345
|
+
}, [innerVisible, selectedValue]);
|
|
346
346
|
useEffect(() => {
|
|
347
347
|
if (innerVisible) {
|
|
348
348
|
init();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React__default, { useRef, useState } from "react";
|
|
2
2
|
import { View } from "@tarojs/components";
|
|
3
|
+
import { Loading, More } from "@nutui/icons-react-taro";
|
|
3
4
|
import { u as useConfig } from "./configprovider.taro-_wngOo0k.js";
|
|
4
5
|
import { u as useTouch } from "./use-touch-BUFdkOSA.js";
|
|
5
6
|
import { C as ComponentDefaults } from "./typings-buMpDfSR.js";
|
|
@@ -59,28 +60,21 @@ const PullToRefresh = (p) => {
|
|
|
59
60
|
const pullingRef = useRef(false);
|
|
60
61
|
const [status, setStatus] = useState("pulling");
|
|
61
62
|
const [height, setHeight] = useState(0);
|
|
62
|
-
const renderIcons = () => {
|
|
63
|
+
const renderIcons = (status2) => {
|
|
63
64
|
return React__default.createElement(
|
|
64
65
|
React__default.Fragment,
|
|
65
66
|
null,
|
|
66
|
-
React__default.createElement(
|
|
67
|
-
|
|
68
|
-
{ className: `${classPrefix}-head-content-icons` },
|
|
69
|
-
(status === "pulling" || status === "complete") && React__default.createElement(
|
|
70
|
-
"svg",
|
|
71
|
-
{ xmlns: "http://www.w3.org/2000/svg", width: "36", height: "26", viewBox: "0 0 36 26", fill: "none" },
|
|
72
|
-
React__default.createElement("path", { d: "M34.7243 10.965C32.842 8.94809 32.4297 5.92727 31.2018 4.90525C29.9738 3.88324 28.1722 5.51123 27.5089 6.46993C23.8429 3.88324 17.9809 4.00082 17.9809 4.00082C17.9809 4.00082 12.1458 3.88324 8.47083 6.46993C7.80754 5.51123 6.01488 3.88324 4.78691 4.90525C3.55894 5.92727 3.15559 8.94809 1.2733 10.965C-0.133943 12.4844 -0.250465 12.9276 0.323186 14.1305C0.887874 15.3334 4.40149 16.3283 6.88432 13.9496C7.21596 15.1887 10.0125 21.9991 17.9899 21.9991C25.9672 21.9991 28.7817 15.1887 29.1043 13.9496C31.5872 16.3283 35.1098 15.3334 35.6834 14.1305C36.2481 12.9276 36.1316 12.4844 34.7243 10.965Z", fill: "#8C8C8C" })
|
|
73
|
-
),
|
|
74
|
-
(status === "canRelease" || status === "refreshing") && React__default.createElement(
|
|
75
|
-
"svg",
|
|
76
|
-
{ xmlns: "http://www.w3.org/2000/svg", width: "36", height: "26", viewBox: "0 0 36 26", fill: "none" },
|
|
77
|
-
React__default.createElement("circle", { cx: "33", cy: "13", r: "3", fill: "#8C8C8C" }),
|
|
78
|
-
React__default.createElement("circle", { cx: "18", cy: "13", r: "3", fill: "#8C8C8C" }),
|
|
79
|
-
React__default.createElement("circle", { cx: "3", cy: "13", r: "3", fill: "#8C8C8C" })
|
|
80
|
-
)
|
|
81
|
-
)
|
|
67
|
+
(status2 === "pulling" || status2 === "complete") && React__default.createElement(Loading, null),
|
|
68
|
+
(status2 === "canRelease" || status2 === "refreshing") && React__default.createElement(More, null)
|
|
82
69
|
);
|
|
83
70
|
};
|
|
71
|
+
const renderStatusIcon = () => {
|
|
72
|
+
var _a;
|
|
73
|
+
if (props.renderIcon) {
|
|
74
|
+
return (_a = props.renderIcon) == null ? void 0 : _a.call(props, status);
|
|
75
|
+
}
|
|
76
|
+
return renderIcons(status);
|
|
77
|
+
};
|
|
84
78
|
const renderStatusText = () => {
|
|
85
79
|
var _a;
|
|
86
80
|
if (props.renderText) {
|
|
@@ -151,7 +145,7 @@ const PullToRefresh = (p) => {
|
|
|
151
145
|
React__default.createElement(
|
|
152
146
|
"div",
|
|
153
147
|
{ className: `${classPrefix}-head-content`, style: { height: headHeight } },
|
|
154
|
-
|
|
148
|
+
React__default.createElement("div", null, renderStatusIcon()),
|
|
155
149
|
React__default.createElement("div", null, renderStatusText())
|
|
156
150
|
)
|
|
157
151
|
),
|
|
@@ -2,7 +2,7 @@ import React__default from "react";
|
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import { C as ComponentDefaults } from "./typings-buMpDfSR.js";
|
|
4
4
|
import { u as usePropsValue } from "./use-props-value-vKr0R0AX.js";
|
|
5
|
-
import { T as TabbarItem } from "./tabbaritem.taro-
|
|
5
|
+
import { a as TabbarContext, T as TabbarItem } from "./tabbaritem.taro-t9C07OYX.js";
|
|
6
6
|
const defaultProps = {
|
|
7
7
|
...ComponentDefaults,
|
|
8
8
|
defaultValue: 0,
|
|
@@ -30,20 +30,20 @@ const Tabbar = (props) => {
|
|
|
30
30
|
{ className: classNames(classPrefix, {
|
|
31
31
|
[`${classPrefix}-fixed`]: fixed
|
|
32
32
|
}, className), style },
|
|
33
|
-
React__default.createElement(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
...child.props,
|
|
39
|
-
active: idx === selectIndex,
|
|
40
|
-
index: idx,
|
|
41
|
-
inactiveColor,
|
|
33
|
+
React__default.createElement(
|
|
34
|
+
"div",
|
|
35
|
+
{ className: `${classPrefix}-wrap` },
|
|
36
|
+
React__default.createElement(TabbarContext.Provider, { value: {
|
|
37
|
+
selectIndex,
|
|
42
38
|
activeColor,
|
|
39
|
+
inactiveColor,
|
|
43
40
|
handleClick: setSelectIndex
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
} }, React__default.Children.map(children, (child, index) => {
|
|
42
|
+
if (!React__default.isValidElement(child))
|
|
43
|
+
return null;
|
|
44
|
+
return React__default.cloneElement(child, { ...child.props, index });
|
|
45
|
+
}))
|
|
46
|
+
),
|
|
47
47
|
(fixed || safeArea) && React__default.createElement("div", { className: `${classPrefix}-safe-area` })
|
|
48
48
|
);
|
|
49
49
|
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import React__default from "react";
|
|
1
|
+
import React__default, { useContext } from "react";
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import { C as ComponentDefaults } from "./typings-buMpDfSR.js";
|
|
4
4
|
import { B as Badge } from "./badge.taro-993L861f.js";
|
|
5
|
+
const TabbarContext = React__default.createContext(null);
|
|
5
6
|
const defaultProps = {
|
|
6
7
|
...ComponentDefaults,
|
|
7
8
|
title: "",
|
|
8
9
|
icon: null,
|
|
9
|
-
active: false,
|
|
10
|
-
index: 0,
|
|
11
10
|
value: "",
|
|
12
11
|
dot: false,
|
|
13
12
|
max: 99,
|
|
@@ -15,10 +14,25 @@ const defaultProps = {
|
|
|
15
14
|
right: "5"
|
|
16
15
|
};
|
|
17
16
|
const TabbarItem = (props) => {
|
|
18
|
-
const
|
|
17
|
+
const ctx = useContext(TabbarContext);
|
|
18
|
+
const {
|
|
19
|
+
className,
|
|
20
|
+
style,
|
|
21
|
+
title,
|
|
22
|
+
icon,
|
|
23
|
+
value,
|
|
24
|
+
dot,
|
|
25
|
+
max,
|
|
26
|
+
top,
|
|
27
|
+
right,
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
index,
|
|
30
|
+
...rest
|
|
31
|
+
} = {
|
|
19
32
|
...defaultProps,
|
|
20
33
|
...props
|
|
21
34
|
};
|
|
35
|
+
const active = index === (ctx == null ? void 0 : ctx.selectIndex);
|
|
22
36
|
const classPrefix = "nut-tabbar-item";
|
|
23
37
|
const tabbarItemClass = classNames(classPrefix, {
|
|
24
38
|
[`${classPrefix}-active`]: active
|
|
@@ -33,12 +47,12 @@ const TabbarItem = (props) => {
|
|
|
33
47
|
max,
|
|
34
48
|
top,
|
|
35
49
|
right,
|
|
36
|
-
color: activeColor
|
|
50
|
+
color: ctx == null ? void 0 : ctx.activeColor
|
|
37
51
|
};
|
|
38
52
|
return React__default.createElement("div", { className: tabbarItemClass, style: {
|
|
39
|
-
color: active ? activeColor : inactiveColor,
|
|
53
|
+
color: active ? ctx == null ? void 0 : ctx.activeColor : ctx == null ? void 0 : ctx.inactiveColor,
|
|
40
54
|
...style
|
|
41
|
-
}, onClick: () => handleClick(index), ...rest }, icon ? React__default.createElement(
|
|
55
|
+
}, onClick: () => ctx == null ? void 0 : ctx.handleClick(index), ...rest }, icon ? React__default.createElement(
|
|
42
56
|
React__default.Fragment,
|
|
43
57
|
null,
|
|
44
58
|
React__default.createElement(
|
|
@@ -54,5 +68,6 @@ const TabbarItem = (props) => {
|
|
|
54
68
|
));
|
|
55
69
|
};
|
|
56
70
|
export {
|
|
57
|
-
TabbarItem as T
|
|
71
|
+
TabbarItem as T,
|
|
72
|
+
TabbarContext as a
|
|
58
73
|
};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import React__default, { useState, useEffect, useCallback, useRef } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { ArrowDown } from "@nutui/icons-react-taro";
|
|
4
|
+
import { u as useConfig } from "./configprovider.taro-_wngOo0k.js";
|
|
5
|
+
import { C as ComponentDefaults } from "./typings-buMpDfSR.js";
|
|
6
|
+
import { u as usePropsValue } from "./use-props-value-vKr0R0AX.js";
|
|
7
|
+
function useTableSticky(columns) {
|
|
8
|
+
const [isSticky, setIsSticky] = useState(false);
|
|
9
|
+
const [stickyColumnStyleMap, setStickyColumnStyleMap] = useState({});
|
|
10
|
+
const [stickyColumnClassMap, setStickyColumnClassMap] = useState({});
|
|
11
|
+
const [stickyLeftWidth, setStickyLeftWidth] = useState(0);
|
|
12
|
+
const [stickyRightWidth, setStickyRightWidth] = useState(0);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const leftColumns = columns.filter((item) => item.fixed === "left") || [];
|
|
15
|
+
const rightColumns = columns.filter((item) => item.fixed === "right") || [];
|
|
16
|
+
const middleColumns = columns.filter((item) => !item.fixed) || [];
|
|
17
|
+
const _columnStyleMap = {};
|
|
18
|
+
const _columnClassMap = {};
|
|
19
|
+
let _stickyLeftWidth = 0;
|
|
20
|
+
let _stickyRightWidth = 0;
|
|
21
|
+
leftColumns.forEach((curr, index) => {
|
|
22
|
+
leftColumns[index - 1] || {};
|
|
23
|
+
_columnStyleMap[curr.key] = {
|
|
24
|
+
left: _stickyLeftWidth || 0,
|
|
25
|
+
width: curr.width || "auto"
|
|
26
|
+
};
|
|
27
|
+
_columnClassMap[curr.key] = {
|
|
28
|
+
"nut-table-fixed-left": true,
|
|
29
|
+
"nut-table-fixed-left-last": index === leftColumns.length - 1
|
|
30
|
+
};
|
|
31
|
+
_stickyLeftWidth += curr.width || 0;
|
|
32
|
+
});
|
|
33
|
+
middleColumns.forEach((curr) => {
|
|
34
|
+
_columnStyleMap[curr.key] = {
|
|
35
|
+
width: curr.width || "auto"
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
for (let i = rightColumns.length - 1; i >= 0; i--) {
|
|
39
|
+
const curr = rightColumns[i];
|
|
40
|
+
rightColumns[i + 1] || {};
|
|
41
|
+
_columnStyleMap[curr.key] = {
|
|
42
|
+
right: _stickyRightWidth || 0,
|
|
43
|
+
width: curr.width || "auto"
|
|
44
|
+
};
|
|
45
|
+
_columnClassMap[curr.key] = {
|
|
46
|
+
"nut-table-fixed-right": true,
|
|
47
|
+
"nut-table-fixed-right-first": i === 0
|
|
48
|
+
};
|
|
49
|
+
_stickyRightWidth += curr.width || 0;
|
|
50
|
+
}
|
|
51
|
+
setIsSticky(leftColumns.length > 0 || rightColumns.length > 0);
|
|
52
|
+
setStickyColumnStyleMap(_columnStyleMap);
|
|
53
|
+
setStickyColumnClassMap(_columnClassMap);
|
|
54
|
+
setStickyLeftWidth(_stickyLeftWidth);
|
|
55
|
+
setStickyRightWidth(_stickyRightWidth);
|
|
56
|
+
}, [columns]);
|
|
57
|
+
const getStickyStyle = useCallback((key) => {
|
|
58
|
+
return stickyColumnStyleMap[key];
|
|
59
|
+
}, [stickyColumnStyleMap]);
|
|
60
|
+
const getStickyClass = useCallback((key) => {
|
|
61
|
+
return stickyColumnClassMap[key];
|
|
62
|
+
}, [stickyColumnClassMap]);
|
|
63
|
+
return {
|
|
64
|
+
isSticky,
|
|
65
|
+
stickyLeftWidth,
|
|
66
|
+
stickyRightWidth,
|
|
67
|
+
getStickyClass,
|
|
68
|
+
getStickyStyle
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const defaultProps = {
|
|
72
|
+
...ComponentDefaults,
|
|
73
|
+
columns: [],
|
|
74
|
+
data: [],
|
|
75
|
+
bordered: true,
|
|
76
|
+
striped: false,
|
|
77
|
+
noData: "",
|
|
78
|
+
sorterIcon: null,
|
|
79
|
+
showHeader: true
|
|
80
|
+
};
|
|
81
|
+
const Table = (props) => {
|
|
82
|
+
const { locale } = useConfig();
|
|
83
|
+
defaultProps.noData = locale.noData;
|
|
84
|
+
const { children, className, style, columns, data, bordered, summary, striped, noData, sorterIcon, showHeader, onSort, ...rest } = {
|
|
85
|
+
...defaultProps,
|
|
86
|
+
...props
|
|
87
|
+
};
|
|
88
|
+
const sortedMapping = useRef({});
|
|
89
|
+
const [innerValue, setValue] = usePropsValue({
|
|
90
|
+
defaultValue: data,
|
|
91
|
+
finalValue: []
|
|
92
|
+
});
|
|
93
|
+
const { isSticky, stickyLeftWidth, stickyRightWidth, getStickyClass, getStickyStyle } = useTableSticky(columns);
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
setValue(data);
|
|
96
|
+
}, [data]);
|
|
97
|
+
const classPrefix = "nut-table";
|
|
98
|
+
const headerClassPrefix = `${classPrefix}-main-head-tr`;
|
|
99
|
+
const bodyClassPrefix = `${classPrefix}-main-body-tr`;
|
|
100
|
+
const cls = classNames(classPrefix, className);
|
|
101
|
+
const handleSorterClick = (item) => {
|
|
102
|
+
if (item.sorter && !sortedMapping.current[item.key]) {
|
|
103
|
+
const copied = [...innerValue];
|
|
104
|
+
if (typeof item.sorter === "function") {
|
|
105
|
+
copied.sort(item.sorter);
|
|
106
|
+
} else if (item.sorter === "default") {
|
|
107
|
+
copied.sort();
|
|
108
|
+
}
|
|
109
|
+
sortedMapping.current[item.key] = true;
|
|
110
|
+
setValue(copied, true);
|
|
111
|
+
onSort && onSort(item, copied);
|
|
112
|
+
} else {
|
|
113
|
+
sortedMapping.current[item.key] = false;
|
|
114
|
+
setValue(data);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
const cellClasses = (item) => {
|
|
118
|
+
return {
|
|
119
|
+
[`${headerClassPrefix}-border`]: props.bordered,
|
|
120
|
+
[`${headerClassPrefix}-align${item.align ? item.align : ""}`]: true
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
const getColumnItem = (value) => {
|
|
124
|
+
return columns.filter((item) => item.key === value)[0];
|
|
125
|
+
};
|
|
126
|
+
const renderHeadCells = () => {
|
|
127
|
+
return columns.map((item, index) => {
|
|
128
|
+
return React__default.createElement(
|
|
129
|
+
"div",
|
|
130
|
+
{ className: classNames(`${headerClassPrefix}-th`, cellClasses(item), getStickyClass(item.key)), key: item.key, onClick: () => handleSorterClick(item), style: getStickyStyle(item.key) },
|
|
131
|
+
item.title,
|
|
132
|
+
" ",
|
|
133
|
+
item.sorter && (sorterIcon || React__default.createElement(ArrowDown, { width: "12px", height: "12px" }))
|
|
134
|
+
);
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
const sortDataItem = () => {
|
|
138
|
+
return columns.map((columns2) => {
|
|
139
|
+
return [columns2.key, columns2.render];
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
const renderBodyTds = (item, rowIndex) => {
|
|
143
|
+
return sortDataItem().map(([value, render]) => {
|
|
144
|
+
return React__default.createElement("div", { className: classNames(`${bodyClassPrefix}-td`, cellClasses(getColumnItem(value)), getStickyClass(value)), key: value, style: getStickyStyle(value) }, typeof item[value] === "function" || typeof render === "function" ? React__default.createElement("div", null, render ? render(item, rowIndex) : item[value](item)) : item[value]);
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
const renderBodyTrs = () => {
|
|
148
|
+
return innerValue.map((item, index) => {
|
|
149
|
+
return React__default.createElement("div", { className: bodyClassPrefix, key: index }, renderBodyTds(item, index));
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
return React__default.createElement(
|
|
153
|
+
"div",
|
|
154
|
+
{ className: cls, ...rest },
|
|
155
|
+
React__default.createElement(
|
|
156
|
+
"div",
|
|
157
|
+
{ className: classNames(`${classPrefix}-wrapper`), style },
|
|
158
|
+
React__default.createElement(
|
|
159
|
+
"div",
|
|
160
|
+
{ className: classNames(`${classPrefix}-main`, {
|
|
161
|
+
[`${classPrefix}-main-striped`]: striped
|
|
162
|
+
}) },
|
|
163
|
+
showHeader && React__default.createElement(
|
|
164
|
+
"div",
|
|
165
|
+
{ className: `${classPrefix}-main-head` },
|
|
166
|
+
React__default.createElement("div", { className: headerClassPrefix }, renderHeadCells())
|
|
167
|
+
),
|
|
168
|
+
React__default.createElement("div", { className: `${classPrefix}-main-body` }, renderBodyTrs())
|
|
169
|
+
)
|
|
170
|
+
),
|
|
171
|
+
isSticky ? React__default.createElement(
|
|
172
|
+
React__default.Fragment,
|
|
173
|
+
null,
|
|
174
|
+
React__default.createElement("div", { className: `${classPrefix}-sticky-left`, style: { width: stickyLeftWidth } }),
|
|
175
|
+
React__default.createElement("div", { className: `${classPrefix}-sticky-right`, style: { width: stickyRightWidth } })
|
|
176
|
+
) : null,
|
|
177
|
+
(summary || innerValue.length === 0) && React__default.createElement("div", { className: `${classPrefix}-summary` }, summary || noData)
|
|
178
|
+
);
|
|
179
|
+
};
|
|
180
|
+
Table.defaultProps = defaultProps;
|
|
181
|
+
Table.displayName = "NutTable";
|
|
182
|
+
export {
|
|
183
|
+
Table as T
|
|
184
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React__default, {
|
|
1
|
+
import React__default, { useRef, useState, useEffect } from "react";
|
|
2
2
|
import { View, ScrollView } from "@tarojs/components";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import { JoySmile } from "@nutui/icons-react-taro";
|
|
@@ -8,10 +8,24 @@ import { T as TabPane } from "./tabpane.taro-5k7wWimS.js";
|
|
|
8
8
|
import { u as usePropsValue } from "./use-props-value-vKr0R0AX.js";
|
|
9
9
|
import { u as useForceUpdate } from "./use-force-update-0oEVD8Nr.js";
|
|
10
10
|
import { r as requestAniFrame } from "./raf-UzmDvMUW.js";
|
|
11
|
+
const idCounter = {};
|
|
12
|
+
function uniqueId(prefix = "$nut$") {
|
|
13
|
+
if (!idCounter[prefix]) {
|
|
14
|
+
idCounter[prefix] = 0;
|
|
15
|
+
}
|
|
16
|
+
const id = ++idCounter[prefix];
|
|
17
|
+
if (prefix === "$nut$") {
|
|
18
|
+
return `${id}`;
|
|
19
|
+
}
|
|
20
|
+
return `${prefix}${id}`;
|
|
21
|
+
}
|
|
22
|
+
function useUuid() {
|
|
23
|
+
const idRef = useRef(uniqueId());
|
|
24
|
+
return idRef.current;
|
|
25
|
+
}
|
|
11
26
|
const defaultProps = {
|
|
12
27
|
...ComponentDefaults,
|
|
13
28
|
tabStyle: {},
|
|
14
|
-
name: "",
|
|
15
29
|
activeColor: "",
|
|
16
30
|
direction: "horizontal",
|
|
17
31
|
activeType: "line",
|
|
@@ -24,6 +38,7 @@ const Tabs = (props) => {
|
|
|
24
38
|
...defaultProps,
|
|
25
39
|
...props
|
|
26
40
|
};
|
|
41
|
+
const uuid = useUuid();
|
|
27
42
|
const [value, setValue] = usePropsValue({
|
|
28
43
|
value: props.value,
|
|
29
44
|
defaultValue: props.defaultValue,
|
|
@@ -110,16 +125,16 @@ const Tabs = (props) => {
|
|
|
110
125
|
animate();
|
|
111
126
|
};
|
|
112
127
|
const scrollIntoView = () => {
|
|
113
|
-
if (!name)
|
|
114
|
-
return;
|
|
115
128
|
requestAniFrame(() => {
|
|
116
129
|
Promise.all([
|
|
117
|
-
getRect(`#nut-tabs-titles-${name} .nut-tabs-list`),
|
|
118
|
-
getAllRect(`#nut-tabs-titles-${name} .nut-tabs-titles-item`)
|
|
130
|
+
getRect(`#nut-tabs-titles-${name || uuid} .nut-tabs-list`),
|
|
131
|
+
getAllRect(`#nut-tabs-titles-${name || uuid} .nut-tabs-titles-item`)
|
|
119
132
|
]).then(([navRect, titleRects]) => {
|
|
120
133
|
navRectRef.current = navRect;
|
|
121
134
|
titleRectRef.current = titleRects;
|
|
122
135
|
const titleRect = titleRectRef.current[value];
|
|
136
|
+
if (!titleRect)
|
|
137
|
+
return;
|
|
123
138
|
let to = 0;
|
|
124
139
|
if (props.direction === "vertical") {
|
|
125
140
|
const DEFAULT_PADDING = 11;
|
|
@@ -157,7 +172,7 @@ const Tabs = (props) => {
|
|
|
157
172
|
{ className: classes, ...rest },
|
|
158
173
|
React__default.createElement(
|
|
159
174
|
ScrollView,
|
|
160
|
-
{ enableFlex: true, scrollX: direction === "horizontal", scrollY: direction === "vertical", scrollLeft, scrollTop, showScrollbar: false, scrollWithAnimation: scrollWithAnimation.current, id: `nut-tabs-titles-${name}`, className: classesTitle, style: { ...tabStyle } },
|
|
175
|
+
{ enableFlex: true, scrollX: direction === "horizontal", scrollY: direction === "vertical", scrollLeft, scrollTop, showScrollbar: false, scrollWithAnimation: scrollWithAnimation.current, id: `nut-tabs-titles-${name || uuid}`, className: classesTitle, style: { ...tabStyle } },
|
|
161
176
|
React__default.createElement(View, { className: "nut-tabs-list", ref: navRef }, !!title && typeof title === "function" ? title() : titles.current.map((item, index) => {
|
|
162
177
|
return React__default.createElement(
|
|
163
178
|
View,
|
|
@@ -20,6 +20,10 @@ export interface CascaderProps extends Pick<PopupProps, 'className' | 'style' |
|
|
|
20
20
|
onChange: (value: CascaderValue, params?: any) => void;
|
|
21
21
|
onPathChange: (value: CascaderValue, params: any) => void;
|
|
22
22
|
}
|
|
23
|
+
export type CascaderActions = {
|
|
24
|
+
open: () => void;
|
|
25
|
+
close: () => void;
|
|
26
|
+
};
|
|
23
27
|
export declare const Cascader: React.ForwardRefExoticComponent<Partial<CascaderProps> & {
|
|
24
28
|
children?: React.ReactNode;
|
|
25
29
|
} & React.RefAttributes<unknown>>;
|
|
@@ -20,6 +20,10 @@ export interface CascaderProps extends Pick<PopupProps, 'className' | 'style' |
|
|
|
20
20
|
onChange: (value: CascaderValue, params?: any) => void;
|
|
21
21
|
onPathChange: (value: CascaderValue, params: any) => void;
|
|
22
22
|
}
|
|
23
|
+
export type CascaderActions = {
|
|
24
|
+
open: () => void;
|
|
25
|
+
close: () => void;
|
|
26
|
+
};
|
|
23
27
|
export declare const Cascader: React.ForwardRefExoticComponent<Partial<CascaderProps> & {
|
|
24
28
|
children?: React.ReactNode;
|
|
25
29
|
} & React.RefAttributes<unknown>>;
|