@pointcloud/pcloud-components 0.1.3 → 0.1.5
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 +301 -23
- 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.d.ts +4 -8
- package/dist/esm/DCascader/index.js +59 -56
- package/dist/esm/DCascader/index.less +5 -1
- package/dist/esm/DForm/DItem/index.d.ts +5 -0
- package/dist/esm/DForm/DItem/index.js +33 -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 +39 -0
- package/dist/esm/DForm/DItem/itemsRender.js +193 -0
- package/dist/esm/DForm/helper.js +7 -7
- package/dist/esm/DForm/index.d.ts +1 -1
- package/dist/esm/DForm/index.js +18 -18
- package/dist/esm/DForm/index.less +32 -31
- package/dist/esm/DInput/index.js +6 -11
- package/dist/esm/DSelect/index.js +7 -18
- package/dist/esm/DTable/index.js +58 -64
- package/dist/esm/DTable/index.less +8 -0
- package/dist/esm/DTreeSelect/index.js +74 -67
- package/dist/esm/DTreeSelect/index.less +2 -0
- package/dist/esm/DUpload/helper.d.ts +105 -0
- package/dist/esm/DUpload/helper.js +261 -0
- package/dist/esm/DUpload/index.d.ts +55 -0
- package/dist/esm/DUpload/index.js +372 -0
- package/dist/esm/DUpload/index.less +19 -0
- package/dist/esm/ErrorBoundary/index.d.ts +2 -2
- package/dist/esm/ErrorBoundary/index.js +16 -12
- package/dist/esm/ErrorBoundary/index.less +1 -0
- 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 +27 -25
- package/dist/esm/LabelValue/index.d.ts +1 -1
- package/dist/esm/LabelValue/index.js +14 -12
- package/dist/esm/LabelValue/styles/index.less +4 -0
- 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 +3 -1
- package/dist/esm/NoData/index.d.ts +2 -2
- package/dist/esm/NoData/index.js +14 -13
- package/dist/esm/NoData/styles/index.less +4 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +1 -0
- package/dist/umd/images/favicon.png +0 -0
- package/dist/umd/mock/dcascader/china_region_city.json +2962 -0
- package/dist/umd/mock/dcascader/china_region_county.json +9991 -0
- package/dist/umd/mock/dcascader/china_region_province.json +36 -0
- package/dist/umd/mock/dupload/other/ZJ-TZ-001_/346/212/244/345/233/275/345/272/231/346/210/217/345/217/260/345/216/206/345/217/262/345/273/272/347/255/221/346/241/243/346/241/210/350/241/250.pdf +0 -0
- package/dist/umd/mock/dupload/other//346/234/210/347/211/231/346/271/276 - /351/243/236/345/204/277/344/271/220/345/233/242.mp3 +0 -0
- package/dist/umd/mock/dupload/picture/110500-thumb.jpg +0 -0
- package/dist/umd/mock/dupload/picture/110500.jpg +0 -0
- package/dist/umd/mock/dupload/picture/110502-thumb.jpg +0 -0
- package/dist/umd/mock/dupload/picture/110502.jpg +0 -0
- package/dist/umd/mock/dupload/picture/110504.png +0 -0
- package/dist/umd/mock/dupload/picture/default.png +0 -0
- package/dist/umd/mock/dupload/picture//346/255/243/351/227/250/345/205/250/346/231/257.jpg +0 -0
- package/dist/umd/pcloud-components.min.css +1 -1
- package/dist/umd/pcloud-components.min.js +1 -1
- package/package.json +91 -73
- package/dist/esm/DForm/DItem.d.ts +0 -26
- package/dist/esm/DForm/DItem.js +0 -31
- package/dist/esm/DForm/DItemsMap.d.ts +0 -32
- package/dist/esm/DForm/DItemsMap.js +0 -144
package/dist/esm/DForm/index.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
1
3
|
var _excluded = ["className", "defaultItemProps", "items", "children", "layout"];
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* @
|
|
7
|
-
* @
|
|
8
|
-
* @LastEditors : wangfeihu
|
|
9
|
-
* @LastEditTime : 2023-06-15 08:28:12
|
|
10
|
-
* @Description : 基于antd的Form组件
|
|
4
|
+
/*
|
|
5
|
+
* @Author : wangfeihu
|
|
6
|
+
* @Date : 2023-06-02 09:29:11
|
|
7
|
+
* @LastEditors : wangfeihu
|
|
8
|
+
* @LastEditTime : 2023-07-14 13:53:10
|
|
9
|
+
* @Description : 基于antd的Form组件
|
|
11
10
|
*/
|
|
12
11
|
|
|
13
12
|
import React, { forwardRef, useMemo, useContext } from 'react';
|
|
@@ -16,14 +15,13 @@ import { ConfigContext } from "../ConfigProvider";
|
|
|
16
15
|
import helper from "./helper";
|
|
17
16
|
import DItem from "./DItem";
|
|
18
17
|
import "./index.less";
|
|
18
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
19
|
function getChildren(items, children, _defaultItemProps) {
|
|
20
20
|
var list = [];
|
|
21
21
|
if (items instanceof Array && items.length > 0) {
|
|
22
22
|
list = items.map(function (item, index) {
|
|
23
23
|
var _item = helper.merge(_defaultItemProps, item);
|
|
24
|
-
return /*#__PURE__*/
|
|
25
|
-
key: (item === null || item === void 0 ? void 0 : item.name) || index
|
|
26
|
-
}, _item));
|
|
24
|
+
return /*#__PURE__*/_jsx(DItem, _objectSpread({}, _item), (item === null || item === void 0 ? void 0 : item.name) || index);
|
|
27
25
|
});
|
|
28
26
|
}
|
|
29
27
|
if (children) {
|
|
@@ -42,18 +40,20 @@ function InternalForm(props, ref) {
|
|
|
42
40
|
otherProps = _objectWithoutProperties(props, _excluded);
|
|
43
41
|
var _useContext = useContext(ConfigContext),
|
|
44
42
|
getPrefixCls = _useContext.getPrefixCls;
|
|
45
|
-
var _className = "".concat(getPrefixCls('
|
|
43
|
+
var _className = "".concat(getPrefixCls('form'), " ").concat(className, " ").concat(layout === 'inlineVertical' ? 'inlineVertical' : '');
|
|
46
44
|
var _layout = layout === 'inlineVertical' ? 'inline' : layout;
|
|
47
45
|
var itemChildren = useMemo(function () {
|
|
48
46
|
return getChildren(items, children, defaultItemProps);
|
|
49
47
|
}, [items, children, defaultItemProps]);
|
|
50
|
-
return /*#__PURE__*/
|
|
48
|
+
return /*#__PURE__*/_jsx(Form, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
51
49
|
className: _className,
|
|
52
50
|
layout: _layout,
|
|
53
|
-
ref: ref
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
ref: ref,
|
|
52
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
53
|
+
className: "form-wrapper",
|
|
54
|
+
children: itemChildren
|
|
55
|
+
})
|
|
56
|
+
}));
|
|
57
57
|
}
|
|
58
58
|
var DForm = /*#__PURE__*/forwardRef(InternalForm);
|
|
59
59
|
DForm.Item = DItem;
|
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
@import '../commonStyle/index.less';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
margin-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.@{prefix}-form.ant-form-inline
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
1
|
+
@import '../commonStyle/index.less';
|
|
2
|
+
|
|
3
|
+
.@{prefix}-form {
|
|
4
|
+
.form-wrapper > * {
|
|
5
|
+
min-height: 32px;
|
|
6
|
+
margin-right: 0;
|
|
7
|
+
margin-bottom: 24px;
|
|
8
|
+
padding-right: 16px;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.@{prefix}-form.ant-form-horizontal .ant-form-item-label {
|
|
13
|
+
min-width: 80px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.@{prefix}-form.ant-form-inline .form-wrapper,
|
|
17
|
+
.@{prefix}-form.ant-form-inline.inlineVertical .form-wrapper {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-wrap: wrap;
|
|
20
|
+
align-items: flex-end;
|
|
21
|
+
height: min-content;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.@{prefix}-form.ant-form-inline.inlineVertical {
|
|
25
|
+
.ant-form-item-row {
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
|
|
28
|
+
.ant-form-item-label {
|
|
29
|
+
text-align: left;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
package/dist/esm/DInput/index.js
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
1
4
|
var _excluded = ["className", "onChange", "onCompositionStart", "onCompositionEnd", "value", "debounce", "enableCompose"];
|
|
2
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
-
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."); }
|
|
5
|
-
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); }
|
|
6
|
-
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; }
|
|
7
|
-
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; } }
|
|
8
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
-
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; }
|
|
10
|
-
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; }
|
|
11
5
|
/*
|
|
12
6
|
* @Author : wangfeihu
|
|
13
7
|
* @Date : 2023-05-16 10:08:26
|
|
14
8
|
* @LastEditors : wangfeihu
|
|
15
|
-
* @LastEditTime : 2023-
|
|
9
|
+
* @LastEditTime : 2023-07-11 17:14:59
|
|
16
10
|
* @Description : 基于antd的Input组件
|
|
17
11
|
*/
|
|
18
12
|
import React, { useRef, forwardRef, useState, useContext } from 'react';
|
|
19
13
|
import { Input } from 'antd';
|
|
20
14
|
import { ConfigContext } from "../ConfigProvider";
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
16
|
function InternalInput(props, ref) {
|
|
22
17
|
var _props$className = props.className,
|
|
23
18
|
className = _props$className === void 0 ? '' : _props$className,
|
|
@@ -77,7 +72,7 @@ function InternalInput(props, ref) {
|
|
|
77
72
|
emitChange(e.target.value, e);
|
|
78
73
|
}
|
|
79
74
|
};
|
|
80
|
-
return /*#__PURE__*/
|
|
75
|
+
return /*#__PURE__*/_jsx(Input, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
81
76
|
className: _className,
|
|
82
77
|
ref: ref,
|
|
83
78
|
value: value,
|
|
@@ -1,29 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
4
|
var _excluded = ["className", "popupClassName", "fieldNames", "searchValue", "filterOption", "options", "onSearch", "loading", "debounce"];
|
|
3
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
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; }
|
|
17
5
|
/*
|
|
18
6
|
* @Author : wangfeihu
|
|
19
7
|
* @Date : 2023-05-17 08:41:25
|
|
20
8
|
* @LastEditors : wangfeihu
|
|
21
|
-
* @LastEditTime : 2023-
|
|
9
|
+
* @LastEditTime : 2023-07-11 15:44:04
|
|
22
10
|
* @Description : 基于antd的Select组件
|
|
23
11
|
*/
|
|
24
12
|
import React, { forwardRef, useEffect, useRef, useState, useMemo, useContext } from 'react';
|
|
25
13
|
import { Select } from 'antd';
|
|
26
14
|
import { ConfigContext } from "../ConfigProvider";
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
16
|
function InternalSelect(props, ref) {
|
|
28
17
|
var _props$className = props.className,
|
|
29
18
|
className = _props$className === void 0 ? '' : _props$className,
|
|
@@ -117,12 +106,12 @@ function InternalSelect(props, ref) {
|
|
|
117
106
|
useEffect(function () {
|
|
118
107
|
return updateOptions(getOptions, searchValue);
|
|
119
108
|
}, [getOptions, searchValue]);
|
|
120
|
-
return /*#__PURE__*/
|
|
109
|
+
return /*#__PURE__*/_jsx(Select, _objectSpread(_objectSpread({
|
|
121
110
|
allowClear: true,
|
|
122
111
|
filterOption: _filterOption,
|
|
123
112
|
showSearch: _showSearch,
|
|
124
113
|
searchValue: searchValue
|
|
125
|
-
}, otherProps, {
|
|
114
|
+
}, otherProps), {}, {
|
|
126
115
|
ref: ref,
|
|
127
116
|
className: _className,
|
|
128
117
|
popupClassName: _popupClassName,
|
package/dist/esm/DTable/index.js
CHANGED
|
@@ -1,30 +1,20 @@
|
|
|
1
|
-
|
|
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";
|
|
2
4
|
var _excluded = ["loadMore", "columnsProp", "actionColumn", "showErrorMsg", "extraParams", "dataSource", "rowKey", "scroll", "className", "pagination", "columns", "loading"];
|
|
3
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
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; }
|
|
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-07-11 17:22:24
|
|
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,11 +22,43 @@ 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 getActionColumnProps(props, columnsProp) {
|
|
36
|
+
var defaultProps = {
|
|
37
|
+
width: 140,
|
|
38
|
+
title: '操作',
|
|
39
|
+
dataIndex: 'action'
|
|
40
|
+
};
|
|
41
|
+
if (typeof props === 'function') {
|
|
42
|
+
return _objectSpread(_objectSpread(_objectSpread({}, columnsProp), defaultProps), {}, {
|
|
43
|
+
render: props
|
|
44
|
+
});
|
|
45
|
+
} else {
|
|
46
|
+
return _objectSpread(_objectSpread(_objectSpread({}, columnsProp), defaultProps), props);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// 分页配置
|
|
51
|
+
function getTablePage(_pagination) {
|
|
52
|
+
var _ref = _pagination || {},
|
|
53
|
+
current = _ref.current,
|
|
54
|
+
defaultCurrent = _ref.defaultCurrent,
|
|
55
|
+
pageSize = _ref.pageSize,
|
|
56
|
+
defaultPageSize = _ref.defaultPageSize;
|
|
57
|
+
return {
|
|
58
|
+
current: current || defaultCurrent || 1,
|
|
59
|
+
size: pageSize || defaultPageSize || 10
|
|
60
|
+
};
|
|
61
|
+
}
|
|
40
62
|
function InternalTable(props, ref) {
|
|
41
63
|
var loadMore = props.loadMore,
|
|
42
64
|
columnsProp = props.columnsProp,
|
|
@@ -102,21 +124,6 @@ function InternalTable(props, ref) {
|
|
|
102
124
|
spinning: false
|
|
103
125
|
}, loading);
|
|
104
126
|
|
|
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
127
|
// 加载数据
|
|
121
128
|
var loadData = function loadData(params) {
|
|
122
129
|
if (typeof loadMore === 'function') {
|
|
@@ -162,11 +169,27 @@ function InternalTable(props, ref) {
|
|
|
162
169
|
}
|
|
163
170
|
};
|
|
164
171
|
|
|
172
|
+
// 监听分页大小变化,如果外部也监听了onChange,则不会触发loadMore,但如果外部onChange返回值为undefined则正常触loadMore
|
|
173
|
+
var onChange = function onChange(page, pageSize) {
|
|
174
|
+
if (_pagination && typeof (_pagination === null || _pagination === void 0 ? void 0 : _pagination.onChange) === 'function') {
|
|
175
|
+
var data = _pagination.onChange(page, pageSize);
|
|
176
|
+
if (data === undefined) loadData(_objectSpread(_objectSpread({}, tableParams), {}, {
|
|
177
|
+
current: page,
|
|
178
|
+
size: pageSize
|
|
179
|
+
}));
|
|
180
|
+
} else {
|
|
181
|
+
loadData(_objectSpread(_objectSpread({}, tableParams), {}, {
|
|
182
|
+
current: page,
|
|
183
|
+
size: pageSize
|
|
184
|
+
}));
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
|
|
165
188
|
// 数据初始加载
|
|
166
189
|
useEffect(function () {
|
|
167
190
|
return loadData(extraParams);
|
|
168
191
|
}, [dataSource, extraParams]);
|
|
169
|
-
return /*#__PURE__*/
|
|
192
|
+
return /*#__PURE__*/_jsx(Table, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
170
193
|
ref: ref,
|
|
171
194
|
rowKey: rowKey,
|
|
172
195
|
className: _className,
|
|
@@ -184,34 +207,5 @@ function InternalTable(props, ref) {
|
|
|
184
207
|
})
|
|
185
208
|
}));
|
|
186
209
|
}
|
|
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
210
|
var DTable = /*#__PURE__*/forwardRef(InternalTable);
|
|
217
211
|
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,
|
|
@@ -23,32 +24,39 @@
|
|
|
23
24
|
max-width: 100%;
|
|
24
25
|
min-height: calc(100% - 56px);
|
|
25
26
|
max-height: calc(100% - 56px);
|
|
27
|
+
|
|
26
28
|
// 表头显示省略号,但表内单元格不省略
|
|
27
29
|
.ant-table-tbody > tr > td.ant-table-cell.ant-table-cell-ellipsis {
|
|
28
30
|
white-space: initial;
|
|
29
31
|
}
|
|
32
|
+
|
|
30
33
|
// x轨道的宽度和y轨道的高度
|
|
31
34
|
&::-webkit-scrollbar {
|
|
32
35
|
width: 4px;
|
|
33
36
|
height: 8px;
|
|
34
37
|
}
|
|
38
|
+
|
|
35
39
|
// 轨道拖动部分的背景颜色
|
|
36
40
|
&::-webkit-scrollbar-thumb {
|
|
37
41
|
background-color: #0084ff;
|
|
38
42
|
}
|
|
43
|
+
|
|
39
44
|
// 轨道背景颜色
|
|
40
45
|
&::-webkit-scrollbar-track {
|
|
41
46
|
background-color: #f1f1f1;
|
|
42
47
|
border-radius: 2px;
|
|
43
48
|
}
|
|
49
|
+
|
|
44
50
|
// x、y两条轨道的交叉处
|
|
45
51
|
&::-webkit-scrollbar-corner {
|
|
46
52
|
background-color: #f1f1f1;
|
|
47
53
|
}
|
|
48
54
|
}
|
|
55
|
+
|
|
49
56
|
.ant-spin-nested-loading > div > .ant-spin {
|
|
50
57
|
max-height: initial;
|
|
51
58
|
}
|
|
59
|
+
|
|
52
60
|
.ant-pagination-total-text span {
|
|
53
61
|
color: #40a9ff;
|
|
54
62
|
font-weight: bold;
|