How to use the ix.Iterable.range function in ix

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

github marinels / webrx-react / src / Components / Common / Items / TreeItem.tsx View on Github external
protected renderIndent() {
    return Iterable
      .range(0, this.props.depth || 0)
      .map((x, i) => {
        return (
          <div key={ i } className='TreeItem-Indent'></div>
        ) as PanelFragment | false;
      })
      .defaultIfEmpty(false)
      .toArray();
  }
github marinels / webrx-react / src / Components / Common / Panel / UniformGridPanel.tsx View on Github external
renderItems(children?: React.ReactNode, componentClass?: React.ReactType) {
    const itemTemplates = super.renderItems(children, componentClass);

    let index = 0 - this.props.firstColumn!;
    return Iterable
      .range(0, this.props.gridRows)
      .map(row => {
        if (this.props.renderEmptyRows !== true && index >= itemTemplates.length) {
          return undefined;
        }

        return Iterable
          .range(0, this.props.gridColumns)
          .map(column => {
            const isBeforeFirstItem = index < 0;
            const isAfterLastItem = index >= itemTemplates.length;

            const itemTemplate = (isBeforeFirstItem || isAfterLastItem) ?
              this.renderEmpty(row, column, index) :
              itemTemplates[index];
github marinels / webrx-react / src / Components / Demo / ComponentDemoView.tsx View on Github external
private renderDropdown(cols: number) {
    return (
      <DropdownButton id='col-width' bsStyle='info'
        title={ `Column Width (${ cols === 0 ? 'Full Width' : cols })` }
        onSelect={ this.bindEventToCommand(x => x.setColumns) }
      >
        {
          Iterable
            .range(1, 13)
            .reverse()
            .map(x => x % 13)
            .map(x => (
              <MenuItem key={ x } eventKey={ x } active={ cols === x }>{ x === 0 ? 'Full Width' : x }</MenuItem>
            ))
            .toArray()
        }
      </DropdownButton>
    );
  }
}
github marinels / webrx-react / src / Components / Common / Panel / Grid.tsx View on Github external
renderItems(allChildren?: React.ReactNode, componentClass?: React.ReactType) {
    const { children, rows, cols } = this.getLayout();

    return Iterable
      .range(0, rows.length)
      .map(row => {
        const colItems = Iterable
          .range(0, cols.length)
          .map(col => {
            return this.renderColumn(row, col, rows, cols, children);
          })
          .toArray();

        return this.renderRow(row, rows, colItems);
      })
      .defaultIfEmpty(this.renderEmpty())
      .toArray();
  }
github marinels / webrx-react / src / Components / Common / Panel / Grid.tsx View on Github external
.map(row => {
        const colItems = Iterable
          .range(0, cols.length)
          .map(col => {
            return this.renderColumn(row, col, rows, cols, children);
          })
          .toArray();

        return this.renderRow(row, rows, colItems);
      })
      .defaultIfEmpty(this.renderEmpty())
github marinels / webrx-react / src / Components / Common / Panel / UniformGridPanel.tsx View on Github external
.map(row => {
        if (this.props.renderEmptyRows !== true && index >= itemTemplates.length) {
          return undefined;
        }

        return Iterable
          .range(0, this.props.gridColumns)
          .map(column => {
            const isBeforeFirstItem = index < 0;
            const isAfterLastItem = index >= itemTemplates.length;

            const itemTemplate = (isBeforeFirstItem || isAfterLastItem) ?
              this.renderEmpty(row, column, index) :
              itemTemplates[index];

            const item = (itemTemplate != null && React.isValidElement<any>(itemTemplate)) ?
              React.cloneElement(itemTemplate, { key: GridLayoutDefinition.generateKey(row, column) }) :
              itemTemplate;

            const context = { row, column, index: index++ };
            const colClassName = Panel.getPanelItemPropValue(this.props.columnClassName, context);
            const colStyle = Panel.getPanelItemPropValue(this.props.columnStyle, context);
github marinels / webrx-react / src / Components / Common / App / BootstrapGuide.tsx View on Github external
render() {
    return (
      <div ref='guide' className='BootstrapGuide'>
        <Grid>
          <Row>
            {
              Iterable
                .range(1, 12)
                .map(x => (
                  <Col key={ x } className='BootstrapGuide-col' xs={ 1 }>
                    <div className='BootstrapGuide-block'>{ `Col ${ x }` }</div>
                  </Col>
                ))
                .toArray()
            }
          </Row>
        </Grid>
        <div ref='hline' className='BootstrapGuide-line BootstrapGuide-hline'></div>
        <div ref='vline' className='BootstrapGuide-line BootstrapGuide-vline'></div>
      </div>
    );
  }