@nokecy/qc-ui 1.0.58 → 1.0.60
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/cjs/ag-grid-plus/ag-gridPlus.js +2 -4
- package/dist/cjs/array-table/index.js +194 -7
- package/dist/cjs/deleteConfirm/index.d.ts +31 -0
- package/dist/cjs/deleteConfirm/index.js +64 -0
- package/dist/cjs/editable/index.js +104 -21
- package/dist/cjs/fullScreenAlert/index.d.ts +25 -4
- package/dist/cjs/fullScreenAlert/index.js +50 -17
- package/dist/cjs/generatedListPage/ConfigurableToolbar.d.ts +35 -0
- package/dist/cjs/generatedListPage/ConfigurableToolbar.js +179 -0
- package/dist/cjs/generatedListPage/GeneratedListPage.d.ts +8 -0
- package/dist/cjs/generatedListPage/GeneratedListPage.js +545 -0
- package/dist/cjs/generatedListPage/OptionsColumn.d.ts +9 -0
- package/dist/cjs/generatedListPage/OptionsColumn.js +135 -0
- package/dist/cjs/generatedListPage/PerformanceMonitor.d.ts +55 -0
- package/dist/cjs/generatedListPage/PerformanceMonitor.js +277 -0
- package/dist/cjs/generatedListPage/RequestManager.d.ts +97 -0
- package/dist/cjs/generatedListPage/RequestManager.js +404 -0
- package/dist/cjs/generatedListPage/_utils/AccessWrapper.d.ts +16 -0
- package/dist/cjs/generatedListPage/_utils/AccessWrapper.js +26 -0
- package/dist/cjs/generatedListPage/_utils/defaultHandlers.d.ts +22 -0
- package/dist/cjs/generatedListPage/_utils/defaultHandlers.js +127 -0
- package/dist/cjs/generatedListPage/index.d.ts +20 -0
- package/dist/cjs/generatedListPage/index.js +92 -0
- package/dist/cjs/generatedListPage/types.d.ts +221 -0
- package/dist/cjs/generatedListPage/types.js +5 -0
- package/dist/cjs/generatedListPage/usePermissionCheck.d.ts +66 -0
- package/dist/cjs/generatedListPage/usePermissionCheck.js +150 -0
- package/dist/cjs/generatedListPage/useRequestManager.d.ts +35 -0
- package/dist/cjs/generatedListPage/useRequestManager.js +121 -0
- package/dist/cjs/importModal/index.d.ts +21 -3
- package/dist/cjs/importModal/index.js +30 -10
- package/dist/cjs/index.d.ts +9 -1
- package/dist/cjs/index.js +21 -0
- package/dist/cjs/standardFormDialog/FormValidation.d.ts +150 -0
- package/dist/cjs/standardFormDialog/FormValidation.js +229 -0
- package/dist/cjs/standardFormDialog/PortalManager.d.ts +94 -0
- package/dist/cjs/standardFormDialog/PortalManager.js +259 -0
- package/dist/cjs/standardFormDialog/StandardFormDialog.d.ts +10 -0
- package/dist/cjs/standardFormDialog/StandardFormDialog.js +516 -0
- package/dist/cjs/standardFormDialog/index.d.ts +7 -0
- package/dist/cjs/standardFormDialog/index.js +83 -0
- package/dist/cjs/standardFormDialog/types.d.ts +107 -0
- package/dist/cjs/standardFormDialog/types.js +5 -0
- package/dist/cjs/standardFormDialog/useStandardFormSchema.d.ts +68 -0
- package/dist/cjs/standardFormDialog/useStandardFormSchema.js +197 -0
- package/dist/cjs/standardFormDialog/withStandardForm.d.ts +193 -0
- package/dist/cjs/standardFormDialog/withStandardForm.js +388 -0
- package/dist/esm/ag-grid-plus/ag-gridPlus.js +2 -4
- package/dist/esm/array-table/index.js +194 -7
- package/dist/esm/deleteConfirm/index.d.ts +31 -0
- package/dist/esm/deleteConfirm/index.js +57 -0
- package/dist/esm/editable/index.js +105 -22
- package/dist/esm/fullScreenAlert/index.d.ts +25 -4
- package/dist/esm/fullScreenAlert/index.js +50 -18
- package/dist/esm/generatedListPage/ConfigurableToolbar.d.ts +35 -0
- package/dist/esm/generatedListPage/ConfigurableToolbar.js +171 -0
- package/dist/esm/generatedListPage/GeneratedListPage.d.ts +8 -0
- package/dist/esm/generatedListPage/GeneratedListPage.js +535 -0
- package/dist/esm/generatedListPage/OptionsColumn.d.ts +9 -0
- package/dist/esm/generatedListPage/OptionsColumn.js +127 -0
- package/dist/esm/generatedListPage/PerformanceMonitor.d.ts +55 -0
- package/dist/esm/generatedListPage/PerformanceMonitor.js +272 -0
- package/dist/esm/generatedListPage/RequestManager.d.ts +97 -0
- package/dist/esm/generatedListPage/RequestManager.js +398 -0
- package/dist/esm/generatedListPage/_utils/AccessWrapper.d.ts +16 -0
- package/dist/esm/generatedListPage/_utils/AccessWrapper.js +20 -0
- package/dist/esm/generatedListPage/_utils/defaultHandlers.d.ts +22 -0
- package/dist/esm/generatedListPage/_utils/defaultHandlers.js +122 -0
- package/dist/esm/generatedListPage/index.d.ts +20 -0
- package/dist/esm/generatedListPage/index.js +26 -0
- package/dist/esm/generatedListPage/types.d.ts +221 -0
- package/dist/esm/generatedListPage/types.js +1 -0
- package/dist/esm/generatedListPage/usePermissionCheck.d.ts +66 -0
- package/dist/esm/generatedListPage/usePermissionCheck.js +145 -0
- package/dist/esm/generatedListPage/useRequestManager.d.ts +35 -0
- package/dist/esm/generatedListPage/useRequestManager.js +116 -0
- package/dist/esm/importModal/index.d.ts +21 -3
- package/dist/esm/importModal/index.js +29 -10
- package/dist/esm/index.d.ts +9 -1
- package/dist/esm/index.js +6 -1
- package/dist/esm/standardFormDialog/FormValidation.d.ts +150 -0
- package/dist/esm/standardFormDialog/FormValidation.js +223 -0
- package/dist/esm/standardFormDialog/PortalManager.d.ts +94 -0
- package/dist/esm/standardFormDialog/PortalManager.js +253 -0
- package/dist/esm/standardFormDialog/StandardFormDialog.d.ts +10 -0
- package/dist/esm/standardFormDialog/StandardFormDialog.js +508 -0
- package/dist/esm/standardFormDialog/index.d.ts +7 -0
- package/dist/esm/standardFormDialog/index.js +6 -0
- package/dist/esm/standardFormDialog/types.d.ts +107 -0
- package/dist/esm/standardFormDialog/types.js +1 -0
- package/dist/esm/standardFormDialog/useStandardFormSchema.d.ts +68 -0
- package/dist/esm/standardFormDialog/useStandardFormSchema.js +191 -0
- package/dist/esm/standardFormDialog/withStandardForm.d.ts +193 -0
- package/dist/esm/standardFormDialog/withStandardForm.js +382 -0
- package/dist/umd/qc-ui.min.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
exports.useRequestManager = useRequestManager;
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _RequestManager = require("./RequestManager");
|
|
11
|
+
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; }
|
|
12
|
+
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); } }
|
|
13
|
+
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); }); }; } /**
|
|
14
|
+
* useRequestManager Hook
|
|
15
|
+
*
|
|
16
|
+
* 为组件提供请求管理功能的 React Hook
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* 使用请求管理器的 Hook
|
|
20
|
+
*/
|
|
21
|
+
function useRequestManager(options) {
|
|
22
|
+
var managerRef = (0, _react.useRef)();
|
|
23
|
+
|
|
24
|
+
// 初始化请求管理器
|
|
25
|
+
if (!managerRef.current) {
|
|
26
|
+
managerRef.current = new _RequestManager.RequestManager(options);
|
|
27
|
+
}
|
|
28
|
+
var manager = managerRef.current;
|
|
29
|
+
|
|
30
|
+
// 组件卸载时清理
|
|
31
|
+
(0, _react.useEffect)(function () {
|
|
32
|
+
return function () {
|
|
33
|
+
manager.cleanup();
|
|
34
|
+
};
|
|
35
|
+
}, [manager]);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 执行请求
|
|
39
|
+
*/
|
|
40
|
+
var request = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
41
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params, requestFn) {
|
|
42
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
43
|
+
while (1) switch (_context.prev = _context.next) {
|
|
44
|
+
case 0:
|
|
45
|
+
return _context.abrupt("return", manager.request(params, requestFn));
|
|
46
|
+
case 1:
|
|
47
|
+
case "end":
|
|
48
|
+
return _context.stop();
|
|
49
|
+
}
|
|
50
|
+
}, _callee);
|
|
51
|
+
}));
|
|
52
|
+
return function (_x, _x2) {
|
|
53
|
+
return _ref.apply(this, arguments);
|
|
54
|
+
};
|
|
55
|
+
}(), [manager]);
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 防抖请求
|
|
59
|
+
*/
|
|
60
|
+
var debouncedRequest = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
61
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(key, params, requestFn) {
|
|
62
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
63
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
64
|
+
case 0:
|
|
65
|
+
return _context2.abrupt("return", manager.debouncedRequest(key, params, requestFn));
|
|
66
|
+
case 1:
|
|
67
|
+
case "end":
|
|
68
|
+
return _context2.stop();
|
|
69
|
+
}
|
|
70
|
+
}, _callee2);
|
|
71
|
+
}));
|
|
72
|
+
return function (_x3, _x4, _x5) {
|
|
73
|
+
return _ref2.apply(this, arguments);
|
|
74
|
+
};
|
|
75
|
+
}(), [manager]);
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* 取消请求
|
|
79
|
+
*/
|
|
80
|
+
var cancelRequest = (0, _react.useCallback)(function (params) {
|
|
81
|
+
manager.cancelRequest(params);
|
|
82
|
+
}, [manager]);
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* 取消所有请求
|
|
86
|
+
*/
|
|
87
|
+
var cancelAllRequests = (0, _react.useCallback)(function () {
|
|
88
|
+
manager.cancelAllPendingRequests();
|
|
89
|
+
}, [manager]);
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* 清理缓存
|
|
93
|
+
*/
|
|
94
|
+
var clearCache = (0, _react.useCallback)(function () {
|
|
95
|
+
manager.clearCache();
|
|
96
|
+
}, [manager]);
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* 清理过期缓存
|
|
100
|
+
*/
|
|
101
|
+
var cleanupCache = (0, _react.useCallback)(function () {
|
|
102
|
+
manager.cleanupExpiredCache();
|
|
103
|
+
}, [manager]);
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* 获取统计信息
|
|
107
|
+
*/
|
|
108
|
+
var getStats = (0, _react.useCallback)(function () {
|
|
109
|
+
return manager.getStats();
|
|
110
|
+
}, [manager]);
|
|
111
|
+
return {
|
|
112
|
+
request: request,
|
|
113
|
+
debouncedRequest: debouncedRequest,
|
|
114
|
+
cancelRequest: cancelRequest,
|
|
115
|
+
cancelAllRequests: cancelAllRequests,
|
|
116
|
+
clearCache: clearCache,
|
|
117
|
+
cleanupCache: cleanupCache,
|
|
118
|
+
getStats: getStats
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
var _default = exports.default = useRequestManager;
|
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
export interface ImportModalProps {
|
|
3
|
+
/** 导入成功后的回调 */
|
|
4
|
+
onAfterSubmit?: (response?: any) => void;
|
|
5
|
+
/** 模块标题(可选,默认为"数据") */
|
|
6
|
+
title?: string;
|
|
7
|
+
/** 模板下载地址(可选,不提供则不显示模板下载链接) */
|
|
8
|
+
downUrl?: string;
|
|
9
|
+
/** 上传地址(完整URL或相对路径) */
|
|
10
|
+
uploadUrl: string;
|
|
11
|
+
/** 按钮文字 */
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
/** 实体ID(可选,用于特定记录的导入) */
|
|
14
|
+
id?: string;
|
|
15
|
+
/** 下载Blob函数(可选,不提供则使用默认实现) */
|
|
16
|
+
downloadBlob?: (url: string, filename: string) => void;
|
|
17
|
+
/** 服务器地址函数(可选,不提供则直接使用uploadUrl) */
|
|
18
|
+
serverUrl?: () => string;
|
|
19
|
+
/** 按钮属性 */
|
|
20
|
+
buttonProps?: any;
|
|
21
|
+
}
|
|
2
22
|
/**
|
|
3
23
|
* 通用导入弹出框
|
|
4
|
-
* @param props
|
|
5
|
-
* @returns
|
|
6
24
|
*/
|
|
7
|
-
declare const ImportModal:
|
|
25
|
+
declare const ImportModal: React.FC<ImportModalProps>;
|
|
8
26
|
export default ImportModal;
|
|
@@ -9,53 +9,73 @@ var _icons = require("@ant-design/icons");
|
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _ahooks = require("ahooks");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
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); }
|
|
12
13
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
14
|
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."); }
|
|
14
15
|
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); }
|
|
15
16
|
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; }
|
|
16
17
|
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; } }
|
|
17
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
+
/**
|
|
20
|
+
* 默认的下载 Blob 实现
|
|
21
|
+
*/
|
|
22
|
+
var defaultDownloadBlob = function defaultDownloadBlob(url, filename) {
|
|
23
|
+
var link = document.createElement('a');
|
|
24
|
+
link.href = url;
|
|
25
|
+
link.download = filename;
|
|
26
|
+
link.click();
|
|
27
|
+
};
|
|
28
|
+
|
|
18
29
|
/**
|
|
19
30
|
* 通用导入弹出框
|
|
20
|
-
* @param props
|
|
21
|
-
* @returns
|
|
22
31
|
*/
|
|
23
32
|
var ImportModal = function ImportModal(props) {
|
|
24
33
|
var onAfterSubmit = props.onAfterSubmit,
|
|
25
|
-
title = props.title,
|
|
34
|
+
_props$title = props.title,
|
|
35
|
+
title = _props$title === void 0 ? '数据' : _props$title,
|
|
26
36
|
downUrl = props.downUrl,
|
|
27
37
|
uploadUrl = props.uploadUrl,
|
|
28
38
|
children = props.children,
|
|
29
39
|
id = props.id,
|
|
30
|
-
downloadBlob = props.downloadBlob,
|
|
31
|
-
|
|
40
|
+
_props$downloadBlob = props.downloadBlob,
|
|
41
|
+
downloadBlob = _props$downloadBlob === void 0 ? defaultDownloadBlob : _props$downloadBlob,
|
|
42
|
+
serverUrl = props.serverUrl,
|
|
43
|
+
buttonProps = props.buttonProps;
|
|
32
44
|
var _useBoolean = (0, _ahooks.useBoolean)(false),
|
|
33
45
|
_useBoolean2 = _slicedToArray(_useBoolean, 2),
|
|
34
46
|
visible = _useBoolean2[0],
|
|
35
47
|
_useBoolean2$ = _useBoolean2[1],
|
|
36
48
|
setTrue = _useBoolean2$.setTrue,
|
|
37
49
|
setFalse = _useBoolean2$.setFalse;
|
|
38
|
-
|
|
50
|
+
|
|
51
|
+
// 构建上传地址
|
|
52
|
+
var getUploadUrl = function getUploadUrl() {
|
|
53
|
+
var baseUrl = serverUrl ? serverUrl() : '';
|
|
54
|
+
var url = "".concat(baseUrl).concat(uploadUrl);
|
|
55
|
+
return id && id.length > 0 ? "".concat(url, "?id=").concat(id) : url;
|
|
56
|
+
};
|
|
57
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_antd.Button, _extends({
|
|
39
58
|
icon: /*#__PURE__*/_react.default.createElement(_icons.ImportOutlined, null),
|
|
40
59
|
onClick: setTrue
|
|
41
|
-
}, children ||
|
|
60
|
+
}, buttonProps), children || '导入'), /*#__PURE__*/_react.default.createElement(_antd.Modal, {
|
|
42
61
|
title: "\u6279\u91CF\u5BFC\u5165".concat(title),
|
|
43
62
|
open: visible,
|
|
44
63
|
onCancel: setFalse,
|
|
64
|
+
footer: null,
|
|
45
65
|
destroyOnClose: true
|
|
46
|
-
}, /*#__PURE__*/_react.default.createElement(_antd.Alert, {
|
|
66
|
+
}, downUrl && /*#__PURE__*/_react.default.createElement(_antd.Alert, {
|
|
47
67
|
message: /*#__PURE__*/_react.default.createElement("span", null, "\u70B9\u51FB\u4E0B\u8F7D", ' ', /*#__PURE__*/_react.default.createElement("a", {
|
|
48
68
|
onClick: function onClick() {
|
|
49
69
|
downloadBlob(downUrl, "\u6279\u91CF\u4E0A\u4F20".concat(title, "\u6A21\u7248.xlsx"));
|
|
50
70
|
}
|
|
51
71
|
}, "\u6A21\u7248")),
|
|
52
|
-
type:
|
|
72
|
+
type: "info"
|
|
53
73
|
}), /*#__PURE__*/_react.default.createElement(_antd.Upload.Dragger, {
|
|
54
74
|
style: {
|
|
55
75
|
marginTop: 10
|
|
56
76
|
},
|
|
57
77
|
multiple: false,
|
|
58
|
-
action:
|
|
78
|
+
action: getUploadUrl(),
|
|
59
79
|
onChange: function onChange(info) {
|
|
60
80
|
if (info.file.status === 'done') {
|
|
61
81
|
_antd.message.success('导入成功');
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -15,4 +15,12 @@ import ToolBar from "./toolBar";
|
|
|
15
15
|
import ImportModal from "./importModal";
|
|
16
16
|
import FullScreenAlert from "./fullScreenAlert";
|
|
17
17
|
import ConfirmPro from "./ConfirmPro";
|
|
18
|
-
|
|
18
|
+
import { GeneratedListPage } from "./generatedListPage";
|
|
19
|
+
import { StandardFormDialog } from "./standardFormDialog";
|
|
20
|
+
import DeleteConfirm from "./deleteConfirm";
|
|
21
|
+
export { AgGridColumn, AgGridPlus, ArrayTable, ArrayTableIndex, Card, Dashboard, DialogSelect, DraggableModal, Editable, ExtensibleGrid, flattenTreeDeep, FormDesigner, FormProContext, FormProLayout, GridPlusContext, ImportModal, QueryBuilder, ToolBar, FullScreenAlert, ConfirmPro, GeneratedListPage, StandardFormDialog, DeleteConfirm };
|
|
22
|
+
export type * from "./generatedListPage";
|
|
23
|
+
export type * from "./standardFormDialog";
|
|
24
|
+
export type * from "./deleteConfirm";
|
|
25
|
+
export type * from "./importModal";
|
|
26
|
+
export type * from "./fullScreenAlert";
|
package/dist/cjs/index.js
CHANGED
|
@@ -45,6 +45,12 @@ Object.defineProperty(exports, "Dashboard", {
|
|
|
45
45
|
return _dashboard.default;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
+
Object.defineProperty(exports, "DeleteConfirm", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function get() {
|
|
51
|
+
return _deleteConfirm.default;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
48
54
|
Object.defineProperty(exports, "DialogSelect", {
|
|
49
55
|
enumerable: true,
|
|
50
56
|
get: function get() {
|
|
@@ -93,6 +99,12 @@ Object.defineProperty(exports, "FullScreenAlert", {
|
|
|
93
99
|
return _fullScreenAlert.default;
|
|
94
100
|
}
|
|
95
101
|
});
|
|
102
|
+
Object.defineProperty(exports, "GeneratedListPage", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function get() {
|
|
105
|
+
return _generatedListPage.GeneratedListPage;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
96
108
|
Object.defineProperty(exports, "GridPlusContext", {
|
|
97
109
|
enumerable: true,
|
|
98
110
|
get: function get() {
|
|
@@ -111,6 +123,12 @@ Object.defineProperty(exports, "QueryBuilder", {
|
|
|
111
123
|
return _queryBuilder.default;
|
|
112
124
|
}
|
|
113
125
|
});
|
|
126
|
+
Object.defineProperty(exports, "StandardFormDialog", {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: function get() {
|
|
129
|
+
return _standardFormDialog.StandardFormDialog;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
114
132
|
Object.defineProperty(exports, "ToolBar", {
|
|
115
133
|
enumerable: true,
|
|
116
134
|
get: function get() {
|
|
@@ -140,4 +158,7 @@ var _toolBar = _interopRequireDefault(require("./toolBar"));
|
|
|
140
158
|
var _importModal = _interopRequireDefault(require("./importModal"));
|
|
141
159
|
var _fullScreenAlert = _interopRequireDefault(require("./fullScreenAlert"));
|
|
142
160
|
var _ConfirmPro = _interopRequireDefault(require("./ConfirmPro"));
|
|
161
|
+
var _generatedListPage = require("./generatedListPage");
|
|
162
|
+
var _standardFormDialog = require("./standardFormDialog");
|
|
163
|
+
var _deleteConfirm = _interopRequireDefault(require("./deleteConfirm"));
|
|
143
164
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 表单验证工具函数
|
|
3
|
+
*/
|
|
4
|
+
export declare const ValidationRules: {
|
|
5
|
+
/**
|
|
6
|
+
* 必填验证
|
|
7
|
+
*/
|
|
8
|
+
required: (message?: string) => {
|
|
9
|
+
required: boolean;
|
|
10
|
+
message: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* 邮箱验证
|
|
14
|
+
*/
|
|
15
|
+
email: (message?: string) => {
|
|
16
|
+
format: string;
|
|
17
|
+
message: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* 手机号验证
|
|
21
|
+
*/
|
|
22
|
+
phone: (message?: string) => {
|
|
23
|
+
pattern: RegExp;
|
|
24
|
+
message: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* 长度验证
|
|
28
|
+
*/
|
|
29
|
+
length: (min: number, max?: number, message?: string) => {
|
|
30
|
+
min: number;
|
|
31
|
+
max: number;
|
|
32
|
+
message: string;
|
|
33
|
+
} | {
|
|
34
|
+
min: number;
|
|
35
|
+
message: string;
|
|
36
|
+
max?: undefined;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* 数字范围验证
|
|
40
|
+
*/
|
|
41
|
+
range: (min: number, max?: number, message?: string) => {
|
|
42
|
+
minimum: number;
|
|
43
|
+
maximum: number;
|
|
44
|
+
message: string;
|
|
45
|
+
} | {
|
|
46
|
+
minimum: number;
|
|
47
|
+
message: string;
|
|
48
|
+
maximum?: undefined;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* 正则表达式验证
|
|
52
|
+
*/
|
|
53
|
+
pattern: (pattern: RegExp, message: string) => {
|
|
54
|
+
pattern: RegExp;
|
|
55
|
+
message: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* 身份证号验证
|
|
59
|
+
*/
|
|
60
|
+
idCard: (message?: string) => {
|
|
61
|
+
pattern: RegExp;
|
|
62
|
+
message: string;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* URL验证
|
|
66
|
+
*/
|
|
67
|
+
url: (message?: string) => {
|
|
68
|
+
format: string;
|
|
69
|
+
message: string;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* 整数验证
|
|
73
|
+
*/
|
|
74
|
+
integer: (message?: string) => {
|
|
75
|
+
pattern: RegExp;
|
|
76
|
+
message: string;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* 正整数验证
|
|
80
|
+
*/
|
|
81
|
+
positiveInteger: (message?: string) => {
|
|
82
|
+
pattern: RegExp;
|
|
83
|
+
message: string;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* 非负整数验证
|
|
87
|
+
*/
|
|
88
|
+
nonNegativeInteger: (message?: string) => {
|
|
89
|
+
pattern: RegExp;
|
|
90
|
+
message: string;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* 小数验证
|
|
94
|
+
*/
|
|
95
|
+
decimal: (precision?: number, message?: string) => {
|
|
96
|
+
pattern: RegExp;
|
|
97
|
+
message: string;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
export declare const combineValidation: (...rules: any[]) => any[];
|
|
101
|
+
export declare const conditionalValidation: (condition: (form: any) => boolean, rules: any[]) => (form: any) => any[];
|
|
102
|
+
export declare const CommonValidations: {
|
|
103
|
+
/**
|
|
104
|
+
* 编码字段(必填,长度限制,字母数字)
|
|
105
|
+
*/
|
|
106
|
+
code: (maxLength?: number) => any[];
|
|
107
|
+
/**
|
|
108
|
+
* 名称字段(必填,长度限制)
|
|
109
|
+
*/
|
|
110
|
+
name: (maxLength?: number) => any[];
|
|
111
|
+
/**
|
|
112
|
+
* 手机号字段(必填,格式验证)
|
|
113
|
+
*/
|
|
114
|
+
requiredPhone: () => any[];
|
|
115
|
+
/**
|
|
116
|
+
* 邮箱字段(必填,格式验证)
|
|
117
|
+
*/
|
|
118
|
+
requiredEmail: () => any[];
|
|
119
|
+
/**
|
|
120
|
+
* 备注字段(可选,长度限制)
|
|
121
|
+
*/
|
|
122
|
+
remark: (maxLength?: number) => ({
|
|
123
|
+
min: number;
|
|
124
|
+
max: number;
|
|
125
|
+
message: string;
|
|
126
|
+
} | {
|
|
127
|
+
min: number;
|
|
128
|
+
message: string;
|
|
129
|
+
max?: undefined;
|
|
130
|
+
})[];
|
|
131
|
+
/**
|
|
132
|
+
* 金额字段(必填,非负数,两位小数)
|
|
133
|
+
*/
|
|
134
|
+
amount: () => any[];
|
|
135
|
+
/**
|
|
136
|
+
* 数量字段(必填,正整数)
|
|
137
|
+
*/
|
|
138
|
+
quantity: () => any[];
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* 表单字段增强工具
|
|
142
|
+
* 为FieldCreators添加验证功能
|
|
143
|
+
*/
|
|
144
|
+
export declare const enhanceFieldWithValidation: (field: any, validations: any[]) => any;
|
|
145
|
+
/**
|
|
146
|
+
* 批量添加验证的工具函数
|
|
147
|
+
*/
|
|
148
|
+
export declare const addValidationToFields: (fields: Record<string, any>, validationMap: Record<string, any[]>) => {
|
|
149
|
+
[x: string]: any;
|
|
150
|
+
};
|