{"_id":"@bw-ui/datatable-clipboard","_rev":"3-24b3d2181ccdd12b1441b0f8978a4733","name":"@bw-ui/datatable-clipboard","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@bw-ui/datatable-clipboard","version":"1.0.0","keywords":["bw-ui","datatable","plugin","clipboard","copy","paste","excel"],"author":{"name":"Black & White UI Engineering"},"license":"MIT","_id":"@bw-ui/datatable-clipboard@1.0.0","maintainers":[{"name":"rchoudhary.dev","email":"rchoudhary.dev@gmail.com"}],"homepage":"https://bw-ui.dev/bw-datatable","bugs":{"url":"https://github.com/bw-ui/bw-datatable/issues"},"dist":{"shasum":"341f8902efdca7ed3449a20cb274d4b8e5908752","tarball":"https://registry.npmjs.org/@bw-ui/datatable-clipboard/-/datatable-clipboard-1.0.0.tgz","fileCount":4,"integrity":"sha512-4vFEliEaeMu2N5eUdFrNOrbPyKXwFCXXzlCgJkJx/oiN79fIFUWD5MjjzEmc/zN2hyQ1C9+L0OJcYE/ERUSENQ==","signatures":[{"sig":"MEUCICqjBJMM79wgC421N9Vq/fza3Uwh+jPFNSB3yUpWUZ64AiEAhFjlcPsQ1aQ7dhSRGpBdAUF6XwNx5QpfhQnfWOsoRQw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14246},"main":"dist/clipboard.min.js","type":"module","types":"types.d.ts","module":"dist/clipboard.esm.min.js","exports":{".":{"import":"./dist/clipboard.esm.min.js","require":"./dist/clipboard.min.js"}},"scripts":{"dev":"node build.js --watch","build":"node build.js"},"_npmUser":{"name":"rchoudhary.dev","email":"rchoudhary.dev@gmail.com"},"repository":{"url":"git+https://github.com/bw-ui/bw-datatable.git","type":"git","directory":"packages/core"},"_npmVersion":"10.9.3","description":"Copy/Paste plugin for @bw-ui/datatable - Excel compatible","directories":{},"_nodeVersion":"22.20.0","_hasShrinkwrap":false,"devDependencies":{"esbuild":"^0.20.0"},"peerDependencies":{"@bw-ui/datatable":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/datatable-clipboard_1.0.0_1764604995250_0.31156762583066233","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bw-ui/datatable-clipboard","version":"1.0.1","keywords":["bw-ui","datatable","plugin","clipboard","copy","paste","excel"],"author":{"name":"Black & White UI Engineering"},"license":"MIT","_id":"@bw-ui/datatable-clipboard@1.0.1","maintainers":[{"name":"rchoudhary.dev","email":"rchoudhary.dev@gmail.com"}],"homepage":"https://github.com/bw-ui/datatable#readme","bugs":{"url":"https://github.com/bw-ui/datatable/issues"},"dist":{"shasum":"b4e69ba2d5400f8b8a845b7142bebb1805f60439","tarball":"https://registry.npmjs.org/@bw-ui/datatable-clipboard/-/datatable-clipboard-1.0.1.tgz","fileCount":4,"integrity":"sha512-TTLQvxXuGxG6k1pxWhTEGlksg3xsQcqr0s7AyYq2q4n4E7igMFPCSbp1+Tb8MKYq6if3z/Y8A1QJu8t6nnOOFw==","signatures":[{"sig":"MEUCIHwgdrW64OCxDUVK8GLfzIBXllXaWvwk+aSuTU7LPm2sAiEAlhLgeVAUH+w3Rja110/ka8qyFfEn6umVsWaEuroIuPQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11629},"main":"dist/clipboard.min.js","type":"module","types":"src/index.d.ts","module":"dist/clipboard.esm.min.js","exports":{".":{"import":"./dist/clipboard.esm.min.js","require":"./dist/clipboard.min.js"}},"gitHead":"3953ac723b4335e86ba18cd918a31837f2b30d45","scripts":{"dev":"node build.js --watch","build":"node build.js"},"_npmUser":{"name":"rchoudhary.dev","email":"rchoudhary.dev@gmail.com"},"repository":{"url":"git+https://github.com/bw-ui/datatable.git","type":"git","directory":"packages/plugins/clipboard"},"_npmVersion":"10.9.3","description":"Copy/Paste plugin for @bw-ui/datatable - Excel compatible","directories":{},"_nodeVersion":"22.20.0","_hasShrinkwrap":false,"devDependencies":{"esbuild":"^0.20.2"},"peerDependencies":{"@bw-ui/datatable":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/datatable-clipboard_1.0.1_1764683228327_0.16833623781568963","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@bw-ui/datatable-clipboard","version":"1.0.2","description":"Copy/Paste plugin for @bw-ui/datatable - Excel compatible","type":"module","main":"dist/clipboard.min.js","module":"dist/clipboard.esm.min.js","types":"src/index.d.ts","exports":{".":{"import":"./dist/clipboard.esm.min.js","require":"./dist/clipboard.min.js"}},"scripts":{"build":"node build.js","dev":"node build.js --watch"},"keywords":["bw-ui","datatable","plugin","clipboard","copy","paste","excel"],"author":{"name":"Black & White UI Engineering"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/bw-ui/bw-datatable.git"},"bugs":{"url":"https://github.com/bw-ui/bw-datatable/issues"},"homepage":"https://bw-ui.github.io/bw-datatable/","peerDependencies":{"@bw-ui/datatable":"^1.0.0"},"devDependencies":{"esbuild":"^0.20.2"},"_id":"@bw-ui/datatable-clipboard@1.0.2","gitHead":"47f3eb05ee98558e6e685c6c15091cb227830297","_nodeVersion":"22.20.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-7NxOX3ay/fc2kAOyrSYYBv2OtmENSmkuHjj09MEq0egojDwRfBuyM9dgc402Awy8f9RiWEEuXG/kvO+Y8IAGTg==","shasum":"4df52c66e28eaa01cdd7ef8240374fa287224fed","tarball":"https://registry.npmjs.org/@bw-ui/datatable-clipboard/-/datatable-clipboard-1.0.2.tgz","fileCount":4,"unpackedSize":11711,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD7jnFeha8sEduwj/eP65bnTVLC5TRXZ6TGvJYkicR2NQIhAIHSsxF96aFg0yTpcvi8bba+IyXzSGGiRMIIDeQJrWRN"}]},"_npmUser":{"name":"rchoudhary.dev","email":"rchoudhary.dev@gmail.com"},"directories":{},"maintainers":[{"name":"rchoudhary.dev","email":"rchoudhary.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/datatable-clipboard_1.0.2_1764776940799_0.1972801737147294"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-01T16:03:15.137Z","modified":"2025-12-03T15:49:01.180Z","1.0.0":"2025-12-01T16:03:15.406Z","1.0.1":"2025-12-02T13:47:08.513Z","1.0.2":"2025-12-03T15:49:00.973Z"},"bugs":{"url":"https://github.com/bw-ui/bw-datatable/issues"},"author":{"name":"Black & White UI Engineering"},"license":"MIT","homepage":"https://bw-ui.github.io/bw-datatable/","keywords":["bw-ui","datatable","plugin","clipboard","copy","paste","excel"],"repository":{"type":"git","url":"git+https://github.com/bw-ui/bw-datatable.git"},"description":"Copy/Paste plugin for @bw-ui/datatable - Excel compatible","maintainers":[{"name":"rchoudhary.dev","email":"rchoudhary.dev@gmail.com"}],"readme":"# @bw-ui/datatable-clipboard\n\nCopy/Paste plugin for BWDataTable with Excel compatibility.\n\n## Features\n\n- 📋 **Copy to Clipboard** - Tab-separated format (Excel/Sheets compatible)\n- 📥 **Paste from Clipboard** - Parse and add rows from Excel/Sheets\n- ⌨️ **Keyboard Shortcuts** - Ctrl+C, Ctrl+V\n- 🎯 **Smart Paste** - Auto-detect headers, type conversion\n\n## Installation\n\n```bash\nnpm install @bw-ui/datatable-clipboard\n```\n\n## Usage\n\n```javascript\nimport { BWDataTable } from '@bw-ui/datatable';\nimport { ClipboardPlugin } from '@bw-ui/datatable-clipboard';\n\nconst table = new BWDataTable('#table', { data }).use(ClipboardPlugin, {\n  copyHeaders: true, // Include headers when copying (default: true)\n  shortcuts: true, // Enable Ctrl+C/V shortcuts (default: true)\n});\n\n// Copy selected rows\ntable.copy();\n\n// Copy all visible rows\ntable.copyAll();\n\n// Paste from clipboard\ntable.paste();\n```\n\n## Options\n\n| Option        | Type      | Default | Description                    |\n| ------------- | --------- | ------- | ------------------------------ |\n| `copyHeaders` | `boolean` | `true`  | Include column headers in copy |\n| `shortcuts`   | `boolean` | `true`  | Enable keyboard shortcuts      |\n\n## Keyboard Shortcuts\n\n| Shortcut           | Action               |\n| ------------------ | -------------------- |\n| `Ctrl+C` / `Cmd+C` | Copy selected rows   |\n| `Ctrl+V` / `Cmd+V` | Paste from clipboard |\n\n## API\n\n### Methods (added to table)\n\n```javascript\n// Copy selected rows to clipboard\ntable.copy(); // Returns: boolean\ntable.copy(true); // Copy only selected (default)\ntable.copy(false); // Copy all visible rows\n\n// Copy all visible rows\ntable.copyAll(); // Returns: boolean\n\n// Paste from clipboard\ntable.paste(); // Adds rows to table\n```\n\n## Events\n\n```javascript\n// After copy\ntable.on('clipboard:copy', ({ count, text }) => {\n  console.log(`Copied ${count} rows`);\n  // text contains tab-separated data\n});\n\n// After paste\ntable.on('clipboard:paste', ({ rows, count, text }) => {\n  console.log(`Pasted ${count} rows`);\n  // rows contains parsed row objects\n});\n```\n\n## Copy Format\n\nData is copied as tab-separated values (TSV):\n\n```\nName\tEmail\tSalary\nJohn\tjohn@example.com\t50000\nJane\tjane@example.com\t60000\n```\n\nThis format is compatible with:\n\n- Microsoft Excel\n- Google Sheets\n- Apple Numbers\n- LibreOffice Calc\n- Any TSV-compatible application\n\n## Paste Behavior\n\nWhen pasting:\n\n1. **Header Detection** - If first row matches column headers, it's skipped\n2. **Type Conversion** - Numbers and booleans are automatically converted\n3. **ID Generation** - New rows get unique IDs (`pasted_<timestamp>_<index>`)\n4. **Append Mode** - Pasted rows are added to existing data\n\n### Supported Paste Sources\n\n- Excel (Ctrl+C from cells)\n- Google Sheets\n- TSV/CSV text\n- Any tab-separated or newline-separated data\n\n## Example: Copy/Paste Workflow\n\n```javascript\nconst table = new BWDataTable('#table', { data }).use(ClipboardPlugin);\n\n// 1. User selects rows with checkboxes\n// 2. User presses Ctrl+C\n// 3. Data is copied to clipboard\n\ntable.on('clipboard:copy', ({ count }) => {\n  showToast(`Copied ${count} rows`);\n});\n\n// 4. User opens Excel, pastes with Ctrl+V\n// 5. User makes changes in Excel\n// 6. User copies from Excel, comes back to table\n// 7. User presses Ctrl+V\n\ntable.on('clipboard:paste', ({ count }) => {\n  showToast(`Added ${count} rows`);\n  table.scrollToBottom();\n});\n```\n\n## Example: Export Button\n\n```javascript\nconst table = new BWDataTable('#table', { data }).use(ClipboardPlugin);\n\ndocument.getElementById('copyAll').addEventListener('click', () => {\n  table.copyAll();\n});\n\ndocument.getElementById('copySelected').addEventListener('click', () => {\n  const selected = table.getSelected();\n  if (selected.length === 0) {\n    alert('Select some rows first');\n    return;\n  }\n  table.copy();\n});\n```\n\n## TypeScript\n\n```typescript\nimport { BWDataTable } from '@bw-ui/datatable';\nimport {\n  ClipboardPlugin,\n  ClipboardPluginOptions,\n} from '@bw-ui/datatable-clipboard';\n\nconst options: ClipboardPluginOptions = {\n  copyHeaders: true,\n  shortcuts: true,\n};\n\nconst table = new BWDataTable('#table', { data }).use(ClipboardPlugin, options);\n\ntable.on('clipboard:copy', ({ count, text }) => {\n  // Typed event data\n});\n```\n\n## Browser Permissions\n\nThe Clipboard API requires:\n\n- **HTTPS** or localhost\n- **User interaction** (click, keyboard)\n- Browser permission (usually auto-granted)\n\nIf clipboard access fails, check browser console for permission errors.\n\n## License\n\nMIT © [BW UI](https://github.com/AshwinPavanKadha/bw-ui)\n","readmeFilename":"README.md"}