@fle-ui/plus-table 1.2.24 → 1.2.26

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.
@@ -2,8 +2,8 @@ import "antd/es/table/style";
2
2
  import _Table from "antd/es/table";
3
3
  import "antd/es/config-provider/style";
4
4
  import _ConfigProvider from "antd/es/config-provider";
5
- 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); }
6
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
+ 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); }
7
7
  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 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 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 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; }
8
8
  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); } }
9
9
  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); }); }; }
@@ -142,7 +142,7 @@ var FormRender = function FormRender(_ref) {
142
142
  var columnKey = (item === null || item === void 0 ? void 0 : item.key) || (item === null || item === void 0 ? void 0 : (_item$dataIndex = item.dataIndex) === null || _item$dataIndex === void 0 ? void 0 : _item$dataIndex.toString());
143
143
  return _objectSpread(_objectSpread(_objectSpread({}, item), {}, {
144
144
  width: undefined
145
- }, item.search ? item.search : {}), {}, {
145
+ }, _typeof(item.search) === "object" ? item.search : {}), {}, {
146
146
  valueType: finalValueType,
147
147
  proFieldProps: _objectSpread(_objectSpread({}, item.proFieldProps), {}, {
148
148
  proFieldKey: columnKey ? "table-field-".concat(columnKey) : undefined
package/es/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import React, { ReactElement } from 'react';
2
- import type { ProColumns, ActionType } from '@ant-design/pro-components';
3
- import type { InputProps } from 'antd';
1
+ import React from 'react';
2
+ import type { ProTableProps, ProColumns } from '@ant-design/pro-components';
4
3
  import './FormSearch/index.less';
5
4
  interface PlusColumns extends ProColumns {
6
5
  baseSearch?: boolean;
@@ -17,49 +16,15 @@ export type settingsColumns = {
17
16
  sort?: number;
18
17
  };
19
18
  };
20
- type OptionsFunctionType = (e: React.MouseEvent<HTMLSpanElement>, action?: ActionType) => void;
21
- type OptionsType = OptionsFunctionType | boolean;
22
- type SettingOptionType = {
23
- draggable?: boolean;
24
- checkable?: boolean;
25
- showListItemOption?: boolean;
26
- checkedReset?: boolean;
27
- listsHeight?: number;
28
- extra?: React.ReactNode;
29
- children?: React.ReactNode;
30
- settingIcon?: React.ReactNode;
31
- };
32
- interface SearchProps extends InputProps {
33
- inputPrefixCls?: string;
34
- onSearch?: (value: string, event?: React.ChangeEvent<HTMLInputElement> | React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLInputElement>, info?: {
35
- source?: 'clear' | 'input';
36
- }) => void;
37
- enterButton?: React.ReactNode;
38
- loading?: boolean;
39
- }
40
- type OptionSearchProps = Omit<SearchProps, 'onSearch'> & {
41
- /** 如果 onSearch 返回一个false,直接拦截请求 */
42
- onSearch?: (keyword: string) => Promise<boolean | undefined> | boolean | undefined;
43
- };
44
- export type optionsConfig = {
45
- density?: boolean;
46
- fullScreen?: OptionsType;
47
- reload?: OptionsType;
48
- setting?: boolean | SettingOptionType;
49
- search?: (OptionSearchProps & {
50
- name?: string;
51
- }) | boolean;
52
- reloadIcon?: React.ReactNode;
53
- densityIcon?: React.ReactNode;
54
- };
55
- type PlusProps = {
19
+ interface PlusTableProps<DataSource, U, ValueType> extends Omit<ProTableProps<DataSource, U, ValueType>, 'columns'> {
56
20
  action?: Array<'advancedFilter' | 'columnSetting' | 'viewInvisibleData'>;
57
21
  columns: PlusColumns[];
58
- request?: any;
59
22
  top?: number;
60
- fetchSetting?: () => Promise<settingsColumns>;
61
- updateSetting?: (params: any) => Promise<settingsColumns>;
62
- resetSetting?: () => Promise<settingsColumns>;
23
+ fetchSetting?: () => Promise<Record<string, any>>;
24
+ updateSetting?: (params: settingsColumns) => void;
25
+ resetSetting?: () => Promise<{
26
+ success: boolean;
27
+ }>;
63
28
  showDefaultSetting?: boolean;
64
29
  defaultColumnsState?: {
65
30
  [key: string]: {
@@ -67,16 +32,13 @@ type PlusProps = {
67
32
  fixed: 'left' | 'right' | undefined;
68
33
  };
69
34
  };
70
- headerTitle?: ReactElement;
71
35
  hasShowFull?: boolean;
72
- pagination?: {
73
- pageSize?: number;
74
- current?: number;
75
- };
76
- actionRef: any;
77
- formRef?: any;
78
- options?: optionsConfig;
79
- [key: string | symbol]: any;
80
- };
81
- declare const PlusTable: React.ForwardRefExoticComponent<Omit<PlusProps, "ref"> & React.RefAttributes<unknown>>;
82
- export default PlusTable;
36
+ getContainer?: string | HTMLElement | (() => HTMLElement) | false;
37
+ }
38
+ interface PlusTableRef {
39
+ getFieldsValue: () => Promise<any>;
40
+ setFiledsValue: (params: any) => Promise<void>;
41
+ setFiledValue: (key: string, value: any) => Promise<void>;
42
+ }
43
+ declare const _default: React.ForwardRefExoticComponent<PlusTableProps<Record<string, any>, Record<string, any>, unknown> & React.RefAttributes<PlusTableRef>>;
44
+ export default _default;
package/es/index.js CHANGED
@@ -4,7 +4,7 @@ import "antd/es/checkbox/style";
4
4
  import _Checkbox from "antd/es/checkbox";
5
5
  import "antd/es/button/style";
6
6
  import _Button from "antd/es/button";
7
- var _excluded = ["mode", "columns", "hasShowFull", "request", "pagination", "formRef", "actionRef", "defaultColumnsState", "options", "action", "showDefaultSetting"];
7
+ var _excluded = ["columns", "hasShowFull", "request", "pagination", "formRef", "actionRef", "defaultColumnsState", "options", "action", "showDefaultSetting"];
8
8
  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); }
9
9
  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); }
10
10
  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 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 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 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,23 +22,22 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
22
22
  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; } }
23
23
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
24
24
  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; }
25
- 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; }
26
- import React, { useEffect, useRef, useState, useImperativeHandle, forwardRef } from 'react';
25
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
26
+ import React, { useEffect, useRef, useState, useImperativeHandle } from 'react';
27
27
  import { ProTable } from '@ant-design/pro-components';
28
28
  import FormRender from './FormSearch/index';
29
29
  import { BarsOutlined } from '@ant-design/icons';
30
30
  import { simulateClick } from './utils/common';
31
31
  import './FormSearch/index.less';
32
- var PlusTable = /*#__PURE__*/forwardRef(function (props, ref) {
32
+ function PlusTable(props, ref) {
33
33
  var _otherProps$scroll;
34
- var mode = props.mode,
35
- columns = props.columns,
34
+ var columns = props.columns,
36
35
  _props$hasShowFull = props.hasShowFull,
37
36
  hasShowFull = _props$hasShowFull === void 0 ? true : _props$hasShowFull,
38
37
  request = props.request,
39
38
  pagination = props.pagination,
40
39
  formRef = props.formRef,
41
- actionRef = props.actionRef,
40
+ propsActionRef = props.actionRef,
42
41
  defaultColumnsState = props.defaultColumnsState,
43
42
  _props$options = props.options,
44
43
  options = _props$options === void 0 ? {} : _props$options,
@@ -60,6 +59,10 @@ var PlusTable = /*#__PURE__*/forwardRef(function (props, ref) {
60
59
  _useState6 = _slicedToArray(_useState5, 2),
61
60
  columnsStateMap = _useState6[0],
62
61
  setColumnsStateMap = _useState6[1];
62
+ var actionRef = useRef();
63
+ useImperativeHandle(propsActionRef, function () {
64
+ return actionRef.current;
65
+ });
63
66
  useImperativeHandle(ref, function () {
64
67
  return {
65
68
  getFieldsValue: function () {
@@ -178,7 +181,6 @@ var PlusTable = /*#__PURE__*/forwardRef(function (props, ref) {
178
181
  while (1) switch (_context5.prev = _context5.next) {
179
182
  case 0:
180
183
  return _context5.abrupt("return", (_props$resetSetting = props.resetSetting) === null || _props$resetSetting === void 0 ? void 0 : _props$resetSetting.call(props).then(function (res) {
181
- console.log(res);
182
184
  res.success && init();
183
185
  }));
184
186
  case 1:
@@ -259,7 +261,7 @@ var PlusTable = /*#__PURE__*/forwardRef(function (props, ref) {
259
261
  onChange: handleOnChangeColumn //列状态的值发生改变之后触发
260
262
  };
261
263
  var propsRequest = /*#__PURE__*/function () {
262
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
264
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params, sort, filter) {
263
265
  var _searchRef$current5, _drawFormRef$current4;
264
266
  var res1, res2, res;
265
267
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
@@ -273,24 +275,34 @@ var PlusTable = /*#__PURE__*/forwardRef(function (props, ref) {
273
275
  return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current4 = drawFormRef.current) === null || _drawFormRef$current4 === void 0 ? void 0 : _drawFormRef$current4.getFieldsValue();
274
276
  case 5:
275
277
  res2 = _context8.sent;
276
- _context8.next = 8;
278
+ if (!request) {
279
+ _context8.next = 12;
280
+ break;
281
+ }
282
+ _context8.next = 9;
277
283
  return request(_objectSpread(_objectSpread(_objectSpread({}, params), dealFetchParams(_objectSpread(_objectSpread(_objectSpread({}, res1), res2), params))), {}, {
278
284
  showFull: showFull
279
- }));
280
- case 8:
281
- res = _context8.sent;
285
+ }), sort, filter);
286
+ case 9:
287
+ _context8.t0 = _context8.sent;
288
+ _context8.next = 13;
289
+ break;
290
+ case 12:
291
+ _context8.t0 = {};
292
+ case 13:
293
+ res = _context8.t0;
282
294
  return _context8.abrupt("return", res);
283
- case 10:
295
+ case 15:
284
296
  case "end":
285
297
  return _context8.stop();
286
298
  }
287
299
  }, _callee8);
288
300
  }));
289
- return function propsRequest(_x5) {
301
+ return function propsRequest(_x5, _x6, _x7) {
290
302
  return _ref5.apply(this, arguments);
291
303
  };
292
304
  }();
293
- var optionsSetting = _typeof(options.setting) === 'object' ? options.setting : {};
305
+ var optionsSetting = _typeof(options) === 'object' && _typeof(options.setting) === 'object' ? options.setting : {};
294
306
  var __options = (action === null || action === void 0 ? void 0 : action.includes('columnSetting')) && showDefaultSetting !== true ? _objectSpread(_objectSpread({}, options), {}, {
295
307
  setting: _objectSpread(_objectSpread({}, optionsSetting), {}, {
296
308
  checkedReset: false,
@@ -315,9 +327,11 @@ var PlusTable = /*#__PURE__*/forwardRef(function (props, ref) {
315
327
  scroll: {
316
328
  x: (otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$scroll = otherProps.scroll) === null || _otherProps$scroll === void 0 ? void 0 : _otherProps$scroll.x) || 1300
317
329
  }
318
- }, otherProps, {
319
330
  // 公共配置 大家都有的
320
- pagination: pagination,
331
+ ,
332
+ pagination: _objectSpread({
333
+ size: 'default'
334
+ }, pagination),
321
335
  actionRef: actionRef,
322
336
  formRef: searchRef
323
337
  // 根据用户自定义的配置 如果配置了高级筛选就有这个配置
@@ -350,16 +364,18 @@ var PlusTable = /*#__PURE__*/forwardRef(function (props, ref) {
350
364
  key: "2",
351
365
  type: "default",
352
366
  onClick: function onClick() {
353
- var _drawFormRef$current5;
367
+ var _drawFormRef$current5, _actionRef$current, _actionRef$current$re, _actionRef$current2, _actionRef$current2$r;
354
368
  drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current5 = drawFormRef.current) === null || _drawFormRef$current5 === void 0 ? void 0 : _drawFormRef$current5.resetFields();
355
- actionRef.current.reset();
356
- actionRef.current.reload();
369
+ actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$re = _actionRef$current.reset) === null || _actionRef$current$re === void 0 ? void 0 : _actionRef$current$re.call(_actionRef$current);
370
+ actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$r = _actionRef$current2.reload) === null || _actionRef$current2$r === void 0 ? void 0 : _actionRef$current2$r.call(_actionRef$current2);
357
371
  },
358
372
  size: "middle"
359
- }, "\u91CD\u7F6E"), columns.filter(function (item) {
360
- return item.search !== false;
361
- }).length > 3 ? /*#__PURE__*/React.createElement("a", {
373
+ }, "\u91CD\u7F6E"), /*#__PURE__*/React.createElement("a", {
362
374
  key: "3",
375
+ style: {
376
+ wordBreak: 'break-word',
377
+ whiteSpace: 'nowrap'
378
+ },
363
379
  onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
364
380
  var _drawFormRef$current6, _searchRef$current6;
365
381
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
@@ -376,7 +392,7 @@ var PlusTable = /*#__PURE__*/forwardRef(function (props, ref) {
376
392
  }
377
393
  }, _callee9);
378
394
  }))
379
- }, /*#__PURE__*/React.createElement(BarsOutlined, null), "\u9AD8\u7EA7\u7B5B\u9009") : null];
395
+ }, /*#__PURE__*/React.createElement(BarsOutlined, null), "\u9AD8\u7EA7\u7B5B\u9009")];
380
396
  }
381
397
  } : props.search
382
398
  // 根据用户自定义的配置 如果配置了列设置就有这个配置完全受控
@@ -407,8 +423,7 @@ var PlusTable = /*#__PURE__*/forwardRef(function (props, ref) {
407
423
  search: false
408
424
  });
409
425
  }) : columns,
410
- toolBarRender: function toolBarRender(searchConfig) {
411
- var _otherProps$toolBarRe;
426
+ toolBarRender: function toolBarRender(searchConfig, rows) {
412
427
  return [(action === null || action === void 0 ? void 0 : action.includes('viewInvisibleData')) ? /*#__PURE__*/React.createElement(_Checkbox, {
413
428
  onChange: function onChange(e) {
414
429
  setShowFull(e.target.checked);
@@ -416,10 +431,10 @@ var PlusTable = /*#__PURE__*/forwardRef(function (props, ref) {
416
431
  searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.reload();
417
432
  }, 100);
418
433
  }
419
- }, "\u663E\u793A\u6240\u6709\u6570\u636E") : null, otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$toolBarRe = otherProps.toolBarRender) === null || _otherProps$toolBarRe === void 0 ? void 0 : _otherProps$toolBarRe.call(otherProps)];
434
+ }, "\u663E\u793A\u6240\u6709\u6570\u636E") : null, typeof otherProps.toolBarRender === 'function' && otherProps.toolBarRender(searchConfig, rows)];
420
435
  },
421
436
  options: __options
422
- })), /*#__PURE__*/React.createElement(_Drawer, {
437
+ }, otherProps)), /*#__PURE__*/React.createElement(_Drawer, {
423
438
  onClose: function onClose() {
424
439
  return setSearchDrawer(false);
425
440
  },
@@ -475,10 +490,10 @@ var PlusTable = /*#__PURE__*/forwardRef(function (props, ref) {
475
490
  }, "\u67E5\u8BE2"), /*#__PURE__*/React.createElement(_Button, {
476
491
  type: "default",
477
492
  onClick: function onClick() {
478
- var _drawFormRef$current10;
493
+ var _drawFormRef$current10, _actionRef$current3, _actionRef$current3$r, _actionRef$current4, _actionRef$current4$r;
479
494
  drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current10 = drawFormRef.current) === null || _drawFormRef$current10 === void 0 ? void 0 : _drawFormRef$current10.resetFields();
480
- actionRef.current.reset();
481
- actionRef.current.reload();
495
+ actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$r = _actionRef$current3.reset) === null || _actionRef$current3$r === void 0 ? void 0 : _actionRef$current3$r.call(_actionRef$current3);
496
+ actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$r = _actionRef$current4.reload) === null || _actionRef$current4$r === void 0 ? void 0 : _actionRef$current4$r.call(_actionRef$current4);
482
497
  },
483
498
  size: "middle"
484
499
  }, "\u91CD\u7F6E"))];
@@ -491,5 +506,5 @@ var PlusTable = /*#__PURE__*/forwardRef(function (props, ref) {
491
506
  manualRequest: true,
492
507
  action: actionRef
493
508
  })));
494
- });
495
- export default PlusTable;
509
+ }
510
+ export default /*#__PURE__*/React.forwardRef(PlusTable);
@@ -3,14 +3,6 @@ export default {
3
3
  code: '2000',
4
4
  message: null,
5
5
  data: [{
6
- id: 12966348,
7
- title: '商品编码',
8
- field: 'goodsNumber',
9
- sort: 0,
10
- hideInTable: 0,
11
- fixed: 1,
12
- disabled: 1
13
- }, {
14
6
  id: 12966347,
15
7
  title: '商品名称',
16
8
  field: 'mainImage,name',
@@ -186,13 +178,5 @@ export default {
186
178
  hideInTable: 1,
187
179
  fixed: 0,
188
180
  disabled: 0
189
- }, {
190
- id: 12966341,
191
- title: '操作',
192
- field: 'option',
193
- sort: 23,
194
- hideInTable: 0,
195
- fixed: 2,
196
- disabled: 1
197
181
  }]
198
182
  };