@teamias/rex-pro 0.0.1
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/LICENSE +21 -0
- package/README.md +65 -0
- package/dist/components/card-basic-info/card-basic-info.d.ts +24 -0
- package/dist/components/card-basic-info/card-basic-info.js +62 -0
- package/dist/components/card-basic-info/demo/BasicCardBasicInfo.d.ts +2 -0
- package/dist/components/card-basic-info/demo/BasicCardBasicInfo.js +11 -0
- package/dist/components/card-basic-info/demo/LinkContentType.d.ts +2 -0
- package/dist/components/card-basic-info/demo/LinkContentType.js +26 -0
- package/dist/components/card-basic-info/demo/TableUsage.d.ts +2 -0
- package/dist/components/card-basic-info/demo/TableUsage.js +44 -0
- package/dist/components/card-basic-info/demo/TagContentType.d.ts +2 -0
- package/dist/components/card-basic-info/demo/TagContentType.js +16 -0
- package/dist/components/card-basic-info/demo/TextAndTagContentType.d.ts +2 -0
- package/dist/components/card-basic-info/demo/TextAndTagContentType.js +23 -0
- package/dist/components/card-basic-info/demo/TextContentType.d.ts +2 -0
- package/dist/components/card-basic-info/demo/TextContentType.js +17 -0
- package/dist/components/card-basic-info/index.d.ts +2 -0
- package/dist/components/card-basic-info/index.js +1 -0
- package/dist/components/card-basic-info/style/index.d.ts +5 -0
- package/dist/components/card-basic-info/style/index.js +19 -0
- package/dist/components/filter-form/demo/AverageFilterForm.d.ts +2 -0
- package/dist/components/filter-form/demo/AverageFilterForm.js +146 -0
- package/dist/components/filter-form/demo/BasicFilterForm.d.ts +2 -0
- package/dist/components/filter-form/demo/BasicFilterForm.js +319 -0
- package/dist/components/filter-form/filter-form.d.ts +62 -0
- package/dist/components/filter-form/filter-form.js +241 -0
- package/dist/components/filter-form/index.d.ts +1 -0
- package/dist/components/filter-form/index.js +2 -0
- package/dist/components/filter-form/style/index.d.ts +3 -0
- package/dist/components/filter-form/style/index.js +3 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +5 -0
- package/dist/components/rex-pro-form/demo/BasicRexProForm.d.ts +2 -0
- package/dist/components/rex-pro-form/demo/BasicRexProForm.js +209 -0
- package/dist/components/rex-pro-form/index.d.ts +1 -0
- package/dist/components/rex-pro-form/index.js +1 -0
- package/dist/components/rex-pro-form/rex-pro-form.d.ts +35 -0
- package/dist/components/rex-pro-form/rex-pro-form.js +100 -0
- package/dist/components/rex-pro-form/style/index.d.ts +2 -0
- package/dist/components/rex-pro-form/style/index.js +2 -0
- package/dist/components/rex-pro-table/components/ActionButtons.d.ts +2 -0
- package/dist/components/rex-pro-table/components/ActionButtons.js +306 -0
- package/dist/components/rex-pro-table/components/drawer-table/InlineTable.d.ts +4 -0
- package/dist/components/rex-pro-table/components/drawer-table/InlineTable.js +89 -0
- package/dist/components/rex-pro-table/components/drawer-table/index.d.ts +2 -0
- package/dist/components/rex-pro-table/components/drawer-table/index.js +67 -0
- package/dist/components/rex-pro-table/components/modal-form/InlineForm.d.ts +8 -0
- package/dist/components/rex-pro-table/components/modal-form/InlineForm.js +143 -0
- package/dist/components/rex-pro-table/components/modal-form/index.d.ts +2 -0
- package/dist/components/rex-pro-table/components/modal-form/index.js +77 -0
- package/dist/components/rex-pro-table/demo/BasicRexProListTable.d.ts +2 -0
- package/dist/components/rex-pro-table/demo/BasicRexProListTable.js +1076 -0
- package/dist/components/rex-pro-table/demo/BasicRexProTable.d.ts +2 -0
- package/dist/components/rex-pro-table/demo/BasicRexProTable.js +1104 -0
- package/dist/components/rex-pro-table/index.d.ts +2 -0
- package/dist/components/rex-pro-table/index.js +1 -0
- package/dist/components/rex-pro-table/rex-pro-table.d.ts +4 -0
- package/dist/components/rex-pro-table/rex-pro-table.js +416 -0
- package/dist/components/rex-pro-table/style/index.d.ts +10 -0
- package/dist/components/rex-pro-table/style/index.js +23 -0
- package/dist/components/rex-pro-table/types.d.ts +221 -0
- package/dist/components/rex-pro-table/types.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/locales/en-US.json +28 -0
- package/dist/locales/zh-CN.json +28 -0
- package/dist/types/svg.d.ts +4 -0
- package/package.json +97 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RexProTable } from "./rex-pro-table";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IRexProTableProps, IRexProTableRef } from './types';
|
|
2
|
+
export declare const RexProTable: <TF extends Record<string, unknown>, TT extends Record<string, unknown>>({ toolbar, filterFormProps, tableProps, listTableProps, request, defaultPageSize, autoInitRequest, hidePagination, actionConfig, proTableRef, reload, }: IRexProTableProps<TF, TT> & {
|
|
3
|
+
reload?: ((wait?: number | undefined) => Promise<void>) | undefined;
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function 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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
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 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; }
|
|
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
|
+
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); }); }; }
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
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."); }
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
14
|
+
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; } }
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
+
import { ProForm } from '@ant-design/pro-components';
|
|
17
|
+
import { BaseListTable, BaseTable, useRequestFieldsConfig, useRexProConfigProvider, useStateData } from '@teamias/rex-design';
|
|
18
|
+
import { Card, Pagination, Skeleton, Space } from 'antd';
|
|
19
|
+
import { cloneDeep } from 'lodash';
|
|
20
|
+
import React, { useImperativeHandle, useRef } from 'react';
|
|
21
|
+
import { FilterForm } from "../filter-form";
|
|
22
|
+
import { ActionButtons } from "./components/ActionButtons";
|
|
23
|
+
import { TableActionButtonGroup, ToolbarBox, Wrapper } from "./style";
|
|
24
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
26
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
|
+
var InlineRexProTable = function InlineRexProTable(_ref) {
|
|
28
|
+
var _state$dataSource;
|
|
29
|
+
var toolbar = _ref.toolbar,
|
|
30
|
+
filterFormProps = _ref.filterFormProps,
|
|
31
|
+
tableProps = _ref.tableProps,
|
|
32
|
+
listTableProps = _ref.listTableProps,
|
|
33
|
+
request = _ref.request,
|
|
34
|
+
_ref$defaultPageSize = _ref.defaultPageSize,
|
|
35
|
+
defaultPageSize = _ref$defaultPageSize === void 0 ? 50 : _ref$defaultPageSize,
|
|
36
|
+
_ref$autoInitRequest = _ref.autoInitRequest,
|
|
37
|
+
autoInitRequest = _ref$autoInitRequest === void 0 ? false : _ref$autoInitRequest,
|
|
38
|
+
_ref$hidePagination = _ref.hidePagination,
|
|
39
|
+
hidePagination = _ref$hidePagination === void 0 ? false : _ref$hidePagination,
|
|
40
|
+
actionConfig = _ref.actionConfig,
|
|
41
|
+
proTableRef = _ref.proTableRef,
|
|
42
|
+
_reload = _ref.reload;
|
|
43
|
+
var _useRexProConfigProvi = useRexProConfigProvider(),
|
|
44
|
+
apiClient = _useRexProConfigProvi.apiClient,
|
|
45
|
+
formatMessage = _useRexProConfigProvi.intl.formatMessage;
|
|
46
|
+
var responseConfig = useRequestFieldsConfig();
|
|
47
|
+
var _ProForm$useForm = ProForm.useForm(),
|
|
48
|
+
_ProForm$useForm2 = _slicedToArray(_ProForm$useForm, 1),
|
|
49
|
+
form = _ProForm$useForm2[0];
|
|
50
|
+
var formRef = useRef();
|
|
51
|
+
var _useStateData = useStateData(function () {
|
|
52
|
+
return {
|
|
53
|
+
params: {
|
|
54
|
+
filterValues: {},
|
|
55
|
+
page: {
|
|
56
|
+
page_size: defaultPageSize,
|
|
57
|
+
current: 1
|
|
58
|
+
},
|
|
59
|
+
sort: {},
|
|
60
|
+
filter: {}
|
|
61
|
+
},
|
|
62
|
+
dataSource: [],
|
|
63
|
+
result: {
|
|
64
|
+
total: 0
|
|
65
|
+
},
|
|
66
|
+
loading: false,
|
|
67
|
+
actionButtonItemsPromise: undefined,
|
|
68
|
+
hasBatchAction: true,
|
|
69
|
+
customEmptyText: formatMessage({
|
|
70
|
+
id: 'bit.data-display.rex-pro-table.empty-text',
|
|
71
|
+
defaultMessage: '请选择相关筛选条件进行搜索.'
|
|
72
|
+
})
|
|
73
|
+
};
|
|
74
|
+
}),
|
|
75
|
+
state = _useStateData.state,
|
|
76
|
+
update = _useStateData.update;
|
|
77
|
+
var change = /*#__PURE__*/function () {
|
|
78
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
79
|
+
var _result$page, result;
|
|
80
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
81
|
+
while (1) switch (_context.prev = _context.next) {
|
|
82
|
+
case 0:
|
|
83
|
+
state.loading = true;
|
|
84
|
+
update();
|
|
85
|
+
_context.prev = 2;
|
|
86
|
+
_context.next = 5;
|
|
87
|
+
return request(cloneDeep(state.params));
|
|
88
|
+
case 5:
|
|
89
|
+
result = _context.sent;
|
|
90
|
+
state.dataSource = result.items;
|
|
91
|
+
state.result.total = ((_result$page = result.page) === null || _result$page === void 0 ? void 0 : _result$page.total_items) || 1;
|
|
92
|
+
_context.next = 15;
|
|
93
|
+
break;
|
|
94
|
+
case 10:
|
|
95
|
+
_context.prev = 10;
|
|
96
|
+
_context.t0 = _context["catch"](2);
|
|
97
|
+
state.dataSource = [];
|
|
98
|
+
state.result.total = 0;
|
|
99
|
+
console.error('request Missing');
|
|
100
|
+
case 15:
|
|
101
|
+
state.customEmptyText = undefined;
|
|
102
|
+
state.loading = false;
|
|
103
|
+
update();
|
|
104
|
+
case 18:
|
|
105
|
+
case "end":
|
|
106
|
+
return _context.stop();
|
|
107
|
+
}
|
|
108
|
+
}, _callee, null, [[2, 10]]);
|
|
109
|
+
}));
|
|
110
|
+
return function change() {
|
|
111
|
+
return _ref2.apply(this, arguments);
|
|
112
|
+
};
|
|
113
|
+
}();
|
|
114
|
+
|
|
115
|
+
/** 列按钮请求配置, 缓存请求的promise */
|
|
116
|
+
var colActionRequestFields = function colActionRequestFields(fn, url, params, config) {
|
|
117
|
+
// if (!fn) return (async () => []) as unknown as Exclude<typeof fn, undefined>;
|
|
118
|
+
var ajaxFn = fn || (url ? function () {
|
|
119
|
+
return apiClient(url, params);
|
|
120
|
+
} : /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
121
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
122
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
123
|
+
case 0:
|
|
124
|
+
return _context2.abrupt("return", config || []);
|
|
125
|
+
case 1:
|
|
126
|
+
case "end":
|
|
127
|
+
return _context2.stop();
|
|
128
|
+
}
|
|
129
|
+
}, _callee2);
|
|
130
|
+
})));
|
|
131
|
+
var newFn = function newFn() {
|
|
132
|
+
if (state.actionButtonItemsPromise) return state.actionButtonItemsPromise;
|
|
133
|
+
state.actionButtonItemsPromise = ajaxFn();
|
|
134
|
+
return state.actionButtonItemsPromise;
|
|
135
|
+
};
|
|
136
|
+
return newFn;
|
|
137
|
+
};
|
|
138
|
+
var action = {
|
|
139
|
+
getList: function getList(page) {
|
|
140
|
+
if (page) {
|
|
141
|
+
state.params.page.current = page;
|
|
142
|
+
}
|
|
143
|
+
change();
|
|
144
|
+
},
|
|
145
|
+
getFilterValue: function getFilterValue(real) {
|
|
146
|
+
if (real) {
|
|
147
|
+
var _formRef$current, _formRef$current$getF;
|
|
148
|
+
// formRef.current
|
|
149
|
+
return (_formRef$current = formRef.current) === null || _formRef$current === void 0 || (_formRef$current$getF = _formRef$current.getFieldsFormatValue) === null || _formRef$current$getF === void 0 ? void 0 : _formRef$current$getF.call(_formRef$current);
|
|
150
|
+
}
|
|
151
|
+
return cloneDeep(state.params.filterValues);
|
|
152
|
+
},
|
|
153
|
+
reload: function () {
|
|
154
|
+
var _reload2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(wait) {
|
|
155
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
156
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
157
|
+
case 0:
|
|
158
|
+
_context3.next = 2;
|
|
159
|
+
return _reload === null || _reload === void 0 ? void 0 : _reload(wait);
|
|
160
|
+
case 2:
|
|
161
|
+
case "end":
|
|
162
|
+
return _context3.stop();
|
|
163
|
+
}
|
|
164
|
+
}, _callee3);
|
|
165
|
+
}));
|
|
166
|
+
function reload(_x) {
|
|
167
|
+
return _reload2.apply(this, arguments);
|
|
168
|
+
}
|
|
169
|
+
return reload;
|
|
170
|
+
}(),
|
|
171
|
+
getFormRef: function getFormRef() {
|
|
172
|
+
return formRef;
|
|
173
|
+
},
|
|
174
|
+
getFormInstance: function getFormInstance() {
|
|
175
|
+
return form;
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
var extraColumns = actionConfig || responseConfig.tableActionButtonUrl || responseConfig.tableActionButtonConfig ? [_objectSpread(_objectSpread({
|
|
179
|
+
title: formatMessage({
|
|
180
|
+
id: 'bit.data-display.rex-pro-table.column-action-title',
|
|
181
|
+
defaultMessage: '操作'
|
|
182
|
+
}),
|
|
183
|
+
fixed: 'right',
|
|
184
|
+
dataIndex: 'webAction',
|
|
185
|
+
align: 'center',
|
|
186
|
+
width: 160
|
|
187
|
+
}, actionConfig === null || actionConfig === void 0 ? void 0 : actionConfig.columnConfig), {}, {
|
|
188
|
+
render: function render(_, record, index) {
|
|
189
|
+
var _actionConfig$actionB, _actionConfig$actionB2, _actionConfig$actionB3, _actionConfig$actionB4;
|
|
190
|
+
// actionConfig.customRender
|
|
191
|
+
var actionButtonsNode = actionConfig !== null && actionConfig !== void 0 && actionConfig.actionButtonProps || responseConfig.tableActionButtonUrl || responseConfig.tableActionButtonConfig ? /*#__PURE__*/_jsx(TableActionButtonGroup, {
|
|
192
|
+
className: "pro-rex-table-action-button-group",
|
|
193
|
+
children: /*#__PURE__*/_jsx(ActionButtons, _objectSpread(_objectSpread({
|
|
194
|
+
size: "small"
|
|
195
|
+
}, actionConfig === null || actionConfig === void 0 ? void 0 : actionConfig.actionButtonProps), {}, {
|
|
196
|
+
record: record,
|
|
197
|
+
requestFields: colActionRequestFields(actionConfig === null || actionConfig === void 0 || (_actionConfig$actionB = actionConfig.actionButtonProps) === null || _actionConfig$actionB === void 0 ? void 0 : _actionConfig$actionB.requestFields, (actionConfig === null || actionConfig === void 0 || (_actionConfig$actionB2 = actionConfig.actionButtonProps) === null || _actionConfig$actionB2 === void 0 ? void 0 : _actionConfig$actionB2.requestFieldsUrl) || responseConfig.tableActionButtonUrl, (actionConfig === null || actionConfig === void 0 || (_actionConfig$actionB3 = actionConfig.actionButtonProps) === null || _actionConfig$actionB3 === void 0 ? void 0 : _actionConfig$actionB3.requestFieldsParams) || responseConfig.tableActionButtonParams, (actionConfig === null || actionConfig === void 0 || (_actionConfig$actionB4 = actionConfig.actionButtonProps) === null || _actionConfig$actionB4 === void 0 ? void 0 : _actionConfig$actionB4.fieldsConfig) || responseConfig.tableActionButtonConfig),
|
|
198
|
+
enablePromiseCollection: false,
|
|
199
|
+
proTableRef: action,
|
|
200
|
+
onClick: function onClick() {
|
|
201
|
+
var _actionConfig$actionB5, _actionConfig$actionB6;
|
|
202
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
203
|
+
args[_key] = arguments[_key];
|
|
204
|
+
}
|
|
205
|
+
actionConfig === null || actionConfig === void 0 || (_actionConfig$actionB5 = actionConfig.actionButtonProps) === null || _actionConfig$actionB5 === void 0 || (_actionConfig$actionB6 = _actionConfig$actionB5.onClick) === null || _actionConfig$actionB6 === void 0 || _actionConfig$actionB6.call.apply(_actionConfig$actionB6, [_actionConfig$actionB5, record, index].concat(args));
|
|
206
|
+
}
|
|
207
|
+
}))
|
|
208
|
+
}) : /*#__PURE__*/_jsx(_Fragment, {});
|
|
209
|
+
if (actionConfig !== null && actionConfig !== void 0 && actionConfig.render) {
|
|
210
|
+
return actionConfig.render(record, index, actionButtonsNode);
|
|
211
|
+
}
|
|
212
|
+
return actionButtonsNode;
|
|
213
|
+
}
|
|
214
|
+
})] : [];
|
|
215
|
+
var batchActionNodeFn = function batchActionNodeFn() {
|
|
216
|
+
// if (!toolbar) return;
|
|
217
|
+
var batchActionNode = toolbar !== null && toolbar !== void 0 && toolbar.batchActionProps || responseConfig.batchActionUrl || responseConfig.batchActionConfig ? /*#__PURE__*/_jsx(ActionButtons, _objectSpread(_objectSpread({
|
|
218
|
+
enablePromiseCollection: true,
|
|
219
|
+
requestFieldsUrl: responseConfig.batchActionUrl,
|
|
220
|
+
requestFieldsParams: responseConfig.batchActionParams,
|
|
221
|
+
fieldsConfig: responseConfig.batchActionConfig
|
|
222
|
+
}, toolbar === null || toolbar === void 0 ? void 0 : toolbar.batchActionProps), {}, {
|
|
223
|
+
proTableRef: action,
|
|
224
|
+
onHasButtons: function onHasButtons(val) {
|
|
225
|
+
if (state.hasBatchAction !== val) {
|
|
226
|
+
state.hasBatchAction = val;
|
|
227
|
+
update();
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
})) : /*#__PURE__*/_jsx(_Fragment, {});
|
|
231
|
+
if (toolbar !== null && toolbar !== void 0 && toolbar.render) {
|
|
232
|
+
return toolbar.render(batchActionNode);
|
|
233
|
+
}
|
|
234
|
+
return batchActionNode;
|
|
235
|
+
};
|
|
236
|
+
useImperativeHandle(proTableRef, function () {
|
|
237
|
+
return action;
|
|
238
|
+
});
|
|
239
|
+
return /*#__PURE__*/_jsxs(Wrapper, {
|
|
240
|
+
className: "pro-rex-table-box",
|
|
241
|
+
children: [/*#__PURE__*/_jsx(Card, {
|
|
242
|
+
size: "small",
|
|
243
|
+
style: {
|
|
244
|
+
display: filterFormProps !== null && filterFormProps !== void 0 && filterFormProps.hidden ? 'none' : undefined
|
|
245
|
+
},
|
|
246
|
+
styles: {
|
|
247
|
+
body: {
|
|
248
|
+
padding: 10
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
children: /*#__PURE__*/_jsx(FilterForm, _objectSpread(_objectSpread({}, filterFormProps), {}, {
|
|
252
|
+
loading: state.loading,
|
|
253
|
+
form: form,
|
|
254
|
+
formRef: formRef,
|
|
255
|
+
firstTriggerInitEvent: true,
|
|
256
|
+
onReset: function onReset(values) {
|
|
257
|
+
if (state.loading) return;
|
|
258
|
+
state.params.filterValues = values;
|
|
259
|
+
action.getList(1);
|
|
260
|
+
},
|
|
261
|
+
onFinish: function onFinish(values) {
|
|
262
|
+
// console.log(values);
|
|
263
|
+
if (state.loading) return;
|
|
264
|
+
state.params.filterValues = values;
|
|
265
|
+
action.getList(1);
|
|
266
|
+
},
|
|
267
|
+
onInit: function onInit(values) {
|
|
268
|
+
state.params.filterValues = values;
|
|
269
|
+
if (autoInitRequest) {
|
|
270
|
+
action.getList(1);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}))
|
|
274
|
+
}), listTableProps ? /*#__PURE__*/_jsx(_Fragment, {}) : /*#__PURE__*/_jsx(ToolbarBox, {
|
|
275
|
+
className: "pro-rex-toolbar-box",
|
|
276
|
+
style: {
|
|
277
|
+
marginBottom: 0
|
|
278
|
+
},
|
|
279
|
+
children: batchActionNodeFn()
|
|
280
|
+
}), /*#__PURE__*/_jsxs(Card, {
|
|
281
|
+
size: "small",
|
|
282
|
+
rootClassName: "pro-rex-table-card",
|
|
283
|
+
styles: {
|
|
284
|
+
body: {
|
|
285
|
+
display: 'flex',
|
|
286
|
+
flexDirection: 'column',
|
|
287
|
+
padding: 10
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
children: [listTableProps ? /*#__PURE__*/_jsx(BaseListTable, _objectSpread(_objectSpread({
|
|
291
|
+
dataSource: state.dataSource
|
|
292
|
+
}, listTableProps), {}, {
|
|
293
|
+
headerRender: function headerRender(originNode) {
|
|
294
|
+
return /*#__PURE__*/_jsxs(ToolbarBox, {
|
|
295
|
+
className: "pro-rex-toolbar-box",
|
|
296
|
+
children: [originNode, batchActionNodeFn()]
|
|
297
|
+
});
|
|
298
|
+
},
|
|
299
|
+
titleRender: function titleRender(record, index, originNode) {
|
|
300
|
+
var _extraColumns$, _extraColumns$$render;
|
|
301
|
+
var node = ((_extraColumns$ = extraColumns[0]) === null || _extraColumns$ === void 0 || (_extraColumns$$render = _extraColumns$.render) === null || _extraColumns$$render === void 0 ? void 0 : _extraColumns$$render.call(_extraColumns$, undefined, record, index)) || /*#__PURE__*/_jsx(_Fragment, {});
|
|
302
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
303
|
+
children: [originNode.checkboxNode, originNode.dataNode, /*#__PURE__*/_jsx("div", {
|
|
304
|
+
style: {
|
|
305
|
+
flex: 1
|
|
306
|
+
}
|
|
307
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
308
|
+
style: {
|
|
309
|
+
minWidth: node ? extraColumns[0].width : undefined
|
|
310
|
+
},
|
|
311
|
+
children: node
|
|
312
|
+
})]
|
|
313
|
+
});
|
|
314
|
+
},
|
|
315
|
+
loading: state.loading,
|
|
316
|
+
pagination: false,
|
|
317
|
+
extraColumns: extraColumns
|
|
318
|
+
})) : /*#__PURE__*/_jsx(BaseTable, _objectSpread(_objectSpread({
|
|
319
|
+
dataSource: state.dataSource
|
|
320
|
+
}, tableProps), {}, {
|
|
321
|
+
customEmptyText: state.customEmptyText,
|
|
322
|
+
loading: state.loading,
|
|
323
|
+
pagination: false,
|
|
324
|
+
extraColumns: extraColumns
|
|
325
|
+
})), (_state$dataSource = state.dataSource) !== null && _state$dataSource !== void 0 && _state$dataSource.length && !hidePagination ? /*#__PURE__*/_jsx(Pagination, {
|
|
326
|
+
style: {
|
|
327
|
+
marginTop: 10
|
|
328
|
+
},
|
|
329
|
+
align: "end",
|
|
330
|
+
size: "small",
|
|
331
|
+
total: state.result.total,
|
|
332
|
+
showSizeChanger: true,
|
|
333
|
+
showQuickJumper: true,
|
|
334
|
+
showLessItems: true,
|
|
335
|
+
showTotal: function showTotal(total) {
|
|
336
|
+
return formatMessage({
|
|
337
|
+
id: 'bit.data-display.rex-pro-table.pagination-total',
|
|
338
|
+
defaultMessage: '共 {total} 条'
|
|
339
|
+
}, {
|
|
340
|
+
total: total
|
|
341
|
+
});
|
|
342
|
+
},
|
|
343
|
+
pageSize: state.params.page.page_size,
|
|
344
|
+
current: state.params.page.current,
|
|
345
|
+
showTitle: true,
|
|
346
|
+
onChange: function onChange(page, pageSize) {
|
|
347
|
+
state.params.page.current = page;
|
|
348
|
+
state.params.page.page_size = pageSize;
|
|
349
|
+
change();
|
|
350
|
+
}
|
|
351
|
+
}) : /*#__PURE__*/_jsx(_Fragment, {})]
|
|
352
|
+
})]
|
|
353
|
+
});
|
|
354
|
+
};
|
|
355
|
+
export var RexProTable = function RexProTable(props) {
|
|
356
|
+
var _useStateData2 = useStateData(function () {
|
|
357
|
+
return {
|
|
358
|
+
/** 用于 reload */
|
|
359
|
+
destroyStatus: false
|
|
360
|
+
};
|
|
361
|
+
}),
|
|
362
|
+
state = _useStateData2.state,
|
|
363
|
+
update = _useStateData2.update;
|
|
364
|
+
var reload = /*#__PURE__*/function () {
|
|
365
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
366
|
+
var wait,
|
|
367
|
+
_args4 = arguments;
|
|
368
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
369
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
370
|
+
case 0:
|
|
371
|
+
wait = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : 0;
|
|
372
|
+
state.destroyStatus = true;
|
|
373
|
+
_context4.next = 4;
|
|
374
|
+
return update();
|
|
375
|
+
case 4:
|
|
376
|
+
setTimeout(function () {
|
|
377
|
+
state.destroyStatus = false;
|
|
378
|
+
update();
|
|
379
|
+
}, wait);
|
|
380
|
+
case 5:
|
|
381
|
+
case "end":
|
|
382
|
+
return _context4.stop();
|
|
383
|
+
}
|
|
384
|
+
}, _callee4);
|
|
385
|
+
}));
|
|
386
|
+
return function reload() {
|
|
387
|
+
return _ref4.apply(this, arguments);
|
|
388
|
+
};
|
|
389
|
+
}();
|
|
390
|
+
if (state.destroyStatus) {
|
|
391
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
392
|
+
children: /*#__PURE__*/_jsxs(Space, {
|
|
393
|
+
size: [8, 16],
|
|
394
|
+
wrap: true,
|
|
395
|
+
children: [/*#__PURE__*/_jsx(Skeleton.Input, {
|
|
396
|
+
active: true
|
|
397
|
+
}), /*#__PURE__*/_jsx(Skeleton.Input, {
|
|
398
|
+
active: true
|
|
399
|
+
}), /*#__PURE__*/_jsx(Skeleton.Input, {
|
|
400
|
+
active: true
|
|
401
|
+
}), /*#__PURE__*/_jsx(Skeleton.Input, {
|
|
402
|
+
active: true
|
|
403
|
+
}), /*#__PURE__*/_jsx(Skeleton.Input, {
|
|
404
|
+
active: true
|
|
405
|
+
}), /*#__PURE__*/_jsx(Skeleton.Input, {
|
|
406
|
+
active: true
|
|
407
|
+
}), /*#__PURE__*/_jsx(Skeleton.Input, {
|
|
408
|
+
active: true
|
|
409
|
+
})]
|
|
410
|
+
})
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
return /*#__PURE__*/_jsx(InlineRexProTable, _objectSpread(_objectSpread({}, props), {}, {
|
|
414
|
+
reload: reload
|
|
415
|
+
}));
|
|
416
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Wrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
+
export declare const ToolbarBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
|
+
export declare const TableActionButtonGroup: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
5
|
+
export declare const ModalSearchStyle: import("react").NamedExoticComponent<import("styled-components").ExecutionProps & object>;
|
|
6
|
+
export declare const ModalFormStyle: import("react").NamedExoticComponent<import("styled-components").ExecutionProps & {
|
|
7
|
+
height?: string | undefined;
|
|
8
|
+
maxHeight?: string | undefined;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const ModalFormButtonGroup: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import styled, { createGlobalStyle } from 'styled-components';
|
|
2
|
+
export var Wrapper = styled.div.withConfig({
|
|
3
|
+
displayName: "Wrapper",
|
|
4
|
+
componentId: "rex-pro-aaf4__sc-48osaw-0"
|
|
5
|
+
})(["&.pro-rex-table-box{display:flex;flex-direction:column;gap:10px;.pro-rex-table-card{flex:1;}}"]);
|
|
6
|
+
export var ToolbarBox = styled.div.withConfig({
|
|
7
|
+
displayName: "ToolbarBox",
|
|
8
|
+
componentId: "rex-pro-aaf4__sc-48osaw-1"
|
|
9
|
+
})(["&.pro-rex-toolbar-box{display:flex;gap:10px;align-items:center;margin-bottom:10px;}"]);
|
|
10
|
+
export var TableActionButtonGroup = styled.div.withConfig({
|
|
11
|
+
displayName: "TableActionButtonGroup",
|
|
12
|
+
componentId: "rex-pro-aaf4__sc-48osaw-2"
|
|
13
|
+
})(["&.pro-rex-table-action-button-group{display:flex;gap:6px;justify-content:center;align-items:center;}"]);
|
|
14
|
+
export var ModalSearchStyle = createGlobalStyle([".pro-rex-table-modal-search .ant-drawer-body{padding:12px;}.pro-rex-table-modal-search .pro-rex-table-box{height:100%;}.pro-rex-table-modal-search .ant-drawer-header{padding:10px 12px;}.pro-rex-table-modal-search .ant-drawer-title{font-size:14px;}"]);
|
|
15
|
+
export var ModalFormStyle = createGlobalStyle([".pro-modal-form-body .ant-modal-body{max-height:", ";height:", ";overflow-y:auto}"], function (props) {
|
|
16
|
+
return props.maxHeight ? props.maxHeight : '60vh';
|
|
17
|
+
}, function (props) {
|
|
18
|
+
return props.height;
|
|
19
|
+
});
|
|
20
|
+
export var ModalFormButtonGroup = styled.div.withConfig({
|
|
21
|
+
displayName: "ModalFormButtonGroup",
|
|
22
|
+
componentId: "rex-pro-aaf4__sc-48osaw-3"
|
|
23
|
+
})(["&.pro-modal-form-button-group{display:flex;gap:8px;justify-content:flex-end;position:sticky;bottom:0;background:#fff;}"]);
|