Skip to content

Commit

Permalink
Merging branch ‘origin/master’ into ‘2-x’
Browse files Browse the repository at this point in the history
  • Loading branch information
fran-worley committed May 22, 2019
2 parents 0da0aa9 + 43a34f5 commit b173a6a
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 32 deletions.
2 changes: 1 addition & 1 deletion addon/-private/global-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ const globalOptions = config['ember-light-table'] || {};
export default globalOptions;

export function mergeOptionsWithGlobals(options) {
return assign(assign({}, globalOptions), options);
return assign({}, globalOptions, options);
}
8 changes: 3 additions & 5 deletions addon/mixins/draggable-column.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,14 @@ export default Mixin.create({
let table = this.get('table');
let columns = this.get('dragColumnGroup');

let _columns = columns.toArray();
let targetColumnIdx = _columns.indexOf(targetColumn);
let targetColumnIdx = columns.indexOf(targetColumn);

e.dataTransfer.dropEffect = 'move';
e.preventDefault();
e.stopPropagation();

_columns.removeObject(sourceColumn);
_columns.insertAt(targetColumnIdx, sourceColumn);
columns.setObjects(_columns);
columns.removeObject(sourceColumn);
columns.insertAt(targetColumnIdx, sourceColumn);

table.notifyPropertyChange('columns');

Expand Down
2 changes: 1 addition & 1 deletion addon/templates/components/lt-body.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
rows=rows
inViewport=(action "inViewport")
exitViewport=(action "exitViewport")
scrollableContent=".lt-scrollable"}}
scrollableContent=(concat "#" tableId " .lt-scrollable")}}
{{/if}}

<div id={{concat tableId '_inline_foot'}} class="lt-inline lt-foot"></div>
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
"loader.js": "^4.6.0",
"yuidoc-ember-theme": "^2.0.1"
},
"resolutions": {
"ip-regex": "^2.1.0"
},
"engines": {
"node": "6.* || 8.* || >= 10.*"
},
Expand Down
36 changes: 36 additions & 0 deletions tests/integration/components/light-table-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,42 @@ module('Integration | Component | light table', function(hooks) {
await scrollTo(scrollContainer, 0, scrollHeight);
});

test('scrolled to bottom (multiple tables)', async function(assert) {
assert.expect(4);

this.set('table', new Table(Columns, this.server.createList('user', 50)));

this.set('onScrolledToBottomTable1', () => {
assert.ok(false);
});

this.set('onScrolledToBottomTable2', () => {
assert.ok(true);
});

await render(hbs `
{{#light-table table height='40vh' id='table-1' as |t|}}
{{t.head fixed=true}}
{{t.body onScrolledToBottom=(action onScrolledToBottomTable1)}}
{{/light-table}}
{{#light-table table height='40vh' id='table-2' as |t|}}
{{t.head fixed=true}}
{{t.body onScrolledToBottom=(action onScrolledToBottomTable2)}}
{{/light-table}}
`);

assert.equal(findAll('#table-2 tbody > tr').length, 50, '50 rows are rendered');

let scrollContainer = '#table-2 .tse-scroll-content';
let { scrollHeight } = find(scrollContainer);

assert.ok(findAll(scrollContainer).length > 0, 'scroll container was rendered');
assert.equal(scrollHeight, 2501, 'scroll height is 2500 + 1px for height of lt-infinity');

await scrollTo(scrollContainer, 0, scrollHeight);
});

test('fixed header', async function(assert) {
assert.expect(2);
this.set('table', new Table(Columns, this.server.createList('user', 5)));
Expand Down
20 changes: 10 additions & 10 deletions tests/integration/components/lt-body-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ module('Integration | Component | lt body', function(hooks) {
});

test('it renders', async function(assert) {
await render(hbs `{{lt-body sharedOptions=sharedOptions}}`);
await render(hbs `{{lt-body sharedOptions=sharedOptions tableId="light-table"}}`);
assert.equal(find('*').textContent.trim(), '');
});

test('row selection - enable or disable', async function(assert) {
this.set('table', new Table(Columns, this.server.createList('user', 1)));
this.set('canSelect', false);

await render(hbs `{{lt-body table=table sharedOptions=sharedOptions canSelect=canSelect}}`);
await render(hbs `{{lt-body table=table sharedOptions=sharedOptions canSelect=canSelect tableId="light-table"}}`);

let row = find('tr');

Expand All @@ -55,7 +55,7 @@ module('Integration | Component | lt body', function(hooks) {
test('row selection - ctrl-click to modify selection', async function(assert) {
this.set('table', new Table(Columns, this.server.createList('user', 5)));

await render(hbs `{{lt-body table=table sharedOptions=sharedOptions canSelect=true multiSelect=true}}`);
await render(hbs `{{lt-body table=table sharedOptions=sharedOptions canSelect=true multiSelect=true tableId="light-table"}}`);
let firstRow = find('tr:first-child');
let middleRow = find('tr:nth-child(4)');
let lastRow = find('tr:last-child');
Expand All @@ -79,7 +79,7 @@ module('Integration | Component | lt body', function(hooks) {
this.set('table', new Table(Columns, this.server.createList('user', 5)));

await render(
hbs `{{lt-body table=table sharedOptions=sharedOptions canSelect=true multiSelect=true multiSelectRequiresKeyboard=false}}`
hbs `{{lt-body table=table sharedOptions=sharedOptions canSelect=true multiSelect=true multiSelectRequiresKeyboard=false tableId="light-table"}}`
);

let firstRow = find('tr:first-child');
Expand All @@ -106,7 +106,7 @@ module('Integration | Component | lt body', function(hooks) {
this.set('canExpand', false);

await render(hbs `
{{#lt-body table=table sharedOptions=sharedOptions canSelect=false canExpand=canExpand multiRowExpansion=false as |b|}}
{{#lt-body table=table sharedOptions=sharedOptions canSelect=false canExpand=canExpand multiRowExpansion=false tableId="light-table" as |b|}}
{{#b.expanded-row}} Hello {{/b.expanded-row}}
{{/lt-body}}
`);
Expand Down Expand Up @@ -139,7 +139,7 @@ module('Integration | Component | lt body', function(hooks) {
test('row expansion - multiple', async function(assert) {
this.set('table', new Table(Columns, this.server.createList('user', 2)));
await render(hbs `
{{#lt-body table=table sharedOptions=sharedOptions canExpand=true as |b|}}
{{#lt-body table=table sharedOptions=sharedOptions canExpand=true tableId="light-table" as |b|}}
{{#b.expanded-row}} Hello {{/b.expanded-row}}
{{/lt-body}}
`);
Expand All @@ -165,7 +165,7 @@ module('Integration | Component | lt body', function(hooks) {
this.actions.onRowClick = (row) => assert.ok(row);
this.actions.onRowDoubleClick = (row) => assert.ok(row);
await render(
hbs `{{lt-body table=table sharedOptions=sharedOptions onRowClick=(action 'onRowClick') onRowDoubleClick=(action 'onRowDoubleClick')}}`
hbs `{{lt-body table=table sharedOptions=sharedOptions onRowClick=(action 'onRowClick') onRowDoubleClick=(action 'onRowDoubleClick') tableId="light-table"}}`
);

let row = find('tr');
Expand All @@ -176,7 +176,7 @@ module('Integration | Component | lt body', function(hooks) {
test('hidden rows', async function(assert) {
this.set('table', new Table(Columns, this.server.createList('user', 5)));

await render(hbs `{{lt-body table=table sharedOptions=sharedOptions}}`);
await render(hbs `{{lt-body table=table sharedOptions=sharedOptions tableId="light-table"}}`);

assert.equal(findAll('tbody > tr').length, 5);

Expand All @@ -198,7 +198,7 @@ module('Integration | Component | lt body', function(hooks) {
const users = this.server.createList('user', 1);
this.set('table', new Table(Columns, users));

await render(hbs `{{lt-body table=table sharedOptions=sharedOptions enableScaffolding=true}}`);
await render(hbs `{{lt-body table=table sharedOptions=sharedOptions enableScaffolding=true tableId="light-table"}}`);

const [scaffoldingRow, userRow] = findAll('tr');
const userCells = userRow.querySelectorAll('.lt-cell');
Expand All @@ -222,7 +222,7 @@ module('Integration | Component | lt body', function(hooks) {
this.set('table', new Table(Columns, this.server.createList('user', 5)));

await render(hbs `
{{#lt-body table=table sharedOptions=sharedOptions overwrite=true as |columns rows|}}
{{#lt-body table=table sharedOptions=sharedOptions overwrite=true tableId="light-table" as |columns rows|}}
{{columns.length}}, {{rows.length}}
{{/lt-body}}
`);
Expand Down
65 changes: 50 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -722,20 +722,20 @@
dependencies:
"@glimmer/util" "^0.27.0"

"@html-next/vertical-collection@^1.0.0-beta.12":
version "1.0.0-beta.12"
resolved "https://registry.yarnpkg.com/@html-next/vertical-collection/-/vertical-collection-1.0.0-beta.12.tgz#c5cbed1a7cc9bfe8d4e82474bbb8d265882bc6f9"
integrity sha512-DAMomcdVH7dxxSmDvI99QRcsl2kV+RKRjbickfyPMN4EcSBQZkAQfkXdJbktk2iW+OuoNHMAlkBV2atwT3OBsw==
"@html-next/vertical-collection@^1.0.0-beta.13":
version "1.0.0-beta.13"
resolved "https://registry.yarnpkg.com/@html-next/vertical-collection/-/vertical-collection-1.0.0-beta.13.tgz#0cd7fbe813fef8c7daea3c46a3d4167cbd8db682"
integrity sha512-YFs+toYLFSCiZSv1kkb3IPvrcVJHVX6q7vkzP0qb2Rvd0s61YqgpPDqtZ8sVViip0Lu3kw+Hs9fysjpAFqJDzQ==
dependencies:
babel-plugin-transform-es2015-block-scoping "^6.24.1"
babel6-plugin-strip-class-callcheck "^6.0.0"
broccoli-funnel "^2.0.1"
broccoli-merge-trees "^2.0.0"
broccoli-merge-trees "^3.0.1"
broccoli-rollup "^2.0.0"
ember-cli-babel "^6.6.0"
ember-cli-htmlbars "^2.0.3"
ember-cli-htmlbars "^3.0.0"
ember-cli-version-checker "^2.1.0"
ember-compatibility-helpers "^0.1.2"
ember-compatibility-helpers "^1.0.0"
ember-raf-scheduler "0.1.0"

"@sindresorhus/is@^0.7.0":
Expand Down Expand Up @@ -1424,7 +1424,7 @@ babel-plugin-check-es2015-constants@^6.22.0:
dependencies:
babel-runtime "^6.22.0"

babel-plugin-debug-macros@^0.1.10, babel-plugin-debug-macros@^0.1.11:
babel-plugin-debug-macros@^0.1.10:
version "0.1.11"
resolved "https://registry.yarnpkg.com/babel-plugin-debug-macros/-/babel-plugin-debug-macros-0.1.11.tgz#6c562bf561fccd406ce14ab04f42c218cf956605"
integrity sha512-hZw5qNNGAR02Y+yBUrtsnJHh8OXavkayPRqKGAXnIm4t5rWVpj3ArwsC7TWdpZsBguQvHAeyTxZ7s23yY60HHg==
Expand All @@ -1438,6 +1438,13 @@ babel-plugin-debug-macros@^0.2.0, babel-plugin-debug-macros@^0.2.0-beta.6:
dependencies:
semver "^5.3.0"

babel-plugin-ember-modules-api-polyfill@^2.3.2:
version "2.9.0"
resolved "https://registry.yarnpkg.com/babel-plugin-ember-modules-api-polyfill/-/babel-plugin-ember-modules-api-polyfill-2.9.0.tgz#8503e7b4192aeb336b00265e6235258ff6b754aa"
integrity sha512-c03h50291phJ2gQxo/aIOvFQE2c6glql1A7uagE3XbPXpKVAJOUxtVDjvWG6UAB6BC5ynsJfMWvY0w4TPRKIHQ==
dependencies:
ember-rfc176-data "^0.3.9"

babel-plugin-ember-modules-api-polyfill@^2.5.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/babel-plugin-ember-modules-api-polyfill/-/babel-plugin-ember-modules-api-polyfill-2.5.0.tgz#860aab9fecbf38c10d1fe0779c6979a854fff154"
Expand Down Expand Up @@ -2121,7 +2128,7 @@ broccoli-babel-transpiler@^6.0.0:
rsvp "^4.8.2"
workerpool "^2.3.0"

broccoli-babel-transpiler@^6.5.0:
broccoli-babel-transpiler@^6.4.5, broccoli-babel-transpiler@^6.5.0:
version "6.5.1"
resolved "https://registry.yarnpkg.com/broccoli-babel-transpiler/-/broccoli-babel-transpiler-6.5.1.tgz#a4afc8d3b59b441518eb9a07bd44149476e30738"
integrity sha512-w6GcnkxvHcNCte5FcLGEG1hUdQvlfvSN/6PtGWU/otg69Ugk8rUk51h41R0Ugoc+TNxyeFG1opRt2RlA87XzNw==
Expand Down Expand Up @@ -3811,6 +3818,16 @@ ember-cli-htmlbars@^2.0.1, ember-cli-htmlbars@^2.0.2, ember-cli-htmlbars@^2.0.3:
json-stable-stringify "^1.0.0"
strip-bom "^3.0.0"

ember-cli-htmlbars@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/ember-cli-htmlbars/-/ember-cli-htmlbars-3.0.1.tgz#01e21f0fd05e0a6489154f26614b1041769e3e58"
integrity sha512-pyyB2s52vKTXDC5svU3IjU7GRLg2+5O81o9Ui0ZSiBS14US/bZl46H2dwcdSJAK+T+Za36ZkQM9eh1rNwOxfoA==
dependencies:
broccoli-persistent-filter "^1.4.3"
hash-for-dep "^1.2.3"
json-stable-stringify "^1.0.0"
strip-bom "^3.0.0"

ember-cli-inject-live-reload@^1.7.0:
version "1.10.2"
resolved "https://registry.yarnpkg.com/ember-cli-inject-live-reload/-/ember-cli-inject-live-reload-1.10.2.tgz#43c59f7f1d1e717772da32e5e81d948fb9fe7c94"
Expand Down Expand Up @@ -4121,13 +4138,13 @@ ember-code-snippet@^2.2.0:
es6-promise "^1.0.0"
glob "^7.1.3"

ember-compatibility-helpers@^0.1.2:
version "0.1.3"
resolved "https://registry.yarnpkg.com/ember-compatibility-helpers/-/ember-compatibility-helpers-0.1.3.tgz#039a57e9f1a401efda0023c1e3650bd01cfd7087"
integrity sha512-3YBCYrbZ+HqQRSxbGl9jso1FBX6WjGS9FC7tgmmul3us6vtFPxjjnGN25H5ze2xk/mDCG373p0lm5xG+mVpKkA==
ember-compatibility-helpers@^1.0.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/ember-compatibility-helpers/-/ember-compatibility-helpers-1.2.0.tgz#feee16c5e9ef1b1f1e53903b241740ad4b01097e"
integrity sha512-pUW4MzJdcaQtwGsErYmitFRs0rlCYBAnunVzlFFUBr4xhjlCjgHJo0b53gFnhTgenNM3d3/NqLarzRhDTjXRTg==
dependencies:
babel-plugin-debug-macros "^0.1.11"
ember-cli-version-checker "^2.0.0"
babel-plugin-debug-macros "^0.2.0"
ember-cli-version-checker "^2.1.1"
semver "^5.4.1"

ember-compatibility-helpers@^1.0.2, ember-compatibility-helpers@^1.1.1:
Expand Down Expand Up @@ -4309,6 +4326,14 @@ ember-native-dom-helpers@^0.6.2:
broccoli-funnel "^1.1.0"
ember-cli-babel "^6.6.0"

ember-notify-property-change-polyfill@^0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/ember-notify-property-change-polyfill/-/ember-notify-property-change-polyfill-0.0.2.tgz#4fd9012c23b9f6a8ee8e73e27989ac946f00b3fb"
integrity sha1-T9kBLCO59qjujnPieYmslG8As/s=
dependencies:
ember-cli-babel "^6.6.0"
ember-cli-version-checker "^2.1.0"

ember-one-way-controls@^3.0.1:
version "3.1.0"
resolved "https://registry.yarnpkg.com/ember-one-way-controls/-/ember-one-way-controls-3.1.0.tgz#5037d024aea0466a1dd787a79fbfd82b5df8c71e"
Expand Down Expand Up @@ -4364,6 +4389,11 @@ ember-rfc176-data@^0.3.1, ember-rfc176-data@^0.3.5:
resolved "https://registry.yarnpkg.com/ember-rfc176-data/-/ember-rfc176-data-0.3.5.tgz#f630e550572c81a5e5c7220f864c0f06eee9e977"
integrity sha512-5NfL1iTkIQDYs16/IZ7/jWCEglNsUrigLelBkBMsNcib9T3XzQwmhhVTjoSsk66s57LmWJ1bQu+2c1CAyYCV7A==

ember-rfc176-data@^0.3.9:
version "0.3.9"
resolved "https://registry.yarnpkg.com/ember-rfc176-data/-/ember-rfc176-data-0.3.9.tgz#44b6e051ead6c044ea87bd551f402e2cf89a7e3d"
integrity sha512-EiTo5YQS0Duy0xp9gCP8ekzv9vxirNi7MnIB4zWs+thtWp/mEKgf5mkiiLU2+oo8C5DuavVHhoPQDmyxh8Io1Q==

ember-router-generator@^1.2.3:
version "1.2.3"
resolved "https://registry.yarnpkg.com/ember-router-generator/-/ember-router-generator-1.2.3.tgz#8ed2ca86ff323363120fc14278191e9e8f1315ee"
Expand Down Expand Up @@ -6297,6 +6327,11 @@ invert-kv@^1.0.0:
resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6"
integrity sha1-EEqOSqym09jNFXqO+L+rLXo//bY=

ip-regex@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9"
integrity sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=

ip@^1.1.4:
version "1.1.5"
resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a"
Expand Down

0 comments on commit b173a6a

Please sign in to comment.