@fle-ui/plus-table 1.2.21-beta.0 → 1.2.22-beta.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.
Files changed (42) hide show
  1. package/README.md +18 -18
  2. package/package.json +2 -2
  3. package/es/FormSearch/FormRender.d.ts +0 -31
  4. package/es/FormSearch/FormRender.js +0 -208
  5. package/es/FormSearch/index.d.ts +0 -44
  6. package/es/FormSearch/index.js +0 -186
  7. package/es/FormSearch/index.less +0 -59
  8. package/es/components/icon/index.d.ts +0 -3
  9. package/es/components/icon/index.js +0 -7
  10. package/es/index.d.ts +0 -80
  11. package/es/index.js +0 -527
  12. package/es/index.less +0 -107
  13. package/es/utils/api.d.ts +0 -9
  14. package/es/utils/api.js +0 -9
  15. package/es/utils/common.d.ts +0 -27
  16. package/es/utils/common.js +0 -36
  17. package/es/utils/options.d.ts +0 -25
  18. package/es/utils/options.js +0 -95
  19. package/es/utils/request.d.ts +0 -26
  20. package/es/utils/request.js +0 -176
  21. package/es/utils/serviceEnv.d.ts +0 -6
  22. package/es/utils/serviceEnv.js +0 -12
  23. package/lib/FormSearch/FormRender.d.ts +0 -31
  24. package/lib/FormSearch/FormRender.js +0 -214
  25. package/lib/FormSearch/index.d.ts +0 -44
  26. package/lib/FormSearch/index.js +0 -193
  27. package/lib/FormSearch/index.less +0 -59
  28. package/lib/components/icon/index.d.ts +0 -3
  29. package/lib/components/icon/index.js +0 -13
  30. package/lib/index.d.ts +0 -80
  31. package/lib/index.js +0 -527
  32. package/lib/index.less +0 -107
  33. package/lib/utils/api.d.ts +0 -9
  34. package/lib/utils/api.js +0 -15
  35. package/lib/utils/common.d.ts +0 -27
  36. package/lib/utils/common.js +0 -44
  37. package/lib/utils/options.d.ts +0 -25
  38. package/lib/utils/options.js +0 -101
  39. package/lib/utils/request.d.ts +0 -26
  40. package/lib/utils/request.js +0 -180
  41. package/lib/utils/serviceEnv.d.ts +0 -6
  42. package/lib/utils/serviceEnv.js +0 -18
package/es/index.d.ts DELETED
@@ -1,80 +0,0 @@
1
- import React, { ReactElement } from 'react';
2
- import type { ProColumns, ActionType } from '@ant-design/pro-components';
3
- import type { InputProps } from 'antd';
4
- import './FormSearch/index.less';
5
- interface PlusColumns extends ProColumns {
6
- baseSearch?: boolean;
7
- }
8
- export type { PlusColumns };
9
- export type settingsColumns = {
10
- [key: string]: {
11
- hideInTable?: boolean;
12
- show?: boolean;
13
- title: string;
14
- field: string;
15
- disabled?: boolean;
16
- fixed?: 'left' | 'right';
17
- sort?: number;
18
- };
19
- };
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 = {
56
- action?: Array<'advancedFilter' | 'columnSetting' | 'viewInvisibleData'>;
57
- columns: PlusColumns[];
58
- request?: any;
59
- top?: number;
60
- fetchSetting?: () => Promise<settingsColumns>;
61
- updateSetting?: (params: any) => Promise<settingsColumns>;
62
- defaultColumnsState?: {
63
- [key: string]: {
64
- show: boolean;
65
- fixed: 'left' | 'right' | undefined;
66
- };
67
- };
68
- headerTitle?: ReactElement;
69
- hasShowFull?: boolean;
70
- pagination?: {
71
- pageSize?: number;
72
- current?: number;
73
- };
74
- actionRef: any;
75
- formRef?: any;
76
- options?: optionsConfig;
77
- [key: string | symbol]: any;
78
- };
79
- declare const PlusTable: React.ForwardRefExoticComponent<Omit<PlusProps, "ref"> & React.RefAttributes<unknown>>;
80
- export default PlusTable;
package/es/index.js DELETED
@@ -1,527 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- import "antd/es/drawer/style";
3
- import _Drawer from "antd/es/drawer";
4
- import "antd/es/checkbox/style";
5
- import _Checkbox from "antd/es/checkbox";
6
- import "antd/es/button/style";
7
- import _Button from "antd/es/button";
8
- import "antd/es/message/style";
9
- import _message from "antd/es/message";
10
- import "antd/es/form/style";
11
- import _Form from "antd/es/form";
12
- var _excluded = ["mode", "columns", "hasShowFull", "request", "pagination", "formRef", "actionRef", "defaultColumnsState", "options", "action"];
13
- 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); }
14
- 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; }
15
- 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; }
16
- 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; }
17
- 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; }
18
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
19
- 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); }
20
- 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); } }
21
- 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); }); }; }
22
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
23
- 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."); }
24
- 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); }
25
- 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; }
26
- 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; } }
27
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
28
- 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; }
29
- 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; }
30
- import React, { useEffect, useRef, useState, useImperativeHandle, forwardRef } from 'react';
31
- import { ProTable } from '@ant-design/pro-components';
32
- import FormRender from './FormSearch/index';
33
- import { BarsOutlined } from '@ant-design/icons';
34
- import './FormSearch/index.less';
35
- import { simulateClick } from './utils/common';
36
- var PlusTable = /*#__PURE__*/forwardRef(function (props, ref) {
37
- var _otherProps$scroll;
38
- var mode = props.mode,
39
- columns = props.columns,
40
- _props$hasShowFull = props.hasShowFull,
41
- hasShowFull = _props$hasShowFull === void 0 ? true : _props$hasShowFull,
42
- request = props.request,
43
- pagination = props.pagination,
44
- formRef = props.formRef,
45
- actionRef = props.actionRef,
46
- defaultColumnsState = props.defaultColumnsState,
47
- _props$options = props.options,
48
- options = _props$options === void 0 ? {} : _props$options,
49
- action = props.action,
50
- otherProps = _objectWithoutProperties(props, _excluded);
51
- var searchRef = useRef(null);
52
- var _useState = useState(false),
53
- _useState2 = _slicedToArray(_useState, 2),
54
- searchDrawer = _useState2[0],
55
- setSearchDrawer = _useState2[1];
56
- var _useState3 = useState(false),
57
- _useState4 = _slicedToArray(_useState3, 2),
58
- showFull = _useState4[0],
59
- setShowFull = _useState4[1];
60
- var drawFormRef = useRef(null);
61
- var _useState5 = useState(pagination || {
62
- current: 1,
63
- pageSize: 20
64
- }),
65
- _useState6 = _slicedToArray(_useState5, 2),
66
- tablePagination = _useState6[0],
67
- setTablePagination = _useState6[1];
68
- var _useState7 = useState({}),
69
- _useState8 = _slicedToArray(_useState7, 2),
70
- columnsStateMap = _useState8[0],
71
- setColumnsStateMap = _useState8[1];
72
- var _useState9 = useState({}),
73
- _useState10 = _slicedToArray(_useState9, 2),
74
- columnsStateContainId = _useState10[0],
75
- setColumnsStateContainId = _useState10[1]; // 上传时 候的对数组
76
- var _Form$useForm = _Form.useForm(),
77
- _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
78
- form = _Form$useForm2[0];
79
- useImperativeHandle(ref, function () {
80
- return {
81
- getFieldsValue: function () {
82
- var _getFieldsValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
83
- var _searchRef$current, _drawFormRef$current;
84
- var res1, res2, res;
85
- return _regeneratorRuntime().wrap(function _callee$(_context) {
86
- while (1) switch (_context.prev = _context.next) {
87
- case 0:
88
- _context.next = 2;
89
- return searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current = searchRef.current) === null || _searchRef$current === void 0 ? void 0 : _searchRef$current.getFieldsValue();
90
- case 2:
91
- res1 = _context.sent;
92
- _context.next = 5;
93
- return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current = drawFormRef.current) === null || _drawFormRef$current === void 0 ? void 0 : _drawFormRef$current.getFieldsValue();
94
- case 5:
95
- res2 = _context.sent;
96
- res = _objectSpread(_objectSpread({}, dealFetchParams(_objectSpread(_objectSpread({}, res1), res2))), {}, {
97
- showFull: showFull
98
- });
99
- return _context.abrupt("return", res);
100
- case 8:
101
- case "end":
102
- return _context.stop();
103
- }
104
- }, _callee);
105
- }));
106
- function getFieldsValue() {
107
- return _getFieldsValue.apply(this, arguments);
108
- }
109
- return getFieldsValue;
110
- }(),
111
- setFiledsValue: function () {
112
- var _setFiledsValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
113
- var _searchRef$current2, _drawFormRef$current2;
114
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
115
- while (1) switch (_context2.prev = _context2.next) {
116
- case 0:
117
- _context2.next = 2;
118
- return searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current2 = searchRef.current) === null || _searchRef$current2 === void 0 ? void 0 : _searchRef$current2.setFieldsValue(params);
119
- case 2:
120
- _context2.next = 4;
121
- return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current2 = drawFormRef.current) === null || _drawFormRef$current2 === void 0 ? void 0 : _drawFormRef$current2.setFieldsValue(params);
122
- case 4:
123
- case "end":
124
- return _context2.stop();
125
- }
126
- }, _callee2);
127
- }));
128
- function setFiledsValue(_x) {
129
- return _setFiledsValue.apply(this, arguments);
130
- }
131
- return setFiledsValue;
132
- }(),
133
- setFiledValue: function () {
134
- var _setFiledValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(key, value) {
135
- var _searchRef$current3, _drawFormRef$current3;
136
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
137
- while (1) switch (_context3.prev = _context3.next) {
138
- case 0:
139
- _context3.next = 2;
140
- return searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current3 = searchRef.current) === null || _searchRef$current3 === void 0 ? void 0 : _searchRef$current3.setFieldValue(key, value);
141
- case 2:
142
- _context3.next = 4;
143
- return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current3 = drawFormRef.current) === null || _drawFormRef$current3 === void 0 ? void 0 : _drawFormRef$current3.setFieldValue(key, value);
144
- case 4:
145
- case "end":
146
- return _context3.stop();
147
- }
148
- }, _callee3);
149
- }));
150
- function setFiledValue(_x2, _x3) {
151
- return _setFiledValue.apply(this, arguments);
152
- }
153
- return setFiledValue;
154
- }()
155
- };
156
- });
157
- var handleOnChangeColumn = function handleOnChangeColumn(map) {
158
- // 列设置更新
159
- setColumnsStateMap(map);
160
- };
161
- var handleSave = /*#__PURE__*/function () {
162
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
163
- var newObj, key;
164
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
165
- while (1) switch (_context4.prev = _context4.next) {
166
- case 0:
167
- newObj = {}; // 保存列设置的操作
168
- if (!props.updateSetting) {
169
- _context4.next = 6;
170
- break;
171
- }
172
- for (key in columnsStateMap) {
173
- newObj[key] = _objectSpread(_objectSpread({}, columnsStateMap[key]), {}, {
174
- hideInTable: columnsStateMap[key].show ? 0 : 1
175
- });
176
- }
177
- _context4.next = 5;
178
- return props.updateSetting(newObj);
179
- case 5:
180
- simulateClick();
181
- case 6:
182
- case "end":
183
- return _context4.stop();
184
- }
185
- }, _callee4);
186
- }));
187
- return function handleSave() {
188
- return _ref.apply(this, arguments);
189
- };
190
- }();
191
- var handleReset = /*#__PURE__*/function () {
192
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
193
- var _props$fetchSetting;
194
- var res;
195
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
196
- while (1) switch (_context5.prev = _context5.next) {
197
- case 0:
198
- _context5.next = 2;
199
- return (_props$fetchSetting = props.fetchSetting) === null || _props$fetchSetting === void 0 ? void 0 : _props$fetchSetting.call(props);
200
- case 2:
201
- res = _context5.sent;
202
- setColumnsStateMap(res);
203
- _message.success('重置成功!');
204
- case 5:
205
- case "end":
206
- return _context5.stop();
207
- }
208
- }, _callee5);
209
- }));
210
- return function handleReset() {
211
- return _ref2.apply(this, arguments);
212
- };
213
- }();
214
- var init = /*#__PURE__*/function () {
215
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
216
- var _props$fetchSetting2, res;
217
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
218
- while (1) switch (_context6.prev = _context6.next) {
219
- case 0:
220
- if (!props.fetchSetting) {
221
- _context6.next = 6;
222
- break;
223
- }
224
- _context6.next = 3;
225
- return (_props$fetchSetting2 = props.fetchSetting) === null || _props$fetchSetting2 === void 0 ? void 0 : _props$fetchSetting2.call(props);
226
- case 3:
227
- res = _context6.sent;
228
- // show?: boolean;
229
- // fixed?: 'right' | 'left' | undefined;
230
- // order?: number;
231
- // disable?: boolean | {
232
- // checkbox: boolean;
233
- // };
234
- // console.log(res);
235
- setColumnsStateContainId(res);
236
- setColumnsStateMap(res);
237
- case 6:
238
- case "end":
239
- return _context6.stop();
240
- }
241
- }, _callee6);
242
- }));
243
- return function init() {
244
- return _ref3.apply(this, arguments);
245
- };
246
- }();
247
- var onValuesChange = function onValuesChange(changeValue, allValue) {
248
- var _searchRef$current4;
249
- searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current4 = searchRef.current) === null || _searchRef$current4 === void 0 ? void 0 : _searchRef$current4.setFieldsValue(drawFormRef.current.getFieldsValue());
250
- };
251
- var onTableChange = function onTableChange(pagination) {
252
- // 劫持分页改动
253
- setTablePagination({
254
- current: pagination.current,
255
- pageSize: (pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) || pagination.defaultPageSize
256
- });
257
- };
258
- var handleSearchAll = /*#__PURE__*/function () {
259
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(searchConfig) {
260
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
261
- while (1) switch (_context7.prev = _context7.next) {
262
- case 0:
263
- searchConfig.form.submit();
264
- case 1:
265
- case "end":
266
- return _context7.stop();
267
- }
268
- }, _callee7);
269
- }));
270
- return function handleSearchAll(_x4) {
271
- return _ref4.apply(this, arguments);
272
- };
273
- }();
274
- useEffect(function () {
275
- init();
276
- }, []);
277
- var dealFetchParams = function dealFetchParams(params) {
278
- // 处理transform中的函数处理
279
- var fetchParams = {};
280
- columns.forEach(function (item) {
281
- var _item$search;
282
- if ((item === null || item === void 0 ? void 0 : (_item$search = item.search) === null || _item$search === void 0 ? void 0 : _item$search.transform) && params[item.dataIndex]) {
283
- fetchParams = _objectSpread(_objectSpread({}, fetchParams), item.search.transform(params[item.dataIndex]));
284
- } else {
285
- fetchParams = _objectSpread(_objectSpread({}, fetchParams), {}, _defineProperty({}, item.dataIndex, params[item.dataIndex]));
286
- }
287
- });
288
- return fetchParams;
289
- };
290
- var columnsState = {
291
- //列设置
292
- defaultValue: defaultColumnsState,
293
- value: columnsStateMap,
294
- onChange: handleOnChangeColumn //列状态的值发生改变之后触发
295
- };
296
- var propsRequest = /*#__PURE__*/function () {
297
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
298
- var _searchRef$current5, _drawFormRef$current4;
299
- var res1, res2, res;
300
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
301
- while (1) switch (_context8.prev = _context8.next) {
302
- case 0:
303
- _context8.next = 2;
304
- return searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current5 = searchRef.current) === null || _searchRef$current5 === void 0 ? void 0 : _searchRef$current5.getFieldsValue();
305
- case 2:
306
- res1 = _context8.sent;
307
- _context8.next = 5;
308
- return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current4 = drawFormRef.current) === null || _drawFormRef$current4 === void 0 ? void 0 : _drawFormRef$current4.getFieldsValue();
309
- case 5:
310
- res2 = _context8.sent;
311
- _context8.next = 8;
312
- return request(_objectSpread(_objectSpread(_objectSpread({}, params), dealFetchParams(_objectSpread(_objectSpread(_objectSpread({}, res1), res2), params))), {}, {
313
- showFull: showFull
314
- }));
315
- case 8:
316
- res = _context8.sent;
317
- return _context8.abrupt("return", res);
318
- case 10:
319
- case "end":
320
- return _context8.stop();
321
- }
322
- }, _callee8);
323
- }));
324
- return function propsRequest(_x5) {
325
- return _ref5.apply(this, arguments);
326
- };
327
- }();
328
- return /*#__PURE__*/React.createElement("div", {
329
- className: "page_plustable__body"
330
- }, /*#__PURE__*/React.createElement(ProTable, _extends({
331
- scroll: {
332
- x: (otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$scroll = otherProps.scroll) === null || _otherProps$scroll === void 0 ? void 0 : _otherProps$scroll.x) || 1300
333
- }
334
- }, otherProps, {
335
- // 公共配置 大家都有的
336
- pagination: pagination,
337
- actionRef: actionRef,
338
- formRef: searchRef
339
- // 根据用户自定义的配置 如果配置了高级筛选就有这个配置
340
- ,
341
- search: (action === null || action === void 0 ? void 0 : action.includes('advancedFilter')) ? {
342
- span: {
343
- xs: 12,
344
- sm: 12,
345
- md: 12,
346
- lg: 12,
347
- xl: 8,
348
- xxl: 6
349
- },
350
- labelWidth: 80,
351
- onCollapse: function onCollapse() {
352
- // 执行展开和关闭动作
353
- },
354
- collapseRender: function collapseRender() {
355
- return null;
356
- },
357
- optionRender: function optionRender(searchConfig) {
358
- return [/*#__PURE__*/React.createElement(_Button, {
359
- key: "1",
360
- size: "middle",
361
- type: "primary",
362
- onClick: function onClick() {
363
- handleSearchAll(searchConfig);
364
- }
365
- }, "\u67E5\u8BE2"), /*#__PURE__*/React.createElement(_Button, {
366
- key: "2",
367
- type: "default",
368
- onClick: function onClick() {
369
- var _drawFormRef$current5;
370
- drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current5 = drawFormRef.current) === null || _drawFormRef$current5 === void 0 ? void 0 : _drawFormRef$current5.resetFields();
371
- actionRef.current.reset();
372
- actionRef.current.reload();
373
- },
374
- size: "middle"
375
- }, "\u91CD\u7F6E"), columns.filter(function (item) {
376
- return item.search !== false;
377
- }).length > 3 ? /*#__PURE__*/React.createElement("a", {
378
- key: "3",
379
- onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
380
- var _drawFormRef$current6, _searchRef$current6;
381
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
382
- while (1) switch (_context9.prev = _context9.next) {
383
- case 0:
384
- _context9.next = 2;
385
- return setSearchDrawer(!searchDrawer);
386
- case 2:
387
- // 没法实时监听数据所以这里要带过来
388
- drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current6 = drawFormRef.current) === null || _drawFormRef$current6 === void 0 ? void 0 : _drawFormRef$current6.setFieldsValue(searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current6 = searchRef.current) === null || _searchRef$current6 === void 0 ? void 0 : _searchRef$current6.getFieldsValue());
389
- case 3:
390
- case "end":
391
- return _context9.stop();
392
- }
393
- }, _callee9);
394
- }))
395
- }, /*#__PURE__*/React.createElement(BarsOutlined, null), "\u9AD8\u7EA7\u7B5B\u9009") : null];
396
- }
397
- } : props.search
398
- // 根据用户自定义的配置 如果配置了列设置就有这个配置完全受控
399
- ,
400
- columnsState: (action === null || action === void 0 ? void 0 : action.includes('columnSetting')) ? columnsState : props.columnsState,
401
- request: request ? propsRequest : undefined
402
- // 同步高筛配置 只有高筛 才有特殊的配置 (baseSearch才会生效)
403
- ,
404
- columns: (action === null || action === void 0 ? void 0 : action.includes('advancedFilter')) ? columns.map(function (item) {
405
- // 只保留基本搜索栏的配置
406
- if (item.baseSearch) {
407
- return _objectSpread(_objectSpread({}, item), {}, {
408
- search: item.search,
409
- fieldProps: _objectSpread({
410
- onChange: function onChange(e) {
411
- if (e) {
412
- var _drawFormRef$current7;
413
- drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current7 = drawFormRef.current) === null || _drawFormRef$current7 === void 0 ? void 0 : _drawFormRef$current7.setFieldsValue(_defineProperty({}, item.dataIndex, e.target ? e.target.value : e));
414
- } else {
415
- var _drawFormRef$current9;
416
- drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current9 = drawFormRef.current) === null || _drawFormRef$current9 === void 0 ? void 0 : _drawFormRef$current9.resetFields([item.dataIndex]);
417
- }
418
- }
419
- }, item.fieldProps)
420
- });
421
- }
422
- return _objectSpread(_objectSpread({}, item), {}, {
423
- search: false
424
- });
425
- }) : columns,
426
- toolBarRender: function toolBarRender(searchConfig) {
427
- var _otherProps$toolBarRe;
428
- return [(action === null || action === void 0 ? void 0 : action.includes('viewInvisibleData')) ? /*#__PURE__*/React.createElement(_Checkbox, {
429
- onChange: function onChange(e) {
430
- setShowFull(e.target.checked);
431
- setTimeout(function () {
432
- searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.reload();
433
- }, 100);
434
- }
435
- }, "\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)];
436
- },
437
- onChange: onTableChange,
438
- options: (action === null || action === void 0 ? void 0 : action.includes('columnSetting')) ? _objectSpread({
439
- setting: {
440
- checkedReset: false,
441
- // children: <div></div>,
442
- extra: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a", {
443
- onClick: function onClick() {
444
- return handleSave();
445
- }
446
- }, "\u4FDD\u5B58"), /*#__PURE__*/React.createElement("a", {
447
- onClick: function onClick() {
448
- return handleReset();
449
- }
450
- }, "\u91CD\u7F6E")),
451
- showListItemOption: true
452
- }
453
- }, options) : options
454
- })), /*#__PURE__*/React.createElement(_Drawer, {
455
- onClose: function onClose() {
456
- return setSearchDrawer(false);
457
- },
458
- title: '高级筛选',
459
- width: 380,
460
- rootStyle: {
461
- position: 'fixed',
462
- top: props.top || 92
463
- },
464
- getContainer: (otherProps === null || otherProps === void 0 ? void 0 : otherProps.getContainer) || document.getElementsByTagName('body')[0],
465
- className: "search-drawer",
466
- open: searchDrawer,
467
- maskClosable: false,
468
- mask: false
469
- }, /*#__PURE__*/React.createElement(FormRender, {
470
- columns: columns,
471
- loading: false,
472
- changeValue: function changeValue(_changeValue, allValue) {
473
- return onValuesChange(_changeValue, allValue);
474
- },
475
- onFormSearchSubmit: function onFormSearchSubmit() {
476
- var _searchRef$current7;
477
- searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current7 = searchRef.current) === null || _searchRef$current7 === void 0 ? void 0 : _searchRef$current7.submit();
478
- },
479
- dateFormatter: "string",
480
- formRef: drawFormRef,
481
- type: "table",
482
- cardBordered: {
483
- search: false
484
- },
485
- form: {},
486
- search: {
487
- optionRender: function optionRender(searchConfig) {
488
- return [/*#__PURE__*/React.createElement("div", {
489
- style: {
490
- position: 'fixed',
491
- bottom: 0,
492
- background: 'white',
493
- display: 'flex',
494
- width: '380px',
495
- borderTop: '1px solid #f0f0f0',
496
- right: '0',
497
- justifyContent: 'space-around',
498
- padding: '16px',
499
- boxSizing: 'border-box'
500
- }
501
- }, /*#__PURE__*/React.createElement(_Button, {
502
- size: "middle",
503
- type: "primary",
504
- onClick: function onClick() {
505
- handleSearchAll(searchConfig);
506
- }
507
- }, "\u67E5\u8BE2"), /*#__PURE__*/React.createElement(_Button, {
508
- type: "default",
509
- onClick: function onClick() {
510
- var _drawFormRef$current10;
511
- drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current10 = drawFormRef.current) === null || _drawFormRef$current10 === void 0 ? void 0 : _drawFormRef$current10.resetFields();
512
- actionRef.current.reset();
513
- actionRef.current.reload();
514
- },
515
- size: "middle"
516
- }, "\u91CD\u7F6E"))];
517
- },
518
- collapsed: false,
519
- collapseRender: function collapseRender() {
520
- return null;
521
- }
522
- },
523
- manualRequest: true,
524
- action: actionRef
525
- })));
526
- });
527
- export default PlusTable;