/*!
 * 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 { JoinStrategy } from '@datashaper/schema';
import { NodeInput } from '@datashaper/workflow';
import { memo, useMemo } from 'react';
import { VerbForm } from '../verbForm/VerbForm.js';
import { enumDropdown, joinInputs, tableDropdown } from '../verbForm/VerbFormFactories.js';
/**
 * Provides inputs for a Join step.
 */ export const JoinBase = /*#__PURE__*/ memo(function JoinBase({ step , onChange , tableOptions , leftColumns , rightColumns ,  }) {
    const inputs = useMemo(()=>[
            tableDropdown('Join table', tableOptions, step.input[NodeInput.Other]?.node, (s, val)=>s.input[NodeInput.Other] = {
                    node: val
                }, {
                required: true,
                placeholder: 'Choose table'
            }),
            enumDropdown('Join strategy', JoinStrategy, step.args.strategy, (s, val)=>s.args.strategy = val, {
                required: true,
                placeholder: 'Choose join',
                advanced: true
            }),
            ...joinInputs(step, leftColumns, rightColumns), 
        ], [
        step,
        leftColumns,
        rightColumns,
        tableOptions
    ]);
    return /*#__PURE__*/ _jsx(VerbForm, {
        step: step,
        onChange: onChange,
        inputs: inputs
    });
});
