@ccs-ui/rc-pro 2.3.6-beta-28 → 2.3.6-beta-30
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/pro-table/head.d.ts +2 -3
- package/es/pro-table/head.js +27 -44
- package/es/pro-table/table.js +27 -14
- package/package.json +1 -1
package/es/pro-table/head.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { FormInstance } from 'antd';
|
|
2
2
|
import React, { ReactElement } from 'react';
|
|
3
|
-
import { PropsWithElementChildren } from '../ccs';
|
|
4
3
|
import { CcsProTableProps } from './table';
|
|
5
|
-
type PropsType<T> = Pick<CcsProTableProps<T>, 'toolbar' | 'formItems' | 'formInitValues' | 'expandForm' | '
|
|
4
|
+
type PropsType<T> = Pick<CcsProTableProps<T>, 'toolbar' | 'formItems' | 'formInitValues' | 'expandForm' | 'formItemLabelWidth'> & {
|
|
6
5
|
/** 更多查询条件 */
|
|
7
6
|
hasMore?: boolean;
|
|
8
7
|
/** table 操作栏 */
|
|
@@ -13,5 +12,5 @@ type PropsType<T> = Pick<CcsProTableProps<T>, 'toolbar' | 'formItems' | 'formIni
|
|
|
13
12
|
formRef: React.RefObject<FormInstance<any>>;
|
|
14
13
|
};
|
|
15
14
|
/** 操作按钮、查询,重置、列筛选、 */
|
|
16
|
-
declare function HeadComponent<T>({
|
|
15
|
+
declare function HeadComponent<T>({ toolbar, expandForm, formItems, formInitValues, formItemLabelWidth, tableOperation, formRef, onSearch, }: PropsType<T>): import("react/jsx-runtime").JSX.Element;
|
|
17
16
|
export default HeadComponent;
|
package/es/pro-table/head.js
CHANGED
|
@@ -6,7 +6,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { DownOutlined, UpOutlined } from '@ant-design/icons';
|
|
8
8
|
import { useUpdateEffect } from 'ahooks';
|
|
9
|
-
import { Button,
|
|
9
|
+
import { Button, Form, theme } from 'antd';
|
|
10
10
|
import _debounce from 'lodash.debounce';
|
|
11
11
|
import React, { useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
12
12
|
import { CcsResizeObserver } from '..';
|
|
@@ -17,8 +17,7 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
17
17
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
18
|
/** 操作按钮、查询,重置、列筛选、 */
|
|
19
19
|
function HeadComponent(_ref) {
|
|
20
|
-
var
|
|
21
|
-
toolbar = _ref.toolbar,
|
|
20
|
+
var toolbar = _ref.toolbar,
|
|
22
21
|
_ref$expandForm = _ref.expandForm,
|
|
23
22
|
expandForm = _ref$expandForm === void 0 ? false : _ref$expandForm,
|
|
24
23
|
_ref$formItems = _ref.formItems,
|
|
@@ -27,7 +26,6 @@ function HeadComponent(_ref) {
|
|
|
27
26
|
formItemLabelWidth = _ref.formItemLabelWidth,
|
|
28
27
|
tableOperation = _ref.tableOperation,
|
|
29
28
|
formRef = _ref.formRef,
|
|
30
|
-
children = _ref.children,
|
|
31
29
|
onSearch = _ref.onSearch;
|
|
32
30
|
var _Form$useForm = Form.useForm(),
|
|
33
31
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
@@ -168,50 +166,35 @@ function HeadComponent(_ref) {
|
|
|
168
166
|
// 获取Input的高度
|
|
169
167
|
var token = theme.useToken().token;
|
|
170
168
|
var controlHeight = token.rootValue ? "".concat((token.controlHeight / token.rootValue).toFixed(3), "rem") : token.controlHeight;
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
children: [allFormItems.length > 0 && /*#__PURE__*/_jsxs(_Fragment, {
|
|
169
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
170
|
+
children: allFormItems.length > 0 && /*#__PURE__*/_jsxs(_Fragment, {
|
|
174
171
|
children: [/*#__PURE__*/_jsx(CcsResizeObserver.Target, {
|
|
175
172
|
targetRef: formItemsRef,
|
|
176
173
|
onResize: onResize
|
|
177
|
-
}), /*#__PURE__*/
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
height: isExpand ? 'auto' : controlHeight
|
|
200
|
-
},
|
|
201
|
-
className: "ccs-pl-adaptation-form",
|
|
202
|
-
ref: formItemsRef,
|
|
203
|
-
children: [renderFormItems(), /*#__PURE__*/_jsx("div", {
|
|
204
|
-
ref: endItemRef
|
|
205
|
-
}), isExpand && renderSearchBtn]
|
|
206
|
-
}), !isExpand && /*#__PURE__*/_jsx("div", {
|
|
207
|
-
style: {
|
|
208
|
-
flex: '0 0 auto'
|
|
209
|
-
},
|
|
210
|
-
children: renderSearchBtn
|
|
211
|
-
})]
|
|
212
|
-
})
|
|
174
|
+
}), /*#__PURE__*/_jsxs(Form, {
|
|
175
|
+
initialValues: formInitValues,
|
|
176
|
+
form: form,
|
|
177
|
+
onFinish: onSearch,
|
|
178
|
+
layout: "inline",
|
|
179
|
+
style: formStyles,
|
|
180
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
181
|
+
style: {
|
|
182
|
+
justifyContent: isExpand && hasMore ? 'flex-start' : 'flex-end',
|
|
183
|
+
height: isExpand ? 'auto' : controlHeight
|
|
184
|
+
},
|
|
185
|
+
className: "ccs-pl-adaptation-form",
|
|
186
|
+
ref: formItemsRef,
|
|
187
|
+
children: [renderFormItems(), /*#__PURE__*/_jsx("div", {
|
|
188
|
+
ref: endItemRef
|
|
189
|
+
}), isExpand && renderSearchBtn]
|
|
190
|
+
}), !isExpand && /*#__PURE__*/_jsx("div", {
|
|
191
|
+
style: {
|
|
192
|
+
flex: '0 0 auto'
|
|
193
|
+
},
|
|
194
|
+
children: renderSearchBtn
|
|
195
|
+
})]
|
|
213
196
|
})]
|
|
214
|
-
})
|
|
197
|
+
})
|
|
215
198
|
});
|
|
216
199
|
}
|
|
217
200
|
export default HeadComponent;
|
package/es/pro-table/table.js
CHANGED
|
@@ -610,6 +610,7 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
610
610
|
tableRef: tableRef,
|
|
611
611
|
onFullScreen: onFullScreen
|
|
612
612
|
}) : undefined;
|
|
613
|
+
var hasFormItem = formItems.length > 0;
|
|
613
614
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
614
615
|
children: [/*#__PURE__*/_jsx(CcsResizeObserver.Target, {
|
|
615
616
|
targetRef: tableContentRef,
|
|
@@ -620,22 +621,33 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
620
621
|
overflow: (table === null || table === void 0 || (_table$scroll2 = table.scroll) === null || _table$scroll2 === void 0 ? void 0 : _table$scroll2.y) === 'auto' ? 'hidden' : 'unset'
|
|
621
622
|
}),
|
|
622
623
|
ref: containerRef,
|
|
623
|
-
children: [
|
|
624
|
+
children: [/*#__PURE__*/_jsxs(TableSelectionContext.Provider, {
|
|
624
625
|
value: {
|
|
625
626
|
selectedRows: selectedRows
|
|
626
627
|
},
|
|
627
|
-
children: [/*#__PURE__*/_jsx(
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
628
|
+
children: [/*#__PURE__*/_jsx(Card, {
|
|
629
|
+
className: "ccs-pl-adaptation",
|
|
630
|
+
style: {
|
|
631
|
+
boxShadow: 'none'
|
|
632
|
+
},
|
|
633
|
+
styles: {
|
|
634
|
+
body: {
|
|
635
|
+
padding: hasFormItem ? 16 : 0
|
|
636
|
+
}
|
|
637
|
+
},
|
|
638
|
+
bordered: false,
|
|
635
639
|
title: props.title,
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
640
|
+
children: hasFormItem && /*#__PURE__*/_jsx(HeadComponent, {
|
|
641
|
+
formRef: formRef,
|
|
642
|
+
toolbar: toolbar,
|
|
643
|
+
formItems: formItems,
|
|
644
|
+
expandForm: expandForm,
|
|
645
|
+
formInitValues: formInitValues,
|
|
646
|
+
formItemLabelWidth: props.formItemLabelWidth,
|
|
647
|
+
onSearch: _onSearch,
|
|
648
|
+
tableOperation: renderTableOperation
|
|
649
|
+
})
|
|
650
|
+
}), (toolbar || !hasFormItem && renderTableOperation) && /*#__PURE__*/_jsxs(Card, {
|
|
639
651
|
styles: {
|
|
640
652
|
cover: {
|
|
641
653
|
borderRadius: 0
|
|
@@ -652,7 +664,8 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
652
664
|
borderRadius: 0,
|
|
653
665
|
borderLeft: 0,
|
|
654
666
|
borderBottom: 0,
|
|
655
|
-
borderRight: 0
|
|
667
|
+
borderRight: 0,
|
|
668
|
+
borderTop: !hasFormItem ? 0 : undefined
|
|
656
669
|
},
|
|
657
670
|
children: [/*#__PURE__*/_jsx("div", {
|
|
658
671
|
style: {
|
|
@@ -665,7 +678,7 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
665
678
|
},
|
|
666
679
|
children: renderTableOperation
|
|
667
680
|
})]
|
|
668
|
-
}),
|
|
681
|
+
}), toolbarExtra]
|
|
669
682
|
}), /*#__PURE__*/_jsxs("div", {
|
|
670
683
|
className: "".concat(classPrefix, "-table-content"),
|
|
671
684
|
style: _objectSpread(_objectSpread({}, styles === null || styles === void 0 ? void 0 : styles.table), {}, {
|