Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(npm): update dependencies and fix eslint #40

Merged
merged 2 commits into from
Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module.exports = {
presets: ['@vue/app'],
presets: [
'@vue/cli-plugin-babel/preset',
],
};
53 changes: 28 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"name": "vue-tabulator",
"description": "The best way to use Tabulator in Vue projects",
"version": "1.0.0",
"engines" : { "node" : ">=10" },
"engines": {
"node": ">=10"
},
"scripts": {
"release": "release-it",
"release:rc": "npm run release -- --preRelease=rc",
Expand Down Expand Up @@ -53,46 +55,47 @@
"dependencies": {
"@types/dashify": "^1.0.0",
"@types/lodash.mergewith": "^4.6.6",
"@types/tabulator-tables": "^4.2.4",
"@types/tabulator-tables": "^4.4.3",
"core-js": "^3.3.6",
"dashify": "^2.0.0",
"lodash.mergewith": "^4.6.2",
"vue-class-component": "^7.1.0",
"vue-property-decorator": "^8.2.1"
"vue-property-decorator": "^8.3.0"
},
"peerDependencies": {
"tabulator-tables": "^4.4.1",
"vue": "^2.6.8"
"tabulator-tables": "^4.4.3",
"vue": "^2.6.10"
},
"devDependencies": {
"@types/jest": "^24.0.15",
"@typescript-eslint/parser": "^2.0.0",
"@vue/cli-plugin-babel": "^3.0.5",
"@vue/cli-plugin-e2e-cypress": "^3.0.5",
"@vue/cli-plugin-eslint": "^3.0.5",
"@vue/cli-plugin-typescript": "^3.0.5",
"@vue/cli-plugin-unit-jest": "^3.0.5",
"@vue/cli-service": "^3.0.5",
"@vue/eslint-config-airbnb": "^4.0.0",
"@types/jest": "^24.0.21",
"@typescript-eslint/parser": "^2.6.1",
"@vue/cli-plugin-babel": "^4.0.5",
"@vue/cli-plugin-e2e-cypress": "^4.0.5",
"@vue/cli-plugin-eslint": "^4.0.5",
"@vue/cli-plugin-typescript": "^4.0.5",
"@vue/cli-plugin-unit-jest": "^4.0.5",
"@vue/cli-service": "^4.0.5",
"@vue/eslint-config-airbnb": "^4.0.1",
"@vue/eslint-config-typescript": "^4.0.0",
"@vue/test-utils": "^1.0.0-beta.20",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"babel-eslint": "^10.0.3",
"chalk": "^2.4.2",
"commitizen": "^4.0.3",
"copy-webpack-plugin": "^5.0.3",
"coveralls": "^3.0.3",
"copy-webpack-plugin": "^5.0.4",
"coveralls": "^3.0.7",
"cz-conventional-changelog": "3.0.2",
"eslint": "^6.1.0",
"eslint": "^5.16.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-vue": "^5.2.3",
"lint-staged": "^9.2.0",
"node-sass": "^4.9.0",
"release-it": "^12.3.3",
"lint-staged": "^9.4.2",
"node-sass": "^4.13.0",
"release-it": "^12.4.3",
"sass-loader": "^8.0.0",
"ts-jest": "^24.0.2",
"typescript": "~3.5.3",
"vue-template-compiler": "^2.6.8",
"vuepress": "^1.1.0",
"ts-jest": "^24.1.0",
"typescript": "~3.6.4",
"vue-template-compiler": "^2.6.10",
"vuepress": "^1.2.0",
"yorkie": "^2.0.0"
},
"files": [
Expand Down
31 changes: 16 additions & 15 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,27 @@ import VueTabulator from './components/TabulatorComponent.vue';
})
export default class App extends Vue {
public data = [{ name: 'Teste', age: 13 }];

public columns = [
{
title: 'Name',
field: 'name',
sorter: 'string',
width: 200,
editor: true,
},
]
{
title: 'Name',
field: 'name',
sorter: 'string',
width: 200,
editor: true,
},
]

get options() {
const vm = this
const vm = this;
return {
columns: this.columns,
rowClick: function(e: Event, row: Tabulator.RowComponent) {
console.log('I clicked a row',vm,e,row)
vm.newRow()
}
}
};
rowClick(e: Event, row: Tabulator.RowComponent) {
console.log('I clicked a row', vm, e, row);
vm.newRow();
},
};
}

updateRow() {
this.data[0].name = 'Name updated';
Expand Down
16 changes: 8 additions & 8 deletions src/components/TabulatorComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
import {
Component, Prop, Vue, Watch, Model,
} from 'vue-property-decorator';
import mergeWith from 'lodash.mergewith';
import { IntegrationOptions, UpdateStrategy } from '@/types';
import mergeWith from 'lodash.mergewith'
import merge from '../utilities/merge'
import merge from '../utilities/merge';
import eventFactory from '../feature/event-factory';
import cellEvents from '../feature/events/cell-events';
import rowEvents from '../feature/events/row-events';

const Tabulator = require('tabulator-tables');
import eventFactory from '../feature/event-factory'
import cellEvents from '../feature/events/cell-events'
import rowEvents from '../feature/events/row-events'

@Component({
name: 'TabulatorComponent',
Expand All @@ -28,8 +29,8 @@ export default class TabulatorComponent extends Vue {
private tabulatorInstance: Tabulator | null = null;

get eventOptions(): Object {
const events = eventFactory.bind(this)
return {...events(rowEvents), ...events(cellEvents)}
const events = eventFactory.bind(this);
return { ...events(rowEvents), ...events(cellEvents) };
}

@Prop({ default: () => ({}) })
Expand All @@ -53,7 +54,6 @@ export default class TabulatorComponent extends Vue {

@Watch('options', { deep: true })
private updateOptions() {

this.resolvedOptions = {
...mergeWith(this.eventOptions, this.options, merge),
data: this.tableData,
Expand Down
4 changes: 2 additions & 2 deletions src/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ export { TabulatorComponent };
function install(VueApp: typeof Vue, options: any = {}) {
const name = options.name || 'VueTabulator';
VueApp.component(name, TabulatorComponent);
};
}

export default {
install,
};

if (typeof window !== 'undefined' && (<any>window).Vue && (<any>window).Vue === Vue) {
install((<any>window).Vue)
install((<any>window).Vue);
}
4 changes: 2 additions & 2 deletions src/feature/events/cell-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ const cellEvents: string[] = [
'cellEditing',
'cellEditCancelled',
'cellEdited',
]
];

export default cellEvents
export default cellEvents;
4 changes: 2 additions & 2 deletions src/feature/events/row-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ const rowEvents: string[] = [
'rowDeleted',
'rowMoved',
'rowResized',
]
];

export default rowEvents
export default rowEvents;
11 changes: 6 additions & 5 deletions tests/e2e/specs/vue-tabulator-spec-e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ describe('VueTabulator', () => {
cy.get('#row').click();
cy.contains('.tabulator-cell', 'Teste 2');
});

it('Bind options to tabulator', () => {
cy.visit('/');
cy.get('#column').click();
cy.contains('.tabulator-col-title', 'age');
});

it('Fires events on row click', () => {
cy.visit('/')
cy.get('.tabulator-cell').click()
cy.visit('/');
cy.get('#row').click();
cy.get('.tabulator-cell').first().click();
cy.contains('.tabulator-cell', 'Teste 2');
})
});
});
36 changes: 18 additions & 18 deletions tests/unit/joint.spec.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import joint from '@/utilities/joint'
import joint from '@/utilities/joint';

describe('joint.ts', () => {
test('joins 2 functions with no params', () => {
const mock1 = jest.fn(() => 0)
const mock2 = jest.fn(() => 2)
const fn3 = joint([mock1,mock2])
fn3()
const mock1 = jest.fn(() => 0);
const mock2 = jest.fn(() => 2);
const fn3 = joint([mock1, mock2]);
fn3();
expect(mock1.mock.calls.length).toEqual(1);
expect(mock2.mock.calls.length).toEqual(1);
});
test('join 2 functions with same params', () => {
const mock1 = jest.fn((a,b) => a * b)
const mock2 = jest.fn((a,b) => a + b)
const fn3 = joint([mock1,mock2])
fn3(1,2)
const mock1 = jest.fn((a, b) => a * b);
const mock2 = jest.fn((a, b) => a + b);
const fn3 = joint([mock1, mock2]);
fn3(1, 2);
expect(mock1.mock.calls.length).toEqual(1);
expect(mock2.mock.calls.length).toEqual(1);
expect(mock1.mock.calls[0][0]).toEqual(1);
Expand All @@ -22,13 +22,13 @@ describe('joint.ts', () => {
expect(mock2.mock.calls[0][1]).toEqual(2);
});
test('joins more than 2 functions', () => {
const mock1 = jest.fn((a,b) => a * b)
const mock2 = jest.fn((a,b) => a + b)
const mock3 = jest.fn((a,b) => a + b)
const fn3 = joint([mock1,mock2,mock3])
fn3(1,2)
expect(mock1.mock.calls.length).toEqual(1)
expect(mock2.mock.calls.length).toEqual(1)
expect(mock3.mock.calls.length).toEqual(1)
})
const mock1 = jest.fn((a, b) => a * b);
const mock2 = jest.fn((a, b) => a + b);
const mock3 = jest.fn((a, b) => a + b);
const fn3 = joint([mock1, mock2, mock3]);
fn3(1, 2);
expect(mock1.mock.calls.length).toEqual(1);
expect(mock2.mock.calls.length).toEqual(1);
expect(mock3.mock.calls.length).toEqual(1);
});
});
16 changes: 8 additions & 8 deletions tests/unit/merge.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import merge from '@/utilities/merge'
import merge from '@/utilities/merge';

describe('merge.ts', () => {
test('merges 2 functions together', () => {
const mock1 = jest.fn(() => 0)
const mock2 = jest.fn(() => 1 + 1)
const merged = merge(mock1, mock2, 'key')
merged()
const mock1 = jest.fn(() => 0);
const mock2 = jest.fn(() => 1 + 1);
const merged = merge(mock1, mock2, 'key');
merged();
expect(mock1.mock.calls.length).toEqual(1);
expect(mock2.mock.calls.length).toEqual(1);
});
test('if params are not functions no return value', () => {
const mock1 = jest.fn(() => 0)
const mock2 = 'should not return function'
const merged = merge(mock1, mock2, 'key')
const mock1 = jest.fn(() => 0);
const mock2 = 'should not return function';
const merged = merge(mock1, mock2, 'key');
expect(merged).toEqual(undefined);
});
});
Loading