@hzab/form-render-mobile 1.2.8 → 1.2.9
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/LICENSE +21 -0
- package/dist/common/array-base-utils.d.ts +9 -0
- package/dist/common/global-props-context.d.ts +8 -0
- package/dist/common/location-utils.d.ts +80 -0
- package/dist/components/ArrayCards/index.d.ts +10 -0
- package/dist/components/ArrayTable/common/utils.d.ts +23 -0
- package/dist/components/ArrayTable/index.d.ts +8 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/DatePicker/common/utils.d.ts +1 -0
- package/dist/components/DatePicker/index.d.ts +16 -0
- package/dist/components/FormCollapse/index.d.ts +30 -0
- package/dist/components/FormItem/common/useFormItemLayout.d.ts +83 -0
- package/dist/components/FormItem/index.d.ts +9 -0
- package/dist/components/FormLayout/index.d.ts +76 -0
- package/dist/components/FormLayout/style.d.ts +1 -0
- package/dist/components/FormLayout/useResponsiveFormLayout.d.ts +17 -0
- package/dist/components/LocationPicker/Map/AMap/common/loader.d.ts +2 -0
- package/dist/components/LocationPicker/Map/AMap/common/utils.d.ts +74 -0
- package/dist/components/LocationPicker/common/utils.d.ts +24 -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/PickerRightOutline/index.d.ts +3 -0
- package/dist/components/Placeholder/index.d.ts +7 -0
- package/dist/components/Radio/index.d.ts +2 -0
- package/dist/components/Select/index.d.ts +8 -0
- package/dist/components/Slider/index.d.ts +2 -0
- package/dist/components/Text/index.d.ts +9 -0
- package/dist/components/TimePicker/common/utils.d.ts +1 -0
- package/dist/components/TimePicker/index.d.ts +6 -0
- package/dist/components/TreeSelect/SelectList/index.d.ts +3 -0
- package/dist/components/TreeSelect/TreeSearch/index.d.ts +3 -0
- package/dist/components/TreeSelect/common/data-handler.d.ts +70 -0
- package/dist/components/TreeSelect/index.d.ts +3 -0
- package/dist/components/Uploader/common/checkFileType.d.ts +4 -0
- package/dist/components/Uploader/common/img.d.ts +10 -0
- package/dist/components/Uploader/components/Image/index.d.ts +3 -0
- package/dist/components/Uploader/components/ItemList/ItemRender.d.ts +2 -0
- package/dist/components/Uploader/components/ItemList/index.d.ts +2 -0
- package/dist/components/UserSelect/index.d.ts +37 -0
- package/dist/components/index.d.ts +20 -0
- package/dist/globalConfig.d.ts +6 -0
- package/dist/index.cjs +1 -0
- package/dist/index.css +2 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +3178 -0
- package/package.json +65 -76
- package/src/common/array-base-utils.ts +1 -1
- package/src/components/ArrayCards/index.tsx +5 -3
- package/src/components/ArrayTable/common/utils.tsx +2 -2
- package/src/components/ArrayTable/index.tsx +6 -3
- package/src/components/Checkbox/index.tsx +1 -1
- package/src/components/DatePicker/index.tsx +3 -3
- package/src/components/FormCollapse/index.tsx +5 -3
- package/src/components/FormItem/index.tsx +2 -1
- package/src/components/FormLayout/useResponsiveFormLayout.ts +1 -1
- package/src/components/LocationPicker/Map/AMap/common/utils.ts +6 -6
- package/src/components/LocationPicker/common/utils.ts +3 -3
- package/src/components/LocationPicker/components/ModalContent/index.tsx +1 -1
- package/src/components/LocationPicker/index.tsx +1 -1
- package/src/components/Radio/index.tsx +2 -1
- package/src/components/Select/index.tsx +2 -2
- package/src/components/TimePicker/common/utils.ts +1 -1
- package/src/components/TimePicker/index.tsx +2 -2
- package/src/components/Uploader/common/img.ts +4 -4
- package/src/components/UserSelect/index.tsx +1 -1
- package/src/global.d.ts +14 -0
- package/src/index.tsx +1 -1
- package/src/type.d.ts +7 -6
- package/src/vite-env.d.ts +1 -0
- package/README.md +0 -111
package/package.json
CHANGED
|
@@ -1,76 +1,65 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@hzab/form-render-mobile",
|
|
3
|
-
"version": "1.2.
|
|
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
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
},
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"src/**/**.{js,jsx,ts,tsx,css,scss,less,json,html}": [
|
|
67
|
-
"prettier --write"
|
|
68
|
-
],
|
|
69
|
-
"example/**.{js,jsx,ts,tsx,css,scss,less,json,html}": [
|
|
70
|
-
"prettier --write"
|
|
71
|
-
],
|
|
72
|
-
"example/**/**.{js,jsx,ts,tsx,css,scss,less,json,html}": [
|
|
73
|
-
"prettier --write"
|
|
74
|
-
]
|
|
75
|
-
}
|
|
76
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@hzab/form-render-mobile",
|
|
3
|
+
"version": "1.2.9",
|
|
4
|
+
"private": false,
|
|
5
|
+
"src-direct": true,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"description": "formily-form-render-mobile",
|
|
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
|
+
"CHANGELOG.md"
|
|
19
|
+
],
|
|
20
|
+
"sideEffects": [
|
|
21
|
+
"**/*.less"
|
|
22
|
+
],
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"react": ">=16.8.0",
|
|
25
|
+
"react-dom": ">=16.8.0"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@amap/amap-jsapi-loader": "^1.0.1",
|
|
29
|
+
"@formily/antd-mobile": "1.0.0-beta.3",
|
|
30
|
+
"@formily/core": "2.2.29",
|
|
31
|
+
"@formily/json-schema": "2.2.29",
|
|
32
|
+
"@formily/react": "2.2.29",
|
|
33
|
+
"@formily/reactive": "2.2.29",
|
|
34
|
+
"@formily/shared": "2.2.29",
|
|
35
|
+
"@hzab/data-model": ">=0.0.3",
|
|
36
|
+
"@hzab/utils": ">=1.0.16",
|
|
37
|
+
"antd-mobile": "^5.32.0",
|
|
38
|
+
"antd-mobile-icons": "^0.2.2",
|
|
39
|
+
"classnames": "^2.3.2",
|
|
40
|
+
"dayjs": "^1.11.7",
|
|
41
|
+
"lodash": "^4.17.21",
|
|
42
|
+
"nanoid": "^3.3.7",
|
|
43
|
+
"react-virtualized": "^9.22.5"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/react": "^17.0.62",
|
|
47
|
+
"@types/react-dom": "^17.0.20",
|
|
48
|
+
"@vitest/coverage-v8": "4.1.10",
|
|
49
|
+
"happy-dom": "^20.11.1",
|
|
50
|
+
"react": "^17.0.2",
|
|
51
|
+
"react-dom": "^17.0.2",
|
|
52
|
+
"typescript": "^5.9.3",
|
|
53
|
+
"vite": "^8.0.0",
|
|
54
|
+
"vitest": "^4.1.10",
|
|
55
|
+
"@hzab/typescript-config": "^0.0.0",
|
|
56
|
+
"@hzab/eslint-config": "^0.0.0",
|
|
57
|
+
"@hzab/vite-config": "^0.0.3-alpha.0"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "vite build && tsc -p tsconfig.build.json",
|
|
61
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
62
|
+
"test": "vitest run --passWithNoTests",
|
|
63
|
+
"test:watch": "vitest"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { CardProps } from "antd-mobile";
|
|
3
|
+
import { Card, Empty } from "antd-mobile";
|
|
4
|
+
import type { ArrayField } from "@formily/core";
|
|
4
5
|
import { useField, observer, useFieldSchema, RecursionField } from "@formily/react";
|
|
5
6
|
import cls from "classnames";
|
|
6
7
|
import { usePrefixCls } from "@formily/antd-mobile/esm/__builtins__";
|
|
7
|
-
import {
|
|
8
|
+
import type { ArrayBaseMixins, IArrayBaseProps } from "@formily/antd-mobile/esm/array-base";
|
|
9
|
+
import { ArrayBase } from "@formily/antd-mobile/esm/array-base";
|
|
8
10
|
import {
|
|
9
11
|
isAdditionComponent,
|
|
10
12
|
isIndexComponent,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createContext, useContext } from "react";
|
|
2
|
-
import { GeneralField, FieldDisplayTypes, ArrayField } from "@formily/core";
|
|
2
|
+
import type { GeneralField, FieldDisplayTypes, ArrayField } from "@formily/core";
|
|
3
3
|
import { useField, observer, useFieldSchema, RecursionField, ReactFC } from "@formily/react";
|
|
4
4
|
import { isArr } from "@formily/shared";
|
|
5
|
-
import { Schema } from "@formily/json-schema";
|
|
5
|
+
import type { Schema } from "@formily/json-schema";
|
|
6
6
|
import { ArrayBase, ArrayBaseMixins, IArrayBaseProps } from "@formily/antd-mobile/esm/array-base";
|
|
7
7
|
|
|
8
8
|
import { isAdditionComponent } from "../../../common/array-base-utils";
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import React, { Fragment, useState, useRef, useEffect, createContext, useContext, useCallback } from "react";
|
|
2
2
|
import cls from "classnames";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import type { ArrayField } from "@formily/core";
|
|
4
|
+
import { GeneralField, FieldDisplayTypes } from "@formily/core";
|
|
5
|
+
import type { ReactFC } from "@formily/react";
|
|
6
|
+
import { useField, observer, useFieldSchema, RecursionField } from "@formily/react";
|
|
5
7
|
import { isArr, isBool, isFn } from "@formily/shared";
|
|
6
8
|
import { Schema } from "@formily/json-schema";
|
|
7
9
|
import { usePrefixCls } from "@formily/antd-mobile/esm/__builtins__";
|
|
8
|
-
import {
|
|
10
|
+
import type { ArrayBaseMixins, IArrayBaseProps } from "@formily/antd-mobile/esm/array-base";
|
|
11
|
+
import { ArrayBase } from "@formily/antd-mobile/esm/array-base";
|
|
9
12
|
|
|
10
13
|
import {
|
|
11
14
|
isColumnComponent,
|
|
@@ -2,7 +2,7 @@ import React, { useEffect, useMemo, useState } from "react";
|
|
|
2
2
|
import { Checkbox as AntdCheckbox, Selector, List, Space } from "antd-mobile";
|
|
3
3
|
import { useField, useFieldSchema, observer } from "@formily/react";
|
|
4
4
|
import type { ISchema } from "@formily/react";
|
|
5
|
-
import { CheckboxProps, CheckboxGroupProps } from "antd-mobile/es/components/checkbox";
|
|
5
|
+
import type { CheckboxProps, CheckboxGroupProps } from "antd-mobile/es/components/checkbox";
|
|
6
6
|
|
|
7
7
|
const checkboxColorMap = {
|
|
8
8
|
defaultColor: "#f5f5f5",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState, useEffect, useMemo } from "react";
|
|
2
2
|
import { useField, observer } from "@formily/react";
|
|
3
3
|
import { DatePicker as ADataPicker } from "antd-mobile";
|
|
4
|
-
import { Precision } from "antd-mobile/2x/es/components/date-picker/date-picker-utils";
|
|
4
|
+
import type { Precision } from "antd-mobile/2x/es/components/date-picker/date-picker-utils";
|
|
5
5
|
import { RightOutline } from "antd-mobile-icons";
|
|
6
6
|
import dayjs from "dayjs";
|
|
7
7
|
|
|
@@ -31,11 +31,11 @@ const formatEnum = {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
type fieldT = {
|
|
34
|
-
dataSource: Array<
|
|
34
|
+
dataSource: Array<object>;
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
type DatePickerPropsT = {
|
|
38
|
-
value: string | number |
|
|
38
|
+
value: string | number | object;
|
|
39
39
|
disabled: boolean;
|
|
40
40
|
readOnly: boolean;
|
|
41
41
|
placeholder: string;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import type { ReactNode} from "react";
|
|
2
|
+
import React, { Fragment, useMemo, useState } from "react";
|
|
3
|
+
import type { CollapsePanelProps } from "antd-mobile";
|
|
4
|
+
import { Collapse, Badge, CollapseProps } from "antd-mobile";
|
|
3
5
|
import { model, markRaw } from "@formily/reactive";
|
|
4
6
|
import { useField, observer, useFieldSchema, RecursionField } from "@formily/react";
|
|
5
|
-
import { Schema, SchemaKey } from "@formily/json-schema";
|
|
7
|
+
import type { Schema, SchemaKey } from "@formily/json-schema";
|
|
6
8
|
import cls from "classnames";
|
|
7
9
|
import { usePrefixCls } from "@formily/antd-mobile/esm/__builtins__";
|
|
8
10
|
import { toArr } from "@formily/shared";
|
|
@@ -9,7 +9,8 @@ import { Popover } from "antd-mobile";
|
|
|
9
9
|
import { CheckCircleOutline, CloseCircleOutline, ExclamationCircleOutline } from "antd-mobile-icons";
|
|
10
10
|
|
|
11
11
|
import { useGlobalPropsContext } from "../../common/global-props-context";
|
|
12
|
-
import { IFormItemProps
|
|
12
|
+
import type { IFormItemProps} from "./common/useFormItemLayout";
|
|
13
|
+
import { useFormItemLayout } from "./common/useFormItemLayout";
|
|
13
14
|
|
|
14
15
|
import "./index.less";
|
|
15
16
|
|
|
@@ -44,7 +44,7 @@ const calcFactor = <T>(value: T | T[], breakpointIndex: number): T => {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
const factor = <T>(value: T | T[], breakpointIndex: number): T =>
|
|
47
|
-
isValid(value) ? calcFactor(value as any, breakpointIndex) : value;
|
|
47
|
+
isValid(value) ? calcFactor(value as any, breakpointIndex) : (value as T);
|
|
48
48
|
|
|
49
49
|
const calculateProps: ICalculateProps = (target, props) => {
|
|
50
50
|
const { clientWidth } = target;
|
|
@@ -24,14 +24,14 @@ export function setSecurityJsCode(securityJsCode) {
|
|
|
24
24
|
|
|
25
25
|
export type setMarkerOptT = {
|
|
26
26
|
id?: number | string;
|
|
27
|
-
marker?:
|
|
28
|
-
map?:
|
|
29
|
-
AMap?:
|
|
30
|
-
markerIconConf?:
|
|
27
|
+
marker?: object;
|
|
28
|
+
map?: object;
|
|
29
|
+
AMap?: object;
|
|
30
|
+
markerIconConf?: object;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
export type markersT = {
|
|
34
|
-
[k: number | string]:
|
|
34
|
+
[k: number | string]: object;
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
export class MapUtils {
|
|
@@ -128,7 +128,7 @@ export class MapUtils {
|
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
130
|
const position = new AMap.LngLat(lon, lat);
|
|
131
|
-
|
|
131
|
+
const _marker = marker || this.markers[id];
|
|
132
132
|
// 创建 Marker 或修改位置
|
|
133
133
|
if (_marker) {
|
|
134
134
|
// @ts-ignore
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export function getPropsValue(value = {}, opt) {
|
|
14
14
|
const { lonKey = "longitude", latKey = "latitude", addrKey = "address" } = opt || {};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const lon = value[lonKey];
|
|
16
|
+
const lat = value[latKey];
|
|
17
|
+
const addr = value[addrKey];
|
|
18
18
|
const res = {
|
|
19
19
|
lon,
|
|
20
20
|
lat,
|
|
@@ -9,7 +9,7 @@ import Notice from "../Notice";
|
|
|
9
9
|
import MapSearch from "../MapSearch";
|
|
10
10
|
|
|
11
11
|
import { getCurrentPosition } from "../../../../common/location-utils";
|
|
12
|
-
import { MapUtils } from "../../Map/AMap/common/utils";
|
|
12
|
+
import type { MapUtils } from "../../Map/AMap/common/utils";
|
|
13
13
|
import { getAddress } from "../../servers";
|
|
14
14
|
import { getPropsValue } from "../../common/utils";
|
|
15
15
|
|
|
@@ -5,7 +5,7 @@ import { observer } from "@formily/react";
|
|
|
5
5
|
import ResInfo from "./components/ResInfo";
|
|
6
6
|
import ModalContent from "./components/ModalContent";
|
|
7
7
|
|
|
8
|
-
import { MapUtils } from "./Map/AMap/common/utils";
|
|
8
|
+
import type { MapUtils } from "./Map/AMap/common/utils";
|
|
9
9
|
import { getCurrentPosition } from "../../common/location-utils";
|
|
10
10
|
import { getPropsValue } from "./common/utils";
|
|
11
11
|
import { getAddress } from "./servers";
|
|
@@ -2,7 +2,8 @@ import React, { useEffect } from "react";
|
|
|
2
2
|
import { Radio as AntdRadio, Selector } from "antd-mobile";
|
|
3
3
|
import { observer, useField, useFieldSchema } from "@formily/react";
|
|
4
4
|
import type { ISchema } from "@formily/react";
|
|
5
|
-
import {
|
|
5
|
+
import type { RadioGroupProps } from "antd-mobile/es/components/radio";
|
|
6
|
+
import { RadioProps } from "antd-mobile/es/components/radio";
|
|
6
7
|
|
|
7
8
|
const CustomRadio: React.FC<RadioGroupProps> = (props) => {
|
|
8
9
|
const field: any = useField();
|
|
@@ -6,12 +6,12 @@ import { RightOutline } from "antd-mobile-icons";
|
|
|
6
6
|
import PickerRightOutline from "../PickerRightOutline";
|
|
7
7
|
import Placeholder from "../Placeholder";
|
|
8
8
|
|
|
9
|
-
import { formItemProps } from "../form-item";
|
|
9
|
+
import type { formItemProps } from "../form-item";
|
|
10
10
|
|
|
11
11
|
import "./index.less";
|
|
12
12
|
|
|
13
13
|
type fieldT = {
|
|
14
|
-
dataSource: Array<
|
|
14
|
+
dataSource: Array<object>;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
type SelectPropsT = {
|
|
@@ -4,7 +4,7 @@ import { Picker } from "antd-mobile";
|
|
|
4
4
|
import PickerRightOutline from "../PickerRightOutline";
|
|
5
5
|
import Placeholder from "../Placeholder";
|
|
6
6
|
import { getTimeColumns } from "./common/utils";
|
|
7
|
-
import { formItemProps } from "../form-item";
|
|
7
|
+
import type { formItemProps } from "../form-item";
|
|
8
8
|
|
|
9
9
|
type TimePickerPropsT = {
|
|
10
10
|
use12Hours: boolean;
|
|
@@ -50,7 +50,7 @@ export const TimePicker = observer((props: TimePickerPropsT) => {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
// 拆分字符串数据并转为数字格式
|
|
53
|
-
|
|
53
|
+
const pickerVal = value?.split(":");
|
|
54
54
|
if (use12Hours && pickerVal && pickerVal.length > 0) {
|
|
55
55
|
const t = pickerVal[2];
|
|
56
56
|
pickerVal.splice(2, 1, t.split(" ")?.[0]);
|
|
@@ -10,7 +10,7 @@ export const loadHeaderImage = (src, headers) => {
|
|
|
10
10
|
}
|
|
11
11
|
xhr.onload = function () {
|
|
12
12
|
if (xhr.status === 200) {
|
|
13
|
-
|
|
13
|
+
const blob = xhr.response;
|
|
14
14
|
resolve(URL.createObjectURL(blob));
|
|
15
15
|
}
|
|
16
16
|
};
|
|
@@ -46,10 +46,10 @@ export function scaleImg(src, size = { width: 1024 }) {
|
|
|
46
46
|
|
|
47
47
|
export function dataURLtoBlob(dataurl) {
|
|
48
48
|
const arr = dataurl.split(",");
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
const mime = arr[0].match(/:(.*?);/)[1];
|
|
50
|
+
const bstr = atob(arr[1]);
|
|
51
51
|
let n = bstr.length;
|
|
52
|
-
|
|
52
|
+
const u8arr = new Uint8Array(n);
|
|
53
53
|
|
|
54
54
|
while (n--) {
|
|
55
55
|
u8arr[n] = bstr.charCodeAt(n);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useMemo, useState } from "react";
|
|
2
2
|
import { Popup, CheckList, Avatar, Button, type AvatarProps } from "antd-mobile";
|
|
3
3
|
import { useField, useFieldSchema } from "@formily/react";
|
|
4
|
-
import { IFieldState } from "@formily/core";
|
|
4
|
+
import type { IFieldState } from "@formily/core";
|
|
5
5
|
|
|
6
6
|
import styles from "./index.module.less";
|
|
7
7
|
|
package/src/global.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
AMap?: any;
|
|
5
|
+
_AMapLoaderTemp?: any;
|
|
6
|
+
_AMapSecurityConfig?: { securityJsCode?: string };
|
|
7
|
+
formRenderGlobalServeConfig?: Record<string, any>;
|
|
8
|
+
// 下潜进 @hzab/utils 源码(node10)时会 typecheck 到 utils 的全局,需在此声明。
|
|
9
|
+
_$offlineSignatureRes?: any;
|
|
10
|
+
_$ossSignatureRes?: any;
|
|
11
|
+
formilyGlobalComponents?: Record<string, any>;
|
|
12
|
+
utilsGlobalServeConfig?: Record<string, any>;
|
|
13
|
+
}
|
|
14
|
+
}
|
package/src/index.tsx
CHANGED
|
@@ -28,7 +28,7 @@ import { schemaHandler } from "./common/schemaHandler";
|
|
|
28
28
|
|
|
29
29
|
import FormLayout, { FormLayoutDeepContext } from "./components/FormLayout";
|
|
30
30
|
|
|
31
|
-
import { formPropsI } from "./type.d";
|
|
31
|
+
import type { formPropsI } from "./type.d";
|
|
32
32
|
|
|
33
33
|
import "./index.less";
|
|
34
34
|
|
package/src/type.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { ReactElement } from "react";
|
|
2
|
-
import { SchemaReactComponents
|
|
3
|
-
import {
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { SchemaReactComponents} from "@formily/react";
|
|
3
|
+
import { Schema } from "@formily/react";
|
|
4
|
+
import type { Form } from "@formily/core";
|
|
4
5
|
|
|
5
6
|
export interface formPropsI {
|
|
6
7
|
/** 元素类名 */
|
|
7
8
|
className?: string;
|
|
8
9
|
/** 表单初始值 */
|
|
9
|
-
initialValues?:
|
|
10
|
+
initialValues?: object;
|
|
10
11
|
/** 表单 schema */
|
|
11
12
|
schema: any;
|
|
12
13
|
/** formily scope 自定义数据 */
|
|
13
|
-
schemaScope?:
|
|
14
|
+
schemaScope?: object;
|
|
14
15
|
/** formily 自定义组件 */
|
|
15
16
|
components?: SchemaReactComponents;
|
|
16
17
|
/** 是否详情页面 */
|
|
@@ -20,7 +21,7 @@ export interface formPropsI {
|
|
|
20
21
|
/** 是否禁用 */
|
|
21
22
|
disabled?: boolean;
|
|
22
23
|
/** createForm 配置项 */
|
|
23
|
-
formOptions?:
|
|
24
|
+
formOptions?: object;
|
|
24
25
|
/** 是否有提交按钮 */
|
|
25
26
|
hasSubmit?: boolean;
|
|
26
27
|
/** 提交按钮文案 */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
package/README.md
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
# @hzab/form-render-mobile
|
|
2
|
-
|
|
3
|
-
组件模板
|
|
4
|
-
|
|
5
|
-
- node@16.x
|
|
6
|
-
|
|
7
|
-
# 注意
|
|
8
|
-
|
|
9
|
-
- Upload 拍照需要用到 cordova 插件,通过 props.getImgOpt.isMediaCapturePlugin, props.getImgOpt.isCameraPlugin 配置
|
|
10
|
-
- isMediaCapturePlugin cordova 插件: cordova-plugin-media-capture
|
|
11
|
-
- isCameraPlugin cordova 插件: cordova-plugin-camera
|
|
12
|
-
|
|
13
|
-
# 组件
|
|
14
|
-
|
|
15
|
-
## 示例
|
|
16
|
-
|
|
17
|
-
```jsx
|
|
18
|
-
import { useRef } from "react";
|
|
19
|
-
import FormRender from "@hzab/form-render-mobile";
|
|
20
|
-
|
|
21
|
-
import Schema from "./test.schema.json";
|
|
22
|
-
|
|
23
|
-
export default () => {
|
|
24
|
-
const formRef = useRef({
|
|
25
|
-
formRender: Object,
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
function onClick() {
|
|
29
|
-
console.log(JSON.stringify(formRef?.current?.formRender.values));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<div>
|
|
34
|
-
<FormRender ref={formRef} schema={Schema} initialValues={ipt:'xxxxssss'} />
|
|
35
|
-
<button onClick={onClick}>提交</button>
|
|
36
|
-
</div>
|
|
37
|
-
);
|
|
38
|
-
};
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## API
|
|
42
|
-
|
|
43
|
-
### InfoPanel Attributes
|
|
44
|
-
|
|
45
|
-
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
46
|
-
| --------------- | --------------------- | ---- | ------ | ----------------------------- |
|
|
47
|
-
| schema | Object | 是 | - | 数据信息的 schema |
|
|
48
|
-
| className | string | 否 | - | 元素类名 |
|
|
49
|
-
| colon | string/false | 否 | : | 设置 label 后面的符号 |
|
|
50
|
-
| initialValues | Object | 否 | - | 表单初始值 |
|
|
51
|
-
| schemaScope | Object | 否 | - | formily scope 自定义数据 |
|
|
52
|
-
| components | SchemaReactComponents | 否 | - | formily 自定义组件 |
|
|
53
|
-
| readOnly | boolean | 否 | - | 是否只读 |
|
|
54
|
-
| disabled | boolean | 否 | - | 是否禁用 |
|
|
55
|
-
| formOptions | Object | 否 | - | createForm 配置项 |
|
|
56
|
-
| hasSubmit | boolean | 否 | - | 是否有提交按钮 |
|
|
57
|
-
| onSubmit | Function | 否 | - | 提交事件 (values): void |
|
|
58
|
-
| init | Function | 否 | - | 组件初始化 (form): void |
|
|
59
|
-
| axios | Object | 否 | - | axios |
|
|
60
|
-
| axiosConf | Object | 否 | - | axios config |
|
|
61
|
-
| footerRender | Function | 否 | - | 底部渲染插槽 (): ReactElement |
|
|
62
|
-
| thumbnailParams | string | 否 | - | 缩略图参数 |
|
|
63
|
-
| selfUrlList | Array | 否 | - | 私有图片链接判断 |
|
|
64
|
-
|
|
65
|
-
# 组件开发流程
|
|
66
|
-
|
|
67
|
-
- 在 config/webpack.config.js 中按需修改 library 配置的文件名
|
|
68
|
-
- 在 config/webpack.config.js 中按需修改 alias 配置的包名,便于本地调试
|
|
69
|
-
- 在 tsconfig.json 中按需修改 paths 配置的包名,解决 ts 报错问题
|
|
70
|
-
- npm run dev
|
|
71
|
-
|
|
72
|
-
## 文件目录
|
|
73
|
-
|
|
74
|
-
- example 本地开发测试代码
|
|
75
|
-
- src 组件源码
|
|
76
|
-
|
|
77
|
-
## 命令
|
|
78
|
-
|
|
79
|
-
- 生成文档:npm run docs
|
|
80
|
-
- 本地运行:npm run dev
|
|
81
|
-
- 打包编译:npm run build
|
|
82
|
-
|
|
83
|
-
## 发布
|
|
84
|
-
|
|
85
|
-
- npm 源和云效源都需要发布
|
|
86
|
-
|
|
87
|
-
- 命令:npm publish --access public
|
|
88
|
-
- 发布目录:
|
|
89
|
-
- src
|
|
90
|
-
|
|
91
|
-
### nrm
|
|
92
|
-
|
|
93
|
-
- 安装
|
|
94
|
-
npm install -g nrm
|
|
95
|
-
- 增加源
|
|
96
|
-
nrm add aliyun https://packages.aliyun.com/62046985b3ead41b374a17f7/npm/npm-registry/
|
|
97
|
-
- 切换源
|
|
98
|
-
nrm use aliyun
|
|
99
|
-
nrm use npm
|
|
100
|
-
- 登录(账号密码在 https://packages.aliyun.com/npm/npm-registry/guide 查看)
|
|
101
|
-
npm login --registry=https://packages.aliyun.com/62046985b3ead41b374a17f7/npm/npm-registry/
|
|
102
|
-
|
|
103
|
-
## 配置
|
|
104
|
-
|
|
105
|
-
### 配置文件
|
|
106
|
-
|
|
107
|
-
- 本地配置文件:config/config.js
|
|
108
|
-
|
|
109
|
-
### webpack 配置文件
|
|
110
|
-
|
|
111
|
-
- config/webpack.config.js
|