@ccs-ui/rc-pro 2.3.6-alpha-31 → 2.3.6-alpha-33
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/package.json +6 -27
- package/LICENSE +0 -21
- package/README.md +0 -37
- package/es/aj-captcha/index.d.ts +0 -34
- package/es/aj-captcha/index.js +0 -302
- package/es/aj-captcha/index.less +0 -89
- package/es/auth/index.d.ts +0 -15
- package/es/auth/index.js +0 -38
- package/es/breadcrumb.d.ts +0 -8
- package/es/breadcrumb.js +0 -40
- package/es/button/dropdown.d.ts +0 -6
- package/es/button/dropdown.js +0 -72
- package/es/button/group.d.ts +0 -2
- package/es/button/group.js +0 -176
- package/es/button/index.d.ts +0 -65
- package/es/button/index.js +0 -133
- package/es/cascader/index.d.ts +0 -33
- package/es/cascader/index.js +0 -120
- package/es/ccs.d.ts +0 -131
- package/es/ccs.js +0 -1
- package/es/color-picker/index.d.ts +0 -7
- package/es/color-picker/index.js +0 -142
- package/es/color-picker/index.less +0 -8
- package/es/config.d.ts +0 -6
- package/es/config.js +0 -126
- package/es/context/index.d.ts +0 -115
- package/es/context/index.js +0 -6
- package/es/date-picker/index.d.ts +0 -19
- package/es/date-picker/index.js +0 -72
- package/es/dialog/HookDrawer.d.ts +0 -9
- package/es/dialog/HookDrawer.js +0 -156
- package/es/dialog/HookModal.d.ts +0 -10
- package/es/dialog/HookModal.js +0 -213
- package/es/dialog/button.d.ts +0 -24
- package/es/dialog/button.js +0 -256
- package/es/dialog/context.d.ts +0 -25
- package/es/dialog/context.js +0 -13
- package/es/dialog/drawer-footer.d.ts +0 -16
- package/es/dialog/drawer-footer.js +0 -43
- package/es/dialog/form.d.ts +0 -16
- package/es/dialog/form.js +0 -53
- package/es/dialog/hook.d.ts +0 -80
- package/es/dialog/hook.js +0 -234
- package/es/dialog/index.d.ts +0 -19
- package/es/dialog/index.js +0 -14
- package/es/dialog/usePatchElement.d.ts +0 -5
- package/es/dialog/usePatchElement.js +0 -35
- package/es/editor/index.d.ts +0 -22
- package/es/editor/index.js +0 -18
- package/es/editor/index.less +0 -19
- package/es/editor/javascript.d.ts +0 -2
- package/es/editor/javascript.js +0 -56
- package/es/editor/json.d.ts +0 -7
- package/es/editor/json.js +0 -82
- package/es/editor/sql.d.ts +0 -2
- package/es/editor/sql.js +0 -54
- package/es/ellipsis/index.d.ts +0 -22
- package/es/ellipsis/index.js +0 -129
- package/es/ellipsis/index.less +0 -5
- package/es/ellipsis/useMeasure.d.ts +0 -9
- package/es/ellipsis/useMeasure.js +0 -142
- package/es/ellipsis/useResizeEffect.d.ts +0 -2
- package/es/ellipsis/useResizeEffect.js +0 -14
- package/es/ellipsis/withStopPropagation.d.ts +0 -4
- package/es/ellipsis/withStopPropagation.js +0 -38
- package/es/full-screen/index.d.ts +0 -3
- package/es/full-screen/index.js +0 -49
- package/es/group-form-item/index.d.ts +0 -11
- package/es/group-form-item/index.js +0 -124
- package/es/hooks/use-app.d.ts +0 -25
- package/es/hooks/use-app.js +0 -52
- package/es/hooks/use-event.d.ts +0 -10
- package/es/hooks/use-event.js +0 -69
- package/es/hooks/use-once-event.d.ts +0 -2
- package/es/hooks/use-once-event.js +0 -16
- package/es/hooks/use-page.d.ts +0 -10
- package/es/hooks/use-page.js +0 -10
- package/es/hooks/use-selection.d.ts +0 -17
- package/es/hooks/use-selection.js +0 -172
- package/es/hooks/use-tabs.d.ts +0 -2
- package/es/hooks/use-tabs.js +0 -10
- package/es/hooks/use-window.d.ts +0 -8
- package/es/hooks/use-window.js +0 -15
- package/es/index.d.ts +0 -37
- package/es/index.js +0 -37
- package/es/interval-button/index.d.ts +0 -14
- package/es/interval-button/index.js +0 -128
- package/es/layout-keep-alive/index.d.ts +0 -29
- package/es/layout-keep-alive/index.js +0 -400
- package/es/layout-keep-alive/index.less +0 -79
- package/es/layout-keep-alive/page.d.ts +0 -14
- package/es/layout-keep-alive/page.js +0 -53
- package/es/layout-single-page/index.d.ts +0 -14
- package/es/layout-single-page/index.js +0 -71
- package/es/layout-single-page/index.less +0 -15
- package/es/layout-single-page/page.d.ts +0 -13
- package/es/layout-single-page/page.js +0 -41
- package/es/loading/index.d.ts +0 -14
- package/es/loading/index.js +0 -43
- package/es/pro-grid/index.d.ts +0 -15
- package/es/pro-grid/index.js +0 -58
- package/es/pro-table/_utils.d.ts +0 -12
- package/es/pro-table/_utils.js +0 -94
- package/es/pro-table/form-item.d.ts +0 -9
- package/es/pro-table/form-item.js +0 -44
- package/es/pro-table/head.d.ts +0 -16
- package/es/pro-table/head.js +0 -225
- package/es/pro-table/index.d.ts +0 -23
- package/es/pro-table/index.js +0 -37
- package/es/pro-table/index.less +0 -82
- package/es/pro-table/operation.d.ts +0 -14
- package/es/pro-table/operation.js +0 -194
- package/es/pro-table/selection-alert.d.ts +0 -20
- package/es/pro-table/selection-alert.js +0 -64
- package/es/pro-table/size.d.ts +0 -10
- package/es/pro-table/size.js +0 -17
- package/es/pro-table/summary.d.ts +0 -8
- package/es/pro-table/summary.js +0 -32
- package/es/pro-table/table.d.ts +0 -104
- package/es/pro-table/table.js +0 -712
- package/es/pro-table/tree.d.ts +0 -24
- package/es/pro-table/tree.js +0 -197
- package/es/pro-tabs/index.d.ts +0 -9
- package/es/pro-tabs/index.js +0 -174
- package/es/resize-observer.d.ts +0 -15
- package/es/resize-observer.js +0 -37
- package/es/result/icon.d.ts +0 -3
- package/es/result/icon.js +0 -3
- package/es/result/index.d.ts +0 -12
- package/es/result/index.js +0 -68
- package/es/select/ modal.d.ts +0 -10
- package/es/select/ modal.js +0 -141
- package/es/select/api.d.ts +0 -25
- package/es/select/api.js +0 -67
- package/es/select/customize.d.ts +0 -25
- package/es/select/customize.js +0 -139
- package/es/select/index.d.ts +0 -31
- package/es/select/index.js +0 -108
- package/es/status-tag/index.d.ts +0 -13
- package/es/status-tag/index.js +0 -31
- package/es/table/index.d.ts +0 -19
- package/es/table/index.js +0 -253
- package/es/table/index.less +0 -29
- package/es/theme-dialog.d.ts +0 -28
- package/es/theme-dialog.js +0 -81
- package/es/time-picker/index.d.ts +0 -15
- package/es/time-picker/index.js +0 -49
- package/es/trigger/index.d.ts +0 -43
- package/es/trigger/index.js +0 -298
- package/es/trigger/index.less +0 -42
- package/es/types.d.ts +0 -0
- package/es/types.js +0 -0
- package/es/upload/index.d.ts +0 -42
- package/es/upload/index.js +0 -167
- package/es/upload/upload-image.d.ts +0 -6
- package/es/upload/upload-image.js +0 -205
- package/es/virtual-list/index.d.ts +0 -51
- package/es/virtual-list/index.js +0 -132
- package/es/water-mark/index.d.ts +0 -65
- package/es/water-mark/index.js +0 -141
- package/es/water-mark/relative.d.ts +0 -62
- package/es/water-mark/relative.js +0 -130
package/es/pro-table/table.js
DELETED
|
@@ -1,712 +0,0 @@
|
|
|
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
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
-
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; }
|
|
7
|
-
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; }
|
|
8
|
-
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; }
|
|
9
|
-
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; }
|
|
10
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
11
|
-
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); }
|
|
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); } }
|
|
13
|
-
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); }); }; }
|
|
14
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
15
|
-
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."); }
|
|
16
|
-
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); }
|
|
17
|
-
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; }
|
|
18
|
-
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; } }
|
|
19
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
-
import { useUpdateEffect } from 'ahooks';
|
|
21
|
-
import { theme as antTheme, Card, Empty } from 'antd';
|
|
22
|
-
import { ConfigContext } from 'antd/es/config-provider';
|
|
23
|
-
import classNames from 'classnames';
|
|
24
|
-
import _debounce from 'lodash.debounce';
|
|
25
|
-
import React, { useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
26
|
-
import { CcsResizeObserver, useAppConfig, useCcsPage } from '..';
|
|
27
|
-
import { useProTableFields } from "../hooks/use-app";
|
|
28
|
-
import { getDataByNamePath } from "../select";
|
|
29
|
-
import CcsTable from "../table";
|
|
30
|
-
import { getAllChildrenId, getDataById, onTableInModalOrDrawer, onTableInTabItem } from "./_utils";
|
|
31
|
-
import HeadComponent from "./head";
|
|
32
|
-
import "./index.less";
|
|
33
|
-
import TableOperation from "./operation";
|
|
34
|
-
import TableTree from "./tree";
|
|
35
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
36
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
37
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
38
|
-
function onSetObj(target, paths, value) {
|
|
39
|
-
while (paths.length > 0) {
|
|
40
|
-
var path = paths.shift();
|
|
41
|
-
if (paths.length > 0) {
|
|
42
|
-
if (!target[path]) target[path] = {};
|
|
43
|
-
onSetObj(target[path], paths, value);
|
|
44
|
-
} else {
|
|
45
|
-
target[path] = value;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
// table 事件
|
|
50
|
-
export var TableEvent = /*#__PURE__*/function (TableEvent) {
|
|
51
|
-
TableEvent["Search"] = "search";
|
|
52
|
-
TableEvent["Reset"] = "reset";
|
|
53
|
-
TableEvent["Reload"] = "reload";
|
|
54
|
-
TableEvent["ChangePage"] = "changePage";
|
|
55
|
-
TableEvent["InitSearch"] = "initSearch";
|
|
56
|
-
TableEvent["FullScreen"] = "fullScreen";
|
|
57
|
-
TableEvent["ColumnFilter"] = "columnFilter";
|
|
58
|
-
TableEvent["SelectedRows"] = "SelectedRows";
|
|
59
|
-
TableEvent["Expand"] = "Expand";
|
|
60
|
-
TableEvent["PartialReload"] = "PartialReload";
|
|
61
|
-
return TableEvent;
|
|
62
|
-
}({}); // 异步树局部刷新
|
|
63
|
-
export var classPrefix = 'ccs-pl';
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* 布局组件 包括form、查询、toolbar、table 自动初始化数据
|
|
67
|
-
* @param CcsProTableType
|
|
68
|
-
* @param ref
|
|
69
|
-
* @returns
|
|
70
|
-
*/
|
|
71
|
-
var InternalProTable = function InternalProTable(props) {
|
|
72
|
-
var _table$scroll2, _table$scroll3;
|
|
73
|
-
var init = props.init,
|
|
74
|
-
auth = props.auth,
|
|
75
|
-
table = props.table,
|
|
76
|
-
_props$styles = props.styles,
|
|
77
|
-
styles = _props$styles === void 0 ? {} : _props$styles,
|
|
78
|
-
proRef = props.proRef,
|
|
79
|
-
toolbar = props.toolbar,
|
|
80
|
-
children = props.children,
|
|
81
|
-
className = props.className,
|
|
82
|
-
expandForm = props.expandForm,
|
|
83
|
-
_props$formItems = props.formItems,
|
|
84
|
-
formItems = _props$formItems === void 0 ? [] : _props$formItems,
|
|
85
|
-
leafNode = props.leafNode,
|
|
86
|
-
bordered = props.bordered,
|
|
87
|
-
parentFieldName = props.parentFieldName,
|
|
88
|
-
_props$formInitValues = props.formInitValues,
|
|
89
|
-
formInitValues = _props$formInitValues === void 0 ? {} : _props$formInitValues,
|
|
90
|
-
onEvent = props.onEvent;
|
|
91
|
-
var _useCcsPage = useCcsPage(),
|
|
92
|
-
onAuth = _useCcsPage.onAuth;
|
|
93
|
-
var config = useContext(ConfigContext);
|
|
94
|
-
var _ref = table || {},
|
|
95
|
-
pagination = _ref.pagination,
|
|
96
|
-
_ref$requestParam = _ref.requestParam,
|
|
97
|
-
requestParam = _ref$requestParam === void 0 ? {} : _ref$requestParam,
|
|
98
|
-
columns = _ref.columns,
|
|
99
|
-
rowKey = _ref.rowKey,
|
|
100
|
-
httpRequest = _ref.request;
|
|
101
|
-
// table sticky
|
|
102
|
-
var stickyRef = useRef(false);
|
|
103
|
-
|
|
104
|
-
// 字段默认过滤,排序值
|
|
105
|
-
var defaultColumnValues = useMemo(function () {
|
|
106
|
-
var defaultValue = {
|
|
107
|
-
filters: {},
|
|
108
|
-
orderProps: []
|
|
109
|
-
};
|
|
110
|
-
columns === null || columns === void 0 || columns.forEach(function (c) {
|
|
111
|
-
// 排序
|
|
112
|
-
if (c.sorter && c.defaultSortOrder !== undefined) {
|
|
113
|
-
defaultValue.orderProps.push({
|
|
114
|
-
prop: c.dataIndex,
|
|
115
|
-
ascending: c.defaultSortOrder === 'ascend'
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// 过滤
|
|
120
|
-
if (c.filters && c.defaultFilteredValue !== undefined) {
|
|
121
|
-
defaultValue.filters[c.dataIndex] = c.defaultFilteredValue;
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
return defaultValue;
|
|
125
|
-
}, []);
|
|
126
|
-
|
|
127
|
-
// column filter
|
|
128
|
-
var filterOrderRef = useRef(defaultColumnValues);
|
|
129
|
-
// table content
|
|
130
|
-
var tableContentRef = useRef(null);
|
|
131
|
-
// container
|
|
132
|
-
var containerRef = useRef(null);
|
|
133
|
-
// table ref
|
|
134
|
-
var tableRef = useRef();
|
|
135
|
-
// 查询form
|
|
136
|
-
var formRef = useRef(null);
|
|
137
|
-
// table data
|
|
138
|
-
var _useState = useState({
|
|
139
|
-
total: 0,
|
|
140
|
-
dataSource: [],
|
|
141
|
-
pageSize: 10,
|
|
142
|
-
current: 1
|
|
143
|
-
}),
|
|
144
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
145
|
-
data = _useState2[0],
|
|
146
|
-
setData = _useState2[1];
|
|
147
|
-
var treeRef = useRef(null);
|
|
148
|
-
var _useState3 = useState((table === null || table === void 0 ? void 0 : table.size) || 'middle'),
|
|
149
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
150
|
-
tableRowSize = _useState4[0],
|
|
151
|
-
setTableRowSize = _useState4[1];
|
|
152
|
-
// 上下文配置
|
|
153
|
-
var _useAppConfig = useAppConfig(),
|
|
154
|
-
theme = _useAppConfig.theme;
|
|
155
|
-
// 接口字段指定全局配置
|
|
156
|
-
var globalFieldNames = useProTableFields();
|
|
157
|
-
var _antTheme$useToken = antTheme.useToken(),
|
|
158
|
-
token = _antTheme$useToken.token;
|
|
159
|
-
|
|
160
|
-
// 暗黑模式
|
|
161
|
-
var isDark = theme === 'dark';
|
|
162
|
-
|
|
163
|
-
// 权限判断
|
|
164
|
-
var isAuth = useMemo(function () {
|
|
165
|
-
if (auth) return onAuth && onAuth(auth);
|
|
166
|
-
return true;
|
|
167
|
-
}, [auth]);
|
|
168
|
-
var formatFormItems = useMemo(function () {
|
|
169
|
-
return formItems.flat(Infinity).filter(function (f) {
|
|
170
|
-
return f.onFormat;
|
|
171
|
-
});
|
|
172
|
-
}, []);
|
|
173
|
-
|
|
174
|
-
// 构建查询条件:表单数据、请求额外参数、分页参数、其他参数
|
|
175
|
-
var getFormValues = /*#__PURE__*/function () {
|
|
176
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
177
|
-
var _formRef$current;
|
|
178
|
-
var formValues, _delField;
|
|
179
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
180
|
-
while (1) switch (_context.prev = _context.next) {
|
|
181
|
-
case 0:
|
|
182
|
-
_context.next = 2;
|
|
183
|
-
return (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.validateFields();
|
|
184
|
-
case 2:
|
|
185
|
-
formValues = _context.sent;
|
|
186
|
-
// 删除无意义字段
|
|
187
|
-
if (formValues) {
|
|
188
|
-
_delField = Object.keys(formValues).filter(function (k) {
|
|
189
|
-
return k.startsWith('_') && k.endsWith('_');
|
|
190
|
-
});
|
|
191
|
-
if (_delField.length > 0) {
|
|
192
|
-
_delField.forEach(function (d) {
|
|
193
|
-
return delete formValues[d];
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
if (formatFormItems.length) {
|
|
198
|
-
// 格式化条件
|
|
199
|
-
Object.keys(formValues).forEach(function (k) {
|
|
200
|
-
if (formValues[k] !== undefined) {
|
|
201
|
-
var s = formatFormItems.find(function (f) {
|
|
202
|
-
return f.name === k;
|
|
203
|
-
});
|
|
204
|
-
if (s) formValues[k] = s.onFormat && s.onFormat(formValues[k]);
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread({}, requestParam), formInitValues), formValues));
|
|
209
|
-
case 6:
|
|
210
|
-
case "end":
|
|
211
|
-
return _context.stop();
|
|
212
|
-
}
|
|
213
|
-
}, _callee);
|
|
214
|
-
}));
|
|
215
|
-
return function getFormValues() {
|
|
216
|
-
return _ref2.apply(this, arguments);
|
|
217
|
-
};
|
|
218
|
-
}();
|
|
219
|
-
|
|
220
|
-
// 获取数据
|
|
221
|
-
var onRequest = /*#__PURE__*/function () {
|
|
222
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(eventType) {
|
|
223
|
-
var _props$table;
|
|
224
|
-
var pageNo,
|
|
225
|
-
pageSize,
|
|
226
|
-
record,
|
|
227
|
-
allParams,
|
|
228
|
-
fieldNames,
|
|
229
|
-
_fieldNames$requestPa,
|
|
230
|
-
_fieldNames$requestPa2,
|
|
231
|
-
fsFilters,
|
|
232
|
-
_fieldNames$requestPa3,
|
|
233
|
-
fsPageNo,
|
|
234
|
-
_fieldNames$requestPa4,
|
|
235
|
-
fsPageSize,
|
|
236
|
-
_fieldNames$requestPa5,
|
|
237
|
-
fsOrderProps,
|
|
238
|
-
fsQuery,
|
|
239
|
-
params,
|
|
240
|
-
_filterOrderRef$curre,
|
|
241
|
-
filters,
|
|
242
|
-
orderProps,
|
|
243
|
-
_treeRef$current,
|
|
244
|
-
requestResult,
|
|
245
|
-
dataSource,
|
|
246
|
-
total,
|
|
247
|
-
newData,
|
|
248
|
-
_args2 = arguments;
|
|
249
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
250
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
251
|
-
case 0:
|
|
252
|
-
pageNo = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : 1;
|
|
253
|
-
pageSize = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : (pagination ? pagination.defaultPageSize : 10) || 10;
|
|
254
|
-
record = _args2.length > 3 ? _args2[3] : undefined;
|
|
255
|
-
if (!(!isAuth || !httpRequest)) {
|
|
256
|
-
_context2.next = 5;
|
|
257
|
-
break;
|
|
258
|
-
}
|
|
259
|
-
return _context2.abrupt("return");
|
|
260
|
-
case 5:
|
|
261
|
-
_context2.next = 7;
|
|
262
|
-
return getFormValues();
|
|
263
|
-
case 7:
|
|
264
|
-
allParams = _context2.sent;
|
|
265
|
-
// 接口字段指定
|
|
266
|
-
fieldNames = _objectSpread(_objectSpread({}, globalFieldNames), (_props$table = props.table) === null || _props$table === void 0 ? void 0 : _props$table.fieldNames); // 请求字段
|
|
267
|
-
_fieldNames$requestPa = fieldNames.requestParam, _fieldNames$requestPa2 = _fieldNames$requestPa.filters, fsFilters = _fieldNames$requestPa2 === void 0 ? ['filters'] : _fieldNames$requestPa2, _fieldNames$requestPa3 = _fieldNames$requestPa.pageNo, fsPageNo = _fieldNames$requestPa3 === void 0 ? ['pageNo'] : _fieldNames$requestPa3, _fieldNames$requestPa4 = _fieldNames$requestPa.pageSize, fsPageSize = _fieldNames$requestPa4 === void 0 ? ['pageSize'] : _fieldNames$requestPa4, _fieldNames$requestPa5 = _fieldNames$requestPa.orderProps, fsOrderProps = _fieldNames$requestPa5 === void 0 ? ['orderProps'] : _fieldNames$requestPa5, fsQuery = _fieldNames$requestPa.query; // 构建请求参数
|
|
268
|
-
params = {};
|
|
269
|
-
if (fsQuery && fsQuery.length > 0) {
|
|
270
|
-
onSetObj(params, _toConsumableArray(fsQuery), allParams);
|
|
271
|
-
} else {
|
|
272
|
-
params = allParams;
|
|
273
|
-
}
|
|
274
|
-
if (pagination !== false) {
|
|
275
|
-
// 分页
|
|
276
|
-
onSetObj(params, _toConsumableArray(fsPageNo), pageNo);
|
|
277
|
-
onSetObj(params, _toConsumableArray(fsPageSize), pageSize);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
// 列过滤或排序参数
|
|
281
|
-
_filterOrderRef$curre = filterOrderRef.current, filters = _filterOrderRef$curre.filters, orderProps = _filterOrderRef$curre.orderProps;
|
|
282
|
-
if (Object.keys(filters).length > 0) {
|
|
283
|
-
onSetObj(params, _toConsumableArray(fsFilters), filters);
|
|
284
|
-
}
|
|
285
|
-
if (orderProps.length > 0) {
|
|
286
|
-
onSetObj(params, _toConsumableArray(fsOrderProps), orderProps);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
// 异步树
|
|
290
|
-
if (!parentFieldName) {
|
|
291
|
-
_context2.next = 19;
|
|
292
|
-
break;
|
|
293
|
-
}
|
|
294
|
-
(_treeRef$current = treeRef.current) === null || _treeRef$current === void 0 || _treeRef$current.onRequestTree(eventType, params.query, record);
|
|
295
|
-
return _context2.abrupt("return");
|
|
296
|
-
case 19:
|
|
297
|
-
// 事件回调,请求中
|
|
298
|
-
onEvent === null || onEvent === void 0 || onEvent(eventType, {
|
|
299
|
-
loading: true,
|
|
300
|
-
params: params
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
// 发起请求
|
|
304
|
-
setData(function (d) {
|
|
305
|
-
return _objectSpread(_objectSpread({}, d), {}, {
|
|
306
|
-
loading: true
|
|
307
|
-
});
|
|
308
|
-
});
|
|
309
|
-
_context2.next = 23;
|
|
310
|
-
return httpRequest(params);
|
|
311
|
-
case 23:
|
|
312
|
-
requestResult = _context2.sent;
|
|
313
|
-
// 事件回调,请求完成
|
|
314
|
-
onEvent === null || onEvent === void 0 || onEvent(eventType, {
|
|
315
|
-
loading: false,
|
|
316
|
-
params: params,
|
|
317
|
-
data: requestResult
|
|
318
|
-
});
|
|
319
|
-
|
|
320
|
-
// 请求结果
|
|
321
|
-
if (!requestResult) {
|
|
322
|
-
_context2.next = 35;
|
|
323
|
-
break;
|
|
324
|
-
}
|
|
325
|
-
// 获取table数据
|
|
326
|
-
dataSource = getDataByNamePath(requestResult, fieldNames.dataSource); // 默认添加一条数据
|
|
327
|
-
if (table !== null && table !== void 0 && table.emptyDefaultOne && dataSource && dataSource.length === 0) {
|
|
328
|
-
dataSource.push(_defineProperty({}, rowKey || 'id', '0'));
|
|
329
|
-
}
|
|
330
|
-
total = getDataByNamePath(requestResult, fieldNames.total);
|
|
331
|
-
if (!(total === undefined || dataSource === undefined)) {
|
|
332
|
-
_context2.next = 33;
|
|
333
|
-
break;
|
|
334
|
-
}
|
|
335
|
-
newData = {
|
|
336
|
-
dataSource: dataSource,
|
|
337
|
-
pageSize: pageSize,
|
|
338
|
-
current: pageNo,
|
|
339
|
-
total: total,
|
|
340
|
-
loading: false
|
|
341
|
-
};
|
|
342
|
-
setData(newData);
|
|
343
|
-
return _context2.abrupt("return");
|
|
344
|
-
case 33:
|
|
345
|
-
// 当前页无数据,返回上一页
|
|
346
|
-
if (!dataSource.length && pageNo !== 1) {
|
|
347
|
-
onRequest(TableEvent.Reload, pageNo - 1);
|
|
348
|
-
} else {
|
|
349
|
-
setData({
|
|
350
|
-
current: pageNo,
|
|
351
|
-
pageSize: pageSize,
|
|
352
|
-
loading: false,
|
|
353
|
-
dataSource: dataSource,
|
|
354
|
-
total: total || 0
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
return _context2.abrupt("return");
|
|
358
|
-
case 35:
|
|
359
|
-
setData(function (d) {
|
|
360
|
-
return _objectSpread(_objectSpread({}, d), {}, {
|
|
361
|
-
loading: false
|
|
362
|
-
});
|
|
363
|
-
});
|
|
364
|
-
case 36:
|
|
365
|
-
case "end":
|
|
366
|
-
return _context2.stop();
|
|
367
|
-
}
|
|
368
|
-
}, _callee2);
|
|
369
|
-
}));
|
|
370
|
-
return function onRequest(_x) {
|
|
371
|
-
return _ref3.apply(this, arguments);
|
|
372
|
-
};
|
|
373
|
-
}();
|
|
374
|
-
|
|
375
|
-
// 异步树、局部刷新方法
|
|
376
|
-
var _onPartialReload = function onPartialReload(id) {
|
|
377
|
-
var _treeRef$current2, _treeRef$current3;
|
|
378
|
-
// 查找需要刷新的节点
|
|
379
|
-
var treeNode = getDataById(data.dataSource || [], rowKey, id);
|
|
380
|
-
// 没有查找到、全部刷新
|
|
381
|
-
if (!treeNode) {
|
|
382
|
-
onRequest(TableEvent.Search);
|
|
383
|
-
return;
|
|
384
|
-
}
|
|
385
|
-
// 获取所有下级ID
|
|
386
|
-
var ids = getAllChildrenId(treeNode.children || [], rowKey);
|
|
387
|
-
// 局部重载
|
|
388
|
-
(_treeRef$current2 = treeRef.current) === null || _treeRef$current2 === void 0 || _treeRef$current2.onExpandKeys(ids);
|
|
389
|
-
(_treeRef$current3 = treeRef.current) === null || _treeRef$current3 === void 0 || _treeRef$current3.onRequestTree(TableEvent.PartialReload, {}, treeNode);
|
|
390
|
-
};
|
|
391
|
-
useEffect(function () {
|
|
392
|
-
// 判断是否在弹出框中
|
|
393
|
-
var inMd = onTableInModalOrDrawer(tableContentRef.current, config.getPrefixCls());
|
|
394
|
-
if (inMd) {
|
|
395
|
-
stickyRef.current = inMd;
|
|
396
|
-
// 弹框中行尺寸默认设置为small
|
|
397
|
-
if (!(table !== null && table !== void 0 && table.size)) setTableRowSize('small');
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
// 判断在tab中
|
|
402
|
-
var inTab = onTableInTabItem(tableContentRef.current);
|
|
403
|
-
if (inTab) {
|
|
404
|
-
stickyRef.current = inTab;
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
}, []);
|
|
408
|
-
|
|
409
|
-
// size参数变化
|
|
410
|
-
useUpdateEffect(function () {
|
|
411
|
-
setTableRowSize((table === null || table === void 0 ? void 0 : table.size) || 'middle');
|
|
412
|
-
}, [table === null || table === void 0 ? void 0 : table.size]);
|
|
413
|
-
|
|
414
|
-
// 初始查询
|
|
415
|
-
useEffect(function () {
|
|
416
|
-
if (init !== false && httpRequest) {
|
|
417
|
-
onRequest(TableEvent.InitSearch);
|
|
418
|
-
}
|
|
419
|
-
}, [Object.keys(requestParam || {}).toString(), Object.values(requestParam || {}).toString()]);
|
|
420
|
-
|
|
421
|
-
// 查询按钮
|
|
422
|
-
var onSearch = function onSearch() {
|
|
423
|
-
var _table$rowSelection, _table$rowSelection$o;
|
|
424
|
-
// @ts-ignore
|
|
425
|
-
table === null || table === void 0 || (_table$rowSelection = table.rowSelection) === null || _table$rowSelection === void 0 || (_table$rowSelection$o = _table$rowSelection.onClearByProTable) === null || _table$rowSelection$o === void 0 || _table$rowSelection$o.call(_table$rowSelection);
|
|
426
|
-
onRequest(TableEvent.Search);
|
|
427
|
-
};
|
|
428
|
-
|
|
429
|
-
// 重置
|
|
430
|
-
var onReset = function onReset() {
|
|
431
|
-
var _table$rowSelection2, _table$rowSelection2$, _formRef$current2;
|
|
432
|
-
// @ts-ignore
|
|
433
|
-
table === null || table === void 0 || (_table$rowSelection2 = table.rowSelection) === null || _table$rowSelection2 === void 0 || (_table$rowSelection2$ = _table$rowSelection2.onClearByProTable) === null || _table$rowSelection2$ === void 0 || _table$rowSelection2$.call(_table$rowSelection2);
|
|
434
|
-
// 重置表单
|
|
435
|
-
(_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 || _formRef$current2.resetFields();
|
|
436
|
-
// 清空columns显示filter和sort值
|
|
437
|
-
columns === null || columns === void 0 || columns.forEach(function (c) {
|
|
438
|
-
if (c.filterDropdown || c.filters) {
|
|
439
|
-
c.filteredValue = c.defaultFilteredValue;
|
|
440
|
-
}
|
|
441
|
-
if (c.sorter) {
|
|
442
|
-
c.sortOrder = c.defaultSortOrder;
|
|
443
|
-
}
|
|
444
|
-
});
|
|
445
|
-
// 清空filter请求值
|
|
446
|
-
filterOrderRef.current = defaultColumnValues;
|
|
447
|
-
onRequest(TableEvent.Reset);
|
|
448
|
-
};
|
|
449
|
-
|
|
450
|
-
// 刷新
|
|
451
|
-
var onReload = function onReload() {
|
|
452
|
-
var _table$rowSelection3, _table$rowSelection3$;
|
|
453
|
-
// @ts-ignore
|
|
454
|
-
table === null || table === void 0 || (_table$rowSelection3 = table.rowSelection) === null || _table$rowSelection3 === void 0 || (_table$rowSelection3$ = _table$rowSelection3.onClearByProTable) === null || _table$rowSelection3$ === void 0 || _table$rowSelection3$.call(_table$rowSelection3);
|
|
455
|
-
onRequest(TableEvent.Reload, data.current, data.pageSize);
|
|
456
|
-
};
|
|
457
|
-
|
|
458
|
-
// form 数据 查询,重载,重置方法
|
|
459
|
-
useImperativeHandle(proRef, function () {
|
|
460
|
-
return {
|
|
461
|
-
data: data,
|
|
462
|
-
getFormValues: getFormValues,
|
|
463
|
-
onSearch: onSearch,
|
|
464
|
-
onReload: onReload,
|
|
465
|
-
onPartialReload: function onPartialReload(param) {
|
|
466
|
-
_onPartialReload(param);
|
|
467
|
-
},
|
|
468
|
-
onReset: onReset,
|
|
469
|
-
onChangeData: setData
|
|
470
|
-
};
|
|
471
|
-
});
|
|
472
|
-
|
|
473
|
-
// 分页查询
|
|
474
|
-
var handlePageChange = function handlePageChange(paginationTable, filters, sorter) {
|
|
475
|
-
// 记录filter,sorter,以便重置的时候可以清除数据
|
|
476
|
-
if (filters) {
|
|
477
|
-
columns === null || columns === void 0 || columns.forEach(function (c) {
|
|
478
|
-
if (c.filterDropdown || c.filters) {
|
|
479
|
-
// @ts-ignore
|
|
480
|
-
c.filteredValue = filters[c.dataIndex];
|
|
481
|
-
}
|
|
482
|
-
});
|
|
483
|
-
filterOrderRef.current = _objectSpread(_objectSpread({}, filterOrderRef.current), {}, {
|
|
484
|
-
filters: filters
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
if (sorter) {
|
|
488
|
-
columns === null || columns === void 0 || columns.forEach(function (c) {
|
|
489
|
-
if (c.sorter) {
|
|
490
|
-
if (Array.isArray(sorter)) {
|
|
491
|
-
// @ts-ignore
|
|
492
|
-
var curSorter = sorter.find(function (sort) {
|
|
493
|
-
return sort.field === c.dataIndex;
|
|
494
|
-
});
|
|
495
|
-
if (curSorter) c.sortOrder = curSorter === null || curSorter === void 0 ? void 0 : curSorter.order;
|
|
496
|
-
return;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
// @ts-ignore
|
|
500
|
-
if (sorter.field === c.dataIndex) {
|
|
501
|
-
c.sortOrder = sorter.order;
|
|
502
|
-
return;
|
|
503
|
-
}
|
|
504
|
-
c.sortOrder = undefined;
|
|
505
|
-
}
|
|
506
|
-
});
|
|
507
|
-
|
|
508
|
-
// 设置orderProps 与后端保持一致
|
|
509
|
-
var orderProps = [];
|
|
510
|
-
if (Array.isArray(sorter)) {
|
|
511
|
-
sorter.forEach(function (s) {
|
|
512
|
-
orderProps.push({
|
|
513
|
-
prop: s.field,
|
|
514
|
-
ascending: s.order === 'ascend'
|
|
515
|
-
});
|
|
516
|
-
});
|
|
517
|
-
} else {
|
|
518
|
-
if (sorter.order) {
|
|
519
|
-
orderProps.push({
|
|
520
|
-
prop: sorter.field,
|
|
521
|
-
ascending: sorter.order === 'ascend'
|
|
522
|
-
});
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
filterOrderRef.current = _objectSpread(_objectSpread({}, filterOrderRef.current), {}, {
|
|
526
|
-
orderProps: orderProps
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
onRequest(TableEvent.ChangePage, paginationTable.current || 0, paginationTable.pageSize || 10);
|
|
530
|
-
};
|
|
531
|
-
var renderTable = function renderTable() {
|
|
532
|
-
if (!table) return null;
|
|
533
|
-
if (!isAuth) {
|
|
534
|
-
return /*#__PURE__*/_jsx(Empty, {
|
|
535
|
-
style: {
|
|
536
|
-
margin: 0,
|
|
537
|
-
padding: '32px 0',
|
|
538
|
-
color: 'red',
|
|
539
|
-
background: '#fff'
|
|
540
|
-
},
|
|
541
|
-
image: Empty.PRESENTED_IMAGE_DEFAULT,
|
|
542
|
-
description: "\u6CA1\u6709\u6570\u636E\u8BF7\u6C42\u6743\u9650"
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
if (_typeof(stickyRef.current) === 'object' && 'getContainer' in stickyRef.current) {
|
|
546
|
-
// 判断吸顶dom是否有paddingTop,设置offsetHeader
|
|
547
|
-
var dom = stickyRef.current.getContainer();
|
|
548
|
-
var _window$getComputedSt = window.getComputedStyle(dom),
|
|
549
|
-
paddingTop = _window$getComputedSt.paddingTop;
|
|
550
|
-
if (paddingTop) {
|
|
551
|
-
stickyRef.current = _objectSpread(_objectSpread({}, stickyRef.current), {}, {
|
|
552
|
-
offsetHeader: -parseInt(paddingTop.replace('px', ''))
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
// 异步树
|
|
558
|
-
if (parentFieldName) {
|
|
559
|
-
return /*#__PURE__*/_jsx(TableTree, {
|
|
560
|
-
data: data,
|
|
561
|
-
table: table,
|
|
562
|
-
leafNode: leafNode,
|
|
563
|
-
treeRef: treeRef,
|
|
564
|
-
tableRef: tableRef,
|
|
565
|
-
tableContentRef: tableContentRef,
|
|
566
|
-
tableRowSize: tableRowSize,
|
|
567
|
-
sticky: stickyRef.current || true,
|
|
568
|
-
parentFieldName: parentFieldName,
|
|
569
|
-
setData: setData,
|
|
570
|
-
onEvent: onEvent,
|
|
571
|
-
handlePageChange: handlePageChange
|
|
572
|
-
});
|
|
573
|
-
}
|
|
574
|
-
return /*#__PURE__*/_jsx(CcsTable, _objectSpread(_objectSpread({
|
|
575
|
-
data: data,
|
|
576
|
-
tableRef: tableRef,
|
|
577
|
-
tableContentRef: tableContentRef,
|
|
578
|
-
onChange: handlePageChange,
|
|
579
|
-
sticky: stickyRef.current || true
|
|
580
|
-
}, table), {}, {
|
|
581
|
-
size: tableRowSize,
|
|
582
|
-
columns: columns,
|
|
583
|
-
showSorterTooltip: true,
|
|
584
|
-
showNumber: props.showNumber,
|
|
585
|
-
loading: table.loading || data.loading || false,
|
|
586
|
-
onEvent: onEvent
|
|
587
|
-
}));
|
|
588
|
-
};
|
|
589
|
-
var rootStyle = styles.root || {};
|
|
590
|
-
if (bordered) {
|
|
591
|
-
rootStyle = _objectSpread({
|
|
592
|
-
border: "1px solid ".concat(token.colorBorderSecondary),
|
|
593
|
-
borderRadius: 4
|
|
594
|
-
}, rootStyle);
|
|
595
|
-
}
|
|
596
|
-
var onFullScreen = function onFullScreen(isFull) {
|
|
597
|
-
var _ref4 = containerRef.current || {},
|
|
598
|
-
classList = _ref4.classList,
|
|
599
|
-
style = _ref4.style;
|
|
600
|
-
if (isFull) {
|
|
601
|
-
classList === null || classList === void 0 || classList.add('css-table-full');
|
|
602
|
-
style.backgroundColor = token.colorBgContainer;
|
|
603
|
-
} else {
|
|
604
|
-
classList === null || classList === void 0 || classList.remove('css-table-full');
|
|
605
|
-
style.backgroundColor = 'transparent';
|
|
606
|
-
}
|
|
607
|
-
};
|
|
608
|
-
|
|
609
|
-
// 尺寸变化重设尺寸
|
|
610
|
-
var resizeFn = function resizeFn() {
|
|
611
|
-
var _table$scroll, _tableContentRef$curr;
|
|
612
|
-
if ((table === null || table === void 0 || (_table$scroll = table.scroll) === null || _table$scroll === void 0 ? void 0 : _table$scroll.y) === 'auto' && ((_tableContentRef$curr = tableContentRef.current) === null || _tableContentRef$curr === void 0 ? void 0 : _tableContentRef$curr.clientHeight) !== 0) {
|
|
613
|
-
var _tableRef$current;
|
|
614
|
-
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 || _tableRef$current.onFixedThead();
|
|
615
|
-
}
|
|
616
|
-
};
|
|
617
|
-
|
|
618
|
-
// 监听容器尺寸变化
|
|
619
|
-
var onResize = _debounce(resizeFn, 500);
|
|
620
|
-
|
|
621
|
-
// table 操作按钮
|
|
622
|
-
var renderTableOperation = (table === null || table === void 0 ? void 0 : table.hideOperation) !== true ? /*#__PURE__*/_jsx(TableOperation, {
|
|
623
|
-
onChangeRowSize: function onChangeRowSize(e) {
|
|
624
|
-
return setTableRowSize(e);
|
|
625
|
-
},
|
|
626
|
-
tableRowSize: tableRowSize,
|
|
627
|
-
onReset: onReset,
|
|
628
|
-
columns: columns,
|
|
629
|
-
tableRef: tableRef,
|
|
630
|
-
onFullScreen: onFullScreen
|
|
631
|
-
}) : undefined;
|
|
632
|
-
|
|
633
|
-
// 有查询条件
|
|
634
|
-
var hasFormItem = formItems.length > 0;
|
|
635
|
-
// 头部间距
|
|
636
|
-
var tokenPadding = tableRowSize === 'small' ? token.paddingSM : token.padding;
|
|
637
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
638
|
-
children: [/*#__PURE__*/_jsx(CcsResizeObserver.Target, {
|
|
639
|
-
targetRef: tableContentRef,
|
|
640
|
-
onResize: onResize
|
|
641
|
-
}), /*#__PURE__*/_jsxs("div", {
|
|
642
|
-
className: classNames(classPrefix, className, _defineProperty({}, 'dark-table', isDark)),
|
|
643
|
-
style: _objectSpread(_objectSpread({}, rootStyle), (table === null || table === void 0 || (_table$scroll2 = table.scroll) === null || _table$scroll2 === void 0 ? void 0 : _table$scroll2.y) === 'auto' ? {
|
|
644
|
-
overflow: 'hidden',
|
|
645
|
-
height: '100%'
|
|
646
|
-
} : {}),
|
|
647
|
-
ref: containerRef,
|
|
648
|
-
children: [/*#__PURE__*/_jsx(Card, {
|
|
649
|
-
style: {
|
|
650
|
-
boxShadow: 'none',
|
|
651
|
-
borderRadius: 0
|
|
652
|
-
},
|
|
653
|
-
styles: {
|
|
654
|
-
body: {
|
|
655
|
-
padding: hasFormItem ? tokenPadding : 0
|
|
656
|
-
}
|
|
657
|
-
},
|
|
658
|
-
variant: "borderless",
|
|
659
|
-
title: props.title,
|
|
660
|
-
children: hasFormItem && /*#__PURE__*/_jsx(HeadComponent, {
|
|
661
|
-
formRef: formRef,
|
|
662
|
-
toolbar: toolbar,
|
|
663
|
-
formItems: formItems,
|
|
664
|
-
expandForm: expandForm,
|
|
665
|
-
formInitValues: formInitValues,
|
|
666
|
-
formItemLabelWidth: props.formItemLabelWidth,
|
|
667
|
-
onSearch: onSearch,
|
|
668
|
-
tableOperation: renderTableOperation
|
|
669
|
-
})
|
|
670
|
-
}), (toolbar || !hasFormItem && renderTableOperation) && /*#__PURE__*/_jsxs(Card, {
|
|
671
|
-
styles: {
|
|
672
|
-
cover: {
|
|
673
|
-
borderRadius: 0
|
|
674
|
-
},
|
|
675
|
-
body: {
|
|
676
|
-
display: 'flex',
|
|
677
|
-
justifyContent: 'space-between',
|
|
678
|
-
width: '100%',
|
|
679
|
-
padding: "".concat(token.paddingSM, "px ").concat(tokenPadding, "px"),
|
|
680
|
-
alignContent: 'center'
|
|
681
|
-
}
|
|
682
|
-
},
|
|
683
|
-
style: {
|
|
684
|
-
borderRadius: 0,
|
|
685
|
-
borderLeft: 0,
|
|
686
|
-
borderBottom: 0,
|
|
687
|
-
borderRight: 0,
|
|
688
|
-
borderTop: !hasFormItem ? 0 : undefined
|
|
689
|
-
},
|
|
690
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
691
|
-
style: {
|
|
692
|
-
flex: '1 1 auto'
|
|
693
|
-
},
|
|
694
|
-
children: toolbar
|
|
695
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
696
|
-
style: {
|
|
697
|
-
flex: '0 0 auto'
|
|
698
|
-
},
|
|
699
|
-
children: renderTableOperation
|
|
700
|
-
})]
|
|
701
|
-
}), /*#__PURE__*/_jsxs("div", {
|
|
702
|
-
className: "".concat(classPrefix, "-table-content"),
|
|
703
|
-
style: _objectSpread(_objectSpread({}, styles === null || styles === void 0 ? void 0 : styles.table), {}, {
|
|
704
|
-
overflow: (table === null || table === void 0 || (_table$scroll3 = table.scroll) === null || _table$scroll3 === void 0 ? void 0 : _table$scroll3.y) === 'auto' ? 'hidden' : 'unset'
|
|
705
|
-
}),
|
|
706
|
-
ref: tableContentRef,
|
|
707
|
-
children: [renderTable(), children]
|
|
708
|
-
})]
|
|
709
|
-
})]
|
|
710
|
-
});
|
|
711
|
-
};
|
|
712
|
-
export default InternalProTable;
|