@nutui/nutui-react-taro 4.0.0-beta.4 → 4.0.0-beta.6
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/cjs/hooks/use-props-value.js +1 -1
- package/dist/cjs/hooks/use-touch.js +4 -4
- package/dist/cjs/packages/address/cascaderRender.js +1 -1
- package/dist/cjs/packages/address/existRender.js +1 -1
- package/dist/cjs/packages/audio/audio.js +1 -1
- package/dist/cjs/packages/avatarcropper/avatarcropper.js +1 -1
- package/dist/cjs/packages/badge/badge.js +1 -1
- package/dist/cjs/packages/barrage/barrage.js +1 -1
- package/dist/cjs/packages/button/button.js +1 -1
- package/dist/cjs/packages/card/card.js +1 -1
- package/dist/cjs/packages/cascader/utils.js +7 -6
- package/dist/cjs/packages/cellgroup/cellgroup.js +1 -1
- package/dist/cjs/packages/checkboxgroup/checkboxgroup.js +3 -3
- package/dist/cjs/packages/circleprogress/circleprogress.js +1 -1
- package/dist/cjs/packages/collapseitem/collapseitem.js +1 -1
- package/dist/cjs/packages/countdown/countdown.js +1 -1
- package/dist/cjs/packages/datepicker/datepicker.js +1 -1
- package/dist/cjs/packages/dialog/dialog.js +2 -2
- package/dist/cjs/packages/divider/divider.js +1 -1
- package/dist/cjs/packages/elevator/elevator.js +1 -1
- package/dist/cjs/packages/ellipsis/ellipsis.js +1 -1
- package/dist/cjs/packages/form/form.js +1 -1
- package/dist/cjs/packages/grid/grid.js +1 -1
- package/dist/cjs/packages/griditem/griditem.js +1 -1
- package/dist/cjs/packages/image/image.js +1 -1
- package/dist/cjs/packages/imagepreview/imagepreview.js +2 -2
- package/dist/cjs/packages/indicator/indicator.js +1 -1
- package/dist/cjs/packages/infiniteloading/infiniteloading.js +3 -3
- package/dist/cjs/packages/input/input.js +1 -1
- package/dist/cjs/packages/inputnumber/inputnumber.js +1 -1
- package/dist/cjs/packages/loading/loading.js +1 -1
- package/dist/cjs/packages/menu/menu.js +1 -1
- package/dist/cjs/packages/overlay/overlay.js +1 -1
- package/dist/cjs/packages/pagination/pagination.js +1 -1
- package/dist/cjs/packages/picker/picker.js +1 -1
- package/dist/cjs/packages/pickerview/pickerroller.js +1 -1
- package/dist/cjs/packages/popover/popover.js +1 -1
- package/dist/cjs/packages/progress/progress.js +6 -9
- package/dist/cjs/packages/quickenter/quickenter.js +2 -2
- package/dist/cjs/packages/radio/radio.js +1 -1
- package/dist/cjs/packages/radiogroup/radiogroup.js +3 -3
- package/dist/cjs/packages/range/range.js +3 -3
- package/dist/cjs/packages/shortpassword/shortpassword.js +1 -1
- package/dist/cjs/packages/sidebar/sidebar.js +1 -1
- package/dist/cjs/packages/signature/signature.js +2 -2
- package/dist/cjs/packages/skeleton/skeleton.js +1 -1
- package/dist/cjs/packages/sticky/sticky.js +3 -3
- package/dist/cjs/packages/swiper/swiper.js +1 -1
- package/dist/cjs/packages/switch/switch.js +1 -1
- package/dist/cjs/packages/tabbaritem/tabbaritem.js +1 -1
- package/dist/cjs/packages/table/table.js +1 -1
- package/dist/cjs/packages/tabs/tabs.js +1 -1
- package/dist/cjs/packages/textarea/textarea.js +1 -1
- package/dist/cjs/packages/timeselect/timeselect.js +1 -1
- package/dist/cjs/packages/toast/toast.js +2 -2
- package/dist/cjs/packages/trendarrow/trendarrow.js +1 -1
- package/dist/cjs/packages/uploader/uploader.js +1 -1
- package/dist/cjs/packages/video/video.js +2 -2
- package/dist/cjs/packages/virtuallist/utils.js +1 -1
- package/dist/cjs/packages/virtuallist/virtuallist.js +1 -1
- package/dist/cjs/utils/scale-f.js +1 -3
- package/dist/es/hooks/taro/use-custom-event.js +3 -3
- package/dist/es/hooks/taro/use-lock-scoll.js +1 -1
- package/dist/es/hooks/use-click-away.js +2 -2
- package/dist/es/hooks/use-lock-scroll.js +3 -3
- package/dist/es/hooks/use-pagination.js +1 -1
- package/dist/es/hooks/use-ref-state.js +3 -3
- package/dist/es/hooks/use-touch.js +13 -13
- package/dist/es/hooks/use-watch.js +1 -1
- package/dist/es/locales/en-US.js +4 -4
- package/dist/es/locales/id-ID.js +4 -4
- package/dist/es/locales/ja-JP.js +4 -4
- package/dist/es/locales/tr-TR.js +4 -4
- package/dist/es/locales/vi-VN.js +4 -4
- package/dist/es/locales/zh-CN.js +4 -4
- package/dist/es/locales/zh-TW.js +4 -4
- package/dist/es/locales/zh-UG.js +4 -4
- package/dist/es/packages/actionsheet/actionsheet.js +8 -8
- package/dist/es/packages/address/address.js +10 -10
- package/dist/es/packages/address/cascaderRender.js +4 -4
- package/dist/es/packages/address/elevatorRender.js +17 -17
- package/dist/es/packages/address/existRender.js +5 -5
- package/dist/es/packages/address/utils.js +5 -5
- package/dist/es/packages/animate/animate.js +3 -3
- package/dist/es/packages/animatingnumbers/countup.js +1 -1
- package/dist/es/packages/audio/audio.js +16 -16
- package/dist/es/packages/avatar/avatar.js +3 -3
- package/dist/es/packages/avatarcropper/avatarcropper.js +25 -25
- package/dist/es/packages/avatargroup/avatargroup.js +1 -1
- package/dist/es/packages/backtop/backtop.js +3 -3
- package/dist/es/packages/badge/badge.js +3 -3
- package/dist/es/packages/barrage/barrage.js +9 -9
- package/dist/es/packages/button/button.js +4 -4
- package/dist/es/packages/calendar/calendar.js +12 -12
- package/dist/es/packages/calendar/utils.js +7 -7
- package/dist/es/packages/calendarcard/calendarcard.js +22 -22
- package/dist/es/packages/calendarcard/icon.js +5 -5
- package/dist/es/packages/calendarcard/utils.js +5 -5
- package/dist/es/packages/calendaritem/calendaritem.js +32 -32
- package/dist/es/packages/card/card.js +2 -2
- package/dist/es/packages/cascader/cascader.js +15 -15
- package/dist/es/packages/cascader/utils.js +9 -8
- package/dist/es/packages/cell/cell.js +4 -4
- package/dist/es/packages/cellgroup/cellgroup.js +2 -2
- package/dist/es/packages/checkbox/checkbox.js +10 -10
- package/dist/es/packages/checkboxgroup/checkboxgroup.js +7 -7
- package/dist/es/packages/circleprogress/circleprogress.js +7 -7
- package/dist/es/packages/col/col.js +2 -2
- package/dist/es/packages/collapse/collapse.js +3 -3
- package/dist/es/packages/collapse/context.js +2 -2
- package/dist/es/packages/collapseitem/collapseitem.js +5 -5
- package/dist/es/packages/configprovider/configprovider.js +5 -5
- package/dist/es/packages/countdown/countdown.js +15 -15
- package/dist/es/packages/datepicker/datepicker.js +12 -12
- package/dist/es/packages/datepicker/utils.js +7 -7
- package/dist/es/packages/datepickerview/datepickerview.js +5 -5
- package/dist/es/packages/dialog/content.js +6 -6
- package/dist/es/packages/dialog/dialog.js +24 -24
- package/dist/es/packages/divider/divider.js +3 -3
- package/dist/es/packages/drag/drag.js +5 -5
- package/dist/es/packages/elevator/elevator.js +17 -17
- package/dist/es/packages/ellipsis/ellipsis.js +14 -14
- package/dist/es/packages/empty/empty.js +1 -1
- package/dist/es/packages/fixednav/fixednav.js +7 -7
- package/dist/es/packages/form/form.js +7 -7
- package/dist/es/packages/form/useform.js +4 -4
- package/dist/es/packages/formitem/formitem.js +1 -1
- package/dist/es/packages/grid/context.js +1 -1
- package/dist/es/packages/grid/grid.js +4 -4
- package/dist/es/packages/griditem/griditem.js +6 -6
- package/dist/es/packages/hoverbutton/hoverbutton.js +1 -1
- package/dist/es/packages/hoverbuttonitem/hoverbuttonitem.js +6 -6
- package/dist/es/packages/hoverbuttonitem/utils.js +1 -1
- package/dist/es/packages/image/image.js +7 -7
- package/dist/es/packages/imagepreview/imagepreview.js +15 -15
- package/dist/es/packages/indicator/indicator.js +5 -5
- package/dist/es/packages/infiniteloading/infiniteloading.js +14 -14
- package/dist/es/packages/input/input.js +13 -13
- package/dist/es/packages/inputnumber/inputnumber.js +12 -12
- package/dist/es/packages/layout/layout.js +1 -1
- package/dist/es/packages/loading/loading.js +3 -3
- package/dist/es/packages/lottie/index.js +1 -1
- package/dist/es/packages/lottie/lottiemp.js +1 -1
- package/dist/es/packages/menu/menu.js +13 -13
- package/dist/es/packages/menuitem/menuitem.js +12 -12
- package/dist/es/packages/navbar/navbar.js +7 -7
- package/dist/es/packages/noticebar/noticebar.js +22 -22
- package/dist/es/packages/notify/notify.js +8 -8
- package/dist/es/packages/numberkeyboard/numberkeyboard.js +12 -12
- package/dist/es/packages/overlay/overlay.js +7 -7
- package/dist/es/packages/pagination/pagination.js +8 -8
- package/dist/es/packages/picker/picker.js +15 -15
- package/dist/es/packages/pickerview/pickerroller.js +12 -12
- package/dist/es/packages/pickerview/pickerview.js +3 -3
- package/dist/es/packages/pickerview/utils.js +6 -6
- package/dist/es/packages/popover/popover.js +15 -15
- package/dist/es/packages/popup/popup.js +26 -26
- package/dist/es/packages/price/price.js +8 -8
- package/dist/es/packages/progress/progress.js +16 -19
- package/dist/es/packages/pulltorefresh/pulltorefresh.js +8 -8
- package/dist/es/packages/quickenter/quickenter.js +14 -14
- package/dist/es/packages/radio/radio.js +11 -11
- package/dist/es/packages/radiogroup/radiogroup.js +6 -6
- package/dist/es/packages/range/range.js +12 -12
- package/dist/es/packages/rate/rate.js +13 -13
- package/dist/es/packages/resultpage/resultpage.js +1 -1
- package/dist/es/packages/row/row.js +4 -4
- package/dist/es/packages/safearea/safearea.js +1 -1
- package/dist/es/packages/searchbar/searchbar.js +4 -4
- package/dist/es/packages/segmented/segmented.js +4 -4
- package/dist/es/packages/shortpassword/shortpassword.js +7 -7
- package/dist/es/packages/sidebar/sidebar.js +11 -11
- package/dist/es/packages/sidebar/utils.js +1 -1
- package/dist/es/packages/sidebaritem/sidebaritem.js +1 -1
- package/dist/es/packages/signature/signature.js +15 -15
- package/dist/es/packages/skeleton/skeleton.js +4 -4
- package/dist/es/packages/space/space.js +1 -1
- package/dist/es/packages/step/step.js +1 -1
- package/dist/es/packages/steps/steps.js +1 -1
- package/dist/es/packages/sticky/sticky.js +5 -5
- package/dist/es/packages/swipe/swipe.js +16 -16
- package/dist/es/packages/swiper/swiper.js +7 -7
- package/dist/es/packages/swiperitem/swiperitem.js +1 -1
- package/dist/es/packages/switch/switch.js +6 -6
- package/dist/es/packages/tabbar/tabbar.js +2 -2
- package/dist/es/packages/tabbaritem/tabbaritem.js +10 -10
- package/dist/es/packages/table/table.js +10 -10
- package/dist/es/packages/tabpane/tabpane.js +1 -1
- package/dist/es/packages/tabs/tabs.js +11 -11
- package/dist/es/packages/tag/tag.js +10 -10
- package/dist/es/packages/textarea/textarea.js +11 -11
- package/dist/es/packages/timedetail/timedetail.js +3 -3
- package/dist/es/packages/timeselect/timeselect.js +6 -6
- package/dist/es/packages/toast/toast.js +10 -10
- package/dist/es/packages/tour/tour.js +10 -10
- package/dist/es/packages/trendarrow/trendarrow.js +4 -4
- package/dist/es/packages/uploader/preview.js +8 -8
- package/dist/es/packages/uploader/uploader.js +19 -19
- package/dist/es/packages/video/video.js +3 -3
- package/dist/es/packages/virtuallist/utils.js +5 -5
- package/dist/es/packages/virtuallist/virtuallist.js +8 -8
- package/dist/es/packages/watermark/watermark.js +2 -2
- package/dist/es/types/spec/empty/base.js +1 -1
- package/dist/es/utils/clamp.js +1 -1
- package/dist/es/utils/date.js +3 -3
- package/dist/es/utils/get-rect.js +1 -1
- package/dist/es/utils/interceptor.js +1 -1
- package/dist/es/utils/is-date.js +1 -1
- package/dist/es/utils/is-empty.js +1 -1
- package/dist/es/utils/is-function.js +1 -1
- package/dist/es/utils/is-object.js +1 -1
- package/dist/es/utils/is-promise.js +1 -1
- package/dist/es/utils/pad-zero.js +1 -1
- package/dist/es/utils/px-check.js +1 -1
- package/dist/es/utils/scale-f.js +2 -4
- package/dist/es/utils/sleep.js +1 -1
- package/dist/es/utils/taro/ConfigurableCSSTransition.js +1 -1
- package/dist/es/utils/taro/get-rect-by-id.js +1 -1
- package/dist/es/utils/taro/get-rect.js +3 -3
- package/dist/es/utils/taro/get-system-info.js +2 -2
- package/dist/es/utils/taro/platform.js +4 -4
- package/dist/es/utils/upper-case-first.js +1 -1
- package/dist/nutui.react.umd.js +1161 -1161
- package/dist/style-jmapp.css +1 -1
- package/dist/style-jmapp.scss +33 -33
- package/dist/style-jrkf.css +1 -1
- package/dist/style-jrkf.scss +32 -32
- package/dist/style.css +1 -1
- package/dist/style.scss +40 -40
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ if (process.env.TARO_ENV === 'jdharmony_cpp') {
|
|
|
10
10
|
doubleLeft = 'https://img13.360buyimg.com/imagetools/jfs/t1/221244/29/45876/259/6731c6bdF515df0a2/624e8eee3c8494a2.png';
|
|
11
11
|
doubleRight = 'https://img11.360buyimg.com/imagetools/jfs/t1/238382/25/24000/235/6731c6bdF0153286c/4a57e60b6e889af3.png';
|
|
12
12
|
}
|
|
13
|
-
var Icon = function(param) {
|
|
13
|
+
var Icon = function Icon(param) {
|
|
14
14
|
var url = param.url;
|
|
15
15
|
var style = {
|
|
16
16
|
width: 18,
|
|
@@ -22,22 +22,22 @@ var Icon = function(param) {
|
|
|
22
22
|
mode: "aspectFit"
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
|
-
export var ArrowLeft = function() {
|
|
25
|
+
export var ArrowLeft = function ArrowLeft() {
|
|
26
26
|
return /*#__PURE__*/ React.createElement(Icon, {
|
|
27
27
|
url: left
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
|
-
export var ArrowRight = function() {
|
|
30
|
+
export var ArrowRight = function ArrowRight() {
|
|
31
31
|
return /*#__PURE__*/ React.createElement(Icon, {
|
|
32
32
|
url: right
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
|
-
export var DoubleLeft = function() {
|
|
35
|
+
export var DoubleLeft = function DoubleLeft() {
|
|
36
36
|
return /*#__PURE__*/ React.createElement(Icon, {
|
|
37
37
|
url: doubleLeft
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
|
-
export var DoubleRight = function() {
|
|
40
|
+
export var DoubleRight = function DoubleRight() {
|
|
41
41
|
return /*#__PURE__*/ React.createElement(Icon, {
|
|
42
42
|
url: doubleRight
|
|
43
43
|
});
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Utils } from "../../utils/date";
|
|
2
|
-
export var convertDateToDay = function(date) {
|
|
2
|
+
export var convertDateToDay = function convertDateToDay(date) {
|
|
3
3
|
return date ? {
|
|
4
4
|
year: date.getFullYear(),
|
|
5
5
|
month: date.getMonth() + 1,
|
|
6
6
|
date: date.getDate()
|
|
7
7
|
} : null;
|
|
8
8
|
};
|
|
9
|
-
export var convertDayToDate = function(day) {
|
|
9
|
+
export var convertDayToDate = function convertDayToDate(day) {
|
|
10
10
|
return day ? new Date(day.year, day.month - 1, day.date) : null;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* 获取当月面板中前一个月的日期数据
|
|
14
|
-
*/ export var getPrevMonthDays = function(year, month, firstDayOfWeek) {
|
|
14
|
+
*/ export var getPrevMonthDays = function getPrevMonthDays(year, month, firstDayOfWeek) {
|
|
15
15
|
var prevMonth = month - 1;
|
|
16
16
|
var prevYear = year;
|
|
17
17
|
if (prevMonth <= 0) {
|
|
@@ -36,7 +36,7 @@ export var convertDayToDate = function(day) {
|
|
|
36
36
|
};
|
|
37
37
|
/**
|
|
38
38
|
* 获取当前月的日期数据
|
|
39
|
-
*/ export var getCurrentMonthDays = function(year, month) {
|
|
39
|
+
*/ export var getCurrentMonthDays = function getCurrentMonthDays(year, month) {
|
|
40
40
|
var days = Utils.getMonthDays("".concat(year), "".concat(month));
|
|
41
41
|
return Array.from(Array(days), function(_, k) {
|
|
42
42
|
return {
|
|
@@ -49,7 +49,7 @@ export var convertDayToDate = function(day) {
|
|
|
49
49
|
};
|
|
50
50
|
/**
|
|
51
51
|
* 根据日期获取当前周的起始日期
|
|
52
|
-
*/ export var getCurrentWeekDays = function(day, firstDayOfWeek) {
|
|
52
|
+
*/ export var getCurrentWeekDays = function getCurrentWeekDays(day, firstDayOfWeek) {
|
|
53
53
|
var current = new Date(day.year, day.month - 1, day.date);
|
|
54
54
|
var count = (current.getDay() + 7 - firstDayOfWeek) % 7;
|
|
55
55
|
return [
|
|
@@ -28,17 +28,17 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
|
28
28
|
showSubTitle: true,
|
|
29
29
|
scrollAnimation: true,
|
|
30
30
|
firstDayOfWeek: 0,
|
|
31
|
-
disableDate: function(date) {
|
|
31
|
+
disableDate: function disableDate(date) {
|
|
32
32
|
return false;
|
|
33
33
|
},
|
|
34
34
|
renderHeaderButtons: undefined,
|
|
35
35
|
renderDay: undefined,
|
|
36
36
|
renderDayTop: undefined,
|
|
37
37
|
renderDayBottom: undefined,
|
|
38
|
-
onConfirm: function() {},
|
|
39
|
-
onUpdate: function() {},
|
|
40
|
-
onDayClick: function() {},
|
|
41
|
-
onPageChange: function() {}
|
|
38
|
+
onConfirm: function onConfirm() {},
|
|
39
|
+
onUpdate: function onUpdate() {},
|
|
40
|
+
onDayClick: function onDayClick() {},
|
|
41
|
+
onPageChange: function onPageChange() {}
|
|
42
42
|
});
|
|
43
43
|
export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
44
44
|
var locale = useConfig().locale;
|
|
@@ -61,13 +61,13 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
61
61
|
var _useState7 = _sliced_to_array(useState({
|
|
62
62
|
currDateArray: []
|
|
63
63
|
}), 1), state = _useState7[0];
|
|
64
|
-
var getMonthsPanel = function() {
|
|
64
|
+
var getMonthsPanel = function getMonthsPanel() {
|
|
65
65
|
return monthsPanel.current;
|
|
66
66
|
};
|
|
67
|
-
var getMonthsRef = function() {
|
|
67
|
+
var getMonthsRef = function getMonthsRef() {
|
|
68
68
|
return monthsRef.current;
|
|
69
69
|
};
|
|
70
|
-
var resetDefaultValue = function() {
|
|
70
|
+
var resetDefaultValue = function resetDefaultValue() {
|
|
71
71
|
if (defaultValue || Array.isArray(defaultValue) && defaultValue.length > 0) {
|
|
72
72
|
return type !== 'single' ? _to_consumable_array(defaultValue) : defaultValue;
|
|
73
73
|
}
|
|
@@ -77,7 +77,7 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
77
77
|
value: value,
|
|
78
78
|
defaultValue: resetDefaultValue(),
|
|
79
79
|
finalValue: [],
|
|
80
|
-
onChange: function(val) {}
|
|
80
|
+
onChange: function onChange(val) {}
|
|
81
81
|
}), 2), currentDate = _usePropsValue[0], setCurrentDate = _usePropsValue[1];
|
|
82
82
|
var weeksPanel = useRef(null);
|
|
83
83
|
var monthsRef = useRef(null);
|
|
@@ -88,7 +88,7 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
88
88
|
var classPrefix = 'nut-calendar';
|
|
89
89
|
var dayPrefix = 'nut-calendar-day';
|
|
90
90
|
// 获取月数据
|
|
91
|
-
var getMonthData = function(curData, monthNum, type) {
|
|
91
|
+
var getMonthData = function getMonthData(curData, monthNum, type) {
|
|
92
92
|
var i = 0;
|
|
93
93
|
var date = curData;
|
|
94
94
|
var monthData = monthsData;
|
|
@@ -120,7 +120,7 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
120
120
|
}while (i++ < monthNum);
|
|
121
121
|
setMonthsData(monthData);
|
|
122
122
|
};
|
|
123
|
-
var setReachedYearMonthInfo = function(current) {
|
|
123
|
+
var setReachedYearMonthInfo = function setReachedYearMonthInfo(current) {
|
|
124
124
|
var currentMonthsData = monthsData[current];
|
|
125
125
|
var _currentMonthsData_curData = _sliced_to_array(currentMonthsData.curData, 2), year = _currentMonthsData_curData[0], month = _currentMonthsData_curData[1];
|
|
126
126
|
if (currentMonthsData.title === yearMonthTitle) return;
|
|
@@ -132,7 +132,7 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
132
132
|
setYearMonthTitle(currentMonthsData.title);
|
|
133
133
|
};
|
|
134
134
|
// 设置默认的范围
|
|
135
|
-
var setDefaultRange = function(monthNum, current) {
|
|
135
|
+
var setDefaultRange = function setDefaultRange(monthNum, current) {
|
|
136
136
|
var start = 0;
|
|
137
137
|
var end = 0;
|
|
138
138
|
if (monthNum >= 3) {
|
|
@@ -157,7 +157,7 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
157
157
|
setTranslateY(monthsData[start].scrollTop);
|
|
158
158
|
setReachedYearMonthInfo(current);
|
|
159
159
|
};
|
|
160
|
-
var getMonthNum = function() {
|
|
160
|
+
var getMonthNum = function getMonthNum() {
|
|
161
161
|
var monthNum = Number(endDates[1]) - Number(startDates[1]);
|
|
162
162
|
var yearNum = Number(endDates[0]) - Number(startDates[0]);
|
|
163
163
|
if (yearNum > 0) {
|
|
@@ -169,7 +169,7 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
169
169
|
setMonthsNum(monthNum);
|
|
170
170
|
return monthNum;
|
|
171
171
|
};
|
|
172
|
-
var setDefaultDate = function() {
|
|
172
|
+
var setDefaultDate = function setDefaultDate() {
|
|
173
173
|
var defaultData = [];
|
|
174
174
|
// 日期转化为数组,限制初始日期。判断时间范围
|
|
175
175
|
if (type === 'range' && Array.isArray(currentDate)) {
|
|
@@ -227,7 +227,7 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
227
227
|
}
|
|
228
228
|
return defaultData;
|
|
229
229
|
};
|
|
230
|
-
var getCurrentIndex = function(defaultData) {
|
|
230
|
+
var getCurrentIndex = function getCurrentIndex(defaultData) {
|
|
231
231
|
// 设置默认可见区域
|
|
232
232
|
var current = 0;
|
|
233
233
|
var lastCurrent = 0;
|
|
@@ -259,7 +259,7 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
259
259
|
lastCurrent: lastCurrent
|
|
260
260
|
};
|
|
261
261
|
};
|
|
262
|
-
var renderCurrentDate = function() {
|
|
262
|
+
var renderCurrentDate = function renderCurrentDate() {
|
|
263
263
|
var defaultData = setDefaultDate();
|
|
264
264
|
var current = getCurrentIndex(defaultData);
|
|
265
265
|
if (defaultData.length > 0) {
|
|
@@ -302,7 +302,7 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
302
302
|
}
|
|
303
303
|
return current.current;
|
|
304
304
|
};
|
|
305
|
-
var requestAniFrameFunc = function(current, monthNum) {
|
|
305
|
+
var requestAniFrameFunc = function requestAniFrameFunc(current, monthNum) {
|
|
306
306
|
var lastItem = monthsData[monthsData.length - 1];
|
|
307
307
|
var containerHeight = lastItem.cssHeight + lastItem.scrollTop;
|
|
308
308
|
requestAniFrame(function() {
|
|
@@ -319,7 +319,7 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
319
319
|
});
|
|
320
320
|
setAvgHeight(Math.floor(containerHeight / (monthNum + 1)));
|
|
321
321
|
};
|
|
322
|
-
var initData = function() {
|
|
322
|
+
var initData = function initData() {
|
|
323
323
|
// 判断时间范围内存在多少个月
|
|
324
324
|
var monthNum = getMonthNum();
|
|
325
325
|
// 设置月份数据,获取包含月份的所有数据,只需要 set 一次即可。
|
|
@@ -331,7 +331,7 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
331
331
|
useEffect(function() {
|
|
332
332
|
initData();
|
|
333
333
|
}, []);
|
|
334
|
-
var resetRender = function() {
|
|
334
|
+
var resetRender = function resetRender() {
|
|
335
335
|
state.currDateArray.splice(0);
|
|
336
336
|
monthsData.splice(0);
|
|
337
337
|
initData();
|
|
@@ -347,7 +347,7 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
347
347
|
currentDate
|
|
348
348
|
]);
|
|
349
349
|
// 暴露出的API
|
|
350
|
-
var scrollToDate = function(date) {
|
|
350
|
+
var scrollToDate = function scrollToDate(date) {
|
|
351
351
|
if (Utils.compareDate(date, propStartDate)) {
|
|
352
352
|
date = propStartDate;
|
|
353
353
|
} else if (!Utils.compareDate(date, propEndDate)) {
|
|
@@ -383,7 +383,7 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
383
383
|
}
|
|
384
384
|
});
|
|
385
385
|
};
|
|
386
|
-
var monthsViewScroll = function(e) {
|
|
386
|
+
var monthsViewScroll = function monthsViewScroll(e) {
|
|
387
387
|
if (monthsData.length <= 1) {
|
|
388
388
|
return;
|
|
389
389
|
}
|
|
@@ -421,7 +421,7 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
421
421
|
scrollToDate: scrollToDate
|
|
422
422
|
};
|
|
423
423
|
});
|
|
424
|
-
var getClasses = function(day, month) {
|
|
424
|
+
var getClasses = function getClasses(day, month) {
|
|
425
425
|
var dateStr = getCurrDate(day, month);
|
|
426
426
|
if (day.type === 'active') {
|
|
427
427
|
if (propStartDate && Utils.compareDate(dateStr, propStartDate) || propEndDate && Utils.compareDate(propEndDate, dateStr)) {
|
|
@@ -447,7 +447,7 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
447
447
|
}
|
|
448
448
|
return "".concat(dayPrefix, "-disabled");
|
|
449
449
|
};
|
|
450
|
-
var chooseDay = function(day, month, isFirst) {
|
|
450
|
+
var chooseDay = function chooseDay(day, month, isFirst) {
|
|
451
451
|
if (getClasses(day, month) === "".concat(dayPrefix, "-disabled")) {
|
|
452
452
|
return;
|
|
453
453
|
}
|
|
@@ -526,8 +526,8 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
526
526
|
}
|
|
527
527
|
setMonthsData(monthsData.slice());
|
|
528
528
|
};
|
|
529
|
-
var resetSelectedValue = function() {
|
|
530
|
-
var itemData = function(dateArr) {
|
|
529
|
+
var resetSelectedValue = function resetSelectedValue() {
|
|
530
|
+
var itemData = function itemData(dateArr) {
|
|
531
531
|
days = dateArr.split('/');
|
|
532
532
|
days[3] = "".concat(days[0], "/").concat(days[1], "/").concat(days[2]);
|
|
533
533
|
days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
|
|
@@ -543,7 +543,7 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
543
543
|
}
|
|
544
544
|
return days;
|
|
545
545
|
};
|
|
546
|
-
var confirm = function() {
|
|
546
|
+
var confirm = function confirm() {
|
|
547
547
|
if (type === 'range' && state.currDateArray.length === 2 || type !== 'range') {
|
|
548
548
|
var chooseData = state.currDateArray.slice(0);
|
|
549
549
|
onConfirm && onConfirm(chooseData);
|
|
@@ -557,14 +557,14 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
557
557
|
var _obj1;
|
|
558
558
|
var headerClasses = classNames((_obj1 = {}, _define_property(_obj1, "".concat(classPrefix, "-header"), true), _define_property(_obj1, "".concat(classPrefix, "-header-title"), !popup), _obj1));
|
|
559
559
|
// 是否有开始提示
|
|
560
|
-
var isStartTip = function(day, month) {
|
|
560
|
+
var isStartTip = function isStartTip(day, month) {
|
|
561
561
|
return (type === 'range' || type === 'week') && day.type === 'active' && isStart(getCurrDate(day, month), currentDate);
|
|
562
562
|
};
|
|
563
563
|
// 是否有结束提示
|
|
564
|
-
var isEndTip = function(day, month) {
|
|
564
|
+
var isEndTip = function isEndTip(day, month) {
|
|
565
565
|
return currentDate.length >= 2 && (type === 'range' || type === 'week') && day.type === 'active' && isEnd(getCurrDate(day, month), currentDate);
|
|
566
566
|
};
|
|
567
|
-
var renderHeader = function() {
|
|
567
|
+
var renderHeader = function renderHeader() {
|
|
568
568
|
return /*#__PURE__*/ React.createElement(View, {
|
|
569
569
|
className: headerClasses
|
|
570
570
|
}, showTitle && /*#__PURE__*/ React.createElement(View, {
|
|
@@ -583,7 +583,7 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
583
583
|
}, item);
|
|
584
584
|
})));
|
|
585
585
|
};
|
|
586
|
-
var renderContent = function() {
|
|
586
|
+
var renderContent = function renderContent() {
|
|
587
587
|
return /*#__PURE__*/ React.createElement(ScrollView, {
|
|
588
588
|
scrollTop: scrollTop,
|
|
589
589
|
scrollY: true,
|
|
@@ -615,7 +615,7 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
615
615
|
"".concat(classPrefix, "-day"),
|
|
616
616
|
getClasses(day, month)
|
|
617
617
|
].join(' '),
|
|
618
|
-
onClick: function() {
|
|
618
|
+
onClick: function onClick() {
|
|
619
619
|
chooseDay(day, month);
|
|
620
620
|
},
|
|
621
621
|
key: i
|
|
@@ -635,7 +635,7 @@ export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
635
635
|
})));
|
|
636
636
|
}))));
|
|
637
637
|
};
|
|
638
|
-
var renderFooter = function() {
|
|
638
|
+
var renderFooter = function renderFooter() {
|
|
639
639
|
return /*#__PURE__*/ React.createElement(View, {
|
|
640
640
|
className: "nut-calendar-footer"
|
|
641
641
|
}, children, /*#__PURE__*/ React.createElement(View, {
|
|
@@ -21,8 +21,8 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
|
21
21
|
priceTag: '',
|
|
22
22
|
extra: ''
|
|
23
23
|
});
|
|
24
|
-
export var Card = function(props) {
|
|
25
|
-
var
|
|
24
|
+
export var Card = function Card(props) {
|
|
25
|
+
var _$_object_spread = _object_spread({}, defaultProps, props), className = _$_object_spread.className, style = _$_object_spread.style, src = _$_object_spread.src, title = _$_object_spread.title, price = _$_object_spread.price, vipPrice = _$_object_spread.vipPrice, shopDescription = _$_object_spread.shopDescription, delivery = _$_object_spread.delivery, shopName = _$_object_spread.shopName, tag = _$_object_spread.tag, priceTag = _$_object_spread.priceTag, description = _$_object_spread.description, extra = _$_object_spread.extra, rest = _object_without_properties(_$_object_spread, [
|
|
26
26
|
"className",
|
|
27
27
|
"style",
|
|
28
28
|
"src",
|
|
@@ -28,9 +28,9 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
|
28
28
|
closeIconPosition: 'top-right',
|
|
29
29
|
closeIcon: 'close',
|
|
30
30
|
lazy: false,
|
|
31
|
-
onClose: function() {},
|
|
32
|
-
onChange: function() {},
|
|
33
|
-
onPathChange: function() {}
|
|
31
|
+
onClose: function onClose() {},
|
|
32
|
+
onChange: function onChange() {},
|
|
33
|
+
onPathChange: function onPathChange() {}
|
|
34
34
|
});
|
|
35
35
|
export var Cascader = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
36
36
|
var classPrefix = 'nut-cascader';
|
|
@@ -45,7 +45,7 @@ export var Cascader = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
45
45
|
value: outerValue,
|
|
46
46
|
defaultValue: outerDefaultValue,
|
|
47
47
|
finalValue: [],
|
|
48
|
-
onChange: function(value) {
|
|
48
|
+
onChange: function onChange(value) {
|
|
49
49
|
var _props_onChange, _props_onPathChange;
|
|
50
50
|
(_props_onChange = props.onChange) === null || _props_onChange === void 0 ? void 0 : _props_onChange.call(props, value, pathNodes.current);
|
|
51
51
|
(_props_onPathChange = props.onPathChange) === null || _props_onPathChange === void 0 ? void 0 : _props_onPathChange.call(props, value, pathNodes.current);
|
|
@@ -124,7 +124,7 @@ export var Cascader = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
124
124
|
var _usePropsValue1 = _sliced_to_array(usePropsValue({
|
|
125
125
|
value: outerVisible,
|
|
126
126
|
defaultValue: undefined,
|
|
127
|
-
onChange: function(value) {
|
|
127
|
+
onChange: function onChange(value) {
|
|
128
128
|
if (value === false) {
|
|
129
129
|
var _props_onClose;
|
|
130
130
|
(_props_onClose = props.onClose) === null || _props_onClose === void 0 ? void 0 : _props_onClose.call(props);
|
|
@@ -132,10 +132,10 @@ export var Cascader = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
132
132
|
}
|
|
133
133
|
}), 2), visible = _usePropsValue1[0], setVisible = _usePropsValue1[1];
|
|
134
134
|
var actions = {
|
|
135
|
-
open: function() {
|
|
135
|
+
open: function open() {
|
|
136
136
|
setVisible(true);
|
|
137
137
|
},
|
|
138
|
-
close: function() {
|
|
138
|
+
close: function close() {
|
|
139
139
|
setVisible(false);
|
|
140
140
|
}
|
|
141
141
|
};
|
|
@@ -174,7 +174,7 @@ export var Cascader = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
174
174
|
outerOptions
|
|
175
175
|
]);
|
|
176
176
|
useEffect(function() {
|
|
177
|
-
var load = function() {
|
|
177
|
+
var load = function load() {
|
|
178
178
|
return _async_to_generator(function() {
|
|
179
179
|
var parent, error;
|
|
180
180
|
return _ts_generator(this, function(_state) {
|
|
@@ -264,7 +264,7 @@ export var Cascader = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
264
264
|
}, [
|
|
265
265
|
lazy
|
|
266
266
|
]);
|
|
267
|
-
var chooseItem = function(pane, levelIndex) {
|
|
267
|
+
var chooseItem = function chooseItem(pane, levelIndex) {
|
|
268
268
|
return _async_to_generator(function() {
|
|
269
269
|
var nextValue, nextPathNodes, _props_onPathChange, asyncOptions;
|
|
270
270
|
return _ts_generator(this, function(_state) {
|
|
@@ -321,7 +321,7 @@ export var Cascader = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
321
321
|
});
|
|
322
322
|
})();
|
|
323
323
|
};
|
|
324
|
-
var renderCascaderItem = function(item, levelIndex) {
|
|
324
|
+
var renderCascaderItem = function renderCascaderItem(item, levelIndex) {
|
|
325
325
|
var _item_pane;
|
|
326
326
|
return (_item_pane = item.pane) === null || _item_pane === void 0 ? void 0 : _item_pane.map(function(pane, index) {
|
|
327
327
|
var active = item.selected === pane.value;
|
|
@@ -336,7 +336,7 @@ export var Cascader = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
336
336
|
color: active ? activeColor : ''
|
|
337
337
|
},
|
|
338
338
|
key: pane.value,
|
|
339
|
-
onClick: function() {
|
|
339
|
+
onClick: function onClick() {
|
|
340
340
|
chooseItem(pane, levelIndex);
|
|
341
341
|
}
|
|
342
342
|
}, /*#__PURE__*/ React.createElement(View, {
|
|
@@ -350,14 +350,14 @@ export var Cascader = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
350
350
|
})));
|
|
351
351
|
});
|
|
352
352
|
};
|
|
353
|
-
var renderTab = function() {
|
|
353
|
+
var renderTab = function renderTab() {
|
|
354
354
|
return /*#__PURE__*/ React.createElement(View, {
|
|
355
355
|
className: classNames(classPrefix, props.className),
|
|
356
356
|
style: props.style
|
|
357
357
|
}, /*#__PURE__*/ React.createElement(Tabs, {
|
|
358
358
|
align: "left",
|
|
359
359
|
value: tabActiveIndex,
|
|
360
|
-
onChange: function(index) {
|
|
360
|
+
onChange: function onChange(index) {
|
|
361
361
|
var _props_onTabsChange;
|
|
362
362
|
(_props_onTabsChange = props.onTabsChange) === null || _props_onTabsChange === void 0 ? void 0 : _props_onTabsChange.call(props, Number(index));
|
|
363
363
|
setTabActiveIndex(Number(index));
|
|
@@ -380,10 +380,10 @@ export var Cascader = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
380
380
|
closeIconPosition: closeIconPosition,
|
|
381
381
|
title: props.title,
|
|
382
382
|
left: props.left,
|
|
383
|
-
onOverlayClick: function() {
|
|
383
|
+
onOverlayClick: function onOverlayClick() {
|
|
384
384
|
return setVisible(false);
|
|
385
385
|
},
|
|
386
|
-
onCloseIconClick: function() {
|
|
386
|
+
onCloseIconClick: function onCloseIconClick() {
|
|
387
387
|
return setVisible(false);
|
|
388
388
|
}
|
|
389
389
|
}), renderTab()) : renderTab();
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
2
3
|
import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
|
|
3
4
|
import { _ as _to_property_key } from "@swc/helpers/_/_to_property_key";
|
|
4
|
-
export var normalizeOptions = function(options, keyMap) {
|
|
5
|
+
export var normalizeOptions = function normalizeOptions1(options, keyMap) {
|
|
5
6
|
if (!options) return undefined;
|
|
6
7
|
return options.map(function(opt) {
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
var _key = keyMap.textKey, _key1 = keyMap.valueKey, _key2 = keyMap.childrenKey, text = opt[_key], value = opt[_key1], children = opt[_key2], others = _object_without_properties(opt, [
|
|
9
|
+
_key,
|
|
10
|
+
_key1,
|
|
11
|
+
_key2
|
|
11
12
|
].map(_to_property_key));
|
|
12
|
-
return _object_spread({
|
|
13
|
+
return _object_spread_props(_object_spread({}, others), {
|
|
13
14
|
text: text,
|
|
14
15
|
value: value,
|
|
15
16
|
children: normalizeOptions(children, keyMap)
|
|
16
|
-
}
|
|
17
|
+
});
|
|
17
18
|
});
|
|
18
19
|
};
|
|
19
|
-
export var normalizeListOptions = function(options, format) {
|
|
20
|
+
export var normalizeListOptions = function normalizeListOptions(options, format) {
|
|
20
21
|
var defaultConvertConfig = {
|
|
21
22
|
topId: null,
|
|
22
23
|
idKey: 'id',
|
|
@@ -17,14 +17,14 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
|
17
17
|
align: 'flex-start',
|
|
18
18
|
clickable: false,
|
|
19
19
|
isLast: false,
|
|
20
|
-
onClick: function(event) {}
|
|
20
|
+
onClick: function onClick(event) {}
|
|
21
21
|
});
|
|
22
22
|
var classPrefix = 'nut-cell';
|
|
23
|
-
export var Cell = function(props) {
|
|
23
|
+
export var Cell = function Cell(props) {
|
|
24
24
|
var ctx = useContext(CellGroupContext);
|
|
25
25
|
var _$_object_spread = _object_spread({}, defaultProps, props), children = _$_object_spread.children, onClick = _$_object_spread.onClick, title = _$_object_spread.title, description = _$_object_spread.description, extra = _$_object_spread.extra, radius = _$_object_spread.radius, align = _$_object_spread.align, isLast = _$_object_spread.isLast, className = _$_object_spread.className, style = _$_object_spread.style, clickable = _$_object_spread.clickable;
|
|
26
26
|
var rtl = useRtl();
|
|
27
|
-
var handleClick = function(event) {
|
|
27
|
+
var handleClick = function handleClick(event) {
|
|
28
28
|
onClick(event);
|
|
29
29
|
};
|
|
30
30
|
var radiusNumber = Number(String(radius).replace(/[^\d]/g, ''));
|
|
@@ -42,7 +42,7 @@ export var Cell = function(props) {
|
|
|
42
42
|
className,
|
|
43
43
|
_define_property({}, "".concat(classPrefix, "-group-item"), ctx === null || ctx === void 0 ? void 0 : ctx.group)
|
|
44
44
|
], clickable ? "".concat(classPrefix, "-clickable") : '')),
|
|
45
|
-
onClick: function(event) {
|
|
45
|
+
onClick: function onClick(event) {
|
|
46
46
|
return handleClick(event);
|
|
47
47
|
},
|
|
48
48
|
style: baseStyle
|
|
@@ -12,8 +12,8 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
|
12
12
|
divider: true
|
|
13
13
|
});
|
|
14
14
|
var classPrefix = 'nut-cell-group';
|
|
15
|
-
export var CellGroup = function(props) {
|
|
16
|
-
var
|
|
15
|
+
export var CellGroup = function CellGroup(props) {
|
|
16
|
+
var _$_object_spread = _object_spread({}, defaultProps, props), children = _$_object_spread.children, className = _$_object_spread.className, title = _$_object_spread.title, description = _$_object_spread.description, divider = _$_object_spread.divider, rest = _object_without_properties(_$_object_spread, [
|
|
17
17
|
"children",
|
|
18
18
|
"className",
|
|
19
19
|
"title",
|
|
@@ -17,10 +17,10 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
|
17
17
|
icon: null,
|
|
18
18
|
activeIcon: null,
|
|
19
19
|
indeterminateIcon: null,
|
|
20
|
-
onChange: function(value) {}
|
|
20
|
+
onChange: function onChange(value) {}
|
|
21
21
|
});
|
|
22
22
|
var classPrefix = 'nut-checkbox';
|
|
23
|
-
export var Checkbox = function(props) {
|
|
23
|
+
export var Checkbox = function Checkbox(props) {
|
|
24
24
|
var children = _object_spread({}, defaultProps, props).children;
|
|
25
25
|
var icon = props.icon, label = props.label, className = props.className, activeIcon = props.activeIcon, checked = props.checked, value = props.value, defaultChecked = props.defaultChecked, shape = props.shape, disabled = props.disabled, onChange = props.onChange, indeterminate = props.indeterminate, indeterminateIcon = props.indeterminateIcon, others = _object_without_properties(props, [
|
|
26
26
|
"icon",
|
|
@@ -66,13 +66,13 @@ export var Checkbox = function(props) {
|
|
|
66
66
|
}
|
|
67
67
|
innerDisabled = ctx.disabled !== undefined ? ctx.disabled : innerDisabled;
|
|
68
68
|
innerChecked = ctx.value.includes(value);
|
|
69
|
-
setChecked = function(checked) {
|
|
69
|
+
setChecked = function setChecked(checked) {
|
|
70
70
|
if (ctx.disabled) return;
|
|
71
71
|
if (checked) ctx.check(value);
|
|
72
72
|
if (!checked) ctx.uncheck(value);
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
|
-
var renderIcon = function() {
|
|
75
|
+
var renderIcon = function renderIcon() {
|
|
76
76
|
if (innerDisabled) {
|
|
77
77
|
if (innerIndeterminate) {
|
|
78
78
|
// @ts-ignore
|
|
@@ -115,7 +115,7 @@ export var Checkbox = function(props) {
|
|
|
115
115
|
ariaHidden: true
|
|
116
116
|
}));
|
|
117
117
|
};
|
|
118
|
-
var color = function() {
|
|
118
|
+
var color = function color() {
|
|
119
119
|
var cls = "".concat(classPrefix, "-icon ");
|
|
120
120
|
if (innerDisabled) {
|
|
121
121
|
if (innerChecked && !innerIndeterminate) {
|
|
@@ -134,20 +134,20 @@ export var Checkbox = function(props) {
|
|
|
134
134
|
}
|
|
135
135
|
return cls;
|
|
136
136
|
};
|
|
137
|
-
var renderLabel = function() {
|
|
137
|
+
var renderLabel = function renderLabel() {
|
|
138
138
|
var hasLabel = children || label;
|
|
139
139
|
return hasLabel ? /*#__PURE__*/ React.createElement(View, {
|
|
140
140
|
className: classNames("".concat(classPrefix, "-label "), _define_property({}, "".concat(classPrefix, "-label-disabled"), innerDisabled))
|
|
141
141
|
}, hasLabel) : null;
|
|
142
142
|
};
|
|
143
|
-
var handleClick = function() {
|
|
143
|
+
var handleClick = function handleClick() {
|
|
144
144
|
// 禁用的时候直接返回
|
|
145
145
|
if (disabled) return;
|
|
146
146
|
// 先转换状态
|
|
147
147
|
var latestChecked = !innerChecked;
|
|
148
148
|
setChecked(latestChecked);
|
|
149
149
|
};
|
|
150
|
-
var renderButton = function() {
|
|
150
|
+
var renderButton = function renderButton() {
|
|
151
151
|
var _obj;
|
|
152
152
|
return /*#__PURE__*/ React.createElement(View, {
|
|
153
153
|
className: classNames("".concat(classPrefix, "-button"), (_obj = {}, _define_property(_obj, "".concat(classPrefix, "-button-active"), innerChecked), _define_property(_obj, "".concat(classPrefix, "-button-disabled"), disabled), _obj))
|
|
@@ -155,10 +155,10 @@ export var Checkbox = function(props) {
|
|
|
155
155
|
className: classNames("".concat(classPrefix, "-button-icon"))
|
|
156
156
|
}), activeIcon) : null);
|
|
157
157
|
};
|
|
158
|
-
var renderListItem = function() {
|
|
158
|
+
var renderListItem = function renderListItem() {
|
|
159
159
|
return /*#__PURE__*/ React.createElement(React.Fragment, null, renderIcon(), renderLabel());
|
|
160
160
|
};
|
|
161
|
-
var renderCheckboxItem = function() {
|
|
161
|
+
var renderCheckboxItem = function renderCheckboxItem() {
|
|
162
162
|
if (ctx === null || ctx === void 0 ? void 0 : ctx.list) {
|
|
163
163
|
return /*#__PURE__*/ React.createElement(React.Fragment, null, renderListItem());
|
|
164
164
|
}
|
|
@@ -15,13 +15,13 @@ var defaultProps = {
|
|
|
15
15
|
list: false,
|
|
16
16
|
labelPosition: 'right',
|
|
17
17
|
direction: 'vertical',
|
|
18
|
-
onChange: function(value) {},
|
|
19
|
-
onLimit: function(type) {},
|
|
18
|
+
onChange: function onChange(value) {},
|
|
19
|
+
onLimit: function onLimit(type) {},
|
|
20
20
|
options: []
|
|
21
21
|
};
|
|
22
22
|
var classPrefix = 'nut-checkboxgroup';
|
|
23
23
|
export var CheckboxGroup = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
24
|
-
var
|
|
24
|
+
var _$_object_spread = _object_spread({}, defaultProps, props), children = _$_object_spread.children, className = _$_object_spread.className, disabled = _$_object_spread.disabled, list = _$_object_spread.list, value = _$_object_spread.value, defaultValue = _$_object_spread.defaultValue, max = _$_object_spread.max, min = _$_object_spread.min, labelPosition = _$_object_spread.labelPosition, direction = _$_object_spread.direction, options = _$_object_spread.options, onChange = _$_object_spread.onChange, onLimit = _$_object_spread.onLimit, rest = _object_without_properties(_$_object_spread, [
|
|
25
25
|
"children",
|
|
26
26
|
"className",
|
|
27
27
|
"disabled",
|
|
@@ -72,8 +72,8 @@ export var CheckboxGroup = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
72
72
|
onChange: onChange
|
|
73
73
|
}), 2), _value = _usePropsValue[0], setValue = _usePropsValue[1];
|
|
74
74
|
var renderOptions = useCallback(function() {
|
|
75
|
-
return options === null || options === void 0 ? void 0 : options.map(function(
|
|
76
|
-
var label =
|
|
75
|
+
return options === null || options === void 0 ? void 0 : options.map(function(_0) {
|
|
76
|
+
var label = _0.label, value = _0.value, disabled = _0.disabled, onChange = _0.onChange, rest = _object_without_properties(_0, [
|
|
77
77
|
"label",
|
|
78
78
|
"value",
|
|
79
79
|
"disabled",
|
|
@@ -100,7 +100,7 @@ export var CheckboxGroup = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
100
100
|
list: list,
|
|
101
101
|
onLimit: onLimit,
|
|
102
102
|
value: _value,
|
|
103
|
-
check: function(value) {
|
|
103
|
+
check: function check(value) {
|
|
104
104
|
var combined = _to_consumable_array(_value).concat([
|
|
105
105
|
value
|
|
106
106
|
]);
|
|
@@ -111,7 +111,7 @@ export var CheckboxGroup = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
111
111
|
}
|
|
112
112
|
setValue(combined);
|
|
113
113
|
},
|
|
114
|
-
uncheck: function(value) {
|
|
114
|
+
uncheck: function uncheck(value) {
|
|
115
115
|
var reduced = _value.filter(function(item) {
|
|
116
116
|
return item !== value;
|
|
117
117
|
});
|