@ccs-ui/rc-pro 1.1.0 → 1.1.1-rc10

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 (60) hide show
  1. package/es/auth/auth-button.js +25 -12
  2. package/es/auth/index.d.ts +7 -13
  3. package/es/auth/index.js +96 -74
  4. package/es/dialog/HookDrawer.d.ts +1 -1
  5. package/es/dialog/HookDrawer.js +31 -19
  6. package/es/dialog/HookModal.d.ts +1 -1
  7. package/es/dialog/HookModal.js +25 -20
  8. package/es/dialog/button.d.ts +3 -1
  9. package/es/dialog/button.js +28 -16
  10. package/es/dialog/context.d.ts +8 -7
  11. package/es/dialog/context.js +4 -4
  12. package/es/dialog/form.d.ts +2 -2
  13. package/es/dialog/form.js +4 -3
  14. package/es/dialog/{dialog.d.ts → hook.d.ts} +9 -1
  15. package/es/dialog/{dialog.js → hook.js} +11 -11
  16. package/es/dialog/index.d.ts +4 -4
  17. package/es/dialog/index.js +2 -2
  18. package/es/dialog/index.less +14 -17
  19. package/es/drawer.zip +0 -0
  20. package/es/index.d.ts +11 -8
  21. package/es/index.js +0 -2
  22. package/es/keep-alive-tabs/index.d.ts +1 -1
  23. package/es/keep-alive-tabs/index.js +46 -41
  24. package/es/keep-alive-tabs/index.less +2 -2
  25. package/es/modal.zip +0 -0
  26. package/es/pro-table/index.d.ts +3 -3
  27. package/es/pro-table/index.js +69 -179
  28. package/es/pro-table/index.less +3 -13
  29. package/es/pro-table/search.js +7 -4
  30. package/es/pro-table/tree.d.ts +22 -0
  31. package/es/pro-table/tree.js +184 -0
  32. package/es/table/index.js +70 -59
  33. package/es/upload/upload-image.js +33 -15
  34. package/package.json +3 -2
  35. package/es/drawer/buttons.d.ts +0 -14
  36. package/es/drawer/buttons.js +0 -93
  37. package/es/drawer/index.d.ts +0 -13
  38. package/es/drawer/index.js +0 -11
  39. package/es/drawer/index.less +0 -5
  40. package/es/drawer/open/content.d.ts +0 -20
  41. package/es/drawer/open/content.js +0 -43
  42. package/es/drawer/open/destory-fns.d.ts +0 -2
  43. package/es/drawer/open/destory-fns.js +0 -3
  44. package/es/drawer/open/form.d.ts +0 -12
  45. package/es/drawer/open/form.js +0 -32
  46. package/es/drawer/open/index.d.ts +0 -18
  47. package/es/drawer/open/index.js +0 -166
  48. package/es/modal/buttons.d.ts +0 -14
  49. package/es/modal/buttons.js +0 -90
  50. package/es/modal/index.d.ts +0 -12
  51. package/es/modal/index.js +0 -11
  52. package/es/modal/index.less +0 -26
  53. package/es/modal/open/destory-fns.d.ts +0 -2
  54. package/es/modal/open/destory-fns.js +0 -3
  55. package/es/modal/open/drag.d.ts +0 -1
  56. package/es/modal/open/drag.js +0 -104
  57. package/es/modal/open/form.d.ts +0 -12
  58. package/es/modal/open/form.js +0 -35
  59. package/es/modal/open/index.d.ts +0 -19
  60. package/es/modal/open/index.js +0 -93
@@ -0,0 +1,184 @@
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); }
2
+ 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, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $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 defineProperty(generator, "_invoke", { value: makeInvokeMethod(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; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(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); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), 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, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), 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 (val) { var object = Object(val), 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; }
3
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
+ 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."); }
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
+ 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; }
8
+ 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; }
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
11
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
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(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
19
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
+ import { useImperativeHandle, useState } from 'react';
21
+ import { CcsTable, CcsUtils } from '..';
22
+ import { jsx as _jsx } from "react/jsx-runtime";
23
+ var TableTree = function TableTree(_ref) {
24
+ var data = _ref.data,
25
+ table = _ref.table,
26
+ event$ = _ref.event$,
27
+ loading = _ref.loading,
28
+ treeRef = _ref.treeRef,
29
+ sticky = _ref.sticky,
30
+ setData = _ref.setData,
31
+ onSearchAfter = _ref.onSearchAfter,
32
+ onSearchBefore = _ref.onSearchBefore,
33
+ handlePageChange = _ref.handlePageChange,
34
+ isInModalOrDrawer = _ref.isInModalOrDrawer;
35
+ // async tree expand key
36
+ var _useState = useState([]),
37
+ _useState2 = _slicedToArray(_useState, 2),
38
+ expandKeys = _useState2[0],
39
+ setExpandKeys = _useState2[1];
40
+ var _ref2 = table,
41
+ rowKey = _ref2.rowKey,
42
+ asyncTree = _ref2.asyncTree,
43
+ _ref2$childrenColumnN = _ref2.childrenColumnName,
44
+ childrenColumnName = _ref2$childrenColumnN === void 0 ? 'children' : _ref2$childrenColumnN,
45
+ columns = _ref2.columns,
46
+ request = _ref2.request;
47
+
48
+ // 获取数据
49
+ var _onRequestTree = /*#__PURE__*/function () {
50
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
51
+ var query,
52
+ record,
53
+ params,
54
+ newParams,
55
+ requestResult,
56
+ newRequestResult,
57
+ treeData,
58
+ _args = arguments;
59
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
60
+ while (1) switch (_context.prev = _context.next) {
61
+ case 0:
62
+ query = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
63
+ record = _args.length > 1 ? _args[1] : undefined;
64
+ params = query;
65
+ if (record && asyncTree !== null && asyncTree !== void 0 && asyncTree.parentName) {
66
+ params[asyncTree === null || asyncTree === void 0 ? void 0 : asyncTree.parentName] = record[rowKey];
67
+ }
68
+
69
+ // onSearchBefore 请求前回传参数,可以在父组件进行修改
70
+ newParams = onSearchBefore ? onSearchBefore(params) : params; // 发起请求
71
+ setData(function (d) {
72
+ return _objectSpread(_objectSpread({}, d), {}, {
73
+ loading: true
74
+ });
75
+ });
76
+ _context.t0 = request;
77
+ if (!_context.t0) {
78
+ _context.next = 11;
79
+ break;
80
+ }
81
+ _context.next = 10;
82
+ return request(_objectSpread({}, newParams));
83
+ case 10:
84
+ _context.t0 = _context.sent;
85
+ case 11:
86
+ requestResult = _context.t0;
87
+ // 请求结果
88
+ if (requestResult && requestResult.success) {
89
+ // onSearchAfter 处理请求结果
90
+ newRequestResult = onSearchAfter ? onSearchAfter(requestResult) : requestResult;
91
+ treeData = newRequestResult.data;
92
+ if (record) {
93
+ // 异步树
94
+ record[childrenColumnName] = treeData;
95
+ setData(function (d) {
96
+ return _objectSpread(_objectSpread({}, d), {}, {
97
+ result: _toConsumableArray(d.result || []),
98
+ loading: false
99
+ });
100
+ });
101
+ } else {
102
+ setExpandKeys([]);
103
+ setData({
104
+ loading: false,
105
+ result: treeData || []
106
+ });
107
+ }
108
+ } else {
109
+ setData(function (d) {
110
+ return _objectSpread(_objectSpread({}, d), {}, {
111
+ loading: false
112
+ });
113
+ });
114
+ }
115
+ case 13:
116
+ case "end":
117
+ return _context.stop();
118
+ }
119
+ }, _callee);
120
+ }));
121
+ return function onRequestTree() {
122
+ return _ref3.apply(this, arguments);
123
+ };
124
+ }();
125
+ useImperativeHandle(treeRef, function () {
126
+ return {
127
+ onRequestTree: function onRequestTree(query, record) {
128
+ _onRequestTree(query, record);
129
+ },
130
+ onExpandKeys: function onExpandKeys(ids) {
131
+ setExpandKeys(expandKeys.filter(function (e) {
132
+ return !ids.includes(e);
133
+ }));
134
+ }
135
+ };
136
+ });
137
+ var onExpand = function onExpand(expanded, record) {
138
+ var _table$asyncTree;
139
+ if (!(table !== null && table !== void 0 && table.asyncTree)) return;
140
+ if (!(table !== null && table !== void 0 && (_table$asyncTree = table.asyncTree) !== null && _table$asyncTree !== void 0 && _table$asyncTree.parentName)) {
141
+ CcsUtils.showLogWarning('执行失败、参数treeParentName为空!!!');
142
+ return;
143
+ }
144
+ if (!rowKey || (rowKey && record[rowKey]) === undefined) {
145
+ CcsUtils.showLogWarning('rowKey未传入或传入rowKey不正确');
146
+ return;
147
+ }
148
+ var expandId = record[rowKey];
149
+ if (expanded) {
150
+ var _record$childrenColum;
151
+ expandKeys.push(expandId);
152
+ if (((_record$childrenColum = record[childrenColumnName]) === null || _record$childrenColum === void 0 ? void 0 : _record$childrenColum.length) > 0) return;
153
+ _onRequestTree({}, record);
154
+ } else {
155
+ setExpandKeys(expandKeys.filter(function (e) {
156
+ return e !== expandId;
157
+ }));
158
+ }
159
+ };
160
+
161
+ // 添加吸顶
162
+ var tableParams = _objectSpread({
163
+ sticky: sticky
164
+ }, table);
165
+
166
+ // 异步树
167
+ if (table !== null && table !== void 0 && table.asyncTree) {
168
+ tableParams.expandable = {
169
+ onExpand: onExpand,
170
+ expandedRowKeys: expandKeys
171
+ };
172
+ }
173
+ return /*#__PURE__*/_jsx(CcsTable, _objectSpread(_objectSpread({
174
+ onChange: handlePageChange,
175
+ data: data,
176
+ event$: event$,
177
+ size: isInModalOrDrawer ? 'small' : 'middle'
178
+ }, tableParams), {}, {
179
+ columns: columns,
180
+ showSorterTooltip: true,
181
+ loading: loading || data.loading || false
182
+ }));
183
+ };
184
+ export default TableTree;
package/es/table/index.js CHANGED
@@ -1,6 +1,5 @@
1
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); }
2
2
  var _excluded = ["data", "style", "scroll", "event$", "rowKey", "columns", "pagination", "rowSelection", "className"];
3
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
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; }
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
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -8,11 +7,14 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
8
7
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
9
8
  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
9
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
11
- import { useDebounceFn, useEventListener, useUpdate } from 'ahooks';
12
- import { Pagination, Table, Tooltip } from 'antd';
10
+ import { useDebounceFn, useEventListener, useUpdate, useUpdateEffect } from 'ahooks';
11
+ import { Pagination, Table, Tooltip, theme } from 'antd';
13
12
  import classNames from 'classnames';
14
- import React, { useEffect, useRef } from 'react';
13
+ import { useRef } from 'react';
15
14
  import "./index.less";
15
+ import { jsx as _jsx } from "react/jsx-runtime";
16
+ import { Fragment as _Fragment } from "react/jsx-runtime";
17
+ import { jsxs as _jsxs } from "react/jsx-runtime";
16
18
  var DEFAULT_PAGE = {
17
19
  totalNum: 0,
18
20
  result: [],
@@ -60,7 +62,7 @@ var CustomTable = function CustomTable(props) {
60
62
  if (_pagination && _pagination.length > 0) {
61
63
  pageHeight = _pagination[0].clientHeight;
62
64
  }
63
- var scrollHeight = bodyHeight - top - 16 - theadHeight - pageHeight;
65
+ var scrollHeight = bodyHeight - top - 16 - theadHeight - pageHeight - (restProps.title ? 46 : 0) - (restProps.footer ? 46 : 0);
64
66
 
65
67
  // 固定tbody高度
66
68
  var tbody = (_ref$current4 = ref.current) === null || _ref$current4 === void 0 ? void 0 : _ref$current4.getElementsByClassName('ant-table-body');
@@ -73,7 +75,7 @@ var CustomTable = function CustomTable(props) {
73
75
  leading: true
74
76
  }),
75
77
  onFixedThead = _useDebounceFn.run;
76
- useEffect(function () {
78
+ useUpdateEffect(function () {
77
79
  onFixedThead();
78
80
  }, [totalNum]);
79
81
 
@@ -107,67 +109,76 @@ var CustomTable = function CustomTable(props) {
107
109
  showTitle: false
108
110
  };
109
111
  sc.render = function (e) {
110
- return /*#__PURE__*/React.createElement(Tooltip, {
112
+ return /*#__PURE__*/_jsx(Tooltip, {
111
113
  zIndex: 2020,
112
114
  title: e,
113
115
  placement: "bottomLeft",
114
- destroyTooltipOnHide: true
115
- }, e);
116
+ destroyTooltipOnHide: true,
117
+ children: e
118
+ });
116
119
  };
117
120
  }
118
121
  });
119
122
  return cls;
120
123
  };
121
- return /*#__PURE__*/React.createElement("div", {
124
+ var _theme$useToken = theme.useToken(),
125
+ token = _theme$useToken.token;
126
+ return /*#__PURE__*/_jsx("div", {
122
127
  className: "ccs-table-card",
123
- style: _objectSpread({}, style)
124
- }, restProps.render ? /*#__PURE__*/React.createElement(React.Fragment, null, restProps.render(result || []), pagination === false ? null : /*#__PURE__*/React.createElement(Pagination, _objectSpread({
125
- total: totalNum,
126
- pageSize: pageSize,
127
- size: restProps.size === 'small' ? 'small' : 'default',
128
- simple: restProps.size === 'small',
129
- current: pageNo,
130
- showSizeChanger: true,
131
- showQuickJumper: true,
132
- showTotal: function showTotal() {
133
- return "\u5171".concat(totalNum, "\u6761\u8BB0\u5F55");
134
- },
135
- pageSizeOptions: ['10', '20', '30', '50', '100'],
136
- onChange: function onChange(page, size) {
137
- return restProps.onChange && restProps.onChange({
138
- pageSize: size,
139
- current: page
140
- }, {}, {}, {
141
- currentDataSource: [],
142
- action: 'paginate'
143
- });
144
- }
145
- }, pagination))) : /*#__PURE__*/React.createElement(Table, _extends({}, _objectSpread(_objectSpread({
146
- rowKey: rowKey,
147
- dataSource: result,
148
- pagination: pagination === false ? false : _objectSpread({
149
- total: totalNum,
150
- pageSize: pageSize,
151
- current: pageNo,
152
- showSizeChanger: true,
153
- showQuickJumper: true,
154
- showTotal: function showTotal() {
155
- return "\u5171".concat(totalNum, "\u6761\u8BB0\u5F55");
156
- },
157
- pageSizeOptions: ['10', '20', '30', '50', '100'],
158
- size: restProps.size === 'small' ? 'small' : 'default',
159
- simple: restProps.size === 'small'
160
- }, pagination),
161
- rowSelection: rowSelection ? _objectSpread(_objectSpread({}, rowSelection), {}, {
162
- columnWidth: 60
163
- }) : undefined,
164
- columns: filterColumns()
165
- }, restProps), {}, {
166
- size: restProps.size || 'middle',
167
- className: classNames("".concat(!rowSelection ? 'ccs-table-noselection' : ''), !totalNum ? 'ccs-table-nodata' : '', className),
168
- scroll: scroll
169
- }), {
170
- ref: ref
171
- })));
128
+ style: _objectSpread(_objectSpread({}, style), {}, {
129
+ background: token.colorBgContainer
130
+ }),
131
+ children: restProps.render ? /*#__PURE__*/_jsxs(_Fragment, {
132
+ children: [restProps.render(result || []), pagination === false ? null : /*#__PURE__*/_jsx(Pagination, _objectSpread({}, _objectSpread({
133
+ total: totalNum,
134
+ pageSize: pageSize,
135
+ size: restProps.size === 'small' ? 'small' : 'default',
136
+ simple: restProps.size === 'small',
137
+ current: pageNo,
138
+ showSizeChanger: true,
139
+ showQuickJumper: true,
140
+ showTotal: function showTotal() {
141
+ return "\u5171".concat(totalNum, "\u6761\u8BB0\u5F55");
142
+ },
143
+ pageSizeOptions: ['10', '20', '30', '50', '100'],
144
+ onChange: function onChange(page, size) {
145
+ return restProps.onChange && restProps.onChange({
146
+ pageSize: size,
147
+ current: page
148
+ }, {}, {}, {
149
+ currentDataSource: [],
150
+ action: 'paginate'
151
+ });
152
+ }
153
+ }, pagination)))]
154
+ }) : /*#__PURE__*/_jsx("div", {
155
+ ref: ref,
156
+ children: /*#__PURE__*/_jsx(Table, _objectSpread({}, _objectSpread(_objectSpread({
157
+ rowKey: rowKey,
158
+ dataSource: result,
159
+ pagination: pagination === false ? false : _objectSpread({
160
+ total: totalNum,
161
+ pageSize: pageSize,
162
+ current: pageNo,
163
+ showSizeChanger: true,
164
+ showQuickJumper: true,
165
+ showTotal: function showTotal() {
166
+ return "\u5171".concat(totalNum, "\u6761\u8BB0\u5F55");
167
+ },
168
+ pageSizeOptions: ['10', '20', '30', '50', '100'],
169
+ size: restProps.size === 'small' ? 'small' : 'default',
170
+ simple: restProps.size === 'small'
171
+ }, pagination),
172
+ rowSelection: rowSelection ? _objectSpread(_objectSpread({}, rowSelection), {}, {
173
+ columnWidth: 60
174
+ }) : undefined,
175
+ columns: filterColumns()
176
+ }, restProps), {}, {
177
+ size: restProps.size || 'middle',
178
+ className: classNames("".concat(!rowSelection ? 'ccs-table-noselection' : ''), !totalNum ? 'ccs-table-nodata' : '', className),
179
+ scroll: scroll
180
+ })))
181
+ })
182
+ });
172
183
  };
173
184
  export default CustomTable;
@@ -1,6 +1,10 @@
1
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); }
2
2
  var _excluded = ["crop", "tokenKey", "uploadText", "maxCount", "maxFileSize", "onChange"];
3
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
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
+ 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; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
8
  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, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $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 defineProperty(generator, "_invoke", { value: makeInvokeMethod(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; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(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); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), 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, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), 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 (val) { var object = Object(val), 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; }
5
9
  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); } }
6
10
  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,10 +17,13 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
17
  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; }
14
18
  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; }
15
19
  import { PlusOutlined } from '@ant-design/icons';
16
- import { CcsModal } from "./..";
17
20
  import { Upload, message } from 'antd';
18
21
  import ImgCrop from 'antd-img-crop';
19
- import React, { useState } from 'react';
22
+ import { useState } from 'react';
23
+ import CcsDialog from "../dialog";
24
+ import { jsx as _jsx } from "react/jsx-runtime";
25
+ import { jsxs as _jsxs } from "react/jsx-runtime";
26
+ import { Fragment as _Fragment } from "react/jsx-runtime";
20
27
  var getBase64 = function getBase64(file) {
21
28
  return new Promise(function (resolve, reject) {
22
29
  var reader = new FileReader();
@@ -43,6 +50,9 @@ export function ImageUpload(_ref) {
43
50
  _useState2 = _slicedToArray(_useState, 2),
44
51
  files = _useState2[0],
45
52
  setFiles = _useState2[1];
53
+ var _CcsDialog$useDialog = CcsDialog.useDialog(),
54
+ openModal = _CcsDialog$useDialog.openModal,
55
+ contextHolder = _CcsDialog$useDialog.contextHolder;
46
56
  var handleOnChange = function handleOnChange(_ref2) {
47
57
  var fileList = _ref2.fileList;
48
58
  setFiles(fileList.filter(function (f) {
@@ -86,9 +96,9 @@ export function ImageUpload(_ref) {
86
96
  case 3:
87
97
  file.preview = _context.sent;
88
98
  case 4:
89
- CcsModal.open({
99
+ openModal({
90
100
  title: file.name || file.url.substring(file.url.lastIndexOf('/') + 1),
91
- content: /*#__PURE__*/React.createElement("img", {
101
+ content: /*#__PURE__*/_jsx("img", {
92
102
  alt: "example",
93
103
  style: {
94
104
  width: '100%'
@@ -113,20 +123,28 @@ export function ImageUpload(_ref) {
113
123
  token: tokenKey ? sessionStorage.getItem(tokenKey) : ''
114
124
  }
115
125
  };
116
- var renderUpload = /*#__PURE__*/React.createElement(Upload, _extends({}, uploadProps, {
126
+ var renderUpload = /*#__PURE__*/_jsx(Upload, _objectSpread(_objectSpread(_objectSpread({}, uploadProps), {}, {
117
127
  onChange: handleOnChange,
118
128
  beforeUpload: beforeUpload,
119
129
  fileList: files,
120
130
  maxCount: maxCount,
121
131
  listType: "picture-card",
122
132
  onPreview: handlePreview
123
- }, otherProps), files.length < maxCount && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("div", {
124
- style: {
125
- marginTop: 8
126
- }
127
- }, uploadText)));
128
- return crop ? /*#__PURE__*/React.createElement(ImgCrop, {
129
- minZoom: 0.5,
130
- rotationSlider: true
131
- }, renderUpload) : renderUpload;
133
+ }, otherProps), {}, {
134
+ children: files.length < maxCount && /*#__PURE__*/_jsxs("div", {
135
+ children: [/*#__PURE__*/_jsx(PlusOutlined, {}), /*#__PURE__*/_jsx("div", {
136
+ style: {
137
+ marginTop: 8
138
+ },
139
+ children: uploadText
140
+ })]
141
+ })
142
+ }));
143
+ return /*#__PURE__*/_jsxs(_Fragment, {
144
+ children: [crop ? /*#__PURE__*/_jsx(ImgCrop, {
145
+ minZoom: 0.5,
146
+ rotationSlider: true,
147
+ children: renderUpload
148
+ }) : renderUpload, contextHolder]
149
+ });
132
150
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccs-ui/rc-pro",
3
- "version": "1.1.0",
3
+ "version": "1.1.1-rc10",
4
4
  "description": "A react pro components",
5
5
  "license": "MIT",
6
6
  "module": "es/index.js",
@@ -49,7 +49,7 @@
49
49
  "dependencies": {
50
50
  "@ant-design/icons": "^5.1.4",
51
51
  "ahooks": "^3.7.7",
52
- "antd": "5.6",
52
+ "antd": "^5.11.0",
53
53
  "antd-img-crop": "^4.12.2",
54
54
  "classnames": "^2.3.2",
55
55
  "dayjs": "^1.11.7",
@@ -91,6 +91,7 @@
91
91
  "stylelint": "^14.9.1"
92
92
  },
93
93
  "peerDependencies": {
94
+ "antd": "5.6",
94
95
  "react": ">=16.9.0",
95
96
  "react-dom": ">=16.9.0"
96
97
  },
@@ -1,14 +0,0 @@
1
- import { ReactNode } from 'react';
2
- interface PropsType {
3
- children?: ReactNode;
4
- /** 确定文字内容 */
5
- okText?: string;
6
- /** 确定按钮权限 */
7
- okAuth?: string;
8
- /** 加载中 */
9
- loading?: boolean;
10
- /** 确定事件 */
11
- onOk?: (value?: any) => void;
12
- }
13
- export default function DrawerButton({ children, okText, onOk, okAuth, loading, }: PropsType): import("react/jsx-runtime").JSX.Element;
14
- export {};