| | |
| | | _cols.set(item.field, item) |
| | | }) |
| | | |
| | | let _width = 0 |
| | | _config.subcards.forEach(card => { |
| | | _width += card.setting.width |
| | | card.elements = card.elements.map(item => { |
| | | if (item.field && _cols.has(item.field)) { |
| | | item.col = _cols.get(item.field) |
| | |
| | | return item |
| | | }) |
| | | }) |
| | | |
| | | let offset = 0 |
| | | if (_config.wrap.cardFloat && _config.wrap.cardFloat !== 'left' && _config.subcards[0] && _width < 24) { |
| | | offset = 24 - _width |
| | | if (_config.wrap.cardFloat === 'center') { |
| | | offset = Math.floor(offset / 2) |
| | | } |
| | | _config.subcards[0].offset = offset |
| | | } |
| | | |
| | | this.setState({ |
| | | sync: _sync, |
| | |
| | | <Spin /> |
| | | </div> : null |
| | | } |
| | | <div className="card-row-list"> |
| | | <div className={`card-row-list ${config.wrap.cardType} ${config.wrap.scale}`}> |
| | | {config.subcards.map((item, index) => ( |
| | | <Col className={activeKey === index ? 'active' : ''} key={index} span={item.setting.width || 6} onClick={() => {this.changeCard(index, item)}}> |
| | | <Col className={activeKey === index ? 'active' : ''} key={index} span={item.setting.width || 6} offset={item.offset || 0} onClick={() => {this.changeCard(index, item)}}> |
| | | <CardItem card={item} cards={config} data={data} updateStatus={this.updateStatus}/> |
| | | </Col> |
| | | ))} |