@nutui/nutui-react-taro 2.0.0-alpha.13 → 2.0.0-alpha.14
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 +16 -0
- package/dist/esm/ActionSheet/style/style.css +1 -1
- package/dist/esm/Address/style/style.css +1 -1
- package/dist/esm/Audio.js +3 -3
- package/dist/esm/Barrage/style/style.css +1 -1
- package/dist/esm/Barrage.js +2 -3
- package/dist/esm/Calendar/style/style.css +1 -1
- package/dist/esm/Cascader/style/style.css +1 -1
- package/dist/esm/CircleProgress.js +2 -2
- package/dist/esm/DatePicker/style/style.css +1 -1
- package/dist/esm/DatePicker.js +3 -3
- package/dist/esm/Ellipsis.js +2 -2
- package/dist/esm/ImagePreview/style/style.css +1 -1
- package/dist/esm/Menu.js +1 -1
- package/dist/esm/MenuItem.js +2 -2
- package/dist/esm/NoticeBar.js +2 -2
- package/dist/esm/NumberKeyboard/style/style.css +1 -1
- package/dist/esm/Picker/style/style.css +1 -1
- package/dist/esm/Picker.js +2 -2
- package/dist/esm/Popover/style/index.js +1 -1
- package/dist/esm/Popover/style/style.css +1 -1
- package/dist/esm/Popover.js +9 -3
- package/dist/esm/Popup/style/style.css +1 -1
- package/dist/esm/Range.js +2 -2
- package/dist/esm/ShortPassword/style/style.css +1 -1
- package/dist/esm/SideNavBar/style/style.css +1 -1
- package/dist/esm/SideNavBar.js +3 -3
- package/dist/esm/SideNavBarItem/style/style.css +1 -1
- package/dist/esm/SideNavBarItem.js +1 -1
- package/dist/esm/Signature.js +1 -1
- package/dist/esm/Sticky.js +2 -2
- package/dist/esm/SubSideNavBar/style/style.css +1 -1
- package/dist/esm/SubSideNavBar.js +2 -2
- package/dist/esm/Swipe.js +2 -2
- package/dist/esm/TextArea/style/style.css +1 -1
- package/dist/esm/TimeSelect/style/style.css +1 -1
- package/dist/esm/Uploader.js +2 -2
- package/dist/esm/{audio.taro-bbd39f93.js → audio.taro-73011657.js} +3 -3
- package/dist/esm/{barrage.taro-c8cb9864.js → barrage.taro-e87bc58e.js} +32 -32
- package/dist/esm/{circleprogress.taro-7149e09d.js → circleprogress.taro-9064d69c.js} +1 -1
- package/dist/esm/{datepicker.taro-65dbeceb.js → datepicker.taro-6304d59d.js} +1 -1
- package/dist/esm/{ellipsis.taro-f423affa.js → ellipsis.taro-5653d0b2.js} +12 -12
- package/dist/esm/{index-e3184f19.js → index-0a89a47b.js} +7 -1
- package/dist/esm/{menu.taro-cd0fef41.js → menu.taro-40d36e0a.js} +3 -3
- package/dist/esm/{menuitem.taro-6076bffa.js → menuitem.taro-6aa35a00.js} +1 -1
- package/dist/esm/{noticebar.taro-2f02b2ad.js → noticebar.taro-8d496dd6.js} +1 -1
- package/dist/esm/nutui-react.es.js +21 -21
- package/dist/esm/{picker.taro-0570ec32.js → picker.taro-8ba4624c.js} +44 -40
- package/dist/esm/popover.taro-ba6c323a.js +229 -0
- package/dist/esm/{range.taro-615e193a.js → range.taro-a1d1ad25.js} +1 -1
- package/dist/esm/{sidenavbar.taro-9f210df4.js → sidenavbar.taro-1aefdd3c.js} +13 -10
- package/dist/esm/sidenavbaritem.taro-7d805f92.js +13 -0
- package/dist/esm/{signature.taro-c57469aa.js → signature.taro-6e75a1ac.js} +1 -1
- package/dist/esm/{sticky.taro-f8ae8d5e.js → sticky.taro-6bc62a96.js} +2 -2
- package/dist/esm/{subsidenavbar.taro-abe07673.js → subsidenavbar.taro-47bb6e74.js} +10 -9
- package/dist/esm/{swipe.taro-de80fcd8.js → swipe.taro-966af6d3.js} +1 -1
- package/dist/esm/types/src/packages/barrage/barrage.d.ts +6 -7
- package/dist/esm/types/src/packages/barrage/barrage.taro.d.ts +6 -7
- package/dist/esm/types/src/packages/barrage/index.d.ts +1 -0
- package/dist/esm/types/src/packages/barrage/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/button/button.d.ts +1 -0
- package/dist/esm/types/src/packages/configprovider/types.d.ts +1 -1
- package/dist/esm/types/src/packages/input/input.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/menu/menu.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/picker/doc.en.d.ts +9 -9
- package/dist/esm/types/src/packages/popover/demo.d.ts +3 -2
- package/dist/esm/types/src/packages/popover/demo.taro.d.ts +2 -2
- package/dist/esm/types/src/packages/popover/index.d.ts +1 -0
- package/dist/esm/types/src/packages/popover/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/popover/popover.d.ts +20 -9
- package/dist/esm/types/src/packages/popover/popover.taro.d.ts +20 -10
- package/dist/esm/types/src/packages/sidenavbar/index.d.ts +1 -0
- package/dist/esm/types/src/packages/sidenavbar/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/sidenavbar/sidenavbar.d.ts +5 -9
- package/dist/esm/types/src/packages/sidenavbar/sidenavbar.taro.d.ts +5 -9
- package/dist/esm/types/src/packages/sidenavbaritem/index.d.ts +1 -0
- package/dist/esm/types/src/packages/sidenavbaritem/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/sidenavbaritem/sidenavbaritem.d.ts +3 -3
- package/dist/esm/types/src/packages/sidenavbaritem/sidenavbaritem.taro.d.ts +3 -3
- package/dist/esm/types/src/packages/subsidenavbar/index.d.ts +1 -0
- package/dist/esm/types/src/packages/subsidenavbar/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/subsidenavbar/subsidenavbar.d.ts +3 -3
- package/dist/esm/types/src/packages/subsidenavbar/subsidenavbar.taro.d.ts +3 -3
- package/dist/esm/types/src/utils/index.d.ts +1 -0
- package/dist/esm/types/src/utils/use-click-away.d.ts +3 -0
- package/dist/esm/{uploader.taro-7e38fc37.js → uploader.taro-fbd05e20.js} +1 -1
- package/dist/esm/use-client-rect-2bb6c562.js +40 -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 +466 -324
- package/dist/nutui.react.umd.js +466 -324
- package/dist/packages/barrage/barrage.scss +0 -13
- package/dist/packages/popover/popover.scss +158 -230
- package/dist/packages/popup/popup.scss +36 -0
- package/dist/packages/sidenavbar/sidenavbar.scss +10 -16
- package/dist/packages/sidenavbaritem/sidenavbaritem.scss +7 -19
- package/dist/packages/subsidenavbar/subsidenavbar.scss +10 -19
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/variables-jmapp.scss +35 -47
- package/dist/styles/variables.scss +45 -57
- package/dist/types/packages/barrage/barrage.taro.d.ts +32 -9
- package/dist/types/packages/barrage/index.taro.d.ts +1 -0
- package/dist/types/packages/configprovider/types.d.ts +1 -1
- package/dist/types/packages/input/input.taro.d.ts +1 -1
- package/dist/types/packages/menu/menu.taro.d.ts +5 -1
- package/dist/types/packages/popover/index.taro.d.ts +1 -0
- package/dist/types/packages/popover/popover.taro.d.ts +99 -13
- package/dist/types/packages/sidenavbar/index.taro.d.ts +1 -0
- package/dist/types/packages/sidenavbar/sidenavbar.taro.d.ts +33 -13
- package/dist/types/packages/sidenavbaritem/index.taro.d.ts +1 -0
- package/dist/types/packages/sidenavbaritem/sidenavbaritem.taro.d.ts +3 -3
- package/dist/types/packages/subsidenavbar/index.taro.d.ts +1 -0
- package/dist/types/packages/subsidenavbar/subsidenavbar.taro.d.ts +3 -3
- package/dist/types/utils/index.d.ts +1 -0
- package/package.json +1 -1
- package/dist/esm/popover.taro-ad483372.js +0 -162
- package/dist/esm/sidenavbaritem.taro-32a45ce6.js +0 -12
- package/dist/esm/types/src/packages/popover/Trigger.d.ts +0 -19
- package/dist/esm/types/src/packages/sidenavbar/type.d.ts +0 -34
- package/dist/esm/use-client-rect-f317804e.js +0 -10
- package/dist/types/packages/popover/Trigger.d.ts +0 -19
- /package/dist/esm/{offsetContext-f32a9246.js → context-f32a9246.js} +0 -0
- /package/dist/esm/types/src/packages/sidenavbar/{offsetContext.d.ts → context.d.ts} +0 -0
- /package/dist/types/packages/sidenavbar/{offsetContext.d.ts → context.d.ts} +0 -0
|
@@ -10,14 +10,14 @@ import { G } from "./grid.taro-fbbd8618.js";
|
|
|
10
10
|
import { G as G2 } from "./griditem.taro-b0c37077.js";
|
|
11
11
|
import { L } from "./layout.taro-9659a928.js";
|
|
12
12
|
import { R } from "./row.taro-8b7febd4.js";
|
|
13
|
-
import { S } from "./sticky.taro-
|
|
13
|
+
import { S } from "./sticky.taro-6bc62a96.js";
|
|
14
14
|
import { B as B2 } from "./backtop.taro-7de36464.js";
|
|
15
15
|
import { E } from "./elevator.taro-df8fde9d.js";
|
|
16
16
|
import { F } from "./fixednav.taro-b9ecf0d5.js";
|
|
17
17
|
import { N } from "./navbar.taro-5e1a0835.js";
|
|
18
|
-
import { S as S2 } from "./sidenavbar.taro-
|
|
19
|
-
import { S as S3 } from "./sidenavbaritem.taro-
|
|
20
|
-
import { S as S4 } from "./subsidenavbar.taro-
|
|
18
|
+
import { S as S2 } from "./sidenavbar.taro-1aefdd3c.js";
|
|
19
|
+
import { S as S3 } from "./sidenavbaritem.taro-7d805f92.js";
|
|
20
|
+
import { S as S4 } from "./subsidenavbar.taro-47bb6e74.js";
|
|
21
21
|
import { T } from "./tabbar.taro-18eee41f.js";
|
|
22
22
|
import { T as T2 } from "./tabbaritem.taro-89646ca1.js";
|
|
23
23
|
import { T as T3 } from "./tabpane.taro-f8d92ece.js";
|
|
@@ -27,48 +27,48 @@ import { C as C5 } from "./calendar.taro-10a6cb11.js";
|
|
|
27
27
|
import { C as C6 } from "./calendaritem.taro-3e5f114e.js";
|
|
28
28
|
import { C as C7 } from "./cascader.taro-fb7a0230.js";
|
|
29
29
|
import { C as C8, a } from "./checkbox.taro-303276d7.js";
|
|
30
|
-
import { D as D2 } from "./datepicker.taro-
|
|
30
|
+
import { D as D2 } from "./datepicker.taro-6304d59d.js";
|
|
31
31
|
import { F as F2 } from "./form.taro-b06754e8.js";
|
|
32
32
|
import { F as F3 } from "./formitem.taro-b326809d.js";
|
|
33
33
|
import { I as I2 } from "./input.taro-27d686c9.js";
|
|
34
34
|
import { I as I3 } from "./inputnumber.taro-6657d2c1.js";
|
|
35
|
-
import { M } from "./menu.taro-
|
|
36
|
-
import { M as M2 } from "./menuitem.taro-
|
|
35
|
+
import { M } from "./menu.taro-40d36e0a.js";
|
|
36
|
+
import { M as M2 } from "./menuitem.taro-6aa35a00.js";
|
|
37
37
|
import { N as N2 } from "./numberkeyboard.taro-ad8afaf9.js";
|
|
38
|
-
import { P } from "./picker.taro-
|
|
38
|
+
import { P } from "./picker.taro-8ba4624c.js";
|
|
39
39
|
import { R as R2, a as a2 } from "./radio.taro-5d6ca4ad.js";
|
|
40
|
-
import { R as R3 } from "./range.taro-
|
|
40
|
+
import { R as R3 } from "./range.taro-a1d1ad25.js";
|
|
41
41
|
import { R as R4 } from "./rate.taro-78c66969.js";
|
|
42
42
|
import { S as S5 } from "./searchbar.taro-09468fff.js";
|
|
43
43
|
import { S as S6 } from "./shortpassword.taro-eabbde1b.js";
|
|
44
|
-
import { S as S7 } from "./signature.taro-
|
|
44
|
+
import { S as S7 } from "./signature.taro-6e75a1ac.js";
|
|
45
45
|
import { S as S8 } from "./switch.taro-f0da73a3.js";
|
|
46
46
|
import { T as T5 } from "./textarea.taro-c110565e.js";
|
|
47
|
-
import { U } from "./uploader.taro-
|
|
47
|
+
import { U } from "./uploader.taro-fbd05e20.js";
|
|
48
48
|
import { A as A2 } from "./actionsheet.taro-697a594b.js";
|
|
49
49
|
import { B as B3 } from "./badge.taro-872605bf.js";
|
|
50
50
|
import { B as B4 } from "./dialog.taro-290eb9a6.js";
|
|
51
51
|
import { D as D3 } from "./drag.taro-48e1ff38.js";
|
|
52
52
|
import { E as E2 } from "./empty.taro-ca792f57.js";
|
|
53
53
|
import { I as I4 } from "./infiniteloading.taro-f8f23ac6.js";
|
|
54
|
-
import { N as N3 } from "./noticebar.taro-
|
|
54
|
+
import { N as N3 } from "./noticebar.taro-8d496dd6.js";
|
|
55
55
|
import { N as N4 } from "./notify.taro-5768403d.js";
|
|
56
|
-
import { P as P2 } from "./popover.taro-
|
|
56
|
+
import { P as P2 } from "./popover.taro-ba6c323a.js";
|
|
57
57
|
import { P as P3 } from "./pulltorefresh.taro-5b36a881.js";
|
|
58
58
|
import { S as S9 } from "./skeleton.taro-0552c2ec.js";
|
|
59
|
-
import { S as S10 } from "./swipe.taro-
|
|
59
|
+
import { S as S10 } from "./swipe.taro-966af6d3.js";
|
|
60
60
|
import { P as P4 } from "./popup.taro-e756f3fc.js";
|
|
61
61
|
import { T as T6 } from "./toast.taro-b2937e7c.js";
|
|
62
62
|
import { A as A3 } from "./animate.taro-c8b29242.js";
|
|
63
63
|
import { default as default2 } from "./AnimatingNumbers.js";
|
|
64
|
-
import { A as A4 } from "./audio.taro-
|
|
64
|
+
import { A as A4 } from "./audio.taro-73011657.js";
|
|
65
65
|
import { A as A5 } from "./avatar.taro-01536aff.js";
|
|
66
66
|
import { A as A6 } from "./avatargroup.taro-ad5ffb46.js";
|
|
67
|
-
import { C as C9 } from "./circleprogress.taro-
|
|
67
|
+
import { C as C9 } from "./circleprogress.taro-9064d69c.js";
|
|
68
68
|
import { C as C10 } from "./collapse.taro-98577a29.js";
|
|
69
69
|
import { C as C11 } from "./collapseitem.taro-9451f40f.js";
|
|
70
70
|
import { C as C12 } from "./countdown.taro-c399cc08.js";
|
|
71
|
-
import { E as E3 } from "./ellipsis.taro-
|
|
71
|
+
import { E as E3 } from "./ellipsis.taro-5653d0b2.js";
|
|
72
72
|
import { I as I5 } from "./imagepreview.taro-daa5a84f.js";
|
|
73
73
|
import { I as I6 } from "./indicator.taro-edbc71df.js";
|
|
74
74
|
import { V } from "./virtuallist.taro-97d3403a.js";
|
|
@@ -82,7 +82,7 @@ import { S as S14 } from "./swiperitem.taro-ef7342e8.js";
|
|
|
82
82
|
import { T as T7 } from "./table.taro-15a55c5d.js";
|
|
83
83
|
import { T as T8 } from "./tag.taro-1b4134a5.js";
|
|
84
84
|
import { V as V2 } from "./video.taro-2a26d7da.js";
|
|
85
|
-
import { B as B5 } from "./barrage.taro-
|
|
85
|
+
import { B as B5 } from "./barrage.taro-e87bc58e.js";
|
|
86
86
|
import { C as C13 } from "./card.taro-2080f4d2.js";
|
|
87
87
|
import { T as T9 } from "./timedetail.taro-8d2acbbf.js";
|
|
88
88
|
import { T as T10 } from "./timepannel.taro-ee4c5dfa.js";
|
|
@@ -96,16 +96,16 @@ import "./typings-11d83a22.js";
|
|
|
96
96
|
import "@tarojs/components";
|
|
97
97
|
import "./UserContext-ab42ba7f.js";
|
|
98
98
|
import "@tarojs/taro";
|
|
99
|
-
import "./use-client-rect-
|
|
99
|
+
import "./use-client-rect-2bb6c562.js";
|
|
100
100
|
import "./can-use-dom-0e539bd3.js";
|
|
101
|
-
import "./
|
|
101
|
+
import "./context-f32a9246.js";
|
|
102
102
|
import "./use-props-value-7ac1b1b5.js";
|
|
103
103
|
import "./bem-cdccae08.js";
|
|
104
104
|
import "@bem-react/classname";
|
|
105
105
|
import "./ConfigProvider.js";
|
|
106
106
|
import "react-transition-group";
|
|
107
107
|
import "./use-touch-ff43512c.js";
|
|
108
|
-
import "./index-
|
|
108
|
+
import "./index-0a89a47b.js";
|
|
109
109
|
import "react-dom";
|
|
110
110
|
import "./context-d0fccf11.js";
|
|
111
111
|
import "./context-ab42ba7f.js";
|
|
@@ -4,7 +4,7 @@ import Taro from "@tarojs/taro";
|
|
|
4
4
|
import { View, PickerView, PickerViewColumn } from "@tarojs/components";
|
|
5
5
|
import { P as Popup } from "./popup.taro-e756f3fc.js";
|
|
6
6
|
import { u as useTouch } from "./use-touch-ff43512c.js";
|
|
7
|
-
import { g as getRectByTaro } from "./use-client-rect-
|
|
7
|
+
import { g as getRectByTaro } from "./use-client-rect-2bb6c562.js";
|
|
8
8
|
import { c as canUseDom } from "./can-use-dom-0e539bd3.js";
|
|
9
9
|
import { u as useConfig } from "./configprovider.taro-25758d9f.js";
|
|
10
10
|
import { u as usePropsValue } from "./use-props-value-7ac1b1b5.js";
|
|
@@ -250,7 +250,7 @@ const defaultProps = {
|
|
|
250
250
|
};
|
|
251
251
|
const InternalPicker = (props, ref) => {
|
|
252
252
|
const { locale } = useConfig();
|
|
253
|
-
const { visible, title, options = [], defaultValue = [], className, style, threeDimensional, duration, onConfirm, onClose, afterClose, onChange, ...rest } = { ...defaultProps, ...props };
|
|
253
|
+
const { children, visible, title, options = [], defaultValue = [], className, style, threeDimensional, duration, onConfirm, onClose, afterClose, onChange, ...rest } = { ...defaultProps, ...props };
|
|
254
254
|
const classPrefix = "nut-picker";
|
|
255
255
|
const classes = classNames(classPrefix, className);
|
|
256
256
|
const [selectedValue, setSelectedValue] = usePropsValue({
|
|
@@ -262,6 +262,7 @@ const InternalPicker = (props, ref) => {
|
|
|
262
262
|
(_a = props.onConfirm) == null ? void 0 : _a.call(props, setSelectedOptions(), val);
|
|
263
263
|
}
|
|
264
264
|
});
|
|
265
|
+
const [innerValue, setInnerValue] = useState(selectedValue);
|
|
265
266
|
const [currentValue, setCurrentValue] = useState([]);
|
|
266
267
|
const [columnIndex, setColumnIndex] = useState(0);
|
|
267
268
|
const pickerRef = useRef(null);
|
|
@@ -300,40 +301,49 @@ const InternalPicker = (props, ref) => {
|
|
|
300
301
|
}
|
|
301
302
|
return "single";
|
|
302
303
|
};
|
|
303
|
-
const normalListData = () => {
|
|
304
|
+
const normalListData = (innerValue2) => {
|
|
304
305
|
const type = columnsType();
|
|
305
306
|
switch (type) {
|
|
306
307
|
case "multiple":
|
|
307
308
|
return options;
|
|
308
309
|
case "cascade":
|
|
309
|
-
return formatCascade(options,
|
|
310
|
+
return formatCascade(options, innerValue2);
|
|
310
311
|
default:
|
|
311
312
|
return [options];
|
|
312
313
|
}
|
|
313
314
|
};
|
|
314
315
|
const init = () => {
|
|
315
|
-
const normalData = normalListData();
|
|
316
|
+
const normalData = normalListData(innerValue);
|
|
316
317
|
setColumnsList(normalData);
|
|
317
318
|
const data = [];
|
|
318
319
|
normalData.length > 0 && normalData.map((item) => {
|
|
319
320
|
item[0] && data.push(item[0].value);
|
|
320
321
|
return item;
|
|
321
322
|
});
|
|
322
|
-
if (!
|
|
323
|
-
|
|
323
|
+
if (!innerValue.length && innerValue.length === 0) {
|
|
324
|
+
setInnerValue([...data]);
|
|
324
325
|
}
|
|
325
326
|
};
|
|
327
|
+
useEffect(() => {
|
|
328
|
+
setInnerValue(innerValue !== selectedValue ? selectedValue : innerValue);
|
|
329
|
+
}, [visible]);
|
|
330
|
+
useEffect(() => {
|
|
331
|
+
if (visible) {
|
|
332
|
+
init();
|
|
333
|
+
}
|
|
334
|
+
}, [options, visible]);
|
|
326
335
|
useEffect(() => {
|
|
327
336
|
if (!visible) {
|
|
328
337
|
return;
|
|
329
338
|
}
|
|
330
|
-
|
|
331
|
-
|
|
339
|
+
Taro.getEnv() !== "WEB" && setCurrentValue(defaultValuesConvert());
|
|
340
|
+
onChange && onChange(setSelectedOptions(), innerValue, columnIndex);
|
|
341
|
+
}, [innerValue, columnsList, visible]);
|
|
332
342
|
const setSelectedOptions = () => {
|
|
333
343
|
const options2 = [];
|
|
334
344
|
let currOptions = [];
|
|
335
345
|
columnsList.forEach((columnOptions, index) => {
|
|
336
|
-
currOptions = columnOptions.filter((item) => item.value ===
|
|
346
|
+
currOptions = columnOptions.filter((item) => item.value === innerValue[index]);
|
|
337
347
|
if (currOptions[0]) {
|
|
338
348
|
options2.push(currOptions[0]);
|
|
339
349
|
} else {
|
|
@@ -344,8 +354,8 @@ const InternalPicker = (props, ref) => {
|
|
|
344
354
|
};
|
|
345
355
|
const defaultValuesConvert = () => {
|
|
346
356
|
const defaultIndexs = [];
|
|
347
|
-
if (
|
|
348
|
-
|
|
357
|
+
if (innerValue.length > 0) {
|
|
358
|
+
innerValue.forEach((value, index) => {
|
|
349
359
|
var _a;
|
|
350
360
|
for (let i = 0; i < ((_a = columnsList == null ? void 0 : columnsList[index]) == null ? void 0 : _a.length); i++) {
|
|
351
361
|
if (columnsList[index][i].value === value) {
|
|
@@ -362,37 +372,30 @@ const InternalPicker = (props, ref) => {
|
|
|
362
372
|
}
|
|
363
373
|
return defaultIndexs;
|
|
364
374
|
};
|
|
365
|
-
useEffect(() => {
|
|
366
|
-
if (!visible) {
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
Taro.getEnv() !== "WEB" && setCurrentValue(defaultValuesConvert());
|
|
370
|
-
onChange && onChange(setSelectedOptions(), selectedValue, columnIndex);
|
|
371
|
-
if (isConfirmEvent.current) {
|
|
372
|
-
isConfirmEvent.current = false;
|
|
373
|
-
onConfirm && onConfirm(setSelectedOptions(), selectedValue);
|
|
374
|
-
}
|
|
375
|
-
}, [selectedValue, columnsList, visible]);
|
|
376
375
|
const chooseItem = (columnOptions, columnIndex2) => {
|
|
377
376
|
var _a, _b;
|
|
377
|
+
const values = [];
|
|
378
|
+
const start = columnIndex2;
|
|
378
379
|
if (columnOptions && Object.keys(columnOptions).length) {
|
|
379
|
-
if (
|
|
380
|
+
if (values[columnIndex2] !== columnOptions.value) {
|
|
380
381
|
if (columnsType() === "cascade") {
|
|
381
|
-
|
|
382
|
-
setSelectedValue([...selectedValue]);
|
|
382
|
+
values[columnIndex2] = columnOptions.value || "";
|
|
383
383
|
while ((_a = columnOptions == null ? void 0 : columnOptions.children) == null ? void 0 : _a[0]) {
|
|
384
|
-
|
|
385
|
-
setSelectedValue([...selectedValue]);
|
|
384
|
+
values[columnIndex2 + 1] = columnOptions.children[0].value;
|
|
386
385
|
columnIndex2++;
|
|
387
386
|
columnOptions = columnOptions.children[0];
|
|
388
387
|
}
|
|
389
388
|
if ((_b = columnOptions == null ? void 0 : columnOptions.children) == null ? void 0 : _b.length) {
|
|
390
|
-
|
|
391
|
-
setSelectedValue([...selectedValue]);
|
|
389
|
+
values[columnIndex2 + 1] = "";
|
|
392
390
|
}
|
|
393
|
-
|
|
391
|
+
const combineResult = [
|
|
392
|
+
...innerValue.slice(0, start),
|
|
393
|
+
...values.splice(start)
|
|
394
|
+
];
|
|
395
|
+
setInnerValue(combineResult);
|
|
396
|
+
setColumnsList(normalListData(combineResult));
|
|
394
397
|
} else {
|
|
395
|
-
|
|
398
|
+
setInnerValue((data) => {
|
|
396
399
|
const cdata = [...data];
|
|
397
400
|
cdata[columnIndex2] = Object.prototype.hasOwnProperty.call(columnOptions, "value") ? columnOptions.value : "";
|
|
398
401
|
return cdata;
|
|
@@ -403,16 +406,16 @@ const InternalPicker = (props, ref) => {
|
|
|
403
406
|
}
|
|
404
407
|
};
|
|
405
408
|
const confirm = () => {
|
|
406
|
-
let
|
|
409
|
+
let moving = false;
|
|
407
410
|
refs.forEach((ref2) => {
|
|
408
411
|
if (ref2.moving)
|
|
409
|
-
|
|
412
|
+
moving = true;
|
|
410
413
|
ref2.stopMomentum();
|
|
411
414
|
});
|
|
412
|
-
if (
|
|
415
|
+
if (moving) {
|
|
413
416
|
isConfirmEvent.current = true;
|
|
414
417
|
} else {
|
|
415
|
-
|
|
418
|
+
setSelectedValue(innerValue);
|
|
416
419
|
closePicker();
|
|
417
420
|
}
|
|
418
421
|
setTimeout(() => {
|
|
@@ -420,8 +423,8 @@ const InternalPicker = (props, ref) => {
|
|
|
420
423
|
}, 0);
|
|
421
424
|
};
|
|
422
425
|
const closePicker = () => {
|
|
423
|
-
onClose && onClose(setSelectedOptions(),
|
|
424
|
-
afterClose && afterClose(setSelectedOptions(),
|
|
426
|
+
onClose && onClose(setSelectedOptions(), innerValue);
|
|
427
|
+
afterClose && afterClose(setSelectedOptions(), innerValue, pickerRef);
|
|
425
428
|
};
|
|
426
429
|
const renderTitleBar = () => {
|
|
427
430
|
return React.createElement(
|
|
@@ -432,7 +435,7 @@ const InternalPicker = (props, ref) => {
|
|
|
432
435
|
React.createElement("span", { className: `${classPrefix}__confirm-btn`, onClick: confirm }, locale.confirm)
|
|
433
436
|
);
|
|
434
437
|
};
|
|
435
|
-
const [
|
|
438
|
+
const [, setPickingStatus] = useState(false);
|
|
436
439
|
const pickerStart = () => {
|
|
437
440
|
setPickingStatus(true);
|
|
438
441
|
};
|
|
@@ -460,8 +463,9 @@ const InternalPicker = (props, ref) => {
|
|
|
460
463
|
View,
|
|
461
464
|
{ className: classes, style, ...rest, catchMove: true },
|
|
462
465
|
renderTitleBar(),
|
|
466
|
+
children,
|
|
463
467
|
React.createElement("div", { className: `${classPrefix}__panel`, ref: pickerRef }, Taro.getEnv() === "WEB" ? columnsList == null ? void 0 : columnsList.map((item, index) => {
|
|
464
|
-
return React.createElement(PickerPanel$1, { ref: setRefs(index), defaultValue:
|
|
468
|
+
return React.createElement(PickerPanel$1, { ref: setRefs(index), defaultValue: innerValue == null ? void 0 : innerValue[index], options: item, threeDimensional, chooseItem: (value, index2) => chooseItem(value, index2), duration, key: index, keyIndex: index, itemShow: visible });
|
|
465
469
|
}) : React.createElement(PickerView, { ref: pickerRef, value: currentValue, immediateChange: true, onPickStart: pickerStart, onChange: pickerChange, onPickEnd: pickerEnd, className: "nut-picker-view-panel" }, columnsList == null ? void 0 : columnsList.map((columnOptions, index) => {
|
|
466
470
|
return React.createElement(PickerViewColumn, { key: `col${index}` }, columnOptions.map((item, index2) => {
|
|
467
471
|
return React.createElement(
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import React, { useRef, useState, useEffect } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { P as Popup } from "./popup.taro-e756f3fc.js";
|
|
4
|
+
import Taro from "@tarojs/taro";
|
|
5
|
+
import { a as getRect, g as getRectByTaro } from "./use-client-rect-2bb6c562.js";
|
|
6
|
+
import { u as upperCaseFirst } from "./index-0a89a47b.js";
|
|
7
|
+
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
8
|
+
const defaultProps = {
|
|
9
|
+
...ComponentDefaults,
|
|
10
|
+
list: [],
|
|
11
|
+
location: "bottom",
|
|
12
|
+
visible: false,
|
|
13
|
+
offset: [0, 12],
|
|
14
|
+
targetId: "",
|
|
15
|
+
className: "",
|
|
16
|
+
background: "",
|
|
17
|
+
color: "",
|
|
18
|
+
showArrow: true,
|
|
19
|
+
duration: 0.3,
|
|
20
|
+
overlay: false,
|
|
21
|
+
overlayClassName: "",
|
|
22
|
+
overlayStyle: {},
|
|
23
|
+
closeOnClickOutside: true,
|
|
24
|
+
closeOnClickAction: true,
|
|
25
|
+
closeOnOverlayClick: true,
|
|
26
|
+
onClick: () => {
|
|
27
|
+
},
|
|
28
|
+
onOpen: () => {
|
|
29
|
+
},
|
|
30
|
+
onClose: () => {
|
|
31
|
+
},
|
|
32
|
+
onSelect: (item, index) => {
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const classPrefix = `nut-popover`;
|
|
36
|
+
const Popover = (props) => {
|
|
37
|
+
const { children, list, location, visible, offset, targetId, overlay, overlayStyle, overlayClassName, closeOnClickOutside, closeOnClickAction, closeOnOverlayClick, className, showArrow, style, background, color, onClick, onOpen, onClose, onSelect, ...reset } = {
|
|
38
|
+
...defaultProps,
|
|
39
|
+
...props
|
|
40
|
+
};
|
|
41
|
+
const popoverRef = useRef(null);
|
|
42
|
+
const popoverContentRef = useRef(null);
|
|
43
|
+
const [showPopup, setShowPopup] = useState(false);
|
|
44
|
+
const [elWidth, setElWidth] = useState(0);
|
|
45
|
+
const [elHeight, setElHeight] = useState(0);
|
|
46
|
+
const [rootPosition, setRootPosition] = useState();
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
setShowPopup(visible);
|
|
49
|
+
if (visible) {
|
|
50
|
+
setTimeout(() => {
|
|
51
|
+
getContentWidth();
|
|
52
|
+
}, 0);
|
|
53
|
+
}
|
|
54
|
+
}, [visible]);
|
|
55
|
+
const getContentWidth = async () => {
|
|
56
|
+
let rect;
|
|
57
|
+
if (targetId) {
|
|
58
|
+
if (Taro.getEnv() == Taro.ENV_TYPE.WEB) {
|
|
59
|
+
rect = getRect(document.querySelector(`#${targetId}`));
|
|
60
|
+
} else {
|
|
61
|
+
rect = await getRectTaro(targetId);
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
rect = await getRectByTaro(popoverRef.current);
|
|
65
|
+
}
|
|
66
|
+
setRootPosition({
|
|
67
|
+
width: rect.width,
|
|
68
|
+
height: rect.height,
|
|
69
|
+
left: rect.left,
|
|
70
|
+
top: rect.top,
|
|
71
|
+
right: rect.right
|
|
72
|
+
});
|
|
73
|
+
setTimeout(() => {
|
|
74
|
+
getPopoverContentW();
|
|
75
|
+
}, 300);
|
|
76
|
+
};
|
|
77
|
+
const getRectTaro = async (targetId2) => {
|
|
78
|
+
return new Promise((resolve) => {
|
|
79
|
+
const query = Taro.createSelectorQuery();
|
|
80
|
+
query.select(`#${targetId2}`) && query.select(`#${targetId2}`).boundingClientRect();
|
|
81
|
+
query.exec(function(res) {
|
|
82
|
+
resolve(res[0]);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const getPopoverContentW = async () => {
|
|
87
|
+
let rectContent = await getRectByTaro(popoverContentRef.current);
|
|
88
|
+
setElWidth(rectContent.width);
|
|
89
|
+
setElHeight(rectContent.height);
|
|
90
|
+
};
|
|
91
|
+
const clickAway = () => {
|
|
92
|
+
if (closeOnClickOutside) {
|
|
93
|
+
props.onClick && props.onClick();
|
|
94
|
+
onClose && onClose();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const classes = classNames({
|
|
98
|
+
[`${classPrefix}`]: true
|
|
99
|
+
}, className);
|
|
100
|
+
const customStyle = () => {
|
|
101
|
+
const styles = {};
|
|
102
|
+
if (background) {
|
|
103
|
+
styles.background = background;
|
|
104
|
+
}
|
|
105
|
+
if (color) {
|
|
106
|
+
styles.color = color;
|
|
107
|
+
}
|
|
108
|
+
return styles;
|
|
109
|
+
};
|
|
110
|
+
const popoverArrow = () => {
|
|
111
|
+
const prefixCls = "nut-popover-arrow";
|
|
112
|
+
const loca = location;
|
|
113
|
+
const direction = loca.split("-")[0];
|
|
114
|
+
return `${prefixCls} ${prefixCls}-${direction} ${prefixCls}--${loca}`;
|
|
115
|
+
};
|
|
116
|
+
const popoverArrowStyle = () => {
|
|
117
|
+
const styles = {};
|
|
118
|
+
const { background: background2 } = props;
|
|
119
|
+
const direction = location.split("-")[0];
|
|
120
|
+
if (background2) {
|
|
121
|
+
styles[`border${upperCaseFirst(direction)}Color`] = background2;
|
|
122
|
+
}
|
|
123
|
+
return styles;
|
|
124
|
+
};
|
|
125
|
+
const getRootPosition = () => {
|
|
126
|
+
let styles = {};
|
|
127
|
+
if (!rootPosition) {
|
|
128
|
+
styles.visibility = "hidden";
|
|
129
|
+
return styles;
|
|
130
|
+
}
|
|
131
|
+
const contentWidth = elWidth;
|
|
132
|
+
const contentHeight = elHeight;
|
|
133
|
+
const { width, height, left, top, right } = rootPosition;
|
|
134
|
+
const direction = location.split("-")[0];
|
|
135
|
+
const skew = location.split("-")[1];
|
|
136
|
+
let cross = 0;
|
|
137
|
+
let parallel = 0;
|
|
138
|
+
if (Array.isArray(offset) && offset.length == 2) {
|
|
139
|
+
cross += +offset[1];
|
|
140
|
+
parallel += +offset[0];
|
|
141
|
+
}
|
|
142
|
+
if (width) {
|
|
143
|
+
if (["bottom", "top"].includes(direction)) {
|
|
144
|
+
const h = direction == "bottom" ? height + cross : -(contentHeight + cross);
|
|
145
|
+
styles.top = `${top + h}px`;
|
|
146
|
+
if (!skew) {
|
|
147
|
+
styles.left = `${-(contentWidth - width) / 2 + left + parallel}px`;
|
|
148
|
+
}
|
|
149
|
+
if (skew == "start") {
|
|
150
|
+
styles.left = `${left + parallel}px`;
|
|
151
|
+
}
|
|
152
|
+
if (skew == "end") {
|
|
153
|
+
styles.left = `${right + parallel}px`;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (["left", "right"].includes(direction)) {
|
|
157
|
+
const contentW = direction == "left" ? -(contentWidth + cross) : width + cross;
|
|
158
|
+
styles.left = `${left + contentW}px`;
|
|
159
|
+
if (!skew) {
|
|
160
|
+
styles.top = `${top - contentHeight / 2 + height / 2 - 4 + parallel}px`;
|
|
161
|
+
}
|
|
162
|
+
if (skew == "start") {
|
|
163
|
+
styles.top = `${top + parallel}px`;
|
|
164
|
+
}
|
|
165
|
+
if (skew == "end") {
|
|
166
|
+
styles.top = `${top + height + parallel}px`;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (elWidth === 0) {
|
|
171
|
+
styles.visibility = "hidden";
|
|
172
|
+
} else {
|
|
173
|
+
styles.visibility = "initial";
|
|
174
|
+
}
|
|
175
|
+
return styles;
|
|
176
|
+
};
|
|
177
|
+
const handleSelect = (item, index) => {
|
|
178
|
+
if (!item.disabled) {
|
|
179
|
+
onSelect(item, index);
|
|
180
|
+
}
|
|
181
|
+
if (closeOnClickAction) {
|
|
182
|
+
props.onClick && props.onClick();
|
|
183
|
+
onClose && onClose();
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
return React.createElement(
|
|
187
|
+
React.Fragment,
|
|
188
|
+
null,
|
|
189
|
+
!targetId && React.createElement("div", { className: "nut-popover-wrapper", ref: popoverRef, onClick: () => {
|
|
190
|
+
props.onClick && props.onClick();
|
|
191
|
+
if (!visible) {
|
|
192
|
+
onOpen && onOpen();
|
|
193
|
+
} else {
|
|
194
|
+
onClose && onClose();
|
|
195
|
+
}
|
|
196
|
+
}, style }, Array.isArray(children) ? children[0] : children),
|
|
197
|
+
React.createElement(
|
|
198
|
+
"div",
|
|
199
|
+
{ className: classes, style: getRootPosition(), ...reset },
|
|
200
|
+
React.createElement(
|
|
201
|
+
Popup,
|
|
202
|
+
{ className: `nut-popover-content nut-popover-content--${location}`, style: customStyle(), position: "default", overlay, overlayStyle, overlayClassName, closeOnOverlayClick, visible: showPopup },
|
|
203
|
+
React.createElement(
|
|
204
|
+
"div",
|
|
205
|
+
{ className: "nut-popover-content-group", ref: popoverContentRef },
|
|
206
|
+
showArrow && React.createElement("div", { className: popoverArrow(), style: popoverArrowStyle() }),
|
|
207
|
+
Array.isArray(children) ? children[1] : "",
|
|
208
|
+
list.map((item, index) => {
|
|
209
|
+
return React.createElement(
|
|
210
|
+
"div",
|
|
211
|
+
{ className: classNames({
|
|
212
|
+
"nut-popover-menu-item": true,
|
|
213
|
+
"nut-popover-menu-disabled": item.disabled
|
|
214
|
+
}, item.className), key: item.key, onClick: () => handleSelect(item, index) },
|
|
215
|
+
item.icon ? item.icon : null,
|
|
216
|
+
React.createElement("div", { className: "nut-popover-menu-item-name" }, item.name)
|
|
217
|
+
);
|
|
218
|
+
})
|
|
219
|
+
)
|
|
220
|
+
),
|
|
221
|
+
showPopup && React.createElement("div", { className: "nut-popover-content-bg", onClick: clickAway, onTouchMove: clickAway })
|
|
222
|
+
)
|
|
223
|
+
);
|
|
224
|
+
};
|
|
225
|
+
Popover.defaultProps = defaultProps;
|
|
226
|
+
Popover.displayName = "NutPopover";
|
|
227
|
+
export {
|
|
228
|
+
Popover as P
|
|
229
|
+
};
|
|
@@ -2,7 +2,7 @@ import React, { useState, useRef, useEffect, useCallback } from "react";
|
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import { View } from "@tarojs/components";
|
|
4
4
|
import { u as useTouch } from "./use-touch-ff43512c.js";
|
|
5
|
-
import { g as getRectByTaro } from "./use-client-rect-
|
|
5
|
+
import { g as getRectByTaro } from "./use-client-rect-2bb6c562.js";
|
|
6
6
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
7
7
|
import { u as usePropsValue } from "./use-props-value-7ac1b1b5.js";
|
|
8
8
|
const defaultProps = {
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
2
3
|
import { P as Popup } from "./popup.taro-e756f3fc.js";
|
|
3
|
-
import { O as OffsetContext } from "./
|
|
4
|
+
import { O as OffsetContext } from "./context-f32a9246.js";
|
|
5
|
+
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
4
6
|
const defaultProps = {
|
|
5
|
-
|
|
7
|
+
...ComponentDefaults,
|
|
6
8
|
position: "left",
|
|
7
9
|
width: "80%"
|
|
8
10
|
};
|
|
9
11
|
const SideNavBar = (props) => {
|
|
10
|
-
const
|
|
12
|
+
const classPrefix = "nut-sidenavbar";
|
|
13
|
+
const { title, visible, width, position, children, className, onClose, ...rest } = {
|
|
11
14
|
...defaultProps,
|
|
12
15
|
...props
|
|
13
16
|
};
|
|
14
|
-
const
|
|
17
|
+
const indent = props.indent ? Number(props.indent) : 20;
|
|
15
18
|
const [sidenavbarShow, setSidenavbarShow] = useState(true);
|
|
16
19
|
const handleClick = () => {
|
|
17
20
|
setSidenavbarShow(!sidenavbarShow);
|
|
@@ -21,23 +24,23 @@ const SideNavBar = (props) => {
|
|
|
21
24
|
{ visible, style: { width, height: "100%" }, position, onClose },
|
|
22
25
|
React.createElement(
|
|
23
26
|
"div",
|
|
24
|
-
{ className: className
|
|
27
|
+
{ className: classNames(className, classPrefix), ...rest },
|
|
25
28
|
React.createElement(
|
|
26
29
|
"div",
|
|
27
|
-
{ className:
|
|
30
|
+
{ className: `${classPrefix}__content` },
|
|
28
31
|
React.createElement(
|
|
29
32
|
"div",
|
|
30
|
-
{ className:
|
|
33
|
+
{ className: `${classPrefix}__list ${sidenavbarShow ? "sidenavbar-show" : "sidenavbar-hide"}`, onClick: handleClick },
|
|
31
34
|
React.createElement(
|
|
32
35
|
"div",
|
|
33
|
-
{ className:
|
|
36
|
+
{ className: `${classPrefix}__title ${classPrefix}-border-bt`, style: { paddingLeft: `${indent}px` } },
|
|
34
37
|
title,
|
|
35
38
|
React.createElement("i", { className: `arrow-icon ${sidenavbarShow ? "arrow-up" : "arrow-down"}` })
|
|
36
39
|
),
|
|
37
40
|
React.createElement(
|
|
38
41
|
OffsetContext.Provider,
|
|
39
|
-
{ value:
|
|
40
|
-
React.createElement("div", { className:
|
|
42
|
+
{ value: indent },
|
|
43
|
+
React.createElement("div", { className: `${classPrefix}__content` }, children)
|
|
41
44
|
)
|
|
42
45
|
)
|
|
43
46
|
)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
const SideNavBarItem = (props) => {
|
|
3
|
+
const classPrefix = "nut-subsidenavbar";
|
|
4
|
+
const { title, value, children, onClick, ...rest } = props;
|
|
5
|
+
const clickFn = (e) => {
|
|
6
|
+
e.stopPropagation();
|
|
7
|
+
onClick && onClick({ title, value });
|
|
8
|
+
};
|
|
9
|
+
return React.createElement("div", { className: `${classPrefix}__item ${classPrefix}-border-bt`, onClick: clickFn, ...rest }, title);
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
SideNavBarItem as S
|
|
13
|
+
};
|
|
@@ -2,7 +2,7 @@ import React, { useRef, useEffect, useState, useMemo, useCallback } from "react"
|
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import { getEnv, usePageScroll, getSystemInfoSync } from "@tarojs/taro";
|
|
4
4
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
5
|
-
import { g as getRectByTaro } from "./use-client-rect-
|
|
5
|
+
import { g as getRectByTaro } from "./use-client-rect-2bb6c562.js";
|
|
6
6
|
import { c as canUseDom } from "./can-use-dom-0e539bd3.js";
|
|
7
7
|
function useWatch(dep, callback, config = { immediate: false }) {
|
|
8
8
|
const { immediate } = config;
|
|
@@ -118,7 +118,7 @@ const Sticky = (props) => {
|
|
|
118
118
|
setFixed(windowHeight - threshold < curRootRect.bottom);
|
|
119
119
|
}
|
|
120
120
|
} else {
|
|
121
|
-
console.
|
|
121
|
+
console.warn("getRectByTaro获取失败", { stickyRect, curRootRect });
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
124
|
const getElement = useCallback(() => {
|