import { ComponentStylingModel, ComponentStylingPropertiesControlComponent, genericPropertiesControlFor } from '@anglr/dynamic/layout-editor';
import { MaterialExpansionPanelModel } from './expansionPanel.model';
/**
 * Material expansion panel layout metadata
 */
export class MaterialExpansionPanelLayoutEditorMetadata {
    //######################### constructor #########################
    constructor() {
        //######################### public properties - implementation of LayoutEditorMetadataDescriptor #########################
        /**
         * @inheritdoc
         */
        this.metaInfo = {
            name: 'Expansion panel',
            description: 'Material expansion panel',
            group: 'Material',
            optionsMetadata: {
                propertiesMetadata: [
                    {
                        modelType: ComponentStylingModel,
                        propertiesControls: [
                            ComponentStylingPropertiesControlComponent,
                        ],
                    },
                    {
                        modelType: MaterialExpansionPanelModel,
                        propertiesControls: [
                            genericPropertiesControlFor(['title', 'description', 'expanded'])
                        ],
                    },
                ]
            },
            defaultOptions: {
                expanded: true,
                title: 'Panel title'
            }
        };
        /**
         * @inheritdoc
         */
        this.addDescendant = (metadata, options, index) => {
            var _a;
            (_a = options.children) !== null && _a !== void 0 ? _a : (options.children = []);
            options.children.splice(index, 0, metadata);
        };
        /**
         * @inheritdoc
         */
        this.canDropMetadata = () => true;
        /**
         * @inheritdoc
         */
        this.getChildrenContainer = element => element.querySelector('.mat-expansion-panel-body');
        /**
         * @inheritdoc
         */
        this.removeDescendant = (id, options) => {
            var _a;
            (_a = options.children) !== null && _a !== void 0 ? _a : (options.children = []);
            const index = options.children.findIndex(itm => itm.id === id);
            options.children.splice(index, 1);
        };
        Object.freeze(this);
    }
}
//# sourceMappingURL=expansionPanel.layoutMetadata.js.map