@ccs-ui/rc-pro 1.1.1-rc1 → 1.1.1-rc11

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.
Files changed (64) hide show
  1. package/es/auth/index.d.ts +3 -9
  2. package/es/auth/index.js +10 -9
  3. package/es/dialog/HookDrawer.d.ts +1 -1
  4. package/es/dialog/HookDrawer.js +31 -19
  5. package/es/dialog/HookModal.d.ts +1 -1
  6. package/es/dialog/HookModal.js +25 -20
  7. package/es/dialog/button.d.ts +2 -1
  8. package/es/dialog/button.js +20 -17
  9. package/es/dialog/context.d.ts +8 -7
  10. package/es/dialog/context.js +4 -4
  11. package/es/dialog/form.d.ts +2 -2
  12. package/es/dialog/form.js +4 -3
  13. package/es/dialog/{dialog.d.ts → hook.d.ts} +9 -1
  14. package/es/dialog/index.d.ts +4 -4
  15. package/es/dialog/index.js +2 -2
  16. package/es/dialog/index.less +14 -17
  17. package/es/drawer.zip +0 -0
  18. package/es/index.d.ts +4 -8
  19. package/es/index.js +0 -2
  20. package/es/keep-alive-tabs/index.d.ts +1 -1
  21. package/es/keep-alive-tabs/index.js +1 -1
  22. package/es/keep-alive-tabs/index.less +2 -2
  23. package/es/keep-alive-tabs/page.d.ts +2 -2
  24. package/es/keep-alive-tabs/page.js +1 -1
  25. package/es/modal.zip +0 -0
  26. package/es/pro-table/index.d.ts +3 -3
  27. package/es/pro-table/index.js +69 -177
  28. package/es/pro-table/index.less +13 -16
  29. package/es/pro-table/search.js +7 -4
  30. package/es/pro-table/tree.d.ts +22 -0
  31. package/es/pro-table/tree.js +184 -0
  32. package/es/pro-tabs/index.d.ts +0 -1
  33. package/es/pro-tabs/index.js +10 -3
  34. package/es/table/index.js +38 -33
  35. package/es/upload/upload-image.js +14 -8
  36. package/package.json +3 -1
  37. package/es/drawer/buttons.d.ts +0 -14
  38. package/es/drawer/buttons.js +0 -103
  39. package/es/drawer/index.d.ts +0 -13
  40. package/es/drawer/index.js +0 -11
  41. package/es/drawer/index.less +0 -5
  42. package/es/drawer/open/content.d.ts +0 -20
  43. package/es/drawer/open/content.js +0 -49
  44. package/es/drawer/open/destory-fns.d.ts +0 -2
  45. package/es/drawer/open/destory-fns.js +0 -3
  46. package/es/drawer/open/form.d.ts +0 -12
  47. package/es/drawer/open/form.js +0 -34
  48. package/es/drawer/open/index.d.ts +0 -18
  49. package/es/drawer/open/index.js +0 -180
  50. package/es/modal/buttons.d.ts +0 -14
  51. package/es/modal/buttons.js +0 -100
  52. package/es/modal/index.d.ts +0 -12
  53. package/es/modal/index.js +0 -11
  54. package/es/modal/index.less +0 -26
  55. package/es/modal/open/destory-fns.d.ts +0 -2
  56. package/es/modal/open/destory-fns.js +0 -3
  57. package/es/modal/open/drag.d.ts +0 -1
  58. package/es/modal/open/drag.js +0 -107
  59. package/es/modal/open/form.d.ts +0 -12
  60. package/es/modal/open/form.js +0 -43
  61. package/es/modal/open/index.d.ts +0 -19
  62. package/es/modal/open/index.js +0 -96
  63. package/es/pro-tabs/index.less +0 -5
  64. /package/es/dialog/{dialog.js → hook.js} +0 -0
@@ -6,6 +6,7 @@ export interface ButtonItem {
6
6
  auth?: string;
7
7
  type?: ButtonProps['type'];
8
8
  disabled?: boolean;
9
+ hidden?: boolean;
9
10
  danger?: boolean;
10
11
  icon?: ReactNode;
11
12
  confirm?: string;
@@ -28,7 +29,7 @@ export interface CcsAuthGroupProps {
28
29
  }
29
30
  export interface CcsAuthProps {
30
31
  /** 权限标识 */
31
- auth: string;
32
+ auth?: string;
32
33
  /** component children */
33
34
  children: ReactElement;
34
35
  }
@@ -38,14 +39,7 @@ export declare function ModalConfirm({ modalRef }: {
38
39
  declare function CcsAuth({ auth, children }: CcsAuthProps): ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
39
40
  declare namespace CcsAuth {
40
41
  var Group: typeof AuthGroup;
41
- var Button: ({ auth, text, confirm, onClick, ...restProps }: Partial<{
42
- href: string;
43
- target?: import("react").HTMLAttributeAnchorTarget | undefined;
44
- onClick?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
45
- } & import("antd/es/button/button").BaseButtonProps & Omit<import("react").AnchorHTMLAttributes<HTMLAnchorElement | HTMLButtonElement>, "type" | "onClick"> & {
46
- htmlType?: "button" | "submit" | "reset" | undefined;
47
- onClick?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
48
- } & Omit<import("react").ButtonHTMLAttributes<HTMLButtonElement>, "type" | "onClick">> & {
42
+ var Button: ({ auth, text, confirm, onClick, ...restProps }: ButtonProps & {
49
43
  auth: string;
50
44
  text?: string | undefined;
51
45
  confirm?: string | undefined;
package/es/auth/index.js CHANGED
@@ -8,10 +8,6 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
8
8
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
9
9
  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; }
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
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
12
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
14
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
15
11
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
16
12
  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."); }
17
13
  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); }
@@ -57,23 +53,28 @@ function AuthGroup(_ref4) {
57
53
  showCount = _ref4.showCount,
58
54
  moreIcon = _ref4.moreIcon,
59
55
  moreText = _ref4.moreText,
60
- items = _ref4.items,
56
+ _ref4$items = _ref4.items,
57
+ items = _ref4$items === void 0 ? [] : _ref4$items,
61
58
  onClick = _ref4.onClick;
62
59
  var _ref5 = useCcsPage() || {},
63
60
  onAuth = _ref5.onAuth;
64
61
  var IsAuthButton = CCS.GlobalConfig.IsAuthButton;
65
62
  var modalRef = useRef(null);
66
- if (!items || items.length === 0) return null;
67
63
  var authButtons = [];
64
+
65
+ // 过滤隐藏按钮
66
+ authButtons = items.filter(function (items) {
67
+ return !items.hidden;
68
+ });
69
+
68
70
  // 需要判断权限
69
71
  if (IsAuthButton && onAuth) {
70
- authButtons = items.filter(function (b) {
72
+ authButtons = authButtons.filter(function (b) {
71
73
  if (b.auth) return onAuth(b.auth);
72
74
  return true;
73
75
  });
74
- } else {
75
- authButtons = _toConsumableArray(items);
76
76
  }
77
+ if (!items || items.length === 0) return null;
77
78
 
78
79
  // 当前菜单下查找按钮权限
79
80
  var showBtns = authButtons.splice(0, showCount || items.length);
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { CcsDialogDrawer, CcsDialogDrawerProps } from './dialog';
2
+ import { CcsDialogDrawer, CcsDialogDrawerProps } from './hook';
3
3
  export interface HookDrawerProps {
4
4
  afterClose: () => void;
5
5
  config: CcsDialogDrawerProps;
@@ -13,11 +13,11 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import { Drawer } from 'antd';
14
14
  import classNames from 'classnames';
15
15
  import { forwardRef, useImperativeHandle, useState } from 'react';
16
- import { ModalContentContext } from "./context";
16
+ import { DialogContentContext } from "./context";
17
17
  import DialogForm from "./form";
18
18
  import { jsx as _jsx } from "react/jsx-runtime";
19
19
  var HookDrawer = function HookDrawer(_ref, ref) {
20
- var _config$form;
20
+ var _config$form, _innerConfig$styles;
21
21
  var hookAfterClose = _ref.afterClose,
22
22
  config = _ref.config;
23
23
  var _useState = useState(function () {
@@ -31,19 +31,31 @@ var HookDrawer = function HookDrawer(_ref, ref) {
31
31
  _useState2 = _slicedToArray(_useState, 2),
32
32
  innerConfig = _useState2[0],
33
33
  setInnerConfig = _useState2[1];
34
- var _useState3 = useState(false),
35
- _useState4 = _slicedToArray(_useState3, 2),
36
- hasButtons = _useState4[0],
37
- setHasButtons = _useState4[1];
38
34
  var afterClose = function afterClose() {
39
35
  hookAfterClose();
40
36
  };
41
- var close = function close() {
37
+ var close = function close(e) {
42
38
  setInnerConfig(function (c) {
43
39
  return _objectSpread(_objectSpread({}, c), {}, {
44
40
  open: false
45
41
  });
46
42
  });
43
+ if ((e === null || e === void 0 ? void 0 : e.type) === 'click') {
44
+ // 通过点击关闭按钮或取消按钮关闭
45
+ if (innerConfig.afterCloseByCancel) {
46
+ innerConfig.afterCloseByCancel(e);
47
+ }
48
+ } else {
49
+ // 通过调用closeDialog关闭
50
+ if (innerConfig.afterCloseByOk) {
51
+ innerConfig.afterCloseByOk(e);
52
+ }
53
+ }
54
+
55
+ // 入参有onClose
56
+ if (innerConfig.onClose) {
57
+ innerConfig.onClose(e);
58
+ }
47
59
  };
48
60
  useImperativeHandle(ref, function () {
49
61
  return {
@@ -63,21 +75,23 @@ var HookDrawer = function HookDrawer(_ref, ref) {
63
75
  return undefined;
64
76
  };
65
77
  var isCrInProp = ('getContainer' in innerConfig);
78
+ var styles = innerConfig.styles || {};
79
+ if (config.form) {
80
+ styles.body = {
81
+ padding: 0
82
+ };
83
+ }
66
84
  return /*#__PURE__*/_jsx(Drawer, _objectSpread(_objectSpread({
67
- onClose: close,
68
85
  afterOpenChange: function afterOpenChange(open) {
69
86
  if (!open) afterClose();
70
87
  }
71
88
  }, innerConfig), {}, {
89
+ onClose: close,
72
90
  className: classNames('ccs-dialog-drawer', innerConfig.className),
73
91
  maskStyle: _objectSpread({
74
92
  background: 'rgba(0, 0, 0, 0.1)'
75
93
  }, innerConfig.maskStyle),
76
- bodyStyle: _objectSpread(_objectSpread({}, hasButtons ? {
77
- marginBottom: 80
78
- } : {}), config.form ? {
79
- padding: 0
80
- } : innerConfig.bodyStyle),
94
+ styles: styles,
81
95
  rootStyle: _objectSpread(_objectSpread({}, !isCrInProp ? {
82
96
  position: 'absolute'
83
97
  } : {}), innerConfig.rootStyle),
@@ -85,19 +99,17 @@ var HookDrawer = function HookDrawer(_ref, ref) {
85
99
  boxShadow: 'none'
86
100
  } : {}), innerConfig.contentWrapperStyle),
87
101
  getContainer: isCrInProp ? innerConfig.getContainer : onGetContainer,
88
- children: /*#__PURE__*/_jsx(ModalContentContext.Provider, {
102
+ extra: null,
103
+ children: /*#__PURE__*/_jsx(DialogContentContext.Provider, {
89
104
  value: {
90
105
  closeDialog: close,
91
- onHasButtons: function onHasButtons() {
92
- return setHasButtons(true);
93
- },
94
106
  formInitialValues: ((_config$form = config.form) === null || _config$form === void 0 ? void 0 : _config$form.initialValues) || {}
95
107
  },
96
108
  children: config.form ? /*#__PURE__*/_jsx(DialogForm, {
97
109
  formProps: config.form,
98
- bodyStyle: _objectSpread({
110
+ styles: _objectSpread({
99
111
  padding: 24
100
- }, innerConfig.bodyStyle),
112
+ }, (_innerConfig$styles = innerConfig.styles) === null || _innerConfig$styles === void 0 ? void 0 : _innerConfig$styles.body),
101
113
  children: config.content
102
114
  }) : config.content
103
115
  })
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { CcsDialogModal, CcsDialogModalProps } from './dialog';
2
+ import { CcsDialogModal, CcsDialogModalProps } from './hook';
3
3
  export interface HookModalProps {
4
4
  afterClose: () => void;
5
5
  config: CcsDialogModalProps;
@@ -1,8 +1,4 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
2
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7
3
  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."); }
8
4
  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); }
@@ -18,7 +14,7 @@ import { Modal } from 'antd';
18
14
  import classNames from 'classnames';
19
15
  import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
20
16
  import Draggable from 'react-draggable';
21
- import { ModalContentContext } from "./context";
17
+ import { DialogContentContext } from "./context";
22
18
  import DialogForm from "./form";
23
19
  import { jsx as _jsx } from "react/jsx-runtime";
24
20
  var DragModal = function DragModal(_ref) {
@@ -94,20 +90,27 @@ var HookModal = function HookModal(_ref2, ref) {
94
90
  if (config.destroyOnClose !== false) hookAfterClose();
95
91
  (_innerConfig$afterClo = innerConfig.afterClose) === null || _innerConfig$afterClo === void 0 ? void 0 : _innerConfig$afterClo.call(innerConfig);
96
92
  };
97
- var close = function close() {
93
+ var close = function close(e) {
98
94
  setInnerConfig(function (c) {
99
95
  return _objectSpread(_objectSpread({}, c), {}, {
100
96
  open: false
101
97
  });
102
98
  });
103
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
104
- args[_key] = arguments[_key];
99
+ if ((e === null || e === void 0 ? void 0 : e.type) === 'click') {
100
+ // 通过点击关闭按钮或取消按钮关闭
101
+ if (innerConfig.afterCloseByCancel) {
102
+ innerConfig.afterCloseByCancel(e);
103
+ }
104
+ } else {
105
+ // 通过调用closeDialog关闭
106
+ if (innerConfig.afterCloseByOk) {
107
+ innerConfig.afterCloseByOk(e);
108
+ }
105
109
  }
106
- var triggerCancel = args.some(function (param) {
107
- return param && param.triggerCancel;
108
- });
109
- if (innerConfig.onCancel && triggerCancel) {
110
- innerConfig.onCancel.apply(innerConfig, [function () {}].concat(_toConsumableArray(args.slice(1))));
110
+
111
+ // 入参有onClose
112
+ if (innerConfig.onCancel) {
113
+ innerConfig.onCancel(e);
111
114
  }
112
115
  };
113
116
  useImperativeHandle(ref, function () {
@@ -120,15 +123,17 @@ var HookModal = function HookModal(_ref2, ref) {
120
123
  }
121
124
  };
122
125
  });
126
+ var styles = innerConfig.styles || {};
127
+ styles.body = _objectSpread(_objectSpread({
128
+ position: 'relative'
129
+ }, styles.body), hasButtons ? {
130
+ paddingBottom: 44
131
+ } : {});
123
132
  return /*#__PURE__*/_jsx(Modal, _objectSpread(_objectSpread({
124
133
  onCancel: close,
125
134
  afterClose: afterClose
126
135
  }, innerConfig), {}, {
127
- bodyStyle: _objectSpread(_objectSpread({
128
- position: 'relative'
129
- }, innerConfig.bodyStyle), hasButtons ? {
130
- paddingBottom: 44
131
- } : {}),
136
+ styles: styles,
132
137
  className: classNames('ccs-dialog-modal', innerConfig.className),
133
138
  footer: null,
134
139
  title: config.isDrag ? /*#__PURE__*/_jsx("div", {
@@ -161,10 +166,10 @@ var HookModal = function HookModal(_ref2, ref) {
161
166
  onDragState: setDragState
162
167
  });
163
168
  } : undefined,
164
- children: /*#__PURE__*/_jsx(ModalContentContext.Provider, {
169
+ children: /*#__PURE__*/_jsx(DialogContentContext.Provider, {
165
170
  value: {
166
171
  closeDialog: close,
167
- onHasButtons: function onHasButtons() {
172
+ onHasModalButtons: function onHasModalButtons() {
168
173
  return setHasButtons(true);
169
174
  },
170
175
  formInitialValues: ((_config$form = config.form) === null || _config$form === void 0 ? void 0 : _config$form.initialValues) || {}
@@ -5,7 +5,8 @@ interface DialogButtonsProps {
5
5
  okAuth?: string;
6
6
  loading?: boolean;
7
7
  children?: ReactNode;
8
+ hideCancel?: boolean;
8
9
  onOk?: (values?: any) => void;
9
10
  }
10
- export default function CcsDialogButtons({ okText, okAuth, loading, children, cancelText, onOk, }: DialogButtonsProps): import("react/jsx-runtime").JSX.Element | null;
11
+ export default function CcsDialogButtons({ okText, okAuth, loading, children, hideCancel, cancelText, onOk, }: DialogButtonsProps): import("react/jsx-runtime").JSX.Element | null;
11
12
  export {};
@@ -9,22 +9,23 @@ import { Button, Form } from 'antd';
9
9
  import { useEffect } from 'react';
10
10
  import CcsDialog from '.';
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
- import { jsxs as _jsxs } from "react/jsx-runtime";
13
12
  import { Fragment as _Fragment } from "react/jsx-runtime";
13
+ import { jsxs as _jsxs } from "react/jsx-runtime";
14
14
  export default function CcsDialogButtons(_ref) {
15
15
  var okText = _ref.okText,
16
16
  okAuth = _ref.okAuth,
17
17
  loading = _ref.loading,
18
18
  children = _ref.children,
19
+ hideCancel = _ref.hideCancel,
19
20
  cancelText = _ref.cancelText,
20
21
  onOk = _ref.onOk;
21
- var _CcsDialog$useContext = CcsDialog.useContext(),
22
- closeDialog = _CcsDialog$useContext.closeDialog,
23
- onHasButtons = _CcsDialog$useContext.onHasButtons,
24
- formInitialValues = _CcsDialog$useContext.formInitialValues;
22
+ var _CcsDialog$useInstanc = CcsDialog.useInstance(),
23
+ closeDialog = _CcsDialog$useInstanc.closeDialog,
24
+ onHasModalButtons = _CcsDialog$useInstanc.onHasModalButtons,
25
+ formInitialValues = _CcsDialog$useInstanc.formInitialValues;
25
26
  var form = Form.useFormInstance();
26
27
  useEffect(function () {
27
- onHasButtons();
28
+ if (onHasModalButtons) onHasModalButtons();
28
29
  }, []);
29
30
  var onOkClick = function onOkClick() {
30
31
  if (!onOk) return;
@@ -38,19 +39,21 @@ export default function CcsDialogButtons(_ref) {
38
39
  }
39
40
  onOk();
40
41
  };
41
- return onOk ? /*#__PURE__*/_jsx(_Fragment, {
42
+ return onOk || children ? /*#__PURE__*/_jsx(_Fragment, {
42
43
  children: /*#__PURE__*/_jsxs("div", {
43
44
  className: "ccs-dialog-buttons",
44
- children: [/*#__PURE__*/_jsx(Button, {
45
- onClick: closeDialog,
46
- children: cancelText || '取消'
47
- }), /*#__PURE__*/_jsx(CcsAuth.Button, {
48
- auth: okAuth || '',
49
- type: "primary",
50
- loading: loading,
51
- onClick: onOkClick,
52
- children: okText || '确定'
53
- }), children]
45
+ children: [children, onOk && /*#__PURE__*/_jsxs(_Fragment, {
46
+ children: [!hideCancel && /*#__PURE__*/_jsx(Button, {
47
+ onClick: closeDialog,
48
+ children: cancelText || '取消'
49
+ }), /*#__PURE__*/_jsx(CcsAuth.Button, {
50
+ auth: okAuth || '',
51
+ type: "primary",
52
+ loading: loading,
53
+ onClick: onOkClick,
54
+ children: okText || '确定'
55
+ })]
56
+ })]
54
57
  })
55
58
  }) : null;
56
59
  }
@@ -1,11 +1,12 @@
1
1
  import { Store } from 'antd/es/form/interface';
2
2
  import React from 'react';
3
- interface ContentContextType<T = Store> {
4
- locationKey: string;
3
+ export interface DialogContextType<T = Store> {
4
+ /** 表单初始值 */
5
5
  formInitialValues: T;
6
- closeDialog: () => void;
7
- onHasButtons: () => void;
6
+ /** 关闭弹框,可以设置返回值 */
7
+ closeDialog: (e?: any) => void;
8
+ onHasModalButtons?: () => void;
8
9
  }
9
- declare const ModalContentContext: React.Context<ContentContextType<any>>;
10
- declare const useDialogContext: <T = Store>() => ContentContextType<T>;
11
- export { useDialogContext, ModalContentContext };
10
+ declare const DialogContentContext: React.Context<DialogContextType<any>>;
11
+ declare const useDialogContext: <T = Store>() => DialogContextType<T>;
12
+ export { useDialogContext, DialogContentContext };
@@ -1,10 +1,10 @@
1
1
  import React, { useContext } from 'react';
2
- var ModalContentContext = /*#__PURE__*/React.createContext({});
2
+ var DialogContentContext = /*#__PURE__*/React.createContext({});
3
3
  var useDialogContext = function useDialogContext() {
4
- var context = useContext(ModalContentContext);
4
+ var context = useContext(DialogContentContext);
5
5
  if (context === undefined) {
6
- throw new Error('ModalContentContext not found');
6
+ throw new Error('DialogContentContext not found');
7
7
  }
8
8
  return context;
9
9
  };
10
- export { useDialogContext, ModalContentContext };
10
+ export { useDialogContext, DialogContentContext };
@@ -3,11 +3,11 @@ import { CSSProperties, ReactNode } from 'react';
3
3
  interface PropsType {
4
4
  children: ReactNode;
5
5
  formProps: FormProps;
6
- bodyStyle?: CSSProperties;
6
+ styles?: CSSProperties;
7
7
  }
8
8
  /**
9
9
  * 添加form实例
10
10
  * @returns
11
11
  */
12
- export default function DialogForm({ children, bodyStyle, formProps: { labelCol, wrapperCol, ...restProps }, }: PropsType): import("react/jsx-runtime").JSX.Element;
12
+ export default function DialogForm({ children, styles, formProps: { labelCol, wrapperCol, ...restProps }, }: PropsType): import("react/jsx-runtime").JSX.Element;
13
13
  export {};
package/es/dialog/form.js CHANGED
@@ -21,7 +21,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
21
21
  */
22
22
  export default function DialogForm(_ref) {
23
23
  var children = _ref.children,
24
- bodyStyle = _ref.bodyStyle,
24
+ styles = _ref.styles,
25
25
  _ref$formProps = _ref.formProps,
26
26
  labelCol = _ref$formProps.labelCol,
27
27
  wrapperCol = _ref$formProps.wrapperCol,
@@ -36,12 +36,13 @@ export default function DialogForm(_ref) {
36
36
  },
37
37
  wrapperCol: wrapperCol || {
38
38
  span: 14
39
- }
39
+ },
40
+ preserve: false
40
41
  }, restProps), {}, {
41
42
  style: _objectSpread(_objectSpread({
42
43
  height: '100%',
43
44
  overflow: 'auto'
44
- }, bodyStyle), restProps.style),
45
+ }, styles), restProps.style),
45
46
  children: children
46
47
  }));
47
48
  }
@@ -23,12 +23,20 @@ export type CcsDialogModalProps = ModalFuncProps & {
23
23
  form?: FormProps;
24
24
  /** 关闭后销毁组件,默认true */
25
25
  destroyOnClose?: boolean;
26
+ /** 通过closeDialog方法关闭dialog */
27
+ afterCloseByOk?: (e: any) => void;
28
+ /** 通过点击关闭按钮或取消按钮关闭 */
29
+ afterCloseByCancel?: (e: any) => void;
26
30
  };
27
- export type CcsDialogDrawerProps = DrawerProps & {
31
+ export type CcsDialogDrawerProps = Omit<DrawerProps, 'extra'> & {
28
32
  /** antd form */
29
33
  form?: FormProps;
30
34
  /** 抽屉内容 */
31
35
  content?: ReactNode;
36
+ /** 通过closeDialog方法关闭dialog */
37
+ afterCloseByOk?: (e: any) => void;
38
+ /** 通过点击关闭按钮或取消按钮关闭 */
39
+ afterCloseByCancel?: (e: any) => void;
32
40
  };
33
41
  export type ModalDialog = (...args: Parameters<ModalFunc>) => ReturnType<ModalFunc>;
34
42
  export type DrawerDialog = (...args: Parameters<ModalFunc>) => ReturnType<DrawerFunc>;
@@ -1,11 +1,11 @@
1
1
  import CcsDialogButtons from './button';
2
2
  import { useDialogContext } from './context';
3
- import useCcsDialog from './dialog';
3
+ import useCcsDialog from './hook';
4
4
  import './index.less';
5
- interface ModalInterface {
5
+ interface DialogInterface {
6
6
  Buttons: typeof CcsDialogButtons;
7
7
  useDialog: typeof useCcsDialog;
8
- useContext: typeof useDialogContext;
8
+ useInstance: typeof useDialogContext;
9
9
  }
10
- declare const CcsDialog: ModalInterface;
10
+ declare const CcsDialog: DialogInterface;
11
11
  export default CcsDialog;
@@ -1,9 +1,9 @@
1
1
  import CcsDialogButtons from "./button";
2
2
  import { useDialogContext } from "./context";
3
- import useCcsDialog from "./dialog";
3
+ import useCcsDialog from "./hook";
4
4
  import "./index.less";
5
5
  var CcsDialog = {};
6
6
  CcsDialog.Buttons = CcsDialogButtons;
7
7
  CcsDialog.useDialog = useCcsDialog;
8
- CcsDialog.useContext = useDialogContext;
8
+ CcsDialog.useInstance = useDialogContext;
9
9
  export default CcsDialog;
@@ -1,28 +1,25 @@
1
- .ccs-dialog {
2
- &-buttons {
3
- position: absolute;
4
- bottom: 0;
5
- right: 0;
6
- z-index: 1;
1
+ .ccs-dialog-buttons {
2
+ position: absolute;
3
+ bottom: 0;
4
+ right: 0;
5
+ z-index: 1;
7
6
 
8
- .ant-btn + .ant-btn:not(.ant-dropdown-trigger) {
9
- margin-bottom: 0;
10
- margin-left: 8px;
11
- }
7
+ .ant-btn + .ant-btn:not(.ant-dropdown-trigger) {
8
+ margin-bottom: 0;
9
+ margin-left: 8px;
12
10
  }
13
11
  }
14
12
 
15
13
  .ccs-dialog-drawer {
16
14
  .ccs-dialog-buttons {
17
- height: 80px;
18
- line-height: 79px;
19
- background-color: #fff;
20
- border-top: 1px solid rgba(5, 5, 5, 6%);
21
- width: 100%;
22
- text-align: center;
15
+ right: 16px;
16
+ top: 0;
17
+ bottom: auto;
18
+ height: 57px;
19
+ line-height: 56px;
23
20
  }
24
21
 
25
22
  .ant-drawer-header {
26
- padding: 10px;
23
+ padding: 16px;
27
24
  }
28
25
  }
package/es/drawer.zip ADDED
Binary file
package/es/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { MenuProps } from 'antd';
2
- import { ConfigProviderProps } from 'antd/lib/config-provider';
2
+ type ReactText = 'string' | 'number';
3
3
  interface MenuTreeNodeData {
4
4
  buttonUrlId: number;
5
5
  createTime: string;
@@ -40,8 +40,8 @@ interface CcsUserDetailType {
40
40
  export interface CcsGlobalConfigType {
41
41
  /** app名称 */
42
42
  AppName: string;
43
- /** 主题色 */
44
- BrandPrimary: string;
43
+ /** 主题 */
44
+ AppTheme: 'default' | 'dark';
45
45
  /** 菜单展开宽度 */
46
46
  MenuExpandWidth: number;
47
47
  /** 菜单收起宽度 */
@@ -50,8 +50,6 @@ export interface CcsGlobalConfigType {
50
50
  IsTabsPage: boolean;
51
51
  /** 启用按钮权限 */
52
52
  IsAuthButton: boolean;
53
- /** ant 主题 */
54
- theme: ConfigProviderProps['theme'];
55
53
  /** 菜单类型,现在支持垂直、水平、和内嵌模式三种 */
56
54
  MenuExpandMode: MenuProps['mode'];
57
55
  /** 菜单始终收起状态? */
@@ -135,7 +133,6 @@ export { default as CcsColorPicker } from './color-picker';
135
133
  export { default as CcsConfigProvider } from './config';
136
134
  export { default as CcsDatePicker } from './date-picker';
137
135
  export { default as CcsDialog } from './dialog';
138
- export { default as CcsDrawer } from './drawer';
139
136
  export { default as CcsFullScreenButton } from './full-screen';
140
137
  export { default as useCcsGlobal } from './hooks/use-global';
141
138
  export { default as useCcsOnceEvent } from './hooks/use-once-event';
@@ -145,7 +142,6 @@ export { default as useCcsWindow } from './hooks/use-window';
145
142
  export { default as CcsIntervalButton } from './interval-button';
146
143
  export { default as CcsKeepAliveTabs } from './keep-alive-tabs';
147
144
  export { default as CcsLoading } from './loading';
148
- export { default as CcsModal } from './modal';
149
145
  export { default as CcsProGrid } from './pro-grid';
150
146
  export { default as CcsProTable } from './pro-table';
151
147
  export { default as CcsProTabs } from './pro-tabs';
@@ -158,4 +154,4 @@ export { default as CcsUpload } from './upload';
158
154
  export { default as CcsUtils } from './utils';
159
155
  export { default as CcsVirtualList } from './virtual-list';
160
156
  export { default as CcsWaterMark } from './water-mark';
161
- export type { PageType, HttpResult, RecordType, MenuTreeNode, PageQueryType, TableDataType, ListQueryType, HttpListResult, HttpPageResult, MenuTreeNodeData, CcsUserDetailType, RouteHistoryType, };
157
+ export type { PageType, ReactText, HttpResult, RecordType, MenuTreeNode, PageQueryType, TableDataType, ListQueryType, HttpListResult, HttpPageResult, MenuTreeNodeData, CcsUserDetailType, RouteHistoryType, };
package/es/index.js CHANGED
@@ -7,7 +7,6 @@ export { default as CcsColorPicker } from "./color-picker";
7
7
  export { default as CcsConfigProvider } from "./config";
8
8
  export { default as CcsDatePicker } from "./date-picker";
9
9
  export { default as CcsDialog } from "./dialog";
10
- export { default as CcsDrawer } from "./drawer";
11
10
  export { default as CcsFullScreenButton } from "./full-screen";
12
11
  export { default as useCcsGlobal } from "./hooks/use-global";
13
12
  export { default as useCcsOnceEvent } from "./hooks/use-once-event";
@@ -17,7 +16,6 @@ export { default as useCcsWindow } from "./hooks/use-window";
17
16
  export { default as CcsIntervalButton } from "./interval-button";
18
17
  export { default as CcsKeepAliveTabs } from "./keep-alive-tabs";
19
18
  export { default as CcsLoading } from "./loading";
20
- export { default as CcsModal } from "./modal";
21
19
  export { default as CcsProGrid } from "./pro-grid";
22
20
  export { default as CcsProTable } from "./pro-table";
23
21
  export { default as CcsProTabs } from "./pro-tabs";
@@ -1,4 +1,4 @@
1
- import { MenuTreeNode } from '../types';
1
+ import { MenuTreeNode } from '../';
2
2
  import './index.less';
3
3
  interface PropsType {
4
4
  maxLen?: number;
@@ -14,7 +14,7 @@ import { Button, Dropdown, Empty, Tabs } from 'antd';
14
14
  import classnames from 'classnames';
15
15
  import _debounce from 'lodash/debounce';
16
16
  import ResizeObserver from 'rc-resize-observer';
17
- import React, { useEffect, useMemo, useRef } from 'react';
17
+ import { useEffect, useMemo, useRef } from 'react';
18
18
  import { useLocation } from 'react-router';
19
19
  import { useOutlet } from 'react-router-dom';
20
20
  import { CCS, CcsUtils } from "../";
@@ -1,11 +1,11 @@
1
1
  .ccs-keep-alive {
2
2
  flex: 1 1 auto;
3
- background: #f0f2f5;
3
+ // background: #f0f2f5;
4
4
  display: flex;
5
5
  flex-direction: column;
6
6
 
7
7
  &-tabs {
8
- background: rgb(240 242 245);
8
+ // background: rgb(240 242 245);
9
9
 
10
10
  & > .ant-tabs-nav {
11
11
  margin: 0;