@ccs-ui/rc-pro 1.1.3 → 1.1.5
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/dialog/HookDrawer.js
CHANGED
|
@@ -14,7 +14,7 @@ import { Drawer } from 'antd';
|
|
|
14
14
|
import classNames from 'classnames';
|
|
15
15
|
import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
|
|
16
16
|
import { DialogSelfButton } from "./HookModal";
|
|
17
|
-
import { DialogButtonHolder } from "./button";
|
|
17
|
+
import CcsDialogButtons, { DialogButtonHolder } from "./button";
|
|
18
18
|
import { DialogContentContext } from "./context";
|
|
19
19
|
import DialogForm from "./form";
|
|
20
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -101,11 +101,12 @@ var HookDrawer = function HookDrawer(_ref, ref) {
|
|
|
101
101
|
position: 'absolute'
|
|
102
102
|
} : {}), innerConfig.rootStyle),
|
|
103
103
|
getContainer: isCrInProp ? innerConfig.getContainer : onGetContainer,
|
|
104
|
-
extra:
|
|
105
|
-
request:
|
|
104
|
+
extra: config.request ? /*#__PURE__*/_jsx(DialogSelfButton, {
|
|
105
|
+
request: config.request,
|
|
106
106
|
onCancel: close,
|
|
107
107
|
formRef: formRef,
|
|
108
|
-
onRequestBefore:
|
|
108
|
+
onRequestBefore: config.onRequestBefore,
|
|
109
|
+
auth: config.auth,
|
|
109
110
|
formInitialValues: (_config$form = config.form) === null || _config$form === void 0 ? void 0 : _config$form.initialValues
|
|
110
111
|
}) : /*#__PURE__*/_jsx(DialogButtonHolder, {
|
|
111
112
|
ref: buttonRef
|
|
@@ -115,6 +116,7 @@ var HookDrawer = function HookDrawer(_ref, ref) {
|
|
|
115
116
|
}),
|
|
116
117
|
children: /*#__PURE__*/_jsx(DialogContentContext.Provider, {
|
|
117
118
|
value: {
|
|
119
|
+
Buttons: CcsDialogButtons,
|
|
118
120
|
buttonRef: buttonRef,
|
|
119
121
|
buttonType: 'drawer',
|
|
120
122
|
closeDialog: close,
|
package/es/dialog/HookModal.d.ts
CHANGED
|
@@ -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: ({
|
|
5
|
+
export declare const DialogSelfButton: ({ auth, formRef, formInitialValues, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "auth" | "request" | "onCancel" | "onRequestBefore"> & {
|
|
6
6
|
formRef: React.RefObject<DialogFormRef>;
|
|
7
7
|
formInitialValues: FormProps['initialValues'];
|
|
8
8
|
}) => import("react/jsx-runtime").JSX.Element;
|
package/es/dialog/HookModal.js
CHANGED
|
@@ -14,8 +14,8 @@ import { Button, Modal } from 'antd';
|
|
|
14
14
|
import classNames from 'classnames';
|
|
15
15
|
import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
|
|
16
16
|
import Draggable from 'react-draggable';
|
|
17
|
-
import { CcsDialog, CcsUtils } from '..';
|
|
18
|
-
import { DialogButtonHolder } from "./button";
|
|
17
|
+
import { CcsAuth, CcsDialog, CcsUtils } from '..';
|
|
18
|
+
import CcsDialogButtons, { DialogButtonHolder } from "./button";
|
|
19
19
|
import { DialogContentContext } from "./context";
|
|
20
20
|
import DialogForm from "./form";
|
|
21
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -59,9 +59,10 @@ var DragModal = function DragModal(_ref) {
|
|
|
59
59
|
});
|
|
60
60
|
};
|
|
61
61
|
export var DialogSelfButton = function DialogSelfButton(_ref2) {
|
|
62
|
-
var
|
|
63
|
-
formInitialValues = _ref2$formInitialValu === void 0 ? {} : _ref2$formInitialValu,
|
|
62
|
+
var auth = _ref2.auth,
|
|
64
63
|
formRef = _ref2.formRef,
|
|
64
|
+
_ref2$formInitialValu = _ref2.formInitialValues,
|
|
65
|
+
formInitialValues = _ref2$formInitialValu === void 0 ? {} : _ref2$formInitialValu,
|
|
65
66
|
request = _ref2.request,
|
|
66
67
|
onCancel = _ref2.onCancel,
|
|
67
68
|
onRequestBefore = _ref2.onRequestBefore;
|
|
@@ -94,7 +95,8 @@ export var DialogSelfButton = function DialogSelfButton(_ref2) {
|
|
|
94
95
|
children: [/*#__PURE__*/_jsx(Button, {
|
|
95
96
|
onClick: onCancel,
|
|
96
97
|
children: "\u53D6\u6D88"
|
|
97
|
-
}), /*#__PURE__*/_jsx(Button, {
|
|
98
|
+
}), /*#__PURE__*/_jsx(CcsAuth.Button, {
|
|
99
|
+
auth: auth || '',
|
|
98
100
|
type: "primary",
|
|
99
101
|
onClick: onOk,
|
|
100
102
|
loading: loading,
|
|
@@ -185,10 +187,11 @@ var HookModal = function HookModal(_ref3, ref) {
|
|
|
185
187
|
padding: '8px 16px'
|
|
186
188
|
},
|
|
187
189
|
children: /*#__PURE__*/_jsx(DialogSelfButton, {
|
|
188
|
-
|
|
190
|
+
auth: config.auth,
|
|
191
|
+
request: config.request,
|
|
189
192
|
onCancel: close,
|
|
190
193
|
formRef: formRef,
|
|
191
|
-
onRequestBefore:
|
|
194
|
+
onRequestBefore: config.onRequestBefore,
|
|
192
195
|
formInitialValues: (_config$form = config.form) === null || _config$form === void 0 ? void 0 : _config$form.initialValues
|
|
193
196
|
})
|
|
194
197
|
}) : /*#__PURE__*/_jsx(DialogButtonHolder, {
|
|
@@ -228,8 +231,9 @@ var HookModal = function HookModal(_ref3, ref) {
|
|
|
228
231
|
value: {
|
|
229
232
|
buttonRef: buttonRef,
|
|
230
233
|
buttonType: 'modal',
|
|
231
|
-
|
|
232
|
-
formInitialValues: ((_config$form2 = config.form) === null || _config$form2 === void 0 ? void 0 : _config$form2.initialValues) || {}
|
|
234
|
+
Buttons: CcsDialogButtons,
|
|
235
|
+
formInitialValues: ((_config$form2 = config.form) === null || _config$form2 === void 0 ? void 0 : _config$form2.initialValues) || {},
|
|
236
|
+
closeDialog: close
|
|
233
237
|
},
|
|
234
238
|
children: config.form ? /*#__PURE__*/_jsx(DialogForm, {
|
|
235
239
|
ref: formRef,
|
package/es/dialog/button.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
interface DialogButtonsProps {
|
|
2
|
+
export interface DialogButtonsProps {
|
|
3
3
|
okText?: string;
|
|
4
4
|
cancelText?: string;
|
|
5
5
|
okAuth?: string;
|
|
@@ -12,5 +12,4 @@ export type DialogButtonRef = {
|
|
|
12
12
|
onSetButtons: (e: React.ReactElement) => void;
|
|
13
13
|
};
|
|
14
14
|
export declare const DialogButtonHolder: React.MemoExoticComponent<React.ForwardRefExoticComponent<React.RefAttributes<DialogButtonRef>>>;
|
|
15
|
-
export default function CcsDialogButtons({ okText, okAuth, loading, children, hideCancel, cancelText, onOk, }: DialogButtonsProps):
|
|
16
|
-
export {};
|
|
15
|
+
export default function CcsDialogButtons({ okText, okAuth, loading, children, hideCancel, cancelText, onOk, }: DialogButtonsProps): import("react/jsx-runtime").JSX.Element;
|
package/es/dialog/button.js
CHANGED
|
@@ -84,8 +84,8 @@ export default function CcsDialogButtons(_ref) {
|
|
|
84
84
|
children: btns
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
|
-
CcsUtils.showWarning(!!buttonRef.current, "\u68C0\u6D4B\u5230".concat(buttonType === 'modal' ? 'openModal' : 'openDrawer', "\u4F20\u5165request\u53C2\u6570\
|
|
87
|
+
CcsUtils.showWarning(!!buttonRef.current, "\u68C0\u6D4B\u5230".concat(buttonType === 'modal' ? 'openModal' : 'openDrawer', "\u4F20\u5165request\u53C2\u6570\uFF0CButtons\u5C06\u4E0D\u80FD\u751F\u6548\u3002"));
|
|
88
88
|
(_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 ? void 0 : _buttonRef$current.onSetButtons(btns);
|
|
89
89
|
});
|
|
90
|
-
return
|
|
90
|
+
return /*#__PURE__*/_jsx(_Fragment, {});
|
|
91
91
|
}
|
package/es/dialog/context.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Store } from 'antd/es/form/interface';
|
|
2
|
-
import React, { RefObject } from 'react';
|
|
3
|
-
import { DialogButtonRef } from './button';
|
|
2
|
+
import React, { ReactElement, RefObject } from 'react';
|
|
3
|
+
import { DialogButtonRef, DialogButtonsProps } from './button';
|
|
4
4
|
export interface DialogContextType<T = Store> {
|
|
5
|
-
/** 按钮类型 */
|
|
6
|
-
buttonType: 'modal' | 'drawer';
|
|
7
5
|
/** 表单初始值 */
|
|
8
6
|
formInitialValues: T;
|
|
7
|
+
/** 按钮组件 */
|
|
8
|
+
Buttons: (e: DialogButtonsProps) => ReactElement;
|
|
9
|
+
/** 按钮类型 */
|
|
10
|
+
buttonType: 'modal' | 'drawer';
|
|
9
11
|
/** 按钮 ref */
|
|
10
12
|
buttonRef: RefObject<DialogButtonRef>;
|
|
11
13
|
/** drawer footer ref */
|
package/es/dialog/hook.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ type DrawerFunc = (props: DrawerProps) => {
|
|
|
20
20
|
export type CcsDialogModalProps = ModalFuncProps & {
|
|
21
21
|
/** antd form */
|
|
22
22
|
form?: FormProps;
|
|
23
|
+
/** 表单接口请求权限 */
|
|
24
|
+
auth?: string;
|
|
23
25
|
/** 表单接口请求 */
|
|
24
26
|
request?: (values: any) => Promise<CCS.HttpResult>;
|
|
25
27
|
/** request执行前参数处理 */
|
|
@@ -34,6 +36,8 @@ export type CcsDialogModalProps = ModalFuncProps & {
|
|
|
34
36
|
export type CcsDialogDrawerProps = Omit<DrawerProps, 'extra'> & {
|
|
35
37
|
/** antd form */
|
|
36
38
|
form?: FormProps;
|
|
39
|
+
/** 表单接口请求权限 */
|
|
40
|
+
auth?: string;
|
|
37
41
|
/** 抽屉内容 */
|
|
38
42
|
content?: ReactNode;
|
|
39
43
|
/** 表单接口请求 */
|