@guo514360255/antd-lib 1.4.1

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 (37) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +44 -0
  3. package/dist/CustomDetailModal/detailModal.d.ts +72 -0
  4. package/dist/CustomDetailModal/index.d.ts +5 -0
  5. package/dist/CustomDetailModal/index.js +183 -0
  6. package/dist/CustomDetailModal/index.less +6 -0
  7. package/dist/CustomFormModal/formModal.d.ts +78 -0
  8. package/dist/CustomFormModal/index.d.ts +5 -0
  9. package/dist/CustomFormModal/index.js +293 -0
  10. package/dist/CustomFormModal/index.less +29 -0
  11. package/dist/CustomTable/index.d.ts +5 -0
  12. package/dist/CustomTable/index.js +412 -0
  13. package/dist/CustomTable/index.less +69 -0
  14. package/dist/CustomTable/table.d.ts +143 -0
  15. package/dist/CustomTag/index.d.ts +3 -0
  16. package/dist/CustomTag/index.js +27 -0
  17. package/dist/CustomTag/tag.d.ts +19 -0
  18. package/dist/CustomUpload/index.d.ts +22 -0
  19. package/dist/CustomUpload/index.js +197 -0
  20. package/dist/DynamicIcon/index.d.ts +9 -0
  21. package/dist/DynamicIcon/index.js +34 -0
  22. package/dist/FormItem/index.d.ts +9 -0
  23. package/dist/FormItem/index.js +47 -0
  24. package/dist/compontent.d.ts +86 -0
  25. package/dist/hooks/index.d.ts +2 -0
  26. package/dist/hooks/index.js +7 -0
  27. package/dist/hooks/useFullscreen.d.ts +6 -0
  28. package/dist/hooks/useFullscreen.js +77 -0
  29. package/dist/index.d.ts +13 -0
  30. package/dist/index.js +9 -0
  31. package/dist/utils/index.d.ts +3 -0
  32. package/dist/utils/index.js +8 -0
  33. package/dist/utils/rememberPwd.d.ts +34 -0
  34. package/dist/utils/rememberPwd.js +112 -0
  35. package/dist/utils/util.d.ts +54 -0
  36. package/dist/utils/util.js +119 -0
  37. package/package.json +90 -0
@@ -0,0 +1,54 @@
1
+ import { GetProp, UploadProps } from 'antd';
2
+ export type FileType = Parameters<GetProp<UploadProps, 'beforeUpload'>>[0];
3
+ /**
4
+ * 本地文件转为base64
5
+ * @param file
6
+ */
7
+ export declare const fileTransformBase64: (file: FileType) => Promise<string>;
8
+ /**
9
+ * valueEnum 转换为 options
10
+ * @param data
11
+ * @param val
12
+ * @param label
13
+ * @param value
14
+ */
15
+ export declare const valueEnumTransform: (data: {
16
+ [key: string]: any;
17
+ } | undefined, val: any, label?: string, value?: string) => {
18
+ [x: string]: any;
19
+ }[];
20
+ /**
21
+ * 根据key超找树的节点
22
+ * @param tree
23
+ * @param value
24
+ * @param key
25
+ */
26
+ export declare const findTreeNodeByKey: (tree: any[], value: any, key?: string) => any;
27
+ /**
28
+ * 判断是否为空 '' | undefined | null
29
+ * @param value
30
+ */
31
+ export declare const isEmptyValue: (value: any) => boolean;
32
+ /**
33
+ * 随机数
34
+ * @param min
35
+ * @param max
36
+ */
37
+ export declare const randomInt: (min: number, max: number) => number;
38
+ /**
39
+ * 首字母转化为大写
40
+ * @param string
41
+ */
42
+ export declare const capitalizeFirstLetter: (string: string | number) => string;
43
+ /**
44
+ * 数组类型转化为首字母大写
45
+ * @param strings
46
+ */
47
+ export declare const capitalizeFirstLetters: (strings: string[]) => string[];
48
+ /**
49
+ * 处理字段属性
50
+ * @param setColumns
51
+ * @param code
52
+ * @param fn
53
+ */
54
+ export declare const handleColumnFieldProps: (setColumns: any, code: string, fn: (data: any) => void) => void;
@@ -0,0 +1,119 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
+ /*
4
+ * @Author: 郭郭
5
+ * @Date: 2025/11/4
6
+ * @Description:
7
+ */
8
+
9
+ import { isEmpty, isNil, isString } from 'lodash';
10
+ import isFinite from 'lodash/isFinite';
11
+ /**
12
+ * 本地文件转为base64
13
+ * @param file
14
+ */
15
+ export var fileTransformBase64 = function fileTransformBase64(file) {
16
+ return new Promise(function (resolve, reject) {
17
+ var reader = new FileReader();
18
+ reader.readAsDataURL(file);
19
+ reader.onload = function () {
20
+ return resolve(reader.result);
21
+ };
22
+ reader.onerror = function (error) {
23
+ return reject(error);
24
+ };
25
+ });
26
+ };
27
+
28
+ /**
29
+ * valueEnum 转换为 options
30
+ * @param data
31
+ * @param val
32
+ * @param label
33
+ * @param value
34
+ */
35
+ export var valueEnumTransform = function valueEnumTransform() {
36
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
37
+ var val = arguments.length > 1 ? arguments[1] : undefined;
38
+ var label = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'label';
39
+ var value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'value';
40
+ var result = [];
41
+ var isNumber = isFinite(val);
42
+ // eslint-disable-next-line guard-for-in
43
+ for (var _key in data) {
44
+ var _data$_key;
45
+ result.push(_defineProperty(_defineProperty({}, label, ((_data$_key = data[_key]) === null || _data$_key === void 0 ? void 0 : _data$_key.text) || '-'), value, isNumber ? Number(_key) : _key));
46
+ }
47
+ return result;
48
+ };
49
+
50
+ /**
51
+ * 根据key超找树的节点
52
+ * @param tree
53
+ * @param value
54
+ * @param key
55
+ */
56
+ export var findTreeNodeByKey = function findTreeNodeByKey(tree, value) {
57
+ var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'value';
58
+ var stack = _toConsumableArray(tree);
59
+ while (stack.length > 0) {
60
+ var node = stack.pop();
61
+ if ("".concat(node[key]) === "".concat(value)) return node;
62
+ if (node.children) stack.push.apply(stack, _toConsumableArray(node.children));
63
+ }
64
+ return null;
65
+ };
66
+
67
+ /**
68
+ * 判断是否为空 '' | undefined | null
69
+ * @param value
70
+ */
71
+ export var isEmptyValue = function isEmptyValue(value) {
72
+ return isNil(value) || value === '' || isString(value) && isEmpty(value);
73
+ };
74
+
75
+ /**
76
+ * 随机数
77
+ * @param min
78
+ * @param max
79
+ */
80
+ export var randomInt = function randomInt(min, max) {
81
+ return Math.floor(Math.random() * (max - min + 1)) + min;
82
+ };
83
+
84
+ /**
85
+ * 首字母转化为大写
86
+ * @param string
87
+ */
88
+ export var capitalizeFirstLetter = function capitalizeFirstLetter(string) {
89
+ return String(string).charAt(0).toUpperCase() + String(string).slice(1);
90
+ };
91
+
92
+ /**
93
+ * 数组类型转化为首字母大写
94
+ * @param strings
95
+ */
96
+ export var capitalizeFirstLetters = function capitalizeFirstLetters(strings) {
97
+ if (!Array.isArray(strings)) {
98
+ return strings;
99
+ }
100
+ return strings.map(capitalizeFirstLetter);
101
+ };
102
+
103
+ /**
104
+ * 处理字段属性
105
+ * @param setColumns
106
+ * @param code
107
+ * @param fn
108
+ */
109
+ export var handleColumnFieldProps = function handleColumnFieldProps(setColumns, code, fn) {
110
+ setColumns(function (s) {
111
+ var column = s.find(function (item) {
112
+ return item.dataIndex === code;
113
+ });
114
+ if (column && column.fieldProps) {
115
+ fn(column);
116
+ }
117
+ return s;
118
+ });
119
+ };
package/package.json ADDED
@@ -0,0 +1,90 @@
1
+ {
2
+ "name": "@guo514360255/antd-lib",
3
+ "version": "1.4.1",
4
+ "description": "react design 5 lib",
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
+ "@ant-design/icons": "^6.1.0",
49
+ "@ant-design/pro-components": "^2.8.10",
50
+ "@babel/runtime": "^7.28.4",
51
+ "@types/lodash": "^4.17.20",
52
+ "antd": "^5.28.0",
53
+ "antd-img-crop": "^4.27.0",
54
+ "crypto-js": "^4.2.0",
55
+ "js-cookie": "^3.0.5",
56
+ "lodash": "^4.17.21"
57
+ },
58
+ "devDependencies": {
59
+ "@commitlint/cli": "^17.1.2",
60
+ "@commitlint/config-conventional": "^17.1.0",
61
+ "@types/crypto-js": "^4.2.2",
62
+ "@types/js-cookie": "^3.0.6",
63
+ "@types/react": "18.2.0",
64
+ "@types/react-dom": "18.2.0",
65
+ "@umijs/lint": "^4.0.0",
66
+ "dumi": "^2.4.13",
67
+ "eslint": "^8.23.0",
68
+ "father": "^4.1.0",
69
+ "husky": "^8.0.1",
70
+ "lint-staged": "^13.0.3",
71
+ "prettier": "^2.7.1",
72
+ "prettier-plugin-organize-imports": "^3.0.0",
73
+ "prettier-plugin-packagejson": "^2.2.18",
74
+ "react": "18.2.0",
75
+ "react-dom": "18.2.0",
76
+ "stylelint": "^14.9.1"
77
+ },
78
+ "peerDependencies": {
79
+ "@ant-design/pro-table": "^3.x",
80
+ "antd": "^5.x",
81
+ "react": ">=16.9.0",
82
+ "react-dom": ">=16.9.0"
83
+ },
84
+ "publishConfig": {
85
+ "access": "public"
86
+ },
87
+ "authors": [
88
+ "514360255@qq.com"
89
+ ]
90
+ }