import { jsx as _jsx } from "react/jsx-runtime";
import { FieldAggregateOperation } from '@data-wrangling-components/core';
import { useMemo } from 'react';
import { VerbForm } from '../verbForm/VerbForm.js';
import { dropdown, enumDropdown } from '../verbForm/VerbFormFactories.js';
/**
 * Just the group/column/op inputs for an aggregation.
 * Input table is expected to be edited elsewhere and configured as the step input.
 */ export const AggregateBase = function AggregateBase({ step , onChange , columns  }) {
    const verbInputs = useMemo(()=>[
            dropdown('Column to group by', columns, step.args.groupby, (s, key)=>s.args.groupby = key, {
                required: true
            }),
            enumDropdown('Function', FieldAggregateOperation, step.args.operation, (s, key)=>s.args.operation = key, {
                required: true
            }), 
        ], [
        step,
        columns
    ]);
    return /*#__PURE__*/ _jsx(VerbForm, {
        step: step,
        inputs: verbInputs,
        onChange: onChange
    });
};
