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

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var tslib = require('tslib');
var React = require('react');
var amisCore = require('amis-core');
var PickerContainer = require('../PickerContainer.js');
var SchemaVariableList = require('./SchemaVariableList.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);

var __react_jsx__ = require('react');
var _J$X_ = (__react_jsx__["default"] || __react_jsx__).createElement;
(__react_jsx__["default"] || __react_jsx__).Fragment;
var SchemaVariableListPicker = /** @class */ (function (_super) {
    tslib.__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 (_J$X_(PickerContainer["default"], { 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 ? (_J$X_(SchemaVariableList["default"], { 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 })) : (_J$X_(React__default["default"].Fragment, null));
            }, value: value, onConfirm: onConfirm, onCancel: onCancel }, children));
    };
    return SchemaVariableListPicker;
}(React__default["default"].Component));
var SchemaVariableListPicker$1 = amisCore.localeable(amisCore.themeable(SchemaVariableListPicker));

exports.SchemaVariableListPicker = SchemaVariableListPicker;
exports["default"] = SchemaVariableListPicker$1;
