@adaptabletools/adaptable-cjs
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
30 lines (29 loc) • 1.45 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PlusMinusScopeWizardSection = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
const NewScopeComponent_1 = require("../../Components/NewScopeComponent");
const PlusMinusScopeWizardSection = (props) => {
const { data, api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
const availableColumns = React.useMemo(() => api.columnApi.getNumericColumns(), []);
return (React.createElement(NewScopeComponent_1.NewScopeComponent, { availableDataTypes: ['number'], scopeColumns: availableColumns, scope: data.Scope, descriptions: {
rowScope: 'Matching rows will have the plus/minus applied',
columnScope: 'Matching Columns will have the plus/minus 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,
});
} }));
};
exports.PlusMinusScopeWizardSection = PlusMinusScopeWizardSection;