Skip to content
Draft
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
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI

on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

jobs:
test:
name: Build & Test
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: web-component/package-lock.json

- name: Install dependencies
working-directory: web-component
run: npm ci

- name: Type-check
working-directory: web-component
run: npm run typecheck

- name: Run tests
working-directory: web-component
run: npm test

- name: Build
working-directory: web-component
run: npm run build

- name: Verify dist contains expected files
working-directory: web-component
run: |
test -f dist/dragtable.js || (echo "Missing dist/dragtable.js" && exit 1)
test -f dist/dragtable.umd.js || (echo "Missing dist/dragtable.umd.js" && exit 1)
test -f dist/dragtable.d.ts || (echo "Missing dist/dragtable.d.ts" && exit 1)
echo "✓ All expected dist files present"
43 changes: 43 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Publish to npm

on:
release:
types: [published]

jobs:
publish:
name: Publish package
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write # needed for npm provenance

steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
cache-dependency-path: web-component/package-lock.json

- name: Install dependencies
working-directory: web-component
run: npm ci

- name: Run tests
working-directory: web-component
run: npm test

- name: Build
working-directory: web-component
run: npm run build

- name: Publish
working-directory: web-component
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Dependencies
node_modules/

# Build output
web-component/dist/

# IDE
.idea/
.vscode/
*.swp
*.swo

# OS files
.DS_Store
Thumbs.db

# Logs
*.log
npm-debug.log*

# Test coverage
coverage/

# Temp files
*.tmp
.tmp/
61 changes: 61 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

---

## [4.0.0] – 2026-03-17

This is a complete rewrite of the library as a **native Web Component** with no dependencies.

### Added

- `<drag-table>` custom element — wraps any `<table>` to enable drag-and-drop column reordering
- Full TypeScript source with exported types `DragTableOptions` and `DragTableEventDetail`
- Dual distribution: ES module (`dist/dragtable.js`) and UMD (`dist/dragtable.umd.js`)
- Generated TypeScript declarations (`dist/dragtable.d.ts`)
- Automatic style injection — no external CSS file needed
- HTML attribute API: `data-header`, `handle`, `items`, `boundary`, `placeholder`, `scroll`
- Public `order()` method — get or set the current column order
- Native `CustomEvent` system replacing jQuery custom events:
- `dragtable-start`
- `dragtable-beforechange` (cancelable via `e.preventDefault()`)
- `dragtable-change`
- `dragtable-stop`
- 47 automated tests (Vitest + jsdom)
- Demo page (`web-component/index.html`)
- Migration guide (`MIGRATION.md`)
- GitHub Actions CI workflow (build, typecheck, test on every push/PR)
- GitHub Actions publish workflow (triggered on GitHub Release)

### Changed

- No jQuery or jQuery UI dependency required
- `<drag-table>` replaces `$('#table').dragtable()` — see [MIGRATION.md](MIGRATION.md) for details
- Events renamed with a hyphen separator (`dragtablechange` → `dragtable-change`)
- `dragtablebeforeChange` returns `false` to cancel → `e.preventDefault()` on `dragtable-beforechange`
- `appendTarget` option removed — drag display is always appended to the table's parent

### Removed

- jQuery UI widget API (`$.widget`, `_create`, `_destroy`, etc.)
- Dependency on jQuery and jQuery UI
- Legacy CSS file requirement (`dragtable-default.css`)

---

## [3.0.0] – 2010-12-02

Initial release of the jQuery UI widget.

- jQuery UI widget (`$.widget("jb.dragtable", ...)`)
- Options: `dataHeader`, `handle`, `items`, `boundary`, `placeholder`, `appendTarget`, `scroll`
- Events: `dragtablestart`, `dragtablebeforeChange`, `dragtablechange`, `dragtablestop`
- `order()` get/set API
- IE 8+ support

[4.0.0]: https://github.com/jebaird/dragtable/releases/tag/v4.0.0
[3.0.0]: https://github.com/jebaird/dragtable/releases/tag/v3.0.0
Loading