@ccs-ui/rc-pro 1.2.0-beta-10 → 1.2.0-beta-12

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.
@@ -11,6 +11,7 @@
11
11
  }
12
12
 
13
13
  .ccs-aj-slider-img {
14
+ top: 0;
14
15
  position: absolute;
15
16
  -webkit-user-drag: none;
16
17
  }
@@ -102,6 +102,9 @@ function HeadComponent(_ref) {
102
102
  onClick: function onClick() {
103
103
  return form.submit();
104
104
  },
105
+ style: {
106
+ marginLeft: !hasMore ? 10 : undefined
107
+ },
105
108
  children: "\u67E5\u8BE2"
106
109
  }), toolbar ? null : tableOperation]
107
110
  });
@@ -201,8 +204,7 @@ function HeadComponent(_ref) {
201
204
  children: [renderFormItems(), isExpand && renderSearchBtn]
202
205
  }), !isExpand && /*#__PURE__*/_jsx("div", {
203
206
  style: {
204
- flex: '0 0 auto',
205
- paddingLeft: 10
207
+ flex: '0 0 auto'
206
208
  },
207
209
  children: renderSearchBtn
208
210
  })]
@@ -14,7 +14,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
14
14
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
15
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
16
  import CcsUtils from '@ccs-ui/utils';
17
- import { useUpdateEffect } from 'ahooks';
17
+ import { useSize, useUpdateEffect } from 'ahooks';
18
18
  import { Empty, Form, theme } from 'antd';
19
19
  import classNames from 'classnames';
20
20
  import React, { useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
@@ -80,6 +80,8 @@ var InternalProTable = function InternalProTable(props) {
80
80
  var filtersRef = useRef({});
81
81
  // table content
82
82
  var tableContentRef = useRef(null);
83
+ // container
84
+ var containerRef = useRef(null);
83
85
  // table ref
84
86
  var tableRef = useRef();
85
87
  // 查询form
@@ -121,6 +123,13 @@ var InternalProTable = function InternalProTable(props) {
121
123
  });
122
124
  }, []);
123
125
 
126
+ // 监听容器尺寸变化
127
+ var size = useSize(containerRef);
128
+ useEffect(function () {
129
+ var _table$scroll, _tableRef$current;
130
+ if ((table === null || table === void 0 || (_table$scroll = table.scroll) === null || _table$scroll === void 0 ? void 0 : _table$scroll.y) === 'auto') (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 || _tableRef$current.onFixedThead();
131
+ }, [size === null || size === void 0 ? void 0 : size.height]);
132
+
124
133
  // 获取数据
125
134
  var onRequest = /*#__PURE__*/function () {
126
135
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(eventType) {
@@ -151,7 +160,7 @@ var InternalProTable = function InternalProTable(props) {
151
160
  newRequestResult,
152
161
  _newRequestResult$dat,
153
162
  totalNum,
154
- size,
163
+ _size,
155
164
  no,
156
165
  result,
157
166
  _args = arguments;
@@ -201,7 +210,7 @@ var InternalProTable = function InternalProTable(props) {
201
210
  }
202
211
  // onSearchAfter 处理请求结果
203
212
  newRequestResult = onSearchAfter ? onSearchAfter(requestResult, eventType) : requestResult;
204
- _newRequestResult$dat = newRequestResult.data, totalNum = _newRequestResult$dat.totalNum, size = _newRequestResult$dat.pageSize, no = _newRequestResult$dat.pageNo, result = _newRequestResult$dat.result;
213
+ _newRequestResult$dat = newRequestResult.data, totalNum = _newRequestResult$dat.totalNum, _size = _newRequestResult$dat.pageSize, no = _newRequestResult$dat.pageNo, result = _newRequestResult$dat.result;
205
214
  if (!(totalNum === undefined || pageSize === undefined || no === undefined || result === undefined)) {
206
215
  _context.next = 19;
207
216
  break;
@@ -218,7 +227,7 @@ var InternalProTable = function InternalProTable(props) {
218
227
  } else {
219
228
  setData({
220
229
  pageNo: no,
221
- pageSize: size,
230
+ pageSize: _size,
222
231
  loading: false,
223
232
  result: result,
224
233
  totalNum: totalNum || 0
@@ -265,12 +274,6 @@ var InternalProTable = function InternalProTable(props) {
265
274
  (_treeRef$current2 = treeRef.current) === null || _treeRef$current2 === void 0 || _treeRef$current2.onExpandKeys(ids);
266
275
  (_treeRef$current3 = treeRef.current) === null || _treeRef$current3 === void 0 || _treeRef$current3.onRequestTree({}, treeNode);
267
276
  };
268
-
269
- // 尺寸变化重设尺寸
270
- // const resizeFn = _debounce(() => {
271
- // // console.log('resizeFn...');
272
- // }, 200);
273
-
274
277
  useEffect(function () {
275
278
  // 判断是否在弹出框中
276
279
  var inMd = onTableInModalOrDrawer(tableContentRef.current);
@@ -287,12 +290,6 @@ var InternalProTable = function InternalProTable(props) {
287
290
  stickyRef.current = inTab;
288
291
  return;
289
292
  }
290
-
291
- // // 监听resize
292
- // window.addEventListener('resize', resizeFn);
293
- // return () => {
294
- // window.removeEventListener('resize', resizeFn);
295
- // };
296
293
  }, []);
297
294
 
298
295
  // size参数变化
@@ -520,6 +517,7 @@ var InternalProTable = function InternalProTable(props) {
520
517
  var render = /*#__PURE__*/_jsxs("div", {
521
518
  className: classNames(classPrefix, className, _defineProperty({}, 'dark-table', isDark)),
522
519
  style: rootStyle,
520
+ ref: containerRef,
523
521
  children: [!(!formItems.length && !toolbar) && isAuth && props.formItemLayout !== 'adaptation' ? /*#__PURE__*/_jsx(SearchComponent, {
524
522
  form: form,
525
523
  title: title,
@@ -6,8 +6,12 @@ type TableProps<T> = Omit<CcsTableProps<T>, 'request' | 'requestParam' | 'title'
6
6
  tableRef?: React.MutableRefObject<TableRefType | undefined>;
7
7
  };
8
8
  export type TableRefType = {
9
+ /** 列筛选 */
9
10
  onColumnFilter: (e: any) => void;
11
+ /** 全屏 */
10
12
  onFullScreen: () => void;
13
+ /** 计算固定表头宽度 */
14
+ onFixedThead: () => void;
11
15
  };
12
16
  declare const CustomTable: <T extends object = any>(props: TableProps<T>) => import("react/jsx-runtime").JSX.Element;
13
17
  export default CustomTable;
package/es/table/index.js CHANGED
@@ -117,7 +117,8 @@ var CustomTable = function CustomTable(props) {
117
117
  });
118
118
  update();
119
119
  },
120
- onFullScreen: onFixedThead
120
+ onFullScreen: onFixedThead,
121
+ onFixedThead: onFixedThead
121
122
  };
122
123
  });
123
124
 
@@ -209,7 +210,7 @@ var CustomTable = function CustomTable(props) {
209
210
  // locale={{ emptyText: <CcsResult.NoData iconWidth={80} /> }}
210
211
  }, restProps), {}, {
211
212
  size: restProps.size || 'middle',
212
- className: classNames(_defineProperty(_defineProperty(_defineProperty({}, 'ccs-table-nodata', !totalNum), 'ccs-table-wrapper', !rowSelection), "className", className)),
213
+ className: classNames(_defineProperty(_defineProperty(_defineProperty({}, 'ccs-table-nodata', !result || result.length === 0), 'ccs-table-wrapper', !rowSelection), "className", className)),
213
214
  scroll: scroll,
214
215
  components: {
215
216
  header: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccs-ui/rc-pro",
3
- "version": "1.2.0-beta-10",
3
+ "version": "1.2.0-beta-12",
4
4
  "description": "验证码组件兼容暗黑模式;proTable封装rowselection代码;proTable添加自适应布局模式;CcsDialog不适应contextHolder也能打开;移除utils,独立存在@ccs-ui/utils;添加属性isEnableToolbar,table可以隐藏toolbar; ",
5
5
  "license": "MIT",
6
6
  "author": {