"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTableVOnSelectRowsFuncName = exports.getTableRowSelectionType = exports.isInputParameters = void 0;
// import get from 'lodash/get';
const lodash = require('lodash');
function isInputParameters(vName, inputList = []) {
    if (Array.isArray(inputList)) {
        for (let i = 0; i < inputList.length; i += 1) {
            if (inputList[i].name === vName) {
                return true;
            }
        }
    }
    return false;
}
exports.isInputParameters = isInputParameters;
// 获取属性列表里的 select-type 属性，并且返回类型，类型共有两种，radio 和 checkbox，默认checkbox
// https://ant.design/components/table-cn/#rowSelection
function getTableRowSelectionType(attrList) {
    const target = attrList.find(a => a.name.name === 'selectType');
    if (target) {
        return lodash.get(target, 'value.value', 'checkbox');
    }
    return 'checkbox';
}
exports.getTableRowSelectionType = getTableRowSelectionType;
// 获取 client action 属性对应的 action name 'v-on:selectRows'
function getTableVOnSelectRowsFuncName(attrList, attrName) {
    const target = attrList.find(a => a.name.name === attrName);
    if (target) {
        const clientActionName = lodash.get(target, 'value.value', '');
        if (clientActionName.indexOf('client.') !== -1) {
            const actionName = clientActionName.split('client.')[1];
            return `onChange: this.${actionName}`;
        }
        return '';
    }
    return '';
}
exports.getTableVOnSelectRowsFuncName = getTableVOnSelectRowsFuncName;
