@ccs-ui/rc-pro 2.3.2 → 2.3.3-beta-1

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/es/dialog/form.js CHANGED
@@ -24,8 +24,14 @@ var DialogForm = function DialogForm(_ref) {
24
24
  var formRef = _ref.formRef,
25
25
  children = _ref.children,
26
26
  _ref$formProps = _ref.formProps,
27
- labelCol = _ref$formProps.labelCol,
28
- wrapperCol = _ref$formProps.wrapperCol,
27
+ _ref$formProps$labelC = _ref$formProps.labelCol,
28
+ labelCol = _ref$formProps$labelC === void 0 ? {
29
+ span: 7
30
+ } : _ref$formProps$labelC,
31
+ _ref$formProps$wrappe = _ref$formProps.wrapperCol,
32
+ wrapperCol = _ref$formProps$wrappe === void 0 ? {
33
+ span: 16
34
+ } : _ref$formProps$wrappe,
29
35
  restProps = _objectWithoutProperties(_ref$formProps, _excluded);
30
36
  var _Form$useForm = Form.useForm(),
31
37
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
@@ -37,12 +43,8 @@ var DialogForm = function DialogForm(_ref) {
37
43
  });
38
44
  return /*#__PURE__*/_jsx(Form, _objectSpread(_objectSpread({
39
45
  form: form,
40
- labelCol: labelCol || {
41
- span: 7
42
- },
43
- wrapperCol: wrapperCol || {
44
- span: 14
45
- },
46
+ labelCol: labelCol,
47
+ wrapperCol: wrapperCol,
46
48
  preserve: false
47
49
  }, restProps), {}, {
48
50
  children: children
@@ -71,8 +71,10 @@ export type CcsProTableProps<RecordType> = Pick<PropsWithCss, 'className'> & Pro
71
71
  root?: CSSProperties;
72
72
  table?: CSSProperties;
73
73
  };
74
- /** 父级值字段 */
74
+ /** 异步树父级值字段 */
75
75
  parentFieldName?: string;
76
+ /** 异步树叶子节点标识 */
77
+ leafNode?: boolean | ((record: RecordType) => boolean);
76
78
  /** ref 回调方法 */
77
79
  proRef?: CCS.TableInstanceRef<RecordType>;
78
80
  /** 显示序号 */
@@ -9,7 +9,7 @@ export type TreeInstance<T> = {
9
9
  onRequestTree: (query: any, record: T | any) => void;
10
10
  onExpandKeys: (ids: string[]) => void;
11
11
  };
12
- type TreeTableProps<T> = Pick<CcsProTableProps<T>, 'table' | 'onSearchBefore' | 'parentFieldName' | 'onSearchAfter'> & {
12
+ type TreeTableProps<T> = Pick<CcsProTableProps<T>, 'table' | 'onSearchBefore' | 'parentFieldName' | 'onSearchAfter' | 'leafNode'> & {
13
13
  data: CCS.TableData<T>;
14
14
  sticky: boolean | TableSticky;
15
15
  tableRowSize: TableProps['size'];
@@ -29,6 +29,7 @@ var TableTree = function TableTree(props) {
29
29
  sticky = props.sticky,
30
30
  treeRef = props.treeRef,
31
31
  tableRef = props.tableRef,
32
+ leafNode = props.leafNode,
32
33
  tableRowSize = props.tableRowSize,
33
34
  tableContentRef = props.tableContentRef,
34
35
  parentFieldName = props.parentFieldName,
@@ -96,7 +97,18 @@ var TableTree = function TableTree(props) {
96
97
  if (requestResult) {
97
98
  // onSearchAfter 处理请求结果
98
99
  newReqResult = onSearchAfter(requestResult); // 获取table数据
99
- dataSource = getDataFromFields(newReqResult, fieldNames.dataSource);
100
+ dataSource = getDataFromFields(newReqResult, fieldNames.dataSource); // 判断非叶子节点,添加children
101
+ if (leafNode && dataSource && Array.isArray(dataSource)) {
102
+ dataSource.forEach(function (d) {
103
+ if (typeof leafNode === 'string' && !d[leafNode]) {
104
+ d.children = [];
105
+ return;
106
+ }
107
+ if (typeof leafNode === 'function' && !leafNode(d)) {
108
+ d.children = [];
109
+ }
110
+ });
111
+ }
100
112
  if (record) {
101
113
  // 异步树
102
114
  record[childrenColumnName] = dataSource;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccs-ui/rc-pro",
3
- "version": "2.3.2",
3
+ "version": "2.3.3-beta-1",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": {