@hzab/form-render 1.7.17 → 1.7.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 +8 -0
- package/LICENSE +21 -0
- package/dist/common/date-utils.d.ts +1 -0
- package/dist/common/event.d.ts +5 -0
- package/dist/common/formily-utils.d.ts +54 -0
- package/dist/common/global-props-context.d.ts +8 -0
- package/dist/common/location-utils.d.ts +6 -0
- package/dist/common/schema-handler.d.ts +90 -0
- package/dist/common/schema-merge.d.ts +12 -0
- package/dist/components/ArrayBase/index.d.ts +75 -0
- package/dist/components/ArrayBase/style.d.ts +2 -0
- package/dist/components/ArrayCards/index.d.ts +13 -0
- package/dist/components/ArrayCards/style.d.ts +4 -0
- package/dist/components/ArrayTable/index.d.ts +51 -0
- package/dist/components/ArrayTable/style.d.ts +7 -0
- package/dist/components/CheckboxWithTip/index.d.ts +15 -0
- package/dist/components/DatePicker/index.d.ts +5 -0
- package/dist/components/LocationListPicker/components/AddrList/index.d.ts +3 -0
- package/dist/components/LocationListPicker/components/Popup/index.d.ts +15 -0
- package/dist/components/LocationListPicker/index.d.ts +3 -0
- package/dist/components/LocationPicker/Map/AMap/common/loader.d.ts +2 -0
- package/dist/components/LocationPicker/Map/AMap/common/utils.d.ts +130 -0
- package/dist/components/LocationPicker/common/utils.d.ts +19 -0
- package/dist/components/LocationPicker/components/ModalContent/index.d.ts +3 -0
- package/dist/components/LocationPicker/components/Notice/index.d.ts +2 -0
- package/dist/components/LocationPicker/components/PickerInfo/index.d.ts +3 -0
- package/dist/components/LocationPicker/components/ResInfo/index.d.ts +8 -0
- package/dist/components/LocationPicker/index.d.ts +3 -0
- package/dist/components/LocationPicker/servers/index.d.ts +21 -0
- package/dist/components/PersonnelSelect/index.d.ts +6 -0
- package/dist/components/PersonnelSelect/type.d.ts +88 -0
- package/dist/components/RadioGroupWithTip/index.d.ts +14 -0
- package/dist/components/RichEditor/components/handleMobileRem/index.d.ts +3 -0
- package/dist/components/RichEditor/components/handleMobileVw/index.d.ts +3 -0
- package/dist/components/RichEditor/index.d.ts +32 -0
- package/dist/components/Text/index.d.ts +9 -0
- package/dist/components/TreeCheckbox/common/utils.d.ts +74 -0
- package/dist/components/TreeCheckbox/components/CheckboxTable/index.d.ts +2 -0
- package/dist/components/TreeCheckbox/components/Render/index.d.ts +2 -0
- package/dist/components/TreeCheckbox/components/TabsRender/index.d.ts +2 -0
- package/dist/components/TreeCheckbox/index.d.ts +3 -0
- package/dist/components/Upload/common/OfflineUpload.d.ts +3 -0
- package/dist/components/Upload/common/checkFileType.d.ts +3 -0
- package/dist/components/Upload/common/customRequest.d.ts +32 -0
- package/dist/components/Upload/common/fileName.d.ts +3 -0
- package/dist/components/Upload/common/handleIOFileList.d.ts +133 -0
- package/dist/components/Upload/common/nanoid.d.ts +2 -0
- package/dist/components/Upload/components/Image/index.d.ts +3 -0
- package/dist/components/Upload/components/ItemList/ItemRender.d.ts +2 -0
- package/dist/components/Upload/components/ItemList/index.d.ts +2 -0
- package/dist/components/Upload/components/PreviewModal/index.d.ts +5 -0
- package/dist/components/Upload/components/PreviewModal/previewRender.d.ts +12 -0
- package/dist/components/Upload/index.d.ts +2 -0
- package/dist/components/UserSelect/index.d.ts +29 -0
- package/dist/components/index.d.ts +14 -0
- package/dist/globalConfig.d.ts +6 -0
- package/dist/index.cjs +9 -0
- package/dist/index.css +2 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +3227 -0
- package/package.json +79 -63
- package/src/common/schema-handler.ts +2 -2
- package/src/components/ArrayBase/index.tsx +7 -5
- package/src/components/ArrayCards/index.tsx +5 -4
- package/src/components/ArrayTable/index.tsx +9 -7
- package/src/components/DatePicker/index.tsx +1 -1
- package/src/components/LocationListPicker/components/Popup/index.tsx +1 -1
- package/src/components/LocationListPicker/index.tsx +4 -4
- package/src/components/LocationPicker/Map/AMap/common/loader.ts +2 -3
- package/src/components/LocationPicker/Map/AMap/common/utils.ts +9 -9
- package/src/components/LocationPicker/common/utils.ts +5 -5
- package/src/components/LocationPicker/components/ModalContent/index.tsx +5 -5
- package/src/components/PersonnelSelect/type.ts +1 -1
- package/src/components/RichEditor/components/handleMobileRem/index.tsx +2 -2
- package/src/components/RichEditor/components/handleMobileVw/index.tsx +1 -1
- package/src/components/RichEditor/index.tsx +1 -1
- package/src/components/TreeCheckbox/common/utils.ts +1 -1
- package/src/components/Upload/common/handleIOFileList.ts +2 -2
- package/src/components/Upload/uploader-input.jsx +2 -3
- package/src/components/Upload/uploader.jsx +8 -1
- package/src/components/UserSelect/index.tsx +1 -1
- package/src/global.d.ts +12 -0
- package/src/index.tsx +2 -2
- package/src/vite-env.d.ts +1 -0
- package/README.md +0 -271
- package/src/components/LocationPicker/README.md +0 -44
- package/src/components/RichEditor/README.md +0 -82
- package/src/components/TreeCheckbox/README.md +0 -11
- package/src/components/Upload/README.md +0 -77
package/package.json
CHANGED
|
@@ -1,63 +1,79 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@hzab/form-render",
|
|
3
|
-
"version": "1.7.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"@
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"react": "
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"@formily/core": "2.3.1",
|
|
51
|
-
"@formily/
|
|
52
|
-
"@formily/
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@hzab/form-render",
|
|
3
|
+
"version": "1.7.19",
|
|
4
|
+
"private": false,
|
|
5
|
+
"src-direct": true,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"description": "基于 Formily 的动态表单渲染",
|
|
8
|
+
"license": "ISC",
|
|
9
|
+
"author": "CaiYansong",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=24"
|
|
12
|
+
},
|
|
13
|
+
"main": "src",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"dist",
|
|
18
|
+
"docs",
|
|
19
|
+
"CHANGELOG.md"
|
|
20
|
+
],
|
|
21
|
+
"sideEffects": [
|
|
22
|
+
"**/*.less"
|
|
23
|
+
],
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"antd": "4.x",
|
|
26
|
+
"axios": ">=1.4.0",
|
|
27
|
+
"react": ">=16.8.0",
|
|
28
|
+
"react-dom": ">=16.8.0"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@amap/amap-jsapi-loader": "^1.0.1",
|
|
32
|
+
"@ant-design/icons": "^4.8.0",
|
|
33
|
+
"@formily/core": "2.3.1",
|
|
34
|
+
"@formily/json-schema": "2.3.1",
|
|
35
|
+
"@formily/react": "2.3.1",
|
|
36
|
+
"@formily/reactive-react": "2.3.1",
|
|
37
|
+
"@formily/shared": "2.3.1",
|
|
38
|
+
"@turf/turf": "^6.5.0",
|
|
39
|
+
"@wangeditor/editor": "^5.1.23",
|
|
40
|
+
"@wangeditor/editor-for-react": "^1.0.6",
|
|
41
|
+
"ajv": "^8.12.0",
|
|
42
|
+
"c-formily-antd": "^2.3.1",
|
|
43
|
+
"classnames": "^2.3.2",
|
|
44
|
+
"dayjs": "^1.11.7",
|
|
45
|
+
"lodash": "^4.17.21",
|
|
46
|
+
"nanoid": "^3.3.7",
|
|
47
|
+
"@hzab/utils": ">=1.0.6"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@formily/core": "2.3.1",
|
|
51
|
+
"@formily/json-schema": "2.3.1",
|
|
52
|
+
"@formily/react": "2.3.1",
|
|
53
|
+
"@formily/reactive-react": "2.3.1",
|
|
54
|
+
"@formily/shared": "2.3.1",
|
|
55
|
+
"@types/lodash": "^4.17.12",
|
|
56
|
+
"@types/react": "^17.0.62",
|
|
57
|
+
"@types/react-dom": "^17.0.20",
|
|
58
|
+
"@vitest/coverage-v8": "4.1.10",
|
|
59
|
+
"antd": "^4.24.12",
|
|
60
|
+
"axios": "^1.4.0",
|
|
61
|
+
"c-formily-antd": "^2.3.1",
|
|
62
|
+
"happy-dom": "^20.11.1",
|
|
63
|
+
"less": "^4.1.3",
|
|
64
|
+
"react": "^17.0.2",
|
|
65
|
+
"react-dom": "^17.0.2",
|
|
66
|
+
"typescript": "^5.9.3",
|
|
67
|
+
"vite": "^8.0.0",
|
|
68
|
+
"vitest": "^4.1.10",
|
|
69
|
+
"@hzab/typescript-config": "^0.0.0",
|
|
70
|
+
"@hzab/eslint-config": "^0.0.0",
|
|
71
|
+
"@hzab/vite-config": "^0.0.3-alpha.0"
|
|
72
|
+
},
|
|
73
|
+
"scripts": {
|
|
74
|
+
"build": "vite build && tsc -p tsconfig.build.json",
|
|
75
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
76
|
+
"test": "vitest run --passWithNoTests",
|
|
77
|
+
"test:watch": "vitest"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -50,7 +50,7 @@ export const bindOnChange = (schema, opt) => {
|
|
|
50
50
|
let _schema = isCloneDeep ? _.cloneDeep(schema) : schema;
|
|
51
51
|
_schema = _schema.schema || _schema;
|
|
52
52
|
Object.keys(_schema.properties || {})?.forEach((key) => {
|
|
53
|
-
|
|
53
|
+
const item = _schema.properties[key];
|
|
54
54
|
if (!item) {
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
@@ -216,7 +216,7 @@ export const handleSchemaStrVal = (strKey, schemaScope) => {
|
|
|
216
216
|
if (!_str) {
|
|
217
217
|
return strKey;
|
|
218
218
|
}
|
|
219
|
-
|
|
219
|
+
const fn = getScopeKeyVal(_str, schemaScope);
|
|
220
220
|
if (fn) {
|
|
221
221
|
return fn;
|
|
222
222
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { CopyOutlined, DeleteOutlined, DownOutlined, MenuOutlined, PlusOutlined, UpOutlined } from "@ant-design/icons";
|
|
2
|
-
import { ArrayField } from "@formily/core";
|
|
3
|
-
import { JSXComponent, Schema
|
|
2
|
+
import type { ArrayField } from "@formily/core";
|
|
3
|
+
import type { JSXComponent, Schema} from "@formily/react";
|
|
4
|
+
import { useField, useFieldSchema } from "@formily/react";
|
|
4
5
|
import { clone, isUndef, isValid } from "@formily/shared";
|
|
5
6
|
import { Button, Popconfirm } from "antd";
|
|
6
|
-
import { ButtonProps } from "antd/lib/button";
|
|
7
|
+
import type { ButtonProps } from "antd/lib/button";
|
|
7
8
|
import cls from "classnames";
|
|
8
|
-
import
|
|
9
|
+
import type { ReactNode} from "react";
|
|
10
|
+
import React, { createContext, useContext } from "react";
|
|
9
11
|
import { SortableHandle, usePrefixCls } from "c-formily-antd/lib/__builtins__";
|
|
10
12
|
|
|
11
13
|
export interface IArrayBaseAdditionProps extends ButtonProps {
|
|
@@ -88,7 +90,7 @@ export const getSchemaDefaultValue = (schema: Schema) => {
|
|
|
88
90
|
if (schema?.type === "array") return [];
|
|
89
91
|
if (schema?.type === "object") return {};
|
|
90
92
|
if (schema?.type === "void") {
|
|
91
|
-
for (
|
|
93
|
+
for (const key in schema.properties) {
|
|
92
94
|
const value = getSchemaDefaultValue(schema.properties[key]);
|
|
93
95
|
if (isValid(value)) return value;
|
|
94
96
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Card, Empty } from "antd";
|
|
3
|
-
import { CardProps } from "antd/lib/card";
|
|
4
|
-
import { ArrayField } from "@formily/core";
|
|
3
|
+
import type { CardProps } from "antd/lib/card";
|
|
4
|
+
import type { ArrayField } from "@formily/core";
|
|
5
5
|
import { useField, observer, useFieldSchema, RecursionField } from "@formily/react";
|
|
6
6
|
import cls from "classnames";
|
|
7
|
-
import { ISchema } from "@formily/json-schema";
|
|
7
|
+
import type { ISchema } from "@formily/json-schema";
|
|
8
8
|
import { usePrefixCls } from "c-formily-antd/lib/__builtins__";
|
|
9
|
-
import {
|
|
9
|
+
import type { ArrayBaseMixins, IArrayBaseProps } from "../ArrayBase";
|
|
10
|
+
import { ArrayBase } from "../ArrayBase";
|
|
10
11
|
|
|
11
12
|
export type ComposedArrayCards = React.FC<React.PropsWithChildren<CardProps & IArrayBaseProps>> & ArrayBaseMixins;
|
|
12
13
|
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import React, { Fragment, useState, useRef, useEffect, createContext, useContext, useCallback } from "react";
|
|
2
2
|
import { Table, Pagination, Space, Select, Badge } from "antd";
|
|
3
|
-
import { PaginationProps } from "antd/lib/pagination";
|
|
4
|
-
import { TableProps, ColumnProps } from "antd/lib/table";
|
|
5
|
-
import { SelectProps } from "antd/lib/select";
|
|
3
|
+
import type { PaginationProps } from "antd/lib/pagination";
|
|
4
|
+
import type { TableProps, ColumnProps } from "antd/lib/table";
|
|
5
|
+
import type { SelectProps } from "antd/lib/select";
|
|
6
6
|
import cls from "classnames";
|
|
7
|
-
import { GeneralField, FieldDisplayTypes, ArrayField } from "@formily/core";
|
|
8
|
-
import {
|
|
7
|
+
import type { GeneralField, FieldDisplayTypes, ArrayField } from "@formily/core";
|
|
8
|
+
import type { ReactFC } from "@formily/react";
|
|
9
|
+
import { useField, observer, useFieldSchema, RecursionField } from "@formily/react";
|
|
9
10
|
import { isArr, isBool, isFn } from "@formily/shared";
|
|
10
|
-
import { Schema } from "@formily/json-schema";
|
|
11
|
+
import type { Schema } from "@formily/json-schema";
|
|
11
12
|
import { usePrefixCls, SortableContainer, SortableElement } from "c-formily-antd/lib/__builtins__";
|
|
12
|
-
import {
|
|
13
|
+
import type { ArrayBaseMixins, IArrayBaseProps } from "../ArrayBase";
|
|
14
|
+
import { ArrayBase } from "../ArrayBase";
|
|
13
15
|
|
|
14
16
|
export interface ObservableColumnSource {
|
|
15
17
|
field: GeneralField;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useField, useFieldSchema, connect, mapProps } from "@formily/react";
|
|
2
2
|
import { DatePicker as AntdDatePicker } from "c-formily-antd";
|
|
3
3
|
|
|
4
|
-
import { DatePickerProps, RangePickerProps } from "antd/lib/date-picker";
|
|
4
|
+
import type { DatePickerProps, RangePickerProps } from "antd/lib/date-picker";
|
|
5
5
|
|
|
6
6
|
import { getParentValue } from "../../common/formily-utils";
|
|
7
7
|
import { dateable } from "../../common/date-utils";
|
|
@@ -10,7 +10,7 @@ import Popup from "./components/Popup";
|
|
|
10
10
|
|
|
11
11
|
import AMapCom from "../LocationPicker/Map/AMap";
|
|
12
12
|
import MapSearch from "../LocationPicker/components/MapSearch";
|
|
13
|
-
import { MapUtils } from "../LocationPicker/Map/AMap/common/utils";
|
|
13
|
+
import type { MapUtils } from "../LocationPicker/Map/AMap/common/utils";
|
|
14
14
|
import { getAddress } from "../LocationPicker/servers";
|
|
15
15
|
import { markerIconBase64 } from "../LocationPicker/assets/svg-icon";
|
|
16
16
|
|
|
@@ -55,7 +55,7 @@ export const LocationListPicker = observer((props) => {
|
|
|
55
55
|
// 取消监听
|
|
56
56
|
mapUtilsRef.current?.off("click", onMapClick);
|
|
57
57
|
mapUtilsRef.current?.off("dblclick", onMapDbClick);
|
|
58
|
-
mapDomRef.current
|
|
58
|
+
mapDomRef.current?.current?.removeEventListener?.("mousemove", onMouseMove);
|
|
59
59
|
};
|
|
60
60
|
}, []);
|
|
61
61
|
|
|
@@ -172,8 +172,8 @@ export const LocationListPicker = observer((props) => {
|
|
|
172
172
|
|
|
173
173
|
function getPolygonCenter(coordinate) {
|
|
174
174
|
if (coordinate.length > 0) {
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
const features = turf.featureCollection(coordinate.map((item) => turf.point(item)));
|
|
176
|
+
const center = turf.center(features).geometry.coordinates;
|
|
177
177
|
return center;
|
|
178
178
|
}
|
|
179
179
|
return [];
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import AMapLoader from "@amap/amap-jsapi-loader"
|
|
2
|
+
|
|
1
3
|
const defaultVersion = "2.0";
|
|
2
4
|
const defaultPlugins = ["AMap.Geocoder", "AMap.AutoComplete", "AMap.PolygonEditor", "AMap.PolylineEditor"];
|
|
3
5
|
|
|
@@ -33,9 +35,6 @@ function Loader(opt) {
|
|
|
33
35
|
|
|
34
36
|
window._AMapLoaderTemp.plugins = plugins ? [...defaultPlugins, ...(plugins || [])] : defaultPlugins;
|
|
35
37
|
|
|
36
|
-
// 不用地图组件时可以不安装 "@amap/amap-jsapi-loader"
|
|
37
|
-
const AMapLoader = require("@amap/amap-jsapi-loader");
|
|
38
|
-
|
|
39
38
|
window._AMapLoaderTemp.loading = true;
|
|
40
39
|
window._AMapLoaderTemp.promise = AMapLoader.load({
|
|
41
40
|
key: key || window._AMapLoaderTemp.key, // 申请好的Web端开发者Key,首次调用 load 时必填
|
|
@@ -35,12 +35,12 @@ export interface IMarker {
|
|
|
35
35
|
export type setMarkerOptT = {
|
|
36
36
|
id?: number | string;
|
|
37
37
|
marker?: IMarker;
|
|
38
|
-
map?:
|
|
39
|
-
AMap?:
|
|
40
|
-
markerIconConf?:
|
|
41
|
-
markerConf?:
|
|
38
|
+
map?: object;
|
|
39
|
+
AMap?: object;
|
|
40
|
+
markerIconConf?: object;
|
|
41
|
+
markerConf?: object;
|
|
42
42
|
onClick?: Function;
|
|
43
|
-
data?:
|
|
43
|
+
data?: object;
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
export type markersT = {
|
|
@@ -141,7 +141,7 @@ export class MapUtils {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
const position = new AMap.LngLat(lon, lat);
|
|
144
|
-
|
|
144
|
+
const _marker = marker || this.markers[id];
|
|
145
145
|
|
|
146
146
|
// 创建 Marker 或修改位置
|
|
147
147
|
if (_marker) {
|
|
@@ -343,7 +343,7 @@ export class MapUtils {
|
|
|
343
343
|
// circles
|
|
344
344
|
|
|
345
345
|
const center = new AMap.LngLat(lon, lat);
|
|
346
|
-
|
|
346
|
+
const _circle = circle || this.circles[id];
|
|
347
347
|
|
|
348
348
|
// 创建 Marker 或修改位置
|
|
349
349
|
if (_circle) {
|
|
@@ -412,8 +412,8 @@ export class MapUtils {
|
|
|
412
412
|
|
|
413
413
|
getPolygonCenter(coordinate) {
|
|
414
414
|
if (coordinate.length > 0) {
|
|
415
|
-
|
|
416
|
-
|
|
415
|
+
const features = turf.featureCollection(coordinate.map((item) => turf.point(item)));
|
|
416
|
+
const center = turf.center(features).geometry.coordinates;
|
|
417
417
|
return center;
|
|
418
418
|
}
|
|
419
419
|
return [];
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
export function getPropsValue(value = {}, opt) {
|
|
14
14
|
const { lonKey = "longitude", latKey = "latitude", addrKey = "address", pointsKey = "points", rangeKey = "range" } = opt || {};
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
const lon = value[lonKey];
|
|
17
|
+
const lat = value[latKey];
|
|
18
|
+
const addr = value[addrKey];
|
|
19
|
+
const points = value[pointsKey];
|
|
20
|
+
const range = value[rangeKey];
|
|
21
21
|
|
|
22
22
|
const res = {
|
|
23
23
|
lon,
|
|
@@ -8,7 +8,7 @@ import Notice from "../Notice";
|
|
|
8
8
|
import MapSearch from "../MapSearch";
|
|
9
9
|
|
|
10
10
|
import { getCurrentPosition } from "../../../../common/location-utils";
|
|
11
|
-
import { MapUtils } from "../../Map/AMap/common/utils";
|
|
11
|
+
import type { MapUtils } from "../../Map/AMap/common/utils";
|
|
12
12
|
import { getAddress } from "../../servers";
|
|
13
13
|
import { getPropsValue } from "../../common/utils";
|
|
14
14
|
|
|
@@ -85,9 +85,9 @@ export const ModalContent = observer((props: any) => {
|
|
|
85
85
|
useEffect(() => {
|
|
86
86
|
if (isShowMode) {
|
|
87
87
|
// mode === 'show' 的情况
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
const _lon = formatVal.lon;
|
|
89
|
+
const _lat = formatVal.lat;
|
|
90
|
+
const _points = formatVal.points;
|
|
91
91
|
formatValRef.current = {
|
|
92
92
|
...formatVal,
|
|
93
93
|
};
|
|
@@ -116,7 +116,7 @@ export const ModalContent = observer((props: any) => {
|
|
|
116
116
|
// 处理弹窗展示数据回显逻辑
|
|
117
117
|
let _lon = defaultLocation.lon;
|
|
118
118
|
let _lat = defaultLocation.lat;
|
|
119
|
-
|
|
119
|
+
const _points = defaultLocation.points || [];
|
|
120
120
|
let addr = defaultLocation.addr;
|
|
121
121
|
if (formatVal.lon && formatVal.lat) {
|
|
122
122
|
_lon = formatVal.lon;
|
|
@@ -6,8 +6,8 @@ const HandleMobileRem: any = (props) => {
|
|
|
6
6
|
|
|
7
7
|
const init = () => {
|
|
8
8
|
const newStr = content.replace(/(\d+(\.\d+)?)px/g, function (match) {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const num = parseInt(match); // 提取数字部分
|
|
10
|
+
const remValue = num / (designWidth / 10); // 根据换算比例计算 rem 值
|
|
11
11
|
return remValue + 'rem';
|
|
12
12
|
});
|
|
13
13
|
(editorArticleRef.current as HTMLElement).innerHTML = newStr
|
|
@@ -10,7 +10,7 @@ const HandleMobileVw: any = (props) => {
|
|
|
10
10
|
|
|
11
11
|
const init = () => {
|
|
12
12
|
const newStr = content.replace(/(\d+(\.\d+)?)px/g, function (match) {
|
|
13
|
-
|
|
13
|
+
const num = parseInt(match); // 提取数字部分
|
|
14
14
|
return `${getClientRate(num, designWidth) * 100}vw`;
|
|
15
15
|
});
|
|
16
16
|
(editorArticleRef.current as HTMLElement).innerHTML = newStr
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@wangeditor/editor/dist/css/style.css"; // 引入 css
|
|
2
2
|
import React, { useState, useEffect, useImperativeHandle, forwardRef } from "react";
|
|
3
3
|
import { Editor as WangEditor, Toolbar } from "@wangeditor/editor-for-react";
|
|
4
|
-
import { IDomEditor, IEditorConfig, IToolbarConfig } from "@wangeditor/editor";
|
|
4
|
+
import type { IDomEditor, IEditorConfig, IToolbarConfig } from "@wangeditor/editor";
|
|
5
5
|
import { getOssUploadRequest, getOfflineUploadRequest } from "../Upload/common/customRequest";
|
|
6
6
|
import { handlePreviewUrls } from "../Upload/common/OfflineUpload";
|
|
7
7
|
import "./index.less";
|
|
@@ -25,7 +25,7 @@ export function getTabTableData(_treeData = [], opt: ITabTableDataOpt = {}) {
|
|
|
25
25
|
const treeData = _.cloneDeep(_treeData);
|
|
26
26
|
const { tabLevel = 0, _level = 0, fieldNames } = opt || {};
|
|
27
27
|
const { value, children } = fieldNames || {};
|
|
28
|
-
|
|
28
|
+
const resList = [];
|
|
29
29
|
// 当前层级小于 tabLevel,视为当前层级渲染为 tab
|
|
30
30
|
const isTab = _level < tabLevel;
|
|
31
31
|
|
|
@@ -70,7 +70,7 @@ export interface IHandlerOpt {
|
|
|
70
70
|
/** 子项数据模式: 格式化对象 | file 文件格式 | url 地址 | JSON 序列化字符串 */
|
|
71
71
|
itemMode: "object" | "file" | "url" | "jsonStr";
|
|
72
72
|
/** 预览配置参数 */
|
|
73
|
-
previewConfig?:
|
|
73
|
+
previewConfig?: object;
|
|
74
74
|
thumbnailParams?: string;
|
|
75
75
|
/** maxCount === 1 时是否去除数组,直接返回内容 */
|
|
76
76
|
isResRemoveArr: boolean;
|
|
@@ -153,7 +153,7 @@ export const handleInputItem = (data, opt: IHandlerOpt) => {
|
|
|
153
153
|
}
|
|
154
154
|
const { thumbnailParams } = opt;
|
|
155
155
|
|
|
156
|
-
|
|
156
|
+
const file = {
|
|
157
157
|
...fileTpl,
|
|
158
158
|
};
|
|
159
159
|
// 对象字符串 转为 对象
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { useState, useRef, useEffect, useMemo } from "react";
|
|
2
2
|
import { Button, Modal, message } from "antd";
|
|
3
|
+
import _ from "lodash";
|
|
3
4
|
|
|
4
5
|
import ItemList from "./components/ItemList";
|
|
5
6
|
|
|
6
|
-
import { handleMaxCount } from "@hzab/utils/upload/uploadUtils";
|
|
7
|
+
import { handleMaxCount } from "@hzab/utils/src/upload/uploadUtils";
|
|
7
8
|
import { handleInputFileList, handleOutputFileList } from "./common/handleIOFileList";
|
|
8
9
|
import { handleOssUpload } from "./common/ossUpload";
|
|
9
10
|
|
|
10
11
|
import "./uploader.less";
|
|
11
12
|
|
|
12
|
-
const _ = require("lodash");
|
|
13
|
-
|
|
14
13
|
function Uploader(props) {
|
|
15
14
|
const {
|
|
16
15
|
name,
|
|
@@ -68,6 +68,7 @@ export function Uploader({ onChange, ...props }) {
|
|
|
68
68
|
isFileJson = false,
|
|
69
69
|
thumbnailParams = { image_process: "resize,w_200" },
|
|
70
70
|
readPretty,
|
|
71
|
+
afterUpload,
|
|
71
72
|
} = props;
|
|
72
73
|
const isPrivateStore =
|
|
73
74
|
props.uploadParams?.fileAcl === "private" || props.ossOpt?.signatureParams?.fileAcl === "private";
|
|
@@ -155,6 +156,13 @@ export function Uploader({ onChange, ...props }) {
|
|
|
155
156
|
});
|
|
156
157
|
|
|
157
158
|
onChange && onChange?.(_files);
|
|
159
|
+
|
|
160
|
+
// 上传完成后回调(同步自源仓 1.7.18)
|
|
161
|
+
if (afterUpload) {
|
|
162
|
+
await afterUpload({ files: fileList, urls: _files });
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
setChecking(false);
|
|
158
166
|
};
|
|
159
167
|
|
|
160
168
|
useEffect(() => {
|
|
@@ -294,7 +302,6 @@ export function Uploader({ onChange, ...props }) {
|
|
|
294
302
|
return AUpload.LIST_IGNORE;
|
|
295
303
|
}
|
|
296
304
|
}
|
|
297
|
-
setChecking(false);
|
|
298
305
|
},
|
|
299
306
|
customRequest,
|
|
300
307
|
...(props || {}),
|
|
@@ -2,7 +2,7 @@ import React, { useCallback, useMemo } from "react";
|
|
|
2
2
|
import { Select as AntdSelect, Avatar, type AvatarProps } from "antd";
|
|
3
3
|
import { useField, useFieldSchema } from "@formily/react";
|
|
4
4
|
import { observer } from "@formily/reactive-react";
|
|
5
|
-
import { SelectProps as AntdSelectProps } from "antd/lib/select";
|
|
5
|
+
import type { SelectProps as AntdSelectProps } from "antd/lib/select";
|
|
6
6
|
|
|
7
7
|
import styles from "./index.module.less";
|
|
8
8
|
|
package/src/global.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
AMap?: any;
|
|
5
|
+
_AMapLoaderTemp?: any;
|
|
6
|
+
_AMapSecurityConfig?: { securityJsCode?: string };
|
|
7
|
+
formRenderPCGlobalServeConfig?: Record<string, any>;
|
|
8
|
+
// 下潜进 @hzab/utils 源码(node10)时会 typecheck 到 utils 的全局,需在此声明。
|
|
9
|
+
_$offlineSignatureRes?: any;
|
|
10
|
+
formilyGlobalComponents?: Record<string, any>;
|
|
11
|
+
}
|
|
12
|
+
}
|
package/src/index.tsx
CHANGED
|
@@ -39,7 +39,7 @@ import { bindOnChange } from "./common/schema-handler";
|
|
|
39
39
|
|
|
40
40
|
import "./index.less";
|
|
41
41
|
|
|
42
|
-
const antdComponents = {
|
|
42
|
+
const antdComponents: any = {
|
|
43
43
|
Form,
|
|
44
44
|
FormItem,
|
|
45
45
|
DatePicker,
|
|
@@ -70,7 +70,7 @@ const antdComponents = {
|
|
|
70
70
|
|
|
71
71
|
const FormRender = forwardRef((props: any, parentRef) => {
|
|
72
72
|
/** schema scope 解决父级无 schema Scope 导致 scope 对象刷新的问题 */
|
|
73
|
-
const schemaScopeRef = useRef<{ _$tempData:
|
|
73
|
+
const schemaScopeRef = useRef<{ _$tempData: object }>({
|
|
74
74
|
scenario: "form-render",
|
|
75
75
|
_$tempData: {},
|
|
76
76
|
...props.schemaScope,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|