@arim-aisdc/public-components 2.3.97 → 2.3.99
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/BaseInfo/BaseInfo.d.ts +1 -1
- package/dist/components/ConditionExpression/index.d.ts +22 -4
- package/dist/components/ConditionExpression/index.js +281 -20
- package/dist/components/ConditionExpression/index.less +27 -4
- package/dist/components/CustomForm/CustomForm.js +6 -1
- package/dist/components/CustomForm/type.d.ts +10 -1
- package/dist/components/TableMax/TableBody/OriginalRow.js +22 -6
- package/dist/components/TableMax/TableBody/VirtualRow.js +21 -5
- package/dist/components/TableMax/TableHeader/Cell.js +1 -1
- package/dist/components/TableMax/TableMax.d.ts +1 -1
- package/dist/components/TableMax/TableMax.js +1 -1
- package/dist/components/TableMax/components/ColumnEdit/index.d.ts +3 -0
- package/dist/components/TableMax/components/ColumnEdit/index.js +16 -4
- package/dist/components/TableMax/components/ColumnSetting/index.js +1 -1
- package/dist/components/TableMax/components/Export/useTableExport.d.ts +1 -1
- package/dist/components/TableMax/components/Export/useTableExport.js +2 -2
- package/dist/components/TableMax/index.d.ts +1 -2
- package/dist/components/TableMax/index.js +3 -1
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ export declare const foramtBaseInfoField: (data: any, dataField: BaseInfoFieldTy
|
|
|
17
17
|
value: any;
|
|
18
18
|
field: string;
|
|
19
19
|
label?: string;
|
|
20
|
-
text: string | Element |
|
|
20
|
+
text: string | JSX.Element | Element;
|
|
21
21
|
units?: string;
|
|
22
22
|
width?: string;
|
|
23
23
|
labelWidth?: string;
|
|
@@ -15,6 +15,23 @@ export type conditionExpressionItemType = {
|
|
|
15
15
|
/**与下一组条件表达式连接符 */
|
|
16
16
|
logicOperator?: string | null;
|
|
17
17
|
};
|
|
18
|
+
export type ConditionExpressionOptionType = {
|
|
19
|
+
label: any;
|
|
20
|
+
value: any;
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
};
|
|
23
|
+
export type ConditionExpressionParameterOptionsRequestParams = {
|
|
24
|
+
page: number;
|
|
25
|
+
pageSize: number;
|
|
26
|
+
keyword?: string;
|
|
27
|
+
groupIndex?: number;
|
|
28
|
+
conditionIndex?: number;
|
|
29
|
+
};
|
|
30
|
+
export type ConditionExpressionParameterOptionsRequestResult = ConditionExpressionOptionType[] | {
|
|
31
|
+
options: ConditionExpressionOptionType[];
|
|
32
|
+
total?: number;
|
|
33
|
+
hasMore?: boolean;
|
|
34
|
+
};
|
|
18
35
|
export interface ConditionExpressionPropsType {
|
|
19
36
|
/** 组件的值 */
|
|
20
37
|
value?: conditionExpressionItemType[];
|
|
@@ -23,10 +40,11 @@ export interface ConditionExpressionPropsType {
|
|
|
23
40
|
/** 第一个参数是否展示 */
|
|
24
41
|
showParameter?: boolean;
|
|
25
42
|
/** 第一个参数的options */
|
|
26
|
-
parameterOptions?:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
43
|
+
parameterOptions?: ConditionExpressionOptionType[];
|
|
44
|
+
/** 第一个参数的options远程获取函数 */
|
|
45
|
+
parameterOptionsRequest?: (params: ConditionExpressionParameterOptionsRequestParams) => Promise<ConditionExpressionParameterOptionsRequestResult>;
|
|
46
|
+
/** 第一个参数的options远程获取每页条数 */
|
|
47
|
+
parameterOptionsPageSize?: number;
|
|
30
48
|
/** 第一个参数的Select的labelInValue属性 */
|
|
31
49
|
labelInValue?: boolean;
|
|
32
50
|
/** 是否支持前端筛选 */
|
|
@@ -1,22 +1,30 @@
|
|
|
1
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _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; } }
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
2
14
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
15
|
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
16
|
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); }
|
|
5
17
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
18
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
19
|
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; }
|
|
8
|
-
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; }
|
|
9
|
-
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; }
|
|
10
|
-
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; }
|
|
11
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
12
|
-
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); }
|
|
13
20
|
import { CloseOutlined, PlusOutlined } from '@ant-design/icons';
|
|
14
|
-
import { Button, Input, Select, Tooltip } from 'antd';
|
|
15
|
-
import { cloneDeep } from 'lodash';
|
|
16
|
-
import React from 'react';
|
|
21
|
+
import { Button, Input, Select, Spin, Tooltip } from 'antd';
|
|
22
|
+
import { cloneDeep, debounce } from 'lodash';
|
|
23
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
17
24
|
import Icon from "../Icon";
|
|
18
25
|
import "./index.less";
|
|
19
26
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
20
28
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
29
|
var operatorOptions = [{
|
|
22
30
|
label: '=',
|
|
@@ -51,6 +59,60 @@ var operatorOptions = [{
|
|
|
51
59
|
}];
|
|
52
60
|
var tooltipList = ['Between', 'NotBetween', 'In', 'NotIn'];
|
|
53
61
|
var tooltipTitle = '请使用逗号隔开多个参数值,如:1,2';
|
|
62
|
+
var DEFAULT_PARAMETER_OPTIONS_PAGE_SIZE = 20;
|
|
63
|
+
var getOptionKey = function getOptionKey(option) {
|
|
64
|
+
try {
|
|
65
|
+
return JSON.stringify(option === null || option === void 0 ? void 0 : option.value);
|
|
66
|
+
} catch (error) {
|
|
67
|
+
return String(option === null || option === void 0 ? void 0 : option.value);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
var mergeOptions = function mergeOptions() {
|
|
71
|
+
var originOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
72
|
+
var appendOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
73
|
+
var optionMap = new Map();
|
|
74
|
+
[].concat(_toConsumableArray(originOptions), _toConsumableArray(appendOptions)).forEach(function (option) {
|
|
75
|
+
var optionKey = getOptionKey(option);
|
|
76
|
+
if (!optionMap.has(optionKey)) {
|
|
77
|
+
optionMap.set(optionKey, option);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return Array.from(optionMap.values());
|
|
81
|
+
};
|
|
82
|
+
var normalizeParameterOptionsResult = function normalizeParameterOptionsResult(result) {
|
|
83
|
+
if (Array.isArray(result)) {
|
|
84
|
+
return {
|
|
85
|
+
options: result
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
options: (result === null || result === void 0 ? void 0 : result.options) || [],
|
|
90
|
+
total: result === null || result === void 0 ? void 0 : result.total,
|
|
91
|
+
hasMore: result === null || result === void 0 ? void 0 : result.hasMore
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
var createRemoteParameterOptionsState = function createRemoteParameterOptionsState() {
|
|
95
|
+
return {
|
|
96
|
+
options: [],
|
|
97
|
+
loading: false,
|
|
98
|
+
hasMore: true,
|
|
99
|
+
page: 0,
|
|
100
|
+
keyword: '',
|
|
101
|
+
fetchId: 0
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
var getRemoteParameterOptionsKey = function getRemoteParameterOptionsKey() {
|
|
105
|
+
var groupIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
106
|
+
var conditionIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
107
|
+
return "".concat(groupIndex, "-").concat(conditionIndex);
|
|
108
|
+
};
|
|
109
|
+
var getConditionExpressionStructureKey = function getConditionExpressionStructureKey() {
|
|
110
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
111
|
+
return value.map(function (item) {
|
|
112
|
+
var _item$conditionItem;
|
|
113
|
+
return (item === null || item === void 0 || (_item$conditionItem = item.conditionItem) === null || _item$conditionItem === void 0 ? void 0 : _item$conditionItem.length) || 0;
|
|
114
|
+
}).join('|');
|
|
115
|
+
};
|
|
54
116
|
var ConditionExpressionDefaultValue = [{
|
|
55
117
|
conditionItem: [{
|
|
56
118
|
arguments: null,
|
|
@@ -67,9 +129,187 @@ var ConditionExpression = function ConditionExpression(_ref) {
|
|
|
67
129
|
_ref$showParameter = _ref.showParameter,
|
|
68
130
|
showParameter = _ref$showParameter === void 0 ? true : _ref$showParameter,
|
|
69
131
|
parameterOptions = _ref.parameterOptions,
|
|
132
|
+
parameterOptionsRequest = _ref.parameterOptionsRequest,
|
|
133
|
+
_ref$parameterOptions = _ref.parameterOptionsPageSize,
|
|
134
|
+
parameterOptionsPageSize = _ref$parameterOptions === void 0 ? DEFAULT_PARAMETER_OPTIONS_PAGE_SIZE : _ref$parameterOptions,
|
|
70
135
|
labelInValue = _ref.labelInValue,
|
|
71
136
|
canFrontFilter = _ref.canFrontFilter,
|
|
72
137
|
frontendFilterOptionFun = _ref.frontendFilterOptionFun;
|
|
138
|
+
var isRemoteParameterOptions = !!parameterOptionsRequest;
|
|
139
|
+
var conditionExpressionStructureKey = getConditionExpressionStructureKey(value);
|
|
140
|
+
var _useState = useState({}),
|
|
141
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
142
|
+
remoteParameterOptionsMap = _useState2[0],
|
|
143
|
+
setRemoteParameterOptionsMap = _useState2[1];
|
|
144
|
+
var remoteParameterOptionsMapRef = useRef({});
|
|
145
|
+
var remoteParameterOptionsStructureKeyRef = useRef(conditionExpressionStructureKey);
|
|
146
|
+
var syncRemoteParameterOptionsStructure = useCallback(function () {
|
|
147
|
+
if (remoteParameterOptionsStructureKeyRef.current === conditionExpressionStructureKey) {
|
|
148
|
+
return remoteParameterOptionsMapRef.current;
|
|
149
|
+
}
|
|
150
|
+
remoteParameterOptionsStructureKeyRef.current = conditionExpressionStructureKey;
|
|
151
|
+
remoteParameterOptionsMapRef.current = {};
|
|
152
|
+
setRemoteParameterOptionsMap({});
|
|
153
|
+
return {};
|
|
154
|
+
}, [conditionExpressionStructureKey]);
|
|
155
|
+
useEffect(function () {
|
|
156
|
+
syncRemoteParameterOptionsStructure();
|
|
157
|
+
}, [syncRemoteParameterOptionsStructure]);
|
|
158
|
+
var updateRemoteParameterOptionsState = useCallback(function (remoteKey, updater) {
|
|
159
|
+
var currentState = remoteParameterOptionsMapRef.current[remoteKey] || createRemoteParameterOptionsState();
|
|
160
|
+
var nextStateMap = _objectSpread(_objectSpread({}, remoteParameterOptionsMapRef.current), {}, _defineProperty({}, remoteKey, updater(currentState)));
|
|
161
|
+
remoteParameterOptionsMapRef.current = nextStateMap;
|
|
162
|
+
setRemoteParameterOptionsMap(nextStateMap);
|
|
163
|
+
}, []);
|
|
164
|
+
var loadRemoteParameterOptions = useCallback( /*#__PURE__*/function () {
|
|
165
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
|
|
166
|
+
var page, _ref2$keyword, keyword, reset, force, groupIndex, conditionIndex, remoteKey, remoteParameterOptionsStateMap, currentState, fetchId, result, latestState, _normalizeParameterOp, options, total, hasMore, nextOptions, nextHasMore, _latestState;
|
|
167
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
168
|
+
while (1) switch (_context.prev = _context.next) {
|
|
169
|
+
case 0:
|
|
170
|
+
page = _ref2.page, _ref2$keyword = _ref2.keyword, keyword = _ref2$keyword === void 0 ? '' : _ref2$keyword, reset = _ref2.reset, force = _ref2.force, groupIndex = _ref2.groupIndex, conditionIndex = _ref2.conditionIndex;
|
|
171
|
+
remoteKey = getRemoteParameterOptionsKey(groupIndex, conditionIndex);
|
|
172
|
+
remoteParameterOptionsStateMap = syncRemoteParameterOptionsStructure();
|
|
173
|
+
currentState = remoteParameterOptionsStateMap[remoteKey] || createRemoteParameterOptionsState();
|
|
174
|
+
if (!(!parameterOptionsRequest || currentState.loading && !force)) {
|
|
175
|
+
_context.next = 6;
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
return _context.abrupt("return");
|
|
179
|
+
case 6:
|
|
180
|
+
fetchId = currentState.fetchId + 1;
|
|
181
|
+
updateRemoteParameterOptionsState(remoteKey, function (state) {
|
|
182
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
183
|
+
loading: true,
|
|
184
|
+
fetchId: fetchId
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
_context.prev = 8;
|
|
188
|
+
_context.next = 11;
|
|
189
|
+
return parameterOptionsRequest({
|
|
190
|
+
page: page,
|
|
191
|
+
pageSize: parameterOptionsPageSize,
|
|
192
|
+
keyword: keyword,
|
|
193
|
+
groupIndex: groupIndex,
|
|
194
|
+
conditionIndex: conditionIndex
|
|
195
|
+
});
|
|
196
|
+
case 11:
|
|
197
|
+
result = _context.sent;
|
|
198
|
+
latestState = remoteParameterOptionsMapRef.current[remoteKey] || createRemoteParameterOptionsState();
|
|
199
|
+
if (!(fetchId !== latestState.fetchId)) {
|
|
200
|
+
_context.next = 15;
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
return _context.abrupt("return");
|
|
204
|
+
case 15:
|
|
205
|
+
_normalizeParameterOp = normalizeParameterOptionsResult(result), options = _normalizeParameterOp.options, total = _normalizeParameterOp.total, hasMore = _normalizeParameterOp.hasMore;
|
|
206
|
+
nextOptions = reset ? options : mergeOptions(latestState.options, options);
|
|
207
|
+
nextHasMore = typeof hasMore === 'boolean' ? hasMore : typeof total === 'number' ? nextOptions.length < total : options.length >= parameterOptionsPageSize;
|
|
208
|
+
updateRemoteParameterOptionsState(remoteKey, function (state) {
|
|
209
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
210
|
+
options: nextOptions,
|
|
211
|
+
page: page,
|
|
212
|
+
keyword: keyword,
|
|
213
|
+
hasMore: nextHasMore
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
_context.next = 23;
|
|
217
|
+
break;
|
|
218
|
+
case 21:
|
|
219
|
+
_context.prev = 21;
|
|
220
|
+
_context.t0 = _context["catch"](8);
|
|
221
|
+
case 23:
|
|
222
|
+
_context.prev = 23;
|
|
223
|
+
_latestState = remoteParameterOptionsMapRef.current[remoteKey] || createRemoteParameterOptionsState();
|
|
224
|
+
if (fetchId === _latestState.fetchId) {
|
|
225
|
+
updateRemoteParameterOptionsState(remoteKey, function (state) {
|
|
226
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
227
|
+
loading: false
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
return _context.finish(23);
|
|
232
|
+
case 27:
|
|
233
|
+
case "end":
|
|
234
|
+
return _context.stop();
|
|
235
|
+
}
|
|
236
|
+
}, _callee, null, [[8, 21, 23, 27]]);
|
|
237
|
+
}));
|
|
238
|
+
return function (_x) {
|
|
239
|
+
return _ref3.apply(this, arguments);
|
|
240
|
+
};
|
|
241
|
+
}(), [parameterOptionsPageSize, parameterOptionsRequest, syncRemoteParameterOptionsStructure, updateRemoteParameterOptionsState]);
|
|
242
|
+
var debounceRemoteSearch = useMemo(function () {
|
|
243
|
+
return debounce(function (keyword, indexList) {
|
|
244
|
+
var remoteKey = getRemoteParameterOptionsKey(indexList[0], indexList[1]);
|
|
245
|
+
updateRemoteParameterOptionsState(remoteKey, function (state) {
|
|
246
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
247
|
+
options: [],
|
|
248
|
+
page: 0,
|
|
249
|
+
keyword: keyword,
|
|
250
|
+
hasMore: true
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
loadRemoteParameterOptions({
|
|
254
|
+
page: 1,
|
|
255
|
+
keyword: keyword,
|
|
256
|
+
reset: true,
|
|
257
|
+
force: true,
|
|
258
|
+
groupIndex: indexList[0],
|
|
259
|
+
conditionIndex: indexList[1]
|
|
260
|
+
});
|
|
261
|
+
}, 500);
|
|
262
|
+
}, [loadRemoteParameterOptions, updateRemoteParameterOptionsState]);
|
|
263
|
+
useEffect(function () {
|
|
264
|
+
return function () {
|
|
265
|
+
debounceRemoteSearch.cancel();
|
|
266
|
+
};
|
|
267
|
+
}, [debounceRemoteSearch]);
|
|
268
|
+
var handleRemoteOpenChange = function handleRemoteOpenChange(open, indexList) {
|
|
269
|
+
var remoteKey = getRemoteParameterOptionsKey(indexList[0], indexList[1]);
|
|
270
|
+
var remoteParameterOptionsStateMap = syncRemoteParameterOptionsStructure();
|
|
271
|
+
var currentState = remoteParameterOptionsStateMap[remoteKey] || createRemoteParameterOptionsState();
|
|
272
|
+
if (!open || !isRemoteParameterOptions || currentState.page > 0 || currentState.loading) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
loadRemoteParameterOptions({
|
|
276
|
+
page: 1,
|
|
277
|
+
keyword: currentState.keyword,
|
|
278
|
+
reset: true,
|
|
279
|
+
groupIndex: indexList[0],
|
|
280
|
+
conditionIndex: indexList[1]
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
var handleRemotePopupScroll = function handleRemotePopupScroll(event, indexList) {
|
|
284
|
+
var remoteKey = getRemoteParameterOptionsKey(indexList[0], indexList[1]);
|
|
285
|
+
var remoteParameterOptionsStateMap = syncRemoteParameterOptionsStructure();
|
|
286
|
+
var currentState = remoteParameterOptionsStateMap[remoteKey] || createRemoteParameterOptionsState();
|
|
287
|
+
if (!isRemoteParameterOptions || currentState.loading || !currentState.hasMore) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
var target = event.target;
|
|
291
|
+
var isBottom = target.scrollTop + target.offsetHeight >= target.scrollHeight - 20;
|
|
292
|
+
if (!isBottom) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
loadRemoteParameterOptions({
|
|
296
|
+
page: currentState.page + 1,
|
|
297
|
+
keyword: currentState.keyword,
|
|
298
|
+
groupIndex: indexList[0],
|
|
299
|
+
conditionIndex: indexList[1]
|
|
300
|
+
});
|
|
301
|
+
};
|
|
302
|
+
var getRemotePopupRender = function getRemotePopupRender(menu, loading) {
|
|
303
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
304
|
+
children: [menu, loading && /*#__PURE__*/_jsx("div", {
|
|
305
|
+
className: "condition-select-loading",
|
|
306
|
+
children: /*#__PURE__*/_jsx(Spin, {
|
|
307
|
+
size: "small"
|
|
308
|
+
})
|
|
309
|
+
})]
|
|
310
|
+
});
|
|
311
|
+
};
|
|
312
|
+
|
|
73
313
|
/** 添加条件触发 */
|
|
74
314
|
var addExpression = function addExpression(index) {
|
|
75
315
|
var _conditionExpressionItem = value.map(function (e, i) {
|
|
@@ -113,7 +353,11 @@ var ConditionExpression = function ConditionExpression(_ref) {
|
|
|
113
353
|
/** 数据变化时调用 */
|
|
114
354
|
var dataChange = function dataChange(type, data, index) {
|
|
115
355
|
var _conditionExpressionItem = cloneDeep(value);
|
|
116
|
-
type === 'logicOperatorByGroup'
|
|
356
|
+
if (type === 'logicOperatorByGroup') {
|
|
357
|
+
_conditionExpressionItem[index[0]]['logicOperator'] = data;
|
|
358
|
+
} else {
|
|
359
|
+
_conditionExpressionItem[index[0]].conditionItem[index[1]][type] = data;
|
|
360
|
+
}
|
|
117
361
|
onChange === null || onChange === void 0 || onChange(_conditionExpressionItem);
|
|
118
362
|
};
|
|
119
363
|
|
|
@@ -159,10 +403,11 @@ var ConditionExpression = function ConditionExpression(_ref) {
|
|
|
159
403
|
})
|
|
160
404
|
});
|
|
161
405
|
};
|
|
162
|
-
var getConditionExpressionItem = function getConditionExpressionItem(item, index
|
|
406
|
+
var getConditionExpressionItem = function getConditionExpressionItem(item, index) {
|
|
407
|
+
var _value$index$5;
|
|
163
408
|
return /*#__PURE__*/_jsxs("div", {
|
|
164
409
|
className: 'condition-all',
|
|
165
|
-
children: [
|
|
410
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
166
411
|
className: "condition-all-content",
|
|
167
412
|
children: /*#__PURE__*/_jsxs("div", {
|
|
168
413
|
className: 'condition-all-undelete',
|
|
@@ -173,11 +418,11 @@ var ConditionExpression = function ConditionExpression(_ref) {
|
|
|
173
418
|
var _option$label;
|
|
174
419
|
return ((_option$label = option === null || option === void 0 ? void 0 : option.label) !== null && _option$label !== void 0 ? _option$label : '').toLowerCase().includes(input.toLowerCase());
|
|
175
420
|
};
|
|
421
|
+
var remoteKey = getRemoteParameterOptionsKey(index[0], i);
|
|
422
|
+
var remoteParameterOptionsState = remoteParameterOptionsMap[remoteKey] || createRemoteParameterOptionsState();
|
|
423
|
+
var mergedParameterOptions = mergeOptions(parameterOptions || [], remoteParameterOptionsState.options);
|
|
176
424
|
return /*#__PURE__*/_jsxs("div", {
|
|
177
|
-
|
|
178
|
-
display: 'flex',
|
|
179
|
-
alignItems: 'center'
|
|
180
|
-
},
|
|
425
|
+
className: 'condition-item-row',
|
|
181
426
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
182
427
|
className: 'condition-item',
|
|
183
428
|
children: [showParameter && /*#__PURE__*/_jsx("div", {
|
|
@@ -188,13 +433,29 @@ var ConditionExpression = function ConditionExpression(_ref) {
|
|
|
188
433
|
},
|
|
189
434
|
value: value === null || value === void 0 || (_value$index$ = value[index[0]]) === null || _value$index$ === void 0 || (_value$index$ = _value$index$.conditionItem[i]) === null || _value$index$ === void 0 ? void 0 : _value$index$.arguments,
|
|
190
435
|
placeholder: '请选择参数',
|
|
191
|
-
options:
|
|
436
|
+
options: mergedParameterOptions,
|
|
192
437
|
labelInValue: labelInValue,
|
|
193
438
|
onSelect: function onSelect(data) {
|
|
194
439
|
return dataChange('arguments', data, [index[0], i]);
|
|
195
440
|
},
|
|
196
|
-
showSearch: canFrontFilter,
|
|
197
|
-
|
|
441
|
+
showSearch: isRemoteParameterOptions || canFrontFilter,
|
|
442
|
+
onSearch: isRemoteParameterOptions ? function (keyword) {
|
|
443
|
+
return debounceRemoteSearch(keyword, [index[0], i]);
|
|
444
|
+
} : undefined,
|
|
445
|
+
onOpenChange: isRemoteParameterOptions ? function (open) {
|
|
446
|
+
return handleRemoteOpenChange(open, [index[0], i]);
|
|
447
|
+
} : undefined,
|
|
448
|
+
onPopupScroll: isRemoteParameterOptions ? function (event) {
|
|
449
|
+
return handleRemotePopupScroll(event, [index[0], i]);
|
|
450
|
+
} : undefined,
|
|
451
|
+
loading: remoteParameterOptionsState.loading,
|
|
452
|
+
notFoundContent: isRemoteParameterOptions && remoteParameterOptionsState.loading ? /*#__PURE__*/_jsx(Spin, {
|
|
453
|
+
size: "small"
|
|
454
|
+
}) : null,
|
|
455
|
+
popupRender: isRemoteParameterOptions ? function (menu) {
|
|
456
|
+
return getRemotePopupRender(menu, remoteParameterOptionsState.loading);
|
|
457
|
+
} : undefined,
|
|
458
|
+
filterOption: isRemoteParameterOptions ? false : canFrontFilter || frontendFilterOptionFun ? frontendFilterOptionFun || frontendFilterOption : true
|
|
198
459
|
})
|
|
199
460
|
}), /*#__PURE__*/_jsx("div", {
|
|
200
461
|
className: 'condition-select-middle',
|
|
@@ -244,7 +505,7 @@ var ConditionExpression = function ConditionExpression(_ref) {
|
|
|
244
505
|
})
|
|
245
506
|
})]
|
|
246
507
|
})
|
|
247
|
-
}), value.length > 1 && /*#__PURE__*/_jsx(CloseOutlined, {
|
|
508
|
+
}), (value === null || value === void 0 || (_value$index$5 = value[index[0]]) === null || _value$index$5 === void 0 ? void 0 : _value$index$5.logicOperator) && conditionLink(value === null || value === void 0 ? void 0 : value[index[0]].logicOperator, 'logicOperatorByGroup', [index[0]]), value.length > 1 && /*#__PURE__*/_jsx(CloseOutlined, {
|
|
248
509
|
className: "condition-del",
|
|
249
510
|
onClick: function onClick() {
|
|
250
511
|
return delOnClick(index);
|
|
@@ -255,7 +516,7 @@ var ConditionExpression = function ConditionExpression(_ref) {
|
|
|
255
516
|
return /*#__PURE__*/_jsxs("div", {
|
|
256
517
|
className: 'condition-expression-item',
|
|
257
518
|
children: [value === null || value === void 0 ? void 0 : value.map(function (e, index) {
|
|
258
|
-
return getConditionExpressionItem(e.conditionItem, [index]
|
|
519
|
+
return getConditionExpressionItem(e.conditionItem, [index]);
|
|
259
520
|
}), /*#__PURE__*/_jsx(Button, {
|
|
260
521
|
onClick: addGroup,
|
|
261
522
|
className: 'condition-add-group',
|
|
@@ -23,21 +23,29 @@
|
|
|
23
23
|
/* 添加相对定位 */
|
|
24
24
|
.condition-all-undelete {
|
|
25
25
|
display: flex;
|
|
26
|
-
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
align-items: flex-start;
|
|
28
|
+
gap: 6px;
|
|
27
29
|
position: relative;
|
|
28
30
|
border-radius: 6px;
|
|
29
31
|
padding: 6px 8px 6px 6px;
|
|
30
32
|
|
|
33
|
+
.condition-item-row {
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
width: 100%;
|
|
37
|
+
}
|
|
38
|
+
|
|
31
39
|
.condition-item {
|
|
32
40
|
display: flex;
|
|
33
41
|
align-items: center;
|
|
34
42
|
position: relative;
|
|
35
43
|
padding-right: 8px;
|
|
44
|
+
flex: 0 0 auto;
|
|
36
45
|
|
|
37
46
|
.condition-select-left {
|
|
38
47
|
padding-right: 4px;
|
|
39
|
-
|
|
40
|
-
max-width: 300px;
|
|
48
|
+
width: 240px;
|
|
41
49
|
}
|
|
42
50
|
|
|
43
51
|
.condition-select-middle {
|
|
@@ -74,6 +82,10 @@
|
|
|
74
82
|
}
|
|
75
83
|
|
|
76
84
|
.condition-add {
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
height: 24px;
|
|
88
|
+
|
|
77
89
|
i {
|
|
78
90
|
font-size: 20px;
|
|
79
91
|
cursor: pointer;
|
|
@@ -107,6 +119,17 @@
|
|
|
107
119
|
}
|
|
108
120
|
|
|
109
121
|
.condition-link {
|
|
122
|
+
flex: 0 0 88px;
|
|
123
|
+
margin-left: 8px;
|
|
110
124
|
padding-right: 8px;
|
|
125
|
+
|
|
126
|
+
.ant-select {
|
|
127
|
+
width: 72px;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.condition-select-loading {
|
|
132
|
+
padding: 8px 0;
|
|
133
|
+
text-align: center;
|
|
111
134
|
}
|
|
112
|
-
}
|
|
135
|
+
}
|
|
@@ -748,7 +748,12 @@ var CustomForm = function CustomForm(_ref, ref) {
|
|
|
748
748
|
case CustomFormItemType.ConditionExpression:
|
|
749
749
|
element = /*#__PURE__*/_jsx(ConditionExpression, {
|
|
750
750
|
showParameter: item === null || item === void 0 ? void 0 : item.showParameter,
|
|
751
|
-
parameterOptions: (item === null || item === void 0 ? void 0 : item.setting) || []
|
|
751
|
+
parameterOptions: (item === null || item === void 0 ? void 0 : item.setting) || [],
|
|
752
|
+
labelInValue: item === null || item === void 0 ? void 0 : item.labelInValue,
|
|
753
|
+
canFrontFilter: item === null || item === void 0 ? void 0 : item.canFrontFilter,
|
|
754
|
+
frontendFilterOptionFun: item === null || item === void 0 ? void 0 : item.frontendFilterOptionFun,
|
|
755
|
+
parameterOptionsRequest: item === null || item === void 0 ? void 0 : item.parameterOptionsRequest,
|
|
756
|
+
parameterOptionsPageSize: item === null || item === void 0 ? void 0 : item.parameterOptionsPageSize
|
|
752
757
|
});
|
|
753
758
|
break;
|
|
754
759
|
case CustomFormItemType.RemoteSelect:
|
|
@@ -2,6 +2,7 @@ import type { TimePickerProps, TimeRangePickerProps, GetProps } from 'antd';
|
|
|
2
2
|
import { FormProps, DatePicker } from 'antd';
|
|
3
3
|
import { FormLabelAlign } from 'antd/es/form/interface';
|
|
4
4
|
import { MouseEventHandler, ReactNode } from 'react';
|
|
5
|
+
import type { ConditionExpressionParameterOptionsRequestParams, ConditionExpressionParameterOptionsRequestResult } from '../ConditionExpression';
|
|
5
6
|
type RangePickerProps = GetProps<typeof DatePicker.RangePicker>;
|
|
6
7
|
export interface fieldType {
|
|
7
8
|
field: string;
|
|
@@ -86,7 +87,7 @@ export type CustomSearchFieldType = {
|
|
|
86
87
|
max?: number;
|
|
87
88
|
step?: number;
|
|
88
89
|
precision?: number;
|
|
89
|
-
showSearch?: boolean |
|
|
90
|
+
showSearch?: boolean | object;
|
|
90
91
|
handleSearch?: () => void;
|
|
91
92
|
suffix?: string;
|
|
92
93
|
isFilter?: boolean;
|
|
@@ -105,6 +106,14 @@ export type CustomSearchFieldType = {
|
|
|
105
106
|
extra?: ReactNode;
|
|
106
107
|
unit?: string;
|
|
107
108
|
tooltip?: string;
|
|
109
|
+
/**conditionExpression组件获取参数options函数 */
|
|
110
|
+
parameterOptionsRequest?: (params: ConditionExpressionParameterOptionsRequestParams) => Promise<ConditionExpressionParameterOptionsRequestResult>;
|
|
111
|
+
/**conditionExpression组件获取参数options每页条数 */
|
|
112
|
+
parameterOptionsPageSize?: number;
|
|
113
|
+
/**conditionExpression组件是否支持前端筛选 */
|
|
114
|
+
canFrontFilter?: boolean;
|
|
115
|
+
/**conditionExpression组件前端筛选函数 */
|
|
116
|
+
frontendFilterOptionFun?: (input: any, option: any) => boolean;
|
|
108
117
|
/**remoteSelect组件获取options函数 */
|
|
109
118
|
getOptionsFn?: (keyword: string) => Promise<any[]>;
|
|
110
119
|
/**自定义节点 label、value、options、groupLabel 的字段 */
|
|
@@ -79,7 +79,16 @@ var OriginalRow = function OriginalRow(_ref) {
|
|
|
79
79
|
dateFormat = _useConfig.dateFormat;
|
|
80
80
|
var timerRef = useRef();
|
|
81
81
|
var clickCountRef = useRef(0);
|
|
82
|
-
|
|
82
|
+
// const [tooltipOpen, setTooltipOpen] = useState(false);
|
|
83
|
+
var _useState = useState({}),
|
|
84
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
85
|
+
tooltipStates = _useState2[0],
|
|
86
|
+
setTooltipStates = _useState2[1];
|
|
87
|
+
var handleTooltipChange = function handleTooltipChange(cellId, open) {
|
|
88
|
+
setTooltipStates(function (prev) {
|
|
89
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, cellId, open));
|
|
90
|
+
});
|
|
91
|
+
};
|
|
83
92
|
// 优化:使用useMemo缓存计算结果
|
|
84
93
|
var dropPreviewLineClassName = useMemo(function () {
|
|
85
94
|
if (hoverRowIndex === row.index) {
|
|
@@ -177,6 +186,7 @@ var OriginalRow = function OriginalRow(_ref) {
|
|
|
177
186
|
// 优化:分离单击和双击逻辑,避免定时器延迟
|
|
178
187
|
var handleRowClick = useCallback(function (evt) {
|
|
179
188
|
clickCountRef.current++;
|
|
189
|
+
setTooltipStates({});
|
|
180
190
|
if (clickCountRef.current === 1) {
|
|
181
191
|
timerRef.current = setTimeout(function () {
|
|
182
192
|
// 单击逻辑
|
|
@@ -297,13 +307,13 @@ var OriginalRow = function OriginalRow(_ref) {
|
|
|
297
307
|
var handleCellRightClick = useCallback(function (e, cell) {
|
|
298
308
|
onCellContextMenu(e, cell);
|
|
299
309
|
}, [onCellContextMenu]);
|
|
300
|
-
var
|
|
310
|
+
var _useState3 = useState({
|
|
301
311
|
title: ' ',
|
|
302
312
|
color: ''
|
|
303
313
|
}),
|
|
304
|
-
|
|
305
|
-
tooltipConfig =
|
|
306
|
-
setTooltipConfig =
|
|
314
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
315
|
+
tooltipConfig = _useState4[0],
|
|
316
|
+
setTooltipConfig = _useState4[1];
|
|
307
317
|
var onOpenChange = useCallback(function (open) {
|
|
308
318
|
if (open) {
|
|
309
319
|
setTooltipConfig((getRowHoverTipConfig === null || getRowHoverTipConfig === void 0 ? void 0 : getRowHoverTipConfig(row.original)) || {
|
|
@@ -377,6 +387,9 @@ var OriginalRow = function OriginalRow(_ref) {
|
|
|
377
387
|
}, getCellProps === null || getCellProps === void 0 ? void 0 : getCellProps(cell.getContext())), {}, {
|
|
378
388
|
children: EditableCell(_objectSpread(_objectSpread({}, cell.column.columnDef), {}, {
|
|
379
389
|
tableTooltip: tableTooltip,
|
|
390
|
+
cellId: cell.id,
|
|
391
|
+
tooltipOpen: tooltipStates[cell.id] || false,
|
|
392
|
+
onTooltipChange: handleTooltipChange,
|
|
380
393
|
editing: columnEditing,
|
|
381
394
|
dataIndex: accessorKey,
|
|
382
395
|
title: header,
|
|
@@ -409,7 +422,7 @@ var OriginalRow = function OriginalRow(_ref) {
|
|
|
409
422
|
}
|
|
410
423
|
}, [
|
|
411
424
|
// 依赖项保持不变
|
|
412
|
-
row, row.id, rowEditing, tableId, editting, canRowDrag, disableDragRowIds, isDragging, selectedRowDragging, rowStyle, handleRowClick, rowMouseEnter, rowMouseLeave, rowClassNames, cellClassName, theme, table, handleCellRightClick, getCellProps, tableTooltip, onEditValueChange, dateFormat, row.getVisibleCells(), row.getIsSelected(), row.getIsExpanded()]);
|
|
425
|
+
row, row.id, rowEditing, tableId, editting, canRowDrag, disableDragRowIds, isDragging, selectedRowDragging, rowStyle, handleRowClick, rowMouseEnter, rowMouseLeave, rowClassNames, cellClassName, theme, table, handleCellRightClick, getCellProps, tableTooltip, onEditValueChange, dateFormat, row.getVisibleCells(), row.getIsSelected(), row.getIsExpanded(), tooltipStates]);
|
|
413
426
|
var rowCom = function rowCom() {
|
|
414
427
|
var renderCell = function renderCell(cell) {
|
|
415
428
|
var _cellClassName2;
|
|
@@ -449,6 +462,9 @@ var OriginalRow = function OriginalRow(_ref) {
|
|
|
449
462
|
}, getCellProps === null || getCellProps === void 0 ? void 0 : getCellProps(cell.getContext())), {}, {
|
|
450
463
|
children: EditableCell(_objectSpread(_objectSpread({}, cell.column.columnDef), {}, {
|
|
451
464
|
tableTooltip: tableTooltip,
|
|
465
|
+
cellId: cell.id,
|
|
466
|
+
tooltipOpen: tooltipStates[cell.id] || false,
|
|
467
|
+
onTooltipChange: handleTooltipChange,
|
|
452
468
|
editing: columnEditing,
|
|
453
469
|
dataIndex: accessorKey,
|
|
454
470
|
title: header,
|
|
@@ -80,6 +80,15 @@ var VirtualRow = function VirtualRow(_ref) {
|
|
|
80
80
|
dateFormat = _useConfig.dateFormat;
|
|
81
81
|
var timerRef = useRef();
|
|
82
82
|
var clickCountRef = useRef(0);
|
|
83
|
+
var _useState = useState({}),
|
|
84
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
85
|
+
tooltipStates = _useState2[0],
|
|
86
|
+
setTooltipStates = _useState2[1];
|
|
87
|
+
var handleTooltipChange = function handleTooltipChange(cellId, open) {
|
|
88
|
+
setTooltipStates(function (prev) {
|
|
89
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, cellId, open));
|
|
90
|
+
});
|
|
91
|
+
};
|
|
83
92
|
|
|
84
93
|
// 拖拽时的鼠标位置跟踪
|
|
85
94
|
var dragStartPosRef = useRef(null);
|
|
@@ -227,6 +236,7 @@ var VirtualRow = function VirtualRow(_ref) {
|
|
|
227
236
|
// 点击事件处理逻辑
|
|
228
237
|
var handleRowClick = useCallback(function (evt) {
|
|
229
238
|
clickCountRef.current++;
|
|
239
|
+
setTooltipStates({});
|
|
230
240
|
if (clickCountRef.current === 1) {
|
|
231
241
|
timerRef.current = setTimeout(function () {
|
|
232
242
|
if (clickCountRef.current === 1) {
|
|
@@ -344,13 +354,13 @@ var VirtualRow = function VirtualRow(_ref) {
|
|
|
344
354
|
var rowMouseLeave = useCallback(function () {
|
|
345
355
|
onRowMouseLeave === null || onRowMouseLeave === void 0 || onRowMouseLeave(row);
|
|
346
356
|
}, [row, onRowMouseLeave]);
|
|
347
|
-
var
|
|
357
|
+
var _useState3 = useState({
|
|
348
358
|
title: ' ',
|
|
349
359
|
color: ''
|
|
350
360
|
}),
|
|
351
|
-
|
|
352
|
-
tooltipConfig =
|
|
353
|
-
setTooltipConfig =
|
|
361
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
362
|
+
tooltipConfig = _useState4[0],
|
|
363
|
+
setTooltipConfig = _useState4[1];
|
|
354
364
|
var onOpenChange = useCallback(function (open) {
|
|
355
365
|
if (open) {
|
|
356
366
|
setTooltipConfig((getRowHoverTipConfig === null || getRowHoverTipConfig === void 0 ? void 0 : getRowHoverTipConfig(row.original)) || {
|
|
@@ -425,6 +435,9 @@ var VirtualRow = function VirtualRow(_ref) {
|
|
|
425
435
|
children: EditableCell(_objectSpread(_objectSpread({}, cell.column.columnDef), {}, {
|
|
426
436
|
width: cell.column.getSize(),
|
|
427
437
|
tableTooltip: tableTooltip,
|
|
438
|
+
cellId: cell.id,
|
|
439
|
+
tooltipOpen: tooltipStates[cell.id] || false,
|
|
440
|
+
onTooltipChange: handleTooltipChange,
|
|
428
441
|
editing: columnEditing,
|
|
429
442
|
dataIndex: accessorKey,
|
|
430
443
|
title: header,
|
|
@@ -452,7 +465,7 @@ var VirtualRow = function VirtualRow(_ref) {
|
|
|
452
465
|
console.error('Error rendering row:', error);
|
|
453
466
|
return null;
|
|
454
467
|
}
|
|
455
|
-
}, [row, row.id, rowEditing, tableId, editting, canRowDrag, disableDragRowIds, isDragging, selectedRowDragging, rowStyle, handleRowClick, rowMouseEnter, rowMouseLeave, rowClassNames, cellClassName, theme, table, handleCellRightClick, getCellProps, tableTooltip, onEditValueChange, dateFormat, rowStyles, row.getVisibleCells(), row.getIsSelected(), row.getIsExpanded(), table.getState().columnSizing]);
|
|
468
|
+
}, [row, row.id, rowEditing, tableId, editting, canRowDrag, disableDragRowIds, isDragging, selectedRowDragging, rowStyle, handleRowClick, rowMouseEnter, rowMouseLeave, rowClassNames, cellClassName, theme, table, handleCellRightClick, getCellProps, tableTooltip, onEditValueChange, dateFormat, rowStyles, row.getVisibleCells(), row.getIsSelected(), row.getIsExpanded(), table.getState().columnSizing, tooltipStates, handleTooltipChange]);
|
|
456
469
|
var rowCom = function rowCom() {
|
|
457
470
|
var renderCell = function renderCell(cell) {
|
|
458
471
|
var _cellClassName2;
|
|
@@ -493,6 +506,9 @@ var VirtualRow = function VirtualRow(_ref) {
|
|
|
493
506
|
children: EditableCell(_objectSpread(_objectSpread({}, cell.column.columnDef), {}, {
|
|
494
507
|
width: cell.column.getSize(),
|
|
495
508
|
tableTooltip: tableTooltip,
|
|
509
|
+
cellId: cell.id,
|
|
510
|
+
tooltipOpen: tooltipStates[cell.id] || false,
|
|
511
|
+
onTooltipChange: handleTooltipChange,
|
|
496
512
|
editing: columnEditing,
|
|
497
513
|
dataIndex: accessorKey,
|
|
498
514
|
title: header,
|
|
@@ -20,7 +20,7 @@ import { Tooltip } from 'antd';
|
|
|
20
20
|
import { useMemo } from 'react';
|
|
21
21
|
import { useDrag, useDrop } from 'react-dnd';
|
|
22
22
|
import { useConfig } from "../../ConfigProvider";
|
|
23
|
-
import { ColumnType } from "../
|
|
23
|
+
import { ColumnType } from "../index";
|
|
24
24
|
import { ColumnFilter } from "../components/ColumnFilterV2";
|
|
25
25
|
import Sort from "../components/ColumnSort";
|
|
26
26
|
import "./index.less";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './tableMax.less';
|
|
3
|
-
import { type TableMaxProps } from './
|
|
3
|
+
import { type TableMaxProps } from './index';
|
|
4
4
|
export type ColumnSizing = Record<string, number>;
|
|
5
5
|
export declare const CACHE_MAX_AGE: number;
|
|
6
6
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<TableMaxProps & React.RefAttributes<unknown>>>;
|
|
@@ -35,7 +35,7 @@ import customSortFns, { setDefaultSortFn } from "./components/ColumnSort/customS
|
|
|
35
35
|
import PaginationV2 from "./components/PaginationV2";
|
|
36
36
|
import { useColumnWidth } from "./hooks/useColumnWidth";
|
|
37
37
|
import "./tableMax.less";
|
|
38
|
-
import { ColumnType } from "./
|
|
38
|
+
import { ColumnType } from "./index";
|
|
39
39
|
import { downloadExcel, getFormatFilters, getFormatFiltersV2, getFormatSorting, operationColumnNoTooltips } from "./utils";
|
|
40
40
|
import { useTableScrollShadow } from "./hooks/useTableScrollShadow";
|
|
41
41
|
import { ExportTableData } from "./components/Export";
|
|
@@ -30,6 +30,9 @@ interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
30
30
|
editComDisabled?: boolean;
|
|
31
31
|
onEditValueChange?: (field: string, value: any, extra?: any) => void;
|
|
32
32
|
width?: number;
|
|
33
|
+
tooltipOpen?: boolean;
|
|
34
|
+
onTooltipChange?: (cellId: string, open: boolean) => void;
|
|
35
|
+
cellId?: string;
|
|
33
36
|
}
|
|
34
37
|
export declare const EditableCell: React.FC<EditableCellProps>;
|
|
35
38
|
export {};
|
|
@@ -32,7 +32,14 @@ export var EditableCell = function EditableCell(_ref) {
|
|
|
32
32
|
_ref$editComDisabled = _ref.editComDisabled,
|
|
33
33
|
editComDisabled = _ref$editComDisabled === void 0 ? false : _ref$editComDisabled,
|
|
34
34
|
onEditValueChange = _ref.onEditValueChange,
|
|
35
|
-
width = _ref.width
|
|
35
|
+
width = _ref.width,
|
|
36
|
+
tooltipOpen = _ref.tooltipOpen,
|
|
37
|
+
onTooltipChange = _ref.onTooltipChange,
|
|
38
|
+
cellId = _ref.cellId;
|
|
39
|
+
// const [tooltipOpen, setTooltipOpen] = useState(false);
|
|
40
|
+
// const handleClick = () => {
|
|
41
|
+
// setTooltipOpen(false); // 点击时关闭 tooltip
|
|
42
|
+
// };
|
|
36
43
|
var getEditComponent = function getEditComponent(dataIndex) {
|
|
37
44
|
switch (editComType) {
|
|
38
45
|
case InputType.InputNumber:
|
|
@@ -122,9 +129,14 @@ export var EditableCell = function EditableCell(_ref) {
|
|
|
122
129
|
}) : ((_ref2 = ellipsis !== null && ellipsis !== void 0 ? ellipsis : columnTooltip) !== null && _ref2 !== void 0 ? _ref2 : tableTooltip) ? /*#__PURE__*/_jsx(Tooltip, {
|
|
123
130
|
placement: "top",
|
|
124
131
|
title: children,
|
|
125
|
-
mouseEnterDelay: 0.5
|
|
126
|
-
|
|
127
|
-
|
|
132
|
+
mouseEnterDelay: 0.5,
|
|
133
|
+
open: tooltipOpen,
|
|
134
|
+
onOpenChange: function onOpenChange(open) {
|
|
135
|
+
return onTooltipChange(cellId, open);
|
|
136
|
+
},
|
|
137
|
+
getPopupContainer: function getPopupContainer() {
|
|
138
|
+
return document.body;
|
|
139
|
+
},
|
|
128
140
|
overlayClassName: "tableMaxCellTooltip",
|
|
129
141
|
children: /*#__PURE__*/_jsx("div", {
|
|
130
142
|
className: "ellipsis",
|
|
@@ -14,7 +14,7 @@ import React, { useEffect, useLayoutEffect, useMemo, useRef, useState } from 're
|
|
|
14
14
|
import { useDrag, useDrop } from 'react-dnd';
|
|
15
15
|
import { createPortal } from 'react-dom';
|
|
16
16
|
import { useConfig } from "../../../ConfigProvider";
|
|
17
|
-
import { ColumnType } from "../../
|
|
17
|
+
import { ColumnType } from "../../index";
|
|
18
18
|
import "./index.less";
|
|
19
19
|
import { useTranslation } from "../../../../hooks/useTranslation";
|
|
20
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -16,7 +16,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16
16
|
import { useCallback, useState, useRef } from 'react';
|
|
17
17
|
import * as XLSX from 'xlsx';
|
|
18
18
|
import { message } from 'antd';
|
|
19
|
-
import { ColumnType } from "../../
|
|
19
|
+
import { ColumnType } from "../../index";
|
|
20
20
|
var defaultApplyCellLogic = function defaultApplyCellLogic(value, columnId, originalRow, column) {
|
|
21
21
|
var cell = column.cell,
|
|
22
22
|
accessorKey = column.accessorKey,
|
|
@@ -58,7 +58,6 @@ var defaultApplyCellLogic = function defaultApplyCellLogic(value, columnId, orig
|
|
|
58
58
|
}
|
|
59
59
|
return value !== null && value !== void 0 ? value : '';
|
|
60
60
|
};
|
|
61
|
-
var EnableExportColumnTypeList = [ColumnType.Selection, ColumnType.Darg, ColumnType.PlaceHolder, ColumnType.Expander, ColumnType.Index];
|
|
62
61
|
function fetchWithRetry(_x) {
|
|
63
62
|
return _fetchWithRetry.apply(this, arguments);
|
|
64
63
|
}
|
|
@@ -136,6 +135,7 @@ function _fetchWithRetry() {
|
|
|
136
135
|
return _fetchWithRetry.apply(this, arguments);
|
|
137
136
|
}
|
|
138
137
|
export var useTableExport = function useTableExport() {
|
|
138
|
+
var EnableExportColumnTypeList = [ColumnType.Selection, ColumnType.Darg, ColumnType.PlaceHolder, ColumnType.Expander, ColumnType.Index];
|
|
139
139
|
var _useState = useState(false),
|
|
140
140
|
_useState2 = _slicedToArray(_useState, 2),
|
|
141
141
|
exporting = _useState2[0],
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import TableMax from './TableMax';
|
|
2
|
-
export { ColumnType } from './type';
|
|
3
2
|
export { InputType } from './components/ColumnEdit';
|
|
4
3
|
export { FilterType } from './components/ColumnFilterV2';
|
|
5
4
|
export type { FilterFnType } from './components/ColumnFilterV2';
|
|
6
5
|
export type { SortFnType } from './components/ColumnSort/customSortFns';
|
|
7
|
-
export type
|
|
6
|
+
export { type ColumnPinningConfigType, type ColumnVisibleConfigType, type TableMaxColumnType, type TableMaxProps, ColumnType } from './type';
|
|
8
7
|
export default TableMax;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import TableMax from "./TableMax";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
// export { ColumnType } from './type';
|
|
3
4
|
export { InputType } from "./components/ColumnEdit";
|
|
4
5
|
export { FilterType } from "./components/ColumnFilterV2";
|
|
6
|
+
export { ColumnType } from "./type";
|
|
5
7
|
export default TableMax;
|