ember-light-table
Advanced tools
Comparing version 1.5.1 to 1.5.2
@@ -81,2 +81,10 @@ import Ember from 'ember'; | ||
/** | ||
* The minimum width (in px) that this column can be resized to. | ||
* @property minResizeWidth | ||
* @type {Number} | ||
* @default 0 | ||
*/ | ||
minResizeWidth: 0, | ||
/** | ||
* An array of sub columns to be grouped together | ||
@@ -83,0 +91,0 @@ * @property subColumns |
@@ -26,3 +26,3 @@ import Ember from 'ember'; | ||
attributeBindings: ['style', 'colspan', 'rowspan'], | ||
classNameBindings: ['align', 'isGroupColumn:lt-group-column', 'isHideable', 'isSortable', 'isSorted', 'isResizable', 'column.classNames'], | ||
classNameBindings: ['align', 'isGroupColumn:lt-group-column', 'isHideable', 'isSortable', 'isSorted', 'isResizable', 'isResizing', 'column.classNames'], | ||
@@ -34,2 +34,3 @@ isGroupColumn: computed.readOnly('column.isGroupColumn'), | ||
isResizable: computed.readOnly('column.resizable'), | ||
isResizing: false, | ||
@@ -36,0 +37,0 @@ style: computed('column.width', function() { |
@@ -5,3 +5,4 @@ import Ember from 'ember'; | ||
const { | ||
$ | ||
$, | ||
computed | ||
} = Ember; | ||
@@ -19,2 +20,6 @@ | ||
$column: computed(function() { | ||
return $(this.get('element')).parent('th'); | ||
}).volatile().readOnly(), | ||
didInsertElement() { | ||
@@ -46,3 +51,3 @@ this._super(...arguments); | ||
mouseDown(e) { | ||
let $column = this._getColumn(); | ||
let $column = this.get('$column'); | ||
@@ -54,5 +59,7 @@ e.preventDefault(); | ||
isResizing: true, | ||
startWidth: $column.width(), | ||
startWidth: $column.outerWidth(), | ||
startX: e.pageX | ||
}); | ||
this.$().closest('.ember-light-table').addClass('is-resizing'); | ||
}, | ||
@@ -65,7 +72,10 @@ | ||
let $column = this._getColumn(); | ||
let $column = this.get('$column'); | ||
let width = `${$column.outerWidth()}px`; | ||
this.set('isResizing', false); | ||
this.set('column.width', `${$column.width()}px`); | ||
this.sendAction('columnResized', this.get('column.width')); | ||
this.set('column.width', width); | ||
this.sendAction('columnResized', width); | ||
this.$().closest('.ember-light-table').removeClass('is-resizing'); | ||
} | ||
@@ -80,5 +90,6 @@ }, | ||
let resizeOnDrag = this.get('resizeOnDrag'); | ||
let $column = this._getColumn(); | ||
let $column = this.get('$column'); | ||
let minResizeWidth = this.get('column.minResizeWidth'); | ||
let { startX, startWidth } = this.getProperties(['startX', 'startWidth']); | ||
let width = startWidth + (e.pageX - startX); | ||
let width = Math.max(startWidth + (e.pageX - startX), minResizeWidth); | ||
@@ -88,10 +99,6 @@ if (resizeOnDrag) { | ||
} else { | ||
$column.width(`${width}px`); | ||
$column.outerWidth(`${width}px`); | ||
} | ||
} | ||
}, | ||
_getColumn() { | ||
return $(this.get('element')).parent('th'); | ||
} | ||
}); |
Changelog | ||
========= | ||
## v1.5.2 | ||
### Pull Requests | ||
- [#244](https://github.com/offirgolan/ember-light-table/pull/244) [FEATURE] minResizeWidth + Event bubbling fix *by [Offir Golan](https://github.com/offirgolan)* | ||
## v1.5.1 | ||
@@ -5,0 +11,0 @@ |
{ | ||
"name": "ember-light-table", | ||
"version": "1.5.1", | ||
"version": "1.5.2", | ||
"description": "Lightweight, component based table for Ember 2.x", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/offirgolan/ember-light-table", |
@@ -9,4 +9,4 @@ # Ember Light Table | ||
[![Code Climate](https://codeclimate.com/github/offirgolan/ember-light-table/badges/gpa.svg)](https://codeclimate.com/github/offirgolan/ember-light-table) | ||
[![Test Coverage](https://codeclimate.com/github/offirgolan/ember-light-table/badges/coverage.svg)](https://codeclimate.com/github/offirgolan/ember-light-table/coverage) | ||
[![Dependency Status](https://david-dm.org/offirgolan/ember-light-table.svg)](https://david-dm.org/offirgolan/ember-light-table) | ||
[]([![Test Coverage](https://codeclimate.com/github/offirgolan/ember-light-table/badges/coverage.svg)](https://codeclimate.com/github/offirgolan/ember-light-table/coverage)) | ||
[]([![Dependency Status](https://david-dm.org/offirgolan/ember-light-table.svg)](https://david-dm.org/offirgolan/ember-light-table)) | ||
@@ -19,3 +19,3 @@ A lightweight contextual component based table addon that follows Ember's actions up, data down ideology. | ||
- Infinite scroll support | ||
- Select & Multi-select | ||
- Select & Multi-select with keyboard support (CMD/CTRL, SHIFT) | ||
- Fixed header and footer | ||
@@ -25,7 +25,10 @@ - Grouped columns | ||
- Expandable rows | ||
- Responsive | ||
- Scroll Tracking | ||
- Easy table manipulation | ||
- Easy override to table header and footer | ||
- Easy override to table header, body, and footer | ||
- Contextual component for header, body, and footer, as well as loading, no data, and expanded row | ||
## Installation | ||
```shell | ||
@@ -32,0 +35,0 @@ ember install ember-light-table |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
811510
3244
45