@nutui/nutui-react 2.0.0-beta.2 → 2.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/esm/Avatar.js +2 -0
- package/dist/esm/Cell/style/index.js +1 -1
- package/dist/esm/Cell/style/style.css +1 -1
- package/dist/esm/Cell.js +2 -0
- package/dist/esm/CellGroup.js +47 -4
- package/dist/esm/Form.js +1 -2
- package/dist/esm/Menu.js +6 -0
- package/dist/esm/MenuItem.js +8 -153
- package/dist/esm/Swiper.js +4 -1
- package/dist/esm/menuitem2.js +156 -0
- package/dist/esm/types/src/packages/avatar/avatar.d.ts +4 -1
- package/dist/esm/types/src/packages/avatar/avatar.taro.d.ts +4 -1
- package/dist/esm/types/src/packages/cell/cell.d.ts +4 -1
- package/dist/esm/types/src/packages/cell/cell.taro.d.ts +4 -1
- package/dist/esm/types/src/packages/menu/menu.d.ts +4 -1
- package/dist/esm/types/src/packages/menu/menu.taro.d.ts +4 -1
- package/dist/esm/types/src/packages/swiper/index.d.ts +8 -2
- package/dist/esm/types/src/packages/swiper/index.taro.d.ts +8 -2
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/tr-TR.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.es.js +236 -231
- package/dist/nutui.react.umd.js +236 -231
- package/dist/packages/cell/cell.scss +2 -0
- package/dist/style.mjs +1 -1
- package/dist/types/packages/avatar/avatar.d.ts +4 -1
- package/dist/types/packages/cell/cell.d.ts +4 -1
- package/dist/types/packages/menu/menu.d.ts +4 -1
- package/dist/types/packages/swiper/index.d.ts +8 -2
- package/dist/types/packages/virtuallist/utils.d.ts +1 -1
- package/package.json +1 -1
- package/dist/esm/cellgroup2.js +0 -50
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
# v2.0.0-beta.3
|
|
2
|
+
`2023-06-30`
|
|
3
|
+
|
|
4
|
+
* 🔨 chore: 增加组件名称调整的内容 (#1161) @oasis-cloud
|
|
5
|
+
* 📖 docs: 统一升级文档中的修改的描述术语 (#1159) @xiaoyatong
|
|
6
|
+
* :bug: fix: 修改migrate文档 (#1164) @junjun666
|
|
7
|
+
* :bug: fix: 单元测试问题修复 (#1158) @Eiinu
|
|
8
|
+
* 🛠 refactor: 调整 MenuItem CellGroup SwiperItem 使用方式为 Menu.Item Cell.Group… (#1160) @oasis-cloud
|
|
9
|
+
|
|
10
|
+
|
|
1
11
|
# v2.0.0-beta.2
|
|
2
12
|
`2023-06-28`
|
|
3
13
|
|
package/dist/esm/Avatar.js
CHANGED
|
@@ -29,6 +29,7 @@ import { My } from "@nutui/icons-react";
|
|
|
29
29
|
import { A as AvatarContext } from "./context2.js";
|
|
30
30
|
import Image from "./Image.js";
|
|
31
31
|
import { C as ComponentDefaults } from "./typings.js";
|
|
32
|
+
import AvatarGroup from "./AvatarGroup.js";
|
|
32
33
|
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
33
34
|
size: "",
|
|
34
35
|
shape: "round",
|
|
@@ -119,6 +120,7 @@ var Avatar = function Avatar2(props) {
|
|
|
119
120
|
};
|
|
120
121
|
Avatar.defaultProps = defaultProps;
|
|
121
122
|
Avatar.displayName = "NutAvatar";
|
|
123
|
+
Avatar.Group = AvatarGroup;
|
|
122
124
|
export {
|
|
123
125
|
Avatar as default
|
|
124
126
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import '../../CellGroup/style'
|
|
2
2
|
import '../../../packages/cell/cell.scss'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.nut-cell{position:relative;display:flex;width:100%;line-height:var(--nutui-cell-line-height, 20px);padding:var(--nutui-cell-padding, 13px 16px);background-color:var(--nutui-cell-background-color, var(--nutui-gray-6, #ffffff));border-radius:var(--nutui-cell-border-radius, 6px);box-shadow:var(--nutui-cell-box-shadow, 0px 1px 7px 0px rgb(237, 238, 241));font-size:var(--nutui-cell-title-font-size, var(--nutui-font-size-2, 14px));color:var(--nutui-cell-title-color, var(--nutui-gray-1, #1a1a1a));margin:10px 0;box-sizing:border-box}.nut-cell__left{display:flex;flex-direction:column;flex:1}.nut-cell__description{font-size:var(--nutui-cell-description-font-size, var(--nutui-font-size-1, 12px));color:var(--nutui-cell-description-color, var(--nutui-gray-2, #757575))}.nut-cell__extra{display:inline-flex;justify-content:flex-end;align-items:center;flex:1;min-width:0;word-break:break-all;font-size:var(--nutui-cell-extra-font-size, var(--nutui-font-size-2, 14px));color:var(--nutui-cell-extra-color, var(--nutui-gray-2, #757575))}
|
|
1
|
+
.nut-cell-group{display:block}.nut-cell-group__title{display:inherit;padding:var(--nutui-cell-group-title-padding, 0 10px);color:var(--nutui-cell-group-title-color, #909ca4);font-size:var(--nutui-cell-group-title-font-size, var(--nutui-font-size-2, 14px));line-height:var(--nutui-cell-group-title-line-height, 20px);margin-top:30px;margin-bottom:10px}.nut-cell-group__description{display:inherit;padding:var(--nutui-cell-group-description-padding, 0 10px);color:var(--nutui-cell-group-description-color, #909ca4);font-size:var(--nutui-cell-group-description-font-size, var(--nutui-font-size-1, 12px));line-height:var(--nutui-cell-group-description-line-height, 16px);margin-top:10px;margin-bottom:10px}.nut-cell-group__wrap{display:inherit;border-radius:var(--nutui-cell-border-radius, 6px);overflow:hidden;background-color:var(--nutui-cell-group-background-color, var(--nutui-gray-6, #ffffff));margin:10px 0}.nut-cell-group__wrap .nut-cell{margin:0;box-shadow:none;border-radius:0}.nut-cell-group__wrap--divider .nut-cell__divider{position:absolute;box-sizing:border-box;pointer-events:none;right:var(--nutui-cell-divider-right, 16px);bottom:0;left:var(--nutui-cell-divider-left, 16px);transform:scaleY(.5);border-top:var(--nutui-cell-divider-border-bottom, 2px solid #f5f6f7)}.nut-cell-group__wrap--divider .nut-cell:last-child .nut-cell__divider{border-top:0!important}.nut-cell{position:relative;display:flex;width:100%;line-height:var(--nutui-cell-line-height, 20px);padding:var(--nutui-cell-padding, 13px 16px);background-color:var(--nutui-cell-background-color, var(--nutui-gray-6, #ffffff));border-radius:var(--nutui-cell-border-radius, 6px);box-shadow:var(--nutui-cell-box-shadow, 0px 1px 7px 0px rgb(237, 238, 241));font-size:var(--nutui-cell-title-font-size, var(--nutui-font-size-2, 14px));color:var(--nutui-cell-title-color, var(--nutui-gray-1, #1a1a1a));margin:10px 0;box-sizing:border-box}.nut-cell__left{display:flex;flex-direction:column;flex:1}.nut-cell__description{font-size:var(--nutui-cell-description-font-size, var(--nutui-font-size-1, 12px));color:var(--nutui-cell-description-color, var(--nutui-gray-2, #757575))}.nut-cell__extra{display:inline-flex;justify-content:flex-end;align-items:center;flex:1;min-width:0;word-break:break-all;font-size:var(--nutui-cell-extra-font-size, var(--nutui-font-size-2, 14px));color:var(--nutui-cell-extra-color, var(--nutui-gray-2, #757575))}
|
package/dist/esm/Cell.js
CHANGED
|
@@ -25,6 +25,7 @@ function _objectSpread(target) {
|
|
|
25
25
|
import React__default from "react";
|
|
26
26
|
import classNames from "classnames";
|
|
27
27
|
import { C as ComponentDefaults } from "./typings.js";
|
|
28
|
+
import CellGroup from "./CellGroup.js";
|
|
28
29
|
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
29
30
|
title: null,
|
|
30
31
|
description: null,
|
|
@@ -68,6 +69,7 @@ var Cell = function Cell2(props) {
|
|
|
68
69
|
};
|
|
69
70
|
Cell.defaultProps = defaultProps;
|
|
70
71
|
Cell.displayName = "NutCell";
|
|
72
|
+
Cell.Group = CellGroup;
|
|
71
73
|
export {
|
|
72
74
|
Cell as default
|
|
73
75
|
};
|
package/dist/esm/CellGroup.js
CHANGED
|
@@ -1,7 +1,50 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
var _excluded = ["children", "className", "style", "title", "description", "divider"];
|
|
4
|
+
function ownKeys(object, enumerableOnly) {
|
|
5
|
+
var keys = Object.keys(object);
|
|
6
|
+
if (Object.getOwnPropertySymbols) {
|
|
7
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
8
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
9
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
10
|
+
})), keys.push.apply(keys, symbols);
|
|
11
|
+
}
|
|
12
|
+
return keys;
|
|
13
|
+
}
|
|
14
|
+
function _objectSpread(target) {
|
|
15
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
16
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
17
|
+
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
18
|
+
_defineProperty(target, key, source[key]);
|
|
19
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
20
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return target;
|
|
24
|
+
}
|
|
25
|
+
import React__default from "react";
|
|
26
|
+
import classNames from "classnames";
|
|
27
|
+
import { C as ComponentDefaults } from "./typings.js";
|
|
28
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
29
|
+
title: "",
|
|
30
|
+
description: "",
|
|
31
|
+
divider: true
|
|
32
|
+
});
|
|
33
|
+
var classPrefix = "nut-cell-group";
|
|
34
|
+
var CellGroup = function CellGroup2(props) {
|
|
35
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children, className = _defaultProps$props.className, style = _defaultProps$props.style, title = _defaultProps$props.title, description = _defaultProps$props.description, divider = _defaultProps$props.divider, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
36
|
+
return React__default.createElement("div", _objectSpread({
|
|
37
|
+
className: classNames(classPrefix, className)
|
|
38
|
+
}, rest), title ? React__default.createElement("div", {
|
|
39
|
+
className: "".concat(classPrefix, "__title")
|
|
40
|
+
}, title) : null, description ? React__default.createElement("div", {
|
|
41
|
+
className: "".concat(classPrefix, "__description")
|
|
42
|
+
}, description) : null, React__default.createElement("div", {
|
|
43
|
+
className: "".concat(classPrefix, "__wrap ").concat(divider ? "".concat(classPrefix, "__wrap--divider") : "")
|
|
44
|
+
}, children));
|
|
45
|
+
};
|
|
46
|
+
CellGroup.defaultProps = defaultProps;
|
|
47
|
+
CellGroup.displayName = "NutCellGroup";
|
|
5
48
|
export {
|
|
6
49
|
CellGroup as default
|
|
7
50
|
};
|
package/dist/esm/Form.js
CHANGED
|
@@ -27,7 +27,6 @@ function _objectSpread(target) {
|
|
|
27
27
|
}
|
|
28
28
|
import React__default, { useRef } from "react";
|
|
29
29
|
import classNames from "classnames";
|
|
30
|
-
import { C as CellGroup } from "./cellgroup2.js";
|
|
31
30
|
import { C as Context, F as FormItem } from "./formitem2.js";
|
|
32
31
|
import { C as ComponentDefaults } from "./typings.js";
|
|
33
32
|
import Cell from "./Cell.js";
|
|
@@ -1255,7 +1254,7 @@ var Form = function Form2(props) {
|
|
|
1255
1254
|
e.stopPropagation();
|
|
1256
1255
|
resetFields();
|
|
1257
1256
|
}
|
|
1258
|
-
}, React__default.createElement(
|
|
1257
|
+
}, React__default.createElement(Cell.Group, null, React__default.createElement(Context.Provider, {
|
|
1259
1258
|
value: formInstance
|
|
1260
1259
|
}, children), footer ? React__default.createElement(Cell, null, footer) : null));
|
|
1261
1260
|
};
|
package/dist/esm/Menu.js
CHANGED
|
@@ -27,7 +27,12 @@ function _objectSpread(target) {
|
|
|
27
27
|
import React__default, { useRef, useState, useEffect } from "react";
|
|
28
28
|
import classNames from "classnames";
|
|
29
29
|
import { ArrowUp2, ArrowDown2 } from "@nutui/icons-react";
|
|
30
|
+
import { M as MenuItem } from "./menuitem2.js";
|
|
30
31
|
import { C as ComponentDefaults } from "./typings.js";
|
|
32
|
+
import "react-transition-group";
|
|
33
|
+
import "./overlay2.js";
|
|
34
|
+
import "./use-click-away.js";
|
|
35
|
+
import "./index.js";
|
|
31
36
|
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
32
37
|
activeColor: "",
|
|
33
38
|
closeOnOverlayClick: true,
|
|
@@ -150,6 +155,7 @@ var Menu = function Menu2(props) {
|
|
|
150
155
|
};
|
|
151
156
|
Menu.defaultProps = defaultProps;
|
|
152
157
|
Menu.displayName = "NutMenu";
|
|
158
|
+
Menu.Item = MenuItem;
|
|
153
159
|
export {
|
|
154
160
|
Menu as default
|
|
155
161
|
};
|
package/dist/esm/MenuItem.js
CHANGED
|
@@ -1,157 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
})), keys.push.apply(keys, symbols);
|
|
10
|
-
}
|
|
11
|
-
return keys;
|
|
12
|
-
}
|
|
13
|
-
function _objectSpread(target) {
|
|
14
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
15
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
16
|
-
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
17
|
-
_defineProperty(target, key, source[key]);
|
|
18
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
19
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return target;
|
|
23
|
-
}
|
|
24
|
-
import React__default, { forwardRef, useState, useEffect, useImperativeHandle, useRef } from "react";
|
|
25
|
-
import classNames from "classnames";
|
|
26
|
-
import { CSSTransition } from "react-transition-group";
|
|
27
|
-
import { Check } from "@nutui/icons-react";
|
|
28
|
-
import { O as Overlay } from "./overlay2.js";
|
|
29
|
-
import { u as useClickAway } from "./use-click-away.js";
|
|
30
|
-
import { C as ComponentDefaults } from "./typings.js";
|
|
1
|
+
import { M as MenuItem } from "./menuitem2.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import "classnames";
|
|
4
|
+
import "react-transition-group";
|
|
5
|
+
import "@nutui/icons-react";
|
|
6
|
+
import "./overlay2.js";
|
|
7
|
+
import "./typings.js";
|
|
8
|
+
import "./use-click-away.js";
|
|
31
9
|
import "./index.js";
|
|
32
|
-
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
33
|
-
columns: 1,
|
|
34
|
-
direction: "down",
|
|
35
|
-
icon: null,
|
|
36
|
-
activeTitleClass: "",
|
|
37
|
-
inactiveTitleClass: "",
|
|
38
|
-
onChange: function onChange(value) {
|
|
39
|
-
return void 0;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
var MenuItem = forwardRef(function(props, ref) {
|
|
43
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, style = _defaultProps$props.style, options = _defaultProps$props.options, value = _defaultProps$props.value, columns = _defaultProps$props.columns, title = _defaultProps$props.title, icon = _defaultProps$props.icon, direction = _defaultProps$props.direction, onChange2 = _defaultProps$props.onChange, activeTitleClass = _defaultProps$props.activeTitleClass, inactiveTitleClass = _defaultProps$props.inactiveTitleClass, closeOnClickAway = _defaultProps$props.closeOnClickAway, children = _defaultProps$props.children, activeColor = _defaultProps$props.activeColor, show = _defaultProps$props.show, parent = _defaultProps$props.parent, index = _defaultProps$props.index;
|
|
44
|
-
var _useState = useState(show), _useState2 = _slicedToArray(_useState, 2), _showPopup = _useState2[0], setShowPopup = _useState2[1];
|
|
45
|
-
var _useState3 = useState(value), _useState4 = _slicedToArray(_useState3, 2), _value = _useState4[0], setValue = _useState4[1];
|
|
46
|
-
useEffect(function() {
|
|
47
|
-
setShowPopup(show);
|
|
48
|
-
}, [show]);
|
|
49
|
-
useImperativeHandle(ref, function() {
|
|
50
|
-
return {
|
|
51
|
-
toggle: parent.toggleMenuItem
|
|
52
|
-
};
|
|
53
|
-
});
|
|
54
|
-
var getIconCName = function getIconCName2(optionVal, value2) {
|
|
55
|
-
var _classNames;
|
|
56
|
-
return classNames((_classNames = {}, _defineProperty(_classNames, activeTitleClass, optionVal === value2), _defineProperty(_classNames, inactiveTitleClass, optionVal !== value2), _classNames));
|
|
57
|
-
};
|
|
58
|
-
var setTitle = function setTitle2(text) {
|
|
59
|
-
if (!title) {
|
|
60
|
-
parent.updateTitle(text, index);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
var handleClick = function handleClick2(item) {
|
|
64
|
-
parent.toggleMenuItem(index);
|
|
65
|
-
setTitle(item.text);
|
|
66
|
-
setValue(item.value);
|
|
67
|
-
onChange2 && onChange2(item);
|
|
68
|
-
};
|
|
69
|
-
var isShow = function isShow2() {
|
|
70
|
-
if (_showPopup)
|
|
71
|
-
return {};
|
|
72
|
-
return {
|
|
73
|
-
display: "none"
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
var getPosition = function getPosition2() {
|
|
77
|
-
return direction === "down" ? {
|
|
78
|
-
position: "absolute",
|
|
79
|
-
height: "".concat(window.innerHeight, "px")
|
|
80
|
-
} : {
|
|
81
|
-
position: "absolute",
|
|
82
|
-
bottom: "100%",
|
|
83
|
-
top: "auto",
|
|
84
|
-
height: "".concat(window.innerHeight, "px")
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
var micRef = useRef(null);
|
|
88
|
-
var targetSet = [micRef.current];
|
|
89
|
-
useClickAway(
|
|
90
|
-
function() {
|
|
91
|
-
parent.hideMenuItem(index);
|
|
92
|
-
},
|
|
93
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
94
|
-
// @ts-ignore
|
|
95
|
-
targetSet,
|
|
96
|
-
"click",
|
|
97
|
-
false,
|
|
98
|
-
_showPopup,
|
|
99
|
-
closeOnClickAway
|
|
100
|
-
);
|
|
101
|
-
return React__default.createElement("div", {
|
|
102
|
-
className: "nut-menu-item-container",
|
|
103
|
-
ref: micRef,
|
|
104
|
-
style: {
|
|
105
|
-
position: "absolute",
|
|
106
|
-
left: 0,
|
|
107
|
-
right: 0
|
|
108
|
-
}
|
|
109
|
-
}, React__default.createElement(Overlay, {
|
|
110
|
-
className: "nut-menu__overlay",
|
|
111
|
-
style: getPosition(),
|
|
112
|
-
lockScroll: parent.lockScroll,
|
|
113
|
-
visible: _showPopup,
|
|
114
|
-
closeOnOverlayClick: parent.closeOnOverlayClick,
|
|
115
|
-
onClick: function onClick() {
|
|
116
|
-
parent.closeOnOverlayClick && parent.toggleMenuItem(index);
|
|
117
|
-
}
|
|
118
|
-
}), React__default.createElement("div", {
|
|
119
|
-
className: classNames(className, {
|
|
120
|
-
"nut-menu-item__wrap": direction === "down",
|
|
121
|
-
"nut-menu-item__wrap-up": direction !== "down"
|
|
122
|
-
}),
|
|
123
|
-
style: _objectSpread(_objectSpread({}, style), isShow())
|
|
124
|
-
}, React__default.createElement(CSSTransition, {
|
|
125
|
-
"in": _showPopup,
|
|
126
|
-
timeout: 100,
|
|
127
|
-
classNames: direction === "down" ? "menu-item" : "menu-item-up"
|
|
128
|
-
}, React__default.createElement("div", {
|
|
129
|
-
className: "nut-menu-item__content"
|
|
130
|
-
}, options === null || options === void 0 ? void 0 : options.map(function(item) {
|
|
131
|
-
return React__default.createElement("div", {
|
|
132
|
-
className: "nut-menu-item__option ".concat(classNames({
|
|
133
|
-
active: item.value === _value
|
|
134
|
-
})),
|
|
135
|
-
key: item.text,
|
|
136
|
-
style: {
|
|
137
|
-
flexBasis: "".concat(100 / columns, "%")
|
|
138
|
-
},
|
|
139
|
-
onClick: function onClick() {
|
|
140
|
-
handleClick(item);
|
|
141
|
-
}
|
|
142
|
-
}, item.value === _value ? React__default.createElement("i", null, icon || React__default.createElement(Check, {
|
|
143
|
-
color: activeColor,
|
|
144
|
-
className: getIconCName(item.value, value)
|
|
145
|
-
})) : null, React__default.createElement("div", {
|
|
146
|
-
className: getIconCName(item.value, value),
|
|
147
|
-
style: {
|
|
148
|
-
color: "".concat(item.value === _value ? activeColor : "")
|
|
149
|
-
}
|
|
150
|
-
}, item.text));
|
|
151
|
-
}), children))));
|
|
152
|
-
});
|
|
153
|
-
MenuItem.defaultProps = defaultProps;
|
|
154
|
-
MenuItem.displayName = "NutMenuItem";
|
|
155
10
|
export {
|
|
156
11
|
MenuItem as default
|
|
157
12
|
};
|
package/dist/esm/Swiper.js
CHANGED
|
@@ -29,6 +29,7 @@ import classNames from "classnames";
|
|
|
29
29
|
import { D as DataContext } from "./context4.js";
|
|
30
30
|
import { g as getRect } from "./use-client-rect.js";
|
|
31
31
|
import Indicator from "./Indicator.js";
|
|
32
|
+
import SwiperItem from "./SwiperItem.js";
|
|
32
33
|
var defaultProps = {
|
|
33
34
|
width: (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" ? window.innerWidth : 375,
|
|
34
35
|
height: 0,
|
|
@@ -447,6 +448,8 @@ var Swiper = React__default.forwardRef(function(props, ref) {
|
|
|
447
448
|
});
|
|
448
449
|
Swiper.defaultProps = defaultProps;
|
|
449
450
|
Swiper.displayName = "NutSwiper";
|
|
451
|
+
var InnerSwiper = Swiper;
|
|
452
|
+
InnerSwiper.Item = SwiperItem;
|
|
450
453
|
export {
|
|
451
|
-
|
|
454
|
+
InnerSwiper as default
|
|
452
455
|
};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
function ownKeys(object, enumerableOnly) {
|
|
4
|
+
var keys = Object.keys(object);
|
|
5
|
+
if (Object.getOwnPropertySymbols) {
|
|
6
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
8
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
9
|
+
})), keys.push.apply(keys, symbols);
|
|
10
|
+
}
|
|
11
|
+
return keys;
|
|
12
|
+
}
|
|
13
|
+
function _objectSpread(target) {
|
|
14
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
15
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
16
|
+
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
17
|
+
_defineProperty(target, key, source[key]);
|
|
18
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
19
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return target;
|
|
23
|
+
}
|
|
24
|
+
import React__default, { forwardRef, useState, useEffect, useImperativeHandle, useRef } from "react";
|
|
25
|
+
import classNames from "classnames";
|
|
26
|
+
import { CSSTransition } from "react-transition-group";
|
|
27
|
+
import { Check } from "@nutui/icons-react";
|
|
28
|
+
import { O as Overlay } from "./overlay2.js";
|
|
29
|
+
import { u as useClickAway } from "./use-click-away.js";
|
|
30
|
+
import { C as ComponentDefaults } from "./typings.js";
|
|
31
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
32
|
+
columns: 1,
|
|
33
|
+
direction: "down",
|
|
34
|
+
icon: null,
|
|
35
|
+
activeTitleClass: "",
|
|
36
|
+
inactiveTitleClass: "",
|
|
37
|
+
onChange: function onChange(value) {
|
|
38
|
+
return void 0;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
var MenuItem = forwardRef(function(props, ref) {
|
|
42
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, style = _defaultProps$props.style, options = _defaultProps$props.options, value = _defaultProps$props.value, columns = _defaultProps$props.columns, title = _defaultProps$props.title, icon = _defaultProps$props.icon, direction = _defaultProps$props.direction, onChange2 = _defaultProps$props.onChange, activeTitleClass = _defaultProps$props.activeTitleClass, inactiveTitleClass = _defaultProps$props.inactiveTitleClass, closeOnClickAway = _defaultProps$props.closeOnClickAway, children = _defaultProps$props.children, activeColor = _defaultProps$props.activeColor, show = _defaultProps$props.show, parent = _defaultProps$props.parent, index = _defaultProps$props.index;
|
|
43
|
+
var _useState = useState(show), _useState2 = _slicedToArray(_useState, 2), _showPopup = _useState2[0], setShowPopup = _useState2[1];
|
|
44
|
+
var _useState3 = useState(value), _useState4 = _slicedToArray(_useState3, 2), _value = _useState4[0], setValue = _useState4[1];
|
|
45
|
+
useEffect(function() {
|
|
46
|
+
setShowPopup(show);
|
|
47
|
+
}, [show]);
|
|
48
|
+
useImperativeHandle(ref, function() {
|
|
49
|
+
return {
|
|
50
|
+
toggle: parent.toggleMenuItem
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
var getIconCName = function getIconCName2(optionVal, value2) {
|
|
54
|
+
var _classNames;
|
|
55
|
+
return classNames((_classNames = {}, _defineProperty(_classNames, activeTitleClass, optionVal === value2), _defineProperty(_classNames, inactiveTitleClass, optionVal !== value2), _classNames));
|
|
56
|
+
};
|
|
57
|
+
var setTitle = function setTitle2(text) {
|
|
58
|
+
if (!title) {
|
|
59
|
+
parent.updateTitle(text, index);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var handleClick = function handleClick2(item) {
|
|
63
|
+
parent.toggleMenuItem(index);
|
|
64
|
+
setTitle(item.text);
|
|
65
|
+
setValue(item.value);
|
|
66
|
+
onChange2 && onChange2(item);
|
|
67
|
+
};
|
|
68
|
+
var isShow = function isShow2() {
|
|
69
|
+
if (_showPopup)
|
|
70
|
+
return {};
|
|
71
|
+
return {
|
|
72
|
+
display: "none"
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
var getPosition = function getPosition2() {
|
|
76
|
+
return direction === "down" ? {
|
|
77
|
+
position: "absolute",
|
|
78
|
+
height: "".concat(window.innerHeight, "px")
|
|
79
|
+
} : {
|
|
80
|
+
position: "absolute",
|
|
81
|
+
bottom: "100%",
|
|
82
|
+
top: "auto",
|
|
83
|
+
height: "".concat(window.innerHeight, "px")
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
var micRef = useRef(null);
|
|
87
|
+
var targetSet = [micRef.current];
|
|
88
|
+
useClickAway(
|
|
89
|
+
function() {
|
|
90
|
+
parent.hideMenuItem(index);
|
|
91
|
+
},
|
|
92
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
93
|
+
// @ts-ignore
|
|
94
|
+
targetSet,
|
|
95
|
+
"click",
|
|
96
|
+
false,
|
|
97
|
+
_showPopup,
|
|
98
|
+
closeOnClickAway
|
|
99
|
+
);
|
|
100
|
+
return React__default.createElement("div", {
|
|
101
|
+
className: "nut-menu-item-container",
|
|
102
|
+
ref: micRef,
|
|
103
|
+
style: {
|
|
104
|
+
position: "absolute",
|
|
105
|
+
left: 0,
|
|
106
|
+
right: 0
|
|
107
|
+
}
|
|
108
|
+
}, React__default.createElement(Overlay, {
|
|
109
|
+
className: "nut-menu__overlay",
|
|
110
|
+
style: getPosition(),
|
|
111
|
+
lockScroll: parent.lockScroll,
|
|
112
|
+
visible: _showPopup,
|
|
113
|
+
closeOnOverlayClick: parent.closeOnOverlayClick,
|
|
114
|
+
onClick: function onClick() {
|
|
115
|
+
parent.closeOnOverlayClick && parent.toggleMenuItem(index);
|
|
116
|
+
}
|
|
117
|
+
}), React__default.createElement("div", {
|
|
118
|
+
className: classNames(className, {
|
|
119
|
+
"nut-menu-item__wrap": direction === "down",
|
|
120
|
+
"nut-menu-item__wrap-up": direction !== "down"
|
|
121
|
+
}),
|
|
122
|
+
style: _objectSpread(_objectSpread({}, style), isShow())
|
|
123
|
+
}, React__default.createElement(CSSTransition, {
|
|
124
|
+
"in": _showPopup,
|
|
125
|
+
timeout: 100,
|
|
126
|
+
classNames: direction === "down" ? "menu-item" : "menu-item-up"
|
|
127
|
+
}, React__default.createElement("div", {
|
|
128
|
+
className: "nut-menu-item__content"
|
|
129
|
+
}, options === null || options === void 0 ? void 0 : options.map(function(item) {
|
|
130
|
+
return React__default.createElement("div", {
|
|
131
|
+
className: "nut-menu-item__option ".concat(classNames({
|
|
132
|
+
active: item.value === _value
|
|
133
|
+
})),
|
|
134
|
+
key: item.text,
|
|
135
|
+
style: {
|
|
136
|
+
flexBasis: "".concat(100 / columns, "%")
|
|
137
|
+
},
|
|
138
|
+
onClick: function onClick() {
|
|
139
|
+
handleClick(item);
|
|
140
|
+
}
|
|
141
|
+
}, item.value === _value ? React__default.createElement("i", null, icon || React__default.createElement(Check, {
|
|
142
|
+
color: activeColor,
|
|
143
|
+
className: getIconCName(item.value, value)
|
|
144
|
+
})) : null, React__default.createElement("div", {
|
|
145
|
+
className: getIconCName(item.value, value),
|
|
146
|
+
style: {
|
|
147
|
+
color: "".concat(item.value === _value ? activeColor : "")
|
|
148
|
+
}
|
|
149
|
+
}, item.text));
|
|
150
|
+
}), children))));
|
|
151
|
+
});
|
|
152
|
+
MenuItem.defaultProps = defaultProps;
|
|
153
|
+
MenuItem.displayName = "NutMenuItem";
|
|
154
|
+
export {
|
|
155
|
+
MenuItem as M
|
|
156
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
2
|
import { BasicComponent } from '@/utils/typings';
|
|
3
|
+
import AvatarGroup from '@/packages/avatargroup';
|
|
3
4
|
export interface AvatarProps extends BasicComponent {
|
|
4
5
|
size: string;
|
|
5
6
|
icon: React.ReactNode;
|
|
@@ -13,4 +14,6 @@ export interface AvatarProps extends BasicComponent {
|
|
|
13
14
|
onError: () => void;
|
|
14
15
|
}
|
|
15
16
|
export type AvatarShape = 'round' | 'square';
|
|
16
|
-
export declare const Avatar: FunctionComponent<Partial<AvatarProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'
|
|
17
|
+
export declare const Avatar: FunctionComponent<Partial<AvatarProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'>> & {
|
|
18
|
+
Group: typeof AvatarGroup;
|
|
19
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
2
|
import { BasicComponent } from '@/utils/typings';
|
|
3
|
+
import AvatarGroup from '@/packages/avatargroup/index.taro';
|
|
3
4
|
export interface AvatarProps extends BasicComponent {
|
|
4
5
|
size: string;
|
|
5
6
|
icon: React.ReactNode;
|
|
@@ -13,4 +14,6 @@ export interface AvatarProps extends BasicComponent {
|
|
|
13
14
|
onError: () => void;
|
|
14
15
|
}
|
|
15
16
|
export type AvatarShape = 'round' | 'square';
|
|
16
|
-
export declare const Avatar: FunctionComponent<Partial<AvatarProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'
|
|
17
|
+
export declare const Avatar: FunctionComponent<Partial<AvatarProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'>> & {
|
|
18
|
+
Group: typeof AvatarGroup;
|
|
19
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { FunctionComponent, ReactNode } from 'react';
|
|
2
2
|
import { BasicComponent } from '@/utils/typings';
|
|
3
|
+
import CellGroup from '@/packages/cellgroup';
|
|
3
4
|
export interface CellProps extends BasicComponent {
|
|
4
5
|
title: ReactNode;
|
|
5
6
|
description: ReactNode;
|
|
@@ -8,4 +9,6 @@ export interface CellProps extends BasicComponent {
|
|
|
8
9
|
align: string;
|
|
9
10
|
onClick: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
10
11
|
}
|
|
11
|
-
export declare const Cell: FunctionComponent<Partial<CellProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'title'
|
|
12
|
+
export declare const Cell: FunctionComponent<Partial<CellProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'title'>> & {
|
|
13
|
+
Group: typeof CellGroup;
|
|
14
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { FunctionComponent, ReactNode } from 'react';
|
|
2
2
|
import { BasicComponent } from '@/utils/typings';
|
|
3
|
+
import { CellGroup } from '@/packages/cellgroup/cellgroup.taro';
|
|
3
4
|
export interface CellProps extends BasicComponent {
|
|
4
5
|
title: ReactNode;
|
|
5
6
|
description: ReactNode;
|
|
@@ -8,4 +9,6 @@ export interface CellProps extends BasicComponent {
|
|
|
8
9
|
align: string;
|
|
9
10
|
onClick: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
10
11
|
}
|
|
11
|
-
export declare const Cell: FunctionComponent<Partial<CellProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'title'
|
|
12
|
+
export declare const Cell: FunctionComponent<Partial<CellProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'title'>> & {
|
|
13
|
+
Group: typeof CellGroup;
|
|
14
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
|
+
import { MenuItem } from '@/packages/menuitem/menuitem';
|
|
2
3
|
import { BasicComponent } from '@/utils/typings';
|
|
3
4
|
export interface MenuProps extends BasicComponent {
|
|
4
5
|
activeColor: string;
|
|
@@ -8,4 +9,6 @@ export interface MenuProps extends BasicComponent {
|
|
|
8
9
|
icon: React.ReactNode;
|
|
9
10
|
children: React.ReactNode;
|
|
10
11
|
}
|
|
11
|
-
export declare const Menu: FunctionComponent<Partial<MenuProps
|
|
12
|
+
export declare const Menu: FunctionComponent<Partial<MenuProps>> & {
|
|
13
|
+
Item: typeof MenuItem;
|
|
14
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
|
+
import { MenuItem } from '@/packages/menuitem/menuitem.taro';
|
|
2
3
|
import { BasicComponent } from '@/utils/typings';
|
|
3
4
|
export interface MenuProps extends BasicComponent {
|
|
4
5
|
activeColor: string;
|
|
@@ -8,4 +9,6 @@ export interface MenuProps extends BasicComponent {
|
|
|
8
9
|
icon: React.ReactNode;
|
|
9
10
|
children: React.ReactNode;
|
|
10
11
|
}
|
|
11
|
-
export declare const Menu: FunctionComponent<Partial<MenuProps
|
|
12
|
+
export declare const Menu: FunctionComponent<Partial<MenuProps>> & {
|
|
13
|
+
Item: typeof MenuItem;
|
|
14
|
+
};
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SwiperProps, SwiperRef } from './swiper';
|
|
3
|
+
import SwiperItem from '@/packages/swiperitem';
|
|
2
4
|
export type { SwiperProps, SwiperRef } from './swiper';
|
|
3
|
-
|
|
5
|
+
type CompoundedComponent = React.ForwardRefExoticComponent<Partial<SwiperProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> & React.RefAttributes<SwiperRef>> & {
|
|
6
|
+
Item: typeof SwiperItem;
|
|
7
|
+
};
|
|
8
|
+
declare const InnerSwiper: CompoundedComponent;
|
|
9
|
+
export default InnerSwiper;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SwiperProps } from './swiper.taro';
|
|
3
|
+
import SwiperItem from '@/packages/swiperitem/index.taro';
|
|
2
4
|
export type { SwiperProps } from './swiper.taro';
|
|
3
|
-
|
|
5
|
+
type CompoundedComponent = React.ForwardRefExoticComponent<Partial<SwiperProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> & React.RefAttributes<any>> & {
|
|
6
|
+
Item: typeof SwiperItem;
|
|
7
|
+
};
|
|
8
|
+
declare const InnerSwiper: CompoundedComponent;
|
|
9
|
+
export default InnerSwiper;
|
package/dist/locales/base.js
CHANGED
package/dist/locales/en-US.js
CHANGED
package/dist/locales/id-ID.js
CHANGED
package/dist/locales/tr-TR.js
CHANGED
package/dist/locales/zh-CN.js
CHANGED