epn-ui
Version:
Дизайн система кабинета ВМ
47 lines (44 loc) • 2.5 kB
JavaScript
import React, { useMemo } from 'react';
import Space from '../../Space/index.js';
import SaveTableToFile from './save/index.js';
import TablePersonalization from './personalization/index.js';
import TableSettings from './settings/index.js';
var Actions = function (_a) {
var columns = _a.columns, loading = _a.loading, filtersIsActive = _a.filtersIsActive, freezeFirstColumn = _a.freezeFirstColumn, isApiExport = _a.isApiExport, showConfig = _a.showConfig, onToggle = _a.onToggle, onDrag = _a.onDrag, onPersonalizationSave = _a.onPersonalizationSave, onExport = _a.onExport;
var showExport = useMemo(function () {
if (typeof showConfig === 'boolean' && showConfig)
return true;
if (typeof showConfig !== 'boolean' && typeof showConfig.export === 'undefined') {
return true;
}
if (typeof showConfig !== 'boolean' && showConfig.export)
return true;
return false;
}, [showConfig]);
var showSort = useMemo(function () {
if (typeof showConfig === 'boolean' && showConfig)
return true;
if (typeof showConfig !== 'boolean' && typeof showConfig.sort === 'undefined')
return true;
if (typeof showConfig !== 'boolean' && showConfig.sort)
return true;
return false;
}, [showConfig]);
var showSettings = useMemo(function () {
if (typeof showConfig === 'boolean' && showConfig)
return true;
if (typeof showConfig !== 'boolean' && typeof showConfig.settings === 'undefined') {
return true;
}
if (typeof showConfig !== 'boolean' && showConfig.settings)
return true;
return false;
}, [showConfig]);
return (React.createElement("div", { className: "epn-tablePro__actions" },
React.createElement("div", { className: "epn-tablePro__actions_container" },
React.createElement(Space, null,
showExport && React.createElement(SaveTableToFile, { onSave: onExport, locale: "ru" }),
showSort && (React.createElement(TablePersonalization, { columns: columns, loading: loading, filtersIsActive: filtersIsActive, freezeFirstColumn: freezeFirstColumn, onToggle: onToggle, onDrag: onDrag, onSave: onPersonalizationSave, locale: "ru" })),
showSettings && React.createElement(TableSettings, { isApiExport: isApiExport, locale: "ru" })))));
};
export { Actions as default };