@ccs-ui/rc-pro 2.3.2 → 2.3.3-beta-2
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 +10 -8
- package/es/pro-table/table.d.ts +3 -1
- package/es/pro-table/table.js +2 -0
- package/es/pro-table/tree.d.ts +1 -1
- package/es/pro-table/tree.js +13 -1
- package/package.json +1 -1
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
|
-
|
|
28
|
-
|
|
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
|
-
|
|
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
|
package/es/pro-table/table.d.ts
CHANGED
|
@@ -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?: string | ((record: RecordType) => boolean);
|
|
76
78
|
/** ref 回调方法 */
|
|
77
79
|
proRef?: CCS.TableInstanceRef<RecordType>;
|
|
78
80
|
/** 显示序号 */
|
package/es/pro-table/table.js
CHANGED
|
@@ -58,6 +58,7 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
58
58
|
toolbarExtra = props.toolbarExtra,
|
|
59
59
|
_props$formItems = props.formItems,
|
|
60
60
|
formItems = _props$formItems === void 0 ? [] : _props$formItems,
|
|
61
|
+
leafNode = props.leafNode,
|
|
61
62
|
parentFieldName = props.parentFieldName,
|
|
62
63
|
_props$formInitValues = props.formInitValues,
|
|
63
64
|
formInitValues = _props$formInitValues === void 0 ? {} : _props$formInitValues;
|
|
@@ -476,6 +477,7 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
476
477
|
return tableTitle;
|
|
477
478
|
} : undefined
|
|
478
479
|
}),
|
|
480
|
+
leafNode: leafNode,
|
|
479
481
|
treeRef: treeRef,
|
|
480
482
|
tableRef: tableRef,
|
|
481
483
|
tableContentRef: tableContentRef,
|
package/es/pro-table/tree.d.ts
CHANGED
|
@@ -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'];
|
package/es/pro-table/tree.js
CHANGED
|
@@ -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;
|