xydata-tools 1.0.50 → 1.0.52
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/README.md +21 -65
- package/dist/components/downloadFile/index.js +26 -16
- package/dist/components/tools/version.js +1 -1
- package/dist/components/uni-app/file-picker/file-picker.vue +5 -0
- package/dist/types/components/downloadFile/index.d.ts +19 -15
- package/dist/types/components/tools/version.d.ts +1 -1
- package/dist/types/components/uploadFile/index.d.ts +0 -4
- package/dist/utils/serviceSet.js +0 -2
- package/package.json +9 -11
package/README.md
CHANGED
|
@@ -1,50 +1,6 @@
|
|
|
1
1
|
# 鑫义科技前端开发者工具包
|
|
2
2
|
|
|
3
|
-
内网文档:[http://172.16.1.
|
|
4
|
-
|
|
5
|
-
# xydata-tools 文档索引
|
|
6
|
-
|
|
7
|
-
> **注意**:如果您在 NPM 上查看此文档,链接可能无法正常工作。请访问 [GitLab 仓库](https://172.16.1.252/wuxiaohu/xydata-tools) 查看完整文档。
|
|
8
|
-
|
|
9
|
-
#### Web 端组件
|
|
10
|
-
|
|
11
|
-
- **附件上传组件** - [查看文档](https://172.16.1.252/wuxiaohu/xydata-tools/-/blob/new/docs/组件使用文档/附件上传组件.md)
|
|
12
|
-
- 支持图片、文件上传
|
|
13
|
-
- 内置文件大小、格式校验
|
|
14
|
-
- 支持预览功能
|
|
15
|
-
|
|
16
|
-
- **附件下载组件** - [查看文档](https://172.16.1.252/wuxiaohu/xydata-tools/-/blob/new/docs/组件使用文档/附件下载组件.md)
|
|
17
|
-
- 支持链接和流式文件下载
|
|
18
|
-
- 兼容原生按钮功能
|
|
19
|
-
|
|
20
|
-
- **数据字典组件** - [查看文档](https://172.16.1.252/wuxiaohu/xydata-tools/-/blob/new/docs/组件使用文档/数据字典.md)
|
|
21
|
-
- 完整的数据字典管理功能
|
|
22
|
-
- 支持分类管理
|
|
23
|
-
|
|
24
|
-
- **组织机构组件** - [查看文档](https://172.16.1.252/wuxiaohu/xydata-tools/-/blob/new/docs/组件使用文档/组织机构.md)
|
|
25
|
-
- 树形结构展示
|
|
26
|
-
- 人员管理功能
|
|
27
|
-
|
|
28
|
-
#### uni-app 组件
|
|
29
|
-
|
|
30
|
-
- **MediaPicker - 媒体选择器** - [查看文档](https://172.16.1.252/wuxiaohu/xydata-tools/-/blob/new/docs/uniapp/MediaPicker.md)
|
|
31
|
-
- **FilePicker - 文件选择器** - [查看文档](https://172.16.1.252/wuxiaohu/xydata-tools/-/blob/new/docs/uniapp/FilePicker.md)
|
|
32
|
-
|
|
33
|
-
#### 模版使用文档
|
|
34
|
-
|
|
35
|
-
- **AAA 模版** - [查看文档](https://172.16.1.252/wuxiaohu/xydata-tools/-/blob/new/docs/模版使用文档/AAA模版.md)
|
|
36
|
-
- 适用场景:有独立登录页面,不支持统一登录
|
|
37
|
-
- 包含:SecurityLayout、系统管理模块
|
|
38
|
-
|
|
39
|
-
- **SSO 模版** - [查看文档](https://172.16.1.252/wuxiaohu/xydata-tools/-/blob/new/docs/模版使用文档/SSO模版.md)
|
|
40
|
-
- 适用场景:没有独立登录页面,支持统一登录
|
|
41
|
-
- 包含:SecurityLayout、系统管理模块
|
|
42
|
-
|
|
43
|
-
- **Both 模版** - [查看文档](https://172.16.1.252/wuxiaohu/xydata-tools/-/blob/new/docs/模版使用文档/Both模版.md)
|
|
44
|
-
- 适用场景:同时支持独立登录和统一登录
|
|
45
|
-
- 包含:SecurityLayout
|
|
46
|
-
|
|
47
|
-
---
|
|
3
|
+
内网文档:[http://172.16.1.222/craft-page-web/xydata](http://172.16.1.222/craft-page-web/xydata)
|
|
48
4
|
|
|
49
5
|
## 本地开发
|
|
50
6
|
|
|
@@ -52,15 +8,15 @@ react
|
|
|
52
8
|
|
|
53
9
|
1. 在项目根目录执行:
|
|
54
10
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
11
|
+
```bash
|
|
12
|
+
yarn dev
|
|
13
|
+
```
|
|
58
14
|
|
|
59
15
|
2. 在 example 目录下执行:
|
|
60
16
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
17
|
+
```bash
|
|
18
|
+
yarn start
|
|
19
|
+
```
|
|
64
20
|
|
|
65
21
|
3. example 是一个由 `umi` 搭建的后台项目,可直接引用 `xydata-tools` 内的组件进行预览。
|
|
66
22
|
4. 新组件可在 `/xydata-tools/src/components` 下进行开发更新。
|
|
@@ -70,28 +26,28 @@ uniapp
|
|
|
70
26
|
|
|
71
27
|
1. 在项目根目录执行:
|
|
72
28
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
29
|
+
```bash
|
|
30
|
+
yarn dev
|
|
31
|
+
```
|
|
76
32
|
|
|
77
33
|
2. 在 example-uniapp 下运行
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
34
|
+
```bash
|
|
35
|
+
yarn link xydata-tools
|
|
36
|
+
```
|
|
81
37
|
3. 将 example-uniapp 添加到 H-Builder 中运行
|
|
82
38
|
|
|
83
39
|
打包发布:
|
|
84
40
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
41
|
+
```bash
|
|
42
|
+
npm run prepublishOnly
|
|
43
|
+
npm config set registry https://registry.npmjs.org
|
|
44
|
+
npm publish -d
|
|
45
|
+
```
|
|
90
46
|
|
|
91
47
|
发布完成后,还原 npm 源(淘宝源):
|
|
92
48
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
49
|
+
```bash
|
|
50
|
+
npm config set registry https://registry.npmmirror.com
|
|
51
|
+
```
|
|
96
52
|
|
|
97
53
|
---
|
|
@@ -22,19 +22,21 @@ import DownloadFileTool from "../../utils/downloadFile";
|
|
|
22
22
|
* @preserve
|
|
23
23
|
* @param {Object} props 组件的属性
|
|
24
24
|
* @param {string|React.ReactNode} [props.text] 按钮内容,可传入 string 或 ReactNode
|
|
25
|
-
* @param {Object} [props.queryOption] 下载参数对象
|
|
26
|
-
* @param {string} [props.queryOption.url] 下载地址
|
|
27
|
-
* @param {string} [props.queryOption.methods] 请求方法 (GET/POST)
|
|
28
|
-
* @param {string} [props.queryOption.fileName] 文件名
|
|
29
|
-
* @param {Object} [props.queryOption.params] 请求参数
|
|
30
|
-
* @param {Object} [props.queryOption.customField] 自定义字段
|
|
31
|
-
* @param {string} [props.queryOption.customField.url] 自定义文件地址字段(表示取值res.data.[传入的参数])
|
|
32
|
-
* @param {string} [props.queryOption.customField.fileName] 自定义文件名字段(表示取值res.data.[传入的参数])
|
|
33
|
-
* @param {(error: Error) => void} [props.onError] 接口异常回调函数
|
|
34
25
|
* @param {React.ReactNode} [props.icon] 按钮的图标
|
|
35
26
|
* @param {boolean} [props.disabled] 是否禁用按钮
|
|
36
27
|
* @param {boolean} [props.danger] 是否为危险按钮
|
|
37
28
|
* @param {"default"|"primary"|"ghost"|"dashed"|"link"|"text"} [props.type] 按钮类型
|
|
29
|
+
* @param {Object} [props.queryOption] 下载参数对象
|
|
30
|
+
* @param {string} [props.queryOption.url] 下载接口地址
|
|
31
|
+
* @param {string} [props.queryOption.method] 请求方法 (GET/POST)
|
|
32
|
+
* @param {string} [props.queryOption.downloadType] 下载类型,值为 'pure' 时表示下载外链文件(通过网页地址栏打开就可以下载的链接)
|
|
33
|
+
* @param {string} [props.queryOption.fileName] 默认下载的文件名,需要后缀,如接口中返回了fileName,以接口返回的为准
|
|
34
|
+
* @param {Object} [props.queryOption.params] 默认请求参数
|
|
35
|
+
* @param {(params: Object) => Object} [props.queryOption.onBeforeDownload] 请求前调用,用于获取或修改请求参数
|
|
36
|
+
* @param {Object} [props.queryOption.customField] 自定义接口取值字段
|
|
37
|
+
* @param {string} [props.queryOption.customField.url] 自定义文件地址字段(表示取值res.data.[传入的参数])
|
|
38
|
+
* @param {string} [props.queryOption.customField.fileName] 自定义文件名字段(表示取值res.data.[传入的参数])
|
|
39
|
+
* @param {(error: Error) => void} [props.queryOption.onError] 接口异常回调函数
|
|
38
40
|
*/
|
|
39
41
|
var DownloadFile = function DownloadFile(props) {
|
|
40
42
|
var _useState = useState(false),
|
|
@@ -46,23 +48,31 @@ var DownloadFile = function DownloadFile(props) {
|
|
|
46
48
|
onClick: function () {
|
|
47
49
|
var _onClick = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
48
50
|
var _props$queryOption;
|
|
51
|
+
var mergedParams, dynamicParams;
|
|
49
52
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
50
53
|
while (1) switch (_context.prev = _context.next) {
|
|
51
54
|
case 0:
|
|
52
55
|
if (!((_props$queryOption = props.queryOption) !== null && _props$queryOption !== void 0 && _props$queryOption.url)) {
|
|
53
|
-
_context.next =
|
|
56
|
+
_context.next = 9;
|
|
54
57
|
break;
|
|
55
58
|
}
|
|
56
59
|
setLoading(true);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
mergedParams = props.queryOption.params || {};
|
|
61
|
+
if (typeof props.queryOption.onBeforeDownload === "function") {
|
|
62
|
+
dynamicParams = props.queryOption.onBeforeDownload(mergedParams) || {};
|
|
63
|
+
mergedParams = _objectSpread(_objectSpread({}, mergedParams), dynamicParams);
|
|
64
|
+
}
|
|
65
|
+
_context.next = 6;
|
|
66
|
+
return DownloadFileTool(_objectSpread(_objectSpread({}, props.queryOption || {}), {}, {
|
|
67
|
+
params: mergedParams
|
|
68
|
+
}));
|
|
69
|
+
case 6:
|
|
60
70
|
setLoading(false);
|
|
61
|
-
_context.next =
|
|
71
|
+
_context.next = 10;
|
|
62
72
|
break;
|
|
63
|
-
case
|
|
73
|
+
case 9:
|
|
64
74
|
console.error("请传入下载参数");
|
|
65
|
-
case
|
|
75
|
+
case 10:
|
|
66
76
|
case "end":
|
|
67
77
|
return _context.stop();
|
|
68
78
|
}
|
|
@@ -6,7 +6,7 @@ import React from "react";
|
|
|
6
6
|
var ButtonBox = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: #999;\n position: absolute;\n z-index: 3;\n bottom: 20px;\n width: 100%;\n text-align: center;\n font-size: 12px;\n"])));
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* 版本注释
|
|
10
10
|
* @preserve
|
|
11
11
|
* @param {Object} props 组件的属性
|
|
12
12
|
* @param {Object} [props.envData] 环境变量数据,默认为从 sessionStorage 中获取的 env_data
|
|
@@ -4,35 +4,39 @@ export default DownloadFile;
|
|
|
4
4
|
* @preserve
|
|
5
5
|
* @param {Object} props 组件的属性
|
|
6
6
|
* @param {string|React.ReactNode} [props.text] 按钮内容,可传入 string 或 ReactNode
|
|
7
|
-
* @param {Object} [props.queryOption] 下载参数对象
|
|
8
|
-
* @param {string} [props.queryOption.url] 下载地址
|
|
9
|
-
* @param {string} [props.queryOption.methods] 请求方法 (GET/POST)
|
|
10
|
-
* @param {string} [props.queryOption.fileName] 文件名
|
|
11
|
-
* @param {Object} [props.queryOption.params] 请求参数
|
|
12
|
-
* @param {Object} [props.queryOption.customField] 自定义字段
|
|
13
|
-
* @param {string} [props.queryOption.customField.url] 自定义文件地址字段(表示取值res.data.[传入的参数])
|
|
14
|
-
* @param {string} [props.queryOption.customField.fileName] 自定义文件名字段(表示取值res.data.[传入的参数])
|
|
15
|
-
* @param {(error: Error) => void} [props.onError] 接口异常回调函数
|
|
16
7
|
* @param {React.ReactNode} [props.icon] 按钮的图标
|
|
17
8
|
* @param {boolean} [props.disabled] 是否禁用按钮
|
|
18
9
|
* @param {boolean} [props.danger] 是否为危险按钮
|
|
19
10
|
* @param {"default"|"primary"|"ghost"|"dashed"|"link"|"text"} [props.type] 按钮类型
|
|
11
|
+
* @param {Object} [props.queryOption] 下载参数对象
|
|
12
|
+
* @param {string} [props.queryOption.url] 下载接口地址
|
|
13
|
+
* @param {string} [props.queryOption.method] 请求方法 (GET/POST)
|
|
14
|
+
* @param {string} [props.queryOption.downloadType] 下载类型,值为 'pure' 时表示下载外链文件(通过网页地址栏打开就可以下载的链接)
|
|
15
|
+
* @param {string} [props.queryOption.fileName] 默认下载的文件名,需要后缀,如接口中返回了fileName,以接口返回的为准
|
|
16
|
+
* @param {Object} [props.queryOption.params] 默认请求参数
|
|
17
|
+
* @param {(params: Object) => Object} [props.queryOption.onBeforeDownload] 请求前调用,用于获取或修改请求参数
|
|
18
|
+
* @param {Object} [props.queryOption.customField] 自定义接口取值字段
|
|
19
|
+
* @param {string} [props.queryOption.customField.url] 自定义文件地址字段(表示取值res.data.[传入的参数])
|
|
20
|
+
* @param {string} [props.queryOption.customField.fileName] 自定义文件名字段(表示取值res.data.[传入的参数])
|
|
21
|
+
* @param {(error: Error) => void} [props.queryOption.onError] 接口异常回调函数
|
|
20
22
|
*/
|
|
21
23
|
declare function DownloadFile(props: {
|
|
22
24
|
text?: string | React.ReactNode;
|
|
25
|
+
icon?: React.ReactNode;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
danger?: boolean;
|
|
28
|
+
type?: "default" | "primary" | "ghost" | "dashed" | "link" | "text";
|
|
23
29
|
queryOption?: {
|
|
24
30
|
url?: string;
|
|
25
|
-
|
|
31
|
+
method?: string;
|
|
32
|
+
downloadType?: string;
|
|
26
33
|
fileName?: string;
|
|
27
34
|
params?: any;
|
|
35
|
+
onBeforeDownload?: (params: any) => any;
|
|
28
36
|
customField?: {
|
|
29
37
|
url?: string;
|
|
30
38
|
fileName?: string;
|
|
31
39
|
};
|
|
40
|
+
onError?: (error: Error) => void;
|
|
32
41
|
};
|
|
33
|
-
onError?: (error: Error) => void;
|
|
34
|
-
icon?: React.ReactNode;
|
|
35
|
-
disabled?: boolean;
|
|
36
|
-
danger?: boolean;
|
|
37
|
-
type?: "default" | "primary" | "ghost" | "dashed" | "link" | "text";
|
|
38
42
|
}): JSX.Element;
|
|
@@ -51,7 +51,3 @@ declare function UploadFile(props: {
|
|
|
51
51
|
uploadOptions: UploadProps;
|
|
52
52
|
buttonOptions: ButtonProps;
|
|
53
53
|
}): JSX.Element;
|
|
54
|
-
import { FormProps } from "antd";
|
|
55
|
-
import { FormItemProps } from "antd";
|
|
56
|
-
import { UploadProps } from "antd";
|
|
57
|
-
import { ButtonProps } from "antd";
|
package/dist/utils/serviceSet.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// import { history } from 'umi'
|
|
2
|
-
// import { stringify } from "querystring";
|
|
3
1
|
import { setSessionStorage, removeSessionStorage, getSessionStorage } from "./token.js";
|
|
4
2
|
var SERVICE_NAME = getSessionStorage('service');
|
|
5
3
|
export var registerService = function registerService(service) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xydata-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.52",
|
|
4
4
|
"description": "xydata tools",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -27,7 +27,12 @@
|
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react": "^17.0.0",
|
|
30
|
-
"react-dom": "^17.0.0"
|
|
30
|
+
"react-dom": "^17.0.0",
|
|
31
|
+
"moment": "^2.30.1",
|
|
32
|
+
"antd": "^4.24.16",
|
|
33
|
+
"@ant-design/icons": "^4.5.0",
|
|
34
|
+
"@ant-design/pro-form": "^1.69.4",
|
|
35
|
+
"@ant-design/pro-table": "^2.80.8"
|
|
31
36
|
},
|
|
32
37
|
"devDependencies": {
|
|
33
38
|
"@babel/core": "7.24.9",
|
|
@@ -41,16 +46,9 @@
|
|
|
41
46
|
"vue-template-compiler": "2.7.16"
|
|
42
47
|
},
|
|
43
48
|
"dependencies": {
|
|
44
|
-
"@ant-design/icons": "4.5.0",
|
|
45
|
-
"@ant-design/pro-form": "1.69.4",
|
|
46
|
-
"@ant-design/pro-table": "2.80.8",
|
|
47
49
|
"@zhengxs/js.tree": "0.5.0",
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"querystring": "0.2.1",
|
|
51
|
-
"stringify": "5.2.0",
|
|
52
|
-
"styled-components": "4.4.1",
|
|
53
|
-
"umi-request": "1.0.8",
|
|
50
|
+
"querystring": "0.2.1",
|
|
51
|
+
"styled-components": "4.4.1",
|
|
54
52
|
"compressorjs": "1.2.1"
|
|
55
53
|
}
|
|
56
54
|
}
|