@ccs-ui/rc-pro 2.3.5 → 2.3.6-alpha-2
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/es/aj-captcha/index.d.ts +5 -2
- package/es/aj-captcha/index.js +6 -2
- package/es/auth/index.d.ts +3 -0
- package/es/auth/index.js +3 -0
- package/es/button/dropdown.js +5 -17
- package/es/button/group.js +47 -65
- package/es/button/index.d.ts +4 -11
- package/es/button/index.js +10 -13
- package/es/cascader/index.d.ts +6 -3
- package/es/cascader/index.js +11 -7
- package/es/ccs.d.ts +9 -10
- package/es/color-picker/index.d.ts +5 -1
- package/es/color-picker/index.js +6 -2
- package/es/context/index.d.ts +24 -2
- package/es/date-picker/index.d.ts +1 -0
- package/es/date-picker/index.js +3 -0
- package/es/dialog/HookDrawer.js +3 -1
- package/es/dialog/HookModal.js +3 -1
- package/es/dialog/button.d.ts +1 -1
- package/es/dialog/context.d.ts +2 -1
- package/es/dialog/hook.d.ts +10 -0
- package/es/dialog/index.d.ts +3 -1
- package/es/dialog/index.js +3 -0
- package/es/editor/index.d.ts +1 -0
- package/es/editor/index.js +3 -0
- package/es/ellipsis/index.d.ts +21 -5
- package/es/ellipsis/index.js +117 -28
- package/es/ellipsis/index.less +5 -0
- package/es/ellipsis/useMeasure.d.ts +9 -0
- package/es/ellipsis/useMeasure.js +142 -0
- package/es/ellipsis/useResizeEffect.d.ts +2 -0
- package/es/ellipsis/useResizeEffect.js +28 -0
- package/es/ellipsis/withStopPropagation.d.ts +4 -0
- package/es/ellipsis/withStopPropagation.js +38 -0
- package/es/hooks/use-app.d.ts +7 -2
- package/es/hooks/use-app.js +8 -3
- package/es/hooks/use-selection.d.ts +28 -0
- package/es/hooks/use-selection.js +148 -0
- package/es/index.d.ts +3 -2
- package/es/index.js +3 -2
- package/es/interval-button/index.js +3 -0
- package/es/layout-keep-alive/index.d.ts +8 -4
- package/es/layout-keep-alive/index.js +94 -49
- package/es/layout-keep-alive/page.d.ts +2 -2
- package/es/layout-keep-alive/page.js +4 -4
- package/es/layout-single-page/index.d.ts +5 -2
- package/es/layout-single-page/index.js +8 -7
- package/es/layout-single-page/page.d.ts +2 -2
- package/es/loading/index.d.ts +4 -1
- package/es/loading/index.js +4 -1
- package/es/pro-table/head.d.ts +8 -7
- package/es/pro-table/head.js +54 -100
- package/es/pro-table/index.d.ts +8 -8
- package/es/pro-table/index.js +8 -3
- package/es/pro-table/index.less +8 -3
- package/es/pro-table/selection-alert.d.ts +18 -0
- package/es/pro-table/selection-alert.js +52 -0
- package/es/pro-table/summary.d.ts +8 -0
- package/es/pro-table/summary.js +32 -0
- package/es/pro-table/table.d.ts +37 -30
- package/es/pro-table/table.js +485 -265
- package/es/pro-table/tree.d.ts +1 -1
- package/es/pro-table/tree.js +9 -15
- package/es/pro-tabs/index.d.ts +5 -2
- package/es/pro-tabs/index.js +16 -6
- package/es/resize-observer.d.ts +2 -2
- package/es/resize-observer.js +2 -2
- package/es/result/index.d.ts +11 -15
- package/es/result/index.js +57 -54
- package/es/select/ modal.d.ts +16 -0
- package/es/select/ modal.js +100 -0
- package/es/select/api.d.ts +25 -0
- package/es/select/api.js +67 -0
- package/es/select/customize.d.ts +37 -0
- package/es/select/customize.js +146 -0
- package/es/select/index.d.ts +20 -20
- package/es/select/index.js +70 -80
- package/es/status-tag/index.d.ts +5 -1
- package/es/status-tag/index.js +6 -2
- package/es/table/index.d.ts +5 -2
- package/es/table/index.js +82 -42
- package/es/table/index.less +27 -42
- package/es/trigger/index.d.ts +1 -0
- package/es/trigger/index.js +1 -0
- package/es/upload/index.d.ts +4 -3
- package/es/upload/index.js +6 -3
- package/es/water-mark/index.d.ts +4 -1
- package/es/water-mark/index.js +3 -0
- package/package.json +5 -4
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["width", "title", "value", "style", "mode", "children", "autoClose", "contentWidth", "onChange"];
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
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; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
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."); }
|
|
10
|
+
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); }
|
|
11
|
+
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; }
|
|
12
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
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; }
|
|
15
|
+
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; }
|
|
16
|
+
import { CloseOutlined, SelectOutlined } from '@ant-design/icons';
|
|
17
|
+
import { Button, Select } from 'antd';
|
|
18
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
19
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
22
|
+
/**
|
|
23
|
+
* 自定义弹框
|
|
24
|
+
* @param SelectCustomizeProps
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
function SelectIndex(_ref) {
|
|
28
|
+
var width = _ref.width,
|
|
29
|
+
title = _ref.title,
|
|
30
|
+
value = _ref.value,
|
|
31
|
+
style = _ref.style,
|
|
32
|
+
mode = _ref.mode,
|
|
33
|
+
children = _ref.children,
|
|
34
|
+
autoClose = _ref.autoClose,
|
|
35
|
+
contentWidth = _ref.contentWidth,
|
|
36
|
+
_onChange = _ref.onChange,
|
|
37
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
38
|
+
// 初始加载
|
|
39
|
+
var _useState = useState(true),
|
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
41
|
+
open = _useState2[0],
|
|
42
|
+
setOpen = _useState2[1];
|
|
43
|
+
var ref = useRef(null);
|
|
44
|
+
var _useState3 = useState(undefined),
|
|
45
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
46
|
+
labelText = _useState4[0],
|
|
47
|
+
setLabelText = _useState4[1];
|
|
48
|
+
|
|
49
|
+
// 选择说明
|
|
50
|
+
var _useState5 = useState(undefined),
|
|
51
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
52
|
+
options = _useState6[0],
|
|
53
|
+
setOptions = _useState6[1];
|
|
54
|
+
|
|
55
|
+
// 确定按钮
|
|
56
|
+
var onClose = function onClose(e) {
|
|
57
|
+
e === null || e === void 0 || e.stopPropagation();
|
|
58
|
+
setOpen(false);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// 多选
|
|
62
|
+
var isMulti = mode === 'multiple';
|
|
63
|
+
|
|
64
|
+
// children 参数
|
|
65
|
+
var childrenProps = {
|
|
66
|
+
value: value,
|
|
67
|
+
onClose: onClose,
|
|
68
|
+
onChange: function onChange(e) {
|
|
69
|
+
_onChange === null || _onChange === void 0 || _onChange(e);
|
|
70
|
+
// 单选关闭弹框
|
|
71
|
+
if (!isMulti && autoClose !== false) setOpen(false);
|
|
72
|
+
},
|
|
73
|
+
onChangeLabel: setLabelText,
|
|
74
|
+
multiple: isMulti,
|
|
75
|
+
onChangeOptions: setOptions
|
|
76
|
+
};
|
|
77
|
+
var _dropdownRender = useMemo(function () {
|
|
78
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
79
|
+
style: {
|
|
80
|
+
display: 'none'
|
|
81
|
+
},
|
|
82
|
+
ref: ref,
|
|
83
|
+
children: [title && /*#__PURE__*/_jsxs("div", {
|
|
84
|
+
style: {
|
|
85
|
+
padding: 10,
|
|
86
|
+
borderBottom: '1px solid #f5f5f5',
|
|
87
|
+
display: 'flex',
|
|
88
|
+
justifyContent: 'space-between'
|
|
89
|
+
},
|
|
90
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
91
|
+
children: title
|
|
92
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
93
|
+
type: "text",
|
|
94
|
+
size: "small",
|
|
95
|
+
onClick: onClose,
|
|
96
|
+
children: /*#__PURE__*/_jsx(CloseOutlined, {
|
|
97
|
+
style: {
|
|
98
|
+
color: 'rgba(0,0,0,0.55)'
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
})]
|
|
102
|
+
}), typeof children === 'function' ? children(childrenProps) : /*#__PURE__*/React.cloneElement(children, childrenProps)]
|
|
103
|
+
});
|
|
104
|
+
}, [value]);
|
|
105
|
+
useEffect(function () {
|
|
106
|
+
setOpen(false);
|
|
107
|
+
}, []);
|
|
108
|
+
useEffect(function () {
|
|
109
|
+
if (open && ref.current) {
|
|
110
|
+
if (ref.current.style.display === 'none') {
|
|
111
|
+
ref.current.style.display = 'block';
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}, [open]);
|
|
115
|
+
var renderValueText = function renderValueText() {
|
|
116
|
+
if (value === undefined || Array.isArray(value) && value.length === 0) {
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// 优先显示 labelText
|
|
121
|
+
if (!!labelText) return labelText;
|
|
122
|
+
return value;
|
|
123
|
+
};
|
|
124
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
125
|
+
children: /*#__PURE__*/_jsx(Select, _objectSpread(_objectSpread({
|
|
126
|
+
open: open,
|
|
127
|
+
onDropdownVisibleChange: setOpen,
|
|
128
|
+
allowClear: true,
|
|
129
|
+
defaultActiveFirstOption: true,
|
|
130
|
+
suffixIcon: /*#__PURE__*/_jsx(SelectOutlined, {})
|
|
131
|
+
}, otherProps), {}, {
|
|
132
|
+
popupMatchSelectWidth: contentWidth,
|
|
133
|
+
dropdownRender: function dropdownRender() {
|
|
134
|
+
return _dropdownRender;
|
|
135
|
+
},
|
|
136
|
+
mode: !!labelText ? undefined : mode,
|
|
137
|
+
value: renderValueText(),
|
|
138
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
139
|
+
width: width
|
|
140
|
+
}),
|
|
141
|
+
onChange: _onChange,
|
|
142
|
+
options: options
|
|
143
|
+
}))
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
export default SelectIndex;
|
package/es/select/index.d.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { SelectProps } from 'antd';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
cache?: CacheType;
|
|
13
|
-
/** 依赖参数 */
|
|
14
|
-
defaultParams?: CCS.RecordType;
|
|
2
|
+
import ModalSelect from './ modal';
|
|
3
|
+
import ApiSelect from './api';
|
|
4
|
+
import CustomizeSelect from './customize';
|
|
5
|
+
export declare function getDataFromFields(data: Record<string, any>, fields: string[]): any;
|
|
6
|
+
export interface CcsSelectProps extends Omit<SelectProps, 'fieldNames'> {
|
|
7
|
+
/** 配置全部选项 */
|
|
8
|
+
showAll?: boolean | {
|
|
9
|
+
label: string;
|
|
10
|
+
value: any;
|
|
11
|
+
};
|
|
15
12
|
/** 接口数据字段 */
|
|
16
13
|
fieldNames?: {
|
|
17
14
|
label?: string[] | string;
|
|
18
15
|
value?: string[] | string;
|
|
19
16
|
};
|
|
20
|
-
|
|
21
|
-
onQuery?: (params?: any) => Promise<any>;
|
|
22
|
-
};
|
|
23
|
-
export declare function getDataFromFields(data: Record<string, any>, fields: string[]): any;
|
|
17
|
+
}
|
|
24
18
|
/**
|
|
25
|
-
*
|
|
19
|
+
* select 组件扩展
|
|
26
20
|
* @param CcsSelectProps
|
|
27
21
|
* @returns
|
|
28
22
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
declare function InternalSelect({ showAll, fieldNames, options, ...props }: CcsSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare namespace InternalSelect {
|
|
25
|
+
var displayName: string;
|
|
26
|
+
var Api: typeof ApiSelect;
|
|
27
|
+
var Customize: typeof CustomizeSelect;
|
|
28
|
+
var Modal: typeof ModalSelect;
|
|
29
|
+
}
|
|
30
|
+
export default InternalSelect;
|
package/es/select/index.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
var _excluded = ["
|
|
1
|
+
var _excluded = ["showAll", "fieldNames", "options"];
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
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; }
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
8
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
10
7
|
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; }
|
|
11
8
|
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; }
|
|
12
9
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
@@ -16,9 +13,12 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
16
13
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
17
14
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
18
15
|
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; }
|
|
19
|
-
import { useRequest } from 'ahooks';
|
|
20
16
|
import { Select } from 'antd';
|
|
21
|
-
import {
|
|
17
|
+
import { useMemo } from 'react';
|
|
18
|
+
import pinyin from 'tiny-pinyin';
|
|
19
|
+
import ModalSelect from "./ modal";
|
|
20
|
+
import ApiSelect from "./api";
|
|
21
|
+
import CustomizeSelect from "./customize";
|
|
22
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
23
|
export function getDataFromFields(data, fields) {
|
|
24
24
|
if (!data || fields.length === 0) return;
|
|
@@ -34,85 +34,75 @@ function onIsArray(data) {
|
|
|
34
34
|
if (Array.isArray(data)) return data;
|
|
35
35
|
return [data];
|
|
36
36
|
}
|
|
37
|
-
|
|
38
37
|
/**
|
|
39
|
-
*
|
|
38
|
+
* select 组件扩展
|
|
40
39
|
* @param CcsSelectProps
|
|
41
40
|
* @returns
|
|
42
41
|
*/
|
|
43
|
-
|
|
44
|
-
var
|
|
45
|
-
cache = _ref.cache,
|
|
42
|
+
function InternalSelect(_ref) {
|
|
43
|
+
var showAll = _ref.showAll,
|
|
46
44
|
fieldNames = _ref.fieldNames,
|
|
47
|
-
_ref$
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
var labelField = _toConsumableArray(onIsArray((fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label) || ['
|
|
51
|
-
var valueField = _toConsumableArray(onIsArray((fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value) || ['
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
case 14:
|
|
91
|
-
return _context.abrupt("return", result);
|
|
92
|
-
case 15:
|
|
93
|
-
case "end":
|
|
94
|
-
return _context.stop();
|
|
95
|
-
}
|
|
96
|
-
}, _callee);
|
|
97
|
-
}));
|
|
98
|
-
return function (_x) {
|
|
99
|
-
return _ref2.apply(this, arguments);
|
|
100
|
-
};
|
|
101
|
-
}(), _objectSpread({
|
|
102
|
-
manual: true
|
|
103
|
-
}, cache || {})),
|
|
104
|
-
loading = _useRequest.loading,
|
|
105
|
-
_useRequest$data = _useRequest.data,
|
|
106
|
-
data = _useRequest$data === void 0 ? [] : _useRequest$data,
|
|
107
|
-
run = _useRequest.run;
|
|
108
|
-
useEffect(function () {
|
|
109
|
-
if (onQuery) run(defaultParams);
|
|
110
|
-
}, [JSON.stringify(defaultParams)]);
|
|
45
|
+
_ref$options = _ref.options,
|
|
46
|
+
options = _ref$options === void 0 ? [] : _ref$options,
|
|
47
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
48
|
+
var labelField = _toConsumableArray(onIsArray((fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label) || ['label']));
|
|
49
|
+
var valueField = _toConsumableArray(onIsArray((fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value) || ['value']));
|
|
50
|
+
|
|
51
|
+
// 搜索,中文转英文搜索
|
|
52
|
+
var onFilterOption = function onFilterOption(input, option) {
|
|
53
|
+
var str = "".concat(option === null || option === void 0 ? void 0 : option.label).concat(option === null || option === void 0 ? void 0 : option.value);
|
|
54
|
+
var strPin = pinyin.convertToPinyin(str, '', true).toLocaleUpperCase();
|
|
55
|
+
if (str.includes(input) || strPin.includes(input.toLocaleUpperCase())) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
return false;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// 选项
|
|
62
|
+
var selectOptions = useMemo(function () {
|
|
63
|
+
var ops = options || [];
|
|
64
|
+
while (labelField.length > 0 || valueField.length > 0) {
|
|
65
|
+
if (Array.isArray(ops)) {
|
|
66
|
+
ops.forEach(function (r) {
|
|
67
|
+
r.label = getDataFromFields(r, labelField);
|
|
68
|
+
r.value = getDataFromFields(r, valueField);
|
|
69
|
+
});
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
labelField.shift();
|
|
73
|
+
var value = valueField.shift();
|
|
74
|
+
if (value) {
|
|
75
|
+
ops = ops[value];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// 添加全部选中
|
|
80
|
+
if (showAll && Array.isArray(ops) && ops.length > 0) {
|
|
81
|
+
ops.unshift(typeof showAll === 'boolean' ? {
|
|
82
|
+
label: '全部',
|
|
83
|
+
value: ''
|
|
84
|
+
} : showAll);
|
|
85
|
+
}
|
|
86
|
+
return ops;
|
|
87
|
+
}, [options]);
|
|
111
88
|
return /*#__PURE__*/_jsx(Select, _objectSpread({
|
|
112
|
-
options:
|
|
113
|
-
loading: loading,
|
|
89
|
+
options: selectOptions,
|
|
114
90
|
style: {
|
|
115
91
|
width: '100%'
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
92
|
+
},
|
|
93
|
+
filterOption: onFilterOption,
|
|
94
|
+
placeholder: "\u8BF7\u9009\u62E9",
|
|
95
|
+
allowClear: true,
|
|
96
|
+
showSearch: true
|
|
97
|
+
}, props));
|
|
98
|
+
}
|
|
99
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
100
|
+
InternalSelect.displayName = 'CcsSelect';
|
|
101
|
+
}
|
|
102
|
+
InternalSelect.Api = ApiSelect;
|
|
103
|
+
InternalSelect.Customize = CustomizeSelect;
|
|
104
|
+
InternalSelect.Modal = ModalSelect;
|
|
105
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
106
|
+
InternalSelect.displayName = 'CcsSelect';
|
|
107
|
+
}
|
|
108
|
+
export default InternalSelect;
|
package/es/status-tag/index.d.ts
CHANGED
|
@@ -6,4 +6,8 @@ export type CcsStatusTagProps = {
|
|
|
6
6
|
tag?: string[];
|
|
7
7
|
}[];
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
declare function StatusTag({ value, options }: CcsStatusTagProps): any;
|
|
10
|
+
declare namespace StatusTag {
|
|
11
|
+
var displayName: string;
|
|
12
|
+
}
|
|
13
|
+
export default StatusTag;
|
package/es/status-tag/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Badge, Tag } from 'antd';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
|
|
3
|
+
function StatusTag(_ref) {
|
|
4
4
|
var value = _ref.value,
|
|
5
5
|
_ref$options = _ref.options,
|
|
6
6
|
options = _ref$options === void 0 ? [] : _ref$options;
|
|
@@ -24,4 +24,8 @@ export default function CcsStatusTag(_ref) {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
return label;
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
29
|
+
StatusTag.displayName = 'CcsStatusTag';
|
|
30
|
+
}
|
|
31
|
+
export default StatusTag;
|
package/es/table/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CcsProTableProps, CcsTableProps } from '../pro-table/table';
|
|
3
3
|
import './index.less';
|
|
4
|
-
type
|
|
4
|
+
export type CustomTableProps<T> = Omit<CcsTableProps<T>, 'request' | 'title'> & Pick<CcsProTableProps<T>, 'showNumber' | 'onEvent'> & {
|
|
5
5
|
title?: any;
|
|
6
6
|
tableRef?: React.MutableRefObject<TableRefType | undefined>;
|
|
7
7
|
tableContentRef: React.RefObject<HTMLDivElement>;
|
|
@@ -12,5 +12,8 @@ export type TableRefType = {
|
|
|
12
12
|
/** 计算固定表头宽度 */
|
|
13
13
|
onFixedThead: () => void;
|
|
14
14
|
};
|
|
15
|
-
declare const CustomTable:
|
|
15
|
+
declare const CustomTable: {
|
|
16
|
+
<T extends object = any>(props: CustomTableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
16
19
|
export default CustomTable;
|
package/es/table/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
1
|
var _excluded = ["onResize", "width"],
|
|
3
2
|
_excluded2 = ["data", "style", "scroll", "rowKey", "columns", "tableRef", "pagination", "rowSelection", "className", "tableContentRef"];
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
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; }
|
|
@@ -9,10 +9,13 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
9
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
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
11
|
import { useDebounceFn, useUpdate } from 'ahooks';
|
|
12
|
-
import { Table,
|
|
12
|
+
import { Table, theme } from 'antd';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
14
|
import { useEffect, useImperativeHandle } from 'react';
|
|
15
15
|
import { Resizable } from 'react-resizable';
|
|
16
|
+
import CcsEllipsis2 from "../ellipsis";
|
|
17
|
+
import useTabs from "../hooks/use-tabs";
|
|
18
|
+
import { TableEvent } from "../pro-table/table";
|
|
16
19
|
import "./index.less";
|
|
17
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
21
|
var ResizableTitle = function ResizableTitle(props) {
|
|
@@ -61,36 +64,56 @@ var CustomTable = function CustomTable(props) {
|
|
|
61
64
|
current = _ref$current === void 0 ? 1 : _ref$current,
|
|
62
65
|
_ref$total = _ref.total,
|
|
63
66
|
total = _ref$total === void 0 ? 0 : _ref$total;
|
|
67
|
+
var inTabs = useTabs();
|
|
64
68
|
|
|
65
69
|
// table 固定表头,内容滚动
|
|
66
70
|
var _useDebounceFn = useDebounceFn(function () {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
var _pagination = tableTarget.getElementsByClassName('ant-pagination');
|
|
77
|
-
if (_pagination && _pagination.length > 0) {
|
|
78
|
-
pageHeight = _pagination[0].clientHeight;
|
|
79
|
-
}
|
|
80
|
-
var header = tableTarget.getElementsByClassName('ant-table-header');
|
|
81
|
-
var footer = tableTarget.getElementsByClassName('ant-table-footer');
|
|
82
|
-
if (footer && footer.length > 0) {
|
|
83
|
-
footerHeight = footer[0].clientHeight;
|
|
71
|
+
var _tableContentRef$curr;
|
|
72
|
+
if ((scroll === null || scroll === void 0 ? void 0 : scroll.y) !== 'auto') return;
|
|
73
|
+
var tableTarget = tableContentRef === null || tableContentRef === void 0 ? void 0 : tableContentRef.current;
|
|
74
|
+
|
|
75
|
+
// 在ccs tabs组件内
|
|
76
|
+
if (inTabs !== null && inTabs !== void 0 && inTabs.tabsId) {
|
|
77
|
+
var tabsDom = document.getElementById(inTabs === null || inTabs === void 0 ? void 0 : inTabs.tabsId);
|
|
78
|
+
if (tabsDom) {
|
|
79
|
+
tabsDom.classList.add('ccs-tabs-auto-height');
|
|
84
80
|
}
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
}
|
|
82
|
+
if (!tableTarget) return;
|
|
83
|
+
|
|
84
|
+
// 容器最大高度
|
|
85
|
+
var maxHeight = (_tableContentRef$curr = tableContentRef.current) === null || _tableContentRef$curr === void 0 ? void 0 : _tableContentRef$curr.clientHeight;
|
|
86
|
+
|
|
87
|
+
// 计算所有dom高度
|
|
88
|
+
var tableEle = tableTarget.getElementsByClassName('ant-table')[0];
|
|
89
|
+
var childHeights = [];
|
|
90
|
+
var antTablebody = undefined;
|
|
91
|
+
tableEle.childNodes.forEach(function (e) {
|
|
92
|
+
if (e.classList.contains('ant-table-container')) {
|
|
93
|
+
e.childNodes.forEach(function (node) {
|
|
94
|
+
if (node.classList.contains('ant-table-body')) {
|
|
95
|
+
antTablebody = node;
|
|
96
|
+
} else {
|
|
97
|
+
childHeights.push(node.clientHeight || 0);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
} else {
|
|
101
|
+
childHeights.push(e.clientHeight || 0);
|
|
87
102
|
}
|
|
103
|
+
});
|
|
88
104
|
|
|
89
|
-
|
|
90
|
-
|
|
105
|
+
// 分页高度
|
|
106
|
+
var pagination = tableTarget.getElementsByClassName('ant-pagination');
|
|
107
|
+
if (pagination && pagination.length > 0) {
|
|
108
|
+
childHeights.push(pagination[0].clientHeight);
|
|
109
|
+
}
|
|
91
110
|
|
|
92
|
-
|
|
93
|
-
|
|
111
|
+
// 计算body滚动高度
|
|
112
|
+
if (antTablebody) {
|
|
113
|
+
var scrollHeight = maxHeight - childHeights.reduce(function (c, s) {
|
|
114
|
+
return c + s;
|
|
115
|
+
}, 0);
|
|
116
|
+
antTablebody.style.height = "".concat(scrollHeight, "px");
|
|
94
117
|
}
|
|
95
118
|
}, {
|
|
96
119
|
wait: 500,
|
|
@@ -108,9 +131,11 @@ var CustomTable = function CustomTable(props) {
|
|
|
108
131
|
useImperativeHandle(tableRef, function () {
|
|
109
132
|
return {
|
|
110
133
|
onColumnFilter: function onColumnFilter(e) {
|
|
134
|
+
var _props$onEvent;
|
|
111
135
|
columns === null || columns === void 0 || columns.forEach(function (c) {
|
|
112
136
|
c.hidden = e.columnHiddenKeys.includes(c.dataIndex);
|
|
113
137
|
});
|
|
138
|
+
(_props$onEvent = props.onEvent) === null || _props$onEvent === void 0 || _props$onEvent.call(props, TableEvent.ColumnFilter, e);
|
|
114
139
|
update();
|
|
115
140
|
},
|
|
116
141
|
onFixedThead: onFixedThead
|
|
@@ -136,21 +161,25 @@ var CustomTable = function CustomTable(props) {
|
|
|
136
161
|
});
|
|
137
162
|
cls === null || cls === void 0 || cls.forEach(function (c) {
|
|
138
163
|
if (c.ellipsis && !c.render) {
|
|
139
|
-
var
|
|
140
|
-
|
|
141
|
-
|
|
164
|
+
var ellipsisProps = {};
|
|
165
|
+
if (typeof c.ellipsis === 'number') {
|
|
166
|
+
ellipsisProps = {
|
|
167
|
+
rows: c.ellipsis
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
if (typeof c.ellipsis === 'boolean') ellipsisProps = {
|
|
171
|
+
rows: 1
|
|
172
|
+
};
|
|
173
|
+
if (_typeof(c.ellipsis) === 'object') ellipsisProps = c.ellipsis;
|
|
174
|
+
|
|
175
|
+
// 禁用默认 ellipsis
|
|
176
|
+
c.ellipsis = false;
|
|
177
|
+
// 渲染内容
|
|
142
178
|
c.render = function (e) {
|
|
143
|
-
return /*#__PURE__*/_jsx(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
destroyTooltipOnHide: true,
|
|
148
|
-
className: classNames(_defineProperty({}, "ccs-table-cell-ellipsis-multi lineclamp".concat(ellipsis), isMultiRow)),
|
|
149
|
-
overlayInnerStyle: {
|
|
150
|
-
whiteSpace: 'normal'
|
|
151
|
-
},
|
|
152
|
-
children: e
|
|
153
|
-
});
|
|
179
|
+
return /*#__PURE__*/_jsx(CcsEllipsis2, _objectSpread({
|
|
180
|
+
content: e,
|
|
181
|
+
showTooltip: true
|
|
182
|
+
}, ellipsisProps));
|
|
154
183
|
};
|
|
155
184
|
}
|
|
156
185
|
// 拖拽头部改变列宽响应
|
|
@@ -175,13 +204,17 @@ var CustomTable = function CustomTable(props) {
|
|
|
175
204
|
};
|
|
176
205
|
var _theme$useToken = theme.useToken(),
|
|
177
206
|
token = _theme$useToken.token;
|
|
207
|
+
var tableRowKey = function tableRowKey(_, index) {
|
|
208
|
+
return index || 0;
|
|
209
|
+
};
|
|
210
|
+
var showColumns = filterColumns();
|
|
178
211
|
return /*#__PURE__*/_jsx("div", {
|
|
179
212
|
className: "ccs-table-card",
|
|
180
213
|
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
181
214
|
background: token.colorBgContainer
|
|
182
215
|
}),
|
|
183
216
|
children: /*#__PURE__*/_jsx(Table, _objectSpread(_objectSpread({
|
|
184
|
-
rowKey: rowKey,
|
|
217
|
+
rowKey: rowKey || tableRowKey,
|
|
185
218
|
dataSource: dataSource,
|
|
186
219
|
pagination: pagination === false ? false : _objectSpread({
|
|
187
220
|
total: total,
|
|
@@ -199,7 +232,7 @@ var CustomTable = function CustomTable(props) {
|
|
|
199
232
|
rowSelection: rowSelection ? _objectSpread(_objectSpread({}, rowSelection), {}, {
|
|
200
233
|
columnWidth: 60
|
|
201
234
|
}) : undefined,
|
|
202
|
-
columns:
|
|
235
|
+
columns: showColumns,
|
|
203
236
|
components: {
|
|
204
237
|
header: {
|
|
205
238
|
cell: ResizableTitle
|
|
@@ -208,8 +241,15 @@ var CustomTable = function CustomTable(props) {
|
|
|
208
241
|
}, restProps), {}, {
|
|
209
242
|
size: restProps.size || 'middle',
|
|
210
243
|
className: classNames(_defineProperty(_defineProperty(_defineProperty({}, 'ccs-table-nodata', !dataSource || dataSource.length === 0), 'ccs-table-wrapper', !rowSelection), "className", className)),
|
|
211
|
-
scroll: scroll
|
|
244
|
+
scroll: scroll,
|
|
245
|
+
summary: restProps !== null && restProps !== void 0 && restProps.summary ? function (e) {
|
|
246
|
+
var _restProps$summary;
|
|
247
|
+
return (_restProps$summary = restProps.summary) === null || _restProps$summary === void 0 ? void 0 : _restProps$summary.call(restProps, e, showColumns || []);
|
|
248
|
+
} : undefined
|
|
212
249
|
}))
|
|
213
250
|
});
|
|
214
251
|
};
|
|
252
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
253
|
+
CustomTable.displayName = 'CcsTable';
|
|
254
|
+
}
|
|
215
255
|
export default CustomTable;
|