- {Object.keys(p.value).map(name =>
- p.getSubField({
+
+ {Object.keys(p.value).map(name => {
+ return p.getSubField({
name,
value: p.value[name],
onChange(key, val, objValue) {
@@ -33,8 +39,8 @@ export default function map(p) {
p.onChange(p.name, value);
},
rootValue: p.value,
- })
- )}
+ });
+ })}
);
}
diff --git a/src/widgets/antd/list.jsx b/src/widgets/antd/list.jsx
index d86a226f7..e09d8ed83 100644
--- a/src/widgets/antd/list.jsx
+++ b/src/widgets/antd/list.jsx
@@ -3,11 +3,11 @@
* 数组组件
*/
-import React from 'react';
+import React, { useState } from 'react';
import listHoc from '../../components/listHoc';
import * as Icons from '@ant-design/icons';
-
-import { Button } from 'antd';
+import { isObj } from '../../base/utils';
+import { Button, Modal, Drawer } from 'antd';
function FrButton({ icon, children, ...rest }) {
let iconName;
@@ -25,12 +25,71 @@ function FrButton({ icon, children, ...rest }) {
const IconComponent = Icons[iconName];
if (IconComponent) {
return (
-
}>
+
}>
{children}
);
}
- return
;
+ return (
+
+ );
}
-export default listHoc(FrButton);
+const List = listHoc(FrButton);
+
+const ListWithModal = props => {
+ const { options, schema } = props || {};
+ const [show, setShow] = useState(false);
+ const toggle = () => setShow(o => !o);
+ if (options && options.modal) {
+ const config = isObj(options.modal) ? options.modal : {};
+ const { text } = config;
+ return (
+
+ );
+ }
+ if (options && options.drawer) {
+ const config = isObj(options.drawer) ? options.drawer : {};
+ const { text } = config;
+ return (
+
+ );
+ }
+ return
;
+};
+
+export default ListWithModal;
diff --git a/src/widgets/antd/map.jsx b/src/widgets/antd/map.jsx
index 7f4689d65..9f344127c 100644
--- a/src/widgets/antd/map.jsx
+++ b/src/widgets/antd/map.jsx
@@ -1,2 +1,55 @@
-import map from '../../components/map';
-export default map;
+import React, { useState } from 'react';
+import { Modal, Drawer } from 'antd';
+import { isObj } from '../../base/utils';
+import Map from '../../components/map';
+
+const MapWithModal = props => {
+ const { options = {}, schema } = props || {};
+ const [show, setShow] = useState(false);
+ const toggle = () => setShow(o => !o);
+ if (options && options.modal) {
+ const config = isObj(options.modal) ? options.modal : {};
+ const { text } = config;
+ return (
+
+ );
+ }
+ if (options && options.drawer) {
+ const config = isObj(options.drawer) ? options.drawer : {};
+ const { text } = config;
+ return (
+
+ );
+ }
+ return
;
+};
+
+export default MapWithModal;
diff --git a/src/widgets/fusion/list.jsx b/src/widgets/fusion/list.jsx
index ed3c0f62c..b7b53c74f 100644
--- a/src/widgets/fusion/list.jsx
+++ b/src/widgets/fusion/list.jsx
@@ -1,6 +1,7 @@
-import React from 'react';
-import { Button, Icon } from '@alifd/next';
+import React, { useState } from 'react';
+import { Button, Icon, Dialog as Modal, Drawer } from '@alifd/next';
import listHoc from '../../components/listHoc';
+import { isObj } from '../../base/utils';
function FrButton({ icon, children, type, ...rest }) {
let iconName;
@@ -23,4 +24,58 @@ function FrButton({ icon, children, type, ...rest }) {
);
}
-export default listHoc(FrButton);
+const List = listHoc(FrButton);
+
+const ListWithModal = props => {
+ const { options, schema } = props || {};
+ const [show, setShow] = useState(false);
+ const toggle = () => setShow(o => !o);
+ if (options && options.modal) {
+ const config = isObj(options.modal) ? options.modal : {};
+ const { text } = config;
+ return (
+
+ );
+ }
+ if (options && options.drawer) {
+ const config = isObj(options.drawer) ? options.drawer : {};
+ const { text } = config;
+ return (
+
+ );
+ }
+ return
;
+};
+
+export default ListWithModal;
diff --git a/src/widgets/fusion/map.jsx b/src/widgets/fusion/map.jsx
index 7f4689d65..117f8c9e0 100644
--- a/src/widgets/fusion/map.jsx
+++ b/src/widgets/fusion/map.jsx
@@ -1,2 +1,54 @@
-import map from '../../components/map';
-export default map;
+import React, { useState } from 'react';
+import { Dialog as Modal, Drawer } from '@alifd/next';
+import { isObj } from '../../base/utils';
+import Map from '../../components/map';
+
+const MapWithModal = props => {
+ const { options = {}, schema } = props || {};
+ const [show, setShow] = useState(false);
+ const toggle = () => setShow(o => !o);
+ if (options && options.modal) {
+ const config = isObj(options.modal) ? options.modal : {};
+ const { text } = config;
+ return (
+
+ );
+ }
+ if (options && options.drawer) {
+ const config = isObj(options.drawer) ? options.drawer : {};
+ const { text } = config;
+ return (
+
+ );
+ }
+ return
;
+};
+
+export default MapWithModal;