@arim-aisdc/public-components 2.3.96 → 2.3.98

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.
@@ -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
- label: any;
28
- value: any;
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' ? _conditionExpressionItem[index[0]]['logicOperator'] = data : _conditionExpressionItem[index[0]].conditionItem[index[1]][type] = data;
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, notFirst) {
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: [notFirst && conditionLink(value === null || value === void 0 ? void 0 : value[index[0] - 1].logicOperator, 'logicOperatorByGroup', [index[0] - 1]), /*#__PURE__*/_jsx("div", {
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
- style: {
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: parameterOptions,
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
- filterOption: canFrontFilter || frontendFilterOptionFun ? frontendFilterOptionFun || frontendFilterOption : true
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], index !== 0);
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
- align-items: center;
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
- min-width: 120px;
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
+ }
@@ -16,7 +16,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
16
16
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
17
17
  import { MinusOutlined } from '@ant-design/icons';
18
18
  import { useDebounceFn } from 'ahooks';
19
- import { AutoComplete, Badge, Button, Cascader, Checkbox, Col, DatePicker, Form, Input, InputNumber, Radio, Row, Select, Spin, Switch } from 'antd';
19
+ import { AutoComplete, Badge, Button, Cascader, Checkbox, Col, DatePicker, Form, Input, InputNumber, Radio, Row, Select, Spin, Switch, Tooltip } from 'antd';
20
20
  import dayjs from 'dayjs';
21
21
  import { debounce } from 'lodash';
22
22
  import React, { forwardRef, useEffect, useMemo, useState } from 'react';
@@ -319,6 +319,38 @@ var CustomForm = function CustomForm(_ref, ref) {
319
319
  maxTagCount: item.maxTagCount,
320
320
  optionFilterProp: item.optionFilterProp || 'value',
321
321
  optionLabelProp: item.optionLabelProp || 'children',
322
+ maxTagPlaceholder: item.maxTagPlaceholder || function (omittedValues) {
323
+ return /*#__PURE__*/_jsx(Tooltip, {
324
+ styles: {
325
+ root: {
326
+ pointerEvents: 'none'
327
+ }
328
+ },
329
+ title: omittedValues.map(function (_ref2) {
330
+ var label = _ref2.label;
331
+ if (typeof label === 'string' || typeof label === 'number') {
332
+ return String(label);
333
+ } else if ( /*#__PURE__*/React.isValidElement(label)) {
334
+ var _element = label;
335
+ var props = _element.props;
336
+
337
+ // 尝试提取文本
338
+ if ((props === null || props === void 0 ? void 0 : props.text) !== undefined) {
339
+ var text = props.text;
340
+ if (Array.isArray(text)) {
341
+ return text.join(', ');
342
+ }
343
+ return String(text);
344
+ }
345
+ } else {
346
+ return '';
347
+ }
348
+ }).join(', '),
349
+ children: /*#__PURE__*/_jsxs("span", {
350
+ children: ["+", omittedValues.length, "..."]
351
+ })
352
+ });
353
+ },
322
354
  children: (item === null || item === void 0 ? void 0 : item.setting) && Array.isArray(item.setting) && ((_item$setting2 = item.setting) === null || _item$setting2 === void 0 ? void 0 : _item$setting2.map(function (el, num) {
323
355
  var _el$options;
324
356
  if (el !== null && el !== void 0 && el.options && (el === null || el === void 0 || (_el$options = el.options) === null || _el$options === void 0 ? void 0 : _el$options.length) > 0) {
@@ -579,6 +611,38 @@ var CustomForm = function CustomForm(_ref, ref) {
579
611
  style: {
580
612
  width: '100%'
581
613
  },
614
+ maxTagPlaceholder: item.maxTagPlaceholder || function (omittedValues) {
615
+ return /*#__PURE__*/_jsx(Tooltip, {
616
+ styles: {
617
+ root: {
618
+ pointerEvents: 'none'
619
+ }
620
+ },
621
+ title: omittedValues.map(function (_ref3) {
622
+ var label = _ref3.label;
623
+ if (typeof label === 'string' || typeof label === 'number') {
624
+ return String(label);
625
+ } else if ( /*#__PURE__*/React.isValidElement(label)) {
626
+ var _element2 = label;
627
+ var props = _element2.props;
628
+
629
+ // 尝试提取文本
630
+ if ((props === null || props === void 0 ? void 0 : props.text) !== undefined) {
631
+ var text = props.text;
632
+ if (Array.isArray(text)) {
633
+ return text.join(', ');
634
+ }
635
+ return String(text);
636
+ }
637
+ } else {
638
+ return '';
639
+ }
640
+ }).join(', '),
641
+ children: /*#__PURE__*/_jsxs("span", {
642
+ children: ["+", omittedValues.length, "..."]
643
+ })
644
+ });
645
+ },
582
646
  children: (item === null || item === void 0 ? void 0 : item.setting) && Array.isArray(item.setting) && item.setting.map(function (el, num) {
583
647
  return /*#__PURE__*/_jsx(Option, {
584
648
  value: el.value,
@@ -622,6 +686,38 @@ var CustomForm = function CustomForm(_ref, ref) {
622
686
  style: {
623
687
  width: '100%'
624
688
  },
689
+ maxTagPlaceholder: item.maxTagPlaceholder || function (omittedValues) {
690
+ return /*#__PURE__*/_jsx(Tooltip, {
691
+ styles: {
692
+ root: {
693
+ pointerEvents: 'none'
694
+ }
695
+ },
696
+ title: omittedValues.map(function (_ref4) {
697
+ var label = _ref4.label;
698
+ if (typeof label === 'string' || typeof label === 'number') {
699
+ return String(label);
700
+ } else if ( /*#__PURE__*/React.isValidElement(label)) {
701
+ var _element3 = label;
702
+ var props = _element3.props;
703
+
704
+ // 尝试提取文本
705
+ if ((props === null || props === void 0 ? void 0 : props.text) !== undefined) {
706
+ var text = props.text;
707
+ if (Array.isArray(text)) {
708
+ return text.join(', ');
709
+ }
710
+ return String(text);
711
+ }
712
+ } else {
713
+ return '';
714
+ }
715
+ }).join(', '),
716
+ children: /*#__PURE__*/_jsxs("span", {
717
+ children: ["+", omittedValues.length, "..."]
718
+ })
719
+ });
720
+ },
625
721
  children: item.setting1.map(function (el, num) {
626
722
  return /*#__PURE__*/_jsx(Option, {
627
723
  value: el.value,
@@ -652,7 +748,12 @@ var CustomForm = function CustomForm(_ref, ref) {
652
748
  case CustomFormItemType.ConditionExpression:
653
749
  element = /*#__PURE__*/_jsx(ConditionExpression, {
654
750
  showParameter: item === null || item === void 0 ? void 0 : item.showParameter,
655
- 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
656
757
  });
657
758
  break;
658
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 | Object;
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 的字段 */
@@ -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 "../TableMax";
23
+ import { ColumnType } from "../type";
24
24
  import { ColumnFilter } from "../components/ColumnFilterV2";
25
25
  import Sort from "../components/ColumnSort";
26
26
  import "./index.less";
@@ -1,13 +1,6 @@
1
1
  import React from 'react';
2
2
  import './tableMax.less';
3
3
  import { type TableMaxProps } from './type';
4
- export declare enum ColumnType {
5
- Selection = "selection-column",
6
- Darg = "darg-column",
7
- PlaceHolder = "placeholder-column",
8
- Expander = "expander",
9
- Index = "inner-index"
10
- }
11
4
  export type ColumnSizing = Record<string, number>;
12
5
  export declare const CACHE_MAX_AGE: number;
13
6
  declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<TableMaxProps & React.RefAttributes<unknown>>>;
@@ -35,6 +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 "./type";
38
39
  import { downloadExcel, getFormatFilters, getFormatFiltersV2, getFormatSorting, operationColumnNoTooltips } from "./utils";
39
40
  import { useTableScrollShadow } from "./hooks/useTableScrollShadow";
40
41
  import { ExportTableData } from "./components/Export";
@@ -42,14 +43,6 @@ import UnifiedTable from "./UnifiedTable";
42
43
  import { useHoverDetection } from "./hooks/useHoverDetection";
43
44
  import { jsx as _jsx } from "react/jsx-runtime";
44
45
  import { jsxs as _jsxs } from "react/jsx-runtime";
45
- export var ColumnType = /*#__PURE__*/function (ColumnType) {
46
- ColumnType["Selection"] = "selection-column";
47
- ColumnType["Darg"] = "darg-column";
48
- ColumnType["PlaceHolder"] = "placeholder-column";
49
- ColumnType["Expander"] = "expander";
50
- ColumnType["Index"] = "inner-index";
51
- return ColumnType;
52
- }({});
53
46
  export var CACHE_MAX_AGE = 1 * 60 * 60 * 1000;
54
47
  var getCurrentRouterName = function getCurrentRouterName() {
55
48
  return window.location.pathname.slice(1);
@@ -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 "../../index";
17
+ import { ColumnType } from "../../type";
18
18
  import "./index.less";
19
19
  import { useTranslation } from "../../../../hooks/useTranslation";
20
20
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -1,13 +1,13 @@
1
1
  import { TableMaxColumnType } from "../../type";
2
- export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
3
- export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
4
- export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
5
- export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
2
+ export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
3
+ export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
4
+ export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
5
+ export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
6
6
  declare const customSortFns: {
7
- numberSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
8
- stringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
9
- timeSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
10
- numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
7
+ numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
8
+ stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
9
+ timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
10
+ numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
11
11
  };
12
12
  export default customSortFns;
13
13
  export type SortFnType = keyof typeof customSortFns | undefined;
@@ -16,14 +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
- var ColumnType = /*#__PURE__*/function (ColumnType) {
20
- ColumnType["Selection"] = "selection-column";
21
- ColumnType["Drag"] = "darg-column";
22
- ColumnType["PlaceHolder"] = "placeholder-column";
23
- ColumnType["Expander"] = "expander";
24
- ColumnType["Index"] = "inner-index";
25
- return ColumnType;
26
- }(ColumnType || {});
19
+ import { ColumnType } from "../../type";
27
20
  var defaultApplyCellLogic = function defaultApplyCellLogic(value, columnId, originalRow, column) {
28
21
  var cell = column.cell,
29
22
  accessorKey = column.accessorKey,
@@ -65,7 +58,7 @@ var defaultApplyCellLogic = function defaultApplyCellLogic(value, columnId, orig
65
58
  }
66
59
  return value !== null && value !== void 0 ? value : '';
67
60
  };
68
- var EnableExportColumnTypeList = [ColumnType.Selection, ColumnType.Drag, ColumnType.PlaceHolder, ColumnType.Expander, ColumnType.Index];
61
+ var EnableExportColumnTypeList = [ColumnType.Selection, ColumnType.Darg, ColumnType.PlaceHolder, ColumnType.Expander, ColumnType.Index];
69
62
  function fetchWithRetry(_x) {
70
63
  return _fetchWithRetry.apply(this, arguments);
71
64
  }
@@ -1,5 +1,5 @@
1
1
  import TableMax from './TableMax';
2
- export { ColumnType } from './TableMax';
2
+ export { ColumnType } from './type';
3
3
  export { InputType } from './components/ColumnEdit';
4
4
  export { FilterType } from './components/ColumnFilterV2';
5
5
  export type { FilterFnType } from './components/ColumnFilterV2';
@@ -1,5 +1,5 @@
1
1
  import TableMax from "./TableMax";
2
- export { ColumnType } from "./TableMax";
2
+ export { ColumnType } from "./type";
3
3
  export { InputType } from "./components/ColumnEdit";
4
4
  export { FilterType } from "./components/ColumnFilterV2";
5
5
  export default TableMax;
@@ -5,6 +5,13 @@ import { InputType } from './components/ColumnEdit';
5
5
  import { FilterFnType, FilterType } from './components/ColumnFilterV2';
6
6
  import { SortFnType } from './components/ColumnSort/customSortFns';
7
7
  import { ExportOptions } from './components/Export';
8
+ export declare enum ColumnType {
9
+ Selection = "selection-column",
10
+ Darg = "darg-column",
11
+ PlaceHolder = "placeholder-column",
12
+ Expander = "expander",
13
+ Index = "inner-index"
14
+ }
8
15
  export type PrefixClsType = 'custom-light' | 'custom-dark';
9
16
  export declare enum DropSide {
10
17
  Top = "top",
@@ -1,3 +1,11 @@
1
+ export var ColumnType = /*#__PURE__*/function (ColumnType) {
2
+ ColumnType["Selection"] = "selection-column";
3
+ ColumnType["Darg"] = "darg-column";
4
+ ColumnType["PlaceHolder"] = "placeholder-column";
5
+ ColumnType["Expander"] = "expander";
6
+ ColumnType["Index"] = "inner-index";
7
+ return ColumnType;
8
+ }({});
1
9
  export var DropSide = /*#__PURE__*/function (DropSide) {
2
10
  DropSide["Top"] = "top";
3
11
  DropSide["Bottom"] = "bottom";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arim-aisdc/public-components",
3
- "version": "2.3.96",
3
+ "version": "2.3.98",
4
4
  "description": "前端组件库",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -48,7 +48,7 @@
48
48
  "dependencies": {
49
49
  "@ant-design/icons": "^5.3.7",
50
50
  "@ant-design/pro-components": "^2.7.10",
51
- "@arim-aisdc/public-components": "^2.3.90",
51
+ "@arim-aisdc/public-components": "^2.3.96",
52
52
  "@tanstack/match-sorter-utils": "^8.8.4",
53
53
  "@tanstack/react-table": "^8.9.1",
54
54
  "@tanstack/react-virtual": "^3.13.12",