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

@fishbelly/form-morph-element-plus

v0.3.0

Published

form-morph 官方 Element Plus 字段包,提供 28 种表单字段与布局容器

Readme

@fishbelly/form-morph-element-plus

form-morph 的官方 Element Plus 字段包,提供与 Arco 包一致的 28 种表单字段与布局容器。

安装

yarn add @fishbelly/form-morph @fishbelly/form-morph-element-plus element-plus

字段包与引擎按同一版本线发布,安装时请保持 @fishbelly/form-morph 与本包版本一致(当前 0.3.x);引擎注册插件时会校验插件 API 版本,不兼容将直接报错并提示升级。

宿主需要自行引入 Element Plus 组件与样式:

import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import { createElementPlusPack } from '@fishbelly/form-morph-element-plus';
import '@fishbelly/form-morph/style.css';
import '@fishbelly/form-morph-element-plus/style.css';
import { createFormMorph } from '@fishbelly/form-morph';

app.use(ElementPlus);
const morph = createFormMorph({ plugins: [createElementPlusPack()] });

按需引入 Element Plus 样式时,步骤条需要同时引入容器与子组件样式:

import 'element-plus/es/components/steps/style/css';
import 'element-plus/es/components/step/style/css';

主题

字段包不注入自身主题:表单内 Element Plus 组件跟随宿主的 --el-color-primary 系列全局变量(建议定义在 :root)。下拉、日期面板等弹层挂载在 body 上,同样受全局变量控制。

字段

  • 基础:单行文本、多行文本、密码、数字
  • 选择:下拉、多选下拉、单选、复选、开关、滑动条、评分
  • 日期时间:日期、日期范围、时间
  • 高级:文件上传、级联选择、树选择、颜色选择、静态文本、公式字段
  • 容器:卡片、分组区块、分割线、子表单、标签页、折叠面板、步骤

值契约

  • 日期为毫秒时间戳;日期范围为 [开始, 结束] 时间戳数组。
  • 上传值为文件对象数组:已上传文件保留接口返回数据(如 id、fileUrl),待上传文件保留 file(File 实例),提交流程由引擎统一处理待上传文件。
  • 下拉、级联、树选择共用 supportsOptions 数据源。

autoUpload 开启且配置了 action 时由 Element Plus 直接上传;拖拽加入的文件在未自动上传时会作为待上传文件保存在表单值中。

说明

  • 上传控件支持 accept、maxSize、limit、multiple 与设计器属性配置。
  • 与 Arco 包相同,字段外壳提供必填标记、错误提示和标签宽度同步。
  • 表单外壳默认将引擎语言映射到 Element Plus 语言包(内置 zh-CN / en-US),日期面板、空数据等组件内置文案随引擎语言切换;可用 syncLibraryLocale: false 交回宿主管理。
  • 多选批量设置、框选拖动等设计器能力由 @fishbelly/form-morph 提供,与字段包无关。

国际化

  • 引擎默认语言为 zh-CN;createFormMorph({ locale: 'en-US' }) 或运行时 morph.setLocale('en-US') 可切换,字段名称、分类、属性面板与校验提示同步切换;切回 zh-CN 后完整恢复。
  • 英文资源从子路径按需导入,不会进入本包主产物:
import { createFormMorph } from '@fishbelly/form-morph';
import enUS from '@fishbelly/form-morph/locales/en-US';
import designerEnUS from '@fishbelly/form-morph/designer/locales/en-US';
import elementEnUS from '@fishbelly/form-morph-element-plus/locales/en-US';

const morph = createFormMorph({
  locale: 'en-US',
  messages: { 'en-US': { ...enUS, ...designerEnUS } },
  plugins: [createElementPlusPack({ locales: { 'en-US': elementEnUS } })]
});
  • Element Plus 组件内置文案(日期面板、空数据等)默认跟随引擎语言,zh-CN / en-US 已内置映射;追加其他语言用 uiLocales: { 'zh-TW': elementZhTW },需要交给宿主管理时传 syncLibraryLocale: false,由宿主自行用 ElConfigProvider 包裹。
  • 宿主可传 translate(key, defaultMessage, context) 接管翻译,返回 undefined 时回退内置资源;ValidationRule.message 与 messageProvider 优先级更高。
  • Schema 中的用户文案(label、placeholder、静态选项)不会自动翻译;设计器新建字段时按当前语言写入。