@hzab/form-render 1.6.13 → 1.6.14
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 +4 -0
- package/package.json +1 -1
- package/src/components/TreeCheckbox/components/CheckboxTable/index.tsx +3 -3
- package/src/components/TreeCheckbox/components/TabsRender/index.tsx +6 -1
- package/src/components/TreeCheckbox/index.less +1 -0
- package/src/components/TreeCheckbox/index.tsx +15 -6
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Checkbox } from "antd";
|
|
2
2
|
|
|
3
3
|
export const CheckboxTable = (props) => {
|
|
4
|
-
const { data } = props;
|
|
4
|
+
const { data, onChange } = props;
|
|
5
5
|
return (
|
|
6
6
|
<table className="tree-checkbox-table">
|
|
7
7
|
<tbody>
|
|
@@ -27,7 +27,7 @@ export const CheckboxTable = (props) => {
|
|
|
27
27
|
const itKey = it?.value;
|
|
28
28
|
return (
|
|
29
29
|
it && (
|
|
30
|
-
<Checkbox value={itKey} key={itKey}>
|
|
30
|
+
<Checkbox onChange={onChange} value={itKey} key={itKey}>
|
|
31
31
|
{it.label}
|
|
32
32
|
</Checkbox>
|
|
33
33
|
)
|
|
@@ -36,7 +36,7 @@ export const CheckboxTable = (props) => {
|
|
|
36
36
|
</>
|
|
37
37
|
) : (
|
|
38
38
|
col && (
|
|
39
|
-
<Checkbox value={colKey} key={colKey}>
|
|
39
|
+
<Checkbox onChange={onChange} value={colKey} key={colKey}>
|
|
40
40
|
{col.label}
|
|
41
41
|
</Checkbox>
|
|
42
42
|
)
|
|
@@ -36,7 +36,12 @@ export const TabRender = (props) => {
|
|
|
36
36
|
forceRender
|
|
37
37
|
tab={
|
|
38
38
|
<>
|
|
39
|
-
<Checkbox
|
|
39
|
+
<Checkbox
|
|
40
|
+
value={it[valueKey]}
|
|
41
|
+
onChange={props?.onChange}
|
|
42
|
+
key={it[valueKey]}
|
|
43
|
+
onClick={onStopPropagation}
|
|
44
|
+
></Checkbox>
|
|
40
45
|
{it[labelKey]}
|
|
41
46
|
</>
|
|
42
47
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
|
-
import { Checkbox
|
|
2
|
+
import { Checkbox } from "antd";
|
|
3
3
|
import { useField } from "@formily/react";
|
|
4
4
|
|
|
5
5
|
import Render from "./components/Render";
|
|
6
6
|
import { getTabTableData } from "./common/utils";
|
|
7
7
|
|
|
8
|
-
const { TabPane } = Tabs;
|
|
9
|
-
|
|
10
8
|
import "./index.less";
|
|
11
9
|
|
|
12
10
|
export const TreeCheckbox = (props) => {
|
|
@@ -30,7 +28,6 @@ export const TreeCheckbox = (props) => {
|
|
|
30
28
|
// tab 配置列表
|
|
31
29
|
tabConfList,
|
|
32
30
|
} = props;
|
|
33
|
-
|
|
34
31
|
const tabLevel = tabBox === true ? 1 : tabConfList?.length ?? props.tabLevel;
|
|
35
32
|
|
|
36
33
|
const showDataSource = useMemo(() => {
|
|
@@ -45,8 +42,20 @@ export const TreeCheckbox = (props) => {
|
|
|
45
42
|
// 内部数据
|
|
46
43
|
};
|
|
47
44
|
return (
|
|
48
|
-
<Checkbox.Group className="tree-checkbox" disabled={disabled || readOnly} value={value}
|
|
49
|
-
<Render
|
|
45
|
+
<Checkbox.Group className="tree-checkbox" disabled={disabled || readOnly} value={value}>
|
|
46
|
+
<Render
|
|
47
|
+
{..._props}
|
|
48
|
+
onChange={(e) => {
|
|
49
|
+
let selectedValues = value && Array.isArray(value) ? value : [];
|
|
50
|
+
if (e.target.checked) {
|
|
51
|
+
selectedValues = [...selectedValues.filter((v) => v != e.target.value), e.target.value];
|
|
52
|
+
} else {
|
|
53
|
+
selectedValues = [...selectedValues.filter((v) => v != e.target.value)];
|
|
54
|
+
}
|
|
55
|
+
onChange(selectedValues);
|
|
56
|
+
}}
|
|
57
|
+
list={showDataSource}
|
|
58
|
+
/>
|
|
50
59
|
</Checkbox.Group>
|
|
51
60
|
);
|
|
52
61
|
};
|