@4399ywkf/design 1.3.12 → 2.1.0

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.
Files changed (114) hide show
  1. package/dist/MaxTokenSlider/index.d.ts +25 -0
  2. package/dist/MaxTokenSlider/index.js +148 -0
  3. package/dist/MaxTokenSlider/style.d.ts +6 -0
  4. package/dist/MaxTokenSlider/style.js +14 -0
  5. package/dist/Table/components/ColumnSetting/index.js +25 -35
  6. package/dist/Table/components/ColumnSetting/style.d.ts +16 -0
  7. package/dist/Table/components/ColumnSetting/style.js +19 -0
  8. package/dist/Table/components/EnumFilter/index.d.ts +8 -8
  9. package/dist/Table/components/EnumFilter/index.js +34 -36
  10. package/dist/Table/components/EnumFilter/style.d.ts +54 -0
  11. package/dist/Table/components/EnumFilter/style.js +58 -0
  12. package/dist/Table/components/Export/RadioMode.d.ts +1 -5
  13. package/dist/Table/components/Export/RadioMode.js +10 -11
  14. package/dist/Table/components/Export/index.js +160 -207
  15. package/dist/Table/components/Export/style.d.ts +15 -0
  16. package/dist/Table/components/Export/style.js +19 -0
  17. package/dist/Table/components/FilterDropdown/index.d.ts +7 -7
  18. package/dist/Table/components/FilterDropdown/index.js +6 -7
  19. package/dist/Table/components/FilterDropdown/style.d.ts +13 -0
  20. package/dist/Table/components/FilterDropdown/style.js +17 -0
  21. package/dist/Table/components/FilterKeys/index.d.ts +2 -2
  22. package/dist/Table/components/FilterKeys/index.js +51 -69
  23. package/dist/Table/components/FilterKeys/style.d.ts +29 -0
  24. package/dist/Table/components/FilterKeys/style.js +33 -0
  25. package/dist/Table/components/Reload/index.js +8 -21
  26. package/dist/Table/components/SearchInput/index.d.ts +3 -4
  27. package/dist/Table/components/SearchInput/index.js +50 -38
  28. package/dist/Table/components/SearchInput/style.d.ts +11 -0
  29. package/dist/Table/components/SearchInput/style.js +15 -0
  30. package/dist/Table/components/TableSize/index.js +7 -10
  31. package/dist/Table/components/TableTitle/index.d.ts +1 -1
  32. package/dist/Table/components/TableTitle/index.js +36 -38
  33. package/dist/Table/components/TableTitle/style.d.ts +25 -0
  34. package/dist/Table/components/TableTitle/style.js +29 -0
  35. package/dist/Table/context.d.ts +32 -0
  36. package/dist/Table/context.js +31 -0
  37. package/dist/Table/hooks/index.d.ts +8 -0
  38. package/dist/Table/hooks/index.js +8 -0
  39. package/dist/Table/hooks/useColumnsInit.d.ts +6 -0
  40. package/dist/Table/hooks/useColumnsInit.js +44 -0
  41. package/dist/Table/hooks/useEmptyText.d.ts +11 -0
  42. package/dist/Table/hooks/useEmptyText.js +34 -0
  43. package/dist/Table/hooks/usePagination.d.ts +9 -0
  44. package/dist/Table/hooks/usePagination.js +50 -0
  45. package/dist/Table/hooks/useQuerySnapshot.d.ts +6 -0
  46. package/dist/Table/hooks/useQuerySnapshot.js +63 -0
  47. package/dist/Table/hooks/useRowSelection.d.ts +11 -0
  48. package/dist/Table/hooks/useRowSelection.js +34 -0
  49. package/dist/Table/hooks/useSearchEffect.d.ts +9 -0
  50. package/dist/Table/hooks/useSearchEffect.js +48 -0
  51. package/dist/Table/hooks/useTableChange.d.ts +10 -0
  52. package/dist/Table/hooks/useTableChange.js +56 -0
  53. package/dist/Table/hooks/useTriggerSearch.d.ts +22 -0
  54. package/dist/Table/hooks/useTriggerSearch.js +130 -0
  55. package/dist/Table/index.d.ts +1 -1
  56. package/dist/Table/index.js +25 -1
  57. package/dist/Table/store/createStore.d.ts +2 -0
  58. package/dist/Table/store/createStore.js +30 -0
  59. package/dist/Table/store/hooks.d.ts +33 -0
  60. package/dist/Table/store/hooks.js +98 -0
  61. package/dist/Table/store/slices/column/actions.d.ts +9 -0
  62. package/dist/Table/store/slices/column/actions.js +10 -0
  63. package/dist/Table/store/slices/column/initialState.d.ts +2 -0
  64. package/dist/Table/store/slices/column/initialState.js +3 -0
  65. package/dist/Table/store/slices/persist/actions.d.ts +10 -0
  66. package/dist/Table/store/slices/persist/actions.js +28 -0
  67. package/dist/Table/store/slices/persist/api.d.ts +8 -0
  68. package/dist/Table/store/slices/persist/api.js +40 -0
  69. package/dist/Table/store/slices/query/actions.d.ts +32 -0
  70. package/dist/Table/store/slices/query/actions.js +129 -0
  71. package/dist/Table/store/slices/query/initialState.d.ts +2 -0
  72. package/dist/Table/store/slices/query/initialState.js +5 -0
  73. package/dist/Table/store/slices/request/actions.d.ts +8 -0
  74. package/dist/Table/store/slices/request/actions.js +14 -0
  75. package/dist/Table/store/slices/request/initialState.d.ts +2 -0
  76. package/dist/Table/store/slices/request/initialState.js +7 -0
  77. package/dist/Table/store/slices/ui/actions.d.ts +11 -0
  78. package/dist/Table/store/slices/ui/actions.js +15 -0
  79. package/dist/Table/store/slices/ui/initialState.d.ts +2 -0
  80. package/dist/Table/store/slices/ui/initialState.js +4 -0
  81. package/dist/Table/store/types.d.ts +79 -0
  82. package/dist/Table/store/types.js +1 -0
  83. package/dist/Table/style.d.ts +3 -0
  84. package/dist/Table/style.js +10 -0
  85. package/dist/Table/table.d.ts +2 -8
  86. package/dist/Table/table.js +160 -185
  87. package/dist/Table/type.d.ts +50 -64
  88. package/dist/Table/type.js +1 -3
  89. package/dist/Table/utils/Provide.d.ts +6 -9
  90. package/dist/Table/utils/Provide.js +4 -258
  91. package/dist/Table/utils/columnKey.d.ts +2 -0
  92. package/dist/Table/utils/columnKey.js +6 -0
  93. package/dist/Table/utils/getColumn.d.ts +7 -7
  94. package/dist/Table/utils/getColumnEnumProps.d.ts +4 -2
  95. package/dist/Table/utils/getColumnEnumProps.js +8 -6
  96. package/dist/Table/utils/getColumnMerge.d.ts +7 -2
  97. package/dist/Table/utils/getColumnMerge.js +3 -2
  98. package/dist/Table/utils/getDateColumn.d.ts +8 -7
  99. package/dist/Table/utils/getDateColumn.js +22 -68
  100. package/dist/Table/utils/getInputColumn.d.ts +2 -1
  101. package/dist/Table/utils/getInputColumn.js +2 -6
  102. package/dist/Table/utils/getSort.d.ts +4 -2
  103. package/dist/Table/utils/getSort.js +15 -12
  104. package/dist/Table/utils/index.d.ts +5 -20
  105. package/dist/Table/utils/index.js +16 -136
  106. package/dist/index.d.ts +2 -0
  107. package/dist/index.js +3 -0
  108. package/package.json +34 -25
  109. package/dist/Table/components/ColumnSetting/index.css +0 -4
  110. package/dist/Table/components/EnumFilter/index.css +0 -57
  111. package/dist/Table/components/FilterDropdown/index.css +0 -11
  112. package/dist/Table/components/FilterKeys/index.css +0 -19
  113. package/dist/Table/components/SearchInput/style.css +0 -10
  114. package/dist/Table/style.css +0 -42
@@ -1,16 +1,14 @@
1
- import React, { useContext } from 'react';
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
2
  import { Radio, Space } from 'antd';
3
- import { TableContext } from "../../utils/Provide";
4
- /**
5
- * 导出范围单选框
6
- * @constructor
7
- */
3
+ import React from 'react';
4
+ import { useTableContext } from "../../context";
8
5
  var RadioMode = function RadioMode(props) {
9
6
  var value = props.value,
10
7
  onChange = props.onChange;
11
- var _useContext = useContext(TableContext),
12
- isShowExport = _useContext.isShowExport,
13
- rowSelection = _useContext.rowSelection;
8
+ var ctx = useTableContext();
9
+ var isShowExport = ctx.isShowExport,
10
+ rowSelection = ctx.rowSelection;
11
+ var exportConfig = isShowExport && _typeof(isShowExport) === 'object' ? isShowExport : undefined;
14
12
  var radioOptions = [{
15
13
  label: '仅导出搜索结果',
16
14
  value: 'part'
@@ -21,11 +19,11 @@ var RadioMode = function RadioMode(props) {
21
19
  }, {
22
20
  label: '导出全部结果',
23
21
  value: 'all',
24
- disabled: !isShowExport.query
22
+ disabled: !(exportConfig !== null && exportConfig !== void 0 && exportConfig.query)
25
23
  }, {
26
24
  label: '导出全部结果(异步)',
27
25
  value: 'async',
28
- disabled: !isShowExport.query
26
+ disabled: !(exportConfig !== null && exportConfig !== void 0 && exportConfig.query)
29
27
  }];
30
28
  return /*#__PURE__*/React.createElement(Radio.Group, {
31
29
  value: value,
@@ -34,6 +32,7 @@ var RadioMode = function RadioMode(props) {
34
32
  direction: 'vertical'
35
33
  }, radioOptions.map(function (o) {
36
34
  return /*#__PURE__*/React.createElement(Radio, {
35
+ key: o.value,
37
36
  value: o.value,
38
37
  disabled: o.disabled
39
38
  }, o.label);
@@ -1,9 +1,3 @@
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
1
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
8
2
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
9
3
  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); }); }; }
@@ -13,214 +7,206 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
13
7
  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; }
14
8
  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; } }
15
9
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
- import React, { useContext, useEffect, useState } from 'react';
10
+ 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); }
11
+ 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; }
12
+ 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; }
13
+ 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; }
14
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
15
+ 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); }
17
16
  import { ExportOutlined } from '@ant-design/icons';
18
- import { StoreContext, TableContext } from "../../utils/Provide";
19
- import { genColumnKey } from "../../utils";
20
- import { message, Tooltip } from 'antd';
21
- import { Checkbox, Col, Modal, Row } from 'antd';
22
- import RadioMode from "./RadioMode";
17
+ import { Checkbox, Col, message, Modal, Row, Tooltip } from 'antd';
23
18
  import ExcelJs from 'exceljs';
24
- import { useStore } from 'zustand';
25
- var Export = function Export() {
26
- var _useContext = useContext(TableContext),
27
- propsColumns = _useContext.columns,
28
- isShowExport = _useContext.isShowExport;
29
- var _useState = useState(false),
30
- _useState2 = _slicedToArray(_useState, 2),
31
- open = _useState2[0],
32
- setOpen = _useState2[1];
33
- if (!isShowExport) return undefined;
34
- var handleOpenModal = function handleOpenModal() {
35
- console.log(3333);
36
- setOpen(function (e) {
37
- return !!!e;
38
- });
39
- };
40
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ExportModal, {
41
- open: open,
42
- onCancel: handleOpenModal
43
- }), /*#__PURE__*/React.createElement(Tooltip, {
44
- title: '导出数据'
45
- }, /*#__PURE__*/React.createElement("div", {
46
- className: 'listToolbarSettingItem',
47
- onClick: handleOpenModal
48
- }, /*#__PURE__*/React.createElement(ExportOutlined, null))));
19
+ import React, { useEffect, useMemo, useState } from 'react';
20
+ import { useTableContext } from "../../context";
21
+ import { useColumns, useTableStore } from "../../store/hooks";
22
+ import { genColumnKey } from "../../utils/columnKey";
23
+ import RadioMode from "./RadioMode";
24
+ import { useStyles } from "./style";
25
+ var getColumnIdentity = function getColumnIdentity(column, index) {
26
+ var _column$key;
27
+ var rawKey = (_column$key = column.key) !== null && _column$key !== void 0 ? _column$key : column.dataIndex;
28
+ if (Array.isArray(rawKey)) return rawKey.join('.');
29
+ if (typeof rawKey === 'string' || typeof rawKey === 'number') return rawKey;
30
+ return index;
49
31
  };
50
- function isPromise(obj) {
51
- return obj && Object.prototype.toString.call(obj) === '[object Promise]';
32
+ function exportTableToExcel(props) {
33
+ var column = props.column,
34
+ dataSource = props.dataSource,
35
+ _props$exportFileName = props.exportFileName,
36
+ exportFileName = _props$exportFileName === void 0 ? '未命名文件' : _props$exportFileName,
37
+ setLoading = props.setLoading;
38
+ var workbook = new ExcelJs.Workbook();
39
+ var worksheet = workbook.addWorksheet('sheet1');
40
+ worksheet.columns = column.map(function (o) {
41
+ return {
42
+ header: typeof o.exportTitle === 'string' && o.exportTitle ? o.exportTitle : typeof o.title === 'string' ? o.title : '未知标题',
43
+ key: genColumnKey(getColumnIdentity(o, 0))
44
+ };
45
+ });
46
+ var filterDataSource = dataSource.map(function (data) {
47
+ var deepData = _objectSpread({}, data);
48
+ column.forEach(function (col) {
49
+ var key = genColumnKey(getColumnIdentity(col, 0));
50
+ var filterHandler = col.handleExportFilter;
51
+ if (filterHandler && typeof filterHandler === 'function') {
52
+ var _deepData$key;
53
+ deepData[key] = filterHandler(String((_deepData$key = deepData[key]) !== null && _deepData$key !== void 0 ? _deepData$key : ''));
54
+ }
55
+ });
56
+ return deepData;
57
+ });
58
+ worksheet.addRows(filterDataSource);
59
+ workbook.xlsx.writeBuffer().then(function (buffer) {
60
+ setLoading(false);
61
+ var link = document.createElement('a');
62
+ var blob = new Blob([buffer], {
63
+ type: 'application/vnd.ms-excel;charset=utf-8;'
64
+ });
65
+ link.download = "".concat(exportFileName, ".xlsx");
66
+ link.href = URL.createObjectURL(blob);
67
+ link.click();
68
+ });
52
69
  }
53
- var ExportModal = function ExportModal(props) {
54
- var _isShowExport$mode;
55
- var _useContext2 = useContext(TableContext),
56
- propsColumns = _useContext2.columns,
57
- isShowExport = _useContext2.isShowExport,
58
- dataSource = _useContext2.dataSource,
59
- selectedRowKeys = _useContext2.selectedRowKeys;
60
- var store = useContext(StoreContext);
61
- var _useStore = useStore(store),
62
- columnSetting = _useStore.columnSetting;
63
- var _useState3 = useState(false),
70
+ function ExportModal(props) {
71
+ var _ctx$dataSource, _propsColumns$length, _propsColumns$length2;
72
+ var _useColumns = useColumns(),
73
+ propsColumns = _useColumns.columns,
74
+ columnSetting = _useColumns.columnSetting;
75
+ var typedColumns = propsColumns;
76
+ var ctx = useTableContext();
77
+ var isShowExport = ctx.isShowExport;
78
+ var dataSource = (_ctx$dataSource = ctx.dataSource) !== null && _ctx$dataSource !== void 0 ? _ctx$dataSource : [];
79
+ var selectedRowKeys = useTableStore(function (s) {
80
+ return s.selectedRowKeys;
81
+ });
82
+ var exportConfig = isShowExport && _typeof(isShowExport) === 'object' ? isShowExport : undefined;
83
+ var _useState = useState(false),
84
+ _useState2 = _slicedToArray(_useState, 2),
85
+ loading = _useState2[0],
86
+ setLoading = _useState2[1];
87
+ var _useState3 = useState([]),
64
88
  _useState4 = _slicedToArray(_useState3, 2),
65
- loading = _useState4[0],
66
- setLoading = _useState4[1];
67
- var _useState5 = useState([]),
89
+ checkedList = _useState4[0],
90
+ setCheckedList = _useState4[1];
91
+ var _useState5 = useState((exportConfig === null || exportConfig === void 0 ? void 0 : exportConfig.mode) === 'all' || (exportConfig === null || exportConfig === void 0 ? void 0 : exportConfig.mode) === 'part' || (exportConfig === null || exportConfig === void 0 ? void 0 : exportConfig.mode) === 'select' || (exportConfig === null || exportConfig === void 0 ? void 0 : exportConfig.mode) === 'async' ? exportConfig.mode : 'part'),
68
92
  _useState6 = _slicedToArray(_useState5, 2),
69
- checkedList = _useState6[0],
70
- setCheckedList = _useState6[1];
71
- var _useState7 = useState(isShowExport ? (_isShowExport$mode = isShowExport === null || isShowExport === void 0 ? void 0 : isShowExport.mode) !== null && _isShowExport$mode !== void 0 ? _isShowExport$mode : 'part' : 'part'),
72
- _useState8 = _slicedToArray(_useState7, 2),
73
- mode = _useState8[0],
74
- setMode = _useState8[1];
93
+ mode = _useState6[0],
94
+ setMode = _useState6[1];
75
95
  var open = props.open,
76
96
  onCancel = props.onCancel;
77
97
  useEffect(function () {
78
- var res = propsColumns.map(function (column, index) {
79
- var _column$dataIndex, _columnSetting$find;
80
- var columnKey = genColumnKey(column.key || (Array.isArray(column.dataIndex) ? column.dataIndex.join('.') : (_column$dataIndex = column.dataIndex) === null || _column$dataIndex === void 0 ? void 0 : _column$dataIndex.toString()), index);
98
+ var res = typedColumns.map(function (column, index) {
99
+ var _columnSetting$find;
100
+ var columnKey = genColumnKey(getColumnIdentity(column, index), index);
81
101
  if ((_columnSetting$find = columnSetting.find(function (o) {
82
102
  return o.key === columnKey;
83
- })) !== null && _columnSetting$find !== void 0 && _columnSetting$find.hidden) {
84
- return undefined;
85
- } else {
86
- return columnKey;
87
- }
103
+ })) !== null && _columnSetting$find !== void 0 && _columnSetting$find.hidden) return undefined;
104
+ return columnKey;
88
105
  }).filter(Boolean);
89
106
  setCheckedList(res);
90
107
  }, [columnSetting, propsColumns]);
91
- var CheckboxGroupOptions = propsColumns.map(function (column, index) {
92
- var _column$dataIndex2;
93
- var columnKey = genColumnKey(column.key || (Array.isArray(column.dataIndex) ? column.dataIndex.join('.') : (_column$dataIndex2 = column.dataIndex) === null || _column$dataIndex2 === void 0 ? void 0 : _column$dataIndex2.toString()), index);
94
- return {
95
- label: column.title,
96
- value: columnKey
97
- };
98
- });
99
- var indeterminate = checkedList.length > 0 && checkedList.length < propsColumns.length;
108
+ var checkboxGroupOptions = useMemo(function () {
109
+ return typedColumns.map(function (column, index) {
110
+ var columnKey = genColumnKey(getColumnIdentity(column, index), index);
111
+ return {
112
+ label: column.title,
113
+ value: columnKey
114
+ };
115
+ });
116
+ }, [typedColumns]);
117
+ var indeterminate = checkedList.length > 0 && checkedList.length < ((_propsColumns$length = propsColumns === null || propsColumns === void 0 ? void 0 : propsColumns.length) !== null && _propsColumns$length !== void 0 ? _propsColumns$length : 0);
100
118
  var onCheckAllChange = function onCheckAllChange(e) {
101
- setCheckedList(e.target.checked ? propsColumns.map(function (column, index) {
102
- var _column$dataIndex3;
103
- return genColumnKey(column.key || (Array.isArray(column.dataIndex) ? column.dataIndex.join('.') : (_column$dataIndex3 = column.dataIndex) === null || _column$dataIndex3 === void 0 ? void 0 : _column$dataIndex3.toString()), index);
119
+ setCheckedList(e.target.checked ? typedColumns.map(function (column, index) {
120
+ return genColumnKey(getColumnIdentity(column, index), index);
104
121
  }) : []);
105
122
  };
106
- var checkAll = propsColumns.length === checkedList.length;
123
+ var checkAll = ((_propsColumns$length2 = propsColumns === null || propsColumns === void 0 ? void 0 : propsColumns.length) !== null && _propsColumns$length2 !== void 0 ? _propsColumns$length2 : 0) === checkedList.length;
107
124
  var onChange = function onChange(list) {
108
125
  setCheckedList(list);
109
126
  };
110
127
  var onRadioChange = function onRadioChange(e) {
111
128
  setMode(e.target.value);
112
129
  };
113
-
114
- /**
115
- * 导出当前页的所有数据
116
- * 1. 只需修改导出列头即可(根据用户选择进行导出列头)
117
- * 2. 关闭模态框
118
- */
130
+ var getSelectedColumns = function getSelectedColumns() {
131
+ return typedColumns.filter(function (o, index) {
132
+ return checkedList.includes(genColumnKey(getColumnIdentity(o, index)));
133
+ });
134
+ };
119
135
  var onSelectExportOnlyData = function onSelectExportOnlyData() {
120
136
  try {
121
137
  setLoading(true);
122
- var column = propsColumns.filter(function (o) {
123
- var _o$dataIndex;
124
- return checkedList.includes(genColumnKey((_o$dataIndex = o === null || o === void 0 ? void 0 : o.dataIndex) !== null && _o$dataIndex !== void 0 ? _o$dataIndex : o === null || o === void 0 ? void 0 : o.key));
125
- });
126
138
  exportTableToExcel({
127
- column: column,
128
- dataSource: dataSource,
129
- exportFileName: isShowExport === null || isShowExport === void 0 ? void 0 : isShowExport.name,
139
+ column: getSelectedColumns(),
140
+ dataSource: dataSource !== null && dataSource !== void 0 ? dataSource : [],
141
+ exportFileName: exportConfig === null || exportConfig === void 0 ? void 0 : exportConfig.name,
130
142
  setLoading: setLoading
131
143
  });
132
144
  } finally {
133
- onCancel && onCancel();
145
+ onCancel === null || onCancel === void 0 || onCancel();
134
146
  setLoading(false);
135
147
  }
136
148
  };
137
-
138
- /**
139
- * 当导出类型选择全部时,执行的逻辑函数
140
- * 1. 设置导出状态Loading = true
141
- * 2. 删除fetchData 的 offset
142
- * 3. 删除fetchData 的 limit
143
- * 4. 获取用户选择导出的列头,以及最终生成的数据
144
- * 5. 执行将数据写进Excel 函数
145
- * 6. 导出成功后,将loading = false, 关闭模态框
146
- * @returns null
147
- */
148
149
  var onSelectExportAllData = /*#__PURE__*/function () {
149
150
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
150
- var values, column;
151
+ var values;
151
152
  return _regeneratorRuntime().wrap(function _callee$(_context) {
152
153
  while (1) switch (_context.prev = _context.next) {
153
154
  case 0:
154
155
  _context.prev = 0;
155
- if (!isShowExport.query) {
156
- _context.next = 8;
156
+ if (!(exportConfig !== null && exportConfig !== void 0 && exportConfig.query)) {
157
+ _context.next = 7;
157
158
  break;
158
159
  }
159
160
  setLoading(true);
160
161
  _context.next = 5;
161
- return isShowExport.query();
162
+ return exportConfig.query();
162
163
  case 5:
163
164
  values = _context.sent;
164
- column = propsColumns.filter(function (o) {
165
- var _o$dataIndex2;
166
- return checkedList.includes(genColumnKey((_o$dataIndex2 = o === null || o === void 0 ? void 0 : o.dataIndex) !== null && _o$dataIndex2 !== void 0 ? _o$dataIndex2 : o === null || o === void 0 ? void 0 : o.key));
167
- });
168
165
  exportTableToExcel({
169
- column: column,
166
+ column: getSelectedColumns(),
170
167
  dataSource: values,
171
- exportFileName: isShowExport === null || isShowExport === void 0 ? void 0 : isShowExport.name,
168
+ exportFileName: exportConfig === null || exportConfig === void 0 ? void 0 : exportConfig.name,
172
169
  setLoading: setLoading
173
170
  });
174
- case 8:
175
- _context.next = 15;
171
+ case 7:
172
+ _context.next = 14;
176
173
  break;
177
- case 10:
178
- _context.prev = 10;
174
+ case 9:
175
+ _context.prev = 9;
179
176
  _context.t0 = _context["catch"](0);
180
177
  setLoading(false);
181
178
  message.error({
182
179
  content: '将数据导出成Excel时,发生异常。请及时联系管理员'
183
180
  });
184
181
  return _context.abrupt("return");
185
- case 15:
186
- _context.prev = 15;
187
- onCancel && onCancel();
182
+ case 14:
183
+ _context.prev = 14;
184
+ onCancel === null || onCancel === void 0 || onCancel();
188
185
  setLoading(false);
189
- return _context.finish(15);
190
- case 19:
186
+ return _context.finish(14);
187
+ case 18:
191
188
  case "end":
192
189
  return _context.stop();
193
190
  }
194
- }, _callee, null, [[0, 10, 15, 19]]);
191
+ }, _callee, null, [[0, 9, 14, 18]]);
195
192
  }));
196
193
  return function onSelectExportAllData() {
197
194
  return _ref.apply(this, arguments);
198
195
  };
199
196
  }();
200
-
201
- /**
202
- * 当导出类型选择全部时,异步执行的逻辑函数
203
- * 1. 设置导出状态Loading = true
204
- * 2. 删除fetchData 的 offset
205
- * 3. 删除fetchData 的 limit
206
- * 4. 获取用户选择导出的列头,以及最终生成的数据
207
- * 5. 执行将数据写进Excel 函数
208
- * 6. 导出成功后,将loading = false, 关闭模态框
209
- * @returns null
210
- */
211
197
  var onSelectExportAsyncData = /*#__PURE__*/function () {
212
198
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
213
199
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
214
200
  while (1) switch (_context2.prev = _context2.next) {
215
201
  case 0:
216
202
  _context2.prev = 0;
217
- if (!isShowExport.query) {
203
+ if (!(exportConfig !== null && exportConfig !== void 0 && exportConfig.query)) {
218
204
  _context2.next = 5;
219
205
  break;
220
206
  }
221
207
  setLoading(true);
222
208
  _context2.next = 5;
223
- return isShowExport.query();
209
+ return exportConfig.query();
224
210
  case 5:
225
211
  _context2.next = 12;
226
212
  break;
@@ -234,7 +220,7 @@ var ExportModal = function ExportModal(props) {
234
220
  return _context2.abrupt("return");
235
221
  case 12:
236
222
  _context2.prev = 12;
237
- onCancel && onCancel();
223
+ onCancel === null || onCancel === void 0 || onCancel();
238
224
  setLoading(false);
239
225
  return _context2.finish(12);
240
226
  case 16:
@@ -247,37 +233,24 @@ var ExportModal = function ExportModal(props) {
247
233
  return _ref2.apply(this, arguments);
248
234
  };
249
235
  }();
250
-
251
- /**
252
- * 导出用户选择的数据
253
- * 1. 只需修改导出列头即可(根据用户选择进行导出列头)
254
- * 2. 根据当前数据过滤出用户需要导出的数据
255
- * 2. 关闭模态框
256
- */
257
236
  var onSelectExportSelectData = function onSelectExportSelectData() {
258
237
  try {
259
238
  setLoading(true);
260
- var column = propsColumns.filter(function (o) {
261
- var _o$dataIndex3;
262
- return checkedList.includes(genColumnKey((_o$dataIndex3 = o === null || o === void 0 ? void 0 : o.dataIndex) !== null && _o$dataIndex3 !== void 0 ? _o$dataIndex3 : o === null || o === void 0 ? void 0 : o.key));
263
- });
264
239
  var selectedRowKeysList = [];
265
- selectedRowKeys.forEach(function (row) {
240
+ (selectedRowKeys !== null && selectedRowKeys !== void 0 ? selectedRowKeys : []).forEach(function (row) {
266
241
  var obj = dataSource.find(function (o) {
267
242
  return o.key === row;
268
243
  });
269
- if (obj) {
270
- selectedRowKeysList.push(obj);
271
- }
244
+ if (obj) selectedRowKeysList.push(obj);
272
245
  });
273
246
  exportTableToExcel({
274
- column: column,
247
+ column: getSelectedColumns(),
275
248
  dataSource: selectedRowKeysList,
276
- exportFileName: isShowExport === null || isShowExport === void 0 ? void 0 : isShowExport.name,
249
+ exportFileName: exportConfig === null || exportConfig === void 0 ? void 0 : exportConfig.name,
277
250
  setLoading: setLoading
278
251
  });
279
252
  } finally {
280
- onCancel && onCancel();
253
+ onCancel === null || onCancel === void 0 || onCancel();
281
254
  setLoading(false);
282
255
  }
283
256
  };
@@ -295,6 +268,8 @@ var ExportModal = function ExportModal(props) {
295
268
  case 'async':
296
269
  onSelectExportAsyncData();
297
270
  break;
271
+ default:
272
+ onSelectExportOnlyData();
298
273
  }
299
274
  };
300
275
  return /*#__PURE__*/React.createElement(Modal, {
@@ -318,14 +293,13 @@ var ExportModal = function ExportModal(props) {
318
293
  }, /*#__PURE__*/React.createElement(Checkbox.Group, {
319
294
  value: checkedList,
320
295
  onChange: onChange
321
- }, /*#__PURE__*/React.createElement(Row, null, CheckboxGroupOptions.map(function (option, index) {
296
+ }, /*#__PURE__*/React.createElement(Row, null, checkboxGroupOptions.map(function (option) {
322
297
  return /*#__PURE__*/React.createElement(Col, {
323
298
  span: 8,
324
- key: index
299
+ key: option.value
325
300
  }, /*#__PURE__*/React.createElement(Checkbox, {
326
- value: option.value,
327
- key: index
328
- }, option.label));
301
+ value: option.value
302
+ }, typeof option.label === 'function' ? '未命名列' : option.label));
329
303
  })))), /*#__PURE__*/React.createElement(Col, {
330
304
  span: 6
331
305
  }, /*#__PURE__*/React.createElement("span", null, "\u5BFC\u51FA\u8303\u56F4")), /*#__PURE__*/React.createElement(Col, {
@@ -334,52 +308,31 @@ var ExportModal = function ExportModal(props) {
334
308
  value: mode,
335
309
  onChange: onRadioChange
336
310
  }))));
337
- };
338
- /**
339
- * 将数据写进Excel的函数
340
- * @param props
341
- */
342
- var exportTableToExcel = function exportTableToExcel(props) {
343
- var column = props.column,
344
- dataSource = props.dataSource,
345
- _props$exportFileName = props.exportFileName,
346
- exportFileName = _props$exportFileName === void 0 ? '未命名文件' : _props$exportFileName,
347
- setLoading = props.setLoading;
348
- var workbook = new ExcelJs.Workbook();
349
- var worksheet = workbook.addWorksheet('sheet1');
350
- // 重新生成一遍列表头
351
- worksheet.columns = column.map(function (o) {
352
- var _o$dataIndex4;
353
- return {
354
- header: typeof o.exportTitle === 'string' && o.exportTitle ? o.exportTitle : typeof o.title == 'string' ? o.title : '未知标题',
355
- key: genColumnKey((_o$dataIndex4 = o === null || o === void 0 ? void 0 : o.dataIndex) !== null && _o$dataIndex4 !== void 0 ? _o$dataIndex4 : o === null || o === void 0 ? void 0 : o.key)
356
- };
357
- });
358
- var filterDataSource = [];
359
- dataSource.forEach(function (data) {
360
- var deepData = _objectSpread({}, data);
361
- column.forEach(function (col) {
362
- var _col$dataIndex;
363
- var key = genColumnKey((_col$dataIndex = col === null || col === void 0 ? void 0 : col.dataIndex) !== null && _col$dataIndex !== void 0 ? _col$dataIndex : col === null || col === void 0 ? void 0 : col.key);
364
- if (col.handleExportFilter && typeof col.handleExportFilter == 'function') {
365
- deepData[key] = col.handleExportFilter(deepData[key]);
366
- }
367
- });
368
- filterDataSource.push(deepData);
369
- });
370
- worksheet.addRows(filterDataSource);
371
- var writeFile = function writeFile(content) {
372
- var link = document.createElement('a');
373
- var blob = new Blob([content], {
374
- type: 'application/vnd.ms-excel;charset=utf-8;'
311
+ }
312
+ var Export = function Export() {
313
+ var _useStyles = useStyles(),
314
+ styles = _useStyles.styles;
315
+ var _useTableContext = useTableContext(),
316
+ isShowExport = _useTableContext.isShowExport;
317
+ var _useState7 = useState(false),
318
+ _useState8 = _slicedToArray(_useState7, 2),
319
+ open = _useState8[0],
320
+ setOpen = _useState8[1];
321
+ if (!isShowExport) return undefined;
322
+ var handleOpenModal = function handleOpenModal() {
323
+ setOpen(function (e) {
324
+ return !e;
375
325
  });
376
- link.download = "".concat(exportFileName, ".xlsx");
377
- link.href = URL.createObjectURL(blob);
378
- link.click();
379
326
  };
380
- workbook.xlsx.writeBuffer().then(function (buffer) {
381
- setLoading(false);
382
- writeFile(buffer);
383
- });
327
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ExportModal, {
328
+ open: open,
329
+ onCancel: handleOpenModal
330
+ }), /*#__PURE__*/React.createElement(Tooltip, {
331
+ title: '导出数据'
332
+ }, /*#__PURE__*/React.createElement("button", {
333
+ type: 'button',
334
+ className: styles.trigger,
335
+ onClick: handleOpenModal
336
+ }, /*#__PURE__*/React.createElement(ExportOutlined, null))));
384
337
  };
385
338
  export default Export;
@@ -0,0 +1,15 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ trigger: {
3
+ marginBlock: number;
4
+ marginInline: number;
5
+ color: string;
6
+ fontSize: number;
7
+ cursor: "pointer";
8
+ border: number;
9
+ background: string;
10
+ padding: number;
11
+ '&:hover': {
12
+ color: string;
13
+ };
14
+ };
15
+ }>;
@@ -0,0 +1,19 @@
1
+ import { createStyles } from 'antd-style';
2
+ export var useStyles = createStyles(function (_ref) {
3
+ var token = _ref.token;
4
+ return {
5
+ trigger: {
6
+ marginBlock: 0,
7
+ marginInline: token.marginXXS,
8
+ color: token.colorTextSecondary,
9
+ fontSize: token.fontSizeLG,
10
+ cursor: 'pointer',
11
+ border: 0,
12
+ background: 'transparent',
13
+ padding: 0,
14
+ '&:hover': {
15
+ color: token.colorPrimary
16
+ }
17
+ }
18
+ };
19
+ });
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
- import './index.css';
3
- declare const FilterDropdown: ({ children, disabled, onReset, onOk }: {
4
- children: any;
5
- disabled: any;
6
- onReset: any;
7
- onOk: any;
8
- }) => React.JSX.Element;
2
+ interface FilterDropdownProps {
3
+ children: React.ReactNode;
4
+ disabled?: boolean;
5
+ onReset?: () => void;
6
+ onOk?: () => void;
7
+ }
8
+ declare const FilterDropdown: ({ children, disabled, onReset, onOk }: FilterDropdownProps) => React.JSX.Element;
9
9
  export default FilterDropdown;