yootd 0.2.6 → 0.2.7

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.
@@ -9,6 +9,7 @@ declare const FileUpload: React.ForwardRefExoticComponent<import("antd").UploadP
9
9
  value?: UploadFile<any>[] | undefined;
10
10
  widthPixels?: number | undefined;
11
11
  heightPixels?: number | undefined;
12
+ proportio?: [number, number] | undefined;
12
13
  fileType?: "image" | "file" | undefined;
13
14
  onChange?: ((value?: UploadFile<any>[] | undefined) => void) | undefined;
14
15
  } & React.RefAttributes<UploadRef<any>>>;
@@ -9,6 +9,7 @@ declare const ImageUpload: React.ForwardRefExoticComponent<import("antd").Upload
9
9
  value?: UploadFile<any>[] | undefined;
10
10
  widthPixels?: number | undefined;
11
11
  heightPixels?: number | undefined;
12
+ proportio?: [number, number] | undefined;
12
13
  fileType?: "image" | "file" | undefined;
13
14
  onChange?: ((value?: UploadFile<any>[] | undefined) => void) | undefined;
14
15
  } & React.RefAttributes<UploadRef<any>>>;
@@ -22,7 +22,8 @@ var InternalUpload = function InternalUpload(props, ref) {
22
22
  value = props.value,
23
23
  onChange = props.onChange,
24
24
  widthPixels = props.widthPixels,
25
- heightPixels = props.heightPixels;
25
+ heightPixels = props.heightPixels,
26
+ proportio = props.proportio;
26
27
  var mb = useBem('upload');
27
28
  var _useState = useState([]),
28
29
  _useState2 = _slicedToArray(_useState, 2),
@@ -39,6 +40,7 @@ var InternalUpload = function InternalUpload(props, ref) {
39
40
  _message$useMessage2 = _slicedToArray(_message$useMessage, 2),
40
41
  messageApi = _message$useMessage2[0],
41
42
  contextHolder = _message$useMessage2[1];
43
+ console.log('比例值', proportio);
42
44
  function getBase64(_x) {
43
45
  return _getBase.apply(this, arguments);
44
46
  }
@@ -108,6 +110,15 @@ var InternalUpload = function InternalUpload(props, ref) {
108
110
  return;
109
111
  }
110
112
  }
113
+ if ((proportio === null || proportio === void 0 ? void 0 : proportio[0]) != null && (proportio === null || proportio === void 0 ? void 0 : proportio[1]) != null) {
114
+ var imageRatio = image.width / image.height;
115
+ var expectedRatio = proportio[0] / proportio[1];
116
+ if (Math.abs(imageRatio - expectedRatio) > 0.01) {
117
+ void messageApi.warning("\u8BF7\u4E0A\u4F20\u6BD4\u4F8B\u4E3A".concat(proportio[0], ":").concat(proportio[1], "\u7684\u56FE\u7247"));
118
+ return;
119
+ }
120
+ }
121
+
111
122
  // 图片尺寸符合要求,上传图片
112
123
  var formData = new FormData();
113
124
  if (folder != null) {
@@ -10,6 +10,7 @@ export type UploadProps = AntUploadProps & {
10
10
  value?: UploadFile[];
11
11
  widthPixels?: number;
12
12
  heightPixels?: number;
13
+ proportio?: [number, number];
13
14
  fileType?: 'file' | 'image';
14
15
  onChange?: (value?: UploadFile[]) => void;
15
16
  };
@@ -20,6 +21,7 @@ declare const UploadInternal: React.ForwardRefExoticComponent<AntUploadProps<any
20
21
  value?: UploadFile<any>[] | undefined;
21
22
  widthPixels?: number | undefined;
22
23
  heightPixels?: number | undefined;
24
+ proportio?: [number, number] | undefined;
23
25
  fileType?: "image" | "file" | undefined;
24
26
  onChange?: ((value?: UploadFile[]) => void) | undefined;
25
27
  } & React.RefAttributes<UploadRef<any>>>;
package/package.json CHANGED
@@ -1,91 +1,91 @@
1
- {
2
- "name": "yootd",
3
- "version": "0.2.6",
4
- "description": "基于 Antd 二次开发的组件库",
5
- "license": "MIT",
6
- "module": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "files": [
9
- "dist"
10
- ],
11
- "scripts": {
12
- "build": "father build",
13
- "build:watch": "father dev",
14
- "dev": "dumi dev",
15
- "docs:build": "dumi build",
16
- "docs:preview": "dumi preview",
17
- "doctor": "father doctor",
18
- "lint": "npm run lint:es && npm run lint:css",
19
- "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
20
- "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
21
- "prepare": "husky install && dumi setup",
22
- "prepublishOnly": "father doctor && npm run build",
23
- "start": "npm run dev"
24
- },
25
- "commitlint": {
26
- "extends": [
27
- "@commitlint/config-conventional"
28
- ]
29
- },
30
- "lint-staged": {
31
- "*.{md,json}": [
32
- "prettier --write --no-error-on-unmatched-pattern"
33
- ],
34
- "*.{css,less}": [
35
- "stylelint --fix",
36
- "prettier --write"
37
- ],
38
- "*.{js,jsx}": [
39
- "eslint --fix",
40
- "prettier --write"
41
- ],
42
- "*.{ts,tsx}": [
43
- "eslint --fix",
44
- "prettier --parser=typescript --write"
45
- ]
46
- },
47
- "dependencies": {
48
- "@babel/runtime": "^7.26.9"
49
- },
50
- "devDependencies": {
51
- "@commitlint/cli": "^17.1.2",
52
- "@commitlint/config-conventional": "^17.1.0",
53
- "@types/lodash": "^4.17.12",
54
- "@types/react": "^18.0.0",
55
- "@types/react-dom": "^18.0.0",
56
- "@umijs/lint": "^4.0.0",
57
- "dumi": "^2.3.0",
58
- "dumi-theme-antd": "^0.4.2",
59
- "eslint": "^8.23.0",
60
- "father": "^4.1.0",
61
- "husky": "^8.0.1",
62
- "lint-staged": "^13.0.3",
63
- "prettier": "^2.7.1",
64
- "prettier-plugin-organize-imports": "^3.0.0",
65
- "prettier-plugin-packagejson": "^2.2.18",
66
- "sass": "^1.80.0",
67
- "stylelint": "^14.9.1"
68
- },
69
- "peerDependencies": {
70
- "@dnd-kit/core": ">=6.1.0",
71
- "@dnd-kit/modifiers": ">=7.0.0",
72
- "@dnd-kit/sortable": ">=8.0.0",
73
- "@dnd-kit/utilities": ">=3.2.2",
74
- "@tanstack/react-query": ">=5.59.15",
75
- "@tensorflow-models/pose-detection": ">=2.1.3",
76
- "@tensorflow/tfjs": ">=4.22.0",
77
- "@vladmandic/face-api": ">=1.7.14",
78
- "@xyflow/react": ">=12.3.3",
79
- "antd": ">=5.21.4",
80
- "axios": ">=1.7.7",
81
- "dayjs": ">=1.11.13",
82
- "lodash": ">=4.17.21",
83
- "react": ">=18.0.0",
84
- "react-dom": ">=18.0.0",
85
- "yootd-webrtc-sdk": ">=1.0.1"
86
- },
87
- "publishConfig": {
88
- "access": "public"
89
- },
90
- "authors": []
91
- }
1
+ {
2
+ "name": "yootd",
3
+ "version": "0.2.7",
4
+ "description": "基于 Antd 二次开发的组件库",
5
+ "license": "MIT",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "scripts": {
12
+ "build": "father build",
13
+ "build:watch": "father dev",
14
+ "dev": "dumi dev",
15
+ "docs:build": "dumi build",
16
+ "docs:preview": "dumi preview",
17
+ "doctor": "father doctor",
18
+ "lint": "npm run lint:es && npm run lint:css",
19
+ "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
20
+ "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
21
+ "prepare": "husky install && dumi setup",
22
+ "prepublishOnly": "father doctor && npm run build",
23
+ "start": "npm run dev"
24
+ },
25
+ "commitlint": {
26
+ "extends": [
27
+ "@commitlint/config-conventional"
28
+ ]
29
+ },
30
+ "lint-staged": {
31
+ "*.{md,json}": [
32
+ "prettier --write --no-error-on-unmatched-pattern"
33
+ ],
34
+ "*.{css,less}": [
35
+ "stylelint --fix",
36
+ "prettier --write"
37
+ ],
38
+ "*.{js,jsx}": [
39
+ "eslint --fix",
40
+ "prettier --write"
41
+ ],
42
+ "*.{ts,tsx}": [
43
+ "eslint --fix",
44
+ "prettier --parser=typescript --write"
45
+ ]
46
+ },
47
+ "dependencies": {
48
+ "@babel/runtime": "^7.26.9"
49
+ },
50
+ "devDependencies": {
51
+ "@commitlint/cli": "^17.1.2",
52
+ "@commitlint/config-conventional": "^17.1.0",
53
+ "@types/lodash": "^4.17.12",
54
+ "@types/react": "^18.0.0",
55
+ "@types/react-dom": "^18.0.0",
56
+ "@umijs/lint": "^4.0.0",
57
+ "dumi": "^2.3.0",
58
+ "dumi-theme-antd": "^0.4.2",
59
+ "eslint": "^8.23.0",
60
+ "father": "^4.1.0",
61
+ "husky": "^8.0.1",
62
+ "lint-staged": "^13.0.3",
63
+ "prettier": "^2.7.1",
64
+ "prettier-plugin-organize-imports": "^3.0.0",
65
+ "prettier-plugin-packagejson": "^2.2.18",
66
+ "sass": "^1.80.0",
67
+ "stylelint": "^14.9.1"
68
+ },
69
+ "peerDependencies": {
70
+ "@dnd-kit/core": ">=6.1.0",
71
+ "@dnd-kit/modifiers": ">=7.0.0",
72
+ "@dnd-kit/sortable": ">=8.0.0",
73
+ "@dnd-kit/utilities": ">=3.2.2",
74
+ "@tanstack/react-query": ">=5.59.15",
75
+ "@tensorflow-models/pose-detection": ">=2.1.3",
76
+ "@tensorflow/tfjs": ">=4.22.0",
77
+ "@vladmandic/face-api": ">=1.7.14",
78
+ "@xyflow/react": ">=12.3.3",
79
+ "antd": ">=5.21.4",
80
+ "axios": ">=1.7.7",
81
+ "dayjs": ">=1.11.13",
82
+ "lodash": ">=4.17.21",
83
+ "react": ">=18.0.0",
84
+ "react-dom": ">=18.0.0",
85
+ "yootd-webrtc-sdk": ">=1.0.1"
86
+ },
87
+ "publishConfig": {
88
+ "access": "public"
89
+ },
90
+ "authors": []
91
+ }