@ccs-ui/rc-pro 2.3.6-beta-1 → 2.3.6-beta-2

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.
@@ -20,6 +20,8 @@ export type CcsTabProps = Omit<TabPaneProps, 'tab'> & {
20
20
  label: React.ReactNode;
21
21
  };
22
22
  type CcsTabsContextType = {
23
+ /** dom id */
24
+ tabsId: string;
23
25
  /** 当前激活tab面板的key */
24
26
  activeKey: string;
25
27
  /** tab间传递的参数 */
@@ -16,7 +16,7 @@ export type DialogButtonsProps<T> = Pick<CcsDialogModalProps, 'okText' | 'onClos
16
16
  export type DialogButtonRef = {
17
17
  onSetButtons: (e: React.ReactElement) => void;
18
18
  };
19
- export declare const DialogButtonHolder: <TParams, TData>({ auth, extraBtn, formRef, request, onOk, onClose, buttonRef, requestFieldNames, formInitialValues, preventRequestHandle, }: Pick<CcsDialogModalProps<TParams, TData>, "onOk" | "onClose" | "auth" | "request" | "extraBtn" | "requestFieldNames" | "preventRequestHandle"> & {
19
+ export declare const DialogButtonHolder: <TParams, TData>({ auth, extraBtn, formRef, request, onOk, onClose, buttonRef, requestFieldNames, formInitialValues, preventRequestHandle, }: Pick<CcsDialogModalProps<TParams, TData>, "auth" | "request" | "onClose" | "onOk" | "extraBtn" | "requestFieldNames" | "preventRequestHandle"> & {
20
20
  formRef: React.RefObject<DialogFormRef<TParams>>;
21
21
  formInitialValues: FormProps['initialValues'];
22
22
  buttonRef: RefObject<DialogButtonRef>;
@@ -416,14 +416,21 @@ var InternalProTable = function InternalProTable(props) {
416
416
  if (sorter) {
417
417
  columns === null || columns === void 0 || columns.forEach(function (c) {
418
418
  if (c.sorter) {
419
- var curSorter = Array.isArray(sorter) ?
420
- // @ts-ignore
421
- sorter.find(function (sort) {
422
- return sort.field === c.dataIndex;
423
- }) : sorter;
419
+ if (Array.isArray(sorter)) {
420
+ // @ts-ignore
421
+ var curSorter = sorter.find(function (sort) {
422
+ return sort.field === c.dataIndex;
423
+ });
424
+ if (curSorter) c.sortOrder = curSorter === null || curSorter === void 0 ? void 0 : curSorter.order;
425
+ return;
426
+ }
424
427
 
425
428
  // @ts-ignore
426
- c.sortOrder = curSorter === null || curSorter === void 0 ? void 0 : curSorter.order;
429
+ if (sorter.field === c.dataIndex) {
430
+ c.sortOrder = sorter.order;
431
+ return;
432
+ }
433
+ c.sortOrder = undefined;
427
434
  }
428
435
  });
429
436
 
@@ -4,6 +4,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
4
4
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
5
  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; } }
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import CcsUtils from '@ccs-ui/utils';
7
8
  import { useUpdateEffect } from 'ahooks';
8
9
  import { theme as antTheme } from 'antd';
9
10
  import update from 'immutability-helper';
@@ -19,16 +20,19 @@ export default (function (_ref) {
19
20
  activeKey = _ref2.activeKey,
20
21
  defaultActiveKey = _ref2.defaultActiveKey,
21
22
  onChange = _ref2.onChange;
22
- var _useState = useState(function () {
23
+ var _useState = useState("ccs-tabs-".concat(CcsUtils.getUUID(5))),
24
+ _useState2 = _slicedToArray(_useState, 1),
25
+ tabsId = _useState2[0];
26
+ var _useState3 = useState(function () {
23
27
  return {
24
28
  activeKey: defaultActiveKey || (items[0] || {}).key,
25
29
  items: items || [],
26
30
  options: {}
27
31
  };
28
32
  }),
29
- _useState2 = _slicedToArray(_useState, 2),
30
- tabsProps = _useState2[0],
31
- setTabsProps = _useState2[1];
33
+ _useState4 = _slicedToArray(_useState3, 2),
34
+ tabsProps = _useState4[0],
35
+ setTabsProps = _useState4[1];
32
36
 
33
37
  // items 发生改变
34
38
  useUpdateEffect(function () {
@@ -45,6 +49,7 @@ export default (function (_ref) {
45
49
  var addOptions = {
46
50
  items: tabsProps.items,
47
51
  className: 'ccs-tabs',
52
+ id: tabsId,
48
53
  tabBarStyle: {
49
54
  margin: 0,
50
55
  paddingLeft: 16,
@@ -153,6 +158,7 @@ export default (function (_ref) {
153
158
  };
154
159
  return children ? /*#__PURE__*/_jsx(TabsContext.Provider, {
155
160
  value: {
161
+ tabsId: tabsId,
156
162
  activeKey: tabsProps.activeKey,
157
163
  options: tabsProps.options,
158
164
  onTabChange: onHooksChange,
package/es/table/index.js CHANGED
@@ -13,6 +13,7 @@ import { Table, Tooltip, theme } from 'antd';
13
13
  import classNames from 'classnames';
14
14
  import { useEffect, useImperativeHandle } from 'react';
15
15
  import { Resizable } from 'react-resizable';
16
+ import useTabs from "../hooks/use-tabs";
16
17
  import "./index.less";
17
18
  import { jsx as _jsx } from "react/jsx-runtime";
18
19
  var ResizableTitle = function ResizableTitle(props) {
@@ -61,12 +62,21 @@ var CustomTable = function CustomTable(props) {
61
62
  current = _ref$current === void 0 ? 1 : _ref$current,
62
63
  _ref$total = _ref.total,
63
64
  total = _ref$total === void 0 ? 0 : _ref$total;
65
+ var inTabs = useTabs();
64
66
 
65
67
  // table 固定表头,内容滚动
66
68
  var _useDebounceFn = useDebounceFn(function () {
67
69
  if ((scroll === null || scroll === void 0 ? void 0 : scroll.y) === 'auto') {
68
70
  var _tableContentRef$curr;
69
71
  var tableTarget = tableContentRef === null || tableContentRef === void 0 ? void 0 : tableContentRef.current;
72
+
73
+ // 在ccs tabs组件内
74
+ if (inTabs !== null && inTabs !== void 0 && inTabs.tabsId) {
75
+ var tabsDom = document.getElementById(inTabs === null || inTabs === void 0 ? void 0 : inTabs.tabsId);
76
+ if (tabsDom) {
77
+ tabsDom.classList.add('ccs-tabs-auto-height');
78
+ }
79
+ }
70
80
  if (!tableTarget) return;
71
81
  var tableBody = tableTarget.getElementsByClassName('ant-table-body')[0];
72
82
  if (!tableBody) return;
@@ -171,3 +171,19 @@
171
171
  }
172
172
  }
173
173
  }
174
+
175
+ .ccs-tabs-auto-height {
176
+ flex: 1 1 auto;
177
+ > .ant-tabs-content-holder {
178
+ height: 100%;
179
+ > .ant-tabs-content {
180
+ height: 100%;
181
+ > div {
182
+ height: 100%;
183
+ > .ccs-pl {
184
+ height: 100%;
185
+ }
186
+ }
187
+ }
188
+ }
189
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccs-ui/rc-pro",
3
- "version": "2.3.6-beta-1",
3
+ "version": "2.3.6-beta-2",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": {