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

@94ai-plus/common-ui

v1.0.0

Published

Vue 3 component framework for common-ui-plus

Readme

@94ai-plus/common-ui

拥抱最新技术生态,面向 AI,九四智能下一代公共组件库。

@94ai-plus/common-ui 是组件库的 Vue 3 总入口,统一提供组件注册、消息/通知/确认服务、全局配置、国际化、主题切换及 TypeScript 类型。覆盖基础交互、规则与条件、业务选择器、表单与表格、音频及软电话等场景。仅支持 Vue 3 与 Element Plus,不包含 Vue 2 / Element UI 兼容层。

HomePage

官网 · 快速上手 · 全局配置 · 演练场 · 项目仓库

组件与能力

| 分类 | 导出组件/服务 | | --- | --- | | 全局配置 | NfConfigProvider | | 基础交互与展示 | NfButton、NfEmpty、NfImportTemplate、NfRadioGroup、NfAlert、NfTag、NfDrawer | | 消息与确认 | NfMessage / Message、NfNotification / Notification、NfConfirm / Confirm | | 布局与辅助交互 | NfResizablePanels、NfIndicatorPlane、NfTextOverflow、NfAction、NfInfiniteMenu | | 规则与条件 | NfRules、NfConditions、NfKeywords | | 业务选择器 | NfVariableSelect、NfTransferSelect、NfVirtualSelect、NfLazySelect、NfPopupLazySelect | | 日期与周期 | NfDatePicker、NfHalfYearPicker、NfHalfYearRangePicker、NfWeekRangePicker | | 表单与表格 | NfFormItem、NfForm、NfSearchForm、NfTable | | 音频与软电话 | NfAudio、NfSoftphone、nfSoftphone、nfSoftphoneManager |

各组件的 props、事件、插槽和实例方法见组件文档。文档示例支持编辑与实时预览,也可跳转演练场;演练场支持从 npm 获取并切换 CommonUI 版本,与本地源码模式区分。

Installation

yarn add @94ai-plus/common-ui @94ai-plus/nf-theme-chalk vue element-plus

业务项目的 peer dependency 范围为 Vue ^3.5.44、Element Plus ^2.14.7。组件库开发基线为 Vue 3.5.44、Element Plus 2.14.7;Node.js 徽章表示本仓库开发环境,不是业务项目的浏览器要求。

Element Plus 和主题样式需由业务项目显式安装、引入;CommonUI 不会自动安装 Element Plus 插件。OEM 项目将主题包替换为 @94ai-plus/nf-theme-oem。

Usage

import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import { createCommonUI, zhCn } from '@94ai-plus/common-ui'
import 'element-plus/dist/index.css'
import '@94ai-plus/nf-theme-chalk/index.css'
import App from './App.vue'

const app = createApp(App)
app.use(ElementPlus)
app.use(createCommonUI({ locale: zhCn, theme: 'chalk' }))
app.mount('#app')

使用默认配置可直接 import CommonUI from '@94ai-plus/common-ui' 后 app.use(CommonUI);也可使用 app.use(CommonUI, { locale: zhCn, theme: 'chalk' }) 传入配置。

全局配置

<script setup lang="ts">
import { ref } from 'vue'
import { NfConfigProvider, NfButton, NfHalfYearPicker } from '@94ai-plus/common-ui'

const halfYear = ref<Date | null>(null)
</script>

<template>
  <NfConfigProvider
    locale="zh-CN"
    theme="chalk"
    :nf-button="{ size: 'medium', type: 'primary' }"
    :nf-date-picker="{ clearable: true, disabled: false }"
  >
    <NfButton>继承默认配置</NfButton>
    <NfButton :disabled="false" type="success">局部覆盖</NfButton>
    <NfHalfYearPicker v-model="halfYear" />
  </NfConfigProvider>
</template>

NfConfigProvider 透传 Element Plus ElConfigProvider 配置,并增加 theme、elementPlusLocale 和各 Nf 组件默认属性。

NfConfigProvider 由 @94ai-plus/common-ui 导出,覆盖所有组件的默认属性,支持响应式更新与嵌套继承。优先级为组件显式属性 → 最近一层 Provider → 外层 Provider → 组件原有默认值。undefined 继续继承,false、0 和空字符串保留;按属性合并,数组、对象和函数整体替换,不深度合并。初始化选项仍按组件原有生命周期生效。

消息、通知、确认框在 Provider 后代组件的 setup 中使用 useMessage()、useNotification()、useConfirm() 继承当前配置;无上下文的直接服务调用及软电话管理类实例不读取组件树配置。半年、半年区间和周区间选择器先读取各自配置,再回退到 nfDatePicker。事件、插槽和必填业务数据在组件上设置。完整配置项和逐组件可编辑示例见全局配置。

| 配置范围 | Provider 配置项 | | --- | --- | | 基础交互 | nfButton、nfEmpty、nfImportTemplate、nfRadioGroup、nfAlert、nfTag | | 反馈与浮层 | nfDrawer、nfMessage、nfNotification、nfConfirm | | 布局与展示 | nfResizablePanels、nfIndicatorPlane、nfTextOverflow、nfAction、nfInfiniteMenu、nfAudio | | 表单与表格 | nfFormItem、nfForm、nfSearchForm、nfTable | | 规则与选择 | nfRules、nfConditions、nfKeywords、nfVariableSelect、nfTransferSelect、nfVirtualSelect、nfLazySelect、nfPopupLazySelect | | 日期与周期 | nfDatePicker、nfHalfYearPicker、nfHalfYearRangePicker、nfWeekRangePicker | | 网页电话条 | nfSoftphone |

模板可使用 kebab-case(例如 :nf-table="{ stripe: true }"),TypeScript 可用总包导出的 NfComponentConfig 约束配置对象。顶层 size、button 等透传给 Element Plus;NfButton 沿用 mini / small / medium 尺寸,通过 nfButton.size 设置。Chalk/OEM 主题将默认单行控件统一为 28px,small 为 24px、large 为 40px,多选标签与多行内容可自然撑高。

国际化与组件主题

内置中文(zh-CN)、英文(en-US)、日语(ja)、西语(es)、印尼语(id)、泰语(th)、他加禄语(tl)和葡萄牙语(pt)。总包同时导出 zhCn、enUs、ja、es、id、th、tl、pt 语言包及 createLocale、useLocale 等国际化接口。

需要动态切换时,可在应用初始化时使用共享语言上下文:

import { createCommonUI, createLocale, zhCn } from '@94ai-plus/common-ui'

const locale = createLocale(zhCn)
app.use(createCommonUI({ locale, theme: 'chalk' }))

// 在用户切换语言时调用
locale.setLocale('en-US')

显式设置 CommonUI 的语言后,插件会同步选择对应的 Element Plus 语言包;elementPlusLocale 可单独覆盖 Element Plus 语言。业务传入的正文、插槽及自定义文案不会自动翻译。

组件主题支持 Chalk(主色 #1177ff)与 OEM(主色 #007555)。OEM 引入 @94ai-plus/nf-theme-oem/index.css,并配置 theme: 'oem';运行时通过 NfConfigProvider 的 theme 或总包的 applyTheme() 切换。需要动态切换两主题时,先加载两份主题 CSS。主题通过页面根节点的 data-nf-theme 生效,不是 provider 子树独立作用域;它与文档/演练场的白黑外观是两种独立配置。

具名导入与类型提示

<script setup lang="ts">
import { NfButton, NfEmpty } from '@94ai-plus/common-ui'
import 'element-plus/dist/index.css'
import '@94ai-plus/nf-theme-chalk/index.css'
</script>

<template>
  <NfEmpty type="data">
    <NfButton type="primary">重新加载</NfButton>
  </NfEmpty>
</template>

总包导出组件 props、事件参数、实例及服务等公共类型,并提供 @94ai-plus/common-ui/global 全局组件类型入口。需要自动导入时,使用 @94ai-plus/common-ui-resolver 配合 unplugin-vue-components;解析器会引用对应独立组件包和主题样式,不负责安装依赖,Element Plus 的自动导入需另行配置。

消息、通知与确认服务

import { Message, Notification } from '@94ai-plus/common-ui'

Message.success('保存成功')
Notification({ title: '提示', message: '数据已更新' })

可调用服务为 Message、Notification、Confirm,NfMessage、NfNotification、NfConfirm 是组件插件。安装总包后,Options API 可使用 this.$openMessage、this.$openNotify、this.$openConfirm;setup 内使用 useMessage()、useNotification()、useConfirm() 继承当前 provider 的注入/语言并在卸载时清理。多应用场景可通过 createMessage(appContext)、createNotification(appContext)、createConfirm(appContext) 创建应用专属服务。

软电话接入

总包统一导出三种接入方式,均通过 qiankun 或 wujie 加载九四公共网页软电话微应用,不在本地重写 SIP 电话:

  • NfSoftphone:适合 Vue SFC,支持 loading / error 插槽及组件卸载清理。
  • nfSoftphone:默认单例,适合只需要一条电话条的场景。
  • nfSoftphoneManager:管理类,通过 new nfSoftphoneManager() 创建多实例,使用不同 name 隔离微应用。

异步获取签名时,使用 :auto-start="false",在 onMounted(async () => …) 中取得签名、更新 props,等待 nextTick() 后手动调用组件的 initSoftphone()。ready 表示微应用已挂载;组件 ref 的 initSoftphone() 还会等待电话条可见内容渲染。管理类在 await phone.ready 后使用 waitForSoftphoneRender() 等待实际渲染。nfSoftphone Provider 配置只作用于 Vue 组件,单例与管理类需要显式传入初始化 options;远程语言通过 nfSoftphone.lang 设置,不由顶层 locale 自动转换。

同时导出 createSoftphoneSign(优先 Web Crypto,不支持时按需加载远程 CryptoJS)、installSoftphoneCryptoJS(显式挂载 window.CryptoJS)和 SOFTPHONE_CRYPTO_JS_CDN_URL。生产环境签名应由服务端生成,不把 appSecret 放入前端。完整示例与动作/通知协议见软电话文档。

搜索表单、表格与持久化

NfSearchForm 提供配置式字段、联动加载、查询/导出/重置、校验与字段设置;NfTable 提供分页、选择、树形数据、嵌套表头、操作栏、列设置与虚拟滚动。

搜索字段设置、表格列顺序/显隐/固定状态及拖拽列宽使用 IndexedDB,按 storageKey 隔离;同页不同实例应设置不同 key。表单与表格使用独立对象仓库,共享异步访问队列,支持恢复、保存和清除的顺序与竞态保护。IndexedDB 不可用或读写失败时继续使用当前组件状态,不回退写入 localStorage,也不自动迁移旧 localStorage 数据。

虚拟表格要求固定行高及稳定的 row-key;树展开、跨行合并或可变行高使用普通表格模式。完整用法见搜索表单与表格。

AI 辅助接入与版本文档

先确认业务项目安装的 @94ai-plus/common-ui 版本,再查询该版本的属性、事件、插槽、实例方法与完整示例。文档提供 For Agents、LLMs.txt、单组件 LLMs.md、设计规范和组件描述 JSON。

@94ai-plus/cli 是独立 Node 工具,不属于组件运行时依赖。可查询 API 或安装 common-ui Skill:

npx --package @94ai-plus/cli common-ui info NfTable --lang zh-CN
npx --package @94ai-plus/cli common-ui skills install

CLI/MCP 优先使用匹配的随包知识与已验证缓存,缺失时下载精确版本;--offline 禁止联网,找不到匹配资料时明确报错,不擅自用其他版本代替。Skill 指导 Agent 按版本查询与开发;MCP 提供九个只读知识工具和两个提示词,接入方式见 CLI/MCP。

文档顶部版本菜单切换独立构建的历史站点,保留语言和可用页面。主站历史路径为 /common-ui-plus/versions/<版本号>/,OEM 为 /common-ui-plus-oem/versions/<版本号>/;具体可用版本见在线版本目录。

Build outputs

| 产物 | 包内路径 | | --- | --- | | ESM | dist/es/index.mjs | | CommonJS | dist/cjs/index.cjs | | 浏览器 ES Module | dist/browser/index.js | | 浏览器 UMD | dist/browser/index.umd.js | | TypeScript 声明 | dist/types/index.d.ts | | 包样式 | dist/style/index.css,支持 @94ai-plus/common-ui/style.css 入口 |

ESM / CJS 外置 Vue、Element Plus 和同 scope 依赖;浏览器产物打包同 scope 依赖,外置 Vue / Element Plus,UMD 使用全局 Vue、ElementPlus。主题包 CSS 和 Element Plus 基础样式仍需由使用方引入。

Contributors

感谢每一位参与项目建设的贡献者!

最近三个月的贡献者气泡图

最近三个月的贡献者头像墙(使用姓名首字母)

以上为随本版本发布的贡献者统计快照,统计日期与分支见图中说明;仅统计 Git 非合并提交,头像使用姓名首字母,不是 GitLab 个人照片。

License

本项目采用 MIT License 开源许可。

Copyright (c) 2026-present Jiahe Zou, 94 Intelligent Technology Co., Ltd.