@boldbv/table-loader
v1.0.17
Published
A package to dynamically load tables based on an API
Downloads
160
Readme
📦 @boldbv/table-loader
@boldbv/table-loader is a lightweight JavaScript utility that dynamically loads a styled, responsive table from an API endpoint. It is designed to be easily embedded in platforms such as WordPress or static sites.
Features
- ✅ Dynamic table loading via API
- 📥 Download button with record count
- 📱 Responsive, mobile-friendly layout
- 📊 Clean styling with overlay and label
🔧 How to Use
# Using npm
npm install @boldbv/table-loaderExample
import { loadTable } from '@boldbv/table-loader';
import '@boldbv/table-loader/dist/styles.css';
loadTable(
'container-id', // HTML container ID
'https://api.url/data', // API endpoint URL
'https://csv.download', // Button download URL
'your-api-key', // API key
6, // Optional: number of rows (default: 6)
'My File.csv' // Optional: label text (default: page title or fallback)
);HTML example include:
<div id="container-id">Loading...</div>const containerId = 'table-container';
const apiEndpointUrl = 'https://api.boldata.com/data?param=example';
const buttonUrl = 'https://boldata.com/export?param=example';
const apiKey = 'your-api-key';
const maxRows = 6; // Optional (default = 6)
loadTable(containerId, apiEndpointUrl, buttonUrl, apiKey, maxRows);Package Code Adjustments
1. Make your code changes
- Source files live in the
src/directory:src/index.js– Main logic for rendering tablessrc/styles.css– Default styling for the table and overlay
- Edit these files as needed (e.g., to alter dummy columns, row-limits, styling).
- Build the distributable version:
npm run buildCommit your changes
git add .
git commit -m "MESSAGE"2. Bump the version
Push a new release:
npm version patch # e.g., 1.0.0 → 1.0.1 for bug fixes
npm version minor # e.g., 1.0.0 → 1.1.0 for new features
npm version major # e.g., 1.0.0 → 2.0.0 for breaking changes3. Push to GitHub
After updating the version:
git push origin main --tags4. Publish to npm
Now, publish the updated version:
npm publish --access public5. Update in consuming projects
Projects that depend on @boldbv/table-loader can now pull the new version:
npm update @boldbv/table-loaderRebuild frontend bundle
npm run build