@ccs-ui/rc-pro 2.3.5 → 2.3.6-alpha-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/aj-captcha/index.d.ts +5 -2
- package/es/aj-captcha/index.js +6 -2
- package/es/auth/index.d.ts +3 -0
- package/es/auth/index.js +3 -0
- package/es/button/dropdown.js +5 -17
- package/es/button/group.js +47 -65
- package/es/button/index.d.ts +4 -11
- package/es/button/index.js +10 -13
- package/es/cascader/index.d.ts +6 -3
- package/es/cascader/index.js +11 -7
- package/es/ccs.d.ts +9 -10
- package/es/color-picker/index.d.ts +5 -1
- package/es/color-picker/index.js +6 -2
- package/es/context/index.d.ts +24 -2
- package/es/date-picker/index.d.ts +1 -0
- package/es/date-picker/index.js +3 -0
- package/es/dialog/HookDrawer.js +3 -1
- package/es/dialog/HookModal.js +3 -1
- package/es/dialog/button.d.ts +1 -1
- package/es/dialog/context.d.ts +2 -1
- package/es/dialog/hook.d.ts +10 -0
- package/es/dialog/index.d.ts +3 -1
- package/es/dialog/index.js +3 -0
- package/es/editor/index.d.ts +1 -0
- package/es/editor/index.js +3 -0
- package/es/ellipsis/index.d.ts +21 -5
- package/es/ellipsis/index.js +117 -28
- package/es/ellipsis/index.less +5 -0
- package/es/ellipsis/useMeasure.d.ts +9 -0
- package/es/ellipsis/useMeasure.js +142 -0
- package/es/ellipsis/useResizeEffect.d.ts +2 -0
- package/es/ellipsis/useResizeEffect.js +28 -0
- package/es/ellipsis/withStopPropagation.d.ts +4 -0
- package/es/ellipsis/withStopPropagation.js +38 -0
- package/es/hooks/use-app.d.ts +7 -2
- package/es/hooks/use-app.js +8 -3
- package/es/hooks/use-selection.d.ts +28 -0
- package/es/hooks/use-selection.js +148 -0
- package/es/index.d.ts +3 -2
- package/es/index.js +3 -2
- package/es/interval-button/index.js +3 -0
- package/es/layout-keep-alive/index.d.ts +8 -4
- package/es/layout-keep-alive/index.js +94 -49
- package/es/layout-keep-alive/page.d.ts +2 -2
- package/es/layout-keep-alive/page.js +4 -4
- package/es/layout-single-page/index.d.ts +5 -2
- package/es/layout-single-page/index.js +8 -7
- package/es/layout-single-page/page.d.ts +2 -2
- package/es/loading/index.d.ts +4 -1
- package/es/loading/index.js +4 -1
- package/es/pro-table/head.d.ts +8 -7
- package/es/pro-table/head.js +54 -100
- package/es/pro-table/index.d.ts +8 -8
- package/es/pro-table/index.js +8 -3
- package/es/pro-table/index.less +8 -3
- package/es/pro-table/selection-alert.d.ts +18 -0
- package/es/pro-table/selection-alert.js +52 -0
- package/es/pro-table/summary.d.ts +8 -0
- package/es/pro-table/summary.js +32 -0
- package/es/pro-table/table.d.ts +37 -30
- package/es/pro-table/table.js +485 -265
- package/es/pro-table/tree.d.ts +1 -1
- package/es/pro-table/tree.js +9 -15
- package/es/pro-tabs/index.d.ts +5 -2
- package/es/pro-tabs/index.js +16 -6
- package/es/resize-observer.d.ts +2 -2
- package/es/resize-observer.js +2 -2
- package/es/result/index.d.ts +11 -15
- package/es/result/index.js +57 -54
- package/es/select/ modal.d.ts +16 -0
- package/es/select/ modal.js +100 -0
- package/es/select/api.d.ts +25 -0
- package/es/select/api.js +67 -0
- package/es/select/customize.d.ts +37 -0
- package/es/select/customize.js +146 -0
- package/es/select/index.d.ts +20 -20
- package/es/select/index.js +70 -80
- package/es/status-tag/index.d.ts +5 -1
- package/es/status-tag/index.js +6 -2
- package/es/table/index.d.ts +5 -2
- package/es/table/index.js +82 -42
- package/es/table/index.less +27 -42
- package/es/trigger/index.d.ts +1 -0
- package/es/trigger/index.js +1 -0
- package/es/upload/index.d.ts +4 -3
- package/es/upload/index.js +6 -3
- package/es/water-mark/index.d.ts +4 -1
- package/es/water-mark/index.js +3 -0
- package/package.json +5 -4
package/es/dialog/HookDrawer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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 = ["auth", "form", "content", "extraBtn", "className", "rootStyle", "getContainer", "requestFieldNames", "preventRequestHandle", "request", "onClose", "onOk"];
|
|
2
|
+
var _excluded = ["auth", "form", "content", "extraBtn", "className", "rootStyle", "getContainer", "requestFieldNames", "preventRequestHandle", "contextParam", "request", "onClose", "onOk"];
|
|
3
3
|
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; }
|
|
4
4
|
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); } }
|
|
5
5
|
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); }); }; }
|
|
@@ -54,6 +54,7 @@ var HookDrawer = function HookDrawer(props) {
|
|
|
54
54
|
getContainer = innerConfig.getContainer,
|
|
55
55
|
requestFieldNames = innerConfig.requestFieldNames,
|
|
56
56
|
preventRequestHandle = innerConfig.preventRequestHandle,
|
|
57
|
+
contextParam = innerConfig.contextParam,
|
|
57
58
|
request = innerConfig.request,
|
|
58
59
|
onClose = innerConfig.onClose,
|
|
59
60
|
onOk = innerConfig.onOk,
|
|
@@ -137,6 +138,7 @@ var HookDrawer = function HookDrawer(props) {
|
|
|
137
138
|
value: {
|
|
138
139
|
formRef: formRef,
|
|
139
140
|
buttonRef: buttonRef,
|
|
141
|
+
contextParam: contextParam,
|
|
140
142
|
buttonType: 'drawer',
|
|
141
143
|
onOkCallBack: onOk,
|
|
142
144
|
closeDialog: onHandleClose,
|
package/es/dialog/HookModal.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["auth", "form", "title", "content", "extraBtn", "className", "footer", "preventRequestHandle", "requestFieldNames", "onOk", "request", "onClose"];
|
|
1
|
+
var _excluded = ["auth", "form", "title", "content", "extraBtn", "className", "footer", "contextParam", "preventRequestHandle", "requestFieldNames", "onOk", "request", "onClose"];
|
|
2
2
|
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); }
|
|
3
3
|
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; }
|
|
4
4
|
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); } }
|
|
@@ -101,6 +101,7 @@ var HookModal = function HookModal(props) {
|
|
|
101
101
|
extraBtn = innerConfig.extraBtn,
|
|
102
102
|
className = innerConfig.className,
|
|
103
103
|
footer = innerConfig.footer,
|
|
104
|
+
contextParam = innerConfig.contextParam,
|
|
104
105
|
preventRequestHandle = innerConfig.preventRequestHandle,
|
|
105
106
|
requestFieldNames = innerConfig.requestFieldNames,
|
|
106
107
|
onOk = innerConfig.onOk,
|
|
@@ -195,6 +196,7 @@ var HookModal = function HookModal(props) {
|
|
|
195
196
|
value: {
|
|
196
197
|
formRef: formRef,
|
|
197
198
|
buttonRef: buttonRef,
|
|
199
|
+
contextParam: contextParam,
|
|
198
200
|
buttonType: 'modal',
|
|
199
201
|
onOkCallBack: onOk,
|
|
200
202
|
closeDialog: onHandleClose,
|
package/es/dialog/button.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type DialogButtonsProps<T> = Pick<CcsDialogModalProps, 'okText' | 'onClos
|
|
|
16
16
|
export type DialogButtonRef = {
|
|
17
17
|
onSetButtons: (e: React.ReactElement) => void;
|
|
18
18
|
};
|
|
19
|
-
export declare const DialogButtonHolder: <TParams, TData>({ auth, extraBtn, formRef, request, onOk, onClose, buttonRef, requestFieldNames, formInitialValues, preventRequestHandle, }: Pick<CcsDialogModalProps<TParams, TData>, "
|
|
19
|
+
export declare const DialogButtonHolder: <TParams, TData>({ auth, extraBtn, formRef, request, onOk, onClose, buttonRef, requestFieldNames, formInitialValues, preventRequestHandle, }: Pick<CcsDialogModalProps<TParams, TData>, "onClose" | "auth" | "request" | "onOk" | "extraBtn" | "requestFieldNames" | "preventRequestHandle"> & {
|
|
20
20
|
formRef: React.RefObject<DialogFormRef<TParams>>;
|
|
21
21
|
formInitialValues: FormProps['initialValues'];
|
|
22
22
|
buttonRef: RefObject<DialogButtonRef>;
|
package/es/dialog/context.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ import { Store } from 'antd/es/form/interface';
|
|
|
2
2
|
import React, { RefObject } from 'react';
|
|
3
3
|
import { DialogButtonRef } from './button';
|
|
4
4
|
import { DialogFormRef } from './form';
|
|
5
|
-
import { OkEvent } from './hook';
|
|
5
|
+
import { CcsDialogModalProps, OkEvent } from './hook';
|
|
6
6
|
type DialogContextType<T = Store> = {
|
|
7
|
+
contextParam: CcsDialogModalProps['contextParam'];
|
|
7
8
|
/** 表单初始值 */
|
|
8
9
|
formInitialValues: T;
|
|
9
10
|
/** ant form 实例 */
|
package/es/dialog/hook.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DrawerProps, FormProps, ModalFuncProps } from 'antd';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
|
+
import { RecordType } from '../ccs';
|
|
3
4
|
import usePatchElement from './usePatchElement';
|
|
4
5
|
export type CcsDialogModal = {
|
|
5
6
|
destroy: () => void;
|
|
@@ -31,6 +32,15 @@ type DialogProps<TParams, TData> = {
|
|
|
31
32
|
form?: FormProps;
|
|
32
33
|
/** 表单接口请求权限 */
|
|
33
34
|
auth?: string;
|
|
35
|
+
/** 上下文参数、可通过CcsDialog.useInstance获取 */
|
|
36
|
+
contextParam?: {
|
|
37
|
+
/** 当前行数据 */
|
|
38
|
+
record?: RecordType;
|
|
39
|
+
/** 选中行数据 */
|
|
40
|
+
selectedRows?: RecordType[];
|
|
41
|
+
/** 其他扩展参数 */
|
|
42
|
+
contextParam?: RecordType;
|
|
43
|
+
};
|
|
34
44
|
/** 通过参数传递的扩展按钮 */
|
|
35
45
|
extraBtn?: ReactNode;
|
|
36
46
|
/** 确定按钮,返回false 或者 promiss false 则阻止关闭对话框 */
|
package/es/dialog/index.d.ts
CHANGED
|
@@ -14,5 +14,7 @@ type DialogInterface = {
|
|
|
14
14
|
/** drawer footer */
|
|
15
15
|
DrawerFooter: typeof CcsDrawerFooter;
|
|
16
16
|
};
|
|
17
|
-
declare const CcsDialog: typeof ThemeDialog & DialogInterface
|
|
17
|
+
declare const CcsDialog: typeof ThemeDialog & DialogInterface & {
|
|
18
|
+
displayName?: string | undefined;
|
|
19
|
+
};
|
|
18
20
|
export default CcsDialog;
|
package/es/dialog/index.js
CHANGED
|
@@ -9,4 +9,7 @@ CcsDialog.Buttons = CcsDialogFooter;
|
|
|
9
9
|
CcsDialog.useDialog = useCcsDialog;
|
|
10
10
|
CcsDialog.useInstance = useDialogContext;
|
|
11
11
|
CcsDialog.DrawerFooter = CcsDrawerFooter;
|
|
12
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
13
|
+
CcsDialog.displayName = 'CcsDialog';
|
|
14
|
+
}
|
|
12
15
|
export default CcsDialog;
|
package/es/editor/index.d.ts
CHANGED
package/es/editor/index.js
CHANGED
package/es/ellipsis/index.d.ts
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { FC, ReactNode } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './index.less';
|
|
4
|
+
import { PropagationEvent } from './withStopPropagation';
|
|
5
|
+
export type EllipsisProps = {
|
|
6
|
+
content: string;
|
|
7
|
+
direction?: 'start' | 'end' | 'middle';
|
|
8
|
+
rows?: number;
|
|
9
|
+
expandText?: ReactNode;
|
|
10
|
+
collapseText?: ReactNode;
|
|
11
|
+
stopPropagationForActionButtons?: PropagationEvent[];
|
|
12
|
+
onContentClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
13
|
+
defaultExpanded?: boolean;
|
|
14
|
+
showTooltip?: boolean;
|
|
4
15
|
};
|
|
5
|
-
|
|
6
|
-
|
|
16
|
+
/**
|
|
17
|
+
* 文本缩略
|
|
18
|
+
* @param EllipsisProps
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
declare const Ellipsis: FC<EllipsisProps>;
|
|
22
|
+
export default Ellipsis;
|
package/es/ellipsis/index.js
CHANGED
|
@@ -4,35 +4,124 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
4
|
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; }
|
|
5
5
|
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; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
7
|
+
import { CopyOutlined } from '@ant-design/icons';
|
|
8
|
+
import CcsUtils from '@ccs-ui/utils';
|
|
9
|
+
import { Tooltip } from 'antd';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import CcsDialog from "../dialog";
|
|
12
|
+
import "./index.less";
|
|
13
|
+
import useMeasure from "./useMeasure";
|
|
14
|
+
import { useResizeEffect } from "./useResizeEffect";
|
|
15
|
+
import { withStopPropagation } from "./withStopPropagation";
|
|
9
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
|
+
var classPrefix = "ccs-ellipsis";
|
|
20
|
+
var defaultProps = {
|
|
21
|
+
direction: 'end',
|
|
22
|
+
rows: 1,
|
|
23
|
+
expandText: '',
|
|
24
|
+
content: '',
|
|
25
|
+
collapseText: '',
|
|
26
|
+
stopPropagationForActionButtons: [],
|
|
27
|
+
onContentClick: function onContentClick() {},
|
|
28
|
+
defaultExpanded: false,
|
|
29
|
+
showTooltip: false
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 文本缩略
|
|
34
|
+
* @param EllipsisProps
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
var Ellipsis = function Ellipsis(p) {
|
|
38
|
+
var props = CcsUtils.mergeProps(defaultProps, p);
|
|
39
|
+
var direction = props.direction,
|
|
40
|
+
rows = props.rows,
|
|
41
|
+
expandText = props.expandText,
|
|
42
|
+
collapseText = props.collapseText,
|
|
43
|
+
stopPropagationForActionButtons = props.stopPropagationForActionButtons,
|
|
44
|
+
onContentClick = props.onContentClick,
|
|
45
|
+
defaultExpanded = props.defaultExpanded,
|
|
46
|
+
showTooltip = props.showTooltip;
|
|
47
|
+
var content = props.content === null ? '' : props.content.toString();
|
|
48
|
+
|
|
49
|
+
// ============================ Refs ============================
|
|
50
|
+
var rootRef = React.useRef(null);
|
|
51
|
+
|
|
52
|
+
// ========================== Expanded ==========================
|
|
53
|
+
var _React$useState = React.useState(defaultExpanded),
|
|
54
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
55
|
+
expanded = _React$useState2[0],
|
|
56
|
+
setExpanded = _React$useState2[1];
|
|
57
|
+
var expandNode = expandText ? withStopPropagation(stopPropagationForActionButtons, /*#__PURE__*/_jsx("a", {
|
|
58
|
+
onClick: function onClick() {
|
|
59
|
+
setExpanded(true);
|
|
60
|
+
},
|
|
61
|
+
children: expandText
|
|
62
|
+
})) : null;
|
|
63
|
+
var collapseNode = collapseText ? withStopPropagation(stopPropagationForActionButtons, /*#__PURE__*/_jsx("a", {
|
|
64
|
+
onClick: function onClick() {
|
|
65
|
+
setExpanded(false);
|
|
66
|
+
},
|
|
67
|
+
children: collapseText
|
|
68
|
+
})) : null;
|
|
69
|
+
|
|
70
|
+
// ========================== Ellipsis ==========================
|
|
71
|
+
var _useMeasure = useMeasure(content, rows, direction, expanded, expandNode, collapseNode),
|
|
72
|
+
_useMeasure2 = _slicedToArray(_useMeasure, 3),
|
|
73
|
+
measureNodes = _useMeasure2[0],
|
|
74
|
+
status = _useMeasure2[1],
|
|
75
|
+
forceResize = _useMeasure2[2];
|
|
76
|
+
useResizeEffect(forceResize, rootRef);
|
|
77
|
+
|
|
78
|
+
// =========================== Render ===========================
|
|
79
|
+
var renderNode = /*#__PURE__*/_jsx("div", {
|
|
80
|
+
ref: rootRef,
|
|
81
|
+
className: classPrefix,
|
|
82
|
+
onClick: function onClick(e) {
|
|
83
|
+
if (e.target === e.currentTarget) {
|
|
84
|
+
onContentClick(e);
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
children: measureNodes
|
|
88
|
+
});
|
|
89
|
+
if (status === 100 || !showTooltip) {
|
|
90
|
+
return renderNode;
|
|
91
|
+
}
|
|
92
|
+
if (showTooltip) {
|
|
93
|
+
return /*#__PURE__*/_jsx(Tooltip, {
|
|
94
|
+
zIndex: 9999,
|
|
95
|
+
title: function title() {
|
|
96
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
97
|
+
children: [content, /*#__PURE__*/_jsxs("a", {
|
|
98
|
+
style: {
|
|
99
|
+
color: 'gray',
|
|
100
|
+
display: 'block'
|
|
101
|
+
},
|
|
102
|
+
onClick: function onClick() {
|
|
103
|
+
var _CcsDialog$message;
|
|
104
|
+
CcsUtils.copy(content);
|
|
105
|
+
(_CcsDialog$message = CcsDialog.message) === null || _CcsDialog$message === void 0 || _CcsDialog$message.info('复制成功');
|
|
106
|
+
},
|
|
107
|
+
children: [/*#__PURE__*/_jsx(CopyOutlined, {
|
|
108
|
+
style: {
|
|
109
|
+
marginRight: 5
|
|
110
|
+
}
|
|
111
|
+
}), "\u590D\u5236"]
|
|
112
|
+
})]
|
|
113
|
+
});
|
|
23
114
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
maxLine: maxLine,
|
|
29
|
-
ellipsis: /*#__PURE__*/_jsx("a", {
|
|
30
|
-
onClick: function onClick() {
|
|
31
|
-
return setIsShowMore(true);
|
|
115
|
+
placement: "bottomLeft",
|
|
116
|
+
destroyTooltipOnHide: true,
|
|
117
|
+
overlayInnerStyle: {
|
|
118
|
+
whiteSpace: 'normal'
|
|
32
119
|
},
|
|
33
|
-
children:
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
120
|
+
children: renderNode
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
125
|
+
Ellipsis.displayName = 'CcsEllipsis';
|
|
126
|
+
}
|
|
127
|
+
export default Ellipsis;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const enum MEASURE_STATUS {
|
|
3
|
+
PREPARE = 1,
|
|
4
|
+
MEASURE_WALKING = 2,
|
|
5
|
+
STABLE_ELLIPSIS = 99,
|
|
6
|
+
STABLE_NO_ELLIPSIS = 100
|
|
7
|
+
}
|
|
8
|
+
export default function useMeasure(content: string, rows: number, direction: 'start' | 'end' | 'middle', expanded: boolean, expandNode: React.ReactElement | null, collapseNode: React.ReactElement | null): readonly [import("react/jsx-runtime").JSX.Element, MEASURE_STATUS, () => void];
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { useEvent } from 'rc-util';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { unstable_batchedUpdates } from 'react-dom';
|
|
10
|
+
import runes from 'runes2';
|
|
11
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
var ELLIPSIS_TEXT = '...';
|
|
15
|
+
var measureStyle = {
|
|
16
|
+
visibility: 'hidden',
|
|
17
|
+
whiteSpace: 'inherit',
|
|
18
|
+
lineHeight: 'inherit',
|
|
19
|
+
fontSize: 'inherit'
|
|
20
|
+
};
|
|
21
|
+
export default function useMeasure(content, rows, direction, expanded, expandNode, collapseNode) {
|
|
22
|
+
var contentChars = React.useMemo(function () {
|
|
23
|
+
return runes(content);
|
|
24
|
+
}, [content]);
|
|
25
|
+
var _React$useState = React.useState(0),
|
|
26
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
27
|
+
maxHeight = _React$useState2[0],
|
|
28
|
+
setMaxHeight = _React$useState2[1];
|
|
29
|
+
var _React$useState3 = React.useState([0, 0]),
|
|
30
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
31
|
+
walkingIndexes = _React$useState4[0],
|
|
32
|
+
setWalkingIndexes = _React$useState4[1];
|
|
33
|
+
var midIndex = Math.ceil((walkingIndexes[0] + walkingIndexes[1]) / 2);
|
|
34
|
+
var _React$useState5 = React.useState(100),
|
|
35
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
36
|
+
status = _React$useState6[0],
|
|
37
|
+
setStatus = _React$useState6[1];
|
|
38
|
+
|
|
39
|
+
// ============================ Refs ============================
|
|
40
|
+
var singleRowMeasureRef = React.useRef(null);
|
|
41
|
+
var fullMeasureRef = React.useRef(null);
|
|
42
|
+
var midMeasureRef = React.useRef(null);
|
|
43
|
+
var startMeasure = useEvent(function () {
|
|
44
|
+
// use batch update to avoid async update trigger 2 render
|
|
45
|
+
unstable_batchedUpdates(function () {
|
|
46
|
+
setStatus(1);
|
|
47
|
+
setWalkingIndexes([0, direction === 'middle' ? Math.ceil(contentChars.length / 2) : contentChars.length]);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Initialize
|
|
52
|
+
React.useLayoutEffect(function () {
|
|
53
|
+
startMeasure();
|
|
54
|
+
}, [contentChars, rows]);
|
|
55
|
+
|
|
56
|
+
// Measure element height
|
|
57
|
+
React.useLayoutEffect(function () {
|
|
58
|
+
if (status === 1) {
|
|
59
|
+
var _fullMeasureRef$curre, _singleRowMeasureRef$;
|
|
60
|
+
var fullMeasureHeight = ((_fullMeasureRef$curre = fullMeasureRef.current) === null || _fullMeasureRef$curre === void 0 ? void 0 : _fullMeasureRef$curre.offsetHeight) || 0;
|
|
61
|
+
var singleRowMeasureHeight = ((_singleRowMeasureRef$ = singleRowMeasureRef.current) === null || _singleRowMeasureRef$ === void 0 ? void 0 : _singleRowMeasureRef$.offsetHeight) || 0;
|
|
62
|
+
var rowMeasureHeight = singleRowMeasureHeight * (rows + 0.5);
|
|
63
|
+
if (fullMeasureHeight <= rowMeasureHeight) {
|
|
64
|
+
setStatus(100);
|
|
65
|
+
} else {
|
|
66
|
+
setMaxHeight(rowMeasureHeight);
|
|
67
|
+
setStatus(2);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}, [status]);
|
|
71
|
+
|
|
72
|
+
// Walking measure
|
|
73
|
+
React.useLayoutEffect(function () {
|
|
74
|
+
if (status === 2) {
|
|
75
|
+
var _midMeasureRef$curren;
|
|
76
|
+
var diff = walkingIndexes[1] - walkingIndexes[0];
|
|
77
|
+
var midHeight = ((_midMeasureRef$curren = midMeasureRef.current) === null || _midMeasureRef$curren === void 0 ? void 0 : _midMeasureRef$curren.offsetHeight) || 0;
|
|
78
|
+
if (diff > 1) {
|
|
79
|
+
if (midHeight > maxHeight) {
|
|
80
|
+
setWalkingIndexes([walkingIndexes[0], midIndex]);
|
|
81
|
+
} else {
|
|
82
|
+
setWalkingIndexes([midIndex, walkingIndexes[1]]);
|
|
83
|
+
}
|
|
84
|
+
} else {
|
|
85
|
+
if (midHeight > maxHeight) {
|
|
86
|
+
setWalkingIndexes([walkingIndexes[0], walkingIndexes[0]]);
|
|
87
|
+
} else {
|
|
88
|
+
setWalkingIndexes([walkingIndexes[1], walkingIndexes[1]]);
|
|
89
|
+
}
|
|
90
|
+
setStatus(99);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}, [status, walkingIndexes]);
|
|
94
|
+
|
|
95
|
+
// =========================== Render ===========================
|
|
96
|
+
/** Render by cut index */
|
|
97
|
+
var renderContent = function renderContent(index) {
|
|
98
|
+
var prefixContent = contentChars.slice(0, index);
|
|
99
|
+
var suffixContent = contentChars.slice(contentChars.length - index);
|
|
100
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
101
|
+
children: [direction === 'start' && /*#__PURE__*/_jsxs(_Fragment, {
|
|
102
|
+
children: [expandNode, ELLIPSIS_TEXT]
|
|
103
|
+
}), direction !== 'start' && prefixContent.join(''), direction === 'middle' && /*#__PURE__*/_jsx(_Fragment, {
|
|
104
|
+
children: expandNode ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
105
|
+
children: [ELLIPSIS_TEXT, expandNode, ELLIPSIS_TEXT]
|
|
106
|
+
}) : ELLIPSIS_TEXT
|
|
107
|
+
}), direction !== 'end' && suffixContent.join(''), direction === 'end' && /*#__PURE__*/_jsxs(_Fragment, {
|
|
108
|
+
children: [ELLIPSIS_TEXT, expandNode]
|
|
109
|
+
})]
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
var finalContent = React.useMemo(function () {
|
|
113
|
+
if (expanded || status === 100) {
|
|
114
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
115
|
+
children: [content, status === 99 && collapseNode]
|
|
116
|
+
}, "display");
|
|
117
|
+
}
|
|
118
|
+
if (status === 99) {
|
|
119
|
+
return renderContent(midIndex);
|
|
120
|
+
}
|
|
121
|
+
return null;
|
|
122
|
+
}, [expanded, status, content, collapseNode, midIndex]);
|
|
123
|
+
var allNodes = /*#__PURE__*/_jsxs(_Fragment, {
|
|
124
|
+
children: [status === 1 && /*#__PURE__*/_jsxs("div", {
|
|
125
|
+
"aria-hidden": true,
|
|
126
|
+
ref: fullMeasureRef,
|
|
127
|
+
style: measureStyle,
|
|
128
|
+
children: [content, expandNode]
|
|
129
|
+
}, "full"), status === 1 && /*#__PURE__*/_jsx("div", {
|
|
130
|
+
"aria-hidden": true,
|
|
131
|
+
ref: singleRowMeasureRef,
|
|
132
|
+
style: measureStyle,
|
|
133
|
+
children: "\xA0"
|
|
134
|
+
}, "stable"), status === 2 && /*#__PURE__*/_jsx("div", {
|
|
135
|
+
"aria-hidden": true,
|
|
136
|
+
ref: midMeasureRef,
|
|
137
|
+
style: measureStyle,
|
|
138
|
+
children: renderContent(midIndex)
|
|
139
|
+
}, "walking-mid"), finalContent]
|
|
140
|
+
});
|
|
141
|
+
return [allNodes, status, startMeasure];
|
|
142
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useIsomorphicLayoutEffect, useMemoizedFn } from 'ahooks';
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
export function useResizeEffect(effect, targetRef) {
|
|
4
|
+
var ref = useRef(0);
|
|
5
|
+
var fn = useMemoizedFn(effect);
|
|
6
|
+
useIsomorphicLayoutEffect(function () {
|
|
7
|
+
var target = targetRef.current;
|
|
8
|
+
if (!target) return;
|
|
9
|
+
if (window.ResizeObserver) {
|
|
10
|
+
var animationFrame;
|
|
11
|
+
var observer = new ResizeObserver(function () {
|
|
12
|
+
// 隐藏了,为0不处理
|
|
13
|
+
if (target.clientWidth === 0 || (target === null || target === void 0 ? void 0 : target.clientWidth) === ref.current) return;
|
|
14
|
+
animationFrame = window.requestAnimationFrame(function () {
|
|
15
|
+
return fn(target);
|
|
16
|
+
});
|
|
17
|
+
ref.current = target === null || target === void 0 ? void 0 : target.clientWidth;
|
|
18
|
+
});
|
|
19
|
+
observer.observe(target);
|
|
20
|
+
return function () {
|
|
21
|
+
window.cancelAnimationFrame(animationFrame);
|
|
22
|
+
observer.disconnect();
|
|
23
|
+
};
|
|
24
|
+
} else {
|
|
25
|
+
fn(target);
|
|
26
|
+
}
|
|
27
|
+
}, [targetRef]);
|
|
28
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export type PropagationEvent = 'click' | 'touchstart';
|
|
4
|
+
export declare function withStopPropagation(events: PropagationEvent[], element: ReactElement): ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
@@ -0,0 +1,38 @@
|
|
|
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 _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
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
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
+
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); }
|
|
10
|
+
import React from 'react';
|
|
11
|
+
var eventToPropRecord = {
|
|
12
|
+
click: 'onClick',
|
|
13
|
+
touchstart: 'onTouchStart'
|
|
14
|
+
};
|
|
15
|
+
export function withStopPropagation(events, element) {
|
|
16
|
+
var props = _objectSpread({}, element.props);
|
|
17
|
+
var _iterator = _createForOfIteratorHelper(events),
|
|
18
|
+
_step;
|
|
19
|
+
try {
|
|
20
|
+
var _loop = function _loop() {
|
|
21
|
+
var key = _step.value;
|
|
22
|
+
var prop = eventToPropRecord[key];
|
|
23
|
+
props[prop] = function (e) {
|
|
24
|
+
var _element$props$prop, _element$props;
|
|
25
|
+
e.stopPropagation();
|
|
26
|
+
(_element$props$prop = (_element$props = element.props)[prop]) === null || _element$props$prop === void 0 || _element$props$prop.call(_element$props, e);
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
30
|
+
_loop();
|
|
31
|
+
}
|
|
32
|
+
} catch (err) {
|
|
33
|
+
_iterator.e(err);
|
|
34
|
+
} finally {
|
|
35
|
+
_iterator.f();
|
|
36
|
+
}
|
|
37
|
+
return /*#__PURE__*/React.cloneElement(element, props);
|
|
38
|
+
}
|
package/es/hooks/use-app.d.ts
CHANGED
|
@@ -6,8 +6,13 @@ declare const useAppConfig: () => import("../context").CssAppConfigType;
|
|
|
6
6
|
export declare const useProTableFields: () => {
|
|
7
7
|
dataSource: string[];
|
|
8
8
|
total: string[];
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
requestParam: {
|
|
10
|
+
pageNo: string[];
|
|
11
|
+
pageSize: string[];
|
|
12
|
+
query?: string[] | undefined;
|
|
13
|
+
orderProps?: string[] | undefined;
|
|
14
|
+
filters?: string[] | undefined;
|
|
15
|
+
};
|
|
11
16
|
};
|
|
12
17
|
export declare const useProTableTreeFields: () => {
|
|
13
18
|
dataSource: string[];
|
package/es/hooks/use-app.js
CHANGED
|
@@ -23,9 +23,14 @@ export var useProTableFields = function useProTableFields() {
|
|
|
23
23
|
var context = useContext(AppConfigContext) || {};
|
|
24
24
|
return _objectSpread({
|
|
25
25
|
dataSource: ['data', 'result'],
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
total: ['data', 'totalNum'],
|
|
27
|
+
requestParam: {
|
|
28
|
+
pageNo: ['pageNo'],
|
|
29
|
+
pageSize: ['pageSize'],
|
|
30
|
+
filters: ['filters'],
|
|
31
|
+
orderProps: ['orderProps'],
|
|
32
|
+
query: ['query']
|
|
33
|
+
}
|
|
29
34
|
}, context === null || context === void 0 || (_context$fieldNames = context.fieldNames) === null || _context$fieldNames === void 0 ? void 0 : _context$fieldNames.proTable);
|
|
30
35
|
};
|
|
31
36
|
export var useProTableTreeFields = function useProTableTreeFields() {
|