@ccs-ui/rc-pro 1.2.0-beta-4 → 1.2.0-beta-6
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.js +16 -10
- package/package.json +1 -1
package/es/pro-table/head.js
CHANGED
|
@@ -8,7 +8,7 @@ import { DownOutlined, UpOutlined } from '@ant-design/icons';
|
|
|
8
8
|
import { useUpdateEffect } from 'ahooks';
|
|
9
9
|
import { Button, Card, Form } from 'antd';
|
|
10
10
|
import _debounce from 'lodash.debounce';
|
|
11
|
-
import React, { useMemo, useRef, useState } from 'react';
|
|
11
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
12
12
|
import { CcsResizeObserver } from '..';
|
|
13
13
|
import { getShowDpends } from "./_utils";
|
|
14
14
|
import HeadFormItem from "./form-item";
|
|
@@ -29,17 +29,17 @@ function HeadComponent(_ref) {
|
|
|
29
29
|
formItemLabelWidth = _ref.formItemLabelWidth,
|
|
30
30
|
tableOperation = _ref.tableOperation,
|
|
31
31
|
onSearch = _ref.onSearch;
|
|
32
|
-
var searchBtnRef = useRef(null);
|
|
33
32
|
var formItemsRef = useRef(null);
|
|
34
33
|
// 查询条件是否展开
|
|
35
34
|
var _useState = useState(expandForm),
|
|
36
35
|
_useState2 = _slicedToArray(_useState, 2),
|
|
37
36
|
isExpand = _useState2[0],
|
|
38
37
|
setIsExpand = _useState2[1];
|
|
39
|
-
var _useState3 = useState(
|
|
38
|
+
var _useState3 = useState('hidden'),
|
|
40
39
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
visible = _useState4[0],
|
|
41
|
+
setVisible = _useState4[1];
|
|
42
|
+
var hasMore = visible === 'more';
|
|
43
43
|
useUpdateEffect(function () {
|
|
44
44
|
setIsExpand(expandForm);
|
|
45
45
|
}, [expandForm]);
|
|
@@ -61,21 +61,26 @@ function HeadComponent(_ref) {
|
|
|
61
61
|
|
|
62
62
|
// 尺寸变化重设尺寸
|
|
63
63
|
var resizeFn = _debounce(function (hm) {
|
|
64
|
-
|
|
64
|
+
setVisible(hm);
|
|
65
65
|
}, 500);
|
|
66
66
|
|
|
67
67
|
// 监听dom尺寸变化
|
|
68
68
|
var onResize = function onResize() {
|
|
69
69
|
var _formItemsRef$current;
|
|
70
|
+
if (visible === 'hidden') return;
|
|
70
71
|
var scrollHeight = ((_formItemsRef$current = formItemsRef.current) === null || _formItemsRef$current === void 0 ? void 0 : _formItemsRef$current.scrollHeight) || 0;
|
|
71
72
|
if (scrollHeight === 0) return;
|
|
72
|
-
var hm = scrollHeight > 40;
|
|
73
|
-
|
|
73
|
+
var hm = scrollHeight > 40 ? 'more' : 'visible';
|
|
74
|
+
resizeFn(hm);
|
|
74
75
|
};
|
|
76
|
+
useEffect(function () {
|
|
77
|
+
var _formItemsRef$current2;
|
|
78
|
+
var scrollHeight = ((_formItemsRef$current2 = formItemsRef.current) === null || _formItemsRef$current2 === void 0 ? void 0 : _formItemsRef$current2.scrollHeight) || 0;
|
|
79
|
+
setVisible(scrollHeight > 40 ? 'more' : 'visible');
|
|
80
|
+
}, []);
|
|
75
81
|
|
|
76
82
|
// 操作按钮
|
|
77
83
|
var renderSearchBtn = /*#__PURE__*/_jsxs("div", {
|
|
78
|
-
ref: searchBtnRef,
|
|
79
84
|
style: {
|
|
80
85
|
textAlign: 'right',
|
|
81
86
|
flex: isExpand && hasMore ? '1 1 auto' : '0 0 auto'
|
|
@@ -164,7 +169,8 @@ function HeadComponent(_ref) {
|
|
|
164
169
|
}), /*#__PURE__*/_jsx(Card, {
|
|
165
170
|
className: "ccs-pl-adaptation",
|
|
166
171
|
style: {
|
|
167
|
-
boxShadow: 'none'
|
|
172
|
+
boxShadow: 'none',
|
|
173
|
+
visibility: visible === 'hidden' ? 'hidden' : 'visible'
|
|
168
174
|
},
|
|
169
175
|
styles: {
|
|
170
176
|
body: {
|
package/package.json
CHANGED