function getLeftmostOrRightmostColKey({ type, colgroups, colKeys }) {
    let result = null;

    if (Array.isArray(colKeys) && colKeys.length) {
        let mostObj = {
            colKey: null,
            colIndex: null,
        };
        colKeys.forEach((colKey) => {
            const colIndex = colgroups.findIndex((x) => x.key === colKey);

            if (colIndex === -1) {
                console.warn(
                    `getLeftmostOrRightmostColKey error:: can't find colKey:${colKey}`,
                );
                return false;
            }

            if (isEmptyValue(mostObj.colKey)) {
                mostObj = {
                    colKey,
                    colIndex: colIndex,
                };
            } else {
                if (type === "leftmost") {
                    if (colIndex < mostObj.colIndex) {
                        mostObj = {
                            colKey,
                            colIndex: colIndex,
                        };
                    }
                } else if (type === "rightmost") {
                    if (colIndex > mostObj.colIndex) {
                        mostObj = {
                            colKey,
                            colIndex: colIndex,
                        };
                    }
                }
            }
        });

        result = mostObj.colKey;
    }

    return result;
}
@getLeftmostOrRightmostColKey
@desc get leftmost or rightmost column key
@param {string} type
@param {array<object>} colgroups
@param {array<any>} colKeys
@return colKey