Skip to content

Commit

Permalink
Now with Typescript! (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
selfagency authored Aug 9, 2021
1 parent 48f7f8a commit 83f2c49
Show file tree
Hide file tree
Showing 73 changed files with 8,290 additions and 6,131 deletions.
3 changes: 0 additions & 3 deletions .browserslistrc

This file was deleted.

4 changes: 0 additions & 4 deletions .dcignore

This file was deleted.

3 changes: 0 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2

[*.cs]
indent_size = 4
4 changes: 1 addition & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ module.exports = {
root: true,
env: {
browser: true,
node: true
node: false
},
extends: ['plugin:vue/recommended', 'eslint:recommended', 'plugin:import/errors', 'plugin:import/warnings'],
parserOptions: {
parser: 'babel-eslint'
},
plugins: ['html'],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'import/no-unresolved': 'warn'
},
overrides: [
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,4 @@ yarn-error.log
# End of https://www.toptal.com/developers/gitignore/api/linux,macos,node,dotenv,visualstudiocode,vuejs

.dccache
build
29 changes: 9 additions & 20 deletions bili.config.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,19 @@
module.exports = {
jsCompiler: 'babel',
input: ['src/index.browser.mjs', 'src/index.mjs'],
const config = {
input: 'build/main.js',
bundleNodeModules: true,
externals: ['vue'],
output: {
format: ['cjs', 'esm', 'umd'],
minify: true,
moduleName: 'Grid',
extractCSS: false
extractCSS: false,
dir: 'dist/'
},
plugins: {
string: {
include: 'node_modules/**/*.css'
},
babel: false,
vue: {
target: 'browser'
},
babel: {
presets: ['vue', ['@babel/preset-env', { useBuiltIns: 'usage', corejs: 3 }]],
plugins: ['@babel/plugin-transform-runtime'],
babelHelpers: 'runtime',
configFile: false
},
'node-resolve': true
},
resolvePlugins: {
string: require('rollup-plugin-string').string
},
external: 'crypto'
}
}
}
export default config
6 changes: 3 additions & 3 deletions docs/using_with_components.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ directly into a table cell or row.

<script>
import faker from 'https://cdn.skypack.dev/faker'
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'
import TestComponent from '../test-component.mjs'
export default {
Expand Down Expand Up @@ -57,7 +57,7 @@ passing `methods` to `$gridjs.helper()` containing your event handler, just as y

<script>
import faker from 'https://cdn.skypack.dev/faker'
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'
import TestComponent from '../test-component.mjs'
export default {
Expand Down Expand Up @@ -106,7 +106,7 @@ communicate back with the main Vue application unless using a separate global ev
```js
import Emittery from 'https://cdn.skypack.dev/emittery'
import faker from 'https://cdn.skypack.dev/faker'
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

window.emitter = new Emittery()

Expand Down
2 changes: 1 addition & 1 deletion examples/advanced/custom-sort.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'CustomSort',
Expand Down
16 changes: 9 additions & 7 deletions examples/advanced/events.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'Events',
Expand All @@ -20,13 +20,15 @@ export default {
},
mounted() {
this.$nextTick(() => {
this.$refs.myGrid.grid.on('rowClick', (...args) => {
console.log(`row: ${JSON.stringify(args)}`)
})
if (this.$refs.myGrid && this.$refs.myGrid.grid) {
this.$refs.myGrid.grid.on('rowClick', (...args) => {
console.log(`row: ${JSON.stringify(args)}`)
})

this.$refs.myGrid.grid.on('cellClick', (...args) => {
console.log(`cell: ${JSON.stringify(args)}`)
})
this.$refs.myGrid.grid.on('cellClick', (...args) => {
console.log(`cell: ${JSON.stringify(args)}`)
})
}
})
},
template: `
Expand Down
2 changes: 1 addition & 1 deletion examples/advanced/force-render.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'ForceRender',
Expand Down
2 changes: 1 addition & 1 deletion examples/advanced/global-event-bus.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Emittery from 'https://cdn.skypack.dev/emittery'
import faker from 'https://cdn.skypack.dev/faker'
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

window.emitter = new Emittery()

Expand Down
2 changes: 1 addition & 1 deletion examples/advanced/multi-column-sort.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'MultiColumnSort',
Expand Down
2 changes: 1 addition & 1 deletion examples/advanced/nested-header.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import faker from 'https://cdn.skypack.dev/faker'
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'NestedHeader',
Expand Down
2 changes: 1 addition & 1 deletion examples/advanced/stock-market.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import VueChartist from 'https://cdn.skypack.dev/v-chartist'
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'StockMarket',
Expand Down
2 changes: 1 addition & 1 deletion examples/advanced/virtual-dom.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import faker from 'https://cdn.skypack.dev/faker'
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'VirtualDom',
Expand Down
2 changes: 1 addition & 1 deletion examples/advanced/vue-events.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import faker from 'https://cdn.skypack.dev/faker'
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'
import TestComponent from '../test-component.mjs'

export default {
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/auto-update.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'AutoUpdate',
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/fixed-header.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import faker from 'https://cdn.skypack.dev/faker'
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'FixedHeader',
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/from-html-table.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'FromHtmlTable',
Expand Down
9 changes: 2 additions & 7 deletions examples/basic/hello-world.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'HelloWorld',
Expand Down Expand Up @@ -31,12 +31,7 @@ export default {
]
}
},
methods: {
log(text) {
console.log(text)
}
},
template: `
<div><grid :columns="columns" :rows="rows" ref="helloWorld" @ready="log('Hi to you too!')"></grid></div>
<div><grid :columns="columns" :rows="rows" ref="helloWorld"></grid></div>
`
}
2 changes: 1 addition & 1 deletion examples/basic/hidden-columns.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import faker from 'https://cdn.skypack.dev/faker'
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'HiddenColumns',
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/loading-state.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'LoadingState',
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/pagination.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'Pagination',
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/resizable.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'Resizable',
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/search.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'Search',
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/sorting.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'Sorting',
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/wide-table.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import faker from 'https://cdn.skypack.dev/faker'
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'WideTable',
Expand Down
2 changes: 1 addition & 1 deletion examples/customizing/cell-attributes.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import faker from 'https://cdn.skypack.dev/faker'
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'CellAttributes',
Expand Down
2 changes: 1 addition & 1 deletion examples/customizing/cell-formatting.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import faker from 'https://cdn.skypack.dev/faker'
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'CellFormatting',
Expand Down
2 changes: 1 addition & 1 deletion examples/customizing/html-in-cells.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import faker from 'https://cdn.skypack.dev/faker'
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'HtmlInCells',
Expand Down
2 changes: 1 addition & 1 deletion examples/customizing/html-in-header-cells.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import faker from 'https://cdn.skypack.dev/faker'
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'HtmlInCells',
Expand Down
2 changes: 1 addition & 1 deletion examples/customizing/row-buttons.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import faker from 'https://cdn.skypack.dev/faker'
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'RowButtons',
Expand Down
2 changes: 1 addition & 1 deletion examples/customizing/vue-component-in-cells.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import faker from 'https://cdn.skypack.dev/faker'
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'
import TestComponent from '../test-component.mjs'

export default {
Expand Down
2 changes: 1 addition & 1 deletion examples/data-source/async-data-import.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'AsyncDataImport',
Expand Down
2 changes: 1 addition & 1 deletion examples/data-source/dynamic-data-import.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'DynamicDataImport',
Expand Down
2 changes: 1 addition & 1 deletion examples/data-source/from-html-table.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'FromHtmlTable',
Expand Down
2 changes: 1 addition & 1 deletion examples/data-source/import-server-side-data.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'ImportServerSideData',
Expand Down
2 changes: 1 addition & 1 deletion examples/data-source/json.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'Json',
Expand Down
2 changes: 1 addition & 1 deletion examples/data-source/xml.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'Json',
Expand Down
2 changes: 1 addition & 1 deletion examples/server-side/custom-http-client.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'CustomHttpClient',
Expand Down
2 changes: 1 addition & 1 deletion examples/server-side/import-server-side-data.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'ImportServerSideData',
Expand Down
2 changes: 1 addition & 1 deletion examples/server-side/server-side-pagination.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'ServerSidePagination',
Expand Down
2 changes: 1 addition & 1 deletion examples/server-side/server-side-search.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'ServerSideSearch',
Expand Down
2 changes: 1 addition & 1 deletion examples/server-side/server-side-sorting.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid } from '../../dist/index.esm.js'
import { Grid } from '../../dist/main.esm.js'

export default {
name: 'ServerSideSorting',
Expand Down
7 changes: 7 additions & 0 deletions examples/styling.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,12 @@ <h2>CSS-in-JS</h2>
`
})
</script>

<style>
.gridjs-td.my-custom-td-class {
background-color: blue !important;
color: white !important;
}
</style>
</body>
</html>
Loading

0 comments on commit 83f2c49

Please sign in to comment.