How to use the @blueprintjs/table/src.Utils.times function in @blueprintjs/table

To help you get started, we’ve selected a few @blueprintjs/table examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github palantir / blueprint / packages / table-dev-app / src / features.tsx View on Github external
function getTableComponent(numCols: number, numRows: number, columnProps?: any, tableProps?: any) {
    // combine table overrides
    const getCellClipboardData = (row: number, col: number) => {
        return Utils.toBase26Alpha(col) + (row + 1);
    };

    const tablePropsWithDefaults = { numRows, getCellClipboardData, enableFocusedCell: true, ...tableProps };

    // combine column overrides
    const columnPropsWithDefaults = {
        cellRenderer: (rowIndex: number, columnIndex: number) => {
            return {Utils.toBase26Alpha(columnIndex) + (rowIndex + 1)};
        },
        ...columnProps,
    };
    const columns = Utils.times(numCols, index => {
        return ;
    });
    return {columns}<table></table>;
}
github palantir / blueprint / packages / table-dev-app / src / mutableTable.tsx View on Github external
private renderColumns() {
        return Utils.times(this.state.numCols, columnIndex =&gt; {
            return (
                
            );
        });
    }
github palantir / blueprint / packages / table-dev-app / src / mutableTable.tsx View on Github external
"scrollToRegionType",
            REGION_CARDINALITIES,
            this.getRegionCardinalityLabel,
            this.handleRegionCardinalityChange,
        );
        const scrollToRowSelectMenu = this.renderSelectMenu(
            "Row",
            "scrollToRowIndex",
            Utils.times(this.state.numRows, rowIndex =&gt; rowIndex),
            rowIndex =&gt; `${rowIndex + 1}`,
            this.handleNumberStateChange,
        );
        const scrollToColumnSelectMenu = this.renderSelectMenu(
            "Column",
            "scrollToColumnIndex",
            Utils.times(this.state.numCols, columnIndex =&gt; columnIndex),
            columnIndex =&gt; this.store.getColumnName(columnIndex),
            this.handleNumberStateChange,
        );

        const ROW_MENU_CARDINALITIES = [RegionCardinality.CELLS, RegionCardinality.FULL_ROWS];
        const COLUMN_MENU_CARDINALITIES = [RegionCardinality.CELLS, RegionCardinality.FULL_COLUMNS];

        const shouldShowRowSelectMenu = contains(ROW_MENU_CARDINALITIES, scrollToRegionType);
        const shouldShowColumnSelectMenu = contains(COLUMN_MENU_CARDINALITIES, scrollToRegionType);

        return (
            <div>
                {scrollToRegionTypeSelectMenu}
                <div>
                    {shouldShowRowSelectMenu ? scrollToRowSelectMenu : undefined}
                    {shouldShowColumnSelectMenu ? scrollToColumnSelectMenu : undefined}</div></div>
github palantir / blueprint / packages / table-dev-app / src / slowLayoutStack.tsx View on Github external
public render() {
        const { children, depth, enabled, rootClassName, branchClassName } = this.props;
        let elements = children;
        if (enabled) {
            Utils.times(depth, (i: number) =&gt; {
                elements = [
                    <div>
                        {elements}
                    </div>,
                ];
            });
        }
        return <div>{elements}</div>;
    }
}
github palantir / blueprint / packages / table-dev-app / src / mutableTable.tsx View on Github external
private renderScrollToSection() {
        const { scrollToRegionType } = this.state;

        const scrollToRegionTypeSelectMenu = this.renderSelectMenu(
            "Region type",
            "scrollToRegionType",
            REGION_CARDINALITIES,
            this.getRegionCardinalityLabel,
            this.handleRegionCardinalityChange,
        );
        const scrollToRowSelectMenu = this.renderSelectMenu(
            "Row",
            "scrollToRowIndex",
            Utils.times(this.state.numRows, rowIndex => rowIndex),
            rowIndex => `${rowIndex + 1}`,
            this.handleNumberStateChange,
        );
        const scrollToColumnSelectMenu = this.renderSelectMenu(
            "Column",
            "scrollToColumnIndex",
            Utils.times(this.state.numCols, columnIndex => columnIndex),
            columnIndex => this.store.getColumnName(columnIndex),
            this.handleNumberStateChange,
        );

        const ROW_MENU_CARDINALITIES = [RegionCardinality.CELLS, RegionCardinality.FULL_ROWS];
        const COLUMN_MENU_CARDINALITIES = [RegionCardinality.CELLS, RegionCardinality.FULL_COLUMNS];

        const shouldShowRowSelectMenu = contains(ROW_MENU_CARDINALITIES, scrollToRegionType);
        const shouldShowColumnSelectMenu = contains(COLUMN_MENU_CARDINALITIES, scrollToRegionType);