All Downloads are FREE. Search and download functionalities are using the official Maven repository.

components.widgets.Table.cells.ListTextCell.utils.js Maven / Gradle / Ivy

There is a newer version: 7.28.3
Show newest version
import isUndefined from 'lodash/isUndefined'
import classNames from 'classnames'

// dashed стиль лейбла tooltip или нет
export const triggerClassName = (labelDashed, type) => classNames({
    'list-text-cell__trigger_dashed': labelDashed,
    'list-text-cell__trigger': !labelDashed || isUndefined(labelDashed),
    'd-flex': type === 'mapProps(StandardButton)',
})

// ищет placeholder {size} в label, заменяет на длину массива
export const replacePlaceholder = (label, listLength) => {
    const placeholder = '{size}'
    const hasPlaceholder = !isUndefined(label) && label.match(placeholder)

    if (isUndefined(label)) {
        return listLength
    }

    if (hasPlaceholder) {
        return label.replace(/{size}/gm, listLength)
    }

    return label
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy