@hzab/list-render 1.9.15 → 1.9.16
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/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/src/DetailModal/index.jsx +5 -2
- package/src/list-render.jsx +6 -3
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -11,11 +11,14 @@ function DetailModal(props, parentRef) {
|
|
|
11
11
|
const { modalMode, Slots = {}, modalConf = {}, modalProps = {} } = props;
|
|
12
12
|
const [open, setOpen] = useState(false);
|
|
13
13
|
const [data, setData] = useState({});
|
|
14
|
+
const [title, setTitle] = useState("详情");
|
|
15
|
+
|
|
14
16
|
const formRef = useRef();
|
|
15
|
-
function show(formData = props.formInitialValues) {
|
|
17
|
+
function show(formData = props.formInitialValues, title) {
|
|
16
18
|
setOpen(true);
|
|
17
19
|
// 处理 formRef.current 为 undefined 的问题
|
|
18
20
|
setData(formData);
|
|
21
|
+
setTitle(title || '详情')
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
function close() {
|
|
@@ -72,7 +75,7 @@ function DetailModal(props, parentRef) {
|
|
|
72
75
|
const _modalProps = {
|
|
73
76
|
className: "detail-modal",
|
|
74
77
|
wrapClassName: "detail-modal",
|
|
75
|
-
title:
|
|
78
|
+
title: title,
|
|
76
79
|
visible: open,
|
|
77
80
|
open: open,
|
|
78
81
|
onClose: close,
|
package/src/list-render.jsx
CHANGED
|
@@ -221,7 +221,8 @@ const ListRender = forwardRef(function (props, parentRef) {
|
|
|
221
221
|
|
|
222
222
|
function onCreate() {
|
|
223
223
|
setFormState("create");
|
|
224
|
-
|
|
224
|
+
let title = props.formInitialValues?.[modalConf?.title?.createKey] || modalConf?.title?.createText || '新增'
|
|
225
|
+
formModalRef.current.show(props.formInitialValues, title);
|
|
225
226
|
}
|
|
226
227
|
|
|
227
228
|
async function onCreateSubmit(data) {
|
|
@@ -268,7 +269,8 @@ const ListRender = forwardRef(function (props, parentRef) {
|
|
|
268
269
|
|
|
269
270
|
function handleDetail(data, id) {
|
|
270
271
|
setRowId(id);
|
|
271
|
-
|
|
272
|
+
let title = data[modalConf?.title?.detailKey] || modalConf?.title?.detailText || '详情'
|
|
273
|
+
detailModalRef.current.show(data, title);
|
|
272
274
|
}
|
|
273
275
|
|
|
274
276
|
function onEdit(row, idx) {
|
|
@@ -297,7 +299,8 @@ const ListRender = forwardRef(function (props, parentRef) {
|
|
|
297
299
|
function handleEdit(data, id) {
|
|
298
300
|
setRowId(id);
|
|
299
301
|
setFormState("edit");
|
|
300
|
-
|
|
302
|
+
let title = data[modalConf?.title?.editKey] || modalConf?.title?.editText || '编辑'
|
|
303
|
+
formModalRef.current.show(data, title, "edit");
|
|
301
304
|
}
|
|
302
305
|
|
|
303
306
|
async function onEditSubmit(data) {
|