@ccs-ui/rc-pro 1.1.2 → 1.1.3

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.
@@ -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 _config$form, _innerConfig$styles;
22
+ var _config$form, _config$form2, _innerConfig$styles;
23
23
  var hookAfterClose = _ref.afterClose,
24
24
  config = _ref.config;
25
25
  var _useState = useState(function () {
@@ -105,7 +105,8 @@ var HookDrawer = function HookDrawer(_ref, ref) {
105
105
  request: innerConfig.request,
106
106
  onCancel: close,
107
107
  formRef: formRef,
108
- onRequestBefore: innerConfig.onRequestBefore
108
+ onRequestBefore: innerConfig.onRequestBefore,
109
+ formInitialValues: (_config$form = config.form) === null || _config$form === void 0 ? void 0 : _config$form.initialValues
109
110
  }) : /*#__PURE__*/_jsx(DialogButtonHolder, {
110
111
  ref: buttonRef
111
112
  }),
@@ -118,7 +119,7 @@ var HookDrawer = function HookDrawer(_ref, ref) {
118
119
  buttonType: 'drawer',
119
120
  closeDialog: close,
120
121
  drawerFooterRef: footerRef,
121
- formInitialValues: ((_config$form = config.form) === null || _config$form === void 0 ? void 0 : _config$form.initialValues) || {}
122
+ formInitialValues: ((_config$form2 = config.form) === null || _config$form2 === void 0 ? void 0 : _config$form2.initialValues) || {}
122
123
  },
123
124
  children: config.form ? /*#__PURE__*/_jsx(DialogForm, {
124
125
  ref: formRef,
@@ -1,8 +1,10 @@
1
1
  /// <reference types="react" />
2
+ import { FormProps } from 'antd';
2
3
  import { DialogFormRef } from './form';
3
4
  import { CcsDialogModal, CcsDialogModalProps } from './hook';
4
- export declare const DialogSelfButton: ({ formRef, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "request" | "onCancel" | "onRequestBefore"> & {
5
+ export declare const DialogSelfButton: ({ formInitialValues, formRef, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "request" | "onCancel" | "onRequestBefore"> & {
5
6
  formRef: React.RefObject<DialogFormRef>;
7
+ formInitialValues: FormProps['initialValues'];
6
8
  }) => import("react/jsx-runtime").JSX.Element;
7
9
  export interface HookModalProps {
8
10
  afterClose: () => void;
@@ -59,7 +59,9 @@ var DragModal = function DragModal(_ref) {
59
59
  });
60
60
  };
61
61
  export var DialogSelfButton = function DialogSelfButton(_ref2) {
62
- var formRef = _ref2.formRef,
62
+ var _ref2$formInitialValu = _ref2.formInitialValues,
63
+ formInitialValues = _ref2$formInitialValu === void 0 ? {} : _ref2$formInitialValu,
64
+ formRef = _ref2.formRef,
63
65
  request = _ref2.request,
64
66
  onCancel = _ref2.onCancel,
65
67
  onRequestBefore = _ref2.onRequestBefore;
@@ -75,7 +77,7 @@ export var DialogSelfButton = function DialogSelfButton(_ref2) {
75
77
  }
76
78
  formRef.current.formInstance.validateFields().then(function (values) {
77
79
  setLoading(true);
78
- var params = onRequestBefore ? onRequestBefore(values) : values;
80
+ var params = _objectSpread(_objectSpread({}, formInitialValues), onRequestBefore ? onRequestBefore(values) : values);
79
81
  request(params).then(function (d) {
80
82
  setLoading(false);
81
83
  if (d !== null && d !== void 0 && d.success && onCancel) {
@@ -87,10 +89,7 @@ export var DialogSelfButton = function DialogSelfButton(_ref2) {
87
89
  console.log('e', err);
88
90
  });
89
91
  });
90
-
91
- // request
92
92
  };
93
-
94
93
  return /*#__PURE__*/_jsxs(_Fragment, {
95
94
  children: [/*#__PURE__*/_jsx(Button, {
96
95
  onClick: onCancel,
@@ -104,7 +103,7 @@ export var DialogSelfButton = function DialogSelfButton(_ref2) {
104
103
  });
105
104
  };
106
105
  var HookModal = function HookModal(_ref3, ref) {
107
- var _config$form;
106
+ var _config$form, _config$form2;
108
107
  var hookAfterClose = _ref3.afterClose,
109
108
  config = _ref3.config;
110
109
  var _useState3 = useState(function () {
@@ -189,17 +188,12 @@ var HookModal = function HookModal(_ref3, ref) {
189
188
  request: innerConfig.request,
190
189
  onCancel: close,
191
190
  formRef: formRef,
192
- onRequestBefore: innerConfig.onRequestBefore
191
+ onRequestBefore: innerConfig.onRequestBefore,
192
+ formInitialValues: (_config$form = config.form) === null || _config$form === void 0 ? void 0 : _config$form.initialValues
193
193
  })
194
194
  }) : /*#__PURE__*/_jsx(DialogButtonHolder, {
195
195
  ref: buttonRef
196
196
  }),
197
- onOk: function onOk() {
198
- // 传入request,onOk触发请求
199
- if (innerConfig.request) {
200
- console.log(111);
201
- }
202
- },
203
197
  title: /*#__PURE__*/_jsx("div", {
204
198
  style: {
205
199
  width: '100%',
@@ -235,7 +229,7 @@ var HookModal = function HookModal(_ref3, ref) {
235
229
  buttonRef: buttonRef,
236
230
  buttonType: 'modal',
237
231
  closeDialog: close,
238
- formInitialValues: ((_config$form = config.form) === null || _config$form === void 0 ? void 0 : _config$form.initialValues) || {}
232
+ formInitialValues: ((_config$form2 = config.form) === null || _config$form2 === void 0 ? void 0 : _config$form2.initialValues) || {}
239
233
  },
240
234
  children: config.form ? /*#__PURE__*/_jsx(DialogForm, {
241
235
  ref: formRef,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccs-ui/rc-pro",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "A react pro components",
5
5
  "license": "MIT",
6
6
  "module": "es/index.js",