1.0.11 • Published 2 years ago

svelte-resizable-columns v1.0.11

Weekly downloads
3
License
MIT
Repository
github
Last release
2 years ago

svelte-resizable-columns

Svelte JS action for resizing HTML table columns

Based on jquery-resizable-columns

Demo gif

Simple Usage

<script>
  import { ResizableColumns } from 'svelte-resizable-columns';
</script>


<style>
  table {
	width: 600px;
  	border-collapse: collapse;
  }
</style>

<table use:ResizableColumns>
  <thead>
    <tr>
      <th>#</th>
      <th>First Name</th>
      <th>Last Name</th>
      <th>Username</th>
    </tr>
  </thead>
  <tbody>
    ...
  </tbody>
</table>

Guidelines

  • Table should have fixed width.
  • Bundler needs to support css imports. For example, for Rollup + PostCss you can use rollup-plugin-postcss. See the demo in this repository.
  • Add style no-resize for fixed width columns
  • Events: resize-columns-start, resize-columns-move, resize-columns-stop
  • Custom css styles are added to the table, th elements during resize
<script>    
  const update = (e) => {
	let event = e.type;
	let leftWidth = e.detail.leftWidth;
	let rightWidth = e.detail.rightWidth;
	let leftColumn = e.detail.leftColumn;
	let rightColumn = e.detail.rightColumn;
  }
</script>

<table use:ResizableColumns on:resize-columns-start={update} on:resize-columns-move={update} on:resize-columns-stop={update}>
    ...
</table>
1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago