This repository has been archived on 2025-05-09. You can view files and clone it, but cannot push or open issues or pull requests.
2022-04-06 10:42:45 +03:00

43 lines
1.4 KiB
TypeScript

import ELT from '../../Components/ELT';
import finGAP from '../../Components/FinGAP';
import { CustomComponents, NonValueElementsNames } from '../../types/elements';
import { TableNames } from '../../types/tables';
import components from '../components';
import tables from '../tables';
import buildAction from './buildAction';
import buildComputed from './buildComputed';
import buildLink from './buildLink';
import buildTable from './buildTable';
import buildValue from './buildValue';
const valueElementsBuilders = Object.keys(components).reduce(
(acc, elementName) => {
acc[elementName] = buildValue;
return acc;
},
{},
);
const overrideBuilders: Record<
NonValueElementsNames | TableNames | CustomComponents,
any
> = {
labelLeaseObjectRisk: buildComputed,
tbxInsKaskoPriceLeasePeriod: buildComputed,
labelIrrInfo: buildComputed,
labelRegistrationDescription: buildComputed,
btnCreateKP: buildAction,
btnCalculate: buildAction,
linkDownloadKp: buildLink,
componentElt: () => ELT,
componentfinGAP: () => finGAP,
tablePayments: ({ name, Component }) =>
buildTable({ name, Component, ...tables[name] }),
tableInsurance: ({ name, Component }) =>
buildTable({ name, Component, ...tables[name] }),
tableResults: ({ name, Component }) =>
buildTable({ name, Component, ...tables[name] }),
};
export default Object.assign(valueElementsBuilders, overrideBuilders);