@ccs-ui/rc-pro 2.3.6-alpha-31 → 2.3.6-alpha-33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/package.json +6 -27
  2. package/LICENSE +0 -21
  3. package/README.md +0 -37
  4. package/es/aj-captcha/index.d.ts +0 -34
  5. package/es/aj-captcha/index.js +0 -302
  6. package/es/aj-captcha/index.less +0 -89
  7. package/es/auth/index.d.ts +0 -15
  8. package/es/auth/index.js +0 -38
  9. package/es/breadcrumb.d.ts +0 -8
  10. package/es/breadcrumb.js +0 -40
  11. package/es/button/dropdown.d.ts +0 -6
  12. package/es/button/dropdown.js +0 -72
  13. package/es/button/group.d.ts +0 -2
  14. package/es/button/group.js +0 -176
  15. package/es/button/index.d.ts +0 -65
  16. package/es/button/index.js +0 -133
  17. package/es/cascader/index.d.ts +0 -33
  18. package/es/cascader/index.js +0 -120
  19. package/es/ccs.d.ts +0 -131
  20. package/es/ccs.js +0 -1
  21. package/es/color-picker/index.d.ts +0 -7
  22. package/es/color-picker/index.js +0 -142
  23. package/es/color-picker/index.less +0 -8
  24. package/es/config.d.ts +0 -6
  25. package/es/config.js +0 -126
  26. package/es/context/index.d.ts +0 -115
  27. package/es/context/index.js +0 -6
  28. package/es/date-picker/index.d.ts +0 -19
  29. package/es/date-picker/index.js +0 -72
  30. package/es/dialog/HookDrawer.d.ts +0 -9
  31. package/es/dialog/HookDrawer.js +0 -156
  32. package/es/dialog/HookModal.d.ts +0 -10
  33. package/es/dialog/HookModal.js +0 -213
  34. package/es/dialog/button.d.ts +0 -24
  35. package/es/dialog/button.js +0 -256
  36. package/es/dialog/context.d.ts +0 -25
  37. package/es/dialog/context.js +0 -13
  38. package/es/dialog/drawer-footer.d.ts +0 -16
  39. package/es/dialog/drawer-footer.js +0 -43
  40. package/es/dialog/form.d.ts +0 -16
  41. package/es/dialog/form.js +0 -53
  42. package/es/dialog/hook.d.ts +0 -80
  43. package/es/dialog/hook.js +0 -234
  44. package/es/dialog/index.d.ts +0 -19
  45. package/es/dialog/index.js +0 -14
  46. package/es/dialog/usePatchElement.d.ts +0 -5
  47. package/es/dialog/usePatchElement.js +0 -35
  48. package/es/editor/index.d.ts +0 -22
  49. package/es/editor/index.js +0 -18
  50. package/es/editor/index.less +0 -19
  51. package/es/editor/javascript.d.ts +0 -2
  52. package/es/editor/javascript.js +0 -56
  53. package/es/editor/json.d.ts +0 -7
  54. package/es/editor/json.js +0 -82
  55. package/es/editor/sql.d.ts +0 -2
  56. package/es/editor/sql.js +0 -54
  57. package/es/ellipsis/index.d.ts +0 -22
  58. package/es/ellipsis/index.js +0 -129
  59. package/es/ellipsis/index.less +0 -5
  60. package/es/ellipsis/useMeasure.d.ts +0 -9
  61. package/es/ellipsis/useMeasure.js +0 -142
  62. package/es/ellipsis/useResizeEffect.d.ts +0 -2
  63. package/es/ellipsis/useResizeEffect.js +0 -14
  64. package/es/ellipsis/withStopPropagation.d.ts +0 -4
  65. package/es/ellipsis/withStopPropagation.js +0 -38
  66. package/es/full-screen/index.d.ts +0 -3
  67. package/es/full-screen/index.js +0 -49
  68. package/es/group-form-item/index.d.ts +0 -11
  69. package/es/group-form-item/index.js +0 -124
  70. package/es/hooks/use-app.d.ts +0 -25
  71. package/es/hooks/use-app.js +0 -52
  72. package/es/hooks/use-event.d.ts +0 -10
  73. package/es/hooks/use-event.js +0 -69
  74. package/es/hooks/use-once-event.d.ts +0 -2
  75. package/es/hooks/use-once-event.js +0 -16
  76. package/es/hooks/use-page.d.ts +0 -10
  77. package/es/hooks/use-page.js +0 -10
  78. package/es/hooks/use-selection.d.ts +0 -17
  79. package/es/hooks/use-selection.js +0 -172
  80. package/es/hooks/use-tabs.d.ts +0 -2
  81. package/es/hooks/use-tabs.js +0 -10
  82. package/es/hooks/use-window.d.ts +0 -8
  83. package/es/hooks/use-window.js +0 -15
  84. package/es/index.d.ts +0 -37
  85. package/es/index.js +0 -37
  86. package/es/interval-button/index.d.ts +0 -14
  87. package/es/interval-button/index.js +0 -128
  88. package/es/layout-keep-alive/index.d.ts +0 -29
  89. package/es/layout-keep-alive/index.js +0 -400
  90. package/es/layout-keep-alive/index.less +0 -79
  91. package/es/layout-keep-alive/page.d.ts +0 -14
  92. package/es/layout-keep-alive/page.js +0 -53
  93. package/es/layout-single-page/index.d.ts +0 -14
  94. package/es/layout-single-page/index.js +0 -71
  95. package/es/layout-single-page/index.less +0 -15
  96. package/es/layout-single-page/page.d.ts +0 -13
  97. package/es/layout-single-page/page.js +0 -41
  98. package/es/loading/index.d.ts +0 -14
  99. package/es/loading/index.js +0 -43
  100. package/es/pro-grid/index.d.ts +0 -15
  101. package/es/pro-grid/index.js +0 -58
  102. package/es/pro-table/_utils.d.ts +0 -12
  103. package/es/pro-table/_utils.js +0 -94
  104. package/es/pro-table/form-item.d.ts +0 -9
  105. package/es/pro-table/form-item.js +0 -44
  106. package/es/pro-table/head.d.ts +0 -16
  107. package/es/pro-table/head.js +0 -225
  108. package/es/pro-table/index.d.ts +0 -23
  109. package/es/pro-table/index.js +0 -37
  110. package/es/pro-table/index.less +0 -82
  111. package/es/pro-table/operation.d.ts +0 -14
  112. package/es/pro-table/operation.js +0 -194
  113. package/es/pro-table/selection-alert.d.ts +0 -20
  114. package/es/pro-table/selection-alert.js +0 -64
  115. package/es/pro-table/size.d.ts +0 -10
  116. package/es/pro-table/size.js +0 -17
  117. package/es/pro-table/summary.d.ts +0 -8
  118. package/es/pro-table/summary.js +0 -32
  119. package/es/pro-table/table.d.ts +0 -104
  120. package/es/pro-table/table.js +0 -712
  121. package/es/pro-table/tree.d.ts +0 -24
  122. package/es/pro-table/tree.js +0 -197
  123. package/es/pro-tabs/index.d.ts +0 -9
  124. package/es/pro-tabs/index.js +0 -174
  125. package/es/resize-observer.d.ts +0 -15
  126. package/es/resize-observer.js +0 -37
  127. package/es/result/icon.d.ts +0 -3
  128. package/es/result/icon.js +0 -3
  129. package/es/result/index.d.ts +0 -12
  130. package/es/result/index.js +0 -68
  131. package/es/select/ modal.d.ts +0 -10
  132. package/es/select/ modal.js +0 -141
  133. package/es/select/api.d.ts +0 -25
  134. package/es/select/api.js +0 -67
  135. package/es/select/customize.d.ts +0 -25
  136. package/es/select/customize.js +0 -139
  137. package/es/select/index.d.ts +0 -31
  138. package/es/select/index.js +0 -108
  139. package/es/status-tag/index.d.ts +0 -13
  140. package/es/status-tag/index.js +0 -31
  141. package/es/table/index.d.ts +0 -19
  142. package/es/table/index.js +0 -253
  143. package/es/table/index.less +0 -29
  144. package/es/theme-dialog.d.ts +0 -28
  145. package/es/theme-dialog.js +0 -81
  146. package/es/time-picker/index.d.ts +0 -15
  147. package/es/time-picker/index.js +0 -49
  148. package/es/trigger/index.d.ts +0 -43
  149. package/es/trigger/index.js +0 -298
  150. package/es/trigger/index.less +0 -42
  151. package/es/types.d.ts +0 -0
  152. package/es/types.js +0 -0
  153. package/es/upload/index.d.ts +0 -42
  154. package/es/upload/index.js +0 -167
  155. package/es/upload/upload-image.d.ts +0 -6
  156. package/es/upload/upload-image.js +0 -205
  157. package/es/virtual-list/index.d.ts +0 -51
  158. package/es/virtual-list/index.js +0 -132
  159. package/es/water-mark/index.d.ts +0 -65
  160. package/es/water-mark/index.js +0 -141
  161. package/es/water-mark/relative.d.ts +0 -62
  162. package/es/water-mark/relative.js +0 -130
@@ -1,205 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["uploadText", "maxCount", "maxFileSize", "crop", "value", "fileDownloadUrl", "uploadRequest", "onChange"];
3
- 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; }
4
- 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; }
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
- 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); }
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 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; }
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); } }
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); }); }; }
11
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
- 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."); }
13
- 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); }
14
- 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; }
15
- 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; } }
16
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
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; }
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; }
19
- import { PlusOutlined } from '@ant-design/icons';
20
- import { message, Upload } from 'antd';
21
- import ImgCrop from 'antd-img-crop';
22
- import { useState } from 'react';
23
- import CcsDialog from "../dialog";
24
- import { uploadDefaultFlies } from "./index";
25
- import { jsx as _jsx } from "react/jsx-runtime";
26
- import { jsxs as _jsxs } from "react/jsx-runtime";
27
- import { Fragment as _Fragment } from "react/jsx-runtime";
28
- var getBase64 = function getBase64(file) {
29
- return new Promise(function (resolve, reject) {
30
- var reader = new FileReader();
31
- reader.readAsDataURL(file);
32
- reader.onload = function () {
33
- return resolve(reader.result);
34
- };
35
- reader.onerror = function (error) {
36
- return reject(error);
37
- };
38
- });
39
- };
40
- export function ImageUpload(_ref) {
41
- var _ref$uploadText = _ref.uploadText,
42
- uploadText = _ref$uploadText === void 0 ? '上传' : _ref$uploadText,
43
- _ref$maxCount = _ref.maxCount,
44
- maxCount = _ref$maxCount === void 0 ? 1 : _ref$maxCount,
45
- _ref$maxFileSize = _ref.maxFileSize,
46
- maxFileSize = _ref$maxFileSize === void 0 ? 10 : _ref$maxFileSize,
47
- crop = _ref.crop,
48
- value = _ref.value,
49
- _ref$fileDownloadUrl = _ref.fileDownloadUrl,
50
- fileDownloadUrl = _ref$fileDownloadUrl === void 0 ? '' : _ref$fileDownloadUrl,
51
- uploadRequest = _ref.uploadRequest,
52
- onChange = _ref.onChange,
53
- otherProps = _objectWithoutProperties(_ref, _excluded);
54
- var _useState = useState(function () {
55
- return uploadDefaultFlies(value, fileDownloadUrl);
56
- }),
57
- _useState2 = _slicedToArray(_useState, 2),
58
- files = _useState2[0],
59
- setFiles = _useState2[1];
60
- var _CcsDialog$useDialog = CcsDialog.useDialog(),
61
- openModal = _CcsDialog$useDialog.openModal;
62
- var handleOnChange = function handleOnChange(_ref2) {
63
- var fileList = _ref2.fileList;
64
- fileList.forEach(function (f) {
65
- if (!f.fileId && f.response) {
66
- f.fileId = f.response.data;
67
- }
68
- });
69
- setFiles(fileList);
70
- if (!onChange) return;
71
-
72
- // 文件上传中,不更新结果
73
- if (fileList.find(function (f) {
74
- return f.status === 'uploading';
75
- })) return;
76
- if (maxCount === 1) {
77
- var _fileList$;
78
- // 只能上传一个文件
79
- onChange((_fileList$ = fileList[0]) === null || _fileList$ === void 0 ? void 0 : _fileList$.fileId);
80
- } else {
81
- // 上传完成的文件,返回上传结果集
82
- onChange(fileList.filter(function (f) {
83
- return !!f.fileId;
84
- }).map(function (f) {
85
- return f.fileId;
86
- }));
87
- }
88
- };
89
-
90
- // 上传大小检查
91
- var beforeUpload = function beforeUpload(file) {
92
- var isLt2M = file.size / 1024 / 1024 < maxFileSize;
93
- if (!isLt2M) {
94
- message.error("\u56FE\u7247\u4E0D\u80FD\u5927\u4E8E".concat(maxFileSize, "MB!"));
95
- }
96
- return isLt2M;
97
- };
98
-
99
- // 预览
100
- var handlePreview = /*#__PURE__*/function () {
101
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {
102
- return _regeneratorRuntime().wrap(function _callee$(_context) {
103
- while (1) switch (_context.prev = _context.next) {
104
- case 0:
105
- if (file.preview) {
106
- _context.next = 8;
107
- break;
108
- }
109
- if (!file.originFileObj) {
110
- _context.next = 7;
111
- break;
112
- }
113
- _context.next = 4;
114
- return getBase64(file.originFileObj);
115
- case 4:
116
- file.preview = _context.sent;
117
- _context.next = 8;
118
- break;
119
- case 7:
120
- file.preview = "".concat(fileDownloadUrl).concat(file.fileId);
121
- case 8:
122
- openModal({
123
- title: file.name || file.url.substring(file.url.lastIndexOf('/') + 1),
124
- content: /*#__PURE__*/_jsx("img", {
125
- alt: file.name,
126
- style: {
127
- width: '100%'
128
- },
129
- src: file.preview
130
- }),
131
- footer: null
132
- });
133
- case 9:
134
- case "end":
135
- return _context.stop();
136
- }
137
- }, _callee);
138
- }));
139
- return function handlePreview(_x) {
140
- return _ref3.apply(this, arguments);
141
- };
142
- }();
143
-
144
- // 自定义上传
145
- var onCustomRequest = /*#__PURE__*/function () {
146
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref4) {
147
- var file, onSuccess, onError, result;
148
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
149
- while (1) switch (_context2.prev = _context2.next) {
150
- case 0:
151
- file = _ref4.file, onSuccess = _ref4.onSuccess, onError = _ref4.onError;
152
- _context2.next = 3;
153
- return uploadRequest(file);
154
- case 3:
155
- result = _context2.sent;
156
- // 上传成功
157
- if (result.success && onSuccess) {
158
- onSuccess(result);
159
- }
160
- // 上传失败
161
- if (!result.success && onError) {
162
- CcsDialog.message.error(result.msg || '上传失败');
163
- onError({
164
- status: 500,
165
- name: '出错了',
166
- message: result.msg || '上传失败'
167
- });
168
- }
169
- case 6:
170
- case "end":
171
- return _context2.stop();
172
- }
173
- }, _callee2);
174
- }));
175
- return function onCustomRequest(_x2) {
176
- return _ref5.apply(this, arguments);
177
- };
178
- }();
179
- var renderUpload = /*#__PURE__*/_jsx(Upload, _objectSpread(_objectSpread({
180
- customRequest: onCustomRequest,
181
- name: "fileName",
182
- onChange: handleOnChange,
183
- beforeUpload: beforeUpload,
184
- fileList: files,
185
- maxCount: maxCount,
186
- listType: "picture-card",
187
- onPreview: handlePreview
188
- }, otherProps), {}, {
189
- children: files.length < maxCount && /*#__PURE__*/_jsxs("div", {
190
- children: [/*#__PURE__*/_jsx(PlusOutlined, {}), /*#__PURE__*/_jsx("div", {
191
- style: {
192
- marginTop: 8
193
- },
194
- children: uploadText
195
- })]
196
- })
197
- }));
198
- return /*#__PURE__*/_jsx(_Fragment, {
199
- children: crop ? /*#__PURE__*/_jsx(ImgCrop, {
200
- minZoom: 0.5,
201
- rotationSlider: true,
202
- children: renderUpload
203
- }) : renderUpload
204
- });
205
- }
@@ -1,51 +0,0 @@
1
- import { ReactNode, RefObject } from 'react';
2
- import { PropsWithCss } from '../ccs';
3
- type Position = {
4
- left: number;
5
- top: number;
6
- };
7
- export type RowRendererProps = {
8
- rowHeight: number;
9
- index: number;
10
- };
11
- export type VirtualInstance = {
12
- scrollTop: (top: number) => void;
13
- };
14
- export type VirtualListProps = PropsWithCss & {
15
- /** 容器高度 */
16
- height?: number;
17
- /** 记录条数 */
18
- rowCount: number;
19
- /** 行高 */
20
- rowHeight: number;
21
- /**
22
- * 自动隐藏滚动条
23
- * @default true
24
- */
25
- autoHideScroll?: boolean;
26
- /** 显示条数 */
27
- overscanRowCount: number;
28
- /** 条数改变定位顶部 */
29
- rowCountChangeScrollTop?: boolean;
30
- /** instance */
31
- virtualRef?: RefObject<VirtualInstance>;
32
- /** 渲染row */
33
- rowRenderer: ({ rowHeight, index }: RowRendererProps) => ReactNode;
34
- /** scroll event */
35
- onScroll?: (position: Position) => void;
36
- };
37
- export type VirtualListItemProps = Pick<VirtualListProps, 'rowHeight' | 'rowRenderer'> & {
38
- index: number;
39
- };
40
- export type ListItemProps = {
41
- prefix: ReactNode;
42
- title: ReactNode;
43
- extra?: ReactNode;
44
- extraIcon?: ReactNode;
45
- height: number;
46
- className?: string;
47
- description?: ReactNode;
48
- onClick?: () => void;
49
- };
50
- declare const VirtualList: ({ height, rowCount, rowHeight, className, style, virtualRef, onScroll, rowRenderer, autoHideScroll, overscanRowCount, rowCountChangeScrollTop, }: VirtualListProps) => import("react/jsx-runtime").JSX.Element;
51
- export default VirtualList;
@@ -1,132 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function 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
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
- 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."); }
9
- 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); }
10
- 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; }
11
- 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; } }
12
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
- import { useScroll } from 'ahooks';
14
- import { useEffect, useImperativeHandle, useRef, useState } from 'react';
15
- import { Scrollbars } from 'react-custom-scrollbars';
16
- import { jsx as _jsx } from "react/jsx-runtime";
17
- import { Fragment as _Fragment } from "react/jsx-runtime";
18
- function getArrayIdsNew(start, end) {
19
- var ids = [];
20
- for (var i = start; i <= end; i += 1) {
21
- ids.push(i);
22
- }
23
- return ids;
24
- }
25
- var VirtualListItem = function VirtualListItem(_ref) {
26
- var rowHeight = _ref.rowHeight,
27
- rowRenderer = _ref.rowRenderer,
28
- index = _ref.index;
29
- return /*#__PURE__*/_jsx("div", {
30
- style: {
31
- height: rowHeight,
32
- position: 'absolute',
33
- top: index * rowHeight,
34
- width: '100%'
35
- },
36
- children: rowRenderer({
37
- rowHeight: rowHeight,
38
- index: index
39
- })
40
- });
41
- };
42
- var VirtualList = function VirtualList(_ref2) {
43
- var height = _ref2.height,
44
- rowCount = _ref2.rowCount,
45
- rowHeight = _ref2.rowHeight,
46
- className = _ref2.className,
47
- _ref2$style = _ref2.style,
48
- style = _ref2$style === void 0 ? {} : _ref2$style,
49
- virtualRef = _ref2.virtualRef,
50
- onScroll = _ref2.onScroll,
51
- rowRenderer = _ref2.rowRenderer,
52
- autoHideScroll = _ref2.autoHideScroll,
53
- overscanRowCount = _ref2.overscanRowCount,
54
- rowCountChangeScrollTop = _ref2.rowCountChangeScrollTop;
55
- // 渲染区间
56
- var _useState = useState([0, overscanRowCount - 1]),
57
- _useState2 = _slicedToArray(_useState, 2),
58
- ids = _useState2[0],
59
- setIds = _useState2[1];
60
- var ref = useRef(null);
61
- useImperativeHandle(virtualRef, function () {
62
- return {
63
- scrollTop: function scrollTop(top) {
64
- if (ref.current) ref.current.scrollTop = top;
65
- }
66
- };
67
- });
68
- useScroll(ref, function (position) {
69
- var top = position.top;
70
- var addRowNumber = overscanRowCount - 1;
71
- var start = Math.trunc((top < 0 ? 0 : top) / rowHeight);
72
- var end = start + addRowNumber;
73
- if (ids[0] !== start && ids[1] !== end) {
74
- setIds([start, end]);
75
- }
76
- if (onScroll) {
77
- onScroll(position);
78
- }
79
- return false;
80
- });
81
- var onScrollUpdate = function onScrollUpdate(position) {
82
- var scrollTop = position.scrollTop;
83
- var addRowNumber = overscanRowCount - 1;
84
- var start = Math.trunc((scrollTop < 0 ? 0 : scrollTop) / rowHeight);
85
- var end = start + addRowNumber;
86
- if (ids[0] !== start && ids[1] !== end) {
87
- setIds([start, end]);
88
- }
89
- if (onScroll) {
90
- onScroll(position);
91
- }
92
- };
93
- useEffect(function () {
94
- if (rowCount > 0 && rowCountChangeScrollTop && ref.current) {
95
- ref.current.scrollTo({
96
- top: 0,
97
- behavior: 'smooth'
98
- });
99
- }
100
- }, [rowCount]);
101
- return rowCount === 0 ? /*#__PURE__*/_jsx(_Fragment, {
102
- children: "\u6309\u9700\u52A0\u8F7D\u6D4B\u8BD5tttttt-tttt11--tt"
103
- }) : /*#__PURE__*/_jsx("div", {
104
- className: className,
105
- style: _objectSpread({
106
- height: height || '100%'
107
- }, style),
108
- ref: ref,
109
- children: /*#__PURE__*/_jsx(Scrollbars, {
110
- autoHide: autoHideScroll !== false,
111
- onUpdate: onScrollUpdate,
112
- style: {
113
- flex: '1 1 auto'
114
- },
115
- children: /*#__PURE__*/_jsx("div", {
116
- style: {
117
- position: 'relative',
118
- height: rowHeight * rowCount,
119
- overflow: 'hidden'
120
- },
121
- children: getArrayIdsNew(ids[0], ids[1] >= rowCount ? rowCount - 1 : ids[1]).map(function (i) {
122
- return /*#__PURE__*/_jsx(VirtualListItem, {
123
- rowHeight: rowHeight,
124
- rowRenderer: rowRenderer,
125
- index: i
126
- }, i);
127
- })
128
- })
129
- })
130
- });
131
- };
132
- export default VirtualList;
@@ -1,65 +0,0 @@
1
- import React from 'react';
2
- import { PropsWithCss, PropsWithNodeChildren } from '../ccs';
3
- export type WaterMarkProps = PropsWithNodeChildren & PropsWithCss & {
4
- /** 水印文字内容 */
5
- content?: string;
6
- /** 水印样式 */
7
- markStyle?: React.CSSProperties;
8
- /** 水印类名 */
9
- markClassName?: string;
10
- /** 水印之间的水平间距 */
11
- gapX?: number;
12
- /** 水印之间的垂直间距 */
13
- gapY?: number;
14
- /** 追加的水印元素的z-index */
15
- zIndex?: number;
16
- /** 水印的宽度 */
17
- width?: number;
18
- /** 水印的高度 */
19
- height?: number;
20
- /** 水印在canvas 画布上绘制的垂直偏移量,正常情况下,水印绘制在中间位置, 即 offsetTop = gapY / 2 */
21
- offsetTop?: number;
22
- /** 水印在canvas 画布上绘制的水平偏移量, 正常情况下,水印绘制在中间位置, 即 offsetTop = gapX / 2 */
23
- offsetLeft?: number;
24
- /** 水印绘制时,旋转的角度,单位 ° */
25
- rotate?: number;
26
- /** ClassName 前缀 */
27
- prefixCls?: string;
28
- /** 高清印图片源, 为了高清屏幕显示,建议使用 2倍或3倍图,优先使用图片渲染水印。 */
29
- image?: string;
30
- /**
31
- * @description 文字颜色
32
- * @default rgba(0,0,0,.15)
33
- */
34
- fontColor?: string;
35
- /**
36
- * @description 文字样式
37
- * @default normal
38
- */
39
- fontStyle?: 'none' | 'normal' | 'italic' | 'oblique';
40
- /**
41
- * @description 文字族
42
- * @default sans-serif
43
- */
44
- fontFamily?: string;
45
- /**
46
- * @description 文字粗细
47
- * @default normal
48
- */
49
- fontWeight?: 'normal' | 'light' | 'weight' | number;
50
- /**
51
- * @description 文字大小
52
- * @default 16
53
- */
54
- fontSize?: number | string;
55
- };
56
- /**
57
- * 水印组件
58
- * @param WaterMarkProps
59
- * @returns
60
- */
61
- declare const WaterMarkComponent: {
62
- (props: WaterMarkProps): import("react/jsx-runtime").JSX.Element;
63
- displayName: string;
64
- };
65
- export default WaterMarkComponent;
@@ -1,141 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function 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
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
- 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."); }
9
- 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); }
10
- 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; }
11
- 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; } }
12
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
- import { ConfigProvider } from 'antd';
14
- import classNames from 'classnames';
15
- import React, { useContext, useEffect, useState } from 'react';
16
- import { jsx as _jsx } from "react/jsx-runtime";
17
- import { jsxs as _jsxs } from "react/jsx-runtime";
18
- /**
19
- * 返回当前显示设备的物理像素分辨率与CSS像素分辨率之比
20
- *
21
- * @param context
22
- * @see api 有些废弃了,其实类型 CanvasRenderingContext2D
23
- */
24
- var getPixelRatio = function getPixelRatio(context) {
25
- if (!context) {
26
- return 1;
27
- }
28
- var backingStore = context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || context.backingStorePixelRatio || 1;
29
- return (window.devicePixelRatio || 1) / backingStore;
30
- };
31
-
32
- /**
33
- * 水印组件
34
- * @param WaterMarkProps
35
- * @returns
36
- */
37
- var WaterMarkComponent = function WaterMarkComponent(props) {
38
- var children = props.children,
39
- style = props.style,
40
- className = props.className,
41
- markStyle = props.markStyle,
42
- markClassName = props.markClassName,
43
- _props$zIndex = props.zIndex,
44
- zIndex = _props$zIndex === void 0 ? 9 : _props$zIndex,
45
- _props$gapX = props.gapX,
46
- gapX = _props$gapX === void 0 ? 212 : _props$gapX,
47
- _props$gapY = props.gapY,
48
- gapY = _props$gapY === void 0 ? 222 : _props$gapY,
49
- _props$width = props.width,
50
- width = _props$width === void 0 ? 120 : _props$width,
51
- _props$height = props.height,
52
- height = _props$height === void 0 ? 64 : _props$height,
53
- _props$rotate = props.rotate,
54
- rotate = _props$rotate === void 0 ? -22 : _props$rotate,
55
- image = props.image,
56
- content = props.content,
57
- offsetLeft = props.offsetLeft,
58
- offsetTop = props.offsetTop,
59
- _props$fontStyle = props.fontStyle,
60
- fontStyle = _props$fontStyle === void 0 ? 'normal' : _props$fontStyle,
61
- _props$fontWeight = props.fontWeight,
62
- fontWeight = _props$fontWeight === void 0 ? 'normal' : _props$fontWeight,
63
- _props$fontColor = props.fontColor,
64
- fontColor = _props$fontColor === void 0 ? 'rgba(0,0,0,.15)' : _props$fontColor,
65
- _props$fontSize = props.fontSize,
66
- fontSize = _props$fontSize === void 0 ? 16 : _props$fontSize,
67
- _props$fontFamily = props.fontFamily,
68
- fontFamily = _props$fontFamily === void 0 ? 'sans-serif' : _props$fontFamily,
69
- customizePrefixCls = props.prefixCls;
70
- var _useContext = useContext(ConfigProvider.ConfigContext),
71
- getPrefixCls = _useContext.getPrefixCls;
72
- var prefixCls = getPrefixCls('pro-layout-watermark', customizePrefixCls);
73
- var wrapperCls = classNames("".concat(prefixCls, "-wrapper"), className);
74
- var waterMakrCls = classNames(prefixCls, markClassName);
75
- var _useState = useState(''),
76
- _useState2 = _slicedToArray(_useState, 2),
77
- base64Url = _useState2[0],
78
- setBase64Url = _useState2[1];
79
- useEffect(function () {
80
- var canvas = document.createElement('canvas');
81
- var ctx = canvas.getContext('2d');
82
- var ratio = getPixelRatio(ctx);
83
- var canvasWidth = "".concat((gapX + width) * ratio, "px");
84
- var canvasHeight = "".concat((gapY + height) * ratio, "px");
85
- var canvasOffsetLeft = offsetLeft || gapX / 2;
86
- var canvasOffsetTop = offsetTop || gapY / 2;
87
- canvas.setAttribute('width', canvasWidth);
88
- canvas.setAttribute('height', canvasHeight);
89
- if (ctx) {
90
- // 旋转字符 rotate
91
- ctx.translate(canvasOffsetLeft * ratio, canvasOffsetTop * ratio);
92
- ctx.rotate(Math.PI / 180 * Number(rotate));
93
- var markWidth = width * ratio;
94
- var markHeight = height * ratio;
95
- if (image) {
96
- var img = new Image();
97
- img.crossOrigin = 'anonymous';
98
- img.referrerPolicy = 'no-referrer';
99
- img.src = image;
100
- img.onload = function () {
101
- ctx.drawImage(img, 0, 0, markWidth, markHeight);
102
- setBase64Url(canvas.toDataURL());
103
- };
104
- } else if (content) {
105
- var markSize = Number(fontSize) * ratio;
106
- ctx.font = "".concat(fontStyle, " normal ").concat(fontWeight, " ").concat(markSize, "px/").concat(markHeight, "px ").concat(fontFamily);
107
- ctx.fillStyle = fontColor;
108
- ctx.fillText(content, 0, 0);
109
- setBase64Url(canvas.toDataURL());
110
- }
111
- } else {
112
- // eslint-disable-next-line no-console
113
- console.error('当前环境不支持Canvas');
114
- }
115
- }, [gapX, gapY, offsetLeft, offsetTop, rotate, fontStyle, fontWeight, width, height, fontFamily, fontColor, image, content, fontSize]);
116
- return /*#__PURE__*/_jsxs("div", {
117
- style: _objectSpread({
118
- position: 'relative'
119
- }, style),
120
- className: wrapperCls,
121
- children: [children, base64Url && /*#__PURE__*/_jsx("div", {
122
- className: waterMakrCls,
123
- style: _objectSpread({
124
- zIndex: zIndex,
125
- position: 'absolute',
126
- left: 0,
127
- top: 0,
128
- width: '100%',
129
- height: '100%',
130
- backgroundSize: "".concat(gapX + width, "px"),
131
- pointerEvents: 'none',
132
- backgroundRepeat: 'repeat',
133
- backgroundImage: "url('".concat(base64Url, "')")
134
- }, markStyle)
135
- })]
136
- });
137
- };
138
- if (process.env.NODE_ENV !== 'production') {
139
- WaterMarkComponent.displayName = 'CcsWaterMark';
140
- }
141
- export default WaterMarkComponent;