@arim-aisdc/public-components 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Foo/index.d.ts +6 -0
- package/dist/{Foo → components/Foo}/index.js +6 -0
- package/dist/components/Foo/index.less +3 -0
- package/dist/components/TableMax/TableBody/Row.d.ts +38 -0
- package/dist/{TableMax → components/TableMax}/TableBody/Row.js +0 -1
- package/dist/components/TableMax/TableBody/index.d.ts +49 -0
- package/dist/{TableMax → components/TableMax}/TableBody/index.js +6 -12
- package/dist/components/TableMax/TableHeader/Cell.d.ts +13 -0
- package/dist/{TableMax → components/TableMax}/TableHeader/Cell.js +32 -17
- package/dist/components/TableMax/TableHeader/index.d.ts +16 -0
- package/dist/{TableMax → components/TableMax}/TableHeader/index.js +8 -15
- package/dist/{TableMax → components/TableMax}/TableHeader/index.less +23 -17
- package/dist/components/TableMax/TableHeader/utils.d.ts +1 -0
- package/dist/components/TableMax/TableMax.d.ts +18 -0
- package/dist/{TableMax/index.js → components/TableMax/TableMax.js} +170 -201
- package/dist/components/TableMax/components/ColumnEdit/components/numberRange/index.d.ts +8 -0
- package/dist/{TableMax → components/TableMax}/components/ColumnEdit/components/numberRange/index.js +4 -3
- package/dist/components/TableMax/components/ColumnEdit/index.d.ts +28 -0
- package/dist/{TableMax → components/TableMax}/components/ColumnEdit/index.js +31 -12
- package/dist/{TableMax → components/TableMax}/components/ColumnEdit/index.less +9 -4
- package/dist/components/TableMax/components/ColumnFilter/FilterDateRange/index.d.ts +16 -0
- package/dist/{TableMax → components/TableMax}/components/ColumnFilter/FilterDateRange/index.js +5 -4
- package/dist/components/TableMax/components/ColumnFilter/MultipleSelect/index.d.ts +8 -0
- package/dist/{TableMax → components/TableMax}/components/ColumnFilter/MultipleSelect/index.js +3 -2
- package/dist/components/TableMax/components/ColumnFilter/SingleSelect/index.d.ts +8 -0
- package/dist/{TableMax → components/TableMax}/components/ColumnFilter/SingleSelect/index.js +3 -2
- package/dist/components/TableMax/components/ColumnFilter/customFilterFns.d.ts +6 -0
- package/dist/{TableMax → components/TableMax}/components/ColumnFilter/customFilterFns.js +6 -1
- package/dist/components/TableMax/components/ColumnFilter/index.d.ts +21 -0
- package/dist/{TableMax → components/TableMax}/components/ColumnFilter/index.js +39 -36
- package/dist/components/TableMax/components/ColumnSetting/index.d.ts +18 -0
- package/dist/{TableMax → components/TableMax}/components/ColumnSetting/index.js +16 -29
- package/dist/components/TableMax/components/CustomDragerLayer/index.d.ts +2 -0
- package/dist/{TableMax → components/TableMax}/components/CustomDragerLayer/index.js +49 -9
- package/dist/{TableMax → components/TableMax}/components/CustomDragerLayer/index.less +9 -5
- package/dist/components/TableMax/index.d.ts +7 -0
- package/dist/components/TableMax/index.js +5 -0
- package/dist/{TableMax/index.less → components/TableMax/tableMax.less} +3 -7
- package/dist/components/TableMax/type.d.ts +250 -0
- package/dist/components/TableMax/type.js +1 -0
- package/dist/components/TableMax/utils.d.ts +6 -0
- package/dist/{TableMax → components/TableMax}/utils.js +1 -1
- package/dist/constants/index.d.ts +0 -0
- package/dist/constants/index.js +0 -0
- package/dist/hooks/usePageCacheState/config.d.ts +5 -0
- package/dist/hooks/usePageCacheState/config.js +1 -0
- package/dist/hooks/usePageCacheState/index.d.ts +25 -0
- package/dist/hooks/usePageCacheState/index.js +210 -0
- package/dist/hooks/usePageCacheState/tableDemoConfig.d.ts +3 -0
- package/dist/hooks/usePageCacheState/tableDemoConfig.js +5 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -2
- package/dist/themes/ThemeContext.d.ts +6 -0
- package/dist/themes/ThemeContext.js +51 -0
- package/dist/themes/custom-dark.css +28466 -0
- package/dist/themes/custom-light.css +28092 -0
- package/dist/themes/theme.d.ts +75 -0
- package/dist/themes/theme.js +147 -0
- package/dist/themes/variables.less +70 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +92 -89
- package/dist/Foo/index.less +0 -3
- package/dist/TableMax/type.d.ts +0 -216
- /package/dist/{TableMax → components/TableMax}/TableBody/index.less +0 -0
- /package/dist/{TableMax → components/TableMax}/TableHeader/utils.js +0 -0
- /package/dist/{TableMax → components/TableMax}/components/ColumnEdit/components/numberRange/index.less +0 -0
- /package/dist/{TableMax → components/TableMax}/components/ColumnFilter/FilterDateRange/index.less +0 -0
- /package/dist/{TableMax → components/TableMax}/components/ColumnFilter/MultipleSelect/index.less +0 -0
- /package/dist/{TableMax → components/TableMax}/components/ColumnFilter/SingleSelect/index.less +0 -0
- /package/dist/{TableMax → components/TableMax}/components/ColumnSetting/index.less +0 -0
|
@@ -1,4 +1,12 @@
|
|
|
1
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
|
+
import "antd/es/pagination/style";
|
|
3
|
+
import _Pagination from "antd/es/pagination";
|
|
4
|
+
import "antd/es/button/style";
|
|
5
|
+
import _Button from "antd/es/button";
|
|
6
|
+
import "antd/es/checkbox/style";
|
|
7
|
+
import _Checkbox from "antd/es/checkbox";
|
|
8
|
+
import "antd/es/form/style";
|
|
9
|
+
import _Form from "antd/es/form";
|
|
2
10
|
var _this = this;
|
|
3
11
|
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; }
|
|
4
12
|
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); } }
|
|
@@ -19,30 +27,23 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
19
27
|
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; }
|
|
20
28
|
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; } }
|
|
21
29
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
22
|
-
import { getTextWidth } from "../../src/utils/index";
|
|
23
30
|
import { MinusSquareOutlined, PlusSquareOutlined } from '@ant-design/icons';
|
|
24
31
|
import { getCoreRowModel, getExpandedRowModel, getFacetedUniqueValues, getFilteredRowModel, getSortedRowModel, useReactTable } from '@tanstack/react-table';
|
|
25
|
-
import { Button, Checkbox, Form, Pagination } from 'antd';
|
|
26
32
|
import { cloneDeep } from 'lodash';
|
|
27
33
|
import moment from 'moment';
|
|
28
34
|
import React, { createContext, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
29
35
|
import { DndProvider } from 'react-dnd';
|
|
30
36
|
import { HTML5Backend } from 'react-dnd-html5-backend';
|
|
37
|
+
import TableBody from "./TableBody";
|
|
38
|
+
import TableHeader from "./TableHeader";
|
|
31
39
|
import { InputType } from "./components/ColumnEdit";
|
|
32
40
|
import { setDefaultFilterFn } from "./components/ColumnFilter";
|
|
33
41
|
import customFilterFns from "./components/ColumnFilter/customFilterFns";
|
|
34
42
|
import ColumnSetting from "./components/ColumnSetting";
|
|
35
|
-
|
|
36
|
-
import "./index.less";
|
|
37
|
-
// import TableCore from './Table';
|
|
43
|
+
import "./tableMax.less";
|
|
38
44
|
import { getSizeInfo } from "./utils";
|
|
39
|
-
// import { useUpdateEffect } from 'ahooks';
|
|
40
|
-
import TableBody from "./TableBody";
|
|
41
|
-
import TableHeader from "./TableHeader";
|
|
42
45
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
43
46
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
44
|
-
export { InputType } from "./components/ColumnEdit";
|
|
45
|
-
export { FilterType, setDefaultFilterFn } from "./components/ColumnFilter";
|
|
46
47
|
export var ColumnType = /*#__PURE__*/function (ColumnType) {
|
|
47
48
|
ColumnType["Selection"] = "selection-column";
|
|
48
49
|
ColumnType["Darg"] = "darg-column";
|
|
@@ -81,17 +82,18 @@ var TableMax = function TableMax(_ref) {
|
|
|
81
82
|
changePagination = _ref.changePagination,
|
|
82
83
|
_ref$defaultScrollY = _ref.defaultScrollY,
|
|
83
84
|
defaultScrollY = _ref$defaultScrollY === void 0 ? 600 : _ref$defaultScrollY,
|
|
84
|
-
_ref$
|
|
85
|
-
|
|
85
|
+
_ref$columnResizeMode = _ref.columnResizeMode,
|
|
86
|
+
columnResizeMode = _ref$columnResizeMode === void 0 ? 'onChange' : _ref$columnResizeMode,
|
|
86
87
|
rowKey = _ref.rowKey,
|
|
87
|
-
filterFn = _ref.filterFn,
|
|
88
88
|
refreshFun = _ref.refreshFun,
|
|
89
89
|
_ref$canRefresh = _ref.canRefresh,
|
|
90
90
|
canRefresh = _ref$canRefresh === void 0 ? true : _ref$canRefresh,
|
|
91
91
|
_ref$canSetting = _ref.canSetting,
|
|
92
92
|
canSetting = _ref$canSetting === void 0 ? true : _ref$canSetting,
|
|
93
93
|
_ref$canFilter = _ref.canFilter,
|
|
94
|
-
canFilter = _ref$canFilter === void 0 ?
|
|
94
|
+
canFilter = _ref$canFilter === void 0 ? true : _ref$canFilter,
|
|
95
|
+
_ref$defaultEnableFil = _ref.defaultEnableFilters,
|
|
96
|
+
defaultEnableFilters = _ref$defaultEnableFil === void 0 ? false : _ref$defaultEnableFil,
|
|
95
97
|
_ref$canSelection = _ref.canSelection,
|
|
96
98
|
canSelection = _ref$canSelection === void 0 ? false : _ref$canSelection,
|
|
97
99
|
_ref$canRowDrag = _ref.canRowDrag,
|
|
@@ -116,7 +118,6 @@ var TableMax = function TableMax(_ref) {
|
|
|
116
118
|
renderOperateRight = _ref.renderOperateRight,
|
|
117
119
|
_ref$loading = _ref.loading,
|
|
118
120
|
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
119
|
-
global = _ref.global,
|
|
120
121
|
rowClassName = _ref.rowClassName,
|
|
121
122
|
cellClassName = _ref.cellClassName,
|
|
122
123
|
rowStyle = _ref.rowStyle,
|
|
@@ -133,8 +134,6 @@ var TableMax = function TableMax(_ref) {
|
|
|
133
134
|
return false;
|
|
134
135
|
} : _ref$getRowCanExpand,
|
|
135
136
|
renderSubComponent = _ref.renderSubComponent,
|
|
136
|
-
_ref$isAllRowExpanded = _ref.isAllRowExpanded,
|
|
137
|
-
isAllRowExpanded = _ref$isAllRowExpanded === void 0 ? false : _ref$isAllRowExpanded,
|
|
138
137
|
refInstance = _ref.refInstance,
|
|
139
138
|
_ref$onSelectAllChang = _ref.onSelectAllChange,
|
|
140
139
|
onSelectAllChange = _ref$onSelectAllChang === void 0 ? function () {
|
|
@@ -156,7 +155,11 @@ var TableMax = function TableMax(_ref) {
|
|
|
156
155
|
_ref$autoHeight = _ref.autoHeight,
|
|
157
156
|
autoHeight = _ref$autoHeight === void 0 ? false : _ref$autoHeight,
|
|
158
157
|
_ref$emptyDataHeight = _ref.emptyDataHeight,
|
|
159
|
-
emptyDataHeight = _ref$emptyDataHeight === void 0 ? 100 : _ref$emptyDataHeight
|
|
158
|
+
emptyDataHeight = _ref$emptyDataHeight === void 0 ? 100 : _ref$emptyDataHeight,
|
|
159
|
+
_ref$rowCanDrop = _ref.rowCanDrop,
|
|
160
|
+
rowCanDrop = _ref$rowCanDrop === void 0 ? function () {
|
|
161
|
+
return true;
|
|
162
|
+
} : _ref$rowCanDrop;
|
|
160
163
|
var columns = useMemo(function () {
|
|
161
164
|
// 列筛选:给columns配置默认的过滤函数
|
|
162
165
|
return setDefaultFilterFn(cloneDeep(originColumns));
|
|
@@ -218,32 +221,24 @@ var TableMax = function TableMax(_ref) {
|
|
|
218
221
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
219
222
|
columnPinning = _useState18[0],
|
|
220
223
|
setColumnPinning = _useState18[1];
|
|
221
|
-
var _useState19 = useState(defaultIsSplit),
|
|
222
|
-
_useState20 = _slicedToArray(_useState19, 2),
|
|
223
|
-
isSplit = _useState20[0],
|
|
224
|
-
setIsSplit = _useState20[1];
|
|
225
224
|
/**列宽 */
|
|
226
|
-
var
|
|
225
|
+
var _useState19 = useState([]),
|
|
226
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
227
|
+
columnSizes = _useState20[0],
|
|
228
|
+
setColumnSizes = _useState20[1];
|
|
229
|
+
var _useState21 = useState([]),
|
|
227
230
|
_useState22 = _slicedToArray(_useState21, 2),
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
+
visibleColumnSizes = _useState22[0],
|
|
232
|
+
setVisibleColumnSizes = _useState22[1];
|
|
233
|
+
/**列筛选 */
|
|
234
|
+
var _useState23 = useState(defaultColumnFilters),
|
|
231
235
|
_useState24 = _slicedToArray(_useState23, 2),
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
var _useState25 = useState(
|
|
236
|
+
columnFilters = _useState24[0],
|
|
237
|
+
setColumnFilters = _useState24[1];
|
|
238
|
+
var _useState25 = useState(''),
|
|
235
239
|
_useState26 = _slicedToArray(_useState25, 2),
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
/**列筛选 */
|
|
239
|
-
var _useState27 = useState(defaultColumnFilters),
|
|
240
|
-
_useState28 = _slicedToArray(_useState27, 2),
|
|
241
|
-
columnFilters = _useState28[0],
|
|
242
|
-
setColumnFilters = _useState28[1];
|
|
243
|
-
var _useState29 = useState(''),
|
|
244
|
-
_useState30 = _slicedToArray(_useState29, 2),
|
|
245
|
-
globalFilter = _useState30[0],
|
|
246
|
-
setGlobalFilter = _useState30[1];
|
|
240
|
+
globalFilter = _useState26[0],
|
|
241
|
+
setGlobalFilter = _useState26[1];
|
|
247
242
|
/**分页 */
|
|
248
243
|
var pagination = useMemo(function () {
|
|
249
244
|
return typeof skipCount === 'number' && pageSize ? {
|
|
@@ -252,63 +247,118 @@ var TableMax = function TableMax(_ref) {
|
|
|
252
247
|
} : undefined;
|
|
253
248
|
}, [skipCount, pageSize]);
|
|
254
249
|
/**是否有分组 */
|
|
255
|
-
var
|
|
256
|
-
|
|
257
|
-
hasGroup =
|
|
258
|
-
setHasGroup =
|
|
250
|
+
var _useState27 = useState(false),
|
|
251
|
+
_useState28 = _slicedToArray(_useState27, 2),
|
|
252
|
+
hasGroup = _useState28[0],
|
|
253
|
+
setHasGroup = _useState28[1];
|
|
259
254
|
|
|
260
255
|
/**表格宽度计算 */
|
|
261
|
-
var
|
|
262
|
-
|
|
263
|
-
tableContainerWidth =
|
|
264
|
-
setTableContainerWidth =
|
|
256
|
+
var _useState29 = useState(),
|
|
257
|
+
_useState30 = _slicedToArray(_useState29, 2),
|
|
258
|
+
tableContainerWidth = _useState30[0],
|
|
259
|
+
setTableContainerWidth = _useState30[1];
|
|
265
260
|
var _React$useState = React.useState({}),
|
|
266
261
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
267
262
|
expanded = _React$useState2[0],
|
|
268
263
|
setExpanded = _React$useState2[1];
|
|
269
264
|
|
|
270
265
|
/**table-head高度 */
|
|
271
|
-
var
|
|
272
|
-
|
|
273
|
-
tableHeadHeight =
|
|
274
|
-
setTableHeadHeight =
|
|
266
|
+
var _useState31 = useState(0),
|
|
267
|
+
_useState32 = _slicedToArray(_useState31, 2),
|
|
268
|
+
tableHeadHeight = _useState32[0],
|
|
269
|
+
setTableHeadHeight = _useState32[1];
|
|
275
270
|
|
|
276
271
|
/**table-body 高度 */
|
|
277
|
-
var
|
|
278
|
-
|
|
279
|
-
tableBodyHeight =
|
|
280
|
-
setTableBodyHeight =
|
|
272
|
+
var _useState33 = useState(defaultScrollY),
|
|
273
|
+
_useState34 = _slicedToArray(_useState33, 2),
|
|
274
|
+
tableBodyHeight = _useState34[0],
|
|
275
|
+
setTableBodyHeight = _useState34[1];
|
|
281
276
|
|
|
282
277
|
/**table-body-content 高度 */
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
278
|
+
// const [bodyContentHeight, setBodyContentHeight] = useState(tableDatas.length * Number(rowHeight));
|
|
279
|
+
var bodyContentHeight = useMemo(function () {
|
|
280
|
+
return tableDatas.length * Number(rowHeight);
|
|
281
|
+
}, [tableDatas.length, rowHeight]);
|
|
287
282
|
|
|
288
283
|
/**是否正在多行拖拽 */
|
|
289
|
-
var
|
|
290
|
-
|
|
291
|
-
selectedRowDragging =
|
|
292
|
-
setSelectedRowDragging =
|
|
293
|
-
var
|
|
294
|
-
|
|
295
|
-
enableFilters =
|
|
296
|
-
setEnableFilters =
|
|
297
|
-
var _Form$useForm =
|
|
284
|
+
var _useState35 = useState(false),
|
|
285
|
+
_useState36 = _slicedToArray(_useState35, 2),
|
|
286
|
+
selectedRowDragging = _useState36[0],
|
|
287
|
+
setSelectedRowDragging = _useState36[1];
|
|
288
|
+
var _useState37 = useState(defaultEnableFilters),
|
|
289
|
+
_useState38 = _slicedToArray(_useState37, 2),
|
|
290
|
+
enableFilters = _useState38[0],
|
|
291
|
+
setEnableFilters = _useState38[1];
|
|
292
|
+
var _Form$useForm = _Form.useForm(),
|
|
298
293
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
299
294
|
form = _Form$useForm2[0];
|
|
300
295
|
/**正在编辑的行id*/
|
|
301
|
-
var
|
|
302
|
-
|
|
303
|
-
editingRowId =
|
|
304
|
-
setEditingRowId =
|
|
296
|
+
var _useState39 = useState(''),
|
|
297
|
+
_useState40 = _slicedToArray(_useState39, 2),
|
|
298
|
+
editingRowId = _useState40[0],
|
|
299
|
+
setEditingRowId = _useState40[1];
|
|
305
300
|
|
|
306
301
|
// 表格table-max-content元素
|
|
307
302
|
var tableContentRef = useRef(null);
|
|
308
|
-
var
|
|
309
|
-
|
|
310
|
-
hasVerticalScrollBar =
|
|
311
|
-
setHasVerticalScrollBar =
|
|
303
|
+
var _useState41 = useState(false),
|
|
304
|
+
_useState42 = _slicedToArray(_useState41, 2),
|
|
305
|
+
hasVerticalScrollBar = _useState42[0],
|
|
306
|
+
setHasVerticalScrollBar = _useState42[1];
|
|
307
|
+
var table = useReactTable({
|
|
308
|
+
data: tableDatas,
|
|
309
|
+
// defaultColumn: defaultColumn,
|
|
310
|
+
// @ts-ignore
|
|
311
|
+
columns: tableColumns,
|
|
312
|
+
// 自定义的过滤函数
|
|
313
|
+
filterFns: customFilterFns,
|
|
314
|
+
// 自定义Row.id
|
|
315
|
+
getRowId: function getRowId(originalRow, index) {
|
|
316
|
+
return rowKey ? originalRow[rowKey] : index;
|
|
317
|
+
},
|
|
318
|
+
state: {
|
|
319
|
+
columnVisibility: columnVisibility,
|
|
320
|
+
// defaultColumn,
|
|
321
|
+
// @ts-ignore TODO: 传的state不在table内部已有的state范围内,待优化
|
|
322
|
+
columnSizes: columnSizes,
|
|
323
|
+
visibleColumnSizes: visibleColumnSizes,
|
|
324
|
+
columnOrder: columnOrder,
|
|
325
|
+
pagination: pagination,
|
|
326
|
+
sorting: canSorting ? sorting : undefined,
|
|
327
|
+
columnPinning: columnPinning,
|
|
328
|
+
columnFilters: columnFilters,
|
|
329
|
+
globalFilter: globalFilter,
|
|
330
|
+
rowSelection: rowSelection,
|
|
331
|
+
expanded: expanded
|
|
332
|
+
},
|
|
333
|
+
onColumnVisibilityChange: setColumnVisibility,
|
|
334
|
+
onColumnOrderChange: setColumnOrder,
|
|
335
|
+
onColumnPinningChange: setColumnPinning,
|
|
336
|
+
getCoreRowModel: getCoreRowModel(),
|
|
337
|
+
getExpandedRowModel: getExpandedRowModel(),
|
|
338
|
+
onColumnFiltersChange: setColumnFilters,
|
|
339
|
+
getFacetedUniqueValues: getFacetedUniqueValues(),
|
|
340
|
+
getFilteredRowModel: getFilteredRowModel(),
|
|
341
|
+
onGlobalFilterChange: setGlobalFilter,
|
|
342
|
+
manualPagination: true,
|
|
343
|
+
manualSorting: manualSorting,
|
|
344
|
+
manualFiltering: manualFiltering,
|
|
345
|
+
enableFilters: enableFilters,
|
|
346
|
+
debugTable: false,
|
|
347
|
+
debugHeaders: false,
|
|
348
|
+
debugColumns: false,
|
|
349
|
+
columnResizeMode: columnResizeMode,
|
|
350
|
+
getRowCanExpand: getRowCanExpand,
|
|
351
|
+
enableMultiSort: enableMultiSort,
|
|
352
|
+
isMultiSortEvent: function isMultiSortEvent() {
|
|
353
|
+
return enableMultiSort;
|
|
354
|
+
},
|
|
355
|
+
onSortingChange: setSorting,
|
|
356
|
+
getSortedRowModel: getSortedRowModel(),
|
|
357
|
+
onRowSelectionChange: setRowSelection,
|
|
358
|
+
enableRowSelection: enableRowSelection,
|
|
359
|
+
onExpandedChange: setExpanded,
|
|
360
|
+
sortDescFirst: true // 首次排序为递减排序,不加这个属性的话,有些列的排序会有问题
|
|
361
|
+
});
|
|
312
362
|
|
|
313
363
|
// 暴露给外部的api
|
|
314
364
|
useImperativeHandle(refInstance, function () {
|
|
@@ -328,24 +378,28 @@ var TableMax = function TableMax(_ref) {
|
|
|
328
378
|
|
|
329
379
|
// 设置table-body高度
|
|
330
380
|
useEffect(function () {
|
|
331
|
-
var _tableContentRef$curr, _tableContentRef$curr2;
|
|
381
|
+
var _tableContentRef$curr, _tableContentRef$curr2, _tableContentRef$curr3;
|
|
332
382
|
if (datas.length === 0) {
|
|
333
383
|
setTableBodyHeight(emptyDataHeight);
|
|
334
384
|
return;
|
|
335
385
|
}
|
|
336
386
|
var horizontalScrollHeight = table.getCenterTotalSize() > (tableContentRef === null || tableContentRef === void 0 || (_tableContentRef$curr = tableContentRef.current) === null || _tableContentRef$curr === void 0 ? void 0 : _tableContentRef$curr.offsetWidth) ? 10 : 0;
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
387
|
+
console.log('horizontalScrollHeight---------', table.getCenterTotalSize(), tableContentRef === null || tableContentRef === void 0 || (_tableContentRef$curr2 = tableContentRef.current) === null || _tableContentRef$curr2 === void 0 ? void 0 : _tableContentRef$curr2.offsetWidth);
|
|
388
|
+
var maxBodyHeight = autoHeight ? (tableContentRef === null || tableContentRef === void 0 || (_tableContentRef$curr3 = tableContentRef.current) === null || _tableContentRef$curr3 === void 0 ? void 0 : _tableContentRef$curr3.clientHeight) - tableHeadHeight - horizontalScrollHeight : defaultScrollY - tableHeadHeight - horizontalScrollHeight;
|
|
389
|
+
setTableBodyHeight(Math.min(bodyContentHeight, maxBodyHeight));
|
|
390
|
+
setHasVerticalScrollBar(bodyContentHeight > maxBodyHeight);
|
|
391
|
+
}, [tableHeadHeight, bodyContentHeight, defaultScrollY]);
|
|
341
392
|
|
|
342
393
|
// 单选多选-控制选中行
|
|
343
394
|
useEffect(function () {
|
|
344
|
-
|
|
345
|
-
accumulator
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
395
|
+
if (canSelection) {
|
|
396
|
+
setRowSelection(defaultSelectedRowIds.reduce(function (accumulator, currentValue) {
|
|
397
|
+
accumulator[currentValue] = true;
|
|
398
|
+
return accumulator;
|
|
399
|
+
}, {}));
|
|
400
|
+
} else {
|
|
401
|
+
setRowSelectedId(defaultSelectedRowId);
|
|
402
|
+
}
|
|
349
403
|
}, [defaultSelectedRowId, JSON.stringify(defaultSelectedRowIds), canSelection]);
|
|
350
404
|
|
|
351
405
|
/** 列表行是否支持展开 和 多选 */
|
|
@@ -381,7 +435,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
381
435
|
id: ColumnType.Selection,
|
|
382
436
|
header: function header(_ref3) {
|
|
383
437
|
var table = _ref3.table;
|
|
384
|
-
return /*#__PURE__*/_jsx(
|
|
438
|
+
return /*#__PURE__*/_jsx(_Checkbox, {
|
|
385
439
|
checked: table.getIsAllRowsSelected(),
|
|
386
440
|
indeterminate: table.getIsSomeRowsSelected(),
|
|
387
441
|
onChange: selectAllChange.bind(_this, table),
|
|
@@ -393,7 +447,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
393
447
|
},
|
|
394
448
|
cell: function cell(_ref4) {
|
|
395
449
|
var row = _ref4.row;
|
|
396
|
-
return /*#__PURE__*/_jsx(
|
|
450
|
+
return /*#__PURE__*/_jsx(_Checkbox, {
|
|
397
451
|
checked: row.getIsSelected(),
|
|
398
452
|
disabled: !row.getCanSelect(),
|
|
399
453
|
indeterminate: row.getIsSomeSelected(),
|
|
@@ -464,60 +518,6 @@ var TableMax = function TableMax(_ref) {
|
|
|
464
518
|
}
|
|
465
519
|
setColumnOrder(arr);
|
|
466
520
|
};
|
|
467
|
-
var table = useReactTable({
|
|
468
|
-
data: tableDatas,
|
|
469
|
-
// defaultColumn: defaultColumn,
|
|
470
|
-
columns: tableColumns,
|
|
471
|
-
// 自定义的过滤函数
|
|
472
|
-
filterFns: customFilterFns,
|
|
473
|
-
// 自定义Row.id
|
|
474
|
-
getRowId: function getRowId(originalRow, index) {
|
|
475
|
-
return rowKey ? originalRow[rowKey] : index;
|
|
476
|
-
},
|
|
477
|
-
state: {
|
|
478
|
-
columnVisibility: columnVisibility,
|
|
479
|
-
// defaultColumn,
|
|
480
|
-
columnSizes: columnSizes,
|
|
481
|
-
visibleColumnSizes: visibleColumnSizes,
|
|
482
|
-
columnOrder: columnOrder,
|
|
483
|
-
pagination: pagination,
|
|
484
|
-
sorting: canSorting ? sorting : undefined,
|
|
485
|
-
columnPinning: columnPinning,
|
|
486
|
-
columnFilters: columnFilters,
|
|
487
|
-
globalFilter: globalFilter,
|
|
488
|
-
rowSelection: rowSelection,
|
|
489
|
-
expanded: expanded
|
|
490
|
-
},
|
|
491
|
-
onColumnVisibilityChange: setColumnVisibility,
|
|
492
|
-
onColumnOrderChange: setColumnOrder,
|
|
493
|
-
onColumnPinningChange: setColumnPinning,
|
|
494
|
-
getCoreRowModel: getCoreRowModel(),
|
|
495
|
-
getExpandedRowModel: getExpandedRowModel(),
|
|
496
|
-
onColumnFiltersChange: setColumnFilters,
|
|
497
|
-
getFacetedUniqueValues: getFacetedUniqueValues(),
|
|
498
|
-
getFilteredRowModel: getFilteredRowModel(),
|
|
499
|
-
onGlobalFilterChange: setGlobalFilter,
|
|
500
|
-
manualPagination: true,
|
|
501
|
-
manualSorting: manualSorting,
|
|
502
|
-
manualFiltering: manualFiltering,
|
|
503
|
-
enableFilters: enableFilters,
|
|
504
|
-
debugTable: false,
|
|
505
|
-
debugHeaders: false,
|
|
506
|
-
debugColumns: false,
|
|
507
|
-
columnResizeMode: columnResizeMode,
|
|
508
|
-
getRowCanExpand: getRowCanExpand,
|
|
509
|
-
enableMultiSort: enableMultiSort,
|
|
510
|
-
isMultiSortEvent: function isMultiSortEvent() {
|
|
511
|
-
return enableMultiSort;
|
|
512
|
-
},
|
|
513
|
-
onSortingChange: setSorting,
|
|
514
|
-
getSortedRowModel: getSortedRowModel(),
|
|
515
|
-
onRowSelectionChange: setRowSelection,
|
|
516
|
-
enableRowSelection: enableRowSelection,
|
|
517
|
-
onExpandedChange: setExpanded,
|
|
518
|
-
sortDescFirst: true // 首次排序为递减排序,不加这个属性的话,有些列的排序会有问题
|
|
519
|
-
});
|
|
520
|
-
|
|
521
521
|
useEffect(function () {
|
|
522
522
|
var _localStorage$getItem2, _document$getElementB;
|
|
523
523
|
// 列宽度计算-初始化
|
|
@@ -538,7 +538,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
538
538
|
allCount = _getSizeInfo.allCount,
|
|
539
539
|
hasSizeCount = _getSizeInfo.hasSizeCount,
|
|
540
540
|
hasSizeAllWidth = _getSizeInfo.hasSizeAllWidth;
|
|
541
|
-
//表格宽度,offsetWidth?下面监听里用的
|
|
541
|
+
//表格宽度,offsetWidth?下面监听里用的clientWidth
|
|
542
542
|
var tableContainerWidth = ((_document$getElementB = document.getElementById("".concat(tableId, "-TableCore"))) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.offsetWidth) || 1000;
|
|
543
543
|
console.log('tableContainerWidth initColumn', tableContainerWidth);
|
|
544
544
|
// 空白宽度
|
|
@@ -555,10 +555,10 @@ var TableMax = function TableMax(_ref) {
|
|
|
555
555
|
});
|
|
556
556
|
});
|
|
557
557
|
} else {
|
|
558
|
-
// TODO: 什么作用?
|
|
559
558
|
newColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
|
|
560
559
|
return _objectSpread({
|
|
561
|
-
size:
|
|
560
|
+
size: 60,
|
|
561
|
+
// 默认宽度60
|
|
562
562
|
maxSize: 500
|
|
563
563
|
}, item);
|
|
564
564
|
});
|
|
@@ -572,6 +572,8 @@ var TableMax = function TableMax(_ref) {
|
|
|
572
572
|
return (column === null || column === void 0 ? void 0 : column.columns) && ((_column$columns = column.columns) === null || _column$columns === void 0 ? void 0 : _column$columns.length) > 0;
|
|
573
573
|
}) > -1);
|
|
574
574
|
}, [columns]);
|
|
575
|
+
|
|
576
|
+
// 添加空白列
|
|
575
577
|
useEffect(function () {
|
|
576
578
|
var _table$getAllColumns, _table$getVisibleLeaf;
|
|
577
579
|
// 未固定列的宽度总和
|
|
@@ -710,9 +712,12 @@ var TableMax = function TableMax(_ref) {
|
|
|
710
712
|
columnFilters: tableState.columnFilters,
|
|
711
713
|
columnSorting: tableState.sorting,
|
|
712
714
|
enableFilters: enableFilters,
|
|
715
|
+
// @ts-ignore
|
|
713
716
|
columnSizes: tableState.columnSizes
|
|
714
717
|
}));
|
|
715
|
-
}, [table.getState().columnVisibility, table.getState().columnPinning, table.getState().columnOrder, table.getState().columnFilters, table.getState().sorting, enableFilters,
|
|
718
|
+
}, [table.getState().columnVisibility, table.getState().columnPinning, table.getState().columnOrder, table.getState().columnFilters, table.getState().sorting, enableFilters,
|
|
719
|
+
// @ts-ignore
|
|
720
|
+
table.getState().columnSizes]);
|
|
716
721
|
|
|
717
722
|
// const reorderRow = (dragFromRowIndex: number, targetRowIndex: number) => {
|
|
718
723
|
// const draggedRows = table.getSelectedRowModel()?.rows || [];
|
|
@@ -762,6 +767,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
762
767
|
sourceTableId = fromDatas.sourceTableId;
|
|
763
768
|
var hoverRow = toDatas.hoverRow,
|
|
764
769
|
targetTableId = toDatas.targetTableId;
|
|
770
|
+
if (!rowCanDrop(toDatas, fromDatas)) return;
|
|
765
771
|
var dragFromRowIndex = draggedRow.index;
|
|
766
772
|
var targetRowIndex = hoverRow.index;
|
|
767
773
|
var draggedRowsIndexList = draggedRows === null || draggedRows === void 0 ? void 0 : draggedRows.map(function (row) {
|
|
@@ -808,7 +814,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
808
814
|
newTableDatas = tableDatas.filter(function (data, idx) {
|
|
809
815
|
return !draggedRowsIndexList.includes(idx);
|
|
810
816
|
});
|
|
811
|
-
(_newTableDatas2 = newTableDatas).splice.apply(_newTableDatas2, [targetRowIndex - aheadOfTargetRowNumber, 0].concat(draggedDatas));
|
|
817
|
+
(_newTableDatas2 = newTableDatas).splice.apply(_newTableDatas2, [targetRowIndex > dragFromRowIndex ? targetRowIndex - aheadOfTargetRowNumber + 1 : targetRowIndex - aheadOfTargetRowNumber, 0].concat(draggedDatas));
|
|
812
818
|
setTableDatas(_toConsumableArray(newTableDatas));
|
|
813
819
|
} else {
|
|
814
820
|
// 单选行拖动
|
|
@@ -827,31 +833,6 @@ var TableMax = function TableMax(_ref) {
|
|
|
827
833
|
updatedTableDatas: newTableDatas
|
|
828
834
|
});
|
|
829
835
|
};
|
|
830
|
-
/**纵向滚动高度 */
|
|
831
|
-
var _useState49 = useState(0),
|
|
832
|
-
_useState50 = _slicedToArray(_useState49, 2),
|
|
833
|
-
scroll = _useState50[0],
|
|
834
|
-
setScroll = _useState50[1];
|
|
835
|
-
var onScroll = function onScroll(event) {
|
|
836
|
-
// if (!event?.currentTarget) return;
|
|
837
|
-
// event.preventDefault();
|
|
838
|
-
// event.stopPropagation();
|
|
839
|
-
// const scrollLeft = event?.currentTarget?.scrollLeft;
|
|
840
|
-
// const clientWidth = event?.currentTarget.clientWidth;
|
|
841
|
-
// const scrollWidth = event?.currentTarget?.scrollWidth;
|
|
842
|
-
// const elementLeft = document.querySelector(`.${tableId}-left`) as Element;
|
|
843
|
-
// const elementRight = document.querySelector(`.${tableId}-right`) as Element;
|
|
844
|
-
// if (!scrollLeft) {
|
|
845
|
-
// !!elementLeft && (elementLeft.style.boxShadow = 'none');
|
|
846
|
-
// !!elementRight && (elementRight.style.boxShadow = 'inset -10px 0 8px -8px rgba(0, 0, 0, 0.15)');
|
|
847
|
-
// } else if (scrollLeft + clientWidth >= scrollWidth) {
|
|
848
|
-
// !!elementLeft && (elementLeft.style.boxShadow = 'inset 10px 0 8px -8px rgba(0, 0, 0, 0.15)');
|
|
849
|
-
// !!elementRight && (elementRight.style.boxShadow = 'none');
|
|
850
|
-
// } else {
|
|
851
|
-
// !!elementLeft && (elementLeft.style.boxShadow = 'inset 10px 0 8px -8px rgba(0, 0, 0, 0.15)');
|
|
852
|
-
// !!elementRight && (elementRight.style.boxShadow = 'inset -10px 0 8px -8px rgba(0, 0, 0, 0.15)');
|
|
853
|
-
// }
|
|
854
|
-
};
|
|
855
836
|
|
|
856
837
|
// 是否可点击编辑按钮:当且仅当选中一行时可点击编辑按钮
|
|
857
838
|
var canClickEditIcon = useMemo(function () {
|
|
@@ -912,6 +893,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
912
893
|
save();
|
|
913
894
|
}
|
|
914
895
|
};
|
|
896
|
+
|
|
915
897
|
// 编辑时,监听click事件,点击其他行时,触发保存;
|
|
916
898
|
useEffect(function () {
|
|
917
899
|
var tableBodyTBodyDom = document.getElementById("table-max-tableBody-tbody-".concat(tableId));
|
|
@@ -955,22 +937,19 @@ var TableMax = function TableMax(_ref) {
|
|
|
955
937
|
canSelection: canSelection,
|
|
956
938
|
canRowDrag: canRowDrag,
|
|
957
939
|
canFilter: canFilter,
|
|
958
|
-
rowSelectionChange: rowSelectionChange,
|
|
959
940
|
tableBodyHeight: tableBodyHeight,
|
|
960
|
-
|
|
961
|
-
|
|
941
|
+
// setScroll,
|
|
942
|
+
// scroll,
|
|
962
943
|
rowHeight: rowHeight,
|
|
963
944
|
tableHeadHeight: tableHeadHeight,
|
|
964
945
|
setTableHeadHeight: setTableHeadHeight,
|
|
965
946
|
bodyContentHeight: bodyContentHeight,
|
|
966
|
-
|
|
947
|
+
// setBodyContentHeight,
|
|
967
948
|
tableContainerWidth: tableContainerWidth,
|
|
968
949
|
rowKey: rowKey,
|
|
969
|
-
filterFn: filterFn,
|
|
970
950
|
hasGroup: hasGroup,
|
|
971
951
|
tableDatas: tableDatas,
|
|
972
952
|
canSorting: canSorting,
|
|
973
|
-
loading: loading,
|
|
974
953
|
rowClassName: rowClassName,
|
|
975
954
|
cellClassName: cellClassName,
|
|
976
955
|
rowStyle: rowStyle,
|
|
@@ -978,7 +957,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
978
957
|
getHeaderCellProps: getHeaderCellProps,
|
|
979
958
|
editingRowId: editingRowId,
|
|
980
959
|
renderSubComponent: renderSubComponent,
|
|
981
|
-
|
|
960
|
+
// isAllRowExpanded,
|
|
982
961
|
selectedRowDragging: selectedRowDragging,
|
|
983
962
|
setSelectedRowDragging: setSelectedRowDragging,
|
|
984
963
|
onRowMouseEnter: onRowMouseEnter,
|
|
@@ -1002,20 +981,18 @@ var TableMax = function TableMax(_ref) {
|
|
|
1002
981
|
onSelectChange: onSelectChange,
|
|
1003
982
|
canFilter: canFilter,
|
|
1004
983
|
canSelection: canSelection,
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
setScroll: setScroll,
|
|
984
|
+
// scroll,
|
|
985
|
+
// setScroll,
|
|
1008
986
|
tableBodyHeight: tableBodyHeight,
|
|
1009
987
|
tableHeadHeight: tableHeadHeight,
|
|
1010
988
|
setTableHeadHeight: setTableHeadHeight,
|
|
1011
989
|
bodyContentHeight: bodyContentHeight,
|
|
1012
|
-
|
|
990
|
+
// setBodyContentHeight,
|
|
1013
991
|
tableContainerWidth: tableContainerWidth,
|
|
1014
992
|
selectedRowDragging: selectedRowDragging,
|
|
1015
993
|
setSelectedRowDragging: setSelectedRowDragging,
|
|
1016
994
|
canRowDrag: canRowDrag,
|
|
1017
995
|
rowKey: rowKey,
|
|
1018
|
-
filterFn: filterFn,
|
|
1019
996
|
hasGroup: hasGroup,
|
|
1020
997
|
tableDatas: tableDatas,
|
|
1021
998
|
canSorting: canSorting,
|
|
@@ -1029,7 +1006,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
1029
1006
|
editingRowId: editingRowId,
|
|
1030
1007
|
handleEditRowWhenDClick: handleEditRowWhenDClick,
|
|
1031
1008
|
renderSubComponent: renderSubComponent,
|
|
1032
|
-
|
|
1009
|
+
// isAllRowExpanded,
|
|
1033
1010
|
onRowMouseEnter: onRowMouseEnter,
|
|
1034
1011
|
onRowMouseLeave: onRowMouseLeave,
|
|
1035
1012
|
onRowMouseClick: onRowMouseClick,
|
|
@@ -1055,16 +1032,16 @@ var TableMax = function TableMax(_ref) {
|
|
|
1055
1032
|
table: table,
|
|
1056
1033
|
canFilter: canFilter,
|
|
1057
1034
|
enableFilters: enableFilters,
|
|
1058
|
-
filterFn: filterFn,
|
|
1059
1035
|
canSorting: canSorting,
|
|
1060
1036
|
rowHeight: rowHeight,
|
|
1061
1037
|
hasGroup: hasGroup,
|
|
1062
1038
|
headerGroups: table.getHeaderGroups(),
|
|
1063
|
-
getHeaderCellProps: getHeaderCellProps
|
|
1039
|
+
getHeaderCellProps: getHeaderCellProps,
|
|
1040
|
+
columnResizeMode: columnResizeMode
|
|
1064
1041
|
// hasVerticalScrollBar
|
|
1065
1042
|
};
|
|
1066
1043
|
|
|
1067
|
-
return /*#__PURE__*/_jsx(
|
|
1044
|
+
return /*#__PURE__*/_jsx(_Form, {
|
|
1068
1045
|
form: form,
|
|
1069
1046
|
component: false,
|
|
1070
1047
|
children: /*#__PURE__*/_jsx(DndProvider, {
|
|
@@ -1090,14 +1067,14 @@ var TableMax = function TableMax(_ref) {
|
|
|
1090
1067
|
className: "table-max-header-right",
|
|
1091
1068
|
children: /*#__PURE__*/_jsxs("span", {
|
|
1092
1069
|
className: "handleRightEditBtn",
|
|
1093
|
-
children: [/*#__PURE__*/_jsx(
|
|
1070
|
+
children: [/*#__PURE__*/_jsx(_Button, {
|
|
1094
1071
|
type: "default",
|
|
1095
1072
|
onClick: handleClickCancelEdit,
|
|
1096
1073
|
style: {
|
|
1097
1074
|
marginRight: 12
|
|
1098
1075
|
},
|
|
1099
1076
|
children: "\u53D6\u6D88"
|
|
1100
|
-
}), /*#__PURE__*/_jsx(
|
|
1077
|
+
}), /*#__PURE__*/_jsx(_Button, {
|
|
1101
1078
|
type: "primary",
|
|
1102
1079
|
onClick: save,
|
|
1103
1080
|
children: "\u4FDD\u5B58"
|
|
@@ -1127,7 +1104,6 @@ var TableMax = function TableMax(_ref) {
|
|
|
1127
1104
|
}), canSetting && /*#__PURE__*/_jsx(ColumnSetting, {
|
|
1128
1105
|
table: table,
|
|
1129
1106
|
tableId: tableId,
|
|
1130
|
-
isSplit: isSplit,
|
|
1131
1107
|
canFilter: canFilter,
|
|
1132
1108
|
enableFilters: enableFilters,
|
|
1133
1109
|
canRowDrag: canRowDrag,
|
|
@@ -1149,7 +1125,6 @@ var TableMax = function TableMax(_ref) {
|
|
|
1149
1125
|
value: _objectSpread({}, TableContextProps),
|
|
1150
1126
|
children: /*#__PURE__*/_jsxs("div", {
|
|
1151
1127
|
className: "table-center",
|
|
1152
|
-
onScroll: onScroll,
|
|
1153
1128
|
ref: tableContentRef,
|
|
1154
1129
|
children: [/*#__PURE__*/_jsx("div", {
|
|
1155
1130
|
ref: tableHeaderRef,
|
|
@@ -1172,7 +1147,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
1172
1147
|
})
|
|
1173
1148
|
}), pagination && /*#__PURE__*/_jsx("div", {
|
|
1174
1149
|
className: "table-max-footer",
|
|
1175
|
-
children: /*#__PURE__*/_jsx(
|
|
1150
|
+
children: /*#__PURE__*/_jsx(_Pagination, {
|
|
1176
1151
|
pageSize: pageSize,
|
|
1177
1152
|
total: totalCount,
|
|
1178
1153
|
defaultPageSize: pageSize,
|
|
@@ -1194,14 +1169,8 @@ var TableMax = function TableMax(_ref) {
|
|
|
1194
1169
|
})
|
|
1195
1170
|
});
|
|
1196
1171
|
};
|
|
1197
|
-
|
|
1198
|
-
// const Component = connect(({ global }: any) => ({
|
|
1199
|
-
// global,
|
|
1200
|
-
// }))(TableMax);
|
|
1201
|
-
|
|
1202
|
-
var Component = TableMax;
|
|
1203
1172
|
export default /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
1204
|
-
return /*#__PURE__*/_jsx(
|
|
1173
|
+
return /*#__PURE__*/_jsx(TableMax, _objectSpread(_objectSpread({}, props), {}, {
|
|
1205
1174
|
refInstance: ref
|
|
1206
1175
|
}));
|
|
1207
1176
|
});
|