@nutui/nutui-react-taro 2.3.12 → 2.4.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/CHANGELOG.md +30 -0
- package/dist/esm/Address.js +1 -1
- package/dist/esm/AnimatingNumbers/style/style.css +1 -1
- package/dist/esm/Badge/style/style.css +1 -1
- package/dist/esm/Badge.js +1 -1
- package/dist/esm/Cascader.js +1 -1
- package/dist/esm/Checkbox/style/style.css +1 -1
- package/dist/esm/Checkbox.js +1 -1
- package/dist/esm/CheckboxGroup/style/style.css +1 -1
- package/dist/esm/CheckboxGroup.js +1 -1
- package/dist/esm/Collapse/style/style.css +1 -1
- package/dist/esm/CollapseItem/style/style.css +1 -1
- package/dist/esm/CountDown.js +1 -1
- package/dist/esm/DatePicker.js +1 -1
- package/dist/esm/Dialog/style/style.css +1 -1
- package/dist/esm/Dialog.js +1 -1
- package/dist/esm/InputNumber/style/style.css +1 -1
- package/dist/esm/InputNumber.js +1 -1
- package/dist/esm/NoticeBar/style/style.css +1 -1
- package/dist/esm/NoticeBar.js +1 -1
- package/dist/esm/Popover/style/style.css +1 -1
- package/dist/esm/Popover.js +1 -1
- package/dist/esm/Swipe/style/style.css +1 -1
- package/dist/esm/Tabbar/style/style.css +1 -1
- package/dist/esm/Tabbar.js +1 -1
- package/dist/esm/TabbarItem/style/style.css +1 -1
- package/dist/esm/TabbarItem.js +1 -1
- package/dist/esm/Table.js +1 -1
- package/dist/esm/Tabs.js +1 -1
- package/dist/esm/Toast.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/VirtualList.js +1 -1
- package/dist/esm/{address.taro-DjlXNWie.js → address.taro-CgkCHDYZ.js} +1 -1
- package/dist/esm/{badge.taro-CyDqBb9Z.js → badge.taro-D7Yn5zJi.js} +4 -1
- package/dist/esm/{cascader.taro-CpofskUL.js → cascader.taro-BMp2mI0W.js} +1 -1
- package/dist/esm/{checkbox.taro-D9F_HM7f.js → checkbox.taro-CUpF7Afr.js} +23 -5
- package/dist/esm/{countdown.taro-Dfa9kpmZ.js → countdown.taro-D-H9erkV.js} +1 -1
- package/dist/esm/{datepicker.taro-DshCn7Rn.js → datepicker.taro-DqR52Ivo.js} +1 -1
- package/dist/esm/{dialog.taro-xsQhsC1V.js → dialog.taro-Dk0QQMn_.js} +14 -6
- package/dist/esm/{inputnumber.taro-F3jNGr_V.js → inputnumber.taro-CQiAPZgS.js} +1 -1
- package/dist/esm/{noticebar.taro-CMdfOp2g.js → noticebar.taro-CRPbZenq.js} +26 -21
- package/dist/esm/nutui-react.es.js +18 -18
- package/dist/esm/{popover.taro-CcKwnX27.js → popover.taro-BsOaXoWp.js} +8 -6
- package/dist/esm/{tabbar.taro-8_SmJofa.js → tabbar.taro-LAPQoOva.js} +1 -1
- package/dist/esm/{tabbaritem.taro-Cb-yfOln.js → tabbaritem.taro-C4AZbQMG.js} +1 -1
- package/dist/esm/{table.taro-0BcEBB0F.js → table.taro-ClLmfqz3.js} +8 -7
- package/dist/esm/{tabs.taro-HgAoKBAc.js → tabs.taro-DRmZR3Xu.js} +5 -5
- package/dist/esm/{toast.taro-BIR_7Wgb.js → toast.taro-BVXqvjNJ.js} +3 -3
- package/dist/esm/{tour.taro-CMagdKcp.js → tour.taro-wfXuUebD.js} +1 -1
- package/dist/esm/types/src/packages/cell/demo.d.ts +0 -1
- package/dist/esm/types/src/packages/cell/demo.taro.d.ts +0 -1
- package/dist/esm/types/src/packages/cell/demos/h5/demo1.d.ts +3 -0
- package/dist/esm/types/src/packages/cell/demos/h5/demo2.d.ts +3 -0
- package/dist/esm/types/src/packages/cell/demos/h5/demo3.d.ts +3 -0
- package/dist/esm/types/src/packages/cell/demos/h5/demo4.d.ts +3 -0
- package/dist/esm/types/src/packages/cell/demos/h5/demo5.d.ts +3 -0
- package/dist/esm/types/src/packages/cell/demos/h5/demo6.d.ts +3 -0
- package/dist/esm/types/src/packages/cell/demos/h5/demo7.d.ts +3 -0
- package/dist/esm/types/src/packages/cell/demos/taro/demo1.d.ts +3 -0
- package/dist/esm/types/src/packages/cell/demos/taro/demo2.d.ts +3 -0
- package/dist/esm/types/src/packages/cell/demos/taro/demo3.d.ts +3 -0
- package/dist/esm/types/src/packages/cell/demos/taro/demo4.d.ts +3 -0
- package/dist/esm/types/src/packages/cell/demos/taro/demo5.d.ts +3 -0
- package/dist/esm/types/src/packages/cell/demos/taro/demo6.d.ts +3 -0
- package/dist/esm/types/src/packages/cell/demos/taro/demo7.d.ts +3 -0
- package/dist/esm/types/src/packages/checkboxgroup/checkboxgroup.d.ts +1 -0
- package/dist/esm/types/src/packages/checkboxgroup/checkboxgroup.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/checkboxgroup/context.d.ts +1 -0
- package/dist/esm/types/src/packages/configprovider/types.d.ts +1 -1
- package/dist/esm/types/src/packages/dialog/config.d.ts +3 -3
- package/dist/esm/types/src/packages/dialog/index.d.ts +1 -1
- package/dist/esm/types/src/packages/noticebar/index.d.ts +1 -0
- package/dist/esm/types/src/packages/noticebar/noticebar.d.ts +2 -0
- package/dist/esm/types/src/packages/noticebar/noticebar.taro.d.ts +2 -0
- package/dist/esm/types/src/packages/noticebar/types.d.ts +1 -0
- package/dist/esm/types/src/packages/popover/index.d.ts +2 -1
- package/dist/esm/types/src/packages/popover/index.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/popover/popover.d.ts +2 -12
- package/dist/esm/types/src/packages/popover/popover.taro.d.ts +2 -12
- package/dist/esm/types/src/packages/popover/types.d.ts +14 -0
- package/dist/esm/types/src/packages/table/useTableSticky.d.ts +1 -1
- package/dist/esm/types/src/packages/toast/toast.taro.d.ts +7 -3
- package/dist/esm/types/src/packages/tour/tour.d.ts +1 -1
- package/dist/esm/types/src/packages/tour/tour.taro.d.ts +1 -1
- package/dist/esm/{uploader.taro-CuaIVvya.js → uploader.taro-DdJ-sOK4.js} +2 -2
- package/dist/esm/{virtuallist.taro-C5vZAyza.js → virtuallist.taro-Cl08vfdg.js} +5 -4
- 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 +99 -51
- package/dist/nutui.react.umd.js +99 -51
- package/dist/packages/animatingnumbers/countup.scss +1 -0
- package/dist/packages/badge/badge.scss +2 -0
- package/dist/packages/checkbox/checkbox.scss +19 -0
- package/dist/packages/checkboxgroup/checkboxgroup.scss +25 -0
- package/dist/packages/collapseitem/collapseitem.scss +1 -6
- package/dist/packages/dialog/dialog.scss +8 -1
- package/dist/packages/noticebar/noticebar.scss +19 -1
- package/dist/packages/popover/popover.scss +21 -0
- package/dist/packages/swipe/swipe.scss +2 -0
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/variables-jmapp.scss +13 -0
- package/dist/styles/variables.scss +19 -12
- package/dist/types/index.d.ts +98 -98
- package/dist/types/packages/actionsheet/actionsheet.d.ts +1 -1
- package/dist/types/packages/actionsheet/actionsheet.taro.d.ts +1 -1
- package/dist/types/packages/address/address.d.ts +1 -1
- package/dist/types/packages/address/address.taro.d.ts +1 -1
- package/dist/types/packages/address/customRender.d.ts +1 -1
- package/dist/types/packages/address/customRender.taro.d.ts +1 -1
- package/dist/types/packages/avatar/avatar.d.ts +1 -1
- package/dist/types/packages/avatar/avatar.taro.d.ts +1 -1
- package/dist/types/packages/badge/badge.taro.d.ts +1 -1
- package/dist/types/packages/calendaritem/calendaritem.d.ts +1 -1
- package/dist/types/packages/calendaritem/calendaritem.taro.d.ts +1 -1
- package/dist/types/packages/cascader/cascader.d.ts +1 -1
- package/dist/types/packages/cascader/cascader.taro.d.ts +1 -1
- package/dist/types/packages/cell/cell.d.ts +1 -1
- package/dist/types/packages/cell/cell.taro.d.ts +1 -1
- package/dist/types/packages/cell/demos/h5/demo1.d.ts +3 -0
- package/dist/types/packages/cell/demos/h5/demo2.d.ts +3 -0
- package/dist/types/packages/cell/demos/h5/demo3.d.ts +3 -0
- package/dist/types/packages/cell/demos/h5/demo4.d.ts +3 -0
- package/dist/types/packages/cell/demos/h5/demo5.d.ts +3 -0
- package/dist/types/packages/cell/demos/h5/demo6.d.ts +3 -0
- package/dist/types/packages/cell/demos/h5/demo7.d.ts +3 -0
- package/dist/types/packages/cell/demos/taro/demo1.d.ts +3 -0
- package/dist/types/packages/cell/demos/taro/demo2.d.ts +3 -0
- package/dist/types/packages/cell/demos/taro/demo3.d.ts +3 -0
- package/dist/types/packages/cell/demos/taro/demo4.d.ts +3 -0
- package/dist/types/packages/cell/demos/taro/demo5.d.ts +3 -0
- package/dist/types/packages/cell/demos/taro/demo6.d.ts +3 -0
- package/dist/types/packages/cell/demos/taro/demo7.d.ts +3 -0
- package/dist/types/packages/checkbox/checkbox.d.ts +2 -2
- package/dist/types/packages/checkbox/checkbox.taro.d.ts +2 -2
- package/dist/types/packages/checkboxgroup/checkboxgroup.d.ts +3 -2
- package/dist/types/packages/checkboxgroup/checkboxgroup.taro.d.ts +3 -2
- package/dist/types/packages/checkboxgroup/context.d.ts +1 -0
- package/dist/types/packages/configprovider/types.d.ts +1 -1
- package/dist/types/packages/datepicker/datepicker.d.ts +1 -1
- package/dist/types/packages/datepicker/datepicker.taro.d.ts +1 -1
- package/dist/types/packages/dialog/config.d.ts +3 -3
- package/dist/types/packages/dialog/dialogwrap.d.ts +1 -1
- package/dist/types/packages/dialog/index.d.ts +1 -1
- package/dist/types/packages/empty/empty.d.ts +1 -1
- package/dist/types/packages/fixednav/fixednav.d.ts +1 -1
- package/dist/types/packages/fixednav/fixednav.taro.d.ts +1 -1
- package/dist/types/packages/form/form.d.ts +1 -1
- package/dist/types/packages/form/form.taro.d.ts +1 -1
- package/dist/types/packages/form/index.d.ts +1 -1
- package/dist/types/packages/form/index.taro.d.ts +1 -1
- package/dist/types/packages/menu/menu.d.ts +1 -1
- package/dist/types/packages/menu/menu.taro.d.ts +1 -1
- package/dist/types/packages/noticebar/index.d.ts +1 -0
- package/dist/types/packages/noticebar/noticebar.d.ts +2 -0
- package/dist/types/packages/noticebar/noticebar.taro.d.ts +6 -0
- package/dist/types/packages/noticebar/types.d.ts +1 -0
- package/dist/types/packages/numberkeyboard/numberkeyboard.d.ts +1 -1
- package/dist/types/packages/numberkeyboard/numberkeyboard.taro.d.ts +1 -1
- package/dist/types/packages/nutui.react.build.d.ts +98 -98
- package/dist/types/packages/nutui.react.d.ts +98 -98
- package/dist/types/packages/nutui.react.taro.d.ts +98 -98
- package/dist/types/packages/picker/picker.d.ts +1 -1
- package/dist/types/packages/picker/picker.taro.d.ts +1 -1
- package/dist/types/packages/popover/index.d.ts +2 -1
- package/dist/types/packages/popover/index.taro.d.ts +2 -1
- package/dist/types/packages/popover/popover.d.ts +3 -13
- package/dist/types/packages/popover/popover.taro.d.ts +3 -13
- package/dist/types/packages/popover/types.d.ts +14 -0
- package/dist/types/packages/popup/popup.d.ts +1 -1
- package/dist/types/packages/popup/popup.taro.d.ts +1 -1
- package/dist/types/packages/radio/radio.d.ts +2 -2
- package/dist/types/packages/radio/radio.taro.d.ts +2 -2
- package/dist/types/packages/shortpassword/shortpassword.d.ts +1 -1
- package/dist/types/packages/shortpassword/shortpassword.taro.d.ts +1 -1
- package/dist/types/packages/swiper/index.d.ts +1 -1
- package/dist/types/packages/swiper/index.taro.d.ts +1 -1
- package/dist/types/packages/table/useTableSticky.d.ts +1 -1
- package/dist/types/packages/tabs/tabs.d.ts +1 -1
- package/dist/types/packages/tabs/tabs.taro.d.ts +1 -1
- package/dist/types/packages/timedetail/timedetail.d.ts +1 -1
- package/dist/types/packages/timedetail/timedetail.taro.d.ts +1 -1
- package/dist/types/packages/toast/toast.taro.d.ts +8 -4
- package/dist/types/packages/tour/tour.d.ts +1 -1
- package/dist/types/packages/tour/tour.taro.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React__default from "react";
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
|
|
4
|
+
import { a as useRtl } from "./configprovider.taro-CyU_tvNJ.js";
|
|
4
5
|
const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { value: "", dot: false, max: 99, top: "4", right: "8", color: "" });
|
|
5
6
|
const Badge = (props) => {
|
|
6
7
|
var _a;
|
|
8
|
+
const rtl = useRtl();
|
|
7
9
|
const { className, style, value, max, children, dot, top, right, color } = Object.assign(Object.assign({}, defaultProps), props);
|
|
8
10
|
const classPrefix = "nut-badge";
|
|
9
11
|
const classes = classNames(classPrefix, className);
|
|
@@ -33,7 +35,8 @@ const Badge = (props) => {
|
|
|
33
35
|
const getStyle = () => {
|
|
34
36
|
const style2 = {};
|
|
35
37
|
style2.top = `${Number(top) || parseFloat(String(top)) || 0}px`;
|
|
36
|
-
|
|
38
|
+
const dir = rtl ? "left" : "right";
|
|
39
|
+
style2[dir] = `${Number(right) || parseFloat(String(right)) || 0}px`;
|
|
37
40
|
style2.background = color;
|
|
38
41
|
return style2;
|
|
39
42
|
};
|
|
@@ -4,7 +4,7 @@ import classNames from "classnames";
|
|
|
4
4
|
import { Loading, Checklist } from "@nutui/icons-react-taro";
|
|
5
5
|
import { ScrollView } from "@tarojs/components";
|
|
6
6
|
import { P as Popup } from "./popup.taro-Iy_WQZ-m.js";
|
|
7
|
-
import { T as Tabs } from "./tabs.taro-
|
|
7
|
+
import { T as Tabs } from "./tabs.taro-DRmZR3Xu.js";
|
|
8
8
|
import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
|
|
9
9
|
import { u as usePropsValue } from "./use-props-value-SH9krhkx.js";
|
|
10
10
|
const formatTree = (tree, parent, config) => tree.map((node) => {
|
|
@@ -2,6 +2,7 @@ import { _ as __rest } from "./tslib.es6-BZ8i9Q6l.js";
|
|
|
2
2
|
import React__default, { createContext, useImperativeHandle, useCallback, useContext, useState, useEffect } from "react";
|
|
3
3
|
import { CheckDisabled, Checked, CheckNormal } from "@nutui/icons-react-taro";
|
|
4
4
|
import classNames from "classnames";
|
|
5
|
+
import { View } from "@tarojs/components";
|
|
5
6
|
import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
|
|
6
7
|
import { u as usePropsValue } from "./use-props-value-SH9krhkx.js";
|
|
7
8
|
const CheckboxGroupContext = createContext(null);
|
|
@@ -9,6 +10,7 @@ const Context = CheckboxGroupContext;
|
|
|
9
10
|
const defaultProps$1 = {
|
|
10
11
|
max: void 0,
|
|
11
12
|
min: void 0,
|
|
13
|
+
list: false,
|
|
12
14
|
labelPosition: "right",
|
|
13
15
|
direction: "vertical",
|
|
14
16
|
onChange: (value) => {
|
|
@@ -19,7 +21,7 @@ const defaultProps$1 = {
|
|
|
19
21
|
};
|
|
20
22
|
const classPrefix$1 = "nut-checkboxgroup";
|
|
21
23
|
const CheckboxGroup = React__default.forwardRef((props, ref) => {
|
|
22
|
-
const _a = Object.assign(Object.assign({}, defaultProps$1), props), { children, className, disabled, onChange, value, defaultValue, max, min, onLimit, labelPosition, direction, options } = _a, rest = __rest(_a, ["children", "className", "disabled", "onChange", "value", "defaultValue", "max", "min", "onLimit", "labelPosition", "direction", "options"]);
|
|
24
|
+
const _a = Object.assign(Object.assign({}, defaultProps$1), props), { children, className, disabled, list, onChange, value, defaultValue, max, min, onLimit, labelPosition, direction, options } = _a, rest = __rest(_a, ["children", "className", "disabled", "list", "onChange", "value", "defaultValue", "max", "min", "onLimit", "labelPosition", "direction", "options"]);
|
|
23
25
|
useImperativeHandle(ref, () => ({
|
|
24
26
|
toggle(state) {
|
|
25
27
|
if (state === false) {
|
|
@@ -61,6 +63,7 @@ const CheckboxGroup = React__default.forwardRef((props, ref) => {
|
|
|
61
63
|
labelPosition: labelPosition || "right",
|
|
62
64
|
disabled,
|
|
63
65
|
max,
|
|
66
|
+
list,
|
|
64
67
|
onLimit,
|
|
65
68
|
value: _value,
|
|
66
69
|
check: (value2) => {
|
|
@@ -81,7 +84,8 @@ const CheckboxGroup = React__default.forwardRef((props, ref) => {
|
|
|
81
84
|
}
|
|
82
85
|
} },
|
|
83
86
|
React__default.createElement("div", Object.assign({ className: classNames(classPrefix$1, {
|
|
84
|
-
[`nut-checkboxgroup-${props.direction}`]: props.direction
|
|
87
|
+
[`nut-checkboxgroup-${props.direction}`]: props.direction,
|
|
88
|
+
[`nut-checkboxgroup-list`]: list
|
|
85
89
|
}, className) }, rest), (options === null || options === void 0 ? void 0 : options.length) ? renderOptions() : children)
|
|
86
90
|
);
|
|
87
91
|
});
|
|
@@ -148,6 +152,9 @@ const Checkbox = (props) => {
|
|
|
148
152
|
if (innerChecked && !innerIndeterminate) {
|
|
149
153
|
return `${cls}${classPrefix}-icon-checked ${classPrefix}-icon-disabled`;
|
|
150
154
|
}
|
|
155
|
+
if (innerChecked && innerIndeterminate) {
|
|
156
|
+
return `${cls}${classPrefix}-icon-indeterminate ${classPrefix}-icon-disabled`;
|
|
157
|
+
}
|
|
151
158
|
return `${cls}${classPrefix}-icon-disabled`;
|
|
152
159
|
}
|
|
153
160
|
if (innerChecked) {
|
|
@@ -171,16 +178,27 @@ const Checkbox = (props) => {
|
|
|
171
178
|
};
|
|
172
179
|
const renderButton = () => {
|
|
173
180
|
return React__default.createElement(
|
|
174
|
-
|
|
181
|
+
View,
|
|
175
182
|
{ className: classNames(`${classPrefix}-button`, {
|
|
176
183
|
[`${classPrefix}-button-active`]: innerChecked,
|
|
177
184
|
[`${classPrefix}-button-disabled`]: disabled
|
|
178
185
|
}) },
|
|
179
186
|
children || label,
|
|
180
|
-
innerChecked && activeIcon ? React__default.createElement(
|
|
187
|
+
innerChecked && activeIcon ? React__default.createElement(View, { className: classNames(`${classPrefix}-button-icon`) }, activeIcon) : null
|
|
188
|
+
);
|
|
189
|
+
};
|
|
190
|
+
const renderListItem = () => {
|
|
191
|
+
return React__default.createElement(
|
|
192
|
+
View,
|
|
193
|
+
{ className: "nut-checkbox-list-item" },
|
|
194
|
+
renderLabel(),
|
|
195
|
+
renderIcon()
|
|
181
196
|
);
|
|
182
197
|
};
|
|
183
198
|
const renderCheckboxItem = () => {
|
|
199
|
+
if (ctx === null || ctx === void 0 ? void 0 : ctx.list) {
|
|
200
|
+
return React__default.createElement(React__default.Fragment, null, renderListItem());
|
|
201
|
+
}
|
|
184
202
|
if (shape === "button") {
|
|
185
203
|
return renderButton();
|
|
186
204
|
}
|
|
@@ -191,7 +209,7 @@ const Checkbox = (props) => {
|
|
|
191
209
|
renderLabel()
|
|
192
210
|
);
|
|
193
211
|
};
|
|
194
|
-
return React__default.createElement(
|
|
212
|
+
return React__default.createElement(View, Object.assign({ className: classNames(classPrefix, {
|
|
195
213
|
[`${classPrefix}-reverse`]: labelPosition === "left"
|
|
196
214
|
}, className) }, rest, { onClick: handleClick }), renderCheckboxItem());
|
|
197
215
|
};
|
|
@@ -25,7 +25,7 @@ const InternalCountDown = (props, ref) => {
|
|
|
25
25
|
if (!timeStr)
|
|
26
26
|
return Date.now();
|
|
27
27
|
let t = timeStr;
|
|
28
|
-
t = t > 0 ? +t : t.toString().replace(/-/g, "/");
|
|
28
|
+
t = Number(t) > 0 ? +t : t.toString().replace(/-/g, "/");
|
|
29
29
|
return new Date(t).getTime();
|
|
30
30
|
};
|
|
31
31
|
const initTime = () => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { a as __awaiter } from "./tslib.es6-BZ8i9Q6l.js";
|
|
2
|
+
import React__default, { useState } from "react";
|
|
2
3
|
import classNames from "classnames";
|
|
3
4
|
import { CSSTransition } from "react-transition-group";
|
|
4
5
|
import { View } from "@tarojs/components";
|
|
@@ -63,6 +64,7 @@ const defaultProps = {
|
|
|
63
64
|
const BaseDialog = (props) => {
|
|
64
65
|
const classPrefix = "nut-dialog";
|
|
65
66
|
const { locale } = useConfig();
|
|
67
|
+
const [loading, setLoading] = useState(false);
|
|
66
68
|
const { params: { id, className, style, visible, footer, title, header, content, children, footerDirection, hideConfirmButton, hideCancelButton, lockScroll, disableConfirmButton, closeOnOverlayClick, onOverlayClick, confirmText, cancelText, overlay, closeIconPosition, closeIcon, onClose, onCancel, onConfirm, beforeCancel, beforeClose }, setParams } = useParams(Object.assign(Object.assign({}, defaultProps), props));
|
|
67
69
|
useCustomEvent(id, ({ status, options }) => {
|
|
68
70
|
if (status) {
|
|
@@ -84,18 +86,24 @@ const BaseDialog = (props) => {
|
|
|
84
86
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
85
87
|
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
86
88
|
};
|
|
87
|
-
const handleOk = (e) => {
|
|
89
|
+
const handleOk = (e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
88
90
|
e.stopPropagation();
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
setLoading(true);
|
|
92
|
+
try {
|
|
93
|
+
yield onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm(e);
|
|
94
|
+
setLoading(false);
|
|
95
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
96
|
+
} catch (_a) {
|
|
97
|
+
setLoading(false);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
92
100
|
return footer || React__default.createElement(
|
|
93
101
|
React__default.Fragment,
|
|
94
102
|
null,
|
|
95
103
|
!hideCancelButton && React__default.createElement(Button, { type: "default", className: `${classPrefix}-footer-cancel`, onClick: (e) => handleCancel(e) }, cancelText || locale.cancel),
|
|
96
104
|
!hideConfirmButton && React__default.createElement(Button, { type: "primary", className: classNames(`${classPrefix}-footer-ok`, {
|
|
97
105
|
disabled: disableConfirmButton
|
|
98
|
-
}), disabled: disableConfirmButton, onClick: (e) => handleOk(e) }, confirmText || locale.confirm)
|
|
106
|
+
}), disabled: disableConfirmButton, onClick: (e) => handleOk(e), loading }, confirmText || locale.confirm)
|
|
99
107
|
);
|
|
100
108
|
};
|
|
101
109
|
const renderCloseIcon = () => {
|
|
@@ -72,7 +72,7 @@ const InputNumber = (props) => {
|
|
|
72
72
|
const shouldOverBoundary = calcNextValue(shadowValue, step, negative ? -1 : 1);
|
|
73
73
|
const nextValue = bound(shouldOverBoundary, Number(min), Number(max));
|
|
74
74
|
setShadowValue(nextValue);
|
|
75
|
-
if (negative ? shouldOverBoundary < min : shouldOverBoundary > max) {
|
|
75
|
+
if (negative ? shouldOverBoundary < Number(min) : shouldOverBoundary > Number(max)) {
|
|
76
76
|
onOverlimit === null || onOverlimit === void 0 ? void 0 : onOverlimit(e);
|
|
77
77
|
} else {
|
|
78
78
|
onChange === null || onChange === void 0 ? void 0 : onChange(nextValue, e);
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { a as __awaiter } from "./tslib.es6-BZ8i9Q6l.js";
|
|
2
2
|
import React__default, { useRef, useState, useMemo, useEffect } from "react";
|
|
3
|
+
import { View } from "@tarojs/components";
|
|
3
4
|
import { Notice, Close } from "@nutui/icons-react-taro";
|
|
4
5
|
import classNames from "classnames";
|
|
5
6
|
import { g as getRectByTaro } from "./get-rect-by-taro-CSN0TGnD.js";
|
|
6
7
|
import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
|
|
7
|
-
|
|
8
|
+
import { a as useRtl } from "./configprovider.taro-CyU_tvNJ.js";
|
|
9
|
+
const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { align: "left", direction: "horizontal", list: [], duration: 1e3, height: 40, content: "", closeable: false, wrap: false, leftIcon: React__default.createElement(Notice, { size: 16 }), rightIcon: null, delay: 1, scrollable: null, speed: 50 });
|
|
8
10
|
const NoticeBar = (props) => {
|
|
9
|
-
const
|
|
11
|
+
const rtl = useRtl();
|
|
12
|
+
const { children, className, style, align, direction, list, duration, height, content, closeable, wrap, leftIcon, rightIcon, delay, scrollable, speed, close, click, onClose, onClick, onItemClick } = Object.assign(Object.assign({}, defaultProps), props);
|
|
10
13
|
const classPrefix = "nut-noticebar";
|
|
11
14
|
const wrapRef = useRef(null);
|
|
12
15
|
const contentRef = useRef(null);
|
|
@@ -92,7 +95,7 @@ const NoticeBar = (props) => {
|
|
|
92
95
|
const contentRes = yield getRectByTaro(contentRef.current);
|
|
93
96
|
const wrapW = warpRes.width;
|
|
94
97
|
const offsetW = contentRes.width;
|
|
95
|
-
const canScroll = scrollable == null ? offsetW > wrapW : scrollable;
|
|
98
|
+
const canScroll = align === "left" && scrollable == null ? offsetW > wrapW : scrollable;
|
|
96
99
|
SetIsCanScroll(canScroll);
|
|
97
100
|
if (canScroll) {
|
|
98
101
|
SetWrapWidth(wrapW);
|
|
@@ -143,7 +146,7 @@ const NoticeBar = (props) => {
|
|
|
143
146
|
onClose && onClose(event);
|
|
144
147
|
};
|
|
145
148
|
const isEllipsis = () => {
|
|
146
|
-
if (isCanScroll == null) {
|
|
149
|
+
if (isCanScroll == null && align === "left") {
|
|
147
150
|
return wrap;
|
|
148
151
|
}
|
|
149
152
|
return !isCanScroll && !wrap;
|
|
@@ -151,7 +154,7 @@ const NoticeBar = (props) => {
|
|
|
151
154
|
const contentStyle = {
|
|
152
155
|
animationDelay: `${firstRound ? delay : 0}s`,
|
|
153
156
|
animationDuration: `${animationDuration}s`,
|
|
154
|
-
transform: `translateX(${firstRound ? 0 : `${wrapWidth}px`})`
|
|
157
|
+
transform: `translateX(${firstRound ? 0 : `${rtl ? -wrapWidth : wrapWidth}px`})`
|
|
155
158
|
};
|
|
156
159
|
const barStyle = {
|
|
157
160
|
height: isVertical ? `${height}px` : ""
|
|
@@ -294,50 +297,52 @@ const NoticeBar = (props) => {
|
|
|
294
297
|
}
|
|
295
298
|
};
|
|
296
299
|
const noticebarClass = classNames({
|
|
297
|
-
|
|
298
|
-
[
|
|
300
|
+
[`${classPrefix}-box`]: true,
|
|
301
|
+
[`${classPrefix}-box-wrapable`]: wrap,
|
|
302
|
+
[`${classPrefix}-box-${align}`]: true
|
|
299
303
|
});
|
|
304
|
+
const cls = classNames(classPrefix, className);
|
|
300
305
|
useEffect(() => {
|
|
301
306
|
return () => {
|
|
302
307
|
stopAutoPlay();
|
|
303
308
|
};
|
|
304
309
|
}, []);
|
|
305
310
|
return React__default.createElement(
|
|
306
|
-
|
|
307
|
-
{ className:
|
|
311
|
+
View,
|
|
312
|
+
{ className: cls, style },
|
|
308
313
|
showNoticeBar && direction === "horizontal" ? React__default.createElement(
|
|
309
|
-
|
|
314
|
+
View,
|
|
310
315
|
{ className: noticebarClass, style: barStyle, onClick: handleClick },
|
|
311
|
-
leftIcon ? React__default.createElement(
|
|
316
|
+
leftIcon ? React__default.createElement(View, { className: "nut-noticebar-box-left-icon" }, leftIcon) : null,
|
|
312
317
|
React__default.createElement(
|
|
313
|
-
|
|
318
|
+
View,
|
|
314
319
|
{ ref: wrapRef, className: "nut-noticebar-box-wrap" },
|
|
315
320
|
React__default.createElement(
|
|
316
|
-
|
|
321
|
+
View,
|
|
317
322
|
{ ref: contentRef, className: `nut-noticebar-box-wrap-content ${animationClass} ${isEllipsis() ? "nut-ellipsis" : ""}`, style: contentStyle, onAnimationEnd },
|
|
318
323
|
children,
|
|
319
324
|
content
|
|
320
325
|
)
|
|
321
326
|
),
|
|
322
|
-
closeable || rightIcon ? React__default.createElement(
|
|
327
|
+
closeable || rightIcon ? React__default.createElement(View, { className: "nut-noticebar-box-right-icon", onClick: onClickIcon }, rightIcon || React__default.createElement(Close, { size: 12 })) : null
|
|
323
328
|
) : null,
|
|
324
329
|
showNoticeBar && scrollList.current.length > 0 && isVertical ? React__default.createElement(
|
|
325
|
-
|
|
330
|
+
View,
|
|
326
331
|
{ className: "nut-noticebar-vertical", style: barStyle, ref: container, onClick: handleClick },
|
|
327
|
-
leftIcon ? React__default.createElement(
|
|
328
|
-
children ? React__default.createElement(
|
|
329
|
-
return React__default.createElement(
|
|
332
|
+
leftIcon ? React__default.createElement(View, { className: "nut-noticebar-box-left-icon" }, leftIcon) : null,
|
|
333
|
+
children ? React__default.createElement(View, { className: "nut-noticebar-box-wrap", ref: innerRef }, scrollList.current.map((item, index) => {
|
|
334
|
+
return React__default.createElement(View, { style: itemStyle(index), key: index, onClick: (e) => {
|
|
330
335
|
handleItemClick(e, item);
|
|
331
336
|
} }, item);
|
|
332
|
-
})) : React__default.createElement(
|
|
337
|
+
})) : React__default.createElement(View, { className: "nut-noticebar-box-horseLamp-list", style: horseLampStyle }, scrollList.current.map((item, index) => {
|
|
333
338
|
return (
|
|
334
339
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
335
|
-
React__default.createElement(
|
|
340
|
+
React__default.createElement(View, { className: "nut-noticebar-box-horseLamp-list-item", style: { height }, key: index, onClick: (e) => {
|
|
336
341
|
handleItemClick(e, item);
|
|
337
342
|
} }, item)
|
|
338
343
|
);
|
|
339
344
|
})),
|
|
340
|
-
React__default.createElement(
|
|
345
|
+
React__default.createElement(View, { className: "nut-noticebar-box-right-icon", onClick: (e) => {
|
|
341
346
|
handleClickIcon(e);
|
|
342
347
|
} }, rightIcon || (closeable ? React__default.createElement(Close, { size: 12 }) : null))
|
|
343
348
|
) : null
|
|
@@ -20,21 +20,21 @@ import { N } from "./navbar.taro-B8u3DOE4.js";
|
|
|
20
20
|
import { S as S4 } from "./sidenavbar.taro-eK5vaZPR.js";
|
|
21
21
|
import { S as S5 } from "./sidenavbaritem.taro-L7HbsCLn.js";
|
|
22
22
|
import { S as S6 } from "./subsidenavbar.taro-ByxYpgfP.js";
|
|
23
|
-
import { T } from "./tabbar.taro-
|
|
24
|
-
import { T as T2 } from "./tabbaritem.taro-
|
|
23
|
+
import { T } from "./tabbar.taro-LAPQoOva.js";
|
|
24
|
+
import { T as T2 } from "./tabbaritem.taro-C4AZbQMG.js";
|
|
25
25
|
import { T as T3 } from "./tabpane.taro-BAe86j3t.js";
|
|
26
|
-
import { T as T4 } from "./tabs.taro-
|
|
27
|
-
import { A } from "./address.taro-
|
|
26
|
+
import { T as T4 } from "./tabs.taro-DRmZR3Xu.js";
|
|
27
|
+
import { A } from "./address.taro-CgkCHDYZ.js";
|
|
28
28
|
import { C as C5 } from "./calendar.taro-DbHJEx4G.js";
|
|
29
29
|
import { C as C6 } from "./calendaritem.taro-B8tN2DYa.js";
|
|
30
30
|
import { C as C7 } from "./calendarcard.taro-BHGCq5zX.js";
|
|
31
|
-
import { C as C8 } from "./cascader.taro-
|
|
32
|
-
import { C as C9, a } from "./checkbox.taro-
|
|
33
|
-
import { D as D2 } from "./datepicker.taro-
|
|
31
|
+
import { C as C8 } from "./cascader.taro-BMp2mI0W.js";
|
|
32
|
+
import { C as C9, a } from "./checkbox.taro-CUpF7Afr.js";
|
|
33
|
+
import { D as D2 } from "./datepicker.taro-DqR52Ivo.js";
|
|
34
34
|
import { default as default2 } from "./Form.js";
|
|
35
35
|
import { F as F2 } from "./formitem.taro-Brz5dj_8.js";
|
|
36
36
|
import { I as I2 } from "./input.taro-BVC8gEuk.js";
|
|
37
|
-
import { I as I3 } from "./inputnumber.taro-
|
|
37
|
+
import { I as I3 } from "./inputnumber.taro-CQiAPZgS.js";
|
|
38
38
|
import { M } from "./menu.taro-BAiJPGR7.js";
|
|
39
39
|
import { M as M2 } from "./menuitem.taro-oLv6ZYC5.js";
|
|
40
40
|
import { N as N2 } from "./numberkeyboard.taro-B9rMgy7D.js";
|
|
@@ -47,22 +47,22 @@ import { S as S8 } from "./shortpassword.taro-BXsxku33.js";
|
|
|
47
47
|
import { S as S9 } from "./signature.taro-KPm_xs66.js";
|
|
48
48
|
import { S as S10 } from "./switch.taro-D1HgJoJz.js";
|
|
49
49
|
import { T as T5 } from "./textarea.taro-BJIFCpKb.js";
|
|
50
|
-
import { U } from "./uploader.taro-
|
|
50
|
+
import { U } from "./uploader.taro-DdJ-sOK4.js";
|
|
51
51
|
import { A as A2 } from "./actionsheet.taro-C5BqWoML.js";
|
|
52
|
-
import { B as B3 } from "./badge.taro-
|
|
53
|
-
import { B as B4 } from "./dialog.taro-
|
|
52
|
+
import { B as B3 } from "./badge.taro-D7Yn5zJi.js";
|
|
53
|
+
import { B as B4 } from "./dialog.taro-Dk0QQMn_.js";
|
|
54
54
|
import { D as D3 } from "./drag.taro-CcHIO07Y.js";
|
|
55
55
|
import { E as E2 } from "./empty.taro-Brkv6B2Z.js";
|
|
56
56
|
import { I as I4 } from "./infiniteloading.taro-Ccq4bEzk.js";
|
|
57
57
|
import { L as L2 } from "./loading.taro-CRF1z5wQ.js";
|
|
58
|
-
import { N as N3 } from "./noticebar.taro-
|
|
58
|
+
import { N as N3 } from "./noticebar.taro-CRPbZenq.js";
|
|
59
59
|
import { N as N4 } from "./notify.taro-jP7y9zMU.js";
|
|
60
|
-
import { P as P2 } from "./popover.taro-
|
|
60
|
+
import { P as P2 } from "./popover.taro-BsOaXoWp.js";
|
|
61
61
|
import { P as P3 } from "./popup.taro-Iy_WQZ-m.js";
|
|
62
62
|
import { P as P4 } from "./pulltorefresh.taro-BJdQj5sL.js";
|
|
63
63
|
import { S as S11 } from "./skeleton.taro-BwIDIf2p.js";
|
|
64
64
|
import { S as S12 } from "./swipe.taro-wm7YWwaj.js";
|
|
65
|
-
import { T as T6 } from "./toast.taro-
|
|
65
|
+
import { T as T6 } from "./toast.taro-BVXqvjNJ.js";
|
|
66
66
|
import { A as A3 } from "./animate.taro-Dg9jxZEu.js";
|
|
67
67
|
import { default as default3 } from "./AnimatingNumbers.js";
|
|
68
68
|
import { A as A4 } from "./audio.taro-DXxWGngO.js";
|
|
@@ -71,7 +71,7 @@ import { A as A6 } from "./avatargroup.taro-bpT5kPbf.js";
|
|
|
71
71
|
import { C as C10 } from "./circleprogress.taro-CKSrzt8Q.js";
|
|
72
72
|
import { C as C11 } from "./collapse.taro-BM0BsN30.js";
|
|
73
73
|
import { C as C12 } from "./collapseitem.taro-D_m4VEdG.js";
|
|
74
|
-
import { C as C13 } from "./countdown.taro-
|
|
74
|
+
import { C as C13 } from "./countdown.taro-D-H9erkV.js";
|
|
75
75
|
import { E as E3 } from "./ellipsis.taro-B_mTyNyk.js";
|
|
76
76
|
import { I as I5 } from "./imagepreview.taro-Bb1TkBCV.js";
|
|
77
77
|
import { I as I6 } from "./indicator.taro-CpHZtD9p.js";
|
|
@@ -82,11 +82,11 @@ import { S as S13 } from "./step.taro-DLr2GzYk.js";
|
|
|
82
82
|
import { S as S14 } from "./steps.taro-C8Yg1Sns.js";
|
|
83
83
|
import { default as default4 } from "./Swiper.js";
|
|
84
84
|
import { S as S15 } from "./swiperitem.taro-8JXI24f0.js";
|
|
85
|
-
import { T as T7 } from "./table.taro-
|
|
85
|
+
import { T as T7 } from "./table.taro-ClLmfqz3.js";
|
|
86
86
|
import { T as T8 } from "./tag.taro-BsmY5QfN.js";
|
|
87
|
-
import { T as T9 } from "./tour.taro-
|
|
87
|
+
import { T as T9 } from "./tour.taro-wfXuUebD.js";
|
|
88
88
|
import { V } from "./video.taro-CEMVfhCS.js";
|
|
89
|
-
import { V as V2 } from "./virtuallist.taro-
|
|
89
|
+
import { V as V2 } from "./virtuallist.taro-Cl08vfdg.js";
|
|
90
90
|
import { B as B5 } from "./barrage.taro-BNOcZsJ1.js";
|
|
91
91
|
import { C as C14 } from "./card.taro-uLorQW97.js";
|
|
92
92
|
import { T as T10 } from "./timedetail.taro-x6Zey1xi.js";
|
|
@@ -5,13 +5,13 @@ import Taro, { createSelectorQuery } from "@tarojs/taro";
|
|
|
5
5
|
import { P as Popup } from "./popup.taro-Iy_WQZ-m.js";
|
|
6
6
|
import { a as getRect, g as getRectByTaro } from "./get-rect-by-taro-CSN0TGnD.js";
|
|
7
7
|
import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
|
|
8
|
-
const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { list: [], location: "bottom", visible: false, offset: [0, 12], arrowOffset: 0, targetId: "", className: "", showArrow: true,
|
|
8
|
+
const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { list: [], theme: "light", location: "bottom", visible: false, offset: [0, 12], arrowOffset: 0, targetId: "", className: "", showArrow: true, closeOnOutsideClick: true, closeOnActionClick: true, overlay: false, onClick: () => {
|
|
9
9
|
}, onOpen: () => {
|
|
10
10
|
}, onClose: () => {
|
|
11
11
|
} });
|
|
12
12
|
const classPrefix = `nut-popover`;
|
|
13
13
|
const Popover = (props) => {
|
|
14
|
-
const _a = Object.assign(Object.assign({}, defaultProps), props), { children, list, location, visible, offset, targetId, overlay, closeOnOutsideClick, closeOnActionClick, className, showArrow,
|
|
14
|
+
const _a = Object.assign(Object.assign({}, defaultProps), props), { children, list, theme, location, visible, offset, arrowOffset, targetId, overlay, closeOnOutsideClick, closeOnActionClick, className, showArrow, style, onClick, onOpen, onClose, onSelect } = _a, rest = __rest(_a, ["children", "list", "theme", "location", "visible", "offset", "arrowOffset", "targetId", "overlay", "closeOnOutsideClick", "closeOnActionClick", "className", "showArrow", "style", "onClick", "onOpen", "onClose", "onSelect"]);
|
|
15
15
|
const popoverRef = useRef(null);
|
|
16
16
|
const popoverContentRef = useRef(null);
|
|
17
17
|
const [showPopup, setShowPopup] = useState(false);
|
|
@@ -72,7 +72,8 @@ const Popover = (props) => {
|
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
const classes = classNames({
|
|
75
|
-
[`${classPrefix}`]: true
|
|
75
|
+
[`${classPrefix}`]: true,
|
|
76
|
+
[`${classPrefix}-${theme}`]: theme === "dark"
|
|
76
77
|
}, className);
|
|
77
78
|
const popoverArrow = () => {
|
|
78
79
|
const prefixCls = "nut-popover-arrow";
|
|
@@ -176,11 +177,12 @@ const Popover = (props) => {
|
|
|
176
177
|
React__default.Fragment,
|
|
177
178
|
null,
|
|
178
179
|
!targetId && React__default.createElement("div", { className: "nut-popover-wrapper", ref: popoverRef, onClick: () => {
|
|
179
|
-
|
|
180
|
+
var _a2;
|
|
181
|
+
(_a2 = props === null || props === void 0 ? void 0 : props.onClick) === null || _a2 === void 0 ? void 0 : _a2.call(props);
|
|
180
182
|
if (!visible) {
|
|
181
|
-
onOpen
|
|
183
|
+
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
182
184
|
} else {
|
|
183
|
-
onClose
|
|
185
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
184
186
|
}
|
|
185
187
|
}, style }, Array.isArray(children) ? children[0] : children),
|
|
186
188
|
React__default.createElement(
|
|
@@ -2,7 +2,7 @@ import React__default from "react";
|
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
|
|
4
4
|
import { u as usePropsValue } from "./use-props-value-SH9krhkx.js";
|
|
5
|
-
import { a as TabbarContext, T as TabbarItem } from "./tabbaritem.taro-
|
|
5
|
+
import { a as TabbarContext, T as TabbarItem } from "./tabbaritem.taro-C4AZbQMG.js";
|
|
6
6
|
const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { defaultValue: 0, fixed: false, inactiveColor: "", activeColor: "", safeArea: false, onSwitch: (value) => {
|
|
7
7
|
} });
|
|
8
8
|
const Tabbar = (props) => {
|
|
@@ -2,7 +2,7 @@ import { _ as __rest } from "./tslib.es6-BZ8i9Q6l.js";
|
|
|
2
2
|
import React__default, { useContext } from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
|
|
5
|
-
import { B as Badge } from "./badge.taro-
|
|
5
|
+
import { B as Badge } from "./badge.taro-D7Yn5zJi.js";
|
|
6
6
|
const TabbarContext = React__default.createContext(null);
|
|
7
7
|
const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { title: "", icon: null, value: "", dot: false, max: 99, top: "0", right: "5" });
|
|
8
8
|
const TabbarItem = (props) => {
|
|
@@ -2,10 +2,10 @@ import { _ as __rest } from "./tslib.es6-BZ8i9Q6l.js";
|
|
|
2
2
|
import React__default, { useState, useEffect, useCallback, useRef } from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import { ArrowDown } from "@nutui/icons-react-taro";
|
|
5
|
-
import { u as useConfig } from "./configprovider.taro-CyU_tvNJ.js";
|
|
5
|
+
import { u as useConfig, a as useRtl } from "./configprovider.taro-CyU_tvNJ.js";
|
|
6
6
|
import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
|
|
7
7
|
import { u as usePropsValue } from "./use-props-value-SH9krhkx.js";
|
|
8
|
-
function useTableSticky(columns) {
|
|
8
|
+
function useTableSticky(columns, rtl = false) {
|
|
9
9
|
const [isSticky, setIsSticky] = useState(false);
|
|
10
10
|
const [stickyColumnStyleMap, setStickyColumnStyleMap] = useState({});
|
|
11
11
|
const [stickyColumnClassMap, setStickyColumnClassMap] = useState({});
|
|
@@ -20,9 +20,9 @@ function useTableSticky(columns) {
|
|
|
20
20
|
let _stickyLeftWidth = 0;
|
|
21
21
|
let _stickyRightWidth = 0;
|
|
22
22
|
leftColumns.forEach((curr, index) => {
|
|
23
|
-
|
|
23
|
+
const dir = rtl ? "right" : "left";
|
|
24
24
|
_columnStyleMap[curr.key] = {
|
|
25
|
-
|
|
25
|
+
[dir]: _stickyLeftWidth || 0,
|
|
26
26
|
width: curr.width || "auto"
|
|
27
27
|
};
|
|
28
28
|
_columnClassMap[curr.key] = {
|
|
@@ -38,9 +38,9 @@ function useTableSticky(columns) {
|
|
|
38
38
|
});
|
|
39
39
|
for (let i = rightColumns.length - 1; i >= 0; i--) {
|
|
40
40
|
const curr = rightColumns[i];
|
|
41
|
-
|
|
41
|
+
const dir = rtl ? "left" : "right";
|
|
42
42
|
_columnStyleMap[curr.key] = {
|
|
43
|
-
|
|
43
|
+
[dir]: _stickyRightWidth || 0,
|
|
44
44
|
width: curr.width || "auto"
|
|
45
45
|
};
|
|
46
46
|
_columnClassMap[curr.key] = {
|
|
@@ -72,6 +72,7 @@ function useTableSticky(columns) {
|
|
|
72
72
|
const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { columns: [], data: [], bordered: true, striped: false, noData: "", sorterIcon: null, showHeader: true });
|
|
73
73
|
const Table = (props) => {
|
|
74
74
|
const { locale } = useConfig();
|
|
75
|
+
const rtl = useRtl();
|
|
75
76
|
defaultProps.noData = locale.noData;
|
|
76
77
|
const _a = Object.assign(Object.assign({}, defaultProps), props), { children, className, style, columns, data, bordered, summary, striped, noData, sorterIcon, showHeader, onSort } = _a, rest = __rest(_a, ["children", "className", "style", "columns", "data", "bordered", "summary", "striped", "noData", "sorterIcon", "showHeader", "onSort"]);
|
|
77
78
|
const sortedMapping = useRef({});
|
|
@@ -79,7 +80,7 @@ const Table = (props) => {
|
|
|
79
80
|
defaultValue: data,
|
|
80
81
|
finalValue: []
|
|
81
82
|
});
|
|
82
|
-
const { isSticky, stickyLeftWidth, stickyRightWidth, getStickyClass, getStickyStyle } = useTableSticky(columns);
|
|
83
|
+
const { isSticky, stickyLeftWidth, stickyRightWidth, getStickyClass, getStickyStyle } = useTableSticky(columns, rtl);
|
|
83
84
|
useEffect(() => {
|
|
84
85
|
setValue(data);
|
|
85
86
|
}, [data]);
|
|
@@ -114,7 +114,7 @@ const Tabs = (props) => {
|
|
|
114
114
|
}
|
|
115
115
|
animate();
|
|
116
116
|
};
|
|
117
|
-
const scrollIntoView = () => {
|
|
117
|
+
const scrollIntoView = (index) => {
|
|
118
118
|
requestAniFrame(() => {
|
|
119
119
|
Promise.all([
|
|
120
120
|
getRect(`#nut-tabs-titles-${name || uuid} .nut-tabs-list`),
|
|
@@ -122,17 +122,17 @@ const Tabs = (props) => {
|
|
|
122
122
|
]).then(([navRect, titleRects]) => {
|
|
123
123
|
navRectRef.current = navRect;
|
|
124
124
|
titleRectRef.current = titleRects;
|
|
125
|
-
const titleRect = titleRectRef.current[
|
|
125
|
+
const titleRect = titleRectRef.current[index];
|
|
126
126
|
if (!titleRect)
|
|
127
127
|
return;
|
|
128
128
|
let to = 0;
|
|
129
129
|
if (props.direction === "vertical") {
|
|
130
130
|
const DEFAULT_PADDING = 11;
|
|
131
|
-
const top = titleRects.slice(0,
|
|
131
|
+
const top = titleRects.slice(0, index).reduce((prev, curr) => prev + curr.height, DEFAULT_PADDING);
|
|
132
132
|
to = top - (navRectRef.current.height - titleRect.height) / 2;
|
|
133
133
|
} else {
|
|
134
134
|
const DEFAULT_PADDING = 20;
|
|
135
|
-
const left = titleRects.slice(0,
|
|
135
|
+
const left = titleRects.slice(0, index).reduce((prev, curr) => prev + curr.width, DEFAULT_PADDING);
|
|
136
136
|
to = left - (navRectRef.current.width - titleRect.width) / 2;
|
|
137
137
|
}
|
|
138
138
|
nextTick(() => {
|
|
@@ -148,7 +148,7 @@ const Tabs = (props) => {
|
|
|
148
148
|
transform: direction === "horizontal" ? `translate3d(-${index * 100}%, 0, 0)` : `translate3d( 0,-${index * 100}%, 0)`,
|
|
149
149
|
transitionDuration: `${duration}ms`
|
|
150
150
|
});
|
|
151
|
-
scrollIntoView();
|
|
151
|
+
scrollIntoView(index);
|
|
152
152
|
}, [value]);
|
|
153
153
|
const tabChange = (item, index) => {
|
|
154
154
|
onClick && onClick(item.value);
|
|
@@ -5,11 +5,11 @@ import { O as Overlay } from "./overlay.taro-BaBu-3-F.js";
|
|
|
5
5
|
import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
|
|
6
6
|
import { b as useParams, u as useCustomEvent, a as useCustomEventsPath, c as customEvents } from "./use-custom-event-DuP4onEm.js";
|
|
7
7
|
import { u as usePropsValue } from "./use-props-value-SH9krhkx.js";
|
|
8
|
-
const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { id: "", icon: null, iconSize: "20", msg: "", duration: 2, position: "center", type: "text", title: "", closeOnOverlayClick: false, lockScroll: false, contentClassName: "", size: "base", visible: false, wordBreak: "break-all", onClose: () => {
|
|
8
|
+
const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { id: "", icon: null, iconSize: "20", content: "", msg: "", duration: 2, position: "center", type: "text", title: "", closeOnOverlayClick: false, lockScroll: false, contentClassName: "", size: "base", visible: false, wordBreak: "break-all", onClose: () => {
|
|
9
9
|
} });
|
|
10
10
|
const classPrefix = "nut-toast";
|
|
11
11
|
const Toast = (props) => {
|
|
12
|
-
const { params: { id, position, contentStyle, icon, iconSize, msg, duration, type, title, closeOnOverlayClick, lockScroll, contentClassName, visible, size, className, style, onClose, wordBreak }, setParams } = useParams(Object.assign(Object.assign({}, defaultProps), props));
|
|
12
|
+
const { params: { id, position, contentStyle, icon, iconSize, content, msg, duration, type, title, closeOnOverlayClick, lockScroll, contentClassName, visible, size, className, style, onClose, wordBreak }, setParams } = useParams(Object.assign(Object.assign({}, defaultProps), props));
|
|
13
13
|
const timer = useRef(-1);
|
|
14
14
|
const [innerVisible, setInnerVisible] = usePropsValue({
|
|
15
15
|
value: visible,
|
|
@@ -95,7 +95,7 @@ const Toast = (props) => {
|
|
|
95
95
|
{ className: `${classPrefix}-inner ${classPrefix}-${position} ${contentClassName} ${wordBreak}`, style: contentStyle },
|
|
96
96
|
hasIcon() ? React__default.createElement("p", { className: `${classPrefix}-icon-wrapper` }, iconName()) : null,
|
|
97
97
|
title ? React__default.createElement("div", { className: `${classPrefix}-title` }, title) : null,
|
|
98
|
-
React__default.createElement("span", { className: `${classPrefix}-text` }, msg)
|
|
98
|
+
React__default.createElement("span", { className: `${classPrefix}-text` }, content || msg)
|
|
99
99
|
)
|
|
100
100
|
)
|
|
101
101
|
) : null);
|
|
@@ -2,7 +2,7 @@ import { _ as __rest } from "./tslib.es6-BZ8i9Q6l.js";
|
|
|
2
2
|
import React__default, { useState, useEffect } from "react";
|
|
3
3
|
import { Close } from "@nutui/icons-react-taro";
|
|
4
4
|
import classNames from "classnames";
|
|
5
|
-
import { P as Popover } from "./popover.taro-
|
|
5
|
+
import { P as Popover } from "./popover.taro-BsOaXoWp.js";
|
|
6
6
|
import Taro, { createSelectorQuery } from "@tarojs/taro";
|
|
7
7
|
import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
|
|
8
8
|
import { useConfig } from "./ConfigProvider.js";
|