@gm-pc/business 1.24.9-beta.11 → 1.24.9-beta.13
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/README.md +3 -3
- package/package.json +4 -4
- package/src/code_input/code_input.tsx +38 -38
- package/src/code_input/index.ts +2 -2
- package/src/code_input/stories.tsx +66 -66
- package/src/code_input/util.ts +11 -11
- package/src/data_category_tree/data_category_tree.tsx +75 -75
- package/src/data_category_tree/index.ts +1 -1
- package/src/data_category_tree/stories.tsx +46 -46
- package/src/data_category_tree/util.ts +109 -109
- package/src/data_gegraphic_label/data_address.tsx +46 -46
- package/src/data_gegraphic_label/data_address_name.tsx +30 -30
- package/src/data_gegraphic_label/index.ts +2 -2
- package/src/data_gegraphic_label/stories.tsx +36 -36
- package/src/data_gegraphic_label/types.ts +44 -44
- package/src/data_gegraphic_label/util.ts +73 -73
- package/src/index.ts +4 -4
- package/src/stories.tsx +27 -27
- package/src/table_list/index.ts +2 -2
- package/src/table_list/table_list.tsx +110 -110
- package/src/table_list/table_total_text.tsx +36 -36
- package/src/table_list/types.ts +51 -51
- package/src/table_list/util.ts +16 -16
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './data_category_tree'
|
|
2
|
-
export * from './data_gegraphic_label'
|
|
3
|
-
export * from './code_input'
|
|
4
|
-
export * from './table_list'
|
|
1
|
+
export * from './data_category_tree'
|
|
2
|
+
export * from './data_gegraphic_label'
|
|
3
|
+
export * from './code_input'
|
|
4
|
+
export * from './table_list'
|
package/src/stories.tsx
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import sha256 from 'crypto-js/sha256'
|
|
3
|
-
import { Token } from 'gm_api/src/oauth'
|
|
4
|
-
|
|
5
|
-
export const ComLogin = () => {
|
|
6
|
-
return (
|
|
7
|
-
<div>
|
|
8
|
-
<button
|
|
9
|
-
onClick={() => {
|
|
10
|
-
Token({
|
|
11
|
-
grant_type: 'password',
|
|
12
|
-
username: 'admin',
|
|
13
|
-
group_id: '328775773546610712',
|
|
14
|
-
password: sha256('123456').toString(),
|
|
15
|
-
client_id: '1',
|
|
16
|
-
})
|
|
17
|
-
}}
|
|
18
|
-
>
|
|
19
|
-
login
|
|
20
|
-
</button>
|
|
21
|
-
</div>
|
|
22
|
-
)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default {
|
|
26
|
-
title: 'Business/ceres login',
|
|
27
|
-
}
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import sha256 from 'crypto-js/sha256'
|
|
3
|
+
import { Token } from 'gm_api/src/oauth'
|
|
4
|
+
|
|
5
|
+
export const ComLogin = () => {
|
|
6
|
+
return (
|
|
7
|
+
<div>
|
|
8
|
+
<button
|
|
9
|
+
onClick={() => {
|
|
10
|
+
Token({
|
|
11
|
+
grant_type: 'password',
|
|
12
|
+
username: 'admin',
|
|
13
|
+
group_id: '328775773546610712',
|
|
14
|
+
password: sha256('123456').toString(),
|
|
15
|
+
client_id: '1',
|
|
16
|
+
})
|
|
17
|
+
}}
|
|
18
|
+
>
|
|
19
|
+
login
|
|
20
|
+
</button>
|
|
21
|
+
</div>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
title: 'Business/ceres login',
|
|
27
|
+
}
|
package/src/table_list/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './table_list'
|
|
2
|
-
export * from './types'
|
|
1
|
+
export * from './table_list'
|
|
2
|
+
export * from './types'
|
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Description: 业务列表、半自动请求
|
|
3
|
-
*/
|
|
4
|
-
import React, { useState, useImperativeHandle } from 'react'
|
|
5
|
-
import { BoxTable, BoxTableInfo } from '@gm-pc/react'
|
|
6
|
-
import { Table, TableProps, SortsType, useTableRef } from '@gm-pc/table-x'
|
|
7
|
-
|
|
8
|
-
import { usePagination, useUpdateEffect } from '@gm-common/hooks'
|
|
9
|
-
|
|
10
|
-
import TableTotalText from './table_total_text'
|
|
11
|
-
|
|
12
|
-
import { TableListProps } from './types'
|
|
13
|
-
import { handleParams } from './util'
|
|
14
|
-
|
|
15
|
-
export function TableList<D extends object = any>({
|
|
16
|
-
totalTextData,
|
|
17
|
-
filter,
|
|
18
|
-
filterProp,
|
|
19
|
-
isPagination = true,
|
|
20
|
-
info,
|
|
21
|
-
action,
|
|
22
|
-
headerProps,
|
|
23
|
-
isUpdateEffect,
|
|
24
|
-
isHeaderSort,
|
|
25
|
-
isFilterSpread = true,
|
|
26
|
-
paginationOptions,
|
|
27
|
-
tableRef,
|
|
28
|
-
pagination,
|
|
29
|
-
service,
|
|
30
|
-
formatData = (data) => data.data,
|
|
31
|
-
...res
|
|
32
|
-
}: TableListProps<D>) {
|
|
33
|
-
const {
|
|
34
|
-
paging,
|
|
35
|
-
loading,
|
|
36
|
-
data = {},
|
|
37
|
-
runChangePaging,
|
|
38
|
-
run,
|
|
39
|
-
refresh,
|
|
40
|
-
refreshAfterDelete,
|
|
41
|
-
} = usePagination<any>(service, { ...paginationOptions }, false)
|
|
42
|
-
|
|
43
|
-
const [sorts, setSorts] = useState<SortsType>({})
|
|
44
|
-
const _tableRef = useTableRef()
|
|
45
|
-
|
|
46
|
-
let tableData = formatData(data)
|
|
47
|
-
if (!Array.isArray(tableData)) {
|
|
48
|
-
tableData = []
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
useUpdateEffect(
|
|
52
|
-
() => {
|
|
53
|
-
// 如果没传service,则return
|
|
54
|
-
if (!service) {
|
|
55
|
-
return
|
|
56
|
-
}
|
|
57
|
-
const params = handleParams({
|
|
58
|
-
filter,
|
|
59
|
-
filterProp,
|
|
60
|
-
isFilterSpread,
|
|
61
|
-
isHeaderSort,
|
|
62
|
-
sorts,
|
|
63
|
-
})
|
|
64
|
-
run(params)
|
|
65
|
-
},
|
|
66
|
-
[filter, filterProp, sorts, isHeaderSort, isFilterSpread, service],
|
|
67
|
-
isUpdateEffect
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
const onHeadersSort: TableProps['onHeadersSort'] = (sorts) => {
|
|
71
|
-
setSorts(sorts)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const boxTableProps = {
|
|
75
|
-
pagination:
|
|
76
|
-
pagination || (isPagination ? { paging, onChange: runChangePaging } : undefined),
|
|
77
|
-
|
|
78
|
-
info:
|
|
79
|
-
info ??
|
|
80
|
-
(totalTextData ? (
|
|
81
|
-
<BoxTableInfo>
|
|
82
|
-
<TableTotalText data={totalTextData} />
|
|
83
|
-
</BoxTableInfo>
|
|
84
|
-
) : undefined),
|
|
85
|
-
action,
|
|
86
|
-
headerProps,
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const tableProps = ({
|
|
90
|
-
data: tableData,
|
|
91
|
-
loading,
|
|
92
|
-
onHeadersSort,
|
|
93
|
-
...res,
|
|
94
|
-
tableRef: _tableRef,
|
|
95
|
-
} as unknown) as TableProps<D>
|
|
96
|
-
|
|
97
|
-
useImperativeHandle(tableRef, () => ({
|
|
98
|
-
..._tableRef.current,
|
|
99
|
-
refresh,
|
|
100
|
-
run,
|
|
101
|
-
refreshAfterDelete: (delNum = 1) => {
|
|
102
|
-
return refreshAfterDelete(tableProps.data, delNum)
|
|
103
|
-
},
|
|
104
|
-
}))
|
|
105
|
-
return (
|
|
106
|
-
<BoxTable {...boxTableProps}>
|
|
107
|
-
<Table {...tableProps} />
|
|
108
|
-
</BoxTable>
|
|
109
|
-
)
|
|
110
|
-
}
|
|
1
|
+
/*
|
|
2
|
+
* @Description: 业务列表、半自动请求
|
|
3
|
+
*/
|
|
4
|
+
import React, { useState, useImperativeHandle } from 'react'
|
|
5
|
+
import { BoxTable, BoxTableInfo } from '@gm-pc/react'
|
|
6
|
+
import { Table, TableProps, SortsType, useTableRef } from '@gm-pc/table-x'
|
|
7
|
+
|
|
8
|
+
import { usePagination, useUpdateEffect } from '@gm-common/hooks'
|
|
9
|
+
|
|
10
|
+
import TableTotalText from './table_total_text'
|
|
11
|
+
|
|
12
|
+
import { TableListProps } from './types'
|
|
13
|
+
import { handleParams } from './util'
|
|
14
|
+
|
|
15
|
+
export function TableList<D extends object = any>({
|
|
16
|
+
totalTextData,
|
|
17
|
+
filter,
|
|
18
|
+
filterProp,
|
|
19
|
+
isPagination = true,
|
|
20
|
+
info,
|
|
21
|
+
action,
|
|
22
|
+
headerProps,
|
|
23
|
+
isUpdateEffect,
|
|
24
|
+
isHeaderSort,
|
|
25
|
+
isFilterSpread = true,
|
|
26
|
+
paginationOptions,
|
|
27
|
+
tableRef,
|
|
28
|
+
pagination,
|
|
29
|
+
service,
|
|
30
|
+
formatData = (data) => data.data,
|
|
31
|
+
...res
|
|
32
|
+
}: TableListProps<D>) {
|
|
33
|
+
const {
|
|
34
|
+
paging,
|
|
35
|
+
loading,
|
|
36
|
+
data = {},
|
|
37
|
+
runChangePaging,
|
|
38
|
+
run,
|
|
39
|
+
refresh,
|
|
40
|
+
refreshAfterDelete,
|
|
41
|
+
} = usePagination<any>(service, { ...paginationOptions }, false)
|
|
42
|
+
|
|
43
|
+
const [sorts, setSorts] = useState<SortsType>({})
|
|
44
|
+
const _tableRef = useTableRef()
|
|
45
|
+
|
|
46
|
+
let tableData = formatData(data)
|
|
47
|
+
if (!Array.isArray(tableData)) {
|
|
48
|
+
tableData = []
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
useUpdateEffect(
|
|
52
|
+
() => {
|
|
53
|
+
// 如果没传service,则return
|
|
54
|
+
if (!service) {
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
const params = handleParams({
|
|
58
|
+
filter,
|
|
59
|
+
filterProp,
|
|
60
|
+
isFilterSpread,
|
|
61
|
+
isHeaderSort,
|
|
62
|
+
sorts,
|
|
63
|
+
})
|
|
64
|
+
run(params)
|
|
65
|
+
},
|
|
66
|
+
[filter, filterProp, sorts, isHeaderSort, isFilterSpread, service],
|
|
67
|
+
isUpdateEffect
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
const onHeadersSort: TableProps['onHeadersSort'] = (sorts) => {
|
|
71
|
+
setSorts(sorts)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const boxTableProps = {
|
|
75
|
+
pagination:
|
|
76
|
+
pagination || (isPagination ? { paging, onChange: runChangePaging } : undefined),
|
|
77
|
+
|
|
78
|
+
info:
|
|
79
|
+
info ??
|
|
80
|
+
(totalTextData ? (
|
|
81
|
+
<BoxTableInfo>
|
|
82
|
+
<TableTotalText data={totalTextData} />
|
|
83
|
+
</BoxTableInfo>
|
|
84
|
+
) : undefined),
|
|
85
|
+
action,
|
|
86
|
+
headerProps,
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const tableProps = ({
|
|
90
|
+
data: tableData,
|
|
91
|
+
loading,
|
|
92
|
+
onHeadersSort,
|
|
93
|
+
...res,
|
|
94
|
+
tableRef: _tableRef,
|
|
95
|
+
} as unknown) as TableProps<D>
|
|
96
|
+
|
|
97
|
+
useImperativeHandle(tableRef, () => ({
|
|
98
|
+
..._tableRef.current,
|
|
99
|
+
refresh,
|
|
100
|
+
run,
|
|
101
|
+
refreshAfterDelete: (delNum = 1) => {
|
|
102
|
+
return refreshAfterDelete(tableProps.data, delNum)
|
|
103
|
+
},
|
|
104
|
+
}))
|
|
105
|
+
return (
|
|
106
|
+
<BoxTable {...boxTableProps}>
|
|
107
|
+
<Table {...tableProps} />
|
|
108
|
+
</BoxTable>
|
|
109
|
+
)
|
|
110
|
+
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import React, { ComponentType, ReactNode, FC } from 'react'
|
|
2
|
-
import { Flex } from '@gm-pc/react'
|
|
3
|
-
import _ from 'lodash'
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
data: [{label: '', content: ''},...]
|
|
7
|
-
*/
|
|
8
|
-
export interface TotalTextOptions {
|
|
9
|
-
label: string | ComponentType | ReactNode
|
|
10
|
-
content: string | ComponentType | ReactNode
|
|
11
|
-
hide?: boolean
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const TableTotalText: FC<{ data: TotalTextOptions[] }> = ({ data }) => {
|
|
15
|
-
const list = _.filter(data, (v) => !v.hide)
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<Flex row wrap>
|
|
19
|
-
{_.map(list, (item, index) => {
|
|
20
|
-
return (
|
|
21
|
-
<Flex alignCenter key={index} wrap>
|
|
22
|
-
{item.label}:
|
|
23
|
-
<span className='gm-text-primary gm-text-14 gm-text-bold'>
|
|
24
|
-
{item.content}
|
|
25
|
-
</span>
|
|
26
|
-
{index < list.length - 1 && (
|
|
27
|
-
<span className='gm-padding-lr-10 gm-text-desc'>|</span>
|
|
28
|
-
)}
|
|
29
|
-
</Flex>
|
|
30
|
-
)
|
|
31
|
-
})}
|
|
32
|
-
</Flex>
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export default TableTotalText
|
|
1
|
+
import React, { ComponentType, ReactNode, FC } from 'react'
|
|
2
|
+
import { Flex } from '@gm-pc/react'
|
|
3
|
+
import _ from 'lodash'
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
data: [{label: '', content: ''},...]
|
|
7
|
+
*/
|
|
8
|
+
export interface TotalTextOptions {
|
|
9
|
+
label: string | ComponentType | ReactNode
|
|
10
|
+
content: string | ComponentType | ReactNode
|
|
11
|
+
hide?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const TableTotalText: FC<{ data: TotalTextOptions[] }> = ({ data }) => {
|
|
15
|
+
const list = _.filter(data, (v) => !v.hide)
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Flex row wrap>
|
|
19
|
+
{_.map(list, (item, index) => {
|
|
20
|
+
return (
|
|
21
|
+
<Flex alignCenter key={index} wrap>
|
|
22
|
+
{item.label}:
|
|
23
|
+
<span className='gm-text-primary gm-text-14 gm-text-bold'>
|
|
24
|
+
{item.content}
|
|
25
|
+
</span>
|
|
26
|
+
{index < list.length - 1 && (
|
|
27
|
+
<span className='gm-padding-lr-10 gm-text-desc'>|</span>
|
|
28
|
+
)}
|
|
29
|
+
</Flex>
|
|
30
|
+
)
|
|
31
|
+
})}
|
|
32
|
+
</Flex>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default TableTotalText
|
package/src/table_list/types.ts
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { RefObject } from 'react'
|
|
2
|
-
import { TableProps, Column, TableInstance, SortsType } from '@gm-pc/table-x'
|
|
3
|
-
import { UsePaginationOptions } from '@gm-common/hooks'
|
|
4
|
-
import { PagingRes } from '@gm-common/hooks/src/types'
|
|
5
|
-
import { TotalTextOptions } from './table_total_text'
|
|
6
|
-
|
|
7
|
-
export type BaseTableListType = Pick<TableProps, 'tableRef'>
|
|
8
|
-
export interface FilterProps {
|
|
9
|
-
onExport: (...arg: any) => Promise<any>
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type TableListColumn<D extends object = any> = Column<D>
|
|
13
|
-
|
|
14
|
-
export type FormatDataType = (data: { paging: PagingRes; data: any[] }) => any[]
|
|
15
|
-
export type TableListInstance = TableInstance & {
|
|
16
|
-
refresh(): Promise<any>
|
|
17
|
-
/** 对应删除的刷新,如果当前页有10条数据,一次性删除了10条,那么会调用run跳到第一条,否则调用refresh刷新当前页 */
|
|
18
|
-
refreshAfterDelete(delNum?: number): Promise<any>
|
|
19
|
-
run(): Promise<any>
|
|
20
|
-
}
|
|
21
|
-
export type TableListRef = RefObject<TableListInstance>
|
|
22
|
-
export interface TableListProps<D extends object = any>
|
|
23
|
-
extends Omit<TableProps<D>, 'tableRef' | 'data'> {
|
|
24
|
-
data?: TableProps<D>['data']
|
|
25
|
-
tableRef?: TableListRef
|
|
26
|
-
/** 列表汇总 */
|
|
27
|
-
totalTextData?: TotalTextOptions[]
|
|
28
|
-
/** 列表筛选参数, 请保证不可变性 */
|
|
29
|
-
filter?: any
|
|
30
|
-
/** 回传给service的参数中对应的filter的key名,默认为filter */
|
|
31
|
-
filterProp?: string
|
|
32
|
-
paginationOptions?: UsePaginationOptions<any, any>
|
|
33
|
-
/** 表头是否排序 */
|
|
34
|
-
isHeaderSort?: boolean
|
|
35
|
-
/** didMount的时候时候请求数据 */
|
|
36
|
-
isUpdateEffect?: boolean
|
|
37
|
-
/** filter run回传的时候是否展开 */
|
|
38
|
-
isFilterSpread?: boolean
|
|
39
|
-
/** 列表请求接口 请保证不可变性 */
|
|
40
|
-
service(...args: any): Promise<any>
|
|
41
|
-
/** 列表接口响应数据格式化,返回值为数组 */
|
|
42
|
-
formatData?: FormatDataType
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface HandleParamsProps
|
|
46
|
-
extends Pick<
|
|
47
|
-
TableListProps,
|
|
48
|
-
'filter' | 'filterProp' | 'isHeaderSort' | 'isFilterSpread'
|
|
49
|
-
> {
|
|
50
|
-
sorts: SortsType
|
|
51
|
-
}
|
|
1
|
+
import { RefObject } from 'react'
|
|
2
|
+
import { TableProps, Column, TableInstance, SortsType } from '@gm-pc/table-x'
|
|
3
|
+
import { UsePaginationOptions } from '@gm-common/hooks'
|
|
4
|
+
import { PagingRes } from '@gm-common/hooks/src/types'
|
|
5
|
+
import { TotalTextOptions } from './table_total_text'
|
|
6
|
+
|
|
7
|
+
export type BaseTableListType = Pick<TableProps, 'tableRef'>
|
|
8
|
+
export interface FilterProps {
|
|
9
|
+
onExport: (...arg: any) => Promise<any>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type TableListColumn<D extends object = any> = Column<D>
|
|
13
|
+
|
|
14
|
+
export type FormatDataType = (data: { paging: PagingRes; data: any[] }) => any[]
|
|
15
|
+
export type TableListInstance = TableInstance & {
|
|
16
|
+
refresh(): Promise<any>
|
|
17
|
+
/** 对应删除的刷新,如果当前页有10条数据,一次性删除了10条,那么会调用run跳到第一条,否则调用refresh刷新当前页 */
|
|
18
|
+
refreshAfterDelete(delNum?: number): Promise<any>
|
|
19
|
+
run(): Promise<any>
|
|
20
|
+
}
|
|
21
|
+
export type TableListRef = RefObject<TableListInstance>
|
|
22
|
+
export interface TableListProps<D extends object = any>
|
|
23
|
+
extends Omit<TableProps<D>, 'tableRef' | 'data'> {
|
|
24
|
+
data?: TableProps<D>['data']
|
|
25
|
+
tableRef?: TableListRef
|
|
26
|
+
/** 列表汇总 */
|
|
27
|
+
totalTextData?: TotalTextOptions[]
|
|
28
|
+
/** 列表筛选参数, 请保证不可变性 */
|
|
29
|
+
filter?: any
|
|
30
|
+
/** 回传给service的参数中对应的filter的key名,默认为filter */
|
|
31
|
+
filterProp?: string
|
|
32
|
+
paginationOptions?: UsePaginationOptions<any, any>
|
|
33
|
+
/** 表头是否排序 */
|
|
34
|
+
isHeaderSort?: boolean
|
|
35
|
+
/** didMount的时候时候请求数据 */
|
|
36
|
+
isUpdateEffect?: boolean
|
|
37
|
+
/** filter run回传的时候是否展开 */
|
|
38
|
+
isFilterSpread?: boolean
|
|
39
|
+
/** 列表请求接口 请保证不可变性 */
|
|
40
|
+
service(...args: any): Promise<any>
|
|
41
|
+
/** 列表接口响应数据格式化,返回值为数组 */
|
|
42
|
+
formatData?: FormatDataType
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface HandleParamsProps
|
|
46
|
+
extends Pick<
|
|
47
|
+
TableListProps,
|
|
48
|
+
'filter' | 'filterProp' | 'isHeaderSort' | 'isFilterSpread'
|
|
49
|
+
> {
|
|
50
|
+
sorts: SortsType
|
|
51
|
+
}
|
package/src/table_list/util.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { HandleParamsProps } from './types'
|
|
2
|
-
|
|
3
|
-
const handleParams = ({
|
|
4
|
-
filter,
|
|
5
|
-
filterProp = 'filter',
|
|
6
|
-
isHeaderSort,
|
|
7
|
-
isFilterSpread,
|
|
8
|
-
sorts,
|
|
9
|
-
}: HandleParamsProps) => {
|
|
10
|
-
const params = isFilterSpread ? { ...filter } : { [filterProp]: filter }
|
|
11
|
-
if (isHeaderSort) {
|
|
12
|
-
Object.assign(params, { sorts })
|
|
13
|
-
}
|
|
14
|
-
return params
|
|
15
|
-
}
|
|
16
|
-
export { handleParams }
|
|
1
|
+
import { HandleParamsProps } from './types'
|
|
2
|
+
|
|
3
|
+
const handleParams = ({
|
|
4
|
+
filter,
|
|
5
|
+
filterProp = 'filter',
|
|
6
|
+
isHeaderSort,
|
|
7
|
+
isFilterSpread,
|
|
8
|
+
sorts,
|
|
9
|
+
}: HandleParamsProps) => {
|
|
10
|
+
const params = isFilterSpread ? { ...filter } : { [filterProp]: filter }
|
|
11
|
+
if (isHeaderSort) {
|
|
12
|
+
Object.assign(params, { sorts })
|
|
13
|
+
}
|
|
14
|
+
return params
|
|
15
|
+
}
|
|
16
|
+
export { handleParams }
|