@ccs-ui/rc-pro 1.1.0 → 1.1.1-rc10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/auth/auth-button.js +25 -12
- package/es/auth/index.d.ts +7 -13
- package/es/auth/index.js +96 -74
- package/es/dialog/HookDrawer.d.ts +1 -1
- package/es/dialog/HookDrawer.js +31 -19
- package/es/dialog/HookModal.d.ts +1 -1
- package/es/dialog/HookModal.js +25 -20
- package/es/dialog/button.d.ts +3 -1
- package/es/dialog/button.js +28 -16
- package/es/dialog/context.d.ts +8 -7
- package/es/dialog/context.js +4 -4
- package/es/dialog/form.d.ts +2 -2
- package/es/dialog/form.js +4 -3
- package/es/dialog/{dialog.d.ts → hook.d.ts} +9 -1
- package/es/dialog/{dialog.js → hook.js} +11 -11
- package/es/dialog/index.d.ts +4 -4
- package/es/dialog/index.js +2 -2
- package/es/dialog/index.less +14 -17
- package/es/drawer.zip +0 -0
- package/es/index.d.ts +11 -8
- package/es/index.js +0 -2
- package/es/keep-alive-tabs/index.d.ts +1 -1
- package/es/keep-alive-tabs/index.js +46 -41
- package/es/keep-alive-tabs/index.less +2 -2
- package/es/modal.zip +0 -0
- package/es/pro-table/index.d.ts +3 -3
- package/es/pro-table/index.js +69 -179
- package/es/pro-table/index.less +3 -13
- package/es/pro-table/search.js +7 -4
- package/es/pro-table/tree.d.ts +22 -0
- package/es/pro-table/tree.js +184 -0
- package/es/table/index.js +70 -59
- package/es/upload/upload-image.js +33 -15
- package/package.json +3 -2
- package/es/drawer/buttons.d.ts +0 -14
- package/es/drawer/buttons.js +0 -93
- package/es/drawer/index.d.ts +0 -13
- package/es/drawer/index.js +0 -11
- package/es/drawer/index.less +0 -5
- package/es/drawer/open/content.d.ts +0 -20
- package/es/drawer/open/content.js +0 -43
- package/es/drawer/open/destory-fns.d.ts +0 -2
- package/es/drawer/open/destory-fns.js +0 -3
- package/es/drawer/open/form.d.ts +0 -12
- package/es/drawer/open/form.js +0 -32
- package/es/drawer/open/index.d.ts +0 -18
- package/es/drawer/open/index.js +0 -166
- package/es/modal/buttons.d.ts +0 -14
- package/es/modal/buttons.js +0 -90
- package/es/modal/index.d.ts +0 -12
- package/es/modal/index.js +0 -11
- package/es/modal/index.less +0 -26
- package/es/modal/open/destory-fns.d.ts +0 -2
- package/es/modal/open/destory-fns.js +0 -3
- package/es/modal/open/drag.d.ts +0 -1
- package/es/modal/open/drag.js +0 -104
- package/es/modal/open/form.d.ts +0 -12
- package/es/modal/open/form.js +0 -35
- package/es/modal/open/index.d.ts +0 -19
- package/es/modal/open/index.js +0 -93
package/es/pro-table/index.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
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
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -29,6 +25,7 @@ import useProGrid from "../pro-grid/useProGrid";
|
|
|
29
25
|
import CcsTable from "../table";
|
|
30
26
|
import "./index.less";
|
|
31
27
|
import SearchComponent from "./search";
|
|
28
|
+
import TableTree from "./tree";
|
|
32
29
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
33
30
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
34
31
|
// 判断组件所处dom
|
|
@@ -88,7 +85,6 @@ var ProTable = function ProTable(props) {
|
|
|
88
85
|
var init = props.init,
|
|
89
86
|
auth = props.auth,
|
|
90
87
|
table = props.table,
|
|
91
|
-
title = props.title,
|
|
92
88
|
style = props.style,
|
|
93
89
|
proRef = props.proRef,
|
|
94
90
|
loading = props.loading,
|
|
@@ -121,12 +117,11 @@ var ProTable = function ProTable(props) {
|
|
|
121
117
|
requestParam = _ref$requestParam === void 0 ? {} : _ref$requestParam,
|
|
122
118
|
columns = _ref.columns,
|
|
123
119
|
asyncTree = _ref.asyncTree,
|
|
124
|
-
rowKey = _ref.rowKey
|
|
125
|
-
_ref$childrenColumnNa = _ref.childrenColumnName,
|
|
126
|
-
childrenColumnName = _ref$childrenColumnNa === void 0 ? 'children' : _ref$childrenColumnNa;
|
|
120
|
+
rowKey = _ref.rowKey;
|
|
127
121
|
var stickyRef = useRef(false);
|
|
128
122
|
// 判断当前组件是否在弹出框中
|
|
129
123
|
var isInModalOrDrawer = _typeof(stickyRef.current) === 'object';
|
|
124
|
+
// column filter
|
|
130
125
|
var filtersRef = useRef({});
|
|
131
126
|
// 查询form
|
|
132
127
|
var _Form$useForm = Form.useForm(),
|
|
@@ -142,20 +137,14 @@ var ProTable = function ProTable(props) {
|
|
|
142
137
|
_useState2 = _slicedToArray(_useState, 2),
|
|
143
138
|
data = _useState2[0],
|
|
144
139
|
setData = _useState2[1];
|
|
145
|
-
|
|
146
|
-
var
|
|
147
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
148
|
-
expandKeys = _useState4[0],
|
|
149
|
-
setExpandKeys = _useState4[1];
|
|
140
|
+
var event$ = useEventEmitter();
|
|
141
|
+
var treeRef = useRef(null);
|
|
150
142
|
|
|
151
143
|
// 权限判断
|
|
152
144
|
var isAuth = useMemo(function () {
|
|
153
|
-
if (auth && IsAuthButton
|
|
145
|
+
if (auth && IsAuthButton) {
|
|
154
146
|
return onAuth && onAuth(auth);
|
|
155
147
|
}
|
|
156
|
-
if (!auth && IsAuthButton && table) {
|
|
157
|
-
CcsUtils.showLogWarning('CcsProTable:未传入auth权限标识');
|
|
158
|
-
}
|
|
159
148
|
return true;
|
|
160
149
|
}, []);
|
|
161
150
|
var formatFormItems = useMemo(function () {
|
|
@@ -164,108 +153,31 @@ var ProTable = function ProTable(props) {
|
|
|
164
153
|
});
|
|
165
154
|
}, []);
|
|
166
155
|
|
|
167
|
-
// 获取数据
|
|
168
|
-
var onRequestTree = /*#__PURE__*/function () {
|
|
169
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
170
|
-
var query,
|
|
171
|
-
record,
|
|
172
|
-
params,
|
|
173
|
-
newParams,
|
|
174
|
-
requestResult,
|
|
175
|
-
newRequestResult,
|
|
176
|
-
treeData,
|
|
177
|
-
_args = arguments;
|
|
178
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
179
|
-
while (1) switch (_context.prev = _context.next) {
|
|
180
|
-
case 0:
|
|
181
|
-
query = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
182
|
-
record = _args.length > 1 ? _args[1] : undefined;
|
|
183
|
-
params = query;
|
|
184
|
-
if (record && asyncTree !== null && asyncTree !== void 0 && asyncTree.parentName) {
|
|
185
|
-
params[asyncTree === null || asyncTree === void 0 ? void 0 : asyncTree.parentName] = record[rowKey];
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// onSearchBefore 请求前回传参数,可以在父组件进行修改
|
|
189
|
-
newParams = onSearchBefore ? onSearchBefore(params) : params; // 发起请求
|
|
190
|
-
setData(function (d) {
|
|
191
|
-
return _objectSpread(_objectSpread({}, d), {}, {
|
|
192
|
-
loading: true
|
|
193
|
-
});
|
|
194
|
-
});
|
|
195
|
-
_context.t0 = request;
|
|
196
|
-
if (!_context.t0) {
|
|
197
|
-
_context.next = 11;
|
|
198
|
-
break;
|
|
199
|
-
}
|
|
200
|
-
_context.next = 10;
|
|
201
|
-
return request(_objectSpread({}, newParams));
|
|
202
|
-
case 10:
|
|
203
|
-
_context.t0 = _context.sent;
|
|
204
|
-
case 11:
|
|
205
|
-
requestResult = _context.t0;
|
|
206
|
-
// 请求结果
|
|
207
|
-
if (requestResult && requestResult.success) {
|
|
208
|
-
// onSearchAfter 处理请求结果
|
|
209
|
-
newRequestResult = onSearchAfter ? onSearchAfter(requestResult) : requestResult;
|
|
210
|
-
treeData = newRequestResult.data;
|
|
211
|
-
if (record) {
|
|
212
|
-
// 异步树
|
|
213
|
-
record[childrenColumnName] = treeData;
|
|
214
|
-
setData(function (d) {
|
|
215
|
-
return _objectSpread(_objectSpread({}, d), {}, {
|
|
216
|
-
result: _toConsumableArray(d.result || []),
|
|
217
|
-
loading: false
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
} else {
|
|
221
|
-
setExpandKeys([]);
|
|
222
|
-
setData({
|
|
223
|
-
loading: false,
|
|
224
|
-
result: treeData || []
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
} else {
|
|
228
|
-
setData(function (d) {
|
|
229
|
-
return _objectSpread(_objectSpread({}, d), {}, {
|
|
230
|
-
loading: false
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
case 13:
|
|
235
|
-
case "end":
|
|
236
|
-
return _context.stop();
|
|
237
|
-
}
|
|
238
|
-
}, _callee);
|
|
239
|
-
}));
|
|
240
|
-
return function onRequestTree() {
|
|
241
|
-
return _ref2.apply(this, arguments);
|
|
242
|
-
};
|
|
243
|
-
}();
|
|
244
|
-
|
|
245
156
|
// 获取数据
|
|
246
157
|
var onRequest = /*#__PURE__*/function () {
|
|
247
|
-
var
|
|
158
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(eventType) {
|
|
248
159
|
var pageNo,
|
|
249
160
|
pageSize,
|
|
250
161
|
record,
|
|
251
|
-
|
|
252
|
-
return _regeneratorRuntime().wrap(function
|
|
253
|
-
while (1) switch (
|
|
162
|
+
_args2 = arguments;
|
|
163
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
164
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
254
165
|
case 0:
|
|
255
|
-
pageNo =
|
|
256
|
-
pageSize =
|
|
257
|
-
record =
|
|
166
|
+
pageNo = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : 1;
|
|
167
|
+
pageSize = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : (pagination ? pagination.defaultPageSize : 10) || 10;
|
|
168
|
+
record = _args2.length > 3 ? _args2[3] : undefined;
|
|
258
169
|
if (!(!isAuth || !request)) {
|
|
259
|
-
|
|
170
|
+
_context2.next = 5;
|
|
260
171
|
break;
|
|
261
172
|
}
|
|
262
|
-
return
|
|
173
|
+
return _context2.abrupt("return");
|
|
263
174
|
case 5:
|
|
264
175
|
// 构建查询条件:表单数据、请求额外参数、分页参数、其他参数
|
|
265
|
-
form.validateFields().then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
176
|
+
form.validateFields().then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
266
177
|
var formValues,
|
|
267
178
|
pageValue,
|
|
268
179
|
params,
|
|
180
|
+
_treeRef$current,
|
|
269
181
|
newParams,
|
|
270
182
|
requestResult,
|
|
271
183
|
newRequestResult,
|
|
@@ -274,11 +186,11 @@ var ProTable = function ProTable(props) {
|
|
|
274
186
|
size,
|
|
275
187
|
no,
|
|
276
188
|
result,
|
|
277
|
-
|
|
278
|
-
return _regeneratorRuntime().wrap(function
|
|
279
|
-
while (1) switch (
|
|
189
|
+
_args = arguments;
|
|
190
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
191
|
+
while (1) switch (_context.prev = _context.next) {
|
|
280
192
|
case 0:
|
|
281
|
-
formValues =
|
|
193
|
+
formValues = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
282
194
|
// 格式化条件
|
|
283
195
|
if (formatFormItems.length) {
|
|
284
196
|
Object.keys(formValues).forEach(function (k) {
|
|
@@ -298,11 +210,11 @@ var ProTable = function ProTable(props) {
|
|
|
298
210
|
query: _objectSpread(_objectSpread({}, formValues), requestParam)
|
|
299
211
|
}, pageValue), filtersRef.current); // 异步树
|
|
300
212
|
if (!asyncTree) {
|
|
301
|
-
|
|
213
|
+
_context.next = 7;
|
|
302
214
|
break;
|
|
303
215
|
}
|
|
304
|
-
onRequestTree(params.query, record);
|
|
305
|
-
return
|
|
216
|
+
(_treeRef$current = treeRef.current) === null || _treeRef$current === void 0 ? void 0 : _treeRef$current.onRequestTree(params.query, record);
|
|
217
|
+
return _context.abrupt("return");
|
|
306
218
|
case 7:
|
|
307
219
|
// onSearchBefore 请求前回传参数,可以在父组件进行修改
|
|
308
220
|
newParams = onSearchBefore ? onSearchBefore(params, eventType) : params; // 发起请求
|
|
@@ -311,30 +223,29 @@ var ProTable = function ProTable(props) {
|
|
|
311
223
|
loading: true
|
|
312
224
|
});
|
|
313
225
|
});
|
|
314
|
-
|
|
226
|
+
_context.next = 11;
|
|
315
227
|
return request(_objectSpread({}, newParams));
|
|
316
228
|
case 11:
|
|
317
|
-
requestResult =
|
|
229
|
+
requestResult = _context.sent;
|
|
318
230
|
if (!(requestResult && requestResult.success)) {
|
|
319
|
-
|
|
231
|
+
_context.next = 22;
|
|
320
232
|
break;
|
|
321
233
|
}
|
|
322
234
|
// onSearchAfter 处理请求结果
|
|
323
235
|
newRequestResult = onSearchAfter ? onSearchAfter(requestResult, eventType) : requestResult;
|
|
324
236
|
_newRequestResult$dat = newRequestResult.data, totalNum = _newRequestResult$dat.totalNum, size = _newRequestResult$dat.pageSize, no = _newRequestResult$dat.pageNo, result = _newRequestResult$dat.result;
|
|
325
237
|
if (!(totalNum === undefined || pageSize === undefined || no === undefined || result === undefined)) {
|
|
326
|
-
|
|
238
|
+
_context.next = 19;
|
|
327
239
|
break;
|
|
328
240
|
}
|
|
329
241
|
CcsUtils.showLogWarning('分页返回对象,totalNum,pageSize,no,result不能为空');
|
|
330
242
|
setData(_objectSpread(_objectSpread({}, data), {}, {
|
|
331
243
|
loading: false
|
|
332
244
|
}));
|
|
333
|
-
return
|
|
245
|
+
return _context.abrupt("return");
|
|
334
246
|
case 19:
|
|
335
247
|
// 当前页无数据,返回上一页
|
|
336
248
|
if (!result.length && no !== 1 && no !== undefined) {
|
|
337
|
-
console.log('no', no);
|
|
338
249
|
onRequest('reload', no - 1);
|
|
339
250
|
} else {
|
|
340
251
|
setData({
|
|
@@ -345,7 +256,7 @@ var ProTable = function ProTable(props) {
|
|
|
345
256
|
totalNum: totalNum || 0
|
|
346
257
|
});
|
|
347
258
|
}
|
|
348
|
-
|
|
259
|
+
_context.next = 23;
|
|
349
260
|
break;
|
|
350
261
|
case 22:
|
|
351
262
|
setData(function (d) {
|
|
@@ -355,23 +266,24 @@ var ProTable = function ProTable(props) {
|
|
|
355
266
|
});
|
|
356
267
|
case 23:
|
|
357
268
|
case "end":
|
|
358
|
-
return
|
|
269
|
+
return _context.stop();
|
|
359
270
|
}
|
|
360
|
-
},
|
|
271
|
+
}, _callee);
|
|
361
272
|
}))).catch(function () {});
|
|
362
273
|
case 6:
|
|
363
274
|
case "end":
|
|
364
|
-
return
|
|
275
|
+
return _context2.stop();
|
|
365
276
|
}
|
|
366
|
-
},
|
|
277
|
+
}, _callee2);
|
|
367
278
|
}));
|
|
368
279
|
return function onRequest(_x2) {
|
|
369
|
-
return
|
|
280
|
+
return _ref2.apply(this, arguments);
|
|
370
281
|
};
|
|
371
282
|
}();
|
|
372
283
|
|
|
373
284
|
// 异步树、局部刷新方法
|
|
374
285
|
var _onPartialReload = function onPartialReload(id) {
|
|
286
|
+
var _treeRef$current2, _treeRef$current3;
|
|
375
287
|
// 查找需要刷新的节点
|
|
376
288
|
var treeNode = getDataById(data.result || [], rowKey, id);
|
|
377
289
|
// 没有查找到、全部刷新
|
|
@@ -382,10 +294,8 @@ var ProTable = function ProTable(props) {
|
|
|
382
294
|
// 获取所有下级ID
|
|
383
295
|
var ids = getAllChildrenId(treeNode.children || [], rowKey);
|
|
384
296
|
// 局部重载
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
}));
|
|
388
|
-
onRequestTree({}, treeNode);
|
|
297
|
+
(_treeRef$current2 = treeRef.current) === null || _treeRef$current2 === void 0 ? void 0 : _treeRef$current2.onExpandKeys(ids);
|
|
298
|
+
(_treeRef$current3 = treeRef.current) === null || _treeRef$current3 === void 0 ? void 0 : _treeRef$current3.onRequestTree({}, treeNode);
|
|
389
299
|
};
|
|
390
300
|
|
|
391
301
|
// 尺寸变化重设尺寸
|
|
@@ -494,37 +404,21 @@ var ProTable = function ProTable(props) {
|
|
|
494
404
|
}
|
|
495
405
|
onRequest('changePage', paginationTable.current || 0, paginationTable.pageSize || 10);
|
|
496
406
|
};
|
|
497
|
-
|
|
498
|
-
// 发布订阅、组件通信模式
|
|
499
|
-
var event$ = useEventEmitter();
|
|
500
|
-
var onExpand = function onExpand(expanded, record) {
|
|
501
|
-
var _table$asyncTree;
|
|
502
|
-
if (!(table !== null && table !== void 0 && table.asyncTree)) return;
|
|
503
|
-
if (!(table !== null && table !== void 0 && (_table$asyncTree = table.asyncTree) !== null && _table$asyncTree !== void 0 && _table$asyncTree.parentName)) {
|
|
504
|
-
CcsUtils.showLogWarning('执行失败、参数treeParentName为空!!!');
|
|
505
|
-
return;
|
|
506
|
-
}
|
|
507
|
-
if (!rowKey || (rowKey && record[rowKey]) === undefined) {
|
|
508
|
-
CcsUtils.showLogWarning('rowKey未传入或传入rowKey不正确');
|
|
509
|
-
return;
|
|
510
|
-
}
|
|
511
|
-
var expandId = record[rowKey];
|
|
512
|
-
if (expanded) {
|
|
513
|
-
var _record$childrenColum;
|
|
514
|
-
expandKeys.push(expandId);
|
|
515
|
-
if (((_record$childrenColum = record[childrenColumnName]) === null || _record$childrenColum === void 0 ? void 0 : _record$childrenColum.length) > 0) return;
|
|
516
|
-
onRequestTree({}, record);
|
|
517
|
-
} else {
|
|
518
|
-
setExpandKeys(expandKeys.filter(function (e) {
|
|
519
|
-
return e !== expandId;
|
|
520
|
-
}));
|
|
521
|
-
}
|
|
522
|
-
};
|
|
523
407
|
var renderTable = function renderTable() {
|
|
524
408
|
if (!table) return null;
|
|
525
|
-
|
|
526
|
-
|
|
409
|
+
if (!isAuth) {
|
|
410
|
+
return /*#__PURE__*/_jsx(Empty, {
|
|
411
|
+
style: {
|
|
412
|
+
margin: 0,
|
|
413
|
+
padding: '32px 0',
|
|
414
|
+
color: 'red'
|
|
415
|
+
},
|
|
416
|
+
image: Empty.PRESENTED_IMAGE_DEFAULT,
|
|
417
|
+
description: "\u6CA1\u6709\u6570\u636E\u8BF7\u6C42\u6743\u9650"
|
|
418
|
+
});
|
|
419
|
+
}
|
|
527
420
|
if (_typeof(stickyRef.current) === 'object' && 'getContainer' in stickyRef.current) {
|
|
421
|
+
// 判断吸顶dom是否有paddingTop,设置offsetHeader
|
|
528
422
|
var dom = stickyRef.current.getContainer();
|
|
529
423
|
var _window$getComputedSt = window.getComputedStyle(dom),
|
|
530
424
|
paddingTop = _window$getComputedSt.paddingTop;
|
|
@@ -534,43 +428,39 @@ var ProTable = function ProTable(props) {
|
|
|
534
428
|
});
|
|
535
429
|
}
|
|
536
430
|
}
|
|
537
|
-
// 添加吸顶
|
|
538
|
-
var tableParams = _objectSpread({
|
|
539
|
-
sticky: stickyRef.current || true
|
|
540
|
-
}, table);
|
|
541
431
|
|
|
542
432
|
// 异步树
|
|
543
433
|
if (table !== null && table !== void 0 && table.asyncTree) {
|
|
544
|
-
|
|
545
|
-
|
|
434
|
+
return /*#__PURE__*/_jsx(TableTree, {
|
|
435
|
+
data: data,
|
|
436
|
+
table: table,
|
|
437
|
+
event$: event$,
|
|
438
|
+
loading: loading,
|
|
439
|
+
treeRef: treeRef,
|
|
440
|
+
sticky: stickyRef.current || true,
|
|
441
|
+
setData: setData,
|
|
442
|
+
onSearchAfter: onSearchAfter,
|
|
443
|
+
onSearchBefore: onSearchBefore,
|
|
444
|
+
handlePageChange: handlePageChange,
|
|
445
|
+
isInModalOrDrawer: isInModalOrDrawer
|
|
446
|
+
});
|
|
546
447
|
}
|
|
547
|
-
return
|
|
448
|
+
return /*#__PURE__*/_jsx(CcsTable, _objectSpread(_objectSpread({
|
|
548
449
|
onChange: handlePageChange,
|
|
549
450
|
data: data,
|
|
550
451
|
event$: event$,
|
|
551
|
-
size: isInModalOrDrawer ? 'small' : 'middle'
|
|
552
|
-
|
|
452
|
+
size: isInModalOrDrawer ? 'small' : 'middle',
|
|
453
|
+
sticky: stickyRef.current || true
|
|
454
|
+
}, table), {}, {
|
|
553
455
|
columns: columns,
|
|
554
456
|
showSorterTooltip: true,
|
|
555
457
|
loading: loading || data.loading || false
|
|
556
|
-
}))
|
|
557
|
-
style: {
|
|
558
|
-
margin: 0,
|
|
559
|
-
padding: '32px 0',
|
|
560
|
-
color: 'red'
|
|
561
|
-
},
|
|
562
|
-
image: Empty.PRESENTED_IMAGE_DEFAULT,
|
|
563
|
-
description: "\u6CA1\u6709\u6570\u636E\u8BF7\u6C42\u6743\u9650"
|
|
564
|
-
});
|
|
458
|
+
}));
|
|
565
459
|
};
|
|
566
460
|
var render = /*#__PURE__*/_jsxs("div", {
|
|
567
461
|
className: classNames(classPrefix, className),
|
|
568
462
|
style: style,
|
|
569
|
-
children: [
|
|
570
|
-
className: "".concat(classPrefix, "-title"),
|
|
571
|
-
style: {},
|
|
572
|
-
children: title
|
|
573
|
-
}), !(!formItems.length && !toolbar) && isAuth && /*#__PURE__*/_jsx(SearchComponent, {
|
|
463
|
+
children: [!(!formItems.length && !toolbar) && isAuth && /*#__PURE__*/_jsx(SearchComponent, {
|
|
574
464
|
form: form,
|
|
575
465
|
toolbar: toolbar,
|
|
576
466
|
columns: columns,
|
package/es/pro-table/index.less
CHANGED
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
// display: none;
|
|
13
13
|
// }
|
|
14
14
|
.ant-pagination {
|
|
15
|
-
background-color: #fff;
|
|
16
15
|
margin: 0 !important;
|
|
17
16
|
}
|
|
18
17
|
|
|
@@ -27,15 +26,6 @@
|
|
|
27
26
|
position: relative;
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
&-title {
|
|
31
|
-
padding: 10px 16px;
|
|
32
|
-
color: rgb(0 0 0 / 85%);
|
|
33
|
-
font-weight: 500;
|
|
34
|
-
font-size: 16px;
|
|
35
|
-
background: #fff;
|
|
36
|
-
border-bottom: 1px solid #f0f0f0;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
29
|
&-form {
|
|
40
30
|
flex: 0 1 auto;
|
|
41
31
|
overflow: hidden;
|
|
@@ -79,8 +69,8 @@
|
|
|
79
69
|
}
|
|
80
70
|
|
|
81
71
|
&-high-form {
|
|
82
|
-
background: #fff;
|
|
83
|
-
box-shadow: 0 2px 2px 0 rgb(0 0 0 / 3%);
|
|
72
|
+
// background: #fff;
|
|
73
|
+
// box-shadow: 0 2px 2px 0 rgb(0 0 0 / 3%);
|
|
84
74
|
|
|
85
75
|
.ant-form-item {
|
|
86
76
|
margin-bottom: 10px !important;
|
|
@@ -127,7 +117,7 @@
|
|
|
127
117
|
gap: 10px;
|
|
128
118
|
justify-content: space-between;
|
|
129
119
|
align-items: center;
|
|
130
|
-
background-color: #fff;
|
|
120
|
+
// background-color: #fff;
|
|
131
121
|
|
|
132
122
|
.ant-form-item-explain {
|
|
133
123
|
position: absolute;
|
package/es/pro-table/search.js
CHANGED
|
@@ -9,7 +9,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
9
9
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
11
|
import { MoreOutlined, RedoOutlined, SettingOutlined, UpOutlined } from '@ant-design/icons';
|
|
12
|
-
import { Button, Checkbox, Col, Dropdown, Form, Row, Tooltip } from 'antd';
|
|
12
|
+
import { Button, Card, Checkbox, Col, Dropdown, Form, Row, Tooltip } from 'antd';
|
|
13
13
|
import _debounce from 'lodash/debounce';
|
|
14
14
|
import ResizeObserver from 'rc-resize-observer';
|
|
15
15
|
import { cloneElement, useMemo, useRef, useState } from 'react';
|
|
@@ -418,11 +418,14 @@ function SearchComponent(_ref) {
|
|
|
418
418
|
});
|
|
419
419
|
};
|
|
420
420
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
421
|
-
children: /*#__PURE__*/_jsxs(
|
|
421
|
+
children: /*#__PURE__*/_jsxs(Card, {
|
|
422
|
+
bodyStyle: {
|
|
423
|
+
padding: 16
|
|
424
|
+
},
|
|
422
425
|
style: {
|
|
423
|
-
|
|
424
|
-
background: '#fff'
|
|
426
|
+
borderRadius: 0
|
|
425
427
|
},
|
|
428
|
+
bordered: false,
|
|
426
429
|
children: [(hasMore || expandForm) && renderMoreForm(), /*#__PURE__*/_jsxs("div", {
|
|
427
430
|
className: "".concat(classPrefix, "-header"),
|
|
428
431
|
children: [/*#__PURE__*/_jsx("div", {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { EventEmitter } from 'ahooks/lib/useEventEmitter';
|
|
2
|
+
import { TableSticky } from 'rc-table/lib/interface';
|
|
3
|
+
import { RefObject } from 'react';
|
|
4
|
+
import { CcsProTableProps } from '.';
|
|
5
|
+
import { TableDataType } from '..';
|
|
6
|
+
export type TreeInstance<T> = {
|
|
7
|
+
onRequestTree: (query: any, record: T | any) => void;
|
|
8
|
+
onExpandKeys: (ids: string[]) => void;
|
|
9
|
+
};
|
|
10
|
+
type TreeTableProps<T> = Pick<CcsProTableProps<T>, 'table' | 'onSearchAfter' | 'onSearchBefore' | 'loading'> & {
|
|
11
|
+
data: TableDataType<T>;
|
|
12
|
+
event$: EventEmitter<{
|
|
13
|
+
key: 'formFilter' | 'columnFilter' | 'columnFilter';
|
|
14
|
+
}>;
|
|
15
|
+
treeRef: RefObject<TreeInstance<T>>;
|
|
16
|
+
isInModalOrDrawer: boolean;
|
|
17
|
+
sticky: true | TableSticky;
|
|
18
|
+
setData: React.Dispatch<React.SetStateAction<TableDataType<T>>>;
|
|
19
|
+
handlePageChange: any;
|
|
20
|
+
};
|
|
21
|
+
declare const TableTree: <T extends object = any>({ data, table, event$, loading, treeRef, sticky, setData, onSearchAfter, onSearchBefore, handlePageChange, isInModalOrDrawer, }: TreeTableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export default TableTree;
|