@arim-aisdc/public-components 2.1.2 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/components/BaseInfo/BaseInfo.d.ts +1 -1
  2. package/dist/components/CustomForm/CustomForm.js +3 -0
  3. package/dist/components/TableMax/TableBody/Row.d.ts +3 -2
  4. package/dist/components/TableMax/TableBody/Row.js +12 -7
  5. package/dist/components/TableMax/TableBody/index.d.ts +2 -1
  6. package/dist/components/TableMax/TableBody/index.js +5 -2
  7. package/dist/components/TableMax/TableMax.d.ts +1 -0
  8. package/dist/components/TableMax/TableMax.js +107 -205
  9. package/dist/components/TableMax/components/ColumnEdit/components/numberRange/index.d.ts +2 -1
  10. package/dist/components/TableMax/components/ColumnEdit/components/numberRange/index.js +4 -1
  11. package/dist/components/TableMax/components/ColumnEdit/components/remoteSelect/index.d.ts +11 -0
  12. package/dist/components/TableMax/components/ColumnEdit/components/remoteSelect/index.js +106 -0
  13. package/dist/components/TableMax/components/ColumnEdit/index.d.ts +4 -0
  14. package/dist/components/TableMax/components/ColumnEdit/index.js +34 -15
  15. package/dist/components/TableMax/components/ColumnFilter/MultipleSelect/index.js +2 -5
  16. package/dist/components/TableMax/components/ColumnFilter/SingleSelect/index.js +3 -6
  17. package/dist/components/TableMax/components/ColumnSort/customSortFns.d.ts +8 -8
  18. package/dist/components/TableMax/components/CustomDragerLayer/index.js +22 -5
  19. package/dist/components/TableMax/components/CustomDragerLayer/index.less +19 -1
  20. package/dist/components/TableMax/hooks/useColumnWidth.d.ts +18 -0
  21. package/dist/components/TableMax/hooks/useColumnWidth.js +351 -0
  22. package/dist/components/TableMax/type.d.ts +13 -4
  23. package/dist/components/TableMax/utils.d.ts +1 -0
  24. package/dist/components/TableMax/utils.js +7 -0
  25. package/package.json +1 -1
@@ -0,0 +1,351 @@
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 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; }
3
+ 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; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ 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); }
7
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+ 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."); }
9
+ 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); }
10
+ 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; }
11
+ 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; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ import { useCallback, useEffect, useMemo, useState } from 'react';
14
+ import { getSizeInfo } from "../utils";
15
+ import { debounce } from 'lodash';
16
+ var CACHE_MAX_AGE = 1 * 60 * 60 * 1000; // 1小时
17
+
18
+ export var useColumnWidth = function useColumnWidth(_ref) {
19
+ var tableMaxRef = _ref.tableMaxRef,
20
+ tableId = _ref.tableId,
21
+ tableKeyPrefixCls = _ref.tableKeyPrefixCls,
22
+ _ref$columnVisibleCon = _ref.columnVisibleConfig,
23
+ columnVisibleConfig = _ref$columnVisibleCon === void 0 ? {} : _ref$columnVisibleCon,
24
+ tableKey = _ref.tableKey;
25
+ var _useState = useState({
26
+ columnSizing: {},
27
+ //显示列的列宽
28
+ allColumnSizing: {},
29
+ //所有列的列宽
30
+ allColumnCount: 0,
31
+ tableContainerWidth: undefined
32
+ }),
33
+ _useState2 = _slicedToArray(_useState, 2),
34
+ state = _useState2[0],
35
+ setState = _useState2[1];
36
+
37
+ /**
38
+ * 处理容器宽度变化的逻辑
39
+ * 1.容器变小,不重新计算其他列
40
+ * 2.容器变大:
41
+ * 列宽之和大于容器宽度,不重新计算
42
+ * 列宽之和小于容器宽度,除选择列和展开列外,其他列平分 列宽之和与容器宽度的差值
43
+ */
44
+ var handleResize = useCallback(function () {
45
+ if (!tableMaxRef.current) return;
46
+ var newWidth = Math.floor(tableMaxRef.current.clientWidth);
47
+ setState(function (prevState) {
48
+ // 计算可见列,排除特定列
49
+ var visibleColumns = Object.keys(prevState.columnSizing).filter(function (key) {
50
+ return columnVisibleConfig[key] !== false && key !== 'expander' && key !== 'selection-column';
51
+ });
52
+ var totalVisibleWidth = Object.keys(prevState.columnSizing).filter(function (key) {
53
+ return columnVisibleConfig[key] !== false;
54
+ }).reduce(function (sum, key) {
55
+ return sum + (prevState.columnSizing[key] || 120);
56
+ }, 0);
57
+
58
+ // 容器变大时的逻辑
59
+ if (newWidth > prevState.tableContainerWidth) {
60
+ if (totalVisibleWidth < newWidth) {
61
+ // 计算剩余宽度
62
+ var remainWidth = newWidth - totalVisibleWidth - 10;
63
+ var unselectedCount = visibleColumns.length;
64
+
65
+ // 如果有未排除的列,均匀分配剩余宽度
66
+ if (unselectedCount > 0) {
67
+ var averageWidth = remainWidth / unselectedCount;
68
+ var newVisibleColumnsSizing = _objectSpread({}, prevState.columnSizing);
69
+ visibleColumns.forEach(function (key) {
70
+ newVisibleColumnsSizing[key] = (newVisibleColumnsSizing[key] || 0) + averageWidth;
71
+ });
72
+ console.log(newVisibleColumnsSizing, 'newVisibleColumnsSizing');
73
+ return _objectSpread(_objectSpread({}, prevState), {}, {
74
+ columnSizing: newVisibleColumnsSizing,
75
+ allColumnSizing: _objectSpread(_objectSpread({}, prevState.allColumnSizing || {}), newVisibleColumnsSizing),
76
+ tableContainerWidth: newWidth
77
+ });
78
+ }
79
+ }
80
+ }
81
+ // 容器变小时,列宽保持不变
82
+ return _objectSpread(_objectSpread({}, prevState), {}, {
83
+ tableContainerWidth: newWidth
84
+ });
85
+ });
86
+ }, [tableMaxRef.current]);
87
+
88
+ // 使用防抖处理容器宽度变化
89
+ var debouncedHandleResize = useMemo(function () {
90
+ return debounce(handleResize, 200);
91
+ }, [handleResize]);
92
+ useEffect(function () {
93
+ if (!tableMaxRef.current) return;
94
+ var resizeObserver = new ResizeObserver(debouncedHandleResize);
95
+ resizeObserver.observe(tableMaxRef.current);
96
+ return function () {
97
+ resizeObserver.disconnect();
98
+ debouncedHandleResize.cancel(); // 清理防抖
99
+ };
100
+ }, [tableMaxRef.current, debouncedHandleResize]);
101
+
102
+ /**
103
+ * 列显示隐藏后调整列宽
104
+ * @param key
105
+ * @param value
106
+ * 增加列,其余列宽度不变
107
+ * 减少列,列宽之和大于容器宽度,其余列宽不变
108
+ * 列宽之和小于容器宽度,除展开列和勾选列外,其余列平分列宽之和与容器宽度的差值
109
+ */
110
+
111
+ var handleVisibleConfigChange = function handleVisibleConfigChange(key, value) {
112
+ setState(function (prevState) {
113
+ //列宽增加
114
+ if (value) {
115
+ console.log(prevState.allColumnSizing[key], prevState.allColumnSizing, 'prevState.allColumnSizing[key]');
116
+ return _objectSpread(_objectSpread({}, prevState), {}, {
117
+ columnSizing: _objectSpread(_objectSpread({}, prevState.columnSizing), {}, {
118
+ key: prevState.allColumnSizing[key]
119
+ }),
120
+ allColumnSizing: _objectSpread(_objectSpread({}, prevState.allColumnSizing), {}, {
121
+ key: prevState.allColumnSizing[key] || 120
122
+ })
123
+ });
124
+ } else {
125
+ var _tableMaxRef$current;
126
+ //列宽减少
127
+ var newVisibleColumnsSizing = prevState.columnSizing;
128
+ delete newVisibleColumnsSizing[key];
129
+ var containerWidth = ((_tableMaxRef$current = tableMaxRef.current) === null || _tableMaxRef$current === void 0 ? void 0 : _tableMaxRef$current.clientWidth) - 10 || 0;
130
+ // 计算当前总宽度
131
+ var totalWidth = Object.values(newVisibleColumnsSizing).reduce(function (sum, width) {
132
+ return Number(sum || 0) + Number(width || 0);
133
+ }, 0);
134
+ console.log(newVisibleColumnsSizing, totalWidth, containerWidth, 'newVisibleColumnsSizing');
135
+ if (containerWidth < totalWidth) {
136
+ // 容器宽度小于增加列后的列总和,其他列宽度不变
137
+ return _objectSpread(_objectSpread({}, prevState), {}, {
138
+ columnSizing: newVisibleColumnsSizing
139
+ });
140
+ } else {
141
+ // 容器宽度大于增加列后的列总和,其他列宽度平分差值
142
+ var widthDifference = containerWidth - totalWidth; // 计算差值
143
+ var joinCalculateColumns = Object.keys(prevState.columnSizing).filter(function (key) {
144
+ return key !== 'expander' && key !== 'selection-column';
145
+ });
146
+ var averageWidthIncrease = widthDifference / (joinCalculateColumns === null || joinCalculateColumns === void 0 ? void 0 : joinCalculateColumns.length);
147
+ joinCalculateColumns === null || joinCalculateColumns === void 0 || joinCalculateColumns.forEach(function (key) {
148
+ newVisibleColumnsSizing[key] = (newVisibleColumnsSizing[key] || 0) + averageWidthIncrease;
149
+ });
150
+ console.log(newVisibleColumnsSizing, joinCalculateColumns, 'newVisibleColumnsSizing', averageWidthIncrease);
151
+ return _objectSpread(_objectSpread({}, prevState), {}, {
152
+ columnSizing: newVisibleColumnsSizing,
153
+ allColumnSizing: _objectSpread(_objectSpread({}, prevState.allColumnSizing), newVisibleColumnsSizing)
154
+ });
155
+ }
156
+ }
157
+ });
158
+ };
159
+
160
+ /**
161
+ * 初始化时计算列宽
162
+ * 未设置宽度的列,容器剩余宽度存在,平分剩余宽度,最大不超过240;容器剩余宽度不存在,默认120
163
+ * 平分后还存在剩余宽度,除展开列和勾选列外的其他列平分剩余宽度
164
+ * */
165
+ var calculateColumnSizing = useCallback(function (columnsSizeMap, allColumnCount, containerWidth) {
166
+ var _Object$keys$filter;
167
+ if (!tableMaxRef.current || !columnsSizeMap) return {};
168
+ var currentWidth = containerWidth || state.tableContainerWidth || tableMaxRef.current.clientWidth;
169
+ var hasColumnCount = ((_Object$keys$filter = Object.keys(columnsSizeMap).filter(function (item) {
170
+ return !!columnsSizeMap[item];
171
+ })) === null || _Object$keys$filter === void 0 ? void 0 : _Object$keys$filter.length) || 0;
172
+ var remainColumnCount = allColumnCount - hasColumnCount;
173
+ var allColumnWidth = Object.values(columnsSizeMap).reduce(function (sum, width) {
174
+ return sum + Number(width || 0);
175
+ }, 0);
176
+ var remainTableContainerWidth = currentWidth - allColumnWidth - 10;
177
+ var newColumnSizeMap = _objectSpread({}, columnsSizeMap);
178
+ console.log(remainColumnCount, 'remainColumnCount');
179
+
180
+ // 处理未设置宽度的列
181
+ if (remainColumnCount > 0) {
182
+ var defaultMinSize = 120;
183
+ var defaultMaxSize = 240;
184
+ var averageSize = Math.max(Math.min(remainTableContainerWidth / remainColumnCount, defaultMaxSize), defaultMinSize);
185
+ Object.keys(columnsSizeMap).forEach(function (key) {
186
+ if (!newColumnSizeMap[key]) {
187
+ newColumnSizeMap[key] = averageSize;
188
+ }
189
+ });
190
+ allColumnWidth = Object.values(newColumnSizeMap).reduce(function (sum, width) {
191
+ return sum + Number(width || 0);
192
+ }, 0);
193
+ remainTableContainerWidth = currentWidth - allColumnWidth - 10;
194
+ }
195
+
196
+ // 分配剩余宽度
197
+ if (remainTableContainerWidth > 0) {
198
+ var excludeColumns = ['expander', 'selection-column'].filter(Boolean);
199
+ var adjustableColumns = Object.keys(newColumnSizeMap).filter(function (key) {
200
+ return !excludeColumns.includes(key);
201
+ });
202
+ if (adjustableColumns.length > 0) {
203
+ var averageExtra = remainTableContainerWidth / adjustableColumns.length;
204
+ adjustableColumns.forEach(function (key) {
205
+ newColumnSizeMap[key] += averageExtra;
206
+ });
207
+ }
208
+ }
209
+ return newColumnSizeMap;
210
+ }, [state.allColumnCount, state.tableContainerWidth]);
211
+
212
+ // 初始化列宽信息
213
+ var initializeColumnSizing = useCallback(function (columns) {
214
+ var _localStorage$getItem;
215
+ if (!Array.isArray(columns) || columns.length === 0) {
216
+ return;
217
+ }
218
+ var cache = JSON.parse((_localStorage$getItem = localStorage.getItem("".concat(tableKey))) !== null && _localStorage$getItem !== void 0 ? _localStorage$getItem : '{}');
219
+ var _getSizeInfo = getSizeInfo(columns),
220
+ allCount = _getSizeInfo.allCount,
221
+ columnSizeMap = _getSizeInfo.columnSizeMap;
222
+ if (cache && cache !== null && cache !== void 0 && cache.editTime && +new Date() - cache.editTime > CACHE_MAX_AGE) {
223
+ var _initColumnsSizeMap = _objectSpread({}, columnSizeMap);
224
+ var _visibleColumnsSizeMap = {};
225
+ var _notVisibleColumns = Object.keys(columnVisibleConfig).filter(function (key) {
226
+ return !columnVisibleConfig[key];
227
+ });
228
+ var _newAllColumnCount = allCount - _notVisibleColumns.length;
229
+ Object.keys(_initColumnsSizeMap).forEach(function (key) {
230
+ if (!_notVisibleColumns.includes(key)) {
231
+ _visibleColumnsSizeMap[key] = _initColumnsSizeMap[key];
232
+ }
233
+ });
234
+ setState(function (prevState) {
235
+ var columnSizing = calculateColumnSizing(_visibleColumnsSizeMap, _newAllColumnCount, prevState.tableContainerWidth);
236
+ return {
237
+ columnSizing: columnSizing,
238
+ allColumnCount: _newAllColumnCount,
239
+ allColumnSizing: _objectSpread(_objectSpread({}, _initColumnsSizeMap), columnSizing),
240
+ tableContainerWidth: prevState.tableContainerWidth
241
+ };
242
+ });
243
+ return;
244
+ }
245
+ var cacheColumnSizing = cache.columnSizing,
246
+ cacheColumnVisibility = cache.columnVisibility;
247
+ var initColumnsSizeMap = _objectSpread(_objectSpread({}, columnSizeMap), cacheColumnSizing);
248
+ var initColumnsVisibility = _objectSpread(_objectSpread({}, columnVisibleConfig), cacheColumnVisibility);
249
+ var visibleColumnsSizeMap = {};
250
+ var notVisibleColumns = Object.keys(initColumnsVisibility).filter(function (key) {
251
+ return !initColumnsVisibility[key];
252
+ });
253
+ var newAllColumnCount = allCount - notVisibleColumns.length;
254
+ Object.keys(initColumnsSizeMap).forEach(function (key) {
255
+ if (!notVisibleColumns.includes(key)) {
256
+ visibleColumnsSizeMap[key] = initColumnsSizeMap[key];
257
+ }
258
+ });
259
+ setState(function (prevState) {
260
+ var columnSizing = calculateColumnSizing(visibleColumnsSizeMap, newAllColumnCount, prevState.tableContainerWidth);
261
+ console.log(columnSizing, _objectSpread(_objectSpread({}, initColumnsSizeMap), columnSizing), 'columnSizing11');
262
+ return {
263
+ columnSizing: columnSizing,
264
+ allColumnSizing: _objectSpread(_objectSpread({}, initColumnsSizeMap), columnSizing),
265
+ allColumnCount: newAllColumnCount,
266
+ tableContainerWidth: prevState.tableContainerWidth
267
+ };
268
+ });
269
+ }, [columnVisibleConfig, tableId, tableKey, tableKeyPrefixCls, calculateColumnSizing]);
270
+
271
+ /**
272
+ * 列宽变化
273
+ * 1。列宽增加,不重新计算其他列
274
+ * 2.列宽减小:
275
+ * 列宽之和大于容器宽度,不重新计算
276
+ * 列宽之和小于容器宽度,当前列的下一列/上一列,增加列宽之与大于容器宽度差值
277
+ */
278
+ var handleColumnSizingChange = useCallback(function (data) {
279
+ if (!data) return;
280
+ var changedColumn = data();
281
+ if (!changedColumn) return;
282
+ setState(function (prevState) {
283
+ var _tableMaxRef$current2;
284
+ var changedColumnKey = Object.keys(changedColumn)[0];
285
+ if (!changedColumnKey) return prevState;
286
+ var oldWidth = prevState.columnSizing[changedColumnKey] || 0;
287
+ var newWidth = changedColumn[changedColumnKey] || 0;
288
+ var widthDiff = newWidth - oldWidth; // 计算宽度变化
289
+
290
+ // 创建新的列宽映射
291
+ var newVisibleColumnsSizing = _objectSpread(_objectSpread({}, prevState.columnSizing), changedColumn);
292
+ console.log(newVisibleColumnsSizing, 'newVisibleColumnsSizing');
293
+
294
+ // 计算当前总宽度
295
+ var totalWidth = Object.values(newVisibleColumnsSizing).reduce(function (sum, width) {
296
+ return Number(sum || 0) + Number(width || 0);
297
+ }, 0);
298
+ var containerWidth = ((_tableMaxRef$current2 = tableMaxRef.current) === null || _tableMaxRef$current2 === void 0 ? void 0 : _tableMaxRef$current2.clientWidth) - 10 || 0;
299
+ console.log(widthDiff, newWidth, oldWidth, changedColumnKey, prevState, 3344);
300
+
301
+ // 处理列宽变大
302
+ if (widthDiff > 0) {
303
+ // 只更新变大的列的宽度
304
+ return _objectSpread(_objectSpread({}, prevState), {}, {
305
+ allColumnSizing: _objectSpread(_objectSpread({}, prevState.allColumnSizing || {}), newVisibleColumnsSizing),
306
+ columnSizing: newVisibleColumnsSizing
307
+ });
308
+ }
309
+
310
+ // 处理列宽缩小
311
+ if (widthDiff < 0) {
312
+ // 如果缩小后总列宽小于容器宽度
313
+ if (totalWidth < containerWidth) {
314
+ var widthDifference = containerWidth - totalWidth; // 计算差值
315
+
316
+ // 找到当前列的索引
317
+ var columns = Object.keys(prevState.columnSizing);
318
+ var currentIndex = columns.indexOf(changedColumnKey);
319
+ var targetColumnKey;
320
+
321
+ // 如果当前列是最后一列,处理前一列
322
+ if (currentIndex === columns.length - 1) {
323
+ targetColumnKey = columns[currentIndex - 1]; // 前一列
324
+ } else {
325
+ targetColumnKey = columns[currentIndex + 1]; // 下一列
326
+ }
327
+ console.log(widthDifference, newVisibleColumnsSizing[targetColumnKey], 'newVisibleColumnsSizing');
328
+ // 增加目标列的宽度
329
+ if (targetColumnKey) {
330
+ newVisibleColumnsSizing[targetColumnKey] = (newVisibleColumnsSizing[targetColumnKey] || 0) + widthDifference;
331
+ }
332
+ }
333
+
334
+ // 更新当前列的宽度
335
+ return _objectSpread(_objectSpread({}, prevState), {}, {
336
+ allColumnSizing: _objectSpread(_objectSpread({}, prevState.allColumnSizing || {}), newVisibleColumnsSizing),
337
+ columnSizing: newVisibleColumnsSizing
338
+ });
339
+ }
340
+ return prevState; // 如果没有变化,返回原状态
341
+ });
342
+ }, [tableId, tableKeyPrefixCls]);
343
+ return {
344
+ columnSizing: state.columnSizing,
345
+ allColumnCount: state.allColumnCount,
346
+ onColumnSizingChange: handleColumnSizingChange,
347
+ tableContainerWidth: state.tableContainerWidth,
348
+ initializeColumnSizing: initializeColumnSizing,
349
+ handleVisibleConfigChange: handleVisibleConfigChange
350
+ };
351
+ };
@@ -30,6 +30,10 @@ export type DownloadProps = {
30
30
  title: string;
31
31
  method?: string;
32
32
  };
33
+ export type IGetOptionType = (inputValue: string) => Promise<{
34
+ label: any;
35
+ value: any;
36
+ }[]>;
33
37
  export type OnSelectChangeType = (row: any, original: any, selected: boolean, event: any) => void;
34
38
  export type IMenuOptionsType = {
35
39
  label: string;
@@ -303,6 +307,8 @@ export type TableMaxProps = {
303
307
  compactMode?: boolean;
304
308
  /**request函数 用于下载*/
305
309
  request?: (...params: any[]) => Promise<Blob>;
310
+ /**编辑时修改组件值时触发的事件 */
311
+ onEditValueChange?: (field: string, value: any, extra?: any) => void;
306
312
  };
307
313
  export interface TableMaxColumnType {
308
314
  /**每一列的id是唯一的 */
@@ -330,10 +336,7 @@ export interface TableMaxColumnType {
330
336
  label: any;
331
337
  }[];
332
338
  /**通过该函数获取可选项 */
333
- getFilterOptionsFn?: (inputValue: string) => Promise<{
334
- label: any;
335
- value: any;
336
- }[]>;
339
+ getFilterOptionsFn?: IGetOptionType;
337
340
  /**列筛选时 使用的过滤函数 */
338
341
  filterFn?: FilterFnType | ((row: any, columnId: any, filterValue: any) => boolean);
339
342
  /**筛选组件属性配置 */
@@ -352,11 +355,15 @@ export interface TableMaxColumnType {
352
355
  editable?: boolean;
353
356
  /**编辑时使用的编辑组件类型,默认为Input组件 */
354
357
  editComType?: InputType;
358
+ /**编辑时使用的编辑组件disabled属性,默认false(可编辑) */
359
+ editComDisabled?: boolean;
355
360
  /**使用select选择框编辑时的可选项 */
356
361
  editOptions?: {
357
362
  value: any;
358
363
  label: any;
359
364
  }[];
365
+ /**使用select选择框编辑时远程搜索函数(输入时触发搜索,已添加节流) */
366
+ getEditOptionsFn?: IGetOptionType;
360
367
  /** @deprecated 已废弃,使用tooltip替代;表格单元格超出部分省略号展示
361
368
  * 是否显示tooltip
362
369
  */
@@ -373,4 +380,6 @@ export interface TableMaxColumnType {
373
380
  sortingKey?: string;
374
381
  /** 编辑时该列是否必填 */
375
382
  required?: boolean;
383
+ /**是否可调整列宽大小 */
384
+ enableResizing?: boolean;
376
385
  }
@@ -32,3 +32,4 @@ export declare const downloadExcel: ({ url, data, title, setDownLoading, method,
32
32
  method?: string;
33
33
  request?: (...params: any[]) => Promise<Blob>;
34
34
  }) => void;
35
+ export declare const filterOptions: (inputValue: any, option: any) => boolean;
@@ -186,4 +186,11 @@ export var downloadExcel = function downloadExcel(_ref6) {
186
186
  btn = null;
187
187
  });
188
188
  setDownLoading(false);
189
+ };
190
+ export var filterOptions = function filterOptions(inputValue, option) {
191
+ var _option$label;
192
+ // console.log('inputValue', inputValue, option);
193
+ var input = (inputValue !== null && inputValue !== void 0 ? inputValue : '').toUpperCase().trim();
194
+ var optionFilterString = ('' + ((_option$label = option.label) !== null && _option$label !== void 0 ? _option$label : option.children)).toUpperCase().trim();
195
+ return optionFilterString.indexOf(input) !== -1;
189
196
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arim-aisdc/public-components",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "前端组件库",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",