@ccs-ui/rc-pro 1.1.13 → 1.1.15

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.
@@ -2,7 +2,7 @@
2
2
  import { FormProps } from 'antd';
3
3
  import { DialogFormRef } from './form';
4
4
  import { CcsDialogModal, CcsDialogModalProps } from './hook';
5
- export declare const DialogSelfButton: ({ auth, formRef, formInitialValues, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "auth" | "request" | "onRequestBefore" | "onCancel"> & {
5
+ export declare const DialogSelfButton: ({ auth, formRef, formInitialValues, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "request" | "auth" | "onRequestBefore" | "onCancel"> & {
6
6
  formRef: React.RefObject<DialogFormRef>;
7
7
  formInitialValues: FormProps['initialValues'];
8
8
  }) => import("react/jsx-runtime").JSX.Element;
@@ -10,7 +10,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
10
10
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
11
11
  import { MoreOutlined } from '@ant-design/icons';
12
12
  import { useUpdate, useUpdateEffect } from 'ahooks';
13
- import { Button, Dropdown, Empty, Tabs } from 'antd';
13
+ import { Button, Dropdown, Empty, Tabs, theme } from 'antd';
14
14
  import classnames from 'classnames';
15
15
  import _debounce from 'lodash/debounce';
16
16
  import ResizeObserver from 'rc-resize-observer';
@@ -44,6 +44,9 @@ export default (function (_ref) {
44
44
  locationKey = location.key;
45
45
  var outlet = useOutlet();
46
46
  var update = useUpdate();
47
+ var _theme$useToken = theme.useToken(),
48
+ token = _theme$useToken.token;
49
+ var isDark = token._appTheme === 'dark';
47
50
 
48
51
  // 超过缓存数量,删除第一个
49
52
  if (components.current.length >= maxLen) {
@@ -219,12 +222,13 @@ export default (function (_ref) {
219
222
  children: /*#__PURE__*/_jsx("div", {})
220
223
  }), /*#__PURE__*/_jsx(Tabs, {
221
224
  id: "keep-alive-tabs",
222
- hideAdd: true,
223
- size: "small",
225
+ hideAdd: true
226
+ // size="small"
227
+ ,
224
228
  onChange: function onChange(e) {
225
229
  history.push(e);
226
230
  },
227
- className: "ccs-keep-alive-tabs",
231
+ className: "ccs-keep-alive-tabs ".concat(isDark ? 'dark' : ''),
228
232
  activeKey: pathname,
229
233
  type: "editable-card",
230
234
  onEdit: function onEdit(e) {
@@ -5,7 +5,11 @@
5
5
  flex-direction: column;
6
6
 
7
7
  &-tabs {
8
- // background: rgb(240 242 245);
8
+ background-color: #fff;
9
+
10
+ &.dark {
11
+ background-color: rgb(37, 37, 37);
12
+ }
9
13
 
10
14
  & > .ant-tabs-nav {
11
15
  margin: 0;
@@ -18,6 +22,15 @@
18
22
  border: 0;
19
23
  border-radius: 0 !important;
20
24
  }
25
+ .ant-tabs-tab-active {
26
+ background-color: #f0f2f5;
27
+ }
28
+ }
29
+
30
+ &.dark > .ant-tabs-nav {
31
+ .ant-tabs-tab-active {
32
+ background-color: #2b2c2c;
33
+ }
21
34
  }
22
35
  }
23
36
  }
@@ -23,7 +23,8 @@ export default /*#__PURE__*/memo(function (props) {
23
23
  style: {
24
24
  flex: '1 1 auto',
25
25
  display: active ? 'block' : 'none',
26
- position: 'relative'
26
+ position: 'relative',
27
+ padding: 16
27
28
  },
28
29
  id: id,
29
30
  "data-display": active,
@@ -0,0 +1,25 @@
1
+ import { CardProps } from 'antd';
2
+ import { CSSProperties, FC, ReactNode } from 'react';
3
+ import './index.less';
4
+ type ClassProps = {
5
+ className?: string;
6
+ style?: CSSProperties;
7
+ };
8
+ type CcsProGridProps = ClassProps & {
9
+ title?: string;
10
+ titleExtra?: ReactNode;
11
+ bordered?: boolean;
12
+ hideTitle?: boolean;
13
+ children?: ReactNode;
14
+ };
15
+ type ColProps = CardProps & {
16
+ colSpan?: string | number;
17
+ colStyle?: CSSProperties;
18
+ colClassName?: string;
19
+ };
20
+ type GridInstance = FC<CcsProGridProps> & {
21
+ Col: typeof GridCol;
22
+ };
23
+ declare const GridCol: ({ colSpan, colClassName, colStyle, ...otherProps }: ColProps) => import("react/jsx-runtime").JSX.Element;
24
+ declare const ProGrid: GridInstance;
25
+ export default ProGrid;
@@ -10,7 +10,6 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
10
10
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
11
11
  import { Card } from 'antd';
12
12
  import classNames from 'classnames';
13
- import { GridContext } from "./context";
14
13
  import "./index.less";
15
14
  import { jsx as _jsx } from "react/jsx-runtime";
16
15
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -47,36 +46,31 @@ var Grid = function Grid(_ref2) {
47
46
  bordered = _ref2.bordered,
48
47
  children = _ref2.children,
49
48
  restProps = _objectWithoutProperties(_ref2, _excluded2);
50
- return /*#__PURE__*/_jsx(GridContext.Provider, {
51
- value: {
52
- inProGrid: true
53
- },
54
- children: /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({}, restProps), {}, {
55
- className: classNames({
56
- 'ccs-pg-border': bordered
57
- }),
58
- children: [!hideTitle && title ? /*#__PURE__*/_jsx(Card, {
59
- title: title,
60
- extra: titleExtra,
61
- bordered: false,
49
+ return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({}, restProps), {}, {
50
+ className: classNames({
51
+ 'ccs-pg-border': bordered
52
+ }),
53
+ children: [!hideTitle && title ? /*#__PURE__*/_jsx(Card, {
54
+ title: title,
55
+ extra: titleExtra,
56
+ bordered: false,
57
+ style: {
58
+ borderRadius: 0
59
+ },
60
+ bodyStyle: {
61
+ padding: 0
62
+ }
63
+ }) : null, /*#__PURE__*/_jsx("div", {
64
+ className: "ccs-pl-table-content",
65
+ children: /*#__PURE__*/_jsx("div", {
62
66
  style: {
63
- borderRadius: 0
67
+ display: 'flex',
68
+ padding: 10
64
69
  },
65
- bodyStyle: {
66
- padding: 0
67
- }
68
- }) : null, /*#__PURE__*/_jsx("div", {
69
- className: "ccs-pl-table-content",
70
- children: /*#__PURE__*/_jsx("div", {
71
- style: {
72
- display: 'flex',
73
- padding: 10
74
- },
75
- children: children
76
- })
77
- })]
78
- }))
79
- });
70
+ children: children
71
+ })
72
+ })]
73
+ }));
80
74
  };
81
75
  var ProGrid = Grid;
82
76
  ProGrid.Col = GridCol;
@@ -21,7 +21,6 @@ import _isArray from 'lodash/isArray';
21
21
  import React, { useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
22
22
  import { CcsUtils, CcsWaterMark } from '..';
23
23
  import { useCcsPage } from "../";
24
- import useProGrid from "../pro-grid/useProGrid";
25
24
  import CcsTable from "../table";
26
25
  import "./index.less";
27
26
  import SearchComponent from "./search";
@@ -106,8 +105,6 @@ var InternalProTable = function InternalProTable(props) {
106
105
  var tableRef = useRef(null);
107
106
  var _useCcsPage = useCcsPage(),
108
107
  onAuth = _useCcsPage.onAuth;
109
- var _useProGrid = useProGrid(),
110
- inProGrid = _useProGrid.inProGrid;
111
108
  var _ref = table || {},
112
109
  pagination = _ref.pagination,
113
110
  request = _ref.request,
@@ -476,9 +473,7 @@ var InternalProTable = function InternalProTable(props) {
476
473
  children: toolbarExtra
477
474
  }), /*#__PURE__*/_jsxs("div", {
478
475
  className: "".concat(classPrefix, "-table-content"),
479
- style: _objectSpread({
480
- padding: isInModalOrDrawer || inProGrid ? 0 : 16
481
- }, tableStyle),
476
+ style: tableStyle,
482
477
  ref: tableRef,
483
478
  children: [renderTable(), children]
484
479
  })]
package/es/table/index.js CHANGED
@@ -60,7 +60,7 @@ var CustomTable = function CustomTable(props) {
60
60
  if (_pagination && _pagination.length > 0) {
61
61
  pageHeight = _pagination[0].clientHeight;
62
62
  }
63
- var scrollHeight = bodyHeight - top - 16 - theadHeight - pageHeight - (restProps.title ? 46 : 0) - (restProps.footer ? 46 : 0);
63
+ var scrollHeight = bodyHeight - top - 32 - theadHeight - pageHeight - (restProps.title ? 46 : 0) - (restProps.footer ? 46 : 0);
64
64
 
65
65
  // 固定tbody高度
66
66
  var tbody = (_ref$current4 = ref.current) === null || _ref$current4 === void 0 ? void 0 : _ref$current4.getElementsByClassName('ant-table-body');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccs-ui/rc-pro",
3
- "version": "1.1.13",
3
+ "version": "1.1.15",
4
4
  "description": "A react pro components",
5
5
  "license": "MIT",
6
6
  "module": "es/index.js",
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- export var GridContext = /*#__PURE__*/React.createContext({
3
- inProGrid: false
4
- });
@@ -1,10 +0,0 @@
1
- import { useContext } from 'react';
2
- import { GridContext } from "./context";
3
- function useProGrid() {
4
- var context = useContext(GridContext);
5
- if (context === undefined) {
6
- throw new Error('TabsContext must be used within a app page');
7
- }
8
- return context;
9
- }
10
- export default useProGrid;