@nutui/nutui-react 1.3.0 → 1.3.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/Audio/style/index.js +4 -0
- package/dist/esm/Audio.js +293 -0
- package/dist/esm/Calendar/style/index.js +1 -2
- package/dist/esm/Calendar.js +80 -33
- package/dist/esm/CalendarItem.js +429 -231
- package/dist/esm/Cascader/style/index.js +2 -0
- package/dist/esm/Cascader.js +788 -0
- package/dist/esm/ConfigProvider.js +16 -0
- package/dist/esm/DatePicker.js +37 -6
- package/dist/esm/Dialog.js +9 -16
- package/dist/esm/Elevator.js +16 -5
- package/dist/esm/Grid/style/index.js +2 -0
- package/dist/esm/Grid.js +91 -0
- package/dist/esm/GridItem/style/index.js +2 -0
- package/dist/esm/GridItem.js +99 -0
- package/dist/esm/ImagePreview/style/index.js +2 -0
- package/dist/esm/ImagePreview.js +257 -0
- package/dist/esm/Menu/style/index.js +3 -0
- package/dist/esm/Menu.js +153 -0
- package/dist/esm/MenuItem/style/index.js +3 -0
- package/dist/esm/MenuItem.js +197 -0
- package/dist/esm/NoticeBar.js +3 -2
- package/dist/esm/Notify.js +2 -1
- package/dist/esm/Popover.js +4 -11
- package/dist/esm/Range.js +2 -45
- package/dist/esm/Swipe/style/index.js +2 -0
- package/dist/esm/Swipe.js +265 -0
- package/dist/esm/Swiper.js +2 -1
- package/dist/esm/TabPane.js +5 -33
- package/dist/esm/Tabs.js +6 -196
- package/dist/esm/TextArea.js +45 -4
- package/dist/esm/Toast.js +2 -1
- package/dist/esm/nutui-react.es.js +8 -0
- package/dist/esm/render-4a3856cb.js +32 -0
- package/dist/esm/tabpane-c957ab14.js +33 -0
- package/dist/esm/tabs-a48583e9.js +196 -0
- package/dist/esm/useClientRect-839d18c5.js +44 -0
- package/dist/locales/base.d.ts +16 -0
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +17 -1
- package/dist/locales/id-ID.js +17 -1
- package/dist/locales/zh-CN.js +17 -1
- package/dist/locales/zh-TW.js +17 -1
- package/dist/nutui.react.es.js +2338 -530
- package/dist/nutui.react.umd.js +2345 -529
- package/dist/packages/audio/audio.scss +80 -0
- package/dist/packages/calendar/calendar.scss +57 -36
- package/dist/packages/calendaritem/calendaritem.scss +0 -191
- package/dist/packages/cascader/cascader.scss +69 -0
- package/dist/packages/grid/grid.scss +10 -0
- package/dist/packages/griditem/griditem.scss +103 -0
- package/dist/packages/imagepreview/imagepreview.scss +51 -0
- package/dist/packages/menu/menu.scss +72 -0
- package/dist/packages/menuitem/menuitem.scss +90 -0
- package/dist/packages/popup/popup.scss +1 -1
- package/dist/packages/searchbar/searchbar.scss +1 -0
- package/dist/packages/shortpassword/shortpassword.scss +6 -1
- package/dist/packages/swipe/swipe.scss +33 -0
- package/dist/packages/textarea/textarea.scss +16 -1
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/font/iconfont.js +20 -18
- package/dist/styles/themes/default.scss +8 -0
- package/dist/styles/variables.scss +59 -8
- package/dist/types/audio/__test__/audio.spec.d.ts +1 -0
- package/dist/types/audio/audio.d.ts +18 -0
- package/dist/types/audio/audio.taro.d.ts +18 -0
- package/dist/types/audio/demo.d.ts +4 -0
- package/dist/types/audio/index.d.ts +2 -0
- package/dist/types/audio/index.taro.d.ts +2 -0
- package/dist/types/backtop/__test__/backtop.spec.d.ts +1 -0
- package/dist/types/calendar/__tests__/calendar.spec.d.ts +1 -0
- package/dist/types/calendar/calendar.d.ts +22 -2
- package/dist/types/calendar/demo.d.ts +1 -0
- package/dist/types/calendaritem/calendaritem.d.ts +21 -3
- package/dist/types/cascader/__tests__/cascader.spec.d.ts +1 -0
- package/dist/types/cascader/cascader.d.ts +25 -0
- package/dist/types/cascader/cascader.taro.d.ts +25 -0
- package/dist/types/cascader/cascaderItem.d.ts +25 -0
- package/dist/types/cascader/cascaderItem.taro.d.ts +25 -0
- package/dist/types/cascader/demo.d.ts +3 -0
- package/dist/types/cascader/helper.d.ts +4 -0
- package/dist/types/cascader/index.d.ts +2 -0
- package/dist/types/cascader/index.taro.d.ts +2 -0
- package/dist/types/cascader/tree.d.ts +12 -0
- package/dist/types/cascader/types.d.ts +28 -0
- package/dist/types/checkbox/checkbox.d.ts +2 -2
- package/dist/types/checkbox/checkbox.taro.d.ts +2 -2
- package/dist/types/checkboxgroup/checkboxgroup.d.ts +2 -2
- package/dist/types/checkboxgroup/checkboxgroup.taro.d.ts +2 -2
- package/dist/types/dialog/__test__/dialog.spec.d.ts +1 -0
- package/dist/types/dialog/config.d.ts +3 -3
- package/dist/types/dialog/dialog.d.ts +2 -1
- package/dist/types/dialog/dialog.taro.d.ts +2 -1
- package/dist/types/fixednav/fixednav.d.ts +2 -2
- package/dist/types/grid/__test__/grid.spec.d.ts +1 -0
- package/dist/types/grid/demo.d.ts +3 -0
- package/dist/types/grid/grid.d.ts +16 -0
- package/dist/types/grid/grid.taro.d.ts +16 -0
- package/dist/types/grid/index.d.ts +2 -0
- package/dist/types/grid/index.taro.d.ts +2 -0
- package/dist/types/griditem/griditem.d.ts +20 -0
- package/dist/types/griditem/griditem.taro.d.ts +20 -0
- package/dist/types/griditem/index.d.ts +2 -0
- package/dist/types/griditem/index.taro.d.ts +2 -0
- package/dist/types/icon/icon.d.ts +1 -2
- package/dist/types/icon/icon.taro.d.ts +1 -2
- package/dist/types/imagepreview/__test__/imagepreview.spec.d.ts +1 -0
- package/dist/types/imagepreview/demo.d.ts +3 -0
- package/dist/types/imagepreview/imagepreview.d.ts +26 -0
- package/dist/types/imagepreview/imagepreview.taro.d.ts +26 -0
- package/dist/types/imagepreview/index.d.ts +2 -0
- package/dist/types/imagepreview/index.taro.d.ts +2 -0
- package/dist/types/input/__test__/input.spec.d.ts +1 -0
- package/dist/types/menu/__test__/menu.spec.d.ts +1 -0
- package/dist/types/menu/demo.d.ts +4 -0
- package/dist/types/menu/index.d.ts +2 -0
- package/dist/types/menu/index.taro.d.ts +2 -0
- package/dist/types/menu/menu.d.ts +12 -0
- package/dist/types/menu/menu.taro.d.ts +12 -0
- package/dist/types/menuitem/index.d.ts +2 -0
- package/dist/types/menuitem/index.taro.d.ts +2 -0
- package/dist/types/menuitem/menuitem.d.ts +23 -0
- package/dist/types/menuitem/menuitem.taro.d.ts +23 -0
- package/dist/types/notify/__test__/notify.spec.d.ts +1 -0
- package/dist/types/notify/notify.d.ts +13 -0
- package/dist/types/notify/notify.taro.d.ts +13 -0
- package/dist/types/nutui.react.d.ts +95 -1
- package/dist/types/picker/doc.en.d.ts +142 -0
- package/dist/types/picker/picker.d.ts +2 -2
- package/dist/types/picker/picker.taro.d.ts +2 -2
- package/dist/types/popup/popup.d.ts +1 -1
- package/dist/types/popup/popup.taro.d.ts +1 -1
- package/dist/types/shortpassword/shortpassword.taro.d.ts +3 -3
- package/dist/types/sidenavbar/sidenavbar.d.ts +14 -2
- package/dist/types/sidenavbar/sidenavbar.taro.d.ts +14 -2
- package/dist/types/sidenavbaritem/sidenavbaritem.d.ts +10 -2
- package/dist/types/sidenavbaritem/sidenavbaritem.taro.d.ts +10 -2
- package/dist/types/subsidenavbar/subsidenavbar.d.ts +13 -3
- package/dist/types/subsidenavbar/subsidenavbar.taro.d.ts +13 -3
- package/dist/types/swipe/__tests__/swipe.spec.d.ts +1 -0
- package/dist/types/swipe/demo.d.ts +3 -0
- package/dist/types/swipe/index.d.ts +2 -0
- package/dist/types/swipe/index.taro.d.ts +2 -0
- package/dist/types/swipe/swipe.d.ts +41 -0
- package/dist/types/swipe/swipe.taro.d.ts +41 -0
- package/dist/types/swiper/swiper.d.ts +1 -2
- package/dist/types/swiperitem/swiperitem.d.ts +1 -2
- package/dist/types/table/table.d.ts +2 -1
- package/dist/types/table/table.taro.d.ts +2 -1
- package/dist/types/table/types.d.ts +1 -1
- package/dist/types/textarea/__test__/textarea.spec.d.ts +1 -0
- package/dist/types/toast/toast.d.ts +21 -0
- package/dist/types/toast/toast.taro.d.ts +18 -0
- package/dist/types/virtuallist/type.d.ts +1 -1
- package/dist/types/virtuallist/virtuallist.d.ts +2 -1
- package/dist/types/virtuallist/virtuallist.taro.d.ts +2 -1
- package/package.json +4 -4
package/dist/nutui.react.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui-react v1.3.0 Wed Aug
|
|
2
|
+
* @nutui/nutui-react v1.3.1-beta.0 Wed Aug 31 2022 13:31:29 GMT+0800 (China Standard Time)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -45,7 +45,7 @@ classname_production_min.cn = e$1, classname_production_min.withNaming = r$1;
|
|
|
45
45
|
classname.exports = classname_production_min;
|
|
46
46
|
}
|
|
47
47
|
const cn = classname.exports.withNaming({ n: "nut-", e: "__", m: "--", v: "-" });
|
|
48
|
-
const defaultProps$
|
|
48
|
+
const defaultProps$1j = {
|
|
49
49
|
name: "",
|
|
50
50
|
size: "",
|
|
51
51
|
classPrefix: "nut-icon",
|
|
@@ -73,7 +73,7 @@ function Icon(props) {
|
|
|
73
73
|
onClick,
|
|
74
74
|
...rest
|
|
75
75
|
} = {
|
|
76
|
-
...defaultProps$
|
|
76
|
+
...defaultProps$1j,
|
|
77
77
|
...props
|
|
78
78
|
};
|
|
79
79
|
const isImage = name ? name.indexOf("/") !== -1 : false;
|
|
@@ -107,9 +107,9 @@ function Icon(props) {
|
|
|
107
107
|
children
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
|
-
Icon.defaultProps = defaultProps$
|
|
110
|
+
Icon.defaultProps = defaultProps$1j;
|
|
111
111
|
Icon.displayName = "NutIcon";
|
|
112
|
-
const defaultProps$
|
|
112
|
+
const defaultProps$1i = {
|
|
113
113
|
className: "",
|
|
114
114
|
color: "",
|
|
115
115
|
shape: "round",
|
|
@@ -142,7 +142,7 @@ const Button = (props) => {
|
|
|
142
142
|
style,
|
|
143
143
|
...rest
|
|
144
144
|
} = {
|
|
145
|
-
...defaultProps$
|
|
145
|
+
...defaultProps$1i,
|
|
146
146
|
...props
|
|
147
147
|
};
|
|
148
148
|
const getStyle = useCallback(() => {
|
|
@@ -215,7 +215,7 @@ const Button = (props) => {
|
|
|
215
215
|
name: icon
|
|
216
216
|
}) : "", children));
|
|
217
217
|
};
|
|
218
|
-
Button.defaultProps = defaultProps$
|
|
218
|
+
Button.defaultProps = defaultProps$1i;
|
|
219
219
|
Button.displayName = "NutButton";
|
|
220
220
|
function _setPrototypeOf(o, p2) {
|
|
221
221
|
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p3) {
|
|
@@ -677,7 +677,7 @@ function createReactContext(defaultValue, calculateChangedBits) {
|
|
|
677
677
|
}
|
|
678
678
|
}
|
|
679
679
|
};
|
|
680
|
-
_proto.render = function
|
|
680
|
+
_proto.render = function render2() {
|
|
681
681
|
return this.props.children;
|
|
682
682
|
};
|
|
683
683
|
return Provider2;
|
|
@@ -725,7 +725,7 @@ function createReactContext(defaultValue, calculateChangedBits) {
|
|
|
725
725
|
return defaultValue;
|
|
726
726
|
}
|
|
727
727
|
};
|
|
728
|
-
_proto2.render = function
|
|
728
|
+
_proto2.render = function render2() {
|
|
729
729
|
return onlyChild(this.props.children)(this.state.value);
|
|
730
730
|
};
|
|
731
731
|
return Consumer2;
|
|
@@ -1171,7 +1171,7 @@ var Router = /* @__PURE__ */ function(_React$Component) {
|
|
|
1171
1171
|
this._pendingLocation = null;
|
|
1172
1172
|
}
|
|
1173
1173
|
};
|
|
1174
|
-
_proto.render = function
|
|
1174
|
+
_proto.render = function render2() {
|
|
1175
1175
|
return /* @__PURE__ */ React__default.createElement(context.Provider, {
|
|
1176
1176
|
value: {
|
|
1177
1177
|
history: this.props.history,
|
|
@@ -1198,7 +1198,7 @@ var Router = /* @__PURE__ */ function(_React$Component) {
|
|
|
1198
1198
|
return _this;
|
|
1199
1199
|
}
|
|
1200
1200
|
var _proto = MemoryRouter.prototype;
|
|
1201
|
-
_proto.render = function
|
|
1201
|
+
_proto.render = function render2() {
|
|
1202
1202
|
return /* @__PURE__ */ React__default.createElement(Router, {
|
|
1203
1203
|
history: this.history,
|
|
1204
1204
|
children: this.props.children
|
|
@@ -1224,7 +1224,7 @@ var Router = /* @__PURE__ */ function(_React$Component) {
|
|
|
1224
1224
|
if (this.props.onUnmount)
|
|
1225
1225
|
this.props.onUnmount.call(this, this);
|
|
1226
1226
|
};
|
|
1227
|
-
_proto.render = function
|
|
1227
|
+
_proto.render = function render2() {
|
|
1228
1228
|
return null;
|
|
1229
1229
|
};
|
|
1230
1230
|
return Lifecycle;
|
|
@@ -1297,7 +1297,7 @@ function isEmptyChildren(children) {
|
|
|
1297
1297
|
return _React$Component.apply(this, arguments) || this;
|
|
1298
1298
|
}
|
|
1299
1299
|
var _proto = Route.prototype;
|
|
1300
|
-
_proto.render = function
|
|
1300
|
+
_proto.render = function render2() {
|
|
1301
1301
|
var _this = this;
|
|
1302
1302
|
return /* @__PURE__ */ React__default.createElement(context.Consumer, null, function(context$1) {
|
|
1303
1303
|
!context$1 ? invariant(false) : void 0;
|
|
@@ -1307,13 +1307,13 @@ function isEmptyChildren(children) {
|
|
|
1307
1307
|
location,
|
|
1308
1308
|
match
|
|
1309
1309
|
});
|
|
1310
|
-
var _this$props = _this.props, children = _this$props.children, component = _this$props.component,
|
|
1310
|
+
var _this$props = _this.props, children = _this$props.children, component = _this$props.component, render3 = _this$props.render;
|
|
1311
1311
|
if (Array.isArray(children) && isEmptyChildren(children)) {
|
|
1312
1312
|
children = null;
|
|
1313
1313
|
}
|
|
1314
1314
|
return /* @__PURE__ */ React__default.createElement(context.Provider, {
|
|
1315
1315
|
value: props
|
|
1316
|
-
}, props.match ? children ? typeof children === "function" ? children(props) : children : component ? /* @__PURE__ */ React__default.createElement(component, props) :
|
|
1316
|
+
}, props.match ? children ? typeof children === "function" ? children(props) : children : component ? /* @__PURE__ */ React__default.createElement(component, props) : render3 ? render3(props) : null : typeof children === "function" ? children(props) : null);
|
|
1317
1317
|
});
|
|
1318
1318
|
};
|
|
1319
1319
|
return Route;
|
|
@@ -1377,7 +1377,7 @@ function noop$3() {
|
|
|
1377
1377
|
context2.location = addBasename(basename, createLocation(location));
|
|
1378
1378
|
context2.url = createURL(context2.location);
|
|
1379
1379
|
};
|
|
1380
|
-
_proto.render = function
|
|
1380
|
+
_proto.render = function render2() {
|
|
1381
1381
|
var _this$props2 = this.props, _this$props2$basename = _this$props2.basename, basename = _this$props2$basename === void 0 ? "" : _this$props2$basename, _this$props2$context = _this$props2.context, context2 = _this$props2$context === void 0 ? {} : _this$props2$context, _this$props2$location = _this$props2.location, location = _this$props2$location === void 0 ? "/" : _this$props2$location, rest = _objectWithoutPropertiesLoose$3(_this$props2, ["basename", "context", "location"]);
|
|
1382
1382
|
var history = {
|
|
1383
1383
|
createHref: function createHref(path) {
|
|
@@ -1406,7 +1406,7 @@ function noop$3() {
|
|
|
1406
1406
|
return _React$Component.apply(this, arguments) || this;
|
|
1407
1407
|
}
|
|
1408
1408
|
var _proto = Switch2.prototype;
|
|
1409
|
-
_proto.render = function
|
|
1409
|
+
_proto.render = function render2() {
|
|
1410
1410
|
var _this = this;
|
|
1411
1411
|
return /* @__PURE__ */ React__default.createElement(context.Consumer, null, function(context2) {
|
|
1412
1412
|
!context2 ? invariant(false) : void 0;
|
|
@@ -1433,7 +1433,7 @@ var useContext = React__default.useContext;
|
|
|
1433
1433
|
function useHistory() {
|
|
1434
1434
|
return useContext(historyContext);
|
|
1435
1435
|
}
|
|
1436
|
-
const defaultProps$
|
|
1436
|
+
const defaultProps$1h = {
|
|
1437
1437
|
title: null,
|
|
1438
1438
|
subTitle: null,
|
|
1439
1439
|
desc: "",
|
|
@@ -1473,7 +1473,7 @@ const Cell = (props) => {
|
|
|
1473
1473
|
linkSlot,
|
|
1474
1474
|
...rest
|
|
1475
1475
|
} = {
|
|
1476
|
-
...defaultProps$
|
|
1476
|
+
...defaultProps$1h,
|
|
1477
1477
|
...props
|
|
1478
1478
|
};
|
|
1479
1479
|
const b2 = cn("cell");
|
|
@@ -1522,9 +1522,9 @@ const Cell = (props) => {
|
|
|
1522
1522
|
className: b2("link")
|
|
1523
1523
|
}) : linkSlot));
|
|
1524
1524
|
};
|
|
1525
|
-
Cell.defaultProps = defaultProps$
|
|
1525
|
+
Cell.defaultProps = defaultProps$1h;
|
|
1526
1526
|
Cell.displayName = "NutCell";
|
|
1527
|
-
const defaultProps$
|
|
1527
|
+
const defaultProps$1g = {
|
|
1528
1528
|
title: "",
|
|
1529
1529
|
desc: "",
|
|
1530
1530
|
titleSlot: null,
|
|
@@ -1533,7 +1533,7 @@ const defaultProps$17 = {
|
|
|
1533
1533
|
};
|
|
1534
1534
|
const CellGroup = (props) => {
|
|
1535
1535
|
const { children, classPrefix, title, desc, titleSlot, descSlot } = {
|
|
1536
|
-
...defaultProps$
|
|
1536
|
+
...defaultProps$1g,
|
|
1537
1537
|
...props
|
|
1538
1538
|
};
|
|
1539
1539
|
const b2 = cn("cell-group");
|
|
@@ -1547,7 +1547,7 @@ const CellGroup = (props) => {
|
|
|
1547
1547
|
className: b2("wrap")
|
|
1548
1548
|
}, children));
|
|
1549
1549
|
};
|
|
1550
|
-
CellGroup.defaultProps = defaultProps$
|
|
1550
|
+
CellGroup.defaultProps = defaultProps$1g;
|
|
1551
1551
|
CellGroup.displayName = "NutCellGroup";
|
|
1552
1552
|
var classnames = { exports: {} };
|
|
1553
1553
|
/*!
|
|
@@ -1909,7 +1909,7 @@ var Transition = /* @__PURE__ */ function(_React$Component) {
|
|
|
1909
1909
|
setTimeout(this.nextCallback, timeout);
|
|
1910
1910
|
}
|
|
1911
1911
|
};
|
|
1912
|
-
_proto.render = function
|
|
1912
|
+
_proto.render = function render2() {
|
|
1913
1913
|
var status = this.state.status;
|
|
1914
1914
|
if (status === UNMOUNTED) {
|
|
1915
1915
|
return null;
|
|
@@ -2080,7 +2080,7 @@ var CSSTransition = /* @__PURE__ */ function(_React$Component) {
|
|
|
2080
2080
|
removeClass(node, doneClassName);
|
|
2081
2081
|
}
|
|
2082
2082
|
};
|
|
2083
|
-
_proto.render = function
|
|
2083
|
+
_proto.render = function render2() {
|
|
2084
2084
|
var _this$props = this.props;
|
|
2085
2085
|
_this$props.classNames;
|
|
2086
2086
|
var props = _objectWithoutPropertiesLoose$3(_this$props, ["classNames"]);
|
|
@@ -2100,7 +2100,7 @@ CSSTransition.defaultProps = {
|
|
|
2100
2100
|
};
|
|
2101
2101
|
CSSTransition.propTypes = {};
|
|
2102
2102
|
var CSSTransition$1 = CSSTransition;
|
|
2103
|
-
const defaultProps$
|
|
2103
|
+
const defaultProps$1f = {
|
|
2104
2104
|
position: "center",
|
|
2105
2105
|
transition: "",
|
|
2106
2106
|
style: {},
|
|
@@ -2281,7 +2281,7 @@ const Popup = (props) => {
|
|
|
2281
2281
|
}, [position]);
|
|
2282
2282
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderToContainer(teleport, renderNode()));
|
|
2283
2283
|
};
|
|
2284
|
-
Popup.defaultProps = defaultProps$
|
|
2284
|
+
Popup.defaultProps = defaultProps$1f;
|
|
2285
2285
|
Popup.displayName = "NutPopup";
|
|
2286
2286
|
const zhCN = {
|
|
2287
2287
|
save: "\u4FDD\u5B58",
|
|
@@ -2384,9 +2384,25 @@ const zhCN = {
|
|
|
2384
2384
|
title4: "\u641C\u7D22\u6846\u6587\u672C\u8BBE\u7F6E",
|
|
2385
2385
|
title5: "\u81EA\u5B9A\u4E49\u56FE\u6807\u8BBE\u7F6E",
|
|
2386
2386
|
title6: "\u6570\u636E\u6539\u53D8\u76D1\u542C"
|
|
2387
|
+
},
|
|
2388
|
+
audio: {
|
|
2389
|
+
back: "\u5FEB\u9000",
|
|
2390
|
+
forward: "\u5FEB\u8FDB",
|
|
2391
|
+
pause: "\u6682\u505C",
|
|
2392
|
+
start: "\u5F00\u59CB",
|
|
2393
|
+
mute: "\u9759\u97F3",
|
|
2394
|
+
tips: "onPlayEnd\u4E8B\u4EF6\u5728loop=false\u65F6\u624D\u4F1A\u89E6\u53D1"
|
|
2395
|
+
},
|
|
2396
|
+
datepicker: {
|
|
2397
|
+
year: "\u5E74",
|
|
2398
|
+
month: "\u6708",
|
|
2399
|
+
day: "\u65E5",
|
|
2400
|
+
hour: "\u65F6",
|
|
2401
|
+
min: "\u5206",
|
|
2402
|
+
seconds: "\u79D2"
|
|
2387
2403
|
}
|
|
2388
2404
|
};
|
|
2389
|
-
const defaultProps$
|
|
2405
|
+
const defaultProps$1e = {
|
|
2390
2406
|
locale: zhCN
|
|
2391
2407
|
};
|
|
2392
2408
|
const defaultConfigRef = {
|
|
@@ -2403,7 +2419,7 @@ const useConfig = () => {
|
|
|
2403
2419
|
};
|
|
2404
2420
|
const ConfigContext = createContext(null);
|
|
2405
2421
|
const ConfigProvider = (props) => {
|
|
2406
|
-
const { children, ...config2 } = { ...defaultProps$
|
|
2422
|
+
const { children, ...config2 } = { ...defaultProps$1e, ...props };
|
|
2407
2423
|
const parentConfig = useConfig();
|
|
2408
2424
|
return /* @__PURE__ */ React__default.createElement(ConfigContext.Provider, {
|
|
2409
2425
|
value: {
|
|
@@ -2412,25 +2428,25 @@ const ConfigProvider = (props) => {
|
|
|
2412
2428
|
}
|
|
2413
2429
|
}, children);
|
|
2414
2430
|
};
|
|
2415
|
-
ConfigProvider.defaultProps = defaultProps$
|
|
2431
|
+
ConfigProvider.defaultProps = defaultProps$1e;
|
|
2416
2432
|
ConfigProvider.displayName = "NutConfigProvider";
|
|
2417
|
-
const defaultProps$
|
|
2433
|
+
const defaultProps$1d = {};
|
|
2418
2434
|
const Layout = (props) => {
|
|
2419
|
-
({ ...defaultProps$
|
|
2435
|
+
({ ...defaultProps$1d, ...props });
|
|
2420
2436
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
2421
2437
|
className: "nut-layout"
|
|
2422
2438
|
}, "Layout");
|
|
2423
2439
|
};
|
|
2424
|
-
Layout.defaultProps = defaultProps$
|
|
2440
|
+
Layout.defaultProps = defaultProps$1d;
|
|
2425
2441
|
Layout.displayName = "NutLayout";
|
|
2426
2442
|
const DataContext$2 = createContext({});
|
|
2427
|
-
const defaultProps$
|
|
2443
|
+
const defaultProps$1c = {
|
|
2428
2444
|
span: "24",
|
|
2429
2445
|
offset: "0",
|
|
2430
2446
|
gutter: "0"
|
|
2431
2447
|
};
|
|
2432
2448
|
const Col = (props) => {
|
|
2433
|
-
const { span, offset, children, onClick } = { ...defaultProps$
|
|
2449
|
+
const { span, offset, children, onClick } = { ...defaultProps$1c, ...props };
|
|
2434
2450
|
const [colName, setColName] = useState("");
|
|
2435
2451
|
const [colStyle, setColStyle] = useState({});
|
|
2436
2452
|
const { gutter } = useContext$1(DataContext$2);
|
|
@@ -2456,9 +2472,9 @@ const Col = (props) => {
|
|
|
2456
2472
|
}
|
|
2457
2473
|
}, children);
|
|
2458
2474
|
};
|
|
2459
|
-
Col.defaultProps = defaultProps$
|
|
2475
|
+
Col.defaultProps = defaultProps$1c;
|
|
2460
2476
|
Col.displayName = "NutCol";
|
|
2461
|
-
const defaultProps$
|
|
2477
|
+
const defaultProps$1b = {
|
|
2462
2478
|
type: "",
|
|
2463
2479
|
justify: "start",
|
|
2464
2480
|
align: "flex-start",
|
|
@@ -2467,7 +2483,7 @@ const defaultProps$12 = {
|
|
|
2467
2483
|
};
|
|
2468
2484
|
const Row = (props) => {
|
|
2469
2485
|
const { children, type, justify, align, wrap, gutter, onClick } = {
|
|
2470
|
-
...defaultProps$
|
|
2486
|
+
...defaultProps$1b,
|
|
2471
2487
|
...props
|
|
2472
2488
|
};
|
|
2473
2489
|
const prefixCls = "nut-row";
|
|
@@ -2501,9 +2517,9 @@ const Row = (props) => {
|
|
|
2501
2517
|
children
|
|
2502
2518
|
));
|
|
2503
2519
|
};
|
|
2504
|
-
Row.defaultProps = defaultProps$
|
|
2520
|
+
Row.defaultProps = defaultProps$1b;
|
|
2505
2521
|
Row.displayName = "NutRow";
|
|
2506
|
-
const defaultProps$
|
|
2522
|
+
const defaultProps$1a = {
|
|
2507
2523
|
contentPosition: "center",
|
|
2508
2524
|
dashed: false,
|
|
2509
2525
|
hairline: true,
|
|
@@ -2520,7 +2536,7 @@ const Divider = (props) => {
|
|
|
2520
2536
|
direction,
|
|
2521
2537
|
...rest
|
|
2522
2538
|
} = {
|
|
2523
|
-
...defaultProps$
|
|
2539
|
+
...defaultProps$1a,
|
|
2524
2540
|
...props
|
|
2525
2541
|
};
|
|
2526
2542
|
const dividerBem = cn("divider");
|
|
@@ -2541,9 +2557,153 @@ const Divider = (props) => {
|
|
|
2541
2557
|
...rest
|
|
2542
2558
|
}, children);
|
|
2543
2559
|
};
|
|
2544
|
-
Divider.defaultProps = defaultProps$
|
|
2560
|
+
Divider.defaultProps = defaultProps$1a;
|
|
2545
2561
|
Divider.displayName = "NutDivider";
|
|
2546
|
-
const defaultProps$
|
|
2562
|
+
const defaultProps$19 = {
|
|
2563
|
+
columnNum: 4,
|
|
2564
|
+
border: true,
|
|
2565
|
+
gutter: 0,
|
|
2566
|
+
center: true,
|
|
2567
|
+
square: false,
|
|
2568
|
+
reverse: false,
|
|
2569
|
+
direction: "vertical",
|
|
2570
|
+
iconSize: 28,
|
|
2571
|
+
iconColor: ""
|
|
2572
|
+
};
|
|
2573
|
+
const Grid = (props) => {
|
|
2574
|
+
useConfig();
|
|
2575
|
+
const {
|
|
2576
|
+
children,
|
|
2577
|
+
columnNum,
|
|
2578
|
+
border,
|
|
2579
|
+
gutter,
|
|
2580
|
+
center,
|
|
2581
|
+
square,
|
|
2582
|
+
reverse,
|
|
2583
|
+
direction,
|
|
2584
|
+
style,
|
|
2585
|
+
iconSize,
|
|
2586
|
+
iconColor,
|
|
2587
|
+
className,
|
|
2588
|
+
...rest
|
|
2589
|
+
} = { ...defaultProps$19, ...props };
|
|
2590
|
+
const childrenDom = React__default.Children.toArray(children);
|
|
2591
|
+
const pxCheck2 = (value) => {
|
|
2592
|
+
return Number.isNaN(Number(value)) ? String(value) : `${value}px`;
|
|
2593
|
+
};
|
|
2594
|
+
const b2 = cn("grid");
|
|
2595
|
+
const rootClass = () => {
|
|
2596
|
+
const prefixCls = b2();
|
|
2597
|
+
return `${className} ${prefixCls} ${border && !gutter ? `${b2("border")}` : ""}`;
|
|
2598
|
+
};
|
|
2599
|
+
const rootStyle = () => {
|
|
2600
|
+
let styleSelf = {};
|
|
2601
|
+
if (style) {
|
|
2602
|
+
styleSelf = style;
|
|
2603
|
+
}
|
|
2604
|
+
if (gutter) {
|
|
2605
|
+
styleSelf.paddingLeft = pxCheck2(gutter);
|
|
2606
|
+
}
|
|
2607
|
+
return styleSelf;
|
|
2608
|
+
};
|
|
2609
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
2610
|
+
className: rootClass(),
|
|
2611
|
+
style: rootStyle(),
|
|
2612
|
+
...rest
|
|
2613
|
+
}, childrenDom.map((item, idex) => {
|
|
2614
|
+
return React__default.cloneElement(item, {
|
|
2615
|
+
index: idex,
|
|
2616
|
+
columnNum,
|
|
2617
|
+
center,
|
|
2618
|
+
border,
|
|
2619
|
+
gutter,
|
|
2620
|
+
square,
|
|
2621
|
+
reverse,
|
|
2622
|
+
direction,
|
|
2623
|
+
parentIconSize: iconSize,
|
|
2624
|
+
parentIconColor: iconColor
|
|
2625
|
+
});
|
|
2626
|
+
}));
|
|
2627
|
+
};
|
|
2628
|
+
Grid.defaultProps = defaultProps$19;
|
|
2629
|
+
Grid.displayName = "NutGrid";
|
|
2630
|
+
const defaultProps$18 = {
|
|
2631
|
+
text: "",
|
|
2632
|
+
icon: "",
|
|
2633
|
+
iconSize: "",
|
|
2634
|
+
iconColor: "",
|
|
2635
|
+
parentIconSize: "",
|
|
2636
|
+
parentIconColor: "",
|
|
2637
|
+
columnNum: 4,
|
|
2638
|
+
border: true,
|
|
2639
|
+
gutter: 0,
|
|
2640
|
+
center: true,
|
|
2641
|
+
square: false,
|
|
2642
|
+
reverse: false,
|
|
2643
|
+
direction: "vertical"
|
|
2644
|
+
};
|
|
2645
|
+
const GridItem = (props) => {
|
|
2646
|
+
useConfig();
|
|
2647
|
+
const {
|
|
2648
|
+
children,
|
|
2649
|
+
columnNum,
|
|
2650
|
+
index: index2,
|
|
2651
|
+
gutter,
|
|
2652
|
+
square,
|
|
2653
|
+
text,
|
|
2654
|
+
icon,
|
|
2655
|
+
iconColor,
|
|
2656
|
+
iconSize,
|
|
2657
|
+
parentIconSize,
|
|
2658
|
+
parentIconColor,
|
|
2659
|
+
border,
|
|
2660
|
+
center,
|
|
2661
|
+
reverse,
|
|
2662
|
+
direction,
|
|
2663
|
+
...rest
|
|
2664
|
+
} = { ...defaultProps$18, ...props };
|
|
2665
|
+
const b2 = cn("grid-item");
|
|
2666
|
+
const pxCheck2 = (value) => {
|
|
2667
|
+
return Number.isNaN(Number(value)) ? String(value) : `${value}px`;
|
|
2668
|
+
};
|
|
2669
|
+
const rootStyle = () => {
|
|
2670
|
+
const style = {
|
|
2671
|
+
flexBasis: `${100 / +columnNum}%`
|
|
2672
|
+
};
|
|
2673
|
+
if (square) {
|
|
2674
|
+
style.paddingTop = `${100 / +columnNum}%`;
|
|
2675
|
+
} else if (gutter) {
|
|
2676
|
+
style.paddingRight = pxCheck2(gutter);
|
|
2677
|
+
if (index2 >= columnNum) {
|
|
2678
|
+
style.marginTop = pxCheck2(gutter);
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
return style;
|
|
2682
|
+
};
|
|
2683
|
+
const contentClass = () => {
|
|
2684
|
+
return `${b2("content")} ${border && b2("content--border")} ${border && gutter && b2("content--surround")} ${center && b2("content--center")} ${square && b2("content--square")} ${reverse && b2("content--reverse")} ${!!direction && b2(`content--${direction}`)}
|
|
2685
|
+
`;
|
|
2686
|
+
};
|
|
2687
|
+
const isIconName = () => {
|
|
2688
|
+
return typeof icon === "string";
|
|
2689
|
+
};
|
|
2690
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
2691
|
+
className: b2(),
|
|
2692
|
+
style: rootStyle(),
|
|
2693
|
+
...rest
|
|
2694
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
2695
|
+
className: contentClass()
|
|
2696
|
+
}, icon && isIconName() ? /* @__PURE__ */ React__default.createElement(Icon, {
|
|
2697
|
+
name: icon,
|
|
2698
|
+
size: iconSize || parentIconSize,
|
|
2699
|
+
color: iconColor || parentIconColor
|
|
2700
|
+
}) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, icon), text && /* @__PURE__ */ React__default.createElement("div", {
|
|
2701
|
+
className: "nut-grid-item__text"
|
|
2702
|
+
}, text), children && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children)));
|
|
2703
|
+
};
|
|
2704
|
+
GridItem.defaultProps = defaultProps$18;
|
|
2705
|
+
GridItem.displayName = "NutGridItem";
|
|
2706
|
+
const defaultProps$17 = {
|
|
2547
2707
|
title: "",
|
|
2548
2708
|
desc: "",
|
|
2549
2709
|
leftShow: true,
|
|
@@ -2576,7 +2736,7 @@ const NavBar = (props) => {
|
|
|
2576
2736
|
onClickBack,
|
|
2577
2737
|
onClickRight
|
|
2578
2738
|
} = {
|
|
2579
|
-
...defaultProps$
|
|
2739
|
+
...defaultProps$17,
|
|
2580
2740
|
...props
|
|
2581
2741
|
};
|
|
2582
2742
|
const b2 = cn("navbar");
|
|
@@ -2641,9 +2801,9 @@ const NavBar = (props) => {
|
|
|
2641
2801
|
className: `${b2("")}--placeholder`
|
|
2642
2802
|
}, renderWrapper()) : renderWrapper());
|
|
2643
2803
|
};
|
|
2644
|
-
NavBar.defaultProps = defaultProps$
|
|
2804
|
+
NavBar.defaultProps = defaultProps$17;
|
|
2645
2805
|
NavBar.displayName = "NutNavBar";
|
|
2646
|
-
const defaultProps
|
|
2806
|
+
const defaultProps$16 = {
|
|
2647
2807
|
fixednavClass: "nut-fixednav",
|
|
2648
2808
|
activeText: "",
|
|
2649
2809
|
unActiveText: "",
|
|
@@ -2669,7 +2829,7 @@ const FixedNav = (props) => {
|
|
|
2669
2829
|
slotList,
|
|
2670
2830
|
slotBtn,
|
|
2671
2831
|
...rest
|
|
2672
|
-
} = { ...defaultProps
|
|
2832
|
+
} = { ...defaultProps$16, ...props };
|
|
2673
2833
|
const b2 = cn("fixednav");
|
|
2674
2834
|
const classes = classNames(
|
|
2675
2835
|
{
|
|
@@ -2720,9 +2880,9 @@ const FixedNav = (props) => {
|
|
|
2720
2880
|
className: "text"
|
|
2721
2881
|
}, visible ? activeText || locale.fixednav.activeText : unActiveText || locale.fixednav.unActiveText))));
|
|
2722
2882
|
};
|
|
2723
|
-
FixedNav.defaultProps = defaultProps
|
|
2883
|
+
FixedNav.defaultProps = defaultProps$16;
|
|
2724
2884
|
FixedNav.displayName = "NutFixedNav";
|
|
2725
|
-
const defaultProps$
|
|
2885
|
+
const defaultProps$15 = {
|
|
2726
2886
|
visible: 0,
|
|
2727
2887
|
bottom: false,
|
|
2728
2888
|
size: 20,
|
|
@@ -2747,7 +2907,7 @@ const Tabbar = (props) => {
|
|
|
2747
2907
|
style,
|
|
2748
2908
|
tabSwitch
|
|
2749
2909
|
} = {
|
|
2750
|
-
...defaultProps$
|
|
2910
|
+
...defaultProps$15,
|
|
2751
2911
|
...props
|
|
2752
2912
|
};
|
|
2753
2913
|
const b2 = cn("tabbar");
|
|
@@ -2782,9 +2942,9 @@ const Tabbar = (props) => {
|
|
|
2782
2942
|
return React__default.cloneElement(child, childProps);
|
|
2783
2943
|
}));
|
|
2784
2944
|
};
|
|
2785
|
-
Tabbar.defaultProps = defaultProps$
|
|
2945
|
+
Tabbar.defaultProps = defaultProps$15;
|
|
2786
2946
|
Tabbar.displayName = "NutTabbar";
|
|
2787
|
-
const defaultProps$
|
|
2947
|
+
const defaultProps$14 = {
|
|
2788
2948
|
dot: false,
|
|
2789
2949
|
size: "",
|
|
2790
2950
|
classPrefix: "nut-icon",
|
|
@@ -2816,7 +2976,7 @@ const TabbarItem = (props) => {
|
|
|
2816
2976
|
index: index2,
|
|
2817
2977
|
handleClick: handleClick2
|
|
2818
2978
|
} = {
|
|
2819
|
-
...defaultProps$
|
|
2979
|
+
...defaultProps$14,
|
|
2820
2980
|
...props
|
|
2821
2981
|
};
|
|
2822
2982
|
const b2 = cn("tabbar-item");
|
|
@@ -2858,7 +3018,7 @@ const TabbarItem = (props) => {
|
|
|
2858
3018
|
}, tabTitle)));
|
|
2859
3019
|
};
|
|
2860
3020
|
const elevatorContext = createContext({});
|
|
2861
|
-
const defaultProps$
|
|
3021
|
+
const defaultProps$13 = {
|
|
2862
3022
|
height: "200px",
|
|
2863
3023
|
acceptKey: "title",
|
|
2864
3024
|
indexList: [],
|
|
@@ -2881,7 +3041,7 @@ const Elevator = (props) => {
|
|
|
2881
3041
|
children,
|
|
2882
3042
|
...rest
|
|
2883
3043
|
} = {
|
|
2884
|
-
...defaultProps$
|
|
3044
|
+
...defaultProps$13,
|
|
2885
3045
|
...props
|
|
2886
3046
|
};
|
|
2887
3047
|
const b2 = cn("elevator");
|
|
@@ -2949,9 +3109,10 @@ const Elevator = (props) => {
|
|
|
2949
3109
|
const firstTouch = e2.touches[0];
|
|
2950
3110
|
touchState.current.y2 = firstTouch.pageY;
|
|
2951
3111
|
const delta = (touchState.current.y2 - touchState.current.y1) / spaceHeight || 0;
|
|
2952
|
-
const cacheIndex = state.current.anchorIndex + delta;
|
|
3112
|
+
const cacheIndex = state.current.anchorIndex + Math.ceil(delta);
|
|
2953
3113
|
setCodeIndex(cacheIndex);
|
|
2954
3114
|
scrollTo(cacheIndex);
|
|
3115
|
+
e2.preventDefault();
|
|
2955
3116
|
};
|
|
2956
3117
|
const touchEnd = () => {
|
|
2957
3118
|
resetScrollState();
|
|
@@ -3024,6 +3185,15 @@ const Elevator = (props) => {
|
|
|
3024
3185
|
return;
|
|
3025
3186
|
state.current.fixedTop = fixedTop;
|
|
3026
3187
|
}, [state.current.diff, titleHeight]);
|
|
3188
|
+
const refIndexBar = useRef(null);
|
|
3189
|
+
useEffect(() => {
|
|
3190
|
+
refIndexBar.current && refIndexBar.current.addEventListener("touchmove", touchMove, {
|
|
3191
|
+
passive: false
|
|
3192
|
+
});
|
|
3193
|
+
return () => {
|
|
3194
|
+
refIndexBar.current && refIndexBar.current.removeEventListener("touchmove", touchMove);
|
|
3195
|
+
};
|
|
3196
|
+
}, []);
|
|
3027
3197
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
3028
3198
|
className: `${b2()} ${className}`,
|
|
3029
3199
|
...rest
|
|
@@ -3057,9 +3227,9 @@ const Elevator = (props) => {
|
|
|
3057
3227
|
}))), indexList.length && scrollStart ? /* @__PURE__ */ React__default.createElement("div", {
|
|
3058
3228
|
className: b2("code--current", { current: true })
|
|
3059
3229
|
}, indexList[codeIndex][acceptKey]) : null, /* @__PURE__ */ React__default.createElement("div", {
|
|
3230
|
+
ref: refIndexBar,
|
|
3060
3231
|
className: b2("bars"),
|
|
3061
|
-
onTouchStart: (event) => touchStart(event)
|
|
3062
|
-
onTouchMove: (event) => touchMove(event)
|
|
3232
|
+
onTouchStart: (event) => touchStart(event)
|
|
3063
3233
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
3064
3234
|
className: b2("bars__inner")
|
|
3065
3235
|
}, indexList.map((item, index2) => {
|
|
@@ -3073,9 +3243,9 @@ const Elevator = (props) => {
|
|
|
3073
3243
|
}, item[acceptKey]);
|
|
3074
3244
|
}))));
|
|
3075
3245
|
};
|
|
3076
|
-
Elevator.defaultProps = defaultProps$
|
|
3246
|
+
Elevator.defaultProps = defaultProps$13;
|
|
3077
3247
|
Elevator.displayName = "NutElevator";
|
|
3078
|
-
const defaultProps$
|
|
3248
|
+
const defaultProps$12 = {
|
|
3079
3249
|
defaultValue: 1,
|
|
3080
3250
|
mode: "multi",
|
|
3081
3251
|
prevText: "",
|
|
@@ -3092,7 +3262,7 @@ const defaultProps$X = {
|
|
|
3092
3262
|
};
|
|
3093
3263
|
const Pagination = (props) => {
|
|
3094
3264
|
const { locale } = useConfig();
|
|
3095
|
-
({ ...defaultProps$
|
|
3265
|
+
({ ...defaultProps$12, ...props });
|
|
3096
3266
|
const {
|
|
3097
3267
|
modelValue,
|
|
3098
3268
|
mode,
|
|
@@ -3209,7 +3379,7 @@ const Pagination = (props) => {
|
|
|
3209
3379
|
onClick: (e2) => selectPage(Number(currentPage) + 1, true)
|
|
3210
3380
|
}, nextText || locale.pagination.next));
|
|
3211
3381
|
};
|
|
3212
|
-
Pagination.defaultProps = defaultProps$
|
|
3382
|
+
Pagination.defaultProps = defaultProps$12;
|
|
3213
3383
|
Pagination.displayName = "NutPagination";
|
|
3214
3384
|
class Title {
|
|
3215
3385
|
constructor() {
|
|
@@ -3219,7 +3389,7 @@ class Title {
|
|
|
3219
3389
|
this.index = 0;
|
|
3220
3390
|
}
|
|
3221
3391
|
}
|
|
3222
|
-
const defaultProps$
|
|
3392
|
+
const defaultProps$11 = {
|
|
3223
3393
|
value: 0,
|
|
3224
3394
|
color: "",
|
|
3225
3395
|
background: "",
|
|
@@ -3254,7 +3424,7 @@ const Tabs = (props) => {
|
|
|
3254
3424
|
className,
|
|
3255
3425
|
autoHeight,
|
|
3256
3426
|
...rest
|
|
3257
|
-
} = { ...defaultProps$
|
|
3427
|
+
} = { ...defaultProps$11, ...props };
|
|
3258
3428
|
const [currentItem, setCurrentItem] = useState({ index: 0 });
|
|
3259
3429
|
const titles = useRef([]);
|
|
3260
3430
|
useEffect(() => {
|
|
@@ -3366,9 +3536,9 @@ const Tabs = (props) => {
|
|
|
3366
3536
|
return React__default.cloneElement(child, childProps);
|
|
3367
3537
|
})));
|
|
3368
3538
|
};
|
|
3369
|
-
Tabs.defaultProps = defaultProps$
|
|
3539
|
+
Tabs.defaultProps = defaultProps$11;
|
|
3370
3540
|
Tabs.displayName = "NutTabs";
|
|
3371
|
-
const defaultProps$
|
|
3541
|
+
const defaultProps$10 = {
|
|
3372
3542
|
title: "",
|
|
3373
3543
|
paneKey: "",
|
|
3374
3544
|
activeKey: "",
|
|
@@ -3376,7 +3546,7 @@ const defaultProps$V = {
|
|
|
3376
3546
|
};
|
|
3377
3547
|
const TabPane = (props) => {
|
|
3378
3548
|
const { children, paneKey, activeKey, autoHeightClassName } = {
|
|
3379
|
-
...defaultProps$
|
|
3549
|
+
...defaultProps$10,
|
|
3380
3550
|
...props
|
|
3381
3551
|
};
|
|
3382
3552
|
const b2 = cn("tabpane");
|
|
@@ -3391,7 +3561,7 @@ const TabPane = (props) => {
|
|
|
3391
3561
|
className: classes
|
|
3392
3562
|
}, children);
|
|
3393
3563
|
};
|
|
3394
|
-
const defaultProps
|
|
3564
|
+
const defaultProps$$ = {
|
|
3395
3565
|
size: 3,
|
|
3396
3566
|
current: 1,
|
|
3397
3567
|
block: false,
|
|
@@ -3411,7 +3581,7 @@ const Indicator = (props) => {
|
|
|
3411
3581
|
vertical,
|
|
3412
3582
|
...rest
|
|
3413
3583
|
} = {
|
|
3414
|
-
...defaultProps
|
|
3584
|
+
...defaultProps$$,
|
|
3415
3585
|
...props
|
|
3416
3586
|
};
|
|
3417
3587
|
const b2 = cn("indicator");
|
|
@@ -3445,7 +3615,7 @@ const Indicator = (props) => {
|
|
|
3445
3615
|
...rest
|
|
3446
3616
|
}, renderEles());
|
|
3447
3617
|
};
|
|
3448
|
-
Indicator.defaultProps = defaultProps
|
|
3618
|
+
Indicator.defaultProps = defaultProps$$;
|
|
3449
3619
|
Indicator.displayName = "NutIndicator";
|
|
3450
3620
|
const handleClick = (e2) => {
|
|
3451
3621
|
e2.stopPropagation();
|
|
@@ -3461,7 +3631,7 @@ const handleClick = (e2) => {
|
|
|
3461
3631
|
}
|
|
3462
3632
|
};
|
|
3463
3633
|
const OffsetContext = createContext(20);
|
|
3464
|
-
const defaultProps$
|
|
3634
|
+
const defaultProps$_ = {
|
|
3465
3635
|
showhead: false,
|
|
3466
3636
|
position: "left",
|
|
3467
3637
|
width: "80%"
|
|
@@ -3479,7 +3649,7 @@ const SideNavBar = (props) => {
|
|
|
3479
3649
|
handleClose,
|
|
3480
3650
|
...rest
|
|
3481
3651
|
} = {
|
|
3482
|
-
...defaultProps$
|
|
3652
|
+
...defaultProps$_,
|
|
3483
3653
|
...props
|
|
3484
3654
|
};
|
|
3485
3655
|
const offset = props.offset ? Number(props.offset) : 20;
|
|
@@ -3507,14 +3677,14 @@ const SideNavBar = (props) => {
|
|
|
3507
3677
|
className: "nut-sidenavbar__content"
|
|
3508
3678
|
}, children))))));
|
|
3509
3679
|
};
|
|
3510
|
-
SideNavBar.defaultProps = defaultProps$
|
|
3680
|
+
SideNavBar.defaultProps = defaultProps$_;
|
|
3511
3681
|
SideNavBar.displayName = "NutSideNavBar";
|
|
3512
|
-
const defaultProps$
|
|
3682
|
+
const defaultProps$Z = {
|
|
3513
3683
|
open: true
|
|
3514
3684
|
};
|
|
3515
3685
|
const SubSideNavBar = (props) => {
|
|
3516
3686
|
const { title, ikey, children, titleClick, open, ...rest } = {
|
|
3517
|
-
...defaultProps$
|
|
3687
|
+
...defaultProps$Z,
|
|
3518
3688
|
...props
|
|
3519
3689
|
};
|
|
3520
3690
|
const offset = useContext$1(OffsetContext);
|
|
@@ -3585,6 +3755,274 @@ const SideNavBarItem = (props) => {
|
|
|
3585
3755
|
...rest
|
|
3586
3756
|
}, title);
|
|
3587
3757
|
};
|
|
3758
|
+
const defaultProps$Y = {
|
|
3759
|
+
className: "",
|
|
3760
|
+
style: {},
|
|
3761
|
+
activeColor: "#F2270C",
|
|
3762
|
+
closeOnClickOverlay: true,
|
|
3763
|
+
scrollFixed: false,
|
|
3764
|
+
lockScroll: true,
|
|
3765
|
+
titleIcon: ""
|
|
3766
|
+
};
|
|
3767
|
+
const Menu = (props) => {
|
|
3768
|
+
const {
|
|
3769
|
+
className,
|
|
3770
|
+
titleIcon,
|
|
3771
|
+
scrollFixed,
|
|
3772
|
+
lockScroll,
|
|
3773
|
+
closeOnClickOverlay,
|
|
3774
|
+
children,
|
|
3775
|
+
activeColor,
|
|
3776
|
+
...rest
|
|
3777
|
+
} = {
|
|
3778
|
+
...defaultProps$Y,
|
|
3779
|
+
...props
|
|
3780
|
+
};
|
|
3781
|
+
const parentRef = useRef(null);
|
|
3782
|
+
const onScroll = () => {
|
|
3783
|
+
};
|
|
3784
|
+
useEffect(() => {
|
|
3785
|
+
if (scrollFixed) {
|
|
3786
|
+
window.addEventListener("scroll", onScroll);
|
|
3787
|
+
}
|
|
3788
|
+
return () => window.removeEventListener("scroll", onScroll);
|
|
3789
|
+
}, []);
|
|
3790
|
+
const [itemShow, setItemShow] = useState([]);
|
|
3791
|
+
const [itemTitle, setItemTitle] = useState([]);
|
|
3792
|
+
const toggleItemShow = (index2) => {
|
|
3793
|
+
itemShow[index2] = !itemShow[index2];
|
|
3794
|
+
const temp = itemShow.map((i, idx) => idx === index2 ? i : false);
|
|
3795
|
+
setItemShow([...temp]);
|
|
3796
|
+
};
|
|
3797
|
+
const hideItemShow = (index2) => {
|
|
3798
|
+
itemShow[index2] = false;
|
|
3799
|
+
setItemShow([...itemShow]);
|
|
3800
|
+
};
|
|
3801
|
+
const updateTitle = (text, index2) => {
|
|
3802
|
+
itemTitle[index2] = text;
|
|
3803
|
+
setItemTitle([...itemTitle]);
|
|
3804
|
+
};
|
|
3805
|
+
const parent = () => {
|
|
3806
|
+
return parentRef;
|
|
3807
|
+
};
|
|
3808
|
+
const cloneChildren = () => {
|
|
3809
|
+
return React__default.Children.map(children, (child, index2) => {
|
|
3810
|
+
return React__default.cloneElement(child, {
|
|
3811
|
+
showPopup: itemShow[index2],
|
|
3812
|
+
orderKey: index2,
|
|
3813
|
+
activeColor,
|
|
3814
|
+
parent: {
|
|
3815
|
+
closeOnClickOverlay,
|
|
3816
|
+
lockScroll,
|
|
3817
|
+
toggleItemShow,
|
|
3818
|
+
updateTitle,
|
|
3819
|
+
hideItemShow,
|
|
3820
|
+
parent
|
|
3821
|
+
}
|
|
3822
|
+
});
|
|
3823
|
+
});
|
|
3824
|
+
};
|
|
3825
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
3826
|
+
className: `nut-menu ${className}`,
|
|
3827
|
+
...rest,
|
|
3828
|
+
ref: parentRef
|
|
3829
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
3830
|
+
className: `nut-menu__bar ${itemShow.includes(true) ? "opened" : ""} ${className}`
|
|
3831
|
+
}, React__default.Children.toArray(children).map((child, index2) => {
|
|
3832
|
+
if (!child)
|
|
3833
|
+
return null;
|
|
3834
|
+
const { disabled, title, value, direction, options: options2 } = child.props;
|
|
3835
|
+
const currentTitle = options2 == null ? void 0 : options2.filter(
|
|
3836
|
+
(option) => option.value === value
|
|
3837
|
+
);
|
|
3838
|
+
function finallyTitle() {
|
|
3839
|
+
if (title)
|
|
3840
|
+
return title;
|
|
3841
|
+
if (itemTitle && itemTitle[index2])
|
|
3842
|
+
return itemTitle[index2];
|
|
3843
|
+
if (currentTitle && currentTitle[0] && currentTitle[0].text)
|
|
3844
|
+
return currentTitle[0].text;
|
|
3845
|
+
return "";
|
|
3846
|
+
}
|
|
3847
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
3848
|
+
className: `nut-menu__item ${classNames({
|
|
3849
|
+
active: itemShow[index2],
|
|
3850
|
+
disabled
|
|
3851
|
+
})}`,
|
|
3852
|
+
style: { color: itemShow[index2] ? activeColor : "" },
|
|
3853
|
+
key: index2,
|
|
3854
|
+
onClick: () => {
|
|
3855
|
+
!disabled && toggleItemShow(index2);
|
|
3856
|
+
}
|
|
3857
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
3858
|
+
className: `nut-menu__title ${classNames({
|
|
3859
|
+
active: itemShow[index2],
|
|
3860
|
+
disabled
|
|
3861
|
+
})}`
|
|
3862
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
3863
|
+
className: "nut-menu__title-text"
|
|
3864
|
+
}, finallyTitle()), /* @__PURE__ */ React__default.createElement(Icon, {
|
|
3865
|
+
className: "nut-menu__title-icon",
|
|
3866
|
+
size: "10",
|
|
3867
|
+
name: titleIcon || (direction === "up" ? "arrow-up" : "down-arrow")
|
|
3868
|
+
})));
|
|
3869
|
+
})), cloneChildren());
|
|
3870
|
+
};
|
|
3871
|
+
Menu.defaultProps = defaultProps$Y;
|
|
3872
|
+
Menu.displayName = "NutMenu";
|
|
3873
|
+
const defaultProps$X = {
|
|
3874
|
+
className: "",
|
|
3875
|
+
style: {},
|
|
3876
|
+
columns: 1,
|
|
3877
|
+
direction: "down",
|
|
3878
|
+
optionsIcon: "Check",
|
|
3879
|
+
activeTitleClass: "",
|
|
3880
|
+
inactiveTitleClass: "",
|
|
3881
|
+
iconClassPrefix: "nut-icon",
|
|
3882
|
+
fontClassName: "nutui-iconfont",
|
|
3883
|
+
onChange: (value) => void 0
|
|
3884
|
+
};
|
|
3885
|
+
const MenuItem = (props) => {
|
|
3886
|
+
useConfig();
|
|
3887
|
+
const mergedProps = { ...defaultProps$X, ...props };
|
|
3888
|
+
const {
|
|
3889
|
+
className,
|
|
3890
|
+
style,
|
|
3891
|
+
options: options2,
|
|
3892
|
+
value,
|
|
3893
|
+
columns,
|
|
3894
|
+
title,
|
|
3895
|
+
iconClassPrefix,
|
|
3896
|
+
fontClassName,
|
|
3897
|
+
optionsIcon,
|
|
3898
|
+
direction,
|
|
3899
|
+
onChange,
|
|
3900
|
+
activeTitleClass,
|
|
3901
|
+
inactiveTitleClass,
|
|
3902
|
+
children
|
|
3903
|
+
} = {
|
|
3904
|
+
...defaultProps$X,
|
|
3905
|
+
...props
|
|
3906
|
+
};
|
|
3907
|
+
const { activeColor, showPopup, parent, orderKey } = mergedProps;
|
|
3908
|
+
const [_showPopup, setShowPopup] = useState(showPopup);
|
|
3909
|
+
const [_value, setValue] = useState(value);
|
|
3910
|
+
useEffect(() => {
|
|
3911
|
+
setShowPopup(showPopup);
|
|
3912
|
+
}, [showPopup]);
|
|
3913
|
+
useEffect(() => {
|
|
3914
|
+
getParentOffset();
|
|
3915
|
+
}, [_showPopup]);
|
|
3916
|
+
const getIconCName = (optionVal, value2) => {
|
|
3917
|
+
return classNames({
|
|
3918
|
+
[activeTitleClass]: optionVal === value2,
|
|
3919
|
+
[inactiveTitleClass]: optionVal !== value2
|
|
3920
|
+
});
|
|
3921
|
+
};
|
|
3922
|
+
const setTitle = (text) => {
|
|
3923
|
+
if (!title) {
|
|
3924
|
+
parent.updateTitle(text, orderKey);
|
|
3925
|
+
}
|
|
3926
|
+
};
|
|
3927
|
+
const handleClick2 = (item) => {
|
|
3928
|
+
parent.toggleItemShow(orderKey);
|
|
3929
|
+
setTitle(item.text);
|
|
3930
|
+
setValue(item.value);
|
|
3931
|
+
onChange && onChange(item);
|
|
3932
|
+
};
|
|
3933
|
+
const [position, setPosition] = useState({
|
|
3934
|
+
top: 0,
|
|
3935
|
+
height: 0
|
|
3936
|
+
});
|
|
3937
|
+
const getParentOffset = () => {
|
|
3938
|
+
setTimeout(() => {
|
|
3939
|
+
const p2 = parent.parent().current;
|
|
3940
|
+
const rect = p2.getBoundingClientRect();
|
|
3941
|
+
console.log(rect, p2.offsetTop, window.screenTop);
|
|
3942
|
+
setPosition({
|
|
3943
|
+
height: rect.height,
|
|
3944
|
+
top: rect.top
|
|
3945
|
+
});
|
|
3946
|
+
});
|
|
3947
|
+
};
|
|
3948
|
+
const isShow = () => {
|
|
3949
|
+
if (_showPopup)
|
|
3950
|
+
return {};
|
|
3951
|
+
return { display: "none" };
|
|
3952
|
+
};
|
|
3953
|
+
const getPosition = () => {
|
|
3954
|
+
return direction === "down" ? { top: `${position.top + position.height}px` } : { bottom: `${window.innerHeight - position.top}px`, top: "auto" };
|
|
3955
|
+
};
|
|
3956
|
+
const placeholderStyle = () => {
|
|
3957
|
+
if (direction === "down") {
|
|
3958
|
+
return {
|
|
3959
|
+
height: `${position.top + position.height}px`,
|
|
3960
|
+
...isShow(),
|
|
3961
|
+
...style
|
|
3962
|
+
};
|
|
3963
|
+
}
|
|
3964
|
+
return {
|
|
3965
|
+
height: `${window.innerHeight - position.top}px`,
|
|
3966
|
+
top: "auto",
|
|
3967
|
+
...isShow(),
|
|
3968
|
+
...style
|
|
3969
|
+
};
|
|
3970
|
+
};
|
|
3971
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", {
|
|
3972
|
+
className: `placeholder-element ${classNames({
|
|
3973
|
+
up: direction === "up"
|
|
3974
|
+
})} ${className}`,
|
|
3975
|
+
style: placeholderStyle(),
|
|
3976
|
+
onClick: () => parent.toggleItemShow(orderKey)
|
|
3977
|
+
}), /* @__PURE__ */ React__default.createElement(Overlay, {
|
|
3978
|
+
overlayClass: "nut-menu__overlay",
|
|
3979
|
+
style: getPosition(),
|
|
3980
|
+
lockScroll: parent.lockScroll,
|
|
3981
|
+
visible: _showPopup,
|
|
3982
|
+
closeOnClickOverlay: parent.closeOnClickOverlay,
|
|
3983
|
+
onClick: () => {
|
|
3984
|
+
parent.closeOnClickOverlay && parent.toggleItemShow(orderKey);
|
|
3985
|
+
}
|
|
3986
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
|
3987
|
+
className: "nut-menu-item__wrap",
|
|
3988
|
+
style: {
|
|
3989
|
+
...getPosition(),
|
|
3990
|
+
...isShow()
|
|
3991
|
+
}
|
|
3992
|
+
}, /* @__PURE__ */ React__default.createElement(CSSTransition$1, {
|
|
3993
|
+
in: _showPopup,
|
|
3994
|
+
timeout: 100,
|
|
3995
|
+
classNames: "menu-item"
|
|
3996
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
3997
|
+
className: "nut-menu-item__content"
|
|
3998
|
+
}, options2 == null ? void 0 : options2.map((item, index2) => {
|
|
3999
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
4000
|
+
className: `nut-menu-item__option ${classNames({
|
|
4001
|
+
active: item.value === _value
|
|
4002
|
+
})}`,
|
|
4003
|
+
key: item.text,
|
|
4004
|
+
style: {
|
|
4005
|
+
flexBasis: `${100 / columns}%`
|
|
4006
|
+
},
|
|
4007
|
+
onClick: () => {
|
|
4008
|
+
handleClick2(item);
|
|
4009
|
+
}
|
|
4010
|
+
}, item.value === _value ? /* @__PURE__ */ React__default.createElement(Icon, {
|
|
4011
|
+
className: getIconCName(item.value, value),
|
|
4012
|
+
name: optionsIcon,
|
|
4013
|
+
classPrefix: iconClassPrefix,
|
|
4014
|
+
fontClassName,
|
|
4015
|
+
color: activeColor
|
|
4016
|
+
}) : null, /* @__PURE__ */ React__default.createElement("div", {
|
|
4017
|
+
className: getIconCName(item.value, value),
|
|
4018
|
+
style: {
|
|
4019
|
+
color: `${item.value === _value ? activeColor : ""}`
|
|
4020
|
+
}
|
|
4021
|
+
}, item.text));
|
|
4022
|
+
}), children))));
|
|
4023
|
+
};
|
|
4024
|
+
MenuItem.defaultProps = defaultProps$X;
|
|
4025
|
+
MenuItem.displayName = "NutMenuItem";
|
|
3588
4026
|
const MIN_DISTANCE = 10;
|
|
3589
4027
|
function getDirection(x2, y2) {
|
|
3590
4028
|
if (x2 > y2 && x2 > MIN_DISTANCE) {
|
|
@@ -3679,6 +4117,29 @@ const getRect = (elementRef) => {
|
|
|
3679
4117
|
height: 0
|
|
3680
4118
|
};
|
|
3681
4119
|
};
|
|
4120
|
+
let createRoot;
|
|
4121
|
+
try {
|
|
4122
|
+
const mainVersion = Number((ReactDOM.version || "").split(".")[0]);
|
|
4123
|
+
if (mainVersion >= 18 && ReactDOM.createRoot) {
|
|
4124
|
+
createRoot = ReactDOM.createRoot;
|
|
4125
|
+
}
|
|
4126
|
+
} catch (e2) {
|
|
4127
|
+
console.log(e2);
|
|
4128
|
+
}
|
|
4129
|
+
function legacyRender(node, container) {
|
|
4130
|
+
ReactDOM.render(node, container);
|
|
4131
|
+
}
|
|
4132
|
+
function concurrentRender(node, container) {
|
|
4133
|
+
const root = ReactDOM.createRoot(container);
|
|
4134
|
+
root.render(node);
|
|
4135
|
+
}
|
|
4136
|
+
function render(node, container) {
|
|
4137
|
+
if (createRoot) {
|
|
4138
|
+
concurrentRender(node, container);
|
|
4139
|
+
return;
|
|
4140
|
+
}
|
|
4141
|
+
legacyRender(node, container);
|
|
4142
|
+
}
|
|
3682
4143
|
class Notification$1 extends React.PureComponent {
|
|
3683
4144
|
constructor(props) {
|
|
3684
4145
|
super(props);
|
|
@@ -3795,7 +4256,7 @@ Notification$1.newInstance = (properties, callback) => {
|
|
|
3795
4256
|
}
|
|
3796
4257
|
});
|
|
3797
4258
|
}
|
|
3798
|
-
|
|
4259
|
+
render(/* @__PURE__ */ React.createElement(Notification$1, {
|
|
3799
4260
|
...properties,
|
|
3800
4261
|
ref
|
|
3801
4262
|
}), element);
|
|
@@ -3881,7 +4342,7 @@ var Toast = {
|
|
|
3881
4342
|
}
|
|
3882
4343
|
}
|
|
3883
4344
|
};
|
|
3884
|
-
const defaultProps$
|
|
4345
|
+
const defaultProps$W = {
|
|
3885
4346
|
range: false,
|
|
3886
4347
|
hiddenRange: false,
|
|
3887
4348
|
hiddenTag: false,
|
|
@@ -3912,8 +4373,8 @@ const Range = (props) => {
|
|
|
3912
4373
|
change,
|
|
3913
4374
|
dragStart,
|
|
3914
4375
|
dragEnd
|
|
3915
|
-
} = { ...defaultProps$
|
|
3916
|
-
let { min, max, step } = { ...defaultProps$
|
|
4376
|
+
} = { ...defaultProps$W, ...props };
|
|
4377
|
+
let { min, max, step } = { ...defaultProps$W, ...props };
|
|
3917
4378
|
min = Number(min);
|
|
3918
4379
|
max = Number(max);
|
|
3919
4380
|
step = Number(step);
|
|
@@ -4186,7 +4647,7 @@ const Range = (props) => {
|
|
|
4186
4647
|
role: "slider",
|
|
4187
4648
|
key: index2,
|
|
4188
4649
|
className: `${index2 === 0 ? "nut-range-button-wrapper-left" : ""}
|
|
4189
|
-
|
|
4650
|
+
${index2 === 1 ? "nut-range-button-wrapper-right" : ""}`,
|
|
4190
4651
|
tabIndex: disabled ? -1 : 0,
|
|
4191
4652
|
"aria-valuemin": +min,
|
|
4192
4653
|
"aria-valuenow": curValue(index2),
|
|
@@ -4248,7 +4709,7 @@ const Range = (props) => {
|
|
|
4248
4709
|
className: "max"
|
|
4249
4710
|
}, +max) : null);
|
|
4250
4711
|
};
|
|
4251
|
-
Range.defaultProps = defaultProps$
|
|
4712
|
+
Range.defaultProps = defaultProps$W;
|
|
4252
4713
|
Range.displayName = "NutRange";
|
|
4253
4714
|
const Utils = {
|
|
4254
4715
|
isLeapYear(y2) {
|
|
@@ -4342,7 +4803,7 @@ function requestAniFrame() {
|
|
|
4342
4803
|
};
|
|
4343
4804
|
}
|
|
4344
4805
|
var requestAniFrame$1 = requestAniFrame();
|
|
4345
|
-
const defaultProps$
|
|
4806
|
+
const defaultProps$V = {
|
|
4346
4807
|
type: "one",
|
|
4347
4808
|
isAutoBackFill: false,
|
|
4348
4809
|
poppable: true,
|
|
@@ -4351,14 +4812,25 @@ const defaultProps$Q = {
|
|
|
4351
4812
|
defaultValue: "",
|
|
4352
4813
|
startDate: Utils.getDay(0),
|
|
4353
4814
|
endDate: Utils.getDay(365),
|
|
4815
|
+
showToday: true,
|
|
4816
|
+
startText: "\u5F00\u59CB",
|
|
4817
|
+
endText: "\u7ED3\u675F",
|
|
4818
|
+
confirmText: "\u786E\u8BA4",
|
|
4819
|
+
showTitle: true,
|
|
4820
|
+
showSubTitle: true,
|
|
4821
|
+
toDateAnimation: true,
|
|
4822
|
+
onBtn: void 0,
|
|
4823
|
+
onDay: void 0,
|
|
4824
|
+
onTopInfo: void 0,
|
|
4825
|
+
onBottomInfo: void 0,
|
|
4354
4826
|
onChoose: (data) => {
|
|
4355
4827
|
},
|
|
4356
4828
|
onUpdate: () => {
|
|
4357
4829
|
},
|
|
4358
|
-
|
|
4830
|
+
onSelected: (data) => {
|
|
4359
4831
|
}
|
|
4360
4832
|
};
|
|
4361
|
-
const CalendarItem = (props) => {
|
|
4833
|
+
const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
4362
4834
|
const { locale } = useConfig();
|
|
4363
4835
|
const {
|
|
4364
4836
|
type,
|
|
@@ -4366,18 +4838,31 @@ const CalendarItem = (props) => {
|
|
|
4366
4838
|
poppable,
|
|
4367
4839
|
title,
|
|
4368
4840
|
defaultValue,
|
|
4369
|
-
|
|
4370
|
-
|
|
4841
|
+
showToday,
|
|
4842
|
+
startText,
|
|
4843
|
+
endText,
|
|
4844
|
+
confirmText,
|
|
4845
|
+
showTitle,
|
|
4846
|
+
showSubTitle,
|
|
4847
|
+
toDateAnimation,
|
|
4848
|
+
onBtn,
|
|
4849
|
+
onDay,
|
|
4850
|
+
onTopInfo,
|
|
4851
|
+
onBottomInfo,
|
|
4371
4852
|
onChoose,
|
|
4372
4853
|
onUpdate,
|
|
4373
|
-
|
|
4374
|
-
} = { ...defaultProps$
|
|
4854
|
+
onSelected
|
|
4855
|
+
} = { ...defaultProps$V, ...props };
|
|
4375
4856
|
const weeks = locale.calendaritem.weekdays;
|
|
4376
4857
|
const [yearMonthTitle, setYearMonthTitle] = useState("");
|
|
4377
|
-
const [unLoadPrev, setUnLoadPrev] = useState(false);
|
|
4378
4858
|
const [monthsData, setMonthsData] = useState([]);
|
|
4859
|
+
const [translateY, setTranslateY] = useState(0);
|
|
4860
|
+
const [monthDefaultRange, setMonthDefaultRange] = useState([]);
|
|
4379
4861
|
const [state] = useState({
|
|
4380
4862
|
currDate: "",
|
|
4863
|
+
propStartDate: "",
|
|
4864
|
+
propEndDate: "",
|
|
4865
|
+
unLoadPrev: false,
|
|
4381
4866
|
touchParams: {
|
|
4382
4867
|
startY: 0,
|
|
4383
4868
|
endY: 0,
|
|
@@ -4387,7 +4872,6 @@ const CalendarItem = (props) => {
|
|
|
4387
4872
|
lastTime: 0
|
|
4388
4873
|
},
|
|
4389
4874
|
transformY: 0,
|
|
4390
|
-
translateY: 0,
|
|
4391
4875
|
scrollDistance: 0,
|
|
4392
4876
|
defaultData: [],
|
|
4393
4877
|
chooseData: [],
|
|
@@ -4395,12 +4879,17 @@ const CalendarItem = (props) => {
|
|
|
4395
4879
|
dayPrefix: "calendar-month-day",
|
|
4396
4880
|
startData: "",
|
|
4397
4881
|
endData: "",
|
|
4398
|
-
isRange: type === "range",
|
|
4399
|
-
timer: 0
|
|
4882
|
+
isRange: props.type === "range",
|
|
4883
|
+
timer: 0,
|
|
4884
|
+
currentIndex: 0,
|
|
4885
|
+
avgHeight: 0,
|
|
4886
|
+
monthsNum: 0
|
|
4400
4887
|
});
|
|
4401
4888
|
const weeksPanel = useRef(null);
|
|
4402
4889
|
const months = useRef(null);
|
|
4403
4890
|
const monthsPanel = useRef(null);
|
|
4891
|
+
const viewArea = useRef(null);
|
|
4892
|
+
let viewHeight = 0;
|
|
4404
4893
|
const b2 = cn("calendar");
|
|
4405
4894
|
const classes = classNames(
|
|
4406
4895
|
{
|
|
@@ -4426,23 +4915,29 @@ const CalendarItem = (props) => {
|
|
|
4426
4915
|
const isEnd = (currDate) => {
|
|
4427
4916
|
return Utils.isEqual(state.currDate[1], currDate);
|
|
4428
4917
|
};
|
|
4429
|
-
const
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4918
|
+
const isMultiple = (currDate) => {
|
|
4919
|
+
if (state.currDate.length > 0) {
|
|
4920
|
+
return state.currDate.some((item) => {
|
|
4921
|
+
return Utils.isEqual(item, currDate);
|
|
4922
|
+
});
|
|
4923
|
+
}
|
|
4924
|
+
return false;
|
|
4925
|
+
};
|
|
4926
|
+
const getCurrDate = (day, month) => {
|
|
4927
|
+
return `${month.curData[0]}-${month.curData[1]}-${Utils.getNumTwoBit(
|
|
4433
4928
|
+day.day
|
|
4434
4929
|
)}`;
|
|
4435
4930
|
};
|
|
4436
|
-
const getClass = (day, month
|
|
4437
|
-
const currDate = getCurrDate(day, month
|
|
4931
|
+
const getClass = (day, month) => {
|
|
4932
|
+
const currDate = getCurrDate(day, month);
|
|
4438
4933
|
if (day.type === "curr") {
|
|
4439
|
-
if (
|
|
4934
|
+
if (Utils.isEqual(state.currDate, currDate) || type === "range" && (isStart(currDate) || isEnd(currDate)) || type === "multiple" && isMultiple(currDate)) {
|
|
4440
4935
|
return `${state.dayPrefix}-active`;
|
|
4441
4936
|
}
|
|
4442
|
-
if (
|
|
4937
|
+
if (state.propStartDate && Utils.compareDate(currDate, state.propStartDate) || state.propEndDate && Utils.compareDate(state.propEndDate, currDate)) {
|
|
4443
4938
|
return `${state.dayPrefix}-disabled`;
|
|
4444
4939
|
}
|
|
4445
|
-
if (
|
|
4940
|
+
if (type === "range" && Array.isArray(state.currDate) && Object.values(state.currDate).length === 2 && Utils.compareDate(state.currDate[0], currDate) && Utils.compareDate(currDate, state.currDate[1])) {
|
|
4446
4941
|
return `${state.dayPrefix}-choose`;
|
|
4447
4942
|
}
|
|
4448
4943
|
return null;
|
|
@@ -4457,56 +4952,86 @@ const CalendarItem = (props) => {
|
|
|
4457
4952
|
return Utils.isEqual(date, Utils.date2Str(new Date()));
|
|
4458
4953
|
};
|
|
4459
4954
|
const confirm2 = () => {
|
|
4460
|
-
|
|
4461
|
-
|
|
4955
|
+
const { type: type2 } = props;
|
|
4956
|
+
if (type2 === "range" && state.chooseData.length === 2 || type2 !== "range") {
|
|
4957
|
+
const chooseData = state.chooseData.slice(0);
|
|
4958
|
+
onChoose && onChoose(chooseData);
|
|
4462
4959
|
if (poppable) {
|
|
4463
4960
|
onUpdate && onUpdate();
|
|
4464
4961
|
}
|
|
4465
4962
|
}
|
|
4466
4963
|
};
|
|
4467
|
-
const chooseDay = (day, month, isFirst
|
|
4468
|
-
if (getClass(day, month
|
|
4469
|
-
|
|
4470
|
-
days =
|
|
4964
|
+
const chooseDay = (day, month, isFirst) => {
|
|
4965
|
+
if (getClass(day, month) !== `${state.dayPrefix}-disabled`) {
|
|
4966
|
+
const { type: type2 } = props;
|
|
4967
|
+
const days = [...month.curData];
|
|
4471
4968
|
days[2] = typeof day.day === "number" ? Utils.getNumTwoBit(day.day) : day.day;
|
|
4472
4969
|
days[3] = `${days[0]}-${days[1]}-${days[2]}`;
|
|
4473
4970
|
days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
|
|
4474
|
-
if (
|
|
4475
|
-
state.currDate
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4971
|
+
if (type2 === "multiple") {
|
|
4972
|
+
if (state.currDate.length > 0) {
|
|
4973
|
+
let hasIndex = "";
|
|
4974
|
+
state.currDate.forEach((item, index2) => {
|
|
4975
|
+
if (item === days[3]) {
|
|
4976
|
+
hasIndex = index2;
|
|
4977
|
+
}
|
|
4978
|
+
});
|
|
4979
|
+
if (isFirst) {
|
|
4980
|
+
state.chooseData.push([...days]);
|
|
4981
|
+
} else if (hasIndex !== "") {
|
|
4982
|
+
state.currDate.splice(hasIndex, 1);
|
|
4983
|
+
state.chooseData.splice(hasIndex, 1);
|
|
4984
|
+
} else {
|
|
4985
|
+
state.currDate.push(days[3]);
|
|
4986
|
+
state.chooseData.push([...days]);
|
|
4987
|
+
}
|
|
4988
|
+
} else {
|
|
4989
|
+
state.currDate = [days[3]];
|
|
4990
|
+
state.chooseData = [[...days]];
|
|
4991
|
+
}
|
|
4992
|
+
} else if (type2 === "range") {
|
|
4993
|
+
const curDataLength = Object.values(state.currDate).length;
|
|
4994
|
+
if (curDataLength === 2 || curDataLength === 0) {
|
|
4995
|
+
state.currDate = [days[3]];
|
|
4996
|
+
} else if (Utils.compareDate(state.currDate[0], days[3])) {
|
|
4997
|
+
Array.isArray(state.currDate) && state.currDate.push(days[3]);
|
|
4482
4998
|
} else {
|
|
4483
4999
|
Array.isArray(state.currDate) && state.currDate.unshift(days[3]);
|
|
4484
5000
|
}
|
|
4485
5001
|
if (state.chooseData.length === 2 || !state.chooseData.length) {
|
|
4486
|
-
state.chooseData = [...days];
|
|
4487
|
-
} else if (Utils.compareDate(state.chooseData[3], days[3])) {
|
|
4488
|
-
state.chooseData = [
|
|
5002
|
+
state.chooseData = [[...days]];
|
|
5003
|
+
} else if (Utils.compareDate(state.chooseData[0][3], days[3])) {
|
|
5004
|
+
state.chooseData = [...state.chooseData, [...days]];
|
|
4489
5005
|
} else {
|
|
4490
|
-
state.chooseData = [[...days],
|
|
5006
|
+
state.chooseData = [[...days], ...state.chooseData];
|
|
4491
5007
|
}
|
|
5008
|
+
} else {
|
|
5009
|
+
state.currDate = days[3];
|
|
5010
|
+
state.chooseData = [...days];
|
|
4492
5011
|
}
|
|
4493
|
-
if (
|
|
4494
|
-
|
|
5012
|
+
if (!isFirst) {
|
|
5013
|
+
onSelected && onSelected(state.chooseData);
|
|
5014
|
+
if (isAutoBackFill || !poppable) {
|
|
5015
|
+
confirm2();
|
|
5016
|
+
}
|
|
4495
5017
|
}
|
|
4496
5018
|
setMonthsData(state.monthsData.slice());
|
|
4497
5019
|
}
|
|
4498
5020
|
};
|
|
4499
5021
|
const isStartTip = (day, month) => {
|
|
4500
|
-
|
|
4501
|
-
|
|
5022
|
+
return isActive(day, month) && isStart(getCurrDate(day, month));
|
|
5023
|
+
};
|
|
5024
|
+
const isEndTip = (day, month) => {
|
|
5025
|
+
if (state.currDate.length >= 2 && isEnd(getCurrDate(day, month))) {
|
|
5026
|
+
return isActive(day, month);
|
|
4502
5027
|
}
|
|
4503
5028
|
return false;
|
|
4504
5029
|
};
|
|
4505
|
-
const
|
|
4506
|
-
if (
|
|
4507
|
-
return
|
|
5030
|
+
const rangeTip = () => {
|
|
5031
|
+
if (state.currDate.length >= 2) {
|
|
5032
|
+
return Utils.isEqual(state.currDate[0], state.currDate[1]);
|
|
4508
5033
|
}
|
|
4509
|
-
return
|
|
5034
|
+
return false;
|
|
4510
5035
|
};
|
|
4511
5036
|
const getCurrData = (type2) => {
|
|
4512
5037
|
const monthData = type2 === "prev" ? state.monthsData[0] : state.monthsData[state.monthsData.length - 1];
|
|
@@ -4528,20 +5053,45 @@ const CalendarItem = (props) => {
|
|
|
4528
5053
|
Utils.getMonthDays(String(year), String(month))
|
|
4529
5054
|
];
|
|
4530
5055
|
};
|
|
4531
|
-
const getDaysStatus = (days, type2) => {
|
|
5056
|
+
const getDaysStatus = (days, type2, dateInfo) => {
|
|
5057
|
+
const { year, month } = dateInfo;
|
|
4532
5058
|
if (type2 === "prev" && days >= 7) {
|
|
4533
5059
|
days -= 7;
|
|
4534
5060
|
}
|
|
4535
5061
|
return Array.from(Array(days), (v2, k2) => {
|
|
4536
5062
|
return {
|
|
4537
5063
|
day: k2 + 1,
|
|
4538
|
-
type: type2
|
|
5064
|
+
type: type2,
|
|
5065
|
+
year,
|
|
5066
|
+
month
|
|
4539
5067
|
};
|
|
4540
5068
|
});
|
|
4541
5069
|
};
|
|
5070
|
+
const getPreDaysStatus = (days, type2, dateInfo, preCurrMonthDays) => {
|
|
5071
|
+
const { year, month } = dateInfo;
|
|
5072
|
+
if (type2 === "prev" && days >= 7) {
|
|
5073
|
+
days -= 7;
|
|
5074
|
+
}
|
|
5075
|
+
const months2 = Array.from(Array(preCurrMonthDays), (v2, k2) => {
|
|
5076
|
+
return {
|
|
5077
|
+
day: k2 + 1,
|
|
5078
|
+
type: type2,
|
|
5079
|
+
year,
|
|
5080
|
+
month
|
|
5081
|
+
};
|
|
5082
|
+
});
|
|
5083
|
+
return months2.slice(preCurrMonthDays - days);
|
|
5084
|
+
};
|
|
4542
5085
|
const getMonth = (curData, type2) => {
|
|
4543
5086
|
const preMonthDays = Utils.getMonthPreDay(+curData[0], +curData[1]);
|
|
5087
|
+
let preMonth = +curData[1] - 1;
|
|
5088
|
+
let preYear = curData[0];
|
|
5089
|
+
if (preMonth <= 0) {
|
|
5090
|
+
preMonth = 12;
|
|
5091
|
+
preYear += 1;
|
|
5092
|
+
}
|
|
4544
5093
|
const currMonthDays = Utils.getMonthDays(curData[0], curData[1]);
|
|
5094
|
+
const preCurrMonthDays = Utils.getMonthDays(`${preYear}`, `${preMonth}`);
|
|
4545
5095
|
const title2 = {
|
|
4546
5096
|
year: curData[0],
|
|
4547
5097
|
month: curData[1]
|
|
@@ -4550,10 +5100,21 @@ const CalendarItem = (props) => {
|
|
|
4550
5100
|
curData,
|
|
4551
5101
|
title: locale.calendaritem.monthTitle(title2.year, title2.month),
|
|
4552
5102
|
monthData: [
|
|
4553
|
-
...
|
|
4554
|
-
|
|
5103
|
+
...getPreDaysStatus(
|
|
5104
|
+
preMonthDays,
|
|
5105
|
+
"prev",
|
|
5106
|
+
{ month: preMonth, year: preYear },
|
|
5107
|
+
preCurrMonthDays
|
|
5108
|
+
),
|
|
5109
|
+
...getDaysStatus(currMonthDays, "curr", title2)
|
|
4555
5110
|
]
|
|
4556
5111
|
};
|
|
5112
|
+
monthInfo.cssHeight = 39 + (monthInfo.monthData.length > 35 ? 384 : 320);
|
|
5113
|
+
let cssScrollHeight = 0;
|
|
5114
|
+
if (state.monthsData.length > 0) {
|
|
5115
|
+
cssScrollHeight = state.monthsData[state.monthsData.length - 1].cssScrollHeight + state.monthsData[state.monthsData.length - 1].cssHeight;
|
|
5116
|
+
}
|
|
5117
|
+
monthInfo.cssScrollHeight = cssScrollHeight;
|
|
4557
5118
|
if (type2 === "next") {
|
|
4558
5119
|
if (!state.endData || !Utils.compareDate(
|
|
4559
5120
|
`${state.endData[0]}-${state.endData[1]}-${Utils.getMonthDays(
|
|
@@ -4569,187 +5130,260 @@ const CalendarItem = (props) => {
|
|
|
4569
5130
|
`${state.startData[0]}-${state.startData[1]}-01`
|
|
4570
5131
|
)) {
|
|
4571
5132
|
state.monthsData.unshift(monthInfo);
|
|
4572
|
-
} else {
|
|
4573
|
-
setUnLoadPrev(true);
|
|
4574
5133
|
}
|
|
4575
5134
|
setMonthsData(state.monthsData);
|
|
4576
5135
|
};
|
|
4577
|
-
const
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
}
|
|
4591
|
-
}
|
|
4592
|
-
}
|
|
4593
|
-
});
|
|
4594
|
-
};
|
|
4595
|
-
const setTransform = (translateY = 0, type2, time = 1e3) => {
|
|
4596
|
-
if (monthsPanel == null ? void 0 : monthsPanel.current) {
|
|
4597
|
-
if (type2 === "end") {
|
|
4598
|
-
monthsPanel.current.style.webkitTransition = `transform ${time}ms cubic-bezier(0.19, 1, 0.22, 1)`;
|
|
4599
|
-
clearTimeout(state.timer);
|
|
4600
|
-
state.timer = setTimeout(() => {
|
|
4601
|
-
loadScroll();
|
|
4602
|
-
}, time);
|
|
4603
|
-
} else {
|
|
4604
|
-
monthsPanel.current.style.webkitTransition = "";
|
|
4605
|
-
loadScroll();
|
|
5136
|
+
const setDefaultRange = (monthsNum, current) => {
|
|
5137
|
+
let start2 = 0;
|
|
5138
|
+
let end = 0;
|
|
5139
|
+
if (monthsNum >= 3) {
|
|
5140
|
+
if (current > 0 && current < monthsNum) {
|
|
5141
|
+
start2 = current - 1;
|
|
5142
|
+
end = current + 3;
|
|
5143
|
+
} else if (current === 0) {
|
|
5144
|
+
start2 = current;
|
|
5145
|
+
end = current + 4;
|
|
5146
|
+
} else if (current === monthsNum) {
|
|
5147
|
+
start2 = current - 2;
|
|
5148
|
+
end = current + 2;
|
|
4606
5149
|
}
|
|
4607
|
-
|
|
4608
|
-
|
|
5150
|
+
} else {
|
|
5151
|
+
start2 = 0;
|
|
5152
|
+
end = monthsNum + 2;
|
|
4609
5153
|
}
|
|
5154
|
+
setMonthDefaultRange([start2, end]);
|
|
5155
|
+
setTranslateY(state.monthsData[start2].cssScrollHeight);
|
|
4610
5156
|
};
|
|
4611
|
-
const
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
const
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
5157
|
+
const mothsViewScroll = (e2) => {
|
|
5158
|
+
if (state.monthsData.length <= 1) {
|
|
5159
|
+
return;
|
|
5160
|
+
}
|
|
5161
|
+
const target = e2.target;
|
|
5162
|
+
const currentScrollTop = target.scrollTop;
|
|
5163
|
+
let current = Math.floor(currentScrollTop / state.avgHeight);
|
|
5164
|
+
if (current === 0) {
|
|
5165
|
+
if (currentScrollTop >= state.monthsData[current + 1].cssScrollHeight) {
|
|
5166
|
+
current += 1;
|
|
4619
5167
|
}
|
|
4620
|
-
|
|
4621
|
-
|
|
5168
|
+
} else if (current > 0 && current < state.monthsNum - 1) {
|
|
5169
|
+
if (currentScrollTop >= state.monthsData[current + 1].cssScrollHeight) {
|
|
5170
|
+
current += 1;
|
|
4622
5171
|
}
|
|
4623
|
-
if (
|
|
4624
|
-
|
|
5172
|
+
if (currentScrollTop < state.monthsData[current].cssScrollHeight) {
|
|
5173
|
+
current -= 1;
|
|
4625
5174
|
}
|
|
4626
|
-
setTransform(updateMove, type2, time);
|
|
4627
5175
|
} else {
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
if (updateMove < -offsetHeight + h2 - 100 && state.monthsData.length > 1) {
|
|
4632
|
-
updateMove = -offsetHeight + h2 - 100;
|
|
5176
|
+
const viewPosition = Math.round(currentScrollTop + viewHeight);
|
|
5177
|
+
if (viewPosition < state.monthsData[current].cssScrollHeight + state.monthsData[current].cssHeight && currentScrollTop > state.monthsData[current - 1].cssScrollHeight) {
|
|
5178
|
+
current -= 1;
|
|
4633
5179
|
}
|
|
4634
|
-
if (
|
|
4635
|
-
|
|
5180
|
+
if (current + 1 <= state.monthsNum && viewPosition >= state.monthsData[current + 1].cssScrollHeight + state.monthsData[current + 1].cssHeight) {
|
|
5181
|
+
current += 1;
|
|
4636
5182
|
}
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
};
|
|
4640
|
-
const onTouchStart = (event) => {
|
|
4641
|
-
event.stopPropagation();
|
|
4642
|
-
const changedTouches = event.changedTouches[0];
|
|
4643
|
-
state.touchParams.startY = changedTouches.pageY;
|
|
4644
|
-
state.touchParams.startTime = event.timeStamp || Date.now();
|
|
4645
|
-
state.transformY = state.scrollDistance;
|
|
4646
|
-
};
|
|
4647
|
-
const onTouchMove = (event) => {
|
|
4648
|
-
event.stopPropagation();
|
|
4649
|
-
const changedTouches = event.changedTouches[0];
|
|
4650
|
-
state.touchParams.lastY = changedTouches.pageY;
|
|
4651
|
-
state.touchParams.lastTime = event.timeStamp || Date.now();
|
|
4652
|
-
const move = state.touchParams.lastY - state.touchParams.startY;
|
|
4653
|
-
if (Math.abs(move) < 5) {
|
|
4654
|
-
return false;
|
|
4655
|
-
}
|
|
4656
|
-
setMove(move);
|
|
4657
|
-
};
|
|
4658
|
-
const onTouchEnd = (event) => {
|
|
4659
|
-
var _a, _b;
|
|
4660
|
-
event.stopPropagation();
|
|
4661
|
-
const changedTouches = event.changedTouches[0];
|
|
4662
|
-
state.touchParams.lastY = changedTouches.pageY;
|
|
4663
|
-
state.touchParams.lastTime = event.timeStamp || Date.now();
|
|
4664
|
-
let move = state.touchParams.lastY - state.touchParams.startY;
|
|
4665
|
-
if (Math.abs(move) < 5) {
|
|
4666
|
-
return false;
|
|
4667
|
-
}
|
|
4668
|
-
const updateMove = move + state.transformY;
|
|
4669
|
-
const h2 = ((_a = months.current) == null ? void 0 : _a.offsetHeight) || 0;
|
|
4670
|
-
const offsetHeight = ((_b = monthsPanel.current) == null ? void 0 : _b.offsetHeight) || 0;
|
|
4671
|
-
if (updateMove > 0) {
|
|
4672
|
-
getMonth(getCurrData("prev"), "prev");
|
|
4673
|
-
} else if (updateMove < 0 && updateMove < -offsetHeight + (Math.abs(move) > h2 ? Math.abs(move) : h2) * 5) {
|
|
4674
|
-
getMonth(getCurrData("next"), "next");
|
|
4675
|
-
if (Math.abs(move) >= 300) {
|
|
4676
|
-
getMonth(getCurrData("next"), "next");
|
|
5183
|
+
if (current >= 1 && currentScrollTop < state.monthsData[current - 1].cssScrollHeight) {
|
|
5184
|
+
current -= 1;
|
|
4677
5185
|
}
|
|
4678
5186
|
}
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
moveTime += 1e3;
|
|
4683
|
-
setMove(move, "end", moveTime);
|
|
4684
|
-
} else {
|
|
4685
|
-
setMove(move, "end");
|
|
5187
|
+
if (state.currentIndex !== current) {
|
|
5188
|
+
state.currentIndex = current;
|
|
5189
|
+
setDefaultRange(state.monthsNum, current);
|
|
4686
5190
|
}
|
|
5191
|
+
setYearMonthTitle(state.monthsData[current].title);
|
|
4687
5192
|
};
|
|
4688
5193
|
const initData = () => {
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
5194
|
+
const propStartDate = props.startDate ? props.startDate : Utils.getDay(0);
|
|
5195
|
+
const propEndDate = props.endDate ? props.endDate : Utils.getDay(365);
|
|
5196
|
+
state.propStartDate = propStartDate;
|
|
5197
|
+
state.propEndDate = propEndDate;
|
|
5198
|
+
state.startData = splitDate(propStartDate);
|
|
5199
|
+
state.endData = splitDate(propEndDate);
|
|
5200
|
+
if (defaultValue || Array.isArray(defaultValue) && defaultValue.length > 0) {
|
|
5201
|
+
state.currDate = props.type !== "one" ? [...props.defaultValue] : props.defaultValue;
|
|
5202
|
+
}
|
|
5203
|
+
const startDate = {
|
|
5204
|
+
year: Number(state.startData[0]),
|
|
5205
|
+
month: Number(state.startData[1])
|
|
5206
|
+
};
|
|
5207
|
+
const endDate = {
|
|
5208
|
+
year: Number(state.endData[0]),
|
|
5209
|
+
month: Number(state.endData[1])
|
|
5210
|
+
};
|
|
5211
|
+
let monthsNum = endDate.month - startDate.month;
|
|
5212
|
+
if (endDate.year - startDate.year > 0) {
|
|
5213
|
+
monthsNum += 12 * (endDate.year - startDate.year);
|
|
5214
|
+
}
|
|
5215
|
+
if (monthsNum <= 0) {
|
|
5216
|
+
monthsNum = 1;
|
|
4695
5217
|
}
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
5218
|
+
getMonth(state.startData, "next");
|
|
5219
|
+
let i = 1;
|
|
5220
|
+
do {
|
|
5221
|
+
getMonth(getCurrData("next"), "next");
|
|
5222
|
+
} while (i++ < monthsNum);
|
|
5223
|
+
state.monthsNum = monthsNum;
|
|
5224
|
+
if (type === "range" && Array.isArray(state.currDate)) {
|
|
5225
|
+
if (state.currDate.length > 0) {
|
|
5226
|
+
if (propStartDate && Utils.compareDate(state.currDate[0], propStartDate)) {
|
|
5227
|
+
state.currDate.splice(0, 1, propStartDate);
|
|
5228
|
+
}
|
|
5229
|
+
if (propEndDate && Utils.compareDate(propEndDate, state.currDate[1])) {
|
|
5230
|
+
state.currDate.splice(1, 1, propEndDate);
|
|
5231
|
+
}
|
|
5232
|
+
state.defaultData = [
|
|
5233
|
+
...splitDate(state.currDate[0]),
|
|
5234
|
+
...splitDate(state.currDate[1])
|
|
5235
|
+
];
|
|
4699
5236
|
}
|
|
4700
|
-
|
|
4701
|
-
|
|
5237
|
+
} else if (props.type === "multiple" && Array.isArray(state.currDate)) {
|
|
5238
|
+
if (state.currDate.length > 0) {
|
|
5239
|
+
const defaultArr = [];
|
|
5240
|
+
const obj = {};
|
|
5241
|
+
state.currDate.forEach((item) => {
|
|
5242
|
+
if (propStartDate && !Utils.compareDate(item, propStartDate) && propEndDate && !Utils.compareDate(propEndDate, item)) {
|
|
5243
|
+
if (!Object.hasOwnProperty.call(obj, item)) {
|
|
5244
|
+
defaultArr.push(item);
|
|
5245
|
+
obj[item] = item;
|
|
5246
|
+
}
|
|
5247
|
+
}
|
|
5248
|
+
});
|
|
5249
|
+
state.currDate = [...defaultArr];
|
|
5250
|
+
state.defaultData = [...splitDate(defaultArr[0])];
|
|
4702
5251
|
}
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
if (startDate && Utils.compareDate(state.currDate, startDate)) {
|
|
4709
|
-
state.currDate = startDate;
|
|
4710
|
-
} else if (endDate && !Utils.compareDate(state.currDate, endDate)) {
|
|
4711
|
-
state.currDate = endDate;
|
|
5252
|
+
} else if (state.currDate) {
|
|
5253
|
+
if (propStartDate && Utils.compareDate(state.currDate, propStartDate)) {
|
|
5254
|
+
state.currDate = propStartDate;
|
|
5255
|
+
} else if (propEndDate && !Utils.compareDate(state.currDate, propEndDate)) {
|
|
5256
|
+
state.currDate = propEndDate;
|
|
4712
5257
|
}
|
|
4713
5258
|
state.defaultData = [...splitDate(state.currDate)];
|
|
4714
5259
|
}
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
5260
|
+
let current = 0;
|
|
5261
|
+
let lastCurrent = 0;
|
|
5262
|
+
if (state.defaultData.length > 0) {
|
|
5263
|
+
state.monthsData.forEach((item, index2) => {
|
|
5264
|
+
if (item.title === locale.calendaritem.monthTitle(
|
|
5265
|
+
state.defaultData[0],
|
|
5266
|
+
state.defaultData[1]
|
|
5267
|
+
)) {
|
|
5268
|
+
current = index2;
|
|
5269
|
+
}
|
|
5270
|
+
if (props.type === "range") {
|
|
5271
|
+
if (item.title === locale.calendaritem.monthTitle(
|
|
5272
|
+
state.defaultData[3],
|
|
5273
|
+
state.defaultData[4]
|
|
5274
|
+
)) {
|
|
5275
|
+
lastCurrent = index2;
|
|
5276
|
+
}
|
|
5277
|
+
}
|
|
5278
|
+
});
|
|
5279
|
+
}
|
|
5280
|
+
setDefaultRange(monthsNum, current);
|
|
5281
|
+
state.currentIndex = current;
|
|
5282
|
+
setYearMonthTitle(state.monthsData[state.currentIndex].title);
|
|
5283
|
+
if (state.defaultData.length > 0) {
|
|
5284
|
+
if (type === "range") {
|
|
5285
|
+
chooseDay(
|
|
5286
|
+
{ day: state.defaultData[2], type: "curr" },
|
|
5287
|
+
state.monthsData[state.currentIndex],
|
|
5288
|
+
true
|
|
5289
|
+
);
|
|
5290
|
+
chooseDay(
|
|
5291
|
+
{ day: state.defaultData[5], type: "curr" },
|
|
5292
|
+
state.monthsData[lastCurrent],
|
|
5293
|
+
true
|
|
5294
|
+
);
|
|
5295
|
+
} else if (type === "multiple") {
|
|
5296
|
+
[...state.currDate].forEach((item) => {
|
|
5297
|
+
const dateArr = splitDate(item);
|
|
5298
|
+
let current2 = state.currentIndex;
|
|
5299
|
+
state.monthsData.forEach((item2, index2) => {
|
|
5300
|
+
if (item2.title === locale.calendaritem.monthTitle(dateArr[0], dateArr[1])) {
|
|
5301
|
+
current2 = index2;
|
|
5302
|
+
}
|
|
5303
|
+
});
|
|
5304
|
+
chooseDay(
|
|
5305
|
+
{ day: dateArr[2], type: "curr" },
|
|
5306
|
+
state.monthsData[current2],
|
|
5307
|
+
true
|
|
5308
|
+
);
|
|
5309
|
+
});
|
|
5310
|
+
} else {
|
|
5311
|
+
chooseDay(
|
|
5312
|
+
{ day: state.defaultData[2], type: "curr" },
|
|
5313
|
+
state.monthsData[state.currentIndex],
|
|
5314
|
+
true
|
|
5315
|
+
);
|
|
5316
|
+
}
|
|
4739
5317
|
}
|
|
5318
|
+
const lastItem = state.monthsData[state.monthsData.length - 1];
|
|
5319
|
+
const containerHeight = lastItem.cssHeight + lastItem.cssScrollHeight;
|
|
5320
|
+
requestAniFrame$1(() => {
|
|
5321
|
+
if (months && monthsPanel && viewArea) {
|
|
5322
|
+
viewHeight = months.current.clientHeight;
|
|
5323
|
+
monthsPanel.current.style.height = `${containerHeight}px`;
|
|
5324
|
+
months.current.scrollTop = state.monthsData[state.currentIndex].cssScrollHeight;
|
|
5325
|
+
}
|
|
5326
|
+
});
|
|
5327
|
+
state.avgHeight = Math.floor(containerHeight / (monthsNum + 1));
|
|
5328
|
+
};
|
|
5329
|
+
const resetRender = () => {
|
|
5330
|
+
state.chooseData.splice(0);
|
|
5331
|
+
state.monthsData.splice(0);
|
|
5332
|
+
initData();
|
|
5333
|
+
};
|
|
5334
|
+
const scrollToDate = (date) => {
|
|
5335
|
+
if (Utils.compareDate(date, state.propStartDate)) {
|
|
5336
|
+
date = state.propStartDate;
|
|
5337
|
+
} else if (!Utils.compareDate(date, state.propEndDate)) {
|
|
5338
|
+
date = state.propEndDate;
|
|
5339
|
+
}
|
|
5340
|
+
const dateArr = splitDate(date);
|
|
5341
|
+
state.monthsData.forEach((item, index2) => {
|
|
5342
|
+
if (item.title === locale.calendaritem.monthTitle(dateArr[0], dateArr[1])) {
|
|
5343
|
+
if (months.current) {
|
|
5344
|
+
const distance = state.monthsData[index2].cssScrollHeight - months.current.scrollTop;
|
|
5345
|
+
if (toDateAnimation) {
|
|
5346
|
+
let flag = 0;
|
|
5347
|
+
const interval = setInterval(() => {
|
|
5348
|
+
flag++;
|
|
5349
|
+
if (months.current) {
|
|
5350
|
+
const offset = distance / 10;
|
|
5351
|
+
months.current.scrollTop += offset;
|
|
5352
|
+
}
|
|
5353
|
+
if (flag >= 10) {
|
|
5354
|
+
clearInterval(interval);
|
|
5355
|
+
if (months.current) {
|
|
5356
|
+
months.current.scrollTop = state.monthsData[index2].cssScrollHeight;
|
|
5357
|
+
}
|
|
5358
|
+
}
|
|
5359
|
+
}, 40);
|
|
5360
|
+
} else {
|
|
5361
|
+
months.current.scrollTop = state.monthsData[index2].cssScrollHeight;
|
|
5362
|
+
}
|
|
5363
|
+
}
|
|
5364
|
+
}
|
|
5365
|
+
});
|
|
4740
5366
|
};
|
|
4741
5367
|
useEffect(() => {
|
|
4742
5368
|
initData();
|
|
4743
5369
|
}, []);
|
|
5370
|
+
useEffect(() => {
|
|
5371
|
+
poppable && resetRender();
|
|
5372
|
+
}, [defaultValue]);
|
|
5373
|
+
React__default.useImperativeHandle(ref, () => ({
|
|
5374
|
+
scrollToDate
|
|
5375
|
+
}));
|
|
4744
5376
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", {
|
|
4745
5377
|
className: classes
|
|
4746
5378
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
4747
5379
|
className: headerClasses
|
|
4748
|
-
},
|
|
5380
|
+
}, showTitle && /* @__PURE__ */ React__default.createElement("div", {
|
|
4749
5381
|
className: "calendar-title"
|
|
4750
|
-
}, locale.calendaritem.title), /* @__PURE__ */ React__default.createElement("div", {
|
|
5382
|
+
}, title || locale.calendaritem.title), onBtn && /* @__PURE__ */ React__default.createElement("div", {
|
|
5383
|
+
className: "calendar-top-slot"
|
|
5384
|
+
}, onBtn()), showSubTitle && /* @__PURE__ */ React__default.createElement("div", {
|
|
4751
5385
|
className: "calendar-curr-month"
|
|
4752
|
-
}, yearMonthTitle)
|
|
5386
|
+
}, yearMonthTitle), /* @__PURE__ */ React__default.createElement("div", {
|
|
4753
5387
|
className: "calendar-weeks",
|
|
4754
5388
|
ref: weeksPanel
|
|
4755
5389
|
}, weeks.map((item) => /* @__PURE__ */ React__default.createElement("div", {
|
|
@@ -4757,51 +5391,57 @@ const CalendarItem = (props) => {
|
|
|
4757
5391
|
key: item
|
|
4758
5392
|
}, item)))), /* @__PURE__ */ React__default.createElement("div", {
|
|
4759
5393
|
className: "nut-calendar-content",
|
|
4760
|
-
|
|
4761
|
-
onTouchMove,
|
|
4762
|
-
onTouchEnd,
|
|
5394
|
+
onScroll: mothsViewScroll,
|
|
4763
5395
|
ref: months
|
|
4764
5396
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
4765
5397
|
className: "calendar-months-panel",
|
|
4766
5398
|
ref: monthsPanel
|
|
4767
5399
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
4768
|
-
className: "
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
5400
|
+
className: "viewArea",
|
|
5401
|
+
ref: viewArea,
|
|
5402
|
+
style: { transform: `translateY(${translateY}px)` }
|
|
5403
|
+
}, state.monthsData.slice(monthDefaultRange[0], monthDefaultRange[1]).map((month, key) => {
|
|
5404
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
5405
|
+
className: "calendar-month",
|
|
5406
|
+
key
|
|
5407
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
5408
|
+
className: "calendar-month-title"
|
|
5409
|
+
}, month.title), /* @__PURE__ */ React__default.createElement("div", {
|
|
5410
|
+
className: "calendar-month-con"
|
|
5411
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
5412
|
+
className: monthitemclasses
|
|
5413
|
+
}, month.monthData.map((day, i) => /* @__PURE__ */ React__default.createElement("div", {
|
|
5414
|
+
className: [
|
|
5415
|
+
"calendar-month-day",
|
|
5416
|
+
getClass(day, month)
|
|
5417
|
+
].join(" "),
|
|
5418
|
+
onClick: () => {
|
|
5419
|
+
chooseDay(day, month);
|
|
5420
|
+
},
|
|
5421
|
+
key: i
|
|
5422
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
5423
|
+
className: "calendar-day"
|
|
5424
|
+
}, onDay ? onDay(day) : day.day), onTopInfo && /* @__PURE__ */ React__default.createElement("div", {
|
|
5425
|
+
className: "calendar-curr-tips calendar-curr-tips-top"
|
|
5426
|
+
}, onTopInfo(day)), onBottomInfo && /* @__PURE__ */ React__default.createElement("div", {
|
|
5427
|
+
className: "calendar-curr-tips calendar-curr-tips-bottom"
|
|
5428
|
+
}, onBottomInfo(day)), !onBottomInfo && showToday && isCurrDay(month, day.day) && /* @__PURE__ */ React__default.createElement("div", {
|
|
5429
|
+
className: "calendar-curr-tip-curr"
|
|
5430
|
+
}, locale.calendaritem.today), isStartTip(day, month) && /* @__PURE__ */ React__default.createElement("div", {
|
|
5431
|
+
className: `calendar-day-tip ${rangeTip() ? "calendar-curr-tips-top" : ""}`
|
|
5432
|
+
}, startText || locale.calendaritem.start), isEndTip(day, month) && /* @__PURE__ */ React__default.createElement("div", {
|
|
5433
|
+
className: "calendar-day-tip"
|
|
5434
|
+
}, endText || locale.calendaritem.end))))));
|
|
5435
|
+
})))), poppable && !isAutoBackFill ? /* @__PURE__ */ React__default.createElement("div", {
|
|
4796
5436
|
className: "nut-calendar-footer"
|
|
4797
5437
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
4798
5438
|
className: "calendar-confirm-btn",
|
|
4799
5439
|
onClick: confirm2
|
|
4800
|
-
}, locale.confirm)) : ""));
|
|
4801
|
-
};
|
|
4802
|
-
CalendarItem.defaultProps = defaultProps$
|
|
5440
|
+
}, confirmText || locale.confirm)) : ""));
|
|
5441
|
+
});
|
|
5442
|
+
CalendarItem.defaultProps = defaultProps$V;
|
|
4803
5443
|
CalendarItem.displayName = "NutCalendarItem";
|
|
4804
|
-
const defaultProps$
|
|
5444
|
+
const defaultProps$U = {
|
|
4805
5445
|
type: "one",
|
|
4806
5446
|
isAutoBackFill: false,
|
|
4807
5447
|
poppable: true,
|
|
@@ -4810,15 +5450,27 @@ const defaultProps$P = {
|
|
|
4810
5450
|
defaultValue: "",
|
|
4811
5451
|
startDate: Utils.getDay(0),
|
|
4812
5452
|
endDate: Utils.getDay(365),
|
|
5453
|
+
showToday: true,
|
|
5454
|
+
startText: "\u5F00\u59CB",
|
|
5455
|
+
endText: "\u7ED3\u675F",
|
|
5456
|
+
confirmText: "\u786E\u8BA4",
|
|
5457
|
+
showTitle: true,
|
|
5458
|
+
showSubTitle: true,
|
|
5459
|
+
toDateAnimation: true,
|
|
5460
|
+
onBtn: void 0,
|
|
5461
|
+
onDay: void 0,
|
|
5462
|
+
onTopInfo: void 0,
|
|
5463
|
+
onBottomInfo: void 0,
|
|
4813
5464
|
onClose: () => {
|
|
4814
5465
|
},
|
|
4815
5466
|
onChoose: (param) => {
|
|
5467
|
+
},
|
|
5468
|
+
onSelected: (data) => {
|
|
4816
5469
|
}
|
|
4817
5470
|
};
|
|
4818
|
-
const Calendar = (props) => {
|
|
5471
|
+
const Calendar = React__default.forwardRef((props, ref) => {
|
|
4819
5472
|
const { locale } = useConfig();
|
|
4820
5473
|
const {
|
|
4821
|
-
children,
|
|
4822
5474
|
poppable,
|
|
4823
5475
|
visible,
|
|
4824
5476
|
type,
|
|
@@ -4827,14 +5479,25 @@ const Calendar = (props) => {
|
|
|
4827
5479
|
defaultValue,
|
|
4828
5480
|
startDate,
|
|
4829
5481
|
endDate,
|
|
5482
|
+
showToday,
|
|
5483
|
+
startText,
|
|
5484
|
+
endText,
|
|
5485
|
+
confirmText,
|
|
5486
|
+
showTitle,
|
|
5487
|
+
showSubTitle,
|
|
5488
|
+
toDateAnimation,
|
|
5489
|
+
onBtn,
|
|
5490
|
+
onDay,
|
|
5491
|
+
onTopInfo,
|
|
5492
|
+
onBottomInfo,
|
|
4830
5493
|
onClose,
|
|
4831
|
-
onChoose
|
|
4832
|
-
|
|
5494
|
+
onChoose,
|
|
5495
|
+
onSelected
|
|
5496
|
+
} = { ...defaultProps$U, ...props };
|
|
5497
|
+
const calendarRef = useRef(null);
|
|
4833
5498
|
const close = () => {
|
|
4834
5499
|
onClose && onClose();
|
|
4835
5500
|
};
|
|
4836
|
-
const update2 = () => {
|
|
4837
|
-
};
|
|
4838
5501
|
const choose = (param) => {
|
|
4839
5502
|
close();
|
|
4840
5503
|
onChoose && onChoose(param);
|
|
@@ -4842,39 +5505,56 @@ const Calendar = (props) => {
|
|
|
4842
5505
|
const closePopup = () => {
|
|
4843
5506
|
close();
|
|
4844
5507
|
};
|
|
5508
|
+
const select = (param) => {
|
|
5509
|
+
onSelected && onSelected(param);
|
|
5510
|
+
};
|
|
5511
|
+
const scrollToDate = (date) => {
|
|
5512
|
+
var _a;
|
|
5513
|
+
(_a = calendarRef.current) == null ? void 0 : _a.scrollToDate(date);
|
|
5514
|
+
};
|
|
5515
|
+
React__default.useImperativeHandle(ref, () => ({
|
|
5516
|
+
scrollToDate
|
|
5517
|
+
}));
|
|
5518
|
+
const renderItem = () => {
|
|
5519
|
+
return /* @__PURE__ */ React__default.createElement(CalendarItem, {
|
|
5520
|
+
ref: calendarRef,
|
|
5521
|
+
type,
|
|
5522
|
+
isAutoBackFill,
|
|
5523
|
+
poppable,
|
|
5524
|
+
title: locale.calendaritem.title || title,
|
|
5525
|
+
defaultValue,
|
|
5526
|
+
startDate,
|
|
5527
|
+
endDate,
|
|
5528
|
+
showToday,
|
|
5529
|
+
startText,
|
|
5530
|
+
endText,
|
|
5531
|
+
confirmText,
|
|
5532
|
+
showTitle,
|
|
5533
|
+
showSubTitle,
|
|
5534
|
+
toDateAnimation,
|
|
5535
|
+
onBtn,
|
|
5536
|
+
onDay,
|
|
5537
|
+
onTopInfo,
|
|
5538
|
+
onBottomInfo,
|
|
5539
|
+
onChoose: choose,
|
|
5540
|
+
onSelected: select
|
|
5541
|
+
});
|
|
5542
|
+
};
|
|
4845
5543
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, poppable ? /* @__PURE__ */ React__default.createElement(Popup, {
|
|
4846
5544
|
visible,
|
|
4847
5545
|
position: "bottom",
|
|
4848
5546
|
round: true,
|
|
5547
|
+
duration: 0.5,
|
|
4849
5548
|
closeable: true,
|
|
5549
|
+
destroyOnClose: true,
|
|
4850
5550
|
onClickOverlay: closePopup,
|
|
4851
|
-
onClickCloseIcon: closePopup
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
title: locale.calendaritem.title || title,
|
|
4857
|
-
defaultValue,
|
|
4858
|
-
startDate,
|
|
4859
|
-
endDate,
|
|
4860
|
-
onUpdate: update2,
|
|
4861
|
-
onClose: close,
|
|
4862
|
-
onChoose: choose
|
|
4863
|
-
})) : /* @__PURE__ */ React__default.createElement(CalendarItem, {
|
|
4864
|
-
type,
|
|
4865
|
-
isAutoBackFill,
|
|
4866
|
-
poppable,
|
|
4867
|
-
title: locale.calendaritem.title,
|
|
4868
|
-
defaultValue,
|
|
4869
|
-
startDate,
|
|
4870
|
-
endDate,
|
|
4871
|
-
onClose: close,
|
|
4872
|
-
onChoose: choose
|
|
4873
|
-
}));
|
|
4874
|
-
};
|
|
4875
|
-
Calendar.defaultProps = defaultProps$P;
|
|
5551
|
+
onClickCloseIcon: closePopup,
|
|
5552
|
+
style: { height: "85vh" }
|
|
5553
|
+
}, renderItem()) : renderItem());
|
|
5554
|
+
});
|
|
5555
|
+
Calendar.defaultProps = defaultProps$U;
|
|
4876
5556
|
Calendar.displayName = "NutCalendar";
|
|
4877
|
-
const defaultProps$
|
|
5557
|
+
const defaultProps$T = {
|
|
4878
5558
|
disabled: false,
|
|
4879
5559
|
checkedValue: [],
|
|
4880
5560
|
max: void 0,
|
|
@@ -4883,7 +5563,7 @@ const defaultProps$O = {
|
|
|
4883
5563
|
};
|
|
4884
5564
|
const CheckboxGroup = React__default.forwardRef(
|
|
4885
5565
|
(props, ref) => {
|
|
4886
|
-
const { children } = { ...defaultProps$
|
|
5566
|
+
const { children } = { ...defaultProps$T, ...props };
|
|
4887
5567
|
const b2 = cn("checkboxgroup");
|
|
4888
5568
|
const { className, disabled, onChange, checkedValue, max, ...rest } = props;
|
|
4889
5569
|
const [innerDisabled, setInnerDisabled] = useState(disabled);
|
|
@@ -4961,9 +5641,9 @@ const CheckboxGroup = React__default.forwardRef(
|
|
|
4961
5641
|
}, cloneChildren());
|
|
4962
5642
|
}
|
|
4963
5643
|
);
|
|
4964
|
-
CheckboxGroup.defaultProps = defaultProps$
|
|
5644
|
+
CheckboxGroup.defaultProps = defaultProps$T;
|
|
4965
5645
|
CheckboxGroup.displayName = "NutCheckboxGroup";
|
|
4966
|
-
const defaultProps$
|
|
5646
|
+
const defaultProps$S = {
|
|
4967
5647
|
checked: false,
|
|
4968
5648
|
disabled: false,
|
|
4969
5649
|
textPosition: "right",
|
|
@@ -4977,7 +5657,7 @@ const defaultProps$N = {
|
|
|
4977
5657
|
}
|
|
4978
5658
|
};
|
|
4979
5659
|
const Checkbox = (props) => {
|
|
4980
|
-
const { children } = { ...defaultProps$
|
|
5660
|
+
const { children } = { ...defaultProps$S, ...props };
|
|
4981
5661
|
const b2 = cn("checkbox");
|
|
4982
5662
|
const {
|
|
4983
5663
|
iconName,
|
|
@@ -5057,7 +5737,7 @@ const Checkbox = (props) => {
|
|
|
5057
5737
|
onClick: handleClick2
|
|
5058
5738
|
}, renderIcon(), renderLabel());
|
|
5059
5739
|
};
|
|
5060
|
-
Checkbox.defaultProps = defaultProps$
|
|
5740
|
+
Checkbox.defaultProps = defaultProps$S;
|
|
5061
5741
|
Checkbox.displayName = "NutCheckBox";
|
|
5062
5742
|
Checkbox.Group = CheckboxGroup;
|
|
5063
5743
|
const InternalPickerSlot = (props, ref) => {
|
|
@@ -5140,7 +5820,7 @@ const InternalPickerSlot = (props, ref) => {
|
|
|
5140
5820
|
const touchMove = (event) => {
|
|
5141
5821
|
touch.move(event);
|
|
5142
5822
|
if (touch.isVertical) {
|
|
5143
|
-
|
|
5823
|
+
preventDefault2(event, true);
|
|
5144
5824
|
}
|
|
5145
5825
|
const move = touch.deltaY - startY;
|
|
5146
5826
|
setMove(move);
|
|
@@ -5190,7 +5870,7 @@ const InternalPickerSlot = (props, ref) => {
|
|
|
5190
5870
|
const stopMomentum = () => {
|
|
5191
5871
|
setChooseValue(scrollDistance);
|
|
5192
5872
|
};
|
|
5193
|
-
const
|
|
5873
|
+
const preventDefault2 = (event, isStopPropagation) => {
|
|
5194
5874
|
if (typeof event.cancelable !== "boolean" || event.cancelable) {
|
|
5195
5875
|
event.preventDefault();
|
|
5196
5876
|
}
|
|
@@ -5423,7 +6103,7 @@ const InternalPicker = (props, ref) => {
|
|
|
5423
6103
|
};
|
|
5424
6104
|
const Picker = React__default.forwardRef(InternalPicker);
|
|
5425
6105
|
const currentYear = new Date().getFullYear();
|
|
5426
|
-
const defaultProps$
|
|
6106
|
+
const defaultProps$R = {
|
|
5427
6107
|
modelValue: null,
|
|
5428
6108
|
visible: false,
|
|
5429
6109
|
title: "",
|
|
@@ -5453,9 +6133,10 @@ const DatePicker = (props) => {
|
|
|
5453
6133
|
style,
|
|
5454
6134
|
...rest
|
|
5455
6135
|
} = {
|
|
5456
|
-
...defaultProps$
|
|
6136
|
+
...defaultProps$R,
|
|
5457
6137
|
...props
|
|
5458
6138
|
};
|
|
6139
|
+
const { locale } = useConfig();
|
|
5459
6140
|
const [show, setShow] = useState(false);
|
|
5460
6141
|
const [currentDate, setCurrentDate] = useState(modelValue);
|
|
5461
6142
|
const [defaultValue, setDefaultValue] = useState([]);
|
|
@@ -5464,13 +6145,14 @@ const DatePicker = (props) => {
|
|
|
5464
6145
|
const isDate = (val) => {
|
|
5465
6146
|
return Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
|
|
5466
6147
|
};
|
|
6148
|
+
const datepickerLang = locale.datepicker;
|
|
5467
6149
|
const zhCNType = {
|
|
5468
|
-
day:
|
|
5469
|
-
year:
|
|
5470
|
-
month:
|
|
5471
|
-
hour:
|
|
5472
|
-
minute:
|
|
5473
|
-
seconds:
|
|
6150
|
+
day: datepickerLang.day,
|
|
6151
|
+
year: datepickerLang.year,
|
|
6152
|
+
month: datepickerLang.month,
|
|
6153
|
+
hour: datepickerLang.hour,
|
|
6154
|
+
minute: datepickerLang.min,
|
|
6155
|
+
seconds: datepickerLang.seconds
|
|
5474
6156
|
};
|
|
5475
6157
|
const formatValue = (value) => {
|
|
5476
6158
|
let cvalue = value;
|
|
@@ -5718,9 +6400,9 @@ const DatePicker = (props) => {
|
|
|
5718
6400
|
ref: pickerRef
|
|
5719
6401
|
}));
|
|
5720
6402
|
};
|
|
5721
|
-
DatePicker.defaultProps = defaultProps$
|
|
6403
|
+
DatePicker.defaultProps = defaultProps$R;
|
|
5722
6404
|
DatePicker.displayName = "NutDatePicker";
|
|
5723
|
-
const defaultProps$
|
|
6405
|
+
const defaultProps$Q = {
|
|
5724
6406
|
disabled: false,
|
|
5725
6407
|
buttonSize: "",
|
|
5726
6408
|
min: 1,
|
|
@@ -5758,7 +6440,7 @@ const InputNumber = (props) => {
|
|
|
5758
6440
|
focus,
|
|
5759
6441
|
...restProps
|
|
5760
6442
|
} = {
|
|
5761
|
-
...defaultProps$
|
|
6443
|
+
...defaultProps$Q,
|
|
5762
6444
|
...props
|
|
5763
6445
|
};
|
|
5764
6446
|
const [inputValue, setInputValue] = useState(modelValue);
|
|
@@ -5883,7 +6565,7 @@ const InputNumber = (props) => {
|
|
|
5883
6565
|
onClick: addNumber
|
|
5884
6566
|
}));
|
|
5885
6567
|
};
|
|
5886
|
-
InputNumber.defaultProps = defaultProps$
|
|
6568
|
+
InputNumber.defaultProps = defaultProps$Q;
|
|
5887
6569
|
InputNumber.displayName = "NutInputNumber";
|
|
5888
6570
|
function trimExtraChar(value, char, regExp) {
|
|
5889
6571
|
const index2 = value.indexOf(char);
|
|
@@ -5909,7 +6591,7 @@ function formatNumber(value, allowDot = true, allowMinus = true) {
|
|
|
5909
6591
|
const regExp = allowDot ? /[^-0-9.]/g : /[^-0-9]/g;
|
|
5910
6592
|
return value.replace(regExp, "");
|
|
5911
6593
|
}
|
|
5912
|
-
const defaultProps$
|
|
6594
|
+
const defaultProps$P = {
|
|
5913
6595
|
type: "text",
|
|
5914
6596
|
defaultValue: "",
|
|
5915
6597
|
placeholder: "",
|
|
@@ -5992,7 +6674,7 @@ const Input = (props) => {
|
|
|
5992
6674
|
clickRightIcon,
|
|
5993
6675
|
click,
|
|
5994
6676
|
...rest
|
|
5995
|
-
} = { ...defaultProps$
|
|
6677
|
+
} = { ...defaultProps$P, ...props };
|
|
5996
6678
|
locale.placeholder = placeholder || locale.placeholder;
|
|
5997
6679
|
const [inputValue, SetInputValue] = useState("");
|
|
5998
6680
|
const [active, SetActive] = useState(false);
|
|
@@ -6204,14 +6886,14 @@ const Input = (props) => {
|
|
|
6204
6886
|
}
|
|
6205
6887
|
}, errorMessage) : null)));
|
|
6206
6888
|
};
|
|
6207
|
-
Input.defaultProps = defaultProps$
|
|
6889
|
+
Input.defaultProps = defaultProps$P;
|
|
6208
6890
|
Input.displayName = "NutInput";
|
|
6209
6891
|
const radioContext = {
|
|
6210
6892
|
onChange: (val) => {
|
|
6211
6893
|
}
|
|
6212
6894
|
};
|
|
6213
6895
|
var RadioContext = React__default.createContext(radioContext);
|
|
6214
|
-
const defaultProps$
|
|
6896
|
+
const defaultProps$O = {
|
|
6215
6897
|
value: null,
|
|
6216
6898
|
textPosition: "right",
|
|
6217
6899
|
onChange: (value) => {
|
|
@@ -6220,7 +6902,7 @@ const defaultProps$J = {
|
|
|
6220
6902
|
};
|
|
6221
6903
|
const RadioGroup = React__default.forwardRef(
|
|
6222
6904
|
(props, ref) => {
|
|
6223
|
-
const { children } = { ...defaultProps$
|
|
6905
|
+
const { children } = { ...defaultProps$O, ...props };
|
|
6224
6906
|
cn("RadioGroup");
|
|
6225
6907
|
const { className, value, onChange, textPosition, direction, ...rest } = props;
|
|
6226
6908
|
const [val2State, setVal2State] = useState(value);
|
|
@@ -6257,9 +6939,9 @@ const RadioGroup = React__default.forwardRef(
|
|
|
6257
6939
|
}, cloneChildren()));
|
|
6258
6940
|
}
|
|
6259
6941
|
);
|
|
6260
|
-
RadioGroup.defaultProps = defaultProps$
|
|
6942
|
+
RadioGroup.defaultProps = defaultProps$O;
|
|
6261
6943
|
RadioGroup.displayName = "NutRadioGroup";
|
|
6262
|
-
const defaultProps$
|
|
6944
|
+
const defaultProps$N = {
|
|
6263
6945
|
disabled: false,
|
|
6264
6946
|
checked: false,
|
|
6265
6947
|
shape: "round",
|
|
@@ -6272,7 +6954,7 @@ const defaultProps$I = {
|
|
|
6272
6954
|
}
|
|
6273
6955
|
};
|
|
6274
6956
|
const Radio = (props) => {
|
|
6275
|
-
const { children } = { ...defaultProps$
|
|
6957
|
+
const { children } = { ...defaultProps$N, ...props };
|
|
6276
6958
|
const {
|
|
6277
6959
|
className,
|
|
6278
6960
|
disabled,
|
|
@@ -6346,10 +7028,10 @@ const Radio = (props) => {
|
|
|
6346
7028
|
...rest
|
|
6347
7029
|
}, renderRadioItem());
|
|
6348
7030
|
};
|
|
6349
|
-
Radio.defaultProps = defaultProps$
|
|
7031
|
+
Radio.defaultProps = defaultProps$N;
|
|
6350
7032
|
Radio.displayName = "NutRadio";
|
|
6351
7033
|
Radio.RadioGroup = RadioGroup;
|
|
6352
|
-
const defaultProps$
|
|
7034
|
+
const defaultProps$M = {
|
|
6353
7035
|
count: 5,
|
|
6354
7036
|
modelValue: 0,
|
|
6355
7037
|
minimizeValue: 0,
|
|
@@ -6378,7 +7060,7 @@ const Rate = (props) => {
|
|
|
6378
7060
|
allowHalf,
|
|
6379
7061
|
spacing,
|
|
6380
7062
|
change
|
|
6381
|
-
} = { ...defaultProps$
|
|
7063
|
+
} = { ...defaultProps$M, ...props };
|
|
6382
7064
|
const b2 = cn("rate");
|
|
6383
7065
|
const bi = cn("rate-item");
|
|
6384
7066
|
const [countArray, setCountArray] = useState([1, 2, 3, 4, 5]);
|
|
@@ -6444,9 +7126,9 @@ const Rate = (props) => {
|
|
|
6444
7126
|
}));
|
|
6445
7127
|
}));
|
|
6446
7128
|
};
|
|
6447
|
-
Rate.defaultProps = defaultProps$
|
|
7129
|
+
Rate.defaultProps = defaultProps$M;
|
|
6448
7130
|
Rate.displayName = "NutRate";
|
|
6449
|
-
const defaultProps$
|
|
7131
|
+
const defaultProps$L = {
|
|
6450
7132
|
title: "",
|
|
6451
7133
|
desc: "",
|
|
6452
7134
|
tips: "",
|
|
@@ -6609,9 +7291,9 @@ const ShortPassword = (props) => {
|
|
|
6609
7291
|
onClick: () => sure()
|
|
6610
7292
|
}, locale.confirm)) : null)));
|
|
6611
7293
|
};
|
|
6612
|
-
ShortPassword.defaultProps = defaultProps$
|
|
7294
|
+
ShortPassword.defaultProps = defaultProps$L;
|
|
6613
7295
|
ShortPassword.displayName = "NutShortPassword";
|
|
6614
|
-
const defaultProps$
|
|
7296
|
+
const defaultProps$K = {
|
|
6615
7297
|
defaultValue: "",
|
|
6616
7298
|
textAlign: "left",
|
|
6617
7299
|
limitshow: false,
|
|
@@ -6639,9 +7321,10 @@ const TextArea = (props) => {
|
|
|
6639
7321
|
onChange,
|
|
6640
7322
|
onBlur,
|
|
6641
7323
|
onFocus
|
|
6642
|
-
} = { ...defaultProps$
|
|
7324
|
+
} = { ...defaultProps$K, ...props };
|
|
6643
7325
|
const textareaBem = cn("textarea");
|
|
6644
7326
|
const [inputValue, SetInputValue] = useState("");
|
|
7327
|
+
const textareaRef = useRef(null);
|
|
6645
7328
|
useEffect(() => {
|
|
6646
7329
|
if (defaultValue) {
|
|
6647
7330
|
let initValue = defaultValue;
|
|
@@ -6650,7 +7333,38 @@ const TextArea = (props) => {
|
|
|
6650
7333
|
}
|
|
6651
7334
|
SetInputValue(initValue);
|
|
6652
7335
|
}
|
|
6653
|
-
|
|
7336
|
+
if (autosize) {
|
|
7337
|
+
setTimeout(() => {
|
|
7338
|
+
setContentHeight();
|
|
7339
|
+
});
|
|
7340
|
+
}
|
|
7341
|
+
}, [defaultValue, autosize]);
|
|
7342
|
+
useEffect(() => {
|
|
7343
|
+
if (inputValue) {
|
|
7344
|
+
if (autosize) {
|
|
7345
|
+
setContentHeight();
|
|
7346
|
+
}
|
|
7347
|
+
}
|
|
7348
|
+
}, [inputValue]);
|
|
7349
|
+
const setContentHeight = () => {
|
|
7350
|
+
const textarea = textareaRef.current;
|
|
7351
|
+
if (textarea) {
|
|
7352
|
+
textarea.style.height = "auto";
|
|
7353
|
+
let height = textarea == null ? void 0 : textarea.scrollHeight;
|
|
7354
|
+
if (typeof autosize === "object") {
|
|
7355
|
+
const { maxHeight, minHeight } = autosize;
|
|
7356
|
+
if (maxHeight !== void 0) {
|
|
7357
|
+
height = Math.min(height, maxHeight);
|
|
7358
|
+
}
|
|
7359
|
+
if (minHeight !== void 0) {
|
|
7360
|
+
height = Math.max(height, minHeight);
|
|
7361
|
+
}
|
|
7362
|
+
}
|
|
7363
|
+
if (height) {
|
|
7364
|
+
textarea.style.height = `${height}px`;
|
|
7365
|
+
}
|
|
7366
|
+
}
|
|
7367
|
+
};
|
|
6654
7368
|
const textChange = (event) => {
|
|
6655
7369
|
const text = event.target;
|
|
6656
7370
|
if (maxlength && text.value.length > Number(maxlength)) {
|
|
@@ -6678,10 +7392,10 @@ const TextArea = (props) => {
|
|
|
6678
7392
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
6679
7393
|
className: `${textareaBem()} ${disabled ? textareaBem("disabled") : ""} ${className || ""}`
|
|
6680
7394
|
}, /* @__PURE__ */ React__default.createElement("textarea", {
|
|
7395
|
+
ref: textareaRef,
|
|
6681
7396
|
className: textareaBem("textarea"),
|
|
6682
7397
|
style: {
|
|
6683
7398
|
textAlign,
|
|
6684
|
-
resize: `${autosize ? "vertical" : "none"}`,
|
|
6685
7399
|
...style
|
|
6686
7400
|
},
|
|
6687
7401
|
disabled,
|
|
@@ -6706,7 +7420,7 @@ const TextArea = (props) => {
|
|
|
6706
7420
|
className: textareaBem("limit")
|
|
6707
7421
|
}, inputValue.length, "/", maxlength < 0 ? 0 : maxlength) : null);
|
|
6708
7422
|
};
|
|
6709
|
-
TextArea.defaultProps = defaultProps$
|
|
7423
|
+
TextArea.defaultProps = defaultProps$K;
|
|
6710
7424
|
TextArea.displayName = "NutTextArea";
|
|
6711
7425
|
class UploadOptions {
|
|
6712
7426
|
constructor() {
|
|
@@ -6759,7 +7473,7 @@ class Upload {
|
|
|
6759
7473
|
}
|
|
6760
7474
|
}
|
|
6761
7475
|
}
|
|
6762
|
-
const defaultProps$
|
|
7476
|
+
const defaultProps$J = {
|
|
6763
7477
|
url: "",
|
|
6764
7478
|
maximum: 1,
|
|
6765
7479
|
uploadIcon: "photograph",
|
|
@@ -6834,7 +7548,7 @@ const InternalUploader = (props, ref) => {
|
|
|
6834
7548
|
beforeUpload,
|
|
6835
7549
|
beforeDelete,
|
|
6836
7550
|
...restProps
|
|
6837
|
-
} = { ...defaultProps$
|
|
7551
|
+
} = { ...defaultProps$J, ...props };
|
|
6838
7552
|
const [fileList, setFileList] = useState([]);
|
|
6839
7553
|
const [uploadQueue, setUploadQueue] = useState([]);
|
|
6840
7554
|
useEffect(() => {
|
|
@@ -7133,9 +7847,497 @@ const InternalUploader = (props, ref) => {
|
|
|
7133
7847
|
})));
|
|
7134
7848
|
};
|
|
7135
7849
|
const Uploader = React__default.forwardRef(InternalUploader);
|
|
7136
|
-
Uploader.defaultProps = defaultProps$
|
|
7850
|
+
Uploader.defaultProps = defaultProps$J;
|
|
7137
7851
|
Uploader.displayName = "NutUploader";
|
|
7138
|
-
const defaultProps$
|
|
7852
|
+
const defaultProps$I = {
|
|
7853
|
+
data: {
|
|
7854
|
+
text: "",
|
|
7855
|
+
value: "",
|
|
7856
|
+
paneKey: "",
|
|
7857
|
+
disabled: false,
|
|
7858
|
+
loading: false,
|
|
7859
|
+
children: []
|
|
7860
|
+
},
|
|
7861
|
+
checked: false,
|
|
7862
|
+
chooseItem: () => {
|
|
7863
|
+
}
|
|
7864
|
+
};
|
|
7865
|
+
const InternalCascaderItem = (props) => {
|
|
7866
|
+
const { data, checked, chooseItem } = {
|
|
7867
|
+
...defaultProps$I,
|
|
7868
|
+
...props
|
|
7869
|
+
};
|
|
7870
|
+
const b2 = cn("cascader-item");
|
|
7871
|
+
const classes = classNames(
|
|
7872
|
+
{
|
|
7873
|
+
active: checked,
|
|
7874
|
+
disabled: data.disabled
|
|
7875
|
+
},
|
|
7876
|
+
b2("")
|
|
7877
|
+
);
|
|
7878
|
+
const classesTitle = classNames({
|
|
7879
|
+
[`${b2("")}__title`]: true
|
|
7880
|
+
});
|
|
7881
|
+
useEffect(() => {
|
|
7882
|
+
initData();
|
|
7883
|
+
}, [data]);
|
|
7884
|
+
const initData = () => {
|
|
7885
|
+
};
|
|
7886
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
7887
|
+
className: classes,
|
|
7888
|
+
onClick: () => {
|
|
7889
|
+
chooseItem(data);
|
|
7890
|
+
}
|
|
7891
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
7892
|
+
className: classesTitle
|
|
7893
|
+
}, data.text), data.loading ? /* @__PURE__ */ React__default.createElement(Icon, {
|
|
7894
|
+
color: "#969799",
|
|
7895
|
+
className: "nut-cascader-item__icon-loading",
|
|
7896
|
+
name: "loading"
|
|
7897
|
+
}) : /* @__PURE__ */ React__default.createElement(Icon, {
|
|
7898
|
+
className: `${checked ? b2("icon-check") : ""}`,
|
|
7899
|
+
name: "checklist"
|
|
7900
|
+
}));
|
|
7901
|
+
};
|
|
7902
|
+
const CascaderItem = React__default.forwardRef(InternalCascaderItem);
|
|
7903
|
+
CascaderItem.defaultProps = defaultProps$I;
|
|
7904
|
+
CascaderItem.displayName = "NutCascaderItem";
|
|
7905
|
+
const formatTree = (tree, parent, config2) => tree.map((node) => {
|
|
7906
|
+
const {
|
|
7907
|
+
value: valueKey = "value",
|
|
7908
|
+
text: textKey = "text",
|
|
7909
|
+
children: childrenKey = "children"
|
|
7910
|
+
} = config2;
|
|
7911
|
+
const {
|
|
7912
|
+
[valueKey]: value,
|
|
7913
|
+
[textKey]: text,
|
|
7914
|
+
[childrenKey]: children,
|
|
7915
|
+
...others
|
|
7916
|
+
} = node;
|
|
7917
|
+
const newNode = {
|
|
7918
|
+
loading: false,
|
|
7919
|
+
...others,
|
|
7920
|
+
level: parent ? (parent && parent.level || 0) + 1 : 0,
|
|
7921
|
+
value,
|
|
7922
|
+
text,
|
|
7923
|
+
children,
|
|
7924
|
+
_parent: parent
|
|
7925
|
+
};
|
|
7926
|
+
if (newNode.children && newNode.children.length) {
|
|
7927
|
+
newNode.children = formatTree(newNode.children, newNode, config2);
|
|
7928
|
+
}
|
|
7929
|
+
return newNode;
|
|
7930
|
+
});
|
|
7931
|
+
const eachTree = (tree, cb) => {
|
|
7932
|
+
let i = 0;
|
|
7933
|
+
let node;
|
|
7934
|
+
while (node = tree[i++]) {
|
|
7935
|
+
if (cb(node) === true) {
|
|
7936
|
+
break;
|
|
7937
|
+
}
|
|
7938
|
+
if (node.children && node.children.length) {
|
|
7939
|
+
eachTree(node.children, cb);
|
|
7940
|
+
}
|
|
7941
|
+
}
|
|
7942
|
+
};
|
|
7943
|
+
const defaultConvertConfig = {
|
|
7944
|
+
topId: null,
|
|
7945
|
+
idKey: "id",
|
|
7946
|
+
pidKey: "pid",
|
|
7947
|
+
sortKey: ""
|
|
7948
|
+
};
|
|
7949
|
+
const convertListToOptions = (list, options2) => {
|
|
7950
|
+
const mergedOptions = {
|
|
7951
|
+
...defaultConvertConfig,
|
|
7952
|
+
...options2 || {}
|
|
7953
|
+
};
|
|
7954
|
+
const { topId, idKey, pidKey, sortKey } = mergedOptions;
|
|
7955
|
+
let result = [];
|
|
7956
|
+
let map = {};
|
|
7957
|
+
list.forEach((node) => {
|
|
7958
|
+
node = { ...node };
|
|
7959
|
+
const { [idKey]: id, [pidKey]: pid } = node;
|
|
7960
|
+
const children = map[pid] = map[pid] || [];
|
|
7961
|
+
if (!result.length && pid === topId) {
|
|
7962
|
+
result = children;
|
|
7963
|
+
}
|
|
7964
|
+
children.push(node);
|
|
7965
|
+
node.children = map[id] || (map[id] = []);
|
|
7966
|
+
});
|
|
7967
|
+
if (sortKey) {
|
|
7968
|
+
Object.keys(map).forEach((i) => {
|
|
7969
|
+
if (map[i].length > 1) {
|
|
7970
|
+
map[i].sort((a, b2) => a[sortKey] - b2[sortKey]);
|
|
7971
|
+
}
|
|
7972
|
+
});
|
|
7973
|
+
}
|
|
7974
|
+
map = null;
|
|
7975
|
+
return result;
|
|
7976
|
+
};
|
|
7977
|
+
class Tree {
|
|
7978
|
+
constructor(nodes, config2) {
|
|
7979
|
+
this.isLeaf = (node, lazy) => {
|
|
7980
|
+
const { leaf, children } = node;
|
|
7981
|
+
const hasChildren = Array.isArray(children) && Boolean(children.length);
|
|
7982
|
+
return leaf || !hasChildren && !lazy;
|
|
7983
|
+
};
|
|
7984
|
+
this.hasChildren = (node, lazy) => {
|
|
7985
|
+
const isLeaf = this.isLeaf(node, lazy);
|
|
7986
|
+
if (isLeaf) {
|
|
7987
|
+
return false;
|
|
7988
|
+
}
|
|
7989
|
+
const { children } = node;
|
|
7990
|
+
return Array.isArray(children) && Boolean(children.length);
|
|
7991
|
+
};
|
|
7992
|
+
this.config = {
|
|
7993
|
+
value: "value",
|
|
7994
|
+
text: "text",
|
|
7995
|
+
children: "children",
|
|
7996
|
+
...config2 || {}
|
|
7997
|
+
};
|
|
7998
|
+
this.nodes = formatTree(nodes, null, this.config);
|
|
7999
|
+
}
|
|
8000
|
+
updateChildren(nodes, parent) {
|
|
8001
|
+
if (!parent) {
|
|
8002
|
+
this.nodes = formatTree(nodes, null, this.config);
|
|
8003
|
+
} else {
|
|
8004
|
+
parent.children = formatTree(nodes, parent, this.config);
|
|
8005
|
+
}
|
|
8006
|
+
}
|
|
8007
|
+
getNodeByValue(value) {
|
|
8008
|
+
let foundNode;
|
|
8009
|
+
eachTree(this.nodes, (node) => {
|
|
8010
|
+
if (node.value === value) {
|
|
8011
|
+
foundNode = node;
|
|
8012
|
+
return true;
|
|
8013
|
+
}
|
|
8014
|
+
return null;
|
|
8015
|
+
});
|
|
8016
|
+
return foundNode;
|
|
8017
|
+
}
|
|
8018
|
+
getPathNodesByValue(value) {
|
|
8019
|
+
if (!value.length) {
|
|
8020
|
+
return [];
|
|
8021
|
+
}
|
|
8022
|
+
const pathNodes = [];
|
|
8023
|
+
let currentNodes = this.nodes;
|
|
8024
|
+
while (currentNodes && currentNodes.length) {
|
|
8025
|
+
const foundNode = currentNodes.find(
|
|
8026
|
+
(node) => node.value === value[node.level]
|
|
8027
|
+
);
|
|
8028
|
+
if (!foundNode) {
|
|
8029
|
+
break;
|
|
8030
|
+
}
|
|
8031
|
+
pathNodes.push(foundNode);
|
|
8032
|
+
currentNodes = foundNode.children;
|
|
8033
|
+
}
|
|
8034
|
+
return pathNodes;
|
|
8035
|
+
}
|
|
8036
|
+
}
|
|
8037
|
+
const defaultProps$H = {
|
|
8038
|
+
className: "",
|
|
8039
|
+
style: {},
|
|
8040
|
+
visible: false,
|
|
8041
|
+
options: [],
|
|
8042
|
+
value: [],
|
|
8043
|
+
title: "",
|
|
8044
|
+
textKey: "text",
|
|
8045
|
+
valueKey: "value",
|
|
8046
|
+
childrenKey: "children",
|
|
8047
|
+
convertConfig: {},
|
|
8048
|
+
closeable: false,
|
|
8049
|
+
closeIconPosition: "top-right",
|
|
8050
|
+
closeIcon: "close",
|
|
8051
|
+
lazy: false,
|
|
8052
|
+
lazyLoad: () => {
|
|
8053
|
+
},
|
|
8054
|
+
onClose: () => {
|
|
8055
|
+
},
|
|
8056
|
+
onChange: () => {
|
|
8057
|
+
},
|
|
8058
|
+
onPathChange: () => {
|
|
8059
|
+
},
|
|
8060
|
+
...Popup.defaultProps
|
|
8061
|
+
};
|
|
8062
|
+
const InternalCascader = (props) => {
|
|
8063
|
+
const {
|
|
8064
|
+
className,
|
|
8065
|
+
style,
|
|
8066
|
+
visible,
|
|
8067
|
+
options: options2,
|
|
8068
|
+
value,
|
|
8069
|
+
title,
|
|
8070
|
+
textKey,
|
|
8071
|
+
valueKey,
|
|
8072
|
+
childrenKey,
|
|
8073
|
+
convertConfig: convertConfig2,
|
|
8074
|
+
closeable,
|
|
8075
|
+
closeIconPosition,
|
|
8076
|
+
closeIcon,
|
|
8077
|
+
lazy,
|
|
8078
|
+
lazyLoad,
|
|
8079
|
+
onClose,
|
|
8080
|
+
onChange,
|
|
8081
|
+
onPathChange
|
|
8082
|
+
} = { ...defaultProps$H, ...props };
|
|
8083
|
+
const [tabvalue, setTabvalue] = useState("c1");
|
|
8084
|
+
const [optiosData, setOptiosData] = useState([]);
|
|
8085
|
+
const isLazy = () => state.configs.lazy && Boolean(state.configs.lazyLoad);
|
|
8086
|
+
const [state] = useState({
|
|
8087
|
+
optionsData: [],
|
|
8088
|
+
panes: [
|
|
8089
|
+
{
|
|
8090
|
+
nodes: [],
|
|
8091
|
+
selectedNode: [],
|
|
8092
|
+
paneKey: ""
|
|
8093
|
+
}
|
|
8094
|
+
],
|
|
8095
|
+
innerValue: value,
|
|
8096
|
+
tree: new Tree([], {}),
|
|
8097
|
+
tabsCursor: 0,
|
|
8098
|
+
initLoading: false,
|
|
8099
|
+
currentProcessNode: [],
|
|
8100
|
+
configs: {
|
|
8101
|
+
lazy,
|
|
8102
|
+
lazyLoad,
|
|
8103
|
+
valueKey,
|
|
8104
|
+
textKey,
|
|
8105
|
+
childrenKey,
|
|
8106
|
+
convertConfig: convertConfig2
|
|
8107
|
+
},
|
|
8108
|
+
lazyLoadMap: /* @__PURE__ */ new Map()
|
|
8109
|
+
});
|
|
8110
|
+
const b2 = cn("cascader");
|
|
8111
|
+
const classes = classNames(b2(""));
|
|
8112
|
+
const classesPane = classNames({
|
|
8113
|
+
[`${b2("")}-pane`]: true
|
|
8114
|
+
});
|
|
8115
|
+
useEffect(() => {
|
|
8116
|
+
initData();
|
|
8117
|
+
}, []);
|
|
8118
|
+
useEffect(() => {
|
|
8119
|
+
if (value !== state.innerValue) {
|
|
8120
|
+
state.innerValue = value;
|
|
8121
|
+
}
|
|
8122
|
+
}, [value]);
|
|
8123
|
+
useEffect(() => {
|
|
8124
|
+
initData();
|
|
8125
|
+
}, [options2]);
|
|
8126
|
+
const initData = async () => {
|
|
8127
|
+
state.lazyLoadMap.clear();
|
|
8128
|
+
if (convertConfig2 && Object.keys(convertConfig2).length > 0) {
|
|
8129
|
+
state.optionsData = convertListToOptions(
|
|
8130
|
+
options2,
|
|
8131
|
+
convertConfig2
|
|
8132
|
+
);
|
|
8133
|
+
} else {
|
|
8134
|
+
state.optionsData = options2;
|
|
8135
|
+
}
|
|
8136
|
+
state.tree = new Tree(state.optionsData, {
|
|
8137
|
+
value: state.configs.valueKey,
|
|
8138
|
+
text: state.configs.textKey,
|
|
8139
|
+
children: state.configs.childrenKey
|
|
8140
|
+
});
|
|
8141
|
+
if (isLazy() && !state.tree.nodes.length) {
|
|
8142
|
+
await invokeLazyLoad({
|
|
8143
|
+
root: true,
|
|
8144
|
+
loading: true,
|
|
8145
|
+
text: "",
|
|
8146
|
+
value: ""
|
|
8147
|
+
});
|
|
8148
|
+
}
|
|
8149
|
+
state.panes = [
|
|
8150
|
+
{
|
|
8151
|
+
nodes: state.tree.nodes,
|
|
8152
|
+
selectedNode: null,
|
|
8153
|
+
paneKey: "c1"
|
|
8154
|
+
}
|
|
8155
|
+
];
|
|
8156
|
+
syncValue();
|
|
8157
|
+
setOptiosData(state.panes);
|
|
8158
|
+
};
|
|
8159
|
+
const syncValue = async () => {
|
|
8160
|
+
const currentValue2 = state.innerValue;
|
|
8161
|
+
if (currentValue2 === void 0 || !state.tree.nodes.length) {
|
|
8162
|
+
return;
|
|
8163
|
+
}
|
|
8164
|
+
if (currentValue2.length === 0) {
|
|
8165
|
+
state.tabsCursor = 0;
|
|
8166
|
+
return;
|
|
8167
|
+
}
|
|
8168
|
+
let needToSync = currentValue2;
|
|
8169
|
+
if (isLazy() && Array.isArray(currentValue2) && currentValue2.length) {
|
|
8170
|
+
needToSync = [];
|
|
8171
|
+
const parent = state.tree.nodes.find(
|
|
8172
|
+
(node) => node.value === currentValue2[0]
|
|
8173
|
+
);
|
|
8174
|
+
if (parent) {
|
|
8175
|
+
needToSync = [parent.value];
|
|
8176
|
+
state.initLoading = true;
|
|
8177
|
+
const last = await currentValue2.slice(1).reduce(async (p2, value2) => {
|
|
8178
|
+
var _a;
|
|
8179
|
+
const parent2 = await p2;
|
|
8180
|
+
await invokeLazyLoad(parent2);
|
|
8181
|
+
const node = (_a = parent2 == null ? void 0 : parent2.children) == null ? void 0 : _a.find(
|
|
8182
|
+
(item) => item.value === value2
|
|
8183
|
+
);
|
|
8184
|
+
if (node) {
|
|
8185
|
+
needToSync.push(value2);
|
|
8186
|
+
}
|
|
8187
|
+
return Promise.resolve(node);
|
|
8188
|
+
}, Promise.resolve(parent));
|
|
8189
|
+
await invokeLazyLoad(last);
|
|
8190
|
+
state.initLoading = false;
|
|
8191
|
+
}
|
|
8192
|
+
}
|
|
8193
|
+
if (needToSync.length && currentValue2 === value) {
|
|
8194
|
+
const pathNodes = state.tree.getPathNodesByValue(needToSync);
|
|
8195
|
+
pathNodes.forEach((node, index2) => {
|
|
8196
|
+
state.tabsCursor = index2;
|
|
8197
|
+
chooseItem(node, true);
|
|
8198
|
+
});
|
|
8199
|
+
}
|
|
8200
|
+
};
|
|
8201
|
+
const invokeLazyLoad = async (node) => {
|
|
8202
|
+
if (!node) {
|
|
8203
|
+
return;
|
|
8204
|
+
}
|
|
8205
|
+
if (!state.configs.lazyLoad) {
|
|
8206
|
+
node.leaf = true;
|
|
8207
|
+
return;
|
|
8208
|
+
}
|
|
8209
|
+
if (state.tree.isLeaf(node, isLazy()) || state.tree.hasChildren(node, isLazy())) {
|
|
8210
|
+
return;
|
|
8211
|
+
}
|
|
8212
|
+
node.loading = true;
|
|
8213
|
+
const parent = node.root ? null : node;
|
|
8214
|
+
let lazyLoadPromise = state.lazyLoadMap.get(node);
|
|
8215
|
+
if (!lazyLoadPromise) {
|
|
8216
|
+
lazyLoadPromise = new Promise((resolve) => {
|
|
8217
|
+
var _a, _b;
|
|
8218
|
+
(_b = (_a = state.configs).lazyLoad) == null ? void 0 : _b.call(_a, node, resolve);
|
|
8219
|
+
});
|
|
8220
|
+
state.lazyLoadMap.set(node, lazyLoadPromise);
|
|
8221
|
+
}
|
|
8222
|
+
const nodes = await lazyLoadPromise;
|
|
8223
|
+
if (Array.isArray(nodes) && nodes.length > 0) {
|
|
8224
|
+
state.tree.updateChildren(nodes, parent);
|
|
8225
|
+
} else {
|
|
8226
|
+
node.leaf = true;
|
|
8227
|
+
}
|
|
8228
|
+
node.loading = false;
|
|
8229
|
+
state.lazyLoadMap.delete(node);
|
|
8230
|
+
};
|
|
8231
|
+
const close = () => {
|
|
8232
|
+
onClose && onClose();
|
|
8233
|
+
};
|
|
8234
|
+
const closePopup = () => {
|
|
8235
|
+
close();
|
|
8236
|
+
};
|
|
8237
|
+
const chooseItem = async (node, type) => {
|
|
8238
|
+
if (!type && node.disabled || !state.panes[state.tabsCursor]) {
|
|
8239
|
+
return;
|
|
8240
|
+
}
|
|
8241
|
+
if (state.tree.isLeaf(node, isLazy())) {
|
|
8242
|
+
node.leaf = true;
|
|
8243
|
+
state.panes[state.tabsCursor].selectedNode = node;
|
|
8244
|
+
state.panes = state.panes.slice(0, node.level + 1);
|
|
8245
|
+
if (!type) {
|
|
8246
|
+
const pathNodes = state.panes.map((item) => item.selectedNode);
|
|
8247
|
+
const optionParams = pathNodes.map((item) => item.value);
|
|
8248
|
+
onChange(optionParams, pathNodes);
|
|
8249
|
+
onPathChange(optionParams, pathNodes);
|
|
8250
|
+
}
|
|
8251
|
+
setOptiosData(state.panes);
|
|
8252
|
+
close();
|
|
8253
|
+
return;
|
|
8254
|
+
}
|
|
8255
|
+
if (state.tree.hasChildren(node, isLazy())) {
|
|
8256
|
+
const level = node.level + 1;
|
|
8257
|
+
state.panes[state.tabsCursor].selectedNode = node;
|
|
8258
|
+
state.panes = state.panes.slice(0, level);
|
|
8259
|
+
state.tabsCursor = level;
|
|
8260
|
+
state.panes.push({
|
|
8261
|
+
nodes: node.children || [],
|
|
8262
|
+
selectedNode: null,
|
|
8263
|
+
paneKey: `c${state.tabsCursor + 1}`
|
|
8264
|
+
});
|
|
8265
|
+
setTabvalue(`c${state.tabsCursor + 1}`);
|
|
8266
|
+
setOptiosData(state.panes);
|
|
8267
|
+
if (!type) {
|
|
8268
|
+
const pathNodes = state.panes.map((item) => item.selectedNode);
|
|
8269
|
+
const optionParams = pathNodes.map((item) => item == null ? void 0 : item.value);
|
|
8270
|
+
onPathChange(optionParams, pathNodes);
|
|
8271
|
+
}
|
|
8272
|
+
return;
|
|
8273
|
+
}
|
|
8274
|
+
state.currentProcessNode = node;
|
|
8275
|
+
if (node.loading) {
|
|
8276
|
+
return;
|
|
8277
|
+
}
|
|
8278
|
+
await invokeLazyLoad(node);
|
|
8279
|
+
if (state.currentProcessNode === node) {
|
|
8280
|
+
state.panes[state.tabsCursor].selectedNode = node;
|
|
8281
|
+
chooseItem(node, type);
|
|
8282
|
+
}
|
|
8283
|
+
setOptiosData(state.panes);
|
|
8284
|
+
};
|
|
8285
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
8286
|
+
className: `${classes} ${className}`,
|
|
8287
|
+
style
|
|
8288
|
+
}, /* @__PURE__ */ React__default.createElement(Popup, {
|
|
8289
|
+
popClass: "cascadar-popup",
|
|
8290
|
+
visible,
|
|
8291
|
+
position: "bottom",
|
|
8292
|
+
round: true,
|
|
8293
|
+
closeable,
|
|
8294
|
+
closeIconPosition,
|
|
8295
|
+
closeIcon,
|
|
8296
|
+
onClickOverlay: closePopup,
|
|
8297
|
+
onClickCloseIcon: closePopup
|
|
8298
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
8299
|
+
className: b2("title")
|
|
8300
|
+
}, title), /* @__PURE__ */ React__default.createElement(Tabs, {
|
|
8301
|
+
value: tabvalue,
|
|
8302
|
+
titleNode: () => {
|
|
8303
|
+
return optiosData.map((pane, index2) => {
|
|
8304
|
+
var _a, _b;
|
|
8305
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
8306
|
+
onClick: () => {
|
|
8307
|
+
setTabvalue(pane.paneKey);
|
|
8308
|
+
state.tabsCursor = index2;
|
|
8309
|
+
},
|
|
8310
|
+
className: `nut-tabs__titles-item ${tabvalue === pane.paneKey ? "active" : ""}`,
|
|
8311
|
+
key: pane.paneKey
|
|
8312
|
+
}, /* @__PURE__ */ React__default.createElement("span", {
|
|
8313
|
+
className: "nut-tabs__titles-item__text"
|
|
8314
|
+
}, !state.initLoading && state.panes.length && ((_a = pane == null ? void 0 : pane.selectedNode) == null ? void 0 : _a.text), !state.initLoading && state.panes.length && !((_b = pane == null ? void 0 : pane.selectedNode) == null ? void 0 : _b.text) && "\u8BF7\u9009\u62E9", !(!state.initLoading && state.panes.length) && "Loading..."), /* @__PURE__ */ React__default.createElement("span", {
|
|
8315
|
+
className: "nut-tabs__titles-item__line"
|
|
8316
|
+
}));
|
|
8317
|
+
});
|
|
8318
|
+
}
|
|
8319
|
+
}, !state.initLoading && state.panes.length ? optiosData.map((pane) => /* @__PURE__ */ React__default.createElement(TabPane, {
|
|
8320
|
+
key: pane.paneKey,
|
|
8321
|
+
paneKey: pane.paneKey
|
|
8322
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
8323
|
+
className: classesPane
|
|
8324
|
+
}, pane.nodes && pane.nodes.map((node, index2) => {
|
|
8325
|
+
var _a;
|
|
8326
|
+
return /* @__PURE__ */ React__default.createElement(CascaderItem, {
|
|
8327
|
+
key: index2,
|
|
8328
|
+
...props,
|
|
8329
|
+
data: node,
|
|
8330
|
+
checked: ((_a = pane.selectedNode) == null ? void 0 : _a.value) === node.value,
|
|
8331
|
+
chooseItem: (node2) => chooseItem(node2, false)
|
|
8332
|
+
});
|
|
8333
|
+
})))) : /* @__PURE__ */ React__default.createElement(TabPane, null, /* @__PURE__ */ React__default.createElement("div", {
|
|
8334
|
+
className: classesPane
|
|
8335
|
+
})))));
|
|
8336
|
+
};
|
|
8337
|
+
const Cascader = React__default.forwardRef(InternalCascader);
|
|
8338
|
+
Cascader.defaultProps = defaultProps$H;
|
|
8339
|
+
Cascader.displayName = "NutCascader";
|
|
8340
|
+
const defaultProps$G = {
|
|
7139
8341
|
placeholder: "",
|
|
7140
8342
|
shape: "square",
|
|
7141
8343
|
disabled: false,
|
|
@@ -7182,7 +8384,7 @@ const SearchBar = (props) => {
|
|
|
7182
8384
|
onClickRightinIcon,
|
|
7183
8385
|
onClickRightoutIcon
|
|
7184
8386
|
} = {
|
|
7185
|
-
...defaultProps$
|
|
8387
|
+
...defaultProps$G,
|
|
7186
8388
|
...props
|
|
7187
8389
|
};
|
|
7188
8390
|
const alignClass = `${align}`;
|
|
@@ -7319,9 +8521,9 @@ const SearchBar = (props) => {
|
|
|
7319
8521
|
className: `${searchbarBem("content")}`
|
|
7320
8522
|
}, renderLeftinIcon(), renderField(), renderRightinIcon(), clearable && value && handleClear()), renderRightoutIcon(), renderRightLabel());
|
|
7321
8523
|
};
|
|
7322
|
-
SearchBar.defaultProps = defaultProps$
|
|
8524
|
+
SearchBar.defaultProps = defaultProps$G;
|
|
7323
8525
|
SearchBar.displayName = "NutSearchBar";
|
|
7324
|
-
const defaultProps$
|
|
8526
|
+
const defaultProps$F = {
|
|
7325
8527
|
confirmText: "",
|
|
7326
8528
|
title: "",
|
|
7327
8529
|
visible: false,
|
|
@@ -7519,9 +8721,9 @@ const NumberKeyboard = (props) => {
|
|
|
7519
8721
|
})
|
|
7520
8722
|
}, confirmText || locale.done))) : null))));
|
|
7521
8723
|
};
|
|
7522
|
-
NumberKeyboard.defaultProps = defaultProps$
|
|
8724
|
+
NumberKeyboard.defaultProps = defaultProps$F;
|
|
7523
8725
|
NumberKeyboard.displayName = "NutNumberKeyboard";
|
|
7524
|
-
const defaultProps$
|
|
8726
|
+
const defaultProps$E = {
|
|
7525
8727
|
cancelTxt: "",
|
|
7526
8728
|
optionTag: "name",
|
|
7527
8729
|
optionSubTag: "subname",
|
|
@@ -7554,7 +8756,7 @@ const ActionSheet = (props) => {
|
|
|
7554
8756
|
className,
|
|
7555
8757
|
style,
|
|
7556
8758
|
...rest
|
|
7557
|
-
} = { ...defaultProps$
|
|
8759
|
+
} = { ...defaultProps$E, ...props };
|
|
7558
8760
|
const b2 = cn("actionsheet");
|
|
7559
8761
|
const isHighlight = (item) => {
|
|
7560
8762
|
return props.chooseTagValue && props.chooseTagValue === item[props.optionTag || "name"] ? props.color : "#1a1a1a";
|
|
@@ -7598,9 +8800,9 @@ const ActionSheet = (props) => {
|
|
|
7598
8800
|
onClick: () => cancelActionSheet()
|
|
7599
8801
|
}, cancelTxt)));
|
|
7600
8802
|
};
|
|
7601
|
-
ActionSheet.defaultProps = defaultProps$
|
|
8803
|
+
ActionSheet.defaultProps = defaultProps$E;
|
|
7602
8804
|
ActionSheet.displayName = "NutActionSheet";
|
|
7603
|
-
const defaultProps$
|
|
8805
|
+
const defaultProps$D = {
|
|
7604
8806
|
bottom: 20,
|
|
7605
8807
|
right: 10,
|
|
7606
8808
|
elId: "body",
|
|
@@ -7623,7 +8825,7 @@ const BackTop = (props) => {
|
|
|
7623
8825
|
style,
|
|
7624
8826
|
onClick
|
|
7625
8827
|
} = {
|
|
7626
|
-
...defaultProps$
|
|
8828
|
+
...defaultProps$D,
|
|
7627
8829
|
...props
|
|
7628
8830
|
};
|
|
7629
8831
|
const [backTop, SetBackTop] = useState(false);
|
|
@@ -7712,7 +8914,7 @@ const BackTop = (props) => {
|
|
|
7712
8914
|
name: "top"
|
|
7713
8915
|
}));
|
|
7714
8916
|
};
|
|
7715
|
-
BackTop.defaultProps = defaultProps$
|
|
8917
|
+
BackTop.defaultProps = defaultProps$D;
|
|
7716
8918
|
BackTop.displayName = "NutBackTop";
|
|
7717
8919
|
function clamp(v2, min, max) {
|
|
7718
8920
|
return Math.max(min, Math.min(v2, max));
|
|
@@ -12116,7 +13318,7 @@ const host = createHost(primitives, {
|
|
|
12116
13318
|
}
|
|
12117
13319
|
});
|
|
12118
13320
|
const animated = host.animated;
|
|
12119
|
-
const defaultProps$
|
|
13321
|
+
const defaultProps$C = {
|
|
12120
13322
|
attract: false,
|
|
12121
13323
|
direction: void 0,
|
|
12122
13324
|
boundary: {
|
|
@@ -12129,7 +13331,7 @@ const defaultProps$z = {
|
|
|
12129
13331
|
};
|
|
12130
13332
|
const Drag = (props) => {
|
|
12131
13333
|
const { attract, direction, boundary, children, className, style, ...reset } = {
|
|
12132
|
-
...defaultProps$
|
|
13334
|
+
...defaultProps$C,
|
|
12133
13335
|
...props
|
|
12134
13336
|
};
|
|
12135
13337
|
const b2 = cn("drag");
|
|
@@ -12191,7 +13393,7 @@ const Drag = (props) => {
|
|
|
12191
13393
|
...bind()
|
|
12192
13394
|
}, children));
|
|
12193
13395
|
};
|
|
12194
|
-
Drag.defaultProps = defaultProps$
|
|
13396
|
+
Drag.defaultProps = defaultProps$C;
|
|
12195
13397
|
Drag.displayName = "NutDrag";
|
|
12196
13398
|
const Content = (props) => {
|
|
12197
13399
|
const {
|
|
@@ -12312,13 +13514,13 @@ const normalizeConfig = (_config) => {
|
|
|
12312
13514
|
function confirm(config2, renderFunc) {
|
|
12313
13515
|
const div = document.createElement("div");
|
|
12314
13516
|
document.body.appendChild(div);
|
|
12315
|
-
function
|
|
13517
|
+
function render2(props) {
|
|
12316
13518
|
ReactDOM__default.render(/* @__PURE__ */ React__default.createElement(ConfirmDialog, {
|
|
12317
13519
|
...props,
|
|
12318
13520
|
onCancel
|
|
12319
13521
|
}), div);
|
|
12320
13522
|
}
|
|
12321
|
-
const renderFunction = renderFunc ||
|
|
13523
|
+
const renderFunction = renderFunc || render2;
|
|
12322
13524
|
let dialogConfig = {
|
|
12323
13525
|
...config2,
|
|
12324
13526
|
visible: false
|
|
@@ -12386,9 +13588,9 @@ function confirm(config2, renderFunc) {
|
|
|
12386
13588
|
update: update2
|
|
12387
13589
|
};
|
|
12388
13590
|
}
|
|
12389
|
-
const defaultProps$
|
|
12390
|
-
okText: "",
|
|
12391
|
-
cancelText: "",
|
|
13591
|
+
const defaultProps$B = {
|
|
13592
|
+
okText: "\u786E\u8BA4",
|
|
13593
|
+
cancelText: "\u53D6\u6D88",
|
|
12392
13594
|
mask: true,
|
|
12393
13595
|
closeOnClickOverlay: true,
|
|
12394
13596
|
noFooter: false,
|
|
@@ -12401,10 +13603,10 @@ const defaultProps$y = {
|
|
|
12401
13603
|
lockScroll: false
|
|
12402
13604
|
};
|
|
12403
13605
|
const BaseDialog = (props, ref) => {
|
|
12404
|
-
const { locale } = useConfig();
|
|
12405
13606
|
const {
|
|
12406
13607
|
visible,
|
|
12407
13608
|
footer,
|
|
13609
|
+
noFooter,
|
|
12408
13610
|
noOkBtn,
|
|
12409
13611
|
noCancelBtn,
|
|
12410
13612
|
lockScroll,
|
|
@@ -12418,9 +13620,9 @@ const BaseDialog = (props, ref) => {
|
|
|
12418
13620
|
...restProps
|
|
12419
13621
|
} = props;
|
|
12420
13622
|
const renderFooter = function() {
|
|
12421
|
-
if (footer === null)
|
|
13623
|
+
if (footer === null || noFooter)
|
|
12422
13624
|
return "";
|
|
12423
|
-
const handleCancel =
|
|
13625
|
+
const handleCancel = (e2) => {
|
|
12424
13626
|
e2.stopPropagation();
|
|
12425
13627
|
if (!cancelAutoClose)
|
|
12426
13628
|
return;
|
|
@@ -12430,7 +13632,7 @@ const BaseDialog = (props, ref) => {
|
|
|
12430
13632
|
document.body.classList.remove("nut-overflow-hidden");
|
|
12431
13633
|
}
|
|
12432
13634
|
};
|
|
12433
|
-
const handleOk =
|
|
13635
|
+
const handleOk = (e2) => {
|
|
12434
13636
|
e2.stopPropagation();
|
|
12435
13637
|
onClosed == null ? void 0 : onClosed();
|
|
12436
13638
|
onOk == null ? void 0 : onOk(e2);
|
|
@@ -12443,16 +13645,16 @@ const BaseDialog = (props, ref) => {
|
|
|
12443
13645
|
plain: true,
|
|
12444
13646
|
type: "primary",
|
|
12445
13647
|
className: "nut-dialog__footer-cancel",
|
|
12446
|
-
onClick:
|
|
12447
|
-
}, cancelText
|
|
13648
|
+
onClick: handleCancel
|
|
13649
|
+
}, cancelText), !noOkBtn && /* @__PURE__ */ React__default.createElement(Button, {
|
|
12448
13650
|
size: "small",
|
|
12449
13651
|
type: "primary",
|
|
12450
13652
|
className: classNames("nut-dialog__footer-ok", {
|
|
12451
13653
|
disabled: okBtnDisabled
|
|
12452
13654
|
}),
|
|
12453
13655
|
disabled: okBtnDisabled,
|
|
12454
|
-
onClick:
|
|
12455
|
-
}, okText
|
|
13656
|
+
onClick: handleOk
|
|
13657
|
+
}, okText));
|
|
12456
13658
|
return footerContent;
|
|
12457
13659
|
};
|
|
12458
13660
|
return /* @__PURE__ */ React__default.createElement(DialogWrapper, {
|
|
@@ -12477,9 +13679,9 @@ Dialog.confirm = (props) => {
|
|
|
12477
13679
|
});
|
|
12478
13680
|
};
|
|
12479
13681
|
});
|
|
12480
|
-
Dialog.defaultProps = defaultProps$
|
|
13682
|
+
Dialog.defaultProps = defaultProps$B;
|
|
12481
13683
|
Dialog.displayName = "NutDialog";
|
|
12482
|
-
const defaultProps$
|
|
13684
|
+
const defaultProps$A = {
|
|
12483
13685
|
hasMore: true,
|
|
12484
13686
|
threshold: 200,
|
|
12485
13687
|
containerId: "",
|
|
@@ -12513,7 +13715,7 @@ const Infiniteloading = (props) => {
|
|
|
12513
13715
|
scrollChange,
|
|
12514
13716
|
...restProps
|
|
12515
13717
|
} = {
|
|
12516
|
-
...defaultProps$
|
|
13718
|
+
...defaultProps$A,
|
|
12517
13719
|
...props
|
|
12518
13720
|
};
|
|
12519
13721
|
const [isInfiniting, setIsInfiniting] = useState(false);
|
|
@@ -12673,7 +13875,7 @@ const Infiniteloading = (props) => {
|
|
|
12673
13875
|
className: "tips"
|
|
12674
13876
|
}, loadMoreTxt || locale.infiniteloading.loadMoreText)));
|
|
12675
13877
|
};
|
|
12676
|
-
Infiniteloading.defaultProps = defaultProps$
|
|
13878
|
+
Infiniteloading.defaultProps = defaultProps$A;
|
|
12677
13879
|
Infiniteloading.displayName = "NutInfiniteloading";
|
|
12678
13880
|
class Notification extends React.PureComponent {
|
|
12679
13881
|
constructor(props) {
|
|
@@ -12780,7 +13982,7 @@ Notification.newInstance = (properties, callback) => {
|
|
|
12780
13982
|
}
|
|
12781
13983
|
});
|
|
12782
13984
|
}
|
|
12783
|
-
|
|
13985
|
+
render(/* @__PURE__ */ React.createElement(Notification, {
|
|
12784
13986
|
...properties,
|
|
12785
13987
|
ref
|
|
12786
13988
|
}), element);
|
|
@@ -12848,7 +14050,7 @@ var Notify = {
|
|
|
12848
14050
|
}
|
|
12849
14051
|
}
|
|
12850
14052
|
};
|
|
12851
|
-
const defaultProps$
|
|
14053
|
+
const defaultProps$z = {
|
|
12852
14054
|
isAsync: false,
|
|
12853
14055
|
checked: false,
|
|
12854
14056
|
disable: false,
|
|
@@ -12871,7 +14073,7 @@ const Switch = (props) => {
|
|
|
12871
14073
|
className,
|
|
12872
14074
|
style
|
|
12873
14075
|
} = {
|
|
12874
|
-
...defaultProps$
|
|
14076
|
+
...defaultProps$z,
|
|
12875
14077
|
...props
|
|
12876
14078
|
};
|
|
12877
14079
|
const [value, setValue] = useState(false);
|
|
@@ -12882,39 +14084,223 @@ const Switch = (props) => {
|
|
|
12882
14084
|
const classes = () => {
|
|
12883
14085
|
return `${b2()} ${value ? "switch-open" : "switch-close"} ${disable ? `${b2()}-disable` : ""} ${`${b2()}-base`} ${className}`;
|
|
12884
14086
|
};
|
|
12885
|
-
const styles = () => {
|
|
12886
|
-
const myStyle = {
|
|
12887
|
-
backgroundColor: value ? activeColor : inactiveColor,
|
|
12888
|
-
...style || {}
|
|
12889
|
-
};
|
|
12890
|
-
return myStyle;
|
|
14087
|
+
const styles = () => {
|
|
14088
|
+
const myStyle = {
|
|
14089
|
+
backgroundColor: value ? activeColor : inactiveColor,
|
|
14090
|
+
...style || {}
|
|
14091
|
+
};
|
|
14092
|
+
return myStyle;
|
|
14093
|
+
};
|
|
14094
|
+
const onClick = (event) => {
|
|
14095
|
+
if (disable)
|
|
14096
|
+
return;
|
|
14097
|
+
if (!isAsync) {
|
|
14098
|
+
setValue(!value);
|
|
14099
|
+
}
|
|
14100
|
+
change && change(!value, event);
|
|
14101
|
+
};
|
|
14102
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
14103
|
+
className: classes(),
|
|
14104
|
+
onClick: (e2) => onClick(e2),
|
|
14105
|
+
style: styles()
|
|
14106
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
14107
|
+
className: "switch-button"
|
|
14108
|
+
}, !value && /* @__PURE__ */ React__default.createElement("div", {
|
|
14109
|
+
className: "close-line"
|
|
14110
|
+
}), activeText && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, value ? /* @__PURE__ */ React__default.createElement("div", {
|
|
14111
|
+
className: `${b2("label")} open`
|
|
14112
|
+
}, activeText) : /* @__PURE__ */ React__default.createElement("div", {
|
|
14113
|
+
className: `${b2("label")} close`
|
|
14114
|
+
}, inactiveText))));
|
|
14115
|
+
};
|
|
14116
|
+
Switch.defaultProps = defaultProps$z;
|
|
14117
|
+
Switch.displayName = "NutSwitch";
|
|
14118
|
+
function preventDefault(event, isStopPropagation) {
|
|
14119
|
+
if (typeof event.cancelable !== "boolean" || event.cancelable) {
|
|
14120
|
+
event.preventDefault();
|
|
14121
|
+
}
|
|
14122
|
+
if (isStopPropagation) {
|
|
14123
|
+
event.stopPropagation();
|
|
14124
|
+
}
|
|
14125
|
+
}
|
|
14126
|
+
const defaultProps$y = {
|
|
14127
|
+
name: "",
|
|
14128
|
+
leftWidth: 0,
|
|
14129
|
+
rightWidth: 0
|
|
14130
|
+
};
|
|
14131
|
+
const Swipe = forwardRef((props, instanceRef) => {
|
|
14132
|
+
const swipeBem = cn("swipe");
|
|
14133
|
+
const touch = useTouch();
|
|
14134
|
+
const { children, className, style } = { ...defaultProps$y, ...props };
|
|
14135
|
+
const root = useRef();
|
|
14136
|
+
const opened = useRef(false);
|
|
14137
|
+
const lockClick = useRef(false);
|
|
14138
|
+
const startOffset = useRef(0);
|
|
14139
|
+
const [state, setState] = useState({
|
|
14140
|
+
offset: 0,
|
|
14141
|
+
dragging: false
|
|
14142
|
+
});
|
|
14143
|
+
const [actionWidth, setActionWidth] = useState({
|
|
14144
|
+
left: 0,
|
|
14145
|
+
right: 0
|
|
14146
|
+
});
|
|
14147
|
+
const wrapperStyle = {
|
|
14148
|
+
transform: `translate3d(${state.offset}px, 0, 0)`,
|
|
14149
|
+
transitionDuration: state.dragging ? "0s" : ".6s"
|
|
14150
|
+
};
|
|
14151
|
+
const leftWidth = useMemo(
|
|
14152
|
+
() => props.leftWidth ? props.leftWidth : actionWidth.left,
|
|
14153
|
+
[props.leftWidth, actionWidth.left]
|
|
14154
|
+
);
|
|
14155
|
+
const rightWidth = useMemo(
|
|
14156
|
+
() => props.rightWidth ? props.rightWidth : actionWidth.right,
|
|
14157
|
+
[props.rightWidth, actionWidth.right]
|
|
14158
|
+
);
|
|
14159
|
+
const onTouchStart = (event) => {
|
|
14160
|
+
if (!props.disabled) {
|
|
14161
|
+
startOffset.current = state.offset;
|
|
14162
|
+
touch.start(event);
|
|
14163
|
+
}
|
|
14164
|
+
};
|
|
14165
|
+
const onTouchMove = (event) => {
|
|
14166
|
+
if (props.disabled) {
|
|
14167
|
+
return;
|
|
14168
|
+
}
|
|
14169
|
+
touch.move(event);
|
|
14170
|
+
if (touch.isHorizontal()) {
|
|
14171
|
+
lockClick.current = true;
|
|
14172
|
+
const newState = { ...state, dragging: true };
|
|
14173
|
+
const isEdge = !opened || touch.deltaX * startOffset.current < 0;
|
|
14174
|
+
if (isEdge) {
|
|
14175
|
+
preventDefault(event, true);
|
|
14176
|
+
}
|
|
14177
|
+
newState.offset = rangeCalculation(
|
|
14178
|
+
touch.deltaX + startOffset.current,
|
|
14179
|
+
-rightWidth,
|
|
14180
|
+
leftWidth
|
|
14181
|
+
);
|
|
14182
|
+
setState(newState);
|
|
14183
|
+
}
|
|
14184
|
+
};
|
|
14185
|
+
const onTouchEnd = () => {
|
|
14186
|
+
if (state.dragging) {
|
|
14187
|
+
setState((v2) => ({ ...v2, dragging: false }));
|
|
14188
|
+
toggle(state.offset > 0 ? "left" : "right");
|
|
14189
|
+
setTimeout(() => {
|
|
14190
|
+
lockClick.current = false;
|
|
14191
|
+
}, 0);
|
|
14192
|
+
}
|
|
14193
|
+
};
|
|
14194
|
+
const toggle = (side) => {
|
|
14195
|
+
const offset = Math.abs(state.offset);
|
|
14196
|
+
const base = 0.3;
|
|
14197
|
+
const baseNum = opened ? 1 - base : base;
|
|
14198
|
+
const width = side === "left" ? leftWidth : rightWidth;
|
|
14199
|
+
if (width && offset > Number(width) * baseNum) {
|
|
14200
|
+
open(side);
|
|
14201
|
+
} else {
|
|
14202
|
+
close(side);
|
|
14203
|
+
}
|
|
14204
|
+
};
|
|
14205
|
+
const open = (side) => {
|
|
14206
|
+
var _a;
|
|
14207
|
+
opened.current = true;
|
|
14208
|
+
const offset = side === "left" ? leftWidth : -rightWidth;
|
|
14209
|
+
const name = props.name;
|
|
14210
|
+
(_a = props.onOpen) == null ? void 0 : _a.call(props, { name, position: side });
|
|
14211
|
+
setState((v2) => ({ ...v2, offset: Number(offset) || 0 }));
|
|
14212
|
+
};
|
|
14213
|
+
const close = (position) => {
|
|
14214
|
+
var _a;
|
|
14215
|
+
if (opened.current) {
|
|
14216
|
+
opened.current = false;
|
|
14217
|
+
(_a = props.onClose) == null ? void 0 : _a.call(props, {
|
|
14218
|
+
name: props.name,
|
|
14219
|
+
position: position || "left"
|
|
14220
|
+
});
|
|
14221
|
+
}
|
|
14222
|
+
setState((v2) => ({ ...v2, offset: 0 }));
|
|
14223
|
+
};
|
|
14224
|
+
const rangeCalculation = (num, min, max) => {
|
|
14225
|
+
return Math.min(Math.max(Number(num), Number(min)), Number(max));
|
|
12891
14226
|
};
|
|
12892
|
-
const
|
|
12893
|
-
if (
|
|
12894
|
-
|
|
12895
|
-
|
|
12896
|
-
|
|
14227
|
+
const getNodeWidth = (node) => {
|
|
14228
|
+
if (node) {
|
|
14229
|
+
const ele = getRect(node);
|
|
14230
|
+
return ele.width;
|
|
14231
|
+
}
|
|
14232
|
+
return 0;
|
|
14233
|
+
};
|
|
14234
|
+
const leftRef = useCallback(
|
|
14235
|
+
(node) => {
|
|
14236
|
+
if (node !== null) {
|
|
14237
|
+
setActionWidth((v2) => ({ ...v2, left: getNodeWidth(node) }));
|
|
14238
|
+
}
|
|
14239
|
+
},
|
|
14240
|
+
[props.leftAction]
|
|
14241
|
+
);
|
|
14242
|
+
const rightRef = useCallback(
|
|
14243
|
+
(node) => {
|
|
14244
|
+
if (node !== null) {
|
|
14245
|
+
setActionWidth((v2) => ({ ...v2, right: getNodeWidth(node) }));
|
|
14246
|
+
}
|
|
14247
|
+
},
|
|
14248
|
+
[props.rightAction]
|
|
14249
|
+
);
|
|
14250
|
+
const renderActionContent = (side, measuredRef) => {
|
|
14251
|
+
if (props[`${side}Action`]) {
|
|
14252
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
14253
|
+
ref: measuredRef,
|
|
14254
|
+
className: `${swipeBem(side)}`,
|
|
14255
|
+
onClick: (e2) => handleOperate(e2, side)
|
|
14256
|
+
}, props[`${side}Action`]);
|
|
14257
|
+
}
|
|
14258
|
+
return null;
|
|
14259
|
+
};
|
|
14260
|
+
const handleOperate = (event, position) => {
|
|
14261
|
+
event.stopPropagation();
|
|
14262
|
+
if (props.beforeClose) {
|
|
14263
|
+
props.beforeClose(position);
|
|
14264
|
+
} else {
|
|
14265
|
+
props.onActionClick && props.onActionClick(event, position);
|
|
12897
14266
|
}
|
|
12898
|
-
change && change(!value, event);
|
|
12899
14267
|
};
|
|
14268
|
+
useImperativeHandle(instanceRef, () => ({
|
|
14269
|
+
open,
|
|
14270
|
+
close: () => close()
|
|
14271
|
+
}));
|
|
14272
|
+
useEffect(() => {
|
|
14273
|
+
const handler = (event) => {
|
|
14274
|
+
const targets = [root];
|
|
14275
|
+
if (targets.some((targetItem) => {
|
|
14276
|
+
const targetElement = targetItem.current || targetItem;
|
|
14277
|
+
return !targetElement || (targetElement == null ? void 0 : targetElement.contains(event.target));
|
|
14278
|
+
})) {
|
|
14279
|
+
return;
|
|
14280
|
+
}
|
|
14281
|
+
close();
|
|
14282
|
+
};
|
|
14283
|
+
document.addEventListener("touchstart", handler);
|
|
14284
|
+
return () => {
|
|
14285
|
+
document.removeEventListener("touchstart", handler);
|
|
14286
|
+
};
|
|
14287
|
+
}, []);
|
|
12900
14288
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
12901
|
-
|
|
12902
|
-
|
|
12903
|
-
|
|
14289
|
+
ref: root,
|
|
14290
|
+
className: `${swipeBem()} ${className}`,
|
|
14291
|
+
onTouchStart: (e2) => onTouchStart(e2),
|
|
14292
|
+
onTouchMove: (e2) => onTouchMove(e2),
|
|
14293
|
+
onTouchEnd,
|
|
14294
|
+
style
|
|
12904
14295
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
12905
|
-
className: "
|
|
12906
|
-
|
|
12907
|
-
|
|
12908
|
-
|
|
12909
|
-
|
|
12910
|
-
|
|
12911
|
-
className: `${b2("label")} close`
|
|
12912
|
-
}, inactiveText))));
|
|
12913
|
-
};
|
|
12914
|
-
Switch.defaultProps = defaultProps$w;
|
|
12915
|
-
Switch.displayName = "NutSwitch";
|
|
14296
|
+
className: `${swipeBem("wrapper")}`,
|
|
14297
|
+
style: wrapperStyle
|
|
14298
|
+
}, renderActionContent("left", leftRef), children, renderActionContent("right", rightRef)));
|
|
14299
|
+
});
|
|
14300
|
+
Swipe.defaultProps = defaultProps$y;
|
|
14301
|
+
Swipe.displayName = "NutSwipe";
|
|
12916
14302
|
const isObject = (val) => val !== null && typeof val === "object";
|
|
12917
|
-
const defaultProps$
|
|
14303
|
+
const defaultProps$x = {
|
|
12918
14304
|
strokeWidth: 5,
|
|
12919
14305
|
radius: 50,
|
|
12920
14306
|
strokeLinecap: "round",
|
|
@@ -12937,7 +14323,7 @@ const CircleProgress = (props) => {
|
|
|
12937
14323
|
strokeLinecap,
|
|
12938
14324
|
...restProps
|
|
12939
14325
|
} = {
|
|
12940
|
-
...defaultProps$
|
|
14326
|
+
...defaultProps$x,
|
|
12941
14327
|
...props
|
|
12942
14328
|
};
|
|
12943
14329
|
const b2 = cn("circleprogress");
|
|
@@ -13023,9 +14409,9 @@ const CircleProgress = (props) => {
|
|
|
13023
14409
|
className: "nut-circleprogress-text"
|
|
13024
14410
|
}, children || /* @__PURE__ */ React__default.createElement("div", null, progress, "%")));
|
|
13025
14411
|
};
|
|
13026
|
-
CircleProgress.defaultProps = defaultProps$
|
|
14412
|
+
CircleProgress.defaultProps = defaultProps$x;
|
|
13027
14413
|
CircleProgress.displayName = "NutCircleProgress";
|
|
13028
|
-
const defaultProps$
|
|
14414
|
+
const defaultProps$w = {
|
|
13029
14415
|
direction: "across",
|
|
13030
14416
|
list: [],
|
|
13031
14417
|
standTime: 1e3,
|
|
@@ -13063,7 +14449,7 @@ const NoticeBar = (props) => {
|
|
|
13063
14449
|
rightIcon,
|
|
13064
14450
|
close,
|
|
13065
14451
|
click
|
|
13066
|
-
} = { ...defaultProps$
|
|
14452
|
+
} = { ...defaultProps$w, ...props };
|
|
13067
14453
|
const wrap = useRef(null);
|
|
13068
14454
|
const content = useRef(null);
|
|
13069
14455
|
const [showNoticeBar, SetShowNoticeBar] = useState(true);
|
|
@@ -13128,8 +14514,8 @@ const NoticeBar = (props) => {
|
|
|
13128
14514
|
if (!wrap.current || !content.current) {
|
|
13129
14515
|
return;
|
|
13130
14516
|
}
|
|
13131
|
-
const wrapW = wrap.current
|
|
13132
|
-
const offsetW = content.current
|
|
14517
|
+
const wrapW = getRect(wrap.current).width;
|
|
14518
|
+
const offsetW = getRect(content.current).width;
|
|
13133
14519
|
const canScroll = scrollable == null ? offsetW > wrapW : scrollable;
|
|
13134
14520
|
SetIsCanScroll(canScroll);
|
|
13135
14521
|
if (canScroll) {
|
|
@@ -13303,16 +14689,16 @@ const NoticeBar = (props) => {
|
|
|
13303
14689
|
size: "11px"
|
|
13304
14690
|
}) : null))) : null);
|
|
13305
14691
|
};
|
|
13306
|
-
NoticeBar.defaultProps = defaultProps$
|
|
14692
|
+
NoticeBar.defaultProps = defaultProps$w;
|
|
13307
14693
|
NoticeBar.displayName = "NutNoticeBar";
|
|
13308
14694
|
const DataContext$1 = createContext({});
|
|
13309
|
-
const defaultProps$
|
|
14695
|
+
const defaultProps$v = {
|
|
13310
14696
|
current: 0,
|
|
13311
14697
|
direction: "horizontal",
|
|
13312
14698
|
progressDot: false
|
|
13313
14699
|
};
|
|
13314
14700
|
const Steps = (props) => {
|
|
13315
|
-
const propSteps = { ...defaultProps$
|
|
14701
|
+
const propSteps = { ...defaultProps$v, ...props };
|
|
13316
14702
|
const {
|
|
13317
14703
|
children,
|
|
13318
14704
|
current,
|
|
@@ -13345,9 +14731,9 @@ const Steps = (props) => {
|
|
|
13345
14731
|
children
|
|
13346
14732
|
));
|
|
13347
14733
|
};
|
|
13348
|
-
Steps.defaultProps = defaultProps$
|
|
14734
|
+
Steps.defaultProps = defaultProps$v;
|
|
13349
14735
|
Steps.displayName = "NutSteps";
|
|
13350
|
-
const defaultProps$
|
|
14736
|
+
const defaultProps$u = {
|
|
13351
14737
|
title: "",
|
|
13352
14738
|
content: "",
|
|
13353
14739
|
activeIndex: 0,
|
|
@@ -13368,7 +14754,7 @@ const Step = (props) => {
|
|
|
13368
14754
|
renderContent,
|
|
13369
14755
|
...restProps
|
|
13370
14756
|
} = {
|
|
13371
|
-
...defaultProps$
|
|
14757
|
+
...defaultProps$u,
|
|
13372
14758
|
...props
|
|
13373
14759
|
};
|
|
13374
14760
|
const parent = useContext$1(DataContext$1);
|
|
@@ -13429,10 +14815,10 @@ const Step = (props) => {
|
|
|
13429
14815
|
className: "nut-step-content"
|
|
13430
14816
|
}, renderContent())));
|
|
13431
14817
|
};
|
|
13432
|
-
Step.defaultProps = defaultProps$
|
|
14818
|
+
Step.defaultProps = defaultProps$u;
|
|
13433
14819
|
Step.displayName = "NutStep";
|
|
13434
14820
|
const DataContext = createContext({});
|
|
13435
|
-
const defaultProps$
|
|
14821
|
+
const defaultProps$t = {
|
|
13436
14822
|
width: typeof window === "object" ? window.innerWidth : 375,
|
|
13437
14823
|
height: 0,
|
|
13438
14824
|
duration: 500,
|
|
@@ -13450,7 +14836,7 @@ const defaultProps$r = {
|
|
|
13450
14836
|
};
|
|
13451
14837
|
const DISTANCE = 5;
|
|
13452
14838
|
const Swiper = React__default.forwardRef((props, ref) => {
|
|
13453
|
-
const propSwiper = { ...defaultProps$
|
|
14839
|
+
const propSwiper = { ...defaultProps$t, ...props };
|
|
13454
14840
|
const {
|
|
13455
14841
|
children,
|
|
13456
14842
|
direction,
|
|
@@ -13754,7 +15140,7 @@ const Swiper = React__default.forwardRef((props, ref) => {
|
|
|
13754
15140
|
_swiper.current.activePagination = (active + childCount) % childCount;
|
|
13755
15141
|
}, [active]);
|
|
13756
15142
|
const init = (active2 = +propSwiper.initPage) => {
|
|
13757
|
-
const rect2 = container.current
|
|
15143
|
+
const rect2 = getRect(container == null ? void 0 : container.current);
|
|
13758
15144
|
const _active = Math.max(Math.min(childCount - 1, active2), 0);
|
|
13759
15145
|
const _width = propSwiper.width ? +propSwiper.width : rect2.width;
|
|
13760
15146
|
const _height = propSwiper.height ? +propSwiper.height : rect2.height;
|
|
@@ -13860,13 +15246,13 @@ const Swiper = React__default.forwardRef((props, ref) => {
|
|
|
13860
15246
|
});
|
|
13861
15247
|
})) : /* @__PURE__ */ React__default.createElement("div", null, pageContent)));
|
|
13862
15248
|
});
|
|
13863
|
-
Swiper.defaultProps = defaultProps$
|
|
15249
|
+
Swiper.defaultProps = defaultProps$t;
|
|
13864
15250
|
Swiper.displayName = "NutSwiper";
|
|
13865
|
-
const defaultProps$
|
|
15251
|
+
const defaultProps$s = {
|
|
13866
15252
|
direction: "horizontal"
|
|
13867
15253
|
};
|
|
13868
15254
|
const SwiperItem = React__default.forwardRef((props, ref) => {
|
|
13869
|
-
const _props = { ...defaultProps$
|
|
15255
|
+
const _props = { ...defaultProps$s, ...props };
|
|
13870
15256
|
const { children, direction, size } = _props;
|
|
13871
15257
|
const parent = useContext$1(DataContext);
|
|
13872
15258
|
const b2 = cn("swiper-item");
|
|
@@ -13885,10 +15271,10 @@ const SwiperItem = React__default.forwardRef((props, ref) => {
|
|
|
13885
15271
|
style: style()
|
|
13886
15272
|
}, children);
|
|
13887
15273
|
});
|
|
13888
|
-
SwiperItem.defaultProps = defaultProps$
|
|
15274
|
+
SwiperItem.defaultProps = defaultProps$s;
|
|
13889
15275
|
SwiperItem.displayName = "NutSwiperItem";
|
|
13890
15276
|
const AvatarContext = createContext({});
|
|
13891
|
-
const defaultProps$
|
|
15277
|
+
const defaultProps$r = {
|
|
13892
15278
|
size: "",
|
|
13893
15279
|
icon: "",
|
|
13894
15280
|
bgColor: "#eee",
|
|
@@ -13915,7 +15301,7 @@ const Avatar = (props) => {
|
|
|
13915
15301
|
onError,
|
|
13916
15302
|
...rest
|
|
13917
15303
|
} = {
|
|
13918
|
-
...defaultProps$
|
|
15304
|
+
...defaultProps$r,
|
|
13919
15305
|
...props
|
|
13920
15306
|
};
|
|
13921
15307
|
const [maxSum, setMaxSum] = useState(0);
|
|
@@ -13996,9 +15382,9 @@ const Avatar = (props) => {
|
|
|
13996
15382
|
className: "text"
|
|
13997
15383
|
}, ((_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.maxCount)}`)));
|
|
13998
15384
|
};
|
|
13999
|
-
Avatar.defaultProps = defaultProps$
|
|
15385
|
+
Avatar.defaultProps = defaultProps$r;
|
|
14000
15386
|
Avatar.displayName = "NutAvatar";
|
|
14001
|
-
const defaultProps$
|
|
15387
|
+
const defaultProps$q = {
|
|
14002
15388
|
maxContent: "",
|
|
14003
15389
|
maxCount: "",
|
|
14004
15390
|
maxBgColor: "#eee",
|
|
@@ -14010,7 +15396,7 @@ const defaultProps$o = {
|
|
|
14010
15396
|
};
|
|
14011
15397
|
const AvatarGroup = (props) => {
|
|
14012
15398
|
useConfig();
|
|
14013
|
-
const propAvatarGroup = { ...defaultProps$
|
|
15399
|
+
const propAvatarGroup = { ...defaultProps$q, ...props };
|
|
14014
15400
|
const { className, style, children } = propAvatarGroup;
|
|
14015
15401
|
const avatarGroupRef = useRef(null);
|
|
14016
15402
|
const b2 = cn("avatar-group");
|
|
@@ -14027,9 +15413,9 @@ const AvatarGroup = (props) => {
|
|
|
14027
15413
|
ref: avatarGroupRef
|
|
14028
15414
|
}, children));
|
|
14029
15415
|
};
|
|
14030
|
-
AvatarGroup.defaultProps = defaultProps$
|
|
15416
|
+
AvatarGroup.defaultProps = defaultProps$q;
|
|
14031
15417
|
AvatarGroup.displayName = "NutAvatarGroup";
|
|
14032
|
-
const defaultProps$
|
|
15418
|
+
const defaultProps$p = {
|
|
14033
15419
|
price: 0,
|
|
14034
15420
|
needSymbol: true,
|
|
14035
15421
|
symbol: "¥",
|
|
@@ -14047,7 +15433,7 @@ const Price = (props) => {
|
|
|
14047
15433
|
className,
|
|
14048
15434
|
...rest
|
|
14049
15435
|
} = {
|
|
14050
|
-
...defaultProps$
|
|
15436
|
+
...defaultProps$p,
|
|
14051
15437
|
...props
|
|
14052
15438
|
};
|
|
14053
15439
|
const b2 = cn("price");
|
|
@@ -14110,9 +15496,9 @@ const Price = (props) => {
|
|
|
14110
15496
|
className: `${b2("small")}`
|
|
14111
15497
|
}, formatDecimal(price)));
|
|
14112
15498
|
};
|
|
14113
|
-
Price.defaultProps = defaultProps$
|
|
15499
|
+
Price.defaultProps = defaultProps$p;
|
|
14114
15500
|
Price.displayName = "NutPrice";
|
|
14115
|
-
const defaultProps$
|
|
15501
|
+
const defaultProps$o = {
|
|
14116
15502
|
value: "",
|
|
14117
15503
|
dot: false,
|
|
14118
15504
|
max: 1e4,
|
|
@@ -14124,7 +15510,7 @@ const defaultProps$m = {
|
|
|
14124
15510
|
};
|
|
14125
15511
|
const Badge = (props) => {
|
|
14126
15512
|
const { children, dot, top, right, zIndex, color, icons } = {
|
|
14127
|
-
...defaultProps$
|
|
15513
|
+
...defaultProps$o,
|
|
14128
15514
|
...props
|
|
14129
15515
|
};
|
|
14130
15516
|
function content() {
|
|
@@ -14159,9 +15545,9 @@ const Badge = (props) => {
|
|
|
14159
15545
|
style: getStyle()
|
|
14160
15546
|
}, content()));
|
|
14161
15547
|
};
|
|
14162
|
-
Badge.defaultProps = defaultProps$
|
|
15548
|
+
Badge.defaultProps = defaultProps$o;
|
|
14163
15549
|
Badge.displayName = "NutBadge";
|
|
14164
|
-
const defaultProps$
|
|
15550
|
+
const defaultProps$n = {
|
|
14165
15551
|
type: "default",
|
|
14166
15552
|
color: "",
|
|
14167
15553
|
textColor: "",
|
|
@@ -14189,7 +15575,7 @@ const Tag = (props) => {
|
|
|
14189
15575
|
onClick,
|
|
14190
15576
|
onClose
|
|
14191
15577
|
} = {
|
|
14192
|
-
...defaultProps$
|
|
15578
|
+
...defaultProps$n,
|
|
14193
15579
|
...props
|
|
14194
15580
|
};
|
|
14195
15581
|
const [btnName, setBtnName] = useState("");
|
|
@@ -14261,7 +15647,7 @@ const Tag = (props) => {
|
|
|
14261
15647
|
className: "text"
|
|
14262
15648
|
}, children)));
|
|
14263
15649
|
};
|
|
14264
|
-
Tag.defaultProps = defaultProps$
|
|
15650
|
+
Tag.defaultProps = defaultProps$n;
|
|
14265
15651
|
Tag.displayName = "NutTag";
|
|
14266
15652
|
function fillRef(ref, node) {
|
|
14267
15653
|
if (typeof ref === "function") {
|
|
@@ -14305,13 +15691,7 @@ class Trigger extends React__default.Component {
|
|
|
14305
15691
|
return trigger;
|
|
14306
15692
|
}
|
|
14307
15693
|
}
|
|
14308
|
-
const
|
|
14309
|
-
if (ele && ele.getBoundingClientRect) {
|
|
14310
|
-
return ele.getBoundingClientRect();
|
|
14311
|
-
}
|
|
14312
|
-
return null;
|
|
14313
|
-
};
|
|
14314
|
-
const defaultProps$k = {
|
|
15694
|
+
const defaultProps$m = {
|
|
14315
15695
|
list: [],
|
|
14316
15696
|
theme: "light",
|
|
14317
15697
|
location: "bottom",
|
|
@@ -14337,14 +15717,14 @@ const Popover = (props) => {
|
|
|
14337
15717
|
onChoose,
|
|
14338
15718
|
...reset
|
|
14339
15719
|
} = {
|
|
14340
|
-
...defaultProps$
|
|
15720
|
+
...defaultProps$m,
|
|
14341
15721
|
...props
|
|
14342
15722
|
};
|
|
14343
15723
|
const goodItem = useRef(null);
|
|
14344
15724
|
setTimeout(() => {
|
|
14345
|
-
if (goodItem.current &&
|
|
14346
|
-
setElWidth(
|
|
14347
|
-
setElHeight(
|
|
15725
|
+
if (goodItem.current && getRect(goodItem.current)) {
|
|
15726
|
+
setElWidth(getRect(goodItem.current).width);
|
|
15727
|
+
setElHeight(getRect(goodItem.current).height);
|
|
14348
15728
|
}
|
|
14349
15729
|
});
|
|
14350
15730
|
const [classes, setClasses] = useState("");
|
|
@@ -14429,9 +15809,9 @@ const Popover = (props) => {
|
|
|
14429
15809
|
style: { background: "transparent" }
|
|
14430
15810
|
}) : "");
|
|
14431
15811
|
};
|
|
14432
|
-
Popover.defaultProps = defaultProps$
|
|
15812
|
+
Popover.defaultProps = defaultProps$m;
|
|
14433
15813
|
Popover.displayName = "NutPopover";
|
|
14434
|
-
const defaultProps$
|
|
15814
|
+
const defaultProps$l = {
|
|
14435
15815
|
width: "100px",
|
|
14436
15816
|
height: "100px",
|
|
14437
15817
|
row: 1,
|
|
@@ -14459,7 +15839,7 @@ const Skeleton = (props) => {
|
|
|
14459
15839
|
avatarShape,
|
|
14460
15840
|
...restProps
|
|
14461
15841
|
} = {
|
|
14462
|
-
...defaultProps$
|
|
15842
|
+
...defaultProps$l,
|
|
14463
15843
|
...props
|
|
14464
15844
|
};
|
|
14465
15845
|
const b2 = cn("skeleton");
|
|
@@ -14514,9 +15894,9 @@ const Skeleton = (props) => {
|
|
|
14514
15894
|
});
|
|
14515
15895
|
})))));
|
|
14516
15896
|
};
|
|
14517
|
-
Skeleton.defaultProps = defaultProps$
|
|
15897
|
+
Skeleton.defaultProps = defaultProps$l;
|
|
14518
15898
|
Skeleton.displayName = "NutSkeleton";
|
|
14519
|
-
const defaultProps$
|
|
15899
|
+
const defaultProps$k = {
|
|
14520
15900
|
showPlainText: false,
|
|
14521
15901
|
showDays: false,
|
|
14522
15902
|
paused: false,
|
|
@@ -14539,7 +15919,7 @@ const CountDown = (props) => {
|
|
|
14539
15919
|
onUpdate,
|
|
14540
15920
|
children,
|
|
14541
15921
|
...rest
|
|
14542
|
-
} = { ...defaultProps$
|
|
15922
|
+
} = { ...defaultProps$k, ...props };
|
|
14543
15923
|
const b2 = cn("countdown");
|
|
14544
15924
|
const [restTimeStamp, setRestTime] = useState(0);
|
|
14545
15925
|
const stateRef = useRef({
|
|
@@ -14686,9 +16066,9 @@ const CountDown = (props) => {
|
|
|
14686
16066
|
className: b2("block")
|
|
14687
16067
|
}, resttime.s))));
|
|
14688
16068
|
};
|
|
14689
|
-
CountDown.defaultProps = defaultProps$
|
|
16069
|
+
CountDown.defaultProps = defaultProps$k;
|
|
14690
16070
|
CountDown.displayName = "NutCountDown";
|
|
14691
|
-
const defaultProps$
|
|
16071
|
+
const defaultProps$j = {
|
|
14692
16072
|
activeName: ["0"],
|
|
14693
16073
|
accordion: false,
|
|
14694
16074
|
icon: "",
|
|
@@ -14711,7 +16091,7 @@ const Collapse = memo(
|
|
|
14711
16091
|
iconColor,
|
|
14712
16092
|
change
|
|
14713
16093
|
} = {
|
|
14714
|
-
...defaultProps$
|
|
16094
|
+
...defaultProps$j,
|
|
14715
16095
|
...props
|
|
14716
16096
|
};
|
|
14717
16097
|
const childrenDom = React__default.Children.toArray(children);
|
|
@@ -14768,9 +16148,9 @@ const Collapse = memo(
|
|
|
14768
16148
|
},
|
|
14769
16149
|
areEqual
|
|
14770
16150
|
);
|
|
14771
|
-
Collapse.defaultProps = defaultProps$
|
|
16151
|
+
Collapse.defaultProps = defaultProps$j;
|
|
14772
16152
|
Collapse.displayName = "NutCollapse";
|
|
14773
|
-
const defaultProps$
|
|
16153
|
+
const defaultProps$i = {
|
|
14774
16154
|
title: "",
|
|
14775
16155
|
name: "",
|
|
14776
16156
|
isOpen: false,
|
|
@@ -14804,7 +16184,7 @@ const CollapseItem = (props) => {
|
|
|
14804
16184
|
iconColor,
|
|
14805
16185
|
...rest
|
|
14806
16186
|
} = {
|
|
14807
|
-
...defaultProps$
|
|
16187
|
+
...defaultProps$i,
|
|
14808
16188
|
...props
|
|
14809
16189
|
};
|
|
14810
16190
|
const [domHeight, setDomHeight] = useState(-1);
|
|
@@ -14878,9 +16258,9 @@ const CollapseItem = (props) => {
|
|
|
14878
16258
|
className: colBem("content-text")
|
|
14879
16259
|
}, children)));
|
|
14880
16260
|
};
|
|
14881
|
-
CollapseItem.defaultProps = defaultProps$
|
|
16261
|
+
CollapseItem.defaultProps = defaultProps$i;
|
|
14882
16262
|
CollapseItem.displayName = "NutCollapseItem";
|
|
14883
|
-
const defaultProps$
|
|
16263
|
+
const defaultProps$h = {
|
|
14884
16264
|
maxLen: 0,
|
|
14885
16265
|
endNumber: "",
|
|
14886
16266
|
delaySpeed: 300,
|
|
@@ -14898,7 +16278,7 @@ const CountUp = (props) => {
|
|
|
14898
16278
|
thousands,
|
|
14899
16279
|
...reset
|
|
14900
16280
|
} = {
|
|
14901
|
-
...defaultProps$
|
|
16281
|
+
...defaultProps$h,
|
|
14902
16282
|
...props
|
|
14903
16283
|
};
|
|
14904
16284
|
const b2 = cn("countup");
|
|
@@ -14968,9 +16348,9 @@ const CountUp = (props) => {
|
|
|
14968
16348
|
}, item));
|
|
14969
16349
|
})));
|
|
14970
16350
|
};
|
|
14971
|
-
CountUp.defaultProps = defaultProps$
|
|
16351
|
+
CountUp.defaultProps = defaultProps$h;
|
|
14972
16352
|
CountUp.displayName = "NutCountUp";
|
|
14973
|
-
const defaultProps$
|
|
16353
|
+
const defaultProps$g = {};
|
|
14974
16354
|
class AnimatingNumbers extends Component {
|
|
14975
16355
|
constructor(props) {
|
|
14976
16356
|
super(props);
|
|
@@ -14982,7 +16362,7 @@ class AnimatingNumbers extends Component {
|
|
|
14982
16362
|
});
|
|
14983
16363
|
}
|
|
14984
16364
|
}
|
|
14985
|
-
AnimatingNumbers.defaultProps = defaultProps$
|
|
16365
|
+
AnimatingNumbers.defaultProps = defaultProps$g;
|
|
14986
16366
|
AnimatingNumbers.displayName = "NutAnimatingNumbers";
|
|
14987
16367
|
AnimatingNumbers.CountUp = CountUp;
|
|
14988
16368
|
AnimatingNumbers.CountUp = CountUp;
|
|
@@ -14991,7 +16371,7 @@ const defaultStatus = {
|
|
|
14991
16371
|
error: "https://ftcms.jd.com/p/files/61a9e33ee7dcdbcc0ce62736.png",
|
|
14992
16372
|
network: "https://static-ftcms.jd.com/p/files/61a9e31de7dcdbcc0ce62734.png"
|
|
14993
16373
|
};
|
|
14994
|
-
const defaultProps$
|
|
16374
|
+
const defaultProps$f = {
|
|
14995
16375
|
description: "\u65E0\u5185\u5BB9",
|
|
14996
16376
|
image: "empty",
|
|
14997
16377
|
imageSize: "",
|
|
@@ -14999,9 +16379,9 @@ const defaultProps$d = {
|
|
|
14999
16379
|
};
|
|
15000
16380
|
const Empty = (props) => {
|
|
15001
16381
|
const { locale } = useConfig();
|
|
15002
|
-
defaultProps$
|
|
16382
|
+
defaultProps$f.description = locale.noData || defaultProps$f.description;
|
|
15003
16383
|
const { image, imageSize, description, children, className, ...rest } = {
|
|
15004
|
-
...defaultProps$
|
|
16384
|
+
...defaultProps$f,
|
|
15005
16385
|
...props
|
|
15006
16386
|
};
|
|
15007
16387
|
const [imgStyle, setImgStyle] = useState({});
|
|
@@ -15043,7 +16423,7 @@ const Empty = (props) => {
|
|
|
15043
16423
|
className: b2("description")
|
|
15044
16424
|
}, description) : { description }, children));
|
|
15045
16425
|
};
|
|
15046
|
-
Empty.defaultProps = defaultProps$
|
|
16426
|
+
Empty.defaultProps = defaultProps$f;
|
|
15047
16427
|
Empty.displayName = "NutEmpty";
|
|
15048
16428
|
const initPositinoCache = (reaItemSize, length = 0) => {
|
|
15049
16429
|
let index2 = 0;
|
|
@@ -15156,7 +16536,7 @@ const updateItemSize = (positions, items, sizeKey) => {
|
|
|
15156
16536
|
}
|
|
15157
16537
|
});
|
|
15158
16538
|
};
|
|
15159
|
-
const defaultProps$
|
|
16539
|
+
const defaultProps$e = {};
|
|
15160
16540
|
const VirtualList = (props) => {
|
|
15161
16541
|
const {
|
|
15162
16542
|
sourceData = [],
|
|
@@ -15315,9 +16695,9 @@ const VirtualList = (props) => {
|
|
|
15315
16695
|
}) : data);
|
|
15316
16696
|
}))));
|
|
15317
16697
|
};
|
|
15318
|
-
VirtualList.defaultProps = defaultProps$
|
|
16698
|
+
VirtualList.defaultProps = defaultProps$e;
|
|
15319
16699
|
VirtualList.displayName = "NutVirtualList";
|
|
15320
|
-
const defaultProps$
|
|
16700
|
+
const defaultProps$d = {
|
|
15321
16701
|
className: "",
|
|
15322
16702
|
style: {},
|
|
15323
16703
|
columns: [],
|
|
@@ -15328,7 +16708,7 @@ const defaultProps$b = {
|
|
|
15328
16708
|
};
|
|
15329
16709
|
const Table = (props) => {
|
|
15330
16710
|
const { locale } = useConfig();
|
|
15331
|
-
defaultProps$
|
|
16711
|
+
defaultProps$d.noData = locale.noData;
|
|
15332
16712
|
const {
|
|
15333
16713
|
children,
|
|
15334
16714
|
className,
|
|
@@ -15342,7 +16722,7 @@ const Table = (props) => {
|
|
|
15342
16722
|
onSorter,
|
|
15343
16723
|
...rest
|
|
15344
16724
|
} = {
|
|
15345
|
-
...defaultProps$
|
|
16725
|
+
...defaultProps$d,
|
|
15346
16726
|
...props
|
|
15347
16727
|
};
|
|
15348
16728
|
const [curData, setCurData] = useState(data);
|
|
@@ -15394,14 +16774,14 @@ const Table = (props) => {
|
|
|
15394
16774
|
});
|
|
15395
16775
|
};
|
|
15396
16776
|
const renderBodyTds = (item) => {
|
|
15397
|
-
return sortDataItem().map(([value,
|
|
16777
|
+
return sortDataItem().map(([value, render2], index2) => {
|
|
15398
16778
|
return /* @__PURE__ */ React__default.createElement("span", {
|
|
15399
16779
|
className: classNames(
|
|
15400
16780
|
"nut-table__main__body__tr__td",
|
|
15401
16781
|
cellClasses(getColumnItem(value))
|
|
15402
16782
|
),
|
|
15403
16783
|
key: value
|
|
15404
|
-
}, typeof item[value] === "function" || typeof
|
|
16784
|
+
}, typeof item[value] === "function" || typeof render2 === "function" ? /* @__PURE__ */ React__default.createElement("div", null, render2 ? render2(item) : item[value](item)) : item[value]);
|
|
15405
16785
|
});
|
|
15406
16786
|
};
|
|
15407
16787
|
const renderBoyTrs = () => {
|
|
@@ -15438,9 +16818,9 @@ const Table = (props) => {
|
|
|
15438
16818
|
className: "nut-table__nodata__text"
|
|
15439
16819
|
}, noData))));
|
|
15440
16820
|
};
|
|
15441
|
-
Table.defaultProps = defaultProps$
|
|
16821
|
+
Table.defaultProps = defaultProps$d;
|
|
15442
16822
|
Table.displayName = "NutTable";
|
|
15443
|
-
const defaultProps$
|
|
16823
|
+
const defaultProps$c = {
|
|
15444
16824
|
source: {
|
|
15445
16825
|
type: {},
|
|
15446
16826
|
src: ""
|
|
@@ -15465,7 +16845,7 @@ const Video = (props) => {
|
|
|
15465
16845
|
playend,
|
|
15466
16846
|
...restProps
|
|
15467
16847
|
} = {
|
|
15468
|
-
...defaultProps$
|
|
16848
|
+
...defaultProps$c,
|
|
15469
16849
|
...props
|
|
15470
16850
|
};
|
|
15471
16851
|
const rootRef = useRef(null);
|
|
@@ -15519,9 +16899,9 @@ const Video = (props) => {
|
|
|
15519
16899
|
kind: "captions"
|
|
15520
16900
|
})));
|
|
15521
16901
|
};
|
|
15522
|
-
Video.defaultProps = defaultProps$
|
|
16902
|
+
Video.defaultProps = defaultProps$c;
|
|
15523
16903
|
Video.displayName = "NutVideo";
|
|
15524
|
-
const defaultProps$
|
|
16904
|
+
const defaultProps$b = {
|
|
15525
16905
|
className: "",
|
|
15526
16906
|
style: {},
|
|
15527
16907
|
isShowPercentage: true,
|
|
@@ -15565,7 +16945,7 @@ const Progress = (props) => {
|
|
|
15565
16945
|
rounded,
|
|
15566
16946
|
children,
|
|
15567
16947
|
...rest
|
|
15568
|
-
} = { ...defaultProps$
|
|
16948
|
+
} = { ...defaultProps$b, ...props };
|
|
15569
16949
|
const b2 = cn("progress");
|
|
15570
16950
|
const classes = classNames(b2(""));
|
|
15571
16951
|
const classesOuter = classNames({
|
|
@@ -15639,8 +17019,436 @@ const Progress = (props) => {
|
|
|
15639
17019
|
color: iconColor
|
|
15640
17020
|
})));
|
|
15641
17021
|
};
|
|
15642
|
-
Progress.defaultProps = defaultProps$
|
|
17022
|
+
Progress.defaultProps = defaultProps$b;
|
|
15643
17023
|
Progress.displayName = "NutProgress";
|
|
17024
|
+
const defaultProps$a = {
|
|
17025
|
+
className: "",
|
|
17026
|
+
url: "",
|
|
17027
|
+
style: {},
|
|
17028
|
+
muted: false,
|
|
17029
|
+
autoplay: false,
|
|
17030
|
+
loop: false,
|
|
17031
|
+
preload: "auto",
|
|
17032
|
+
type: "progress",
|
|
17033
|
+
onFastBack: (e2) => {
|
|
17034
|
+
},
|
|
17035
|
+
onForward: (e2) => {
|
|
17036
|
+
},
|
|
17037
|
+
onPause: (e2) => {
|
|
17038
|
+
},
|
|
17039
|
+
onPlayEnd: (e2) => {
|
|
17040
|
+
},
|
|
17041
|
+
onMute: (e2) => {
|
|
17042
|
+
},
|
|
17043
|
+
onCanPlay: (e2) => {
|
|
17044
|
+
}
|
|
17045
|
+
};
|
|
17046
|
+
const Audio = (props) => {
|
|
17047
|
+
const { locale } = useConfig();
|
|
17048
|
+
const {
|
|
17049
|
+
className,
|
|
17050
|
+
url,
|
|
17051
|
+
style,
|
|
17052
|
+
muted,
|
|
17053
|
+
autoplay,
|
|
17054
|
+
loop: loop2,
|
|
17055
|
+
preload,
|
|
17056
|
+
type,
|
|
17057
|
+
onFastBack,
|
|
17058
|
+
onForward,
|
|
17059
|
+
onPause,
|
|
17060
|
+
onPlayEnd,
|
|
17061
|
+
onMute,
|
|
17062
|
+
onCanPlay,
|
|
17063
|
+
children,
|
|
17064
|
+
...rest
|
|
17065
|
+
} = {
|
|
17066
|
+
...defaultProps$a,
|
|
17067
|
+
...props
|
|
17068
|
+
};
|
|
17069
|
+
const [playing, setPlaying] = useState(false);
|
|
17070
|
+
const [percent, setPercent] = useState(0);
|
|
17071
|
+
const [isCanPlay, setIsCanPlay] = useState(false);
|
|
17072
|
+
const [currentDuration, setCurrentDuration] = useState("00:00:00");
|
|
17073
|
+
const AudioRef = useRef(null);
|
|
17074
|
+
const statusRef = useRef({
|
|
17075
|
+
currentTime: 0,
|
|
17076
|
+
currentDuration: "00:00:00",
|
|
17077
|
+
percent: 0,
|
|
17078
|
+
duration: "00:00:00",
|
|
17079
|
+
second: 0,
|
|
17080
|
+
hanMuted: props.muted,
|
|
17081
|
+
playing: props.autoplay,
|
|
17082
|
+
handPlaying: false
|
|
17083
|
+
});
|
|
17084
|
+
const b2 = cn("audio");
|
|
17085
|
+
const warn = console.warn;
|
|
17086
|
+
const handleEnded = (e2) => {
|
|
17087
|
+
if (props.loop) {
|
|
17088
|
+
warn(locale.audio.tips || "onPlayEnd\u4E8B\u4EF6\u5728loop=false\u65F6\u624D\u4F1A\u89E6\u53D1");
|
|
17089
|
+
} else {
|
|
17090
|
+
props.onPlayEnd && props.onPlayEnd(e2);
|
|
17091
|
+
}
|
|
17092
|
+
};
|
|
17093
|
+
function watch() {
|
|
17094
|
+
if (AudioRef && AudioRef.current) {
|
|
17095
|
+
const current = AudioRef.current;
|
|
17096
|
+
current.addEventListener("play", () => {
|
|
17097
|
+
setPlaying(true);
|
|
17098
|
+
});
|
|
17099
|
+
}
|
|
17100
|
+
}
|
|
17101
|
+
useEffect(() => {
|
|
17102
|
+
watch();
|
|
17103
|
+
}, []);
|
|
17104
|
+
useEffect(() => {
|
|
17105
|
+
}, [currentDuration]);
|
|
17106
|
+
const handleStatusChange = () => {
|
|
17107
|
+
setPlaying(!playing);
|
|
17108
|
+
if (playing) {
|
|
17109
|
+
AudioRef && AudioRef.current && AudioRef.current.pause();
|
|
17110
|
+
} else {
|
|
17111
|
+
AudioRef && AudioRef.current && AudioRef.current.play();
|
|
17112
|
+
}
|
|
17113
|
+
};
|
|
17114
|
+
const renderIcon = () => {
|
|
17115
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", {
|
|
17116
|
+
className: b2("icon")
|
|
17117
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
17118
|
+
className: `${b2("icon-box")} ${playing ? b2("icon-play") : b2("icon-stop")}`,
|
|
17119
|
+
onClick: handleStatusChange
|
|
17120
|
+
}, playing ? /* @__PURE__ */ React__default.createElement(Icon, {
|
|
17121
|
+
name: "service",
|
|
17122
|
+
className: "nut-icon-loading"
|
|
17123
|
+
}) : /* @__PURE__ */ React__default.createElement(Icon, {
|
|
17124
|
+
name: "service"
|
|
17125
|
+
}))));
|
|
17126
|
+
};
|
|
17127
|
+
const handleBack = () => {
|
|
17128
|
+
if (statusRef.current.currentTime > 0 && AudioRef.current) {
|
|
17129
|
+
statusRef.current.currentTime--;
|
|
17130
|
+
AudioRef.current.currentTime = statusRef.current.currentTime;
|
|
17131
|
+
props.onFastBack && props.onFastBack(AudioRef.current);
|
|
17132
|
+
}
|
|
17133
|
+
};
|
|
17134
|
+
const handleForward = () => {
|
|
17135
|
+
if (AudioRef.current) {
|
|
17136
|
+
statusRef.current.currentTime++;
|
|
17137
|
+
AudioRef.current.currentTime = statusRef.current.currentTime;
|
|
17138
|
+
props.onForward && props.onForward(AudioRef.current);
|
|
17139
|
+
}
|
|
17140
|
+
};
|
|
17141
|
+
const handleMute = () => {
|
|
17142
|
+
if (AudioRef.current) {
|
|
17143
|
+
AudioRef.current.muted = !AudioRef.current.muted;
|
|
17144
|
+
props.onMute && props.onMute(AudioRef.current);
|
|
17145
|
+
}
|
|
17146
|
+
};
|
|
17147
|
+
const handlePause = (e2) => {
|
|
17148
|
+
setPlaying(false);
|
|
17149
|
+
props.onPause && props.onPause(e2);
|
|
17150
|
+
};
|
|
17151
|
+
const formatSeconds = (value) => {
|
|
17152
|
+
if (!value) {
|
|
17153
|
+
return "00:00:00";
|
|
17154
|
+
}
|
|
17155
|
+
const time = parseInt(value);
|
|
17156
|
+
const hours = Math.floor(time / 3600);
|
|
17157
|
+
const minutes = Math.floor((time - hours * 3600) / 60);
|
|
17158
|
+
const seconds = time - hours * 3600 - minutes * 60;
|
|
17159
|
+
let result = "";
|
|
17160
|
+
result += `${`0${hours.toString()}`.slice(-2)}:`;
|
|
17161
|
+
result += `${`0${minutes.toString()}`.slice(-2)}:`;
|
|
17162
|
+
result += `0${seconds.toString()}`.slice(-2);
|
|
17163
|
+
return result;
|
|
17164
|
+
};
|
|
17165
|
+
const renderProgerss = () => {
|
|
17166
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", {
|
|
17167
|
+
className: b2("progress")
|
|
17168
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
17169
|
+
className: "time"
|
|
17170
|
+
}, currentDuration), /* @__PURE__ */ React__default.createElement("div", {
|
|
17171
|
+
className: b2("progress-bar-wrapper")
|
|
17172
|
+
}, /* @__PURE__ */ React__default.createElement(Range, {
|
|
17173
|
+
modelValue: percent,
|
|
17174
|
+
hiddenTag: true,
|
|
17175
|
+
hiddenRange: true,
|
|
17176
|
+
"inactive-color": "#cccccc",
|
|
17177
|
+
"active-color": "#fa2c19"
|
|
17178
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
17179
|
+
className: "time"
|
|
17180
|
+
}, AudioRef.current ? formatSeconds(`${statusRef.current.second}`) : "00:00:00")), /* @__PURE__ */ React__default.createElement("div", {
|
|
17181
|
+
className: isCanPlay ? "custom-button-group" : "custom-button-group-disable"
|
|
17182
|
+
}, /* @__PURE__ */ React__default.createElement(Button, {
|
|
17183
|
+
type: "primary",
|
|
17184
|
+
size: "small",
|
|
17185
|
+
className: "back",
|
|
17186
|
+
onClick: handleBack
|
|
17187
|
+
}, locale.audio.back || "\u5FEB\u9000"), /* @__PURE__ */ React__default.createElement(Button, {
|
|
17188
|
+
type: "primary",
|
|
17189
|
+
size: "small",
|
|
17190
|
+
className: "start",
|
|
17191
|
+
onClick: handleStatusChange
|
|
17192
|
+
}, playing ? `${locale.audio.pause || "\u6682\u505C"}` : `${locale.audio.start || "\u5F00\u59CB"}`), /* @__PURE__ */ React__default.createElement(Button, {
|
|
17193
|
+
type: "primary",
|
|
17194
|
+
size: "small",
|
|
17195
|
+
onClick: handleForward
|
|
17196
|
+
}, locale.audio.forward || "\u5FEB\u8FDB"), /* @__PURE__ */ React__default.createElement(Button, {
|
|
17197
|
+
type: AudioRef.current && AudioRef.current.muted ? "default" : "primary",
|
|
17198
|
+
size: "small",
|
|
17199
|
+
onClick: handleMute
|
|
17200
|
+
}, locale.audio.mute || "\u9759\u97F3")));
|
|
17201
|
+
};
|
|
17202
|
+
const renderNone = () => {
|
|
17203
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
17204
|
+
className: b2("none-container"),
|
|
17205
|
+
onClick: handleStatusChange
|
|
17206
|
+
}, children);
|
|
17207
|
+
};
|
|
17208
|
+
const renderAudio = () => {
|
|
17209
|
+
switch (type) {
|
|
17210
|
+
case "icon":
|
|
17211
|
+
return renderIcon();
|
|
17212
|
+
case "progress":
|
|
17213
|
+
return renderProgerss();
|
|
17214
|
+
case "none":
|
|
17215
|
+
return renderNone();
|
|
17216
|
+
default:
|
|
17217
|
+
return null;
|
|
17218
|
+
}
|
|
17219
|
+
};
|
|
17220
|
+
const handleCanplay = (e2) => {
|
|
17221
|
+
setIsCanPlay(true);
|
|
17222
|
+
if (props.autoplay && !playing) {
|
|
17223
|
+
AudioRef && AudioRef.current && AudioRef.current.play();
|
|
17224
|
+
}
|
|
17225
|
+
if (AudioRef.current) {
|
|
17226
|
+
statusRef.current.second = AudioRef.current.duration || 0;
|
|
17227
|
+
props.onCanPlay && props.onCanPlay(e2);
|
|
17228
|
+
}
|
|
17229
|
+
};
|
|
17230
|
+
const onTimeupdate = (e2) => {
|
|
17231
|
+
const time = parseInt(e2.target.currentTime);
|
|
17232
|
+
const formated = formatSeconds(`${time}`);
|
|
17233
|
+
statusRef.current.currentDuration = formated;
|
|
17234
|
+
setPercent(time / statusRef.current.second * 100);
|
|
17235
|
+
setCurrentDuration(formated);
|
|
17236
|
+
statusRef.current.currentTime = time;
|
|
17237
|
+
};
|
|
17238
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
17239
|
+
className: `${b2()} ${className}`,
|
|
17240
|
+
style,
|
|
17241
|
+
...rest
|
|
17242
|
+
}, renderAudio(), /* @__PURE__ */ React__default.createElement("audio", {
|
|
17243
|
+
className: "audioMain",
|
|
17244
|
+
controls: type === "controls",
|
|
17245
|
+
ref: AudioRef,
|
|
17246
|
+
src: url,
|
|
17247
|
+
muted,
|
|
17248
|
+
preload,
|
|
17249
|
+
loop: loop2,
|
|
17250
|
+
onPause: (e2) => handlePause(e2),
|
|
17251
|
+
onEnded: (e2) => handleEnded(e2),
|
|
17252
|
+
onCanPlay: (e2) => handleCanplay(e2),
|
|
17253
|
+
onTimeUpdate: (e2) => onTimeupdate(e2)
|
|
17254
|
+
}, /* @__PURE__ */ React__default.createElement("track", {
|
|
17255
|
+
kind: "captions"
|
|
17256
|
+
})));
|
|
17257
|
+
};
|
|
17258
|
+
Audio.defaultProps = defaultProps$a;
|
|
17259
|
+
Audio.displayName = "NutAudio";
|
|
17260
|
+
const defaultProps$9 = {
|
|
17261
|
+
images: [],
|
|
17262
|
+
videos: [],
|
|
17263
|
+
show: false,
|
|
17264
|
+
autoplay: 3e3,
|
|
17265
|
+
initNo: 1,
|
|
17266
|
+
contentClose: false,
|
|
17267
|
+
paginationVisible: false,
|
|
17268
|
+
paginationColor: "#fff",
|
|
17269
|
+
onClose: () => {
|
|
17270
|
+
}
|
|
17271
|
+
};
|
|
17272
|
+
const ImagePreview = (props) => {
|
|
17273
|
+
const {
|
|
17274
|
+
images,
|
|
17275
|
+
videos,
|
|
17276
|
+
show,
|
|
17277
|
+
initNo,
|
|
17278
|
+
paginationColor,
|
|
17279
|
+
paginationVisible,
|
|
17280
|
+
autoplay,
|
|
17281
|
+
contentClose,
|
|
17282
|
+
onClose
|
|
17283
|
+
} = props;
|
|
17284
|
+
const nutImagePreview = useRef(null);
|
|
17285
|
+
const [showPop, setShowPop] = useState(false);
|
|
17286
|
+
const [active, setActive] = useState(1);
|
|
17287
|
+
const [maxNo, setMaxNo] = useState(1);
|
|
17288
|
+
const [store, setStore] = useState({
|
|
17289
|
+
scale: 1,
|
|
17290
|
+
moveable: false
|
|
17291
|
+
});
|
|
17292
|
+
const [lastTouchEndTime, setLastTouchEndTime] = useState(0);
|
|
17293
|
+
const onTouchStart = (event) => {
|
|
17294
|
+
const touches = event.touches;
|
|
17295
|
+
const events = touches[0];
|
|
17296
|
+
const events2 = touches[1];
|
|
17297
|
+
const curTouchTime = new Date().getTime();
|
|
17298
|
+
if (curTouchTime - lastTouchEndTime < 300) {
|
|
17299
|
+
const store12 = store;
|
|
17300
|
+
if (store12.scale > 1) {
|
|
17301
|
+
store12.scale = 1;
|
|
17302
|
+
} else if (store12.scale === 1) {
|
|
17303
|
+
store12.scale = 2;
|
|
17304
|
+
}
|
|
17305
|
+
scaleNow();
|
|
17306
|
+
}
|
|
17307
|
+
const store1 = store;
|
|
17308
|
+
store1.moveable = true;
|
|
17309
|
+
if (events2) {
|
|
17310
|
+
store1.oriDistance = getDistance(
|
|
17311
|
+
{
|
|
17312
|
+
x: events.pageX,
|
|
17313
|
+
y: events.pageY
|
|
17314
|
+
},
|
|
17315
|
+
{
|
|
17316
|
+
x: events2.pageX,
|
|
17317
|
+
y: events2.pageY
|
|
17318
|
+
}
|
|
17319
|
+
);
|
|
17320
|
+
}
|
|
17321
|
+
store1.originScale = store1.scale || 1;
|
|
17322
|
+
};
|
|
17323
|
+
const onTouchMove = (event) => {
|
|
17324
|
+
const touches = event.touches;
|
|
17325
|
+
const events = touches[0];
|
|
17326
|
+
const events2 = touches[1];
|
|
17327
|
+
if (!store.moveable) {
|
|
17328
|
+
return;
|
|
17329
|
+
}
|
|
17330
|
+
const store1 = store;
|
|
17331
|
+
if (events2) {
|
|
17332
|
+
const curDistance = getDistance(
|
|
17333
|
+
{
|
|
17334
|
+
x: events.pageX,
|
|
17335
|
+
y: events.pageY
|
|
17336
|
+
},
|
|
17337
|
+
{
|
|
17338
|
+
x: events2.pageX,
|
|
17339
|
+
y: events2.pageY
|
|
17340
|
+
}
|
|
17341
|
+
);
|
|
17342
|
+
const curScale = curDistance / store1.oriDistance;
|
|
17343
|
+
store1.scale = store1.originScale * curScale;
|
|
17344
|
+
if (store1.scale > 3) {
|
|
17345
|
+
store1.scale = 3;
|
|
17346
|
+
}
|
|
17347
|
+
scaleNow();
|
|
17348
|
+
}
|
|
17349
|
+
};
|
|
17350
|
+
const onTouchEnd = () => {
|
|
17351
|
+
setLastTouchEndTime(new Date().getTime());
|
|
17352
|
+
const store1 = store;
|
|
17353
|
+
store1.moveable = false;
|
|
17354
|
+
if (store1.scale < 1.1 && store1.scale > 1 || store1.scale < 1) {
|
|
17355
|
+
store1.scale = 1;
|
|
17356
|
+
scaleNow();
|
|
17357
|
+
}
|
|
17358
|
+
};
|
|
17359
|
+
const init = () => {
|
|
17360
|
+
document.addEventListener("touchmove", onTouchMove);
|
|
17361
|
+
document.addEventListener("touchend", onTouchEnd);
|
|
17362
|
+
document.addEventListener("touchcancel", onTouchEnd);
|
|
17363
|
+
};
|
|
17364
|
+
useEffect(() => {
|
|
17365
|
+
if (show !== void 0) {
|
|
17366
|
+
setShowPop(show);
|
|
17367
|
+
init();
|
|
17368
|
+
}
|
|
17369
|
+
}, [show]);
|
|
17370
|
+
useEffect(() => {
|
|
17371
|
+
if (initNo !== void 0) {
|
|
17372
|
+
setActive(initNo);
|
|
17373
|
+
}
|
|
17374
|
+
if (show !== void 0) {
|
|
17375
|
+
setShowPop(show);
|
|
17376
|
+
}
|
|
17377
|
+
if (images && videos) {
|
|
17378
|
+
setMaxNo(images.length + videos.length);
|
|
17379
|
+
}
|
|
17380
|
+
}, []);
|
|
17381
|
+
const scaleNow = () => {
|
|
17382
|
+
if (nutImagePreview.current) {
|
|
17383
|
+
nutImagePreview.current.style.transform = `scale(${store.scale})`;
|
|
17384
|
+
}
|
|
17385
|
+
};
|
|
17386
|
+
const onCloseInner = () => {
|
|
17387
|
+
setShowPop(false);
|
|
17388
|
+
setActive(1);
|
|
17389
|
+
scaleNow();
|
|
17390
|
+
onClose && onClose();
|
|
17391
|
+
setStore({
|
|
17392
|
+
...store,
|
|
17393
|
+
scale: 1
|
|
17394
|
+
});
|
|
17395
|
+
};
|
|
17396
|
+
const getDistance = (first, second) => {
|
|
17397
|
+
return Math.hypot(
|
|
17398
|
+
Math.abs(second.x - first.x),
|
|
17399
|
+
Math.abs(second.y - first.y)
|
|
17400
|
+
);
|
|
17401
|
+
};
|
|
17402
|
+
const slideChangeEnd = (page) => {
|
|
17403
|
+
setActive(page + 1);
|
|
17404
|
+
};
|
|
17405
|
+
const closeOnImg = () => {
|
|
17406
|
+
if (contentClose) {
|
|
17407
|
+
onCloseInner();
|
|
17408
|
+
}
|
|
17409
|
+
};
|
|
17410
|
+
return /* @__PURE__ */ React__default.createElement(Popup, {
|
|
17411
|
+
visible: showPop,
|
|
17412
|
+
popClass: "custom-pop",
|
|
17413
|
+
style: { width: "100%" },
|
|
17414
|
+
onClick: onCloseInner
|
|
17415
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
17416
|
+
className: "nut-imagepreview",
|
|
17417
|
+
ref: nutImagePreview,
|
|
17418
|
+
onClick: closeOnImg,
|
|
17419
|
+
onTouchStart
|
|
17420
|
+
}, /* @__PURE__ */ React__default.createElement(Swiper, {
|
|
17421
|
+
autoPlay: autoplay,
|
|
17422
|
+
className: "nut-imagepreview-swiper",
|
|
17423
|
+
loop: true,
|
|
17424
|
+
isPreventDefault: false,
|
|
17425
|
+
style: { display: showPop ? "block" : "none" },
|
|
17426
|
+
direction: "horizontal",
|
|
17427
|
+
onChange: slideChangeEnd,
|
|
17428
|
+
initPage: initNo && (initNo > maxNo ? maxNo - 1 : initNo - 1),
|
|
17429
|
+
paginationColor,
|
|
17430
|
+
paginationVisible
|
|
17431
|
+
}, videos && videos.length > 0 && videos.map((item, index2) => {
|
|
17432
|
+
return /* @__PURE__ */ React__default.createElement(SwiperItem, {
|
|
17433
|
+
key: index2
|
|
17434
|
+
}, /* @__PURE__ */ React__default.createElement(Video, {
|
|
17435
|
+
source: item.source,
|
|
17436
|
+
options: item.options
|
|
17437
|
+
}));
|
|
17438
|
+
}), images && images.length > 0 && images.map((item, index2) => {
|
|
17439
|
+
return /* @__PURE__ */ React__default.createElement(SwiperItem, {
|
|
17440
|
+
key: index2
|
|
17441
|
+
}, /* @__PURE__ */ React__default.createElement("img", {
|
|
17442
|
+
src: item.src,
|
|
17443
|
+
alt: "",
|
|
17444
|
+
className: "nut-imagepreview-img"
|
|
17445
|
+
}));
|
|
17446
|
+
}))), /* @__PURE__ */ React__default.createElement("div", {
|
|
17447
|
+
className: "nut-imagepreview-index"
|
|
17448
|
+
}, active, "/", (images ? images.length : 0) + (videos ? videos.length : 0)));
|
|
17449
|
+
};
|
|
17450
|
+
ImagePreview.defaultProps = defaultProps$9;
|
|
17451
|
+
ImagePreview.displayName = "NutImagePreview";
|
|
15644
17452
|
const defaultProps$8 = {
|
|
15645
17453
|
type: "custom",
|
|
15646
17454
|
existAddress: [],
|
|
@@ -16666,4 +18474,4 @@ const TimeSelect = (props) => {
|
|
|
16666
18474
|
};
|
|
16667
18475
|
TimeSelect.defaultProps = defaultProps;
|
|
16668
18476
|
TimeSelect.displayName = "NutTimeSelect";
|
|
16669
|
-
export { ActionSheet, Address, AnimatingNumbers, Avatar, AvatarGroup, BackTop, Badge, Barrage, Button, Calendar, CalendarItem, Card, Cell, CellGroup, Checkbox, CheckboxGroup, CircleProgress, Col, Collapse, CollapseItem, ConfigProvider, CountDown, DatePicker, Dialog, Divider, Drag, Elevator, Empty, FixedNav, Icon, Indicator, Infiniteloading, Input, InputNumber, Layout, NavBar, NoticeBar, Notify, NumberKeyboard, Overlay, Pagination, Picker, Popover, Popup, Price, Progress, Radio, RadioGroup, Range, Rate, Row, SearchBar, ShortPassword, SideNavBar, SideNavBarItem, Signature, Skeleton, Step, Steps, SubSideNavBar, Swiper, SwiperItem, Switch, TabPane, Tabbar, TabbarItem, Table, Tabs, Tag, TextArea, TimeDetail, TimePannel, TimeSelect, Toast, Uploader, Video, VirtualList };
|
|
18477
|
+
export { ActionSheet, Address, AnimatingNumbers, Audio, Avatar, AvatarGroup, BackTop, Badge, Barrage, Button, Calendar, CalendarItem, Card, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, CircleProgress, Col, Collapse, CollapseItem, ConfigProvider, CountDown, DatePicker, Dialog, Divider, Drag, Elevator, Empty, FixedNav, Grid, GridItem, Icon, ImagePreview, Indicator, Infiniteloading, Input, InputNumber, Layout, Menu, MenuItem, NavBar, NoticeBar, Notify, NumberKeyboard, Overlay, Pagination, Picker, Popover, Popup, Price, Progress, Radio, RadioGroup, Range, Rate, Row, SearchBar, ShortPassword, SideNavBar, SideNavBarItem, Signature, Skeleton, Step, Steps, SubSideNavBar, Swipe, Swiper, SwiperItem, Switch, TabPane, Tabbar, TabbarItem, Table, Tabs, Tag, TextArea, TimeDetail, TimePannel, TimeSelect, Toast, Uploader, Video, VirtualList };
|