@bchr/bchr-front-lib 0.3.145 → 0.3.148

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.
@@ -54,7 +54,7 @@ var SmartMessage = {
54
54
  exports.SmartMessage = SmartMessage;
55
55
 
56
56
  var showConfirm = function showConfirm(options) {
57
- var confirmDlgHandler = _antd.Modal.confirm({
57
+ _antd.Modal.confirm({
58
58
  centered: true,
59
59
  title: options.title,
60
60
  content: options.content,
@@ -64,16 +64,16 @@ var showConfirm = function showConfirm(options) {
64
64
  closable: options.closable,
65
65
  onOk: function onOk(e) {
66
66
  options.okCallback ? options.okCallback(e) : function () {};
67
+
68
+ _antd.Modal.destroyAll();
67
69
  },
68
70
  onCancel: function onCancel(e) {
71
+ _antd.Modal.destroyAll();
72
+
69
73
  options.cancelCallback ? options.cancelCallback(e) : function () {};
70
74
  },
71
75
  autoFocusButton: null
72
76
  });
73
-
74
- return /*#__PURE__*/_react["default"].createElement(_antd.ConfigProvider, {
75
- locale: _zh_CN["default"]
76
- }, confirmDlgHandler);
77
77
  };
78
78
 
79
79
  var showInfo = function showInfo(options) {
@@ -86,6 +86,8 @@ var showInfo = function showInfo(options) {
86
86
  closable: options.closable,
87
87
  onOk: function onOk(e) {
88
88
  options.okCallback ? options.okCallback(e) : function () {};
89
+
90
+ _antd.Modal.destroyAll();
89
91
  }
90
92
  });
91
93
 
@@ -104,6 +106,8 @@ var showSuccess = function showSuccess(options) {
104
106
  closable: options.closable,
105
107
  onOk: function onOk(e) {
106
108
  options.okCallback ? options.okCallback(e) : function () {};
109
+
110
+ _antd.Modal.destroyAll();
107
111
  }
108
112
  });
109
113
 
@@ -122,6 +126,8 @@ var showError = function showError(options) {
122
126
  closable: options.closable,
123
127
  onOk: function onOk(e) {
124
128
  options.okCallback ? options.okCallback(e) : function () {};
129
+
130
+ _antd.Modal.destroyAll();
125
131
  }
126
132
  });
127
133
 
@@ -140,6 +146,8 @@ var showWarn = function showWarn(options) {
140
146
  closable: options.closable,
141
147
  onOk: function onOk(e) {
142
148
  options.okCallback ? options.okCallback(e) : function () {};
149
+
150
+ _antd.Modal.destroyAll();
143
151
  }
144
152
  });
145
153
 
@@ -160,6 +168,8 @@ var showAutoCloseInfo = function showAutoCloseInfo(options) {
160
168
  closable: options.closable,
161
169
  onOk: function onOk(e) {
162
170
  options.okCallback ? options.okCallback(e) : function () {};
171
+
172
+ _antd.Modal.destroyAll();
163
173
  }
164
174
  });
165
175
 
@@ -186,6 +196,8 @@ var showAutoCloseSuccess = function showAutoCloseSuccess(options) {
186
196
  closable: options.closable,
187
197
  onOk: function onOk(e) {
188
198
  options.okCallback ? options.okCallback(e) : function () {};
199
+
200
+ _antd.Modal.destroyAll();
189
201
  }
190
202
  });
191
203
 
@@ -212,6 +224,8 @@ var showAutoCloseError = function showAutoCloseError(options) {
212
224
  closable: options.closable,
213
225
  onOk: function onOk(e) {
214
226
  options.okCallback ? options.okCallback(e) : function () {};
227
+
228
+ _antd.Modal.destroyAll();
215
229
  }
216
230
  });
217
231
 
@@ -238,6 +252,8 @@ var showAutoCloseWarn = function showAutoCloseWarn(options) {
238
252
  closable: options.closable,
239
253
  onOk: function onOk(e) {
240
254
  options.okCallback ? options.okCallback(e) : function () {};
255
+
256
+ _antd.Modal.destroyAll();
241
257
  }
242
258
  });
243
259
 
@@ -41,7 +41,12 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
41
41
 
42
42
  var ButtonGroup = _antd.Button.Group;
43
43
 
44
- var FormModifyModal = function FormModifyModal(props) {
44
+ var FormModifyModal = function FormModifyModal(props, ref) {
45
+ (0, _react.useImperativeMethods)(ref, function () {
46
+ return {
47
+ closeLoading: closeLoading
48
+ };
49
+ });
45
50
  var formref = props.formref,
46
51
  onOk = props.onOk,
47
52
  data = props.data,
@@ -92,6 +97,10 @@ var FormModifyModal = function FormModifyModal(props) {
92
97
  });
93
98
  };
94
99
 
100
+ var closeLoading = function closeLoading() {
101
+ setLoading(false);
102
+ };
103
+
95
104
  return /*#__PURE__*/_react["default"].createElement(_SModal["default"], {
96
105
  className: "form-modify-modal my-fix-auto-height",
97
106
  width: 1000,
@@ -126,5 +135,6 @@ var FormModifyModal = function FormModifyModal(props) {
126
135
  })))));
127
136
  };
128
137
 
129
- var _default = FormModifyModal;
138
+ var _default = /*#__PURE__*/(0, _react.forwardRef)(FormModifyModal);
139
+
130
140
  exports["default"] = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bchr/bchr-front-lib",
3
- "version": "0.3.145",
3
+ "version": "0.3.148",
4
4
  "description": "bchr front lib",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -48,7 +48,7 @@ const SmartMessage = {
48
48
  };
49
49
 
50
50
  const showConfirm = function(options){
51
- let confirmDlgHandler = Modal.confirm({
51
+ Modal.confirm({
52
52
  centered: true,
53
53
  title: options.title,
54
54
  content: options.content,
@@ -56,19 +56,16 @@ const showConfirm = function(options){
56
56
  cancelText: options.cancelText,
57
57
  zIndex: options.zIndex,
58
58
  closable: options.closable,
59
- onOk(e) {
59
+ onOk: (e) => {
60
60
  options.okCallback ? options.okCallback(e) : function () {};
61
+ Modal.destroyAll()
61
62
  },
62
- onCancel(e) {
63
+ onCancel: (e) => {
64
+ Modal.destroyAll()
63
65
  options.cancelCallback ? options.cancelCallback(e) : function() {};
64
66
  },
65
67
  autoFocusButton: null
66
68
  });
67
-
68
- return <ConfigProvider locale={zhCN}>
69
- {confirmDlgHandler}
70
- </ConfigProvider>;
71
-
72
69
  };
73
70
 
74
71
  const showInfo = function(options) {
@@ -81,6 +78,7 @@ const showInfo = function(options) {
81
78
  closable: options.closable,
82
79
  onOk(e) {
83
80
  options.okCallback ? options.okCallback(e) : function () {}
81
+ Modal.destroyAll()
84
82
  },
85
83
  });
86
84
 
@@ -99,6 +97,7 @@ const showSuccess = function(options) {
99
97
  closable: options.closable,
100
98
  onOk(e) {
101
99
  options.okCallback ? options.okCallback(e) : function () {}
100
+ Modal.destroyAll()
102
101
  },
103
102
  });
104
103
 
@@ -117,6 +116,7 @@ const showError = function(options) {
117
116
  closable: options.closable,
118
117
  onOk(e) {
119
118
  options.okCallback ? options.okCallback(e) : function () {}
119
+ Modal.destroyAll()
120
120
  },
121
121
  });
122
122
 
@@ -135,6 +135,7 @@ const showWarn = function(options) {
135
135
  closable: options.closable,
136
136
  onOk(e) {
137
137
  options.okCallback ? options.okCallback(e) : function () {}
138
+ Modal.destroyAll()
138
139
  },
139
140
  });
140
141
 
@@ -155,6 +156,7 @@ const showAutoCloseInfo = function(options) {
155
156
  closable: options.closable,
156
157
  onOk(e) {
157
158
  options.okCallback ? options.okCallback(e) : function () {}
159
+ Modal.destroyAll()
158
160
  },
159
161
  });
160
162
 
@@ -180,6 +182,7 @@ const showAutoCloseSuccess = function(options) {
180
182
  closable: options.closable,
181
183
  onOk(e) {
182
184
  options.okCallback ? options.okCallback(e) : function () {}
185
+ Modal.destroyAll()
183
186
  },
184
187
  });
185
188
 
@@ -205,6 +208,7 @@ const showAutoCloseError = function(options) {
205
208
  closable: options.closable,
206
209
  onOk(e) {
207
210
  options.okCallback ? options.okCallback(e) : function () {}
211
+ Modal.destroyAll()
208
212
  },
209
213
  });
210
214
 
@@ -230,6 +234,7 @@ const showAutoCloseWarn = function(options) {
230
234
  closable: options.closable,
231
235
  onOk(e) {
232
236
  options.okCallback ? options.okCallback(e) : function () {}
237
+ Modal.destroyAll()
233
238
  },
234
239
  });
235
240
 
@@ -1,11 +1,16 @@
1
- import React, {useEffect, useState} from 'react';
1
+ import React, {useEffect, useState, forwardRef, useImperativeMethods} from 'react';
2
2
  import SModal from "../../modal/SModal";
3
3
  import {Button, message, Spin} from "antd";
4
4
  import FormForModify from "../form/FormForModify";
5
5
  import $ from 'jquery';
6
6
 
7
7
  const ButtonGroup = Button.Group;
8
- const FormModifyModal = (props) => {
8
+ const FormModifyModal = (props, ref) => {
9
+
10
+ useImperativeMethods(ref, () => ({
11
+ closeLoading
12
+ }));
13
+
9
14
  let {
10
15
  formref,
11
16
  onOk,
@@ -42,6 +47,10 @@ const FormModifyModal = (props) => {
42
47
  });
43
48
  };
44
49
 
50
+ const closeLoading = () => {
51
+ setLoading(false);
52
+ }
53
+
45
54
  return (
46
55
  <SModal
47
56
  className="form-modify-modal my-fix-auto-height"
@@ -73,4 +82,4 @@ const FormModifyModal = (props) => {
73
82
  )
74
83
  }
75
84
 
76
- export default FormModifyModal;
85
+ export default forwardRef(FormModifyModal);