@pointcloud/pcloud-components 0.1.32 → 0.1.34
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 +39 -31
- package/dist/esm/AdvancedFilter/FormFilter.d.ts +4 -4
- package/dist/esm/AdvancedFilter/index.d.ts +5 -5
- package/dist/esm/AdvancedFilter/interface.d.ts +101 -101
- package/dist/esm/AnimatedScrollList/index.d.ts +7 -7
- package/dist/esm/AnimatedScrollList/interface.d.ts +71 -71
- package/dist/esm/AspectRatio/index.d.ts +9 -9
- package/dist/esm/AuthComponent/index.d.ts +3 -3
- package/dist/esm/AuthComponent/interface.d.ts +24 -24
- package/dist/esm/CRUD/config.d.ts +2 -0
- package/dist/esm/CRUD/config.js +21 -0
- package/dist/esm/CRUD/index.d.ts +98 -0
- package/dist/esm/CRUD/index.js +669 -0
- package/dist/esm/CRUD/index.less +140 -0
- package/dist/esm/CRUD/toolbar.d.ts +16 -0
- package/dist/esm/CRUD/toolbar.js +249 -0
- package/dist/esm/ColorPicker/index.d.ts +17 -18
- package/dist/esm/ColorPicker/interface.d.ts +164 -164
- package/dist/esm/ConfigProvider/index.d.ts +6 -6
- package/dist/esm/ConfigProvider/index.js +7 -13
- package/dist/esm/ConfigProvider/interface.d.ts +9 -9
- package/dist/esm/ContextMenu/index.d.ts +28 -28
- package/dist/esm/DCascader/index.d.ts +24 -24
- package/dist/esm/DForm/DItem/index.d.ts +5 -5
- package/dist/esm/DForm/DItem/itemType.d.ts +123 -119
- package/dist/esm/DForm/DItem/itemsRender.d.ts +47 -45
- package/dist/esm/DForm/DItem/itemsRender.js +6 -0
- package/dist/esm/DForm/helper.d.ts +8 -8
- package/dist/esm/DForm/index.d.ts +29 -29
- package/dist/esm/DInput/index.d.ts +19 -19
- package/dist/esm/DModal/index.d.ts +19 -18
- package/dist/esm/DModal/index.js +11 -9
- package/dist/esm/DModal/interface.d.ts +8 -14
- package/dist/esm/DRangePicker/index.d.ts +7 -0
- package/dist/esm/DRangePicker/index.js +24 -0
- package/dist/esm/DRangePicker/index.less +30 -0
- package/dist/esm/DRangePicker/interface.d.ts +5 -0
- package/dist/esm/DRangePicker/interface.js +1 -0
- package/dist/esm/DSelect/index.d.ts +24 -24
- package/dist/esm/DTable/index.d.ts +62 -46
- package/dist/esm/DTable/index.js +43 -13
- package/dist/esm/DTreeSelect/index.d.ts +16 -16
- package/dist/esm/DUpload/helper.d.ts +107 -107
- package/dist/esm/DUpload/index.d.ts +55 -55
- package/dist/esm/ErrorBoundary/index.d.ts +5 -6
- package/dist/esm/IPAddress/index.d.ts +20 -20
- package/dist/esm/IconFont/index.d.ts +17 -17
- package/dist/esm/InfiniteScrollList/index.d.ts +63 -63
- package/dist/esm/LabelValue/index.d.ts +16 -16
- package/dist/esm/LabelValue/interface.d.ts +39 -39
- package/dist/esm/Loading/hooks/useLoading.d.ts +6 -6
- package/dist/esm/Loading/index.d.ts +10 -10
- package/dist/esm/Loading/interface.d.ts +23 -23
- package/dist/esm/Loading/loading.d.ts +9 -8
- package/dist/esm/Loading/loading.js +48 -23
- package/dist/esm/Loading/styles/index.less +37 -25
- package/dist/esm/LoginForm/defaultConfig.d.ts +4 -4
- package/dist/esm/LoginForm/index.d.ts +21 -21
- package/dist/esm/ModalForm/index.d.ts +13 -11
- package/dist/esm/ModalForm/index.js +76 -7
- package/dist/esm/NoData/index.d.ts +4 -5
- package/dist/esm/NoData/interface.d.ts +13 -13
- package/dist/esm/OrgTree/index.d.ts +5 -5
- package/dist/esm/OrgTree/interface.d.ts +41 -41
- package/dist/esm/PictureCard/index.d.ts +16 -16
- package/dist/esm/RCropper/handler.d.ts +16 -16
- package/dist/esm/RCropper/index.d.ts +4 -4
- package/dist/esm/RCropper/interface.d.ts +70 -70
- package/dist/esm/RCropper/svgIcons.d.ts +28 -28
- package/dist/esm/RCropper/toolbar.d.ts +5 -5
- package/dist/esm/RndDrag/index.d.ts +5 -6
- package/dist/esm/ScrollNumber/index.d.ts +7 -8
- package/dist/esm/SignaturePad/index.d.ts +32 -32
- package/dist/esm/TypewriterText/index.d.ts +5 -5
- package/dist/esm/TypewriterText/interface.d.ts +42 -42
- package/dist/esm/WordCloud/index.d.ts +10 -11
- package/dist/esm/index.d.ts +66 -62
- package/dist/esm/index.js +3 -1
- package/dist/umd/pcloud-components.min.css +1 -1
- package/dist/umd/pcloud-components.min.js +1 -1
- package/package.json +15 -5
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["rangesPosition", "popupClassName"];
|
|
5
|
+
import { useContext } from 'react';
|
|
6
|
+
import { DatePicker } from 'antd';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
import { ConfigContext } from "../ConfigProvider";
|
|
9
|
+
import "./index.less";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
export default function DRangePicker(props) {
|
|
12
|
+
var _props$rangesPosition = props.rangesPosition,
|
|
13
|
+
rangesPosition = _props$rangesPosition === void 0 ? 'bottom' : _props$rangesPosition,
|
|
14
|
+
popupClassName = props.popupClassName,
|
|
15
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
16
|
+
var _useContext = useContext(ConfigContext),
|
|
17
|
+
prefixCls = _useContext.prefixCls,
|
|
18
|
+
getPrefixCls = _useContext.getPrefixCls;
|
|
19
|
+
var classname = getPrefixCls('range-picker');
|
|
20
|
+
var _popupClassName = classNames(popupClassName, classname, "".concat(classname, "-").concat(rangesPosition), _defineProperty({}, "".concat(prefixCls, "-range-picker"), !!prefixCls));
|
|
21
|
+
return /*#__PURE__*/_jsx(DatePicker.RangePicker, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
22
|
+
popupClassName: _popupClassName
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
@import '../commonStyle/index.less';
|
|
2
|
+
|
|
3
|
+
.@{prefix}-range-picker {
|
|
4
|
+
&-right,
|
|
5
|
+
&-left {
|
|
6
|
+
.ant-picker-panel-container {
|
|
7
|
+
display: flex;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.ant-picker-footer {
|
|
11
|
+
min-width: 40px;
|
|
12
|
+
flex: 1;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.ant-picker-ranges {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.ant-picker-preset .ant-tag {
|
|
21
|
+
margin-right: 0;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&-left {
|
|
26
|
+
.ant-picker-panel-container {
|
|
27
|
+
flex-direction: row-reverse;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { SelectProps } from 'antd';
|
|
3
|
-
import { DefaultOptionType } from 'antd/lib/select';
|
|
4
|
-
export
|
|
5
|
-
/** antd的onSearch属性,onSearch有效时showSearch自动为true */
|
|
6
|
-
onSearch?: (params?: any) => Promise<DefaultOptionType[] | any[]>;
|
|
7
|
-
/** antd的options属性,可以是一个options数组,或一个返回等价options数组的promise */
|
|
8
|
-
options?: DefaultOptionType[] | DSelectProps['onSearch'];
|
|
9
|
-
/** antd的loading属性,是否显示加载中:传入数字表示延迟加载,单位毫秒,0等同于false */
|
|
10
|
-
loading?: boolean | number;
|
|
11
|
-
/** 是否开启防抖: true表示800毫秒,true表示默认值,false或0表示不开启 */
|
|
12
|
-
debounce?: boolean | number;
|
|
13
|
-
};
|
|
14
|
-
declare const DSelect: React.ForwardRefExoticComponent<Omit<SelectProps<any, DefaultOptionType>, "options" | "onSearch" | "loading"> & {
|
|
15
|
-
/** antd的onSearch属性,onSearch有效时showSearch自动为true */
|
|
16
|
-
onSearch?: ((params?: any) => Promise<DefaultOptionType[] | any[]>) | undefined;
|
|
17
|
-
/** antd的options属性,可以是一个options数组,或一个返回等价options数组的promise */
|
|
18
|
-
options?: DefaultOptionType[] | DSelectProps['onSearch'];
|
|
19
|
-
/** antd的loading属性,是否显示加载中:传入数字表示延迟加载,单位毫秒,0等同于false */
|
|
20
|
-
loading?: number | boolean | undefined;
|
|
21
|
-
/** 是否开启防抖: true表示800毫秒,true表示默认值,false或0表示不开启 */
|
|
22
|
-
debounce?: number | boolean | undefined;
|
|
23
|
-
} & React.RefAttributes<any>>;
|
|
24
|
-
export default DSelect;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SelectProps } from 'antd';
|
|
3
|
+
import { DefaultOptionType } from 'antd/lib/select';
|
|
4
|
+
export type DSelectProps = Omit<SelectProps, 'options' | 'onSearch' | 'loading'> & {
|
|
5
|
+
/** antd的onSearch属性,onSearch有效时showSearch自动为true */
|
|
6
|
+
onSearch?: (params?: any) => Promise<DefaultOptionType[] | any[]>;
|
|
7
|
+
/** antd的options属性,可以是一个options数组,或一个返回等价options数组的promise */
|
|
8
|
+
options?: DefaultOptionType[] | DSelectProps['onSearch'];
|
|
9
|
+
/** antd的loading属性,是否显示加载中:传入数字表示延迟加载,单位毫秒,0等同于false */
|
|
10
|
+
loading?: boolean | number;
|
|
11
|
+
/** 是否开启防抖: true表示800毫秒,true表示默认值,false或0表示不开启 */
|
|
12
|
+
debounce?: boolean | number;
|
|
13
|
+
};
|
|
14
|
+
declare const DSelect: React.ForwardRefExoticComponent<Omit<SelectProps<any, DefaultOptionType>, "options" | "onSearch" | "loading"> & {
|
|
15
|
+
/** antd的onSearch属性,onSearch有效时showSearch自动为true */
|
|
16
|
+
onSearch?: ((params?: any) => Promise<DefaultOptionType[] | any[]>) | undefined;
|
|
17
|
+
/** antd的options属性,可以是一个options数组,或一个返回等价options数组的promise */
|
|
18
|
+
options?: DefaultOptionType[] | DSelectProps['onSearch'];
|
|
19
|
+
/** antd的loading属性,是否显示加载中:传入数字表示延迟加载,单位毫秒,0等同于false */
|
|
20
|
+
loading?: number | boolean | undefined;
|
|
21
|
+
/** 是否开启防抖: true表示800毫秒,true表示默认值,false或0表示不开启 */
|
|
22
|
+
debounce?: number | boolean | undefined;
|
|
23
|
+
} & React.RefAttributes<any>>;
|
|
24
|
+
export default DSelect;
|
|
@@ -1,46 +1,62 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { TableProps } from 'antd';
|
|
3
|
-
import { ColumnType } from 'antd/lib/table';
|
|
4
|
-
import './index.less';
|
|
5
|
-
export
|
|
6
|
-
cellEllipsis?: boolean;
|
|
7
|
-
};
|
|
8
|
-
export
|
|
9
|
-
records: TableProps<any>['dataSource'];
|
|
10
|
-
total: number;
|
|
11
|
-
loading?: boolean;
|
|
12
|
-
};
|
|
13
|
-
export
|
|
14
|
-
current?: number;
|
|
15
|
-
size?: number;
|
|
16
|
-
[key: string]: any;
|
|
17
|
-
};
|
|
18
|
-
export
|
|
19
|
-
/** 表格列的基础默认配置,默认所有列居中,表头文字超出显示省略号,详见 antd columns */
|
|
20
|
-
defaultColumnProps?: DColumnType;
|
|
21
|
-
/** 操作列配置,可以是一个普通列配置对象,也可以是一个columns的 render 函数 */
|
|
22
|
-
actionColumn?: DColumnType | DColumnType['render'];
|
|
23
|
-
/** 表格数据的加载函数,在表格创建、分页变化、额外参数变化时自动运行,如果设置该属性,则 dataSource 失效 */
|
|
24
|
-
loadMore?: (params?: TableParamsProps, records?: DTableSourceProps['records']) => Promise<DTableSourceProps>;
|
|
25
|
-
/** 加载数据失败时是否显示错误信息(仅loadMore可用时生效) */
|
|
26
|
-
showErrorMsg?: boolean | ((err: any) => string);
|
|
27
|
-
/** 额外的请求参数,(仅loadMore可用时生效) */
|
|
28
|
-
extraParams?: TableParamsProps;
|
|
29
|
-
/** 表格列配置 */
|
|
30
|
-
columns?: DColumnType[];
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TableProps } from 'antd';
|
|
3
|
+
import { ColumnType } from 'antd/lib/table';
|
|
4
|
+
import './index.less';
|
|
5
|
+
export type DColumnType = ColumnType<any> & {
|
|
6
|
+
cellEllipsis?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type DTableSourceProps = {
|
|
9
|
+
records: TableProps<any>['dataSource'];
|
|
10
|
+
total: number;
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type TableParamsProps = {
|
|
14
|
+
current?: number;
|
|
15
|
+
size?: number;
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
};
|
|
18
|
+
export type DTableProps = Omit<TableProps<any>, 'columns'> & {
|
|
19
|
+
/** 表格列的基础默认配置,默认所有列居中,表头文字超出显示省略号,详见 antd columns */
|
|
20
|
+
defaultColumnProps?: DColumnType;
|
|
21
|
+
/** 操作列配置,可以是一个普通列配置对象,也可以是一个columns的 render 函数 */
|
|
22
|
+
actionColumn?: DColumnType | DColumnType['render'];
|
|
23
|
+
/** 表格数据的加载函数,在表格创建、分页变化、额外参数变化时自动运行,如果设置该属性,则 dataSource 失效 */
|
|
24
|
+
loadMore?: (params?: TableParamsProps, records?: DTableSourceProps['records']) => Promise<DTableSourceProps>;
|
|
25
|
+
/** 加载数据失败时是否显示错误信息(仅loadMore可用时生效) */
|
|
26
|
+
showErrorMsg?: boolean | ((err: any) => string);
|
|
27
|
+
/** 额外的请求参数,(仅loadMore可用时生效) */
|
|
28
|
+
extraParams?: TableParamsProps;
|
|
29
|
+
/** 表格列配置 */
|
|
30
|
+
columns?: DColumnType[];
|
|
31
|
+
};
|
|
32
|
+
export type DTableRef = {
|
|
33
|
+
/** 手动刷新列表方法
|
|
34
|
+
* @param params 可选的新参数,如果不传则使用现有参数
|
|
35
|
+
*/
|
|
36
|
+
refresh: (params?: TableParamsProps) => void;
|
|
37
|
+
/** 手动刷新列表到指定页数方法
|
|
38
|
+
* @param page 指定页数
|
|
39
|
+
*/
|
|
40
|
+
refreshToPage: (page: number) => void;
|
|
41
|
+
/** 获取当前分页信息 */
|
|
42
|
+
getPaginationState: () => {
|
|
43
|
+
current: number;
|
|
44
|
+
size: number;
|
|
45
|
+
total: number;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
declare const DTable: React.ForwardRefExoticComponent<Omit<TableProps<any>, "columns"> & {
|
|
49
|
+
/** 表格列的基础默认配置,默认所有列居中,表头文字超出显示省略号,详见 antd columns */
|
|
50
|
+
defaultColumnProps?: DColumnType | undefined;
|
|
51
|
+
/** 操作列配置,可以是一个普通列配置对象,也可以是一个columns的 render 函数 */
|
|
52
|
+
actionColumn?: DColumnType | DColumnType['render'];
|
|
53
|
+
/** 表格数据的加载函数,在表格创建、分页变化、额外参数变化时自动运行,如果设置该属性,则 dataSource 失效 */
|
|
54
|
+
loadMore?: ((params?: TableParamsProps, records?: DTableSourceProps['records']) => Promise<DTableSourceProps>) | undefined;
|
|
55
|
+
/** 加载数据失败时是否显示错误信息(仅loadMore可用时生效) */
|
|
56
|
+
showErrorMsg?: boolean | ((err: any) => string) | undefined;
|
|
57
|
+
/** 额外的请求参数,(仅loadMore可用时生效) */
|
|
58
|
+
extraParams?: TableParamsProps | undefined;
|
|
59
|
+
/** 表格列配置 */
|
|
60
|
+
columns?: DColumnType[] | undefined;
|
|
61
|
+
} & React.RefAttributes<HTMLDivElement & DTableRef>>;
|
|
62
|
+
export default DTable;
|
package/dist/esm/DTable/index.js
CHANGED
|
@@ -2,17 +2,19 @@ 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 = ["loadMore", "defaultColumnProps", "actionColumn", "showErrorMsg", "extraParams", "dataSource", "rowKey", "scroll", "className", "pagination", "columns", "loading"];
|
|
5
|
-
/*
|
|
6
|
-
* @Author : wangfeihu
|
|
7
|
-
* @Date : 2023-05-09 15:04:48
|
|
8
|
-
* @LastEditors : wangfeihu
|
|
9
|
-
* @LastEditTime : 2023-08-16 16:45:15
|
|
10
|
-
* @Description : 基于antd的Table组件
|
|
5
|
+
/*
|
|
6
|
+
* @Author : wangfeihu
|
|
7
|
+
* @Date : 2023-05-09 15:04:48
|
|
8
|
+
* @LastEditors : wangfeihu
|
|
9
|
+
* @LastEditTime : 2023-08-16 16:45:15
|
|
10
|
+
* @Description : 基于antd的Table组件
|
|
11
11
|
*/
|
|
12
|
-
import React, { forwardRef, useEffect, useRef, useState, useContext, useMemo } from 'react';
|
|
12
|
+
import React, { forwardRef, useEffect, useRef, useState, useContext, useMemo, useImperativeHandle } from 'react';
|
|
13
13
|
import { message, Table } from 'antd';
|
|
14
14
|
import { ConfigContext } from "../ConfigProvider";
|
|
15
15
|
import "./index.less";
|
|
16
|
+
|
|
17
|
+
// DTable组件的Ref接口定义
|
|
16
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
20
|
// 分页器配置项
|
|
@@ -53,7 +55,8 @@ function getActionColumnProps(props, defaultColumnProps) {
|
|
|
53
55
|
var defaultProps = {
|
|
54
56
|
width: 140,
|
|
55
57
|
title: '操作',
|
|
56
|
-
dataIndex: 'action'
|
|
58
|
+
dataIndex: 'action',
|
|
59
|
+
align: 'center'
|
|
57
60
|
};
|
|
58
61
|
return typeof props === 'function' ? _objectSpread(_objectSpread(_objectSpread({}, defaultColumnProps), defaultProps), {}, {
|
|
59
62
|
render: props
|
|
@@ -106,17 +109,21 @@ function InternalTable(props, ref) {
|
|
|
106
109
|
tableParams = _useState4[0],
|
|
107
110
|
setTableParams = _useState4[1];
|
|
108
111
|
|
|
112
|
+
// 隐藏单个分页时, 高度充满
|
|
113
|
+
var extraHeight = useMemo(function () {
|
|
114
|
+
return _pagination['hideOnSinglePage'] ? 0 : 56;
|
|
115
|
+
}, [_pagination]);
|
|
116
|
+
|
|
109
117
|
// 默认垂直滚动高度为 calc(100% - 56px),其中56px为表格header高度,如需修改,需要自行覆盖styles中的相关样式
|
|
110
118
|
var _scroll = scroll ? _objectSpread({
|
|
111
|
-
y:
|
|
119
|
+
y: "calc(100% - ".concat(extraHeight, "px)")
|
|
112
120
|
}, scroll) : {
|
|
113
|
-
y:
|
|
121
|
+
y: "calc(100% - ".concat(extraHeight, "px)")
|
|
114
122
|
};
|
|
115
123
|
|
|
116
124
|
// 合并列属性
|
|
117
125
|
var _columns = getColumns(columns, defaultColumnProps);
|
|
118
126
|
|
|
119
|
-
// 加入操作列
|
|
120
127
|
// 加入操作列
|
|
121
128
|
var _actionColumn = actionColumn ? getActionColumnProps(actionColumn, defaultColumnProps) : undefined;
|
|
122
129
|
if (_actionColumn && _columns instanceof Array) _columns.push(_actionColumn);
|
|
@@ -180,6 +187,12 @@ function InternalTable(props, ref) {
|
|
|
180
187
|
}
|
|
181
188
|
};
|
|
182
189
|
|
|
190
|
+
// 手动刷新方法
|
|
191
|
+
var refresh = function refresh(params) {
|
|
192
|
+
var refreshParams = _objectSpread(_objectSpread({}, tableParams), params);
|
|
193
|
+
loadData(refreshParams);
|
|
194
|
+
};
|
|
195
|
+
|
|
183
196
|
// 监听分页大小变化,如果外部也监听了onChange,则不会触发loadMore,但如果外部onChange返回值为undefined则正常触loadMore
|
|
184
197
|
var onChange = function onChange(page, pageSize) {
|
|
185
198
|
if (_pagination && typeof (_pagination === null || _pagination === void 0 ? void 0 : _pagination.onChange) === 'function') {
|
|
@@ -201,13 +214,30 @@ function InternalTable(props, ref) {
|
|
|
201
214
|
pageSize: tableParams.size,
|
|
202
215
|
onChange: onChange
|
|
203
216
|
}) : _pagination;
|
|
204
|
-
|
|
217
|
+
useImperativeHandle(ref, function () {
|
|
218
|
+
return {
|
|
219
|
+
refresh: refresh,
|
|
220
|
+
// 提供获取当前分页状态的方法
|
|
221
|
+
getPaginationState: function getPaginationState() {
|
|
222
|
+
return {
|
|
223
|
+
current: tableParams.current,
|
|
224
|
+
size: tableParams.size,
|
|
225
|
+
total: tableSource.total
|
|
226
|
+
};
|
|
227
|
+
},
|
|
228
|
+
// 提供刷新到指定页面的方法
|
|
229
|
+
refreshToPage: function refreshToPage(page) {
|
|
230
|
+
refresh({
|
|
231
|
+
current: page
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
});
|
|
205
236
|
// 数据初始加载
|
|
206
237
|
useEffect(function () {
|
|
207
238
|
return loadData(extraParams);
|
|
208
239
|
}, [dataSource, extraParams]);
|
|
209
240
|
return /*#__PURE__*/_jsx(Table, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
210
|
-
ref: ref,
|
|
211
241
|
rowKey: rowKey,
|
|
212
242
|
className: _className,
|
|
213
243
|
columns: _columns,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { TreeSelectProps } from 'antd';
|
|
3
|
-
import { DefaultOptionType } from 'antd/lib/select';
|
|
4
|
-
import './index.less';
|
|
5
|
-
export
|
|
6
|
-
/** antd的treeData属性,可以是一个treeData数组,或一个返回等价treeData数组的promise */
|
|
7
|
-
treeData?: TreeSelectProps['treeData'] | ((node?: DefaultOptionType) => Promise<TreeSelectProps['treeData']>);
|
|
8
|
-
/** antd的loadData属性,动态加载子级列表数据,默认使用treeData所提供的方法,如果传入null,则表示不进行动态加载,该方法要求返回一个treeData数组或与其等价的Promise */
|
|
9
|
-
loadData?: ((node?: DefaultOptionType) => Promise<TreeSelectProps['treeData']>) | null;
|
|
10
|
-
/** 等同antd的loadData属性,用于监听loadData事件*/
|
|
11
|
-
onLoadData?: (node?: DefaultOptionType) => void;
|
|
12
|
-
/** antd的loading属性,是否显示加载中:传入数字表示延迟加载,单位毫秒,0等同于false */
|
|
13
|
-
loading?: boolean | number;
|
|
14
|
-
};
|
|
15
|
-
declare const DTreeSelect: React.ForwardRefExoticComponent<DTreeSelectProps & React.RefAttributes<any>>;
|
|
16
|
-
export default DTreeSelect;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TreeSelectProps } from 'antd';
|
|
3
|
+
import { DefaultOptionType } from 'antd/lib/select';
|
|
4
|
+
import './index.less';
|
|
5
|
+
export type DTreeSelectProps = Omit<TreeSelectProps, 'treeData' | 'loadData' | 'loading'> & {
|
|
6
|
+
/** antd的treeData属性,可以是一个treeData数组,或一个返回等价treeData数组的promise */
|
|
7
|
+
treeData?: TreeSelectProps['treeData'] | ((node?: DefaultOptionType) => Promise<TreeSelectProps['treeData']>);
|
|
8
|
+
/** antd的loadData属性,动态加载子级列表数据,默认使用treeData所提供的方法,如果传入null,则表示不进行动态加载,该方法要求返回一个treeData数组或与其等价的Promise */
|
|
9
|
+
loadData?: ((node?: DefaultOptionType) => Promise<TreeSelectProps['treeData']>) | null;
|
|
10
|
+
/** 等同antd的loadData属性,用于监听loadData事件*/
|
|
11
|
+
onLoadData?: (node?: DefaultOptionType) => void;
|
|
12
|
+
/** antd的loading属性,是否显示加载中:传入数字表示延迟加载,单位毫秒,0等同于false */
|
|
13
|
+
loading?: boolean | number;
|
|
14
|
+
};
|
|
15
|
+
declare const DTreeSelect: React.ForwardRefExoticComponent<DTreeSelectProps & React.RefAttributes<any>>;
|
|
16
|
+
export default DTreeSelect;
|
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
import { UploadFile } from 'antd';
|
|
2
|
-
|
|
3
|
-
/** 文件id */
|
|
4
|
-
id?: string | number;
|
|
5
|
-
/** 文件uid,系统自动生成 */
|
|
6
|
-
uid?: string | number;
|
|
7
|
-
/** 文件来源 upload:文件对话框,remote:已上传的文件对象 */
|
|
8
|
-
source?: 'upload' | 'remote';
|
|
9
|
-
/** 文件状态 */
|
|
10
|
-
status?: 'error' | 'success' | 'done' | 'uploading' | 'removed';
|
|
11
|
-
};
|
|
12
|
-
/** 转换base64时的参数 */
|
|
13
|
-
|
|
14
|
-
width?: number;
|
|
15
|
-
/** 图像高度 */
|
|
16
|
-
height?: number;
|
|
17
|
-
/** 图像质量 */
|
|
18
|
-
quality?: number;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/** 对目标文件进行过滤,默认只对图片格式生成缩略图 */
|
|
22
|
-
filter?: ((file: DUploadFile) => boolean) | Array<string>;
|
|
23
|
-
/** 文件大小,当上传文件大于指定值时会对缩略图进行压缩,单位为字节,默认2MB */
|
|
24
|
-
size?: number;
|
|
25
|
-
/** 缩略图压缩参数,默认为 {width:300,height:200,quality:0.7} */
|
|
26
|
-
compress?: CompressProps | null;
|
|
27
|
-
/** 缩略图生成失败时的回调函数 */
|
|
28
|
-
onError?: (err: Error) => void;
|
|
29
|
-
/** 自定义生成base64缩略图的方法 */
|
|
30
|
-
getThumbUrl?: (file: DUploadFile, option: ThumbOptionProps) => Promise<string>;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* @description : 将图像文件转换为Base64格式
|
|
34
|
-
* @param {Blob} blob 图像文件
|
|
35
|
-
* @param {CompressProps} options 指定图像压缩参数,其格式为: {width:300,height:200,quality:0.7}
|
|
36
|
-
* @return {Promise<string>} 包含Base64字符串的Promise对象
|
|
37
|
-
* @example : imageToBase64(file,{ width: 300, height: 200, quality: 0.7 }).then( url => console.log( url ) )
|
|
38
|
-
*/
|
|
39
|
-
declare function imageToBase64(blob: Blob, options?: CompressProps | null): Promise<string>;
|
|
40
|
-
/**
|
|
41
|
-
* @description : 将传入的文件转换为UploadFile数组
|
|
42
|
-
* @param {any} files 目标文件对象
|
|
43
|
-
* @return {UploadFile[]} UploadFile数组
|
|
44
|
-
* @example :
|
|
45
|
-
*/
|
|
46
|
-
declare function getUploadFile(files: any, maxCount?: number): any[];
|
|
47
|
-
/**
|
|
48
|
-
* @description : 根据传入的option对象获取缩略图参数
|
|
49
|
-
* @param {ThumbOptionProps} option 缩略图参数对象
|
|
50
|
-
* @return {ThumbOptionProps} ThumbOption对象
|
|
51
|
-
* @example :
|
|
52
|
-
*/
|
|
53
|
-
declare function getThumbOption(option?: ThumbOptionProps | null): {
|
|
54
|
-
size: number;
|
|
55
|
-
filter: (
|
|
56
|
-
compress: {
|
|
57
|
-
width: number;
|
|
58
|
-
height: number;
|
|
59
|
-
quality: number;
|
|
60
|
-
} | null;
|
|
61
|
-
onError: ((err: Error) => void) | undefined;
|
|
62
|
-
getThumbUrl: ((file: DUploadFile, option: ThumbOptionProps) => Promise<string>) | undefined;
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* @description : a标签下载文件
|
|
66
|
-
* @param {Blob | string} url a标签的下载url或文件流
|
|
67
|
-
* @param {string} fileName 下载文件的名称,如果缺省则尝试从url中获取,默认为: "新建文件"
|
|
68
|
-
* @return {*}
|
|
69
|
-
* @example :
|
|
70
|
-
*/
|
|
71
|
-
declare function downloadFile(url: Blob | string, fileName?: string): void;
|
|
72
|
-
/**
|
|
73
|
-
* @description : a标签预览文件
|
|
74
|
-
* @param {Blob | string} url a标签的预览url或文件流
|
|
75
|
-
* @return {*}
|
|
76
|
-
* @example :
|
|
77
|
-
*/
|
|
78
|
-
declare function previewFile(url: Blob | string): void;
|
|
79
|
-
/**
|
|
80
|
-
* @description : 以递归方式深度查找一个对象
|
|
81
|
-
* @param {Record} object 待查找的对象
|
|
82
|
-
* @param {function} fn 查找函数,每次递归时执行,如果执行结果为true,则递归过程并返回当前对象
|
|
83
|
-
* @param {number} maxDepth 递归的最大深度,默认10
|
|
84
|
-
* @return {*} 查找到的对象,未查找到则返回undefined
|
|
85
|
-
* @example :
|
|
86
|
-
*/
|
|
87
|
-
declare function deepFindObject(object: Record<string, any>, fn: (item: any, parent: any, fieldMap: any) => boolean, maxDepth?: number): any;
|
|
88
|
-
/**
|
|
89
|
-
* @description : 以递归方式深度查找一个Jsx对象
|
|
90
|
-
* @param {Record} object 待查找的Jsx对象
|
|
91
|
-
* @param {function} fn 查找函数,每次递归时执行,如果执行结果为true,则停止递归过程并返回当前对象
|
|
92
|
-
* @param {number} maxDepth 递归的最大深度,默认10
|
|
93
|
-
* @return {*} 查找到的对象,未查找到则返回undefined
|
|
94
|
-
* @example :
|
|
95
|
-
*/
|
|
96
|
-
declare function deepFindJsx(object: Record<string, any>, fn: (item: any, parent: any) => boolean, maxDepth?: number): any;
|
|
97
|
-
declare const _default: {
|
|
98
|
-
imageToBase64: typeof imageToBase64;
|
|
99
|
-
getUploadFile: typeof getUploadFile;
|
|
100
|
-
getThumbOption: typeof getThumbOption;
|
|
101
|
-
downloadFile: typeof downloadFile;
|
|
102
|
-
previewFile: typeof previewFile;
|
|
103
|
-
deepFindObject: typeof deepFindObject;
|
|
104
|
-
deepFindJsx: typeof deepFindJsx;
|
|
105
|
-
};
|
|
106
|
-
export default _default;
|
|
107
|
-
export type { DUploadFile, ThumbOptionProps };
|
|
1
|
+
import { UploadFile } from 'antd';
|
|
2
|
+
type DUploadFile = Omit<UploadFile, 'uid'> & {
|
|
3
|
+
/** 文件id */
|
|
4
|
+
id?: string | number;
|
|
5
|
+
/** 文件uid,系统自动生成 */
|
|
6
|
+
uid?: string | number;
|
|
7
|
+
/** 文件来源 upload:文件对话框,remote:已上传的文件对象 */
|
|
8
|
+
source?: 'upload' | 'remote';
|
|
9
|
+
/** 文件状态 */
|
|
10
|
+
status?: 'error' | 'success' | 'done' | 'uploading' | 'removed';
|
|
11
|
+
};
|
|
12
|
+
/** 转换base64时的参数 */
|
|
13
|
+
type CompressProps = {
|
|
14
|
+
width?: number;
|
|
15
|
+
/** 图像高度 */
|
|
16
|
+
height?: number;
|
|
17
|
+
/** 图像质量 */
|
|
18
|
+
quality?: number;
|
|
19
|
+
};
|
|
20
|
+
type ThumbOptionProps = {
|
|
21
|
+
/** 对目标文件进行过滤,默认只对图片格式生成缩略图 */
|
|
22
|
+
filter?: ((file: DUploadFile) => boolean) | Array<string>;
|
|
23
|
+
/** 文件大小,当上传文件大于指定值时会对缩略图进行压缩,单位为字节,默认2MB */
|
|
24
|
+
size?: number;
|
|
25
|
+
/** 缩略图压缩参数,默认为 {width:300,height:200,quality:0.7} */
|
|
26
|
+
compress?: CompressProps | null;
|
|
27
|
+
/** 缩略图生成失败时的回调函数 */
|
|
28
|
+
onError?: (err: Error) => void;
|
|
29
|
+
/** 自定义生成base64缩略图的方法 */
|
|
30
|
+
getThumbUrl?: (file: DUploadFile, option: ThumbOptionProps) => Promise<string>;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* @description : 将图像文件转换为Base64格式
|
|
34
|
+
* @param {Blob} blob 图像文件
|
|
35
|
+
* @param {CompressProps} options 指定图像压缩参数,其格式为: {width:300,height:200,quality:0.7}
|
|
36
|
+
* @return {Promise<string>} 包含Base64字符串的Promise对象
|
|
37
|
+
* @example : imageToBase64(file,{ width: 300, height: 200, quality: 0.7 }).then( url => console.log( url ) )
|
|
38
|
+
*/
|
|
39
|
+
declare function imageToBase64(blob: Blob, options?: CompressProps | null): Promise<string>;
|
|
40
|
+
/**
|
|
41
|
+
* @description : 将传入的文件转换为UploadFile数组
|
|
42
|
+
* @param {any} files 目标文件对象
|
|
43
|
+
* @return {UploadFile[]} UploadFile数组
|
|
44
|
+
* @example :
|
|
45
|
+
*/
|
|
46
|
+
declare function getUploadFile(files: any, maxCount?: number): any[];
|
|
47
|
+
/**
|
|
48
|
+
* @description : 根据传入的option对象获取缩略图参数
|
|
49
|
+
* @param {ThumbOptionProps} option 缩略图参数对象
|
|
50
|
+
* @return {ThumbOptionProps} ThumbOption对象
|
|
51
|
+
* @example :
|
|
52
|
+
*/
|
|
53
|
+
declare function getThumbOption(option?: ThumbOptionProps | null): {
|
|
54
|
+
size: number;
|
|
55
|
+
filter: (file: DUploadFile) => boolean;
|
|
56
|
+
compress: {
|
|
57
|
+
width: number;
|
|
58
|
+
height: number;
|
|
59
|
+
quality: number;
|
|
60
|
+
} | null;
|
|
61
|
+
onError: ((err: Error) => void) | undefined;
|
|
62
|
+
getThumbUrl: ((file: DUploadFile, option: ThumbOptionProps) => Promise<string>) | undefined;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* @description : a标签下载文件
|
|
66
|
+
* @param {Blob | string} url a标签的下载url或文件流
|
|
67
|
+
* @param {string} fileName 下载文件的名称,如果缺省则尝试从url中获取,默认为: "新建文件"
|
|
68
|
+
* @return {*}
|
|
69
|
+
* @example :
|
|
70
|
+
*/
|
|
71
|
+
declare function downloadFile(url: Blob | string, fileName?: string): void;
|
|
72
|
+
/**
|
|
73
|
+
* @description : a标签预览文件
|
|
74
|
+
* @param {Blob | string} url a标签的预览url或文件流
|
|
75
|
+
* @return {*}
|
|
76
|
+
* @example :
|
|
77
|
+
*/
|
|
78
|
+
declare function previewFile(url: Blob | string): void;
|
|
79
|
+
/**
|
|
80
|
+
* @description : 以递归方式深度查找一个对象
|
|
81
|
+
* @param {Record} object 待查找的对象
|
|
82
|
+
* @param {function} fn 查找函数,每次递归时执行,如果执行结果为true,则递归过程并返回当前对象
|
|
83
|
+
* @param {number} maxDepth 递归的最大深度,默认10
|
|
84
|
+
* @return {*} 查找到的对象,未查找到则返回undefined
|
|
85
|
+
* @example :
|
|
86
|
+
*/
|
|
87
|
+
declare function deepFindObject(object: Record<string, any>, fn: (item: any, parent: any, fieldMap: any) => boolean, maxDepth?: number): any;
|
|
88
|
+
/**
|
|
89
|
+
* @description : 以递归方式深度查找一个Jsx对象
|
|
90
|
+
* @param {Record} object 待查找的Jsx对象
|
|
91
|
+
* @param {function} fn 查找函数,每次递归时执行,如果执行结果为true,则停止递归过程并返回当前对象
|
|
92
|
+
* @param {number} maxDepth 递归的最大深度,默认10
|
|
93
|
+
* @return {*} 查找到的对象,未查找到则返回undefined
|
|
94
|
+
* @example :
|
|
95
|
+
*/
|
|
96
|
+
declare function deepFindJsx(object: Record<string, any>, fn: (item: any, parent: any) => boolean, maxDepth?: number): any;
|
|
97
|
+
declare const _default: {
|
|
98
|
+
imageToBase64: typeof imageToBase64;
|
|
99
|
+
getUploadFile: typeof getUploadFile;
|
|
100
|
+
getThumbOption: typeof getThumbOption;
|
|
101
|
+
downloadFile: typeof downloadFile;
|
|
102
|
+
previewFile: typeof previewFile;
|
|
103
|
+
deepFindObject: typeof deepFindObject;
|
|
104
|
+
deepFindJsx: typeof deepFindJsx;
|
|
105
|
+
};
|
|
106
|
+
export default _default;
|
|
107
|
+
export type { DUploadFile, ThumbOptionProps };
|