@ccs-ui/rc-pro 1.1.6 → 1.1.9
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 +32 -21
- package/es/dialog/HookModal.d.ts +1 -1
- package/es/dialog/HookModal.js +31 -21
- package/es/dialog/hook.d.ts +10 -10
- package/package.json +1 -2
package/es/dialog/HookDrawer.js
CHANGED
|
@@ -19,7 +19,7 @@ import { DialogContentContext } from "./context";
|
|
|
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
|
|
22
|
+
var _innerConfig$styles;
|
|
23
23
|
var hookAfterClose = _ref.afterClose,
|
|
24
24
|
config = _ref.config;
|
|
25
25
|
var _useState = useState(function () {
|
|
@@ -39,6 +39,17 @@ var HookDrawer = function HookDrawer(_ref, ref) {
|
|
|
39
39
|
var afterClose = function afterClose() {
|
|
40
40
|
hookAfterClose();
|
|
41
41
|
};
|
|
42
|
+
var auth = innerConfig.auth,
|
|
43
|
+
form = innerConfig.form,
|
|
44
|
+
content = innerConfig.content,
|
|
45
|
+
className = innerConfig.className,
|
|
46
|
+
rootStyle = innerConfig.rootStyle,
|
|
47
|
+
getContainer = innerConfig.getContainer,
|
|
48
|
+
request = innerConfig.request,
|
|
49
|
+
onAfterOk = innerConfig.onAfterOk,
|
|
50
|
+
onAfterCancel = innerConfig.onAfterCancel,
|
|
51
|
+
onClose = innerConfig.onClose,
|
|
52
|
+
onRequestBefore = innerConfig.onRequestBefore;
|
|
42
53
|
var close = function close(e) {
|
|
43
54
|
setInnerConfig(function (c) {
|
|
44
55
|
return _objectSpread(_objectSpread({}, c), {}, {
|
|
@@ -47,19 +58,19 @@ var HookDrawer = function HookDrawer(_ref, ref) {
|
|
|
47
58
|
});
|
|
48
59
|
if ((e === null || e === void 0 ? void 0 : e.type) === 'click') {
|
|
49
60
|
// 通过点击关闭按钮或取消按钮关闭
|
|
50
|
-
if (
|
|
51
|
-
|
|
61
|
+
if (onAfterCancel) {
|
|
62
|
+
onAfterCancel(e);
|
|
52
63
|
}
|
|
53
64
|
} else {
|
|
54
65
|
// 通过调用closeDialog关闭
|
|
55
|
-
if (
|
|
56
|
-
|
|
66
|
+
if (onAfterOk) {
|
|
67
|
+
onAfterOk(e);
|
|
57
68
|
}
|
|
58
69
|
}
|
|
59
70
|
|
|
60
71
|
// 入参有onClose
|
|
61
|
-
if (
|
|
62
|
-
|
|
72
|
+
if (onClose) {
|
|
73
|
+
onClose(e);
|
|
63
74
|
}
|
|
64
75
|
};
|
|
65
76
|
useImperativeHandle(ref, function () {
|
|
@@ -81,7 +92,7 @@ var HookDrawer = function HookDrawer(_ref, ref) {
|
|
|
81
92
|
};
|
|
82
93
|
var isCrInProp = ('getContainer' in innerConfig);
|
|
83
94
|
var styles = innerConfig.styles || {};
|
|
84
|
-
if (
|
|
95
|
+
if (form) {
|
|
85
96
|
styles.body = {
|
|
86
97
|
padding: 0
|
|
87
98
|
};
|
|
@@ -95,19 +106,19 @@ var HookDrawer = function HookDrawer(_ref, ref) {
|
|
|
95
106
|
}
|
|
96
107
|
}, innerConfig), {}, {
|
|
97
108
|
onClose: close,
|
|
98
|
-
className: classNames('ccs-dialog-drawer',
|
|
109
|
+
className: classNames('ccs-dialog-drawer', className),
|
|
99
110
|
styles: styles,
|
|
100
111
|
rootStyle: _objectSpread(_objectSpread({}, !isCrInProp ? {
|
|
101
112
|
position: 'absolute'
|
|
102
|
-
} : {}),
|
|
103
|
-
getContainer: isCrInProp ?
|
|
104
|
-
extra:
|
|
105
|
-
request:
|
|
113
|
+
} : {}), rootStyle),
|
|
114
|
+
getContainer: isCrInProp ? getContainer : onGetContainer,
|
|
115
|
+
extra: request ? /*#__PURE__*/_jsx(DialogSelfButton, {
|
|
116
|
+
request: request,
|
|
106
117
|
onCancel: close,
|
|
107
118
|
formRef: formRef,
|
|
108
|
-
onRequestBefore:
|
|
109
|
-
auth:
|
|
110
|
-
formInitialValues:
|
|
119
|
+
onRequestBefore: onRequestBefore,
|
|
120
|
+
auth: auth,
|
|
121
|
+
formInitialValues: form === null || form === void 0 ? void 0 : form.initialValues
|
|
111
122
|
}) : /*#__PURE__*/_jsx(DialogButtonHolder, {
|
|
112
123
|
ref: buttonRef
|
|
113
124
|
}),
|
|
@@ -121,16 +132,16 @@ var HookDrawer = function HookDrawer(_ref, ref) {
|
|
|
121
132
|
buttonType: 'drawer',
|
|
122
133
|
closeDialog: close,
|
|
123
134
|
drawerFooterRef: footerRef,
|
|
124
|
-
formInitialValues: (
|
|
135
|
+
formInitialValues: (form === null || form === void 0 ? void 0 : form.initialValues) || {}
|
|
125
136
|
},
|
|
126
|
-
children:
|
|
137
|
+
children: form ? /*#__PURE__*/_jsx(DialogForm, {
|
|
127
138
|
ref: formRef,
|
|
128
|
-
formProps:
|
|
139
|
+
formProps: form,
|
|
129
140
|
styles: _objectSpread({
|
|
130
141
|
padding: 24
|
|
131
142
|
}, (_innerConfig$styles = innerConfig.styles) === null || _innerConfig$styles === void 0 ? void 0 : _innerConfig$styles.body),
|
|
132
|
-
children:
|
|
133
|
-
}) :
|
|
143
|
+
children: content
|
|
144
|
+
}) : content
|
|
134
145
|
})
|
|
135
146
|
}));
|
|
136
147
|
};
|
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: ({ auth, formRef, formInitialValues, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "auth" | "request" | "
|
|
5
|
+
export declare const DialogSelfButton: ({ auth, formRef, formInitialValues, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "auth" | "request" | "onRequestBefore" | "onCancel"> & {
|
|
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
|
@@ -105,7 +105,6 @@ export var DialogSelfButton = function DialogSelfButton(_ref2) {
|
|
|
105
105
|
});
|
|
106
106
|
};
|
|
107
107
|
var HookModal = function HookModal(_ref3, ref) {
|
|
108
|
-
var _config$form, _config$form2;
|
|
109
108
|
var hookAfterClose = _ref3.afterClose,
|
|
110
109
|
config = _ref3.config;
|
|
111
110
|
var _useState3 = useState(function () {
|
|
@@ -138,6 +137,18 @@ var HookModal = function HookModal(_ref3, ref) {
|
|
|
138
137
|
if (config.destroyOnClose !== false) hookAfterClose();
|
|
139
138
|
(_innerConfig$afterClo = innerConfig.afterClose) === null || _innerConfig$afterClo === void 0 ? void 0 : _innerConfig$afterClo.call(innerConfig);
|
|
140
139
|
};
|
|
140
|
+
var auth = innerConfig.auth,
|
|
141
|
+
form = innerConfig.form,
|
|
142
|
+
title = innerConfig.title,
|
|
143
|
+
content = innerConfig.content,
|
|
144
|
+
_innerConfig$styles = innerConfig.styles,
|
|
145
|
+
styles = _innerConfig$styles === void 0 ? {} : _innerConfig$styles,
|
|
146
|
+
className = innerConfig.className,
|
|
147
|
+
request = innerConfig.request,
|
|
148
|
+
onCancel = innerConfig.onCancel,
|
|
149
|
+
onRequestBefore = innerConfig.onRequestBefore,
|
|
150
|
+
onAfterOk = innerConfig.onAfterOk,
|
|
151
|
+
onAfterCancel = innerConfig.onAfterCancel;
|
|
141
152
|
var close = function close(e) {
|
|
142
153
|
setInnerConfig(function (c) {
|
|
143
154
|
return _objectSpread(_objectSpread({}, c), {}, {
|
|
@@ -146,19 +157,19 @@ var HookModal = function HookModal(_ref3, ref) {
|
|
|
146
157
|
});
|
|
147
158
|
if ((e === null || e === void 0 ? void 0 : e.type) === 'click') {
|
|
148
159
|
// 通过点击关闭按钮或取消按钮关闭
|
|
149
|
-
if (
|
|
150
|
-
|
|
160
|
+
if (onAfterCancel) {
|
|
161
|
+
onAfterCancel(e);
|
|
151
162
|
}
|
|
152
163
|
} else {
|
|
153
164
|
// 通过调用closeDialog关闭
|
|
154
|
-
if (
|
|
155
|
-
|
|
165
|
+
if (onAfterOk) {
|
|
166
|
+
onAfterOk(e);
|
|
156
167
|
}
|
|
157
168
|
}
|
|
158
169
|
|
|
159
170
|
// 入参有onClose
|
|
160
|
-
if (
|
|
161
|
-
|
|
171
|
+
if (onCancel) {
|
|
172
|
+
onCancel(e);
|
|
162
173
|
}
|
|
163
174
|
};
|
|
164
175
|
useImperativeHandle(ref, function () {
|
|
@@ -171,28 +182,27 @@ var HookModal = function HookModal(_ref3, ref) {
|
|
|
171
182
|
}
|
|
172
183
|
};
|
|
173
184
|
});
|
|
174
|
-
var styles = innerConfig.styles || {};
|
|
175
185
|
return /*#__PURE__*/_jsx(Modal, _objectSpread(_objectSpread({
|
|
176
186
|
onCancel: close,
|
|
177
187
|
afterClose: afterClose
|
|
178
188
|
}, innerConfig), {}, {
|
|
179
189
|
styles: _objectSpread({
|
|
180
|
-
footer: !
|
|
190
|
+
footer: !request ? {
|
|
181
191
|
padding: 0
|
|
182
192
|
} : undefined
|
|
183
193
|
}, styles),
|
|
184
|
-
className: classNames('ccs-dialog-modal',
|
|
185
|
-
footer:
|
|
194
|
+
className: classNames('ccs-dialog-modal', className),
|
|
195
|
+
footer: request ? /*#__PURE__*/_jsx("div", {
|
|
186
196
|
style: {
|
|
187
197
|
padding: '8px 16px'
|
|
188
198
|
},
|
|
189
199
|
children: /*#__PURE__*/_jsx(DialogSelfButton, {
|
|
190
|
-
auth:
|
|
191
|
-
request:
|
|
200
|
+
auth: auth,
|
|
201
|
+
request: request,
|
|
192
202
|
onCancel: close,
|
|
193
203
|
formRef: formRef,
|
|
194
|
-
onRequestBefore:
|
|
195
|
-
formInitialValues:
|
|
204
|
+
onRequestBefore: onRequestBefore,
|
|
205
|
+
formInitialValues: form === null || form === void 0 ? void 0 : form.initialValues
|
|
196
206
|
})
|
|
197
207
|
}) : /*#__PURE__*/_jsx(DialogButtonHolder, {
|
|
198
208
|
ref: buttonRef
|
|
@@ -218,7 +228,7 @@ var HookModal = function HookModal(_ref3, ref) {
|
|
|
218
228
|
});
|
|
219
229
|
});
|
|
220
230
|
},
|
|
221
|
-
children:
|
|
231
|
+
children: title
|
|
222
232
|
}),
|
|
223
233
|
modalRender: function modalRender(modal) {
|
|
224
234
|
return /*#__PURE__*/_jsx(DragModal, {
|
|
@@ -232,14 +242,14 @@ var HookModal = function HookModal(_ref3, ref) {
|
|
|
232
242
|
buttonRef: buttonRef,
|
|
233
243
|
buttonType: 'modal',
|
|
234
244
|
Buttons: CcsDialogButtons,
|
|
235
|
-
formInitialValues: (
|
|
245
|
+
formInitialValues: (form === null || form === void 0 ? void 0 : form.initialValues) || {},
|
|
236
246
|
closeDialog: close
|
|
237
247
|
},
|
|
238
|
-
children:
|
|
248
|
+
children: form ? /*#__PURE__*/_jsx(DialogForm, {
|
|
239
249
|
ref: formRef,
|
|
240
|
-
formProps:
|
|
241
|
-
children:
|
|
242
|
-
}) :
|
|
250
|
+
formProps: form,
|
|
251
|
+
children: content
|
|
252
|
+
}) : content
|
|
243
253
|
})
|
|
244
254
|
}));
|
|
245
255
|
};
|
package/es/dialog/hook.d.ts
CHANGED
|
@@ -3,19 +3,19 @@ import React, { ReactNode } from 'react';
|
|
|
3
3
|
import CCS from '..';
|
|
4
4
|
export type CcsDialogModal = {
|
|
5
5
|
destroy: () => void;
|
|
6
|
-
update: (config:
|
|
6
|
+
update: (config: CcsDialogModalProps) => void;
|
|
7
7
|
};
|
|
8
8
|
export type CcsDialogDrawer = {
|
|
9
9
|
destroy: () => void;
|
|
10
|
-
update: (config:
|
|
10
|
+
update: (config: CcsDialogDrawerProps) => void;
|
|
11
11
|
};
|
|
12
|
-
type ModalFunc = (props:
|
|
12
|
+
type ModalFunc = (props: CcsDialogModalProps) => {
|
|
13
13
|
destroy: () => void;
|
|
14
|
-
update: (configUpdate:
|
|
14
|
+
update: (configUpdate: CcsDialogModalProps) => void;
|
|
15
15
|
};
|
|
16
|
-
type DrawerFunc = (props:
|
|
16
|
+
type DrawerFunc = (props: CcsDialogDrawerProps) => {
|
|
17
17
|
destroy: () => void;
|
|
18
|
-
update: (configUpdate:
|
|
18
|
+
update: (configUpdate: CcsDialogDrawerProps) => void;
|
|
19
19
|
};
|
|
20
20
|
export type CcsDialogModalProps = ModalFuncProps & {
|
|
21
21
|
/** antd form */
|
|
@@ -29,9 +29,9 @@ export type CcsDialogModalProps = ModalFuncProps & {
|
|
|
29
29
|
/** 关闭后销毁组件,默认true */
|
|
30
30
|
destroyOnClose?: boolean;
|
|
31
31
|
/** 通过closeDialog方法关闭dialog */
|
|
32
|
-
|
|
32
|
+
onAfterOk?: (e: any) => void;
|
|
33
33
|
/** 通过点击关闭按钮或取消按钮关闭 */
|
|
34
|
-
|
|
34
|
+
onAfterCancel?: (e: any) => void;
|
|
35
35
|
};
|
|
36
36
|
export type CcsDialogDrawerProps = Omit<DrawerProps, 'extra'> & {
|
|
37
37
|
/** antd form */
|
|
@@ -45,9 +45,9 @@ export type CcsDialogDrawerProps = Omit<DrawerProps, 'extra'> & {
|
|
|
45
45
|
/** request执行前参数处理 */
|
|
46
46
|
onRequestBefore?: (values: any) => any;
|
|
47
47
|
/** 通过closeDialog方法关闭dialog */
|
|
48
|
-
|
|
48
|
+
onAfterOk?: (e: any) => void;
|
|
49
49
|
/** 通过点击关闭按钮或取消按钮关闭 */
|
|
50
|
-
|
|
50
|
+
onAfterCancel?: (e: any) => void;
|
|
51
51
|
};
|
|
52
52
|
export type ModalDialog = (...args: Parameters<ModalFunc>) => ReturnType<ModalFunc>;
|
|
53
53
|
export type DrawerDialog = (...args: Parameters<ModalFunc>) => ReturnType<DrawerFunc>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ccs-ui/rc-pro",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"description": "A react pro components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -49,7 +49,6 @@
|
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@ant-design/compatible": "^5.1.2",
|
|
51
51
|
"@ant-design/icons": "^5.1.4",
|
|
52
|
-
"@ccs-ui/rc-pro": "1.1.1-rc34",
|
|
53
52
|
"ahooks": "^3.7.7",
|
|
54
53
|
"antd": "^5.11.0",
|
|
55
54
|
"antd-img-crop": "^4.12.2",
|