npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@xyz-element-plus/form

v0.1.0

Published

Schema-driven intelligent forms for Vue 3 and Element Plus

Readme

@xyz-element-plus/form

基于 Vue 3 和 Element Plus 的 Schema 驱动智能表单。它根据字段类型自动选择控件、生成基础校验规则并完成响应式排版,同时允许显式配置覆盖全部约定。

安装

npm install @xyz-element-plus/form element-plus vue
import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import XyzElementPlusForm from '@xyz-element-plus/form'
import 'element-plus/dist/index.css'
import '@xyz-element-plus/form/style.css'

createApp(App).use(ElementPlus).use(XyzElementPlusForm).mount('#app')

使用

<script setup lang="ts">
import { ref } from 'vue'
import type { FormField, SubmitContext } from '@xyz-element-plus/form'

const form = ref({ name: '', age: 18, enabled: true })
const fields: FormField[] = [
  { name: 'name', label: '姓名', type: 'string', required: true },
  { name: 'age', label: '年龄', type: 'integer' },
  { name: 'enabled', label: '启用', type: 'boolean' },
  { name: 'description', label: '说明', format: 'textarea' },
]

async function save({ value, setErrors }: SubmitContext) {
  // 在应用层调用 API;服务端字段错误可通过 setErrors 回填。
  console.log(value, setErrors)
}
</script>

<template>
  <XyzForm v-model="form" :items="fields" :submit="save" />
</template>

默认推断

| 字段特征 | 默认控件 | | --- | --- | | boolean | Switch | | integer / number / decimal | Input Number | | date / datetime / time | 对应日期或时间控件 | | 少量 choices | Radio | | 较多或多选 choices | Select | | format: 'textarea' 或长文本 | Textarea | | readonly / read_only | 只读显示 |

显式的 widget、rules、span 和 widgetProps 优先于默认推断。#field-字段名 插槽可以完全接管单个字段的渲染。

项目边界

本项目只负责 Schema、表单渲染、校验和布局,不负责 HTTP 请求、鉴权或特定后端错误协议。

本地开发

npm install
npm run dev
npm test