/*!
 * Copyright (c) Microsoft. All rights reserved.
 * Licensed under the MIT license. See LICENSE file in the project.
 */ import { jsx as _jsx } from "react/jsx-runtime";
import { MergeStrategy } from '@datashaper/schema';
import { memo, useMemo } from 'react';
import { FormInputType, VerbForm } from '../verbForm/VerbForm.js';
import { enumDropdown } from '../verbForm/VerbFormFactories.js';
/**
 * Just the to/value inputs for an impute.
 * Input table is expected to be edited elsewhere and configured as the step input.
 */ export const MergeBase = /*#__PURE__*/ memo(function MergeBase({ step , onChange  }) {
    const inputs = useMemo(()=>[
            enumDropdown('Merge strategy', MergeStrategy, step.args.strategy, (s, val)=>s.args.strategy = val, {
                required: true,
                placeholder: 'Choose strategy'
            }),
            {
                label: 'Delimiter',
                type: FormInputType.Text,
                if: step.args.strategy === MergeStrategy.Concat,
                current: step.args.delimiter,
                onChange: (s, val)=>s.args.delimiter = val
            },
            {
                label: 'Keep source columns',
                type: FormInputType.Checkbox,
                current: step.args.preserveSource,
                onChange: (s, val)=>s.args.preserveSource = val,
                advanced: true
            },
            {
                label: 'Unhot',
                type: FormInputType.Checkbox,
                current: step.args.unhot,
                onChange: (s, val)=>s.args.unhot = val,
                advanced: true
            },
            {
                label: 'Prefix',
                type: FormInputType.Text,
                if: step.args.unhot === true,
                current: step.args.prefix,
                onChange: (s, val)=>s.args.prefix = val,
                advanced: true
            }
        ], [
        step
    ]);
    return /*#__PURE__*/ _jsx(VerbForm, {
        inputs: inputs,
        step: step,
        onChange: onChange
    });
});
