UNPKG

@adaptabletools/adaptable

Version:

Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

25 lines (24 loc) 1.16 kB
import * as React from 'react'; import { useOnePageAdaptableWizardContext } from '../../Wizard/OnePageAdaptableWizard'; import { NewScopeComponent } from '../../Components/NewScopeComponent'; export const ShortcutScopeWizardSection = (props) => { const { data, api } = useOnePageAdaptableWizardContext(); const availableColumns = React.useMemo(() => api.columnApi.getNumericColumns(), []); return (React.createElement(NewScopeComponent, { availableDataTypes: ['number'], scopeColumns: availableColumns, scope: data.Scope, descriptions: { rowScope: 'All Numeric Columns will have the Shortcut applied', columnScope: 'Selected Columns will have the Shortcut applied', }, updateScope: (Scope) => { let preparedScope = Scope; if (Scope && 'DataTypes' in Scope && Scope.DataTypes.length === 0) { // default to checked preparedScope = { ...Scope, DataTypes: ['number'], }; } props.onChange({ ...data, Scope: preparedScope, }); } })); };