@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 CHANGED
@@ -1,3 +1,7 @@
1
+ # @hzab/form-render@1.6.14
2
+
3
+ fix: 修复 TreeCheckbox 隐藏不能点击问题。
4
+
1
5
  # @hzab/form-render@1.6.13
2
6
 
3
7
  feat:locationListPicker在已有元素范围内可新增地址标记
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hzab/form-render",
3
- "version": "1.6.13",
3
+ "version": "1.6.14",
4
4
  "description": "",
5
5
  "main": "src",
6
6
  "scripts": {
@@ -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 value={it[valueKey]} key={it[valueKey]} onClick={onStopPropagation}></Checkbox>
39
+ <Checkbox
40
+ value={it[valueKey]}
41
+ onChange={props?.onChange}
42
+ key={it[valueKey]}
43
+ onClick={onStopPropagation}
44
+ ></Checkbox>
40
45
  &nbsp;&nbsp;{it[labelKey]}
41
46
  </>
42
47
  }
@@ -1,4 +1,5 @@
1
1
  .tree-checkbox {
2
+ width: 100%;
2
3
  .tree-checkbox-table {
3
4
  table-layout: fixed;
4
5
  .tree-checkbox-row {
@@ -1,12 +1,10 @@
1
1
  import { useMemo } from "react";
2
- import { Checkbox, Tabs } from "antd";
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} onChange={onChange}>
49
- <Render {..._props} list={showDataSource} />
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
  };