/**
 * amis-ui v6.14.0-beta.1
 * Copyright 2018-2025 fex
 */

import { __extends } from 'tslib';
import React__default from 'react';
import { localeable, themeable } from 'amis-core';
import PickerContainer from '../PickerContainer.js';
import SchemaVariableList from './SchemaVariableList.js';

var SchemaVariableListPicker = /** @class */ (function (_super) {
    __extends(SchemaVariableListPicker, _super);
    function SchemaVariableListPicker() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    SchemaVariableListPicker.prototype.render = function () {
        var _a = this.props, __ = _a.translate, schemas = _a.schemas, value = _a.value, onConfirm = _a.onConfirm, onCancel = _a.onCancel, children = _a.children, title = _a.title, selectMode = _a.selectMode, beforeBuildVariables = _a.beforeBuildVariables, onPickerOpen = _a.onPickerOpen, placeholderRender = _a.placeholderRender;
        return (React__default.createElement(PickerContainer, { onPickerOpen: onPickerOpen, title: title !== null && title !== void 0 ? title : __('Select.placeholder'), bodyRender: function (_a) {
                var _b;
                var value = _a.value, onChange = _a.onChange, stateSchemas = _a.schemas, isOpened = _a.isOpened;
                return isOpened ? (React__default.createElement(SchemaVariableList, { value: (_b = value === null || value === void 0 ? void 0 : value.value) !== null && _b !== void 0 ? _b : value, onSelect: function (value, schema) {
                        return onChange({
                            value: value,
                            schema: schema
                        });
                    }, schemas: stateSchemas !== null && stateSchemas !== void 0 ? stateSchemas : schemas, selectMode: selectMode, beforeBuildVariables: beforeBuildVariables, placeholderRender: placeholderRender })) : (React__default.createElement(React__default.Fragment, null));
            }, value: value, onConfirm: onConfirm, onCancel: onCancel }, children));
    };
    return SchemaVariableListPicker;
}(React__default.Component));
var SchemaVariableListPicker$1 = localeable(themeable(SchemaVariableListPicker));

export { SchemaVariableListPicker, SchemaVariableListPicker$1 as default };
