@quansitech/antd-admin 1.1.1 → 1.1.3
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/Blank.d.ts +6 -0
- package/dist/components/Layout/Blank.js +9 -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 +68 -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 +13 -6
- 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 -251
- 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 -149
- 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,183 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
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); } }
|
|
3
|
+
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); }); }; }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
|
+
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); }
|
|
9
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
10
|
+
import { router } from "@inertiajs/react";
|
|
11
|
+
import Schema from '@rc-component/async-validator';
|
|
12
|
+
import http from "./http";
|
|
13
|
+
import container from "./container";
|
|
14
|
+
import React, { lazy } from "react";
|
|
15
|
+
import global from "./global";
|
|
16
|
+
import { ModalContext } from "../components/ModalContext";
|
|
17
|
+
export function replaceUrl(url, params) {
|
|
18
|
+
return url.replace(/__([\w]+)__/g, function (match, key) {
|
|
19
|
+
return params[key] || match;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export function replaceParams(params, data) {
|
|
23
|
+
if (_typeof(params) !== 'object') {
|
|
24
|
+
return params;
|
|
25
|
+
}
|
|
26
|
+
var res = Object.assign({}, params);
|
|
27
|
+
Object.keys(params).forEach(function (key) {
|
|
28
|
+
if (typeof params[key] === 'string') {
|
|
29
|
+
var m = params[key].match(/^__(\w+)__$/);
|
|
30
|
+
if (m) {
|
|
31
|
+
res[key] = data[m[1]];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return res;
|
|
36
|
+
}
|
|
37
|
+
export function routerNavigateTo(url, config) {
|
|
38
|
+
return router.visit(url, _objectSpread({}, config));
|
|
39
|
+
}
|
|
40
|
+
export function handleRules(dataRules, data) {
|
|
41
|
+
return new Promise(function (resolve) {
|
|
42
|
+
var validator = new Schema(dataRules);
|
|
43
|
+
validator.validate(data, function (errors, fields) {
|
|
44
|
+
if (errors) {
|
|
45
|
+
resolve(false);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
resolve(true);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export function asyncFilter(_x, _x2) {
|
|
53
|
+
return _asyncFilter.apply(this, arguments);
|
|
54
|
+
}
|
|
55
|
+
function _asyncFilter() {
|
|
56
|
+
_asyncFilter = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(arr, predicate) {
|
|
57
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
58
|
+
while (1) switch (_context.prev = _context.next) {
|
|
59
|
+
case 0:
|
|
60
|
+
_context.next = 2;
|
|
61
|
+
return Promise.all(arr.map(predicate)).then(function (results) {
|
|
62
|
+
return arr.filter(function (_v, index) {
|
|
63
|
+
return results[index];
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
case 2:
|
|
67
|
+
return _context.abrupt("return", _context.sent);
|
|
68
|
+
case 3:
|
|
69
|
+
case "end":
|
|
70
|
+
return _context.stop();
|
|
71
|
+
}
|
|
72
|
+
}, _callee);
|
|
73
|
+
}));
|
|
74
|
+
return _asyncFilter.apply(this, arguments);
|
|
75
|
+
}
|
|
76
|
+
export function filterObjectKeys(obj, keysToKeep) {
|
|
77
|
+
if (_typeof(obj) !== 'object' || !obj) {
|
|
78
|
+
return obj;
|
|
79
|
+
}
|
|
80
|
+
return Object.keys(obj).filter(function (key) {
|
|
81
|
+
return !keysToKeep.includes(key);
|
|
82
|
+
}).reduce(function (newObj, key) {
|
|
83
|
+
newObj[key] = obj[key];
|
|
84
|
+
return newObj;
|
|
85
|
+
}, {});
|
|
86
|
+
}
|
|
87
|
+
export function createScript(url) {
|
|
88
|
+
var scriptTags = window.document.querySelectorAll('script');
|
|
89
|
+
var len = scriptTags.length;
|
|
90
|
+
var i = 0;
|
|
91
|
+
var _url = window.location.origin + url;
|
|
92
|
+
return new Promise(function (resolve, reject) {
|
|
93
|
+
for (i = 0; i < len; i++) {
|
|
94
|
+
var src = scriptTags[i].src;
|
|
95
|
+
if (src && src === _url) {
|
|
96
|
+
var _scriptTags$i$parentE;
|
|
97
|
+
(_scriptTags$i$parentE = scriptTags[i].parentElement) === null || _scriptTags$i$parentE === void 0 || _scriptTags$i$parentE.removeChild(scriptTags[i]);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
var node = document.createElement('script');
|
|
101
|
+
node.src = url;
|
|
102
|
+
node.onload = resolve;
|
|
103
|
+
document.body.appendChild(node);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
export function modalShow(_x3) {
|
|
107
|
+
return _modalShow.apply(this, arguments);
|
|
108
|
+
}
|
|
109
|
+
function _modalShow() {
|
|
110
|
+
_modalShow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
|
|
111
|
+
var props, res, Component, _afterClose, modal;
|
|
112
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
113
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
114
|
+
case 0:
|
|
115
|
+
props = options.content.props;
|
|
116
|
+
if (!options.content.url) {
|
|
117
|
+
_context2.next = 8;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
_context2.next = 4;
|
|
121
|
+
return http({
|
|
122
|
+
method: 'get',
|
|
123
|
+
url: options.content.url,
|
|
124
|
+
headers: {
|
|
125
|
+
'X-Modal': '1'
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
case 4:
|
|
129
|
+
res = _context2.sent;
|
|
130
|
+
if (!(typeof res.data === 'string')) {
|
|
131
|
+
_context2.next = 7;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
throw new Error('modal response is not vail');
|
|
135
|
+
case 7:
|
|
136
|
+
props = res.data;
|
|
137
|
+
case 8:
|
|
138
|
+
if (props) {
|
|
139
|
+
_context2.next = 10;
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
throw new Error('modal props is empty');
|
|
143
|
+
case 10:
|
|
144
|
+
Component = /*#__PURE__*/lazy(function () {
|
|
145
|
+
return container.get('Modal.' + upperFirst(props.type));
|
|
146
|
+
});
|
|
147
|
+
_afterClose = function afterClose() {};
|
|
148
|
+
modal = global.modal.info(_objectSpread(_objectSpread({}, options), {}, {
|
|
149
|
+
closable: true,
|
|
150
|
+
icon: null,
|
|
151
|
+
destroyOnClose: true,
|
|
152
|
+
footer: null,
|
|
153
|
+
content: /*#__PURE__*/React.createElement(ModalContext.Provider, {
|
|
154
|
+
value: {
|
|
155
|
+
inModal: true,
|
|
156
|
+
closeModal: function closeModal() {
|
|
157
|
+
modal === null || modal === void 0 || modal.destroy();
|
|
158
|
+
},
|
|
159
|
+
contexts: options.contexts,
|
|
160
|
+
setAfterClose: function setAfterClose(callback) {
|
|
161
|
+
_afterClose = callback;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}, /*#__PURE__*/React.createElement(Component, props)),
|
|
165
|
+
afterClose: function afterClose() {
|
|
166
|
+
_afterClose && _afterClose();
|
|
167
|
+
}
|
|
168
|
+
}));
|
|
169
|
+
return _context2.abrupt("return", {
|
|
170
|
+
destroy: modal.destroy,
|
|
171
|
+
update: modal.update
|
|
172
|
+
});
|
|
173
|
+
case 14:
|
|
174
|
+
case "end":
|
|
175
|
+
return _context2.stop();
|
|
176
|
+
}
|
|
177
|
+
}, _callee2);
|
|
178
|
+
}));
|
|
179
|
+
return _modalShow.apply(this, arguments);
|
|
180
|
+
}
|
|
181
|
+
export function upperFirst(str) {
|
|
182
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
183
|
+
}
|
package/dist/lib/http.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import axios, { AxiosError } from "axios";
|
|
2
|
+
import { routerNavigateTo } from "./helpers";
|
|
3
|
+
import global from "./global";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* fetchOptions.noHandle 成功时不处理 url 和 info
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
var http = axios.create({});
|
|
10
|
+
http.interceptors.request.use(function (config) {
|
|
11
|
+
config.headers['Accept'] = 'application/json';
|
|
12
|
+
// 设置异步模式
|
|
13
|
+
config.headers['X-Requested-With'] = 'XMLHttpRequest';
|
|
14
|
+
return config;
|
|
15
|
+
});
|
|
16
|
+
http.interceptors.response.use(function (response) {
|
|
17
|
+
var _response$config$fetc;
|
|
18
|
+
var checkInfo = function checkInfo(data) {
|
|
19
|
+
if (!(data !== null && data !== void 0 && data.info)) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
switch (data.status) {
|
|
23
|
+
case 0:
|
|
24
|
+
global.notification.warning({
|
|
25
|
+
message: data.info
|
|
26
|
+
});
|
|
27
|
+
break;
|
|
28
|
+
default:
|
|
29
|
+
global.notification.success({
|
|
30
|
+
message: data.info
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
};
|
|
35
|
+
if ((_response$config$fetc = response.config.fetchOptions) !== null && _response$config$fetc !== void 0 && _response$config$fetc.noHandle) {
|
|
36
|
+
return response;
|
|
37
|
+
}
|
|
38
|
+
var showInfo = checkInfo(response.data);
|
|
39
|
+
if (response.data.url) {
|
|
40
|
+
setTimeout(function () {
|
|
41
|
+
routerNavigateTo(response.data.url);
|
|
42
|
+
}, showInfo ? 2000 : 0);
|
|
43
|
+
}
|
|
44
|
+
if (response.data.status == 0) {
|
|
45
|
+
return Promise.reject(response.data.info);
|
|
46
|
+
}
|
|
47
|
+
return response;
|
|
48
|
+
}, function (error) {
|
|
49
|
+
if (error instanceof AxiosError) {
|
|
50
|
+
var _error$response, _error$response3;
|
|
51
|
+
if ((_error$response = error.response) !== null && _error$response !== void 0 && _error$response.headers['content-type'].includes('application/json')) {
|
|
52
|
+
var _error$response2;
|
|
53
|
+
global.notification.error({
|
|
54
|
+
message: ((_error$response2 = error.response) === null || _error$response2 === void 0 || (_error$response2 = _error$response2.data) === null || _error$response2 === void 0 ? void 0 : _error$response2.info) || '请求错误,请稍候重试'
|
|
55
|
+
});
|
|
56
|
+
} else if ((_error$response3 = error.response) !== null && _error$response3 !== void 0 && _error$response3.headers['content-type'].includes('text/html')) {
|
|
57
|
+
var _error$response4, _doc$querySelector;
|
|
58
|
+
var parser = new DOMParser();
|
|
59
|
+
var doc = parser.parseFromString((_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : _error$response4.data, 'text/html');
|
|
60
|
+
var title = (_doc$querySelector = doc.querySelector('title')) === null || _doc$querySelector === void 0 ? void 0 : _doc$querySelector.textContent;
|
|
61
|
+
global.notification.error({
|
|
62
|
+
message: title || '请求错误,请稍候重试'
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
global.notification.error({
|
|
67
|
+
message: '请求错误,请稍候重试'
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return Promise.reject(error);
|
|
71
|
+
});
|
|
72
|
+
export default http;
|
|
@@ -0,0 +1,133 @@
|
|
|
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 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); } }
|
|
4
|
+
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); }); }; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
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; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
+
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); }
|
|
10
|
+
import http from "./http";
|
|
11
|
+
var uploadValidator = function uploadValidator(_, value) {
|
|
12
|
+
return new Promise(function (resolve, reject) {
|
|
13
|
+
if (!value) {
|
|
14
|
+
resolve(true);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
for (var i = 0; i < value.length; i++) {
|
|
18
|
+
switch (value[i].status) {
|
|
19
|
+
case 'error':
|
|
20
|
+
reject('存在上传失败文件,请删除失败文件后重新上传');
|
|
21
|
+
return;
|
|
22
|
+
case 'uploading':
|
|
23
|
+
reject('文件上传中,请稍后');
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
resolve(true);
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var uploadTransform = function uploadTransform(value, _name) {
|
|
31
|
+
if (value instanceof Array) {
|
|
32
|
+
return value.filter(function (file) {
|
|
33
|
+
return file.status === 'done';
|
|
34
|
+
}).map(function (file) {
|
|
35
|
+
var _file$response;
|
|
36
|
+
return (_file$response = file.response) === null || _file$response === void 0 ? void 0 : _file$response.file_id;
|
|
37
|
+
}).join(',');
|
|
38
|
+
}
|
|
39
|
+
return value;
|
|
40
|
+
};
|
|
41
|
+
export var commonHandler = function commonHandler(schema) {
|
|
42
|
+
if (schema.valueEnum) {
|
|
43
|
+
schema.valueEnum = new Map(schema.valueEnum);
|
|
44
|
+
}
|
|
45
|
+
return schema;
|
|
46
|
+
};
|
|
47
|
+
export var schemaHandler = {
|
|
48
|
+
dateTimeRange: function dateTimeRange(schema) {
|
|
49
|
+
if (schema.search !== false) {
|
|
50
|
+
return _objectSpread(_objectSpread({}, schema), {}, {
|
|
51
|
+
search: {
|
|
52
|
+
transform: function transform(value) {
|
|
53
|
+
if (value) {
|
|
54
|
+
return value.join(' - ');
|
|
55
|
+
}
|
|
56
|
+
return value;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return _objectSpread({}, schema);
|
|
62
|
+
},
|
|
63
|
+
dateRange: function dateRange(schema) {
|
|
64
|
+
if (schema.search !== false) {
|
|
65
|
+
return _objectSpread(_objectSpread({}, schema), {}, {
|
|
66
|
+
search: {
|
|
67
|
+
transform: function transform(value) {
|
|
68
|
+
if (value) {
|
|
69
|
+
return value.join(' - ');
|
|
70
|
+
}
|
|
71
|
+
return value;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return _objectSpread({}, schema);
|
|
77
|
+
},
|
|
78
|
+
// 上传
|
|
79
|
+
image: function image(schema) {
|
|
80
|
+
schema.formItemProps.rules.push({
|
|
81
|
+
validator: uploadValidator
|
|
82
|
+
});
|
|
83
|
+
return _objectSpread(_objectSpread({}, schema), {}, {
|
|
84
|
+
transform: uploadTransform
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
file: function file(schema) {
|
|
88
|
+
schema.formItemProps.rules.push({
|
|
89
|
+
validator: uploadValidator
|
|
90
|
+
});
|
|
91
|
+
return _objectSpread(_objectSpread({}, schema), {}, {
|
|
92
|
+
transform: uploadTransform
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
select: function select(schema) {
|
|
96
|
+
var _schema$fieldProps;
|
|
97
|
+
schema.searchOnChange = true;
|
|
98
|
+
if ((_schema$fieldProps = schema.fieldProps) !== null && _schema$fieldProps !== void 0 && _schema$fieldProps.searchUrl) {
|
|
99
|
+
return _objectSpread(_objectSpread({}, schema), {}, {
|
|
100
|
+
request: function () {
|
|
101
|
+
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
|
102
|
+
var res;
|
|
103
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
104
|
+
while (1) switch (_context.prev = _context.next) {
|
|
105
|
+
case 0:
|
|
106
|
+
_context.next = 2;
|
|
107
|
+
return http(schema.fieldProps.searchUrl, {
|
|
108
|
+
params: params
|
|
109
|
+
});
|
|
110
|
+
case 2:
|
|
111
|
+
res = _context.sent;
|
|
112
|
+
return _context.abrupt("return", res.data.map(function (item) {
|
|
113
|
+
return {
|
|
114
|
+
label: item.label || item.value,
|
|
115
|
+
value: item.value
|
|
116
|
+
};
|
|
117
|
+
}));
|
|
118
|
+
case 4:
|
|
119
|
+
case "end":
|
|
120
|
+
return _context.stop();
|
|
121
|
+
}
|
|
122
|
+
}, _callee);
|
|
123
|
+
}));
|
|
124
|
+
function request(_x) {
|
|
125
|
+
return _request.apply(this, arguments);
|
|
126
|
+
}
|
|
127
|
+
return request;
|
|
128
|
+
}()
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return schema;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { UploadRequestOption } from "rc-upload/lib/interface";
|
|
2
|
+
import { GetProp, UploadFile, UploadProps } from "antd";
|
|
3
|
+
type QsUploadFile = UploadFile & {
|
|
4
|
+
hash_id?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function customRequest(options: UploadRequestOption & {
|
|
7
|
+
file: QsUploadFile;
|
|
8
|
+
}): Promise<void>;
|
|
9
|
+
export type FileType = Parameters<GetProp<UploadProps, 'beforeUpload'>>[0];
|
|
10
|
+
export declare function getBase64(file: FileType): Promise<string>;
|
|
11
|
+
/**
|
|
12
|
+
* 计算文件MD5
|
|
13
|
+
* https://github.com/quansitech/file-md5-wasm/blob/master/js/calc_file_hash.js
|
|
14
|
+
* @param file
|
|
15
|
+
*/
|
|
16
|
+
export declare function calc_file_hash(file: File): Promise<string>;
|
|
17
|
+
export declare function beforeUpload(file: File & {
|
|
18
|
+
hash_id?: string;
|
|
19
|
+
}, fileList: UploadFile[], allFileList: UploadFile[]): Promise<string>;
|
|
20
|
+
export {};
|