forked from ddrilling/asb_cloud_front
Merge branch 'master' of https://bitbucket.org/frolovng/asb_cloud_front_react
This commit is contained in:
commit
a23ed5bb25
@ -38,14 +38,14 @@ interface columnPropsOther {
|
|||||||
initialValue?: string|number
|
initialValue?: string|number
|
||||||
}
|
}
|
||||||
|
|
||||||
export const makeColumn = (title:string|any, key:string, other?:columnPropsOther) => ({
|
export const makeColumn = (title:string, key:string, other?:columnPropsOther) => ({
|
||||||
title: title,
|
title: title,
|
||||||
key: key,
|
key: key,
|
||||||
dataIndex: key,
|
dataIndex: key,
|
||||||
...other,
|
...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 keyPlanLocal = key
|
||||||
let keyFactLocal = key
|
let keyFactLocal = key
|
||||||
@ -77,26 +77,27 @@ export const makeColumnsPlanFact = (title:string|any, key:string|string[], colum
|
|||||||
export const makeFilterTextMatch = (key: string | number) => (filterValue: string | number, dataItem: any) =>
|
export const makeFilterTextMatch = (key: string | number) => (filterValue: string | number, dataItem: any) =>
|
||||||
dataItem[key] === filterValue
|
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++) {
|
for (let i = 0; i < a.length; i++) {
|
||||||
if (isNaN(b.charCodeAt(i)) || (a.charCodeAt(i) > b.charCodeAt(i)))
|
if (isNaN(b.charCodeAt(i)) || (a.charCodeAt(i) > b.charCodeAt(i)))
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
if (a.charCodeAt(i) > b.charCodeAt(i))
|
if (a.charCodeAt(i) > b.charCodeAt(i))
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
export const makeGroupColumn = (title: any, children: any) => ({
|
export const makeGroupColumn = (title: string, children: object[]) => ({
|
||||||
title: title,
|
title: title,
|
||||||
children: children,
|
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,
|
title: title,
|
||||||
dataIndex: dataIndex,
|
dataIndex: dataIndex,
|
||||||
key: dataIndex,
|
key: dataIndex,
|
||||||
@ -107,7 +108,8 @@ export const makeTextColumn = (title: any, dataIndex: any, filters: any, sorter:
|
|||||||
...other
|
...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,
|
title: title,
|
||||||
dataIndex: dataIndex,
|
dataIndex: dataIndex,
|
||||||
key: dataIndex,
|
key: dataIndex,
|
||||||
@ -117,7 +119,7 @@ export const makeNumericColumn = (title: any, dataIndex: any, filters: any, filt
|
|||||||
width: width
|
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, [
|
makeGroupColumn( title, [
|
||||||
makeNumericColumn('п', dataIndex + 'Plan', filters, filterDelegate, width),
|
makeNumericColumn('п', dataIndex + 'Plan', filters, filterDelegate, width),
|
||||||
makeNumericColumn('ф', dataIndex + 'Fact', filters, filterDelegate, width),
|
makeNumericColumn('ф', dataIndex + 'Fact', filters, filterDelegate, width),
|
||||||
|
Loading…
Reference in New Issue
Block a user