@quansitech/antd-admin 1.1.0 → 1.1.2
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/dist/components/Column/Cascader.d.ts +3 -0
- package/dist/components/Column/Cascader.js +110 -0
- package/dist/components/Column/File.d.ts +18 -0
- package/dist/components/Column/File.js +176 -0
- package/dist/components/Column/Image.d.ts +10 -0
- package/dist/components/Column/Image.js +104 -0
- package/dist/components/Column/Readonly/Action/Link.d.ts +11 -0
- package/dist/components/Column/Readonly/Action/Link.js +114 -0
- package/dist/components/Column/Readonly/Action/index.d.ts +4 -0
- package/dist/components/Column/Readonly/Action/index.js +3 -0
- package/dist/components/Column/Readonly/Action.d.ts +12 -0
- package/dist/components/Column/Readonly/Action.js +96 -0
- package/dist/components/Column/Readonly/Cascader.d.ts +9 -0
- package/dist/components/Column/Readonly/Cascader.js +52 -0
- package/dist/components/Column/Readonly/File.d.ts +8 -0
- package/dist/components/Column/Readonly/File.js +54 -0
- package/dist/components/Column/Readonly/Image.d.ts +3 -0
- package/dist/components/Column/Readonly/Image.js +69 -0
- package/dist/components/Column/Readonly/Ueditor.d.ts +3 -0
- package/dist/components/Column/Readonly/Ueditor.js +24 -0
- package/dist/components/Column/Readonly/index.d.ts +8 -0
- package/dist/components/Column/Readonly/index.js +7 -0
- package/dist/components/Column/Ueditor.d.ts +27 -0
- package/dist/components/Column/Ueditor.js +333 -0
- package/dist/components/Column/index.d.ts +7 -0
- package/dist/components/Column/index.js +6 -0
- package/dist/components/Form/Action/Button.d.ts +15 -0
- package/dist/components/Form/Action/Button.js +194 -0
- package/dist/components/Form/Action/index.d.ts +4 -0
- package/dist/components/Form/Action/index.js +3 -0
- package/dist/components/Form/Actions.d.ts +6 -0
- package/dist/components/Form/Actions.js +48 -0
- package/dist/components/Form.d.ts +20 -0
- package/dist/components/Form.js +217 -0
- package/dist/components/FormContext.d.ts +7 -0
- package/dist/components/FormContext.js +2 -0
- package/dist/components/Layout/New.d.ts +7 -0
- package/dist/components/Layout/New.js +257 -0
- package/dist/components/Layout.d.ts +4 -0
- package/dist/components/Layout.js +67 -0
- package/dist/components/LayoutContext.d.ts +26 -0
- package/dist/components/LayoutContext.js +2 -0
- package/dist/components/ModalContext.d.ts +8 -0
- package/dist/components/ModalContext.js +6 -0
- package/dist/components/Table/Action/Button.d.ts +10 -0
- package/dist/components/Table/Action/Button.js +166 -0
- package/dist/components/Table/Action/StartEditable.d.ts +10 -0
- package/dist/components/Table/Action/StartEditable.js +79 -0
- package/dist/components/Table/Action/index.d.ts +5 -0
- package/dist/components/Table/Action/index.js +4 -0
- package/dist/components/Table/ToolbarActions.d.ts +6 -0
- package/dist/components/Table/ToolbarActions.js +52 -0
- package/dist/components/Table.d.ts +19 -0
- package/dist/components/Table.js +322 -0
- package/dist/components/TableContext.d.ts +14 -0
- package/dist/components/TableContext.js +2 -0
- package/dist/components/Tabs.d.ts +15 -0
- package/dist/components/Tabs.js +62 -0
- package/dist/env.d.ts +1 -0
- package/dist/global.d.ts +6 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/lib/container.d.ts +9 -0
- package/dist/lib/container.js +93 -0
- package/dist/lib/customRule.d.ts +3 -0
- package/dist/lib/customRule.js +7 -0
- package/dist/lib/global.d.ts +9 -0
- package/dist/lib/global.js +2 -0
- package/dist/lib/helpers.d.ts +14 -0
- package/dist/lib/helpers.js +183 -0
- package/dist/lib/http.d.ts +5 -0
- package/dist/lib/http.js +72 -0
- package/dist/lib/schemaHandler.d.ts +5 -0
- package/dist/lib/schemaHandler.js +133 -0
- package/dist/lib/upload.d.ts +20 -0
- package/dist/lib/upload.js +215 -0
- package/dist/lib/writeExtra.d.ts +1 -0
- package/dist/lib/writeExtra.js +28 -0
- package/dist/types.d.ts +25 -0
- package/package.json +14 -8
- package/components/Column/Cascader.tsx +0 -79
- package/components/Column/File.tsx +0 -166
- package/components/Column/Image.tsx +0 -77
- package/components/Column/Readonly/Action/Link.tsx +0 -78
- package/components/Column/Readonly/Action.tsx +0 -80
- package/components/Column/Readonly/Cascader.tsx +0 -51
- package/components/Column/Readonly/File.tsx +0 -53
- package/components/Column/Readonly/Image.tsx +0 -39
- package/components/Column/Readonly/Ueditor.tsx +0 -18
- package/components/Column/Ueditor.tsx +0 -314
- package/components/Form/Action/Button.tsx +0 -129
- package/components/Form/Actions.tsx +0 -39
- package/components/Form.tsx +0 -177
- package/components/FormContext.ts +0 -9
- package/components/Layout/New.tsx +0 -252
- package/components/Layout.tsx +0 -52
- package/components/LayoutContext.ts +0 -26
- package/components/ModalContext.ts +0 -16
- package/components/Table/Action/Button.tsx +0 -89
- package/components/Table/Action/StartEditable.tsx +0 -59
- package/components/Table/ToolbarActions.tsx +0 -44
- package/components/Table.tsx +0 -280
- package/components/TableContext.ts +0 -15
- package/components/Tabs.tsx +0 -72
- package/lib/container.ts +0 -84
- package/lib/customRule.ts +0 -10
- package/lib/global.ts +0 -11
- package/lib/helpers.tsx +0 -146
- package/lib/http.ts +0 -74
- package/lib/schemaHandler.ts +0 -122
- package/lib/upload.ts +0 -177
- package/lib/writeExtra.js +0 -31
- /package/{components → dist/components}/Column/Readonly/Action/types.d.ts +0 -0
- /package/{components → dist/components}/Column/Readonly/types.d.ts +0 -0
- /package/{components → dist/components}/Column/types.d.ts +0 -0
- /package/{components → dist/components}/Form/Action/types.d.ts +0 -0
- /package/{components → dist/components}/Table/Action/types.d.ts +0 -0
- /package/{components → dist/components}/Table.scss +0 -0
- /package/{components → dist/components}/types.d.ts +0 -0
|
@@ -0,0 +1,322 @@
|
|
|
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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
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); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
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; }
|
|
16
|
+
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; }
|
|
17
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
18
|
+
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); }
|
|
19
|
+
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); } }
|
|
20
|
+
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); }); }; }
|
|
21
|
+
import React, { lazy, useContext, useEffect, useRef, useState } from "react";
|
|
22
|
+
import { ProSkeleton, ProTable } from "@ant-design/pro-components";
|
|
23
|
+
import { cloneDeep, isArray, uniqueId, upperFirst } from "es-toolkit/compat";
|
|
24
|
+
import { TableContext } from "./TableContext";
|
|
25
|
+
import ToolbarActions from "./Table/ToolbarActions";
|
|
26
|
+
import container from "../lib/container";
|
|
27
|
+
import http from "../lib/http";
|
|
28
|
+
import "./Table.scss";
|
|
29
|
+
import { ModalContext } from "./ModalContext";
|
|
30
|
+
import { commonHandler } from "../lib/schemaHandler";
|
|
31
|
+
export default function (props) {
|
|
32
|
+
var request = /*#__PURE__*/function () {
|
|
33
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params, sort, filter) {
|
|
34
|
+
var data, res;
|
|
35
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
36
|
+
while (1) switch (_context.prev = _context.next) {
|
|
37
|
+
case 0:
|
|
38
|
+
setLoading(true);
|
|
39
|
+
data = _objectSpread(_objectSpread(_objectSpread({}, params), filter), {}, {
|
|
40
|
+
sort: sort
|
|
41
|
+
});
|
|
42
|
+
if (props.pagination) {
|
|
43
|
+
data[props.pagination.paramName || 'page'] = data.current;
|
|
44
|
+
delete data.current;
|
|
45
|
+
delete data.pageSize;
|
|
46
|
+
}
|
|
47
|
+
setEditableKeys([]);
|
|
48
|
+
setEditableValues([]);
|
|
49
|
+
_context.prev = 5;
|
|
50
|
+
_context.next = 8;
|
|
51
|
+
return http.get(props.searchUrl, {
|
|
52
|
+
params: data,
|
|
53
|
+
headers: {
|
|
54
|
+
'X-Table-Search': '1'
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
case 8:
|
|
58
|
+
res = _context.sent;
|
|
59
|
+
if (res.data.pagination) {
|
|
60
|
+
setPagination(_objectSpread(_objectSpread({}, res.data.pagination), {}, {
|
|
61
|
+
current: params.current
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
return _context.abrupt("return", {
|
|
65
|
+
data: res.data.dataSource || [],
|
|
66
|
+
success: true
|
|
67
|
+
});
|
|
68
|
+
case 11:
|
|
69
|
+
_context.prev = 11;
|
|
70
|
+
setLoading(false);
|
|
71
|
+
return _context.finish(11);
|
|
72
|
+
case 14:
|
|
73
|
+
case "end":
|
|
74
|
+
return _context.stop();
|
|
75
|
+
}
|
|
76
|
+
}, _callee, null, [[5,, 11, 14]]);
|
|
77
|
+
}));
|
|
78
|
+
return function request(_x, _x2, _x3) {
|
|
79
|
+
return _ref.apply(this, arguments);
|
|
80
|
+
};
|
|
81
|
+
}();
|
|
82
|
+
var formRef = useRef();
|
|
83
|
+
var actionRef = useRef();
|
|
84
|
+
var _useState = useState(function () {
|
|
85
|
+
return [];
|
|
86
|
+
}),
|
|
87
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
88
|
+
editableKeys = _useState2[0],
|
|
89
|
+
setEditableKeys = _useState2[1];
|
|
90
|
+
var _useState3 = useState([]),
|
|
91
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
92
|
+
columns = _useState4[0],
|
|
93
|
+
setColumns = _useState4[1];
|
|
94
|
+
var _useState5 = useState([]),
|
|
95
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
96
|
+
selectedRows = _useState6[0],
|
|
97
|
+
setSelectedRows = _useState6[1];
|
|
98
|
+
var _useState7 = useState([]),
|
|
99
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
100
|
+
editableValues = _useState8[0],
|
|
101
|
+
setEditableValues = _useState8[1];
|
|
102
|
+
var _useState9 = useState(false),
|
|
103
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
104
|
+
loading = _useState10[0],
|
|
105
|
+
setLoading = _useState10[1];
|
|
106
|
+
var _useState11 = useState(false),
|
|
107
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
108
|
+
initialized = _useState12[0],
|
|
109
|
+
setInitialized = _useState12[1];
|
|
110
|
+
var _useState13 = useState(),
|
|
111
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
112
|
+
pagination = _useState14[0],
|
|
113
|
+
setPagination = _useState14[1];
|
|
114
|
+
var _useState15 = useState([]),
|
|
115
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
116
|
+
dataSource = _useState16[0],
|
|
117
|
+
setDataSource = _useState16[1];
|
|
118
|
+
var _useState17 = useState(true),
|
|
119
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
120
|
+
sticky = _useState18[0],
|
|
121
|
+
setSticky = _useState18[1];
|
|
122
|
+
var modalContext = useContext(ModalContext);
|
|
123
|
+
useEffect(function () {
|
|
124
|
+
var _cloneDeep;
|
|
125
|
+
// @ts-ignore
|
|
126
|
+
setPagination(props.pagination || false);
|
|
127
|
+
setDataSource(postData(props.dataSource));
|
|
128
|
+
|
|
129
|
+
// 重新定义列
|
|
130
|
+
setColumns((_cloneDeep = cloneDeep(props.columns)) === null || _cloneDeep === void 0 ? void 0 : _cloneDeep.map(function (c) {
|
|
131
|
+
var _props$defaultSearchV;
|
|
132
|
+
c.key = c.dataIndex;
|
|
133
|
+
|
|
134
|
+
// 列render
|
|
135
|
+
var renderComponent = 'Column.Readonly.' + upperFirst(c.valueType);
|
|
136
|
+
if (container.check(renderComponent)) {
|
|
137
|
+
var Component = /*#__PURE__*/lazy(function () {
|
|
138
|
+
return container.get(renderComponent);
|
|
139
|
+
});
|
|
140
|
+
c.render = function (dom, record, index, action) {
|
|
141
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, c, {
|
|
142
|
+
schema: c,
|
|
143
|
+
key: c.title,
|
|
144
|
+
index: index,
|
|
145
|
+
record: record
|
|
146
|
+
}));
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// 列查询及编辑render
|
|
151
|
+
var formItemComponent = 'Column.' + upperFirst(c.valueType);
|
|
152
|
+
if (container.check(formItemComponent)) {
|
|
153
|
+
var _Component = /*#__PURE__*/lazy(function () {
|
|
154
|
+
return container.get(formItemComponent);
|
|
155
|
+
});
|
|
156
|
+
c.renderFormItem = function (schema, config, form) {
|
|
157
|
+
return /*#__PURE__*/React.createElement(_Component, {
|
|
158
|
+
config: config,
|
|
159
|
+
form: form,
|
|
160
|
+
index: schema.index,
|
|
161
|
+
schema: schema,
|
|
162
|
+
fieldProps: c.fieldProps,
|
|
163
|
+
key: c.title
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
if (((_props$defaultSearchV = props.defaultSearchValue) === null || _props$defaultSearchV === void 0 ? void 0 : _props$defaultSearchV[c.dataIndex]) !== undefined) {
|
|
168
|
+
c.initialValue = props.defaultSearchValue[c.dataIndex];
|
|
169
|
+
}
|
|
170
|
+
commonHandler(c);
|
|
171
|
+
if (container.schemaHandler[c.valueType]) {
|
|
172
|
+
return container.schemaHandler[c.valueType](c);
|
|
173
|
+
}
|
|
174
|
+
return c;
|
|
175
|
+
}));
|
|
176
|
+
setLoading(false);
|
|
177
|
+
setInitialized(true);
|
|
178
|
+
if (!modalContext.inModal) {
|
|
179
|
+
var _document$querySelect;
|
|
180
|
+
setSticky({
|
|
181
|
+
offsetHeader: ((_document$querySelect = document.querySelector('.ant-layout-header')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.clientHeight) || 56
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}, []);
|
|
185
|
+
var postData = function postData(data) {
|
|
186
|
+
if (!isArray(data)) {
|
|
187
|
+
return data;
|
|
188
|
+
}
|
|
189
|
+
props.columns.map(function (column) {
|
|
190
|
+
switch (column.valueType) {
|
|
191
|
+
case 'dateTime':
|
|
192
|
+
data = data.map(function (row) {
|
|
193
|
+
var v = row[column.dataIndex];
|
|
194
|
+
if (parseInt(v) == v && v < 4102444800) {
|
|
195
|
+
row[column.dataIndex] *= 1000;
|
|
196
|
+
}
|
|
197
|
+
return row;
|
|
198
|
+
});
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
return data.map(function (row) {
|
|
203
|
+
if (typeof row[props.rowKey] === 'undefined') {
|
|
204
|
+
row[props.rowKey] = uniqueId('row_');
|
|
205
|
+
}
|
|
206
|
+
return row;
|
|
207
|
+
});
|
|
208
|
+
};
|
|
209
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TableContext.Provider, {
|
|
210
|
+
value: {
|
|
211
|
+
getTableProps: function getTableProps() {
|
|
212
|
+
return props;
|
|
213
|
+
},
|
|
214
|
+
getEditedValues: function getEditedValues() {
|
|
215
|
+
return editableValues;
|
|
216
|
+
},
|
|
217
|
+
editableKeys: editableKeys,
|
|
218
|
+
actionRef: actionRef.current,
|
|
219
|
+
formRef: formRef.current,
|
|
220
|
+
extraRenderValues: props.extraRenderValues
|
|
221
|
+
}
|
|
222
|
+
}, !initialized && /*#__PURE__*/React.createElement(ProSkeleton, {
|
|
223
|
+
type: "list",
|
|
224
|
+
list: 2
|
|
225
|
+
}), /*#__PURE__*/React.createElement(ProTable, {
|
|
226
|
+
rowKey: props.rowKey,
|
|
227
|
+
style: {
|
|
228
|
+
display: initialized ? 'block' : 'none'
|
|
229
|
+
},
|
|
230
|
+
tableClassName: 'qs-antd-table',
|
|
231
|
+
columns: columns,
|
|
232
|
+
onDataSourceChange: setDataSource,
|
|
233
|
+
dataSource: dataSource,
|
|
234
|
+
pagination: pagination,
|
|
235
|
+
loading: loading,
|
|
236
|
+
scroll: {
|
|
237
|
+
x: true
|
|
238
|
+
},
|
|
239
|
+
postData: postData,
|
|
240
|
+
sticky: sticky,
|
|
241
|
+
form: {
|
|
242
|
+
onValuesChange: function onValuesChange(changedValues) {
|
|
243
|
+
var key = Object.keys(changedValues)[0];
|
|
244
|
+
var c = columns.find(function (c) {
|
|
245
|
+
return c.dataIndex === key;
|
|
246
|
+
});
|
|
247
|
+
if (!c) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
// 是否立即搜索
|
|
251
|
+
if (c.searchOnChange) {
|
|
252
|
+
var _formRef$current;
|
|
253
|
+
(_formRef$current = formRef.current) === null || _formRef$current === void 0 || _formRef$current.submit();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
rowSelection: props.rowSelection && {
|
|
258
|
+
alwaysShowAlert: false,
|
|
259
|
+
selectedRowKeys: selectedRows.map(function (item) {
|
|
260
|
+
return item[props.rowKey];
|
|
261
|
+
}),
|
|
262
|
+
onSelect: function onSelect(record, selected) {
|
|
263
|
+
if (selected) {
|
|
264
|
+
setSelectedRows([].concat(_toConsumableArray(selectedRows), [record]));
|
|
265
|
+
} else {
|
|
266
|
+
setSelectedRows(selectedRows.filter(function (item) {
|
|
267
|
+
return item[props.rowKey] !== record[props.rowKey];
|
|
268
|
+
}));
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
onChange: function onChange(selectedRowKeys, newSelectedRows, info) {
|
|
272
|
+
switch (info.type) {
|
|
273
|
+
case 'all':
|
|
274
|
+
if (newSelectedRows.length) {
|
|
275
|
+
setSelectedRows([].concat(_toConsumableArray(selectedRows), _toConsumableArray(newSelectedRows.filter(function (item) {
|
|
276
|
+
return !selectedRows.find(function (s) {
|
|
277
|
+
return s[props.rowKey] == item[props.rowKey];
|
|
278
|
+
});
|
|
279
|
+
}))));
|
|
280
|
+
} else {
|
|
281
|
+
setSelectedRows(selectedRows.filter(function (item) {
|
|
282
|
+
return !dataSource.find(function (dr) {
|
|
283
|
+
return dr[props.rowKey] == item[props.rowKey];
|
|
284
|
+
});
|
|
285
|
+
}));
|
|
286
|
+
}
|
|
287
|
+
break;
|
|
288
|
+
case 'none':
|
|
289
|
+
setSelectedRows([]);
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
toolbar: {
|
|
295
|
+
filter: true
|
|
296
|
+
},
|
|
297
|
+
toolBarRender: function toolBarRender(action) {
|
|
298
|
+
return [/*#__PURE__*/React.createElement(ToolbarActions, {
|
|
299
|
+
key: 'actions',
|
|
300
|
+
actions: props.actions,
|
|
301
|
+
selectedRows: selectedRows
|
|
302
|
+
})];
|
|
303
|
+
},
|
|
304
|
+
editable: {
|
|
305
|
+
type: 'multiple',
|
|
306
|
+
editableKeys: editableKeys,
|
|
307
|
+
onChange: setEditableKeys,
|
|
308
|
+
onValuesChange: function onValuesChange(record) {
|
|
309
|
+
setEditableValues([].concat(_toConsumableArray(editableValues.filter(function (item) {
|
|
310
|
+
return item[props.rowKey] !== record[props.rowKey];
|
|
311
|
+
})), [record]));
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
cardBordered: true,
|
|
315
|
+
manualRequest: true,
|
|
316
|
+
request: request,
|
|
317
|
+
formRef: formRef,
|
|
318
|
+
actionRef: actionRef,
|
|
319
|
+
search: props.search,
|
|
320
|
+
dateFormatter: props.dateFormatter
|
|
321
|
+
})));
|
|
322
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ActionType } from "@ant-design/pro-components";
|
|
3
|
+
import { TableProps } from "./Table";
|
|
4
|
+
import { FormInstance } from "antd/lib/form";
|
|
5
|
+
type TableContextValue = {
|
|
6
|
+
getTableProps: () => TableProps;
|
|
7
|
+
getEditedValues: () => Record<string, any>[];
|
|
8
|
+
editableKeys: React.Key[];
|
|
9
|
+
actionRef?: ActionType;
|
|
10
|
+
formRef?: FormInstance;
|
|
11
|
+
extraRenderValues?: Record<string, any>[];
|
|
12
|
+
};
|
|
13
|
+
export declare const TableContext: React.Context<TableContextValue>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type TabProps = {
|
|
3
|
+
title: string;
|
|
4
|
+
url?: string;
|
|
5
|
+
pane?: {
|
|
6
|
+
component: 'form' | 'table';
|
|
7
|
+
props: any;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export type TabsPageType = {
|
|
11
|
+
tabs: Record<string, TabProps>;
|
|
12
|
+
defaultActiveKey?: string;
|
|
13
|
+
};
|
|
14
|
+
export default function (props: TabsPageType): React.JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { Tabs } from "antd";
|
|
8
|
+
import React, { lazy, Suspense, useEffect, useState } from "react";
|
|
9
|
+
import container from "../lib/container";
|
|
10
|
+
import { routerNavigateTo } from "../lib/helpers";
|
|
11
|
+
import { upperFirst } from "es-toolkit";
|
|
12
|
+
import { ProSkeleton } from "@ant-design/pro-components";
|
|
13
|
+
export default function (props) {
|
|
14
|
+
var _useState = useState([]),
|
|
15
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
16
|
+
items = _useState2[0],
|
|
17
|
+
setItems = _useState2[1];
|
|
18
|
+
var _useState3 = useState(),
|
|
19
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
20
|
+
activeKey = _useState4[0],
|
|
21
|
+
setActiveKey = _useState4[1];
|
|
22
|
+
useEffect(function () {
|
|
23
|
+
setActiveKey(props.defaultActiveKey || Object.keys(props.tabs)[0]);
|
|
24
|
+
setItems(Object.keys(props.tabs).map(function (key) {
|
|
25
|
+
var t = props.tabs[key];
|
|
26
|
+
if (!t.pane) {
|
|
27
|
+
return {
|
|
28
|
+
key: key,
|
|
29
|
+
label: t.title,
|
|
30
|
+
children: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ProSkeleton, {
|
|
31
|
+
list: 2
|
|
32
|
+
}))
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
var Component = /*#__PURE__*/lazy(function () {
|
|
36
|
+
var _t$pane;
|
|
37
|
+
return container.get('Tab.Pane.' + upperFirst((_t$pane = t.pane) === null || _t$pane === void 0 ? void 0 : _t$pane.component));
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
key: key,
|
|
41
|
+
label: t.title,
|
|
42
|
+
children: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Suspense, {
|
|
43
|
+
fallback: /*#__PURE__*/React.createElement(ProSkeleton, {
|
|
44
|
+
list: 2
|
|
45
|
+
})
|
|
46
|
+
}, /*#__PURE__*/React.createElement(Component, t.pane.props)))
|
|
47
|
+
};
|
|
48
|
+
}));
|
|
49
|
+
}, []);
|
|
50
|
+
var onChange = function onChange(key) {
|
|
51
|
+
setActiveKey(key);
|
|
52
|
+
var tab = props.tabs[key];
|
|
53
|
+
if (tab.url) {
|
|
54
|
+
routerNavigateTo(tab.url);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tabs, {
|
|
58
|
+
items: items,
|
|
59
|
+
onChange: onChange,
|
|
60
|
+
activeKey: activeKey
|
|
61
|
+
}));
|
|
62
|
+
}
|
package/dist/env.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
package/dist/global.d.ts
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import container from "./lib/container";
|
|
2
|
+
import Layout from "./components/Layout";
|
|
3
|
+
import http from "./lib/http";
|
|
4
|
+
export { container, Layout, http, };
|
|
5
|
+
export declare const Form: Promise<typeof import("./components/Form")>;
|
|
6
|
+
export declare const Table: Promise<typeof import("./components/Table")>;
|
|
7
|
+
export declare const Tabs: Promise<typeof import("./components/Tabs")>;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import container from "./lib/container";
|
|
2
|
+
import Layout from "./components/Layout";
|
|
3
|
+
import http from "./lib/http";
|
|
4
|
+
export { container, Layout, http };
|
|
5
|
+
export var Form = import("./components/Form");
|
|
6
|
+
export var Table = import("./components/Table");
|
|
7
|
+
export var Tabs = import("./components/Tabs");
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { routerNavigateTo } from "./helpers";
|
|
2
|
+
declare const container: {
|
|
3
|
+
register(name: string, componentLoader: any): void;
|
|
4
|
+
get(name: string): any;
|
|
5
|
+
check(name: string): boolean;
|
|
6
|
+
schemaHandler: Record<string, (schema: any) => import("@ant-design/pro-utils").ProSchema | import("@ant-design/pro-table").ProColumnType>;
|
|
7
|
+
routerNavigateTo: typeof routerNavigateTo;
|
|
8
|
+
};
|
|
9
|
+
export default container;
|
|
@@ -0,0 +1,93 @@
|
|
|
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 _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; }
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
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."); }
|
|
5
|
+
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); }
|
|
6
|
+
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; }
|
|
7
|
+
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; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
+
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); } }
|
|
10
|
+
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); }); }; }
|
|
11
|
+
import { schemaHandler } from "./schemaHandler";
|
|
12
|
+
import { routerNavigateTo } from "./helpers";
|
|
13
|
+
import column from "../components/Column";
|
|
14
|
+
import columnReadonly from "../components/Column/Readonly";
|
|
15
|
+
import columnReadonlyAction from "../components/Column/Readonly/Action/index";
|
|
16
|
+
import tableAction from "../components/Table/Action";
|
|
17
|
+
import formAction from "../components/Form/Action";
|
|
18
|
+
var components = {};
|
|
19
|
+
var container = {
|
|
20
|
+
register: function register(name, componentLoader) {
|
|
21
|
+
if (this.check(name)) {
|
|
22
|
+
throw new Error("Component ".concat(name, " already registered"));
|
|
23
|
+
}
|
|
24
|
+
components[name] = componentLoader;
|
|
25
|
+
},
|
|
26
|
+
get: function get(name) {
|
|
27
|
+
if (!this.check(name)) {
|
|
28
|
+
throw new Error("Component ".concat(name, " is not registered"));
|
|
29
|
+
}
|
|
30
|
+
return components[name];
|
|
31
|
+
},
|
|
32
|
+
check: function check(name) {
|
|
33
|
+
return !!components[name];
|
|
34
|
+
},
|
|
35
|
+
schemaHandler: schemaHandler,
|
|
36
|
+
routerNavigateTo: routerNavigateTo
|
|
37
|
+
};
|
|
38
|
+
function autoRegister(_x, _x2) {
|
|
39
|
+
return _autoRegister.apply(this, arguments);
|
|
40
|
+
} // -------- 通用 -----------
|
|
41
|
+
function _autoRegister() {
|
|
42
|
+
_autoRegister = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(prefix, components) {
|
|
43
|
+
var _i, _Object$entries, _key$split$pop, _Object$entries$_i, key, value, name;
|
|
44
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
45
|
+
while (1) switch (_context.prev = _context.next) {
|
|
46
|
+
case 0:
|
|
47
|
+
for (_i = 0, _Object$entries = Object.entries(components); _i < _Object$entries.length; _i++) {
|
|
48
|
+
_Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), key = _Object$entries$_i[0], value = _Object$entries$_i[1];
|
|
49
|
+
name = (_key$split$pop = key.split('/').pop()) === null || _key$split$pop === void 0 ? void 0 : _key$split$pop.split('.').shift();
|
|
50
|
+
container.register(prefix + name, value);
|
|
51
|
+
}
|
|
52
|
+
case 1:
|
|
53
|
+
case "end":
|
|
54
|
+
return _context.stop();
|
|
55
|
+
}
|
|
56
|
+
}, _callee);
|
|
57
|
+
}));
|
|
58
|
+
return _autoRegister.apply(this, arguments);
|
|
59
|
+
}
|
|
60
|
+
{
|
|
61
|
+
autoRegister('Column.', column);
|
|
62
|
+
|
|
63
|
+
// readonly render
|
|
64
|
+
autoRegister('Column.Readonly.', columnReadonly);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// -------- 弹窗 -----------
|
|
68
|
+
{
|
|
69
|
+
container.register('Modal.Table', import("../components/Table"));
|
|
70
|
+
container.register('Modal.Form', import("../components/Form"));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// -------- Tabs -----------
|
|
74
|
+
{
|
|
75
|
+
container.register('Tab.Pane.Table', import("../components/Table"));
|
|
76
|
+
container.register('Tab.Pane.Form', import("../components/Form"));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// -------- 表格 -----------
|
|
80
|
+
{
|
|
81
|
+
// column.action render
|
|
82
|
+
autoRegister('Column.Readonly.Action.', columnReadonlyAction);
|
|
83
|
+
|
|
84
|
+
// action render
|
|
85
|
+
autoRegister('Table.Action.', tableAction);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// -------- 表单 -----------
|
|
89
|
+
{
|
|
90
|
+
// formAction render
|
|
91
|
+
autoRegister('Form.Action.', formAction);
|
|
92
|
+
}
|
|
93
|
+
export default container;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MessageInstance } from "antd/es/message/interface";
|
|
2
|
+
import { ModalStaticFunctions } from "antd/es/modal/confirm";
|
|
3
|
+
import { NotificationInstance } from "antd/es/notification/interface";
|
|
4
|
+
declare const global: {
|
|
5
|
+
message: MessageInstance;
|
|
6
|
+
modal: Omit<ModalStaticFunctions, 'warn'>;
|
|
7
|
+
notification: NotificationInstance;
|
|
8
|
+
};
|
|
9
|
+
export default global;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { VisitOptions } from "@inertiajs/core/types/types";
|
|
2
|
+
import { Rules } from "@rc-component/async-validator/lib/interface";
|
|
3
|
+
export declare function replaceUrl(url: string, params: any): string;
|
|
4
|
+
export declare function replaceParams(params: Record<string, any>, data: Record<string, any>): Record<string, any>;
|
|
5
|
+
export declare function routerNavigateTo(url: string, config?: VisitOptions): void;
|
|
6
|
+
export declare function handleRules(dataRules: Rules, data: any): Promise<unknown>;
|
|
7
|
+
export declare function asyncFilter(arr: any[], predicate: (item: any) => PromiseLike<any>): Promise<any[]>;
|
|
8
|
+
export declare function filterObjectKeys(obj: Record<string, any>, keysToKeep: string[]): Record<string, any>;
|
|
9
|
+
export declare function createScript(url: string): Promise<unknown>;
|
|
10
|
+
export declare function modalShow(options: ModalOptions): Promise<{
|
|
11
|
+
destroy: () => void;
|
|
12
|
+
update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
|
|
13
|
+
}>;
|
|
14
|
+
export declare function upperFirst(str: string): string;
|