@arim-aisdc/public-components 2.2.8 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/iconfont/table/iconfont.css +29 -9
- package/dist/assets/iconfont/table/iconfont.ttf +0 -0
- package/dist/components/BaseInfo/BaseInfo.d.ts +1 -1
- package/dist/components/CustomForm/CustomForm.js +8 -4
- package/dist/components/CustomForm/type.d.ts +1 -1
- package/dist/components/QueryFilter/QueryFilter.js +9 -4
- package/dist/components/QueryFilter/type.d.ts +2 -5
- package/dist/components/TableMax/TableBody/Row.js +21 -13
- package/dist/components/TableMax/TableBody/index.less +14 -0
- package/dist/components/TableMax/TableHeader/Cell.d.ts +3 -1
- package/dist/components/TableMax/TableHeader/Cell.js +19 -16
- package/dist/components/TableMax/TableHeader/index.d.ts +2 -1
- package/dist/components/TableMax/TableHeader/index.js +11 -20
- package/dist/components/TableMax/TableHeader/index.less +7 -0
- package/dist/components/TableMax/TableMax.d.ts +1 -2
- package/dist/components/TableMax/TableMax.js +11 -7
- package/dist/components/TableMax/components/{ColumnFilter/FilterDateRange → ColumnFilterV2/DateRange}/index.d.ts +2 -1
- package/dist/components/TableMax/components/ColumnFilterV2/DateRange/index.js +135 -0
- package/dist/components/TableMax/components/{ColumnFilter/FilterDateRange → ColumnFilterV2/DateRange}/index.less +5 -5
- package/dist/components/TableMax/components/ColumnFilterV2/Filter.d.ts +9 -0
- package/dist/components/TableMax/components/{ColumnFilter/index.js → ColumnFilterV2/Filter.js} +173 -226
- package/dist/components/TableMax/components/{ColumnFilter → ColumnFilterV2}/MultipleSelect/index.d.ts +3 -1
- package/dist/components/TableMax/components/ColumnFilterV2/MultipleSelect/index.js +124 -0
- package/dist/components/TableMax/components/ColumnFilterV2/MultipleSelect/index.less +32 -0
- package/dist/components/TableMax/components/ColumnFilterV2/NumberRange/index.d.ts +10 -0
- package/dist/components/TableMax/components/ColumnFilterV2/NumberRange/index.js +98 -0
- package/dist/components/TableMax/components/ColumnFilterV2/NumberRange/index.less +27 -0
- package/dist/components/TableMax/components/ColumnFilterV2/SingleSelect/index.d.ts +12 -0
- package/dist/components/TableMax/components/ColumnFilterV2/SingleSelect/index.js +107 -0
- package/dist/components/TableMax/components/ColumnFilterV2/SingleSelect/index.less +43 -0
- package/dist/components/TableMax/components/{ColumnFilter → ColumnFilterV2}/customFilterFns.js +1 -1
- package/dist/components/TableMax/components/{ColumnFilter → ColumnFilterV2}/index.d.ts +15 -1
- package/dist/components/TableMax/components/ColumnFilterV2/index.js +149 -0
- package/dist/components/TableMax/components/ColumnFilterV2/index.less +23 -0
- package/dist/components/TableMax/components/ColumnSetting/index.js +4 -13
- package/dist/components/TableMax/components/ColumnSort/customSortFns.js +43 -8
- package/dist/components/TableMax/components/ColumnSort/index.js +8 -1
- package/dist/components/TableMax/components/ColumnSort/index.less +6 -4
- package/dist/components/TableMax/index.d.ts +2 -2
- package/dist/components/TableMax/index.js +1 -1
- package/dist/components/TableMax/type.d.ts +33 -5
- package/dist/components/TableMax/type.js +21 -1
- package/dist/components/TableMax/utils.d.ts +13 -2
- package/dist/components/TableMax/utils.js +81 -8
- package/dist/themes/variables.less +5 -5
- package/dist/themes/variablesConfig.js +6 -6
- package/dist/utils/request.d.ts +4 -3
- package/dist/utils/request.js +4 -4
- package/package.json +1 -1
- package/dist/components/TableMax/components/ColumnFilter/FilterDateRange/index.js +0 -101
- package/dist/components/TableMax/components/ColumnFilter/MultipleSelect/index.js +0 -52
- package/dist/components/TableMax/components/ColumnFilter/MultipleSelect/index.less +0 -20
- package/dist/components/TableMax/components/ColumnFilter/SingleSelect/index.d.ts +0 -10
- package/dist/components/TableMax/components/ColumnFilter/SingleSelect/index.js +0 -27
- package/dist/components/TableMax/components/ColumnFilter/SingleSelect/index.less +0 -8
- /package/dist/components/TableMax/components/{ColumnFilter → ColumnFilterV2}/customFilterFns.d.ts +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.filter-icon {
|
|
2
|
+
cursor: pointer;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.height-light-filter {
|
|
6
|
+
color: @global-primary-color;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.filter-panel-wrapper {
|
|
10
|
+
position: fixed;
|
|
11
|
+
z-index: 9999;
|
|
12
|
+
border-radius: 2px;
|
|
13
|
+
width: fit-content;
|
|
14
|
+
box-shadow: 0px 5px 12px 4px rgba(3, 6, 33, 0.15);
|
|
15
|
+
background: @tableSettingModalBgc;
|
|
16
|
+
// border: 1px solid #d9d9d9;
|
|
17
|
+
transform: translateX(-100%);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.single-com-wrapper {
|
|
21
|
+
padding: 8px 12px;
|
|
22
|
+
border-radius: 2px;
|
|
23
|
+
}
|
|
@@ -8,7 +8,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
8
8
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
9
9
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
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
|
-
import { Checkbox, Segmented,
|
|
11
|
+
import { Checkbox, Segmented, Tooltip } from 'antd';
|
|
12
12
|
import { cloneDeep } from 'lodash';
|
|
13
13
|
import React, { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
14
14
|
import { useDrag, useDrop } from 'react-dnd';
|
|
@@ -342,18 +342,9 @@ var ColumnSetting = function ColumnSetting(_ref3) {
|
|
|
342
342
|
ref: configWrapperRef,
|
|
343
343
|
className: "column-config-wapper",
|
|
344
344
|
style: columnConfigStyle,
|
|
345
|
-
children: [/*#__PURE__*/
|
|
345
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
346
346
|
className: "first-row-setting",
|
|
347
|
-
children:
|
|
348
|
-
className: "column-filtering",
|
|
349
|
-
children: [/*#__PURE__*/_jsx("span", {
|
|
350
|
-
children: "\u663E\u793A\u7B5B\u9009"
|
|
351
|
-
}), /*#__PURE__*/_jsx(Switch, {
|
|
352
|
-
className: "switch-button",
|
|
353
|
-
defaultChecked: enableFilters,
|
|
354
|
-
onChange: onFilterSwitchChange
|
|
355
|
-
})]
|
|
356
|
-
}) : null, /*#__PURE__*/_jsxs("div", {
|
|
347
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
357
348
|
className: "header-row-num-setting",
|
|
358
349
|
children: [/*#__PURE__*/_jsx("span", {
|
|
359
350
|
children: "\u6807\u9898\u884C\u6570"
|
|
@@ -365,7 +356,7 @@ var ColumnSetting = function ColumnSetting(_ref3) {
|
|
|
365
356
|
marginLeft: 12
|
|
366
357
|
}
|
|
367
358
|
})]
|
|
368
|
-
})
|
|
359
|
+
})
|
|
369
360
|
}), /*#__PURE__*/_jsxs("div", {
|
|
370
361
|
className: "column-setting-wapper",
|
|
371
362
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
2
|
import { InputType } from "../ColumnEdit";
|
|
3
|
-
import { FilterType } from "../
|
|
3
|
+
import { FilterType } from "../ColumnFilterV2";
|
|
4
4
|
var isEmpty = function isEmpty(a) {
|
|
5
5
|
return a === null || a === undefined || a === '';
|
|
6
6
|
};
|
|
@@ -40,18 +40,53 @@ export var stringSortFn = function stringSortFn(rowA, rowB, columnId) {
|
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
// 定义类型权重:数字为0,布尔为1,字符串为2
|
|
44
|
+
var getTypeWeight = function getTypeWeight(value) {
|
|
45
|
+
if (typeof value === 'number') return 0; // 数字优先
|
|
46
|
+
if (typeof value === 'boolean') return 1; // 布尔次之
|
|
47
|
+
if (typeof value === 'string') return 2; // 字符串最后
|
|
48
|
+
return Infinity; // 其他类型(如果存在)放到最后
|
|
49
|
+
};
|
|
50
|
+
|
|
43
51
|
// 数字或字符串排序(按值得类型判断是数字排序还是字符串排序)
|
|
44
52
|
export var numberOrStringSortFn = function numberOrStringSortFn(rowA, rowB, columnId) {
|
|
45
53
|
var aValue = rowA.getValue(columnId);
|
|
46
54
|
var bValue = rowB.getValue(columnId);
|
|
47
55
|
if (!isEmpty(aValue) && !isEmpty(bValue)) {
|
|
48
|
-
|
|
56
|
+
// 获取两个值的类型权重
|
|
57
|
+
var weightA = getTypeWeight(aValue);
|
|
58
|
+
var weightB = getTypeWeight(bValue);
|
|
59
|
+
// 如果类型不同,直接比较权重
|
|
60
|
+
if (weightA !== weightB) {
|
|
61
|
+
if (weightA > weightB) {
|
|
62
|
+
return 1;
|
|
63
|
+
} else {
|
|
64
|
+
return -1;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// 如果类型相同,根据具体类型进行值的比较
|
|
68
|
+
if (typeof aValue === 'number') {
|
|
69
|
+
// 数字:按数值大小排序
|
|
49
70
|
return aValue > bValue ? 1 : aValue < bValue ? -1 : 0;
|
|
71
|
+
} else if (typeof aValue === 'boolean') {
|
|
72
|
+
// 布尔值:false (0) < true (1)
|
|
73
|
+
return aValue === true && bValue === false ? 1 : aValue === false && bValue === true ? -1 : 0;
|
|
74
|
+
} else if (typeof aValue === 'string') {
|
|
75
|
+
// 字符串:按字典序排序
|
|
76
|
+
// return aValue.localeCompare(bValue);
|
|
77
|
+
var compare = aValue.localeCompare(bValue);
|
|
78
|
+
return compare < 0 ? -1 : compare > 0 ? 1 : 0;
|
|
50
79
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
80
|
+
// 如果是其他类型,保持原顺序
|
|
81
|
+
return 0;
|
|
82
|
+
|
|
83
|
+
// if (typeof aValue === 'number' && typeof bValue === 'number') {
|
|
84
|
+
// return aValue > bValue ? 1 : aValue < bValue ? -1 : 0;
|
|
85
|
+
// }
|
|
86
|
+
// aValue = aValue + '';
|
|
87
|
+
// bValue = bValue + '';
|
|
88
|
+
// const compare = aValue.localeCompare(bValue);
|
|
89
|
+
// return compare < 0 ? -1 : compare > 0 ? 1 : 0;
|
|
55
90
|
} else if (!isEmpty(aValue) && isEmpty(bValue)) {
|
|
56
91
|
return 1;
|
|
57
92
|
} else if (isEmpty(aValue) && !isEmpty(bValue)) {
|
|
@@ -95,9 +130,9 @@ export function setDefaultSortFn(columns) {
|
|
|
95
130
|
// 解决排序时undefined值的排序问题
|
|
96
131
|
column.sortUndefined = -1;
|
|
97
132
|
if (!column.sortingFn) {
|
|
98
|
-
if (column.editComType === InputType.InputNumber || column.filterType === FilterType.Integer || column.filterType === FilterType.SingleInteger) {
|
|
133
|
+
if (column.editComType === InputType.InputNumber || column.filterType === FilterType.Integer || column.filterType === FilterType.NumberRange || column.filterType === FilterType.SingleInteger || column.filterType === FilterType.SingleNumber) {
|
|
99
134
|
column.sortingFn = 'numberSortFn'; // 数字排序
|
|
100
|
-
} else if (column.editComType === InputType.DatePicker || column.filterType === FilterType.Date || column.filterType === FilterType.SingleDate) {
|
|
135
|
+
} else if (column.editComType === InputType.DatePicker || column.filterType === FilterType.Date || column.filterType === FilterType.DateRange || column.filterType === FilterType.SingleDate) {
|
|
101
136
|
column.sortingFn = 'timeSortFn'; // 时间排序
|
|
102
137
|
} else {
|
|
103
138
|
column.sortingFn = 'numberOrStringSortFn'; // 默认字符串排序
|
|
@@ -22,6 +22,13 @@ var Sort = function Sort(_ref) {
|
|
|
22
22
|
})]
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
return
|
|
25
|
+
return /*#__PURE__*/_jsxs("span", {
|
|
26
|
+
className: "sort-flag",
|
|
27
|
+
children: [/*#__PURE__*/_jsx("i", {
|
|
28
|
+
className: "triangle-up"
|
|
29
|
+
}), /*#__PURE__*/_jsx("i", {
|
|
30
|
+
className: "triangle-down"
|
|
31
|
+
})]
|
|
32
|
+
});
|
|
26
33
|
};
|
|
27
34
|
export default Sort;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
.sort-flag {
|
|
2
|
-
display:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: center;
|
|
4
|
+
align-items: center;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
width: 16px;
|
|
7
|
+
cursor: pointer;
|
|
6
8
|
|
|
7
9
|
.triangle-up {
|
|
8
10
|
display: block;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import TableMax from './TableMax';
|
|
2
2
|
export { ColumnType } from './TableMax';
|
|
3
3
|
export { InputType } from './components/ColumnEdit';
|
|
4
|
-
export { FilterType } from './components/
|
|
5
|
-
export type { FilterFnType } from './components/
|
|
4
|
+
export { FilterType } from './components/ColumnFilterV2';
|
|
5
|
+
export type { FilterFnType } from './components/ColumnFilterV2';
|
|
6
6
|
export type { SortFnType } from './components/ColumnSort/customSortFns';
|
|
7
7
|
export type { ColumnPinningConfigType, ColumnVisibleConfigType, TableMaxColumnType, TableMaxProps } from './type';
|
|
8
8
|
export default TableMax;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import TableMax from "./TableMax";
|
|
2
2
|
export { ColumnType } from "./TableMax";
|
|
3
3
|
export { InputType } from "./components/ColumnEdit";
|
|
4
|
-
export { FilterType } from "./components/
|
|
4
|
+
export { FilterType } from "./components/ColumnFilterV2";
|
|
5
5
|
export default TableMax;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ColumnFiltersState, ColumnResizeMode, RowModel, SortingState } from '@tanstack/react-table';
|
|
2
|
-
import { UploadProps } from 'antd';
|
|
2
|
+
import { TimeRangePickerProps, UploadProps } from 'antd';
|
|
3
3
|
import { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
4
4
|
import { InputType } from './components/ColumnEdit';
|
|
5
|
-
import { FilterFnType, FilterType } from './components/
|
|
5
|
+
import { FilterFnType, FilterType } from './components/ColumnFilterV2';
|
|
6
6
|
import { SortFnType } from './components/ColumnSort/customSortFns';
|
|
7
7
|
export type PrefixClsType = 'custom-light' | 'custom-dark';
|
|
8
8
|
export declare enum DropSide {
|
|
@@ -208,6 +208,9 @@ export type TableMaxProps = {
|
|
|
208
208
|
formatFilters: {
|
|
209
209
|
[key: string]: any;
|
|
210
210
|
};
|
|
211
|
+
formatFiltersV2: {
|
|
212
|
+
[key: string]: any;
|
|
213
|
+
};
|
|
211
214
|
}) => void;
|
|
212
215
|
/**自定义表格顶部所有的内容 */
|
|
213
216
|
renderOperate?: ReactNode;
|
|
@@ -326,7 +329,7 @@ export interface TableMaxColumnType {
|
|
|
326
329
|
columns?: TableMaxColumnType[];
|
|
327
330
|
/**列宽度 */
|
|
328
331
|
size?: number;
|
|
329
|
-
|
|
332
|
+
/**单位转换函数,编辑、筛选时,会自动调用这个函数处理用户输入的值 */
|
|
330
333
|
unitsChangeFn?: (num: number) => number;
|
|
331
334
|
/**列筛选时 筛选组件类型 */
|
|
332
335
|
filterType?: FilterType;
|
|
@@ -341,13 +344,14 @@ export interface TableMaxColumnType {
|
|
|
341
344
|
filterFn?: FilterFnType | ((row: any, columnId: any, filterValue: any) => boolean);
|
|
342
345
|
/**筛选组件属性配置 */
|
|
343
346
|
filterComProps?: {
|
|
344
|
-
showTime?:
|
|
347
|
+
showTime?: any;
|
|
345
348
|
format?: string;
|
|
346
349
|
picker?: 'date' | 'week' | 'month' | 'quarter' | 'year';
|
|
350
|
+
rangePresets?: TimeRangePickerProps['presets'];
|
|
347
351
|
};
|
|
348
352
|
/**自定义当前列筛选值所使用的key,默认为当前列的id: { [ filterKey || id ]: value} */
|
|
349
353
|
filterKey?: string;
|
|
350
|
-
|
|
354
|
+
/**当前列是否可筛选,默认true */
|
|
351
355
|
enableColumnFilter?: boolean;
|
|
352
356
|
/**自定义列的类名 */
|
|
353
357
|
columnClassName?: string[];
|
|
@@ -383,3 +387,27 @@ export interface TableMaxColumnType {
|
|
|
383
387
|
/**是否可调整列宽大小 */
|
|
384
388
|
enableResizing?: boolean;
|
|
385
389
|
}
|
|
390
|
+
export type FormatFilterType = {
|
|
391
|
+
field: string;
|
|
392
|
+
operator: FilterOperator;
|
|
393
|
+
value: any;
|
|
394
|
+
};
|
|
395
|
+
export declare enum FilterOperator {
|
|
396
|
+
Eq = "Eq",// 等于 Field = "Name", Value = "张三"
|
|
397
|
+
Neq = "Neq",// 不等于 Field = "Age", Value = 18
|
|
398
|
+
Gt = "Gt",// 大于 Field = "Price", Value = 100
|
|
399
|
+
Lt = "Lt",// 小于 Field = "Price", Value = 200
|
|
400
|
+
Ge = "Ge",// 大于等于 Field = "Amount", Value = 1000
|
|
401
|
+
Le = "Le",// 小于等于 Field = "Amount", Value = 2000
|
|
402
|
+
Contains = "Contains",// 包含 Field = "Name", Value = "张"
|
|
403
|
+
NotContains = "NotContains",// 不包含 Field = "Name", Value = "李"
|
|
404
|
+
StartsWith = "StartsWith",// 开头是 Field = "Code", Value = "A"
|
|
405
|
+
NotStartsWith = "NotStartsWith",// 开头不是 Field = "Code", Value = "A"
|
|
406
|
+
EndsWith = "EndsWith",// 结尾是 Field = "Email", Value = "@gmail.com"
|
|
407
|
+
NotEndsWith = "NotEndsWith",// 结尾不是 Field = "Email", Value = "@gmail.com"
|
|
408
|
+
In = "In",// 在列表中 Field = "Status", Value = [1, 2, 3]
|
|
409
|
+
NotIn = "NotIn",// 不在列表中 Field = "Type", Value = ["A", "B"]
|
|
410
|
+
Between = "Between",// 区间 Field = "Date", Value = [startDate, endDate]
|
|
411
|
+
IsNull = "IsNull",// 为空 Field = "Remark"
|
|
412
|
+
IsNotNull = "IsNotNull"
|
|
413
|
+
}
|
|
@@ -14,4 +14,24 @@ export var layoutOptions = [{
|
|
|
14
14
|
}, {
|
|
15
15
|
key: LayoutType.COMPACT,
|
|
16
16
|
label: '紧凑'
|
|
17
|
-
}];
|
|
17
|
+
}];
|
|
18
|
+
export var FilterOperator = /*#__PURE__*/function (FilterOperator) {
|
|
19
|
+
FilterOperator["Eq"] = "Eq";
|
|
20
|
+
FilterOperator["Neq"] = "Neq";
|
|
21
|
+
FilterOperator["Gt"] = "Gt";
|
|
22
|
+
FilterOperator["Lt"] = "Lt";
|
|
23
|
+
FilterOperator["Ge"] = "Ge";
|
|
24
|
+
FilterOperator["Le"] = "Le";
|
|
25
|
+
FilterOperator["Contains"] = "Contains";
|
|
26
|
+
FilterOperator["NotContains"] = "NotContains";
|
|
27
|
+
FilterOperator["StartsWith"] = "StartsWith";
|
|
28
|
+
FilterOperator["NotStartsWith"] = "NotStartsWith";
|
|
29
|
+
FilterOperator["EndsWith"] = "EndsWith";
|
|
30
|
+
FilterOperator["NotEndsWith"] = "NotEndsWith";
|
|
31
|
+
FilterOperator["In"] = "In";
|
|
32
|
+
FilterOperator["NotIn"] = "NotIn";
|
|
33
|
+
FilterOperator["Between"] = "Between";
|
|
34
|
+
FilterOperator["IsNull"] = "IsNull";
|
|
35
|
+
FilterOperator["IsNotNull"] = "IsNotNull";
|
|
36
|
+
return FilterOperator;
|
|
37
|
+
}({}); // 不为空 Field = "Email"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ColumnFiltersState, SortingState } from '@tanstack/react-table';
|
|
2
|
-
import { TableMaxColumnType } from './type';
|
|
2
|
+
import { FormatFilterType, TableMaxColumnType } from './type';
|
|
3
|
+
export declare const noValue: (value: any) => boolean;
|
|
3
4
|
export declare const getSizeInfo: (columns: TableMaxColumnType[]) => {
|
|
4
5
|
allCount: number;
|
|
5
6
|
hasSizeCount: number;
|
|
@@ -18,11 +19,21 @@ export declare const setInitColumnsSize: (tableColumns: any, columnsMap: any, de
|
|
|
18
19
|
tableColumns: any;
|
|
19
20
|
};
|
|
20
21
|
export declare const getFormatFilters: (columns: TableMaxColumnType[], originFilters: ColumnFiltersState) => {};
|
|
22
|
+
/**
|
|
23
|
+
* 不同filterType组件的查询格式:
|
|
24
|
+
* 1. DateRange/NumberRange:
|
|
25
|
+
* 1.1 只输入开始:Ge
|
|
26
|
+
* 1.2 只输入结束:Le
|
|
27
|
+
* 1.3 都输入:Between
|
|
28
|
+
* 2. MultiSelect没有填filterType:In
|
|
29
|
+
* 3. Input/AutoComplete:Contains
|
|
30
|
+
* 4. SingleDate/SingleNumber/SingleSelect:Eq
|
|
31
|
+
*/
|
|
32
|
+
export declare const getFormatFiltersV2: (columns: TableMaxColumnType[], originFilters: ColumnFiltersState) => FormatFilterType[];
|
|
21
33
|
export declare const getFormatSorting: (columns: TableMaxColumnType[], originSorting: SortingState) => {
|
|
22
34
|
id: string;
|
|
23
35
|
desc: boolean;
|
|
24
36
|
}[];
|
|
25
|
-
export declare const noValue: (value: any) => boolean;
|
|
26
37
|
export declare const operationColumnNoTooltips: (columns: TableMaxColumnType[]) => TableMaxColumnType[];
|
|
27
38
|
export declare const downloadExcel: ({ url, data, title, setDownLoading, method, request, }: {
|
|
28
39
|
url: string;
|
|
@@ -7,7 +7,11 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
7
7
|
import dayjs from 'dayjs';
|
|
8
8
|
import { cloneDeep } from 'lodash';
|
|
9
9
|
// import request from '../../utils/request';
|
|
10
|
-
import { FilterType, defaultDateFormat } from "./components/
|
|
10
|
+
import { FilterType, defaultDateFormat } from "./components/ColumnFilterV2";
|
|
11
|
+
import { FilterOperator } from "./type";
|
|
12
|
+
export var noValue = function noValue(value) {
|
|
13
|
+
return value === undefined || value === null || value === '';
|
|
14
|
+
};
|
|
11
15
|
export var getSizeInfo = function getSizeInfo(columns) {
|
|
12
16
|
// let columns = cloneDeep(columnDatas)
|
|
13
17
|
var hasSizeCount = 0; //size有值的列
|
|
@@ -54,10 +58,10 @@ export var setRemainColumnsWidth = function setRemainColumnsWidth(initColumns, d
|
|
|
54
58
|
var fn = function fn(columns) {
|
|
55
59
|
columns.forEach(function (column) {
|
|
56
60
|
var _ref, _column$size2;
|
|
57
|
-
console.log(column.size, (_ref = (_column$size2 = column.size) !== null && _column$size2 !== void 0 ? _column$size2 : defaultSize) !== null && _ref !== void 0 ? _ref : (column === null || column === void 0 ? void 0 : column.filterType) === FilterType.Date ? 160 : getTextWidth(column.header, 14) + 50);
|
|
61
|
+
console.log(column.size, (_ref = (_column$size2 = column.size) !== null && _column$size2 !== void 0 ? _column$size2 : defaultSize) !== null && _ref !== void 0 ? _ref : (column === null || column === void 0 ? void 0 : column.filterType) === FilterType.Date || (column === null || column === void 0 ? void 0 : column.filterType) === FilterType.DateRange ? 160 : getTextWidth(column.header, 14) + 50);
|
|
58
62
|
if (!column.columns) {
|
|
59
63
|
var _ref2, _column$size3;
|
|
60
|
-
column.size = (_ref2 = (_column$size3 = column.size) !== null && _column$size3 !== void 0 ? _column$size3 : defaultSize) !== null && _ref2 !== void 0 ? _ref2 : (column === null || column === void 0 ? void 0 : column.filterType) === FilterType.Date ? 160 : getTextWidth(column.header, 14) + 50;
|
|
64
|
+
column.size = (_ref2 = (_column$size3 = column.size) !== null && _column$size3 !== void 0 ? _column$size3 : defaultSize) !== null && _ref2 !== void 0 ? _ref2 : (column === null || column === void 0 ? void 0 : column.filterType) === FilterType.Date || (column === null || column === void 0 ? void 0 : column.filterType) === FilterType.DateRange ? 160 : getTextWidth(column.header, 14) + 50;
|
|
61
65
|
tableColumnsWidth += column.size;
|
|
62
66
|
columnsWidthMap[column.id] = column.size;
|
|
63
67
|
} else {
|
|
@@ -109,11 +113,11 @@ export var getFormatFilters = function getFormatFilters(columns, originFilters)
|
|
|
109
113
|
format = _ref4$format === void 0 ? defaultDateFormat : _ref4$format;
|
|
110
114
|
// 优先取formattedFilterKey作为key
|
|
111
115
|
var formatKey = filterKey || id;
|
|
112
|
-
if (filterType === FilterType.Date) {
|
|
116
|
+
if (filterType === FilterType.Date || filterType === FilterType.DateRange) {
|
|
113
117
|
// 时间范围
|
|
114
118
|
formatFilters["".concat(formatKey, "From")] = value !== null && value !== void 0 && value.startDate ? dayjs(value.startDate).format(format) : '';
|
|
115
119
|
formatFilters["".concat(formatKey, "To")] = value !== null && value !== void 0 && value.endDate ? dayjs(value === null || value === void 0 ? void 0 : value.endDate).format(format) : '';
|
|
116
|
-
} else if (filterType === FilterType.Integer) {
|
|
120
|
+
} else if (filterType === FilterType.Integer || filterType === FilterType.NumberRange) {
|
|
117
121
|
// 数字范围
|
|
118
122
|
formatFilters["".concat(formatKey, "From")] = value === null || value === void 0 ? void 0 : value[0];
|
|
119
123
|
formatFilters["".concat(formatKey, "To")] = value === null || value === void 0 ? void 0 : value[1];
|
|
@@ -128,6 +132,78 @@ export var getFormatFilters = function getFormatFilters(columns, originFilters)
|
|
|
128
132
|
});
|
|
129
133
|
return formatFilters;
|
|
130
134
|
};
|
|
135
|
+
|
|
136
|
+
// 动态化查询格式:https://arim-jyzx.coding.net/p/infra/wiki/3252
|
|
137
|
+
/**
|
|
138
|
+
* 不同filterType组件的查询格式:
|
|
139
|
+
* 1. DateRange/NumberRange:
|
|
140
|
+
* 1.1 只输入开始:Ge
|
|
141
|
+
* 1.2 只输入结束:Le
|
|
142
|
+
* 1.3 都输入:Between
|
|
143
|
+
* 2. MultiSelect没有填filterType:In
|
|
144
|
+
* 3. Input/AutoComplete:Contains
|
|
145
|
+
* 4. SingleDate/SingleNumber/SingleSelect:Eq
|
|
146
|
+
*/
|
|
147
|
+
export var getFormatFiltersV2 = function getFormatFiltersV2(columns, originFilters) {
|
|
148
|
+
// console.log('getFormatFilters :>> ', columns, originFilters);
|
|
149
|
+
var formatFilters = [];
|
|
150
|
+
originFilters.forEach(function (filter) {
|
|
151
|
+
var id = filter.id,
|
|
152
|
+
value = filter.value;
|
|
153
|
+
var curColumn = columns.find(function (item) {
|
|
154
|
+
return item.id === id;
|
|
155
|
+
});
|
|
156
|
+
var filterType = curColumn.filterType,
|
|
157
|
+
filterKey = curColumn.filterKey;
|
|
158
|
+
// const { format = defaultDateFormat } = curColumn.filterComProps || {};
|
|
159
|
+
// 优先取formattedFilterKey作为key
|
|
160
|
+
var formatKey = filterKey || id;
|
|
161
|
+
var res = {
|
|
162
|
+
field: formatKey,
|
|
163
|
+
operator: FilterOperator.Contains,
|
|
164
|
+
value: null
|
|
165
|
+
};
|
|
166
|
+
if (filterType === FilterType.Date || filterType === FilterType.DateRange) {
|
|
167
|
+
// 时间范围
|
|
168
|
+
if (value !== null && value !== void 0 && value.startDate && !(value !== null && value !== void 0 && value.endDate)) {
|
|
169
|
+
res.operator = FilterOperator.Ge;
|
|
170
|
+
res.value = value.startDate;
|
|
171
|
+
} else if (!(value !== null && value !== void 0 && value.startDate) && value !== null && value !== void 0 && value.endDate) {
|
|
172
|
+
res.operator = FilterOperator.Le;
|
|
173
|
+
res.value = value.endDate;
|
|
174
|
+
} else if (value !== null && value !== void 0 && value.startDate && value !== null && value !== void 0 && value.endDate) {
|
|
175
|
+
res.operator = FilterOperator.Between;
|
|
176
|
+
res.value = [value.startDate, value.endDate];
|
|
177
|
+
}
|
|
178
|
+
} else if (filterType === FilterType.Integer || filterType === FilterType.NumberRange) {
|
|
179
|
+
// 数字范围
|
|
180
|
+
if (!noValue(value === null || value === void 0 ? void 0 : value[0]) && noValue(value === null || value === void 0 ? void 0 : value[1])) {
|
|
181
|
+
res.operator = FilterOperator.Ge;
|
|
182
|
+
res.value = value[0];
|
|
183
|
+
} else if (noValue(value === null || value === void 0 ? void 0 : value[0]) && !noValue(value === null || value === void 0 ? void 0 : value[1])) {
|
|
184
|
+
res.operator = FilterOperator.Le;
|
|
185
|
+
res.value = value[1];
|
|
186
|
+
} else if (!noValue(value === null || value === void 0 ? void 0 : value[0]) && !noValue(value === null || value === void 0 ? void 0 : value[1])) {
|
|
187
|
+
res.operator = FilterOperator.Between;
|
|
188
|
+
res.value = value;
|
|
189
|
+
}
|
|
190
|
+
} else if (filterType === FilterType.MultiSelect || !filterType) {
|
|
191
|
+
// 多选组件
|
|
192
|
+
res.operator = FilterOperator.In;
|
|
193
|
+
res.value = value;
|
|
194
|
+
} else if (filterType === FilterType.Input || filterType === FilterType.AutoComplete) {
|
|
195
|
+
// Input组件
|
|
196
|
+
res.operator = FilterOperator.Contains;
|
|
197
|
+
res.value = value;
|
|
198
|
+
} else {
|
|
199
|
+
// 其他组件: SingleDate/SingleNumber/SingleSelect
|
|
200
|
+
res.operator = FilterOperator.Eq;
|
|
201
|
+
res.value = value;
|
|
202
|
+
}
|
|
203
|
+
formatFilters.push(res);
|
|
204
|
+
});
|
|
205
|
+
return formatFilters;
|
|
206
|
+
};
|
|
131
207
|
export var getFormatSorting = function getFormatSorting(columns, originSorting) {
|
|
132
208
|
return originSorting.map(function (sort) {
|
|
133
209
|
var curColumn = columns.find(function (item) {
|
|
@@ -142,9 +218,6 @@ export var getFormatSorting = function getFormatSorting(columns, originSorting)
|
|
|
142
218
|
});
|
|
143
219
|
});
|
|
144
220
|
};
|
|
145
|
-
export var noValue = function noValue(value) {
|
|
146
|
-
return value === undefined || value === null || value === '';
|
|
147
|
-
};
|
|
148
221
|
export var operationColumnNoTooltips = function operationColumnNoTooltips(columns) {
|
|
149
222
|
columns.forEach(function (column) {
|
|
150
223
|
var _id$indexOf, _accessorKey$indexOf;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
@sliderRightBorder: var(--sliderRightBorder, #3e3b3b);
|
|
13
13
|
@selectTableRow: var(--select-table-row, #d0e37b);
|
|
14
14
|
@globalColor_table-line: var(--globalColor_table-line, #f0f0f0); // table行分隔线颜色
|
|
15
|
-
@rowHoverBackgroundColor: var(--table-row-hover-bgc, #ececee);
|
|
15
|
+
@rowHoverBackgroundColor: var(--table-row-hover-bgc, #ececee); // 行hover时背景色;选中背景色。
|
|
16
16
|
|
|
17
17
|
@splite-line: var(--split-line, #ececee);
|
|
18
18
|
@globalColor0: var(--globalColor0, #fdfdfe); // 网格遮罩色
|
|
@@ -59,19 +59,19 @@
|
|
|
59
59
|
@global-table-max-padding-left: var(--global-table-max-padding-left, 8px);
|
|
60
60
|
@global-table-max-padding-right: var(--global-table-max-padding-right, 16px);
|
|
61
61
|
@global-table-max-padding-bottom: var(--global-table-max-padding-bottom, 7px);
|
|
62
|
-
@global-table-max-border: var(--global-table-max-border, 1px solid #
|
|
62
|
+
@global-table-max-border: var(--global-table-max-border, 1px solid #d9d9d9);
|
|
63
63
|
@global-table-max-footer-border-radius: var(--global-table-max-footer-border-radius);
|
|
64
64
|
@global-table-max-center-border-radius: var(--global-table-max-center-border-radius);
|
|
65
65
|
@global-table-max-center-border-bottom: var(--global-table-max-center-border-bottom);
|
|
66
|
-
@global-table-max-scrollbar-track: var(--global-table-max-scrollbar-track, #
|
|
66
|
+
@global-table-max-scrollbar-track: var(--global-table-max-scrollbar-track, #e8e8e8);
|
|
67
67
|
@global-table-max-header-font-weight: var(--global-table-max-header-font-weight);
|
|
68
68
|
@global-table-max-body-font-weight: var(--global-table-max-body-font-weight);
|
|
69
69
|
@global-table-max-header-cell-wapper-line-height: var(--global-table-max-header-cell-wapper-line-height, 16px);
|
|
70
70
|
@global-table-body-tbody-tr-td-line-height: var(--global-table-body-tbody-tr-td-line-height, 32px);
|
|
71
71
|
|
|
72
72
|
// messageTip
|
|
73
|
-
@global-messageTip-background-color: var(--global-messageTip-background-color, #
|
|
74
|
-
@global-messageTip-text-color: var(--global-messageTip-text-color, #
|
|
73
|
+
@global-messageTip-background-color: var(--global-messageTip-background-color, #ffffff);
|
|
74
|
+
@global-messageTip-text-color: var(--global-messageTip-text-color, #ffffff);
|
|
75
75
|
@global-messageTip-font-size: var(--global-messageTip-font-size, 14px);
|
|
76
76
|
@global-messageTip-box-shadow: var(--global-messageTip-box-shadow, 0px 4px 8px rgba(0, 0, 0, 0.15));
|
|
77
77
|
@global-messageTip-border-radius: var(--global-messageTip-border-radius, 8px);
|
|
@@ -237,7 +237,7 @@ export var PublicThemeVariablesConfigTwo = {
|
|
|
237
237
|
'--scrollThumbHover': '#E8E8E8',
|
|
238
238
|
// rgba(0, 0, 0, 0.3)修改为#E8E8E8
|
|
239
239
|
'--sliderRightBorder': '#221919',
|
|
240
|
-
'--select-table-row': '#
|
|
240
|
+
'--select-table-row': '#EDEDED',
|
|
241
241
|
// 表格行选中颜色-1
|
|
242
242
|
'--split-line': '#ECECEE',
|
|
243
243
|
// 全局可切换颜色变量
|
|
@@ -271,7 +271,7 @@ export var PublicThemeVariablesConfigTwo = {
|
|
|
271
271
|
// 铸轧甘特图连铸板坯默认颜色
|
|
272
272
|
'--globalColor_table-line': '#f0f0f0',
|
|
273
273
|
// table行分隔线颜色
|
|
274
|
-
'--table-row-hover-bgc': '#
|
|
274
|
+
'--table-row-hover-bgc': '#CCDCF4 ',
|
|
275
275
|
// 行hover时背景色
|
|
276
276
|
'--arh-color': 'rgba(0, 0, 0, 0.1)',
|
|
277
277
|
// 列表头拖拽线背景色
|
|
@@ -324,7 +324,7 @@ export var PublicThemeVariablesConfigTwo = {
|
|
|
324
324
|
'--scrollThumbHover': '#1E345B',
|
|
325
325
|
// rgba(255, 255, 255, 0.3)修改为#1E345B
|
|
326
326
|
'--sliderRightBorder': '#3E3B3B',
|
|
327
|
-
'--select-table-row': '#
|
|
327
|
+
'--select-table-row': '#2D3A4D',
|
|
328
328
|
// 表格行选中颜色-1
|
|
329
329
|
// 全局可切换颜色变量
|
|
330
330
|
'--globalColor1': '#FFFFFF',
|
|
@@ -357,7 +357,7 @@ export var PublicThemeVariablesConfigTwo = {
|
|
|
357
357
|
// 铸轧甘特图连铸板坯默认颜色
|
|
358
358
|
'--globalColor_table-line': '#373b54',
|
|
359
359
|
// table行分隔线颜色
|
|
360
|
-
'--table-row-hover-bgc': '#
|
|
360
|
+
'--table-row-hover-bgc': '#143B76',
|
|
361
361
|
// 行hover时背景色,rgb(72,74,87) 修改为 #33476F
|
|
362
362
|
'--arh-color': 'rgba(255, 255, 255, 0.1)',
|
|
363
363
|
// 列表头拖拽线背景色
|
|
@@ -404,6 +404,6 @@ export var PublicThemeVariablesConfigTwo = {
|
|
|
404
404
|
})
|
|
405
405
|
};
|
|
406
406
|
export var publicThemeMap = {
|
|
407
|
-
|
|
408
|
-
|
|
407
|
+
DefaultThemePackage: PublicThemeVariablesConfig,
|
|
408
|
+
DyImsBlueThemePackage: PublicThemeVariablesConfigTwo
|
|
409
409
|
};
|
package/dist/utils/request.d.ts
CHANGED
package/dist/utils/request.js
CHANGED
|
@@ -59,13 +59,13 @@ var authHeaderInterceptor = function authHeaderInterceptor(url, options) {
|
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
62
|
+
* @deprecated
|
|
63
|
+
* 仅本地demo测试用,组件中不要用这个
|
|
64
|
+
* 仅本地demo测试用,组件中不要用这个
|
|
65
|
+
* 仅本地demo测试用,组件中不要用这个
|
|
65
66
|
* @en-US https://github.com/umijs/umi-request/blob/master/README_zh-CN.md
|
|
66
67
|
* @zh-CN 配置request请求时的默认参数
|
|
67
68
|
*/
|
|
68
|
-
|
|
69
69
|
var request = extend({
|
|
70
70
|
// prefix: BaseUrl,
|
|
71
71
|
timeoutMessage: '接口请求超时',
|