@fle-ui/plus-table 1.0.4 → 1.0.7

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/index.js ADDED
@@ -0,0 +1,445 @@
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", "search", "hasShowFull", "request", "pagination", "formRef", "actionRef", "defaultColumnsState"];
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 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; }
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 : String(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, ReloadOutlined } from '@ant-design/icons';
34
+ import './FormSearch/index.less';
35
+ var PlusTable = /*#__PURE__*/forwardRef(function (props, ref) {
36
+ var _otherProps$scroll, _document$getElements;
37
+ var mode = props.mode,
38
+ columns = props.columns,
39
+ search = props.search,
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
+ otherProps = _objectWithoutProperties(props, _excluded);
48
+ var searchRef = useRef(null);
49
+ var _useState = useState(false),
50
+ _useState2 = _slicedToArray(_useState, 2),
51
+ searchDrawer = _useState2[0],
52
+ setSearchDrawer = _useState2[1];
53
+ var _useState3 = useState(false),
54
+ _useState4 = _slicedToArray(_useState3, 2),
55
+ showFull = _useState4[0],
56
+ setShowFull = _useState4[1];
57
+ var drawFormRef = useRef(null);
58
+ var _useState5 = useState(pagination || {
59
+ current: 1,
60
+ pageSize: 20
61
+ }),
62
+ _useState6 = _slicedToArray(_useState5, 2),
63
+ tablePagination = _useState6[0],
64
+ setTablePagination = _useState6[1];
65
+ var _useState7 = useState({}),
66
+ _useState8 = _slicedToArray(_useState7, 2),
67
+ columnsStateMap = _useState8[0],
68
+ setColumnsStateMap = _useState8[1];
69
+ var _useState9 = useState({}),
70
+ _useState10 = _slicedToArray(_useState9, 2),
71
+ columnsStateContainId = _useState10[0],
72
+ setColumnsStateContainId = _useState10[1]; // 上传时候的对数组
73
+ var _Form$useForm = _Form.useForm(),
74
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
75
+ form = _Form$useForm2[0];
76
+ useImperativeHandle(ref, function () {
77
+ return {
78
+ getFieldsValue: function () {
79
+ var _getFieldsValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
80
+ var _searchRef$current, _drawFormRef$current;
81
+ var res1, res2, res;
82
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
83
+ while (1) switch (_context.prev = _context.next) {
84
+ case 0:
85
+ _context.next = 2;
86
+ return searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current = searchRef.current) === null || _searchRef$current === void 0 ? void 0 : _searchRef$current.getFieldsValue();
87
+ case 2:
88
+ res1 = _context.sent;
89
+ _context.next = 5;
90
+ return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current = drawFormRef.current) === null || _drawFormRef$current === void 0 ? void 0 : _drawFormRef$current.getFieldsValue();
91
+ case 5:
92
+ res2 = _context.sent;
93
+ res = _objectSpread(_objectSpread({}, dealFetchParams(_objectSpread(_objectSpread({}, res1), res2))), {}, {
94
+ showFull: showFull
95
+ });
96
+ return _context.abrupt("return", res);
97
+ case 8:
98
+ case "end":
99
+ return _context.stop();
100
+ }
101
+ }, _callee);
102
+ }));
103
+ function getFieldsValue() {
104
+ return _getFieldsValue.apply(this, arguments);
105
+ }
106
+ return getFieldsValue;
107
+ }()
108
+ };
109
+ });
110
+ var handleOnChangeColumn = function handleOnChangeColumn(map) {
111
+ // 列设置更新
112
+ setColumnsStateMap(map);
113
+ };
114
+ var handleSave = /*#__PURE__*/function () {
115
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
116
+ var key;
117
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
118
+ while (1) switch (_context2.prev = _context2.next) {
119
+ case 0:
120
+ if (!props.updateSetting) {
121
+ _context2.next = 4;
122
+ break;
123
+ }
124
+ for (key in columnsStateMap) {
125
+ columnsStateContainId[key] = _objectSpread(_objectSpread({}, columnsStateContainId[key]), {}, {
126
+ hideInTable: !columnsStateMap[key].show ? 0 : 1,
127
+ fixed: columnsStateMap[key].fixed
128
+ });
129
+ }
130
+ _context2.next = 4;
131
+ return props.updateSetting(columnsStateContainId);
132
+ case 4:
133
+ case "end":
134
+ return _context2.stop();
135
+ }
136
+ }, _callee2);
137
+ }));
138
+ return function handleSave() {
139
+ return _ref.apply(this, arguments);
140
+ };
141
+ }();
142
+ var handleReset = /*#__PURE__*/function () {
143
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
144
+ var res;
145
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
146
+ while (1) switch (_context3.prev = _context3.next) {
147
+ case 0:
148
+ _context3.next = 2;
149
+ return props.fetchSetting();
150
+ case 2:
151
+ res = _context3.sent;
152
+ setColumnsStateMap(res);
153
+ _message.success('重置成功!');
154
+ case 5:
155
+ case "end":
156
+ return _context3.stop();
157
+ }
158
+ }, _callee3);
159
+ }));
160
+ return function handleReset() {
161
+ return _ref2.apply(this, arguments);
162
+ };
163
+ }();
164
+ var init = /*#__PURE__*/function () {
165
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
166
+ var res;
167
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
168
+ while (1) switch (_context4.prev = _context4.next) {
169
+ case 0:
170
+ if (!props.fetchSetting) {
171
+ _context4.next = 6;
172
+ break;
173
+ }
174
+ _context4.next = 3;
175
+ return props.fetchSetting();
176
+ case 3:
177
+ res = _context4.sent;
178
+ setColumnsStateContainId(res);
179
+ setColumnsStateMap(res);
180
+ case 6:
181
+ case "end":
182
+ return _context4.stop();
183
+ }
184
+ }, _callee4);
185
+ }));
186
+ return function init() {
187
+ return _ref3.apply(this, arguments);
188
+ };
189
+ }();
190
+ var onValuesChange = function onValuesChange() {
191
+ var _searchRef$current2;
192
+ searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current2 = searchRef.current) === null || _searchRef$current2 === void 0 ? void 0 : _searchRef$current2.setFieldValue(drawFormRef.current.getFieldsValue());
193
+ };
194
+ var onTableChange = function onTableChange(pagination) {
195
+ // 劫持分页改动
196
+ setTablePagination({
197
+ current: pagination.current,
198
+ pageSize: (pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) || pagination.defaultPageSize
199
+ });
200
+ };
201
+ var handleSearchAll = /*#__PURE__*/function () {
202
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(searchConfig) {
203
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
204
+ while (1) switch (_context5.prev = _context5.next) {
205
+ case 0:
206
+ searchConfig.form.submit();
207
+ case 1:
208
+ case "end":
209
+ return _context5.stop();
210
+ }
211
+ }, _callee5);
212
+ }));
213
+ return function handleSearchAll(_x) {
214
+ return _ref4.apply(this, arguments);
215
+ };
216
+ }();
217
+ useEffect(function () {
218
+ init();
219
+ }, []);
220
+ var dealFetchParams = function dealFetchParams(params) {
221
+ // 处理transform中的函数处理
222
+ var fetchParams = {};
223
+ columns.forEach(function (item) {
224
+ var _item$search;
225
+ 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]) {
226
+ fetchParams = _objectSpread(_objectSpread({}, fetchParams), item.search.transform(params[item.dataIndex]));
227
+ } else {
228
+ fetchParams = _objectSpread(_objectSpread({}, fetchParams), {}, _defineProperty({}, item.dataIndex, params[item.dataIndex]));
229
+ }
230
+ });
231
+ return fetchParams;
232
+ };
233
+ return /*#__PURE__*/React.createElement("div", {
234
+ className: !searchDrawer ? 'page_plustable__body' : 'page_plustable__body turn-left'
235
+ },
236
+ // 高级搜索模式
237
+ mode === 'drawsearch' ? /*#__PURE__*/React.createElement(ProTable, _extends({}, otherProps, {
238
+ search: {
239
+ span: {
240
+ xs: 12,
241
+ sm: 12,
242
+ md: 12,
243
+ lg: 12,
244
+ xl: 8,
245
+ xxl: 6
246
+ },
247
+ labelWidth: 80,
248
+ onCollapse: function onCollapse(e) {
249
+ // 执行展开和关闭动作
250
+ },
251
+ collapseRender: function collapseRender(collapsed) {
252
+ return null;
253
+ },
254
+ optionRender: function optionRender(searchConfig, formProps, dom) {
255
+ return [/*#__PURE__*/React.createElement(_Button, {
256
+ size: "middle",
257
+ type: "primary",
258
+ ghost: true,
259
+ onClick: function onClick() {
260
+ handleSearchAll(searchConfig);
261
+ }
262
+ }, "\u67E5\u8BE2"), /*#__PURE__*/React.createElement(_Button, {
263
+ type: "default",
264
+ onClick: function onClick() {
265
+ var _drawFormRef$current2;
266
+ drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current2 = drawFormRef.current) === null || _drawFormRef$current2 === void 0 ? void 0 : _drawFormRef$current2.resetFields();
267
+ actionRef.current.reset();
268
+ actionRef.current.reload();
269
+ },
270
+ size: "middle"
271
+ }, "\u91CD\u7F6E"),, columns.filter(function (item) {
272
+ return item.search !== false;
273
+ }).length > 3 ? /*#__PURE__*/React.createElement("a", {
274
+ onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
275
+ var _drawFormRef$current3, _searchRef$current3;
276
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
277
+ while (1) switch (_context6.prev = _context6.next) {
278
+ case 0:
279
+ _context6.next = 2;
280
+ return setSearchDrawer(!searchDrawer);
281
+ case 2:
282
+ // 没法实时监听数据所以这里要带过来
283
+ drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current3 = drawFormRef.current) === null || _drawFormRef$current3 === void 0 ? void 0 : _drawFormRef$current3.setFieldsValue(searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current3 = searchRef.current) === null || _searchRef$current3 === void 0 ? void 0 : _searchRef$current3.getFieldsValue());
284
+ case 3:
285
+ case "end":
286
+ return _context6.stop();
287
+ }
288
+ }, _callee6);
289
+ }))
290
+ }, /*#__PURE__*/React.createElement(BarsOutlined, null), "\u9AD8\u7EA7\u7B5B\u9009") : null];
291
+ }
292
+ },
293
+ columnsState: {
294
+ //列设置
295
+ defaultValue: defaultColumnsState,
296
+ value: columnsStateMap,
297
+ onChange: handleOnChangeColumn //列状态的值发生改变之后触发
298
+ },
299
+ pagination: pagination,
300
+ actionRef: actionRef,
301
+ formRef: searchRef,
302
+ request: ( /*#__PURE__*/function () {
303
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(params) {
304
+ var _searchRef$current4, _drawFormRef$current4;
305
+ var res1, res2, res;
306
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
307
+ while (1) switch (_context7.prev = _context7.next) {
308
+ case 0:
309
+ _context7.next = 2;
310
+ return searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current4 = searchRef.current) === null || _searchRef$current4 === void 0 ? void 0 : _searchRef$current4.getFieldsValue();
311
+ case 2:
312
+ res1 = _context7.sent;
313
+ _context7.next = 5;
314
+ return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current4 = drawFormRef.current) === null || _drawFormRef$current4 === void 0 ? void 0 : _drawFormRef$current4.getFieldsValue();
315
+ case 5:
316
+ res2 = _context7.sent;
317
+ _context7.next = 8;
318
+ return request(_objectSpread(_objectSpread(_objectSpread({}, params), dealFetchParams(_objectSpread(_objectSpread(_objectSpread({}, res1), res2), params))), {}, {
319
+ showFull: showFull
320
+ }));
321
+ case 8:
322
+ res = _context7.sent;
323
+ return _context7.abrupt("return", res);
324
+ case 10:
325
+ case "end":
326
+ return _context7.stop();
327
+ }
328
+ }, _callee7);
329
+ }));
330
+ return function (_x2) {
331
+ return _ref6.apply(this, arguments);
332
+ };
333
+ }()),
334
+ columns: columns.map(function (item) {
335
+ // 只保留基本搜索栏的配置
336
+ if (item.baseSearch) {
337
+ return _objectSpread(_objectSpread({}, item), {}, {
338
+ search: item.search,
339
+ fieldProps: {
340
+ onChange: function onChange(e) {
341
+ if (e) {
342
+ var _drawFormRef$current5;
343
+ drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current5 = drawFormRef.current) === null || _drawFormRef$current5 === void 0 ? void 0 : _drawFormRef$current5.setFieldsValue(_defineProperty({}, item.dataIndex, e.target ? e.target.value : e));
344
+ } else {
345
+ var _drawFormRef$current7;
346
+ drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current7 = drawFormRef.current) === null || _drawFormRef$current7 === void 0 ? void 0 : _drawFormRef$current7.resetFields([item.dataIndex]);
347
+ }
348
+ }
349
+ }
350
+ });
351
+ }
352
+ return _objectSpread(_objectSpread({}, item), {}, {
353
+ search: false
354
+ });
355
+ }),
356
+ toolBarRender: function toolBarRender(searchConfig) {
357
+ var _otherProps$toolBarRe;
358
+ return [hasShowFull ? /*#__PURE__*/React.createElement(_Checkbox, {
359
+ onChange: function onChange(e) {
360
+ setShowFull(e.target.checked);
361
+ setTimeout(function () {
362
+ searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.reload();
363
+ }, 100);
364
+ }
365
+ }, "\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)];
366
+ },
367
+ scroll: {
368
+ y: document.documentElement.clientHeight - 355,
369
+ x: (otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$scroll = otherProps.scroll) === null || _otherProps$scroll === void 0 ? void 0 : _otherProps$scroll.x) || 1300
370
+ },
371
+ onChange: onTableChange,
372
+ options: {
373
+ // 这里还要再处理一下 接口不应该调用
374
+ density: false,
375
+ reloadIcon: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ReloadOutlined, {
376
+ onClick: function onClick() {
377
+ return actionRef.current.reload();
378
+ }
379
+ })),
380
+ setting: {
381
+ checkedReset: false,
382
+ extra: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a", {
383
+ onClick: function onClick() {
384
+ return handleSave();
385
+ }
386
+ }, "\u4FDD\u5B58"), /*#__PURE__*/React.createElement("a", {
387
+ onClick: function onClick() {
388
+ return handleReset();
389
+ }
390
+ }, "\u91CD\u7F6E")),
391
+ showListItemOption: true
392
+ }
393
+ }
394
+ })) : /*#__PURE__*/React.createElement(ProTable // 普通模式
395
+ , _extends({
396
+ columns: columns,
397
+ request: request,
398
+ actionRef: actionRef,
399
+ formRef: formRef
400
+ }, otherProps)), /*#__PURE__*/React.createElement(_Drawer, {
401
+ onClose: function onClose() {
402
+ return setSearchDrawer(false);
403
+ },
404
+ title: "\u9AD8\u7EA7\u7B5B\u9009",
405
+ width: 380,
406
+ rootStyle: {
407
+ position: 'fixed',
408
+ top: props.top || 64
409
+ },
410
+ getContainer: (otherProps === null || otherProps === void 0 ? void 0 : otherProps.getContainer) || ((_document$getElements = document.getElementsByClassName('page_plustable__body')[0]) === null || _document$getElements === void 0 ? void 0 : _document$getElements.parentElement),
411
+ className: "search-drawer",
412
+ open: searchDrawer,
413
+ maskClosable: false,
414
+ mask: false
415
+ }, /*#__PURE__*/React.createElement(FormRender, {
416
+ columns: columns,
417
+ loading: false,
418
+ changeValue: function changeValue() {
419
+ return onValuesChange();
420
+ },
421
+ onFormSearchSubmit: function onFormSearchSubmit() {
422
+ var _searchRef$current5;
423
+ searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current5 = searchRef.current) === null || _searchRef$current5 === void 0 ? void 0 : _searchRef$current5.submit();
424
+ },
425
+ dateFormatter: "string",
426
+ formRef: drawFormRef,
427
+ type: "table",
428
+ cardBordered: {
429
+ search: false
430
+ },
431
+ form: {},
432
+ search: {
433
+ optionRender: function optionRender() {
434
+ return [];
435
+ },
436
+ collapsed: false,
437
+ collapseRender: function collapseRender() {
438
+ return null;
439
+ }
440
+ },
441
+ manualRequest: true,
442
+ action: actionRef
443
+ })));
444
+ });
445
+ export default PlusTable;
package/es/index.less ADDED
@@ -0,0 +1,107 @@
1
+ @primar-color: #2c68ff;
2
+
3
+ .choose-site-goods-modal {
4
+ .ww-search {
5
+ background-color: #fafafa;
6
+ padding: 20px;
7
+ .ww-search-flex {
8
+ width: 100%;
9
+ display: flex;
10
+ align-items: center;
11
+ overflow: hidden;
12
+ .ww-search-range-input {
13
+ flex: 1;
14
+ display: flex;
15
+ align-items: center;
16
+ }
17
+ }
18
+ }
19
+ .main-search {
20
+ display: flex;
21
+ justify-content: center;
22
+ margin-bottom: 16px;
23
+ position: relative;
24
+ .choose-more-btn {
25
+ position: absolute;
26
+ right: 0px;
27
+ top: 0px;
28
+ }
29
+ }
30
+ .search-2 {
31
+ .sort-item {
32
+ display: flex;
33
+ align-items: center;
34
+ .sort-item-label {
35
+ font-size: 12px;
36
+ }
37
+ .sort-item-icon {
38
+ font-size: 10px;
39
+ margin-left: 4px;
40
+ }
41
+ }
42
+ .ant-radio-button-wrapper {
43
+ padding: 0 10px !important;
44
+ }
45
+ }
46
+ .table-goods-wrap {
47
+ display: flex;
48
+
49
+ .table-goods-img-wrap {
50
+ width: 60px;
51
+ height: 60px;
52
+ background: #ffffff;
53
+ border-radius: 1px;
54
+ border: 1px solid #cccccc;
55
+ box-sizing: border-box;
56
+ display: flex;
57
+ align-items: center;
58
+ overflow: hidden;
59
+ .pro-image {
60
+ width: 100%;
61
+ height: 100%;
62
+ object-fit: cover;
63
+ .ant-image {
64
+ width: 100%;
65
+ height: 100%;
66
+ }
67
+ }
68
+ }
69
+
70
+ .table-goods-content {
71
+ margin-left: 10px;
72
+ flex: 1;
73
+
74
+ .table-goods-content-title {
75
+ height: 34px;
76
+ font-size: 12px;
77
+ font-weight: 500;
78
+ color: #666666;
79
+ line-height: 17px;
80
+ text-overflow: -o-ellipsis-lastline;
81
+ overflow: hidden;
82
+ text-overflow: ellipsis;
83
+ display: -webkit-box;
84
+ -webkit-line-clamp: 2;
85
+ line-clamp: 2;
86
+ -webkit-box-orient: vertical;
87
+ text-align: left;
88
+ // color: @primary-color;
89
+ }
90
+
91
+ .table-goods-content-sub-title {
92
+ text-align: left;
93
+ height: 17px;
94
+ font-size: 12px;
95
+ font-weight: 400;
96
+ color: #666666;
97
+ overflow: hidden;
98
+ text-overflow: ellipsis;
99
+ white-space: nowrap;
100
+ margin-top: 9px;
101
+ }
102
+ }
103
+ }
104
+ .ml-3 {
105
+ margin-left: 3px;
106
+ }
107
+ }
package/es/mock.js ADDED
@@ -0,0 +1,60 @@
1
+ export var data = {
2
+ admissionNo: {
3
+ show: true
4
+ },
5
+ supplierName: {
6
+ show: true
7
+ },
8
+ supplierShortName: {
9
+ show: true
10
+ },
11
+ approveState: {
12
+ show: true
13
+ },
14
+ supplierCategoryName: {
15
+ show: true
16
+ },
17
+ supplierGradeName: {
18
+ show: true
19
+ },
20
+ tags: {
21
+ show: true
22
+ },
23
+ developmentPlanNo: {
24
+ show: true
25
+ },
26
+ documentLink: {
27
+ show: true
28
+ },
29
+ cooperateModeName: {
30
+ show: true
31
+ },
32
+ settlementMode: {
33
+ show: true
34
+ },
35
+ taxNumber: {
36
+ show: true
37
+ },
38
+ principalName: {
39
+ show: true
40
+ },
41
+ principalMobile: {
42
+ show: true
43
+ },
44
+ purchasePrincipalName: {
45
+ show: true
46
+ },
47
+ address: {
48
+ show: true
49
+ },
50
+ createTime: {
51
+ show: true
52
+ },
53
+ remark: {
54
+ show: true
55
+ },
56
+ createUserName: {
57
+ show: true,
58
+ fixed: 'right'
59
+ }
60
+ };
@@ -0,0 +1,9 @@
1
+ export default {
2
+ // getGoodsList: '/fleshopy/merchant/site/site-goods/pageList', // 查询站点商品
3
+ getJDGoodsStock: '/fleshopy/stock/getStockBatch',
4
+ getCategoryAllList: '/fleshopy/category/getTreeList',
5
+ getSelfGoodsFlag: '/fleshopy/goods/flag/allList',
6
+ getSelfGoodsFlagCategory: '/elebuys/goodsCategory/tree',
7
+ getDgssCityAllList: '/supplier/dgss/city/allList',
8
+ getGoodsList: '/bestgift/goods/goods/search/getMemberGoodsList'
9
+ };
@@ -0,0 +1,31 @@
1
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
2
+ 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); }
3
+ 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; }
4
+ import moment from 'moment';
5
+ export var showMoney = function showMoney(data) {
6
+ return (+data / 100).toFixed(2);
7
+ };
8
+ export var showTime = function showTime(data) {
9
+ var fmtType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'YYYY-MM-DD HH:mm:ss';
10
+ return data ? moment(data).format(fmtType) : '';
11
+ };
12
+ /**
13
+ * 格式化url参数
14
+ */
15
+ export var parseQueryString = function parseQueryString() {
16
+ var urlParams = new URLSearchParams(window.location.search);
17
+ var params = {};
18
+ var _iterator = _createForOfIteratorHelper(urlParams),
19
+ _step;
20
+ try {
21
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
22
+ var param = _step.value;
23
+ params[param[0]] = param[1];
24
+ }
25
+ } catch (err) {
26
+ _iterator.e(err);
27
+ } finally {
28
+ _iterator.f();
29
+ }
30
+ return params;
31
+ };