@nutui/nutui-react 2.0.0-beta.1 → 2.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/esm/ActionSheet.js +2 -2
- package/dist/esm/Avatar.js +2 -0
- package/dist/esm/Calendar/style/style.css +1 -1
- package/dist/esm/Calendar.js +8 -6
- package/dist/esm/CalendarItem.js +288 -291
- package/dist/esm/Cell/style/index.js +1 -1
- package/dist/esm/Cell/style/style.css +1 -1
- package/dist/esm/Cell.js +2 -0
- package/dist/esm/CellGroup.js +47 -4
- package/dist/esm/ConfigProvider.js +6 -483
- package/dist/esm/Dialog/style/style.css +1 -1
- package/dist/esm/Elevator.js +4 -4
- package/dist/esm/Form.js +1 -2
- package/dist/esm/Menu.js +6 -1
- package/dist/esm/MenuItem.js +8 -153
- package/dist/esm/NavBar.js +2 -2
- package/dist/esm/NoticeBar.js +2 -2
- package/dist/esm/NumberKeyboard.js +2 -2
- package/dist/esm/Popover.js +6 -7
- package/dist/esm/SearchBar.js +2 -2
- package/dist/esm/ShortPassword.js +4 -4
- package/dist/esm/Swiper.js +4 -1
- package/dist/esm/TrendArrow.js +11 -11
- package/dist/esm/Uploader.js +4 -4
- package/dist/esm/VirtualList.js +3 -8
- package/dist/esm/cascader2.js +2 -2
- package/dist/esm/configprovider2.js +486 -0
- package/dist/esm/date.js +103 -2
- package/dist/esm/menuitem2.js +156 -0
- package/dist/esm/nutui-react.es.js +30 -30
- package/dist/esm/popup2.js +5 -5
- package/dist/esm/types/src/packages/avatar/avatar.d.ts +4 -1
- package/dist/esm/types/src/packages/avatar/avatar.taro.d.ts +4 -1
- package/dist/esm/types/src/packages/calendar/calendar.d.ts +4 -6
- package/dist/esm/types/src/packages/calendar/calendar.taro.d.ts +4 -6
- package/dist/esm/types/src/packages/calendar/type.d.ts +13 -0
- package/dist/esm/types/src/packages/calendar/utils.d.ts +8 -0
- package/dist/esm/types/src/packages/calendaritem/calendaritem.d.ts +25 -27
- package/dist/esm/types/src/packages/calendaritem/calendaritem.taro.d.ts +26 -28
- package/dist/esm/types/src/packages/cell/cell.d.ts +4 -1
- package/dist/esm/types/src/packages/cell/cell.taro.d.ts +4 -1
- package/dist/esm/types/src/packages/configprovider/types.d.ts +1 -1
- package/dist/esm/types/src/packages/elevator/elevator.d.ts +2 -2
- package/dist/esm/types/src/packages/elevator/elevator.taro.d.ts +2 -2
- package/dist/esm/types/src/packages/menu/menu.d.ts +4 -1
- package/dist/esm/types/src/packages/menu/menu.taro.d.ts +4 -1
- package/dist/esm/types/src/packages/navbar/demo.d.ts +1 -0
- package/dist/esm/types/src/packages/navbar/demo.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/navbar/navbar.d.ts +1 -1
- package/dist/esm/types/src/packages/navbar/navbar.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/noticebar/noticebar.d.ts +1 -1
- package/dist/esm/types/src/packages/noticebar/noticebar.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/nutui.react.build.d.ts +3 -3
- package/dist/esm/types/src/packages/nutui.react.d.ts +5 -5
- package/dist/esm/types/src/packages/nutui.react.scss.d.ts +2 -2
- package/dist/esm/types/src/packages/nutui.react.taro.d.ts +5 -5
- package/dist/esm/types/src/packages/nutui.react.taro.scss.d.ts +2 -2
- package/dist/esm/types/src/packages/nutui.taro.react.build.d.ts +3 -3
- package/dist/esm/types/src/packages/popover/popover.d.ts +2 -2
- package/dist/esm/types/src/packages/popover/popover.taro.d.ts +2 -2
- package/dist/esm/types/src/packages/popup/popup.d.ts +2 -2
- package/dist/esm/types/src/packages/popup/popup.taro.d.ts +2 -2
- package/dist/esm/types/src/packages/searchbar/searchbar.d.ts +1 -1
- package/dist/esm/types/src/packages/searchbar/searchbar.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/swiper/index.d.ts +8 -2
- package/dist/esm/types/src/packages/swiper/index.taro.d.ts +8 -2
- package/dist/esm/types/src/packages/trendarrow/trendarrow.d.ts +3 -3
- package/dist/esm/types/src/packages/trendarrow/trendarrow.taro.d.ts +3 -3
- package/dist/esm/types/src/packages/uploader/uploader.d.ts +1 -1
- package/dist/esm/types/src/packages/uploader/uploader.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/virtuallist/virtuallist.d.ts +2 -2
- package/dist/esm/types/src/packages/virtuallist/virtuallist.taro.d.ts +2 -2
- package/dist/esm/types/src/utils/date.d.ts +19 -3
- 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 +1104 -1011
- package/dist/nutui.react.umd.js +1104 -1011
- package/dist/packages/calendar/calendar.scss +4 -0
- package/dist/packages/cell/cell.scss +2 -0
- package/dist/packages/dialog/dialog.scss +1 -1
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/themes/default.scss +2 -2
- package/dist/styles/variables-jmapp.scss +2 -2
- package/dist/styles/variables.scss +2 -2
- package/dist/types/index.d.ts +3 -3
- package/dist/types/packages/avatar/avatar.d.ts +4 -1
- package/dist/types/packages/calendar/calendar.d.ts +8 -6
- package/dist/types/packages/calendar/type.d.ts +13 -0
- package/dist/types/packages/calendar/utils.d.ts +8 -0
- package/dist/types/packages/calendaritem/calendaritem.d.ts +25 -27
- package/dist/types/packages/cell/cell.d.ts +4 -1
- package/dist/types/packages/configprovider/types.d.ts +1 -1
- package/dist/types/packages/elevator/elevator.d.ts +2 -2
- package/dist/types/packages/menu/menu.d.ts +4 -1
- package/dist/types/packages/navbar/navbar.d.ts +1 -1
- package/dist/types/packages/noticebar/noticebar.d.ts +1 -1
- package/dist/types/packages/popover/popover.d.ts +2 -2
- package/dist/types/packages/popup/popup.d.ts +2 -2
- package/dist/types/packages/searchbar/searchbar.d.ts +1 -1
- package/dist/types/packages/swiper/index.d.ts +8 -2
- package/dist/types/packages/trendarrow/trendarrow.d.ts +3 -3
- package/dist/types/packages/uploader/uploader.d.ts +1 -1
- package/dist/types/packages/virtuallist/utils.d.ts +1 -1
- package/dist/types/packages/virtuallist/virtuallist.d.ts +2 -2
- package/dist/types/utils/date.d.ts +19 -3
- package/package.json +1 -1
- package/dist/esm/cellgroup2.js +0 -50
package/dist/nutui.react.umd.js
CHANGED
|
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9
9
|
return value;
|
|
10
10
|
};
|
|
11
11
|
/*!
|
|
12
|
-
* @nutui/nutui-react v2.0.0-beta.
|
|
12
|
+
* @nutui/nutui-react v2.0.0-beta.3 Fri Jun 30 2023 14:20:38 GMT+0800 (China Standard Time)
|
|
13
13
|
* (c) 2023 @jdf2e.
|
|
14
14
|
* Released under the MIT License.
|
|
15
15
|
*/
|
|
@@ -2498,6 +2498,28 @@ Check the top-level render call using <` + t + ">.");
|
|
|
2498
2498
|
);
|
|
2499
2499
|
Button.displayName = "NutButton";
|
|
2500
2500
|
const defaultProps$1p = {
|
|
2501
|
+
...ComponentDefaults,
|
|
2502
|
+
title: "",
|
|
2503
|
+
description: "",
|
|
2504
|
+
divider: true
|
|
2505
|
+
};
|
|
2506
|
+
const classPrefix$n = "nut-cell-group";
|
|
2507
|
+
const CellGroup = (props) => {
|
|
2508
|
+
const { children, className, style, title, description, divider, ...rest } = {
|
|
2509
|
+
...defaultProps$1p,
|
|
2510
|
+
...props
|
|
2511
|
+
};
|
|
2512
|
+
return /* @__PURE__ */ React.createElement("div", { className: classNames(classPrefix$n, className), ...rest }, title ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix$n}__title` }, title) : null, description ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix$n}__description` }, description) : null, /* @__PURE__ */ React.createElement(
|
|
2513
|
+
"div",
|
|
2514
|
+
{
|
|
2515
|
+
className: `${classPrefix$n}__wrap ${divider ? `${classPrefix$n}__wrap--divider` : ""}`
|
|
2516
|
+
},
|
|
2517
|
+
children
|
|
2518
|
+
));
|
|
2519
|
+
};
|
|
2520
|
+
CellGroup.defaultProps = defaultProps$1p;
|
|
2521
|
+
CellGroup.displayName = "NutCellGroup";
|
|
2522
|
+
const defaultProps$1o = {
|
|
2501
2523
|
...ComponentDefaults,
|
|
2502
2524
|
title: null,
|
|
2503
2525
|
description: null,
|
|
@@ -2507,7 +2529,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
2507
2529
|
onClick: (event) => {
|
|
2508
2530
|
}
|
|
2509
2531
|
};
|
|
2510
|
-
const classPrefix$
|
|
2532
|
+
const classPrefix$m = "nut-cell";
|
|
2511
2533
|
const Cell = (props) => {
|
|
2512
2534
|
const {
|
|
2513
2535
|
children,
|
|
@@ -2521,7 +2543,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
2521
2543
|
style,
|
|
2522
2544
|
...rest
|
|
2523
2545
|
} = {
|
|
2524
|
-
...defaultProps$
|
|
2546
|
+
...defaultProps$1o,
|
|
2525
2547
|
...props
|
|
2526
2548
|
};
|
|
2527
2549
|
const handleClick2 = (event) => {
|
|
@@ -2538,45 +2560,24 @@ Check the top-level render call using <` + t + ">.");
|
|
|
2538
2560
|
return /* @__PURE__ */ React.createElement(
|
|
2539
2561
|
"div",
|
|
2540
2562
|
{
|
|
2541
|
-
className: classNames(classPrefix$
|
|
2563
|
+
className: classNames(classPrefix$m, className),
|
|
2542
2564
|
onClick: (event) => handleClick2(event),
|
|
2543
2565
|
style: baseStyle,
|
|
2544
2566
|
...rest
|
|
2545
2567
|
},
|
|
2546
|
-
children || /* @__PURE__ */ React.createElement(React.Fragment, null, title || description ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix$
|
|
2568
|
+
children || /* @__PURE__ */ React.createElement(React.Fragment, null, title || description ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix$m}__left` }, title ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix$m}__title` }, title) : null, description ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix$m}__description` }, description) : null) : null, extra ? /* @__PURE__ */ React.createElement(
|
|
2547
2569
|
"div",
|
|
2548
2570
|
{
|
|
2549
|
-
className: `${classPrefix$
|
|
2571
|
+
className: `${classPrefix$m}__extra`,
|
|
2550
2572
|
style: styles
|
|
2551
2573
|
},
|
|
2552
2574
|
extra
|
|
2553
|
-
) : null, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix$
|
|
2575
|
+
) : null, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix$m}__divider` }))
|
|
2554
2576
|
);
|
|
2555
2577
|
};
|
|
2556
|
-
Cell.defaultProps = defaultProps$
|
|
2578
|
+
Cell.defaultProps = defaultProps$1o;
|
|
2557
2579
|
Cell.displayName = "NutCell";
|
|
2558
|
-
|
|
2559
|
-
...ComponentDefaults,
|
|
2560
|
-
title: "",
|
|
2561
|
-
description: "",
|
|
2562
|
-
divider: true
|
|
2563
|
-
};
|
|
2564
|
-
const classPrefix$m = "nut-cell-group";
|
|
2565
|
-
const CellGroup = (props) => {
|
|
2566
|
-
const { children, className, style, title, description, divider, ...rest } = {
|
|
2567
|
-
...defaultProps$1o,
|
|
2568
|
-
...props
|
|
2569
|
-
};
|
|
2570
|
-
return /* @__PURE__ */ React.createElement("div", { className: classNames(classPrefix$m, className), ...rest }, title ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix$m}__title` }, title) : null, description ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix$m}__description` }, description) : null, /* @__PURE__ */ React.createElement(
|
|
2571
|
-
"div",
|
|
2572
|
-
{
|
|
2573
|
-
className: `${classPrefix$m}__wrap ${divider ? `${classPrefix$m}__wrap--divider` : ""}`
|
|
2574
|
-
},
|
|
2575
|
-
children
|
|
2576
|
-
));
|
|
2577
|
-
};
|
|
2578
|
-
CellGroup.defaultProps = defaultProps$1o;
|
|
2579
|
-
CellGroup.displayName = "NutCellGroup";
|
|
2580
|
+
Cell.Group = CellGroup;
|
|
2580
2581
|
var INFINITY = 1 / 0;
|
|
2581
2582
|
var symbolTag = "[object Symbol]";
|
|
2582
2583
|
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
|
@@ -9015,8 +9016,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
9015
9016
|
showKeys,
|
|
9016
9017
|
className,
|
|
9017
9018
|
style,
|
|
9018
|
-
|
|
9019
|
-
|
|
9019
|
+
onItemClick,
|
|
9020
|
+
onIndexClick,
|
|
9020
9021
|
children,
|
|
9021
9022
|
...rest
|
|
9022
9023
|
} = {
|
|
@@ -9098,12 +9099,12 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
9098
9099
|
}
|
|
9099
9100
|
});
|
|
9100
9101
|
const handleClickItem = (key, item) => {
|
|
9101
|
-
|
|
9102
|
+
onItemClick && onItemClick(key, item);
|
|
9102
9103
|
setCurrentData(item);
|
|
9103
9104
|
setCurrentKey(key);
|
|
9104
9105
|
};
|
|
9105
9106
|
const handleClickIndex = (key) => {
|
|
9106
|
-
|
|
9107
|
+
onIndexClick && onIndexClick(key);
|
|
9107
9108
|
};
|
|
9108
9109
|
const setListGroup = () => {
|
|
9109
9110
|
if (listview.current) {
|
|
@@ -9301,7 +9302,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
9301
9302
|
safeAreaInsetTop,
|
|
9302
9303
|
placeholder,
|
|
9303
9304
|
zIndex,
|
|
9304
|
-
|
|
9305
|
+
onBackClick
|
|
9305
9306
|
} = {
|
|
9306
9307
|
...defaultProps$1b,
|
|
9307
9308
|
...props
|
|
@@ -9319,7 +9320,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
9319
9320
|
"div",
|
|
9320
9321
|
{
|
|
9321
9322
|
className: `${classPrefix2}__left__back`,
|
|
9322
|
-
onClick: (e) =>
|
|
9323
|
+
onClick: (e) => onBackClick(e)
|
|
9323
9324
|
},
|
|
9324
9325
|
back
|
|
9325
9326
|
), left);
|
|
@@ -11100,8 +11101,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
11100
11101
|
},
|
|
11101
11102
|
onClose: () => {
|
|
11102
11103
|
},
|
|
11103
|
-
|
|
11104
|
-
|
|
11104
|
+
onOverlayClick: (e) => true,
|
|
11105
|
+
onCloseIconClick: (e) => true,
|
|
11105
11106
|
...defaultOverlayProps
|
|
11106
11107
|
};
|
|
11107
11108
|
let _zIndex = 1e3;
|
|
@@ -11130,8 +11131,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
11130
11131
|
portal,
|
|
11131
11132
|
onOpen,
|
|
11132
11133
|
onClose,
|
|
11133
|
-
|
|
11134
|
-
|
|
11134
|
+
onOverlayClick,
|
|
11135
|
+
onCloseIconClick,
|
|
11135
11136
|
afterShow,
|
|
11136
11137
|
afterClose,
|
|
11137
11138
|
onClick
|
|
@@ -11187,7 +11188,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
11187
11188
|
const onHandleClickOverlay = (e) => {
|
|
11188
11189
|
e.stopPropagation();
|
|
11189
11190
|
if (closeOnOverlayClick) {
|
|
11190
|
-
const closed =
|
|
11191
|
+
const closed = onOverlayClick && onOverlayClick(e);
|
|
11191
11192
|
closed && close();
|
|
11192
11193
|
}
|
|
11193
11194
|
};
|
|
@@ -11195,7 +11196,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
11195
11196
|
onClick && onClick(e);
|
|
11196
11197
|
};
|
|
11197
11198
|
const onHandleClickCloseIcon = (e) => {
|
|
11198
|
-
const closed =
|
|
11199
|
+
const closed = onCloseIconClick && onCloseIconClick(e);
|
|
11199
11200
|
closed && close();
|
|
11200
11201
|
};
|
|
11201
11202
|
const onHandleOpened = (e) => {
|
|
@@ -12290,8 +12291,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12290
12291
|
closeIconPosition,
|
|
12291
12292
|
title: popup && props.title,
|
|
12292
12293
|
left: props.left,
|
|
12293
|
-
|
|
12294
|
-
|
|
12294
|
+
onOverlayClick: closePopup,
|
|
12295
|
+
onCloseIconClick: closePopup
|
|
12295
12296
|
},
|
|
12296
12297
|
renderTabs()
|
|
12297
12298
|
) : renderTabs());
|
|
@@ -12543,7 +12544,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12543
12544
|
return dayNames[index];
|
|
12544
12545
|
},
|
|
12545
12546
|
/**
|
|
12546
|
-
*
|
|
12547
|
+
* 返回上一个月在当前面板中的天数
|
|
12547
12548
|
* @return {Number}
|
|
12548
12549
|
*/
|
|
12549
12550
|
getMonthPreDay(year, month) {
|
|
@@ -12632,9 +12633,140 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12632
12633
|
return true;
|
|
12633
12634
|
}
|
|
12634
12635
|
return false;
|
|
12636
|
+
},
|
|
12637
|
+
getMonthWeek(year, month, date2, firstDayOfWeek = 0) {
|
|
12638
|
+
const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
|
|
12639
|
+
let w = dateNow.getDay();
|
|
12640
|
+
const d = dateNow.getDate();
|
|
12641
|
+
let remainder = 6 - w;
|
|
12642
|
+
if (firstDayOfWeek !== 0) {
|
|
12643
|
+
w = w === 0 ? 7 : w;
|
|
12644
|
+
remainder = 7 - w;
|
|
12645
|
+
}
|
|
12646
|
+
return Math.ceil((d + remainder) / 7);
|
|
12647
|
+
},
|
|
12648
|
+
getYearWeek(year, month, date2, firstDayOfWeek = 0) {
|
|
12649
|
+
const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
|
|
12650
|
+
const dateFirst = new Date(Number(year), 0, 1);
|
|
12651
|
+
const dataNumber = Math.round(
|
|
12652
|
+
(dateNow.valueOf() - dateFirst.valueOf()) / 864e5
|
|
12653
|
+
);
|
|
12654
|
+
return Math.ceil((dataNumber + (dateFirst.getDay() + 1 - 1)) / 7);
|
|
12655
|
+
},
|
|
12656
|
+
getWeekDate(year, month, date2, firstDayOfWeek = 0) {
|
|
12657
|
+
const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
|
|
12658
|
+
const nowTime = dateNow.getTime();
|
|
12659
|
+
let day = dateNow.getDay();
|
|
12660
|
+
if (firstDayOfWeek === 0) {
|
|
12661
|
+
const oneDayTime2 = 24 * 60 * 60 * 1e3;
|
|
12662
|
+
const SundayTime2 = nowTime - day * oneDayTime2;
|
|
12663
|
+
const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
|
|
12664
|
+
const sunday2 = this.date2Str(new Date(SundayTime2));
|
|
12665
|
+
const saturday = this.date2Str(new Date(SaturdayTime));
|
|
12666
|
+
return [sunday2, saturday];
|
|
12667
|
+
}
|
|
12668
|
+
day = day === 0 ? 7 : day;
|
|
12669
|
+
const oneDayTime = 24 * 60 * 60 * 1e3;
|
|
12670
|
+
const MondayTime = nowTime - (day - 1) * oneDayTime;
|
|
12671
|
+
const SundayTime = nowTime + (7 - day) * oneDayTime;
|
|
12672
|
+
const monday = this.date2Str(new Date(MondayTime));
|
|
12673
|
+
const sunday = this.date2Str(new Date(SundayTime));
|
|
12674
|
+
return [monday, sunday];
|
|
12675
|
+
},
|
|
12676
|
+
formatResultDate(date2) {
|
|
12677
|
+
const days = [...date2.split("-")];
|
|
12678
|
+
days[2] = Utils.getNumTwoBit(Number(days[2]));
|
|
12679
|
+
days[3] = `${days[0]}-${days[1]}-${days[2]}`;
|
|
12680
|
+
days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
|
|
12681
|
+
return days;
|
|
12682
|
+
}
|
|
12683
|
+
};
|
|
12684
|
+
const getCurrMonthData = (type2, year, month) => {
|
|
12685
|
+
switch (type2) {
|
|
12686
|
+
case "prev":
|
|
12687
|
+
month === 1 && (year -= 1);
|
|
12688
|
+
month = month === 1 ? 12 : --month;
|
|
12689
|
+
break;
|
|
12690
|
+
case "next":
|
|
12691
|
+
month === 12 && (year += 1);
|
|
12692
|
+
month = month === 12 ? 1 : ++month;
|
|
12693
|
+
break;
|
|
12694
|
+
}
|
|
12695
|
+
return [
|
|
12696
|
+
year,
|
|
12697
|
+
Utils.getNumTwoBit(month),
|
|
12698
|
+
Utils.getMonthDays(String(year), String(month))
|
|
12699
|
+
];
|
|
12700
|
+
};
|
|
12701
|
+
const getDaysStatus = (type2, year, month) => {
|
|
12702
|
+
let days = Utils.getMonthDays(`${year}`, `${month}`);
|
|
12703
|
+
if (type2 === "prev" && days >= 7) {
|
|
12704
|
+
days -= 7;
|
|
12705
|
+
}
|
|
12706
|
+
return Array.from(Array(days), (v, k2) => {
|
|
12707
|
+
return {
|
|
12708
|
+
day: k2 + 1,
|
|
12709
|
+
type: type2,
|
|
12710
|
+
year,
|
|
12711
|
+
month
|
|
12712
|
+
};
|
|
12713
|
+
});
|
|
12714
|
+
};
|
|
12715
|
+
const getPreMonthDates = (type2, year, month, firstDayOfWeek) => {
|
|
12716
|
+
let preMonth = +month - 1;
|
|
12717
|
+
let preYear = year;
|
|
12718
|
+
if (preMonth <= 0) {
|
|
12719
|
+
preMonth = 12;
|
|
12720
|
+
preYear += 1;
|
|
12721
|
+
}
|
|
12722
|
+
let days = Utils.getMonthPreDay(+year, +month);
|
|
12723
|
+
days -= firstDayOfWeek;
|
|
12724
|
+
if (type2 === "prev" && days >= 7) {
|
|
12725
|
+
days -= 7;
|
|
12726
|
+
}
|
|
12727
|
+
const preDates = Utils.getMonthDays(`${preYear}`, `${preMonth}`);
|
|
12728
|
+
const months = Array.from(Array(preDates), (v, k2) => {
|
|
12729
|
+
return {
|
|
12730
|
+
day: k2 + 1,
|
|
12731
|
+
type: type2,
|
|
12732
|
+
preYear,
|
|
12733
|
+
preMonth
|
|
12734
|
+
};
|
|
12735
|
+
});
|
|
12736
|
+
return months.slice(preDates - days);
|
|
12737
|
+
};
|
|
12738
|
+
const splitDate = (date2) => {
|
|
12739
|
+
const split = date2.indexOf("-") !== -1 ? "-" : "/";
|
|
12740
|
+
return date2.split(split);
|
|
12741
|
+
};
|
|
12742
|
+
const isMultiple = (day, days) => {
|
|
12743
|
+
if (days.length > 0) {
|
|
12744
|
+
return days.some((item) => {
|
|
12745
|
+
return Utils.isEqual(item, day);
|
|
12746
|
+
});
|
|
12635
12747
|
}
|
|
12748
|
+
return false;
|
|
12749
|
+
};
|
|
12750
|
+
const isCurrDay = (month, day) => {
|
|
12751
|
+
const date2 = `${month.curData[0]}/${month.curData[1]}/${day}`;
|
|
12752
|
+
return Utils.isEqual(date2, Utils.date2Str(/* @__PURE__ */ new Date(), "/"));
|
|
12753
|
+
};
|
|
12754
|
+
const getCurrDate = (day, month) => {
|
|
12755
|
+
return `${month.curData[0]}/${month.curData[1]}/${Utils.getNumTwoBit(
|
|
12756
|
+
+day.day
|
|
12757
|
+
)}`;
|
|
12758
|
+
};
|
|
12759
|
+
const isStart = (day, days) => {
|
|
12760
|
+
return Utils.isEqual(days[0], day);
|
|
12761
|
+
};
|
|
12762
|
+
const isEnd = (day, days) => {
|
|
12763
|
+
return Utils.isEqual(days[1], day);
|
|
12764
|
+
};
|
|
12765
|
+
const isStartAndEnd = (days) => {
|
|
12766
|
+
return days.length >= 2 && Utils.isEqual(days[0], days[1]);
|
|
12636
12767
|
};
|
|
12637
12768
|
const defaultProps$_ = {
|
|
12769
|
+
...ComponentDefaults,
|
|
12638
12770
|
type: "single",
|
|
12639
12771
|
autoBackfill: false,
|
|
12640
12772
|
popup: true,
|
|
@@ -12648,6 +12780,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12648
12780
|
showTitle: true,
|
|
12649
12781
|
showSubTitle: true,
|
|
12650
12782
|
scrollAnimation: true,
|
|
12783
|
+
firstDayOfWeek: 0,
|
|
12651
12784
|
renderHeaderButtons: void 0,
|
|
12652
12785
|
renderDay: void 0,
|
|
12653
12786
|
renderDayTop: void 0,
|
|
@@ -12656,7 +12789,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12656
12789
|
},
|
|
12657
12790
|
onUpdate: () => {
|
|
12658
12791
|
},
|
|
12659
|
-
|
|
12792
|
+
onDayClick: (data) => {
|
|
12660
12793
|
},
|
|
12661
12794
|
onPageChange: (data) => {
|
|
12662
12795
|
}
|
|
@@ -12664,11 +12797,13 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12664
12797
|
const CalendarItem = React.forwardRef((props, ref) => {
|
|
12665
12798
|
const { locale } = useConfig();
|
|
12666
12799
|
const {
|
|
12800
|
+
popup,
|
|
12667
12801
|
type: type2,
|
|
12668
12802
|
autoBackfill,
|
|
12669
|
-
popup,
|
|
12670
12803
|
title,
|
|
12671
12804
|
defaultValue,
|
|
12805
|
+
startDate,
|
|
12806
|
+
endDate,
|
|
12672
12807
|
showToday,
|
|
12673
12808
|
startText,
|
|
12674
12809
|
endText,
|
|
@@ -12676,28 +12811,29 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12676
12811
|
showTitle,
|
|
12677
12812
|
showSubTitle,
|
|
12678
12813
|
scrollAnimation,
|
|
12814
|
+
firstDayOfWeek,
|
|
12679
12815
|
renderHeaderButtons,
|
|
12680
12816
|
renderDay,
|
|
12681
12817
|
renderDayTop,
|
|
12682
12818
|
renderDayBottom,
|
|
12683
12819
|
onConfirm,
|
|
12684
12820
|
onUpdate,
|
|
12685
|
-
|
|
12821
|
+
onDayClick,
|
|
12686
12822
|
onPageChange
|
|
12687
12823
|
} = { ...defaultProps$_, ...props };
|
|
12688
|
-
const
|
|
12824
|
+
const weekdays = locale.calendaritem.weekdays;
|
|
12825
|
+
const weeks = [
|
|
12826
|
+
...weekdays.slice(firstDayOfWeek, 7),
|
|
12827
|
+
...weekdays.slice(0, firstDayOfWeek)
|
|
12828
|
+
];
|
|
12689
12829
|
const monthTitle = locale.calendaritem.monthTitle;
|
|
12690
12830
|
const [yearMonthTitle, setYearMonthTitle] = React.useState("");
|
|
12691
12831
|
const [monthsData, setMonthsData] = React.useState([]);
|
|
12692
12832
|
const [monthsNum, setMonthsNum] = React.useState(0);
|
|
12693
12833
|
const [translateY, setTranslateY] = React.useState(0);
|
|
12694
12834
|
const [monthDefaultRange, setMonthDefaultRange] = React.useState([]);
|
|
12695
|
-
const propStartDate =
|
|
12696
|
-
const propEndDate =
|
|
12697
|
-
const splitDate = (date2) => {
|
|
12698
|
-
const split = date2.indexOf("-") !== -1 ? "-" : "/";
|
|
12699
|
-
return date2.split(split);
|
|
12700
|
-
};
|
|
12835
|
+
const propStartDate = startDate || Utils.getDay(0);
|
|
12836
|
+
const propEndDate = endDate || Utils.getDay(365);
|
|
12701
12837
|
const startDates = splitDate(propStartDate);
|
|
12702
12838
|
const endDates = splitDate(propEndDate);
|
|
12703
12839
|
const [state] = React.useState({
|
|
@@ -12724,171 +12860,49 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12724
12860
|
let viewHeight = 0;
|
|
12725
12861
|
const classPrefix2 = "nut-calendar";
|
|
12726
12862
|
const dayPrefix = "nut-calendar-day";
|
|
12727
|
-
const
|
|
12728
|
-
|
|
12729
|
-
|
|
12730
|
-
|
|
12731
|
-
|
|
12732
|
-
|
|
12733
|
-
|
|
12734
|
-
|
|
12735
|
-
|
|
12736
|
-
|
|
12737
|
-
|
|
12738
|
-
|
|
12739
|
-
|
|
12740
|
-
|
|
12741
|
-
|
|
12742
|
-
|
|
12743
|
-
|
|
12744
|
-
|
|
12745
|
-
|
|
12746
|
-
|
|
12747
|
-
|
|
12748
|
-
|
|
12749
|
-
|
|
12750
|
-
};
|
|
12751
|
-
const getClasses = (day, month) => {
|
|
12752
|
-
const dateStr = getCurrDate(day, month);
|
|
12753
|
-
if (day.type === "active") {
|
|
12754
|
-
if (propStartDate && Utils.compareDate(dateStr, propStartDate) || propEndDate && Utils.compareDate(propEndDate, dateStr)) {
|
|
12755
|
-
return `${dayPrefix}-disabled`;
|
|
12756
|
-
}
|
|
12757
|
-
if (type2 === "range") {
|
|
12758
|
-
if (isStart(dateStr) || isEnd(dateStr)) {
|
|
12759
|
-
return `${dayPrefix}-active ${isStart(dateStr) ? "active-start" : ""} ${isEnd(dateStr) ? "active-end" : ""}`;
|
|
12760
|
-
}
|
|
12761
|
-
if (Array.isArray(currentDate) && Object.values(currentDate).length === 2 && Utils.compareDate(currentDate[0], dateStr) && Utils.compareDate(dateStr, currentDate[1])) {
|
|
12762
|
-
return `${dayPrefix}-choose`;
|
|
12763
|
-
}
|
|
12764
|
-
return null;
|
|
12765
|
-
}
|
|
12766
|
-
if (type2 === "multiple" && isMultiple(dateStr) || !Array.isArray(currentDate) && Utils.isEqual(currentDate, dateStr)) {
|
|
12767
|
-
return `${dayPrefix}-active`;
|
|
12768
|
-
}
|
|
12769
|
-
return null;
|
|
12770
|
-
}
|
|
12771
|
-
return `${dayPrefix}-disabled`;
|
|
12772
|
-
};
|
|
12773
|
-
const isCurrDay = (month, day) => {
|
|
12774
|
-
const date2 = `${month.curData[0]}/${month.curData[1]}/${day}`;
|
|
12775
|
-
return Utils.isEqual(date2, Utils.date2Str(/* @__PURE__ */ new Date(), "/"));
|
|
12776
|
-
};
|
|
12777
|
-
const isStart = (d) => {
|
|
12778
|
-
return Utils.isEqual(currentDate[0], d);
|
|
12779
|
-
};
|
|
12780
|
-
const isEnd = (d) => {
|
|
12781
|
-
return Utils.isEqual(currentDate[1], d);
|
|
12782
|
-
};
|
|
12783
|
-
const isStartTip = (day, month) => {
|
|
12784
|
-
return type2 === "range" && day.type === "active" && isStart(getCurrDate(day, month));
|
|
12785
|
-
};
|
|
12786
|
-
const isEndTip = (day, month) => {
|
|
12787
|
-
return currentDate.length >= 2 && type2 === "range" && day.type === "active" && isEnd(getCurrDate(day, month));
|
|
12788
|
-
};
|
|
12789
|
-
const isStartAndEnd = () => {
|
|
12790
|
-
return currentDate.length >= 2 && Utils.isEqual(currentDate[0], currentDate[1]);
|
|
12791
|
-
};
|
|
12792
|
-
const getCurrMonthData = (type22) => {
|
|
12793
|
-
const monthData = type22 === "prev" ? monthsData[0] : monthsData[monthsData.length - 1];
|
|
12794
|
-
let year = parseInt(monthData.curData[0]);
|
|
12795
|
-
let month = parseInt(monthData.curData[1].toString().replace(/^0/, ""));
|
|
12796
|
-
switch (type22) {
|
|
12797
|
-
case "prev":
|
|
12798
|
-
month === 1 && (year -= 1);
|
|
12799
|
-
month = month === 1 ? 12 : --month;
|
|
12800
|
-
break;
|
|
12801
|
-
case "next":
|
|
12802
|
-
month === 12 && (year += 1);
|
|
12803
|
-
month = month === 12 ? 1 : ++month;
|
|
12804
|
-
break;
|
|
12805
|
-
}
|
|
12806
|
-
return [
|
|
12807
|
-
year,
|
|
12808
|
-
Utils.getNumTwoBit(month),
|
|
12809
|
-
Utils.getMonthDays(String(year), String(month))
|
|
12810
|
-
];
|
|
12811
|
-
};
|
|
12812
|
-
const getDaysStatus = (days, type22, year, month) => {
|
|
12813
|
-
if (type22 === "prev" && days >= 7) {
|
|
12814
|
-
days -= 7;
|
|
12815
|
-
}
|
|
12816
|
-
return Array.from(Array(days), (v, k2) => {
|
|
12817
|
-
return {
|
|
12818
|
-
day: k2 + 1,
|
|
12819
|
-
type: type22,
|
|
12820
|
-
year,
|
|
12821
|
-
month
|
|
12822
|
-
};
|
|
12823
|
-
});
|
|
12824
|
-
};
|
|
12825
|
-
const getPreDaysStatus = (days, type22, year, month, preCurrMonthDays) => {
|
|
12826
|
-
if (type22 === "prev" && days >= 7) {
|
|
12827
|
-
days -= 7;
|
|
12828
|
-
}
|
|
12829
|
-
const months = Array.from(Array(preCurrMonthDays), (v, k2) => {
|
|
12830
|
-
return {
|
|
12831
|
-
day: k2 + 1,
|
|
12832
|
-
type: type22,
|
|
12833
|
-
year,
|
|
12834
|
-
month
|
|
12863
|
+
const getMonthData = (curData, monthNum, type22) => {
|
|
12864
|
+
let i = 0;
|
|
12865
|
+
let date2 = curData;
|
|
12866
|
+
const monthData = monthsData;
|
|
12867
|
+
do {
|
|
12868
|
+
const y2 = parseInt(date2[0], 10);
|
|
12869
|
+
const m = parseInt(date2[1], 10);
|
|
12870
|
+
const days = [
|
|
12871
|
+
...getPreMonthDates("prev", y2, m, firstDayOfWeek),
|
|
12872
|
+
...getDaysStatus("active", y2, m)
|
|
12873
|
+
];
|
|
12874
|
+
const cssHeight = 39 + (days.length > 35 ? 384 : 320);
|
|
12875
|
+
let scrollTop = 0;
|
|
12876
|
+
if (monthData.length > 0) {
|
|
12877
|
+
const monthEle = monthData[monthData.length - 1];
|
|
12878
|
+
scrollTop = monthEle.scrollTop + monthEle.cssHeight;
|
|
12879
|
+
}
|
|
12880
|
+
const monthInfo = {
|
|
12881
|
+
curData: date2,
|
|
12882
|
+
title: monthTitle(y2, m),
|
|
12883
|
+
monthData: days,
|
|
12884
|
+
cssHeight,
|
|
12885
|
+
scrollTop
|
|
12835
12886
|
};
|
|
12836
|
-
|
|
12837
|
-
|
|
12838
|
-
|
|
12839
|
-
|
|
12840
|
-
|
|
12841
|
-
|
|
12842
|
-
|
|
12843
|
-
|
|
12844
|
-
|
|
12845
|
-
|
|
12846
|
-
|
|
12847
|
-
|
|
12848
|
-
|
|
12849
|
-
const monthInfo = {
|
|
12850
|
-
curData,
|
|
12851
|
-
title: monthTitle(curData[0], curData[1]),
|
|
12852
|
-
monthData: [
|
|
12853
|
-
...getPreDaysStatus(
|
|
12854
|
-
preMonthDays,
|
|
12855
|
-
"prev",
|
|
12856
|
-
`${preMonth}`,
|
|
12857
|
-
preYear,
|
|
12858
|
-
preCurrMonthDays
|
|
12859
|
-
),
|
|
12860
|
-
...getDaysStatus(
|
|
12861
|
-
currMonthDays,
|
|
12862
|
-
"active",
|
|
12863
|
-
curData[0],
|
|
12864
|
-
curData[1]
|
|
12865
|
-
)
|
|
12866
|
-
]
|
|
12867
|
-
};
|
|
12868
|
-
monthInfo.cssHeight = 39 + (monthInfo.monthData.length > 35 ? 384 : 320);
|
|
12869
|
-
let scrollTop = 0;
|
|
12870
|
-
if (monthsData.length > 0) {
|
|
12871
|
-
const monthEle = monthsData[monthsData.length - 1];
|
|
12872
|
-
scrollTop = monthEle.scrollTop + monthEle.cssHeight;
|
|
12873
|
-
}
|
|
12874
|
-
monthInfo.scrollTop = scrollTop;
|
|
12875
|
-
if (type22 === "next") {
|
|
12876
|
-
if (!endDates || !Utils.compareDate(
|
|
12877
|
-
`${endDates[0]}/${endDates[1]}/${Utils.getMonthDays(
|
|
12878
|
-
endDates[0],
|
|
12879
|
-
endDates[1]
|
|
12880
|
-
)}`,
|
|
12881
|
-
`${curData[0]}/${curData[1]}/${curData[2]}`
|
|
12887
|
+
if (type22 === "next") {
|
|
12888
|
+
if (!endDates || !Utils.compareDate(
|
|
12889
|
+
`${endDates[0]}/${endDates[1]}/${Utils.getMonthDays(
|
|
12890
|
+
endDates[0],
|
|
12891
|
+
endDates[1]
|
|
12892
|
+
)}`,
|
|
12893
|
+
`${curData[0]}/${curData[1]}/${curData[2]}`
|
|
12894
|
+
)) {
|
|
12895
|
+
monthData.push(monthInfo);
|
|
12896
|
+
}
|
|
12897
|
+
} else if (!startDates || !Utils.compareDate(
|
|
12898
|
+
`${curData[0]}/${curData[1]}/${curData[2]}`,
|
|
12899
|
+
`${startDates[0]}/${startDates[1]}/01`
|
|
12882
12900
|
)) {
|
|
12883
|
-
|
|
12901
|
+
monthData.unshift(monthInfo);
|
|
12884
12902
|
}
|
|
12885
|
-
|
|
12886
|
-
|
|
12887
|
-
|
|
12888
|
-
)) {
|
|
12889
|
-
monthsData.unshift(monthInfo);
|
|
12890
|
-
}
|
|
12891
|
-
setMonthsData(monthsData);
|
|
12903
|
+
date2 = getCurrMonthData("next", y2, m);
|
|
12904
|
+
} while (i++ < monthNum);
|
|
12905
|
+
setMonthsData(monthData);
|
|
12892
12906
|
};
|
|
12893
12907
|
const setReachedYearMonthInfo = (current) => {
|
|
12894
12908
|
const currentMonthsData = monthsData[current];
|
|
@@ -12920,48 +12934,11 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12920
12934
|
setTranslateY(monthsData[start2].scrollTop);
|
|
12921
12935
|
setReachedYearMonthInfo(current);
|
|
12922
12936
|
};
|
|
12923
|
-
const monthsViewScroll = (e) => {
|
|
12924
|
-
if (monthsData.length <= 1) {
|
|
12925
|
-
return;
|
|
12926
|
-
}
|
|
12927
|
-
const scrollTop = e.target.scrollTop;
|
|
12928
|
-
let current = Math.floor(scrollTop / avgHeight);
|
|
12929
|
-
const nextTop = monthsData[current + 1].scrollTop;
|
|
12930
|
-
const nextHeight = monthsData[current + 1].cssHeight;
|
|
12931
|
-
if (current === 0) {
|
|
12932
|
-
if (scrollTop >= nextTop) {
|
|
12933
|
-
current += 1;
|
|
12934
|
-
}
|
|
12935
|
-
} else if (current > 0 && current < monthsNum - 1) {
|
|
12936
|
-
if (scrollTop >= nextTop) {
|
|
12937
|
-
current += 1;
|
|
12938
|
-
}
|
|
12939
|
-
if (scrollTop < monthsData[current].scrollTop) {
|
|
12940
|
-
current -= 1;
|
|
12941
|
-
}
|
|
12942
|
-
} else {
|
|
12943
|
-
const viewPosition = Math.round(scrollTop + viewHeight);
|
|
12944
|
-
if (current + 1 <= monthsNum && viewPosition >= nextTop + nextHeight) {
|
|
12945
|
-
current += 1;
|
|
12946
|
-
}
|
|
12947
|
-
if (current >= 1 && scrollTop < monthsData[current - 1].scrollTop) {
|
|
12948
|
-
current -= 1;
|
|
12949
|
-
}
|
|
12950
|
-
}
|
|
12951
|
-
setDefaultRange(monthsNum, current);
|
|
12952
|
-
};
|
|
12953
12937
|
const getMonthNum = () => {
|
|
12954
|
-
|
|
12955
|
-
|
|
12956
|
-
|
|
12957
|
-
|
|
12958
|
-
const endDate = {
|
|
12959
|
-
year: Number(endDates[0]),
|
|
12960
|
-
month: Number(endDates[1])
|
|
12961
|
-
};
|
|
12962
|
-
let monthNum = endDate.month - startDate.month;
|
|
12963
|
-
if (endDate.year - startDate.year > 0) {
|
|
12964
|
-
monthNum += 12 * (endDate.year - startDate.year);
|
|
12938
|
+
let monthNum = Number(endDates[1]) - Number(startDates[1]);
|
|
12939
|
+
const yearNum = Number(endDates[0]) - Number(startDates[0]);
|
|
12940
|
+
if (yearNum > 0) {
|
|
12941
|
+
monthNum += 12 * yearNum;
|
|
12965
12942
|
}
|
|
12966
12943
|
if (monthNum <= 0) {
|
|
12967
12944
|
monthNum = 1;
|
|
@@ -12969,26 +12946,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12969
12946
|
setMonthsNum(monthNum);
|
|
12970
12947
|
return monthNum;
|
|
12971
12948
|
};
|
|
12972
|
-
const
|
|
12973
|
-
getMonthData(startDates, "next");
|
|
12974
|
-
let i = 1;
|
|
12975
|
-
do {
|
|
12976
|
-
getMonthData(getCurrMonthData("next"), "next");
|
|
12977
|
-
} while (i++ < monthNum);
|
|
12978
|
-
};
|
|
12979
|
-
const requestAniFrameFunc = (current, monthNum) => {
|
|
12980
|
-
const lastItem = monthsData[monthsData.length - 1];
|
|
12981
|
-
const containerHeight = lastItem.cssHeight + lastItem.scrollTop;
|
|
12982
|
-
requestAniFrame$1(() => {
|
|
12983
|
-
if (monthsRef && monthsPanel && viewAreaRef) {
|
|
12984
|
-
viewHeight = monthsRef.current.clientHeight;
|
|
12985
|
-
monthsPanel.current.style.height = `${containerHeight}px`;
|
|
12986
|
-
monthsRef.current.scrollTop = monthsData[current].scrollTop;
|
|
12987
|
-
}
|
|
12988
|
-
});
|
|
12989
|
-
setAvgHeight(Math.floor(containerHeight / (monthNum + 1)));
|
|
12990
|
-
};
|
|
12991
|
-
const renderCurrentDate = () => {
|
|
12949
|
+
const setDefaultDate = () => {
|
|
12992
12950
|
let defaultData = [];
|
|
12993
12951
|
if (type2 === "range" && Array.isArray(currentDate)) {
|
|
12994
12952
|
if (currentDate.length > 0) {
|
|
@@ -13003,7 +12961,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13003
12961
|
...splitDate(currentDate[1])
|
|
13004
12962
|
];
|
|
13005
12963
|
}
|
|
13006
|
-
} else if (
|
|
12964
|
+
} else if (type2 === "multiple" && Array.isArray(currentDate)) {
|
|
13007
12965
|
if (currentDate.length > 0) {
|
|
13008
12966
|
const defaultArr = [];
|
|
13009
12967
|
const obj = {};
|
|
@@ -13018,6 +12976,22 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13018
12976
|
currentDate.splice(0) && currentDate.push(...defaultArr);
|
|
13019
12977
|
defaultData = [...splitDate(defaultArr[0])];
|
|
13020
12978
|
}
|
|
12979
|
+
} else if (type2 === "week" && Array.isArray(currentDate)) {
|
|
12980
|
+
if (currentDate.length > 0) {
|
|
12981
|
+
const [y2, m, d] = splitDate(currentDate[0]);
|
|
12982
|
+
const weekArr = Utils.getWeekDate(y2, m, d, firstDayOfWeek);
|
|
12983
|
+
currentDate.splice(0) && currentDate.push(...weekArr);
|
|
12984
|
+
if (propStartDate && Utils.compareDate(currentDate[0], propStartDate)) {
|
|
12985
|
+
currentDate.splice(0, 1, propStartDate);
|
|
12986
|
+
}
|
|
12987
|
+
if (propEndDate && Utils.compareDate(propEndDate, currentDate[1])) {
|
|
12988
|
+
currentDate.splice(1, 1, propEndDate);
|
|
12989
|
+
}
|
|
12990
|
+
defaultData = [
|
|
12991
|
+
...splitDate(currentDate[0]),
|
|
12992
|
+
...splitDate(currentDate[1])
|
|
12993
|
+
];
|
|
12994
|
+
}
|
|
13021
12995
|
} else if (currentDate) {
|
|
13022
12996
|
if (currentDate.length > 0) {
|
|
13023
12997
|
if (propStartDate && Utils.compareDate(currentDate, propStartDate)) {
|
|
@@ -13031,6 +13005,9 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13031
13005
|
defaultData = [];
|
|
13032
13006
|
}
|
|
13033
13007
|
}
|
|
13008
|
+
return defaultData;
|
|
13009
|
+
};
|
|
13010
|
+
const getCurrentIndex = (defaultData) => {
|
|
13034
13011
|
let current = 0;
|
|
13035
13012
|
let lastCurrent = 0;
|
|
13036
13013
|
if (defaultData.length > 0) {
|
|
@@ -13038,38 +13015,53 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13038
13015
|
if (item.title === monthTitle(defaultData[0], defaultData[1])) {
|
|
13039
13016
|
current = index;
|
|
13040
13017
|
}
|
|
13041
|
-
if (
|
|
13018
|
+
if (type2 === "range" || type2 === "week") {
|
|
13042
13019
|
if (item.title === monthTitle(defaultData[3], defaultData[4])) {
|
|
13043
13020
|
lastCurrent = index;
|
|
13044
13021
|
}
|
|
13045
13022
|
}
|
|
13046
13023
|
});
|
|
13047
13024
|
} else {
|
|
13048
|
-
const
|
|
13049
|
-
const
|
|
13050
|
-
const
|
|
13051
|
-
|
|
13025
|
+
const date2 = /* @__PURE__ */ new Date();
|
|
13026
|
+
const year = date2.getFullYear();
|
|
13027
|
+
const month = date2.getMonth() + 1;
|
|
13028
|
+
const index = monthsData.findIndex((item) => {
|
|
13029
|
+
return +item.curData[0] === year && +item.curData[1] === month;
|
|
13052
13030
|
});
|
|
13053
|
-
if (
|
|
13054
|
-
current =
|
|
13031
|
+
if (index > -1) {
|
|
13032
|
+
current = index;
|
|
13055
13033
|
}
|
|
13056
13034
|
}
|
|
13035
|
+
return {
|
|
13036
|
+
current,
|
|
13037
|
+
lastCurrent
|
|
13038
|
+
};
|
|
13039
|
+
};
|
|
13040
|
+
const renderCurrentDate = () => {
|
|
13041
|
+
const defaultData = setDefaultDate();
|
|
13042
|
+
const current = getCurrentIndex(defaultData);
|
|
13057
13043
|
if (defaultData.length > 0) {
|
|
13058
13044
|
if (type2 === "range") {
|
|
13059
13045
|
chooseDay(
|
|
13060
13046
|
{ day: defaultData[2], type: "active" },
|
|
13061
|
-
monthsData[current],
|
|
13047
|
+
monthsData[current.current],
|
|
13062
13048
|
true
|
|
13063
13049
|
);
|
|
13064
13050
|
chooseDay(
|
|
13065
13051
|
{ day: defaultData[5], type: "active" },
|
|
13066
|
-
monthsData[lastCurrent],
|
|
13052
|
+
monthsData[current.lastCurrent],
|
|
13053
|
+
true
|
|
13054
|
+
);
|
|
13055
|
+
} else if (props.type === "week") {
|
|
13056
|
+
chooseDay(
|
|
13057
|
+
{ day: defaultData[2], type: "curr" },
|
|
13058
|
+
monthsData[current.current],
|
|
13067
13059
|
true
|
|
13068
13060
|
);
|
|
13069
13061
|
} else if (type2 === "multiple") {
|
|
13070
13062
|
[...currentDate].forEach((item) => {
|
|
13071
13063
|
const dateArr = splitDate(item);
|
|
13072
|
-
let currentIndex = current;
|
|
13064
|
+
let currentIndex = current.current;
|
|
13073
13065
|
monthsData.forEach((item2, index) => {
|
|
13074
13066
|
if (item2.title === monthTitle(dateArr[0], dateArr[1])) {
|
|
13075
13067
|
currentIndex = index;
|
|
@@ -13084,25 +13076,44 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13084
13076
|
} else {
|
|
13085
13077
|
chooseDay(
|
|
13086
13078
|
{ day: defaultData[2], type: "active" },
|
|
13087
|
-
monthsData[current],
|
|
13079
|
+
monthsData[current.current],
|
|
13088
13080
|
true
|
|
13089
13081
|
);
|
|
13090
13082
|
}
|
|
13091
13083
|
}
|
|
13092
|
-
return current;
|
|
13084
|
+
return current.current;
|
|
13085
|
+
};
|
|
13086
|
+
const requestAniFrameFunc = (current, monthNum) => {
|
|
13087
|
+
const lastItem = monthsData[monthsData.length - 1];
|
|
13088
|
+
const containerHeight = lastItem.cssHeight + lastItem.scrollTop;
|
|
13089
|
+
requestAniFrame$1(() => {
|
|
13090
|
+
if (monthsRef && monthsPanel && viewAreaRef) {
|
|
13091
|
+
viewHeight = monthsRef.current.clientHeight;
|
|
13092
|
+
monthsPanel.current.style.height = `${containerHeight}px`;
|
|
13093
|
+
monthsRef.current.scrollTop = monthsData[current].scrollTop;
|
|
13094
|
+
}
|
|
13095
|
+
});
|
|
13096
|
+
setAvgHeight(Math.floor(containerHeight / (monthNum + 1)));
|
|
13093
13097
|
};
|
|
13094
13098
|
const initData = () => {
|
|
13095
13099
|
const monthNum = getMonthNum();
|
|
13096
|
-
|
|
13100
|
+
getMonthData(startDates, monthNum, "next");
|
|
13097
13101
|
const current = renderCurrentDate();
|
|
13098
13102
|
setDefaultRange(monthNum, current);
|
|
13099
13103
|
requestAniFrameFunc(current, monthNum);
|
|
13100
13104
|
};
|
|
13105
|
+
React.useEffect(() => {
|
|
13106
|
+
initData();
|
|
13107
|
+
}, []);
|
|
13101
13108
|
const resetRender = () => {
|
|
13102
13109
|
state.currDateArray.splice(0);
|
|
13103
13110
|
monthsData.splice(0);
|
|
13104
13111
|
initData();
|
|
13105
13112
|
};
|
|
13113
|
+
React.useEffect(() => {
|
|
13114
|
+
setCurrentDate(resetDefaultValue() || []);
|
|
13115
|
+
popup && resetRender();
|
|
13116
|
+
}, [defaultValue]);
|
|
13106
13117
|
const scrollToDate = (date2) => {
|
|
13107
13118
|
if (Utils.compareDate(date2, propStartDate)) {
|
|
13108
13119
|
date2 = propStartDate;
|
|
@@ -13137,30 +13148,67 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13137
13148
|
}
|
|
13138
13149
|
});
|
|
13139
13150
|
};
|
|
13140
|
-
|
|
13141
|
-
|
|
13142
|
-
|
|
13143
|
-
|
|
13144
|
-
|
|
13145
|
-
|
|
13146
|
-
|
|
13147
|
-
|
|
13148
|
-
|
|
13149
|
-
|
|
13150
|
-
|
|
13151
|
-
|
|
13152
|
-
|
|
13153
|
-
|
|
13154
|
-
|
|
13155
|
-
|
|
13156
|
-
|
|
13157
|
-
|
|
13158
|
-
|
|
13151
|
+
const monthsViewScroll = (e) => {
|
|
13152
|
+
if (monthsData.length <= 1) {
|
|
13153
|
+
return;
|
|
13154
|
+
}
|
|
13155
|
+
const scrollTop = e.target.scrollTop;
|
|
13156
|
+
let current = Math.floor(scrollTop / avgHeight);
|
|
13157
|
+
const nextTop = monthsData[current + 1].scrollTop;
|
|
13158
|
+
const nextHeight = monthsData[current + 1].cssHeight;
|
|
13159
|
+
if (current === 0) {
|
|
13160
|
+
if (scrollTop >= nextTop) {
|
|
13161
|
+
current += 1;
|
|
13162
|
+
}
|
|
13163
|
+
} else if (current > 0 && current < monthsNum - 1) {
|
|
13164
|
+
if (scrollTop >= nextTop) {
|
|
13165
|
+
current += 1;
|
|
13166
|
+
}
|
|
13167
|
+
if (scrollTop < monthsData[current].scrollTop) {
|
|
13168
|
+
current -= 1;
|
|
13169
|
+
}
|
|
13170
|
+
} else {
|
|
13171
|
+
const viewPosition = Math.round(scrollTop + viewHeight);
|
|
13172
|
+
if (current + 1 <= monthsNum && viewPosition >= nextTop + nextHeight) {
|
|
13173
|
+
current += 1;
|
|
13174
|
+
}
|
|
13175
|
+
if (current >= 1 && scrollTop < monthsData[current - 1].scrollTop) {
|
|
13176
|
+
current -= 1;
|
|
13177
|
+
}
|
|
13178
|
+
}
|
|
13179
|
+
setDefaultRange(monthsNum, current);
|
|
13180
|
+
};
|
|
13181
|
+
React.useImperativeHandle(ref, () => ({
|
|
13182
|
+
scrollToDate
|
|
13183
|
+
}));
|
|
13184
|
+
const getClasses = (day, month) => {
|
|
13185
|
+
const dateStr = getCurrDate(day, month);
|
|
13186
|
+
if (day.type === "active") {
|
|
13187
|
+
if (propStartDate && Utils.compareDate(dateStr, propStartDate) || propEndDate && Utils.compareDate(propEndDate, dateStr)) {
|
|
13188
|
+
return `${dayPrefix}-disabled`;
|
|
13189
|
+
}
|
|
13190
|
+
if (type2 === "range" || type2 === "week") {
|
|
13191
|
+
if (isStart(dateStr, currentDate) || isEnd(dateStr, currentDate)) {
|
|
13192
|
+
return `${dayPrefix}-active ${isStart(dateStr, currentDate) ? "active-start" : ""} ${isEnd(dateStr, currentDate) ? "active-end" : ""}`;
|
|
13193
|
+
}
|
|
13194
|
+
if (Array.isArray(currentDate) && Object.values(currentDate).length === 2 && Utils.compareDate(currentDate[0], dateStr) && Utils.compareDate(dateStr, currentDate[1])) {
|
|
13195
|
+
return `${dayPrefix}-choose`;
|
|
13196
|
+
}
|
|
13197
|
+
return null;
|
|
13198
|
+
}
|
|
13199
|
+
if (type2 === "multiple" && isMultiple(dateStr, currentDate) || !Array.isArray(currentDate) && Utils.isEqual(currentDate, dateStr)) {
|
|
13200
|
+
return `${dayPrefix}-active`;
|
|
13201
|
+
}
|
|
13202
|
+
return null;
|
|
13203
|
+
}
|
|
13204
|
+
return `${dayPrefix}-disabled`;
|
|
13205
|
+
};
|
|
13159
13206
|
const chooseDay = (day, month, isFirst) => {
|
|
13160
13207
|
if (getClasses(day, month) === `${dayPrefix}-disabled`) {
|
|
13161
13208
|
return;
|
|
13162
13209
|
}
|
|
13163
13210
|
const days = [...month.curData];
|
|
13211
|
+
const [y2, m] = month.curData;
|
|
13164
13212
|
days[2] = typeof day.day === "number" ? Utils.getNumTwoBit(day.day) : day.day;
|
|
13165
13213
|
days[3] = `${days[0]}/${days[1]}/${days[2]}`;
|
|
13166
13214
|
days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
|
|
@@ -13197,67 +13245,109 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13197
13245
|
Array.isArray(currentDate) && currentDate.unshift(days[3]);
|
|
13198
13246
|
state.currDateArray = [[...days], ...state.currDateArray];
|
|
13199
13247
|
}
|
|
13248
|
+
} else if (type2 === "week") {
|
|
13249
|
+
const weekArr = Utils.getWeekDate(y2, m, `${day.day}`, firstDayOfWeek);
|
|
13250
|
+
if (propStartDate && Utils.compareDate(weekArr[0], propStartDate)) {
|
|
13251
|
+
weekArr.splice(0, 1, propStartDate);
|
|
13252
|
+
}
|
|
13253
|
+
if (propEndDate && Utils.compareDate(propEndDate, weekArr[1])) {
|
|
13254
|
+
weekArr.splice(1, 1, propEndDate);
|
|
13255
|
+
}
|
|
13256
|
+
Array.isArray(currentDate) && currentDate.splice(0) && currentDate.push(...weekArr);
|
|
13257
|
+
state.currDateArray = [
|
|
13258
|
+
Utils.formatResultDate(weekArr[0]),
|
|
13259
|
+
Utils.formatResultDate(weekArr[1])
|
|
13260
|
+
];
|
|
13200
13261
|
} else {
|
|
13201
13262
|
setCurrentDate(days[3]);
|
|
13202
13263
|
state.currDateArray = [...days];
|
|
13203
13264
|
}
|
|
13204
13265
|
if (!isFirst) {
|
|
13205
|
-
|
|
13266
|
+
onDayClick && onDayClick(state.currDateArray);
|
|
13206
13267
|
if (autoBackfill || !popup) {
|
|
13207
13268
|
confirm2();
|
|
13208
13269
|
}
|
|
13209
13270
|
}
|
|
13210
13271
|
setMonthsData(monthsData.slice());
|
|
13211
13272
|
};
|
|
13212
|
-
|
|
13213
|
-
"
|
|
13273
|
+
const confirm2 = () => {
|
|
13274
|
+
if (type2 === "range" && state.currDateArray.length === 2 || type2 !== "range") {
|
|
13275
|
+
const chooseData = state.currDateArray.slice(0);
|
|
13276
|
+
onConfirm && onConfirm(chooseData);
|
|
13277
|
+
if (popup) {
|
|
13278
|
+
onUpdate && onUpdate();
|
|
13279
|
+
}
|
|
13280
|
+
}
|
|
13281
|
+
};
|
|
13282
|
+
const classes = classNames(
|
|
13214
13283
|
{
|
|
13215
|
-
|
|
13216
|
-
|
|
13217
|
-
ref: monthsRef
|
|
13284
|
+
[`${classPrefix2}-title`]: !popup,
|
|
13285
|
+
[`${classPrefix2}-nofooter`]: !!autoBackfill
|
|
13218
13286
|
},
|
|
13219
|
-
|
|
13287
|
+
classPrefix2
|
|
13288
|
+
);
|
|
13289
|
+
const headerClasses = classNames({
|
|
13290
|
+
[`${classPrefix2}-header`]: true,
|
|
13291
|
+
[`${classPrefix2}-header-title`]: !popup
|
|
13292
|
+
});
|
|
13293
|
+
const isStartTip = (day, month) => {
|
|
13294
|
+
return (type2 === "range" || type2 === "week") && day.type === "active" && isStart(getCurrDate(day, month), currentDate);
|
|
13295
|
+
};
|
|
13296
|
+
const isEndTip = (day, month) => {
|
|
13297
|
+
return currentDate.length >= 2 && (type2 === "range" || type2 === "week") && day.type === "active" && isEnd(getCurrDate(day, month), currentDate);
|
|
13298
|
+
};
|
|
13299
|
+
const renderHeader = () => {
|
|
13300
|
+
return /* @__PURE__ */ React.createElement("div", { className: headerClasses }, showTitle && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-title` }, title || locale.calendaritem.title), renderHeaderButtons && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-header-buttons` }, renderHeaderButtons()), showSubTitle && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-sub-title` }, yearMonthTitle), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-weeks`, ref: weeksPanel }, weeks.map((item) => /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-week-item`, key: item }, item))));
|
|
13301
|
+
};
|
|
13302
|
+
const renderContent = () => {
|
|
13303
|
+
return /* @__PURE__ */ React.createElement(
|
|
13220
13304
|
"div",
|
|
13221
13305
|
{
|
|
13222
|
-
className:
|
|
13223
|
-
|
|
13224
|
-
|
|
13306
|
+
className: `${classPrefix2}-content`,
|
|
13307
|
+
onScroll: monthsViewScroll,
|
|
13308
|
+
ref: monthsRef
|
|
13225
13309
|
},
|
|
13226
|
-
|
|
13227
|
-
|
|
13228
|
-
|
|
13229
|
-
|
|
13230
|
-
|
|
13231
|
-
|
|
13232
|
-
|
|
13233
|
-
|
|
13234
|
-
|
|
13235
|
-
chooseDay(day, month);
|
|
13236
|
-
},
|
|
13237
|
-
key: i
|
|
13238
|
-
},
|
|
13239
|
-
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
|
|
13240
|
-
!isStartTip(day, month) && renderDayTop && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
|
|
13241
|
-
!isStartTip(day, month) && !isEndTip(day, month) && renderDayBottom && /* @__PURE__ */ React.createElement(
|
|
13242
|
-
"div",
|
|
13243
|
-
{
|
|
13244
|
-
className: `${classPrefix2}-day-info-bottom`
|
|
13245
|
-
},
|
|
13246
|
-
renderDayBottom(day)
|
|
13247
|
-
),
|
|
13248
|
-
!isStartTip(day, month) && !isEndTip(day, month) && !renderDayBottom && showToday && isCurrDay(month, day.day) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-curr` }, locale.calendaritem.today),
|
|
13249
|
-
isStartTip(day, month) && /* @__PURE__ */ React.createElement(
|
|
13310
|
+
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-pannel`, ref: monthsPanel }, /* @__PURE__ */ React.createElement(
|
|
13311
|
+
"div",
|
|
13312
|
+
{
|
|
13313
|
+
className: "viewArea",
|
|
13314
|
+
ref: viewAreaRef,
|
|
13315
|
+
style: { transform: `translateY(${translateY}px)` }
|
|
13316
|
+
},
|
|
13317
|
+
monthsData.slice(monthDefaultRange[0], monthDefaultRange[1]).map((month, key) => {
|
|
13318
|
+
return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-month`, key }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-month-title` }, month.title), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-days` }, month.monthData.map((day, i) => /* @__PURE__ */ React.createElement(
|
|
13250
13319
|
"div",
|
|
13251
13320
|
{
|
|
13252
|
-
className:
|
|
13321
|
+
className: [
|
|
13322
|
+
`${classPrefix2}-day`,
|
|
13323
|
+
getClasses(day, month)
|
|
13324
|
+
].join(" "),
|
|
13325
|
+
onClick: () => {
|
|
13326
|
+
chooseDay(day, month);
|
|
13327
|
+
},
|
|
13328
|
+
key: i
|
|
13253
13329
|
},
|
|
13254
|
-
|
|
13255
|
-
|
|
13256
|
-
|
|
13257
|
-
|
|
13258
|
-
|
|
13259
|
-
|
|
13260
|
-
|
|
13330
|
+
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
|
|
13331
|
+
!isStartTip(day, month) && renderDayTop && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
|
|
13332
|
+
!isStartTip(day, month) && !isEndTip(day, month) && renderDayBottom && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-bottom` }, renderDayBottom(day)),
|
|
13333
|
+
!isStartTip(day, month) && !isEndTip(day, month) && !renderDayBottom && showToday && isCurrDay(month, day.day) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-curr` }, locale.calendaritem.today),
|
|
13334
|
+
isStartTip(day, month) && /* @__PURE__ */ React.createElement(
|
|
13335
|
+
"div",
|
|
13336
|
+
{
|
|
13337
|
+
className: `${classPrefix2}-day-info ${isStartAndEnd(currentDate) ? `${classPrefix2}-day-info-top` : ""}`
|
|
13338
|
+
},
|
|
13339
|
+
startText || locale.calendaritem.start
|
|
13340
|
+
),
|
|
13341
|
+
isEndTip(day, month) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info` }, endText || locale.calendaritem.end)
|
|
13342
|
+
))));
|
|
13343
|
+
})
|
|
13344
|
+
))
|
|
13345
|
+
);
|
|
13346
|
+
};
|
|
13347
|
+
const renderFooter = () => {
|
|
13348
|
+
return /* @__PURE__ */ React.createElement("div", { className: "nut-calendar-footer" }, /* @__PURE__ */ React.createElement("div", { className: "calendar-confirm-btn", onClick: confirm2 }, confirmText || locale.confirm));
|
|
13349
|
+
};
|
|
13350
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: classes }, renderHeader(), renderContent(), popup && !autoBackfill ? renderFooter() : ""));
|
|
13261
13351
|
});
|
|
13262
13352
|
CalendarItem.defaultProps = defaultProps$_;
|
|
13263
13353
|
CalendarItem.displayName = "NutCalendarItem";
|
|
@@ -13277,6 +13367,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13277
13367
|
showTitle: true,
|
|
13278
13368
|
showSubTitle: true,
|
|
13279
13369
|
scrollAnimation: true,
|
|
13370
|
+
firstDayOfWeek: 0,
|
|
13280
13371
|
renderHeaderButtons: void 0,
|
|
13281
13372
|
renderDay: void 0,
|
|
13282
13373
|
renderDayTop: void 0,
|
|
@@ -13285,7 +13376,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13285
13376
|
},
|
|
13286
13377
|
onConfirm: (param) => {
|
|
13287
13378
|
},
|
|
13288
|
-
|
|
13379
|
+
onDayClick: (data) => {
|
|
13289
13380
|
},
|
|
13290
13381
|
onPageChange: (param) => {
|
|
13291
13382
|
}
|
|
@@ -13308,13 +13399,14 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13308
13399
|
showTitle,
|
|
13309
13400
|
showSubTitle,
|
|
13310
13401
|
scrollAnimation,
|
|
13402
|
+
firstDayOfWeek,
|
|
13311
13403
|
renderHeaderButtons,
|
|
13312
13404
|
renderDay,
|
|
13313
13405
|
renderDayTop,
|
|
13314
13406
|
renderDayBottom,
|
|
13315
13407
|
onClose,
|
|
13316
13408
|
onConfirm,
|
|
13317
|
-
|
|
13409
|
+
onDayClick,
|
|
13318
13410
|
onPageChange
|
|
13319
13411
|
} = { ...defaultProps$Z, ...props };
|
|
13320
13412
|
const calendarRef = React.useRef(null);
|
|
@@ -13329,7 +13421,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13329
13421
|
close();
|
|
13330
13422
|
};
|
|
13331
13423
|
const select = (param) => {
|
|
13332
|
-
|
|
13424
|
+
onDayClick && onDayClick(param);
|
|
13333
13425
|
};
|
|
13334
13426
|
const scrollToDate = (date2) => {
|
|
13335
13427
|
var _a2;
|
|
@@ -13360,12 +13452,13 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13360
13452
|
showTitle,
|
|
13361
13453
|
showSubTitle,
|
|
13362
13454
|
scrollAnimation,
|
|
13455
|
+
firstDayOfWeek,
|
|
13363
13456
|
renderHeaderButtons,
|
|
13364
13457
|
renderDay,
|
|
13365
13458
|
renderDayTop,
|
|
13366
13459
|
renderDayBottom,
|
|
13367
13460
|
onConfirm: choose,
|
|
13368
|
-
|
|
13461
|
+
onDayClick: select,
|
|
13369
13462
|
onPageChange: yearMonthChange
|
|
13370
13463
|
}
|
|
13371
13464
|
);
|
|
@@ -13379,8 +13472,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13379
13472
|
duration: 0.5,
|
|
13380
13473
|
closeable: true,
|
|
13381
13474
|
destroyOnClose: true,
|
|
13382
|
-
|
|
13383
|
-
|
|
13475
|
+
onOverlayClick: closePopup,
|
|
13476
|
+
onCloseIconClick: closePopup,
|
|
13384
13477
|
style: { height: "85vh" }
|
|
13385
13478
|
},
|
|
13386
13479
|
renderItem()
|
|
@@ -15850,7 +15943,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15850
15943
|
resetFields();
|
|
15851
15944
|
}
|
|
15852
15945
|
},
|
|
15853
|
-
/* @__PURE__ */ React.createElement(
|
|
15946
|
+
/* @__PURE__ */ React.createElement(Cell.Group, null, /* @__PURE__ */ React.createElement(Context.Provider, { value: formInstance }, children), footer ? /* @__PURE__ */ React.createElement(Cell, null, footer) : null)
|
|
15854
15947
|
);
|
|
15855
15948
|
};
|
|
15856
15949
|
Form.defaultProps = defaultProps$T;
|
|
@@ -16297,149 +16390,6 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16297
16390
|
};
|
|
16298
16391
|
InputNumber.defaultProps = defaultProps$R;
|
|
16299
16392
|
InputNumber.displayName = "NutInputNumber";
|
|
16300
|
-
const defaultProps$Q = {
|
|
16301
|
-
...ComponentDefaults,
|
|
16302
|
-
activeColor: "",
|
|
16303
|
-
closeOnOverlayClick: true,
|
|
16304
|
-
scrollFixed: false,
|
|
16305
|
-
lockScroll: true,
|
|
16306
|
-
icon: null
|
|
16307
|
-
};
|
|
16308
|
-
const Menu = (props) => {
|
|
16309
|
-
const {
|
|
16310
|
-
className,
|
|
16311
|
-
icon,
|
|
16312
|
-
scrollFixed,
|
|
16313
|
-
lockScroll,
|
|
16314
|
-
closeOnOverlayClick,
|
|
16315
|
-
children,
|
|
16316
|
-
activeColor,
|
|
16317
|
-
...rest
|
|
16318
|
-
} = {
|
|
16319
|
-
...defaultProps$Q,
|
|
16320
|
-
...props
|
|
16321
|
-
};
|
|
16322
|
-
const menuRef = React.useRef(null);
|
|
16323
|
-
const [isScrollFixed, setIsScrollFixed] = React.useState(false);
|
|
16324
|
-
const getScrollTop = (el) => {
|
|
16325
|
-
return Math.max(0, "scrollTop" in el ? el.scrollTop : el.pageYOffset);
|
|
16326
|
-
};
|
|
16327
|
-
const onScroll = () => {
|
|
16328
|
-
const { scrollFixed: scrollFixed2 } = props;
|
|
16329
|
-
const scrollTop = getScrollTop(window);
|
|
16330
|
-
const isFixed = scrollTop > (typeof scrollFixed2 === "boolean" ? 30 : Number(scrollFixed2));
|
|
16331
|
-
setIsScrollFixed(isFixed);
|
|
16332
|
-
};
|
|
16333
|
-
React.useEffect(() => {
|
|
16334
|
-
if (scrollFixed) {
|
|
16335
|
-
window.addEventListener("scroll", onScroll);
|
|
16336
|
-
}
|
|
16337
|
-
return () => window.removeEventListener("scroll", onScroll);
|
|
16338
|
-
}, []);
|
|
16339
|
-
const [showMenuItem, setShowMenuItem] = React.useState([]);
|
|
16340
|
-
const [menuItemTitle, setMenuItemTitle] = React.useState([]);
|
|
16341
|
-
const toggleMenuItem = (index) => {
|
|
16342
|
-
showMenuItem[index] = !showMenuItem[index];
|
|
16343
|
-
const temp = showMenuItem.map(
|
|
16344
|
-
(i, idx) => idx === index ? i : false
|
|
16345
|
-
);
|
|
16346
|
-
setShowMenuItem([...temp]);
|
|
16347
|
-
};
|
|
16348
|
-
const hideMenuItem = (index) => {
|
|
16349
|
-
showMenuItem[index] = false;
|
|
16350
|
-
console.log([...showMenuItem]);
|
|
16351
|
-
setShowMenuItem([...showMenuItem]);
|
|
16352
|
-
};
|
|
16353
|
-
const updateTitle = (text, index) => {
|
|
16354
|
-
menuItemTitle[index] = text;
|
|
16355
|
-
setMenuItemTitle([...menuItemTitle]);
|
|
16356
|
-
};
|
|
16357
|
-
const cloneChildren = () => {
|
|
16358
|
-
return React.Children.map(children, (child, index) => {
|
|
16359
|
-
return React.cloneElement(child, {
|
|
16360
|
-
...child.props,
|
|
16361
|
-
show: showMenuItem[index],
|
|
16362
|
-
index,
|
|
16363
|
-
activeColor,
|
|
16364
|
-
parent: {
|
|
16365
|
-
closeOnOverlayClick,
|
|
16366
|
-
lockScroll,
|
|
16367
|
-
toggleMenuItem,
|
|
16368
|
-
updateTitle,
|
|
16369
|
-
hideMenuItem,
|
|
16370
|
-
menuRef
|
|
16371
|
-
}
|
|
16372
|
-
});
|
|
16373
|
-
});
|
|
16374
|
-
};
|
|
16375
|
-
const menuTitle = () => {
|
|
16376
|
-
return React.Children.map(children, (child, index) => {
|
|
16377
|
-
if (React.isValidElement(child)) {
|
|
16378
|
-
const { title, options: options2, value, disabled, direction } = child.props;
|
|
16379
|
-
const selected = options2 == null ? void 0 : options2.filter(
|
|
16380
|
-
(option) => option.value === value
|
|
16381
|
-
);
|
|
16382
|
-
const finallyTitle = () => {
|
|
16383
|
-
if (title)
|
|
16384
|
-
return title;
|
|
16385
|
-
if (menuItemTitle && menuItemTitle[index])
|
|
16386
|
-
return menuItemTitle[index];
|
|
16387
|
-
if (selected && selected.length && selected[0].text)
|
|
16388
|
-
return selected[0].text;
|
|
16389
|
-
return "";
|
|
16390
|
-
};
|
|
16391
|
-
return /* @__PURE__ */ React.createElement(
|
|
16392
|
-
"div",
|
|
16393
|
-
{
|
|
16394
|
-
className: classNames("nut-menu__item ", className, {
|
|
16395
|
-
active: showMenuItem[index],
|
|
16396
|
-
disabled
|
|
16397
|
-
}),
|
|
16398
|
-
style: { color: showMenuItem[index] ? activeColor : "" },
|
|
16399
|
-
key: index,
|
|
16400
|
-
onClick: (e) => {
|
|
16401
|
-
e.stopPropagation();
|
|
16402
|
-
!disabled && toggleMenuItem(index);
|
|
16403
|
-
}
|
|
16404
|
-
},
|
|
16405
|
-
/* @__PURE__ */ React.createElement(
|
|
16406
|
-
"div",
|
|
16407
|
-
{
|
|
16408
|
-
className: classNames("nut-menu__title ", {
|
|
16409
|
-
active: showMenuItem[index],
|
|
16410
|
-
disabled
|
|
16411
|
-
})
|
|
16412
|
-
},
|
|
16413
|
-
/* @__PURE__ */ React.createElement("div", { className: "nut-menu__title-text" }, finallyTitle()),
|
|
16414
|
-
icon || (direction === "up" ? /* @__PURE__ */ React.createElement(x$h, { className: "nut-menu__title-icon" }) : /* @__PURE__ */ React.createElement(y$9, { className: "nut-menu__title-icon" }))
|
|
16415
|
-
)
|
|
16416
|
-
);
|
|
16417
|
-
}
|
|
16418
|
-
return null;
|
|
16419
|
-
});
|
|
16420
|
-
};
|
|
16421
|
-
return /* @__PURE__ */ React.createElement(
|
|
16422
|
-
"div",
|
|
16423
|
-
{
|
|
16424
|
-
...rest,
|
|
16425
|
-
className: classNames(`nut-menu`, className, {
|
|
16426
|
-
"scroll-fixed": isScrollFixed
|
|
16427
|
-
}),
|
|
16428
|
-
ref: menuRef
|
|
16429
|
-
},
|
|
16430
|
-
/* @__PURE__ */ React.createElement("div", { className: "nut-menu-relative" }, /* @__PURE__ */ React.createElement(
|
|
16431
|
-
"div",
|
|
16432
|
-
{
|
|
16433
|
-
className: classNames("nut-menu__bar", {
|
|
16434
|
-
opened: showMenuItem.includes(true)
|
|
16435
|
-
})
|
|
16436
|
-
},
|
|
16437
|
-
menuTitle()
|
|
16438
|
-
), cloneChildren())
|
|
16439
|
-
);
|
|
16440
|
-
};
|
|
16441
|
-
Menu.defaultProps = defaultProps$Q;
|
|
16442
|
-
Menu.displayName = "NutMenu";
|
|
16443
16393
|
const isObject = (val) => val !== null && typeof val === "object";
|
|
16444
16394
|
const isFunction = (val) => typeof val === "function";
|
|
16445
16395
|
const isPromise = (val) => {
|
|
@@ -16480,7 +16430,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16480
16430
|
};
|
|
16481
16431
|
}, [target]);
|
|
16482
16432
|
}
|
|
16483
|
-
const defaultProps$
|
|
16433
|
+
const defaultProps$Q = {
|
|
16484
16434
|
...ComponentDefaults,
|
|
16485
16435
|
columns: 1,
|
|
16486
16436
|
direction: "down",
|
|
@@ -16509,7 +16459,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16509
16459
|
parent,
|
|
16510
16460
|
index
|
|
16511
16461
|
} = {
|
|
16512
|
-
...defaultProps$
|
|
16462
|
+
...defaultProps$Q,
|
|
16513
16463
|
...props
|
|
16514
16464
|
};
|
|
16515
16465
|
const [_showPopup, setShowPopup] = React.useState(show2);
|
|
@@ -16641,12 +16591,155 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16641
16591
|
)
|
|
16642
16592
|
);
|
|
16643
16593
|
});
|
|
16644
|
-
MenuItem.defaultProps = defaultProps$
|
|
16594
|
+
MenuItem.defaultProps = defaultProps$Q;
|
|
16645
16595
|
MenuItem.displayName = "NutMenuItem";
|
|
16646
|
-
const defaultProps$
|
|
16596
|
+
const defaultProps$P = {
|
|
16647
16597
|
...ComponentDefaults,
|
|
16648
|
-
|
|
16649
|
-
|
|
16598
|
+
activeColor: "",
|
|
16599
|
+
closeOnOverlayClick: true,
|
|
16600
|
+
scrollFixed: false,
|
|
16601
|
+
lockScroll: true,
|
|
16602
|
+
icon: null
|
|
16603
|
+
};
|
|
16604
|
+
const Menu = (props) => {
|
|
16605
|
+
const {
|
|
16606
|
+
className,
|
|
16607
|
+
icon,
|
|
16608
|
+
scrollFixed,
|
|
16609
|
+
lockScroll,
|
|
16610
|
+
closeOnOverlayClick,
|
|
16611
|
+
children,
|
|
16612
|
+
activeColor,
|
|
16613
|
+
...rest
|
|
16614
|
+
} = {
|
|
16615
|
+
...defaultProps$P,
|
|
16616
|
+
...props
|
|
16617
|
+
};
|
|
16618
|
+
const menuRef = React.useRef(null);
|
|
16619
|
+
const [isScrollFixed, setIsScrollFixed] = React.useState(false);
|
|
16620
|
+
const getScrollTop = (el) => {
|
|
16621
|
+
return Math.max(0, "scrollTop" in el ? el.scrollTop : el.pageYOffset);
|
|
16622
|
+
};
|
|
16623
|
+
const onScroll = () => {
|
|
16624
|
+
const { scrollFixed: scrollFixed2 } = props;
|
|
16625
|
+
const scrollTop = getScrollTop(window);
|
|
16626
|
+
const isFixed = scrollTop > (typeof scrollFixed2 === "boolean" ? 30 : Number(scrollFixed2));
|
|
16627
|
+
setIsScrollFixed(isFixed);
|
|
16628
|
+
};
|
|
16629
|
+
React.useEffect(() => {
|
|
16630
|
+
if (scrollFixed) {
|
|
16631
|
+
window.addEventListener("scroll", onScroll);
|
|
16632
|
+
}
|
|
16633
|
+
return () => window.removeEventListener("scroll", onScroll);
|
|
16634
|
+
}, []);
|
|
16635
|
+
const [showMenuItem, setShowMenuItem] = React.useState([]);
|
|
16636
|
+
const [menuItemTitle, setMenuItemTitle] = React.useState([]);
|
|
16637
|
+
const toggleMenuItem = (index) => {
|
|
16638
|
+
showMenuItem[index] = !showMenuItem[index];
|
|
16639
|
+
const temp = showMenuItem.map(
|
|
16640
|
+
(i, idx) => idx === index ? i : false
|
|
16641
|
+
);
|
|
16642
|
+
setShowMenuItem([...temp]);
|
|
16643
|
+
};
|
|
16644
|
+
const hideMenuItem = (index) => {
|
|
16645
|
+
showMenuItem[index] = false;
|
|
16646
|
+
setShowMenuItem([...showMenuItem]);
|
|
16647
|
+
};
|
|
16648
|
+
const updateTitle = (text, index) => {
|
|
16649
|
+
menuItemTitle[index] = text;
|
|
16650
|
+
setMenuItemTitle([...menuItemTitle]);
|
|
16651
|
+
};
|
|
16652
|
+
const cloneChildren = () => {
|
|
16653
|
+
return React.Children.map(children, (child, index) => {
|
|
16654
|
+
return React.cloneElement(child, {
|
|
16655
|
+
...child.props,
|
|
16656
|
+
show: showMenuItem[index],
|
|
16657
|
+
index,
|
|
16658
|
+
activeColor,
|
|
16659
|
+
parent: {
|
|
16660
|
+
closeOnOverlayClick,
|
|
16661
|
+
lockScroll,
|
|
16662
|
+
toggleMenuItem,
|
|
16663
|
+
updateTitle,
|
|
16664
|
+
hideMenuItem,
|
|
16665
|
+
menuRef
|
|
16666
|
+
}
|
|
16667
|
+
});
|
|
16668
|
+
});
|
|
16669
|
+
};
|
|
16670
|
+
const menuTitle = () => {
|
|
16671
|
+
return React.Children.map(children, (child, index) => {
|
|
16672
|
+
if (React.isValidElement(child)) {
|
|
16673
|
+
const { title, options: options2, value, disabled, direction } = child.props;
|
|
16674
|
+
const selected = options2 == null ? void 0 : options2.filter(
|
|
16675
|
+
(option) => option.value === value
|
|
16676
|
+
);
|
|
16677
|
+
const finallyTitle = () => {
|
|
16678
|
+
if (title)
|
|
16679
|
+
return title;
|
|
16680
|
+
if (menuItemTitle && menuItemTitle[index])
|
|
16681
|
+
return menuItemTitle[index];
|
|
16682
|
+
if (selected && selected.length && selected[0].text)
|
|
16683
|
+
return selected[0].text;
|
|
16684
|
+
return "";
|
|
16685
|
+
};
|
|
16686
|
+
return /* @__PURE__ */ React.createElement(
|
|
16687
|
+
"div",
|
|
16688
|
+
{
|
|
16689
|
+
className: classNames("nut-menu__item ", className, {
|
|
16690
|
+
active: showMenuItem[index],
|
|
16691
|
+
disabled
|
|
16692
|
+
}),
|
|
16693
|
+
style: { color: showMenuItem[index] ? activeColor : "" },
|
|
16694
|
+
key: index,
|
|
16695
|
+
onClick: (e) => {
|
|
16696
|
+
e.stopPropagation();
|
|
16697
|
+
!disabled && toggleMenuItem(index);
|
|
16698
|
+
}
|
|
16699
|
+
},
|
|
16700
|
+
/* @__PURE__ */ React.createElement(
|
|
16701
|
+
"div",
|
|
16702
|
+
{
|
|
16703
|
+
className: classNames("nut-menu__title ", {
|
|
16704
|
+
active: showMenuItem[index],
|
|
16705
|
+
disabled
|
|
16706
|
+
})
|
|
16707
|
+
},
|
|
16708
|
+
/* @__PURE__ */ React.createElement("div", { className: "nut-menu__title-text" }, finallyTitle()),
|
|
16709
|
+
icon || (direction === "up" ? /* @__PURE__ */ React.createElement(x$h, { className: "nut-menu__title-icon" }) : /* @__PURE__ */ React.createElement(y$9, { className: "nut-menu__title-icon" }))
|
|
16710
|
+
)
|
|
16711
|
+
);
|
|
16712
|
+
}
|
|
16713
|
+
return null;
|
|
16714
|
+
});
|
|
16715
|
+
};
|
|
16716
|
+
return /* @__PURE__ */ React.createElement(
|
|
16717
|
+
"div",
|
|
16718
|
+
{
|
|
16719
|
+
...rest,
|
|
16720
|
+
className: classNames(`nut-menu`, className, {
|
|
16721
|
+
"scroll-fixed": isScrollFixed
|
|
16722
|
+
}),
|
|
16723
|
+
ref: menuRef
|
|
16724
|
+
},
|
|
16725
|
+
/* @__PURE__ */ React.createElement("div", { className: "nut-menu-relative" }, /* @__PURE__ */ React.createElement(
|
|
16726
|
+
"div",
|
|
16727
|
+
{
|
|
16728
|
+
className: classNames("nut-menu__bar", {
|
|
16729
|
+
opened: showMenuItem.includes(true)
|
|
16730
|
+
})
|
|
16731
|
+
},
|
|
16732
|
+
menuTitle()
|
|
16733
|
+
), cloneChildren())
|
|
16734
|
+
);
|
|
16735
|
+
};
|
|
16736
|
+
Menu.defaultProps = defaultProps$P;
|
|
16737
|
+
Menu.displayName = "NutMenu";
|
|
16738
|
+
Menu.Item = MenuItem;
|
|
16739
|
+
const defaultProps$O = {
|
|
16740
|
+
...ComponentDefaults,
|
|
16741
|
+
visible: false,
|
|
16742
|
+
type: "default",
|
|
16650
16743
|
custom: [],
|
|
16651
16744
|
random: false,
|
|
16652
16745
|
onClose: () => {
|
|
@@ -16759,8 +16852,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16759
16852
|
{
|
|
16760
16853
|
visible,
|
|
16761
16854
|
position: "bottom",
|
|
16762
|
-
|
|
16763
|
-
|
|
16855
|
+
onOverlayClick: onClose,
|
|
16856
|
+
onCloseIconClick: onClose,
|
|
16764
16857
|
overlayStyle: { backgroundColor: "rgba(0, 0, 0, 0)" },
|
|
16765
16858
|
...rest
|
|
16766
16859
|
},
|
|
@@ -17438,7 +17531,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
17438
17531
|
onBlur,
|
|
17439
17532
|
onClear,
|
|
17440
17533
|
onSearch,
|
|
17441
|
-
|
|
17534
|
+
onInputClick
|
|
17442
17535
|
} = {
|
|
17443
17536
|
...defaultProps$J,
|
|
17444
17537
|
...props
|
|
@@ -17489,7 +17582,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
17489
17582
|
);
|
|
17490
17583
|
};
|
|
17491
17584
|
const clickInput = (e) => {
|
|
17492
|
-
|
|
17585
|
+
onInputClick && onInputClick(e);
|
|
17493
17586
|
};
|
|
17494
17587
|
const renderLeftIn = () => {
|
|
17495
17588
|
if (!leftIn)
|
|
@@ -17593,8 +17686,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
17593
17686
|
onCancel,
|
|
17594
17687
|
onClose,
|
|
17595
17688
|
onComplete,
|
|
17596
|
-
|
|
17597
|
-
|
|
17689
|
+
onOverlayClick,
|
|
17690
|
+
onCloseIconClick,
|
|
17598
17691
|
...rest
|
|
17599
17692
|
} = {
|
|
17600
17693
|
...defaultProps$I,
|
|
@@ -17633,8 +17726,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
17633
17726
|
},
|
|
17634
17727
|
visible,
|
|
17635
17728
|
closeable: true,
|
|
17636
|
-
|
|
17637
|
-
|
|
17729
|
+
onOverlayClick: onClose,
|
|
17730
|
+
onCloseIconClick: onClose,
|
|
17638
17731
|
...rest
|
|
17639
17732
|
},
|
|
17640
17733
|
/* @__PURE__ */ React.createElement("div", { className: classNames(className, classPrefix2), style }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__title` }, title || locale.shortpassword.title), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__description` }, description || locale.shortpassword.description), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__input`, onClick: onFocus }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__input-site` }), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__input-fake` }, [...new Array(comLen).keys()].map((item, index) => {
|
|
@@ -18144,7 +18237,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
18144
18237
|
url: "",
|
|
18145
18238
|
maxCount: 1,
|
|
18146
18239
|
previewType: "picture",
|
|
18147
|
-
|
|
18240
|
+
fit: "cover",
|
|
18148
18241
|
name: "file",
|
|
18149
18242
|
accept: "*",
|
|
18150
18243
|
disabled: false,
|
|
@@ -18189,7 +18282,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
18189
18282
|
defaultValue,
|
|
18190
18283
|
value,
|
|
18191
18284
|
previewType,
|
|
18192
|
-
|
|
18285
|
+
fit,
|
|
18193
18286
|
disabled,
|
|
18194
18287
|
multiple,
|
|
18195
18288
|
url,
|
|
@@ -18481,7 +18574,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
18481
18574
|
"img",
|
|
18482
18575
|
{
|
|
18483
18576
|
className: "nut-uploader__preview-img__c",
|
|
18484
|
-
style: { objectFit:
|
|
18577
|
+
style: { objectFit: fit },
|
|
18485
18578
|
src: item.url,
|
|
18486
18579
|
alt: "",
|
|
18487
18580
|
onClick: () => handleItemClick(item)
|
|
@@ -18596,7 +18689,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
18596
18689
|
onCancel && onCancel();
|
|
18597
18690
|
};
|
|
18598
18691
|
const chooseItem = (item, index) => {
|
|
18599
|
-
if (!item.
|
|
18692
|
+
if (!item.disabled) {
|
|
18600
18693
|
onSelect && onSelect(item, index);
|
|
18601
18694
|
}
|
|
18602
18695
|
};
|
|
@@ -18616,7 +18709,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
18616
18709
|
return /* @__PURE__ */ React.createElement(
|
|
18617
18710
|
"div",
|
|
18618
18711
|
{
|
|
18619
|
-
className: `${classPrefix2}__item ${item.
|
|
18712
|
+
className: `${classPrefix2}__item ${item.disabled ? "disabled" : ""} ${item.danger ? "danger" : ""}`,
|
|
18620
18713
|
key: index,
|
|
18621
18714
|
onClick: () => chooseItem(item, index)
|
|
18622
18715
|
},
|
|
@@ -19298,7 +19391,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
19298
19391
|
click,
|
|
19299
19392
|
onClose,
|
|
19300
19393
|
onClick,
|
|
19301
|
-
|
|
19394
|
+
onItemClick
|
|
19302
19395
|
} = {
|
|
19303
19396
|
...defaultProps$x,
|
|
19304
19397
|
...props
|
|
@@ -19529,7 +19622,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
19529
19622
|
});
|
|
19530
19623
|
};
|
|
19531
19624
|
const handleItemClick = (event, value) => {
|
|
19532
|
-
|
|
19625
|
+
onItemClick && onItemClick(event, value);
|
|
19533
19626
|
};
|
|
19534
19627
|
const getStyle = (moveOffset = offset) => {
|
|
19535
19628
|
const target = innerRef.current;
|
|
@@ -19823,10 +19916,9 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
19823
19916
|
visible: false,
|
|
19824
19917
|
offset: [0, 12],
|
|
19825
19918
|
targetId: "",
|
|
19826
|
-
className: "",
|
|
19827
19919
|
showArrow: true,
|
|
19828
|
-
|
|
19829
|
-
|
|
19920
|
+
closeOnOutsideClick: true,
|
|
19921
|
+
closeOnActionClick: true,
|
|
19830
19922
|
overlay: false,
|
|
19831
19923
|
onClick: () => {
|
|
19832
19924
|
},
|
|
@@ -19845,8 +19937,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
19845
19937
|
offset,
|
|
19846
19938
|
targetId,
|
|
19847
19939
|
overlay,
|
|
19848
|
-
|
|
19849
|
-
|
|
19940
|
+
closeOnOutsideClick,
|
|
19941
|
+
closeOnActionClick,
|
|
19850
19942
|
className,
|
|
19851
19943
|
showArrow,
|
|
19852
19944
|
style,
|
|
@@ -19886,7 +19978,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
19886
19978
|
"touchstart",
|
|
19887
19979
|
true,
|
|
19888
19980
|
visible,
|
|
19889
|
-
|
|
19981
|
+
closeOnOutsideClick
|
|
19890
19982
|
);
|
|
19891
19983
|
const getContentWidth = () => {
|
|
19892
19984
|
let rect = getRect(popoverRef.current);
|
|
@@ -19980,7 +20072,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
19980
20072
|
if (!item.disabled) {
|
|
19981
20073
|
onSelect && onSelect(item, index);
|
|
19982
20074
|
}
|
|
19983
|
-
if (
|
|
20075
|
+
if (closeOnActionClick) {
|
|
19984
20076
|
props.onClick && props.onClick();
|
|
19985
20077
|
onClose && onClose();
|
|
19986
20078
|
}
|
|
@@ -20232,6 +20324,29 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20232
20324
|
PullToRefresh.displayName = "NutPullToRefresh";
|
|
20233
20325
|
const AvatarContext = React.createContext({});
|
|
20234
20326
|
const defaultProps$u = {
|
|
20327
|
+
...ComponentDefaults,
|
|
20328
|
+
maxContent: "",
|
|
20329
|
+
max: "",
|
|
20330
|
+
maxBackground: "#eee",
|
|
20331
|
+
maxColor: "#666",
|
|
20332
|
+
gap: "-8",
|
|
20333
|
+
level: "left"
|
|
20334
|
+
};
|
|
20335
|
+
const classPrefix$8 = `nut-avatar-group`;
|
|
20336
|
+
const AvatarGroup = (props) => {
|
|
20337
|
+
const propAvatarGroup = { ...defaultProps$u, ...props };
|
|
20338
|
+
const { className, style, children } = propAvatarGroup;
|
|
20339
|
+
const avatarGroupRef = React.useRef(null);
|
|
20340
|
+
const cls = classNames(classPrefix$8, className);
|
|
20341
|
+
const parentAvatar = {
|
|
20342
|
+
propAvatarGroup,
|
|
20343
|
+
avatarGroupRef
|
|
20344
|
+
};
|
|
20345
|
+
return /* @__PURE__ */ React.createElement(AvatarContext.Provider, { value: parentAvatar }, /* @__PURE__ */ React.createElement("div", { className: cls, style, ref: avatarGroupRef }, children));
|
|
20346
|
+
};
|
|
20347
|
+
AvatarGroup.defaultProps = defaultProps$u;
|
|
20348
|
+
AvatarGroup.displayName = "NutAvatarGroup";
|
|
20349
|
+
const defaultProps$t = {
|
|
20235
20350
|
...ComponentDefaults,
|
|
20236
20351
|
size: "",
|
|
20237
20352
|
shape: "round",
|
|
@@ -20242,7 +20357,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20242
20357
|
src: "",
|
|
20243
20358
|
alt: ""
|
|
20244
20359
|
};
|
|
20245
|
-
const classPrefix$
|
|
20360
|
+
const classPrefix$7 = `nut-avatar`;
|
|
20246
20361
|
const Avatar = (props) => {
|
|
20247
20362
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
20248
20363
|
const {
|
|
@@ -20261,7 +20376,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20261
20376
|
onError,
|
|
20262
20377
|
...rest
|
|
20263
20378
|
} = {
|
|
20264
|
-
...defaultProps$
|
|
20379
|
+
...defaultProps$t,
|
|
20265
20380
|
...props
|
|
20266
20381
|
};
|
|
20267
20382
|
const [maxSum, setMaxSum] = React.useState(0);
|
|
@@ -20274,7 +20389,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20274
20389
|
[`nut-avatar-${((_a2 = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _a2.size) || size || "normal"}`]: true,
|
|
20275
20390
|
[`nut-avatar-${((_b = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _b.shape) || shape}`]: true
|
|
20276
20391
|
});
|
|
20277
|
-
const cls = classNames(classPrefix$
|
|
20392
|
+
const cls = classNames(classPrefix$7, classes, className);
|
|
20278
20393
|
const styles = {
|
|
20279
20394
|
width: sizeValue.indexOf(size) > -1 ? "" : `${size}px`,
|
|
20280
20395
|
height: sizeValue.indexOf(size) > -1 ? "" : `${size}px`,
|
|
@@ -20343,9 +20458,10 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20343
20458
|
showMax && /* @__PURE__ */ React.createElement("div", { className: "text" }, ((_l = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _l.maxContent) ? (_m = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _m.maxContent : `+ ${avatarIndex - ((_n = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _n.max)}`)
|
|
20344
20459
|
));
|
|
20345
20460
|
};
|
|
20346
|
-
Avatar.defaultProps = defaultProps$
|
|
20461
|
+
Avatar.defaultProps = defaultProps$t;
|
|
20347
20462
|
Avatar.displayName = "NutAvatar";
|
|
20348
|
-
|
|
20463
|
+
Avatar.Group = AvatarGroup;
|
|
20464
|
+
const defaultProps$s = {
|
|
20349
20465
|
...ComponentDefaults,
|
|
20350
20466
|
rows: 1,
|
|
20351
20467
|
animated: false,
|
|
@@ -20368,7 +20484,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20368
20484
|
avatarShape,
|
|
20369
20485
|
...rest
|
|
20370
20486
|
} = {
|
|
20371
|
-
...defaultProps$
|
|
20487
|
+
...defaultProps$s,
|
|
20372
20488
|
...props
|
|
20373
20489
|
};
|
|
20374
20490
|
const classPrefix2 = "nut-skeleton";
|
|
@@ -20404,7 +20520,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20404
20520
|
return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__block`, key: index });
|
|
20405
20521
|
})))));
|
|
20406
20522
|
};
|
|
20407
|
-
Skeleton.defaultProps = defaultProps$
|
|
20523
|
+
Skeleton.defaultProps = defaultProps$s;
|
|
20408
20524
|
Skeleton.displayName = "NutSkeleton";
|
|
20409
20525
|
function preventDefault(event, isStopPropagation) {
|
|
20410
20526
|
if (typeof event.cancelable !== "boolean" || event.cancelable) {
|
|
@@ -20414,13 +20530,13 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20414
20530
|
event.stopPropagation();
|
|
20415
20531
|
}
|
|
20416
20532
|
}
|
|
20417
|
-
const defaultProps$
|
|
20533
|
+
const defaultProps$r = {
|
|
20418
20534
|
name: ""
|
|
20419
20535
|
};
|
|
20420
20536
|
const Swipe = React.forwardRef((props, instanceRef) => {
|
|
20421
20537
|
const classPrefix2 = "nut-swipe";
|
|
20422
20538
|
const touch = useTouch();
|
|
20423
|
-
const { children, className, style } = { ...defaultProps$
|
|
20539
|
+
const { children, className, style } = { ...defaultProps$r, ...props };
|
|
20424
20540
|
const root2 = React.useRef();
|
|
20425
20541
|
const opened = React.useRef(false);
|
|
20426
20542
|
const lockClick = React.useRef(false);
|
|
@@ -20588,9 +20704,9 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20588
20704
|
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__wrapper`, style: wrapperStyle }, renderActionContent("left", leftRef), children, renderActionContent("right", rightRef))
|
|
20589
20705
|
);
|
|
20590
20706
|
});
|
|
20591
|
-
Swipe.defaultProps = defaultProps$
|
|
20707
|
+
Swipe.defaultProps = defaultProps$r;
|
|
20592
20708
|
Swipe.displayName = "NutSwipe";
|
|
20593
|
-
const classPrefix$
|
|
20709
|
+
const classPrefix$6 = "nut-toast";
|
|
20594
20710
|
class Notification extends React__namespace.PureComponent {
|
|
20595
20711
|
constructor(props) {
|
|
20596
20712
|
super(props);
|
|
@@ -20652,7 +20768,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20652
20768
|
iconNode = /* @__PURE__ */ React__namespace.createElement(x$8, null);
|
|
20653
20769
|
break;
|
|
20654
20770
|
}
|
|
20655
|
-
return /* @__PURE__ */ React__namespace.createElement("p", { className: `${classPrefix$
|
|
20771
|
+
return /* @__PURE__ */ React__namespace.createElement("p", { className: `${classPrefix$6}__icon-wrapper` }, iconNode);
|
|
20656
20772
|
}
|
|
20657
20773
|
return icon;
|
|
20658
20774
|
}
|
|
@@ -20687,22 +20803,22 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20687
20803
|
{
|
|
20688
20804
|
visible: show2,
|
|
20689
20805
|
style,
|
|
20690
|
-
className: `${classPrefix$
|
|
20806
|
+
className: `${classPrefix$6}__overlay-default ${className}`,
|
|
20691
20807
|
onClick: () => {
|
|
20692
20808
|
this.clickCover();
|
|
20693
20809
|
},
|
|
20694
20810
|
closeOnOverlayClick,
|
|
20695
20811
|
lockScroll
|
|
20696
20812
|
},
|
|
20697
|
-
/* @__PURE__ */ React__namespace.createElement("div", { className: `${classPrefix$
|
|
20813
|
+
/* @__PURE__ */ React__namespace.createElement("div", { className: `${classPrefix$6} ${classes}`, id: `toast-${id}` }, /* @__PURE__ */ React__namespace.createElement(
|
|
20698
20814
|
"div",
|
|
20699
20815
|
{
|
|
20700
|
-
className: `${classPrefix$
|
|
20816
|
+
className: `${classPrefix$6}__inner ${classPrefix$6}-${position} ${contentClassName}`,
|
|
20701
20817
|
style: contentStyle
|
|
20702
20818
|
},
|
|
20703
20819
|
this.renderIcon(),
|
|
20704
|
-
title ? /* @__PURE__ */ React__namespace.createElement("div", { className: `${classPrefix$
|
|
20705
|
-
/* @__PURE__ */ React__namespace.createElement("span", { className: `${classPrefix$
|
|
20820
|
+
title ? /* @__PURE__ */ React__namespace.createElement("div", { className: `${classPrefix$6}-title` }, title) : null,
|
|
20821
|
+
/* @__PURE__ */ React__namespace.createElement("span", { className: `${classPrefix$6}-text` }, content)
|
|
20706
20822
|
))
|
|
20707
20823
|
));
|
|
20708
20824
|
}
|
|
@@ -20809,7 +20925,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20809
20925
|
}
|
|
20810
20926
|
}
|
|
20811
20927
|
};
|
|
20812
|
-
const defaultProps$
|
|
20928
|
+
const defaultProps$q = {
|
|
20813
20929
|
...ComponentDefaults,
|
|
20814
20930
|
type: "shake",
|
|
20815
20931
|
action: "initial",
|
|
@@ -20817,16 +20933,16 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20817
20933
|
onClick: (event) => {
|
|
20818
20934
|
}
|
|
20819
20935
|
};
|
|
20820
|
-
const classPrefix$
|
|
20936
|
+
const classPrefix$5 = `nut-animate`;
|
|
20821
20937
|
const Animate = (props) => {
|
|
20822
20938
|
const { className, type: type2, action, loop: loop2, onClick, children, ...rest } = {
|
|
20823
|
-
...defaultProps$
|
|
20939
|
+
...defaultProps$q,
|
|
20824
20940
|
...props
|
|
20825
20941
|
};
|
|
20826
20942
|
const [clicked, setClicked] = React.useState(false);
|
|
20827
20943
|
const classes = classNames({
|
|
20828
20944
|
"nut-ani-container": true,
|
|
20829
|
-
[`${classPrefix$
|
|
20945
|
+
[`${classPrefix$5}-${type2}`]: action === "initial" || clicked ? type2 : false,
|
|
20830
20946
|
loop: loop2
|
|
20831
20947
|
});
|
|
20832
20948
|
const cls = classNames(classes, className);
|
|
@@ -20841,9 +20957,9 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20841
20957
|
};
|
|
20842
20958
|
return /* @__PURE__ */ React.createElement("div", { className: "nut-animate" }, /* @__PURE__ */ React.createElement("div", { className: cls, onClick: handleClick2, ...rest }, children));
|
|
20843
20959
|
};
|
|
20844
|
-
Animate.defaultProps = defaultProps$
|
|
20960
|
+
Animate.defaultProps = defaultProps$q;
|
|
20845
20961
|
Animate.displayName = "NutAnimate";
|
|
20846
|
-
const defaultProps$
|
|
20962
|
+
const defaultProps$p = {
|
|
20847
20963
|
...ComponentDefaults,
|
|
20848
20964
|
length: 0,
|
|
20849
20965
|
value: "",
|
|
@@ -20862,7 +20978,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20862
20978
|
style,
|
|
20863
20979
|
...reset
|
|
20864
20980
|
} = {
|
|
20865
|
-
...defaultProps$
|
|
20981
|
+
...defaultProps$p,
|
|
20866
20982
|
...props
|
|
20867
20983
|
};
|
|
20868
20984
|
const classPrefix2 = "nut-countup";
|
|
@@ -20926,9 +21042,9 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20926
21042
|
);
|
|
20927
21043
|
})));
|
|
20928
21044
|
};
|
|
20929
|
-
CountUp.defaultProps = defaultProps$
|
|
21045
|
+
CountUp.defaultProps = defaultProps$p;
|
|
20930
21046
|
CountUp.displayName = "NutCountUp";
|
|
20931
|
-
const defaultProps$
|
|
21047
|
+
const defaultProps$o = {};
|
|
20932
21048
|
class AnimatingNumbers extends React.Component {
|
|
20933
21049
|
constructor(props) {
|
|
20934
21050
|
super(props);
|
|
@@ -20938,11 +21054,11 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20938
21054
|
return /* @__PURE__ */ React.createElement("div", { className: "nut-animatingnumbers" });
|
|
20939
21055
|
}
|
|
20940
21056
|
}
|
|
20941
|
-
__publicField(AnimatingNumbers, "defaultProps", defaultProps$
|
|
21057
|
+
__publicField(AnimatingNumbers, "defaultProps", defaultProps$o);
|
|
20942
21058
|
__publicField(AnimatingNumbers, "displayName", "NutAnimatingNumbers");
|
|
20943
21059
|
__publicField(AnimatingNumbers, "CountUp", CountUp);
|
|
20944
21060
|
AnimatingNumbers.CountUp = CountUp;
|
|
20945
|
-
const defaultProps$
|
|
21061
|
+
const defaultProps$n = {
|
|
20946
21062
|
...ComponentDefaults,
|
|
20947
21063
|
src: "",
|
|
20948
21064
|
muted: false,
|
|
@@ -20985,7 +21101,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20985
21101
|
children,
|
|
20986
21102
|
...rest
|
|
20987
21103
|
} = {
|
|
20988
|
-
...defaultProps$
|
|
21104
|
+
...defaultProps$n,
|
|
20989
21105
|
...props
|
|
20990
21106
|
};
|
|
20991
21107
|
const [playing, setPlaying] = React.useState(false);
|
|
@@ -21191,31 +21307,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
21191
21307
|
/* @__PURE__ */ React.createElement("track", { kind: "captions" })
|
|
21192
21308
|
));
|
|
21193
21309
|
};
|
|
21194
|
-
Audio.defaultProps = defaultProps$
|
|
21310
|
+
Audio.defaultProps = defaultProps$n;
|
|
21195
21311
|
Audio.displayName = "NutAudio";
|
|
21196
|
-
const defaultProps$n = {
|
|
21197
|
-
...ComponentDefaults,
|
|
21198
|
-
maxContent: "",
|
|
21199
|
-
max: "",
|
|
21200
|
-
maxBackground: "#eee",
|
|
21201
|
-
maxColor: "#666",
|
|
21202
|
-
gap: "-8",
|
|
21203
|
-
level: "left"
|
|
21204
|
-
};
|
|
21205
|
-
const classPrefix$5 = `nut-avatar-group`;
|
|
21206
|
-
const AvatarGroup = (props) => {
|
|
21207
|
-
const propAvatarGroup = { ...defaultProps$n, ...props };
|
|
21208
|
-
const { className, style, children } = propAvatarGroup;
|
|
21209
|
-
const avatarGroupRef = React.useRef(null);
|
|
21210
|
-
const cls = classNames(classPrefix$5, className);
|
|
21211
|
-
const parentAvatar = {
|
|
21212
|
-
propAvatarGroup,
|
|
21213
|
-
avatarGroupRef
|
|
21214
|
-
};
|
|
21215
|
-
return /* @__PURE__ */ React.createElement(AvatarContext.Provider, { value: parentAvatar }, /* @__PURE__ */ React.createElement("div", { className: cls, style, ref: avatarGroupRef }, children));
|
|
21216
|
-
};
|
|
21217
|
-
AvatarGroup.defaultProps = defaultProps$n;
|
|
21218
|
-
AvatarGroup.displayName = "NutAvatarGroup";
|
|
21219
21312
|
const defaultProps$m = {
|
|
21220
21313
|
...ComponentDefaults,
|
|
21221
21314
|
strokeWidth: 5,
|
|
@@ -22490,6 +22583,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22490
22583
|
});
|
|
22491
22584
|
SwiperItem.defaultProps = defaultProps$e;
|
|
22492
22585
|
SwiperItem.displayName = "NutSwiperItem";
|
|
22586
|
+
const InnerSwiper = Swiper;
|
|
22587
|
+
InnerSwiper.Item = SwiperItem;
|
|
22493
22588
|
const defaultProps$d = {
|
|
22494
22589
|
...ComponentDefaults,
|
|
22495
22590
|
images: [],
|
|
@@ -22665,7 +22760,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22665
22760
|
onTouchStart
|
|
22666
22761
|
},
|
|
22667
22762
|
/* @__PURE__ */ React.createElement(
|
|
22668
|
-
|
|
22763
|
+
InnerSwiper,
|
|
22669
22764
|
{
|
|
22670
22765
|
autoPlay,
|
|
22671
22766
|
className: `${classPrefix2}-swiper`,
|
|
@@ -22694,315 +22789,16 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22694
22789
|
};
|
|
22695
22790
|
ImagePreview.defaultProps = defaultProps$d;
|
|
22696
22791
|
ImagePreview.displayName = "NutImagePreview";
|
|
22697
|
-
const
|
|
22698
|
-
|
|
22699
|
-
|
|
22700
|
-
|
|
22701
|
-
|
|
22702
|
-
|
|
22703
|
-
|
|
22704
|
-
|
|
22705
|
-
|
|
22706
|
-
|
|
22707
|
-
left: index * reaItemSize,
|
|
22708
|
-
right: (index + 1) * reaItemSize
|
|
22709
|
-
};
|
|
22710
|
-
index++;
|
|
22711
|
-
}
|
|
22712
|
-
return positions;
|
|
22713
|
-
};
|
|
22714
|
-
const getListTotalSize = (positions, horizontal) => {
|
|
22715
|
-
const index = positions.length - 1;
|
|
22716
|
-
let size = 0;
|
|
22717
|
-
if (index < 0) {
|
|
22718
|
-
size = 0;
|
|
22719
|
-
} else {
|
|
22720
|
-
size = horizontal ? positions[index].right : positions[index].bottom;
|
|
22721
|
-
}
|
|
22722
|
-
return size;
|
|
22723
|
-
};
|
|
22724
|
-
const binarySearch = (positionsList, value = 0, horizontal) => {
|
|
22725
|
-
let start2 = 0;
|
|
22726
|
-
let end = positionsList.length - 1;
|
|
22727
|
-
let tempIndex = null;
|
|
22728
|
-
const key = horizontal ? "right" : "bottom";
|
|
22729
|
-
while (start2 <= end) {
|
|
22730
|
-
const midIndex = Math.floor((start2 + end) / 2);
|
|
22731
|
-
const midValue = positionsList[midIndex][key];
|
|
22732
|
-
if (midValue === value) {
|
|
22733
|
-
return midIndex + 1;
|
|
22734
|
-
}
|
|
22735
|
-
if (midValue < value) {
|
|
22736
|
-
start2 = midIndex + 1;
|
|
22737
|
-
} else if (midValue > value) {
|
|
22738
|
-
if (tempIndex === null || tempIndex > midIndex) {
|
|
22739
|
-
tempIndex = midIndex;
|
|
22740
|
-
}
|
|
22741
|
-
end = midIndex - 1;
|
|
22742
|
-
}
|
|
22743
|
-
}
|
|
22744
|
-
tempIndex = tempIndex || 0;
|
|
22745
|
-
return tempIndex;
|
|
22746
|
-
};
|
|
22747
|
-
const getEndIndex = ({
|
|
22748
|
-
list,
|
|
22749
|
-
startIndex,
|
|
22750
|
-
visibleCount,
|
|
22751
|
-
itemEqual = true,
|
|
22752
|
-
positions,
|
|
22753
|
-
offSetSize,
|
|
22754
|
-
overscan,
|
|
22755
|
-
sizeKey = "width"
|
|
22756
|
-
}) => {
|
|
22757
|
-
const dataLength = list.length;
|
|
22758
|
-
let tempIndex = null;
|
|
22759
|
-
if (itemEqual) {
|
|
22760
|
-
const endIndex = startIndex + visibleCount;
|
|
22761
|
-
tempIndex = dataLength > 0 ? Math.min(dataLength, endIndex) : endIndex;
|
|
22762
|
-
} else {
|
|
22763
|
-
let sizeNum = 0;
|
|
22764
|
-
for (let i = startIndex; i < dataLength; i++) {
|
|
22765
|
-
sizeNum += positions[i][sizeKey] || 0;
|
|
22766
|
-
if (sizeNum > offSetSize) {
|
|
22767
|
-
const endIndex = i + overscan;
|
|
22768
|
-
tempIndex = dataLength > 0 ? Math.min(dataLength, endIndex) : endIndex;
|
|
22769
|
-
break;
|
|
22770
|
-
}
|
|
22771
|
-
}
|
|
22772
|
-
if (sizeNum < offSetSize) {
|
|
22773
|
-
tempIndex = dataLength;
|
|
22774
|
-
}
|
|
22775
|
-
}
|
|
22776
|
-
tempIndex = tempIndex || 0;
|
|
22777
|
-
return tempIndex;
|
|
22778
|
-
};
|
|
22779
|
-
const updateItemSize = (positions, items, sizeKey) => {
|
|
22780
|
-
const newPos = positions.concat();
|
|
22781
|
-
Array.from(items).forEach((item) => {
|
|
22782
|
-
const index = Number(item.getAttribute("data-index"));
|
|
22783
|
-
const styleVal = item.getAttribute("style");
|
|
22784
|
-
if (styleVal && styleVal.includes("none"))
|
|
22785
|
-
return;
|
|
22786
|
-
const nowSize = item.getBoundingClientRect()[sizeKey];
|
|
22787
|
-
const oldSize = positions[index][sizeKey];
|
|
22788
|
-
const dValue = oldSize - nowSize;
|
|
22789
|
-
if (dValue) {
|
|
22790
|
-
if (sizeKey === "width") {
|
|
22791
|
-
newPos[index].right -= dValue;
|
|
22792
|
-
newPos[index][sizeKey] = nowSize;
|
|
22793
|
-
for (let k2 = index + 1; k2 < positions.length; k2++) {
|
|
22794
|
-
newPos[k2].left = positions[k2 - 1].right;
|
|
22795
|
-
newPos[k2].right -= dValue;
|
|
22796
|
-
}
|
|
22797
|
-
} else if (sizeKey === "height") {
|
|
22798
|
-
newPos[index].bottom -= dValue;
|
|
22799
|
-
newPos[index][sizeKey] = nowSize;
|
|
22800
|
-
for (let k2 = index + 1; k2 < positions.length; k2++) {
|
|
22801
|
-
newPos[k2].top = positions[k2 - 1].bottom;
|
|
22802
|
-
newPos[k2].bottom -= dValue;
|
|
22803
|
-
}
|
|
22804
|
-
}
|
|
22805
|
-
}
|
|
22806
|
-
});
|
|
22807
|
-
};
|
|
22808
|
-
const defaultProps$c = {
|
|
22809
|
-
...ComponentDefaults,
|
|
22810
|
-
list: [],
|
|
22811
|
-
itemHeight: 66,
|
|
22812
|
-
itemEqual: true,
|
|
22813
|
-
direction: "vertical",
|
|
22814
|
-
overscan: 2
|
|
22815
|
-
};
|
|
22816
|
-
const VirtualList = (props) => {
|
|
22817
|
-
const {
|
|
22818
|
-
list,
|
|
22819
|
-
ItemRender,
|
|
22820
|
-
itemEqual,
|
|
22821
|
-
itemHeight,
|
|
22822
|
-
direction,
|
|
22823
|
-
overscan,
|
|
22824
|
-
key,
|
|
22825
|
-
onScroll,
|
|
22826
|
-
className,
|
|
22827
|
-
containerHeight,
|
|
22828
|
-
...rest
|
|
22829
|
-
} = {
|
|
22830
|
-
...defaultProps$c,
|
|
22831
|
-
...props
|
|
22832
|
-
};
|
|
22833
|
-
const horizontal = direction === "horizontal";
|
|
22834
|
-
const sizeKey = horizontal ? "width" : "height";
|
|
22835
|
-
const scrollKey = horizontal ? "scrollLeft" : "scrollTop";
|
|
22836
|
-
const offsetKey = horizontal ? "left" : "top";
|
|
22837
|
-
const scrollRef = React.useRef(null);
|
|
22838
|
-
const itemsRef = React.useRef(null);
|
|
22839
|
-
const firstItemRef = React.useRef(null);
|
|
22840
|
-
const [positions, setPositions] = React.useState([
|
|
22841
|
-
{
|
|
22842
|
-
index: 0,
|
|
22843
|
-
left: 0,
|
|
22844
|
-
top: 0,
|
|
22845
|
-
bottom: 0,
|
|
22846
|
-
width: 0,
|
|
22847
|
-
height: 0,
|
|
22848
|
-
right: 0
|
|
22849
|
-
}
|
|
22850
|
-
]);
|
|
22851
|
-
const [listTotalSize, setListTotalSize] = React.useState(99999999);
|
|
22852
|
-
const [visibleCount, setVisibleCount] = React.useState(0);
|
|
22853
|
-
const [offSetSize, setOffSetSize] = React.useState(containerHeight || 0);
|
|
22854
|
-
const [options2, setOptions] = React.useState({
|
|
22855
|
-
startOffset: 0,
|
|
22856
|
-
// 可视区域距离顶部的偏移量
|
|
22857
|
-
startIndex: 0,
|
|
22858
|
-
// 可视区域开始索引
|
|
22859
|
-
overStart: 0,
|
|
22860
|
-
endIndex: 10
|
|
22861
|
-
// 可视区域结束索引
|
|
22862
|
-
});
|
|
22863
|
-
React.useEffect(() => {
|
|
22864
|
-
const pos = initPositinoCache(itemHeight, list.length);
|
|
22865
|
-
setPositions(pos);
|
|
22866
|
-
const totalSize = getListTotalSize(pos, horizontal);
|
|
22867
|
-
setListTotalSize(totalSize);
|
|
22868
|
-
}, [list, itemHeight, horizontal]);
|
|
22869
|
-
const getElement = React.useCallback(() => {
|
|
22870
|
-
var _a2;
|
|
22871
|
-
return ((_a2 = scrollRef.current) == null ? void 0 : _a2.parentElement) || document.body;
|
|
22872
|
-
}, []);
|
|
22873
|
-
React.useEffect(() => {
|
|
22874
|
-
if (containerHeight)
|
|
22875
|
-
return;
|
|
22876
|
-
const size = horizontal ? getElement().offsetWidth : getElement().offsetHeight;
|
|
22877
|
-
setOffSetSize(size);
|
|
22878
|
-
}, [getElement, horizontal, containerHeight]);
|
|
22879
|
-
React.useEffect(() => {
|
|
22880
|
-
if (offSetSize === 0)
|
|
22881
|
-
return;
|
|
22882
|
-
const count = Math.ceil(offSetSize / itemHeight) + overscan;
|
|
22883
|
-
setVisibleCount(count);
|
|
22884
|
-
setOptions((options22) => {
|
|
22885
|
-
return { ...options22, endIndex: count };
|
|
22886
|
-
});
|
|
22887
|
-
}, [getElement, horizontal, itemHeight, overscan, offSetSize]);
|
|
22888
|
-
const updateTotalSize = React.useCallback(() => {
|
|
22889
|
-
if (!itemsRef.current)
|
|
22890
|
-
return;
|
|
22891
|
-
const items = itemsRef.current.children;
|
|
22892
|
-
if (!items.length)
|
|
22893
|
-
return;
|
|
22894
|
-
updateItemSize(positions, items, sizeKey);
|
|
22895
|
-
const totalSize = getListTotalSize(positions, horizontal);
|
|
22896
|
-
setListTotalSize(totalSize);
|
|
22897
|
-
}, [positions, sizeKey, horizontal]);
|
|
22898
|
-
const scroll = React.useCallback(() => {
|
|
22899
|
-
requestAnimationFrame((e) => {
|
|
22900
|
-
const scrollSize = getElement()[scrollKey];
|
|
22901
|
-
const startIndex = binarySearch(positions, scrollSize, horizontal);
|
|
22902
|
-
const overStart = startIndex - overscan > -1 ? startIndex - overscan : 0;
|
|
22903
|
-
if (!itemEqual) {
|
|
22904
|
-
updateTotalSize();
|
|
22905
|
-
}
|
|
22906
|
-
const endIndex = getEndIndex({
|
|
22907
|
-
list,
|
|
22908
|
-
startIndex,
|
|
22909
|
-
visibleCount,
|
|
22910
|
-
itemEqual,
|
|
22911
|
-
positions,
|
|
22912
|
-
offSetSize,
|
|
22913
|
-
sizeKey,
|
|
22914
|
-
overscan
|
|
22915
|
-
});
|
|
22916
|
-
const startOffset = positions[startIndex][offsetKey];
|
|
22917
|
-
setOptions({ startOffset, startIndex, overStart, endIndex });
|
|
22918
|
-
if (endIndex > list.length - 1) {
|
|
22919
|
-
if (onScroll) {
|
|
22920
|
-
onScroll();
|
|
22921
|
-
}
|
|
22922
|
-
}
|
|
22923
|
-
});
|
|
22924
|
-
}, [
|
|
22925
|
-
positions,
|
|
22926
|
-
getElement,
|
|
22927
|
-
list,
|
|
22928
|
-
visibleCount,
|
|
22929
|
-
itemEqual,
|
|
22930
|
-
updateTotalSize,
|
|
22931
|
-
offsetKey,
|
|
22932
|
-
sizeKey,
|
|
22933
|
-
scrollKey,
|
|
22934
|
-
horizontal,
|
|
22935
|
-
overscan,
|
|
22936
|
-
offSetSize
|
|
22937
|
-
]);
|
|
22938
|
-
React.useEffect(() => {
|
|
22939
|
-
const element = getElement();
|
|
22940
|
-
element.addEventListener("scroll", scroll, false);
|
|
22941
|
-
return () => {
|
|
22942
|
-
element.removeEventListener("scroll", scroll, false);
|
|
22943
|
-
};
|
|
22944
|
-
}, [getElement, scroll]);
|
|
22945
|
-
return /* @__PURE__ */ React.createElement(
|
|
22946
|
-
"div",
|
|
22947
|
-
{
|
|
22948
|
-
className: className ? `${className} nut-virtualList-box` : "nut-virtualList-box",
|
|
22949
|
-
...rest,
|
|
22950
|
-
style: {
|
|
22951
|
-
[sizeKey]: containerHeight ? `${offSetSize}px` : ""
|
|
22952
|
-
}
|
|
22953
|
-
},
|
|
22954
|
-
/* @__PURE__ */ React.createElement(
|
|
22955
|
-
"div",
|
|
22956
|
-
{
|
|
22957
|
-
ref: scrollRef,
|
|
22958
|
-
className: horizontal ? "nut-horizontal-box" : "nut-vertical-box",
|
|
22959
|
-
style: {
|
|
22960
|
-
position: "relative",
|
|
22961
|
-
[sizeKey]: `${listTotalSize}px`
|
|
22962
|
-
}
|
|
22963
|
-
},
|
|
22964
|
-
/* @__PURE__ */ React.createElement(
|
|
22965
|
-
"ul",
|
|
22966
|
-
{
|
|
22967
|
-
className: horizontal ? "nut-virtuallist-items nut-horizontal-items" : "nut-virtuallist-items nut-vertical-items",
|
|
22968
|
-
ref: itemsRef,
|
|
22969
|
-
style: {
|
|
22970
|
-
transform: horizontal ? `translate3d(${options2.startOffset}px,0,0)` : `translate3d(0,${options2.startOffset}px,0)`
|
|
22971
|
-
}
|
|
22972
|
-
},
|
|
22973
|
-
list.slice(options2.overStart, options2.endIndex).map((data, index) => {
|
|
22974
|
-
const { startIndex, overStart } = options2;
|
|
22975
|
-
const dataIndex = overStart + index;
|
|
22976
|
-
const styleVal = dataIndex < startIndex ? "none" : "block";
|
|
22977
|
-
const keyVal = key && data[key] ? data[key] : dataIndex;
|
|
22978
|
-
return /* @__PURE__ */ React.createElement(
|
|
22979
|
-
"li",
|
|
22980
|
-
{
|
|
22981
|
-
ref: dataIndex === 0 ? firstItemRef : null,
|
|
22982
|
-
"data-index": `${dataIndex}`,
|
|
22983
|
-
className: dataIndex % 2 === 0 ? "nut-virtuallist-item even" : "nut-virtuallist-item odd",
|
|
22984
|
-
key: `${keyVal}`,
|
|
22985
|
-
style: { display: styleVal }
|
|
22986
|
-
},
|
|
22987
|
-
ItemRender ? /* @__PURE__ */ React.createElement(ItemRender, { data, index: `${dataIndex}` }) : data
|
|
22988
|
-
);
|
|
22989
|
-
})
|
|
22990
|
-
)
|
|
22991
|
-
)
|
|
22992
|
-
);
|
|
22993
|
-
};
|
|
22994
|
-
VirtualList.defaultProps = defaultProps$c;
|
|
22995
|
-
VirtualList.displayName = "NutVirtualList";
|
|
22996
|
-
const defaultProps$b = {
|
|
22997
|
-
...ComponentDefaults,
|
|
22998
|
-
defaultValue: 1,
|
|
22999
|
-
mode: "multi",
|
|
23000
|
-
prev: null,
|
|
23001
|
-
next: null,
|
|
23002
|
-
total: 50,
|
|
23003
|
-
pageSize: 10,
|
|
23004
|
-
itemSize: 5,
|
|
23005
|
-
ellipse: false
|
|
22792
|
+
const defaultProps$c = {
|
|
22793
|
+
...ComponentDefaults,
|
|
22794
|
+
defaultValue: 1,
|
|
22795
|
+
mode: "multi",
|
|
22796
|
+
prev: null,
|
|
22797
|
+
next: null,
|
|
22798
|
+
total: 50,
|
|
22799
|
+
pageSize: 10,
|
|
22800
|
+
itemSize: 5,
|
|
22801
|
+
ellipse: false
|
|
23006
22802
|
};
|
|
23007
22803
|
const Pagination = (props) => {
|
|
23008
22804
|
const { locale } = useConfig();
|
|
@@ -23021,7 +22817,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
23021
22817
|
className,
|
|
23022
22818
|
...rest
|
|
23023
22819
|
} = {
|
|
23024
|
-
...defaultProps$
|
|
22820
|
+
...defaultProps$c,
|
|
23025
22821
|
...props
|
|
23026
22822
|
};
|
|
23027
22823
|
const classPrefix2 = "nut-pagination";
|
|
@@ -23103,9 +22899,9 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
23103
22899
|
next || locale.pagination.next
|
|
23104
22900
|
));
|
|
23105
22901
|
};
|
|
23106
|
-
Pagination.defaultProps = defaultProps$
|
|
22902
|
+
Pagination.defaultProps = defaultProps$c;
|
|
23107
22903
|
Pagination.displayName = "NutPagination";
|
|
23108
|
-
const defaultProps$
|
|
22904
|
+
const defaultProps$b = {
|
|
23109
22905
|
...ComponentDefaults,
|
|
23110
22906
|
price: 0,
|
|
23111
22907
|
symbol: "¥",
|
|
@@ -23128,7 +22924,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
23128
22924
|
style,
|
|
23129
22925
|
...rest
|
|
23130
22926
|
} = {
|
|
23131
|
-
...defaultProps$
|
|
22927
|
+
...defaultProps$b,
|
|
23132
22928
|
...props
|
|
23133
22929
|
};
|
|
23134
22930
|
const classPrefix2 = "nut-price";
|
|
@@ -23208,10 +23004,10 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
23208
23004
|
symbol && position === "after" ? renderSymbol() : null
|
|
23209
23005
|
);
|
|
23210
23006
|
};
|
|
23211
|
-
Price.defaultProps = defaultProps$
|
|
23007
|
+
Price.defaultProps = defaultProps$b;
|
|
23212
23008
|
Price.displayName = "NutPrice";
|
|
23213
23009
|
const DataContext = React.createContext({});
|
|
23214
|
-
const defaultProps$
|
|
23010
|
+
const defaultProps$a = {
|
|
23215
23011
|
...ComponentDefaults,
|
|
23216
23012
|
title: "",
|
|
23217
23013
|
description: "",
|
|
@@ -23220,7 +23016,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
23220
23016
|
};
|
|
23221
23017
|
const Step = (props) => {
|
|
23222
23018
|
const { children, title, description, value, icon, className, ...restProps } = {
|
|
23223
|
-
...defaultProps$
|
|
23019
|
+
...defaultProps$a,
|
|
23224
23020
|
...props
|
|
23225
23021
|
};
|
|
23226
23022
|
const parent = React.useContext(DataContext);
|
|
@@ -23254,16 +23050,16 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
23254
23050
|
};
|
|
23255
23051
|
return /* @__PURE__ */ React.createElement("div", { className: classes, ...restProps, onClick: handleClickStep }, /* @__PURE__ */ React.createElement("div", { className: "nut-step-head" }, /* @__PURE__ */ React.createElement("div", { className: "nut-step-line" }), /* @__PURE__ */ React.createElement("div", { className: renderIconClass() }, icon || !dot && /* @__PURE__ */ React.createElement("span", { className: "nut-step-inner" }, value))), /* @__PURE__ */ React.createElement("div", { className: "nut-step-main" }, /* @__PURE__ */ React.createElement("span", { className: "nut-step-title" }, title), description && /* @__PURE__ */ React.createElement("span", { className: "nut-step-description" }, description)));
|
|
23256
23052
|
};
|
|
23257
|
-
Step.defaultProps = defaultProps$
|
|
23053
|
+
Step.defaultProps = defaultProps$a;
|
|
23258
23054
|
Step.displayName = "NutStep";
|
|
23259
|
-
const defaultProps$
|
|
23055
|
+
const defaultProps$9 = {
|
|
23260
23056
|
...ComponentDefaults,
|
|
23261
23057
|
value: 0,
|
|
23262
23058
|
direction: "horizontal",
|
|
23263
23059
|
dot: false
|
|
23264
23060
|
};
|
|
23265
23061
|
const Steps = (props) => {
|
|
23266
|
-
const propSteps = { ...defaultProps$
|
|
23062
|
+
const propSteps = { ...defaultProps$9, ...props };
|
|
23267
23063
|
const {
|
|
23268
23064
|
children,
|
|
23269
23065
|
value,
|
|
@@ -23294,9 +23090,9 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
23294
23090
|
children
|
|
23295
23091
|
));
|
|
23296
23092
|
};
|
|
23297
|
-
Steps.defaultProps = defaultProps$
|
|
23093
|
+
Steps.defaultProps = defaultProps$9;
|
|
23298
23094
|
Steps.displayName = "NutSteps";
|
|
23299
|
-
const defaultProps$
|
|
23095
|
+
const defaultProps$8 = {
|
|
23300
23096
|
...ComponentDefaults,
|
|
23301
23097
|
columns: [],
|
|
23302
23098
|
data: [],
|
|
@@ -23308,7 +23104,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
23308
23104
|
};
|
|
23309
23105
|
const Table = (props) => {
|
|
23310
23106
|
const { locale } = useConfig();
|
|
23311
|
-
defaultProps$
|
|
23107
|
+
defaultProps$8.noData = locale.noData;
|
|
23312
23108
|
const {
|
|
23313
23109
|
children,
|
|
23314
23110
|
className,
|
|
@@ -23324,7 +23120,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
23324
23120
|
onSort,
|
|
23325
23121
|
...rest
|
|
23326
23122
|
} = {
|
|
23327
|
-
...defaultProps$
|
|
23123
|
+
...defaultProps$8,
|
|
23328
23124
|
...props
|
|
23329
23125
|
};
|
|
23330
23126
|
const [curData, setCurData] = React.useState(data);
|
|
@@ -23407,117 +23203,414 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
23407
23203
|
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__main__body` }, renderBoyTrs())
|
|
23408
23204
|
), (summary || curData.length === 0) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__summary` }, summary || noData));
|
|
23409
23205
|
};
|
|
23410
|
-
Table.defaultProps = defaultProps$
|
|
23411
|
-
Table.displayName = "NutTable";
|
|
23206
|
+
Table.defaultProps = defaultProps$8;
|
|
23207
|
+
Table.displayName = "NutTable";
|
|
23208
|
+
const defaultProps$7 = {
|
|
23209
|
+
...ComponentDefaults,
|
|
23210
|
+
type: "default",
|
|
23211
|
+
background: "",
|
|
23212
|
+
color: "",
|
|
23213
|
+
plain: false,
|
|
23214
|
+
round: false,
|
|
23215
|
+
mark: false,
|
|
23216
|
+
closeable: false,
|
|
23217
|
+
closeIcon: null,
|
|
23218
|
+
onClose: (e) => {
|
|
23219
|
+
},
|
|
23220
|
+
onClick: (e) => {
|
|
23221
|
+
}
|
|
23222
|
+
};
|
|
23223
|
+
const Tag = (props) => {
|
|
23224
|
+
const {
|
|
23225
|
+
className,
|
|
23226
|
+
style,
|
|
23227
|
+
background,
|
|
23228
|
+
plain,
|
|
23229
|
+
type: type2,
|
|
23230
|
+
round,
|
|
23231
|
+
children,
|
|
23232
|
+
mark,
|
|
23233
|
+
closeable,
|
|
23234
|
+
closeIcon,
|
|
23235
|
+
color,
|
|
23236
|
+
onClick,
|
|
23237
|
+
onClose
|
|
23238
|
+
} = {
|
|
23239
|
+
...defaultProps$7,
|
|
23240
|
+
...props
|
|
23241
|
+
};
|
|
23242
|
+
const [tagClass, setTagClass] = React.useState("");
|
|
23243
|
+
const [visible, setVisible] = React.useState(true);
|
|
23244
|
+
const classPrefix2 = "nut-tag";
|
|
23245
|
+
const classes = () => {
|
|
23246
|
+
return classNames({
|
|
23247
|
+
[classPrefix2]: true,
|
|
23248
|
+
[`${classPrefix2}--${type2}`]: type2,
|
|
23249
|
+
[`${classPrefix2}--plain`]: plain,
|
|
23250
|
+
[`${classPrefix2}--round`]: round,
|
|
23251
|
+
[`${classPrefix2}--mark`]: mark,
|
|
23252
|
+
[`${classPrefix2}--close`]: closeable,
|
|
23253
|
+
[`${className}`]: className
|
|
23254
|
+
});
|
|
23255
|
+
};
|
|
23256
|
+
React.useEffect(() => {
|
|
23257
|
+
setTagClass(classes());
|
|
23258
|
+
}, [type2, background, color, plain, round, mark, closeable, className]);
|
|
23259
|
+
const handleClick2 = (e) => {
|
|
23260
|
+
onClick && onClick(e);
|
|
23261
|
+
};
|
|
23262
|
+
const getStyle = () => {
|
|
23263
|
+
const style2 = {};
|
|
23264
|
+
if (color) {
|
|
23265
|
+
style2.color = color;
|
|
23266
|
+
} else if (background && plain) {
|
|
23267
|
+
style2.color = background;
|
|
23268
|
+
}
|
|
23269
|
+
if (plain) {
|
|
23270
|
+
style2.borderColor = background;
|
|
23271
|
+
} else if (background) {
|
|
23272
|
+
style2.background = background;
|
|
23273
|
+
}
|
|
23274
|
+
return style2;
|
|
23275
|
+
};
|
|
23276
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, closeable ? visible && /* @__PURE__ */ React.createElement(
|
|
23277
|
+
"div",
|
|
23278
|
+
{
|
|
23279
|
+
className: tagClass,
|
|
23280
|
+
style: { ...style, ...getStyle() },
|
|
23281
|
+
onClick: (e) => handleClick2(e)
|
|
23282
|
+
},
|
|
23283
|
+
children && /* @__PURE__ */ React.createElement("span", { className: `${classPrefix2}-text` }, children),
|
|
23284
|
+
React.isValidElement(closeIcon) ? /* @__PURE__ */ React.createElement(
|
|
23285
|
+
"i",
|
|
23286
|
+
{
|
|
23287
|
+
className: `${classPrefix2}-custom-icon`,
|
|
23288
|
+
onClick: (e) => {
|
|
23289
|
+
setVisible(false);
|
|
23290
|
+
onClose && onClose(e);
|
|
23291
|
+
}
|
|
23292
|
+
},
|
|
23293
|
+
closeIcon
|
|
23294
|
+
) : /* @__PURE__ */ React.createElement(
|
|
23295
|
+
x$b,
|
|
23296
|
+
{
|
|
23297
|
+
width: 12,
|
|
23298
|
+
height: 12,
|
|
23299
|
+
onClick: (e) => {
|
|
23300
|
+
setVisible(false);
|
|
23301
|
+
onClose && onClose(e);
|
|
23302
|
+
}
|
|
23303
|
+
}
|
|
23304
|
+
)
|
|
23305
|
+
) : /* @__PURE__ */ React.createElement(
|
|
23306
|
+
"div",
|
|
23307
|
+
{
|
|
23308
|
+
className: tagClass,
|
|
23309
|
+
style: { ...style, ...getStyle() },
|
|
23310
|
+
onClick: (e) => handleClick2(e)
|
|
23311
|
+
},
|
|
23312
|
+
children && /* @__PURE__ */ React.createElement("span", { className: `${classPrefix2}-text` }, children)
|
|
23313
|
+
));
|
|
23314
|
+
};
|
|
23315
|
+
Tag.defaultProps = defaultProps$7;
|
|
23316
|
+
Tag.displayName = "NutTag";
|
|
23317
|
+
const initPositinoCache = (reaItemSize, length = 0) => {
|
|
23318
|
+
let index = 0;
|
|
23319
|
+
const positions = Array(length);
|
|
23320
|
+
while (index < length) {
|
|
23321
|
+
positions[index] = {
|
|
23322
|
+
index,
|
|
23323
|
+
height: reaItemSize,
|
|
23324
|
+
width: reaItemSize,
|
|
23325
|
+
top: index * reaItemSize,
|
|
23326
|
+
bottom: (index + 1) * reaItemSize,
|
|
23327
|
+
left: index * reaItemSize,
|
|
23328
|
+
right: (index + 1) * reaItemSize
|
|
23329
|
+
};
|
|
23330
|
+
index++;
|
|
23331
|
+
}
|
|
23332
|
+
return positions;
|
|
23333
|
+
};
|
|
23334
|
+
const getListTotalSize = (positions, horizontal) => {
|
|
23335
|
+
const index = positions.length - 1;
|
|
23336
|
+
let size = 0;
|
|
23337
|
+
if (index < 0) {
|
|
23338
|
+
size = 0;
|
|
23339
|
+
} else {
|
|
23340
|
+
size = horizontal ? positions[index].right : positions[index].bottom;
|
|
23341
|
+
}
|
|
23342
|
+
return size;
|
|
23343
|
+
};
|
|
23344
|
+
const binarySearch = (positionsList, value = 0, horizontal) => {
|
|
23345
|
+
let start2 = 0;
|
|
23346
|
+
let end = positionsList.length - 1;
|
|
23347
|
+
let tempIndex = null;
|
|
23348
|
+
const key = horizontal ? "right" : "bottom";
|
|
23349
|
+
while (start2 <= end) {
|
|
23350
|
+
const midIndex = Math.floor((start2 + end) / 2);
|
|
23351
|
+
const midValue = positionsList[midIndex][key];
|
|
23352
|
+
if (midValue === value) {
|
|
23353
|
+
return midIndex + 1;
|
|
23354
|
+
}
|
|
23355
|
+
if (midValue < value) {
|
|
23356
|
+
start2 = midIndex + 1;
|
|
23357
|
+
} else if (midValue > value) {
|
|
23358
|
+
if (tempIndex === null || tempIndex > midIndex) {
|
|
23359
|
+
tempIndex = midIndex;
|
|
23360
|
+
}
|
|
23361
|
+
end = midIndex - 1;
|
|
23362
|
+
}
|
|
23363
|
+
}
|
|
23364
|
+
tempIndex = tempIndex || 0;
|
|
23365
|
+
return tempIndex;
|
|
23366
|
+
};
|
|
23367
|
+
const getEndIndex = ({
|
|
23368
|
+
list,
|
|
23369
|
+
startIndex,
|
|
23370
|
+
visibleCount,
|
|
23371
|
+
itemEqual = true,
|
|
23372
|
+
positions,
|
|
23373
|
+
offSetSize,
|
|
23374
|
+
overscan,
|
|
23375
|
+
sizeKey = "width"
|
|
23376
|
+
}) => {
|
|
23377
|
+
const dataLength = list.length;
|
|
23378
|
+
let tempIndex = null;
|
|
23379
|
+
if (itemEqual) {
|
|
23380
|
+
const endIndex = startIndex + visibleCount;
|
|
23381
|
+
tempIndex = dataLength > 0 ? Math.min(dataLength, endIndex) : endIndex;
|
|
23382
|
+
} else {
|
|
23383
|
+
let sizeNum = 0;
|
|
23384
|
+
for (let i = startIndex; i < dataLength; i++) {
|
|
23385
|
+
sizeNum += positions[i][sizeKey] || 0;
|
|
23386
|
+
if (sizeNum > offSetSize) {
|
|
23387
|
+
const endIndex = i + overscan;
|
|
23388
|
+
tempIndex = dataLength > 0 ? Math.min(dataLength, endIndex) : endIndex;
|
|
23389
|
+
break;
|
|
23390
|
+
}
|
|
23391
|
+
}
|
|
23392
|
+
if (sizeNum < offSetSize) {
|
|
23393
|
+
tempIndex = dataLength;
|
|
23394
|
+
}
|
|
23395
|
+
}
|
|
23396
|
+
tempIndex = tempIndex || 0;
|
|
23397
|
+
return tempIndex;
|
|
23398
|
+
};
|
|
23399
|
+
const updateItemSize = (positions, items, sizeKey) => {
|
|
23400
|
+
const newPos = positions.concat();
|
|
23401
|
+
Array.from(items).forEach((item) => {
|
|
23402
|
+
const index = Number(item.getAttribute("data-index"));
|
|
23403
|
+
const styleVal = item.getAttribute("style");
|
|
23404
|
+
if (styleVal && styleVal.includes("none"))
|
|
23405
|
+
return;
|
|
23406
|
+
const nowSize = item.getBoundingClientRect()[sizeKey];
|
|
23407
|
+
const oldSize = positions[index][sizeKey];
|
|
23408
|
+
const dValue = oldSize - nowSize;
|
|
23409
|
+
if (dValue) {
|
|
23410
|
+
if (sizeKey === "width") {
|
|
23411
|
+
newPos[index].right -= dValue;
|
|
23412
|
+
newPos[index][sizeKey] = nowSize;
|
|
23413
|
+
for (let k2 = index + 1; k2 < positions.length; k2++) {
|
|
23414
|
+
newPos[k2].left = positions[k2 - 1].right;
|
|
23415
|
+
newPos[k2].right -= dValue;
|
|
23416
|
+
}
|
|
23417
|
+
} else if (sizeKey === "height") {
|
|
23418
|
+
newPos[index].bottom -= dValue;
|
|
23419
|
+
newPos[index][sizeKey] = nowSize;
|
|
23420
|
+
for (let k2 = index + 1; k2 < positions.length; k2++) {
|
|
23421
|
+
newPos[k2].top = positions[k2 - 1].bottom;
|
|
23422
|
+
newPos[k2].bottom -= dValue;
|
|
23423
|
+
}
|
|
23424
|
+
}
|
|
23425
|
+
}
|
|
23426
|
+
});
|
|
23427
|
+
};
|
|
23412
23428
|
const defaultProps$6 = {
|
|
23413
23429
|
...ComponentDefaults,
|
|
23414
|
-
|
|
23415
|
-
|
|
23416
|
-
|
|
23417
|
-
|
|
23418
|
-
|
|
23419
|
-
mark: false,
|
|
23420
|
-
closeable: false,
|
|
23421
|
-
closeIcon: null,
|
|
23422
|
-
onClose: (e) => {
|
|
23423
|
-
},
|
|
23424
|
-
onClick: (e) => {
|
|
23425
|
-
}
|
|
23430
|
+
list: [],
|
|
23431
|
+
itemHeight: 66,
|
|
23432
|
+
itemEqual: true,
|
|
23433
|
+
direction: "vertical",
|
|
23434
|
+
overscan: 2
|
|
23426
23435
|
};
|
|
23427
|
-
const
|
|
23436
|
+
const VirtualList = (props) => {
|
|
23428
23437
|
const {
|
|
23438
|
+
list,
|
|
23439
|
+
itemRender,
|
|
23440
|
+
itemEqual,
|
|
23441
|
+
itemHeight,
|
|
23442
|
+
direction,
|
|
23443
|
+
overscan,
|
|
23444
|
+
key,
|
|
23445
|
+
onScroll,
|
|
23429
23446
|
className,
|
|
23430
|
-
|
|
23431
|
-
|
|
23432
|
-
plain,
|
|
23433
|
-
type: type2,
|
|
23434
|
-
round,
|
|
23435
|
-
children,
|
|
23436
|
-
mark,
|
|
23437
|
-
closeable,
|
|
23438
|
-
closeIcon,
|
|
23439
|
-
color,
|
|
23440
|
-
onClick,
|
|
23441
|
-
onClose
|
|
23447
|
+
containerHeight,
|
|
23448
|
+
...rest
|
|
23442
23449
|
} = {
|
|
23443
23450
|
...defaultProps$6,
|
|
23444
23451
|
...props
|
|
23445
23452
|
};
|
|
23446
|
-
const
|
|
23447
|
-
const
|
|
23448
|
-
const
|
|
23449
|
-
const
|
|
23450
|
-
|
|
23451
|
-
|
|
23452
|
-
|
|
23453
|
-
|
|
23454
|
-
|
|
23455
|
-
|
|
23456
|
-
|
|
23457
|
-
|
|
23453
|
+
const horizontal = direction === "horizontal";
|
|
23454
|
+
const sizeKey = horizontal ? "width" : "height";
|
|
23455
|
+
const scrollKey = horizontal ? "scrollLeft" : "scrollTop";
|
|
23456
|
+
const offsetKey = horizontal ? "left" : "top";
|
|
23457
|
+
const scrollRef = React.useRef(null);
|
|
23458
|
+
const itemsRef = React.useRef(null);
|
|
23459
|
+
const [positions, setPositions] = React.useState([
|
|
23460
|
+
{
|
|
23461
|
+
index: 0,
|
|
23462
|
+
left: 0,
|
|
23463
|
+
top: 0,
|
|
23464
|
+
bottom: 0,
|
|
23465
|
+
width: 0,
|
|
23466
|
+
height: 0,
|
|
23467
|
+
right: 0
|
|
23468
|
+
}
|
|
23469
|
+
]);
|
|
23470
|
+
const [listTotalSize, setListTotalSize] = React.useState(99999999);
|
|
23471
|
+
const [visibleCount, setVisibleCount] = React.useState(0);
|
|
23472
|
+
const [offSetSize, setOffSetSize] = React.useState(containerHeight || 0);
|
|
23473
|
+
const [options2, setOptions] = React.useState({
|
|
23474
|
+
startOffset: 0,
|
|
23475
|
+
// 可视区域距离顶部的偏移量
|
|
23476
|
+
startIndex: 0,
|
|
23477
|
+
// 可视区域开始索引
|
|
23478
|
+
overStart: 0,
|
|
23479
|
+
endIndex: 10
|
|
23480
|
+
// 可视区域结束索引
|
|
23481
|
+
});
|
|
23482
|
+
React.useEffect(() => {
|
|
23483
|
+
const pos = initPositinoCache(itemHeight, list.length);
|
|
23484
|
+
setPositions(pos);
|
|
23485
|
+
const totalSize = getListTotalSize(pos, horizontal);
|
|
23486
|
+
setListTotalSize(totalSize);
|
|
23487
|
+
}, [list, itemHeight, horizontal]);
|
|
23488
|
+
const getElement = React.useCallback(() => {
|
|
23489
|
+
var _a2;
|
|
23490
|
+
return ((_a2 = scrollRef.current) == null ? void 0 : _a2.parentElement) || document.body;
|
|
23491
|
+
}, []);
|
|
23492
|
+
React.useEffect(() => {
|
|
23493
|
+
if (containerHeight)
|
|
23494
|
+
return;
|
|
23495
|
+
const size = horizontal ? getElement().offsetWidth : getElement().offsetHeight;
|
|
23496
|
+
setOffSetSize(size);
|
|
23497
|
+
}, [getElement, horizontal, containerHeight]);
|
|
23498
|
+
React.useEffect(() => {
|
|
23499
|
+
if (offSetSize === 0)
|
|
23500
|
+
return;
|
|
23501
|
+
const count = Math.ceil(offSetSize / itemHeight) + overscan;
|
|
23502
|
+
setVisibleCount(count);
|
|
23503
|
+
setOptions((options22) => {
|
|
23504
|
+
return { ...options22, endIndex: count };
|
|
23458
23505
|
});
|
|
23459
|
-
};
|
|
23506
|
+
}, [getElement, horizontal, itemHeight, overscan, offSetSize]);
|
|
23507
|
+
const updateTotalSize = React.useCallback(() => {
|
|
23508
|
+
if (!itemsRef.current)
|
|
23509
|
+
return;
|
|
23510
|
+
const items = itemsRef.current.children;
|
|
23511
|
+
if (!items.length)
|
|
23512
|
+
return;
|
|
23513
|
+
updateItemSize(positions, items, sizeKey);
|
|
23514
|
+
const totalSize = getListTotalSize(positions, horizontal);
|
|
23515
|
+
setListTotalSize(totalSize);
|
|
23516
|
+
}, [positions, sizeKey, horizontal]);
|
|
23517
|
+
const scroll = React.useCallback(() => {
|
|
23518
|
+
requestAnimationFrame((e) => {
|
|
23519
|
+
const scrollSize = getElement()[scrollKey];
|
|
23520
|
+
const startIndex = binarySearch(positions, scrollSize, horizontal);
|
|
23521
|
+
const overStart = startIndex - overscan > -1 ? startIndex - overscan : 0;
|
|
23522
|
+
if (!itemEqual) {
|
|
23523
|
+
updateTotalSize();
|
|
23524
|
+
}
|
|
23525
|
+
const endIndex = getEndIndex({
|
|
23526
|
+
list,
|
|
23527
|
+
startIndex,
|
|
23528
|
+
visibleCount,
|
|
23529
|
+
itemEqual,
|
|
23530
|
+
positions,
|
|
23531
|
+
offSetSize,
|
|
23532
|
+
sizeKey,
|
|
23533
|
+
overscan
|
|
23534
|
+
});
|
|
23535
|
+
const startOffset = positions[startIndex][offsetKey];
|
|
23536
|
+
setOptions({ startOffset, startIndex, overStart, endIndex });
|
|
23537
|
+
if (endIndex > list.length - 1) {
|
|
23538
|
+
if (onScroll) {
|
|
23539
|
+
onScroll();
|
|
23540
|
+
}
|
|
23541
|
+
}
|
|
23542
|
+
});
|
|
23543
|
+
}, [
|
|
23544
|
+
positions,
|
|
23545
|
+
getElement,
|
|
23546
|
+
list,
|
|
23547
|
+
visibleCount,
|
|
23548
|
+
itemEqual,
|
|
23549
|
+
updateTotalSize,
|
|
23550
|
+
offsetKey,
|
|
23551
|
+
sizeKey,
|
|
23552
|
+
scrollKey,
|
|
23553
|
+
horizontal,
|
|
23554
|
+
overscan,
|
|
23555
|
+
offSetSize
|
|
23556
|
+
]);
|
|
23460
23557
|
React.useEffect(() => {
|
|
23461
|
-
|
|
23462
|
-
|
|
23463
|
-
|
|
23464
|
-
|
|
23465
|
-
|
|
23466
|
-
|
|
23467
|
-
|
|
23468
|
-
if (color) {
|
|
23469
|
-
style2.color = color;
|
|
23470
|
-
} else if (background && plain) {
|
|
23471
|
-
style2.color = background;
|
|
23472
|
-
}
|
|
23473
|
-
if (plain) {
|
|
23474
|
-
style2.borderColor = background;
|
|
23475
|
-
} else if (background) {
|
|
23476
|
-
style2.background = background;
|
|
23477
|
-
}
|
|
23478
|
-
return style2;
|
|
23479
|
-
};
|
|
23480
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, closeable ? visible && /* @__PURE__ */ React.createElement(
|
|
23558
|
+
const element = getElement();
|
|
23559
|
+
element.addEventListener("scroll", scroll, false);
|
|
23560
|
+
return () => {
|
|
23561
|
+
element.removeEventListener("scroll", scroll, false);
|
|
23562
|
+
};
|
|
23563
|
+
}, [getElement, scroll]);
|
|
23564
|
+
return /* @__PURE__ */ React.createElement(
|
|
23481
23565
|
"div",
|
|
23482
23566
|
{
|
|
23483
|
-
className:
|
|
23484
|
-
|
|
23485
|
-
|
|
23567
|
+
className: className ? `${className} nut-virtualList-box` : "nut-virtualList-box",
|
|
23568
|
+
...rest,
|
|
23569
|
+
style: {
|
|
23570
|
+
[sizeKey]: containerHeight ? `${offSetSize}px` : ""
|
|
23571
|
+
}
|
|
23486
23572
|
},
|
|
23487
|
-
|
|
23488
|
-
|
|
23489
|
-
"i",
|
|
23573
|
+
/* @__PURE__ */ React.createElement(
|
|
23574
|
+
"div",
|
|
23490
23575
|
{
|
|
23491
|
-
|
|
23492
|
-
|
|
23493
|
-
|
|
23494
|
-
|
|
23576
|
+
ref: scrollRef,
|
|
23577
|
+
className: horizontal ? "nut-horizontal-box" : "nut-vertical-box",
|
|
23578
|
+
style: {
|
|
23579
|
+
position: "relative",
|
|
23580
|
+
[sizeKey]: `${listTotalSize}px`
|
|
23495
23581
|
}
|
|
23496
23582
|
},
|
|
23497
|
-
|
|
23498
|
-
|
|
23499
|
-
|
|
23500
|
-
|
|
23501
|
-
|
|
23502
|
-
|
|
23503
|
-
|
|
23504
|
-
|
|
23505
|
-
|
|
23506
|
-
|
|
23507
|
-
|
|
23583
|
+
/* @__PURE__ */ React.createElement(
|
|
23584
|
+
"ul",
|
|
23585
|
+
{
|
|
23586
|
+
className: horizontal ? "nut-virtuallist-items nut-horizontal-items" : "nut-virtuallist-items nut-vertical-items",
|
|
23587
|
+
ref: itemsRef,
|
|
23588
|
+
style: {
|
|
23589
|
+
transform: horizontal ? `translate3d(${options2.startOffset}px,0,0)` : `translate3d(0,${options2.startOffset}px,0)`
|
|
23590
|
+
}
|
|
23591
|
+
},
|
|
23592
|
+
list.slice(options2.overStart, options2.endIndex).map((data, index) => {
|
|
23593
|
+
const { startIndex, overStart } = options2;
|
|
23594
|
+
const dataIndex = overStart + index;
|
|
23595
|
+
const styleVal = dataIndex < startIndex ? "none" : "block";
|
|
23596
|
+
const keyVal = key && data[key] ? data[key] : dataIndex;
|
|
23597
|
+
return /* @__PURE__ */ React.createElement(
|
|
23598
|
+
"li",
|
|
23599
|
+
{
|
|
23600
|
+
"data-index": `${dataIndex}`,
|
|
23601
|
+
className: dataIndex % 2 === 0 ? "nut-virtuallist-item even" : "nut-virtuallist-item odd",
|
|
23602
|
+
key: `${keyVal}`,
|
|
23603
|
+
style: { display: styleVal }
|
|
23604
|
+
},
|
|
23605
|
+
itemRender ? itemRender(data, dataIndex, index) : data
|
|
23606
|
+
);
|
|
23607
|
+
})
|
|
23608
|
+
)
|
|
23508
23609
|
)
|
|
23509
|
-
)
|
|
23510
|
-
"div",
|
|
23511
|
-
{
|
|
23512
|
-
className: tagClass,
|
|
23513
|
-
style: { ...style, ...getStyle() },
|
|
23514
|
-
onClick: (e) => handleClick2(e)
|
|
23515
|
-
},
|
|
23516
|
-
children && /* @__PURE__ */ React.createElement("span", { className: `${classPrefix2}-text` }, children)
|
|
23517
|
-
));
|
|
23610
|
+
);
|
|
23518
23611
|
};
|
|
23519
|
-
|
|
23520
|
-
|
|
23612
|
+
VirtualList.defaultProps = defaultProps$6;
|
|
23613
|
+
VirtualList.displayName = "NutVirtualList";
|
|
23521
23614
|
const defaultProps$5 = {
|
|
23522
23615
|
...ComponentDefaults,
|
|
23523
23616
|
list: [],
|
|
@@ -23851,13 +23944,13 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
23851
23944
|
digits: 2,
|
|
23852
23945
|
symbol: false,
|
|
23853
23946
|
zero: false,
|
|
23854
|
-
|
|
23855
|
-
|
|
23947
|
+
left: false,
|
|
23948
|
+
sync: true,
|
|
23856
23949
|
color: "#333",
|
|
23857
23950
|
riseColor: "#fa2c19",
|
|
23858
23951
|
dropColor: "#64b578",
|
|
23859
23952
|
riseIcon: null,
|
|
23860
|
-
|
|
23953
|
+
dropIcon: null
|
|
23861
23954
|
};
|
|
23862
23955
|
const TrendArrow = (props) => {
|
|
23863
23956
|
const {
|
|
@@ -23865,13 +23958,13 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
23865
23958
|
digits,
|
|
23866
23959
|
symbol,
|
|
23867
23960
|
zero,
|
|
23868
|
-
|
|
23869
|
-
|
|
23961
|
+
left,
|
|
23962
|
+
sync: sync2,
|
|
23870
23963
|
color,
|
|
23871
23964
|
riseColor,
|
|
23872
23965
|
dropColor,
|
|
23873
23966
|
riseIcon,
|
|
23874
|
-
|
|
23967
|
+
dropIcon,
|
|
23875
23968
|
className,
|
|
23876
23969
|
style,
|
|
23877
23970
|
children,
|
|
@@ -23889,7 +23982,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
23889
23982
|
};
|
|
23890
23983
|
const calcStyle = (() => {
|
|
23891
23984
|
const arrowColor = rateTrend.current ? riseColor : dropColor;
|
|
23892
|
-
const textEquArrowColor =
|
|
23985
|
+
const textEquArrowColor = sync2 ? arrowColor : color;
|
|
23893
23986
|
const style2 = {
|
|
23894
23987
|
color: value === 0 ? color : textEquArrowColor
|
|
23895
23988
|
};
|
|
@@ -23911,8 +24004,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
23911
24004
|
};
|
|
23912
24005
|
return iconProps;
|
|
23913
24006
|
})();
|
|
23914
|
-
const renderContent = (
|
|
23915
|
-
const classNameSuffix = !
|
|
24007
|
+
const renderContent = (left2) => {
|
|
24008
|
+
const classNameSuffix = !left2 ? "icon-after" : "icon-before";
|
|
23916
24009
|
return /* @__PURE__ */ React.createElement(
|
|
23917
24010
|
"span",
|
|
23918
24011
|
{
|
|
@@ -23922,7 +24015,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
23922
24015
|
calcRate
|
|
23923
24016
|
);
|
|
23924
24017
|
};
|
|
23925
|
-
return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2} ${className}`, style, ...rest }, !
|
|
24018
|
+
return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2} ${className}`, style, ...rest }, !left && renderContent(!left), Number(value) !== 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, rateTrend.current ? /* @__PURE__ */ React.createElement(React.Fragment, null, riseIcon || /* @__PURE__ */ React.createElement(y, { color: calcIconProps.color })) : /* @__PURE__ */ React.createElement(React.Fragment, null, dropIcon || /* @__PURE__ */ React.createElement(y$1, { color: calcIconProps.color }))), left && renderContent(!left));
|
|
23926
24019
|
};
|
|
23927
24020
|
TrendArrow.defaultProps = defaultProps$1;
|
|
23928
24021
|
TrendArrow.displayName = "NutTrendArrow";
|
|
@@ -24112,7 +24205,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
24112
24205
|
exports2.Sticky = Sticky;
|
|
24113
24206
|
exports2.SubSideNavBar = SubSideNavBar;
|
|
24114
24207
|
exports2.Swipe = Swipe;
|
|
24115
|
-
exports2.Swiper =
|
|
24208
|
+
exports2.Swiper = InnerSwiper;
|
|
24116
24209
|
exports2.SwiperItem = SwiperItem;
|
|
24117
24210
|
exports2.Switch = Switch;
|
|
24118
24211
|
exports2.TabPane = TabPane;
|