@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.
Files changed (74) hide show
  1. package/LICENSE +21 -0
  2. package/dist/common/array-base-utils.d.ts +9 -0
  3. package/dist/common/global-props-context.d.ts +8 -0
  4. package/dist/common/location-utils.d.ts +80 -0
  5. package/dist/components/ArrayCards/index.d.ts +10 -0
  6. package/dist/components/ArrayTable/common/utils.d.ts +23 -0
  7. package/dist/components/ArrayTable/index.d.ts +8 -0
  8. package/dist/components/Checkbox/index.d.ts +2 -0
  9. package/dist/components/DatePicker/common/utils.d.ts +1 -0
  10. package/dist/components/DatePicker/index.d.ts +16 -0
  11. package/dist/components/FormCollapse/index.d.ts +30 -0
  12. package/dist/components/FormItem/common/useFormItemLayout.d.ts +83 -0
  13. package/dist/components/FormItem/index.d.ts +9 -0
  14. package/dist/components/FormLayout/index.d.ts +76 -0
  15. package/dist/components/FormLayout/style.d.ts +1 -0
  16. package/dist/components/FormLayout/useResponsiveFormLayout.d.ts +17 -0
  17. package/dist/components/LocationPicker/Map/AMap/common/loader.d.ts +2 -0
  18. package/dist/components/LocationPicker/Map/AMap/common/utils.d.ts +74 -0
  19. package/dist/components/LocationPicker/common/utils.d.ts +24 -0
  20. package/dist/components/LocationPicker/components/ModalContent/index.d.ts +3 -0
  21. package/dist/components/LocationPicker/components/Notice/index.d.ts +2 -0
  22. package/dist/components/LocationPicker/components/PickerInfo/index.d.ts +3 -0
  23. package/dist/components/LocationPicker/components/ResInfo/index.d.ts +8 -0
  24. package/dist/components/LocationPicker/index.d.ts +3 -0
  25. package/dist/components/LocationPicker/servers/index.d.ts +21 -0
  26. package/dist/components/PickerRightOutline/index.d.ts +3 -0
  27. package/dist/components/Placeholder/index.d.ts +7 -0
  28. package/dist/components/Radio/index.d.ts +2 -0
  29. package/dist/components/Select/index.d.ts +8 -0
  30. package/dist/components/Slider/index.d.ts +2 -0
  31. package/dist/components/Text/index.d.ts +9 -0
  32. package/dist/components/TimePicker/common/utils.d.ts +1 -0
  33. package/dist/components/TimePicker/index.d.ts +6 -0
  34. package/dist/components/TreeSelect/SelectList/index.d.ts +3 -0
  35. package/dist/components/TreeSelect/TreeSearch/index.d.ts +3 -0
  36. package/dist/components/TreeSelect/common/data-handler.d.ts +70 -0
  37. package/dist/components/TreeSelect/index.d.ts +3 -0
  38. package/dist/components/Uploader/common/checkFileType.d.ts +4 -0
  39. package/dist/components/Uploader/common/img.d.ts +10 -0
  40. package/dist/components/Uploader/components/Image/index.d.ts +3 -0
  41. package/dist/components/Uploader/components/ItemList/ItemRender.d.ts +2 -0
  42. package/dist/components/Uploader/components/ItemList/index.d.ts +2 -0
  43. package/dist/components/UserSelect/index.d.ts +37 -0
  44. package/dist/components/index.d.ts +20 -0
  45. package/dist/globalConfig.d.ts +6 -0
  46. package/dist/index.cjs +1 -0
  47. package/dist/index.css +2 -0
  48. package/dist/index.d.ts +6 -0
  49. package/dist/index.js +3178 -0
  50. package/package.json +65 -76
  51. package/src/common/array-base-utils.ts +1 -1
  52. package/src/components/ArrayCards/index.tsx +5 -3
  53. package/src/components/ArrayTable/common/utils.tsx +2 -2
  54. package/src/components/ArrayTable/index.tsx +6 -3
  55. package/src/components/Checkbox/index.tsx +1 -1
  56. package/src/components/DatePicker/index.tsx +3 -3
  57. package/src/components/FormCollapse/index.tsx +5 -3
  58. package/src/components/FormItem/index.tsx +2 -1
  59. package/src/components/FormLayout/useResponsiveFormLayout.ts +1 -1
  60. package/src/components/LocationPicker/Map/AMap/common/utils.ts +6 -6
  61. package/src/components/LocationPicker/common/utils.ts +3 -3
  62. package/src/components/LocationPicker/components/ModalContent/index.tsx +1 -1
  63. package/src/components/LocationPicker/index.tsx +1 -1
  64. package/src/components/Radio/index.tsx +2 -1
  65. package/src/components/Select/index.tsx +2 -2
  66. package/src/components/TimePicker/common/utils.ts +1 -1
  67. package/src/components/TimePicker/index.tsx +2 -2
  68. package/src/components/Uploader/common/img.ts +4 -4
  69. package/src/components/UserSelect/index.tsx +1 -1
  70. package/src/global.d.ts +14 -0
  71. package/src/index.tsx +1 -1
  72. package/src/type.d.ts +7 -6
  73. package/src/vite-env.d.ts +1 -0
  74. package/README.md +0 -111
package/package.json CHANGED
@@ -1,76 +1,65 @@
1
- {
2
- "name": "@hzab/form-render-mobile",
3
- "version": "1.2.8",
4
- "description": "formily-form-render-mobile",
5
- "main": "src",
6
- "scripts": {
7
- "dev": "npm run prepare && webpack serve -c ./config/webpack.config.js --env local",
8
- "build": "webpack -c ./config/webpack.config.js --env production",
9
- "version:alpha": "npm version prerelease --preid=alpha",
10
- "publish:alpha": "npm publish --tag alpha",
11
- "version:beta": "npm version prerelease --preid=beta",
12
- "publish:beta": "npm publish --tag beta",
13
- "version:patch": "npm version patch",
14
- "version:minior": "npm version minor",
15
- "version:major": "npm version major",
16
- "publish:stable": "npm publish --access public",
17
- "prepare": "husky install",
18
- "mac-chmod": "chmod +x .husky && chmod +x .husky/pre-commit",
19
- "docs": "typedoc"
20
- },
21
- "files": [
22
- "src",
23
- "CHANGELOG.md"
24
- ],
25
- "keywords": [],
26
- "author": "CaiYansong",
27
- "license": "ISC",
28
- "devDependencies": {
29
- "@ant-design/icons": "^5.2.6",
30
- "@hzab/permissions": "^0.1.1",
31
- "@hzab/webpack-config": "0.0.12",
32
- "@types/react": "^17.0.62",
33
- "@types/react-dom": "^17.0.20",
34
- "axios": "^1.4.0",
35
- "babel-plugin-import": "^1.13.8",
36
- "eslint": "^8.30.0",
37
- "less": "^4.1.3",
38
- "mobx": "^6.7.0",
39
- "mobx-react": "^7.6.0",
40
- "react": "^17.0.2",
41
- "react-dom": "^17.0.2",
42
- "react-router-dom": "^6.14.1",
43
- "typedoc": "^0.24.8",
44
- "typescript": "^4.9.4"
45
- },
46
- "dependencies": {
47
- "@amap/amap-jsapi-loader": "^1.0.1",
48
- "@formily/antd-mobile": "1.0.0-beta.3",
49
- "@formily/core": "2.2.29",
50
- "@formily/react": "2.2.29",
51
- "@hzab/data-model": "^0.0.3",
52
- "@hzab/utils": "^1.0.16",
53
- "antd-mobile": "^5.32.0",
54
- "antd-mobile-icons": "^0.2.2",
55
- "nanoid": "^3.3.7",
56
- "postcss-px-to-viewport": "^1.1.1",
57
- "react-virtualized": "^9.22.5"
58
- },
59
- "directories": {
60
- "lib": "lib"
61
- },
62
- "lint-staged": {
63
- "src/**.{js,jsx,ts,tsx,css,scss,less,json,html}": [
64
- "prettier --write"
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,4 +1,4 @@
1
- import { ISchema } from "@formily/json-schema";
1
+ import type { ISchema } from "@formily/json-schema";
2
2
 
3
3
  export const isAdditionComponent = (schema: ISchema) => {
4
4
  return schema["x-component"]?.indexOf("Addition") > -1;
@@ -1,10 +1,12 @@
1
1
  import React from "react";
2
- import { Card, Empty, CardProps } from "antd-mobile";
3
- import { ArrayField } from "@formily/core";
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 { ArrayBase, ArrayBaseMixins, IArrayBaseProps } from "@formily/antd-mobile/esm/array-base";
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 { GeneralField, FieldDisplayTypes, ArrayField } from "@formily/core";
4
- import { useField, observer, useFieldSchema, RecursionField, ReactFC } from "@formily/react";
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 { ArrayBase, ArrayBaseMixins, IArrayBaseProps } from "@formily/antd-mobile/esm/array-base";
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<Object>;
34
+ dataSource: Array<object>;
35
35
  };
36
36
 
37
37
  type DatePickerPropsT = {
38
- value: string | number | Object;
38
+ value: string | number | object;
39
39
  disabled: boolean;
40
40
  readOnly: boolean;
41
41
  placeholder: string;
@@ -1,8 +1,10 @@
1
- import React, { Fragment, ReactNode, useMemo, useState } from "react";
2
- import { Collapse, Badge, CollapseProps, CollapsePanelProps } from "antd-mobile";
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, useFormItemLayout } from "./common/useFormItemLayout";
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?: Object;
28
- map?: Object;
29
- AMap?: Object;
30
- markerIconConf?: Object;
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]: Object;
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
- let _marker = marker || this.markers[id];
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
- let lon = value[lonKey];
16
- let lat = value[latKey];
17
- let addr = value[addrKey];
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 { RadioProps, RadioGroupProps } from "antd-mobile/es/components/radio";
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<Object>;
14
+ dataSource: Array<object>;
15
15
  };
16
16
 
17
17
  type SelectPropsT = {
@@ -50,7 +50,7 @@ export function getTimeColumns(opt: any = {}) {
50
50
  }
51
51
 
52
52
  while (i <= max) {
53
- let _val = `${i > 9 ? i : "0" + i}`;
53
+ const _val = `${i > 9 ? i : "0" + i}`;
54
54
  columns[idx].push({
55
55
  label: _val,
56
56
  value: _val,
@@ -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
- let pickerVal = value?.split(":");
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
- var blob = xhr.response;
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
- let mime = arr[0].match(/:(.*?);/)[1];
50
- let bstr = atob(arr[1]);
49
+ const mime = arr[0].match(/:(.*?);/)[1];
50
+ const bstr = atob(arr[1]);
51
51
  let n = bstr.length;
52
- let u8arr = new Uint8Array(n);
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
 
@@ -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, Schema } from "@formily/react";
3
- import { Form } from "@formily/core";
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?: Object;
10
+ initialValues?: object;
10
11
  /** 表单 schema */
11
12
  schema: any;
12
13
  /** formily scope 自定义数据 */
13
- schemaScope?: Object;
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?: Object;
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