@ccs-ui/rc-pro 1.2.0-beta-3 → 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.
@@ -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";
@@ -17,7 +17,6 @@ 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 _formItemsRef$current;
21
20
  var form = _ref.form,
22
21
  title = _ref.title,
23
22
  toolbar = _ref.toolbar,
@@ -30,16 +29,17 @@ function HeadComponent(_ref) {
30
29
  formItemLabelWidth = _ref.formItemLabelWidth,
31
30
  tableOperation = _ref.tableOperation,
32
31
  onSearch = _ref.onSearch;
33
- var searchBtnRef = useRef(null);
34
32
  var formItemsRef = useRef(null);
35
33
  // 查询条件是否展开
36
34
  var _useState = useState(expandForm),
37
35
  _useState2 = _slicedToArray(_useState, 2),
38
36
  isExpand = _useState2[0],
39
37
  setIsExpand = _useState2[1];
40
- var _useState3 = useState({}),
38
+ var _useState3 = useState('hidden'),
41
39
  _useState4 = _slicedToArray(_useState3, 2),
42
- update = _useState4[1];
40
+ visible = _useState4[0],
41
+ setVisible = _useState4[1];
42
+ var hasMore = visible === 'more';
43
43
  useUpdateEffect(function () {
44
44
  setIsExpand(expandForm);
45
45
  }, [expandForm]);
@@ -58,11 +58,29 @@ function HeadComponent(_ref) {
58
58
  // 查询条件记录数
59
59
  var itemLen = allFormItems.length;
60
60
  var hasItem = itemLen > 0;
61
- var hasMore = (((_formItemsRef$current = formItemsRef.current) === null || _formItemsRef$current === void 0 ? void 0 : _formItemsRef$current.scrollHeight) || 0) > 40;
61
+
62
+ // 尺寸变化重设尺寸
63
+ var resizeFn = _debounce(function (hm) {
64
+ setVisible(hm);
65
+ }, 500);
66
+
67
+ // 监听dom尺寸变化
68
+ var onResize = function onResize() {
69
+ var _formItemsRef$current;
70
+ if (visible === 'hidden') return;
71
+ var scrollHeight = ((_formItemsRef$current = formItemsRef.current) === null || _formItemsRef$current === void 0 ? void 0 : _formItemsRef$current.scrollHeight) || 0;
72
+ if (scrollHeight === 0) return;
73
+ var hm = scrollHeight > 40 ? 'more' : 'visible';
74
+ resizeFn(hm);
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
+ }, []);
62
81
 
63
82
  // 操作按钮
64
83
  var renderSearchBtn = /*#__PURE__*/_jsxs("div", {
65
- ref: searchBtnRef,
66
84
  style: {
67
85
  textAlign: 'right',
68
86
  flex: isExpand && hasMore ? '1 1 auto' : '0 0 auto'
@@ -140,16 +158,6 @@ function HeadComponent(_ref) {
140
158
  }, item.name);
141
159
  });
142
160
  };
143
-
144
- // 尺寸变化重设尺寸
145
- var resizeFn = _debounce(function () {
146
- update({});
147
- }, 500);
148
-
149
- // 监听dom尺寸变化
150
- var onResize = function onResize() {
151
- resizeFn();
152
- };
153
161
  var formStyles = {
154
162
  flexWrap: isExpand ? 'wrap' : 'nowrap'
155
163
  };
@@ -161,7 +169,8 @@ function HeadComponent(_ref) {
161
169
  }), /*#__PURE__*/_jsx(Card, {
162
170
  className: "ccs-pl-adaptation",
163
171
  style: {
164
- boxShadow: 'none'
172
+ boxShadow: 'none',
173
+ visibility: visible === 'hidden' ? 'hidden' : 'visible'
165
174
  },
166
175
  styles: {
167
176
  body: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccs-ui/rc-pro",
3
- "version": "1.2.0-beta-3",
3
+ "version": "1.2.0-beta-6",
4
4
  "description": "验证码组件兼容暗黑模式;proTable封装rowselection代码;proTable添加自适应布局模式;CcsDialog不适应contextHolder也能打开;移除utils,独立存在@ccs-ui/utils。",
5
5
  "license": "MIT",
6
6
  "author": {