@ccs-ui/rc-pro 2.3.6-alpha-13 → 2.3.6-alpha-16

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.
package/es/config.js CHANGED
@@ -1,9 +1,12 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
1
+ var _excluded = ["token", "cssVar", "components"];
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
8
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
+ 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; }
7
10
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
11
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
12
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -13,7 +16,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
16
  import { darkTheme, defaultTheme } from '@ant-design/compatible';
14
17
  import { theme as antTheme, App, ConfigProvider, message, Modal, notification } from 'antd';
15
18
  import zhCN from 'antd/locale/zh_CN';
16
- import React, { useState } from 'react';
19
+ import { insertCss } from 'insert-css';
20
+ import React, { useEffect, useState } from 'react';
17
21
  import { AppConfigContext } from "./context";
18
22
  import { DialogElementsHolder } from "./dialog/hook";
19
23
  import ThemeDialog from "./theme-dialog";
@@ -57,6 +61,13 @@ function AppConfig(_ref) {
57
61
  var dialogHolderRef = React.useRef(null);
58
62
  // 主题
59
63
  var appTheme = theme === 'dark' ? darkTheme : defaultTheme;
64
+
65
+ // 传入的配置参数
66
+ var _ref2 = themeConfig || {},
67
+ token = _ref2.token,
68
+ cssVar = _ref2.cssVar,
69
+ components = _ref2.components,
70
+ otherConfig = _objectWithoutProperties(_ref2, _excluded);
60
71
  var algorithm = function algorithm() {
61
72
  var algorithms = theme === 'dark' ? [antTheme.darkAlgorithm] : [antTheme.defaultAlgorithm];
62
73
  if (isCompact) {
@@ -64,17 +75,23 @@ function AppConfig(_ref) {
64
75
  }
65
76
  return algorithms;
66
77
  };
78
+ useEffect(function () {
79
+ var prefix = _typeof(cssVar) === 'object' ? cssVar.prefix : 'ant';
80
+ var csss = [".ccs-tabs-auto-height > .ant-tabs-content-holder,\n .ccs-tabs-auto-height > .ant-tabs-content-holder > .ant-tabs-content,\n .ccs-tabs-auto-height > .ant-tabs-content-holder > .ant-tabs-content > div,\n .ccs-tabs-auto-height> .ant-tabs-content-holder> .ant-tabs-content> div> .ccs-pl { height: 100%;}", ".ccs-keep-alive-nav .".concat(prefix, "-tabs-tab {border: 0 !important;border-radius: 0 !important;}"), ".ccs-keep-alive-nav .".concat(prefix, "-tabs-tab-active {background-color: #f0f2f5 !important;}"), ".ccs-keep-alive .dark .ccs-keep-alive-nav .".concat(prefix, "-tabs-tab-active {background-color: #2b2c2c !important;} ")];
81
+ insertCss(csss.join(''));
82
+ }, []);
83
+ useEffect(function () {}, []);
67
84
 
68
85
  // 合并token
69
- var token = _objectSpread(_objectSpread({}, appTheme.token), themeConfig === null || themeConfig === void 0 ? void 0 : themeConfig.token);
70
-
86
+ var newToken = _objectSpread(_objectSpread({}, appTheme.token), token);
71
87
  // 暗黑模式背景色
72
- if (theme === 'dark') token.colorBgContainer = 'rgb(36, 37, 37)';
88
+ if (theme === 'dark') newToken.colorBgContainer = 'rgb(36, 37, 37)';
73
89
  return /*#__PURE__*/_jsx(ConfigProvider, {
74
90
  locale: zhCN,
75
- theme: _objectSpread(_objectSpread({}, appTheme), {}, {
76
- token: token,
77
- components: _objectSpread(_objectSpread({}, appTheme.components), themeConfig === null || themeConfig === void 0 ? void 0 : themeConfig.components),
91
+ theme: _objectSpread(_objectSpread(_objectSpread({}, appTheme), otherConfig), {}, {
92
+ cssVar: cssVar,
93
+ token: newToken,
94
+ components: _objectSpread(_objectSpread({}, appTheme.components), components),
78
95
  algorithm: algorithm()
79
96
  }),
80
97
  children: /*#__PURE__*/_jsxs(AppConfigContext.Provider, {
@@ -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" | "extraBtn" | "request" | "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>;
@@ -18,11 +18,9 @@ import { MoreOutlined } from '@ant-design/icons';
18
18
  import CcsUtils from '@ccs-ui/utils';
19
19
  import { useUpdate, useUpdateEffect } from 'ahooks';
20
20
  import { Button, Dropdown, Tabs } from 'antd';
21
- import { ConfigContext } from 'antd/es/config-provider';
22
21
  import classnames from 'classnames';
23
22
  import updateHelper from 'immutability-helper';
24
- import { insertCss } from 'insert-css';
25
- import { useContext, useEffect, useMemo, useRef } from 'react';
23
+ import { useMemo, useRef } from 'react';
26
24
  import { useLocation } from 'react-router';
27
25
  import { useOutlet } from 'react-router-dom';
28
26
  import { CcsResult, useAppConfig } from '..';
@@ -137,7 +135,6 @@ function KeepAliveTabs(_ref) {
137
135
  var routers = useRef([]);
138
136
  var location = useLocation();
139
137
  var pathname = location.pathname;
140
- var config = useContext(ConfigContext);
141
138
  var outlet = useOutlet();
142
139
  var update = useUpdate();
143
140
  var _useAppConfig = useAppConfig(),
@@ -149,11 +146,6 @@ function KeepAliveTabs(_ref) {
149
146
  if (routers.current.length >= maxLen) {
150
147
  routers.current = routers.current.slice(1);
151
148
  }
152
- useEffect(function () {
153
- var prefix = config.getPrefixCls();
154
- var csss = [".ccs-keep-alive-nav .".concat(prefix, "-tabs-tab {border: 0 !important;border-radius: 0 !important;}"), ".ccs-keep-alive-nav .".concat(prefix, "-tabs-tab-active {background-color: #f0f2f5 !important;}"), ".ccs-keep-alive .dark .ccs-keep-alive-nav .".concat(prefix, "-tabs-tab-active {background-color: #2b2c2c !important;} ")];
155
- insertCss(csss.join(''));
156
- }, []);
157
149
 
158
150
  // 菜单改变,更新用户权限信息
159
151
  useUpdateEffect(function () {
@@ -363,7 +355,6 @@ function KeepAliveTabs(_ref) {
363
355
  type: "text"
364
356
  })
365
357
  });
366
- console.log('routers', routers);
367
358
  return /*#__PURE__*/_jsxs("div", {
368
359
  className: classnames(className, "ccs-keep-alive"),
369
360
  children: [/*#__PURE__*/_jsx(Tabs, {
@@ -53,21 +53,24 @@
53
53
  }
54
54
  &-tabs {
55
55
  background-color: #fff;
56
- border-bottom: 1px solid #f1f2f5;
57
56
 
58
- .ccs-tab-item {
59
- flex: 1 1 auto;
60
- position: relative;
57
+ &.dark {
58
+ background-color: rgb(37, 37, 37);
61
59
  }
60
+ }
62
61
 
63
- .ccs-sticky-scroll > div {
64
- padding: 10px 16px 16px;
65
- flex-direction: column;
66
- display: none;
67
- }
62
+ .ccs-tab-item {
63
+ flex: 1 1 auto;
64
+ position: relative;
65
+ }
68
66
 
69
- .ccs-sticky-scroll.route-avtive > div {
70
- display: flex;
71
- }
67
+ .ccs-sticky-scroll > div {
68
+ padding: 10px 16px 16px;
69
+ flex-direction: column;
70
+ display: none;
71
+ }
72
+
73
+ .ccs-sticky-scroll.route-avtive > div {
74
+ display: flex;
72
75
  }
73
76
  }
@@ -22,9 +22,6 @@ export default function SelectionAlert(_ref) {
22
22
  }
23
23
  return /*#__PURE__*/_jsxs(Space, {
24
24
  size: 4,
25
- style: {
26
- padding: '6px 12px'
27
- },
28
25
  wrap: true,
29
26
  children: [data.map(function () {
30
27
  var row = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -631,6 +631,8 @@ var InternalProTable = function InternalProTable(props) {
631
631
 
632
632
  // 有查询条件
633
633
  var hasFormItem = formItems.length > 0;
634
+ // 头部间距
635
+ var tokenPadding = (table === null || table === void 0 ? void 0 : table.size) === 'small' ? token.paddingSM : token.padding;
634
636
  return /*#__PURE__*/_jsxs(_Fragment, {
635
637
  children: [/*#__PURE__*/_jsx(CcsResizeObserver.Target, {
636
638
  targetRef: tableContentRef,
@@ -642,13 +644,13 @@ var InternalProTable = function InternalProTable(props) {
642
644
  }),
643
645
  ref: containerRef,
644
646
  children: [/*#__PURE__*/_jsx(Card, {
645
- className: "ccs-pl-adaptation",
646
647
  style: {
647
- boxShadow: 'none'
648
+ boxShadow: 'none',
649
+ borderRadius: 0
648
650
  },
649
651
  styles: {
650
652
  body: {
651
- padding: hasFormItem ? 16 : 0
653
+ padding: hasFormItem ? tokenPadding : 0
652
654
  }
653
655
  },
654
656
  variant: "borderless",
@@ -672,7 +674,7 @@ var InternalProTable = function InternalProTable(props) {
672
674
  display: 'flex',
673
675
  justifyContent: 'space-between',
674
676
  width: '100%',
675
- padding: '12px 16px',
677
+ padding: "".concat(token.paddingSM, "px ").concat(tokenPadding, "px"),
676
678
  alignContent: 'center'
677
679
  }
678
680
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccs-ui/rc-pro",
3
- "version": "2.3.6-alpha-13",
3
+ "version": "2.3.6-alpha-16",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": {