@ccs-ui/rc-pro 2.3.6-beta-29 → 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 -2
- package/es/pro-table/head.js +24 -40
- package/es/pro-table/table.js +25 -12
- package/package.json +1 -1
package/es/pro-table/head.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FormInstance } from 'antd';
|
|
2
2
|
import React, { ReactElement } from 'react';
|
|
3
3
|
import { CcsProTableProps } from './table';
|
|
4
|
-
type PropsType<T> = Pick<CcsProTableProps<T>, 'toolbar' | 'formItems' | 'formInitValues' | 'expandForm' | '
|
|
4
|
+
type PropsType<T> = Pick<CcsProTableProps<T>, 'toolbar' | 'formItems' | 'formInitValues' | 'expandForm' | 'formItemLabelWidth'> & {
|
|
5
5
|
/** 更多查询条件 */
|
|
6
6
|
hasMore?: boolean;
|
|
7
7
|
/** table 操作栏 */
|
|
@@ -12,5 +12,5 @@ type PropsType<T> = Pick<CcsProTableProps<T>, 'toolbar' | 'formItems' | 'formIni
|
|
|
12
12
|
formRef: React.RefObject<FormInstance<any>>;
|
|
13
13
|
};
|
|
14
14
|
/** 操作按钮、查询,重置、列筛选、 */
|
|
15
|
-
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;
|
|
16
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,
|
|
@@ -167,48 +166,33 @@ function HeadComponent(_ref) {
|
|
|
167
166
|
// 获取Input的高度
|
|
168
167
|
var token = theme.useToken().token;
|
|
169
168
|
var controlHeight = token.rootValue ? "".concat((token.controlHeight / token.rootValue).toFixed(3), "rem") : token.controlHeight;
|
|
170
|
-
var adaptationRef = useRef(null);
|
|
171
169
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
172
170
|
children: allFormItems.length > 0 && /*#__PURE__*/_jsxs(_Fragment, {
|
|
173
171
|
children: [/*#__PURE__*/_jsx(CcsResizeObserver.Target, {
|
|
174
172
|
targetRef: formItemsRef,
|
|
175
173
|
onResize: onResize
|
|
176
|
-
}), /*#__PURE__*/
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
height: isExpand ? 'auto' : controlHeight
|
|
199
|
-
},
|
|
200
|
-
className: "ccs-pl-adaptation-form",
|
|
201
|
-
ref: formItemsRef,
|
|
202
|
-
children: [renderFormItems(), /*#__PURE__*/_jsx("div", {
|
|
203
|
-
ref: endItemRef
|
|
204
|
-
}), isExpand && renderSearchBtn]
|
|
205
|
-
}), !isExpand && /*#__PURE__*/_jsx("div", {
|
|
206
|
-
style: {
|
|
207
|
-
flex: '0 0 auto'
|
|
208
|
-
},
|
|
209
|
-
children: renderSearchBtn
|
|
210
|
-
})]
|
|
211
|
-
})
|
|
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
|
+
})]
|
|
212
196
|
})]
|
|
213
197
|
})
|
|
214
198
|
});
|
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,21 +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
|
-
|
|
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, {
|
|
638
651
|
styles: {
|
|
639
652
|
cover: {
|
|
640
653
|
borderRadius: 0
|
|
@@ -652,7 +665,7 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
652
665
|
borderLeft: 0,
|
|
653
666
|
borderBottom: 0,
|
|
654
667
|
borderRight: 0,
|
|
655
|
-
borderTop:
|
|
668
|
+
borderTop: !hasFormItem ? 0 : undefined
|
|
656
669
|
},
|
|
657
670
|
children: [/*#__PURE__*/_jsx("div", {
|
|
658
671
|
style: {
|