@arim-aisdc/public-components 2.3.39 → 2.3.41

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 (93) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +3 -3
  3. package/dist/assets/iconfont/index.css +6 -6
  4. package/dist/assets/iconfont/menu-gray/demo.css +539 -539
  5. package/dist/assets/iconfont/menu-gray/demo_index.html +1154 -1154
  6. package/dist/assets/iconfont/menu-gray/iconfont.css +183 -183
  7. package/dist/assets/iconfont/menu-gray/iconfont.json +303 -303
  8. package/dist/assets/iconfont/other/demo.css +539 -539
  9. package/dist/assets/iconfont/other/demo_index.html +2764 -2764
  10. package/dist/assets/iconfont/other/iconfont.css +463 -463
  11. package/dist/assets/iconfont/other/iconfont.json +793 -793
  12. package/dist/assets/iconfont/public/iconfont.css +69 -69
  13. package/dist/assets/iconfont/table/iconfont.css +89 -81
  14. package/dist/assets/iconfont/table/iconfont.ttf +0 -0
  15. package/dist/assets/iconfont/theme-dark/four/demo.css +539 -539
  16. package/dist/assets/iconfont/theme-dark/four/demo_index.html +306 -306
  17. package/dist/assets/iconfont/theme-dark/four/iconfont.css +37 -37
  18. package/dist/assets/iconfont/theme-dark/four/iconfont.json +44 -44
  19. package/dist/assets/images/data-empty-dark.svg +103 -103
  20. package/dist/assets/images/data-empty-light.svg +73 -73
  21. package/dist/assets/images/data.empty-dark.svg +44 -44
  22. package/dist/assets/styles/custom-dark.css +28466 -28466
  23. package/dist/assets/styles/custom-light.css +28092 -28092
  24. package/dist/components/BaseInfo/index.less +95 -95
  25. package/dist/components/CacheTabs/index.less +115 -115
  26. package/dist/components/CenterModal/index.less +41 -41
  27. package/dist/components/ConditionExpression/index.less +111 -111
  28. package/dist/components/CustomForm/CustomForm.js +5 -5
  29. package/dist/components/CustomForm/UploadImg/index.js +5 -5
  30. package/dist/components/CustomForm/customFormItemInputNumber/index.less +12 -12
  31. package/dist/components/CustomForm/index.less +76 -76
  32. package/dist/components/DraggableBox/index.less +26 -26
  33. package/dist/components/Empty/index.less +21 -21
  34. package/dist/components/Filter/FilterColor/index.less +106 -106
  35. package/dist/components/Filter/FilterInputNumber/index.less +15 -15
  36. package/dist/components/Filter/FilterRadio/index.less +25 -25
  37. package/dist/components/Filter/FilterSelect/index.less +28 -28
  38. package/dist/components/Filter/FilterSlider/index.less +19 -19
  39. package/dist/components/Filter/FilterSwitch/index.less +20 -20
  40. package/dist/components/GlobalTip/MessageTip/index.less +28 -28
  41. package/dist/components/GlobalTip/ModalTip/index.less +42 -42
  42. package/dist/components/Icon/IconDemo/animations/Calendar/calendar.json +692 -692
  43. package/dist/components/Icon/IconDemo/animations/Loading/loading.json +869 -869
  44. package/dist/components/Icon/IconDemo/animations/download/download.json +815 -815
  45. package/dist/components/Icon/IconDemo/animations/download/download.svg +5 -5
  46. package/dist/components/Icon/IconDemo/animations/skipForward/skipForward.json +1053 -1053
  47. package/dist/components/Icon/index.less +28 -28
  48. package/dist/components/QueryFilter/QueryFilter.js +5 -5
  49. package/dist/components/QueryFilter/index.less +64 -64
  50. package/dist/components/SchemaForm/type.js +2 -2
  51. package/dist/components/SchemaForm/utils.js +7 -7
  52. package/dist/components/SplitPane/splitPane.less +24 -24
  53. package/dist/components/SplitPane/util.js +21 -21
  54. package/dist/components/SplitterPane/SplitterPane.js +46 -1
  55. package/dist/components/TableMax/TableBody/contextMenu/index.less +21 -21
  56. package/dist/components/TableMax/TableBody/index.less +187 -187
  57. package/dist/components/TableMax/TableHeader/Cell.d.ts +2 -1
  58. package/dist/components/TableMax/TableHeader/Cell.js +4 -2
  59. package/dist/components/TableMax/TableHeader/index.d.ts +2 -1
  60. package/dist/components/TableMax/TableHeader/index.js +4 -2
  61. package/dist/components/TableMax/TableHeader/index.less +224 -224
  62. package/dist/components/TableMax/TableMax.js +59 -28
  63. package/dist/components/TableMax/components/ColumnEdit/components/numberRange/index.less +2 -2
  64. package/dist/components/TableMax/components/ColumnEdit/index.less +72 -72
  65. package/dist/components/TableMax/components/ColumnFilterV2/DateRange/index.less +24 -24
  66. package/dist/components/TableMax/components/ColumnFilterV2/Filter.d.ts +1 -0
  67. package/dist/components/TableMax/components/ColumnFilterV2/Filter.js +77 -14
  68. package/dist/components/TableMax/components/ColumnFilterV2/MultipleSelect/index.less +32 -32
  69. package/dist/components/TableMax/components/ColumnFilterV2/NumberRange/index.less +27 -27
  70. package/dist/components/TableMax/components/ColumnFilterV2/SingleSelect/index.less +43 -43
  71. package/dist/components/TableMax/components/ColumnFilterV2/index.d.ts +3 -1
  72. package/dist/components/TableMax/components/ColumnFilterV2/index.js +19 -3
  73. package/dist/components/TableMax/components/ColumnFilterV2/index.less +39 -39
  74. package/dist/components/TableMax/components/ColumnSetting/index.js +7 -3
  75. package/dist/components/TableMax/components/ColumnSetting/index.less +183 -183
  76. package/dist/components/TableMax/components/ColumnSort/customSortFns.d.ts +8 -8
  77. package/dist/components/TableMax/components/ColumnSort/index.less +42 -42
  78. package/dist/components/TableMax/components/CustomDragerLayer/index.less +59 -59
  79. package/dist/components/TableMax/components/PaginationV2/index.less +116 -116
  80. package/dist/components/TableMax/hooks/useColumnWidth copy.js +26 -26
  81. package/dist/components/TableMax/hooks/useColumnWidth.js +18 -18
  82. package/dist/components/TableMax/hooks/useInfiniteScroll.d.ts +28 -0
  83. package/dist/components/TableMax/hooks/useInfiniteScroll.js +95 -0
  84. package/dist/components/TableMax/tableMax.less +340 -340
  85. package/dist/components/TableMax/type.d.ts +12 -0
  86. package/dist/components/TableMax/utils.js +9 -9
  87. package/dist/hooks/useCenterModalState.js +2 -2
  88. package/dist/hooks/usePageCacheState.js +18 -18
  89. package/dist/themes/custom-dark.css +28482 -28482
  90. package/dist/themes/custom-light.css +28108 -28108
  91. package/dist/themes/variables.less +90 -90
  92. package/dist/utils/request.js +10 -10
  93. package/package.json +108 -108
@@ -1,72 +1,72 @@
1
- .table-max-cell-wrapper {
2
- // display: inline-block;
3
- width: 100%;
4
- padding: 0 8px;
5
- overflow: hidden;
6
- text-overflow: ellipsis;
7
- white-space: nowrap;
8
- box-sizing: border-box !important;
9
-
10
- .ellipsis {
11
- display: inline;
12
- }
13
-
14
- .numberRangeWrapper {
15
- display: flex;
16
- flex-direction: column;
17
- }
18
-
19
- .custom-dark-select,
20
- .custom-dark-picker,
21
- .custom-dark-input-number,
22
- .custom-dark-input,
23
- .custom-dark-input-affix-wrapper,
24
- .custom-dark-switch {
25
- background-color: @global-curd-input-background-color;
26
- }
27
-
28
- .custom-dark-switch-checked {
29
- background-color: @global-primary-color;
30
- }
31
-
32
- .custom-dark-picker-clear,
33
- .custom-dark-select-clear {
34
- background-color: @global-curd-input-background-color;
35
- }
36
-
37
- .custom-light-select,
38
- .custom-light-picker,
39
- .custom-light-input-number,
40
- .custom-light-input,
41
- .custom-light-input-affix-wrapper,
42
- .custom-light-switch {
43
- background-color: @global-curd-input-background-color;
44
- }
45
-
46
- .custom-light-switch-checked {
47
- background-color: @global-primary-color;
48
- }
49
-
50
- .custom-light-picker-clear,
51
- .custom-light-select-clear {
52
- background-color: @global-curd-input-background-color;
53
- }
54
- }
55
-
56
- .tableMaxCellTooltip {
57
- .custom-dark-tooltip-inner,
58
- .custom-light-tooltip-inner,
59
- .ant-tooltip-inner {
60
- background-color: @tableTooltipBgc;
61
- }
62
-
63
- .custom-dark-tooltip-arrow,
64
- .custom-light-tooltip-arrow,
65
- .ant-tooltip-arrow {
66
- .custom-dark-tooltip-arrow-content::before,
67
- .custom-light-tooltip-arrow-content::before,
68
- .ant-tooltip-arrow-content::before {
69
- background: @tableTooltipBgc;
70
- }
71
- }
72
- }
1
+ .table-max-cell-wrapper {
2
+ // display: inline-block;
3
+ width: 100%;
4
+ padding: 0 8px;
5
+ overflow: hidden;
6
+ text-overflow: ellipsis;
7
+ white-space: nowrap;
8
+ box-sizing: border-box !important;
9
+
10
+ .ellipsis {
11
+ display: inline;
12
+ }
13
+
14
+ .numberRangeWrapper {
15
+ display: flex;
16
+ flex-direction: column;
17
+ }
18
+
19
+ .custom-dark-select,
20
+ .custom-dark-picker,
21
+ .custom-dark-input-number,
22
+ .custom-dark-input,
23
+ .custom-dark-input-affix-wrapper,
24
+ .custom-dark-switch {
25
+ background-color: @global-curd-input-background-color;
26
+ }
27
+
28
+ .custom-dark-switch-checked {
29
+ background-color: @global-primary-color;
30
+ }
31
+
32
+ .custom-dark-picker-clear,
33
+ .custom-dark-select-clear {
34
+ background-color: @global-curd-input-background-color;
35
+ }
36
+
37
+ .custom-light-select,
38
+ .custom-light-picker,
39
+ .custom-light-input-number,
40
+ .custom-light-input,
41
+ .custom-light-input-affix-wrapper,
42
+ .custom-light-switch {
43
+ background-color: @global-curd-input-background-color;
44
+ }
45
+
46
+ .custom-light-switch-checked {
47
+ background-color: @global-primary-color;
48
+ }
49
+
50
+ .custom-light-picker-clear,
51
+ .custom-light-select-clear {
52
+ background-color: @global-curd-input-background-color;
53
+ }
54
+ }
55
+
56
+ .tableMaxCellTooltip {
57
+ .custom-dark-tooltip-inner,
58
+ .custom-light-tooltip-inner,
59
+ .ant-tooltip-inner {
60
+ background-color: @tableTooltipBgc;
61
+ }
62
+
63
+ .custom-dark-tooltip-arrow,
64
+ .custom-light-tooltip-arrow,
65
+ .ant-tooltip-arrow {
66
+ .custom-dark-tooltip-arrow-content::before,
67
+ .custom-light-tooltip-arrow-content::before,
68
+ .ant-tooltip-arrow-content::before {
69
+ background: @tableTooltipBgc;
70
+ }
71
+ }
72
+ }
@@ -1,24 +1,24 @@
1
- .date-range-filter-wrapper {
2
- padding: 8px 12px;
3
- .split-wapper {
4
- margin: 5px 0px 0px;
5
- height: 2px;
6
- display: flex;
7
- justify-content: center;
8
-
9
- .horizontal-line {
10
- height: 2px;
11
- display: inline-block;
12
- background: @tableColor4;
13
- width: 8px;
14
- }
15
- }
16
-
17
- .end-time {
18
- margin: 5px 0px 0px;
19
- }
20
-
21
- > div {
22
- width: 100%;
23
- }
24
- }
1
+ .date-range-filter-wrapper {
2
+ padding: 8px 12px;
3
+ .split-wapper {
4
+ margin: 5px 0px 0px;
5
+ height: 2px;
6
+ display: flex;
7
+ justify-content: center;
8
+
9
+ .horizontal-line {
10
+ height: 2px;
11
+ display: inline-block;
12
+ background: @tableColor4;
13
+ width: 8px;
14
+ }
15
+ }
16
+
17
+ .end-time {
18
+ margin: 5px 0px 0px;
19
+ }
20
+
21
+ > div {
22
+ width: 100%;
23
+ }
24
+ }
@@ -1,6 +1,7 @@
1
1
  import { Column } from '@tanstack/react-table';
2
2
  import React from 'react';
3
3
  type IProps = {
4
+ getDynamicFilterOptionsFn: Function;
4
5
  column: Column<any, unknown>;
5
6
  onCloseFilterPanel: () => void;
6
7
  manualFiltering: boolean;
@@ -13,20 +13,27 @@ import { AutoComplete, DatePicker, Input, InputNumber } from 'antd';
13
13
  import dayjs from 'dayjs';
14
14
  import { debounce } from 'lodash';
15
15
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
16
- import { FilterType, defaultDateFormat, isEmpty } from '.';
16
+ import { FilterType, defaultDateFormat, isEmpty, uniqueByField } from '.';
17
+ import { FilterOperator } from "../../type";
17
18
  import { DateRange } from "./DateRange";
18
19
  import MultipleSelect from "./MultipleSelect";
19
20
  import NumberRange from "./NumberRange";
20
21
  import SingleSelect from "./SingleSelect";
21
22
  import { jsx as _jsx } from "react/jsx-runtime";
22
23
  var Filter = function Filter(_ref) {
23
- var column = _ref.column,
24
+ var getDynamicFilterOptionsFn = _ref.getDynamicFilterOptionsFn,
25
+ column = _ref.column,
24
26
  onCloseFilterPanel = _ref.onCloseFilterPanel,
25
27
  manualFiltering = _ref.manualFiltering;
26
28
  var columnDef = column === null || column === void 0 ? void 0 : column.columnDef;
27
29
  // 筛选组件类型
28
- var filterType = columnDef.filterType,
30
+ var id = columnDef.id,
31
+ accessorKey = columnDef.accessorKey,
32
+ filterType = columnDef.filterType,
29
33
  filterOptions = columnDef.filterOptions,
34
+ dynamicFilterOptionsLabelFn = columnDef.dynamicFilterOptionsLabelFn,
35
+ dynamicFilterOptionsLabelField = columnDef.dynamicFilterOptionsLabelField,
36
+ dynamicFilterOptionsValueField = columnDef.dynamicFilterOptionsValueField,
30
37
  getFilterOptionsFn = columnDef.getFilterOptionsFn,
31
38
  _columnDef$isFilterOp = columnDef.isFilterOptionsFrontSearch,
32
39
  isFilterOptionsFrontSearch = _columnDef$isFilterOp === void 0 ? false : _columnDef$isFilterOp;
@@ -46,6 +53,16 @@ var Filter = function Filter(_ref) {
46
53
  apiLoading = _useState6[0],
47
54
  setApiLoading = _useState6[1];
48
55
 
56
+ // 动态接口可选值
57
+ var _useState7 = useState([]),
58
+ _useState8 = _slicedToArray(_useState7, 2),
59
+ dynamicApiOptions = _useState8[0],
60
+ setDynamicApiOptions = _useState8[1];
61
+ var _useState9 = useState(false),
62
+ _useState10 = _slicedToArray(_useState9, 2),
63
+ dynamicApiLoading = _useState10[0],
64
+ setDynamicApiLoading = _useState10[1];
65
+
49
66
  // 修改表格筛选参数
50
67
  var handleChangeFilterValue = function handleChangeFilterValue(value) {
51
68
  var newValue = value;
@@ -91,6 +108,9 @@ var Filter = function Filter(_ref) {
91
108
  changeFilterValueWithDebounce(value);
92
109
  setColumnFilterValue(value);
93
110
  };
111
+ var loading = useMemo(function () {
112
+ return apiLoading || dynamicApiLoading;
113
+ }, [apiLoading, dynamicApiLoading]);
94
114
 
95
115
  // 最终展示的可选值
96
116
  var options = useMemo(function () {
@@ -102,10 +122,14 @@ var Filter = function Filter(_ref) {
102
122
  if (filterOptions) {
103
123
  return filterOptions;
104
124
  }
105
- // 接口获取的可选值
125
+ // 列配置接口获取的可选值
106
126
  if (getFilterOptionsFn && Array.isArray(apiOptions)) {
107
127
  return apiOptions;
108
128
  }
129
+ // 动态接口获取的可选值
130
+ if (getDynamicFilterOptionsFn && Array.isArray(dynamicApiOptions)) {
131
+ return dynamicApiOptions;
132
+ }
109
133
  // 后端筛选时,不再填充可选值
110
134
  if (manualFiltering) {
111
135
  return [];
@@ -119,17 +143,17 @@ var Filter = function Filter(_ref) {
119
143
  label: item + ''
120
144
  };
121
145
  });
122
- }, [column.getFacetedUniqueValues(), filterOptions, manualFiltering, apiOptions]);
146
+ }, [column.getFacetedUniqueValues(), filterOptions, manualFiltering, apiOptions, dynamicApiOptions]);
123
147
 
124
148
  // 调用接口获取可选值
125
149
  var fetchOptions = useCallback( /*#__PURE__*/function () {
126
150
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(inputValue) {
127
- var res;
151
+ var res, _ref3, _ref4, filterField, valueField, filter, _res, uniqueData, _options;
128
152
  return _regeneratorRuntime().wrap(function _callee$(_context) {
129
153
  while (1) switch (_context.prev = _context.next) {
130
154
  case 0:
131
155
  if (!getFilterOptionsFn) {
132
- _context.next = 13;
156
+ _context.next = 15;
133
157
  break;
134
158
  }
135
159
  _context.prev = 1;
@@ -148,16 +172,55 @@ var Filter = function Filter(_ref) {
148
172
  setApiOptions([]);
149
173
  case 12:
150
174
  setApiLoading(false);
151
- case 13:
175
+ _context.next = 33;
176
+ break;
177
+ case 15:
178
+ if (!getDynamicFilterOptionsFn) {
179
+ _context.next = 33;
180
+ break;
181
+ }
182
+ setDynamicApiLoading(true);
183
+ _context.prev = 17;
184
+ filterField = (_ref3 = dynamicFilterOptionsLabelField !== null && dynamicFilterOptionsLabelField !== void 0 ? dynamicFilterOptionsLabelField : id) !== null && _ref3 !== void 0 ? _ref3 : accessorKey;
185
+ valueField = (_ref4 = dynamicFilterOptionsValueField !== null && dynamicFilterOptionsValueField !== void 0 ? dynamicFilterOptionsValueField : id) !== null && _ref4 !== void 0 ? _ref4 : accessorKey;
186
+ filter = inputValue ? {
187
+ field: filterField,
188
+ operator: FilterOperator.Contains,
189
+ value: inputValue
190
+ } : undefined;
191
+ _context.next = 23;
192
+ return getDynamicFilterOptionsFn(filter, filterField, inputValue);
193
+ case 23:
194
+ _res = _context.sent;
195
+ uniqueData = uniqueByField(_res, [valueField]);
196
+ _options = uniqueData.map(function (item) {
197
+ var _ref5, _ref6, _dynamicFilterOptions;
198
+ var label = (_ref5 = (_ref6 = (_dynamicFilterOptions = dynamicFilterOptionsLabelFn === null || dynamicFilterOptionsLabelFn === void 0 ? void 0 : dynamicFilterOptionsLabelFn(item)) !== null && _dynamicFilterOptions !== void 0 ? _dynamicFilterOptions : item === null || item === void 0 ? void 0 : item[dynamicFilterOptionsLabelField]) !== null && _ref6 !== void 0 ? _ref6 : item === null || item === void 0 ? void 0 : item[id]) !== null && _ref5 !== void 0 ? _ref5 : item === null || item === void 0 ? void 0 : item[accessorKey];
199
+ var value = item === null || item === void 0 ? void 0 : item[valueField];
200
+ return {
201
+ label: label,
202
+ value: value
203
+ };
204
+ });
205
+ setDynamicApiOptions(_options);
206
+ _context.next = 32;
207
+ break;
208
+ case 29:
209
+ _context.prev = 29;
210
+ _context.t1 = _context["catch"](17);
211
+ setDynamicApiOptions([]);
212
+ case 32:
213
+ setDynamicApiLoading(false);
214
+ case 33:
152
215
  case "end":
153
216
  return _context.stop();
154
217
  }
155
- }, _callee, null, [[1, 9]]);
218
+ }, _callee, null, [[1, 9], [17, 29]]);
156
219
  }));
157
220
  return function (_x) {
158
221
  return _ref2.apply(this, arguments);
159
222
  };
160
- }(), [getFilterOptionsFn]);
223
+ }(), [getFilterOptionsFn, getDynamicFilterOptionsFn]);
161
224
  var onSearch = useCallback(debounce(function (value) {
162
225
  // console.log('onSearch', value);
163
226
  fetchOptions(value);
@@ -165,8 +228,8 @@ var Filter = function Filter(_ref) {
165
228
  useEffect(function () {
166
229
  if ([FilterType.SingleSelect, FilterType.MultiSelect].includes(filterType)) {
167
230
  // 打开后自动获取可选值
168
- var _ref3 = columnFilterValue || {},
169
- optionsParam = _ref3.optionsParam;
231
+ var _ref7 = columnFilterValue || {},
232
+ optionsParam = _ref7.optionsParam;
170
233
  fetchOptions(optionsParam);
171
234
  }
172
235
  }, []);
@@ -276,7 +339,7 @@ var Filter = function Filter(_ref) {
276
339
  options: options,
277
340
  isFrontSearch: isFilterOptionsFrontSearch,
278
341
  onCloseFilterPanel: onCloseFilterPanel,
279
- loading: apiLoading
342
+ loading: loading
280
343
  });
281
344
  case FilterType.MultiSelect:
282
345
  default:
@@ -285,7 +348,7 @@ var Filter = function Filter(_ref) {
285
348
  onChange: handleChangeSelectFilterValue,
286
349
  onSearch: onSearch,
287
350
  options: options,
288
- loading: apiLoading,
351
+ loading: loading,
289
352
  isFrontSearch: isFilterOptionsFrontSearch,
290
353
  onCloseFilterPanel: onCloseFilterPanel
291
354
  });
@@ -1,32 +1,32 @@
1
- .tableMax-filter-multipleSelect {
2
- width: 212px;
3
- .tableMax-filter-multipleSelect-header {
4
- border-bottom: 1px solid @tableColor7;
5
- padding: 8px 12px;
6
- }
7
- .tableMax-filter-multipleSelect-body {
8
- height: 220px;
9
- overflow-y: auto;
10
- padding: 4px 12px;
11
- .loading {
12
- height: 100%;
13
- width: 100%;
14
- display: flex;
15
- align-items: center;
16
- justify-content: center;
17
- }
18
- .ant-checkbox-group {
19
- display: flex;
20
- flex-direction: column;
21
- .ant-checkbox-wrapper {
22
- line-height: 24px;
23
- }
24
- }
25
- }
26
- .tableMax-filter-multipleSelect-footer {
27
- border-top: 1px solid @tableColor7;
28
- padding: 8px 12px;
29
- display: flex;
30
- justify-content: space-between;
31
- }
32
- }
1
+ .tableMax-filter-multipleSelect {
2
+ width: 212px;
3
+ .tableMax-filter-multipleSelect-header {
4
+ border-bottom: 1px solid @tableColor7;
5
+ padding: 8px 12px;
6
+ }
7
+ .tableMax-filter-multipleSelect-body {
8
+ height: 220px;
9
+ overflow-y: auto;
10
+ padding: 4px 12px;
11
+ .loading {
12
+ height: 100%;
13
+ width: 100%;
14
+ display: flex;
15
+ align-items: center;
16
+ justify-content: center;
17
+ }
18
+ .ant-checkbox-group {
19
+ display: flex;
20
+ flex-direction: column;
21
+ .ant-checkbox-wrapper {
22
+ line-height: 24px;
23
+ }
24
+ }
25
+ }
26
+ .tableMax-filter-multipleSelect-footer {
27
+ border-top: 1px solid @tableColor7;
28
+ padding: 8px 12px;
29
+ display: flex;
30
+ justify-content: space-between;
31
+ }
32
+ }
@@ -1,27 +1,27 @@
1
- .table-filter-number-range-wrapper {
2
- display: flex;
3
- flex-direction: column;
4
- .table-filter-number-range-body {
5
- display: flex;
6
- flex-direction: column;
7
- width: 188px;
8
- padding: 8px 12px;
9
- .split-wrapper {
10
- margin: 5px 0px;
11
- display: flex;
12
- justify-content: center;
13
- .horizontal-line {
14
- height: 2px;
15
- display: inline-block;
16
- background: @tableColor4;
17
- width: 12px;
18
- }
19
- }
20
- }
21
- .table-filter-number-range-footer {
22
- display: flex;
23
- justify-content: space-between;
24
- border-top: 1px solid @tableColor4;
25
- padding: 8px 12px;
26
- }
27
- }
1
+ .table-filter-number-range-wrapper {
2
+ display: flex;
3
+ flex-direction: column;
4
+ .table-filter-number-range-body {
5
+ display: flex;
6
+ flex-direction: column;
7
+ width: 188px;
8
+ padding: 8px 12px;
9
+ .split-wrapper {
10
+ margin: 5px 0px;
11
+ display: flex;
12
+ justify-content: center;
13
+ .horizontal-line {
14
+ height: 2px;
15
+ display: inline-block;
16
+ background: @tableColor4;
17
+ width: 12px;
18
+ }
19
+ }
20
+ }
21
+ .table-filter-number-range-footer {
22
+ display: flex;
23
+ justify-content: space-between;
24
+ border-top: 1px solid @tableColor4;
25
+ padding: 8px 12px;
26
+ }
27
+ }
@@ -1,43 +1,43 @@
1
- .tableMax-filter-singleSelect {
2
- box-sizing: border-box;
3
- width: 212px;
4
- .tableMax-filter-singleSelect-header {
5
- border-bottom: 1px solid @tableColor7;
6
- padding: 8px 12px;
7
- }
8
- .tableMax-filter-singleSelect-body {
9
- height: 220px;
10
- overflow-y: auto;
11
- padding: 4px 12px;
12
- .loading {
13
- height: 100%;
14
- width: 100%;
15
- display: flex;
16
- align-items: center;
17
- justify-content: center;
18
- }
19
- .item {
20
- padding: 2px 4px;
21
- cursor: pointer;
22
- border-radius: 2px;
23
- height: 20px;
24
- font-size: 14px;
25
- line-height: 20px;
26
- white-space: nowrap;
27
- overflow: hidden;
28
- text-overflow: ellipsis;
29
- }
30
- .item:hover {
31
- background-color: @tableColor8;
32
- }
33
- .selected {
34
- background-color: @tableColor8;
35
- }
36
- }
37
- .tableMax-filter-singleSelect-footer {
38
- border-top: 1px solid @tableColor7;
39
- padding: 8px 12px;
40
- display: flex;
41
- justify-content: space-between;
42
- }
43
- }
1
+ .tableMax-filter-singleSelect {
2
+ box-sizing: border-box;
3
+ width: 212px;
4
+ .tableMax-filter-singleSelect-header {
5
+ border-bottom: 1px solid @tableColor7;
6
+ padding: 8px 12px;
7
+ }
8
+ .tableMax-filter-singleSelect-body {
9
+ height: 220px;
10
+ overflow-y: auto;
11
+ padding: 4px 12px;
12
+ .loading {
13
+ height: 100%;
14
+ width: 100%;
15
+ display: flex;
16
+ align-items: center;
17
+ justify-content: center;
18
+ }
19
+ .item {
20
+ padding: 2px 4px;
21
+ cursor: pointer;
22
+ border-radius: 2px;
23
+ height: 20px;
24
+ font-size: 14px;
25
+ line-height: 20px;
26
+ white-space: nowrap;
27
+ overflow: hidden;
28
+ text-overflow: ellipsis;
29
+ }
30
+ .item:hover {
31
+ background-color: @tableColor8;
32
+ }
33
+ .selected {
34
+ background-color: @tableColor8;
35
+ }
36
+ }
37
+ .tableMax-filter-singleSelect-footer {
38
+ border-top: 1px solid @tableColor7;
39
+ padding: 8px 12px;
40
+ display: flex;
41
+ justify-content: space-between;
42
+ }
43
+ }
@@ -30,8 +30,10 @@ export type IFilterFnEnum = {
30
30
  [key in FilterType]: FilterFnType;
31
31
  };
32
32
  export declare function setDefaultFilterFn(columns: TableMaxColumnType[]): TableMaxColumnType[];
33
- export declare function ColumnFilter({ column, manualFiltering }: {
33
+ export declare function ColumnFilter({ column, manualFiltering, getDynamicFilterOptionsFn }: {
34
34
  column: Column<any, unknown>;
35
35
  manualFiltering: boolean;
36
+ getDynamicFilterOptionsFn: Function;
36
37
  }): import("react/jsx-runtime").JSX.Element;
37
38
  export declare function isEmpty(value: any): boolean;
39
+ export declare function uniqueByField(arr: any, field: any): any;
@@ -64,7 +64,8 @@ export function setDefaultFilterFn(columns) {
64
64
  }
65
65
  export function ColumnFilter(_ref) {
66
66
  var column = _ref.column,
67
- manualFiltering = _ref.manualFiltering;
67
+ manualFiltering = _ref.manualFiltering,
68
+ getDynamicFilterOptionsFn = _ref.getDynamicFilterOptionsFn;
68
69
  var _useConfig = useConfig(),
69
70
  root = _useConfig.root;
70
71
  var _useState = useState(false),
@@ -84,10 +85,10 @@ export function ColumnFilter(_ref) {
84
85
  setFilterPanelVisible(false);
85
86
  };
86
87
  if (filterPanelVisible) {
87
- window.addEventListener('click', clickHandler);
88
+ window.addEventListener('mousedown', clickHandler);
88
89
  }
89
90
  return function () {
90
- window.removeEventListener('click', clickHandler);
91
+ window.removeEventListener('mousedown', clickHandler);
91
92
  };
92
93
  }, [filterPanelVisible]);
93
94
 
@@ -148,7 +149,11 @@ export function ColumnFilter(_ref) {
148
149
  onClick: function onClick(e) {
149
150
  return e.stopPropagation();
150
151
  },
152
+ onMouseDown: function onMouseDown(e) {
153
+ return e.stopPropagation();
154
+ },
151
155
  children: /*#__PURE__*/_jsx(Filter, {
156
+ getDynamicFilterOptionsFn: getDynamicFilterOptionsFn,
152
157
  column: column,
153
158
  onCloseFilterPanel: handleClosePanel,
154
159
  manualFiltering: manualFiltering
@@ -160,4 +165,15 @@ export function isEmpty(value) {
160
165
  if (value) return false;
161
166
  if (value === false || value === 0) return false;
162
167
  return true;
168
+ }
169
+ export function uniqueByField(arr, field) {
170
+ var map = new Map();
171
+ return arr.filter(function (item) {
172
+ var key = item[field];
173
+ if (!map.has(key)) {
174
+ map.set(key, true);
175
+ return true;
176
+ }
177
+ return false;
178
+ });
163
179
  }