Add components factory

This commit is contained in:
Фролов 2021-07-29 11:22:25 +05:00
parent 9273e82f19
commit 611244edee

26
src/components/factory.js Normal file
View File

@ -0,0 +1,26 @@
export const makeColumn = (title, key, other) => ({
title: title,
key: key,
dataIndex: key,
...other,
});
export const makeColumnsPlanFact = (title, keyPlan, keyFact, gruopOther) =>
{
let keyPlanLocal = keyPlan
let keyFactLocal = keyFact
if(!keyFact){
keyPlanLocal = keyPlan + 'Plan'
keyFactLocal = keyPlan + 'Fact'
}
return {
title: title,
...gruopOther,
children: [
makeColumn('план', keyPlanLocal),
makeColumn('факт', keyFactLocal),
]
}
}