@ccs-ui/rc-pro 1.2.0-beta-4 → 1.2.0-beta-7

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.
@@ -1,7 +1,7 @@
1
1
  import { FormProps } from 'antd';
2
2
  import { DialogFormRef } from './form';
3
3
  import { CcsDialogModalProps } from './hook';
4
- declare const DialogRequestButton: ({ auth, formRef, extraBtn, formInitialValues, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "auth" | "onCancel" | "extraBtn" | "request" | "onRequestBefore"> & {
4
+ declare const DialogRequestButton: ({ auth, formRef, extraBtn, formInitialValues, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "onCancel" | "auth" | "request" | "extraBtn" | "onRequestBefore"> & {
5
5
  formRef: React.RefObject<DialogFormRef>;
6
6
  formInitialValues: FormProps['initialValues'];
7
7
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { FormProps } from 'antd';
2
2
  import { DialogFormRef } from './form';
3
3
  import { CcsDialogModalProps } from './hook';
4
- declare const DialogSelfOkButton: ({ auth, formRef, extraBtn, formInitialValues, onCancel, onOk, }: Pick<CcsDialogModalProps, "auth" | "onOk" | "onCancel" | "extraBtn"> & {
4
+ declare const DialogSelfOkButton: ({ auth, formRef, extraBtn, formInitialValues, onCancel, onOk, }: Pick<CcsDialogModalProps, "onCancel" | "auth" | "onOk" | "extraBtn"> & {
5
5
  formRef: React.RefObject<DialogFormRef>;
6
6
  formInitialValues: FormProps['initialValues'];
7
7
  }) => import("react/jsx-runtime").JSX.Element;
@@ -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(false),
38
+ var _useState3 = useState('hidden'),
40
39
  _useState4 = _slicedToArray(_useState3, 2),
41
- hasMore = _useState4[0],
42
- setHasMore = _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]);
@@ -61,21 +61,26 @@ function HeadComponent(_ref) {
61
61
 
62
62
  // 尺寸变化重设尺寸
63
63
  var resizeFn = _debounce(function (hm) {
64
- setHasMore(hm);
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
- if (hm !== hasMore) resizeFn(hm);
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: {
@@ -35,6 +35,7 @@ export type CcsTableProps<T> = Omit<TableProps<T>, 'columns' | 'title'> & {
35
35
  className?: string;
36
36
  /** style */
37
37
  style?: CSSProperties;
38
+ isEnableToolbar?: boolean;
38
39
  /** 列配置 */
39
40
  columns?: TableColumns<T>;
40
41
  /** table title */
@@ -30,6 +30,7 @@ import TableTree from "./tree";
30
30
 
31
31
  // 同 antd FormLayout; adaptation为自适应布局
32
32
  import { jsx as _jsx } from "react/jsx-runtime";
33
+ import { Fragment as _Fragment } from "react/jsx-runtime";
33
34
  import { jsxs as _jsxs } from "react/jsx-runtime";
34
35
  export var classPrefix = 'ccs-pl';
35
36
  export var TableSelectionContext = /*#__PURE__*/React.createContext({
@@ -531,7 +532,7 @@ var InternalProTable = function InternalProTable(props) {
531
532
  formItemLayout: props.formItemLayout,
532
533
  formItemCol: props.formItemCol,
533
534
  onSearch: _onSearch,
534
- tableOperation: /*#__PURE__*/_jsx(TableOperation, {
535
+ tableOperation: (table === null || table === void 0 ? void 0 : table.isEnableToolbar) !== false ? /*#__PURE__*/_jsx(TableOperation, {
535
536
  tableRowSize: tableRowSize,
536
537
  columns: columns,
537
538
  tableRef: tableRef,
@@ -540,7 +541,7 @@ var InternalProTable = function InternalProTable(props) {
540
541
  onChangeRowSize: function onChangeRowSize(e) {
541
542
  return setTableRowSize(e);
542
543
  }
543
- }),
544
+ }) : /*#__PURE__*/_jsx(_Fragment, {}),
544
545
  children: newToolbarExtra
545
546
  }) : /*#__PURE__*/_jsx(HeadComponent, {
546
547
  form: form,
@@ -550,7 +551,7 @@ var InternalProTable = function InternalProTable(props) {
550
551
  formInitValues: formInitValues,
551
552
  formItemLabelWidth: props.formItemLabelWidth,
552
553
  onSearch: _onSearch,
553
- tableOperation: /*#__PURE__*/_jsx(TableOperation, {
554
+ tableOperation: (table === null || table === void 0 ? void 0 : table.isEnableToolbar) !== false ? /*#__PURE__*/_jsx(TableOperation, {
554
555
  isInModalOrDrawer: isInModalOrDrawer,
555
556
  onChangeRowSize: function onChangeRowSize(e) {
556
557
  return setTableRowSize(e);
@@ -559,7 +560,7 @@ var InternalProTable = function InternalProTable(props) {
559
560
  onReset: _onReset,
560
561
  columns: columns,
561
562
  tableRef: tableRef
562
- }),
563
+ }) : /*#__PURE__*/_jsx(_Fragment, {}),
563
564
  children: newToolbarExtra
564
565
  }), /*#__PURE__*/_jsxs("div", {
565
566
  className: "".concat(classPrefix, "-table-content ").concat(props.formItemLayout),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ccs-ui/rc-pro",
3
- "version": "1.2.0-beta-4",
4
- "description": "验证码组件兼容暗黑模式;proTable封装rowselection代码;proTable添加自适应布局模式;CcsDialog不适应contextHolder也能打开;移除utils,独立存在@ccs-ui/utils",
3
+ "version": "1.2.0-beta-7",
4
+ "description": "验证码组件兼容暗黑模式;proTable封装rowselection代码;proTable添加自适应布局模式;CcsDialog不适应contextHolder也能打开;移除utils,独立存在@ccs-ui/utils;添加属性isEnableToolbar,table可以隐藏toolbar; ",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "Hong",