@para-ui/core 4.0.87 → 4.0.88
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/Checkbox/index.d.ts +1 -0
- package/Checkbox/index.js +37 -12
- package/ComboSelect/index.js +3 -3
- package/DynamicMultiBox/index.js +3 -3
- package/Form/index.js +3 -3
- package/FormItem/index.js +3 -3
- package/OperateBtn/index.js +2 -2
- package/README.md +7 -0
- package/Radio/index.d.ts +1 -0
- package/Radio/index.js +31 -9
- package/Selector/index.js +280 -222
- package/SelectorPicker/index.js +2 -2
- package/Switch/index.js +2 -2
- package/Table/index.js +432 -496
- package/Tabs/index.js +2 -2
- package/Tree/index.js +2 -2
- package/index.js +2 -2
- package/package.json +1 -1
- package/umd/Checkbox.js +1 -1
- package/umd/CheckboxGroup.js +1 -1
- package/umd/ComboSelect.js +1 -1
- package/umd/DynamicMultiBox.js +1 -1
- package/umd/Form.js +3 -3
- package/umd/FormItem.js +1 -1
- package/umd/QuickReply.js +1 -1
- package/umd/Radio.js +3 -3
- package/umd/RadioGroup.js +1 -1
- package/umd/Selector.js +3 -3
- package/umd/SelectorPicker.js +1 -1
- package/umd/Table.js +1 -1
- package/umd/Tabs.js +1 -1
- package/umd/Tree.js +1 -1
- /package/_verture/{index-0fafedf4.js → index-32a8f7db.js} +0 -0
- /package/_verture/{index-dfb6ceb9.js → index-62845506.js} +0 -0
package/Checkbox/index.d.ts
CHANGED
package/Checkbox/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { useState, useEffect } from 'react';
|
|
2
|
+
import { useState, useRef, useEffect } from 'react';
|
|
3
3
|
import Label from '../Label/index.js';
|
|
4
4
|
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
5
5
|
import { Tooltip } from '../Tooltip/index.js';
|
|
@@ -29,27 +29,48 @@ const Checkbox = props => {
|
|
|
29
29
|
style
|
|
30
30
|
} = props;
|
|
31
31
|
const [checkedCom, setCheckedCom] = useState(false); // 复选框状态
|
|
32
|
+
const inputRef = useRef(null);
|
|
32
33
|
useEffect(() => {
|
|
33
34
|
if (props.defaultChecked !== undefined) setCheckedCom(props.defaultChecked);
|
|
34
35
|
}, []);
|
|
35
36
|
useEffect(() => {
|
|
36
37
|
if (props.checked !== undefined) setCheckedCom(props.checked);
|
|
37
38
|
}, [props.checked]);
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
// 半选态只有 class,没有原生属性,需要通过 ref 同步 input.indeterminate
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (inputRef.current) inputRef.current.indeterminate = indeterminate;
|
|
42
|
+
}, [indeterminate]);
|
|
43
|
+
// 原生 change 事件:浏览器已经完成真实的 checked 切换,e.target.checked 是准确的新值。
|
|
44
|
+
// 之前挂在外层 label 上、靠 e.preventDefault() 拦截原生切换再手动置反的写法,
|
|
45
|
+
// 在真实浏览器里会和原生「取消激活」时序打架,导致原生 checked 与组件状态各算各的、彼此不同步;
|
|
46
|
+
// 交给 input 自己的 onChange 处理不存在这个问题。
|
|
47
|
+
const handleChange = e => {
|
|
41
48
|
if (disabled) return;
|
|
42
49
|
if (indeterminate) {
|
|
43
|
-
//
|
|
50
|
+
// 半选态点击后固定进入全选,不看这次原生切换的结果
|
|
44
51
|
if (props.checked === undefined) setCheckedCom(true);
|
|
45
52
|
onChange && onChange(e, true);
|
|
46
53
|
return;
|
|
47
54
|
}
|
|
55
|
+
const next = e.target.checked;
|
|
48
56
|
// 不可受控组件
|
|
49
|
-
if (props.checked === undefined) setCheckedCom(
|
|
50
|
-
e
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
if (props.checked === undefined) setCheckedCom(next);
|
|
58
|
+
onChange && onChange(e, next);
|
|
59
|
+
};
|
|
60
|
+
// <Label> 内部渲染的标题/提示文字本身也是一个 <label> 标签(嵌套 label,非法但既有结构不改)。
|
|
61
|
+
// 原生「点击 label 转发到关联控件」的规则里,点击目标本身若是 label 元素,只有离它最近的
|
|
62
|
+
// 祖先 label 会尝试转发,而这层内层 label 没有关联的表单控件,到此为止,不会继续冒泡去找外层
|
|
63
|
+
// label——点标题文字因此不会触发任何变化。这里手动补一次 input.click():它和用户真实点击走的
|
|
64
|
+
// 是完全相同的原生激活流程(不是 preventDefault + 手动置反),只是 isTrusted 为 false。
|
|
65
|
+
const handleLabelClick = e => {
|
|
66
|
+
var _a;
|
|
67
|
+
if (disabled) return;
|
|
68
|
+
const target = e.target;
|
|
69
|
+
if (target === inputRef.current) return; // 点在 input 本身上,原生行为已经处理
|
|
70
|
+
const nestedLabel = target.closest('label');
|
|
71
|
+
if (nestedLabel && nestedLabel !== e.currentTarget) {
|
|
72
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
73
|
+
}
|
|
53
74
|
};
|
|
54
75
|
// 处理class
|
|
55
76
|
const handClass = () => {
|
|
@@ -87,15 +108,19 @@ const Checkbox = props => {
|
|
|
87
108
|
const contentRender = () => {
|
|
88
109
|
return jsxs("label", Object.assign({
|
|
89
110
|
className: handClass(),
|
|
90
|
-
|
|
91
|
-
|
|
111
|
+
style: handStyle(),
|
|
112
|
+
onClick: handleLabelClick
|
|
92
113
|
}, {
|
|
93
114
|
children: [jsxs("span", Object.assign({
|
|
94
115
|
className: "checkbox-box"
|
|
95
116
|
}, {
|
|
96
117
|
children: [jsx("input", Object.assign({
|
|
97
118
|
type: "checkbox",
|
|
98
|
-
|
|
119
|
+
ref: inputRef,
|
|
120
|
+
checked: checkedCom,
|
|
121
|
+
disabled: disabled,
|
|
122
|
+
onChange: handleChange,
|
|
123
|
+
"aria-checked": indeterminate ? 'mixed' : checkedCom
|
|
99
124
|
}, props.inputProps)), jsx("span", {
|
|
100
125
|
className: "checkbox-box-inner"
|
|
101
126
|
})]
|
package/ComboSelect/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import SearchIcon from '@para-ui/icons/Search';
|
|
|
6
6
|
import Close from '@para-ui/icons/Close';
|
|
7
7
|
import CloseCircleF from '@para-ui/icons/CloseCircleF';
|
|
8
8
|
import Table from '../Table/index.js';
|
|
9
|
-
import { T as Tree } from '../_verture/index-
|
|
9
|
+
import { T as Tree } from '../_verture/index-62845506.js';
|
|
10
10
|
import { B as Button } from '../_verture/index-98ae8a30.js';
|
|
11
11
|
import { D as Dropdown } from '../_verture/index-bde7aabe.js';
|
|
12
12
|
import { Popover } from '../Popover/index.js';
|
|
@@ -24,8 +24,6 @@ import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
|
24
24
|
import { Search } from '../Search/index.js';
|
|
25
25
|
import LoadingOutlined from '@para-ui/icons/LoadingF';
|
|
26
26
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
27
|
-
import '../_verture/defineProperty-f0e15205.js';
|
|
28
|
-
import '../_verture/slicedToArray-61604a6c.js';
|
|
29
27
|
import '../Checkbox/index.js';
|
|
30
28
|
import '../Help/index.js';
|
|
31
29
|
import '@para-ui/icons/Help';
|
|
@@ -59,6 +57,8 @@ import '@para-ui/icons/DoubleRight';
|
|
|
59
57
|
import '../ScrollBar/index.js';
|
|
60
58
|
import '../_verture/useResizeObserver-edda059a.js';
|
|
61
59
|
import '../_verture/toConsumableArray-599cd94a.js';
|
|
60
|
+
import '../_verture/slicedToArray-61604a6c.js';
|
|
61
|
+
import '../_verture/defineProperty-f0e15205.js';
|
|
62
62
|
import '../_verture/index-8ac46bd9.js';
|
|
63
63
|
import '../_verture/typeof-6ec38efd.js';
|
|
64
64
|
import 'rc-tree';
|
package/DynamicMultiBox/index.js
CHANGED
|
@@ -53,8 +53,6 @@ import '@para-ui/icons/Up';
|
|
|
53
53
|
import '../MultiBox/index.js';
|
|
54
54
|
import '@para-ui/icons/Internet';
|
|
55
55
|
import '../Table/index.js';
|
|
56
|
-
import '../_verture/defineProperty-f0e15205.js';
|
|
57
|
-
import '../_verture/slicedToArray-61604a6c.js';
|
|
58
56
|
import '../_verture/index-98ae8a30.js';
|
|
59
57
|
import '@para-ui/icons/CheckCircleF';
|
|
60
58
|
import '@para-ui/icons/WarningCircle';
|
|
@@ -74,8 +72,10 @@ import '@para-ui/icons/DoubleLeft';
|
|
|
74
72
|
import '@para-ui/icons/DoubleRight';
|
|
75
73
|
import '../ScrollBar/index.js';
|
|
76
74
|
import '../_verture/useResizeObserver-edda059a.js';
|
|
77
|
-
import '../_verture/index-
|
|
75
|
+
import '../_verture/index-62845506.js';
|
|
78
76
|
import '../_verture/toConsumableArray-599cd94a.js';
|
|
77
|
+
import '../_verture/slicedToArray-61604a6c.js';
|
|
78
|
+
import '../_verture/defineProperty-f0e15205.js';
|
|
79
79
|
import '../_verture/index-8ac46bd9.js';
|
|
80
80
|
import '../_verture/typeof-6ec38efd.js';
|
|
81
81
|
import 'rc-tree';
|
package/Form/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { DeepClone } from '@paraview/lib';
|
|
3
3
|
import React__default from 'react';
|
|
4
|
-
import { F as FormItem, l as localeJson, v as validate } from '../_verture/index-
|
|
4
|
+
import { F as FormItem, l as localeJson, v as validate } from '../_verture/index-32a8f7db.js';
|
|
5
5
|
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
6
6
|
import { u as useFormatMessage } from '../_verture/useFormatMessage-1fc7c957.js';
|
|
7
7
|
import '../TextField/index.js';
|
|
@@ -56,7 +56,6 @@ import 'rc-input-number';
|
|
|
56
56
|
import '@para-ui/icons/Up';
|
|
57
57
|
import '../ComboSelect/index.js';
|
|
58
58
|
import '../Table/index.js';
|
|
59
|
-
import '../_verture/defineProperty-f0e15205.js';
|
|
60
59
|
import '@para-ui/icons/ScreenF';
|
|
61
60
|
import '@para-ui/icons/UpTriangleF';
|
|
62
61
|
import '@para-ui/icons/DownTriangleF';
|
|
@@ -74,8 +73,9 @@ import '@para-ui/icons/Right';
|
|
|
74
73
|
import '@para-ui/icons/DoubleLeft';
|
|
75
74
|
import '@para-ui/icons/DoubleRight';
|
|
76
75
|
import '../ScrollBar/index.js';
|
|
77
|
-
import '../_verture/index-
|
|
76
|
+
import '../_verture/index-62845506.js';
|
|
78
77
|
import '../_verture/toConsumableArray-599cd94a.js';
|
|
78
|
+
import '../_verture/defineProperty-f0e15205.js';
|
|
79
79
|
import '../_verture/index-8ac46bd9.js';
|
|
80
80
|
import '../_verture/typeof-6ec38efd.js';
|
|
81
81
|
import 'rc-tree';
|
package/FormItem/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'react/jsx-runtime';
|
|
2
2
|
import 'react';
|
|
3
|
-
export { F as default } from '../_verture/index-
|
|
3
|
+
export { F as default } from '../_verture/index-32a8f7db.js';
|
|
4
4
|
import 'clsx';
|
|
5
5
|
import '../Label/index.js';
|
|
6
6
|
import '../_verture/constant-5317fc89.js';
|
|
@@ -56,7 +56,6 @@ import 'rc-input-number';
|
|
|
56
56
|
import '@para-ui/icons/Up';
|
|
57
57
|
import '../ComboSelect/index.js';
|
|
58
58
|
import '../Table/index.js';
|
|
59
|
-
import '../_verture/defineProperty-f0e15205.js';
|
|
60
59
|
import '@para-ui/icons/ScreenF';
|
|
61
60
|
import '@para-ui/icons/UpTriangleF';
|
|
62
61
|
import '@para-ui/icons/DownTriangleF';
|
|
@@ -74,8 +73,9 @@ import '@para-ui/icons/Right';
|
|
|
74
73
|
import '@para-ui/icons/DoubleLeft';
|
|
75
74
|
import '@para-ui/icons/DoubleRight';
|
|
76
75
|
import '../ScrollBar/index.js';
|
|
77
|
-
import '../_verture/index-
|
|
76
|
+
import '../_verture/index-62845506.js';
|
|
78
77
|
import '../_verture/toConsumableArray-599cd94a.js';
|
|
78
|
+
import '../_verture/defineProperty-f0e15205.js';
|
|
79
79
|
import '../_verture/index-8ac46bd9.js';
|
|
80
80
|
import '../_verture/typeof-6ec38efd.js';
|
|
81
81
|
import 'rc-tree';
|
package/OperateBtn/index.js
CHANGED
|
@@ -36,8 +36,8 @@ var zh = {
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
var localeJson = {
|
|
39
|
-
zh,
|
|
40
|
-
en
|
|
39
|
+
zh: zh,
|
|
40
|
+
en: en
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2022/4/13 10:48 AM\n* @description 表格操作按钮\n*/\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-operate-btn {\n font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC, WenQuanYi Micro Hei, sans-serif;\n font-size: 14px;\n font-weight: 400;\n display: flex;\n align-items: center;\n}\n.paraui-v4-operate-btn > .operate-btn-line {\n display: inline-block;\n width: 1px;\n background-color: rgb(213, 224, 250);\n margin: 0 10px;\n}\n.paraui-v4-operate-btn.paraui-v4-operate-btn-small > .operate-btn-line {\n height: 12px;\n}\n.paraui-v4-operate-btn.paraui-v4-operate-btn-small button svg {\n font-size: 18px;\n}\n.paraui-v4-operate-btn.paraui-v4-operate-btn-medium > .operate-btn-line {\n height: 12px;\n}\n.paraui-v4-operate-btn.paraui-v4-operate-btn-medium button svg {\n font-size: 18px;\n}\n.paraui-v4-operate-btn.paraui-v4-operate-btn-large > .operate-btn-line {\n height: 12px;\n}\n.paraui-v4-operate-btn.paraui-v4-operate-btn-large button svg {\n font-size: 18px;\n}\n\n.paraui-v4-operate-btn-popover .operate-btn-list {\n padding: 4px 0;\n}\n.paraui-v4-operate-btn-popover .operate-btn-list > .operate-btn-list-item {\n padding: 0 10px;\n max-width: 120px;\n cursor: pointer;\n color: rgb(29, 33, 38);\n line-height: 30px;\n text-align: left;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.paraui-v4-operate-btn-popover .operate-btn-list > .operate-btn-list-item:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-operate-btn-popover .operate-btn-list > .operate-btn-list-item-disabled {\n cursor: not-allowed;\n color: rgb(161, 168, 179);\n}\n.paraui-v4-operate-btn-popover .operate-btn-list > .operate-btn-list-item-disabled:hover {\n background-color: white;\n}\n.paraui-v4-operate-btn-popover .operate-btn-list > .operate-btn-list-item-danger {\n color: rgb(244, 66, 66);\n}";
|
package/README.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## 🎉 para-ui/core@4.0.88 发布
|
|
2
|
+
|
|
3
|
+
🔧【Bugfix】
|
|
4
|
+
|
|
5
|
+
- 【复选框-Checkbox】修复点击后原生 checked 恒为 false、状态被写入 value 属性的问题:checked 现作为受控属性传给 input,新增 aria-checked 与原生 indeterminate 同步,value 交还使用方;交互改为交给 input 自身原生 onChange 处理(不再由外层 label 的 onClick + preventDefault 拦截原生切换再手动置反),避免与浏览器原生「取消激活」时序冲突导致的 checked 状态错乱;并补充点击标题/提示文字(内部为嵌套 label,原生点击转发规则不覆盖)时的兼容处理
|
|
6
|
+
- 【单选框-Radio】同一问题一并修复
|
|
7
|
+
|
|
1
8
|
## 🎉 para-ui/core@4.0.86 发布
|
|
2
9
|
|
|
3
10
|
🔧【Bugfix】
|
package/Radio/index.d.ts
CHANGED
package/Radio/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { useState, useEffect } from 'react';
|
|
2
|
+
import { useState, useRef, useEffect } from 'react';
|
|
3
3
|
import Label from '../Label/index.js';
|
|
4
4
|
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
5
5
|
import { Tooltip } from '../Tooltip/index.js';
|
|
@@ -28,20 +28,38 @@ const Radio = props => {
|
|
|
28
28
|
style
|
|
29
29
|
} = props;
|
|
30
30
|
const [checkedCom, setCheckedCom] = useState(false); // 复选框状态
|
|
31
|
+
const inputRef = useRef(null);
|
|
31
32
|
useEffect(() => {
|
|
32
33
|
if (props.defaultChecked !== undefined) setCheckedCom(props.defaultChecked);
|
|
33
34
|
}, []);
|
|
34
35
|
useEffect(() => {
|
|
35
36
|
if (props.checked !== undefined) setCheckedCom(props.checked);
|
|
36
37
|
}, [props.checked]);
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
// 原生 change 事件:浏览器已经完成真实的 checked 切换,e.target.checked 是准确的新值。
|
|
39
|
+
// 之前挂在外层 label 上、靠 e.preventDefault() 拦截原生切换再手动置反的写法,
|
|
40
|
+
// 在真实浏览器里会和原生「取消激活」时序打架,导致原生 checked 与组件状态各算各的、彼此不同步;
|
|
41
|
+
// 交给 input 自己的 onChange 处理不存在这个问题。
|
|
42
|
+
const handleChange = e => {
|
|
40
43
|
if (disabled) return;
|
|
44
|
+
const next = e.target.checked;
|
|
41
45
|
// 不可受控组件
|
|
42
|
-
if (props.checked === undefined) setCheckedCom(
|
|
43
|
-
e
|
|
44
|
-
|
|
46
|
+
if (props.checked === undefined) setCheckedCom(next);
|
|
47
|
+
onChange && onChange(e, next);
|
|
48
|
+
};
|
|
49
|
+
// <Label> 内部渲染的标题/提示文字本身也是一个 <label> 标签(嵌套 label,非法但既有结构不改)。
|
|
50
|
+
// 原生「点击 label 转发到关联控件」的规则里,点击目标本身若是 label 元素,只有离它最近的
|
|
51
|
+
// 祖先 label 会尝试转发,而这层内层 label 没有关联的表单控件,到此为止,不会继续冒泡去找外层
|
|
52
|
+
// label——点标题文字因此不会触发任何变化。这里手动补一次 input.click():它和用户真实点击走的
|
|
53
|
+
// 是完全相同的原生激活流程(不是 preventDefault + 手动置反),只是 isTrusted 为 false。
|
|
54
|
+
const handleLabelClick = e => {
|
|
55
|
+
var _a;
|
|
56
|
+
if (disabled) return;
|
|
57
|
+
const target = e.target;
|
|
58
|
+
if (target === inputRef.current) return; // 点在 input 本身上,原生行为已经处理
|
|
59
|
+
const nestedLabel = target.closest('label');
|
|
60
|
+
if (nestedLabel && nestedLabel !== e.currentTarget) {
|
|
61
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
62
|
+
}
|
|
45
63
|
};
|
|
46
64
|
// 处理className
|
|
47
65
|
const handClass = () => {
|
|
@@ -77,14 +95,18 @@ const Radio = props => {
|
|
|
77
95
|
return jsxs("label", Object.assign({
|
|
78
96
|
className: handClass(),
|
|
79
97
|
style: handStyle(),
|
|
80
|
-
onClick:
|
|
98
|
+
onClick: handleLabelClick
|
|
81
99
|
}, {
|
|
82
100
|
children: [jsxs("span", Object.assign({
|
|
83
101
|
className: "radio-box"
|
|
84
102
|
}, {
|
|
85
103
|
children: [jsx("input", Object.assign({
|
|
86
104
|
type: "radio",
|
|
87
|
-
|
|
105
|
+
ref: inputRef,
|
|
106
|
+
checked: checkedCom,
|
|
107
|
+
disabled: disabled,
|
|
108
|
+
onChange: handleChange,
|
|
109
|
+
"aria-checked": checkedCom
|
|
88
110
|
}, props.inputProps)), jsx("span", {
|
|
89
111
|
className: "radio-box-inner"
|
|
90
112
|
})]
|