This commit is contained in:
Фролов 2021-08-30 13:40:41 +05:00
commit a23ed5bb25

View File

@ -38,14 +38,14 @@ interface columnPropsOther {
initialValue?: string|number
}
export const makeColumn = (title:string|any, key:string, other?:columnPropsOther) => ({
export const makeColumn = (title:string, key:string, other?:columnPropsOther) => ({
title: title,
key: key,
dataIndex: key,
...other,
})
export const makeColumnsPlanFact = (title:string|any, key:string|string[], columsOther?:any|any[], gruopOther?:any) =>
export const makeColumnsPlanFact = (title:string, key:string|string[], columsOther?:any|any[], gruopOther?:any) =>
{
let keyPlanLocal = key
let keyFactLocal = key
@ -77,9 +77,9 @@ export const makeColumnsPlanFact = (title:string|any, key:string|string[], colum
export const makeFilterTextMatch = (key: string | number) => (filterValue: string | number, dataItem: any) =>
dataItem[key] === filterValue
export const makeNumericSorter = (key: any) => (a: any, b: any) => a[key] - b[key]
export const makeNumericSorter = (key: string) => (a: any, b: any) => a[key] - b[key]
export const makeStringSorter = (key: any) => (a: any, b: any) =>
export const makeStringSorter = (key: string) => (a: any, b: any) =>
{
for (let i = 0; i < a.length; i++) {
if (isNaN(b.charCodeAt(i)) || (a.charCodeAt(i) > b.charCodeAt(i)))
@ -91,12 +91,13 @@ for (let i = 0; i < a.length; i++) {
return 0
}
export const makeGroupColumn = (title: any, children: any) => ({
export const makeGroupColumn = (title: string, children: object[]) => ({
title: title,
children: children,
})
export const makeTextColumn = (title: any, dataIndex: any, filters: any, sorter: any, render: any, other: any) => ({
export const makeTextColumn = (title: string, dataIndex: string,
filters: object[], sorter?: (key: string) => any, render?: any, other?: any) => ({
title: title,
dataIndex: dataIndex,
key: dataIndex,
@ -107,7 +108,8 @@ export const makeTextColumn = (title: any, dataIndex: any, filters: any, sorter:
...other
})
export const makeNumericColumn = (title: any, dataIndex: any, filters: any, filterDelegate: (key: string | number) => any, width: string) => ({
export const makeNumericColumn = (title: string, dataIndex: string,
filters: object[], filterDelegate: (key: string | number) => any, width: string) => ({
title: title,
dataIndex: dataIndex,
key: dataIndex,
@ -117,7 +119,7 @@ export const makeNumericColumn = (title: any, dataIndex: any, filters: any, filt
width: width
})
export const makeNumericColumnPlanFact = (title: any, dataIndex: any, filters: any, filterDelegate: (key: string | number) => any, width: string) =>
export const makeNumericColumnPlanFact = (title: string, dataIndex: string, filters: object[], filterDelegate: (key: string | number) => any, width: string) =>
makeGroupColumn( title, [
makeNumericColumn('п', dataIndex + 'Plan', filters, filterDelegate, width),
makeNumericColumn('ф', dataIndex + 'Fact', filters, filterDelegate, width),