seatable-html-page-sdk
v0.0.9
Published
JavaScript SDK for embedding HTML pages within SeaTable Universal Apps.
Readme
Introduction
SeaTable HTML Page SDK is a JavaScript library designed for embedding HTML pages within SeaTable Universal Apps. It provides commonly used interfaces for data interaction and event subscription.
Installation
Package manager
Install with npm or yarn:
# npm
npm install seatable-html-page-sdk --save
# yarn
yarn add seatable-html-page-sdkCDN
Using unpkg CDN:
<script src="https://unpkg.com/seatable-html-page-sdk@latest/dist/index.min.js"></script>
<script>
const sdk = new HTMLPageSDK();
</script>Usage
Initialization options
Development mode (mock)
For local development:
const sdk = new HTMLPageSDK({
server: "your-html-page-server",
accountToken: "your-account-token",
appUuid: "your-app-uuid",
pageId: "your-app-page-id", // create an html page in universal app first
});
await sdk.init();Production mode (iframe)
When running inside a SeaTable Universal App:
const sdk = new HTMLPageSDK();
await sdk.init();Basic usage
import { HTMLPageSDK } from "seatable-html-page-sdk";
// Initialize SDK
const sdk = new HTMLPageSDK(options);
await sdk.init();
// list rows
const rows = await sdk.listRows({
tableName: "TableName",
start: 0,
limit: 100,
});
// Add a new row
await sdk.addRow({
tableName: "TableName",
rowData: { Name: "John", Age: 30 },
});Testing
Run tests
npm testTest coverage
npm run test-covDevelopment
Build
npm run buildLint
# Check code style
npm run eslint
# Auto-fix issues
npm run eslint-fix