@nutui/nutui-react-taro 3.0.19-cpp.16 → 3.0.19-cpp.17
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/cjs/packages/checkbox/checkbox.js +10 -2
- package/dist/cjs/types/spec/checkbox/base.d.ts +1 -0
- package/dist/es/packages/checkbox/checkbox.js +11 -3
- package/dist/es/types/spec/checkbox/base.d.ts +1 -0
- package/dist/nutui.react.umd.js +10 -2
- package/dist/style-jmapp.css +1 -1
- package/dist/style-jmapp.scss +30 -30
- package/dist/style-jrkf.css +1 -1
- package/dist/style-jrkf.scss +25 -25
- package/dist/style.css +1 -1
- package/dist/style.scss +23 -23
- package/package.json +1 -1
|
@@ -29,12 +29,13 @@ var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typing
|
|
|
29
29
|
icon: null,
|
|
30
30
|
activeIcon: null,
|
|
31
31
|
indeterminateIcon: null,
|
|
32
|
+
timeout: 300,
|
|
32
33
|
onChange: function onChange(value) {}
|
|
33
34
|
});
|
|
34
35
|
var classPrefix = 'nut-checkbox';
|
|
35
36
|
var Checkbox = function Checkbox(props) {
|
|
36
37
|
var children = (0, _object_spread._)({}, defaultProps, props).children;
|
|
37
|
-
var icon = props.icon, label = props.label, className = props.className, activeIcon = props.activeIcon, checked = props.checked, value = props.value, defaultChecked = props.defaultChecked, shape = props.shape, disabled = props.disabled, onChange = props.onChange, indeterminate = props.indeterminate, indeterminateIcon = props.indeterminateIcon, others = (0, _object_without_properties._)(props, [
|
|
38
|
+
var icon = props.icon, label = props.label, className = props.className, activeIcon = props.activeIcon, checked = props.checked, value = props.value, defaultChecked = props.defaultChecked, shape = props.shape, disabled = props.disabled, onChange = props.onChange, indeterminate = props.indeterminate, indeterminateIcon = props.indeterminateIcon, timeout = props.timeout, others = (0, _object_without_properties._)(props, [
|
|
38
39
|
"icon",
|
|
39
40
|
"label",
|
|
40
41
|
"className",
|
|
@@ -46,7 +47,8 @@ var Checkbox = function Checkbox(props) {
|
|
|
46
47
|
"disabled",
|
|
47
48
|
"onChange",
|
|
48
49
|
"indeterminate",
|
|
49
|
-
"indeterminateIcon"
|
|
50
|
+
"indeterminateIcon",
|
|
51
|
+
"timeout"
|
|
50
52
|
]);
|
|
51
53
|
// eslint-disable-next-line prefer-const
|
|
52
54
|
var labelPosition = others.labelPosition, rest = (0, _object_without_properties._)(others, [
|
|
@@ -140,9 +142,15 @@ var Checkbox = function Checkbox(props) {
|
|
|
140
142
|
className: (0, _classnames.default)("".concat(classPrefix, "-label "), (0, _define_property._)({}, "".concat(classPrefix, "-label-disabled"), innerDisabled))
|
|
141
143
|
}, children || label);
|
|
142
144
|
};
|
|
145
|
+
var loadingRef = (0, _react.useRef)(false);
|
|
143
146
|
var handleClick = function handleClick() {
|
|
144
147
|
// 禁用的时候直接返回
|
|
145
148
|
if (disabled) return;
|
|
149
|
+
if (loadingRef.current) return;
|
|
150
|
+
loadingRef.current = true;
|
|
151
|
+
setTimeout(function() {
|
|
152
|
+
loadingRef.current = false;
|
|
153
|
+
}, timeout);
|
|
146
154
|
// 先转换状态
|
|
147
155
|
var latestChecked = !innerChecked;
|
|
148
156
|
setChecked(latestChecked);
|
|
@@ -3,7 +3,7 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
|
3
3
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
4
4
|
import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
|
|
5
5
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
6
|
-
import React, { useContext, useEffect, useState } from "react";
|
|
6
|
+
import React, { useContext, useEffect, useRef, useState } from "react";
|
|
7
7
|
import { CheckDisabled, Checked, CheckNormal } from "@nutui/icons-react-taro";
|
|
8
8
|
import classNames from "classnames";
|
|
9
9
|
import { View } from "@tarojs/components";
|
|
@@ -17,12 +17,13 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
|
17
17
|
icon: null,
|
|
18
18
|
activeIcon: null,
|
|
19
19
|
indeterminateIcon: null,
|
|
20
|
+
timeout: 300,
|
|
20
21
|
onChange: function(value) {}
|
|
21
22
|
});
|
|
22
23
|
var classPrefix = 'nut-checkbox';
|
|
23
24
|
export var Checkbox = function(props) {
|
|
24
25
|
var children = _object_spread({}, defaultProps, props).children;
|
|
25
|
-
var icon = props.icon, label = props.label, className = props.className, activeIcon = props.activeIcon, checked = props.checked, value = props.value, defaultChecked = props.defaultChecked, shape = props.shape, disabled = props.disabled, onChange = props.onChange, indeterminate = props.indeterminate, indeterminateIcon = props.indeterminateIcon, others = _object_without_properties(props, [
|
|
26
|
+
var icon = props.icon, label = props.label, className = props.className, activeIcon = props.activeIcon, checked = props.checked, value = props.value, defaultChecked = props.defaultChecked, shape = props.shape, disabled = props.disabled, onChange = props.onChange, indeterminate = props.indeterminate, indeterminateIcon = props.indeterminateIcon, timeout = props.timeout, others = _object_without_properties(props, [
|
|
26
27
|
"icon",
|
|
27
28
|
"label",
|
|
28
29
|
"className",
|
|
@@ -34,7 +35,8 @@ export var Checkbox = function(props) {
|
|
|
34
35
|
"disabled",
|
|
35
36
|
"onChange",
|
|
36
37
|
"indeterminate",
|
|
37
|
-
"indeterminateIcon"
|
|
38
|
+
"indeterminateIcon",
|
|
39
|
+
"timeout"
|
|
38
40
|
]);
|
|
39
41
|
// eslint-disable-next-line prefer-const
|
|
40
42
|
var labelPosition = others.labelPosition, rest = _object_without_properties(others, [
|
|
@@ -128,9 +130,15 @@ export var Checkbox = function(props) {
|
|
|
128
130
|
className: classNames("".concat(classPrefix, "-label "), _define_property({}, "".concat(classPrefix, "-label-disabled"), innerDisabled))
|
|
129
131
|
}, children || label);
|
|
130
132
|
};
|
|
133
|
+
var loadingRef = useRef(false);
|
|
131
134
|
var handleClick = function() {
|
|
132
135
|
// 禁用的时候直接返回
|
|
133
136
|
if (disabled) return;
|
|
137
|
+
if (loadingRef.current) return;
|
|
138
|
+
loadingRef.current = true;
|
|
139
|
+
setTimeout(function() {
|
|
140
|
+
loadingRef.current = false;
|
|
141
|
+
}, timeout);
|
|
134
142
|
// 先转换状态
|
|
135
143
|
var latestChecked = !innerChecked;
|
|
136
144
|
setChecked(latestChecked);
|
package/dist/nutui.react.umd.js
CHANGED
|
@@ -6913,13 +6913,14 @@
|
|
|
6913
6913
|
icon: null,
|
|
6914
6914
|
activeIcon: null,
|
|
6915
6915
|
indeterminateIcon: null,
|
|
6916
|
+
timeout: 300,
|
|
6916
6917
|
onChange: function(value2) {
|
|
6917
6918
|
}
|
|
6918
6919
|
});
|
|
6919
6920
|
var classPrefix$j = "nut-checkbox";
|
|
6920
6921
|
var Checkbox = function(props) {
|
|
6921
6922
|
var children = _object_spread({}, defaultProps$14, props).children;
|
|
6922
|
-
var icon = props.icon, label = props.label, className = props.className, activeIcon = props.activeIcon, checked = props.checked, value2 = props.value, defaultChecked = props.defaultChecked, shape = props.shape, disabled = props.disabled, onChange = props.onChange, indeterminate = props.indeterminate, indeterminateIcon = props.indeterminateIcon, others = _object_without_properties(props, [
|
|
6923
|
+
var icon = props.icon, label = props.label, className = props.className, activeIcon = props.activeIcon, checked = props.checked, value2 = props.value, defaultChecked = props.defaultChecked, shape = props.shape, disabled = props.disabled, onChange = props.onChange, indeterminate = props.indeterminate, indeterminateIcon = props.indeterminateIcon, timeout = props.timeout, others = _object_without_properties(props, [
|
|
6923
6924
|
"icon",
|
|
6924
6925
|
"label",
|
|
6925
6926
|
"className",
|
|
@@ -6931,7 +6932,8 @@
|
|
|
6931
6932
|
"disabled",
|
|
6932
6933
|
"onChange",
|
|
6933
6934
|
"indeterminate",
|
|
6934
|
-
"indeterminateIcon"
|
|
6935
|
+
"indeterminateIcon",
|
|
6936
|
+
"timeout"
|
|
6935
6937
|
]);
|
|
6936
6938
|
var labelPosition = others.labelPosition, rest = _object_without_properties(others, [
|
|
6937
6939
|
"labelPosition"
|
|
@@ -7023,8 +7025,14 @@
|
|
|
7023
7025
|
className: classNames("".concat(classPrefix$j, "-label "), _define_property({}, "".concat(classPrefix$j, "-label-disabled"), innerDisabled))
|
|
7024
7026
|
}, children || label);
|
|
7025
7027
|
};
|
|
7028
|
+
var loadingRef = React.useRef(false);
|
|
7026
7029
|
var handleClick = function() {
|
|
7027
7030
|
if (disabled) return;
|
|
7031
|
+
if (loadingRef.current) return;
|
|
7032
|
+
loadingRef.current = true;
|
|
7033
|
+
setTimeout(function() {
|
|
7034
|
+
loadingRef.current = false;
|
|
7035
|
+
}, timeout);
|
|
7028
7036
|
var latestChecked = !innerChecked;
|
|
7029
7037
|
setChecked(latestChecked);
|
|
7030
7038
|
};
|