@nutui/nutui-react 2.3.8-beta.0 → 2.3.8
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 +23 -0
- package/dist/esm/NavBar/style/style.css +1 -1
- package/dist/esm/NavBar.js +49 -5
- package/dist/esm/Picker.js +1 -13
- package/dist/esm/RadioGroup.js +3 -2
- package/dist/esm/Rate/style/style.css +1 -1
- package/dist/esm/Rate.js +90 -4
- package/dist/esm/Step/style/style.css +1 -1
- package/dist/esm/Step.js +1 -1
- package/dist/esm/Steps/style/style.css +1 -1
- package/dist/esm/radio2.js +4 -4
- package/dist/esm/types/src/packages/navbar/navbar.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/radio/index.d.ts +2 -1
- package/dist/esm/types/src/packages/radio/index.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/radio/radio.d.ts +1 -2
- package/dist/esm/types/src/packages/radio/radio.taro.d.ts +1 -2
- package/dist/esm/types/src/packages/radio/types.d.ts +2 -0
- package/dist/esm/types/src/packages/radiogroup/context.d.ts +2 -0
- package/dist/esm/types/src/packages/radiogroup/index.d.ts +1 -0
- package/dist/esm/types/src/packages/radiogroup/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/radiogroup/radiogroup.d.ts +4 -6
- package/dist/esm/types/src/packages/radiogroup/radiogroup.taro.d.ts +4 -6
- package/dist/esm/types/src/packages/radiogroup/types.d.ts +4 -0
- package/dist/esm/types/src/packages/rate/rate.d.ts +2 -0
- package/dist/esm/types/src/packages/rate/rate.taro.d.ts +2 -0
- package/dist/esm/types/src/packages/video/video.taro.d.ts +4 -5
- package/dist/esm/use-refs.js +17 -0
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/tr-TR.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.es.js +136 -21
- package/dist/nutui.react.umd.js +136 -21
- package/dist/packages/navbar/navbar.scss +7 -0
- package/dist/packages/rate/rate.scss +1 -0
- package/dist/packages/step/step.scss +5 -4
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/types/packages/navbar/navbar.taro.d.ts +2 -1
- package/dist/types/packages/overlay/overlay.d.ts +5 -1
- package/dist/types/packages/radio/index.d.ts +2 -1
- package/dist/types/packages/radio/index.taro.d.ts +2 -1
- package/dist/types/packages/radio/radio.d.ts +1 -2
- package/dist/types/packages/radio/radio.taro.d.ts +1 -2
- package/dist/types/packages/radio/types.d.ts +2 -0
- package/dist/types/packages/radiogroup/context.d.ts +2 -0
- package/dist/types/packages/radiogroup/index.d.ts +1 -0
- package/dist/types/packages/radiogroup/index.taro.d.ts +1 -0
- package/dist/types/packages/radiogroup/radiogroup.d.ts +8 -6
- package/dist/types/packages/radiogroup/radiogroup.taro.d.ts +4 -6
- package/dist/types/packages/radiogroup/types.d.ts +4 -0
- package/dist/types/packages/rate/rate.d.ts +10 -0
- package/dist/types/packages/rate/rate.taro.d.ts +2 -0
- package/dist/types/packages/video/video.taro.d.ts +4 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
# v2.3.8
|
|
2
|
+
`2024-01-26`
|
|
3
|
+
|
|
4
|
+
* 🔨 chore: 修复dev环境下demo分包体超过2M问题 (#1905) @xiaoyatong
|
|
5
|
+
* 📖 docs(configprovider): 文档可读性优化 (#1882) @Alex.huxiyang
|
|
6
|
+
* 📖 docs(grid): 文档可读性优化 (#1903) @Alex.huxiyang
|
|
7
|
+
* 📖 docs(swiper): customize pagination controls (#1892) @oasis
|
|
8
|
+
* :sparkles: feat(navbar): title区域自适应宽度 (#1891) @songsong
|
|
9
|
+
* :sparkles: feat(rate): 新增 touchable 属性支持滑动选择 (#1880) @Eiinu
|
|
10
|
+
* :sparkles: feat(video): support passing through attributes for Taro Video (#1890) @xiaoyatong
|
|
11
|
+
* :sparkles: feat: radiogroup add shape props (#1898) @oasis
|
|
12
|
+
* :bug: fix(ellipsis): 修复小程序文本省略问题 (#1888) @Eiinu
|
|
13
|
+
* :bug: fix(ellipsis): 在 taro 小程序下尽量展示的平滑舒适 (#1902) @xiaoyatong
|
|
14
|
+
* :bug: fix(image): 文档可读性优化 (#1887) @Alex.huxiyang
|
|
15
|
+
* :bug: fix(overlay): 文档可读性优化 (#1894) @Alex.huxiyang
|
|
16
|
+
* :bug: fix(rate): 修复 rate 高度问题 (#1883) @Eiinu
|
|
17
|
+
* :bug: fix(steps): 小程序的真机情况下出现的换行的情况 (#1899) @xiaoyatong
|
|
18
|
+
* :bug: fix(swiper): 轮播跳帧 (#1886) @oasis
|
|
19
|
+
* :bug: fix(tabs): 解决组件嵌套tabs,横向滚动位置计算偏差问题 (#1884) @songsong
|
|
20
|
+
* :bug: fix: doc、demo调整&优化 @huxiyang3
|
|
21
|
+
* :bug: fix: taro.createSelectorQuery not function (#1907) @oasis
|
|
22
|
+
|
|
23
|
+
|
|
1
24
|
# v2.3.7
|
|
2
25
|
`2024-01-19`
|
|
3
26
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.nut-navbar{width:var(--nutui-navbar-width, 100%);position:relative;display:flex;align-items:center;height:var(--nutui-navbar-height, 44px);box-sizing:border-box;background:var(--nutui-navbar-background, var(--nutui-gray-3, #f6f6f6));box-shadow:var(--nutui-navbar-box-shadow, 0px);font-size:var(--nutui-navbar-font-size, var(--nutui-font-size-3, 14px));color:var(--nutui-navbar-color, var(--nutui-gray-7, #1a1a1a));margin-bottom:var(--nutui-navbar-margin-bottom, 20px);overflow:hidden}.nut-navbar-fixed{position:fixed;top:0;left:0;width:100%}.nut-navbar-placeholder{display:inline-block;width:100%}.nut-navbar-safe-area-inset-top{padding-top:constant(safe-area-inset-top);padding-top:env(safe-area-inset-top)}.nut-navbar-title{min-width:53%;margin:0 auto;text-align:center;display:flex;align-items:center;justify-content:center;font-size:var(--nutui-navbar-title-font-size, var(--nutui-font-size-5, 18px));font-weight:var(--nutui-navbar-title-font-weight, var(--nutui-font-weight-bold, 500));color:var(--nutui-navbar-title-font-color, var(--nutui-gray-7, #1a1a1a))}.nut-navbar-title .nut-tabs-titles{background:transparent}.nut-navbar-title .nut-tabs-titles-item-text{color:var(--nutui-gray-7, #1a1a1a)}.nut-navbar-title .nut-tabpane{display:none}.nut-navbar-title ::-webkit-scrollbar{display:none}.nut-navbar-left,.nut-navbar-right{position:absolute;top:0;bottom:0;display:flex;align-items:center;cursor:pointer;padding:0 14px}.nut-navbar-left .nut-icon,.nut-navbar-left .nutui-iconfont,.nut-navbar-right .nut-icon,.nut-navbar-right .nutui-iconfont{width:20px;height:20px;font-size:20px}.nut-navbar-left{left:0}.nut-navbar-left-back{display:flex;align-items:center;justify-content:center;margin-right:10px}.nut-navbar-right{right:0}.nut-navbar-right .nut-icon{margin-left:12px}.nut-navbar-right .nut-icon:first-child{margin-left:0}.nut-navbar-title-align-left{padding:0 14px}.nut-navbar-title-align-left .nut-navbar-left{position:static;padding:0}.nut-navbar-title-align-left .nut-navbar-left .nut-icon{margin-left:12px}.nut-navbar-title-align-left .nut-navbar-left .nut-icon:first-child{margin-left:0}.nut-navbar-title-align-left .nut-navbar-left-back{margin-right:0}.nut-navbar-title-align-left .nut-navbar-title{margin:0;flex:1;justify-content:flex-start;padding:0 8px}
|
|
1
|
+
.nut-navbar{width:var(--nutui-navbar-width, 100%);position:relative;display:flex;align-items:center;height:var(--nutui-navbar-height, 44px);box-sizing:border-box;background:var(--nutui-navbar-background, var(--nutui-gray-3, #f6f6f6));box-shadow:var(--nutui-navbar-box-shadow, 0px);font-size:var(--nutui-navbar-font-size, var(--nutui-font-size-3, 14px));color:var(--nutui-navbar-color, var(--nutui-gray-7, #1a1a1a));margin-bottom:var(--nutui-navbar-margin-bottom, 20px);overflow:hidden}.nut-navbar-fixed{position:fixed;top:0;left:0;width:100%}.nut-navbar-placeholder{display:inline-block;width:100%}.nut-navbar-safe-area-inset-top{padding-top:constant(safe-area-inset-top);padding-top:env(safe-area-inset-top)}.nut-navbar-title{min-width:53%;margin:0 auto;text-align:center;display:flex;align-items:center;justify-content:center;font-size:var(--nutui-navbar-title-font-size, var(--nutui-font-size-5, 18px));font-weight:var(--nutui-navbar-title-font-weight, var(--nutui-font-weight-bold, 500));color:var(--nutui-navbar-title-font-color, var(--nutui-gray-7, #1a1a1a))}.nut-navbar-title .nut-tabs-titles{background:transparent}.nut-navbar-title .nut-tabs-titles-item-text{color:var(--nutui-gray-7, #1a1a1a)}.nut-navbar-title .nut-tabpane{display:none}.nut-navbar-title ::-webkit-scrollbar{display:none}.nut-navbar-left,.nut-navbar-right{position:absolute;top:0;bottom:0;display:flex;align-items:center;cursor:pointer;padding:0 14px}.nut-navbar-left .nut-icon,.nut-navbar-left .nutui-iconfont,.nut-navbar-right .nut-icon,.nut-navbar-right .nutui-iconfont{width:20px;height:20px;font-size:20px}.nut-navbar-left{left:0}.nut-navbar-left-back{display:flex;align-items:center;justify-content:center;margin-right:10px}.nut-navbar-right{right:0}.nut-navbar-right .nut-icon{margin-left:12px}.nut-navbar-right .nut-icon:first-child{margin-left:0}.nut-navbar-title-align-left{padding:0 14px}.nut-navbar-title-align-left .nut-navbar-left{position:static;padding:0}.nut-navbar-title-align-left .nut-navbar-left .nut-icon{margin-left:12px}.nut-navbar-title-align-left .nut-navbar-left .nut-icon:first-child{margin-left:0}.nut-navbar-title-align-left .nut-navbar-right{position:static;display:inline-flex;white-space:nowrap;padding-left:0}.nut-navbar-title-align-left .nut-navbar-left-back{margin-right:0}.nut-navbar-title-align-left .nut-navbar-title{min-width:0;margin:0;flex:1;justify-content:flex-start;padding:0 8px}
|
package/dist/esm/NavBar.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
function ownKeys(e, r) {
|
|
3
4
|
var t = Object.keys(e);
|
|
@@ -20,9 +21,10 @@ function _objectSpread(e) {
|
|
|
20
21
|
}
|
|
21
22
|
return e;
|
|
22
23
|
}
|
|
23
|
-
import React__default from "react";
|
|
24
|
+
import React__default, { useRef, useState, useEffect } from "react";
|
|
24
25
|
import classNames from "classnames";
|
|
25
26
|
import { C as ComponentDefaults } from "./typings.js";
|
|
27
|
+
import { g as getRect } from "./use-client-rect.js";
|
|
26
28
|
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
27
29
|
left: "",
|
|
28
30
|
right: "",
|
|
@@ -42,9 +44,40 @@ var NavBar = function NavBar2(props) {
|
|
|
42
44
|
zIndex
|
|
43
45
|
});
|
|
44
46
|
};
|
|
47
|
+
var leftRef = useRef(null);
|
|
48
|
+
var rightRef = useRef(null);
|
|
49
|
+
var wrapperRef = useRef(null);
|
|
50
|
+
var _useState = useState("50%"), _useState2 = _slicedToArray(_useState, 2), contentWidth = _useState2[0], setContentWidth = _useState2[1];
|
|
51
|
+
var getNodeWidth = function getNodeWidth2(node) {
|
|
52
|
+
if (node) {
|
|
53
|
+
var ele = getRect(node);
|
|
54
|
+
return ele.width;
|
|
55
|
+
}
|
|
56
|
+
return 0;
|
|
57
|
+
};
|
|
58
|
+
useEffect(function() {
|
|
59
|
+
if (titleAlign === "left") {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (!(back || left || right)) {
|
|
63
|
+
setContentWidth("100%");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
var leftRectWidth = getNodeWidth(leftRef === null || leftRef === void 0 ? void 0 : leftRef.current);
|
|
67
|
+
var rightRectWidth = getNodeWidth(rightRef === null || rightRef === void 0 ? void 0 : rightRef.current);
|
|
68
|
+
var wrapperWidth = getNodeWidth(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current);
|
|
69
|
+
var centerWidth = wrapperWidth / 2;
|
|
70
|
+
if (leftRectWidth && rightRectWidth) {
|
|
71
|
+
centerWidth = wrapperWidth - (leftRectWidth > rightRectWidth ? leftRectWidth * 2 : rightRectWidth * 2);
|
|
72
|
+
} else {
|
|
73
|
+
centerWidth = wrapperWidth - leftRectWidth * 2 - rightRectWidth * 2;
|
|
74
|
+
}
|
|
75
|
+
setContentWidth(centerWidth.toFixed(2));
|
|
76
|
+
}, [left, right, back]);
|
|
45
77
|
var renderLeft = function renderLeft2() {
|
|
46
78
|
return back || left ? React__default.createElement("div", {
|
|
47
|
-
className: "".concat(classPrefix, "-left")
|
|
79
|
+
className: "".concat(classPrefix, "-left"),
|
|
80
|
+
ref: leftRef
|
|
48
81
|
}, back && React__default.createElement("div", {
|
|
49
82
|
className: "".concat(classPrefix, "-left-back"),
|
|
50
83
|
onClick: function onClick(e) {
|
|
@@ -53,19 +86,30 @@ var NavBar = function NavBar2(props) {
|
|
|
53
86
|
}, back), left) : null;
|
|
54
87
|
};
|
|
55
88
|
var renderContent = function renderContent2() {
|
|
89
|
+
var titleStyle = {};
|
|
90
|
+
if (titleAlign === "center") {
|
|
91
|
+
var contentRealWidth = "".concat(contentWidth).concat(/%$/i.test(contentWidth) ? "" : "px");
|
|
92
|
+
titleStyle = {
|
|
93
|
+
minWidth: contentRealWidth,
|
|
94
|
+
width: contentRealWidth
|
|
95
|
+
};
|
|
96
|
+
}
|
|
56
97
|
return React__default.createElement("div", {
|
|
57
|
-
className: "".concat(classPrefix, "-title")
|
|
98
|
+
className: "".concat(classPrefix, "-title"),
|
|
99
|
+
style: titleStyle
|
|
58
100
|
}, children);
|
|
59
101
|
};
|
|
60
102
|
var renderRight = function renderRight2() {
|
|
61
103
|
return React__default.createElement("div", {
|
|
62
|
-
className: "".concat(classPrefix, "-right")
|
|
104
|
+
className: "".concat(classPrefix, "-right"),
|
|
105
|
+
ref: rightRef
|
|
63
106
|
}, right);
|
|
64
107
|
};
|
|
65
108
|
var renderWrapper = function renderWrapper2() {
|
|
66
109
|
return React__default.createElement("div", {
|
|
67
110
|
className: cls,
|
|
68
|
-
style: styles()
|
|
111
|
+
style: styles(),
|
|
112
|
+
ref: wrapperRef
|
|
69
113
|
}, renderLeft(), renderContent(), renderRight());
|
|
70
114
|
};
|
|
71
115
|
var classes = classNames(_defineProperty(_defineProperty(_defineProperty({}, "".concat(classPrefix, "-fixed"), fixed), "".concat(classPrefix, "-safe-area-inset-top"), safeAreaInsetTop), "".concat(classPrefix, "-title-align-").concat(titleAlign), true));
|
package/dist/esm/Picker.js
CHANGED
|
@@ -30,6 +30,7 @@ import { P as Popup } from "./popup2.js";
|
|
|
30
30
|
import { S as SafeArea } from "./safearea2.js";
|
|
31
31
|
import { u as useTouch } from "./use-touch.js";
|
|
32
32
|
import { p as passiveSupported } from "./supports-passive.js";
|
|
33
|
+
import { u as useRefs } from "./use-refs.js";
|
|
33
34
|
import { useConfig } from "./ConfigProvider.js";
|
|
34
35
|
import { u as usePropsValue } from "./use-props-value.js";
|
|
35
36
|
import { C as ComponentDefaults } from "./typings.js";
|
|
@@ -249,19 +250,6 @@ var InternalPickerPanel = function InternalPickerPanel2(props, ref) {
|
|
|
249
250
|
};
|
|
250
251
|
var PickerPanel = React__default.forwardRef(InternalPickerPanel);
|
|
251
252
|
var PickerPanel$1 = PickerPanel;
|
|
252
|
-
function useRefs() {
|
|
253
|
-
var refs = React__default.useRef([]);
|
|
254
|
-
var setRefs = React__default.useCallback(function(index) {
|
|
255
|
-
return function(el) {
|
|
256
|
-
if (el)
|
|
257
|
-
refs.current[index] = el;
|
|
258
|
-
};
|
|
259
|
-
}, []);
|
|
260
|
-
var reset = React__default.useCallback(function() {
|
|
261
|
-
refs.current = [];
|
|
262
|
-
}, []);
|
|
263
|
-
return [refs.current, setRefs, reset];
|
|
264
|
-
}
|
|
265
253
|
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
266
254
|
title: "",
|
|
267
255
|
options: [],
|
package/dist/esm/RadioGroup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["children", "className", "value", "defaultValue", "onChange", "labelPosition", "direction", "options", "disabled"], _excluded2 = ["label", "value", "disabled", "onChange"];
|
|
4
|
+
var _excluded = ["children", "className", "value", "defaultValue", "onChange", "shape", "labelPosition", "direction", "options", "disabled"], _excluded2 = ["label", "value", "disabled", "onChange"];
|
|
5
5
|
function ownKeys(e, r) {
|
|
6
6
|
var t = Object.keys(e);
|
|
7
7
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -39,7 +39,7 @@ var defaultProps = {
|
|
|
39
39
|
};
|
|
40
40
|
var classPrefix = "nut-radiogroup";
|
|
41
41
|
var RadioGroup = React__default.forwardRef(function(props, ref) {
|
|
42
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children, className = _defaultProps$props.className, value = _defaultProps$props.value, defaultValue = _defaultProps$props.defaultValue, onChange2 = _defaultProps$props.onChange, labelPosition = _defaultProps$props.labelPosition, direction = _defaultProps$props.direction, options = _defaultProps$props.options, disabled = _defaultProps$props.disabled, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
42
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children, className = _defaultProps$props.className, value = _defaultProps$props.value, defaultValue = _defaultProps$props.defaultValue, onChange2 = _defaultProps$props.onChange, shape = _defaultProps$props.shape, labelPosition = _defaultProps$props.labelPosition, direction = _defaultProps$props.direction, options = _defaultProps$props.options, disabled = _defaultProps$props.disabled, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
43
43
|
var _usePropsValue = usePropsValue({
|
|
44
44
|
defaultValue: props.defaultValue,
|
|
45
45
|
value: props.value,
|
|
@@ -64,6 +64,7 @@ var RadioGroup = React__default.forwardRef(function(props, ref) {
|
|
|
64
64
|
value: {
|
|
65
65
|
labelPosition: labelPosition || "right",
|
|
66
66
|
disabled,
|
|
67
|
+
shape,
|
|
67
68
|
value: val2State,
|
|
68
69
|
check: function check(value2) {
|
|
69
70
|
setVal2State(value2);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.nut-rate{display:flex}.nut-rate.disabled .nut-rate-item-icon{cursor:not-allowed}.nut-rate.readonly .nut-rate-item-icon{cursor:default}.nut-rate-item{display:flex;flex-shrink:0;position:relative;margin-right:var(--nutui-rate-item-margin, 14px)}.nut-rate-item:last-child{margin-right:0}.nut-rate-item-half{position:absolute;height:100%;width:50%!important;left:0;top:0;overflow:hidden}.nut-rate-item-half .nut-icon{flex-shrink:0}.nut-rate-item-icon{display:flex;color:var(--nutui-rate-icon-color, var(--nutui-color-primary, #fa2c19));cursor:pointer}.nut-rate-item-icon-disabled{color:var(--nutui-rate-icon-inactive-color, var(--nutui-color-text-disabled, #bfbfbf))}.nut-rate-item-icon.nut-rate-item-icon.nut-rate-item-icon-half{position:absolute;left:0;top:0;overflow:hidden}.nut-rate-item-icon.nut-rate-item-icon:before{position:relative;top:auto;left:auto;transform:none}
|
|
1
|
+
.nut-rate{display:flex;touch-action:pan-x}.nut-rate.disabled .nut-rate-item-icon{cursor:not-allowed}.nut-rate.readonly .nut-rate-item-icon{cursor:default}.nut-rate-item{display:flex;flex-shrink:0;position:relative;margin-right:var(--nutui-rate-item-margin, 14px)}.nut-rate-item:last-child{margin-right:0}.nut-rate-item-half{position:absolute;height:100%;width:50%!important;left:0;top:0;overflow:hidden}.nut-rate-item-half .nut-icon{flex-shrink:0}.nut-rate-item-icon{display:flex;color:var(--nutui-rate-icon-color, var(--nutui-color-primary, #fa2c19));cursor:pointer}.nut-rate-item-icon-disabled{color:var(--nutui-rate-icon-inactive-color, var(--nutui-color-text-disabled, #bfbfbf))}.nut-rate-item-icon.nut-rate-item-icon.nut-rate-item-icon-half{position:absolute;left:0;top:0;overflow:hidden}.nut-rate-item-icon.nut-rate-item-icon:before{position:relative;top:auto;left:auto;transform:none}
|
package/dist/esm/Rate.js
CHANGED
|
@@ -21,11 +21,13 @@ function _objectSpread(e) {
|
|
|
21
21
|
}
|
|
22
22
|
return e;
|
|
23
23
|
}
|
|
24
|
-
import React__default, { useState, useEffect } from "react";
|
|
24
|
+
import React__default, { useState, useRef, useEffect } from "react";
|
|
25
25
|
import classNames from "classnames";
|
|
26
26
|
import { StarFill } from "@nutui/icons-react";
|
|
27
27
|
import { C as ComponentDefaults } from "./typings.js";
|
|
28
28
|
import { u as usePropsValue } from "./use-props-value.js";
|
|
29
|
+
import { g as getRect } from "./use-client-rect.js";
|
|
30
|
+
import { u as useRefs } from "./use-refs.js";
|
|
29
31
|
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
30
32
|
count: 5,
|
|
31
33
|
min: 0,
|
|
@@ -33,12 +35,15 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
|
33
35
|
uncheckedIcon: null,
|
|
34
36
|
disabled: false,
|
|
35
37
|
readOnly: false,
|
|
36
|
-
allowHalf: false
|
|
38
|
+
allowHalf: false,
|
|
39
|
+
touchable: false
|
|
37
40
|
});
|
|
38
41
|
var Rate = function Rate2(props) {
|
|
39
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, style = _defaultProps$props.style, count = _defaultProps$props.count, value = _defaultProps$props.value, defaultValue = _defaultProps$props.defaultValue, min = _defaultProps$props.min, checkedIcon = _defaultProps$props.checkedIcon, uncheckedIcon = _defaultProps$props.uncheckedIcon, disabled = _defaultProps$props.disabled, readOnly = _defaultProps$props.readOnly, allowHalf = _defaultProps$props.allowHalf, onChange = _defaultProps$props.onChange;
|
|
42
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, style = _defaultProps$props.style, count = _defaultProps$props.count, value = _defaultProps$props.value, defaultValue = _defaultProps$props.defaultValue, min = _defaultProps$props.min, checkedIcon = _defaultProps$props.checkedIcon, uncheckedIcon = _defaultProps$props.uncheckedIcon, disabled = _defaultProps$props.disabled, readOnly = _defaultProps$props.readOnly, allowHalf = _defaultProps$props.allowHalf, touchable = _defaultProps$props.touchable, onChange = _defaultProps$props.onChange, onTouchEnd = _defaultProps$props.onTouchEnd;
|
|
40
43
|
var classPrefix = "nut-rate";
|
|
41
44
|
var _useState = useState([1, 2, 3, 4, 5]), _useState2 = _slicedToArray(_useState, 2), countArray = _useState2[0], setCountArray = _useState2[1];
|
|
45
|
+
var _useRefs = useRefs(), _useRefs2 = _slicedToArray(_useRefs, 2), refs = _useRefs2[0], setRefs = _useRefs2[1];
|
|
46
|
+
var rateRects = useRef([]);
|
|
42
47
|
var _usePropsValue = usePropsValue({
|
|
43
48
|
value,
|
|
44
49
|
defaultValue: Math.max(defaultValue || 0, min),
|
|
@@ -75,16 +80,97 @@ var Rate = function Rate2(props) {
|
|
|
75
80
|
var value2 = Math.max(min, n - 0.5);
|
|
76
81
|
setScore(value2);
|
|
77
82
|
};
|
|
83
|
+
var getScoreByPosition = function getScoreByPosition2(x) {
|
|
84
|
+
var _rateRects$current;
|
|
85
|
+
if ((_rateRects$current = rateRects.current) !== null && _rateRects$current !== void 0 && _rateRects$current.length) {
|
|
86
|
+
for (var index = rateRects.current.length - 1; index >= 0; index--) {
|
|
87
|
+
var item = rateRects.current[index];
|
|
88
|
+
if (item && x > item.left) {
|
|
89
|
+
return allowHalf ? index + (x > item.left + item.width / 2 ? 1 : 0.5) : index + 1;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return 0;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
var updateRects = function updateRects2() {
|
|
96
|
+
for (var index = 0; index < refs.length; index++) {
|
|
97
|
+
var item = refs[index];
|
|
98
|
+
if (item) {
|
|
99
|
+
rateRects.current[index] = getRect(item);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
var handleTouchStart = function handleTouchStart2(e) {
|
|
104
|
+
if (!touchable || readOnly || disabled) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (e.cancelable) {
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
}
|
|
110
|
+
e.stopPropagation();
|
|
111
|
+
updateRects();
|
|
112
|
+
};
|
|
113
|
+
var handleTouchMove = function handleTouchMove2(e) {
|
|
114
|
+
if (!touchable || readOnly || disabled) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (e.cancelable) {
|
|
118
|
+
e.preventDefault();
|
|
119
|
+
}
|
|
120
|
+
e.stopPropagation();
|
|
121
|
+
var val = getScoreByPosition(e.touches[0].clientX);
|
|
122
|
+
if (val !== void 0) {
|
|
123
|
+
setScore(Math.max(min, val));
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
var handleTouchEnd = function handleTouchEnd2(e) {
|
|
127
|
+
if (!touchable || readOnly || disabled) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (e.cancelable) {
|
|
131
|
+
e.preventDefault();
|
|
132
|
+
}
|
|
133
|
+
e.stopPropagation();
|
|
134
|
+
var val = getScoreByPosition(e.changedTouches[0].clientX);
|
|
135
|
+
if (val !== void 0) {
|
|
136
|
+
setScore(Math.max(min, val));
|
|
137
|
+
onTouchEnd && onTouchEnd(e, Math.max(min, val));
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
var rateRef = useRef(null);
|
|
141
|
+
useEffect(function() {
|
|
142
|
+
var element = rateRef.current;
|
|
143
|
+
if (element) {
|
|
144
|
+
element.addEventListener("touchstart", handleTouchStart, {
|
|
145
|
+
passive: false
|
|
146
|
+
});
|
|
147
|
+
element.addEventListener("touchmove", handleTouchMove, {
|
|
148
|
+
passive: false
|
|
149
|
+
});
|
|
150
|
+
element.addEventListener("touchend", handleTouchEnd, {
|
|
151
|
+
passive: false
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
return function() {
|
|
155
|
+
if (element) {
|
|
156
|
+
element.removeEventListener("touchstart", handleTouchStart);
|
|
157
|
+
element.removeEventListener("touchmove", handleTouchMove);
|
|
158
|
+
element.removeEventListener("touchend", handleTouchEnd);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
}, []);
|
|
78
162
|
return React__default.createElement("div", {
|
|
79
163
|
className: classNames(classPrefix, {
|
|
80
164
|
disabled,
|
|
81
165
|
readonly: readOnly
|
|
82
166
|
}, className),
|
|
167
|
+
ref: rateRef,
|
|
83
168
|
style
|
|
84
|
-
}, countArray.map(function(n) {
|
|
169
|
+
}, countArray.map(function(n, index) {
|
|
85
170
|
return React__default.createElement("div", {
|
|
86
171
|
className: "".concat(classPrefix, "-item"),
|
|
87
172
|
key: n,
|
|
173
|
+
ref: setRefs(index),
|
|
88
174
|
onClick: function onClick(event) {
|
|
89
175
|
return _onClick(event, n);
|
|
90
176
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.nut-step{flex-grow:0;flex-shrink:0;flex:1;text-align:center;font-size:0}.nut-step-head{position:relative;display:flex;justify-content:center;margin-bottom:var(--nutui-steps-base-icon-margin-bottom, 12px)}.nut-step-line{position:absolute;top:calc(var(--nutui-steps-base-icon-height, 25px) / 2);left:calc(50% + (100% - var(--nutui-steps-base-line-width, 70%)) / 2);height:var(--nutui-steps-base-line-height, 1px);width:var(--nutui-steps-base-line-width, 70%);background:var(--nutui-steps-base-line-background, var(--nutui-gray-5, #8c8c8c))}.nut-step-icon{position:relative;display:flex;align-items:center;justify-content:center;width:var(--nutui-steps-base-icon-width, 25px);height:var(--nutui-steps-base-icon-height, 25px);line-height:var(--nutui-steps-base-icon-line-height, 25px);font-size:var(--nutui-steps-base-icon-font-size, var(--nutui-font-size-2, 12px));background-color:var(--nutui-steps-wait-icon-bg-color, var(--nutui-gray-5, #8c8c8c));border-color:var(--nutui-steps-wait-icon-bg-color, var(--nutui-gray-5, #8c8c8c));color:var(--nutui-steps-wait-icon-color, #ffffff);z-index:1}.nut-step-icon .nut-icon{width:100%;height:100%}.nut-step-icon.is-text,.nut-step-icon.is-icon{border-radius:50%;border-width:1px;border-style:solid}.nut-step-main{display:
|
|
1
|
+
.nut-step{flex-grow:0;flex-shrink:0;flex:1;text-align:center;font-size:0}.nut-step-head{position:relative;display:flex;justify-content:center;margin-bottom:var(--nutui-steps-base-icon-margin-bottom, 12px)}.nut-step-line{position:absolute;top:calc(var(--nutui-steps-base-icon-height, 25px) / 2);left:calc(50% + (100% - var(--nutui-steps-base-line-width, 70%)) / 2);height:var(--nutui-steps-base-line-height, 1px);width:var(--nutui-steps-base-line-width, 70%);background:var(--nutui-steps-base-line-background, var(--nutui-gray-5, #8c8c8c))}.nut-step-icon{position:relative;display:flex;align-items:center;justify-content:center;width:var(--nutui-steps-base-icon-width, 25px);height:var(--nutui-steps-base-icon-height, 25px);line-height:var(--nutui-steps-base-icon-line-height, 25px);font-size:var(--nutui-steps-base-icon-font-size, var(--nutui-font-size-2, 12px));background-color:var(--nutui-steps-wait-icon-bg-color, var(--nutui-gray-5, #8c8c8c));border-color:var(--nutui-steps-wait-icon-bg-color, var(--nutui-gray-5, #8c8c8c));color:var(--nutui-steps-wait-icon-color, #ffffff);z-index:1}.nut-step-icon .nut-icon{width:100%;height:100%}.nut-step-icon.is-text,.nut-step-icon.is-icon{border-radius:50%;border-width:1px;border-style:solid}.nut-step-main{padding:0 10%;display:flex;flex-direction:column;justify-content:center;align-items:center}.nut-step-title{display:block;margin-bottom:var(--nutui-steps-base-title-margin-bottom, 10px);font-size:var(--nutui-steps-base-title-font-size, var(--nutui-font-size-3, 14px));color:var(--nutui-steps-base-title-color, var(--nutui-gray-7, #1a1a1a))}.nut-step-description{display:block;font-size:var(--nutui-steps-base-description-font-size, var(--nutui-font-size-2, 12px));color:var(--nutui-steps-base-description-color, var(--nutui-gray-6, #595959))}.nut-step:last-child .nut-step-line{display:none}.nut-step.nut-step-process .nut-step-icon{background-color:var(--nutui-steps-process-icon-bg-color, var(--nutui-color-primary, #fa2c19));border-color:var(--nutui-steps-process-icon-bg-color, var(--nutui-color-primary, #fa2c19));color:var(--nutui-steps-process-icon-color, #ffffff)}.nut-step.nut-step-process .nut-step-title{color:var(--nutui-steps-process-title-color, var(--nutui-color-primary, #fa2c19));font-size:var(--nutui-steps-process-title-font-size, var(--nutui-font-size-3, 14px));font-weight:var(--nutui-steps-process-title-font-weight, var(--nutui-font-weight-bold, 500))}.nut-step.nut-step-process .nut-step-description{color:var(--nutui-steps-process-description-color, var(--nutui-gray-6, #595959))}.nut-step.nut-step-wait .nut-step-title{color:var(--nutui-steps-wait-title-color, var(--nutui-gray-7, #1a1a1a))}.nut-step.nut-step-wait .nut-step-description{color:var(--nutui-steps-wait-description-color, var(--nutui-gray-6, #595959))}.nut-step.nut-step-finish .nut-step-icon{background-color:var(--nutui-steps-finish-icon-bg-color, var(--nutui-color-primary-text, #ffffff));border-color:var(--nutui-steps-finish-icon-border-color, var(--nutui-steps-finish-icon-color, var(--nutui-color-primary, #fa2c19)));color:var(--nutui-steps-finish-icon-color, var(--nutui-color-primary, #fa2c19))}.nut-step.nut-step-finish .nut-step-line{background:var(--nutui-steps-finish-line-background, var(--nutui-color-primary, #fa2c19))}.nut-step.nut-step-finish .nut-step-title{color:var(--nutui-steps-finish-title-color, var(--nutui-color-primary, #fa2c19))}.nut-step.nut-step-finish .nut-step-description{color:var(--nutui-steps-finish-description-color, var(--nutui-gray-6, #595959))}.nut-steps-dot .nut-step-head{margin:var(--nutui-steps-dot-head-margin, 10px 0)}.nut-steps-dot .nut-step-line{top:7px}.nut-steps-dot .nut-step-icon{width:var(--nutui-steps-dot-icon-width, 6px);height:var(--nutui-steps-dot-icon-height, 6px);border:var(--nutui-steps-dot-icon-border, 2px solid var(--nutui-color-primary-text, #ffffff));border-radius:50%;box-sizing:content-box}.nut-steps-dot .nut-step-wait .nut-step-icon{background-color:var(--nutui-steps-dot-wait-icon-bg-color, var(--nutui-steps-wait-icon-bg-color, var(--nutui-gray-5, #8c8c8c)))}.nut-steps-dot .nut-step-finish .nut-step-icon{background-color:var(--nutui-steps-finish-icon-bg-color, var(--nutui-color-primary-text, #ffffff));border-color:var(--nutui-steps-dot-finish-icon-bg-color, var(--nutui-steps-finish-icon-color, var(--nutui-color-primary, #fa2c19)))}.nut-steps-dot .nut-step-process .nut-step-icon{position:relative}.nut-steps-dot .nut-step-process .nut-step-icon:before{content:"";display:inline-block;position:absolute;left:50%;top:50%;margin-left:-7px;margin-top:-7px;width:14px;height:14px;background-color:var(--nutui-steps-process-icon-before-bg-color, var(--nutui-color-primary-stop-2, #fa2c19));border-radius:50%;opacity:.23}.nut-steps-horizontal.nut-steps-dot .nut-step-line{top:50%;bottom:-50%}.nut-steps-vertical .nut-step{display:flex;height:33.34%}.nut-steps-vertical .nut-step-line{position:absolute;display:inline-block;width:1px;height:var(--nutui-steps-base-line-width, 70%);background:var(--nutui-steps-base-line-background, var(--nutui-gray-5, #8c8c8c));top:calc(var(--nutui-steps-base-icon-height, 25px) + (100% - var(--nutui-steps-base-line-width, 70%) - var(--nutui-steps-base-icon-margin-bottom, 12px)) / 2);left:calc(50% - 1px)}.nut-steps-vertical.nut-steps-dot .nut-step-line{top:calc(var(--nutui-steps-dot-icon-height, 6px) + (100% - var(--nutui-steps-base-line-width, 70%)) / 2)}.nut-steps-vertical .nut-step-main{display:inline-block;padding-left:6%;text-align:left}
|
package/dist/esm/Step.js
CHANGED
|
@@ -69,7 +69,7 @@ var Step = function Step2(props) {
|
|
|
69
69
|
className: renderIconClass()
|
|
70
70
|
}, icon || !dot && React__default.createElement("span", {
|
|
71
71
|
className: "nut-step-inner"
|
|
72
|
-
}, value))), React__default.createElement("div", {
|
|
72
|
+
}, value))), (title || description) && React__default.createElement("div", {
|
|
73
73
|
className: "nut-step-main"
|
|
74
74
|
}, React__default.createElement("span", {
|
|
75
75
|
className: "nut-step-title"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.nut-step{flex-grow:0;flex-shrink:0;flex:1;text-align:center;font-size:0}.nut-step-head{position:relative;display:flex;justify-content:center;margin-bottom:var(--nutui-steps-base-icon-margin-bottom, 12px)}.nut-step-line{position:absolute;top:calc(var(--nutui-steps-base-icon-height, 25px) / 2);left:calc(50% + (100% - var(--nutui-steps-base-line-width, 70%)) / 2);height:var(--nutui-steps-base-line-height, 1px);width:var(--nutui-steps-base-line-width, 70%);background:var(--nutui-steps-base-line-background, var(--nutui-gray-5, #8c8c8c))}.nut-step-icon{position:relative;display:flex;align-items:center;justify-content:center;width:var(--nutui-steps-base-icon-width, 25px);height:var(--nutui-steps-base-icon-height, 25px);line-height:var(--nutui-steps-base-icon-line-height, 25px);font-size:var(--nutui-steps-base-icon-font-size, var(--nutui-font-size-2, 12px));background-color:var(--nutui-steps-wait-icon-bg-color, var(--nutui-gray-5, #8c8c8c));border-color:var(--nutui-steps-wait-icon-bg-color, var(--nutui-gray-5, #8c8c8c));color:var(--nutui-steps-wait-icon-color, #ffffff);z-index:1}.nut-step-icon .nut-icon{width:100%;height:100%}.nut-step-icon.is-text,.nut-step-icon.is-icon{border-radius:50%;border-width:1px;border-style:solid}.nut-step-main{display:
|
|
1
|
+
.nut-step{flex-grow:0;flex-shrink:0;flex:1;text-align:center;font-size:0}.nut-step-head{position:relative;display:flex;justify-content:center;margin-bottom:var(--nutui-steps-base-icon-margin-bottom, 12px)}.nut-step-line{position:absolute;top:calc(var(--nutui-steps-base-icon-height, 25px) / 2);left:calc(50% + (100% - var(--nutui-steps-base-line-width, 70%)) / 2);height:var(--nutui-steps-base-line-height, 1px);width:var(--nutui-steps-base-line-width, 70%);background:var(--nutui-steps-base-line-background, var(--nutui-gray-5, #8c8c8c))}.nut-step-icon{position:relative;display:flex;align-items:center;justify-content:center;width:var(--nutui-steps-base-icon-width, 25px);height:var(--nutui-steps-base-icon-height, 25px);line-height:var(--nutui-steps-base-icon-line-height, 25px);font-size:var(--nutui-steps-base-icon-font-size, var(--nutui-font-size-2, 12px));background-color:var(--nutui-steps-wait-icon-bg-color, var(--nutui-gray-5, #8c8c8c));border-color:var(--nutui-steps-wait-icon-bg-color, var(--nutui-gray-5, #8c8c8c));color:var(--nutui-steps-wait-icon-color, #ffffff);z-index:1}.nut-step-icon .nut-icon{width:100%;height:100%}.nut-step-icon.is-text,.nut-step-icon.is-icon{border-radius:50%;border-width:1px;border-style:solid}.nut-step-main{padding:0 10%;display:flex;flex-direction:column;justify-content:center;align-items:center}.nut-step-title{display:block;margin-bottom:var(--nutui-steps-base-title-margin-bottom, 10px);font-size:var(--nutui-steps-base-title-font-size, var(--nutui-font-size-3, 14px));color:var(--nutui-steps-base-title-color, var(--nutui-gray-7, #1a1a1a))}.nut-step-description{display:block;font-size:var(--nutui-steps-base-description-font-size, var(--nutui-font-size-2, 12px));color:var(--nutui-steps-base-description-color, var(--nutui-gray-6, #595959))}.nut-step:last-child .nut-step-line{display:none}.nut-step.nut-step-process .nut-step-icon{background-color:var(--nutui-steps-process-icon-bg-color, var(--nutui-color-primary, #fa2c19));border-color:var(--nutui-steps-process-icon-bg-color, var(--nutui-color-primary, #fa2c19));color:var(--nutui-steps-process-icon-color, #ffffff)}.nut-step.nut-step-process .nut-step-title{color:var(--nutui-steps-process-title-color, var(--nutui-color-primary, #fa2c19));font-size:var(--nutui-steps-process-title-font-size, var(--nutui-font-size-3, 14px));font-weight:var(--nutui-steps-process-title-font-weight, var(--nutui-font-weight-bold, 500))}.nut-step.nut-step-process .nut-step-description{color:var(--nutui-steps-process-description-color, var(--nutui-gray-6, #595959))}.nut-step.nut-step-wait .nut-step-title{color:var(--nutui-steps-wait-title-color, var(--nutui-gray-7, #1a1a1a))}.nut-step.nut-step-wait .nut-step-description{color:var(--nutui-steps-wait-description-color, var(--nutui-gray-6, #595959))}.nut-step.nut-step-finish .nut-step-icon{background-color:var(--nutui-steps-finish-icon-bg-color, var(--nutui-color-primary-text, #ffffff));border-color:var(--nutui-steps-finish-icon-border-color, var(--nutui-steps-finish-icon-color, var(--nutui-color-primary, #fa2c19)));color:var(--nutui-steps-finish-icon-color, var(--nutui-color-primary, #fa2c19))}.nut-step.nut-step-finish .nut-step-line{background:var(--nutui-steps-finish-line-background, var(--nutui-color-primary, #fa2c19))}.nut-step.nut-step-finish .nut-step-title{color:var(--nutui-steps-finish-title-color, var(--nutui-color-primary, #fa2c19))}.nut-step.nut-step-finish .nut-step-description{color:var(--nutui-steps-finish-description-color, var(--nutui-gray-6, #595959))}.nut-steps-dot .nut-step-head{margin:var(--nutui-steps-dot-head-margin, 10px 0)}.nut-steps-dot .nut-step-line{top:7px}.nut-steps-dot .nut-step-icon{width:var(--nutui-steps-dot-icon-width, 6px);height:var(--nutui-steps-dot-icon-height, 6px);border:var(--nutui-steps-dot-icon-border, 2px solid var(--nutui-color-primary-text, #ffffff));border-radius:50%;box-sizing:content-box}.nut-steps-dot .nut-step-wait .nut-step-icon{background-color:var(--nutui-steps-dot-wait-icon-bg-color, var(--nutui-steps-wait-icon-bg-color, var(--nutui-gray-5, #8c8c8c)))}.nut-steps-dot .nut-step-finish .nut-step-icon{background-color:var(--nutui-steps-finish-icon-bg-color, var(--nutui-color-primary-text, #ffffff));border-color:var(--nutui-steps-dot-finish-icon-bg-color, var(--nutui-steps-finish-icon-color, var(--nutui-color-primary, #fa2c19)))}.nut-steps-dot .nut-step-process .nut-step-icon{position:relative}.nut-steps-dot .nut-step-process .nut-step-icon:before{content:"";display:inline-block;position:absolute;left:50%;top:50%;margin-left:-7px;margin-top:-7px;width:14px;height:14px;background-color:var(--nutui-steps-process-icon-before-bg-color, var(--nutui-color-primary-stop-2, #fa2c19));border-radius:50%;opacity:.23}.nut-steps-horizontal.nut-steps-dot .nut-step-line{top:50%;bottom:-50%}.nut-steps-vertical .nut-step{display:flex;height:33.34%}.nut-steps-vertical .nut-step-line{position:absolute;display:inline-block;width:1px;height:var(--nutui-steps-base-line-width, 70%);background:var(--nutui-steps-base-line-background, var(--nutui-gray-5, #8c8c8c));top:calc(var(--nutui-steps-base-icon-height, 25px) + (100% - var(--nutui-steps-base-line-width, 70%) - var(--nutui-steps-base-icon-margin-bottom, 12px)) / 2);left:calc(50% - 1px)}.nut-steps-vertical.nut-steps-dot .nut-step-line{top:calc(var(--nutui-steps-dot-icon-height, 6px) + (100% - var(--nutui-steps-base-line-width, 70%)) / 2)}.nut-steps-vertical .nut-step-main{display:inline-block;padding-left:6%;text-align:left}.nut-steps{display:flex}.nut-steps-vertical{height:100%;flex-flow:column}
|
package/dist/esm/radio2.js
CHANGED
|
@@ -100,11 +100,11 @@ var Radio = function Radio2(props) {
|
|
|
100
100
|
className: classNames(color())
|
|
101
101
|
});
|
|
102
102
|
};
|
|
103
|
+
var renderByShape = function renderByShape2(shape2) {
|
|
104
|
+
return shape2 === "button" ? renderButton() : React__default.createElement(React__default.Fragment, null, renderIcon(), renderLabel());
|
|
105
|
+
};
|
|
103
106
|
var renderRadioItem = function renderRadioItem2() {
|
|
104
|
-
|
|
105
|
-
return renderButton();
|
|
106
|
-
}
|
|
107
|
-
return React__default.createElement(React__default.Fragment, null, renderIcon(), renderLabel());
|
|
107
|
+
return renderByShape(context && context.shape ? context.shape : shape);
|
|
108
108
|
};
|
|
109
109
|
var handleClick = function handleClick2(e) {
|
|
110
110
|
if (disabled || checkedStatement)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
|
+
import { ITouchEvent } from '@tarojs/components';
|
|
2
3
|
import { BasicComponent } from '@/utils/typings';
|
|
3
4
|
export interface NavBarProps extends BasicComponent {
|
|
4
5
|
left: React.ReactNode;
|
|
@@ -9,7 +10,7 @@ export interface NavBarProps extends BasicComponent {
|
|
|
9
10
|
safeAreaInsetTop: boolean;
|
|
10
11
|
placeholder: boolean;
|
|
11
12
|
zIndex: number | string;
|
|
12
|
-
onBackClick: (e:
|
|
13
|
+
onBackClick: (e: ITouchEvent) => void;
|
|
13
14
|
children?: React.ReactNode;
|
|
14
15
|
}
|
|
15
16
|
export declare const NavBar: FunctionComponent<Partial<NavBarProps>>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
2
|
import RadioGroup from '@/packages/radiogroup';
|
|
3
3
|
import { BasicComponent } from '@/utils/typings';
|
|
4
|
-
|
|
5
|
-
export type RadioPosition = 'right' | 'left';
|
|
4
|
+
import { RadioPosition, RadioShape } from '@/packages/radio/types';
|
|
6
5
|
export interface RadioProps extends BasicComponent {
|
|
7
6
|
disabled: boolean;
|
|
8
7
|
checked: boolean;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
2
|
import RadioGroup from '@/packages/radiogroup/index.taro';
|
|
3
3
|
import { BasicComponent } from '@/utils/typings';
|
|
4
|
-
|
|
5
|
-
export type RadioPosition = 'right' | 'left';
|
|
4
|
+
import { RadioPosition, RadioShape } from '@/packages/radio/types';
|
|
6
5
|
export interface RadioProps extends BasicComponent {
|
|
7
6
|
disabled: boolean;
|
|
8
7
|
checked: boolean;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { RadioGroupShape } from './types';
|
|
2
3
|
declare const _default: React.Context<{
|
|
3
4
|
labelPosition: 'left' | 'right';
|
|
4
5
|
disabled: boolean | undefined;
|
|
5
6
|
value: string | number;
|
|
7
|
+
shape: RadioGroupShape | undefined;
|
|
6
8
|
check: (value: string | number) => void;
|
|
7
9
|
uncheck: () => void;
|
|
8
10
|
} | null>;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { RadioGroupOptionType } from './types';
|
|
3
|
-
type Position = 'left' | 'right';
|
|
4
|
-
type Direction = 'horizontal' | 'vertical';
|
|
2
|
+
import { RadioGroupDirection, RadioGroupOptionType, RadioGroupPosition, RadioGroupShape } from './types';
|
|
5
3
|
export interface RadioGroupProps {
|
|
6
4
|
value?: string | number;
|
|
7
5
|
defaultValue?: string | number;
|
|
8
|
-
labelPosition:
|
|
9
|
-
direction:
|
|
6
|
+
labelPosition: RadioGroupPosition;
|
|
7
|
+
direction: RadioGroupDirection;
|
|
8
|
+
shape?: RadioGroupShape;
|
|
10
9
|
disabled?: boolean;
|
|
11
10
|
options: RadioGroupOptionType[];
|
|
12
11
|
onChange: (value: string | number) => void;
|
|
13
12
|
}
|
|
14
13
|
export declare const RadioGroup: React.ForwardRefExoticComponent<Partial<RadioGroupProps> & Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> & React.RefAttributes<unknown>>;
|
|
15
|
-
export {};
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { RadioGroupOptionType } from './types';
|
|
3
|
-
type Position = 'left' | 'right';
|
|
4
|
-
type Direction = 'horizontal' | 'vertical';
|
|
2
|
+
import { RadioGroupDirection, RadioGroupOptionType, RadioGroupPosition, RadioGroupShape } from './types';
|
|
5
3
|
export interface RadioGroupProps {
|
|
6
4
|
value?: string | number;
|
|
7
5
|
defaultValue?: string | number;
|
|
8
|
-
labelPosition:
|
|
9
|
-
direction:
|
|
6
|
+
labelPosition: RadioGroupPosition;
|
|
7
|
+
direction: RadioGroupDirection;
|
|
8
|
+
shape?: RadioGroupShape;
|
|
10
9
|
disabled?: boolean;
|
|
11
10
|
options: RadioGroupOptionType[];
|
|
12
11
|
onChange: (value: string | number) => void;
|
|
13
12
|
}
|
|
14
13
|
export declare const RadioGroup: React.ForwardRefExoticComponent<Partial<RadioGroupProps> & Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> & React.RefAttributes<unknown>>;
|
|
15
|
-
export {};
|
|
@@ -2,5 +2,9 @@ export interface RadioGroupOptionType {
|
|
|
2
2
|
label: string;
|
|
3
3
|
value: string;
|
|
4
4
|
disabled?: boolean;
|
|
5
|
+
shape?: RadioGroupShape;
|
|
5
6
|
onChange?: (checked: boolean) => void;
|
|
6
7
|
}
|
|
8
|
+
export type RadioGroupPosition = 'left' | 'right';
|
|
9
|
+
export type RadioGroupDirection = 'horizontal' | 'vertical';
|
|
10
|
+
export type RadioGroupShape = 'button' | 'round';
|
|
@@ -10,6 +10,8 @@ export interface RateProps extends BasicComponent {
|
|
|
10
10
|
disabled: boolean;
|
|
11
11
|
readOnly: boolean;
|
|
12
12
|
allowHalf: boolean;
|
|
13
|
+
touchable: boolean;
|
|
13
14
|
onChange: (value: number) => void;
|
|
15
|
+
onTouchEnd: (e: TouchEvent, value: number) => void;
|
|
14
16
|
}
|
|
15
17
|
export declare const Rate: FunctionComponent<Partial<RateProps>>;
|
|
@@ -10,6 +10,8 @@ export interface RateProps extends BasicComponent {
|
|
|
10
10
|
disabled: boolean;
|
|
11
11
|
readOnly: boolean;
|
|
12
12
|
allowHalf: boolean;
|
|
13
|
+
touchable: boolean;
|
|
13
14
|
onChange: (value: number) => void;
|
|
15
|
+
onTouchEnd: (e: TouchEvent, value: number) => void;
|
|
14
16
|
}
|
|
15
17
|
export declare const Rate: FunctionComponent<Partial<RateProps>>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { BaseEventOrig } from '@tarojs/components';
|
|
3
|
-
|
|
4
|
-
export interface VideoProps extends BasicComponent {
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { VideoProps as VideoPropsTaro, BaseEventOrig } from '@tarojs/components';
|
|
3
|
+
export interface VideoProps extends Omit<VideoPropsTaro, 'src'> {
|
|
5
4
|
source: {
|
|
6
5
|
type: string;
|
|
7
6
|
src: string;
|
|
@@ -18,4 +17,4 @@ export interface VideoProps extends BasicComponent {
|
|
|
18
17
|
onPause: (event: BaseEventOrig<any>) => void;
|
|
19
18
|
onPlayEnd: (event: BaseEventOrig<any>) => void;
|
|
20
19
|
}
|
|
21
|
-
export declare const Video: FunctionComponent<Partial<VideoProps
|
|
20
|
+
export declare const Video: FunctionComponent<Partial<VideoProps>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React__default from "react";
|
|
2
|
+
function useRefs() {
|
|
3
|
+
var refs = React__default.useRef([]);
|
|
4
|
+
var setRefs = React__default.useCallback(function(index) {
|
|
5
|
+
return function(el) {
|
|
6
|
+
if (el)
|
|
7
|
+
refs.current[index] = el;
|
|
8
|
+
};
|
|
9
|
+
}, []);
|
|
10
|
+
var reset = React__default.useCallback(function() {
|
|
11
|
+
refs.current = [];
|
|
12
|
+
}, []);
|
|
13
|
+
return [refs.current, setRefs, reset];
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
useRefs as u
|
|
17
|
+
};
|
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