@lemon-fe/components 0.1.119 → 0.1.122

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 (65) hide show
  1. package/es/Actions/index.js +17 -45
  2. package/es/BaseTable/Actions.d.ts +1 -0
  3. package/es/BaseTable/Actions.js +8 -30
  4. package/es/BaseTable/ResizeHeaderCell.js +12 -39
  5. package/es/BaseTable/VirtualBody.js +11 -50
  6. package/es/BaseTable/index.d.ts +1 -0
  7. package/es/BaseTable/index.js +109 -196
  8. package/es/BaseTable/utils.js +0 -4
  9. package/es/ColorPicker/index.js +13 -31
  10. package/es/Dropdown/index.js +9 -19
  11. package/es/DurationPicker/index.d.ts +1 -0
  12. package/es/DurationPicker/index.js +12 -40
  13. package/es/EditableTable/EditableCell.js +9 -12
  14. package/es/EditableTable/EditableTableFormItem.d.ts +1 -0
  15. package/es/EditableTable/EditableTableFormItem.js +8 -16
  16. package/es/EditableTable/Table.js +28 -103
  17. package/es/EditableTable/util.d.ts +1 -1
  18. package/es/EditableTable/util.js +23 -99
  19. package/es/Filter/index.d.ts +8 -1
  20. package/es/Filter/index.js +118 -196
  21. package/es/Filter/typings.d.ts +1 -0
  22. package/es/FormHorizontal/index.js +0 -5
  23. package/es/FormInline/index.js +5 -21
  24. package/es/FormLayout/index.js +6 -11
  25. package/es/FormTable/index.js +12 -46
  26. package/es/Icons/BigTip/index.js +2 -14
  27. package/es/Icons/Calendar.js +0 -5
  28. package/es/Icons/Close.js +0 -5
  29. package/es/Icons/CollapseUp.js +0 -5
  30. package/es/Icons/DarkSearch.js +0 -5
  31. package/es/Icons/Down.js +0 -5
  32. package/es/Icons/Empty.js +0 -2
  33. package/es/Icons/LookUp.js +0 -5
  34. package/es/Icons/More.js +0 -5
  35. package/es/Icons/Search.js +0 -5
  36. package/es/Icons/Tip.js +2 -19
  37. package/es/InputMaxLength/index.js +9 -29
  38. package/es/Layout/index.js +23 -45
  39. package/es/MainFramework/components/DropMenu/index.d.ts +1 -0
  40. package/es/MainFramework/components/DropMenu/index.js +8 -19
  41. package/es/MainFramework/components/Menu/index.d.ts +1 -0
  42. package/es/MainFramework/components/Menu/index.js +22 -88
  43. package/es/MainFramework/components/RefreshButton/index.d.ts +1 -0
  44. package/es/MainFramework/components/RefreshButton/index.js +5 -14
  45. package/es/MainFramework/components/TabBar/index.d.ts +1 -0
  46. package/es/MainFramework/components/TabBar/index.js +6 -21
  47. package/es/MainFramework/index.js +18 -18
  48. package/es/PageLoading/index.js +0 -2
  49. package/es/Popup/index.js +30 -73
  50. package/es/Portal/index.js +13 -31
  51. package/es/Section/TabBar.js +6 -16
  52. package/es/Section/index.js +14 -22
  53. package/es/SelectView/index.d.ts +1 -1
  54. package/es/SelectView/index.js +25 -62
  55. package/es/SiderTree/TreeNodeTitle.d.ts +1 -0
  56. package/es/SiderTree/TreeNodeTitle.js +8 -24
  57. package/es/SiderTree/index.js +15 -50
  58. package/es/SymbolIcon/index.js +4 -9
  59. package/es/TabBar/index.js +7 -17
  60. package/es/Table/index.d.ts +2 -1
  61. package/es/Table/index.js +90 -124
  62. package/es/TipMark/index.js +7 -17
  63. package/es/init.js +11 -27
  64. package/es/utils.js +0 -2
  65. package/package.json +4 -4
package/es/Table/index.js CHANGED
@@ -1,31 +1,19 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1
2
  var _excluded = ["dataSource", "fetch", "actionRef", "onLoading", "columns", "pagination", "autoLoad"];
2
-
3
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
-
5
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
-
7
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
-
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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
9
7
  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); } }
10
-
11
8
  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); }); }; }
12
-
13
9
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
14
-
15
10
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
16
-
17
11
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
18
-
19
12
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
20
-
21
13
  function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
22
-
23
14
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
24
-
25
15
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
26
-
27
16
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
28
-
29
17
  import React, { useMemo, useState, useImperativeHandle, useEffect } from 'react';
30
18
  import { useRequest } from '@lemon-fe/hooks';
31
19
  import BaseTable from '../BaseTable';
@@ -34,108 +22,92 @@ import empty from '../BaseTable/empty.png';
34
22
  import { PREFIX_CLS } from '../constants';
35
23
  export default function Table(props) {
36
24
  var _props$dataSource = props.dataSource,
37
- dataSource = _props$dataSource === void 0 ? [] : _props$dataSource,
38
- fetch = props.fetch,
39
- actionRef = props.actionRef,
40
- onLoading = props.onLoading,
41
- columns = props.columns,
42
- pagination = props.pagination,
43
- autoLoad = props.autoLoad,
44
- restProps = _objectWithoutProperties(props, _excluded);
45
-
25
+ dataSource = _props$dataSource === void 0 ? [] : _props$dataSource,
26
+ fetch = props.fetch,
27
+ actionRef = props.actionRef,
28
+ onLoading = props.onLoading,
29
+ columns = props.columns,
30
+ pagination = props.pagination,
31
+ autoLoad = props.autoLoad,
32
+ restProps = _objectWithoutProperties(props, _excluded);
46
33
  var defaultPageSize = 50;
47
-
48
34
  var _useState = useState(1),
49
- _useState2 = _slicedToArray(_useState, 2),
50
- current = _useState2[0],
51
- setCurrent = _useState2[1];
52
-
35
+ _useState2 = _slicedToArray(_useState, 2),
36
+ current = _useState2[0],
37
+ setCurrent = _useState2[1];
53
38
  var _useState3 = useState(pagination && pagination.pageSize || defaultPageSize),
54
- _useState4 = _slicedToArray(_useState3, 2),
55
- pageSize = _useState4[0],
56
- setPageSize = _useState4[1];
57
-
39
+ _useState4 = _slicedToArray(_useState3, 2),
40
+ pageSize = _useState4[0],
41
+ setPageSize = _useState4[1];
58
42
  var _useState5 = useState([]),
59
- _useState6 = _slicedToArray(_useState5, 2),
60
- sort = _useState6[0],
61
- setSort = _useState6[1];
62
-
43
+ _useState6 = _slicedToArray(_useState5, 2),
44
+ sort = _useState6[0],
45
+ setSort = _useState6[1];
63
46
  var _useState7 = useState({}),
64
- _useState8 = _slicedToArray(_useState7, 2),
65
- remote = _useState8[0],
66
- setRemote = _useState8[1];
67
-
47
+ _useState8 = _slicedToArray(_useState7, 2),
48
+ remote = _useState8[0],
49
+ setRemote = _useState8[1];
68
50
  var _useRequest = useRequest( /*#__PURE__*/function () {
69
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(params) {
70
- var result;
71
- return regeneratorRuntime.wrap(function _callee$(_context) {
72
- while (1) {
73
- switch (_context.prev = _context.next) {
74
- case 0:
75
- if (onLoading) {
76
- onLoading(true);
77
- }
78
-
79
- result = {
80
- data: [],
81
- total: 0
82
- };
83
-
84
- if (!fetch) {
85
- _context.next = 6;
86
- break;
87
- }
88
-
89
- _context.next = 5;
90
- return fetch(params);
91
-
92
- case 5:
93
- result = _context.sent;
94
-
95
- case 6:
96
- return _context.abrupt("return", {
97
- result: result,
98
- pageSize: pageSize,
99
- current: current
100
- });
101
-
102
- case 7:
103
- case "end":
104
- return _context.stop();
51
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
52
+ var result;
53
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
54
+ while (1) {
55
+ switch (_context.prev = _context.next) {
56
+ case 0:
57
+ if (onLoading) {
58
+ onLoading(true);
59
+ }
60
+ result = {
61
+ data: [],
62
+ total: 0
63
+ };
64
+ if (!fetch) {
65
+ _context.next = 6;
66
+ break;
67
+ }
68
+ _context.next = 5;
69
+ return fetch(params);
70
+ case 5:
71
+ result = _context.sent;
72
+ case 6:
73
+ return _context.abrupt("return", {
74
+ result: result,
75
+ pageSize: pageSize,
76
+ current: current
77
+ });
78
+ case 7:
79
+ case "end":
80
+ return _context.stop();
81
+ }
105
82
  }
106
- }
107
- }, _callee);
108
- }));
109
-
110
- return function (_x) {
111
- return _ref.apply(this, arguments);
112
- };
113
- }(), {
114
- loadingState: onLoading === undefined,
115
- onSuccess: function onSuccess(res) {
116
- if (onLoading) {
117
- onLoading(false);
118
- }
119
-
120
- setRemote(_objectSpread(_objectSpread({}, res.result), {}, {
121
- error: undefined
83
+ }, _callee);
122
84
  }));
123
- },
124
- onError: function onError(error) {
125
- if (onLoading) {
126
- onLoading(false);
85
+ return function (_x) {
86
+ return _ref.apply(this, arguments);
87
+ };
88
+ }(), {
89
+ loadingState: onLoading === undefined,
90
+ onSuccess: function onSuccess(res) {
91
+ if (onLoading) {
92
+ onLoading(false);
93
+ }
94
+ setRemote(_objectSpread(_objectSpread({}, res.result), {}, {
95
+ error: undefined
96
+ }));
97
+ },
98
+ onError: function onError(error) {
99
+ if (onLoading) {
100
+ onLoading(false);
101
+ }
102
+ setRemote({
103
+ data: [],
104
+ total: 0,
105
+ error: error
106
+ });
127
107
  }
128
-
129
- setRemote({
130
- data: [],
131
- total: 0,
132
- error: error
133
- });
134
- }
135
- }),
136
- postData = _useRequest.run,
137
- loading = _useRequest.loading;
138
-
108
+ }),
109
+ postData = _useRequest.run,
110
+ loading = _useRequest.loading;
139
111
  useImperativeHandle(actionRef, function () {
140
112
  return {
141
113
  fetch: function fetch(page) {
@@ -165,18 +137,15 @@ export default function Table(props) {
165
137
  });
166
138
  }
167
139
  }, []);
168
-
169
140
  var _useMemo = useMemo(function () {
170
- if (fetch) {
171
- return [remote.total, remote.data];
172
- }
173
-
174
- return [dataSource.length, dataSource];
175
- }, [dataSource, fetch, remote]),
176
- _useMemo2 = _slicedToArray(_useMemo, 2),
177
- total = _useMemo2[0],
178
- data = _useMemo2[1];
179
-
141
+ if (fetch) {
142
+ return [remote.total, remote.data];
143
+ }
144
+ return [dataSource.length, dataSource];
145
+ }, [dataSource, fetch, remote]),
146
+ _useMemo2 = _slicedToArray(_useMemo, 2),
147
+ total = _useMemo2[0],
148
+ data = _useMemo2[1];
180
149
  return /*#__PURE__*/React.createElement(BaseTable, _objectSpread({
181
150
  columns: columns,
182
151
  dataSource: data,
@@ -187,13 +156,12 @@ export default function Table(props) {
187
156
  },
188
157
  onChange: function onChange(mPage, _, mSort) {
189
158
  var _mPage$current = mPage.current,
190
- page = _mPage$current === void 0 ? 1 : _mPage$current,
191
- _mPage$pageSize = mPage.pageSize,
192
- size = _mPage$pageSize === void 0 ? defaultPageSize : _mPage$pageSize;
159
+ page = _mPage$current === void 0 ? 1 : _mPage$current,
160
+ _mPage$pageSize = mPage.pageSize,
161
+ size = _mPage$pageSize === void 0 ? defaultPageSize : _mPage$pageSize;
193
162
  setPageSize(size);
194
163
  setCurrent(page);
195
164
  var result = [];
196
-
197
165
  if (Array.isArray(mSort)) {
198
166
  mSort.forEach(function (item) {
199
167
  if (isSortValue(item)) {
@@ -209,9 +177,7 @@ export default function Table(props) {
209
177
  order: mSort.order
210
178
  });
211
179
  }
212
-
213
180
  setSort(result);
214
-
215
181
  if (fetch !== undefined) {
216
182
  postData({
217
183
  current: page,
@@ -1,30 +1,22 @@
1
1
  var _excluded = ["prefixCls", "infoContent", "mode", "placement"];
2
-
3
2
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
-
5
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
-
7
4
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
-
9
5
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
-
11
6
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
12
-
13
7
  import React from 'react';
14
8
  import { QuestionCircleFilled } from '@ant-design/icons';
15
9
  import { Tooltip, Popover } from 'antd';
16
10
  import { PREFIX_CLS } from '../constants';
17
-
18
11
  var TipMark = function TipMark(_ref) {
19
12
  var _ref$prefixCls = _ref.prefixCls,
20
- prefixCls = _ref$prefixCls === void 0 ? PREFIX_CLS : _ref$prefixCls,
21
- infoContent = _ref.infoContent,
22
- _ref$mode = _ref.mode,
23
- mode = _ref$mode === void 0 ? 'toolTip' : _ref$mode,
24
- _ref$placement = _ref.placement,
25
- placement = _ref$placement === void 0 ? 'bottom' : _ref$placement,
26
- props = _objectWithoutProperties(_ref, _excluded);
27
-
13
+ prefixCls = _ref$prefixCls === void 0 ? PREFIX_CLS : _ref$prefixCls,
14
+ infoContent = _ref.infoContent,
15
+ _ref$mode = _ref.mode,
16
+ mode = _ref$mode === void 0 ? 'toolTip' : _ref$mode,
17
+ _ref$placement = _ref.placement,
18
+ placement = _ref$placement === void 0 ? 'bottom' : _ref$placement,
19
+ props = _objectWithoutProperties(_ref, _excluded);
28
20
  if (mode === 'toolTip') {
29
21
  return /*#__PURE__*/React.createElement(Tooltip, _objectSpread({
30
22
  title: infoContent,
@@ -33,7 +25,6 @@ var TipMark = function TipMark(_ref) {
33
25
  className: "".concat(prefixCls, "-tip-mark-questionIcon")
34
26
  }));
35
27
  }
36
-
37
28
  return /*#__PURE__*/React.createElement(Popover, _objectSpread({
38
29
  content: infoContent,
39
30
  placement: placement
@@ -41,5 +32,4 @@ var TipMark = function TipMark(_ref) {
41
32
  className: "".concat(prefixCls, "-tip-mark-questionIcon")
42
33
  }));
43
34
  };
44
-
45
35
  export default TipMark;
package/es/init.js CHANGED
@@ -1,54 +1,42 @@
1
1
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
-
3
2
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
-
5
3
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
-
7
4
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
8
-
9
5
  import React from 'react';
10
6
  import { message, Modal, Select, ConfigProvider, Result, Button, version, DatePicker, Cascader, TreeSelect } from 'antd';
11
7
  import { config } from '@lemon-fe/hooks';
12
8
  import PageLoading from './PageLoading';
13
9
  import Icons from './Icons';
14
10
  var Tip = Icons.Tip,
15
- Down = Icons.Down,
16
- BigTip = Icons.BigTip,
17
- Close = Icons.Close;
11
+ Down = Icons.Down,
12
+ BigTip = Icons.BigTip,
13
+ Close = Icons.Close;
18
14
  export default function init() {
19
15
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
20
-
21
16
  // 添加站长统计
22
17
  if (opts.enableCNZZ) {
23
18
  var _node = document.createElement('script');
24
-
25
19
  _node.innerHTML = "\n var _czc = _czc || [];\n window._czc&&window._czc.push(['_setAutoPageview', false]);\n ";
26
20
  document.body.appendChild(_node);
27
21
  _node = document.createElement('script');
28
-
29
22
  if (typeof opts.enableCNZZ === 'string') {
30
23
  _node.src = opts.enableCNZZ;
31
24
  } else {
32
25
  _node.src = '//v1.cnzz.com/z_stat.php?id=1280732258&web_id=1280732258';
33
26
  }
34
-
35
27
  document.body.appendChild(_node);
36
28
  }
37
-
38
29
  var types = ['success', 'error', 'warning', 'info'];
39
30
  types.forEach(function (item) {
40
31
  var msgAPI = message[item].bind(message);
41
32
  var modalAPI = Modal[item].bind(Modal);
42
-
43
33
  message[item] = function () {
44
34
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
45
35
  args[_key] = arguments[_key];
46
36
  }
47
-
48
37
  var args0 = args[0],
49
- args1 = args[1],
50
- args2 = args[2];
51
-
38
+ args1 = args[1],
39
+ args2 = args[2];
52
40
  if (args.length === 1 && _typeof(args0) === 'object' && ! /*#__PURE__*/React.isValidElement(args0)) {
53
41
  return msgAPI(_objectSpread({
54
42
  icon: /*#__PURE__*/React.createElement(Tip, {
@@ -56,7 +44,6 @@ export default function init() {
56
44
  })
57
45
  }, args0));
58
46
  }
59
-
60
47
  return msgAPI({
61
48
  content: args0,
62
49
  duration: args1,
@@ -66,7 +53,6 @@ export default function init() {
66
53
  })
67
54
  });
68
55
  };
69
-
70
56
  Modal[item] = function () {
71
57
  return modalAPI(_objectSpread({
72
58
  icon: /*#__PURE__*/React.createElement(BigTip, {
@@ -77,7 +63,6 @@ export default function init() {
77
63
  };
78
64
  });
79
65
  var modalConfirm = Modal.confirm.bind(Modal);
80
-
81
66
  Modal.confirm = function () {
82
67
  return modalConfirm(_objectSpread({
83
68
  icon: /*#__PURE__*/React.createElement(BigTip, {
@@ -86,7 +71,6 @@ export default function init() {
86
71
  title: '提示'
87
72
  }, arguments.length <= 0 ? undefined : arguments[0]));
88
73
  };
89
-
90
74
  Modal.defaultProps = _objectSpread(_objectSpread({}, Modal.defaultProps), {}, {
91
75
  closeIcon: /*#__PURE__*/React.createElement(Close, null)
92
76
  });
@@ -94,20 +78,20 @@ export default function init() {
94
78
  style: {
95
79
  marginRight: -1
96
80
  }
97
- }); //@ts-ignore
98
-
81
+ });
82
+ //@ts-ignore
99
83
  Select.defaultProps = {
100
84
  suffixIcon: version >= '4.18.9' ? node : function () {
101
85
  return node;
102
86
  }
103
- }; //@ts-ignore
104
-
87
+ };
88
+ //@ts-ignore
105
89
  TreeSelect.defaultProps = {
106
90
  suffixIcon: version >= '4.18.9' ? node : function () {
107
91
  return node;
108
92
  }
109
- }; //@ts-ignore
110
-
93
+ };
94
+ //@ts-ignore
111
95
  Cascader.defaultProps = {
112
96
  suffixIcon: node
113
97
  };
package/es/utils.js CHANGED
@@ -1,13 +1,11 @@
1
1
  // 不使用Children.map的原因是由于它会给子节点生成一个key与tabs的activeTabKey无法对应
2
2
  export var mapChildren = function mapChildren(children, cb) {
3
3
  var nodes = [];
4
-
5
4
  if (Array.isArray(children)) {
6
5
  nodes = children;
7
6
  } else {
8
7
  nodes = [children];
9
8
  }
10
-
11
9
  return nodes.filter(function (item) {
12
10
  return item !== null && item !== undefined;
13
11
  }).map(cb);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "0.1.119",
3
+ "version": "0.1.122",
4
4
  "description": "> TODO: description",
5
5
  "author": "鲁盛杰 <lusj@cnlemon.net>",
6
6
  "homepage": "",
@@ -26,7 +26,7 @@
26
26
  "react-resizable": "^3.0.4"
27
27
  },
28
28
  "peerDependencies": {
29
- "antd": ">=4.20",
29
+ "antd": ">=4.23",
30
30
  "react": ">=16.8",
31
31
  "react-dom": ">=16.8"
32
32
  },
@@ -35,9 +35,9 @@
35
35
  "@types/lodash": "^4.14.179",
36
36
  "@types/react-color": "^3.0.6",
37
37
  "@types/react-resizable": "^1.7.4",
38
- "antd": "^4.21.6",
38
+ "antd": "^4.23.5",
39
39
  "react": "^17.0.2",
40
40
  "react-dom": "^17.0.2"
41
41
  },
42
- "gitHead": "1e168ecae5f933292d902e0463f08272fbd98821"
42
+ "gitHead": "c06d24110423eabd6a1c08e69b5bebcb339e709c"
43
43
  }