@cloudbase/weda-ui 2.0.9 → 2.0.12
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/README.md +1 -0
- package/package.json +13 -5
- package/src/configs/components/button.json +60 -13
- package/src/configs/components/calendar.json +3 -3
- package/src/configs/components/carousel.json +57 -47
- package/src/configs/components/chart/bar.json +4 -13
- package/src/configs/components/chart/line.json +4 -13
- package/src/configs/components/chart/pie.json +3 -10
- package/src/configs/components/chart/statisticsCard.json +1 -4
- package/src/configs/components/container.json +1 -3
- package/src/configs/components/dataView.json +7 -15
- package/src/configs/components/drawer.json +24 -6
- package/src/configs/components/form/form.json +19 -0
- package/src/configs/components/form/input.json +20 -5
- package/src/configs/components/form/location.json +51 -48
- package/src/configs/components/form/radio.json +1 -3
- package/src/configs/components/form/richText.json +14 -14
- package/src/configs/components/form/select.json +62 -82
- package/src/configs/components/form/textarea.json +6 -1
- package/src/configs/components/form/uploader.json +64 -64
- package/src/configs/components/form/uploaderFile.json +1 -2
- package/src/configs/components/graphicCard.json +43 -44
- package/src/configs/components/image.json +44 -40
- package/src/configs/components/link.json +5 -10
- package/src/configs/components/listView.json +2 -8
- package/src/configs/components/lottery.json +7 -3
- package/src/configs/components/modal.json +26 -21
- package/src/configs/components/navLayout.json +66 -67
- package/src/configs/components/navigationBar.json +4 -1
- package/src/configs/components/richtextview.json +1 -1
- package/src/configs/components/scrollVeiw.json +14 -42
- package/src/configs/components/swiper.json +9 -9
- package/src/configs/components/wedaVideo.json +86 -0
- package/src/configs/components/wxOpenApi/phone.json +7 -21
- package/src/configs/components/wxOpenApi/phoneCode.json +7 -19
- package/src/configs/components/wxOpenApi/share.json +14 -24
- package/src/configs/components/wxOpenApi/userInfo.json +9 -27
- package/src/configs/index.js +2 -0
- package/src/docs/common/format.tsx +4 -1
- package/src/docs/common/tableView.css +3 -3
- package/src/docs/common/tableView.tsx +18 -8
- package/src/docs/compsdocs/form/FormLocation.mdx +1 -1
- package/src/docs/compsdocs/form/FormSelect.mdx +0 -1
- package/src/docs/compsdocs/grid/Card.mdx +0 -1
- package/src/docs/compsdocs/grid/Container.mdx +0 -1
- package/src/docs/compsdocs/grid/GridLayout.mdx +0 -1
- package/src/docs/compsdocs/grid/ScrollView.mdx +2 -2
- package/src/docs/compsdocs/grid/Swiper.mdx +1 -2
- package/src/docs/compsdocs/media/Icon.mdx +1 -1
- package/src/docs/compsdocs/media/Image.mdx +6 -6
- package/src/docs/compsdocs/model/ModelCreate.mdx +24 -0
- package/src/docs/compsdocs/model/ModelDetail.mdx +24 -0
- package/src/docs/compsdocs/model/ModelTable.mdx +133 -1
- package/src/docs/compsdocs/model/ModelUpdate.mdx +24 -1
- package/src/docs/compsdocs/navmenu/Classification.mdx +2 -3
- package/src/docs/compsdocs/navmenu/NavBar.mdx +14 -5
- package/src/docs/compsdocs/navmenu/NavLayout.mdx +0 -1
- package/src/docs/compsdocs/navmenu/TabBar.mdx +3 -3
- package/src/docs/compsdocs/navmenu/TabBarItem.mdx +1 -1
- package/src/docs/compsdocs/senior/Lottery.mdx +3 -6
- package/src/docs/compsdocs/senior/Modal.mdx +2 -3
- package/src/docs/compsdocs/senior/SlotMachine.mdx +2 -5
- package/src/docs/compsdocs/senior/_category_.json +1 -1
- package/src/docs/compsdocs/show/GraphicCard.mdx +0 -1
- package/src/docs/compsdocs/show/Item.mdx +0 -1
- package/src/docs/compsdocs/show/ItemList.mdx +1 -0
- package/src/docs/compsdocs/show/Tabs.mdx +2 -3
- package/src/docs/compsdocs/text/Link.mdx +1 -1
- package/src/docs/compsdocs/text/RichTextView.mdx +1 -2
- package/src/docs/compsdocs/text/Text.mdx +1 -1
- package/src/docs/compsdocs/text/Title.mdx +1 -2
- package/src/docs/compsdocs/wxOpen/Phone.mdx +1 -2
- package/src/docs/compsdocs/wxOpen/Share.mdx +0 -1
- package/src/docs/compsdocs/wxOpen/UserInfo.mdx +1 -2
- package/src/mp/components/button/index.js +1 -1
- package/src/mp/components/button/index.wxml +19 -19
- package/src/mp/components/calendar/index.js +64 -37
- package/src/mp/components/calendar/index.json +1 -1
- package/src/mp/components/calendar/index.wxml +4 -6
- package/src/mp/components/carousel/index.json +1 -1
- package/src/mp/components/carousel/index.wxml +2 -2
- package/src/mp/components/chart/bar/index.js +1 -2
- package/src/mp/components/chart/bar/index.wxml +1 -1
- package/src/mp/components/chart/common/config/bar.js +1 -1
- package/src/mp/components/chart/common/core/eChartBar.js +29 -34
- package/src/mp/components/chart/common/core/eChartBase.js +46 -32
- package/src/mp/components/chart/common/core/eChartLine.js +34 -40
- package/src/mp/components/chart/common/core/eChartPie.js +12 -9
- package/src/mp/components/chart/ec-canvas/ec-canvas.json +1 -1
- package/src/mp/components/chart/ec-canvas/wx-canvas.js +24 -22
- package/src/mp/components/chart/line/index.js +2 -2
- package/src/mp/components/chart/line/index.wxml +1 -1
- package/src/mp/components/chart/pie/index.js +1 -1
- package/src/mp/components/chart/pie/index.wxml +1 -2
- package/src/mp/components/dataView/index.wxml +2 -14
- package/src/mp/components/form/checkbox/index.js +10 -6
- package/src/mp/components/form/checkbox/index.wxml +13 -25
- package/src/mp/components/form/form/index.wxml +3 -3
- package/src/mp/components/form/formcell/index.wxml +9 -9
- package/src/mp/components/form/formcell/index.wxss +6 -1
- package/src/mp/components/form/input/index.js +3 -3
- package/src/mp/components/form/input/index.wxml +24 -31
- package/src/mp/components/form/input/index.wxss +9 -3
- package/src/mp/components/form/location/components/mapChoose/index.json +1 -1
- package/src/mp/components/form/location/components/mapChoose/index.wxml +6 -6
- package/src/mp/components/form/location/index.js +7 -1
- package/src/mp/components/form/location/index.json +1 -1
- package/src/mp/components/form/location/index.wxml +6 -10
- package/src/mp/components/form/radio/index.js +9 -5
- package/src/mp/components/form/radio/index.wxml +12 -24
- package/src/mp/components/form/select/index.js +156 -97
- package/src/mp/components/form/select/index.wxml +11 -39
- package/src/mp/components/form/select/index.wxss +14 -3
- package/src/mp/components/form/select/region/index.js +18 -12
- package/src/mp/components/form/switch/index.wxml +11 -18
- package/src/mp/components/form/textarea/index.wxml +2 -17
- package/src/mp/components/form/textarea/index.wxss +5 -0
- package/src/mp/components/form/tips/index.wxml +1 -3
- package/src/mp/components/form/uploader/index.js +1 -1
- package/src/mp/components/form/uploader/index.wxml +3 -20
- package/src/mp/components/form/uploader/weui-uploader.js +210 -200
- package/src/mp/components/form/uploader/weui-uploader.json +6 -6
- package/src/mp/components/form/uploader/weui-uploader.wxml +38 -38
- package/src/mp/components/form/uploaderFile/index.js +5 -4
- package/src/mp/components/form/uploaderFile/index.wxml +40 -41
- package/src/mp/components/graphicCard/index.js +35 -35
- package/src/mp/components/graphicCard/index.wxml +2 -6
- package/src/mp/components/image/index.wxml +9 -20
- package/src/mp/components/image/index.wxss +3 -1
- package/src/mp/components/listView/index.wxml +5 -7
- package/src/mp/components/lottery/index.wxml +1 -3
- package/src/mp/components/lottery/index.wxss +31 -25
- package/src/mp/components/navLayout/index.js +9 -12
- package/src/mp/components/navLayout/index.wxml +2 -4
- package/src/mp/components/navigationBar/index.json +1 -2
- package/src/mp/components/navigationBar/index.wxml +43 -51
- package/src/mp/components/swiper/index.wxml +1 -9
- package/src/mp/components/tabs/index.js +14 -10
- package/src/mp/components/tabs/index.json +1 -1
- package/src/mp/components/tabs/index.wxml +3 -21
- package/src/mp/components/text/index.wxml +1 -6
- package/src/mp/components/text/index.wxss +1 -1
- package/src/mp/components/wedaVideo/index.js +86 -0
- package/src/mp/components/wedaVideo/index.json +4 -0
- package/src/mp/components/wedaVideo/index.wxml +4 -0
- package/src/mp/components/wedaVideo/index.wxss +20 -0
- package/src/mp/components/wxOpenApi/phone/index.js +1 -9
- package/src/mp/components/wxOpenApi/phone/index.wxml +3 -14
- package/src/mp/components/wxOpenApi/phoneCode/index.json +1 -1
- package/src/mp/components/wxOpenApi/phoneCode/index.wxml +3 -14
- package/src/mp/components/wxOpenApi/share/index.wxml +3 -14
- package/src/mp/components/wxOpenApi/userInfo/index.wxml +3 -13
- package/src/mp/index.json +1 -0
- package/src/mp/style/weda-ui.wxss +20 -7
- package/src/mp/utils/deepEqual.js +37 -37
- package/src/mp/utils/destr.js +41 -40
- package/src/mp/utils/dr_square_point.js +10 -6
- package/src/setupTests.js +13 -13
- package/src/web/actions/showModal/index.tsx +5 -4
- package/src/web/components/button/index.tsx +44 -40
- package/src/web/components/calendar/index.css +81 -34
- package/src/web/components/carousel/index.tsx +1 -1
- package/src/web/components/chart/common/config/bar.js +1 -1
- package/src/web/components/chart/common/core/eChartBar.js +28 -34
- package/src/web/components/chart/common/core/eChartBase.ts +55 -42
- package/src/web/components/chart/common/core/eChartLine.js +34 -40
- package/src/web/components/chart/common/core/eChartPie.js +12 -9
- package/src/web/components/chart/common/core/type.ts +23 -23
- package/src/web/components/chart/common/echart.css +12 -12
- package/src/web/components/chart/common/echarts.ts +3 -5
- package/src/web/components/chart/common/useChart.tsx +34 -16
- package/src/web/components/container/index.tsx +3 -4
- package/src/web/components/drawer/index.tsx +15 -4
- package/src/web/components/form/checkbox/index.tsx +32 -31
- package/src/web/components/form/enumSelect/NormalSelect.tsx +0 -2
- package/src/web/components/form/form/index.css +3 -6
- package/src/web/components/form/form/index.tsx +7 -6
- package/src/web/components/form/formcell/index.css +10 -4
- package/src/web/components/form/formcell/index.tsx +3 -7
- package/src/web/components/form/input/index.css +4 -4
- package/src/web/components/form/input/index.tsx +61 -53
- package/src/web/components/form/location/common/selectModal.jsx +2 -11
- package/src/web/components/form/location/common/useLocationInfo.js +4 -0
- package/src/web/components/form/location/components/LocationH5/index.css +0 -1
- package/src/web/components/form/location/components/LocationH5/location.h5.jsx +11 -1
- package/src/web/components/form/location/components/LocationPC/Header.jsx +0 -13
- package/src/web/components/form/location/components/LocationPC/location.PC.jsx +14 -5
- package/src/web/components/form/radio/index.tsx +32 -26
- package/src/web/components/form/renderDecorator.tsx +23 -26
- package/src/web/components/form/select/h5.tsx +154 -103
- package/src/web/components/form/select/index.css +9 -3
- package/src/web/components/form/select/index.tsx +75 -48
- package/src/web/components/form/select/region/index.ts +101 -80
- package/src/web/components/form/select/year.tsx +2 -0
- package/src/web/components/form/switch/index.tsx +40 -40
- package/src/web/components/form/textarea/index.css +4 -0
- package/src/web/components/form/textarea/index.tsx +27 -26
- package/src/web/components/form/types.d.ts +10 -10
- package/src/web/components/form/uploader/uploader.h5.tsx +26 -20
- package/src/web/components/form/uploaderFile/index.jsx +0 -5
- package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +15 -11
- package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +14 -9
- package/src/web/components/image/image.tsx +2 -2
- package/src/web/components/image/index.css +9 -7
- package/src/web/components/image/index.tsx +29 -12
- package/src/web/components/index.js +1 -0
- package/src/web/components/link/index.tsx +13 -13
- package/src/web/components/lottery/index.css +43 -37
- package/src/web/components/lottery/index.tsx +2 -2
- package/src/web/components/modal/index.tsx +34 -34
- package/src/web/components/navLayout/index.tsx +1 -1
- package/src/web/components/navigationBar/index.tsx +2 -2
- package/src/web/components/picker/datePicker.tsx +3 -3
- package/src/web/components/picker/picker.tsx +3 -3
- package/src/web/components/picker/timePicker.tsx +1 -1
- package/src/web/components/richText/index.jsx +41 -46
- package/src/web/components/richTextView/index.tsx +4 -6
- package/src/web/components/scrollView/index.tsx +2 -2
- package/src/web/components/slot/index.tsx +3 -4
- package/src/web/components/swiper/index.css +1 -1
- package/src/web/components/swiper/index.tsx +33 -15
- package/src/web/components/tabs/index.css +1 -1
- package/src/web/components/tabs/index.tsx +6 -6
- package/src/web/components/tabs/tabs.h5.tsx +17 -12
- package/src/web/components/tabs/tabs.pc.tsx +45 -34
- package/src/web/components/text/index.css +1 -1
- package/src/web/components/text/index.tsx +13 -14
- package/src/web/components/wedaVideo/index.css +42 -0
- package/src/web/components/wedaVideo/index.tsx +198 -0
- package/src/web/utils/constant.ts +2 -1
- package/src/web/utils/isObjectEqual.js +2 -1
- package/src/web/utils/loading-fallback.tsx +2 -2
- package/src/web/utils/lodash.ts +1 -1
- package/src/web/utils/useSetState.ts +6 -2
- package/src/web/weda-ui.css +17 -0
|
@@ -17,17 +17,17 @@
|
|
|
17
17
|
}
|
|
18
18
|
.weda-ui-echart .echart-light-box {
|
|
19
19
|
position: relative;
|
|
20
|
-
background-color: #
|
|
20
|
+
background-color: #f4f5f6;
|
|
21
21
|
}
|
|
22
22
|
.weda-ui-echart .echart-light-body {
|
|
23
23
|
background-color: #ffffff;
|
|
24
24
|
}
|
|
25
25
|
.weda-ui-echart .echart-dark-box {
|
|
26
26
|
position: relative;
|
|
27
|
-
background-color: #
|
|
27
|
+
background-color: #4b5d6c;
|
|
28
28
|
}
|
|
29
29
|
.weda-ui-echart .echart-dark-body {
|
|
30
|
-
background-color: #
|
|
30
|
+
background-color: #1d1f24;
|
|
31
31
|
margin: 6px;
|
|
32
32
|
}
|
|
33
33
|
.weda-ui-echart .btn-grounp {
|
|
@@ -67,20 +67,20 @@
|
|
|
67
67
|
user-select: none;
|
|
68
68
|
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
69
69
|
position: relative;
|
|
70
|
-
color: #
|
|
70
|
+
color: #4b5d6c;
|
|
71
71
|
background-color: #fff;
|
|
72
|
-
border-color: #
|
|
72
|
+
border-color: #ccd2d8;
|
|
73
73
|
}
|
|
74
74
|
.weda-ui-echart .button,
|
|
75
|
-
.weda-ui-echart html [type=
|
|
76
|
-
.weda-ui-echart [type=
|
|
77
|
-
.weda-ui-echart [type=
|
|
75
|
+
.weda-ui-echart html [type='button'],
|
|
76
|
+
.weda-ui-echart [type='reset'],
|
|
77
|
+
.weda-ui-echart [type='submit'] {
|
|
78
78
|
-webkit-appearance: button;
|
|
79
79
|
}
|
|
80
80
|
.weda-ui-echart .ant-btn-primary {
|
|
81
81
|
color: #fff;
|
|
82
|
-
background-color: #
|
|
83
|
-
border-color: #
|
|
82
|
+
background-color: #4a62e7;
|
|
83
|
+
border-color: #4a62e7;
|
|
84
84
|
}
|
|
85
85
|
.weda-ui-echart .ant-btn:not([disabled]):hover {
|
|
86
86
|
text-decoration: none;
|
|
@@ -94,9 +94,9 @@
|
|
|
94
94
|
}
|
|
95
95
|
.weda-ui-echart .ant-btn:hover,
|
|
96
96
|
.weda-ui-echart .ant-btn:focus {
|
|
97
|
-
color: #
|
|
97
|
+
color: #4a62e7;
|
|
98
98
|
background-color: #fff;
|
|
99
|
-
border-color: #
|
|
99
|
+
border-color: #4a62e7;
|
|
100
100
|
}
|
|
101
101
|
.weda-ui-echart .ant-btn-primary:hover,
|
|
102
102
|
.weda-ui-echart .ant-btn-primary:focus {
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
TitleComponent,
|
|
8
8
|
TooltipComponent,
|
|
9
9
|
LegendComponent,
|
|
10
|
-
GridComponent
|
|
10
|
+
GridComponent,
|
|
11
11
|
} from 'echarts/components';
|
|
12
12
|
// 标签自动布局,全局过渡动画等特性
|
|
13
13
|
import { LabelLayout, UniversalTransition } from 'echarts/features';
|
|
@@ -25,9 +25,7 @@ echarts.use([
|
|
|
25
25
|
CanvasRenderer,
|
|
26
26
|
BarChart,
|
|
27
27
|
LineChart,
|
|
28
|
-
PieChart
|
|
28
|
+
PieChart,
|
|
29
29
|
]);
|
|
30
30
|
|
|
31
|
-
export {
|
|
32
|
-
echarts
|
|
33
|
-
};
|
|
31
|
+
export { echarts };
|
|
@@ -1,14 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
useAsync,
|
|
3
|
+
useDeepCompareEffect,
|
|
4
|
+
useEventListener,
|
|
5
|
+
useIsMounted,
|
|
6
|
+
useMountEffect,
|
|
7
|
+
} from '@react-hookz/web';
|
|
8
|
+
import {
|
|
9
|
+
MutableRefObject,
|
|
10
|
+
RefObject,
|
|
11
|
+
useCallback,
|
|
12
|
+
useEffect,
|
|
13
|
+
useMemo,
|
|
14
|
+
useRef,
|
|
15
|
+
} from 'react';
|
|
16
|
+
import { IEchartModalBase } from './core/eChartBase';
|
|
17
|
+
import { echarts } from './echarts';
|
|
5
18
|
|
|
6
|
-
export function useChart(
|
|
19
|
+
export function useChart(
|
|
20
|
+
ref: RefObject<HTMLElement> | MutableRefObject<HTMLElement>
|
|
21
|
+
) {
|
|
7
22
|
const chartRef = useRef<echarts.ECharts>();
|
|
8
23
|
const isMounted = useIsMounted();
|
|
9
24
|
useMountEffect(() => {
|
|
10
|
-
|
|
11
|
-
if(!ref.current || !isMounted) {
|
|
25
|
+
if (!ref.current || !isMounted) {
|
|
12
26
|
return;
|
|
13
27
|
}
|
|
14
28
|
|
|
@@ -28,16 +42,19 @@ export function useChart(ref: RefObject<HTMLElement> | MutableRefObject<HTMLElem
|
|
|
28
42
|
return chartRef.current;
|
|
29
43
|
}
|
|
30
44
|
|
|
31
|
-
|
|
32
45
|
/**
|
|
33
46
|
* @deprecated The method should not be used
|
|
34
47
|
*/
|
|
35
|
-
export function useWedaChart(
|
|
48
|
+
export function useWedaChart(
|
|
49
|
+
domRef,
|
|
50
|
+
ModalClass: IEchartModalBase,
|
|
51
|
+
options: echarts.EChartsCoreOption
|
|
52
|
+
) {
|
|
36
53
|
const chart = useChart(domRef);
|
|
37
|
-
const getOptions = async() => {
|
|
54
|
+
const getOptions = async () => {
|
|
38
55
|
const chartModal = new ModalClass();
|
|
39
56
|
let finalOptions: any = await chartModal.setOptions(options);
|
|
40
|
-
if(!finalOptions) {
|
|
57
|
+
if (!finalOptions) {
|
|
41
58
|
finalOptions = chartModal.getOptions() as any;
|
|
42
59
|
}
|
|
43
60
|
return finalOptions;
|
|
@@ -50,18 +67,19 @@ export function useWedaChart(domRef, ModalClass: IEchartModalBase, options: echa
|
|
|
50
67
|
useDeepCompareEffect(() => {
|
|
51
68
|
actions.execute();
|
|
52
69
|
}, [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
70
|
+
// options 变化,包含所有配置项,包括纯前端的配置项变化都会触发setOptions里发请求,但改不动了
|
|
71
|
+
options,
|
|
72
|
+
actions,
|
|
73
|
+
]);
|
|
56
74
|
useEffect(() => {
|
|
57
|
-
if(state.status === 'success' && chart) {
|
|
75
|
+
if (state.status === 'success' && chart) {
|
|
58
76
|
console.log(ModalClass.name, options, state.result, window.location.href);
|
|
59
77
|
chart.setOption(
|
|
60
78
|
state.result,
|
|
61
79
|
true // noMerge 全刷
|
|
62
80
|
);
|
|
63
81
|
} else {
|
|
64
|
-
if(state.status === 'error') {
|
|
82
|
+
if (state.status === 'error') {
|
|
65
83
|
console.error(state.error);
|
|
66
84
|
}
|
|
67
85
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { CommonPropsType } from '../../types';
|
|
2
|
+
import type { CommonPropsType } from '../../types';
|
|
3
3
|
import classNames from '../../utils/classnames';
|
|
4
4
|
|
|
5
5
|
export default function Container({
|
|
@@ -8,7 +8,7 @@ export default function Container({
|
|
|
8
8
|
events = {},
|
|
9
9
|
className,
|
|
10
10
|
style,
|
|
11
|
-
id
|
|
11
|
+
id,
|
|
12
12
|
}: PropsType) {
|
|
13
13
|
return (
|
|
14
14
|
<div
|
|
@@ -31,5 +31,4 @@ export default function Container({
|
|
|
31
31
|
|
|
32
32
|
export interface PropsType extends CommonPropsType {
|
|
33
33
|
title?: string;
|
|
34
|
-
|
|
35
|
-
}
|
|
34
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ConfigProvider, Drawer, DrawerProps } from 'tea-component';
|
|
3
|
-
import { CommonPropsType } from '../../types';
|
|
3
|
+
import type { CommonPropsType } from '../../types';
|
|
4
4
|
|
|
5
5
|
const TeaDrawer = ({
|
|
6
6
|
size,
|
|
@@ -38,19 +38,30 @@ const TeaDrawer = ({
|
|
|
38
38
|
disableCloseIcon={disableCloseIcon}
|
|
39
39
|
outerClickClosable={outerClickClosable}
|
|
40
40
|
{...eventsList}
|
|
41
|
-
|
|
41
|
+
>
|
|
42
42
|
{childrenSlot}
|
|
43
43
|
</Drawer>
|
|
44
44
|
</ConfigProvider>
|
|
45
45
|
);
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
export interface PropsType
|
|
48
|
+
export interface PropsType
|
|
49
|
+
extends CommonPropsType,
|
|
50
|
+
Pick<
|
|
51
|
+
DrawerProps,
|
|
52
|
+
| 'size'
|
|
53
|
+
| 'title'
|
|
54
|
+
| 'showMask'
|
|
55
|
+
| 'placement'
|
|
56
|
+
| 'disableCloseIcon'
|
|
57
|
+
| 'outerClickClosable'
|
|
58
|
+
| 'subtitle'
|
|
59
|
+
> {
|
|
49
60
|
visible: boolean;
|
|
50
61
|
title?: string;
|
|
51
62
|
extraSlot?: React.ReactNode;
|
|
52
63
|
footerSlot?: React.ReactNode;
|
|
53
|
-
childrenSlot?: React.ReactNode;
|
|
64
|
+
childrenSlot?: React.ReactNode;
|
|
54
65
|
}
|
|
55
66
|
|
|
56
67
|
export default TeaDrawer;
|
|
@@ -7,7 +7,7 @@ import isObjectEqual from '../../../utils/isObjectEqual';
|
|
|
7
7
|
import fromEntries from 'object.fromentries';
|
|
8
8
|
import { usePlatform } from '../../../utils/platform';
|
|
9
9
|
import { renderDecorator } from '../renderDecorator';
|
|
10
|
-
import { CommonFormPropsType } from '../types';
|
|
10
|
+
import type { CommonFormPropsType } from '../types';
|
|
11
11
|
import { callWedaApi } from '../../../utils/tcb';
|
|
12
12
|
import destr from 'destr';
|
|
13
13
|
|
|
@@ -27,7 +27,7 @@ export default function Checkbox({
|
|
|
27
27
|
layout = 'horizontal',
|
|
28
28
|
disabled = false,
|
|
29
29
|
requiredFlag = false,
|
|
30
|
-
decorator
|
|
30
|
+
decorator,
|
|
31
31
|
}: PropsType) {
|
|
32
32
|
const cls = classNames({
|
|
33
33
|
'weda-ui': true,
|
|
@@ -46,7 +46,8 @@ export default function Checkbox({
|
|
|
46
46
|
|
|
47
47
|
const [option, setOption] = useState(range);
|
|
48
48
|
const [checkedItems, setCheckedItems] = React.useState(
|
|
49
|
-
platform === 'h5'
|
|
49
|
+
platform === 'h5'
|
|
50
|
+
? fromEntries(option.map(({ value, checked }) => [value, !!checked]))
|
|
50
51
|
: option.filter(({ checked }) => checked).map(({ value }) => value)
|
|
51
52
|
);
|
|
52
53
|
// 两次range不同时, 需要刷新checkedItems
|
|
@@ -69,23 +70,25 @@ export default function Checkbox({
|
|
|
69
70
|
|
|
70
71
|
useEffect(() => {
|
|
71
72
|
if (format !== 'x-enum') {
|
|
72
|
-
setOption(range)
|
|
73
|
+
setOption(range);
|
|
73
74
|
}
|
|
74
75
|
}, [range]);
|
|
75
76
|
|
|
76
|
-
const fetchData = async (param:
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
const fetchData = async (param: {
|
|
78
|
+
OptNameList?: object;
|
|
79
|
+
PageIndex?: number;
|
|
80
|
+
PageSize?: number;
|
|
81
|
+
}) => {
|
|
79
82
|
let data = await callWedaApi({
|
|
80
83
|
action: 'DescribeGeneralOptionsDetailList',
|
|
81
84
|
data: param,
|
|
82
85
|
});
|
|
83
86
|
const config = destr(data?.Items?.[0]?.Config) ?? [];
|
|
84
|
-
const enumOption = config.map(item => {
|
|
87
|
+
const enumOption = config.map((item) => {
|
|
85
88
|
return {
|
|
86
89
|
label: item.value,
|
|
87
90
|
value: item.key,
|
|
88
|
-
checked: false
|
|
91
|
+
checked: false,
|
|
89
92
|
};
|
|
90
93
|
});
|
|
91
94
|
setOption(enumOption);
|
|
@@ -153,9 +156,8 @@ export default function Checkbox({
|
|
|
153
156
|
disabled={disabled}
|
|
154
157
|
value={Object.entries(checkedItems)
|
|
155
158
|
.filter(([, checked]) => checked)
|
|
156
|
-
.map(([value]) => value)
|
|
157
|
-
|
|
158
|
-
onChange={value => {
|
|
159
|
+
.map(([value]) => value)}
|
|
160
|
+
onChange={(value) => {
|
|
159
161
|
const newMap = option
|
|
160
162
|
.map((opt) => opt.value)
|
|
161
163
|
.reduce((acc, cur) => {
|
|
@@ -168,13 +170,11 @@ export default function Checkbox({
|
|
|
168
170
|
return acc;
|
|
169
171
|
}, {});
|
|
170
172
|
setCheckedItems(newMap);
|
|
171
|
-
events.change(
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
},
|
|
177
|
-
);
|
|
173
|
+
events.change({
|
|
174
|
+
value: Object.entries(newMap)
|
|
175
|
+
.filter(([, checked]) => checked)
|
|
176
|
+
.map(([value]) => value),
|
|
177
|
+
});
|
|
178
178
|
}}
|
|
179
179
|
>
|
|
180
180
|
{option.map(({ value, label }, index) => {
|
|
@@ -189,21 +189,22 @@ export default function Checkbox({
|
|
|
189
189
|
</ConfigProvider>
|
|
190
190
|
);
|
|
191
191
|
}
|
|
192
|
-
return renderDecorator(
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
192
|
+
return renderDecorator(
|
|
193
|
+
checkboxElement,
|
|
194
|
+
decorator
|
|
195
|
+
)({
|
|
196
|
+
id,
|
|
197
|
+
className: cls,
|
|
198
|
+
style,
|
|
199
|
+
label: labelVisible ? label : null,
|
|
200
|
+
layout,
|
|
201
|
+
multiCell: true,
|
|
202
|
+
requiredFlag,
|
|
203
|
+
});
|
|
203
204
|
}
|
|
204
205
|
|
|
205
206
|
export interface PropsType extends CommonFormPropsType {
|
|
206
|
-
range?: { label: string
|
|
207
|
+
range?: { label: string; value: any; [key: string]: any }[];
|
|
207
208
|
format?: string;
|
|
208
209
|
enumName?: string;
|
|
209
210
|
}
|
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
color: inherit;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
.
|
|
6
|
-
.
|
|
7
|
-
padding-left: 32px;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.weda-ui.weda-form-pc, .weda-ui.gsd-h5-react-form-pc {
|
|
5
|
+
.weda-ui.weda-form-pc,
|
|
6
|
+
.weda-ui.gsd-h5-react-form-pc {
|
|
11
7
|
padding-left: 24px;
|
|
8
|
+
padding-right: 24px;
|
|
12
9
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import classNames from '../../../utils/classnames';
|
|
3
3
|
import './index.css';
|
|
4
|
-
import {ConfigProvider, Form as TeaForm} from 'tea-component';
|
|
4
|
+
import { ConfigProvider, Form as TeaForm } from 'tea-component';
|
|
5
5
|
import { usePlatform } from '../../../utils/platform';
|
|
6
|
-
import { CommonFormPropsType } from '../types';
|
|
6
|
+
import type { CommonFormPropsType } from '../types';
|
|
7
7
|
|
|
8
8
|
export default function Form({
|
|
9
9
|
// 系统属性
|
|
@@ -16,6 +16,7 @@ export default function Form({
|
|
|
16
16
|
// buttonSlot,
|
|
17
17
|
style,
|
|
18
18
|
id,
|
|
19
|
+
layout,
|
|
19
20
|
}) {
|
|
20
21
|
const platform = usePlatform();
|
|
21
22
|
const cls = classNames({
|
|
@@ -26,14 +27,14 @@ export default function Form({
|
|
|
26
27
|
'gsd-h5-react-form-pc': platform === 'pc',
|
|
27
28
|
[className]: className,
|
|
28
29
|
});
|
|
29
|
-
if(platform === 'pc') {
|
|
30
|
+
if (platform === 'pc') {
|
|
30
31
|
return (
|
|
31
32
|
<ConfigProvider classPrefix="wedatea2td">
|
|
32
33
|
{/** @ts-expect-error tea form id */}
|
|
33
|
-
<TeaForm className={cls} style={style} id={id}>
|
|
34
|
+
<TeaForm layout={layout} className={cls} style={style} id={id}>
|
|
34
35
|
{contentSlot}
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
</TeaForm>
|
|
37
|
+
</ConfigProvider>
|
|
37
38
|
);
|
|
38
39
|
}
|
|
39
40
|
return (
|
|
@@ -1,22 +1,31 @@
|
|
|
1
1
|
.weda-formcells__flag {
|
|
2
2
|
display: inline-block;
|
|
3
|
-
margin-
|
|
3
|
+
margin-left: 4px;
|
|
4
4
|
font-family: SimSun;
|
|
5
5
|
font-size: 12px;
|
|
6
6
|
color: #f60;
|
|
7
7
|
align-self: flex-start;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
.weda-formcells__label.weui-cell {
|
|
11
|
+
align-items: flex-start;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
.weda-ui .weui-cells__group_form .weui-cells {
|
|
11
15
|
margin: 0;
|
|
12
16
|
}
|
|
13
17
|
.weda-formcells.weui-flex .weda-formcells__label {
|
|
14
18
|
width: 130px;
|
|
19
|
+
padding-bottom: 16px;
|
|
15
20
|
}
|
|
16
21
|
.weui-cells__group_form .weui-cell {
|
|
17
22
|
padding: 16px 16px;
|
|
18
23
|
}
|
|
19
24
|
|
|
25
|
+
.weda-formcells .weda-formcells__label {
|
|
26
|
+
padding-bottom: 8px;
|
|
27
|
+
}
|
|
28
|
+
|
|
20
29
|
.weda-formcells__content.weui-flex__item .weui-cell_form {
|
|
21
30
|
padding: 0;
|
|
22
31
|
}
|
|
@@ -25,7 +34,6 @@
|
|
|
25
34
|
padding-right: 16px;
|
|
26
35
|
}
|
|
27
36
|
|
|
28
|
-
|
|
29
37
|
/* formcell 在 form container 外部兼容 and 独立 layout 适配 */
|
|
30
38
|
|
|
31
39
|
.weda-formcells__pc.vertical .wedatea2td-form__controls,
|
|
@@ -70,7 +78,6 @@
|
|
|
70
78
|
.weda-formcells__pc .wedatea2td-form__label label,
|
|
71
79
|
.weda-formcells__pc .wedatea2td-form__label legend {
|
|
72
80
|
display: inline-block;
|
|
73
|
-
white-space: nowrap;
|
|
74
81
|
font-size: 1rem;
|
|
75
82
|
transform: translateZ(0);
|
|
76
83
|
}
|
|
@@ -88,5 +95,4 @@
|
|
|
88
95
|
}
|
|
89
96
|
/*formcell end*/
|
|
90
97
|
|
|
91
|
-
|
|
92
98
|
/* formcell 在 form container 外部兼容 */
|
|
@@ -4,7 +4,7 @@ import classNames from '../../../utils/classnames';
|
|
|
4
4
|
import './index.css';
|
|
5
5
|
import { usePlatform } from '../../../utils/platform';
|
|
6
6
|
import { ConfigProvider, Form as TeaForm } from 'tea-component';
|
|
7
|
-
import { CommonFormPropsType } from '../types';
|
|
7
|
+
import type { CommonFormPropsType } from '../types';
|
|
8
8
|
|
|
9
9
|
export default function FormCell({
|
|
10
10
|
className,
|
|
@@ -33,12 +33,8 @@ export default function FormCell({
|
|
|
33
33
|
[layout]: layout,
|
|
34
34
|
[className]: [className],
|
|
35
35
|
})}
|
|
36
|
-
label={
|
|
37
|
-
|
|
38
|
-
{label}
|
|
39
|
-
{requiredFlag && <span className="weda-formcells__flag">*</span>}
|
|
40
|
-
</>
|
|
41
|
-
}
|
|
36
|
+
label={label}
|
|
37
|
+
required={requiredFlag}
|
|
42
38
|
>
|
|
43
39
|
{children}
|
|
44
40
|
</TeaForm.Item>
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
把weui-cell 的padding还回到input
|
|
9
9
|
*/
|
|
10
10
|
.weda-ui input.weui-input {
|
|
11
|
-
|
|
11
|
+
padding: 28px 0;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
.weda-ui.weda-input .weui-flex__item .weui-cell_form {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
padding: 0;
|
|
16
|
+
padding-right: 16px;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
.weda-ui.weda-input .weui-cell_form {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
START
|
|
30
30
|
*/
|
|
31
31
|
.weda-ui .wedatea2td-input {
|
|
32
|
-
|
|
32
|
+
background: inherit;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* END
|
|
@@ -5,7 +5,7 @@ import { Input as TeaInput, ConfigProvider } from 'tea-component';
|
|
|
5
5
|
import { renderDecorator } from '../renderDecorator';
|
|
6
6
|
import { useSyncValue } from '../../../utils/useSyncValue';
|
|
7
7
|
import './index.css';
|
|
8
|
-
import { CommonFormPropsType } from '../types';
|
|
8
|
+
import type { CommonFormPropsType } from '../types';
|
|
9
9
|
|
|
10
10
|
export default function Input({
|
|
11
11
|
id,
|
|
@@ -80,69 +80,77 @@ export default function Input({
|
|
|
80
80
|
const onBlur = function (e) {
|
|
81
81
|
events.blur({ value: e.target.value }, { originEvent: e });
|
|
82
82
|
};
|
|
83
|
-
const fieldEl =
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
className="weui-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
83
|
+
const fieldEl =
|
|
84
|
+
platform === 'h5' ? (
|
|
85
|
+
<div className={subCls}>
|
|
86
|
+
<div className="weui-cell__bd weui-flex">
|
|
87
|
+
<input
|
|
88
|
+
className="weui-input"
|
|
89
|
+
type={inputType}
|
|
90
|
+
placeholder={placeholder}
|
|
91
|
+
value={value}
|
|
92
|
+
disabled={disabled}
|
|
93
|
+
name={name}
|
|
94
|
+
autoFocus={autoFocus}
|
|
95
|
+
onChange={onChange}
|
|
96
|
+
onFocus={onFocus}
|
|
97
|
+
onBlur={onBlur}
|
|
98
|
+
onKeyDown={onKeyDown}
|
|
99
|
+
role="input"
|
|
100
|
+
/>
|
|
101
|
+
{clearable && (
|
|
102
|
+
<button
|
|
103
|
+
className="weui-btn_reset weui-btn_icon weui-btn_input-clear"
|
|
104
|
+
onMouseDown={onClear}
|
|
105
|
+
>
|
|
106
|
+
<i className="weui-icon-clear"></i>
|
|
107
|
+
</button>
|
|
108
|
+
)}
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
) : (
|
|
112
|
+
<ConfigProvider classPrefix="wedatea2td">
|
|
113
|
+
<TeaInput
|
|
114
|
+
size={size}
|
|
115
|
+
type={inputType}
|
|
116
|
+
placeholder={placeholder}
|
|
117
|
+
value={value}
|
|
118
|
+
disabled={disabled}
|
|
119
|
+
name={name}
|
|
120
|
+
autoFocus={autoFocus}
|
|
121
|
+
onChange={onChange}
|
|
122
|
+
onFocus={onFocus}
|
|
123
|
+
onBlur={onBlur}
|
|
124
|
+
onKeyDown={onKeyDown}
|
|
125
|
+
/>
|
|
126
|
+
</ConfigProvider>
|
|
127
|
+
);
|
|
128
|
+
return renderDecorator(
|
|
129
|
+
fieldEl,
|
|
130
|
+
decorator
|
|
131
|
+
)({
|
|
132
|
+
id,
|
|
133
|
+
className: cls,
|
|
134
|
+
style,
|
|
135
|
+
label: labelVisible ? label : null,
|
|
136
|
+
layout,
|
|
137
|
+
multiCell: false,
|
|
138
|
+
requiredFlag,
|
|
139
|
+
size,
|
|
140
|
+
});
|
|
132
141
|
}
|
|
133
142
|
|
|
134
143
|
export interface PropsType extends CommonFormPropsType {
|
|
135
144
|
defaultValue?: string;
|
|
136
145
|
password?: boolean;
|
|
137
146
|
placeholder?: string;
|
|
138
|
-
type?:
|
|
147
|
+
type?: 'text' | 'number' | 'idcard' | 'digit';
|
|
139
148
|
maxLength?: number;
|
|
140
149
|
focus?: boolean;
|
|
141
|
-
size?:
|
|
150
|
+
size?: 's' | 'm' | 'l' | 'full';
|
|
142
151
|
clearable?: boolean;
|
|
143
152
|
}
|
|
144
153
|
|
|
145
|
-
|
|
146
154
|
function getInputType(type, password) {
|
|
147
155
|
if (password) {
|
|
148
156
|
return 'password';
|