seatable-html-page-sdk
v0.0.1
Published
JavaScript SDK for embedding HTML pages within SeaTable Universal Apps.
Downloads
96
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
Install with npm or yarn:
# npm
$ npm install seatable-html-page-sdk --save
# yarn
$ yarn add seatable-html-page-sdkUsage
Initialization options
Development mode (mock)
For local development:
const sdk = new HTMLPageSDK({
server: "https://your-seatable-server.com",
accessToken: "your-access-token",
appUuid: "your-app-uuid",
pageId: "your-app-page-id", // create an html page in universal app first
});Production mode (iframe)
When running inside a SeaTable Universal App:
const sdk = new HTMLPageSDK({
targetOrigin: "https://your-seatable-server.com", // Optional, defaults to '*'
timeout: 10000, // Optional, request timeout in ms, defaults to 10000
});Basic usage
import { HTMLPageSDK } from "seatable-html-page-sdk";
// Initialize SDK
const sdk = new HTMLPageSDK(options);
// 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