
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
complex-data
Advanced tools
complex-data 是一个高度可组合、可扩展、由数据驱动的 UI 逻辑层框架。它旨在将复杂前端页面(尤其是表单、列表和数据表格)的状逻辑、数据流和交互行为,从具体的 UI 框架中解耦出来,通过一份结构化的数据(我们称之为“字典”)来进行定义和管理。
localStorage 的缓存支持,能够轻松实现远程搜索、数据持久化等功能。GridParse 栅格解析器,可以方便地定义组件的布局。createCustomEdit),可以无缝集成任何非标准组件,并让其享受到框架的数据管理和响应式能力。npm install complex-data
以下是一个定义简单登录表单的例子:
import { ComplexData } from 'complex-data';
// 1. 定义表单字典
const loginDictionary = [
{
prop: 'username',
name: '用户名',
type: 'input',
required: true
},
{
prop: 'password',
name: '密码',
type: 'input',
option: {
password: true
},
required: true
},
{
prop: 'loginBtn',
name: '登录',
type: 'button',
option: {
type: 'primary',
onClick: (payload) => {
// payload.form 是表单实例
payload.form.validate().then(data => {
console.log('表单数据:', data);
// 在这里提交数据...
});
}
}
}
];
// 2. 创建 ComplexData 实例
const loginForm = new ComplexData({
dictionary: loginDictionary
});
// 3. 在你的 UI 框架中渲染
// - 遍历 loginForm.getPageList() 获取渲染列表
// - 将每个组件的属性 (item.name, item.prop, item.$option 等) 传递给你的 UI 组件
// - 通过 item.setValue(newValue) 更新数据
// - 通过 item.getValue() 获取数据
// - 监听 item.$on('change', ...) 来响应数据变化
src/data/: 定义了项目的核心数据模型基类,如 Data, SimpleData, ComplexData。src/module/: 封装了可复用的功能模块,如 SearchData, PaginationData, StatusData 等。src/core/: 包含核心的业务逻辑,如 ComplexInfo (单条数据) 和 ComplexList (数据列表)。src/lib/: 提供了一系列工具类和值对象,如 FormValue, SelectValue, GridParse 等。src/dictionary/: 包含了所有内置组件的定义,是整个字典系统的核心实现。complex-utils: 提供核心的工具函数和基类。欢迎提交问题 (issues) 和合并请求 (pull requests)。
FAQs
a complex data
The npm package complex-data receives a total of 702 weekly downloads. As such, complex-data popularity was classified as not popular.
We found that complex-data demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.