@ccs-ui/rc-pro 1.1.25-beta-26 → 1.2.0-beta-1

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/ccs.d.ts CHANGED
@@ -83,6 +83,8 @@ type PageQuery<T = any> = {
83
83
  limit?: QueryLimit;
84
84
  /** 排序字段,一般前端不传,由后端指定 */
85
85
  orderProps?: OrderProp[];
86
+ /** 过滤字段 */
87
+ filters?: Record<string, any[]>;
86
88
  /** 页码 */
87
89
  pageNo?: number;
88
90
  /** 页长 */
@@ -1,7 +1,7 @@
1
1
  import { TabPaneProps } from 'antd';
2
2
  import { Store } from 'antd/es/form/interface';
3
- import { Location } from 'history';
4
3
  import React from 'react';
4
+ import { Location } from 'react-router';
5
5
  import CCS from '..';
6
6
  type CcsTabsChangeProps = {
7
7
  /** 当前激活tab面板的key */
@@ -55,5 +55,5 @@ declare const GlobalContext: React.Context<GlobalContextType>;
55
55
  declare const DrawerAndModalContext: React.Context<FnContextType<any>>;
56
56
  declare const PageContext: React.Context<PageContextType>;
57
57
  declare const TabsContext: React.Context<CcsTabsContextType>;
58
- export type { FnContextType, CcsTabsContextType, CcsTabsChangeProps, GlobalContextPropsType, };
59
- export { TabsContext, PageContext, GlobalContext, DrawerAndModalContext };
58
+ export { DrawerAndModalContext, GlobalContext, PageContext, TabsContext };
59
+ export type { CcsTabsChangeProps, CcsTabsContextType, FnContextType, GlobalContextPropsType, };
@@ -3,4 +3,4 @@ var GlobalContext = /*#__PURE__*/createContext({});
3
3
  var DrawerAndModalContext = /*#__PURE__*/createContext({});
4
4
  var PageContext = /*#__PURE__*/createContext({});
5
5
  var TabsContext = /*#__PURE__*/React.createContext({});
6
- export { TabsContext, PageContext, GlobalContext, DrawerAndModalContext };
6
+ export { DrawerAndModalContext, GlobalContext, PageContext, TabsContext };
@@ -17,7 +17,7 @@ function CcsDatePicker(_ref) {
17
17
  onChange = _ref.onChange,
18
18
  restProps = _objectWithoutProperties(_ref, _excluded);
19
19
  var handleOnChange = function handleOnChange(_, dateString) {
20
- if (onChange) onChange(dateString);
20
+ if (onChange) onChange(dateString || undefined);
21
21
  };
22
22
  var dateValue = typeof value === 'string' ? dayjs(value) : value;
23
23
  return /*#__PURE__*/_jsx(DatePicker, _objectSpread({
@@ -38,7 +38,7 @@ function RangePicker(_ref2) {
38
38
  return null;
39
39
  };
40
40
  var handleOnChange = function handleOnChange(_, dateString) {
41
- if (onChange) onChange(dateString);
41
+ if (onChange) onChange(dateString || undefined);
42
42
  };
43
43
  return /*#__PURE__*/_jsx(DatePicker.RangePicker, _objectSpread({
44
44
  value: getDateValue(),
@@ -1,7 +1,7 @@
1
1
  import { FormProps } from 'antd';
2
2
  import { DialogFormRef } from './form';
3
3
  import { CcsDialogModalProps } from './hook';
4
- declare const DialogRequestButton: ({ auth, formRef, formInitialValues, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "auth" | "request" | "onRequestBefore" | "onCancel"> & {
4
+ declare const DialogRequestButton: ({ auth, formRef, extraBtn, formInitialValues, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "auth" | "request" | "onCancel" | "extraBtn" | "onRequestBefore"> & {
5
5
  formRef: React.RefObject<DialogFormRef>;
6
6
  formInitialValues: FormProps['initialValues'];
7
7
  }) => import("react/jsx-runtime").JSX.Element;
@@ -19,6 +19,7 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
19
19
  var DialogRequestButton = function DialogRequestButton(_ref) {
20
20
  var auth = _ref.auth,
21
21
  formRef = _ref.formRef,
22
+ extraBtn = _ref.extraBtn,
22
23
  _ref$formInitialValue = _ref.formInitialValues,
23
24
  formInitialValues = _ref$formInitialValue === void 0 ? {} : _ref$formInitialValue,
24
25
  request = _ref.request,
@@ -50,7 +51,7 @@ var DialogRequestButton = function DialogRequestButton(_ref) {
50
51
  });
51
52
  };
52
53
  return /*#__PURE__*/_jsxs(_Fragment, {
53
- children: [/*#__PURE__*/_jsx(Button, {
54
+ children: [extraBtn, /*#__PURE__*/_jsx(Button, {
54
55
  onClick: onCancel,
55
56
  children: "\u53D6\u6D88"
56
57
  }), /*#__PURE__*/_jsx(CcsAuth.Button, {
@@ -1,7 +1,7 @@
1
1
  import { FormProps } from 'antd';
2
2
  import { DialogFormRef } from './form';
3
3
  import { CcsDialogModalProps } from './hook';
4
- declare const DialogSelfOkButton: ({ auth, formRef, formInitialValues, onCancel, onOk, }: Pick<CcsDialogModalProps, "auth" | "onOk" | "onCancel"> & {
4
+ declare const DialogSelfOkButton: ({ auth, formRef, extraBtn, formInitialValues, onCancel, onOk, }: Pick<CcsDialogModalProps, "auth" | "onOk" | "onCancel" | "extraBtn"> & {
5
5
  formRef: React.RefObject<DialogFormRef>;
6
6
  formInitialValues: FormProps['initialValues'];
7
7
  }) => import("react/jsx-runtime").JSX.Element;
@@ -12,6 +12,7 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
12
12
  var DialogSelfOkButton = function DialogSelfOkButton(_ref) {
13
13
  var auth = _ref.auth,
14
14
  formRef = _ref.formRef,
15
+ extraBtn = _ref.extraBtn,
15
16
  _ref$formInitialValue = _ref.formInitialValues,
16
17
  formInitialValues = _ref$formInitialValue === void 0 ? {} : _ref$formInitialValue,
17
18
  onCancel = _ref.onCancel,
@@ -29,7 +30,7 @@ var DialogSelfOkButton = function DialogSelfOkButton(_ref) {
29
30
  });
30
31
  };
31
32
  return /*#__PURE__*/_jsxs(_Fragment, {
32
- children: [/*#__PURE__*/_jsx(Button, {
33
+ children: [extraBtn, /*#__PURE__*/_jsx(Button, {
33
34
  onClick: onCancel,
34
35
  children: "\u53D6\u6D88"
35
36
  }), /*#__PURE__*/_jsx(CcsAuth.Button, {
@@ -19,9 +19,9 @@ import DialogRequestButton from "./DialogRequestButton";
19
19
  import DialogForm from "./form";
20
20
  import { jsx as _jsx } from "react/jsx-runtime";
21
21
  var HookDrawer = function HookDrawer(_ref, ref) {
22
- var _innerConfig$styles;
23
22
  var hookAfterClose = _ref.afterClose,
24
23
  config = _ref.config;
24
+ console.log('config', config);
25
25
  var _useState = useState(function () {
26
26
  if (config.open === undefined) {
27
27
  return _objectSpread(_objectSpread({}, config), {}, {
@@ -92,32 +92,25 @@ var HookDrawer = function HookDrawer(_ref, ref) {
92
92
  };
93
93
  var isCrInProp = ('getContainer' in innerConfig);
94
94
  var styles = innerConfig.styles || {};
95
- if (form) {
96
- styles.body = {
97
- padding: 0
98
- };
99
- }
100
95
  styles.mask = _objectSpread({
101
96
  background: 'rgba(0, 0, 0, 0.1)'
102
97
  }, styles.mask);
103
98
  var renderExtra = function renderExtra() {
104
99
  if (request) {
105
- return /*#__PURE__*/_jsx("div", {
106
- className: "ccs-dialog-footer",
107
- children: /*#__PURE__*/_jsx(DialogRequestButton, {
108
- auth: auth,
109
- request: request,
110
- onCancel: close,
111
- formRef: formRef,
112
- onRequestBefore: onRequestBefore,
113
- formInitialValues: form === null || form === void 0 ? void 0 : form.initialValues
114
- })
100
+ return /*#__PURE__*/_jsx(DialogRequestButton, {
101
+ auth: auth,
102
+ request: request,
103
+ onCancel: close,
104
+ formRef: formRef,
105
+ onRequestBefore: onRequestBefore,
106
+ formInitialValues: form === null || form === void 0 ? void 0 : form.initialValues
115
107
  });
116
108
  }
117
109
  return /*#__PURE__*/_jsx(DialogButtonHolder, {
118
110
  ref: buttonRef
119
111
  });
120
112
  };
113
+ console.log('innerConfig.styles?.body', innerConfig.styles);
121
114
  return /*#__PURE__*/_jsx(Drawer, _objectSpread(_objectSpread({
122
115
  afterOpenChange: function afterOpenChange(open) {
123
116
  if (!open) afterClose();
@@ -146,9 +139,6 @@ var HookDrawer = function HookDrawer(_ref, ref) {
146
139
  children: form ? /*#__PURE__*/_jsx(DialogForm, {
147
140
  ref: formRef,
148
141
  formProps: form,
149
- styles: _objectSpread({
150
- padding: 24
151
- }, (_innerConfig$styles = innerConfig.styles) === null || _innerConfig$styles === void 0 ? void 0 : _innerConfig$styles.body),
152
142
  children: content
153
143
  }) : content
154
144
  })
@@ -96,6 +96,7 @@ var HookModal = function HookModal(_ref2, ref) {
96
96
  _innerConfig$styles = innerConfig.styles,
97
97
  styles = _innerConfig$styles === void 0 ? {} : _innerConfig$styles,
98
98
  className = innerConfig.className,
99
+ extraBtn = innerConfig.extraBtn,
99
100
  request = innerConfig.request,
100
101
  onCancel = innerConfig.onCancel,
101
102
  onRequestBefore = innerConfig.onRequestBefore,
@@ -135,32 +136,34 @@ var HookModal = function HookModal(_ref2, ref) {
135
136
  };
136
137
  });
137
138
  var renderFooter = function renderFooter() {
139
+ // 传入接口请求参数
138
140
  if (request) {
139
- return /*#__PURE__*/_jsx("div", {
140
- className: "ccs-dialog-footer",
141
- children: /*#__PURE__*/_jsx(DialogRequestButton, {
142
- auth: auth,
143
- request: request,
144
- onCancel: close,
145
- formRef: formRef,
146
- onRequestBefore: onRequestBefore,
147
- formInitialValues: form === null || form === void 0 ? void 0 : form.initialValues
148
- })
141
+ return /*#__PURE__*/_jsx(DialogRequestButton, {
142
+ auth: auth,
143
+ request: request,
144
+ onCancel: close,
145
+ formRef: formRef,
146
+ extraBtn: extraBtn,
147
+ onRequestBefore: onRequestBefore,
148
+ formInitialValues: form === null || form === void 0 ? void 0 : form.initialValues
149
149
  });
150
150
  }
151
+
152
+ // 传入onOk参数
151
153
  if (innerConfig.onOk) {
152
- return /*#__PURE__*/_jsx("div", {
153
- className: "ccs-dialog-footer",
154
- children: /*#__PURE__*/_jsx(DialogSelfOkButton, {
155
- auth: auth,
156
- onOk: innerConfig.onOk,
157
- onCancel: close,
158
- formRef: formRef,
159
- formInitialValues: form === null || form === void 0 ? void 0 : form.initialValues
160
- })
154
+ return /*#__PURE__*/_jsx(DialogSelfOkButton, {
155
+ auth: auth,
156
+ onCancel: close,
157
+ formRef: formRef,
158
+ extraBtn: extraBtn,
159
+ onOk: innerConfig.onOk,
160
+ formInitialValues: form === null || form === void 0 ? void 0 : form.initialValues
161
161
  });
162
162
  }
163
+
164
+ // 对话框中使用buttons生成按钮
163
165
  return /*#__PURE__*/_jsx(DialogButtonHolder, {
166
+ extraBtn: extraBtn,
164
167
  ref: buttonRef
165
168
  });
166
169
  };
@@ -168,11 +171,7 @@ var HookModal = function HookModal(_ref2, ref) {
168
171
  onCancel: close,
169
172
  afterClose: afterClose
170
173
  }, innerConfig), {}, {
171
- styles: _objectSpread({
172
- footer: !request ? {
173
- padding: 0
174
- } : undefined
175
- }, styles),
174
+ styles: styles,
176
175
  className: classNames('ccs-dialog-modal', className),
177
176
  footer: renderFooter(),
178
177
  title: /*#__PURE__*/_jsx("div", {
@@ -1,15 +1,13 @@
1
1
  import React, { ReactNode } from 'react';
2
- export type DialogButtonsProps = {
3
- okText?: string;
4
- cancelText?: string;
2
+ import { CcsDialogModalProps } from './hook';
3
+ export type DialogButtonsProps = Pick<CcsDialogModalProps, 'okText' | 'cancelText' | 'onOk'> & {
5
4
  okAuth?: string;
6
5
  loading?: boolean;
7
6
  children?: ReactNode;
8
7
  hideCancel?: boolean;
9
- onOk?: (values?: any) => void;
10
8
  };
11
9
  export type DialogButtonRef = {
12
10
  onSetButtons: (e: React.ReactElement) => void;
13
11
  };
14
- export declare const DialogButtonHolder: React.MemoExoticComponent<React.ForwardRefExoticComponent<React.RefAttributes<DialogButtonRef>>>;
12
+ export declare const DialogButtonHolder: React.MemoExoticComponent<React.ForwardRefExoticComponent<Pick<CcsDialogModalProps, "extraBtn"> & React.RefAttributes<DialogButtonRef>>>;
15
13
  export default function CcsDialogButtons({ okText, okAuth, loading, children, hideCancel, cancelText, onOk, }: DialogButtonsProps): import("react/jsx-runtime").JSX.Element;
@@ -12,16 +12,18 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import { CcsAuth, CcsUtils } from "./..";
14
14
  import { Button, Form } from 'antd';
15
- import React, { useEffect, useImperativeHandle, useState } from 'react';
15
+ import React, { useEffect, useImperativeHandle, useRef, useState } from 'react';
16
16
  import CcsDialog from '.';
17
- import { Fragment as _Fragment } from "react/jsx-runtime";
18
17
  import { jsx as _jsx } from "react/jsx-runtime";
18
+ import { Fragment as _Fragment } from "react/jsx-runtime";
19
19
  import { jsxs as _jsxs } from "react/jsx-runtime";
20
- export var DialogButtonHolder = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (_props, ref) {
20
+ export var DialogButtonHolder = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (_ref, ref) {
21
+ var extraBtn = _ref.extraBtn;
21
22
  var _useState = useState(),
22
23
  _useState2 = _slicedToArray(_useState, 2),
23
24
  buttons = _useState2[0],
24
25
  setButtons = _useState2[1];
26
+ var noBtnRef = useRef(null);
25
27
  useImperativeHandle(ref, function () {
26
28
  return {
27
29
  onSetButtons: function onSetButtons(e) {
@@ -29,18 +31,28 @@ export var DialogButtonHolder = /*#__PURE__*/React.memo( /*#__PURE__*/React.forw
29
31
  }
30
32
  };
31
33
  });
32
- return /*#__PURE__*/_jsx(_Fragment, {
33
- children: buttons
34
+ useEffect(function () {
35
+ if (buttons) {
36
+ noBtnRef.current.parentElement.removeAttribute('style');
37
+ } else {
38
+ // 没有按钮时,ant-modal-footer padding置0。
39
+ noBtnRef.current.parentElement.style.padding = '0px';
40
+ }
41
+ }, [buttons]);
42
+ return /*#__PURE__*/_jsxs(_Fragment, {
43
+ children: [extraBtn, buttons, /*#__PURE__*/_jsx("div", {
44
+ ref: noBtnRef
45
+ })]
34
46
  });
35
47
  }));
36
- export default function CcsDialogButtons(_ref) {
37
- var okText = _ref.okText,
38
- okAuth = _ref.okAuth,
39
- loading = _ref.loading,
40
- children = _ref.children,
41
- hideCancel = _ref.hideCancel,
42
- cancelText = _ref.cancelText,
43
- onOk = _ref.onOk;
48
+ export default function CcsDialogButtons(_ref2) {
49
+ var okText = _ref2.okText,
50
+ okAuth = _ref2.okAuth,
51
+ loading = _ref2.loading,
52
+ children = _ref2.children,
53
+ hideCancel = _ref2.hideCancel,
54
+ cancelText = _ref2.cancelText,
55
+ onOk = _ref2.onOk;
44
56
  var _CcsDialog$useInstanc = CcsDialog.useInstance(),
45
57
  closeDialog = _CcsDialog$useInstanc.closeDialog,
46
58
  buttonRef = _CcsDialog$useInstanc.buttonRef,
@@ -77,11 +89,11 @@ export default function CcsDialogButtons(_ref) {
77
89
  })]
78
90
  });
79
91
  if (buttonType === 'modal') {
80
- btns = /*#__PURE__*/_jsx("div", {
81
- className: "ccs-dialog-footer",
92
+ btns = /*#__PURE__*/_jsx(_Fragment, {
82
93
  children: btns
83
94
  });
84
95
  }
96
+ console.log('btns', btns);
85
97
  CcsUtils.showWarning(!!buttonRef.current, "\u68C0\u6D4B\u5230".concat(buttonType === 'modal' ? 'openModal' : 'openDrawer', "\u4F20\u5165request\u53C2\u6570\uFF0CButtons\u5C06\u4E0D\u80FD\u751F\u6548\u3002"));
86
98
  (_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || _buttonRef$current.onSetButtons(btns);
87
99
  });
@@ -39,10 +39,7 @@ export default function CcsDrawerFooter(_ref) {
39
39
  useEffect(function () {
40
40
  var _drawerFooterRef$curr;
41
41
  if (!onOk && !children) return;
42
- var btns = /*#__PURE__*/_jsxs("div", {
43
- style: {
44
- padding: '8px 16px'
45
- },
42
+ var btns = /*#__PURE__*/_jsxs(_Fragment, {
46
43
  children: [children, onOk && /*#__PURE__*/_jsxs(_Fragment, {
47
44
  children: [!hideCancel && /*#__PURE__*/_jsx(Button, {
48
45
  onClick: closeDialog,
@@ -1,9 +1,8 @@
1
1
  import { FormInstance, FormProps } from 'antd';
2
- import React, { CSSProperties, ReactNode } from 'react';
2
+ import React, { ReactNode } from 'react';
3
3
  type PropsType = {
4
4
  children: ReactNode;
5
5
  formProps: FormProps;
6
- styles?: CSSProperties;
7
6
  };
8
7
  export type DialogFormRef = {
9
8
  formInstance: FormInstance;
package/es/dialog/form.js CHANGED
@@ -22,7 +22,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
22
22
  */
23
23
  var DialogForm = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
24
24
  var children = _ref.children,
25
- styles = _ref.styles,
26
25
  _ref$formProps = _ref.formProps,
27
26
  labelCol = _ref$formProps.labelCol,
28
27
  wrapperCol = _ref$formProps.wrapperCol,
@@ -45,10 +44,10 @@ var DialogForm = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
45
44
  },
46
45
  preserve: false
47
46
  }, restProps), {}, {
48
- style: _objectSpread(_objectSpread({
47
+ style: _objectSpread({
49
48
  height: '100%',
50
49
  overflow: 'auto'
51
- }, styles), restProps.style),
50
+ }, restProps.style),
52
51
  children: children
53
52
  }));
54
53
  });
@@ -22,12 +22,14 @@ export type CcsDialogModalProps = ModalFuncProps & {
22
22
  form?: FormProps;
23
23
  /** 表单接口请求权限 */
24
24
  auth?: string;
25
+ /** 关闭后销毁组件,默认true */
26
+ destroyOnClose?: boolean;
27
+ /** 通过参数传递的扩展按钮 */
28
+ extraBtn?: ReactNode;
25
29
  /** 表单接口请求 */
26
30
  request?: (values: any) => Promise<CCS.HttpResult>;
27
31
  /** request执行前参数处理 */
28
32
  onRequestBefore?: (values: any) => any;
29
- /** 关闭后销毁组件,默认true */
30
- destroyOnClose?: boolean;
31
33
  /** 通过closeDialog方法关闭dialog */
32
34
  onAfterOk?: (e: any) => void;
33
35
  /** 通过点击关闭按钮或取消按钮关闭 */
@@ -40,6 +42,8 @@ export type CcsDialogDrawerProps = Omit<DrawerProps, 'extra'> & {
40
42
  auth?: string;
41
43
  /** 抽屉内容 */
42
44
  content?: ReactNode;
45
+ /** 通过参数传递的扩展按钮 */
46
+ extraBtn?: ReactNode;
43
47
  /** 表单接口请求 */
44
48
  request?: (values: any) => Promise<CCS.HttpResult>;
45
49
  /** request执行前参数处理 */
package/es/dialog/hook.js CHANGED
@@ -12,6 +12,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
12
 
13
13
  import _debounce from 'lodash/debounce';
14
14
  import React from 'react';
15
+ import { createRoot } from 'react-dom/client';
15
16
  import HookDrawer from "./HookDrawer";
16
17
  import HookModal from "./HookModal";
17
18
  import usePatchElement from "./usePatchElement";
@@ -53,10 +54,12 @@ export default function useCcsDialog() {
53
54
  }
54
55
  }, [actionQueue]);
55
56
  var getModalFunc = React.useCallback(function (config) {
56
- var _holderRef$current;
57
57
  modalUuid += 1;
58
58
  var modalRef = /*#__PURE__*/React.createRef();
59
+
60
+ // 关闭事件
59
61
  var closeFunc;
62
+ // modal
60
63
  var modal = /*#__PURE__*/_jsx(HookModal, {
61
64
  config: config,
62
65
  afterClose: function afterClose() {
@@ -65,7 +68,23 @@ export default function useCcsDialog() {
65
68
  },
66
69
  ref: modalRef
67
70
  }, "modal-".concat(modalUuid));
68
- closeFunc = (_holderRef$current = holderRef.current) === null || _holderRef$current === void 0 ? void 0 : _holderRef$current.patchElement(modal);
71
+ if (holderRef.current) {
72
+ // 加载了contextHolder
73
+ closeFunc = holderRef.current.patchElement(modal);
74
+ } else {
75
+ // 未加载contextHolder,创建dom
76
+ var dialogEle = document.createElement('div');
77
+ document.body.append(dialogEle);
78
+ var root = createRoot(dialogEle);
79
+ root.render( /*#__PURE__*/_jsx(_Fragment, {
80
+ children: modal
81
+ }));
82
+ closeFunc = function closeFunc() {
83
+ setTimeout(function () {
84
+ root.unmount();
85
+ }, 500);
86
+ };
87
+ }
69
88
  if (closeFunc) {
70
89
  destroyFns.push(closeFunc);
71
90
  }
@@ -100,7 +119,6 @@ export default function useCcsDialog() {
100
119
  return instance;
101
120
  }, []);
102
121
  var getDrawerFunc = React.useCallback(function (config) {
103
- var _holderRef$current2;
104
122
  drawerUuid += 1;
105
123
  var modalRef = /*#__PURE__*/React.createRef();
106
124
  var closeFunc;
@@ -112,7 +130,24 @@ export default function useCcsDialog() {
112
130
  },
113
131
  ref: modalRef
114
132
  }, "drawer-".concat(drawerUuid));
115
- closeFunc = (_holderRef$current2 = holderRef.current) === null || _holderRef$current2 === void 0 ? void 0 : _holderRef$current2.patchElement(modal);
133
+ if (holderRef.current) {
134
+ var _holderRef$current;
135
+ // 加载了contextHolder
136
+ closeFunc = (_holderRef$current = holderRef.current) === null || _holderRef$current === void 0 ? void 0 : _holderRef$current.patchElement(modal);
137
+ } else {
138
+ // 未加载contextHolder,创建dom
139
+ var dialogEle = document.createElement('div');
140
+ document.body.append(dialogEle);
141
+ var root = createRoot(dialogEle);
142
+ root.render( /*#__PURE__*/_jsx(_Fragment, {
143
+ children: modal
144
+ }));
145
+ closeFunc = function closeFunc() {
146
+ setTimeout(function () {
147
+ root.unmount();
148
+ }, 500);
149
+ };
150
+ }
116
151
  if (closeFunc) {
117
152
  destroyFns.push(closeFunc);
118
153
  }
@@ -14,17 +14,3 @@
14
14
  padding: 0;
15
15
  }
16
16
  }
17
-
18
- .ccs-dialog-modal {
19
- .ant-modal-footer {
20
- padding: 0;
21
- }
22
- }
23
-
24
- .ccs-dialog-footer {
25
- padding: 8px 16px;
26
-
27
- > .ant-btn + .ant-btn {
28
- margin-inline-start: 8px;
29
- }
30
- }
@@ -1,6 +1,6 @@
1
1
  declare const usePage: () => {
2
2
  id: string;
3
- location: import("history").Location;
3
+ location: import("react-router").Location<any>;
4
4
  isActive: boolean;
5
5
  onDestroy: (path: string) => void;
6
6
  onAuth: (code: string) => boolean;
@@ -1,5 +1,5 @@
1
- import { Location } from 'history';
2
1
  import { JSXElementConstructor, ReactElement } from 'react';
2
+ import { Location } from 'react-router';
3
3
  export type CachePageProps = {
4
4
  /** 选中状态 */
5
5
  active: boolean;
@@ -4,8 +4,6 @@ import { CcsProTableProps } from './table';
4
4
  type PropsType<T> = Pick<CcsProTableProps<T>, 'toolbar' | 'formItems' | 'formInitValues' | 'expandForm' | 'title' | 'formItemLabelWidth'> & {
5
5
  /** 更多查询条件 */
6
6
  hasMore?: boolean;
7
- /** 标题边框 */
8
- titleBordered?: boolean;
9
7
  form: FormInstance<any>;
10
8
  children?: ReactElement;
11
9
  /** table 操作栏 */
@@ -13,5 +11,5 @@ type PropsType<T> = Pick<CcsProTableProps<T>, 'toolbar' | 'formItems' | 'formIni
13
11
  onSearch: () => void;
14
12
  };
15
13
  /** 操作按钮、查询,重置、列筛选、 */
16
- declare function HeadComponent<T>({ form, title, toolbar, children, expandForm, titleBordered, formItems, formInitValues, formItemLabelWidth, tableOperation, onSearch, }: PropsType<T>): import("react/jsx-runtime").JSX.Element;
14
+ declare function HeadComponent<T>({ form, title, toolbar, children, expandForm, formItems, formInitValues, formItemLabelWidth, tableOperation, onSearch, }: PropsType<T>): import("react/jsx-runtime").JSX.Element;
17
15
  export default HeadComponent;
@@ -1,9 +1,3 @@
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); }
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
- 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
- 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
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
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
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
2
  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
3
  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); }
@@ -30,7 +24,6 @@ function HeadComponent(_ref) {
30
24
  children = _ref.children,
31
25
  _ref$expandForm = _ref.expandForm,
32
26
  expandForm = _ref$expandForm === void 0 ? false : _ref$expandForm,
33
- titleBordered = _ref.titleBordered,
34
27
  _ref$formItems = _ref.formItems,
35
28
  formItems = _ref$formItems === void 0 ? [] : _ref$formItems,
36
29
  formInitValues = _ref.formInitValues,
@@ -86,7 +79,9 @@ function HeadComponent(_ref) {
86
79
  children: isExpand ? '收起' : '展开'
87
80
  }), /*#__PURE__*/_jsx(Button, {
88
81
  type: "primary",
89
- htmlType: "submit",
82
+ onClick: function onClick() {
83
+ return form.submit();
84
+ },
90
85
  children: "\u67E5\u8BE2"
91
86
  }), toolbar ? null : tableOperation]
92
87
  });
@@ -155,9 +150,6 @@ function HeadComponent(_ref) {
155
150
  var onResize = function onResize() {
156
151
  resizeFn();
157
152
  };
158
-
159
- // table是否有边框
160
- var hasBorder = titleBordered === true;
161
153
  var formStyles = {
162
154
  flexWrap: isExpand ? 'wrap' : 'nowrap'
163
155
  };
@@ -168,18 +160,15 @@ function HeadComponent(_ref) {
168
160
  onResize: onResize
169
161
  }), /*#__PURE__*/_jsx(Card, {
170
162
  className: "ccs-pl-adaptation",
171
- style: _objectSpread({
172
- borderRadius: 0,
163
+ style: {
173
164
  boxShadow: 'none'
174
- }, hasBorder ? {
175
- borderBottom: 0
176
- } : {}),
165
+ },
177
166
  styles: {
178
167
  body: {
179
168
  padding: 16
180
169
  }
181
170
  },
182
- bordered: hasBorder,
171
+ bordered: false,
183
172
  title: title,
184
173
  children: /*#__PURE__*/_jsxs(Form, {
185
174
  initialValues: formInitValues,
@@ -220,6 +209,7 @@ function HeadComponent(_ref) {
220
209
  style: {
221
210
  borderRadius: 0,
222
211
  borderLeft: 0,
212
+ borderBottom: 0,
223
213
  borderRight: 0
224
214
  },
225
215
  children: [/*#__PURE__*/_jsx("div", {
@@ -188,6 +188,35 @@
188
188
  white-space: nowrap;
189
189
  }
190
190
  }
191
+
192
+ .ant-table-wrapper .ant-table > .ant-table-container {
193
+ border-inline-start: 0;
194
+ border-top: 0;
195
+
196
+ & > .ant-table-header > table > thead > tr {
197
+ & > th:last-child {
198
+ border-inline-end: 0;
199
+ border-start-start-radius: 0;
200
+ border-start-end-radius: 0;
201
+ }
202
+
203
+ & > th:first-child {
204
+ border-start-start-radius: 0;
205
+ }
206
+ }
207
+
208
+ & > .ant-table-body > table > tbody > tr > td:last-child {
209
+ border-inline-end: 0;
210
+ }
211
+ }
212
+
213
+ .ant-table-wrapper table {
214
+ border-radius: 0;
215
+ }
216
+
217
+ .ant-table-wrapper .ant-table .ant-table-header {
218
+ border-radius: 0;
219
+ }
191
220
  }
192
221
 
193
222
  // modal drawer ccs-pl 中取消table content padding
@@ -88,7 +88,6 @@ function SearchComponent(props) {
88
88
  onClick: function onClick() {
89
89
  return form.submit();
90
90
  },
91
- htmlType: "submit",
92
91
  style: {
93
92
  marginRight: 4
94
93
  },
@@ -508,9 +508,16 @@ var InternalProTable = function InternalProTable(props) {
508
508
  },
509
509
  children: toolbarExtra
510
510
  });
511
+ var rootStyle = style || {};
512
+ if (table !== null && table !== void 0 && table.bordered) {
513
+ rootStyle = _objectSpread({
514
+ border: "1px solid ".concat(token.colorBorderSecondary),
515
+ borderRadius: 4
516
+ }, rootStyle);
517
+ }
511
518
  var render = /*#__PURE__*/_jsxs("div", {
512
519
  className: classNames(classPrefix, className, _defineProperty({}, 'dark-table', isDark)),
513
- style: style,
520
+ style: rootStyle,
514
521
  children: [!(!formItems.length && !toolbar) && isAuth && props.formItemLayout !== 'adaptation' ? /*#__PURE__*/_jsx(SearchComponent, {
515
522
  form: form,
516
523
  title: title,
@@ -536,7 +543,6 @@ var InternalProTable = function InternalProTable(props) {
536
543
  children: newToolbarExtra
537
544
  }) : /*#__PURE__*/_jsx(HeadComponent, {
538
545
  form: form,
539
- titleBordered: table === null || table === void 0 ? void 0 : table.bordered,
540
546
  toolbar: newToolbar,
541
547
  formItems: formItems,
542
548
  expandForm: expandForm,
package/es/table/index.js CHANGED
@@ -13,7 +13,6 @@ import { Table, Tooltip, theme } from 'antd';
13
13
  import classNames from 'classnames';
14
14
  import { useImperativeHandle, useRef } from 'react';
15
15
  import { Resizable } from 'react-resizable';
16
- import CcsResult from "../result";
17
16
  import "./index.less";
18
17
  import { jsx as _jsx } from "react/jsx-runtime";
19
18
  var DEFAULT_PAGE = {
@@ -206,12 +205,8 @@ var CustomTable = function CustomTable(props) {
206
205
  rowSelection: rowSelection ? _objectSpread(_objectSpread({}, rowSelection), {}, {
207
206
  columnWidth: 60
208
207
  }) : undefined,
209
- columns: filterColumns(),
210
- locale: {
211
- emptyText: /*#__PURE__*/_jsx(CcsResult.NoData, {
212
- iconWidth: 80
213
- })
214
- }
208
+ columns: filterColumns()
209
+ // locale={{ emptyText: <CcsResult.NoData iconWidth={80} /> }}
215
210
  }, restProps), {}, {
216
211
  size: restProps.size || 'middle',
217
212
  className: classNames(_defineProperty(_defineProperty(_defineProperty({}, 'ccs-table-nodata', !totalNum), 'ccs-table-wrapper', !rowSelection), "className", className)),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ccs-ui/rc-pro",
3
- "version": "1.1.25-beta-26",
4
- "description": "验证码组件兼容暗黑模式;proTable封装rowselection代码;proTable添加自适应布局模式;",
3
+ "version": "1.2.0-beta-1",
4
+ "description": "验证码组件兼容暗黑模式;proTable封装rowselection代码;proTable添加自适应布局模式;CcsDialog不适应contextHolder也能打开。",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "Hong",
@@ -68,6 +68,7 @@
68
68
  "js-base64": "^3.7.5",
69
69
  "localforage": "^1.10.0",
70
70
  "lodash": "^4.17.21",
71
+ "rc-menu": "^9.15.1",
71
72
  "rc-trigger": "^5.3.4",
72
73
  "rc-util": "^5.32.4",
73
74
  "react-color": "^2.19.3",
@@ -102,6 +103,7 @@
102
103
  "prettier": "^2.7.1",
103
104
  "prettier-plugin-organize-imports": "^3.0.0",
104
105
  "prettier-plugin-packagejson": "^2.2.18",
106
+ "rc-table": "^7.47.5",
105
107
  "react": "^18.0.0",
106
108
  "react-dom": "^18.0.0",
107
109
  "stylelint": "^14.9.1"