@pointcloud/pcloud-components 0.1.12 → 0.1.14
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/dist/esm/AdvancedFilter/index.js +7 -7
- package/dist/esm/DForm/DItem/itemType.d.ts +4 -3
- package/dist/esm/DForm/DItem/itemsRender.d.ts +27 -24
- package/dist/esm/DForm/DItem/itemsRender.js +19 -9
- package/dist/esm/DForm/index.d.ts +6 -1
- package/dist/esm/DForm/index.js +12 -6
- package/dist/esm/DUpload/helper.d.ts +2 -0
- package/dist/esm/DUpload/helper.js +47 -47
- package/dist/umd/pcloud-components.min.js +1 -1
- package/package.json +2 -2
|
@@ -34,18 +34,18 @@ var AdvancedFilter = function AdvancedFilter(props) {
|
|
|
34
34
|
setInputValue = _useState4[1];
|
|
35
35
|
var inputRef = useRef(null);
|
|
36
36
|
var formRef = useRef(null);
|
|
37
|
-
|
|
37
|
+
var resetFields = function resetFields() {
|
|
38
38
|
var _formRef$current;
|
|
39
|
+
setInputValue('');
|
|
40
|
+
formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.resetFields();
|
|
41
|
+
};
|
|
42
|
+
useImperativeHandle(fRef, function () {
|
|
43
|
+
var _formRef$current2;
|
|
39
44
|
return {
|
|
40
45
|
resetFields: resetFields,
|
|
41
|
-
form: (_formRef$
|
|
46
|
+
form: (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.form
|
|
42
47
|
};
|
|
43
48
|
});
|
|
44
|
-
var resetFields = function resetFields() {
|
|
45
|
-
var _formRef$current2;
|
|
46
|
-
setInputValue('');
|
|
47
|
-
formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.resetFields();
|
|
48
|
-
};
|
|
49
49
|
var handleSearch = function handleSearch(values) {
|
|
50
50
|
var _inputRef$current, _inputRef$current$inp;
|
|
51
51
|
var value = inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : (_inputRef$current$inp = _inputRef$current.input) === null || _inputRef$current$inp === void 0 ? void 0 : _inputRef$current$inp.value;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
import { InputProps, InputNumberProps, AutoCompleteProps, CascaderProps, SelectProps, TreeSelectProps, DatePickerProps, TimePickerProps, MentionProps, CheckboxProps, RadioProps, RateProps, SliderSingleProps, SwitchProps, TransferProps, UploadProps, ButtonProps, DividerProps, FormItemProps } from 'antd';
|
|
2
|
+
import { InputProps, InputNumberProps, AutoCompleteProps, CascaderProps, SelectProps, TreeSelectProps, DatePickerProps, TimePickerProps, MentionProps, CheckboxProps, RadioProps, RateProps, SliderSingleProps, SwitchProps, TransferProps, UploadProps, ButtonProps, DividerProps, FormItemProps, RadioGroupProps } from 'antd';
|
|
3
3
|
import { PasswordProps, TextAreaProps } from 'antd/lib/input';
|
|
4
4
|
import { RangePickerProps } from 'antd/lib/date-picker';
|
|
5
|
+
import { CheckboxGroupProps } from 'antd/lib/checkbox';
|
|
5
6
|
import { DInputProps } from '../../DInput';
|
|
6
7
|
import { DSelectProps } from '../../DSelect';
|
|
7
8
|
import { DCascaderProps } from '../../DCascader';
|
|
8
9
|
import { DTreeSelectProps } from '../../DTreeSelect';
|
|
9
10
|
import { DUploadProps } from '../../DUpload';
|
|
10
|
-
declare type DItemBaseProps = {
|
|
11
|
+
export declare type DItemBaseProps = {
|
|
11
12
|
/** label标签文本,同antd Form.Item的label,只能是string */
|
|
12
13
|
label?: string;
|
|
13
14
|
/** name标签文本,同antd Form.Item的name */
|
|
@@ -102,5 +103,5 @@ declare type ButtonItemProps = {
|
|
|
102
103
|
declare type DividerItemProps = {
|
|
103
104
|
renderType?: 'divider';
|
|
104
105
|
} & DItemBaseProps & DividerProps;
|
|
105
|
-
export declare type DItemProps = CustomItemProps | DInputItemProps | InputItemProps | TextAreaItemProps | PasswordItemProps | InputNumberItemProps | AutoCompleteItemProps | DSelectItemProps | SelectItemProps | DCascaderItemProps | CascaderItemProps | DTreeSelectItemProps | TreeSelectItemProps | DatePickerItemProps | TimePickerItemProps | RangePickerItemProps | MentionItemProps | CheckboxItemProps | RadioItemProps | RateItemProps | SliderItemProps | SwitchItemProps | TransferItemProps | UploadItemProps | DUploadItemProps | ButtonItemProps | DividerItemProps;
|
|
106
|
+
export declare type DItemProps = CustomItemProps | DInputItemProps | InputItemProps | TextAreaItemProps | PasswordItemProps | InputNumberItemProps | AutoCompleteItemProps | DSelectItemProps | SelectItemProps | DCascaderItemProps | CascaderItemProps | DTreeSelectItemProps | TreeSelectItemProps | DatePickerItemProps | TimePickerItemProps | RangePickerItemProps | MentionItemProps | CheckboxItemProps | CheckboxGroupProps | RadioItemProps | RadioGroupProps | RateItemProps | SliderItemProps | SwitchItemProps | TransferItemProps | UploadItemProps | DUploadItemProps | ButtonItemProps | DividerItemProps;
|
|
106
107
|
export {};
|
|
@@ -1,40 +1,43 @@
|
|
|
1
|
-
import { AutoCompleteProps, ButtonProps, CascaderProps, CheckboxProps, DatePickerProps, DividerProps, FormItemProps, InputNumberProps, InputProps, MentionProps, RadioProps, RateProps, SelectProps, SliderSingleProps, SwitchProps, TimePickerProps, TransferProps, TreeSelectProps, UploadProps } from 'antd';
|
|
1
|
+
import { AutoCompleteProps, ButtonProps, CascaderProps, CheckboxProps, DatePickerProps, DividerProps, FormItemProps, InputNumberProps, InputProps, MentionProps, RadioProps, RadioGroupProps, RateProps, SelectProps, SliderSingleProps, SwitchProps, TimePickerProps, TransferProps, TreeSelectProps, UploadProps } from 'antd';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { RangePickerProps } from 'antd/lib/date-picker';
|
|
4
4
|
import { PasswordProps, TextAreaProps } from 'antd/lib/input';
|
|
5
|
+
import { CheckboxGroupProps } from 'antd/lib/checkbox/Group';
|
|
5
6
|
import { DCascaderProps } from '../../DCascader';
|
|
6
7
|
import { DInputProps } from '../../DInput';
|
|
7
8
|
import { DSelectProps } from '../../DSelect';
|
|
8
9
|
import { DTreeSelectProps } from '../../DTreeSelect';
|
|
9
10
|
import { DUploadProps } from '../../DUpload';
|
|
10
|
-
import {
|
|
11
|
+
import { DItemBaseProps } from './itemType';
|
|
11
12
|
declare const renderMap: {
|
|
12
|
-
dInput: (props: DInputProps, formItemProps: FormItemProps, label:
|
|
13
|
-
input: (props: InputProps, formItemProps: FormItemProps, label:
|
|
14
|
-
textArea: (props: TextAreaProps, formItemProps: FormItemProps, label:
|
|
15
|
-
password: (props: PasswordProps, formItemProps: FormItemProps, label:
|
|
16
|
-
inputNumber: (props: InputNumberProps, formItemProps: FormItemProps, label:
|
|
17
|
-
autoComplete: (props: AutoCompleteProps, formItemProps: FormItemProps, label:
|
|
18
|
-
dSelect: (props: DSelectProps, formItemProps: FormItemProps, label:
|
|
19
|
-
select: (props: SelectProps, formItemProps: FormItemProps, label:
|
|
20
|
-
dCascader: (props: DCascaderProps, formItemProps: FormItemProps, label:
|
|
21
|
-
cascader: (props: CascaderProps, formItemProps: FormItemProps, label:
|
|
22
|
-
dTreeSelect: (props: DTreeSelectProps, formItemProps: FormItemProps, label:
|
|
23
|
-
treeSelect: (props: TreeSelectProps, formItemProps: FormItemProps, label:
|
|
24
|
-
datePicker: (props: DatePickerProps, formItemProps: FormItemProps, label:
|
|
25
|
-
timePicker: (props: TimePickerProps, formItemProps: FormItemProps, label:
|
|
13
|
+
dInput: (props: DInputProps, formItemProps: FormItemProps, label: DItemBaseProps['label']) => JSX.Element;
|
|
14
|
+
input: (props: InputProps, formItemProps: FormItemProps, label: DItemBaseProps['label']) => JSX.Element;
|
|
15
|
+
textArea: (props: TextAreaProps, formItemProps: FormItemProps, label: DItemBaseProps['label']) => JSX.Element;
|
|
16
|
+
password: (props: PasswordProps, formItemProps: FormItemProps, label: DItemBaseProps['label']) => JSX.Element;
|
|
17
|
+
inputNumber: (props: InputNumberProps, formItemProps: FormItemProps, label: DItemBaseProps['label']) => JSX.Element;
|
|
18
|
+
autoComplete: (props: AutoCompleteProps, formItemProps: FormItemProps, label: DItemBaseProps['label']) => JSX.Element;
|
|
19
|
+
dSelect: (props: DSelectProps, formItemProps: FormItemProps, label: DItemBaseProps['label']) => JSX.Element;
|
|
20
|
+
select: (props: SelectProps, formItemProps: FormItemProps, label: DItemBaseProps['label']) => JSX.Element;
|
|
21
|
+
dCascader: (props: DCascaderProps, formItemProps: FormItemProps, label: DItemBaseProps['label']) => JSX.Element;
|
|
22
|
+
cascader: (props: CascaderProps, formItemProps: FormItemProps, label: DItemBaseProps['label']) => JSX.Element;
|
|
23
|
+
dTreeSelect: (props: DTreeSelectProps, formItemProps: FormItemProps, label: DItemBaseProps['label']) => JSX.Element;
|
|
24
|
+
treeSelect: (props: TreeSelectProps, formItemProps: FormItemProps, label: DItemBaseProps['label']) => JSX.Element;
|
|
25
|
+
datePicker: (props: DatePickerProps, formItemProps: FormItemProps, label: DItemBaseProps['label']) => JSX.Element;
|
|
26
|
+
timePicker: (props: TimePickerProps, formItemProps: FormItemProps, label: DItemBaseProps['label']) => JSX.Element;
|
|
26
27
|
rangePicker: (props: RangePickerProps, formItemProps: FormItemProps) => JSX.Element;
|
|
27
|
-
mentions: (props: MentionProps, formItemProps: FormItemProps, label:
|
|
28
|
-
checkbox: (props: CheckboxProps, formItemProps: FormItemProps, label:
|
|
29
|
-
|
|
28
|
+
mentions: (props: MentionProps, formItemProps: FormItemProps, label: DItemBaseProps['label']) => JSX.Element;
|
|
29
|
+
checkbox: (props: CheckboxProps, formItemProps: FormItemProps, label: DItemBaseProps['label']) => JSX.Element;
|
|
30
|
+
checkboxGroup: (props: CheckboxGroupProps, formItemProps: FormItemProps) => JSX.Element;
|
|
31
|
+
radio: (props: RadioProps, formItemProps: FormItemProps, label: DItemBaseProps['label']) => JSX.Element;
|
|
32
|
+
radioGroup: (props: RadioGroupProps, formItemProps: FormItemProps) => JSX.Element;
|
|
30
33
|
rate: (props: RateProps, formItemProps: FormItemProps) => JSX.Element;
|
|
31
34
|
slider: (props: SliderSingleProps, formItemProps: FormItemProps) => JSX.Element;
|
|
32
35
|
switch: (props: SwitchProps, formItemProps: FormItemProps) => JSX.Element;
|
|
33
|
-
transfer: (props: TransferProps<any>, formItemProps: FormItemProps,
|
|
34
|
-
upload: (props: UploadProps, formItemProps: FormItemProps, label:
|
|
35
|
-
dUpload: (props: DUploadProps, formItemProps: FormItemProps,
|
|
36
|
-
button: (props: ButtonProps, formItemProps: FormItemProps, label:
|
|
37
|
-
divider: (props: DividerProps, formItemProps: FormItemProps, label:
|
|
36
|
+
transfer: (props: TransferProps<any>, formItemProps: FormItemProps, render: TransferProps<any>['render']) => JSX.Element;
|
|
37
|
+
upload: (props: UploadProps, formItemProps: FormItemProps, label: DItemBaseProps['label'], render: () => void, children: UploadProps['children']) => JSX.Element;
|
|
38
|
+
dUpload: (props: DUploadProps, formItemProps: FormItemProps, render: (props: any) => ReactNode, children: DUploadProps['children']) => JSX.Element;
|
|
39
|
+
button: (props: ButtonProps, formItemProps: FormItemProps, label: DItemBaseProps['label']) => JSX.Element;
|
|
40
|
+
divider: (props: DividerProps, formItemProps: FormItemProps, label: DItemBaseProps['label']) => JSX.Element;
|
|
38
41
|
other: (formItemProps: FormItemProps, children: DUploadProps['children']) => JSX.Element;
|
|
39
42
|
};
|
|
40
43
|
export default renderMap;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
/*
|
|
3
|
-
* @Author : wangfeihu
|
|
4
|
-
* @Date : 2023-06-12 17:35:10
|
|
5
|
-
* @LastEditors :
|
|
6
|
-
* @LastEditTime : 2023-
|
|
7
|
-
* @Description : 根据renderType渲染对应的表单项组件
|
|
2
|
+
/*
|
|
3
|
+
* @Author : wangfeihu
|
|
4
|
+
* @Date : 2023-06-12 17:35:10
|
|
5
|
+
* @LastEditors : frank
|
|
6
|
+
* @LastEditTime : 2023-12-20 15:40:13
|
|
7
|
+
* @Description : 根据renderType渲染对应的表单项组件
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { AutoComplete, Button, Cascader, Checkbox, DatePicker, Divider, Form, Input, InputNumber, Mentions, Radio, Rate, Select, Slider, Switch, TimePicker, Transfer, TreeSelect, Upload } from 'antd';
|
|
@@ -133,6 +133,11 @@ var renderMap = {
|
|
|
133
133
|
}))
|
|
134
134
|
}));
|
|
135
135
|
},
|
|
136
|
+
checkboxGroup: function checkboxGroup(props, formItemProps) {
|
|
137
|
+
return /*#__PURE__*/_jsx(Form.Item, _objectSpread(_objectSpread({}, formItemProps), {}, {
|
|
138
|
+
children: /*#__PURE__*/_jsx(Checkbox.Group, _objectSpread({}, props))
|
|
139
|
+
}));
|
|
140
|
+
},
|
|
136
141
|
radio: function radio(props, formItemProps, label) {
|
|
137
142
|
return /*#__PURE__*/_jsx(Form.Item, _objectSpread(_objectSpread({}, formItemProps), {}, {
|
|
138
143
|
children: /*#__PURE__*/_jsx(Radio, _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -140,6 +145,11 @@ var renderMap = {
|
|
|
140
145
|
}))
|
|
141
146
|
}));
|
|
142
147
|
},
|
|
148
|
+
radioGroup: function radioGroup(props, formItemProps) {
|
|
149
|
+
return /*#__PURE__*/_jsx(Form.Item, _objectSpread(_objectSpread({}, formItemProps), {}, {
|
|
150
|
+
children: /*#__PURE__*/_jsx(Radio.Group, _objectSpread({}, props))
|
|
151
|
+
}));
|
|
152
|
+
},
|
|
143
153
|
rate: function rate(props, formItemProps) {
|
|
144
154
|
return /*#__PURE__*/_jsx(Form.Item, _objectSpread(_objectSpread({}, formItemProps), {}, {
|
|
145
155
|
children: /*#__PURE__*/_jsx(Rate, _objectSpread({}, props))
|
|
@@ -147,7 +157,7 @@ var renderMap = {
|
|
|
147
157
|
},
|
|
148
158
|
slider: function slider(props, formItemProps) {
|
|
149
159
|
return /*#__PURE__*/_jsx(Form.Item, _objectSpread(_objectSpread({}, formItemProps), {}, {
|
|
150
|
-
children: /*#__PURE__*/_jsx(Slider, {})
|
|
160
|
+
children: /*#__PURE__*/_jsx(Slider, _objectSpread({}, props))
|
|
151
161
|
}));
|
|
152
162
|
},
|
|
153
163
|
switch: function _switch(props, formItemProps) {
|
|
@@ -155,7 +165,7 @@ var renderMap = {
|
|
|
155
165
|
children: /*#__PURE__*/_jsx(Switch, _objectSpread({}, props))
|
|
156
166
|
}));
|
|
157
167
|
},
|
|
158
|
-
transfer: function transfer(props, formItemProps,
|
|
168
|
+
transfer: function transfer(props, formItemProps, render) {
|
|
159
169
|
return /*#__PURE__*/_jsx(Form.Item, _objectSpread(_objectSpread({}, formItemProps), {}, {
|
|
160
170
|
children: /*#__PURE__*/_jsx(Transfer, _objectSpread({
|
|
161
171
|
render: render
|
|
@@ -169,7 +179,7 @@ var renderMap = {
|
|
|
169
179
|
}))
|
|
170
180
|
}));
|
|
171
181
|
},
|
|
172
|
-
dUpload: function dUpload(props, formItemProps,
|
|
182
|
+
dUpload: function dUpload(props, formItemProps, render, children) {
|
|
173
183
|
return /*#__PURE__*/_jsx(Form.Item, _objectSpread(_objectSpread({}, formItemProps), {}, {
|
|
174
184
|
children: /*#__PURE__*/_jsx(DUpload, _objectSpread(_objectSpread({}, props), {}, {
|
|
175
185
|
children: children
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { FormProps } from 'antd';
|
|
2
|
+
import { Form, FormProps } from 'antd';
|
|
3
3
|
import DItem, { DItemProps } from './DItem';
|
|
4
4
|
import './index.less';
|
|
5
5
|
declare type InternalFormProps = {
|
|
@@ -18,6 +18,11 @@ declare type DFormRefProps = {
|
|
|
18
18
|
} | undefined;
|
|
19
19
|
declare const DForm: React.ForwardRefExoticComponent<Omit<FormProps<any>, "children" | "layout"> & InternalFormProps & React.RefAttributes<DFormRefProps>> & {
|
|
20
20
|
Item: typeof DItem;
|
|
21
|
+
useForm: typeof Form.useForm;
|
|
22
|
+
useFormInstance: typeof Form.useFormInstance;
|
|
23
|
+
useWatch: typeof Form.useWatch;
|
|
24
|
+
List: typeof Form.List;
|
|
25
|
+
ErrorList: typeof Form.ErrorList;
|
|
21
26
|
};
|
|
22
27
|
export { type DFormProps, type DFormRefProps, type DItemProps };
|
|
23
28
|
export default DForm;
|
package/dist/esm/DForm/index.js
CHANGED
|
@@ -2,12 +2,12 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
var _excluded = ["className", "defaultItemProps", "items", "children", "layout", "autoComplete"];
|
|
5
|
-
/*
|
|
6
|
-
* @Author : wangfeihu
|
|
7
|
-
* @Date : 2023-06-02 09:29:11
|
|
8
|
-
* @LastEditors : wangfeihu
|
|
9
|
-
* @LastEditTime : 2023-08-16 17:44:33
|
|
10
|
-
* @Description : 基于antd的Form组件
|
|
5
|
+
/*
|
|
6
|
+
* @Author : wangfeihu
|
|
7
|
+
* @Date : 2023-06-02 09:29:11
|
|
8
|
+
* @LastEditors : wangfeihu
|
|
9
|
+
* @LastEditTime : 2023-08-16 17:44:33
|
|
10
|
+
* @Description : 基于antd的Form组件
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import React, { forwardRef, useContext, useState, useEffect, useImperativeHandle } from 'react';
|
|
@@ -89,5 +89,11 @@ function InternalForm(props, ref) {
|
|
|
89
89
|
}
|
|
90
90
|
var DForm = /*#__PURE__*/forwardRef(InternalForm);
|
|
91
91
|
DForm.Item = DItem;
|
|
92
|
+
DForm.List = Form.List;
|
|
93
|
+
DForm.ErrorList = Form.ErrorList;
|
|
94
|
+
DForm.useForm = Form.useForm;
|
|
95
|
+
DForm.useFormInstance = Form.useFormInstance;
|
|
96
|
+
DForm.useWatch = Form.useWatch;
|
|
97
|
+
DForm.useForm = Form.useForm;
|
|
92
98
|
export {};
|
|
93
99
|
export default DForm;
|
|
@@ -6,6 +6,8 @@ declare type DUploadFile = Omit<UploadFile, 'uid'> & {
|
|
|
6
6
|
uid?: string | number;
|
|
7
7
|
/** 文件来源 upload:文件对话框,remote:已上传的文件对象 */
|
|
8
8
|
source?: 'upload' | 'remote';
|
|
9
|
+
/** 文件状态 */
|
|
10
|
+
status?: 'error' | 'success' | 'done' | 'uploading' | 'removed';
|
|
9
11
|
};
|
|
10
12
|
/** 转换base64时的参数 */
|
|
11
13
|
declare type CompressProps = {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
3
|
-
/*
|
|
4
|
-
* @Author : wangfeihu
|
|
5
|
-
* @Date : 2023-06-16 11:25:57
|
|
6
|
-
* @LastEditors : wangfeihu
|
|
7
|
-
* @LastEditTime : 2023-08-30 11:26:22
|
|
8
|
-
* @Description : 辅助方法集合
|
|
3
|
+
/*
|
|
4
|
+
* @Author : wangfeihu
|
|
5
|
+
* @Date : 2023-06-16 11:25:57
|
|
6
|
+
* @LastEditors : wangfeihu
|
|
7
|
+
* @LastEditTime : 2023-08-30 11:26:22
|
|
8
|
+
* @Description : 辅助方法集合
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
/** 转换base64时的参数 */
|
|
@@ -41,12 +41,12 @@ function getType(value) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
/**
|
|
45
|
-
* @description : 将图像文件转换为Base64格式
|
|
46
|
-
* @param {Blob} blob 图像文件
|
|
47
|
-
* @param {CompressProps} options 指定图像压缩参数,其格式为: {width:300,height:200,quality:0.7}
|
|
48
|
-
* @return {Promise<string>} 包含Base64字符串的Promise对象
|
|
49
|
-
* @example : imageToBase64(file,{ width: 300, height: 200, quality: 0.7 }).then( url => console.log( url ) )
|
|
44
|
+
/**
|
|
45
|
+
* @description : 将图像文件转换为Base64格式
|
|
46
|
+
* @param {Blob} blob 图像文件
|
|
47
|
+
* @param {CompressProps} options 指定图像压缩参数,其格式为: {width:300,height:200,quality:0.7}
|
|
48
|
+
* @return {Promise<string>} 包含Base64字符串的Promise对象
|
|
49
|
+
* @example : imageToBase64(file,{ width: 300, height: 200, quality: 0.7 }).then( url => console.log( url ) )
|
|
50
50
|
*/
|
|
51
51
|
function imageToBase64(blob, options) {
|
|
52
52
|
return new Promise(function (resolve, reject) {
|
|
@@ -97,11 +97,11 @@ function imageToBase64(blob, options) {
|
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
/**
|
|
101
|
-
* @description : 将传入的文件转换为UploadFile数组
|
|
102
|
-
* @param {any} files 目标文件对象
|
|
103
|
-
* @return {UploadFile[]} UploadFile数组
|
|
104
|
-
* @example :
|
|
100
|
+
/**
|
|
101
|
+
* @description : 将传入的文件转换为UploadFile数组
|
|
102
|
+
* @param {any} files 目标文件对象
|
|
103
|
+
* @return {UploadFile[]} UploadFile数组
|
|
104
|
+
* @example :
|
|
105
105
|
*/
|
|
106
106
|
function getUploadFile(files, maxCount) {
|
|
107
107
|
if (files) {
|
|
@@ -114,11 +114,11 @@ function getUploadFile(files, maxCount) {
|
|
|
114
114
|
return [];
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
/**
|
|
118
|
-
* @description : 根据传入的option对象获取缩略图参数
|
|
119
|
-
* @param {ThumbOptionProps} option 缩略图参数对象
|
|
120
|
-
* @return {ThumbOptionProps} ThumbOption对象
|
|
121
|
-
* @example :
|
|
117
|
+
/**
|
|
118
|
+
* @description : 根据传入的option对象获取缩略图参数
|
|
119
|
+
* @param {ThumbOptionProps} option 缩略图参数对象
|
|
120
|
+
* @return {ThumbOptionProps} ThumbOption对象
|
|
121
|
+
* @example :
|
|
122
122
|
*/
|
|
123
123
|
function getThumbOption(option) {
|
|
124
124
|
var _ref2 = option || {},
|
|
@@ -152,12 +152,12 @@ function getThumbOption(option) {
|
|
|
152
152
|
return _option;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
/**
|
|
156
|
-
* @description : a标签下载文件
|
|
157
|
-
* @param {Blob | string} url a标签的下载url或文件流
|
|
158
|
-
* @param {string} fileName 下载文件的名称,如果缺省则尝试从url中获取,默认为: "新建文件"
|
|
159
|
-
* @return {*}
|
|
160
|
-
* @example :
|
|
155
|
+
/**
|
|
156
|
+
* @description : a标签下载文件
|
|
157
|
+
* @param {Blob | string} url a标签的下载url或文件流
|
|
158
|
+
* @param {string} fileName 下载文件的名称,如果缺省则尝试从url中获取,默认为: "新建文件"
|
|
159
|
+
* @return {*}
|
|
160
|
+
* @example :
|
|
161
161
|
*/
|
|
162
162
|
function downloadFile(url, fileName) {
|
|
163
163
|
var eLink = document.createElement('a');
|
|
@@ -170,11 +170,11 @@ function downloadFile(url, fileName) {
|
|
|
170
170
|
document.body.removeChild(eLink);
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
/**
|
|
174
|
-
* @description : a标签预览文件
|
|
175
|
-
* @param {Blob | string} url a标签的预览url或文件流
|
|
176
|
-
* @return {*}
|
|
177
|
-
* @example :
|
|
173
|
+
/**
|
|
174
|
+
* @description : a标签预览文件
|
|
175
|
+
* @param {Blob | string} url a标签的预览url或文件流
|
|
176
|
+
* @return {*}
|
|
177
|
+
* @example :
|
|
178
178
|
*/
|
|
179
179
|
function previewFile(url) {
|
|
180
180
|
var eLink = document.createElement('a');
|
|
@@ -187,13 +187,13 @@ function previewFile(url) {
|
|
|
187
187
|
document.body.removeChild(eLink);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
/**
|
|
191
|
-
* @description : 以递归方式深度查找一个对象
|
|
192
|
-
* @param {Record} object 待查找的对象
|
|
193
|
-
* @param {function} fn 查找函数,每次递归时执行,如果执行结果为true,则递归过程并返回当前对象
|
|
194
|
-
* @param {number} maxDepth 递归的最大深度,默认10
|
|
195
|
-
* @return {*} 查找到的对象,未查找到则返回undefined
|
|
196
|
-
* @example :
|
|
190
|
+
/**
|
|
191
|
+
* @description : 以递归方式深度查找一个对象
|
|
192
|
+
* @param {Record} object 待查找的对象
|
|
193
|
+
* @param {function} fn 查找函数,每次递归时执行,如果执行结果为true,则递归过程并返回当前对象
|
|
194
|
+
* @param {number} maxDepth 递归的最大深度,默认10
|
|
195
|
+
* @return {*} 查找到的对象,未查找到则返回undefined
|
|
196
|
+
* @example :
|
|
197
197
|
*/
|
|
198
198
|
// eslint-disable-next-line no-unused-vars
|
|
199
199
|
function deepFindObject(object, fn) {
|
|
@@ -223,13 +223,13 @@ function deepFindObject(object, fn) {
|
|
|
223
223
|
return recursive(object, undefined, '', fn, {});
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
/**
|
|
227
|
-
* @description : 以递归方式深度查找一个Jsx对象
|
|
228
|
-
* @param {Record} object 待查找的Jsx对象
|
|
229
|
-
* @param {function} fn 查找函数,每次递归时执行,如果执行结果为true,则停止递归过程并返回当前对象
|
|
230
|
-
* @param {number} maxDepth 递归的最大深度,默认10
|
|
231
|
-
* @return {*} 查找到的对象,未查找到则返回undefined
|
|
232
|
-
* @example :
|
|
226
|
+
/**
|
|
227
|
+
* @description : 以递归方式深度查找一个Jsx对象
|
|
228
|
+
* @param {Record} object 待查找的Jsx对象
|
|
229
|
+
* @param {function} fn 查找函数,每次递归时执行,如果执行结果为true,则停止递归过程并返回当前对象
|
|
230
|
+
* @param {number} maxDepth 递归的最大深度,默认10
|
|
231
|
+
* @return {*} 查找到的对象,未查找到则返回undefined
|
|
232
|
+
* @example :
|
|
233
233
|
*/
|
|
234
234
|
// eslint-disable-next-line no-unused-vars
|
|
235
235
|
function deepFindJsx(object, fn) {
|