@hzab/form-render 1.6.17 → 1.6.19
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 +291 -283
- package/README.md +239 -239
- package/package.json +57 -57
- package/src/common/formily-utils.ts +125 -125
- package/src/common/schema-handler.ts +253 -253
- package/src/common/schema-merge.ts +68 -68
- package/src/components/ArrayBase/index.tsx +349 -349
- package/src/components/ArrayBase/style.less +90 -90
- package/src/components/ArrayBase/style.ts +2 -2
- package/src/components/ArrayCards/index.tsx +149 -149
- package/src/components/ArrayCards/style.less +14 -14
- package/src/components/ArrayCards/style.ts +4 -4
- package/src/components/ArrayTable/index.tsx +411 -411
- package/src/components/ArrayTable/style.less +52 -52
- package/src/components/ArrayTable/style.ts +7 -7
- package/src/components/DatePicker/index.tsx +108 -108
- package/src/components/LocationListPicker/assets/icon.js +1 -1
- package/src/components/LocationListPicker/components/AddrList/index.less +55 -55
- package/src/components/LocationListPicker/components/AddrList/index.tsx +75 -75
- package/src/components/LocationListPicker/components/Popup/address.schema.json +21 -21
- package/src/components/LocationListPicker/components/Popup/index.less +22 -22
- package/src/components/LocationListPicker/components/Popup/index.tsx +92 -92
- package/src/components/LocationListPicker/index.less +34 -34
- package/src/components/LocationListPicker/index.tsx +521 -520
- package/src/components/LocationPicker/Map/AMap/common/loader.ts +58 -58
- package/src/components/LocationPicker/Map/AMap/common/utils.ts +431 -431
- package/src/components/LocationPicker/Map/AMap/index.jsx +51 -51
- package/src/components/LocationPicker/README.md +44 -44
- package/src/components/LocationPicker/common/utils.ts +30 -30
- package/src/components/LocationPicker/components/ModalContent/index.tsx +387 -387
- package/src/components/LocationPicker/components/PickerInfo/index.tsx +109 -109
- package/src/components/LocationPicker/components/ResInfo/index.less +38 -38
- package/src/components/LocationPicker/components/ResInfo/index.tsx +65 -65
- package/src/components/LocationPicker/index.tsx +197 -197
- package/src/components/PersonnelSelect/index.less +21 -21
- package/src/components/PersonnelSelect/index.module.less +33 -33
- package/src/components/PersonnelSelect/index.tsx +305 -300
- package/src/components/PersonnelSelect/type.ts +92 -92
- package/src/components/RichEditor/index.less +38 -38
- package/src/components/RichEditor/index.tsx +238 -238
- package/src/components/TreeCheckbox/components/CheckboxTable/index.tsx +55 -55
- package/src/components/TreeCheckbox/components/TabsRender/index.tsx +58 -58
- package/src/components/TreeCheckbox/index.less +12 -12
- package/src/components/TreeCheckbox/index.tsx +63 -63
- package/src/components/Upload/README.md +64 -64
- package/src/components/Upload/common/OfflineUpload.ts +339 -339
- package/src/components/Upload/common/customRequest.ts +81 -81
- package/src/components/Upload/common/fileName.ts +142 -142
- package/src/components/Upload/common/handleIOFileList.ts +393 -393
- package/src/components/Upload/common/nanoid.ts +7 -7
- package/src/components/Upload/common/ossUpload.js +159 -159
- package/src/components/Upload/common/utils.js +194 -194
- package/src/components/Upload/components/ItemList/index.tsx +52 -52
- package/src/components/Upload/components/PreviewModal/previewRender.tsx +80 -80
- package/src/components/Upload/index.tsx +17 -17
- package/src/components/Upload/uploader-input.jsx +187 -187
- package/src/components/Upload/uploader.jsx +316 -316
- package/src/components/UserSelect/index.tsx +123 -123
- package/src/components/index.tsx +17 -17
- package/src/index.tsx +198 -198
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
@root-entry-name: 'default';
|
|
2
|
-
@import (reference) '~antd/es/style/themes/index.less';
|
|
3
|
-
|
|
4
|
-
@array-table-prefix-cls: ~'@{ant-prefix}-formily-array-table';
|
|
5
|
-
|
|
6
|
-
.@{array-table-prefix-cls} {
|
|
7
|
-
.@{array-table-prefix-cls}-pagination {
|
|
8
|
-
display: flex;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
|
|
11
|
-
.@{array-table-prefix-cls}-status-select.has-error {
|
|
12
|
-
.@{ant-prefix}-select-selector {
|
|
13
|
-
border-color: @error-color !important;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.@{ant-prefix}-table {
|
|
19
|
-
table {
|
|
20
|
-
overflow: hidden;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
td {
|
|
24
|
-
visibility: visible;
|
|
25
|
-
|
|
26
|
-
.@{ant-prefix}-formily-item:not(.@{ant-prefix}-formily-item-feedback-layout-popover) {
|
|
27
|
-
margin-bottom: 0 !important;
|
|
28
|
-
|
|
29
|
-
.@{ant-prefix}-formily-item-help {
|
|
30
|
-
position: absolute;
|
|
31
|
-
font-size: 12px;
|
|
32
|
-
top: 100%;
|
|
33
|
-
background: #fff;
|
|
34
|
-
width: 100%;
|
|
35
|
-
margin-top: 3px;
|
|
36
|
-
padding: 3px;
|
|
37
|
-
z-index: 1;
|
|
38
|
-
border-radius: 3px;
|
|
39
|
-
box-shadow: 0 0 10px #eee;
|
|
40
|
-
animation: none;
|
|
41
|
-
transform: translateY(0);
|
|
42
|
-
opacity: 1;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.@{array-table-prefix-cls}-sort-helper {
|
|
49
|
-
background: #fff;
|
|
50
|
-
border: 1px solid #eee;
|
|
51
|
-
z-index: 10;
|
|
52
|
-
}
|
|
1
|
+
@root-entry-name: 'default';
|
|
2
|
+
@import (reference) '~antd/es/style/themes/index.less';
|
|
3
|
+
|
|
4
|
+
@array-table-prefix-cls: ~'@{ant-prefix}-formily-array-table';
|
|
5
|
+
|
|
6
|
+
.@{array-table-prefix-cls} {
|
|
7
|
+
.@{array-table-prefix-cls}-pagination {
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
|
|
11
|
+
.@{array-table-prefix-cls}-status-select.has-error {
|
|
12
|
+
.@{ant-prefix}-select-selector {
|
|
13
|
+
border-color: @error-color !important;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.@{ant-prefix}-table {
|
|
19
|
+
table {
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
td {
|
|
24
|
+
visibility: visible;
|
|
25
|
+
|
|
26
|
+
.@{ant-prefix}-formily-item:not(.@{ant-prefix}-formily-item-feedback-layout-popover) {
|
|
27
|
+
margin-bottom: 0 !important;
|
|
28
|
+
|
|
29
|
+
.@{ant-prefix}-formily-item-help {
|
|
30
|
+
position: absolute;
|
|
31
|
+
font-size: 12px;
|
|
32
|
+
top: 100%;
|
|
33
|
+
background: #fff;
|
|
34
|
+
width: 100%;
|
|
35
|
+
margin-top: 3px;
|
|
36
|
+
padding: 3px;
|
|
37
|
+
z-index: 1;
|
|
38
|
+
border-radius: 3px;
|
|
39
|
+
box-shadow: 0 0 10px #eee;
|
|
40
|
+
animation: none;
|
|
41
|
+
transform: translateY(0);
|
|
42
|
+
opacity: 1;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.@{array-table-prefix-cls}-sort-helper {
|
|
49
|
+
background: #fff;
|
|
50
|
+
border: 1px solid #eee;
|
|
51
|
+
z-index: 10;
|
|
52
|
+
}
|
|
53
53
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import 'antd/lib/table/style/index'
|
|
2
|
-
import 'antd/lib/button/style/index'
|
|
3
|
-
import 'antd/lib/select/style/index'
|
|
4
|
-
import 'antd/lib/space/style/index'
|
|
5
|
-
import 'antd/lib/badge/style/index'
|
|
6
|
-
import 'antd/lib/pagination/style/index'
|
|
7
|
-
import './style.less'
|
|
1
|
+
import 'antd/lib/table/style/index'
|
|
2
|
+
import 'antd/lib/button/style/index'
|
|
3
|
+
import 'antd/lib/select/style/index'
|
|
4
|
+
import 'antd/lib/space/style/index'
|
|
5
|
+
import 'antd/lib/badge/style/index'
|
|
6
|
+
import 'antd/lib/pagination/style/index'
|
|
7
|
+
import './style.less'
|
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
import { useField, useFieldSchema, connect, mapProps } from "@formily/react";
|
|
2
|
-
import { DatePicker as AntdDatePicker } from "c-formily-antd";
|
|
3
|
-
|
|
4
|
-
import { DatePickerProps, RangePickerProps } from "antd/lib/date-picker";
|
|
5
|
-
|
|
6
|
-
import { getParentValue } from "../../common/formily-utils";
|
|
7
|
-
import { dateable } from "../../common/date-utils";
|
|
8
|
-
|
|
9
|
-
const { RangePicker } = AntdDatePicker;
|
|
10
|
-
|
|
11
|
-
type DatePickerT = React.FC<any> & {
|
|
12
|
-
RangePicker?: React.FC<any>;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const handleProps = (props: DatePickerProps) => {
|
|
16
|
-
const getDefaultFormat = (props: DatePickerProps) => {
|
|
17
|
-
if (props["picker"] === "month") {
|
|
18
|
-
return "YYYY-MM";
|
|
19
|
-
} else if (props["picker"] === "quarter") {
|
|
20
|
-
return "YYYY-\\QQ";
|
|
21
|
-
} else if (props["picker"] === "year") {
|
|
22
|
-
return "YYYY";
|
|
23
|
-
} else if (props["picker"] === "week") {
|
|
24
|
-
return "gggg-wo";
|
|
25
|
-
}
|
|
26
|
-
return props["showTime"] ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
|
|
27
|
-
};
|
|
28
|
-
const format = props["format"] || (getDefaultFormat(props) as any);
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
...props,
|
|
32
|
-
format,
|
|
33
|
-
value: dateable(props.value, format === "gggg-wo" ? "gggg-ww" : format),
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const DatePicker: DatePickerT = connect(
|
|
38
|
-
AntdDatePicker,
|
|
39
|
-
mapProps((props: any) => {
|
|
40
|
-
const datePickerProps = handleProps(props);
|
|
41
|
-
return datePickerProps;
|
|
42
|
-
}),
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
DatePicker.RangePicker = connect(
|
|
46
|
-
(props: any) => {
|
|
47
|
-
const field: any = useField();
|
|
48
|
-
const fieldSchema = useFieldSchema();
|
|
49
|
-
const {
|
|
50
|
-
/**
|
|
51
|
-
*
|
|
52
|
-
isSplitTimes
|
|
53
|
-
true: 拆分为 startKey和 endKey 两个字段
|
|
54
|
-
false: 不做拆分
|
|
55
|
-
*/
|
|
56
|
-
isSplitTimes = false,
|
|
57
|
-
startKey = "startTime",
|
|
58
|
-
endKey = "endTime",
|
|
59
|
-
} = props;
|
|
60
|
-
|
|
61
|
-
const handleOnConfirm = (startTime, endTime) => {
|
|
62
|
-
const res = {
|
|
63
|
-
[startKey]: startTime,
|
|
64
|
-
[endKey]: endTime,
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
if (!field.parent) {
|
|
68
|
-
field.form.setValues(res);
|
|
69
|
-
} else if (field.parent && fieldSchema.parent) {
|
|
70
|
-
// 嵌套在 ArrayBase: ArrayTable ArrayCard 等 里面的情况
|
|
71
|
-
const parentVal = getParentValue(field);
|
|
72
|
-
Object.keys(res).forEach((key) => {
|
|
73
|
-
parentVal[key] = res[key];
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const handleOnChange = (dates, dateStrings) => {
|
|
79
|
-
props.onChange && props.onChange(dates);
|
|
80
|
-
if (!isSplitTimes) return;
|
|
81
|
-
if (!dates || !dates.length) {
|
|
82
|
-
handleOnConfirm(undefined, undefined);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const startTime = dates[0];
|
|
87
|
-
const endTime = dates[1];
|
|
88
|
-
if ((props.pick === "date" || !props.pick) && !props.showTime) {
|
|
89
|
-
handleOnConfirm(startTime + " 00:00:00", endTime + " 23:59:59");
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
handleOnConfirm(startTime, endTime);
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
return (
|
|
96
|
-
<RangePicker
|
|
97
|
-
{...props}
|
|
98
|
-
onChange={(
|
|
99
|
-
value: DatePickerProps["value"] | RangePickerProps["value"],
|
|
100
|
-
dateString: [string, string] | string,
|
|
101
|
-
) => handleOnChange(value, dateString)}
|
|
102
|
-
/>
|
|
103
|
-
);
|
|
104
|
-
},
|
|
105
|
-
mapProps((props: any) => {
|
|
106
|
-
return handleProps(props);
|
|
107
|
-
}),
|
|
108
|
-
);
|
|
1
|
+
import { useField, useFieldSchema, connect, mapProps } from "@formily/react";
|
|
2
|
+
import { DatePicker as AntdDatePicker } from "c-formily-antd";
|
|
3
|
+
|
|
4
|
+
import { DatePickerProps, RangePickerProps } from "antd/lib/date-picker";
|
|
5
|
+
|
|
6
|
+
import { getParentValue } from "../../common/formily-utils";
|
|
7
|
+
import { dateable } from "../../common/date-utils";
|
|
8
|
+
|
|
9
|
+
const { RangePicker } = AntdDatePicker;
|
|
10
|
+
|
|
11
|
+
type DatePickerT = React.FC<any> & {
|
|
12
|
+
RangePicker?: React.FC<any>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const handleProps = (props: DatePickerProps) => {
|
|
16
|
+
const getDefaultFormat = (props: DatePickerProps) => {
|
|
17
|
+
if (props["picker"] === "month") {
|
|
18
|
+
return "YYYY-MM";
|
|
19
|
+
} else if (props["picker"] === "quarter") {
|
|
20
|
+
return "YYYY-\\QQ";
|
|
21
|
+
} else if (props["picker"] === "year") {
|
|
22
|
+
return "YYYY";
|
|
23
|
+
} else if (props["picker"] === "week") {
|
|
24
|
+
return "gggg-wo";
|
|
25
|
+
}
|
|
26
|
+
return props["showTime"] ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
|
|
27
|
+
};
|
|
28
|
+
const format = props["format"] || (getDefaultFormat(props) as any);
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
...props,
|
|
32
|
+
format,
|
|
33
|
+
value: dateable(props.value, format === "gggg-wo" ? "gggg-ww" : format),
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const DatePicker: DatePickerT = connect(
|
|
38
|
+
AntdDatePicker,
|
|
39
|
+
mapProps((props: any) => {
|
|
40
|
+
const datePickerProps = handleProps(props);
|
|
41
|
+
return datePickerProps;
|
|
42
|
+
}),
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
DatePicker.RangePicker = connect(
|
|
46
|
+
(props: any) => {
|
|
47
|
+
const field: any = useField();
|
|
48
|
+
const fieldSchema = useFieldSchema();
|
|
49
|
+
const {
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
isSplitTimes
|
|
53
|
+
true: 拆分为 startKey和 endKey 两个字段
|
|
54
|
+
false: 不做拆分
|
|
55
|
+
*/
|
|
56
|
+
isSplitTimes = false,
|
|
57
|
+
startKey = "startTime",
|
|
58
|
+
endKey = "endTime",
|
|
59
|
+
} = props;
|
|
60
|
+
|
|
61
|
+
const handleOnConfirm = (startTime, endTime) => {
|
|
62
|
+
const res = {
|
|
63
|
+
[startKey]: startTime,
|
|
64
|
+
[endKey]: endTime,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
if (!field.parent) {
|
|
68
|
+
field.form.setValues(res);
|
|
69
|
+
} else if (field.parent && fieldSchema.parent) {
|
|
70
|
+
// 嵌套在 ArrayBase: ArrayTable ArrayCard 等 里面的情况
|
|
71
|
+
const parentVal = getParentValue(field);
|
|
72
|
+
Object.keys(res).forEach((key) => {
|
|
73
|
+
parentVal[key] = res[key];
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const handleOnChange = (dates, dateStrings) => {
|
|
79
|
+
props.onChange && props.onChange(dates);
|
|
80
|
+
if (!isSplitTimes) return;
|
|
81
|
+
if (!dates || !dates.length) {
|
|
82
|
+
handleOnConfirm(undefined, undefined);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const startTime = dates[0];
|
|
87
|
+
const endTime = dates[1];
|
|
88
|
+
if ((props.pick === "date" || !props.pick) && !props.showTime) {
|
|
89
|
+
handleOnConfirm(startTime + " 00:00:00", endTime + " 23:59:59");
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
handleOnConfirm(startTime, endTime);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<RangePicker
|
|
97
|
+
{...props}
|
|
98
|
+
onChange={(
|
|
99
|
+
value: DatePickerProps["value"] | RangePickerProps["value"],
|
|
100
|
+
dateString: [string, string] | string,
|
|
101
|
+
) => handleOnChange(value, dateString)}
|
|
102
|
+
/>
|
|
103
|
+
);
|
|
104
|
+
},
|
|
105
|
+
mapProps((props: any) => {
|
|
106
|
+
return handleProps(props);
|
|
107
|
+
}),
|
|
108
|
+
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const iconCircle0080ff = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJQSURBVGhD3ZrrdcIwDIVldw26R+kesEdZALJA2QMGgT3KGq2razk4cV4OSYPd7w92yznRtSUrslA0B3uzohd6pW/a8OyNFI+JVvZ/nhsZutiRpjPt1dmOJzJNQGE2bNQnj0Jj4zAsZKKY8QKw2sRGK7va82HoSIXauVk04wQU5sOt+N+haMc7cnSzQeIEYNWV9d/HXGUsEitb3pGb/KEb7T67gZ8r+uLRMsYDRWv7TDx7gH4B4jInN1sePBs29NDtQkv4eyw9cdEuQI7H5618G4pjouW4bQqQgIXPp4fhBBkEdlsMpLXyVeQkrFEXAL/HCZAuqzCo6y50MMaN0qbiSn4H9iaNEyeOu61egKLe8zYpKu9hIiAi4yWHs1kE/Mz8ZrkELslKEOcSvCEczDpL9ynhKlBn6T4lXMLWE1l+vOnEM28/Ci60ZKEyP6vcXSh4mcuQfyFgsPJPmJvmbJZm9RWDoQt24CqzPNGcjme5ZH0Kms6a03G+LrRXLEBKs/wCGTfbjByjuDjKDVzLM76oz60mOChru09kbkuyAL0Eh9+BlG/kQtzqA78DCOYcYiGw0e9AycEs2wsYAxofhXp3M4vfgRKTdIGzdZ93mgLElRpffDqwKbiZBk0BAPfwKcWDNDhaT8lmDFRJoUsjxnd2LfsFgGd2azq6MlWGBQBpbp/420sFOH6WsG7z+ZA4ASVLuNSAy4SME1CCXsLc1/HyKrOLWfUqjwkoQXzgavLx301I9h/w8z6mCahSigESK2E2h18jy19tFYhCauRqNyH6BUPQrVUSJvRPAAAAAElFTkSuQmCC`;
|
|
1
|
+
export const iconCircle0080ff = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJQSURBVGhD3ZrrdcIwDIVldw26R+kesEdZALJA2QMGgT3KGq2razk4cV4OSYPd7w92yznRtSUrslA0B3uzohd6pW/a8OyNFI+JVvZ/nhsZutiRpjPt1dmOJzJNQGE2bNQnj0Jj4zAsZKKY8QKw2sRGK7va82HoSIXauVk04wQU5sOt+N+haMc7cnSzQeIEYNWV9d/HXGUsEitb3pGb/KEb7T67gZ8r+uLRMsYDRWv7TDx7gH4B4jInN1sePBs29NDtQkv4eyw9cdEuQI7H5618G4pjouW4bQqQgIXPp4fhBBkEdlsMpLXyVeQkrFEXAL/HCZAuqzCo6y50MMaN0qbiSn4H9iaNEyeOu61egKLe8zYpKu9hIiAi4yWHs1kE/Mz8ZrkELslKEOcSvCEczDpL9ynhKlBn6T4lXMLWE1l+vOnEM28/Ci60ZKEyP6vcXSh4mcuQfyFgsPJPmJvmbJZm9RWDoQt24CqzPNGcjme5ZH0Kms6a03G+LrRXLEBKs/wCGTfbjByjuDjKDVzLM76oz60mOChru09kbkuyAL0Eh9+BlG/kQtzqA78DCOYcYiGw0e9AycEs2wsYAxofhXp3M4vfgRKTdIGzdZ93mgLElRpffDqwKbiZBk0BAPfwKcWDNDhaT8lmDFRJoUsjxnd2LfsFgGd2azq6MlWGBQBpbp/420sFOH6WsG7z+ZA4ASVLuNSAy4SME1CCXsLc1/HyKrOLWfUqjwkoQXzgavLx301I9h/w8z6mCahSigESK2E2h18jy19tFYhCauRqNyH6BUPQrVUSJvRPAAAAAElFTkSuQmCC`;
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
.addr-list {
|
|
2
|
-
flex: 1;
|
|
3
|
-
height: 100%;
|
|
4
|
-
min-height: 600px;
|
|
5
|
-
overflow-y: auto;
|
|
6
|
-
.addr-item {
|
|
7
|
-
display: flex;
|
|
8
|
-
justify-content: space-between;
|
|
9
|
-
align-items: center;
|
|
10
|
-
padding: 12px 24px;
|
|
11
|
-
line-height: 1;
|
|
12
|
-
cursor: pointer;
|
|
13
|
-
|
|
14
|
-
&.active {
|
|
15
|
-
background: #f2f9ff;
|
|
16
|
-
border: 1px solid #0080ff;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.addr-item-content {
|
|
20
|
-
flex: 1;
|
|
21
|
-
width: 100%;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.item-content {
|
|
25
|
-
display: flex;
|
|
26
|
-
.item-addr {
|
|
27
|
-
}
|
|
28
|
-
.item-range {
|
|
29
|
-
flex-shrink: 0;
|
|
30
|
-
color: #999;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.action-box {
|
|
35
|
-
min-width: 56px;
|
|
36
|
-
}
|
|
37
|
-
.action-btn {
|
|
38
|
-
margin-right: 12px;
|
|
39
|
-
font-size: 16px;
|
|
40
|
-
&:last-child {
|
|
41
|
-
margin-right: none;
|
|
42
|
-
}
|
|
43
|
-
&.disabled {
|
|
44
|
-
color: #999;
|
|
45
|
-
cursor: not-allowed;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
.edit-btn {
|
|
49
|
-
color: #0080ff;
|
|
50
|
-
}
|
|
51
|
-
.del-btn {
|
|
52
|
-
color: #ff3333;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
1
|
+
.addr-list {
|
|
2
|
+
flex: 1;
|
|
3
|
+
height: 100%;
|
|
4
|
+
min-height: 600px;
|
|
5
|
+
overflow-y: auto;
|
|
6
|
+
.addr-item {
|
|
7
|
+
display: flex;
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
align-items: center;
|
|
10
|
+
padding: 12px 24px;
|
|
11
|
+
line-height: 1;
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
|
|
14
|
+
&.active {
|
|
15
|
+
background: #f2f9ff;
|
|
16
|
+
border: 1px solid #0080ff;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.addr-item-content {
|
|
20
|
+
flex: 1;
|
|
21
|
+
width: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.item-content {
|
|
25
|
+
display: flex;
|
|
26
|
+
.item-addr {
|
|
27
|
+
}
|
|
28
|
+
.item-range {
|
|
29
|
+
flex-shrink: 0;
|
|
30
|
+
color: #999;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.action-box {
|
|
35
|
+
min-width: 56px;
|
|
36
|
+
}
|
|
37
|
+
.action-btn {
|
|
38
|
+
margin-right: 12px;
|
|
39
|
+
font-size: 16px;
|
|
40
|
+
&:last-child {
|
|
41
|
+
margin-right: none;
|
|
42
|
+
}
|
|
43
|
+
&.disabled {
|
|
44
|
+
color: #999;
|
|
45
|
+
cursor: not-allowed;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
.edit-btn {
|
|
49
|
+
color: #0080ff;
|
|
50
|
+
}
|
|
51
|
+
.del-btn {
|
|
52
|
+
color: #ff3333;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
import { Popconfirm } from "antd";
|
|
2
|
-
import { EditOutlined, DeleteOutlined } from "@ant-design/icons";
|
|
3
|
-
|
|
4
|
-
import "./index.less";
|
|
5
|
-
import { useState } from "react";
|
|
6
|
-
|
|
7
|
-
export const AddrList = (props) => {
|
|
8
|
-
const {
|
|
9
|
-
readOnly,
|
|
10
|
-
disabled,
|
|
11
|
-
list,
|
|
12
|
-
ItemRender,
|
|
13
|
-
onItemClick,
|
|
14
|
-
onEdit,
|
|
15
|
-
onDel,
|
|
16
|
-
hasAction = true,
|
|
17
|
-
activeId,
|
|
18
|
-
onDelClick,
|
|
19
|
-
onDelCancel,
|
|
20
|
-
} = props;
|
|
21
|
-
|
|
22
|
-
const CItemRender = ItemRender ?? LItemRender;
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<div className="addr-list">
|
|
26
|
-
{list?.map((it, i) => {
|
|
27
|
-
const delCom = (
|
|
28
|
-
<DeleteOutlined
|
|
29
|
-
className={`action-btn del-btn ${disabled ? "disabled" : ""}`}
|
|
30
|
-
onClick={(e) => !disabled && onDelClick && onDelClick(it, i, e)}
|
|
31
|
-
/>
|
|
32
|
-
);
|
|
33
|
-
return (
|
|
34
|
-
<div className={`addr-item ${activeId === it.id ? "active" : ""}`} key={it.id ?? i}>
|
|
35
|
-
<div className="addr-item-content" onClick={(e) => onItemClick(it, i, e)}>
|
|
36
|
-
<CItemRender item={it} index={i} />
|
|
37
|
-
</div>
|
|
38
|
-
{!readOnly && hasAction && (
|
|
39
|
-
<div className="action-box">
|
|
40
|
-
<EditOutlined
|
|
41
|
-
className={`action-btn edit-btn ${disabled ? "disabled" : ""}`}
|
|
42
|
-
onClick={(e) => !disabled && onEdit && onEdit(it, i, e)}
|
|
43
|
-
/>
|
|
44
|
-
{disabled ? (
|
|
45
|
-
delCom
|
|
46
|
-
) : (
|
|
47
|
-
<Popconfirm
|
|
48
|
-
title={"确认删除当前项?"}
|
|
49
|
-
onConfirm={(e) => onDel && onDel(it, i, e)}
|
|
50
|
-
onOpenChange={(open) => open === false && onDelCancel && onDelCancel(it, i)}
|
|
51
|
-
>
|
|
52
|
-
{delCom}
|
|
53
|
-
</Popconfirm>
|
|
54
|
-
)}
|
|
55
|
-
</div>
|
|
56
|
-
)}
|
|
57
|
-
</div>
|
|
58
|
-
);
|
|
59
|
-
})}
|
|
60
|
-
</div>
|
|
61
|
-
);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
function LItemRender(props) {
|
|
65
|
-
const { item } = props;
|
|
66
|
-
const { address, range } = item || {};
|
|
67
|
-
return (
|
|
68
|
-
<div className="item-content">
|
|
69
|
-
<div className="item-addr">{address}</div>
|
|
70
|
-
{range && <span className="item-range">(范围:{range})</span>}
|
|
71
|
-
</div>
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export default AddrList;
|
|
1
|
+
import { Popconfirm } from "antd";
|
|
2
|
+
import { EditOutlined, DeleteOutlined } from "@ant-design/icons";
|
|
3
|
+
|
|
4
|
+
import "./index.less";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
|
|
7
|
+
export const AddrList = (props) => {
|
|
8
|
+
const {
|
|
9
|
+
readOnly,
|
|
10
|
+
disabled,
|
|
11
|
+
list,
|
|
12
|
+
ItemRender,
|
|
13
|
+
onItemClick,
|
|
14
|
+
onEdit,
|
|
15
|
+
onDel,
|
|
16
|
+
hasAction = true,
|
|
17
|
+
activeId,
|
|
18
|
+
onDelClick,
|
|
19
|
+
onDelCancel,
|
|
20
|
+
} = props;
|
|
21
|
+
|
|
22
|
+
const CItemRender = ItemRender ?? LItemRender;
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div className="addr-list">
|
|
26
|
+
{list?.map((it, i) => {
|
|
27
|
+
const delCom = (
|
|
28
|
+
<DeleteOutlined
|
|
29
|
+
className={`action-btn del-btn ${disabled ? "disabled" : ""}`}
|
|
30
|
+
onClick={(e) => !disabled && onDelClick && onDelClick(it, i, e)}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
return (
|
|
34
|
+
<div className={`addr-item ${activeId === it.id ? "active" : ""}`} key={it.id ?? i}>
|
|
35
|
+
<div className="addr-item-content" onClick={(e) => onItemClick(it, i, e)}>
|
|
36
|
+
<CItemRender item={it} index={i} />
|
|
37
|
+
</div>
|
|
38
|
+
{!readOnly && hasAction && (
|
|
39
|
+
<div className="action-box">
|
|
40
|
+
<EditOutlined
|
|
41
|
+
className={`action-btn edit-btn ${disabled ? "disabled" : ""}`}
|
|
42
|
+
onClick={(e) => !disabled && onEdit && onEdit(it, i, e)}
|
|
43
|
+
/>
|
|
44
|
+
{disabled ? (
|
|
45
|
+
delCom
|
|
46
|
+
) : (
|
|
47
|
+
<Popconfirm
|
|
48
|
+
title={"确认删除当前项?"}
|
|
49
|
+
onConfirm={(e) => onDel && onDel(it, i, e)}
|
|
50
|
+
onOpenChange={(open) => open === false && onDelCancel && onDelCancel(it, i)}
|
|
51
|
+
>
|
|
52
|
+
{delCom}
|
|
53
|
+
</Popconfirm>
|
|
54
|
+
)}
|
|
55
|
+
</div>
|
|
56
|
+
)}
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
})}
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
function LItemRender(props) {
|
|
65
|
+
const { item } = props;
|
|
66
|
+
const { address, range } = item || {};
|
|
67
|
+
return (
|
|
68
|
+
<div className="item-content">
|
|
69
|
+
<div className="item-addr">{address}</div>
|
|
70
|
+
{range && <span className="item-range">(范围:{range})</span>}
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default AddrList;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
{
|
|
2
|
-
"form": {},
|
|
3
|
-
"schema": {
|
|
4
|
-
"type": "object",
|
|
5
|
-
"properties": {
|
|
6
|
-
"address": {
|
|
7
|
-
"type": "string",
|
|
8
|
-
"title": "位置",
|
|
9
|
-
"x-decorator": "FormItem",
|
|
10
|
-
"x-component": "text",
|
|
11
|
-
"x-validator": [],
|
|
12
|
-
"x-component-props": {},
|
|
13
|
-
"x-decorator-props": {},
|
|
14
|
-
"x-designable-id": "address",
|
|
15
|
-
"name": "address",
|
|
16
|
-
"x-index": 0
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"x-designable-id": "o6m980wykh1"
|
|
20
|
-
}
|
|
21
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"form": {},
|
|
3
|
+
"schema": {
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"address": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"title": "位置",
|
|
9
|
+
"x-decorator": "FormItem",
|
|
10
|
+
"x-component": "text",
|
|
11
|
+
"x-validator": [],
|
|
12
|
+
"x-component-props": {},
|
|
13
|
+
"x-decorator-props": {},
|
|
14
|
+
"x-designable-id": "address",
|
|
15
|
+
"name": "address",
|
|
16
|
+
"x-index": 0
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"x-designable-id": "o6m980wykh1"
|
|
20
|
+
}
|
|
21
|
+
}
|