diff --git a/src/components/factory.js b/src/components/factory.js new file mode 100644 index 0000000..06269a0 --- /dev/null +++ b/src/components/factory.js @@ -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), + ] + } +} \ No newline at end of file