import prefix from '../global/prefix';
import Popup from './Popup';
import isNull from '../utils/isNull';
import config from '../global/config';
class Dropdown extends Popup {
    constructor(elem, options = {}, initial = config.initial) {
        options?.tools === true ? options.tools = { enable: true, placement: 'outside' } : !options?.tools ? options.tools = { enable: false, placement: 'outside' } : null;
        /*  let footChildren = [
             {
                 name: 'close'
             },
             {
                 name: 'cancel',
                 event: 'prevent',
             }, {
                 name: 'confirm',
                 event: 'prevent',
             },
         ];
         if (options?.footer === true) {
             options.footer = { enable: true, children: footChildren }
         } else if (options?.footer === false) {
             (options as T_obj).footer = { enable: false }
         } else if (isNull(options?.footer)) {
             (options as T_obj).footer = { children: footChildren };
         } */
        isNull(options.size) ? options.size = 'md' : null;
        isNull(options?.placement) ? options.placement = 'bottom-start' : null;
        isNull(options?.trigger) ? options.trigger = 'click' : null;
        isNull(options?.in) ? options.in = 'slideDown' : null;
        isNull(options?.out) ? options.out = 'slideUp' : null;
        super(elem, options, initial);
        this.on('init', () => {
            this.mainEl.classList.add(`${prefix}dropdown`);
            this.initList();
        });
        this.on('show', () => {
            this.checkTargetChecked();
        });
    }
}
export default Dropdown;
