@lemon-fe/components 1.1.5-alpha.1 → 1.2.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/base-table/index.js +10 -3
- package/es/base-table/locale/en_US.d.ts +3 -0
- package/es/base-table/locale/en_US.js +5 -0
- package/es/base-table/locale/locale.d.ts +4 -0
- package/es/base-table/locale/locale.js +1 -0
- package/es/base-table/locale/zh_CN.d.ts +3 -0
- package/es/base-table/locale/zh_CN.js +5 -0
- package/es/color-picker/index.js +6 -2
- package/es/color-picker/locale/en_US.d.ts +3 -0
- package/es/color-picker/locale/en_US.js +4 -0
- package/es/color-picker/locale/locale.d.ts +3 -0
- package/es/color-picker/locale/locale.js +1 -0
- package/es/color-picker/locale/zh_CN.d.ts +3 -0
- package/es/color-picker/locale/zh_CN.js +4 -0
- package/es/data-grid/cell-editors/text.js +11 -2
- package/es/data-grid/components/custom-panel/field-modal.js +17 -9
- package/es/data-grid/components/custom-panel/index.js +11 -7
- package/es/data-grid/components/custom-panel/item.js +6 -2
- package/es/data-grid/components/search.js +8 -4
- package/es/data-grid/components/selected.js +9 -2
- package/es/data-grid/hooks.d.ts +4 -4
- package/es/data-grid/index.d.ts +44 -27
- package/es/data-grid/index.js +157 -145
- package/es/data-grid/locale/en_US.d.ts +3 -0
- package/es/data-grid/locale/en_US.js +55 -0
- package/es/data-grid/locale/locale.d.ts +35 -0
- package/es/data-grid/locale/locale.js +1 -0
- package/es/data-grid/locale/zh_CN.d.ts +3 -0
- package/es/data-grid/locale/zh_CN.js +55 -0
- package/es/data-grid/renderer/actions.js +11 -1
- package/es/data-grid/typings.d.ts +2 -2
- package/es/duration-picker/index.d.ts +1 -0
- package/es/duration-picker/index.js +80 -52
- package/es/duration-picker/locale/en_US.d.ts +3 -0
- package/es/duration-picker/locale/en_US.js +11 -0
- package/es/duration-picker/locale/locale.d.ts +10 -0
- package/es/duration-picker/locale/locale.js +1 -0
- package/es/duration-picker/locale/zh_CN.d.ts +3 -0
- package/es/duration-picker/locale/zh_CN.js +11 -0
- package/es/filter/index.js +84 -66
- package/es/filter/index.less +5 -0
- package/es/filter/locale/en_US.d.ts +3 -0
- package/es/filter/locale/en_US.js +22 -0
- package/es/filter/locale/locale.d.ts +22 -0
- package/es/filter/locale/locale.js +1 -0
- package/es/filter/locale/zh_CN.d.ts +3 -0
- package/es/filter/locale/zh_CN.js +22 -0
- package/es/index.d.ts +6 -1
- package/es/index.js +6 -2
- package/es/locale/en_US.d.ts +3 -0
- package/es/locale/en_US.js +32 -0
- package/es/locale/locale.d.ts +29 -0
- package/es/locale/locale.js +7 -0
- package/es/locale/zh_CN.d.ts +3 -0
- package/es/locale/zh_CN.js +65 -0
- package/es/locale-receiver.d.ts +4 -0
- package/es/locale-receiver.js +20 -0
- package/es/select-panel/index.js +15 -4
- package/es/select-panel/locale/en_US.d.ts +3 -0
- package/es/select-panel/locale/en_US.js +5 -0
- package/es/select-panel/locale/locale.d.ts +4 -0
- package/es/select-panel/locale/locale.js +1 -0
- package/es/select-panel/locale/zh_CN.d.ts +3 -0
- package/es/select-panel/locale/zh_CN.js +5 -0
- package/es/select-view/index.js +10 -4
- package/es/select-view/locale/en_US.d.ts +3 -0
- package/es/select-view/locale/en_US.js +6 -0
- package/es/select-view/locale/locale.d.ts +5 -0
- package/es/select-view/locale/locale.js +1 -0
- package/es/select-view/locale/zh_CN.d.ts +3 -0
- package/es/select-view/locale/zh_CN.js +6 -0
- package/es/sider-tree/index.d.ts +1 -1
- package/es/sider-tree/index.js +6 -2
- package/es/sider-tree/locale/en_US.d.ts +3 -0
- package/es/sider-tree/locale/en_US.js +5 -0
- package/es/sider-tree/locale/locale.d.ts +4 -0
- package/es/sider-tree/locale/locale.js +1 -0
- package/es/sider-tree/locale/zh_CN.d.ts +3 -0
- package/es/sider-tree/locale/zh_CN.js +5 -0
- package/es/sider-tree/tree-node-title.js +6 -2
- package/package.json +2 -2
package/es/data-grid/index.js
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
var _excluded = ["validator"],
|
|
2
2
|
_excluded2 = ["title", "dataIndex", "render", "ellipsis", "sorter", "editable", "className"],
|
|
3
3
|
_excluded3 = ["title", "children"],
|
|
4
|
-
_excluded4 = ["rowKey", "fetch", "dataSource", "rowActions", "columns", "autoLoad", "loading", "summary", "detailCell", "pagination", "rowSelection", "columnTypes", "defaultColDef", "components", "sideBar", "detailCellRendererParams", "context", "showSearch", "cellDisplayFlex"];
|
|
4
|
+
_excluded4 = ["rowKey", "fetch", "dataSource", "rowActions", "columns", "autoLoad", "loading", "summary", "detailCell", "pagination", "rowSelection", "columnTypes", "defaultColDef", "components", "sideBar", "detailCellRendererParams", "context", "showSearch", "cellDisplayFlex", "locale"];
|
|
5
5
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
6
6
|
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; }
|
|
7
7
|
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; }
|
|
8
8
|
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); }
|
|
9
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
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
9
|
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; }
|
|
14
10
|
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; }
|
|
15
11
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
16
12
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
13
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
19
14
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
20
|
-
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; }
|
|
21
15
|
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; }
|
|
22
16
|
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); } }
|
|
23
17
|
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); }); }; }
|
|
@@ -34,9 +28,17 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
34
28
|
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; }
|
|
35
29
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
36
30
|
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); }
|
|
31
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
32
|
+
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."); }
|
|
33
|
+
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); }
|
|
34
|
+
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; }
|
|
35
|
+
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; } }
|
|
36
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
37
|
import { Spin, Pagination } from 'antd';
|
|
38
|
-
import React, { Component, createRef } from 'react';
|
|
38
|
+
import React, { Component, createRef, forwardRef, useContext } from 'react';
|
|
39
39
|
import { ComponentConfigureContext } from "../component-configure";
|
|
40
|
+
import { useLocaleReceiver } from "../locale-receiver";
|
|
41
|
+
import { parseLocalTemplate } from "../locale/locale";
|
|
40
42
|
import DateEditor from "./cell-editors/date";
|
|
41
43
|
import NumberEditor from "./cell-editors/number";
|
|
42
44
|
import RowEditor, { RowEditorData } from "./cell-editors/row";
|
|
@@ -48,6 +50,7 @@ import Search from "./components/search";
|
|
|
48
50
|
import Selected from "./components/selected";
|
|
49
51
|
import GridStoreContext from "./context/grid-store";
|
|
50
52
|
import { useGridStore } from "./hooks";
|
|
53
|
+
import defaultLocale from "./locale/zh_CN";
|
|
51
54
|
import { ClipboardModule } from "./modules/clipboard/main";
|
|
52
55
|
import { ColumnsToolPanelModule } from "./modules/column-tool-panel/main";
|
|
53
56
|
import { MasterDetailModule } from "./modules/master-detail/main";
|
|
@@ -109,22 +112,58 @@ function unsort() {
|
|
|
109
112
|
return 0;
|
|
110
113
|
}
|
|
111
114
|
function EmptyOverlay(props) {
|
|
115
|
+
var _useLocaleReceiver = useLocaleReceiver('BaseTable'),
|
|
116
|
+
_useLocaleReceiver2 = _slicedToArray(_useLocaleReceiver, 1),
|
|
117
|
+
noDataText = _useLocaleReceiver2[0].noDataText;
|
|
112
118
|
var err = useGridStore(function (state) {
|
|
113
119
|
return state.fetchError;
|
|
114
120
|
});
|
|
115
121
|
var _props$desc = props.desc,
|
|
116
|
-
desc = _props$desc === void 0 ?
|
|
122
|
+
desc = _props$desc === void 0 ? noDataText : _props$desc;
|
|
117
123
|
return /*#__PURE__*/React.createElement("div", {
|
|
118
124
|
className: prefix('empty-overlay')
|
|
119
125
|
}, err ? err.message : desc, "~");
|
|
120
126
|
}
|
|
121
|
-
var
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
127
|
+
var defaultProps = {
|
|
128
|
+
stopEditingWhenCellsLoseFocus: true,
|
|
129
|
+
autoLoad: false,
|
|
130
|
+
localeText: defaultLocale.localeText,
|
|
131
|
+
locale: defaultLocale
|
|
132
|
+
};
|
|
133
|
+
var SummaryFlag = Symbol('summary');
|
|
134
|
+
var IndexColId = '$$index';
|
|
135
|
+
var EmptyCol = {
|
|
136
|
+
colId: '$$empty',
|
|
137
|
+
flex: 1,
|
|
138
|
+
resizable: false,
|
|
139
|
+
suppressMovable: true,
|
|
140
|
+
headerName: '',
|
|
141
|
+
suppressNavigable: true,
|
|
142
|
+
lockVisible: true,
|
|
143
|
+
suppressMenu: true,
|
|
144
|
+
suppressColumnsToolPanel: true
|
|
145
|
+
};
|
|
146
|
+
var Editors = {
|
|
147
|
+
Text: TextEditor,
|
|
148
|
+
Date: DateEditor,
|
|
149
|
+
Number: NumberEditor,
|
|
150
|
+
Select: SelectEditor,
|
|
151
|
+
Wrapper: EditorWrapper
|
|
152
|
+
};
|
|
153
|
+
function isSummaryRow(_ref) {
|
|
154
|
+
var node = _ref.node;
|
|
155
|
+
if (node && node.data && node.data[SummaryFlag]) {
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
161
|
+
_inherits(InternalDataGrid, _Component);
|
|
162
|
+
var _super = _createSuper(InternalDataGrid);
|
|
163
|
+
function InternalDataGrid(props) {
|
|
125
164
|
var _this;
|
|
126
|
-
_classCallCheck(this,
|
|
127
|
-
_this = _super.call(this, props
|
|
165
|
+
_classCallCheck(this, InternalDataGrid);
|
|
166
|
+
_this = _super.call(this, props);
|
|
128
167
|
_defineProperty(_assertThisInitialized(_this), "api", new GridApi());
|
|
129
168
|
_defineProperty(_assertThisInitialized(_this), "columnApi", new ColumnApi());
|
|
130
169
|
_defineProperty(_assertThisInitialized(_this), "selected", void 0);
|
|
@@ -195,7 +234,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
195
234
|
return summary;
|
|
196
235
|
}));
|
|
197
236
|
_defineProperty(_assertThisInitialized(_this), "init", /*#__PURE__*/function () {
|
|
198
|
-
var
|
|
237
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(args) {
|
|
199
238
|
var api, columnApi, onGridReady;
|
|
200
239
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
201
240
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -216,8 +255,8 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
216
255
|
});
|
|
217
256
|
|
|
218
257
|
// 用于同步selection
|
|
219
|
-
api.addEventListener('rowSelected', function (
|
|
220
|
-
var node =
|
|
258
|
+
api.addEventListener('rowSelected', function (_ref3) {
|
|
259
|
+
var node = _ref3.node;
|
|
221
260
|
var rowSelection = _this.props.rowSelection;
|
|
222
261
|
if (rowSelection !== undefined && node.id !== undefined && node.data !== undefined && api.getRowNode(node.id) !== undefined) {
|
|
223
262
|
var prevSelected = _this.selected.has(node.id);
|
|
@@ -255,7 +294,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
255
294
|
}, _callee);
|
|
256
295
|
}));
|
|
257
296
|
return function (_x) {
|
|
258
|
-
return
|
|
297
|
+
return _ref2.apply(this, arguments);
|
|
259
298
|
};
|
|
260
299
|
}());
|
|
261
300
|
_defineProperty(_assertThisInitialized(_this), "NoRowsOverlay", function () {
|
|
@@ -372,6 +411,9 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
372
411
|
_defineProperty(_assertThisInitialized(_this), "getMemoizedColumnTypes", memoizeOne(function (columnTypesProp) {
|
|
373
412
|
return _objectSpread(_objectSpread({}, columnTypes), columnTypesProp);
|
|
374
413
|
}));
|
|
414
|
+
_defineProperty(_assertThisInitialized(_this), "getMemoizedLocaleText", memoizeOne(function (localeTextProp) {
|
|
415
|
+
return _objectSpread(_objectSpread({}, _this.props.localeText), localeTextProp);
|
|
416
|
+
}));
|
|
375
417
|
_defineProperty(_assertThisInitialized(_this), "getMemoizedComponents", memoizeOne(function (componentsProp) {
|
|
376
418
|
return _objectSpread(_objectSpread({}, defaultComponents), componentsProp);
|
|
377
419
|
}, function (next, prev) {
|
|
@@ -437,16 +479,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
437
479
|
_this.syncColRender();
|
|
438
480
|
return _this;
|
|
439
481
|
}
|
|
440
|
-
|
|
441
|
-
/** TODO目前只应用在部分地方,临时解决一下获取的columnTypes不正确的问题,考虑未来转成函数组件 */
|
|
442
|
-
_createClass(DataGrid, [{
|
|
443
|
-
key: "getProps",
|
|
444
|
-
value: function getProps(props) {
|
|
445
|
-
var reactCtx = this.context;
|
|
446
|
-
var target = props || this.props;
|
|
447
|
-
return _objectSpread(_objectSpread({}, reactCtx.DataGrid), target);
|
|
448
|
-
}
|
|
449
|
-
}, {
|
|
482
|
+
_createClass(InternalDataGrid, [{
|
|
450
483
|
key: "setField",
|
|
451
484
|
value: function setField(field) {
|
|
452
485
|
var newFields = _toConsumableArray(this.fields);
|
|
@@ -526,9 +559,9 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
526
559
|
}, {
|
|
527
560
|
key: "getPagination",
|
|
528
561
|
value: function getPagination() {
|
|
529
|
-
var _this$
|
|
530
|
-
pagination = _this$
|
|
531
|
-
fetch = _this$
|
|
562
|
+
var _this$props3 = this.props,
|
|
563
|
+
pagination = _this$props3.pagination,
|
|
564
|
+
fetch = _this$props3.fetch;
|
|
532
565
|
var page = 1;
|
|
533
566
|
var pageSize = 50;
|
|
534
567
|
var total = 0;
|
|
@@ -559,11 +592,11 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
559
592
|
value: function componentDidUpdate(prevProps) {
|
|
560
593
|
var _this2 = this,
|
|
561
594
|
_prevProps$rowSelecti;
|
|
562
|
-
var _this$
|
|
563
|
-
columns = _this$
|
|
564
|
-
rowSelection = _this$
|
|
565
|
-
dataSource = _this$
|
|
566
|
-
context = _this$
|
|
595
|
+
var _this$props4 = this.props,
|
|
596
|
+
columns = _this$props4.columns,
|
|
597
|
+
rowSelection = _this$props4.rowSelection,
|
|
598
|
+
dataSource = _this$props4.dataSource,
|
|
599
|
+
context = _this$props4.context;
|
|
567
600
|
if (columns !== prevProps.columns) {
|
|
568
601
|
this.syncColRender();
|
|
569
602
|
this.afterReady(function () {
|
|
@@ -599,14 +632,14 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
599
632
|
key: "componentDidMount",
|
|
600
633
|
value: function () {
|
|
601
634
|
var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
602
|
-
var _this$
|
|
635
|
+
var _this$props5, customColumnPanelStorage, autoLoad, state, data;
|
|
603
636
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
604
637
|
while (1) switch (_context3.prev = _context3.next) {
|
|
605
638
|
case 0:
|
|
606
639
|
window.addEventListener('blur', this.handleFocus);
|
|
607
640
|
|
|
608
641
|
/** 加载定制列数据如果接口很慢的话,可能会存在列更新的时序问题,尝试过阻塞其他操作,但在明细页面依旧会出现2个加载动画的情况。未来尝试解决 */
|
|
609
|
-
_this$
|
|
642
|
+
_this$props5 = this.props, customColumnPanelStorage = _this$props5.customColumnPanelStorage, autoLoad = _this$props5.autoLoad;
|
|
610
643
|
if (!customColumnPanelStorage) {
|
|
611
644
|
_context3.next = 16;
|
|
612
645
|
break;
|
|
@@ -785,9 +818,10 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
785
818
|
if (col.type === undefined) {
|
|
786
819
|
return _objectSpread({}, col);
|
|
787
820
|
}
|
|
788
|
-
var _this$
|
|
789
|
-
mColumnTypes = _this$
|
|
790
|
-
mDefaultColDef = _this$
|
|
821
|
+
var _this$props6 = this.props,
|
|
822
|
+
mColumnTypes = _this$props6.columnTypes,
|
|
823
|
+
mDefaultColDef = _this$props6.defaultColDef,
|
|
824
|
+
locale = _this$props6.locale;
|
|
791
825
|
var colTypes = this.getMemoizedColumnTypes(mColumnTypes);
|
|
792
826
|
var result = {};
|
|
793
827
|
var types;
|
|
@@ -810,11 +844,12 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
810
844
|
value: function getColumnDefs() {
|
|
811
845
|
var _this5 = this,
|
|
812
846
|
_this$props$customCol;
|
|
813
|
-
var _this$
|
|
814
|
-
_this$
|
|
815
|
-
columns = _this$
|
|
816
|
-
rowActions = _this$
|
|
817
|
-
rowSelection = _this$
|
|
847
|
+
var _this$props7 = this.props,
|
|
848
|
+
_this$props7$columns = _this$props7.columns,
|
|
849
|
+
columns = _this$props7$columns === void 0 ? [] : _this$props7$columns,
|
|
850
|
+
rowActions = _this$props7.rowActions,
|
|
851
|
+
rowSelection = _this$props7.rowSelection,
|
|
852
|
+
locale = _this$props7.locale;
|
|
818
853
|
var leafColIds = [];
|
|
819
854
|
var map = function map(cols) {
|
|
820
855
|
return cols.map(function (item) {
|
|
@@ -884,7 +919,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
884
919
|
valueSetter = editable.valueSetter,
|
|
885
920
|
enable = editable.enable;
|
|
886
921
|
opts.editable = function (mParams) {
|
|
887
|
-
if (
|
|
922
|
+
if (isSummaryRow({
|
|
888
923
|
node: mParams.node
|
|
889
924
|
})) {
|
|
890
925
|
return false;
|
|
@@ -1019,9 +1054,9 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1019
1054
|
'/': divide,
|
|
1020
1055
|
'*': multiply
|
|
1021
1056
|
});
|
|
1022
|
-
mCode.evaluate(Object.fromEntries(Object.entries(scopeMap).map(function (
|
|
1023
|
-
var
|
|
1024
|
-
k =
|
|
1057
|
+
mCode.evaluate(Object.fromEntries(Object.entries(scopeMap).map(function (_ref4) {
|
|
1058
|
+
var _ref5 = _slicedToArray(_ref4, 1),
|
|
1059
|
+
k = _ref5[0];
|
|
1025
1060
|
return [k, 1];
|
|
1026
1061
|
})));
|
|
1027
1062
|
code = mCode;
|
|
@@ -1033,7 +1068,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1033
1068
|
node = params.node,
|
|
1034
1069
|
columnApi = params.columnApi;
|
|
1035
1070
|
if (node !== null && node.data !== undefined) {
|
|
1036
|
-
if (
|
|
1071
|
+
if (isSummaryRow({
|
|
1037
1072
|
node: node
|
|
1038
1073
|
}) && field.summaryType === 1) {
|
|
1039
1074
|
var summary = _this5.getFieldsSummary(_this5.dataSource, _this5.fields);
|
|
@@ -1057,10 +1092,10 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1057
1092
|
};
|
|
1058
1093
|
if (code) {
|
|
1059
1094
|
try {
|
|
1060
|
-
var scope = Object.fromEntries(Object.entries(scopeMap).map(function (
|
|
1095
|
+
var scope = Object.fromEntries(Object.entries(scopeMap).map(function (_ref6) {
|
|
1061
1096
|
var _getValue;
|
|
1062
|
-
var
|
|
1063
|
-
k =
|
|
1097
|
+
var _ref7 = _slicedToArray(_ref6, 1),
|
|
1098
|
+
k = _ref7[0];
|
|
1064
1099
|
return [k, (_getValue = getValue(scopeMap[k])) !== null && _getValue !== void 0 ? _getValue : ''];
|
|
1065
1100
|
}));
|
|
1066
1101
|
return code.evaluate(scope);
|
|
@@ -1128,7 +1163,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1128
1163
|
result.push(_objectSpread({
|
|
1129
1164
|
colId: '$$actions',
|
|
1130
1165
|
pinned: 'right',
|
|
1131
|
-
headerName:
|
|
1166
|
+
headerName: locale.actionText,
|
|
1132
1167
|
sortable: false,
|
|
1133
1168
|
suppressAutoSize: true,
|
|
1134
1169
|
suppressMovable: true,
|
|
@@ -1240,7 +1275,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1240
1275
|
return;
|
|
1241
1276
|
}
|
|
1242
1277
|
return result.map(function (item) {
|
|
1243
|
-
return _objectSpread(_objectSpread({}, item), {}, _defineProperty({},
|
|
1278
|
+
return _objectSpread(_objectSpread({}, item), {}, _defineProperty({}, SummaryFlag, true));
|
|
1244
1279
|
});
|
|
1245
1280
|
}
|
|
1246
1281
|
}, {
|
|
@@ -1350,6 +1385,14 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1350
1385
|
}
|
|
1351
1386
|
return ['pinSubMenu', 'separator'].concat(_toConsumableArray(params.defaultItems));
|
|
1352
1387
|
}
|
|
1388
|
+
}, {
|
|
1389
|
+
key: "getFieldErrMessage",
|
|
1390
|
+
value: function getFieldErrMessage(err, field) {
|
|
1391
|
+
var locale = this.props.locale;
|
|
1392
|
+
return err.message || parseLocalTemplate(locale.validate.fieldErrorText, {
|
|
1393
|
+
field: field
|
|
1394
|
+
});
|
|
1395
|
+
}
|
|
1353
1396
|
}, {
|
|
1354
1397
|
key: "validateRecord",
|
|
1355
1398
|
value: function validateRecord(record) {
|
|
@@ -1376,7 +1419,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1376
1419
|
var error = new Map();
|
|
1377
1420
|
Object.entries(fields).forEach(function (item) {
|
|
1378
1421
|
error.set(item[0], item[1].map(function (err) {
|
|
1379
|
-
return err
|
|
1422
|
+
return _this9.getFieldErrMessage(err, item[0]);
|
|
1380
1423
|
}));
|
|
1381
1424
|
});
|
|
1382
1425
|
errors.set(rowId, error);
|
|
@@ -1406,8 +1449,8 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1406
1449
|
if (_this10.validator === null) {
|
|
1407
1450
|
promises.push(Promise.resolve(true));
|
|
1408
1451
|
} else {
|
|
1409
|
-
promises.push(_this10.validator.validate(record).catch(function (
|
|
1410
|
-
var fields =
|
|
1452
|
+
promises.push(_this10.validator.validate(record).catch(function (_ref8) {
|
|
1453
|
+
var fields = _ref8.fields;
|
|
1411
1454
|
return Promise.reject({
|
|
1412
1455
|
id: rowId,
|
|
1413
1456
|
data: record,
|
|
@@ -1427,16 +1470,16 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1427
1470
|
failed = [];
|
|
1428
1471
|
result.forEach(function (item) {
|
|
1429
1472
|
if (item.status === 'rejected') {
|
|
1430
|
-
var
|
|
1431
|
-
id =
|
|
1432
|
-
fields =
|
|
1473
|
+
var _ref9 = item.reason,
|
|
1474
|
+
id = _ref9.id,
|
|
1475
|
+
fields = _ref9.fields;
|
|
1433
1476
|
var error = new Map();
|
|
1434
|
-
Object.entries(fields).forEach(function (
|
|
1435
|
-
var
|
|
1436
|
-
field =
|
|
1437
|
-
errs =
|
|
1477
|
+
Object.entries(fields).forEach(function (_ref10) {
|
|
1478
|
+
var _ref11 = _slicedToArray(_ref10, 2),
|
|
1479
|
+
field = _ref11[0],
|
|
1480
|
+
errs = _ref11[1];
|
|
1438
1481
|
error.set(field, errs.map(function (err) {
|
|
1439
|
-
return
|
|
1482
|
+
return _this10.getFieldErrMessage(err, field);
|
|
1440
1483
|
}));
|
|
1441
1484
|
});
|
|
1442
1485
|
errors.set(id, error);
|
|
@@ -1516,27 +1559,28 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1516
1559
|
key: "render",
|
|
1517
1560
|
value: function render() {
|
|
1518
1561
|
var _this12 = this;
|
|
1519
|
-
var _this$
|
|
1520
|
-
rowKey = _this$
|
|
1521
|
-
fetch = _this$
|
|
1522
|
-
dataSource = _this$
|
|
1523
|
-
rowActions = _this$
|
|
1524
|
-
columns = _this$
|
|
1525
|
-
autoLoad = _this$
|
|
1526
|
-
loadingProp = _this$
|
|
1527
|
-
summary = _this$
|
|
1528
|
-
detailCell = _this$
|
|
1529
|
-
pagination = _this$
|
|
1530
|
-
rowSelection = _this$
|
|
1531
|
-
columnTypesProp = _this$
|
|
1532
|
-
defaultColDefProp = _this$
|
|
1533
|
-
componentsProp = _this$
|
|
1534
|
-
sideBarProp = _this$
|
|
1535
|
-
detailCellRendererParams = _this$
|
|
1536
|
-
context = _this$
|
|
1537
|
-
showSearch = _this$
|
|
1538
|
-
cellDisplayFlex = _this$
|
|
1539
|
-
|
|
1562
|
+
var _this$props8 = this.props,
|
|
1563
|
+
rowKey = _this$props8.rowKey,
|
|
1564
|
+
fetch = _this$props8.fetch,
|
|
1565
|
+
dataSource = _this$props8.dataSource,
|
|
1566
|
+
rowActions = _this$props8.rowActions,
|
|
1567
|
+
columns = _this$props8.columns,
|
|
1568
|
+
autoLoad = _this$props8.autoLoad,
|
|
1569
|
+
loadingProp = _this$props8.loading,
|
|
1570
|
+
summary = _this$props8.summary,
|
|
1571
|
+
detailCell = _this$props8.detailCell,
|
|
1572
|
+
pagination = _this$props8.pagination,
|
|
1573
|
+
rowSelection = _this$props8.rowSelection,
|
|
1574
|
+
columnTypesProp = _this$props8.columnTypes,
|
|
1575
|
+
defaultColDefProp = _this$props8.defaultColDef,
|
|
1576
|
+
componentsProp = _this$props8.components,
|
|
1577
|
+
sideBarProp = _this$props8.sideBar,
|
|
1578
|
+
detailCellRendererParams = _this$props8.detailCellRendererParams,
|
|
1579
|
+
context = _this$props8.context,
|
|
1580
|
+
showSearch = _this$props8.showSearch,
|
|
1581
|
+
cellDisplayFlex = _this$props8.cellDisplayFlex,
|
|
1582
|
+
locale = _this$props8.locale,
|
|
1583
|
+
restProps = _objectWithoutProperties(_this$props8, _excluded4);
|
|
1540
1584
|
var _this$state2 = this.state,
|
|
1541
1585
|
enablePagination = _this$state2.pagination,
|
|
1542
1586
|
page = _this$state2.page,
|
|
@@ -1572,7 +1616,9 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1572
1616
|
showSizeChanger: true,
|
|
1573
1617
|
showQuickJumper: true,
|
|
1574
1618
|
showTotal: function showTotal(val) {
|
|
1575
|
-
return
|
|
1619
|
+
return parseLocalTemplate(locale.pagination.totalText, {
|
|
1620
|
+
total: val
|
|
1621
|
+
});
|
|
1576
1622
|
},
|
|
1577
1623
|
defaultCurrent: 1,
|
|
1578
1624
|
defaultPageSize: 20,
|
|
@@ -1636,67 +1682,33 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1636
1682
|
rowSelection: gridRowSelection,
|
|
1637
1683
|
components: this.getMemoizedComponents(componentsProp),
|
|
1638
1684
|
defaultColDef: this.getMemoizedDefaultColDef(defaultColDefProp),
|
|
1639
|
-
columnTypes: this.getMemoizedColumnTypes(columnTypesProp)
|
|
1685
|
+
columnTypes: this.getMemoizedColumnTypes(columnTypesProp),
|
|
1686
|
+
localeText: this.getMemoizedLocaleText(locale.localeText)
|
|
1640
1687
|
})), footer.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
1641
1688
|
className: prefix('bottom')
|
|
1642
1689
|
}, footer), (loadingProp !== null && loadingProp !== void 0 ? loadingProp : loading) ? /*#__PURE__*/React.createElement(Spin, {
|
|
1643
1690
|
className: prefix('spin')
|
|
1644
1691
|
}) : null));
|
|
1645
1692
|
}
|
|
1646
|
-
}], [{
|
|
1647
|
-
key: "isSummaryRow",
|
|
1648
|
-
value: function isSummaryRow(_ref11) {
|
|
1649
|
-
var node = _ref11.node;
|
|
1650
|
-
if (node && node.data && node.data[DataGrid.SummaryFlag]) {
|
|
1651
|
-
return true;
|
|
1652
|
-
}
|
|
1653
|
-
return false;
|
|
1654
|
-
}
|
|
1655
1693
|
}]);
|
|
1656
|
-
return
|
|
1694
|
+
return InternalDataGrid;
|
|
1657
1695
|
}(Component);
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
searchOoo: '搜索',
|
|
1670
|
-
autosizeThiscolumn: '当前列宽自适应',
|
|
1671
|
-
autosizeAllColumns: '所有列宽自适应',
|
|
1672
|
-
resetColumns: '重置所有列',
|
|
1673
|
-
pinColumn: '固定列',
|
|
1674
|
-
pinLeft: '固定在左侧',
|
|
1675
|
-
pinRight: '固定在右侧',
|
|
1676
|
-
noPin: '不固定',
|
|
1677
|
-
expandAll: '展开所有',
|
|
1678
|
-
collapseAll: '折叠所有',
|
|
1679
|
-
columns: '列'
|
|
1680
|
-
}
|
|
1681
|
-
});
|
|
1682
|
-
_defineProperty(DataGrid, "SummaryFlag", Symbol('summary'));
|
|
1683
|
-
_defineProperty(DataGrid, "IndexColId", '$$index');
|
|
1684
|
-
_defineProperty(DataGrid, "EmptyCol", {
|
|
1685
|
-
colId: '$$empty',
|
|
1686
|
-
flex: 1,
|
|
1687
|
-
resizable: false,
|
|
1688
|
-
suppressMovable: true,
|
|
1689
|
-
headerName: '',
|
|
1690
|
-
suppressNavigable: true,
|
|
1691
|
-
lockVisible: true,
|
|
1692
|
-
suppressMenu: true,
|
|
1693
|
-
suppressColumnsToolPanel: true
|
|
1694
|
-
});
|
|
1695
|
-
_defineProperty(DataGrid, "Editors", {
|
|
1696
|
-
Text: TextEditor,
|
|
1697
|
-
Date: DateEditor,
|
|
1698
|
-
Number: NumberEditor,
|
|
1699
|
-
Select: SelectEditor,
|
|
1700
|
-
Wrapper: EditorWrapper
|
|
1696
|
+
var DataGrid = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
1697
|
+
var _useContext = useContext(ComponentConfigureContext),
|
|
1698
|
+
extraProps = _useContext.DataGrid;
|
|
1699
|
+
var _useLocaleReceiver3 = useLocaleReceiver('DataGrid'),
|
|
1700
|
+
_useLocaleReceiver4 = _slicedToArray(_useLocaleReceiver3, 1),
|
|
1701
|
+
dataGridLocale = _useLocaleReceiver4[0];
|
|
1702
|
+
return /*#__PURE__*/React.createElement(InternalDataGrid, _extends({
|
|
1703
|
+
ref: ref
|
|
1704
|
+
}, extraProps, props, {
|
|
1705
|
+
locale: dataGridLocale
|
|
1706
|
+
}));
|
|
1701
1707
|
});
|
|
1702
|
-
|
|
1708
|
+
DataGrid.defaultProps = defaultProps;
|
|
1709
|
+
DataGrid.SummaryFlag = SummaryFlag;
|
|
1710
|
+
DataGrid.IndexColId = IndexColId;
|
|
1711
|
+
DataGrid.EmptyCol = EmptyCol;
|
|
1712
|
+
DataGrid.Editors = Editors;
|
|
1713
|
+
DataGrid.isSummaryRow = isSummaryRow;
|
|
1714
|
+
export default DataGrid;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var locale = {
|
|
2
|
+
localeText: {
|
|
3
|
+
copy: 'Copy',
|
|
4
|
+
copyWithHeaders: 'Copy With Headers',
|
|
5
|
+
copyWithGroupHeaders: 'Copy with Group Headers',
|
|
6
|
+
paste: 'Paste',
|
|
7
|
+
export: 'Export',
|
|
8
|
+
csvExport: 'CSV Export',
|
|
9
|
+
searchOoo: 'Search',
|
|
10
|
+
autosizeThiscolumn: 'Autosize This Column',
|
|
11
|
+
autosizeAllColumns: 'Autosize All Columns',
|
|
12
|
+
resetColumns: 'Reset Columns',
|
|
13
|
+
pinColumn: 'Pin Column',
|
|
14
|
+
pinLeft: 'Pin Left',
|
|
15
|
+
pinRight: 'Pin Right',
|
|
16
|
+
noPin: 'No Pin',
|
|
17
|
+
expandAll: 'Expand All Row Groups',
|
|
18
|
+
collapseAll: 'Close All Row Groups',
|
|
19
|
+
columns: 'Columns'
|
|
20
|
+
},
|
|
21
|
+
pagination: {
|
|
22
|
+
totalText: 'Total ${total} items'
|
|
23
|
+
},
|
|
24
|
+
validate: {
|
|
25
|
+
fieldErrorText: '${field} has error'
|
|
26
|
+
},
|
|
27
|
+
fieldModal: {
|
|
28
|
+
addCustomColumnText: 'Add Custom Column',
|
|
29
|
+
customColumnNameText: 'Name',
|
|
30
|
+
customColumnExpressionText: 'Expression',
|
|
31
|
+
summaryText: 'Summary or not',
|
|
32
|
+
summaryTypeText: 'Rule',
|
|
33
|
+
summaryTypeContentText: "\n <div>\n <p>1. The sum of custom column data values to get the total value</p>\n <p>\n 2. The total value is calculated based on the formula from the data source\n <br />\n Fields added in the formula are summed first, then the total is calculated based on the formula\n </p>\n </div>\n ",
|
|
34
|
+
customSummaryDataText: 'Sum of custom column data values to get the total value',
|
|
35
|
+
dataSourceSummaryDataText: 'Total value calculated based on the formula from the data source',
|
|
36
|
+
addFieldText: 'Add Field'
|
|
37
|
+
},
|
|
38
|
+
maxWordText: '${headName} can not exceed ${maxLength} words',
|
|
39
|
+
operationSuccessText: 'Success',
|
|
40
|
+
displayText: 'Show',
|
|
41
|
+
searchText: 'Search',
|
|
42
|
+
addCustomColumnText: 'Add Custom Column',
|
|
43
|
+
resetText: 'Reset',
|
|
44
|
+
saveText: 'Save',
|
|
45
|
+
editText: 'Edit',
|
|
46
|
+
deleteText: 'Delete',
|
|
47
|
+
searchPlaceholderText: 'Input var',
|
|
48
|
+
searchPrevText: 'Prev',
|
|
49
|
+
searchNextText: 'Next',
|
|
50
|
+
selectedTipText: '${length} Selected',
|
|
51
|
+
clearSelectedText: 'Clear',
|
|
52
|
+
moreText: 'More',
|
|
53
|
+
actionText: 'Action'
|
|
54
|
+
};
|
|
55
|
+
export default locale;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface DataGridLocale {
|
|
2
|
+
/**
|
|
3
|
+
* ag-grid 国际化文件
|
|
4
|
+
*/
|
|
5
|
+
localeText: Record<string, string>;
|
|
6
|
+
pagination: Record<string, string>;
|
|
7
|
+
validate: Record<string, string>;
|
|
8
|
+
fieldModal: {
|
|
9
|
+
addCustomColumnText: string;
|
|
10
|
+
customColumnNameText: string;
|
|
11
|
+
customColumnExpressionText: string;
|
|
12
|
+
summaryText: string;
|
|
13
|
+
summaryTypeText: string;
|
|
14
|
+
summaryTypeContentText: string;
|
|
15
|
+
customSummaryDataText: string;
|
|
16
|
+
dataSourceSummaryDataText: string;
|
|
17
|
+
addFieldText: string;
|
|
18
|
+
};
|
|
19
|
+
maxWordText: string;
|
|
20
|
+
operationSuccessText: string;
|
|
21
|
+
displayText: string;
|
|
22
|
+
searchText: string;
|
|
23
|
+
addCustomColumnText: string;
|
|
24
|
+
resetText: string;
|
|
25
|
+
saveText: string;
|
|
26
|
+
moreText: string;
|
|
27
|
+
actionText: string;
|
|
28
|
+
editText: string;
|
|
29
|
+
deleteText: string;
|
|
30
|
+
searchPlaceholderText: string;
|
|
31
|
+
searchPrevText: string;
|
|
32
|
+
searchNextText: string;
|
|
33
|
+
selectedTipText: string;
|
|
34
|
+
clearSelectedText: string;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|