@pointcloud/pcloud-components 0.1.4 → 0.1.6
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/CHANGELOG.md +10 -0
- package/README.md +284 -25
- package/dist/esm/AdvancedFilter/FormFilter.d.ts +2 -2
- package/dist/esm/AdvancedFilter/FormFilter.js +43 -45
- package/dist/esm/AdvancedFilter/index.js +66 -75
- package/dist/esm/AdvancedFilter/interface.d.ts +1 -1
- package/dist/esm/AdvancedFilter/styles/index.less +146 -116
- package/dist/esm/ConfigProvider/index.d.ts +1 -1
- package/dist/esm/ConfigProvider/index.js +5 -3
- package/dist/esm/DCascader/index.js +12 -26
- package/dist/esm/DCascader/index.less +24 -20
- package/dist/esm/DForm/DItem/index.d.ts +5 -0
- package/dist/esm/DForm/DItem/index.js +36 -0
- package/dist/esm/DForm/DItem/itemType.d.ts +106 -0
- package/dist/esm/DForm/DItem/itemType.js +1 -0
- package/dist/esm/DForm/DItem/itemsRender.d.ts +40 -0
- package/dist/esm/DForm/DItem/itemsRender.js +198 -0
- package/dist/esm/DForm/helper.js +1 -1
- package/dist/esm/DForm/index.d.ts +7 -3
- package/dist/esm/DForm/index.js +55 -22
- package/dist/esm/DForm/index.less +1 -0
- package/dist/esm/DInput/index.js +10 -12
- package/dist/esm/DSelect/index.d.ts +1 -1
- package/dist/esm/DSelect/index.js +12 -23
- package/dist/esm/DTable/index.d.ts +15 -8
- package/dist/esm/DTable/index.js +88 -84
- package/dist/esm/DTable/index.less +11 -2
- package/dist/esm/DTreeSelect/index.d.ts +1 -1
- package/dist/esm/DTreeSelect/index.js +12 -26
- package/dist/esm/DTreeSelect/index.less +11 -9
- package/dist/esm/DUpload/helper.js +49 -53
- package/dist/esm/DUpload/index.js +73 -80
- package/dist/esm/DUpload/index.less +19 -18
- package/dist/esm/ErrorBoundary/index.d.ts +2 -2
- package/dist/esm/ErrorBoundary/index.js +16 -12
- package/dist/esm/ErrorBoundary/index.less +44 -43
- package/dist/esm/LModal/index.d.ts +2 -2
- package/dist/esm/LModal/index.js +11 -13
- package/dist/esm/LModal/interface.d.ts +1 -1
- package/dist/esm/LModal/styles/index.less +2 -0
- package/dist/esm/LabelValue/index.d.ts +1 -1
- package/dist/esm/LabelValue/index.js +14 -12
- package/dist/esm/LabelValue/styles/index.less +23 -19
- package/dist/esm/Loading/interface.d.ts +4 -4
- package/dist/esm/Loading/loading.d.ts +2 -2
- package/dist/esm/Loading/loading.js +18 -16
- package/dist/esm/Loading/styles/index.less +25 -23
- package/dist/esm/NoData/index.d.ts +2 -2
- package/dist/esm/NoData/index.js +14 -13
- package/dist/esm/NoData/styles/index.less +24 -21
- package/dist/esm/index.d.ts +2 -2
- package/dist/umd/pcloud-components.min.css +1 -1
- package/dist/umd/pcloud-components.min.js +1 -1
- package/package.json +94 -73
- package/dist/esm/DForm/DItem.d.ts +0 -28
- package/dist/esm/DForm/DItem.js +0 -31
- package/dist/esm/DForm/DItemsMap.d.ts +0 -33
- package/dist/esm/DForm/DItemsMap.js +0 -148
|
@@ -2,6 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { TableProps } from 'antd';
|
|
3
3
|
import { ColumnType } from 'antd/lib/table';
|
|
4
4
|
import './index.less';
|
|
5
|
+
export declare type DColumnType = ColumnType<any> & {
|
|
6
|
+
cellEllipsis?: boolean;
|
|
7
|
+
};
|
|
5
8
|
export declare type DTableSourceProps = {
|
|
6
9
|
records: TableProps<any>['dataSource'];
|
|
7
10
|
total: number;
|
|
@@ -12,28 +15,32 @@ export declare type TableParamsProps = {
|
|
|
12
15
|
size?: number;
|
|
13
16
|
[key: string]: any;
|
|
14
17
|
};
|
|
15
|
-
export declare type DTableProps = TableProps<any> & {
|
|
18
|
+
export declare type DTableProps = Omit<TableProps<any>, 'columns'> & {
|
|
16
19
|
/** 表格列的基础默认配置,默认所有列居中,表头文字超出显示省略号,详见 antd columns */
|
|
17
|
-
|
|
20
|
+
defaultColumnProps?: DColumnType;
|
|
18
21
|
/** 操作列配置,可以是一个普通列配置对象,也可以是一个columns的 render 函数 */
|
|
19
|
-
actionColumn?:
|
|
22
|
+
actionColumn?: DColumnType | DColumnType['render'];
|
|
20
23
|
/** 表格数据的加载函数,在表格创建、分页变化、额外参数变化时自动运行,如果设置该属性,则 dataSource 失效 */
|
|
21
|
-
loadMore?: (params?: TableParamsProps) => Promise<DTableSourceProps>;
|
|
24
|
+
loadMore?: (params?: TableParamsProps, records?: DTableSourceProps['records']) => Promise<DTableSourceProps>;
|
|
22
25
|
/** 加载数据失败时是否显示错误信息(仅loadMore可用时生效) */
|
|
23
26
|
showErrorMsg?: boolean | ((err: any) => string);
|
|
24
27
|
/** 额外的请求参数,(仅loadMore可用时生效) */
|
|
25
28
|
extraParams?: TableParamsProps;
|
|
29
|
+
/** 表格列配置 */
|
|
30
|
+
columns?: DColumnType[];
|
|
26
31
|
};
|
|
27
|
-
declare const DTable: React.ForwardRefExoticComponent<TableProps<any> & {
|
|
32
|
+
declare const DTable: React.ForwardRefExoticComponent<Omit<TableProps<any>, "columns"> & {
|
|
28
33
|
/** 表格列的基础默认配置,默认所有列居中,表头文字超出显示省略号,详见 antd columns */
|
|
29
|
-
|
|
34
|
+
defaultColumnProps?: DColumnType | undefined;
|
|
30
35
|
/** 操作列配置,可以是一个普通列配置对象,也可以是一个columns的 render 函数 */
|
|
31
|
-
actionColumn?:
|
|
36
|
+
actionColumn?: DColumnType | DColumnType['render'];
|
|
32
37
|
/** 表格数据的加载函数,在表格创建、分页变化、额外参数变化时自动运行,如果设置该属性,则 dataSource 失效 */
|
|
33
|
-
loadMore?: ((params?: TableParamsProps) => Promise<DTableSourceProps>) | undefined;
|
|
38
|
+
loadMore?: ((params?: TableParamsProps, records?: DTableSourceProps['records']) => Promise<DTableSourceProps>) | undefined;
|
|
34
39
|
/** 加载数据失败时是否显示错误信息(仅loadMore可用时生效) */
|
|
35
40
|
showErrorMsg?: boolean | ((err: any) => string) | undefined;
|
|
36
41
|
/** 额外的请求参数,(仅loadMore可用时生效) */
|
|
37
42
|
extraParams?: TableParamsProps | undefined;
|
|
43
|
+
/** 表格列配置 */
|
|
44
|
+
columns?: DColumnType[] | undefined;
|
|
38
45
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
39
46
|
export default DTable;
|
package/dist/esm/DTable/index.js
CHANGED
|
@@ -1,30 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
9
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
13
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
14
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
16
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
|
+
var _excluded = ["loadMore", "defaultColumnProps", "actionColumn", "showErrorMsg", "extraParams", "dataSource", "rowKey", "scroll", "className", "pagination", "columns", "loading"];
|
|
17
5
|
/*
|
|
18
6
|
* @Author : wangfeihu
|
|
19
7
|
* @Date : 2023-05-09 15:04:48
|
|
20
8
|
* @LastEditors : wangfeihu
|
|
21
|
-
* @LastEditTime : 2023-
|
|
9
|
+
* @LastEditTime : 2023-08-16 16:45:15
|
|
22
10
|
* @Description : 基于antd的Table组件
|
|
23
11
|
*/
|
|
24
12
|
import React, { forwardRef, useEffect, useRef, useState, useContext } from 'react';
|
|
25
13
|
import { message, Table } from 'antd';
|
|
26
14
|
import { ConfigContext } from "../ConfigProvider";
|
|
27
15
|
import "./index.less";
|
|
16
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
18
|
// 分页器配置项
|
|
29
19
|
var defaultPagination = {
|
|
30
20
|
hideOnSinglePage: false,
|
|
@@ -32,14 +22,59 @@ var defaultPagination = {
|
|
|
32
22
|
showSizeChanger: true,
|
|
33
23
|
showQuickJumper: true,
|
|
34
24
|
showTotal: function showTotal(total) {
|
|
35
|
-
return /*#__PURE__*/
|
|
36
|
-
className: "d-pagination-total"
|
|
37
|
-
|
|
25
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
26
|
+
className: "d-pagination-total",
|
|
27
|
+
children: ["\u5171", /*#__PURE__*/_jsxs("span", {
|
|
28
|
+
children: [" ", total, " "]
|
|
29
|
+
}), "\u6761"]
|
|
30
|
+
});
|
|
38
31
|
}
|
|
39
32
|
};
|
|
33
|
+
|
|
34
|
+
// 数据列
|
|
35
|
+
function getColumns(columns, defaultColumnProps) {
|
|
36
|
+
return columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
|
|
37
|
+
var _item = _objectSpread(_objectSpread({
|
|
38
|
+
align: 'center',
|
|
39
|
+
ellipsis: {
|
|
40
|
+
showTitle: false
|
|
41
|
+
},
|
|
42
|
+
cellEllipsis: true
|
|
43
|
+
}, defaultColumnProps), item);
|
|
44
|
+
if (_item.cellEllipsis === false) {
|
|
45
|
+
_item.className = _item !== null && _item !== void 0 && _item.className ? 'd-table-cell-wrap ' + _item.className : 'd-table-cell-wrap';
|
|
46
|
+
}
|
|
47
|
+
return _item;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 操作列
|
|
52
|
+
function getActionColumnProps(props, defaultColumnProps) {
|
|
53
|
+
var defaultProps = {
|
|
54
|
+
width: 140,
|
|
55
|
+
title: '操作',
|
|
56
|
+
dataIndex: 'action'
|
|
57
|
+
};
|
|
58
|
+
return typeof props === 'function' ? _objectSpread(_objectSpread(_objectSpread({}, defaultColumnProps), defaultProps), {}, {
|
|
59
|
+
render: props
|
|
60
|
+
}) : _objectSpread(_objectSpread(_objectSpread({}, defaultColumnProps), defaultProps), props);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// 分页配置
|
|
64
|
+
function getTablePage(_pagination) {
|
|
65
|
+
var _ref = _pagination || {},
|
|
66
|
+
current = _ref.current,
|
|
67
|
+
defaultCurrent = _ref.defaultCurrent,
|
|
68
|
+
pageSize = _ref.pageSize,
|
|
69
|
+
defaultPageSize = _ref.defaultPageSize;
|
|
70
|
+
return {
|
|
71
|
+
current: current || defaultCurrent || 1,
|
|
72
|
+
size: pageSize || defaultPageSize || 10
|
|
73
|
+
};
|
|
74
|
+
}
|
|
40
75
|
function InternalTable(props, ref) {
|
|
41
76
|
var loadMore = props.loadMore,
|
|
42
|
-
|
|
77
|
+
defaultColumnProps = props.defaultColumnProps,
|
|
43
78
|
actionColumn = props.actionColumn,
|
|
44
79
|
_props$showErrorMsg = props.showErrorMsg,
|
|
45
80
|
showErrorMsg = _props$showErrorMsg === void 0 ? true : _props$showErrorMsg,
|
|
@@ -78,17 +113,13 @@ function InternalTable(props, ref) {
|
|
|
78
113
|
y: 'calc(100% - 56px)'
|
|
79
114
|
};
|
|
80
115
|
|
|
81
|
-
//
|
|
82
|
-
var _columns = columns
|
|
83
|
-
return _objectSpread(_objectSpread({
|
|
84
|
-
align: 'center',
|
|
85
|
-
ellipsis: true
|
|
86
|
-
}, columnsProp), item);
|
|
87
|
-
});
|
|
116
|
+
// 合并列属性
|
|
117
|
+
var _columns = getColumns(columns, defaultColumnProps);
|
|
88
118
|
|
|
89
119
|
// 加入操作列
|
|
90
|
-
|
|
91
|
-
_actionColumn
|
|
120
|
+
// 加入操作列
|
|
121
|
+
var _actionColumn = actionColumn ? getActionColumnProps(actionColumn, defaultColumnProps) : undefined;
|
|
122
|
+
if (_actionColumn && _columns instanceof Array) _columns.push(_actionColumn);
|
|
92
123
|
|
|
93
124
|
// pcf-table 样式中已经包含对_scroll的支持
|
|
94
125
|
var _className = "".concat(getPrefixCls('table'), " ").concat(className || '', " ").concat(_pagination ? 'height-on-page' : '');
|
|
@@ -102,21 +133,6 @@ function InternalTable(props, ref) {
|
|
|
102
133
|
spinning: false
|
|
103
134
|
}, loading);
|
|
104
135
|
|
|
105
|
-
// 监听分页大小变化,如果外部也监听了onChange,则不会触发loadMore,但如果外部onChange返回值为undefined则正常触loadMore
|
|
106
|
-
var onChange = function onChange(page, pageSize) {
|
|
107
|
-
if (_pagination && typeof (_pagination === null || _pagination === void 0 ? void 0 : _pagination.onChange) === 'function') {
|
|
108
|
-
var data = _pagination.onChange(page, pageSize);
|
|
109
|
-
if (data === undefined) loadData(_objectSpread(_objectSpread({}, tableParams), {}, {
|
|
110
|
-
current: page,
|
|
111
|
-
size: pageSize
|
|
112
|
-
}));
|
|
113
|
-
} else {
|
|
114
|
-
loadData(_objectSpread(_objectSpread({}, tableParams), {}, {
|
|
115
|
-
current: page,
|
|
116
|
-
size: pageSize
|
|
117
|
-
}));
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
136
|
// 加载数据
|
|
121
137
|
var loadData = function loadData(params) {
|
|
122
138
|
if (typeof loadMore === 'function') {
|
|
@@ -127,15 +143,15 @@ function InternalTable(props, ref) {
|
|
|
127
143
|
var paramsString = JSON.stringify(_tableQuery);
|
|
128
144
|
loadingParamsRef.current = paramsString;
|
|
129
145
|
setTableParams(_tableQuery);
|
|
130
|
-
loadMore(_tableQuery).then(function (response) {
|
|
146
|
+
loadMore(_tableQuery, tableSource.records).then(function (response) {
|
|
131
147
|
if (loadingParamsRef.current === paramsString) {
|
|
132
148
|
var _response$total = response.total,
|
|
133
149
|
total = _response$total === void 0 ? 0 : _response$total,
|
|
134
150
|
_response$records = response.records,
|
|
135
|
-
|
|
151
|
+
_records = _response$records === void 0 ? [] : _response$records;
|
|
136
152
|
setTableSource({
|
|
137
153
|
total: total,
|
|
138
|
-
records:
|
|
154
|
+
records: _records,
|
|
139
155
|
loading: false
|
|
140
156
|
});
|
|
141
157
|
}
|
|
@@ -162,56 +178,44 @@ function InternalTable(props, ref) {
|
|
|
162
178
|
}
|
|
163
179
|
};
|
|
164
180
|
|
|
181
|
+
// 监听分页大小变化,如果外部也监听了onChange,则不会触发loadMore,但如果外部onChange返回值为undefined则正常触loadMore
|
|
182
|
+
var onChange = function onChange(page, pageSize) {
|
|
183
|
+
if (_pagination && typeof (_pagination === null || _pagination === void 0 ? void 0 : _pagination.onChange) === 'function') {
|
|
184
|
+
var data = _pagination.onChange(page, pageSize);
|
|
185
|
+
if (data === undefined) loadData(_objectSpread(_objectSpread({}, tableParams), {}, {
|
|
186
|
+
current: page,
|
|
187
|
+
size: pageSize
|
|
188
|
+
}));
|
|
189
|
+
} else {
|
|
190
|
+
loadData(_objectSpread(_objectSpread({}, tableParams), {}, {
|
|
191
|
+
current: page,
|
|
192
|
+
size: pageSize
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
var _tablePagination = _pagination ? _objectSpread(_objectSpread({}, _pagination), {}, {
|
|
197
|
+
total: tableSource.total,
|
|
198
|
+
current: tableParams.current,
|
|
199
|
+
pageSize: tableParams.size,
|
|
200
|
+
onChange: onChange
|
|
201
|
+
}) : _pagination;
|
|
202
|
+
|
|
165
203
|
// 数据初始加载
|
|
166
204
|
useEffect(function () {
|
|
167
205
|
return loadData(extraParams);
|
|
168
206
|
}, [dataSource, extraParams]);
|
|
169
|
-
return /*#__PURE__*/
|
|
207
|
+
return /*#__PURE__*/_jsx(Table, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
170
208
|
ref: ref,
|
|
171
209
|
rowKey: rowKey,
|
|
172
210
|
className: _className,
|
|
173
211
|
columns: _columns,
|
|
174
212
|
dataSource: tableSource.records,
|
|
175
|
-
pagination:
|
|
176
|
-
total: tableSource.total,
|
|
177
|
-
current: tableParams.current,
|
|
178
|
-
pageSize: tableParams.size,
|
|
179
|
-
onChange: onChange
|
|
180
|
-
}),
|
|
213
|
+
pagination: _tablePagination,
|
|
181
214
|
scroll: _scroll,
|
|
182
215
|
loading: _objectSpread(_objectSpread({}, _loading), {}, {
|
|
183
216
|
spinning: tableSource.loading
|
|
184
217
|
})
|
|
185
218
|
}));
|
|
186
219
|
}
|
|
187
|
-
|
|
188
|
-
// 操作列
|
|
189
|
-
function getActionColumnProps(props, columnsProp) {
|
|
190
|
-
var defaultProps = {
|
|
191
|
-
width: 140,
|
|
192
|
-
title: '操作',
|
|
193
|
-
dataIndex: 'action'
|
|
194
|
-
};
|
|
195
|
-
if (typeof props === 'function') {
|
|
196
|
-
return _objectSpread(_objectSpread(_objectSpread({}, columnsProp), defaultProps), {}, {
|
|
197
|
-
render: props
|
|
198
|
-
});
|
|
199
|
-
} else {
|
|
200
|
-
return _objectSpread(_objectSpread(_objectSpread({}, columnsProp), defaultProps), props);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// 分页配置
|
|
205
|
-
function getTablePage(_pagination) {
|
|
206
|
-
var _ref = _pagination || {},
|
|
207
|
-
current = _ref.current,
|
|
208
|
-
defaultCurrent = _ref.defaultCurrent,
|
|
209
|
-
pageSize = _ref.pageSize,
|
|
210
|
-
defaultPageSize = _ref.defaultPageSize;
|
|
211
|
-
return {
|
|
212
|
-
current: current || defaultCurrent || 1,
|
|
213
|
-
size: pageSize || defaultPageSize || 10
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
220
|
var DTable = /*#__PURE__*/forwardRef(InternalTable);
|
|
217
221
|
export default DTable;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@import '../commonStyle/index.less';
|
|
2
|
+
|
|
2
3
|
.@{prefix}-table {
|
|
3
4
|
.ant-spin-nested-loading,
|
|
4
5
|
.ant-spin-container,
|
|
@@ -19,36 +20,44 @@
|
|
|
19
20
|
|
|
20
21
|
.ant-table-body {
|
|
21
22
|
position: absolute;
|
|
23
|
+
overflow-y: auto !important;
|
|
22
24
|
min-width: 100%;
|
|
23
25
|
max-width: 100%;
|
|
24
26
|
min-height: calc(100% - 56px);
|
|
25
27
|
max-height: calc(100% - 56px);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
|
|
29
|
+
// 表内单元格不省略
|
|
30
|
+
.ant-table-tbody > tr > td.ant-table-cell.d-table-cell-wrap {
|
|
28
31
|
white-space: initial;
|
|
29
32
|
}
|
|
33
|
+
|
|
30
34
|
// x轨道的宽度和y轨道的高度
|
|
31
35
|
&::-webkit-scrollbar {
|
|
32
36
|
width: 4px;
|
|
33
37
|
height: 8px;
|
|
34
38
|
}
|
|
39
|
+
|
|
35
40
|
// 轨道拖动部分的背景颜色
|
|
36
41
|
&::-webkit-scrollbar-thumb {
|
|
37
42
|
background-color: #0084ff;
|
|
38
43
|
}
|
|
44
|
+
|
|
39
45
|
// 轨道背景颜色
|
|
40
46
|
&::-webkit-scrollbar-track {
|
|
41
47
|
background-color: #f1f1f1;
|
|
42
48
|
border-radius: 2px;
|
|
43
49
|
}
|
|
50
|
+
|
|
44
51
|
// x、y两条轨道的交叉处
|
|
45
52
|
&::-webkit-scrollbar-corner {
|
|
46
53
|
background-color: #f1f1f1;
|
|
47
54
|
}
|
|
48
55
|
}
|
|
56
|
+
|
|
49
57
|
.ant-spin-nested-loading > div > .ant-spin {
|
|
50
58
|
max-height: initial;
|
|
51
59
|
}
|
|
60
|
+
|
|
52
61
|
.ant-pagination-total-text span {
|
|
53
62
|
color: #40a9ff;
|
|
54
63
|
font-weight: bold;
|
|
@@ -13,7 +13,7 @@ export declare type DTreeSelectProps = Omit<TreeSelectProps, 'treeData' | 'loadD
|
|
|
13
13
|
/** antd的loading属性,是否显示加载中:传入数字表示延迟加载,单位毫秒,0等同于false */
|
|
14
14
|
loading?: boolean | number;
|
|
15
15
|
};
|
|
16
|
-
declare const DTreeSelect: React.ForwardRefExoticComponent<Omit<TreeSelectProps<any, import("rc-tree-select/lib/TreeSelect").DefaultOptionType>, "loading" | "
|
|
16
|
+
declare const DTreeSelect: React.ForwardRefExoticComponent<Omit<TreeSelectProps<any, import("rc-tree-select/lib/TreeSelect").DefaultOptionType>, "loading" | "treeData" | "loadData"> & {
|
|
17
17
|
/** antd的treeData属性,可以是一个treeData数组,或一个返回等价treeData数组的promise */
|
|
18
18
|
treeData?: import("rc-tree-select/lib/TreeSelect").DefaultOptionType[] | ((node?: DefaultOptionType) => Promise<TreeSelectProps['treeData']>) | undefined;
|
|
19
19
|
/** antd的loadData属性,动态加载子级列表数据,默认使用treeData所提供的方法,如果传入null,则表示不进行动态加载,该方法要求返回一个treeData数组或与其等价的Promise */
|
|
@@ -1,35 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
5
|
var _excluded = ["className", "popupClassName", "treeData", "fieldNames", "loadData", "onLoadData", "loading"];
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
17
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
18
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
20
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
21
|
-
/*
|
|
22
|
-
* @Author : wangfeihu
|
|
23
|
-
* @Date : 2023-05-22 10:38:17
|
|
24
|
-
* @LastEditors : wangfeihu
|
|
25
|
-
* @LastEditTime : 2023-06-30 16:24:47
|
|
26
|
-
* @Description : 基于antd的TreeSelect组件
|
|
6
|
+
/*
|
|
7
|
+
* @Author : wangfeihu
|
|
8
|
+
* @Date : 2023-05-22 10:38:17
|
|
9
|
+
* @LastEditors : wangfeihu
|
|
10
|
+
* @LastEditTime : 2023-06-30 16:24:47
|
|
11
|
+
* @Description : 基于antd的TreeSelect组件
|
|
27
12
|
*/
|
|
28
13
|
|
|
29
14
|
import React, { useRef, forwardRef, useState, useEffect, useMemo, useContext } from 'react';
|
|
30
15
|
import { TreeSelect } from 'antd';
|
|
31
16
|
import { ConfigContext } from "../ConfigProvider";
|
|
32
17
|
import "./index.less";
|
|
18
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
33
19
|
// eslint-disable-next-line no-unused-vars
|
|
34
20
|
function deepFind(node, fn) {
|
|
35
21
|
var childrenName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'children';
|
|
@@ -180,7 +166,7 @@ function InternalTreeSelect(props, ref) {
|
|
|
180
166
|
useEffect(function () {
|
|
181
167
|
return updateOptions(getOptionsFun);
|
|
182
168
|
}, [getOptionsFun]);
|
|
183
|
-
return /*#__PURE__*/
|
|
169
|
+
return /*#__PURE__*/_jsx(TreeSelect, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
184
170
|
ref: ref,
|
|
185
171
|
className: _className,
|
|
186
172
|
popupClassName: _popupClassName,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
@import '../commonStyle/index.less';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
1
|
+
@import '../commonStyle/index.less';
|
|
2
|
+
|
|
3
|
+
.@{prefix}-tree-select-dropdown .ant-select-tree-node-content-wrapper {
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
white-space: nowrap;
|
|
6
|
+
text-overflow: ellipsis;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.@{prefix}-tree-select-dropdown .ant-select-tree-node-content-wrapper .ant-select-tree-title {
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* @
|
|
9
|
-
* @Date : 2023-06-16 11:25:57
|
|
10
|
-
* @LastEditors : wangfeihu
|
|
11
|
-
* @LastEditTime : 2023-06-29 18:10:04
|
|
12
|
-
* @Description : 辅助方法集合
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
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-06-29 18:10:04
|
|
8
|
+
* @Description : 辅助方法集合
|
|
13
9
|
*/
|
|
14
10
|
|
|
15
11
|
/** 转换base64时的参数 */
|
|
@@ -45,12 +41,12 @@ function getType(value) {
|
|
|
45
41
|
}
|
|
46
42
|
}
|
|
47
43
|
|
|
48
|
-
/**
|
|
49
|
-
* @description : 将图像文件转换为Base64格式
|
|
50
|
-
* @param {Blob} blob 图像文件
|
|
51
|
-
* @param {CompressProps} options 指定图像压缩参数,其格式为: {width:300,height:200,quality:0.7}
|
|
52
|
-
* @return {Promise<string>} 包含Base64字符串的Promise对象
|
|
53
|
-
* @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 ) )
|
|
54
50
|
*/
|
|
55
51
|
function imageToBase64(blob, options) {
|
|
56
52
|
return new Promise(function (resolve, reject) {
|
|
@@ -101,11 +97,11 @@ function imageToBase64(blob, options) {
|
|
|
101
97
|
});
|
|
102
98
|
}
|
|
103
99
|
|
|
104
|
-
/**
|
|
105
|
-
* @description : 将传入的文件转换为UploadFile数组
|
|
106
|
-
* @param {any} files 目标文件对象
|
|
107
|
-
* @return {UploadFile[]} UploadFile数组
|
|
108
|
-
* @example :
|
|
100
|
+
/**
|
|
101
|
+
* @description : 将传入的文件转换为UploadFile数组
|
|
102
|
+
* @param {any} files 目标文件对象
|
|
103
|
+
* @return {UploadFile[]} UploadFile数组
|
|
104
|
+
* @example :
|
|
109
105
|
*/
|
|
110
106
|
function getUploadFile(files, maxCount) {
|
|
111
107
|
if (files) {
|
|
@@ -115,11 +111,11 @@ function getUploadFile(files, maxCount) {
|
|
|
115
111
|
return [];
|
|
116
112
|
}
|
|
117
113
|
|
|
118
|
-
/**
|
|
119
|
-
* @description : 根据传入的option对象获取缩略图参数
|
|
120
|
-
* @param {ThumbOptionProps} option 缩略图参数对象
|
|
121
|
-
* @return {ThumbOptionProps} ThumbOption对象
|
|
122
|
-
* @example :
|
|
114
|
+
/**
|
|
115
|
+
* @description : 根据传入的option对象获取缩略图参数
|
|
116
|
+
* @param {ThumbOptionProps} option 缩略图参数对象
|
|
117
|
+
* @return {ThumbOptionProps} ThumbOption对象
|
|
118
|
+
* @example :
|
|
123
119
|
*/
|
|
124
120
|
function getThumbOption(option) {
|
|
125
121
|
var _ref2 = option || {},
|
|
@@ -153,12 +149,12 @@ function getThumbOption(option) {
|
|
|
153
149
|
return _option;
|
|
154
150
|
}
|
|
155
151
|
|
|
156
|
-
/**
|
|
157
|
-
* @description : a标签下载文件
|
|
158
|
-
* @param {Blob | string} url a标签的下载url或文件流
|
|
159
|
-
* @param {string} fileName 下载文件的名称,如果缺省则尝试从url中获取,默认为: "新建文件"
|
|
160
|
-
* @return {*}
|
|
161
|
-
* @example :
|
|
152
|
+
/**
|
|
153
|
+
* @description : a标签下载文件
|
|
154
|
+
* @param {Blob | string} url a标签的下载url或文件流
|
|
155
|
+
* @param {string} fileName 下载文件的名称,如果缺省则尝试从url中获取,默认为: "新建文件"
|
|
156
|
+
* @return {*}
|
|
157
|
+
* @example :
|
|
162
158
|
*/
|
|
163
159
|
function downloadFile(url, fileName) {
|
|
164
160
|
var eLink = document.createElement('a');
|
|
@@ -171,11 +167,11 @@ function downloadFile(url, fileName) {
|
|
|
171
167
|
document.body.removeChild(eLink);
|
|
172
168
|
}
|
|
173
169
|
|
|
174
|
-
/**
|
|
175
|
-
* @description : a标签预览文件
|
|
176
|
-
* @param {Blob | string} url a标签的预览url或文件流
|
|
177
|
-
* @return {*}
|
|
178
|
-
* @example :
|
|
170
|
+
/**
|
|
171
|
+
* @description : a标签预览文件
|
|
172
|
+
* @param {Blob | string} url a标签的预览url或文件流
|
|
173
|
+
* @return {*}
|
|
174
|
+
* @example :
|
|
179
175
|
*/
|
|
180
176
|
function previewFile(url) {
|
|
181
177
|
var eLink = document.createElement('a');
|
|
@@ -188,13 +184,13 @@ function previewFile(url) {
|
|
|
188
184
|
document.body.removeChild(eLink);
|
|
189
185
|
}
|
|
190
186
|
|
|
191
|
-
/**
|
|
192
|
-
* @description : 以递归方式深度查找一个对象
|
|
193
|
-
* @param {Record} object 待查找的对象
|
|
194
|
-
* @param {function} fn 查找函数,每次递归时执行,如果执行结果为true,则递归过程并返回当前对象
|
|
195
|
-
* @param {number} maxDepth 递归的最大深度,默认10
|
|
196
|
-
* @return {*} 查找到的对象,未查找到则返回undefined
|
|
197
|
-
* @example :
|
|
187
|
+
/**
|
|
188
|
+
* @description : 以递归方式深度查找一个对象
|
|
189
|
+
* @param {Record} object 待查找的对象
|
|
190
|
+
* @param {function} fn 查找函数,每次递归时执行,如果执行结果为true,则递归过程并返回当前对象
|
|
191
|
+
* @param {number} maxDepth 递归的最大深度,默认10
|
|
192
|
+
* @return {*} 查找到的对象,未查找到则返回undefined
|
|
193
|
+
* @example :
|
|
198
194
|
*/
|
|
199
195
|
// eslint-disable-next-line no-unused-vars
|
|
200
196
|
function deepFindObject(object, fn) {
|
|
@@ -224,13 +220,13 @@ function deepFindObject(object, fn) {
|
|
|
224
220
|
return recursive(object, undefined, '', fn, {});
|
|
225
221
|
}
|
|
226
222
|
|
|
227
|
-
/**
|
|
228
|
-
* @description : 以递归方式深度查找一个Jsx对象
|
|
229
|
-
* @param {Record} object 待查找的Jsx对象
|
|
230
|
-
* @param {function} fn 查找函数,每次递归时执行,如果执行结果为true,则停止递归过程并返回当前对象
|
|
231
|
-
* @param {number} maxDepth 递归的最大深度,默认10
|
|
232
|
-
* @return {*} 查找到的对象,未查找到则返回undefined
|
|
233
|
-
* @example :
|
|
223
|
+
/**
|
|
224
|
+
* @description : 以递归方式深度查找一个Jsx对象
|
|
225
|
+
* @param {Record} object 待查找的Jsx对象
|
|
226
|
+
* @param {function} fn 查找函数,每次递归时执行,如果执行结果为true,则停止递归过程并返回当前对象
|
|
227
|
+
* @param {number} maxDepth 递归的最大深度,默认10
|
|
228
|
+
* @return {*} 查找到的对象,未查找到则返回undefined
|
|
229
|
+
* @example :
|
|
234
230
|
*/
|
|
235
231
|
// eslint-disable-next-line no-unused-vars
|
|
236
232
|
function deepFindJsx(object, fn) {
|