# Common UI Plus (1.0.0)
---
Source commit: f60155079eb2d95a9774ed809fcb39c6fa3a3ade; dirty: false
---
# Installation {#install}
Vue 3 projects use [`@94ai-plus/common-ui`](https://front.94ai.com/common-ui-plus/#/), while Vue 2 projects use [`@94ai/common-ui`](https://front.94ai.com/common-ui/#/).
The @94ai-plus component library is based on vue3.5.44+element-plus@2.14.7.
The @94ai component library is based on vue2.7.16+element-ui@2.15.14.
## Alibaba Cloud private registry authentication {#private-registry}
Use this `.npmrc` template locally or in CI. The company registry uses a username and a Base64-encoded password; an npm public-registry token does not authenticate to the private registry.
```ini
registry=https://registry.npmjs.org/
@94ai:registry=https://packages.aliyun.com/644f755a97d94d909e43534c/npm/npm-registry/
@94ai-plus:registry=https://packages.aliyun.com/644f755a97d94d909e43534c/npm/npm-registry/
//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}
//packages.aliyun.com/644f755a97d94d909e43534c/npm/npm-registry/:username=${NPM_PRIVATE_USERNAME}
//packages.aliyun.com/644f755a97d94d909e43534c/npm/npm-registry/:_password=${NPM_PRIVATE_PASSWORD_BASE64}
//packages.aliyun.com/644f755a97d94d909e43534c/npm/npm-registry/:always-auth=true
```
Ask your administrator for `NPM_PRIVATE_USERNAME` and `NPM_PRIVATE_PASSWORD_BASE64`. The latter is a Base64-encoded password, not plaintext. Omit the public `_authToken` line if you do not need protected npm resources. A valid private-registry token may be used instead if your registry supports it; do not mix token and username/password authentication.
## npm public registry authentication {#public-registry}
To install from or publish to npm, change the registry for the relevant scopes:
```ini
registry=https://registry.npmjs.org/
@94ai:registry=https://registry.npmjs.org/
@94ai-plus:registry=https://registry.npmjs.org/
//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}
```
Obtain NPM_AUTH_TOKEN from the company administrator, or join the company's organization on npm as a Member and manually generate Access Tokens. When generating a token, enable Bypass two-factor authentication (2FA) to satisfy npm's 2FA/token policy.
## Yarn 4 configuration {#yarn-config}
Yarn 4 does not read authentication settings from `.npmrc`; it uses `.yarnrc.yml`. Yarn 4 supports both `npmAuthToken` and `npmAuthIdent` for different authentication methods:
- `npmAuthToken`: token authentication, such as an npm Access Token.
- `npmAuthIdent`: username/password authentication, accepting `username:password` or the Base64 encoding of that complete string.
Example username/password configuration:
```yaml
npmScopes:
94ai-plus:
npmRegistryServer: "https://packages.aliyun.com/644f755a97d94d909e43534c/npm/npm-registry/"
npmAlwaysAuth: true
npmAuthIdent: "${NPM_PRIVATE_AUTH_IDENT}"
```
`NPM_PRIVATE_AUTH_IDENT` is the Base64 encoding of the complete `username:plaintext-password` string, not the `.npmrc` `_password` value. The example above is for manual configuration; this repository automatically derives it in memory from `NPM_PRIVATE_USERNAME` and `NPM_PRIVATE_PASSWORD_BASE64`. No manual identity variable is needed, and the derived value is never logged or written to the repository.
Example token configuration:
```yaml
npmScopes:
94ai-plus:
npmRegistryServer: "https://registry.npmjs.org/"
npmAlwaysAuth: true
npmAuthToken: "${NPM_AUTH_TOKEN}"
```
You can temporarily configure authentication in PowerShell without modifying the version-controlled Yarn configuration:
```powershell
$env:NPM_REGISTRY_URL = 'https://registry.npmjs.org/'
# Inject NPM_AUTH_TOKEN via your environment or CI secrets; never put its value here.
yarn install --immutable
```
Fill these values in root `.env.local` in this repository:
```dotenv
NPM_REGISTRY_URL=https://packages.aliyun.com/644f755a97d94d909e43534c/npm/npm-registry/
NPM_PRIVATE_USERNAME=
NPM_PRIVATE_PASSWORD_BASE64=
```
Plain `yarn install --immutable` automatically loads the file without an extra Node command. Existing shell/CI values take priority. Complete private credentials take precedence for private installation and publication, with no `NPM_AUTH_TOKEN` required; publishing to public npm still needs a token. `.env.local` is Git-ignored. Direct npm commands do not load it automatically. Other projects using the manual Yarn examples must inject their own authentication environment variables.
## Install packages {#install-packages}
```bash
yarn add @94ai-plus/common-ui @94ai-plus/nf-theme-chalk vue@3.5.44 element-plus@2.14.7
```
Or use npm:
```bash
npm install @94ai-plus/common-ui @94ai-plus/nf-theme-chalk vue@3.5.44 element-plus@2.14.7
```
---
# Quick start {#quick-start}
Choose full installation, manual on-demand imports, or automatic on-demand imports. Install the runtime dependencies in your Vue 3 application:
```sh
npm install vue element-plus @94ai-plus/common-ui @94ai-plus/nf-theme-chalk
```
## Full installation {#full-import}
Register Element Plus and CommonUI in `main.ts` and load their complete styles. `App.vue` is your application root component.
```ts
import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import CommonUI, { enUs } from '@94ai-plus/common-ui'
import App from './App.vue'
import 'element-plus/dist/index.css'
import '@94ai-plus/nf-theme-chalk/index.css'
const app = createApp(App)
app.use(ElementPlus)
app.use(CommonUI, { theme: 'chalk', locale: enUs })
app.mount('#app')
```
## Manual on-demand CJS imports {#manual-cjs}
The on-demand examples below use `nf-button`. For standalone integration, install the packages for the components you use:
```sh
npm install vue element-plus @94ai-plus/nf-button @94ai-plus/nf-theme-chalk
```
In a build environment that supports CommonJS, Vue single-file components and CSS loading, import and register individual component packages and load only the CommonUI styles you need. Entry file `main.cjs`:
```js
const { createApp } = require('vue')
const ElementPlus = require('element-plus').default
const NfButton = require('@94ai-plus/nf-button').default
const App = require('./App.vue').default
require('element-plus/dist/index.css')
require('@94ai-plus/nf-theme-chalk/nf-button.css')
const app = createApp(App)
app.use(ElementPlus)
app.use(NfButton)
app.mount('#app')
```
`require()` uses the public CommonJS package entry, with no internal `dist` or legacy `lib` paths. Access the default component export through `.default`. A bundler must process `.vue` and CSS; this is not a standalone Node.js script. CJS does not offer the same static Tree Shaking conditions as ESM, so use individual packages for on-demand imports.
### Webpack 5 configuration (CJS) {#cjs-webpack-config}
For a Vue 3 project with JavaScript SFCs, save the entry above as `src/main.cjs` and the button template in the next section as `src/App.vue`. Install these build dependencies:
```sh
npm install -D webpack@5 webpack-cli@6 vue-loader@17 @vue/compiler-sfc@3.5.44 style-loader css-loader html-webpack-plugin
```
Create `webpack.config.cjs` in the project root. The `.cjs` extension also works when `package.json` declares `"type": "module"`:
```js
const path = require('node:path')
const webpack = require('webpack')
const { VueLoaderPlugin } = require('vue-loader')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
mode: 'production',
entry: './src/main.cjs',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'app.js',
clean: true,
},
resolve: {
extensions: ['.js', '.cjs', '.mjs', '.vue'],
alias: {
'vue$': require.resolve('vue/dist/vue.runtime.esm-bundler.js'),
},
byDependency: {
commonjs: { conditionNames: ['require', 'default'] },
},
},
module: {
rules: [
{ test: /\.vue$/, loader: 'vue-loader' },
{ test: /\.css$/, use: ['style-loader', 'css-loader'] },
],
},
plugins: [
new VueLoaderPlugin(),
new HtmlWebpackPlugin({ template: './public/index.html' }),
new webpack.DefinePlugin({
__VUE_OPTIONS_API__: JSON.stringify(true),
__VUE_PROD_DEVTOOLS__: JSON.stringify(false),
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: JSON.stringify(false),
}),
],
}
```
`vue-loader` and `VueLoaderPlugin` compile `.vue` files. `css-loader` and `style-loader` process and inject CSS. `HtmlWebpackPlugin` injects the bundle into the HTML template below. This example uses JavaScript SFCs; TypeScript SFCs also need an appropriate TypeScript loader.
`resolve.byDependency.commonjs.conditionNames` explicitly selects the `require` condition so `@94ai-plus/nf-button` resolves to its public CJS entry instead of the higher-priority default `browser` entry. The exact Vue alias keeps the entry, SFCs and dependencies on one runtime; `vue-loader` precompiles templates.
Create `public/index.html` with the mount element:
```html
CommonUI Webpack CJS
```
Run this command from the application root. Serve the generated `dist/index.html` over HTTP. In an existing Webpack project, merge the settings while keeping its plugins and application rules.
```sh
npm exec webpack -- --config webpack.config.cjs
```
## Ready-to-use manual ES Module imports {#manual-esm}
Use native `import` with individual component packages, register the required components, and load their theme styles. Entry file `main.ts`:
```ts
import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import NfButton from '@94ai-plus/nf-button'
import App from './App.vue'
import 'element-plus/dist/index.css'
import '@94ai-plus/nf-theme-chalk/nf-button.css'
const app = createApp(App)
app.use(ElementPlus)
app.use(NfButton)
app.mount('#app')
```
Alternatively, replace the component import above with a named import from the full package:
```ts
import { NfButton } from '@94ai-plus/common-ui'
```
ES Modules let bundlers perform Tree Shaking in production; the actual result depends on your build configuration. Import styles explicitly, and omit `app.use(CommonUI)` when using on-demand imports. Both manual approaches can use this `App.vue`:
```vue
Button
```
## Automatic on-demand imports {#auto-import}
Use `unplugin-vue-components` with `@94ai-plus/common-ui-resolver` to import components and theme styles based on template tags. Install the build dependencies:
```sh
npm install -D unplugin-vue-components @94ai-plus/common-ui-resolver
```
### Vite / Webpack configuration {#vite-config}
Merge the following plugin configuration into your `Vite` or `Webpack` config file. For Webpack, keep the existing Vue SFC, TypeScript and CSS loader configuration.
::: code-group
```ts [vite.config.ts]
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import { CommonUIResolver } from '@94ai-plus/common-ui-resolver'
export default defineConfig({
plugins: [
vue(),
Components({
dts: 'components.d.ts',
resolvers: [CommonUIResolver({ theme: 'chalk' }), ElementPlusResolver()],
}),
],
})
```
```js [webpack.config.mjs]
import Components from 'unplugin-vue-components/webpack'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import { CommonUIResolver } from '@94ai-plus/common-ui-resolver'
export default {
plugins: [
Components({
dts: 'components.d.ts',
resolvers: [CommonUIResolver({ theme: 'chalk' }), ElementPlusResolver()],
}),
],
}
```
The entry file only needs to mount the app. Full CommonUI or Element Plus registration is unnecessary; the resolvers generate imports for the `Nf*` and `El*` components used in templates:
```ts
import { createApp } from 'vue'
import App from './App.vue'
createApp(App).mount('#app')
```
```vue
ButtonElement Plus button
```
Resolvers do not install dependencies. Install the corresponding component and theme packages. Include `components.d.ts` in your project’s `tsconfig.json` for template types. Automatic component imports target template tags; services such as `Message`, `Notification` and `Confirm` still require explicit script imports.
`CommonUIResolver()` defaults to Chalk. Set `theme: false` to disable automatic style imports, or use `exclude` to skip matching components. For OEM, set `theme: 'oem'`, install `@94ai-plus/nf-theme-oem`, and set `theme="oem"` on `NfConfigProvider`.
## UMD {#umd}
No build tools are needed. Save a complete example below as an HTML file and serve it over local HTTP. CDN URLs use fixed example versions; update CommonUI and theme package versions together when upgrading.
### Using component UMD builds directly in HTML {#html-umd}
#### Example 1: Full installation {#html-umd-full}
Load Vue, Element Plus and CommonUI UMD scripts in that order, then create the app. The full package exposes `window.CommonUi`; register its `.default` export. Load theme CSS after Element Plus CSS.
```html
CommonUI UMD
Click count: {{ count }}
Click +1Reset
```
#### Example 2: Individual components {#html-umd-component}
For individual components, load their UMD packages and component styles. This example only uses `NfButton`, whose UMD depends only on `Vue`. Load Element Plus first for components that depend on it.
```html
CommonUI UMD component
Click count: {{ count }}
Click +1
```
Use kebab-case component and attribute names in HTML, such as `` and ``. Always include explicit closing tags; SFC self-closing syntax does not work here. These scripts load synchronously in order; do not add `async` and break dependency ordering.
### Using importmap in HTML {#html-importmap}
Use native browser ES Modules and importmap without bundling. Unlike the UMD examples, this loads `dist/browser/index.js` with `import` and does not depend on `window.CommonUi`. Element Plus also uses its browser ESM build, and all modules share the same mapped Vue instance.
```html
CommonUI importmap
Click count: {{ count }}
Click +1Reset
```
Place the importmap before the first module script and use valid JSON. Open the page over HTTP(S) in a modern browser that supports importmap. For browsers without native importmap support, load `es-module-shims` before the importmap. This polyfill does not add support for old browsers unsupported by Vue 3 or Element Plus.
For native browser modules, use `dist/browser/index.js`, not the bundler-oriented `dist/es/index.mjs`, which still contains bare imports of same-scope packages. You can also map `"@94ai-plus/nf-button": "https://cdn.jsdelivr.net/npm/@94ai-plus/nf-button@1.0.0-alpha.4/dist/browser/index.js"`, then `import NfButton from '@94ai-plus/nf-button'` and call `app.use(NfButton)`, using the component CSS instead. Avoid mixing global and ESM Vue builds on the same page, which creates multiple Vue instances.
## Internationalization {#locale}
Built-in languages include Chinese, English, Japanese (ja), Spanish (es), Indonesian (id), Thai (th), Tagalog (tl) and Portuguese (pt). With full installation, replace the earlier `app.use(CommonUI, …)` with a shared locale context for dynamic switching:
```ts
import { createLocale, enUs } from '@94ai-plus/common-locale'
const locale = createLocale(enUs)
app.use(CommonUI, { theme: 'chalk', locale })
locale.setLocale('ja')
```
Built-in locales select the matching Element Plus locale; an explicit `elementPlusLocale` takes precedence. Custom slot content is not translated automatically. With on-demand imports, configure language and theme using [NfConfigProvider](https://front.94ai.com/common-ui-plus/en/components/fixture).
---
# For Agents {#for-agents}
Give AI version-matched APIs, complete Vue examples and design rules.
## General contract {#workflow}
Before writing any code, confirm the component library version installed in the consuming project, then query the props, events, slots, instance methods and complete examples for that version. If matching documentation cannot be found, report an explicit error without inventing APIs. Do not substitute documentation for another version.
## Integration Prompt {#prompt}
Ready-to-use prompts: copy them into your Agent conversation or automation workflow to help any AI coding Agent use Common UI efficiently:
```text
Use Vue 3, Element Plus and @94ai-plus components. Confirm the installed component library version, then retrieve information from these official resources:
Documentation index: https://front.94ai.com/common-ui-plus/llms.txt
Version catalog: https://front.94ai.com/common-ui-plus/versions.json
Design guidelines: https://front.94ai.com/common-ui-plus/design.md
Find the project’s exact version in the version catalog. Read that version’s documentation index, design guidelines, component APIs and complete examples, following design.md for both themes. Clearly report missing matching resources; do not invent APIs or substitute another version.
If you can install skills, run:
npx --package @94ai-plus/cli common-ui skills install
```
## Using Skill — Capabilities and usage {#skill}
The Skill is located at `@94ai-plus/cli/skills/common-ui/SKILL.md`. Install the `common-ui` Skill through Skills CLI and follow the prompts to select AI tools and installation scope. It guides AI to confirm the library version in the consuming project before querying APIs, complete examples and theme guidelines. If the CLI is already installed, use its bundled Skill:
```sh
npx common-ui skills install
```
Use `--agent codex` to select a tool, `--global` for user scope, `--yes` to skip Skills prompts, or `--project ` to choose the project. The default is interactive project installation. `--dry-run` previews without downloading or installing. MCP is not configured.
Installing the Skill does not install `@94ai-plus/cli`, start MCP or change client MCP settings.
## CLI — Offline knowledge and project tools {#cli}
The CLI uses its bundled knowledge snapshot for AI tools with terminal access. List components, inspect APIs and complete examples, or output one component’s Markdown. Install a published `@94ai-plus/cli`; for repository development, run `yarn build:components cli` and replace `common-ui` with `node packages/cli/dist/index.mjs`. For example, `node packages/cli/dist/index.mjs info NfTable --lang en-US` is the equivalent local command.
```sh
common-ui list
common-ui info NfTable --lang en-US
common-ui demo NfTable --lang en-US
common-ui doc NfTable --lang en-US --format markdown
```
The CLI detects the library version installed in the consuming project. Use `--version ` to select explicitly; unavailable data fails without fallback. See [CLI](https://front.94ai.com/common-ui-plus/en/ai/cli).
### Documentation versions and offline queries {#documentation-versions}
The header version menu switches between independently built historical documentation sites while preserving language and page. CLI and MCP prefer matching bundled knowledge or verified cache, then download an exact snapshot if missing. `--offline` disables networking; `--refresh` revalidates online data.
Online version catalog
## MCP — AI tool integration {#mcp}
MCP clients can query the same knowledge over stdio. The following example starts the published `@94ai-plus/cli` through npx; save the configuration as required by your client.
```json
{
"mcpServers": {
"common-ui": {
"command": "npx",
"args": [
"--yes",
"--package",
"@94ai-plus/cli",
"common-ui",
"mcp",
"--lang",
"en-US"
]
}
}
}
```
Use `common_ui_list` for discovery, `common_ui_info` for props, events, slots and types, `common_ui_doc` for one component’s documentation, and `common_ui_demo` for complete examples. Pass the following arguments for a component query. MCP is read-only and does not call model APIs. See [MCP Server](https://front.94ai.com/common-ui-plus/en/ai/mcp).
```json
{"component": "NfTable", "lang": "en-US"}
```
## LLMs.txt — Structured documentation for LLMs {#llms}
Without installing tools, ask AI to read these resources as needed:
- llms.txt — Documentation and component index
- llms-full.txt — Full English documentation
- llms-full-cn.txt — Full Chinese documentation
- design.md — Design rules
- manifest.json — version / commit / digest
Site resources describe their generated source state. Check version, commit and digest in `manifest.json` against the consuming project; arbitrary historical versions are not automatically available.
### Single-component LLMs.md and description JSON {#component-document}
- The `LLMs.md` link at the top of each component page opens raw Markdown in the current language, including its description, API tables and Vue examples. You can also query CLI `doc` / MCP `common_ui_doc`.
You can also open NfTable LLMs.md. Replace `table` in the path with the component ID from the index to read other components as needed, without loading the entire collection. More resources: [LLMs.txt](https://front.94ai.com/common-ui-plus/en/ai/llms).
- A component description JSON file such as table.json contains the package name, exports, source type declarations, API tables in each language and complete examples. AI combines these declarations, documented APIs and examples to determine how to use the component.
---
# design.md {#design-language}
## Design language {#geometry}
Chalk and OEM are component themes. Light/dark appearance is independent. Coordinate language through NfConfigProvider and Element Plus.
| Theme | Primary | Source |
| --- | --- | --- |
| Chalk | #1177ff | nf-theme-chalk/src/_tokens.scss |
| OEM | #007555 | nf-theme-oem/src/_tokens.scss |
The theme --el-component-size variable currently sets default single-line controls to 28px. Components such as NfButton retain their documented size contracts.
Align labels and controls; keep 16px between an example’s result area and component. Compose existing table, search, column settings and drawer components.
Preserve keyboard focus, disabled, error, empty and loading states in overlays. Use public styling hooks rather than internal DOM.
## Element Plus Design Token {#element-plus-tokens}
Tokens come from the locked Element Plus light/dark CSS, preserving names, selectors, raw values and source version, with an upstream SCSS link. `var()` remains unresolved. Common UI Chalk/OEM overrides and additions are listed separately; Nf components are not aliases of similarly named El components.
```sh
common-ui token ElButton --format json
common-ui token NfButton --theme chalk --format json
```
## Tokens {#tokens}
```sh
common-ui theme --theme chalk
common-ui theme --theme oem
```
The command prints the theme variables as JSON in the terminal for developers or AI to query.
It includes:
- Theme variables and their raw values, such as primary colors and sizes.
- The variable source file, _tokens.scss.
- The knowledge version, Git commit and content digest.
This is a query command: it does not generate CSS files or modify the project theme.
With the CLI installed, run:
```txt
npx common-ui theme --theme chalk
```
## Typography {#typography-surfaces}
Inherit Element Plus font variables and preserve each component’s public sizes.
| Style | Configuration |
| --- | --- |
| Typography | `--el-font-family`, `--el-font-size-base`; NfButton mini/small use 12px and medium uses 14px. |
| Radius | `--el-border-radius-base`; NfButton mini uses 2px, the base radius is 4px; `round` and `circle` control rounded and circular buttons. |
| Shadow | `--el-box-shadow-light`; follows the active overlay component. |
## Functional colors, text and background {#surface-colors}
| Theme | Success | Text | Background |
| --- | --- | --- | --- |
| Chalk | #67c23a | #303133 | #ffffff |
| OEM | #31a36b | #252238 | #f8f7fc |
---
## LLMs.txt and component LLMs.md {#llms}
| File | Format and description |
| --- | --- |
| llms.txt | Index of all component documentation |
| llms-full.txt | Complete English library documentation |
| llms-full-cn.txt | Complete Chinese library documentation |
| ai/docs/en-US/table.md | Single-component LLMs.md |
llms.txt provides navigation and indexes all component documentation. The full llms-full.txt collection and per-component LLMs.md files support selective reading.
## manifest.json
| File | Format and description |
| --- | --- |
| ai/manifest.json | Library knowledge manifest and provenance. |
manifest.json is the library knowledge manifest and provenance record. It helps AI confirm which version the information describes and where it was generated, with structured, traceable sources.
It includes:
- version: the component library version; `local` identifies local development knowledge.
- commit: the Git commit used to generate the knowledge.
- digest: a content digest for detecting changes and verifying downloads.
- Component catalog and resource paths: locate each component’s APIs, documentation and examples.
CLI and MCP can use this information to match versions and validate caches.
## Structured component JSON
| File | Format and description |
| --- | --- |
| ai/components/table.json | Component description JSON |
Component JSON contains structured information for selective AI, CLI and MCP queries: the package name, exports, source type declarations, API tables in each language and complete examples.
AI reads it in this order:
```text
Find NfButton in manifest.json
→ Read button.json
→ Retrieve the button APIs and examples
```
An AI querying the button only needs this resource instead of the entire library.

The declarations above are type and interface declarations extracted from component source to help AI verify capabilities.
declarations mainly includes:
- `export interface`: for example, ButtonProps describes props and types.
- `export type`: for example, allowed button types and sizes, and NfButtonComponent in the image.
- `defineProps`, `withDefaults`: prop definitions and defaults.
- `defineEmits`: event declarations.
- `defineExpose`: publicly exposed instance members.
Each record includes:
- path: source file location and line number.
- content: the original source declaration.
This is not a collection of every internal variable or method, nor the complete source. AI combines declarations, documented API tables and examples to determine component usage.
This JSON is generated automatically during the build and is primarily intended for tools.
## design.md
| File | Format and description |
| --- | --- |
| design.md | Common UI visual language |
The library’s design language document helps AI design tools:
1. Generate interface drafts aligned with the Common UI visual system.
2. Help design Agents understand Common UI’s default themes and component usage.
3. Use Common UI’s design language as a constraint for project UI generation.
---
# MCP Server {#mcp}
MCP exposes ten query tools and two prompts over stdio, sharing CLI data. It calls no model API and changes no business project.
## Tools {#tools}
| Tool | Description |
| --- | --- |
| `common_ui_site` | Read the official homepage and snapshot documentation URLs offline |
| `common_ui_list` | List available components and packages |
| `common_ui_info` | Retrieve API tables and source type declarations |
| `common_ui_doc` | Retrieve complete component Markdown documentation |
| `common_ui_demo` | Retrieve Vue examples and supporting modules |
| `common_ui_theme` | Query Chalk / OEM theme variables |
| `common_ui_design` | Retrieve the library’s design guidelines |
| `common_ui_changelog` | Query release notes for a version |
| `common_ui_token` | Query Element Plus Design Tokens and Common UI theme overrides |
| `common_ui_semantic` | Query documented styling props and slots |
## Prompts {#prompts}
| Prompt | Description |
| --- | --- |
| `common-ui-expert` | Position the Agent as a common-ui expert, guiding it to use version-matched APIs, complete examples and design guidelines |
| `common-ui-page-generator` | Help create Vue 3 pages using verified components and design guidelines |
## Configuration {#configuration}
### Using MCP in AI tools {#ai-tools}
These examples use the published `@94ai-plus/cli` and require Node.js 22.13.0 or later and npm/npx. Merge entries into existing files, preserving other MCP servers. In a settings form, enter only the command and args of the common-ui entry.
| Tool | Instructions | Configuration |
| --- | --- | --- |
| **Cursor** | Add to `.cursor/mcp.json` · [Docs](https://cursor.com/docs/mcp) | `{"mcpServers":{"common-ui":{"command":"npx","args":["--yes","--package","@94ai-plus/cli","common-ui","mcp","--lang","en-US"]}}}` |
| **Windsurf** | Open the raw configuration in MCP settings and add a local stdio server · [Docs](https://docs.windsurf.com/windsurf/cascade/mcp) | `{"mcpServers":{"common-ui":{"command":"npx","args":["--yes","--package","@94ai-plus/cli","common-ui","mcp","--lang","en-US"]}}}` |
| **Claude Code** | Add to `.mcp.json` · [Docs](https://code.claude.com/docs/en/mcp) | `{"mcpServers":{"common-ui":{"command":"npx","args":["--yes","--package","@94ai-plus/cli","common-ui","mcp","--lang","en-US"]}}}` |
| **VS Code** | Add to `.vscode/mcp.json`, or run `MCP: Add Server` · [Docs](https://code.visualstudio.com/docs/agents/reference/mcp-configuration) | `{"servers":{"common-ui":{"type":"stdio","command":"npx","args":["--yes","--package","@94ai-plus/cli","common-ui","mcp","--lang","en-US"]}}}` |
| **Codex** | Project `.codex/config.toml` (trusted projects only), or user `~/.codex/config.toml` · [Docs](https://developers.openai.com/codex/mcp/) | `[mcp_servers.common-ui]` `command = "npx"` `args = ["--yes","--package","@94ai-plus/cli","common-ui","mcp","--lang","en-US"]` |
| **Gemini CLI** | Add to `.gemini/settings.json` · [Docs](https://geminicli.com/docs/tools/mcp-server/) | `{"mcpServers":{"common-ui":{"command":"npx","args":["--yes","--package","@94ai-plus/cli","common-ui","mcp","--lang","en-US"]}}}` |
| **Trae** | Manually add a local stdio server in MCP settings · [Docs](https://docs.trae.ai/ide/model-context-protocol) | `{"mcpServers":{"common-ui":{"command":"npx","args":["--yes","--package","@94ai-plus/cli","common-ui","mcp","--lang","en-US"]}}}` |
| **Qoder** | Manually add a local stdio server in MCP settings · [Docs](https://docs.qoder.com/user-guide/chat/model-context-protocol) | `{"mcpServers":{"common-ui":{"command":"npx","args":["--yes","--package","@94ai-plus/cli","common-ui","mcp","--lang","en-US"]}}}` |
| **Neovate Code** | Add to `.neovate/config.json` · [Docs](https://github.com/neovateai/neovate-code/blob/master/examples/mcp/.neovate/config.json) | `{"mcpServers":{"common-ui":{"command":"npx","args":["--yes","--package","@94ai-plus/cli","common-ui","mcp","--lang","en-US"]}}}` |
Codex uses TOML; VS Code uses `servers`; the other JSON examples use `mcpServers`. Configuration entry points can vary by client version; follow the official documentation. If the client working directory differs from your project, append `--project` and its absolute path to args. Add `--version ` to select component knowledge. These are manual integrations; automatic `setup --client` still supports only `claude`, `cursor`, `vscode` and `codex`.
### Start through npx {#npx}
Add the MCP server to your client configuration. The following JSON is suitable for Claude Code and Cursor:
```json
{
"mcpServers": {
"common-ui": {
"command": "npx",
"args": [
"--yes",
"--package",
"@94ai-plus/cli",
"common-ui",
"mcp",
"--lang",
"en-US"
]
}
}
}
```
This configuration starts the published `@94ai-plus/cli` through npx. Save it according to your client’s requirements. The runtime needs Node.js, npm/npx and access to the npm package.
### Using a global CLI {#global-cli}
If the published CLI is installed globally with `npm install -g @94ai-plus/cli`, use `common-ui` as the MCP command.
```json
{"mcpServers":{"common-ui":{"command":"common-ui","args":["mcp","--lang","en-US"]}}}
```
### Select a library version {#component-version}
`--version` selects the component knowledge version; the CLI tool package version is controlled separately by `@` after its npm package name. Replace the example with the project’s actual version. Matching knowledge must exist in the bundled snapshot, cache or online version catalog. If none is found, an explicit error is reported without fallback.
```json
{
"mcpServers": {
"common-ui": {
"command": "npx",
"args": [
"--yes",
"--package",
"@94ai-plus/cli",
"common-ui",
"mcp",
"--version",
"1.0.0-alpha.5",
"--lang",
"en-US"
]
}
}
}
```
### Set up the project {#setup}
Run in the consuming project after installing a published CLI. Supported clients: `claude`, `cursor`, `vscode`, `codex`; modes: `mcp` (default), `skill`, `both`. Skill mode copies the complete bundled Skill and references without downloading Skills CLI.
```sh
npx common-ui setup --client claude --lang en-US
npx common-ui setup --client cursor --mode both --lang en-US
npx common-ui setup --client vscode --write-instructions --lang en-US
npx common-ui setup --client codex --lang en-US
npx common-ui setup --client claude --dry-run --lang en-US
npx common-ui setup --client claude --check --lang en-US
```
You can also run a published CLI temporarily through npx:
```sh
npx --package @94ai-plus/cli common-ui setup --client cursor --mode both --lang en-US
```
| Tool | MCP | Skill | `--write-instructions` |
| --- | --- | --- | --- |
| Claude Code | `.mcp.json`: `mcpServers` | `.claude/skills/common-ui/` | `CLAUDE.md` |
| Cursor | `.cursor/mcp.json`: `mcpServers` | `.cursor/skills/common-ui/` | `.cursor/rules/common-ui.mdc` |
| VS Code | `.vscode/mcp.json`: `servers`, `stdio` | `.github/skills/common-ui/` | `.github/copilot-instructions.md` |
| Codex | `.codex/config.toml`: `[mcp_servers.common-ui]` | `.agents/skills/common-ui/` | `AGENTS.md` |
`--project ` selects the project; `--version ` selects component knowledge; `--lang` selects the language. `--write-instructions` appends a managed instruction block and preserves existing text. MCP configuration pins the current CLI package version and records the absolute project path.
`--dry-run` previews paths, actions and the proposed MCP server; `--check` checks file consistency and exits 1 on missing or different content. Both are read-only and make no network requests. Setup preserves unrelated services, JSON comments and TOML text. Identical files are unchanged; conflicting common-ui entries or Skill files must be reconciled manually. Clients still need to load/approve the server; Codex project settings apply only to trusted projects.
[OpenAI Codex MCP](https://developers.openai.com/codex/mcp/)
`setup` writes only to the selected project and does not change user-level configuration. Skill mode copies the current CLI’s complete bundled Skill and references.
`--write-instructions` appends or updates only the marked Common UI instruction block, preserving existing instructions.
## Alternative: use LLMs.txt {#llms-fallback}
If your AI tool does not support MCP, use our LLMs.txt documentation. We provide:
- llms.txt — Structured index of all component documentation
- llms-full.txt — Complete English library documentation, including full examples
- llms-full-cn.txt — Complete Chinese library documentation, including full examples
---
# CLI {#cli}
`@94ai-plus/cli` is the Common UI command-line tool. The CLI ships its data and supports version, language, JSON and Markdown options.
`site` returns `homepage` (official homepage) and `documentation` (snapshot documentation URL); fixed versions use `versions//`. `--offline` reads matching bundled data or verified cache without visiting the website. Older snapshots without website metadata report `WEBSITE_UNAVAILABLE`; other queries remain available.
## Highlights {#highlights}
- Bundled knowledge: component APIs, declarations, full examples and design rules ship with the CLI. Matching bundled data and verified cache work offline without a model API key.
- Exact versions: confirm the consuming project version, then query its snapshot. Missing data reports an error without substituting another version.
- Agent output: knowledge queries support `--format json` with `provenance` and `result`; documentation can be returned as Markdown.
- Eight languages and two themes: select knowledge with `--lang`; query Chalk/OEM and Element Plus light/dark Design Tokens.
- Project diagnostics: inspect environments, dependencies, component usage, static findings and two explicit knowledge snapshots without executing business modules.
- AI integrations: MCP, Skill installation and project setup are available. Upgrades and issue reports preview by default; writes require explicit execution options.
## Installation {#installation}
Requires Node.js **22.13.0 or later** and npm/npx. Install it globally:
```sh
npm install -g @94ai-plus/cli
```
Alternatively, install it as a project development dependency and run `npx common-ui`:
```sh
npm install -D @94ai-plus/cli
npx common-ui --help
```
Run a published CLI temporarily without installing it first:
```sh
npx --package @94ai-plus/cli common-ui list
```
### Run from local source {#local-development}
In the component-library source repository, build the CLI and replace `common-ui` with `node packages/cli/dist/index.mjs`. For example, `node packages/cli/dist/index.mjs info NfTable --lang en-US` is the local equivalent.
```sh
yarn build:components cli
node packages/cli/dist/index.mjs list
```
## Quick start {#quick-start}
All commands are listed below. Use `common-ui` after global installation or `npx common-ui` after project installation. Replace `` with the library knowledge version and `` with the CLI tool version. Prepare both JSON snapshots before using `diff`. List examples with `demo` before selecting a real example ID.
```sh
common-ui site --offline # Read the official homepage and snapshot documentation URLs offline
common-ui list # List components, packages and public exports
common-ui info NfTable # Read component APIs, declarations and provenance
common-ui doc NfTable --format markdown # Read the complete Markdown document
common-ui demo NfTable # List example IDs; use demo NfTable to read source
common-ui theme --theme chalk # Query Chalk/OEM theme variables
common-ui token ElButton # Query Element Plus tokens and theme overrides
common-ui design # Read design rules for both themes
common-ui semantic NfTable # Query documented styling props and slots
common-ui changelog # Read notes for an exact version
common-ui versions # List published online documentation versions
common-ui env # Inspect runtime and project dependencies
common-ui doctor # Diagnose dependencies, versions and integration
common-ui usage ./src # Locate component imports and template/JSX usage
common-ui lint ./src # Check imports, legacy Vue syntax and parse issues
common-ui diff ./from.json ./to.json # Compare two explicit knowledge snapshots
common-ui mcp # Start the read-only MCP stdio server
common-ui setup --client cursor --mode both --dry-run # Preview project MCP and Skill configuration
common-ui skills install --dry-run # Preview the bundled Skill installation command
common-ui upgrade --dry-run # Preview an explicit CLI version upgrade
common-ui bug --title "Component issue" --dry-run # Preview a component-library issue report
common-ui bug-cli --title "CLI issue" --dry-run # Preview a CLI issue report
common-ui --help # Show commands and options
common-ui --cli-version # Show the CLI tool package version
```
`--version local|` · `--lang en-US` · `--format json|text|markdown` · `--theme chalk|oem`
Confirm the installed library version, then query props, events, slots, methods and full examples. Never infer support from a name. If documentation matching the project’s version cannot be found, an explicit error is reported; documentation for another version is not substituted automatically.
### Install the Skill {#install-skill}
After installing a published CLI, run this in the consuming project and select AI tools when prompted. It installs the bundled Skill through `npx` with the pinned `skills@1.7.6` installer; npm/npx and registry access are required. Copy installation preserves SKILL.md and references independently of the temporary npx cache.
```sh
npx common-ui skills install
npx common-ui skills install --agent codex --yes
npx common-ui skills install --dry-run
```
Use `--agent codex` to select a tool, `--global` for user scope, `--yes` to skip Skills prompts, or `--project ` to choose the project. The default is interactive project installation. `--dry-run` previews without downloading or installing. MCP is not configured.
### Documentation versions and offline queries {#documentation-versions}
CLI and MCP prefer matching bundled knowledge or verified cache, then download an exact snapshot if missing. `--offline` disables networking; `--refresh` revalidates online data.
```sh
common-ui versions --format json
common-ui doc NfTable --version --offline --format json
common-ui doc NfTable --version --refresh --format json
```
### Project tools and maintenance {#project-tools}
Project scans recognize import aliases, Vue templates and JSX, reporting locations without executing business modules. Dynamic usage and cross-file type inference still need review. `diff` compares two explicit knowledge JSON files.
`upgrade` previews an explicit CLI version installation; `--yes` executes it. `bug` / `bug-cli` preview reports; after review, `--submit --yes` with `GITHUB_TOKEN` creates a GitHub Issue. Runtime components are not upgraded automatically and issues are not sent automatically.
```sh
common-ui env --format json
common-ui doctor --format json
common-ui usage ./src --filter NfTable --format json
common-ui lint ./src --only migration --format json
common-ui diff ./from.json ./to.json --format json
common-ui upgrade --dry-run
common-ui bug-cli --title "CLI issue" --description "Reproduction details" --dry-run
```
### Set up the project {#setup}
Run in the consuming project after installing a published CLI. Supported clients: `claude`, `cursor`, `vscode`, `codex`; modes: `mcp` (default), `skill`, `both`. Skill mode copies the complete bundled Skill and references without downloading Skills CLI.
```sh
npx common-ui setup --client claude --lang en-US
npx common-ui setup --client cursor --mode both --lang en-US
npx common-ui setup --client vscode --write-instructions --lang en-US
npx common-ui setup --client codex --dry-run --lang en-US
npx common-ui setup --client codex --check --lang en-US
```
`--project ` selects the project; `--version ` selects component knowledge; `--lang` selects the language. `--write-instructions` appends a managed instruction block and preserves existing text. MCP configuration pins the current CLI package version and records the absolute project path.
`--dry-run` previews paths, actions and the proposed MCP server; `--check` checks file consistency and exits 1 on missing or different content. Both are read-only and make no network requests. Setup preserves unrelated services, JSON comments and TOML text. Identical files are unchanged; conflicting common-ui entries or Skill files must be reconciled manually. Clients still need to load/approve the server; Codex project settings apply only to trusted projects.
[MCP](https://front.94ai.com/common-ui-plus/en/ai/mcp#setup)
### Use with AI tools {#ai-tools}
The CLI bundles the [common-ui Skill](https://front.94ai.com/common-ui-plus/en/ai/for-agents#skill), which guides agents to confirm the component library version before looking up its APIs, complete examples and design guidelines, and to choose appropriate CLI commands. Run the following command and select your AI tool and installation scope:
```sh
npx --package @94ai-plus/cli common-ui skills install
```
| Tool | Instructions |
| --- | --- |
| **Claude Code** | Add `--agent claude-code` when installing the Skill to select this tool. See the [documentation](https://code.claude.com/docs/en/skills) |
| **Cursor** | Add `--agent cursor` when installing the Skill to select this tool. See the [documentation](https://cursor.com/docs/skills) |
| **Codex** | Add `--agent codex` when installing the Skill to select this tool. See the [documentation](https://developers.openai.com/codex/skills/) |
| **Gemini CLI** | Add `--agent gemini-cli` when installing the Skill to select this tool. See the [documentation](https://geminicli.com/docs/cli/skills/) |
Other agents supported by the Skills installer are also available through its interactive prompts. Invoking the CLI requires an available `common-ui` command; see [Installation](#installation). Installing the Skill does not start or configure MCP.
---
# design.md {#design-language}
## Design language {#geometry}
Chalk and OEM are component themes. Light/dark appearance is independent. Coordinate language through NfConfigProvider and Element Plus.
| Theme | Primary | Source |
| --- | --- | --- |
| Chalk | #1177ff | nf-theme-chalk/src/_tokens.scss |
| OEM | #007555 | nf-theme-oem/src/_tokens.scss |
The theme --el-component-size variable currently sets default single-line controls to 28px. Components such as NfButton retain their documented size contracts.
Align labels and controls; keep 16px between an example’s result area and component. Compose existing table, search, column settings and drawer components.
Preserve keyboard focus, disabled, error, empty and loading states in overlays. Use public styling hooks rather than internal DOM.
## Element Plus Design Token {#element-plus-tokens}
Tokens come from the locked Element Plus light/dark CSS, preserving names, selectors, raw values and source version, with an upstream SCSS link. `var()` remains unresolved. Common UI Chalk/OEM overrides and additions are listed separately; Nf components are not aliases of similarly named El components.
```sh
common-ui token ElButton --format json
common-ui token NfButton --theme chalk --format json
```
## Tokens {#tokens}
```sh
common-ui theme --theme chalk
common-ui theme --theme oem
```
The command prints the theme variables as JSON in the terminal for developers or AI to query.
It includes:
- Theme variables and their raw values, such as primary colors and sizes.
- The variable source file, _tokens.scss.
- The knowledge version, Git commit and content digest.
This is a query command: it does not generate CSS files or modify the project theme.
With the CLI installed, run:
```txt
npx common-ui theme --theme chalk
```
## Typography {#typography-surfaces}
Inherit Element Plus font variables and preserve each component’s public sizes.
| Style | Configuration |
| --- | --- |
| Typography | `--el-font-family`, `--el-font-size-base`; NfButton mini/small use 12px and medium uses 14px. |
| Radius | `--el-border-radius-base`; NfButton mini uses 2px, the base radius is 4px; `round` and `circle` control rounded and circular buttons. |
| Shadow | `--el-box-shadow-light`; follows the active overlay component. |
## Functional colors, text and background {#surface-colors}
| Theme | Success | Text | Background |
| --- | --- | --- | --- |
| Chalk | #67c23a | #303133 | #ffffff |
| OEM | #31a36b | #252238 | #f8f7fc |
---
# Global configuration {#framework-fixture}
`NfConfigProvider` validates plugin registration, template types, internationalization and theme switching.
See expanded example example-34 (ConfigProviderExample).
Switch the language to update the confirm/cancel buttons and empty-state text. Confirm increments the counter; cancel resets it. Switch Chalk/OEM to change the primary button and preview border between blue `#1177ff` and green `#007555`. Language and component theme are independent.
Button labels read the language pack through `useLocale().t()`; `NfButton` does not translate custom slot content automatically. The current provider shares the application's locale context and applies its theme to the application root. This example runs in an isolated preview, so it does not change the documentation navigation's language or theme.
## Element Plus global configuration {#element-plus-config}
`NfConfigProvider` reuses all ConfigProvider props, validators and defaults from the installed Element Plus version and forwards the default scoped slot's `config`. For example, `size` controls nested `ElButton` and `ElInput` components without an explicit size; component-level props take priority. `button`, `card`, `dialog`, `link`, `table`, `message`, `zIndex`, `namespace`, `a11y`, `keyboardNavigation`, `experimentalFeatures`, `emptyValues` and `valueOnClear` are forwarded with Element Plus's native nesting/merge behavior.
See expanded example example-34 (ConfigProviderExample).
The example also demonstrates `button.autoInsertSpace`, translated Element Plus pagination and the scoped slot.
A string `locale` selects the CommonUI language and the matching built-in Element Plus language pack. Supported names are `zh-CN`, `en-US`, `ja`, `es`, `id`, `th`, `tl` and `pt`; Tagalog uses this repository's adapter. A language-pack object behaves like `ElConfigProvider`'s `locale`. An explicit `elementPlusLocale` takes precedence. Custom language names require a separate Element Plus language pack.
## Common UI global configuration {#component-defaults}
Set default props through camelCase keys such as `nfForm`, `nfTable`, `nfDrawer`, and `nfSoftphone`; template attributes may use `nf-form` or `nf-table`.
Priority: explicit component props → nearest provider → outer providers → original defaults. Merge by prop; `undefined` inherits, while `false`, `0`, and empty strings override. Arrays, objects, and functions replace whole values. Configuration is reactive; initialization options retain their existing lifecycle. Set required business data, listeners, slots, and native attributes locally.
Call `useMessage()`, `useNotification()`, and `useConfirm()` in a child setup to inherit the current provider. Direct services without context and softphone manager instances do not read the component tree.
### NfButton {#config-nf-button}
NfButton retains its legacy `mini / small / medium` sizes and does not inherit Element Plus's global `size`.
### NfButton
```vue
Global defaultLocal override
```
### NfAction {#config-nf-action}
### NfAction
```vue
```
### NfSoftphone {#config-nf-softphone}
Global defaults disable auto-start and configure the phone language, OEM theme, and PC mode. This follows the softphone documentation’s async onMounted example: it renders an unconnected preview bar by default, and obtains a signature to initialize the live phone bar after entering test `appKey`, `appSecret`, and `agentTag` values in the editor.
### NfSoftphone
```vue
```
### NfTable {#config-nf-table}
### NfTable
```vue
```
### NfTag {#config-nf-tag}
### NfTag
```vue
```
### NfTextOverflow {#config-nf-text-overflow}
### NfTextOverflow
```vue
```
### NfTransferSelect {#config-nf-transfer-select}
### NfTransferSelect
```vue
```
Loading disables the native button, shows a spinning SVG and hides the normal icon without requiring Element UI fonts. Disabled/loading buttons do not emit `click`.
## Sizes {#sizes}
### Legacy sizes
```vue
Default minimediumsmallmini
```
The default remains `mini` (12px font, 7px × 12px padding), not Element Plus's default. `medium` uses 14px and 10px × 12px; `small` uses 12px and 9px × 12px.
## Interaction, icons and native forms {#interaction}
See expanded example example-6 (ButtonExamples).
`icon` accepts legacy class strings or Vue icon components. Common legacy names (`el-icon-search/edit/check/message/star-off/delete/plus/close/download/upload`) map to built-in SVGs. Other strings remain CSS classes; consumers supply their fonts/styles, just as before. Element Plus does not include the Element UI icon font: replace unmapped names with a component, such as `:icon="Search"` imported from `@element-plus/icons-vue`. Give icon-only buttons an `aria-label`.
## Global configuration {#global-config}
`NfConfigProvider` accepts all button props through `nf-button`. Explicit button values (including `false`) win; nested providers inherit per property and update reactively. The fallback size remains `mini`. This configuration is separate from Element Plus's top-level `size` / `button`.
```vue
InheritedLocal override
```
See the [interactive provider example](https://front.94ai.com/common-ui-plus/en/components/fixture#nf-button-config).
## On-demand installation {#installation}
```ts
import NfButton from '@94ai-plus/nf-button'
import '@94ai-plus/nf-theme-chalk/nf-button.css'
app.use(NfButton)
```
For OEM use `@94ai-plus/nf-theme-oem/nf-button.css`. Installing `CommonUI` already registers `NfButton`. Named imports and `CommonUIResolver()` are supported. The component's standalone CSS entry is `@94ai-plus/nf-button/style.css`.
## Props {#props}
| Prop | Description | Type / values | Default |
| --- | --- | --- | --- |
| type | Semantic type | primary / success / info / warning / danger / text | — |
| size | Legacy size | mini / small / medium | mini |
| icon | Icon class or Vue component | string / Component | — |
| plain | Plain button | boolean | false |
| text | Text button; also enabled by `type="text"` | boolean | false |
| round | Rounded corners | boolean | false |
| circle | Circular button | boolean | false |
| loading | Show loading and block clicks | boolean | false |
| disabled | Disable button | boolean | false |
| autofocus | Native autofocus | boolean | false |
| native-type | Native form behavior | button / submit / reset | button |
Undeclared attributes such as `id`, `class`, `style`, `name`, `value`, `aria-*` and `data-*` fall through to the native button. Vue 3 listener fallthrough replaces Vue 2 `.native`. Keyboard `:focus-visible` styles do not change mouse states.
## Events and slots {#events-slots}
| Name | Contract |
| --- | --- |
| click | `(event: MouseEvent) => void`, preserving the native event |
| default | Button content; no content span is generated when absent |
## Expanded component examples
### ButtonExamples
Source: docs/.vitepress/theme/examples/ButtonInteractions.vue
```vue
{{ english ? 'Clicks' : '点击' }} {{ count }}
{{ english ? 'Search' : '搜索' }}{{ english ? 'Custom icon' : '自定义图标' }}
{{ english ? 'Mount autofocus button' : '挂载自动聚焦按钮' }}{{ english ? 'Autofocus attribute' : '自动聚焦属性' }}
```
---
# Empty {#empty}
Display empty data, network errors and permission states with the eight original illustrations and slots. Use the header menus to switch component theme and language.
## Built-in types {#types}
### Built-in types
```vue
```
## Image and size {#custom}
### Image and size
```vue
```
## Description and actions {#slots}
### Description and actions
```vue
The description slot takes priorityRetry
```
## Interactive example {#interactive}
See expanded example example-4 (EmptyExamples).
## On-demand usage {#installation}
```ts
import { createApp } from 'vue'
import NfEmpty from '@94ai-plus/nf-empty'
import '@94ai-plus/nf-theme-chalk/nf-empty.css'
const app = createApp(App)
app.use(NfEmpty)
```
Supports standalone installation, named full-library exports and automatic resolver imports. Illustrations follow Chalk/OEM and default messages follow the locale. Explicit descriptions and slots remain application-controlled.
## Props {#props}
| Prop | Description | Type / values | Default |
| --- | --- | --- | --- |
| image | Custom image URL overrides built-in illustrations | string | `''` |
| type | Empty state type | data / internet / message / server / loading / authority / call / seat | data |
| border | Show a border | boolean | false |
| image-size | Image width in px; 0 keeps the default size | number | undefined |
| description | Custom message; empty values use the current locale | string | `''` |
## Slots {#slot-api}
| Slot | Description |
| --- | --- |
| description | Custom description; overrides the description prop |
| default | Bottom actions |
## Migration notes {#migration}
Fixes the missing seat message, reversed OEM seat/server mapping and incorrect imageSize default. Use NfConfigProvider theme or data-nf-theme instead of window.$agentCustomization. SVGs are inlined and rendering is SSR-safe.
## Expanded component examples
### EmptyExamples
Source: docs/.vitepress/theme/components/EmptyExamples.vue
```vue
```
## Interactive example {#interactive}
See expanded example example-2 (ImportTemplateExamples).
## Installation {#installation}
```ts
import NfImportTemplate from '@94ai-plus/nf-import-template'
import 'element-plus/dist/index.css'
import '@94ai-plus/nf-theme-chalk/nf-import-template.css'
app.use(NfImportTemplate)
```
## Props {#props}
| Prop | Type | Default |
| --- | --- | --- |
| order | string | `'1'` |
| description | string | `''` |
| btnText | string | `''` |
| tip | string | `''` |
| subTip | string | `''` |
| tipDirection | vertical / horizontal | vertical |
| mode | downLoad / download / upload | downLoad |
| uploadMineType | string[] (extensions) | `['.xlsx', '.xls']` |
| limitSize | number (MiB, file size < limit) | 50 |
| showError | boolean | false |
| errorText | string | `''` |
| loading | boolean | false |
## Events {#events}
| Event | Payload |
| --- | --- |
| click | MouseEvent (downLoad / download) |
| upload | File (upload) |
| emit-error | — (showError) |
## Slots {#slots}
| Slot | Content |
| --- | --- |
| default | description |
| tip | tip + subTip |
## Migration notes {#migration}
The actual defaults are `mode="downLoad"` and `tipDirection="vertical"`; `download` is also accepted. Extensions are case-insensitive. File size must be strictly less than `limitSize` MiB. Cancelled selections are safe, and the same file can be selected again. Applications must validate content and server limits.
`showError`: `errorText || lastValidFileName`. `loading`: no click/upload. `$openMessage.error` → `ElMessage.error`.
## Expanded component examples
### ImportTemplateExamples
Source: docs/.vitepress/theme/components/ImportTemplateExamples.vue
```vue
Custom descriptionCustom tip
```
---
# Radio group {#radio-group}
A segmented button selector using Element Plus Tooltip, with single/multiple selection, three sizes and disabled states. Labels and hints are supplied by the application; use the header to switch component themes.
## Single and multiple selection {#selection}
### Single and multiple selection
```vue
single: {{ value }} / multiple: {{ selected }}
```
## Sizes {#sizes}
### Sizes
```vue
```
## Disabled states {#disabled}
### Disabled states
```vue
```
## Custom tooltips {#tooltip}
### Custom tooltips
```vue
{{ index }} / {{ item.tip }}
```
## Interactive example {#interactive}
See expanded example example-5 (RadioGroupExamples).
## Installation {#installation}
```ts
import NfRadioGroup from '@94ai-plus/nf-radio-group'
import 'element-plus/dist/index.css'
import '@94ai-plus/nf-theme-chalk/nf-radio-group.css'
app.use(NfRadioGroup)
```
## Types {#types}
```ts
import type { RadioGroupOption, RadioGroupModelValue, RadioGroupChange } from '@94ai-plus/nf-radio-group'
// RadioGroupOption: { name: string; value: string | number; tip?: string; disabled?: boolean }
// RadioGroupModelValue: string | number | (string | number)[]
// RadioGroupChange: { index: number; value: string | number }
```
## Props {#props}
Text props follow the library language when omitted; defaults below use this language.
| Parameter | Description | Type | Options | Default |
| --- | --- | --- | --- | --- |
| `groups` | Option list with name, value, disabled and tip; business text is not translated automatically. | `RadioGroupOption[]` | — | `[]` |
| `value` | Current value: string/number for single selection, array for multiple; supports v-model:value. | `RadioGroupModelValue` | — | `''` |
| `modelValue` | Current value; Vue 3 v-model takes precedence over the compatibility prop. | `RadioGroupModelValue` | — | `undefined` |
| `multiple` | Enable multiple selection; use an array for multiple values. | `boolean` | — | `false` |
| `disabled` | Whether to disable the component. | `boolean` | — | `false` |
| `size` | Option size. | `string` | small / medium / large | `'medium'` |
| `placement` | Popup placement. | `string` | top / top-start / top-end / bottom / bottom-start / bottom-end / left / left-start / left-end / right / right-start / right-end | `'top'` |
| `effect` | Tooltip theme. | `string` | dark / light | `'dark'` |
| `offset` | Popup offset in pixels. | `number` | — | `0` |
| `transition` | Popup transition name. | `string` | — | `'el-fade-in-linear'` |
| `visibleArrow` | Whether to show the popup arrow. | `boolean` | — | `true` |
| `popperOptions` | Popper 2 options; use modifiers to customize positioning. | `RadioGroupPopperOptions` | — | `{ boundariesElement: 'body', gpuAcceleration: false }` |
| `popperClass` | Custom class for the popup. | `string` | — | `''` |
| `openDelay` | Show delay for hover, in milliseconds. | `number` | — | `0` |
| `enterable` | Whether the pointer can enter the Tooltip. | `boolean` | — | `true` |
| `hideAfter` | Tooltip auto-close delay after showing, in milliseconds; 0 disables auto-close. | `number` | — | `0` |
| `tabindex` | tabindex of the trigger. | `number` | — | `0` |
## Events {#events}
| Event | Description | Payload |
| --- | --- | --- |
| `update:value` | Update the bound value. | `(value: RadioGroupModelValue)` |
| `update:modelValue` | Update the bound value. | `(value: RadioGroupModelValue)` |
| `change` | Fires when an option is clicked; value is the operated option, not the whole multiple-selection array. | `({ index: number, value: string \| number })` |
## Slots {#slots}
| Parameter | Description | Payload |
| --- | --- | --- |
| `content` | Custom Tooltip content; only shown when tip exists and the option is enabled. | `{ item: RadioGroupOption, index: number }` |
## Migration notes {#migration}
Replace Vue 2 `:value.sync` with `v-model:value`. Default `v-model` is also supported; modelValue wins when both are supplied. Multiple selection requires an array. Inputs are not mutated; current values are filtered in group order before toggling. Clicking the selected single item emits nothing. The change payload always contains the clicked item value.
Legacy openDelay/visibleArrow map to showAfter/showArrow. Legacy hideAfter retains auto-close semantics via autoClose, starting when shown. The mouseleave delay is 200ms; enterable controls pointer entry. Legacy boundariesElement/gpuAcceleration become Popper 2 modifiers. Rewrite other Popper 1 settings for Popper 2; explicit modern modifiers win.
Disabled items can no longer be selected. Non-array multiple values no longer throw or match string substrings. Native buttons support Enter/Space, arrows and Home/End, skipping disabled items. Arrows select in single mode and only focus in multiple mode. Missing tips or disabled items/groups suppress tooltips even with a content slot. The slot now receives item/index. Business text is not auto-translated.
## Expanded component examples
### RadioGroupExamples
Source: docs/.vitepress/theme/components/RadioGroupExamples.vue
```vue
```
## Interactive example {#interactive}
See expanded example example-4 (AlertExamples).
## On-demand import {#installation}
```ts
import NfAlert from '@94ai-plus/nf-alert'
import '@94ai-plus/nf-theme-chalk/nf-alert.css'
app.use(NfAlert)
```
## Types {#typings}
```ts
import type { AlertProps, AlertType, AlertEffect, AlertInstance } from '@94ai-plus/nf-alert'
// AlertType: 'success' | 'warning' | 'info' | 'error'
// AlertEffect: 'light' | 'dark'
// AlertInstance: { close(): void }
```
## Attribute {#props}
| parameters | Description | Type | Optional value | Default value |
| --- | --- | --- | --- | --- |
| title | Title, supports trusted HTML; can also be passed in via the title slot. | string | — | '' |
| description | Supporting text. It can also be passed in through the default slot, and the default slot takes priority. | string | — | '' |
| type | Alert type | string | success/warning/info/error | 'info' |
| closable | Can it be closed | boolean | — | true |
| close-text | Close button custom text | string | — | '' |
| showIcon | Whether to display the icon | boolean | — | true |
| center | Is the text centered? | boolean | — | false |
| effect | Visual theme | string | light/dark | 'light' |
## Event {#events}
| event name | Description | callback parameters |
| --- | --- | --- |
| close | Event triggered when alert is turned off | — |
## Slot {#slot-api}
| Name | Description | Slot parameters |
| --- | --- | --- |
| default | Description | — |
| title | Title content | — |
| close | Custom close control | { close: () => void } |
## Migration instructions {#migration}
Reserves 8 properties, no-argument close event, and three slots. Fixed the problem of the description disappearing when the default slot and description are passed in at the same time, and changed it to slot priority; fixed the problem of repeatedly closing the trigger event after being hidden. After closing, updating properties will not automatically reopen. Please remount via key.
The close button is changed to a native button, which supports keyboard operations, accessibility labels in eight languages, and does not submit the form. The icons are changed to built-in SVG and do not rely on Element UI fonts. The close slot has a new close callback, and the instance has a new close() method. The effect controls the appearance of the prompt box and is independent of the white and black theme of the document/drill field.
## Expanded component examples
### AlertExamples
Source: docs/.vitepress/theme/components/AlertExamples.vue
```vue
```
## Installation {#installation}
```ts
import NfDrawer from '@94ai-plus/nf-drawer'
import 'element-plus/dist/index.css'
import '@94ai-plus/nf-theme-chalk/nf-drawer.css'
app.use(NfDrawer)
```
## Props {#props}
| Attribute | Description | Type | Accepted values | Default |
| --- | --- | --- | --- | --- |
| showConfirmButton | Whether to show the confirm button | boolean | — | true |
| showCancelButton | Whether to show the cancel button | boolean | — | true |
| cancelButtonText | Cancel button text | string | — | Current locale |
| confirmButtonText | Confirm button text | string | — | Current locale |
| currentTab | Current tab name; supports v-model:current-tab; invalid values fall back to the first tab | string | — | undefined |
| tabs | Tab data: name is the tab name, slot names its content slot | ITabItem[] / DrawerTabItem[] | — | undefined |
| modelValue | Visibility with v-model; takes precedence over visible | boolean | — | false |
| visible | Visibility with v-model:visible | boolean | — | false |
| title | Title | string | — | `''` |
| customClass | Custom class name | string | — | `''` |
| wrapperClosable | Whether clicking the backdrop closes Drawer | boolean | — | false |
| closeOnClickModal | Backdrop closing; when explicit, overrides wrapperClosable | boolean | — | wrapperClosable |
| closeOnPressEscape | Whether Escape closes Drawer | boolean | — | false |
| direction | Drawer opening direction | string | rtl / ltr / ttb / btt | rtl |
| size | Drawer size: width for horizontal, height for vertical | string / number | — | 30% |
| beforeClose | Before-close callback; done() continues closing; successful confirmation bypasses it | `(done: (cancel?: boolean) => void) => void` | — | — |
| withHeader / showClose / appendTo / appendToBody / destroyOnClose / resizable / modal / lockScroll / openDelay / closeDelay / zIndex / headerClass / bodyClass / footerClass | Forwards the same Element Plus Drawer properties, defaults and behavior | Element Plus Drawer | — | [Element Plus Drawer](https://element-plus.org/en-US/component/drawer.html#attributes) |
## Events {#events}
| Event | Description | Payload |
| --- | --- | --- |
| cancel | Drawer cancel button callback | event: MouseEvent |
| confirm | Drawer confirm callback; done() closes, error() only stops loading | done: () => void, error: () => void |
| changeTab | Tab change callback, receiving the current tab name | name: string |
| update:modelValue | Emitted when visibility changes | value: boolean |
| update:visible | Emitted when visibility changes | value: boolean |
| update:currentTab | Synchronizes the active tab; undefined for an empty list | value: string / undefined |
| open / opened / close / closed / openAutoFocus / closeAutoFocus | Forwards Element Plus Drawer opening, closing and autofocus events | — |
| resize-start / resize / resize-end | Emitted when resizing starts, moves and ends | event: MouseEvent, size: number |
## Slots {#slots}
| Slot | Description | Payload |
| --- | --- | --- |
| default | Drawer content | — |
| title | Drawer title content | close, titleId, titleClass |
| header | Drawer header content; takes precedence over the title slot | close, titleId, titleClass |
| footer | Drawer footer content; hidden when both buttons are hidden | — |
| tabs[].slot | Tab content named by tabs[].slot | — |
## Types {#types}
```ts
import type { DrawerProps, DrawerTabItem, ITabItem, DrawerInstance } from '@94ai-plus/nf-drawer'
// DrawerTabItem: { name: string; slot: string }; ITabItem = DrawerTabItem
// DrawerInstance: closeDrawer(), handleClose(); both run beforeClose
```
## Migration {#migration}
Replace Vue 2 :visible.sync with v-model:visible. wrapperClosable maps to closeOnClickModal (the latter wins); customClass is merged onto the panel. The legacy title slot maps to header; otherwise the title prop renders normally. Hiding both buttons hides the entire footer, including custom content. Confirmation callbacks are single-use and invalidated on close/reopen/unmount. SSR renders a placeholder until mounted.
---
# Tag {#tag}
A native status tag with six variants, an optional status dot, text fallback and click events. Switch Chalk/OEM component themes from the header.
## Status variants {#variants}
### Status variants
```vue
SuccessInfoDisabledWarningTipDanger
```
## Status dot {#circle}
### Status dot
```vue
```
## Text and slots {#content}
### Text and slots
```vue
Slot wins
```
## Click events {#click}
### Click events
```vue
Click me
```
type defaults to undefined: no variant class is added when omitted. value defaults to an empty string and renders as plain text; the default slot takes precedence. circle defaults to true and is decorative.
> **info disabled**
type="disabled" is a gray visual variant, not a disabled control: it still emits click. click receives the original MouseEvent and keeps native bubbling/default behavior. The legacy documentation omitted this payload; the implementation is the compatibility baseline.
## Interactive example {#interactive}
See expanded example example-5 (TagExamples).
## On-demand import {#installation}
```ts
import NfTag from '@94ai-plus/nf-tag'
import '@94ai-plus/nf-theme-chalk/nf-tag.css'
app.use(NfTag)
```
## Types {#types}
```ts
import type { TagProps, TagType } from '@94ai-plus/nf-tag'
// TagType: 'disabled' | 'success' | 'info' | 'warning' | 'danger' | 'tip'
```
## Props {#props}
| Attribute | Description | Type | Accepted values | Default |
| --- | --- | --- | --- | --- |
| type | Type; disabled changes appearance only, not click behavior | string | disabled / success / info / warning / danger / tip | undefined |
| circle | Whether to show the dot | boolean | — | true |
| value | Text displayed when the default slot is absent | string | — | `''` |
## Events {#events}
| Event | Description | Payload |
| --- | --- | --- |
| click | Click callback with the original MouseEvent | event: MouseEvent |
## Slots {#slots}
| Slot | Description | Payload |
| --- | --- | --- |
| default | Tag content | — |
## Migration notes {#migration}
Preserves all three props, the default slot, div root and click behavior. Chalk info text/dot remains #0b73ff; OEM follows the theme primary color (default #007555). Its background stays #e7f1ff. Other colors and dimensions remain unchanged.
Business text comes from value or slots and is not translated automatically. The tag does not add button semantics or keyboard behavior; use appropriate accessible buttons/links for actions. Incorrect ai-action-md event/slot anchors in the old tag page are not claimed, to avoid conflicts with the real action page. Tag routes use their own anchors.
## Expanded component examples
### TagExamples
Source: docs/.vitepress/theme/components/TagExamples.vue
```vue
{{ english ? 'Custom content' : '自定义内容' }}
```
Source: docs/.vitepress/theme/locale.ts
```ts
import { computed, inject, type InjectionKey, type Ref } from 'vue'
import { withBase } from 'vitepress'
import { localizePath, type LocaleName } from '../../../packages/common-locale/src/languages'
import { additionalMessages } from '../locales/ui'
export { languageDefinitions, localeFromPath, isLocaleName } from '../../../packages/common-locale/src/languages'
export type DocsLanguage = LocaleName
export const languageStorageKey = 'common-ui-plus:docs-language'
export const docsLanguageKey: InjectionKey> = Symbol('docs-language')
const zh = {
brand: '94智能通用组件库', home: '94智能公共组件库首页', skip: '跳至正文',
toggleSidebar: '切换侧边导航', closeNav: '关闭导航', navigation: '顶部导航', sidebar: '文档导航', outline: '当前页面目录',
guide: '指南', packages: '分包集合', theme: '主题', language: '语言', links: '边缘库',
chalk: 'Chalk 默认主题', oem: 'OEM 定制主题', playground: '演练场',
dark: '切换为暗色模式', light: '切换为亮色模式',
search: '搜索文档', searchPlaceholder: '搜索文档,索引至标题,定位至组件', noResults: '没有匹配结果',
example: '示例', loadingDemo: '正在加载示例…', preview: '实时预览', actions: '示例操作',
edit: '在线编辑', editTitle: '在演练场中编辑', copy: '复制代码', copied: '代码已复制',
expand: '展开代码', collapse: '收起代码', switchJs: '切换为 JS', switchTs: '切换为 TS',
editor: '示例代码编辑器', switchFailed: '语言切换失败,代码未更改:',
manualCopy: '请展开代码后手动复制。', copyFailed: '无法访问剪贴板,请在展开的编辑器中手动复制。',
}
const en: typeof zh = {
brand: '94AI Common UI', home: '94AI Common UI home', skip: 'Skip to content',
toggleSidebar: 'Toggle sidebar', closeNav: 'Close navigation', navigation: 'Top navigation', sidebar: 'Documentation navigation', outline: 'On this page',
guide: 'Guide', packages: 'Packages', theme: 'Theme', language: 'Language', links: 'Links',
chalk: 'Chalk default theme', oem: 'OEM custom theme', playground: 'Playground',
dark: 'Switch to dark mode', light: 'Switch to light mode',
search: 'Search docs', searchPlaceholder: 'Search docs, headings and components', noResults: 'No matching results',
example: 'Example', loadingDemo: 'Loading example…', preview: ' live preview', actions: 'Example actions',
edit: 'Edit online', editTitle: 'Edit in playground', copy: 'Copy code', copied: 'Code copied',
expand: 'Expand code', collapse: 'Collapse code', switchJs: 'Switch to JS', switchTs: 'Switch to TS',
editor: 'Example code editor', switchFailed: 'Language switch failed; code unchanged: ',
manualCopy: 'Expand the code and copy it manually.', copyFailed: 'Clipboard unavailable. Copy the code manually from the editor.',
}
export const docsMessages: Record = { 'zh-CN': zh, 'en-US': en, ...additionalMessages }
export function localizedPath(path: string, locale: DocsLanguage): string {
return localizePath(path, locale)
}
export function useDocsLanguage() {
const locale = inject(docsLanguageKey)!
const english = computed(() => locale.value !== 'zh-CN')
const ui = computed(() => docsMessages[locale.value])
const docLink = (path: string) => withBase(localizedPath(path, locale.value))
return { locale, english, ui, docLink }
}
```
---
# Message {#message}
Success, warning, info and error notifications with auto-close, stacking and Chalk/OEM themes.
The default export is a component plugin; the callable service is the named `Message` export. Installing CommonUI or `app.use(NfMessage)` provides `this.$openMessage` for Options API. In setup, `useMessage()` inherits provider injections and locale and disposes its messages on unmount. Direct Message does not implicitly bind the last installed app; pass appContext as its second argument or use createMessage(appContext).
## Basic usage and types {#basic}
### Basic usage and types
```vue
{{ type }}
```
## Manual close and stacking {#closing}
### Manual close and stacking
```vue
Openclose()closeAll()
```
## Text, HTML and VNode {#content}
### Text, HTML and VNode
```vue
Escaped text')">TextTrusted HTML', dangerouslyUseHTMLString: true })">HTMLVNode
```
## Center, offset and custom icon {#options}
### Center, offset and custom icon
```vue
OptionsCustom icon
```
## Component and default slot {#slots}
### Component and default slot
```vue
Slot messageDefault slot content
```
## Interactive example {#interactive}
See expanded example example-6 (MessageExamples).
## Installation {#installation}
```ts
import NfMessage, { Message, useMessage, createMessage } from '@94ai-plus/nf-message'
import '@94ai-plus/nf-theme-chalk/nf-message.css'
app.use(NfMessage)
Message.success('Saved')
const appMessage = createMessage(app._context)
appMessage.info('App context')
// setup(): const message = useMessage()
```
## Options {#props}
| Attribute | Description | Type | Accepted values | Default |
| --- | --- | --- | --- | --- |
| message | Message text | string / VNode | — | `''` |
| type | Type | string | success / warning / info / error | info |
| iconClass | Custom icon class, overriding the default type icon | string | — | `''` |
| dangerouslyUseHTMLString | Whether to render message as HTML; trusted content only | boolean | — | false |
| customClass | Custom class name | string | — | `''` |
| duration | Display duration in ms; 0 disables automatic closing | number | — | 3000 |
| showClose | Whether to show the close button | boolean | — | false |
| center | Whether to center the text | boolean | — | false |
| onClose | Close callback, receiving the closed instance’s public handler | `(handler: MessageHandler) => void` | — | — |
| offset | Message offset from the viewport top, in px | number | — | 20 |
| zIndex | Stacking level; service calls increment from 3001 | number | — | Auto-incremented |
## Events {#events}
| Event | Description | Payload |
| --- | --- | --- |
| close | Emitted on close | (handler: MessageHandler) |
| destroy | Emitted after the leave transition | — |
## Slots {#component-slots}
| Slot | Description | Payload |
| --- | --- | --- |
| default | Body content; takes precedence over message | — |
## Methods and handler {#methods}
| API | Description |
| --- | --- |
| Message(string / VNode / options, appContext?) | Returns MessageHandler |
| Message.success / warning / info / error(options?) | Type shortcuts; accepts string, VNode or options |
| handler.close() | Close the current Message; repeated calls are harmless |
| Message.close(id, onClose?) | Close by id; optional extra callback (same callback deduplicated) |
| Message.closeAll() | Close a snapshot of active messages |
| createMessage(appContext) / useMessage() | Context-aware scoped service |
## Migration notes {#migration}
Preserves four types, 3000ms default, hover pause/full-duration restart, Escape closing all messages, and 8px stack spacing. The source default offset is 20px (legacy docs incorrectly said 100); explicit zero works. Height changes, window resizing and closing a middle item trigger reflow. Messages render into body and follow the root data-nf-theme. Services share the page stack.
close() is idempotent. close(id) now really closes the DOM message. Timers, listeners and observers are cleaned up. onClose receives MessageHandler (id, el/$el, visible, closed, close), not Vue 2 private instance fields. SSR returns a closed no-op handler. App-scoped close/closeAll only affect that service; direct Message.closeAll() affects the page. Snapshot closing does not close new messages created in callbacks.
Strings are escaped. dangerouslyUseHTMLString is for trusted HTML only, never user input. The default slot overrides message. iconClass replaces the default SVG and removes the type modifier. The keyboard-accessible close button has a translated aria-label; business content is not auto-translated. Declarative components use fixed positioning but do not join the service stack. Use the service for multiple messages.
## Expanded component examples
### MessageExamples
Source: docs/.vitepress/theme/components/MessageExamples.vue
```vue
```
Source: docs/.vitepress/theme/locale.ts
```ts
import { computed, inject, type InjectionKey, type Ref } from 'vue'
import { withBase } from 'vitepress'
import { localizePath, type LocaleName } from '../../../packages/common-locale/src/languages'
import { additionalMessages } from '../locales/ui'
export { languageDefinitions, localeFromPath, isLocaleName } from '../../../packages/common-locale/src/languages'
export type DocsLanguage = LocaleName
export const languageStorageKey = 'common-ui-plus:docs-language'
export const docsLanguageKey: InjectionKey> = Symbol('docs-language')
const zh = {
brand: '94智能通用组件库', home: '94智能公共组件库首页', skip: '跳至正文',
toggleSidebar: '切换侧边导航', closeNav: '关闭导航', navigation: '顶部导航', sidebar: '文档导航', outline: '当前页面目录',
guide: '指南', packages: '分包集合', theme: '主题', language: '语言', links: '边缘库',
chalk: 'Chalk 默认主题', oem: 'OEM 定制主题', playground: '演练场',
dark: '切换为暗色模式', light: '切换为亮色模式',
search: '搜索文档', searchPlaceholder: '搜索文档,索引至标题,定位至组件', noResults: '没有匹配结果',
example: '示例', loadingDemo: '正在加载示例…', preview: '实时预览', actions: '示例操作',
edit: '在线编辑', editTitle: '在演练场中编辑', copy: '复制代码', copied: '代码已复制',
expand: '展开代码', collapse: '收起代码', switchJs: '切换为 JS', switchTs: '切换为 TS',
editor: '示例代码编辑器', switchFailed: '语言切换失败,代码未更改:',
manualCopy: '请展开代码后手动复制。', copyFailed: '无法访问剪贴板,请在展开的编辑器中手动复制。',
}
const en: typeof zh = {
brand: '94AI Common UI', home: '94AI Common UI home', skip: 'Skip to content',
toggleSidebar: 'Toggle sidebar', closeNav: 'Close navigation', navigation: 'Top navigation', sidebar: 'Documentation navigation', outline: 'On this page',
guide: 'Guide', packages: 'Packages', theme: 'Theme', language: 'Language', links: 'Links',
chalk: 'Chalk default theme', oem: 'OEM custom theme', playground: 'Playground',
dark: 'Switch to dark mode', light: 'Switch to light mode',
search: 'Search docs', searchPlaceholder: 'Search docs, headings and components', noResults: 'No matching results',
example: 'Example', loadingDemo: 'Loading example…', preview: ' live preview', actions: 'Example actions',
edit: 'Edit online', editTitle: 'Edit in playground', copy: 'Copy code', copied: 'Code copied',
expand: 'Expand code', collapse: 'Collapse code', switchJs: 'Switch to JS', switchTs: 'Switch to TS',
editor: 'Example code editor', switchFailed: 'Language switch failed; code unchanged: ',
manualCopy: 'Expand the code and copy it manually.', copyFailed: 'Clipboard unavailable. Copy the code manually from the editor.',
}
export const docsMessages: Record = { 'zh-CN': zh, 'en-US': en, ...additionalMessages }
export function localizedPath(path: string, locale: DocsLanguage): string {
return localizePath(path, locale)
}
export function useDocsLanguage() {
const locale = inject(docsLanguageKey)!
const english = computed(() => locale.value !== 'zh-CN')
const ui = computed(() => docsMessages[locale.value])
const docLink = (path: string) => withBase(localizedPath(path, locale.value))
return { locale, english, ui, docLink }
}
```
---
# Notification {#notification}
Corner notifications with auto-close, independent stacks, action buttons and Chalk/OEM themes.
The default export is a component plugin; the named `Notification` export is the callable service. CommonUI or `app.use(NfNotification)` installs `this.$openNotify`. In setup, `useNotification()` inherits provider injections and locale and disposes notifications on unmount. `createNotification(appContext)` creates an app-scoped service. Direct Notification never implicitly binds the last installed app; pass appContext as its second argument when needed.
## Basic usage and positions {#basic}
### Basic usage and positions
```vue
{{ position }}closeAll()
```
## Notification types {#variants}
### Notification types
```vue
{{ type }}
```
## Cancel and confirm {#actions}
### Cancel and confirm
```vue
Openclose()
```
## Text, HTML and VNode {#content}
### Text, HTML and VNode
```vue
Escaped text')">TextTrusted HTML', dangerouslyUseHTMLString: true })">HTMLVNodeCustom icon
```
## Component and default slot {#slots}
### Component and default slot
```vue
Slot notificationSlot-only content
```
## Interactive example {#interactive}
See expanded example example-6 (NotificationExamples).
## Installation {#installation}
```ts
import NfNotification, { Notification, useNotification, createNotification } from '@94ai-plus/nf-notification'
import '@94ai-plus/nf-theme-chalk/nf-notification.css'
app.use(NfNotification)
Notification.success({ title: 'Saved', message: 'Success' })
const notify = createNotification(app._context)
notify.info('App context')
// setup(): const notify = useNotification()
```
## Options {#props}
| Attribute | Description | Type | Accepted values | Default |
| --- | --- | --- | --- | --- |
| title | Title | string | — | `''` |
| message | Description text | string / VNode | — | `''` |
| dangerouslyUseHTMLString | Whether to render message as HTML; trusted content only | boolean | — | false |
| type | Theme style; unsupported values are ignored | string | success / warning / info / error | `''` |
| iconClass | Custom icon class; a valid type takes precedence | string | — | `''` |
| customClass | Custom class name | string | — | `''` |
| duration | Display duration in ms; 0 disables automatic closing | number | — | 4500 |
| position | Custom popup position | string | top-right / top-left / bottom-right / bottom-left | top-right |
| showClose | Whether to show the close button | boolean | — | true |
| onClose | Close callback, receiving the closed instance’s public handler | `(handler: NotificationHandler) => void` | — | — |
| onClick | Callback when Notification is clicked | `() => void` | — | — |
| offset | Offset shared by simultaneous Notification instances; an additional 16px viewport margin applies | number | — | 0 |
| cancelButtonText | Cancel button text | string | — | `''` |
| confirmButtonText | Confirm button text | string | — | `''` |
| onCancel | Cancel button callback; does not close the notification automatically | `() => void` | — | — |
| onConfirm | Confirm button callback; does not close the notification automatically | `() => void` | — | — |
| zIndex | Stacking level; service calls increment from 3001 | number | — | Auto-incremented |
## Events {#events}
| Event | Description | Payload |
| --- | --- | --- |
| click | Callback when Notification is clicked | — |
| cancel | Cancel button callback; does not close the notification automatically | — |
| confirm | Confirm button callback; does not close the notification automatically | — |
| close | Emitted on close | (handler: NotificationHandler) |
| destroy | Emitted after the leave transition | — |
## Slots {#component-slots}
| Slot | Description | Payload |
| --- | --- | --- |
| default | Body content; takes precedence over message | — |
## Methods and handler {#methods}
| API | Description |
| --- | --- |
| Notification(string / VNode / options, appContext?) | Returns NotificationHandler |
| Notification.success / warning / info / error(options?) | Type shortcuts; accept string, VNode or options |
| handler.close() | Close the current Notification; repeated calls are harmless |
| Notification.close(id, onClose?) | Close by id; identical callback deduplicated |
| Notification.closeAll() | Close a snapshot of active notifications |
| createNotification(appContext) / useNotification() | Context-aware scoped service |
## Migration notes {#migration}
Preserves the 4500ms default, independent corner stacks, 16px edges/gaps, hover pause and full-duration restart on leave. Delete/Backspace pause; other keys restart; Escape closes notifications. Keyboard handling no longer creates duplicate timers or restarts while hovering. Height changes, resizing and middle-item removal trigger reflow.
Cancel/confirm only invoke callbacks, without automatically closing or triggering card onClick. Call handler.close() explicitly when needed. Recognized type icons take priority over iconClass; no type/iconClass means no icon. Titles and strings are escaped. HTML mode is only for trusted content. Slot-only content now renders without message. Business content/action labels are supplied by the caller; close aria-label supports eight languages.
close() is idempotent; close(id) really closes the DOM and releases timers/listeners/observers. onClose receives NotificationHandler (id, position, el/$el/dom, visible, closed, close), not Vue 2 private instance fields. SSR returns a closed no-op handler. Scoped close/closeAll only affect owned notifications; direct Notification.closeAll() affects all notifications on the page. Message and Notification keep separate registries. Notifications mount into body and follow root data-nf-theme; declarative components do not join service stacks.
## Expanded component examples
### NotificationExamples
Source: docs/.vitepress/theme/components/NotificationExamples.vue
```vue
```
Source: docs/.vitepress/theme/locale.ts
```ts
import { computed, inject, type InjectionKey, type Ref } from 'vue'
import { withBase } from 'vitepress'
import { localizePath, type LocaleName } from '../../../packages/common-locale/src/languages'
import { additionalMessages } from '../locales/ui'
export { languageDefinitions, localeFromPath, isLocaleName } from '../../../packages/common-locale/src/languages'
export type DocsLanguage = LocaleName
export const languageStorageKey = 'common-ui-plus:docs-language'
export const docsLanguageKey: InjectionKey> = Symbol('docs-language')
const zh = {
brand: '94智能通用组件库', home: '94智能公共组件库首页', skip: '跳至正文',
toggleSidebar: '切换侧边导航', closeNav: '关闭导航', navigation: '顶部导航', sidebar: '文档导航', outline: '当前页面目录',
guide: '指南', packages: '分包集合', theme: '主题', language: '语言', links: '边缘库',
chalk: 'Chalk 默认主题', oem: 'OEM 定制主题', playground: '演练场',
dark: '切换为暗色模式', light: '切换为亮色模式',
search: '搜索文档', searchPlaceholder: '搜索文档,索引至标题,定位至组件', noResults: '没有匹配结果',
example: '示例', loadingDemo: '正在加载示例…', preview: '实时预览', actions: '示例操作',
edit: '在线编辑', editTitle: '在演练场中编辑', copy: '复制代码', copied: '代码已复制',
expand: '展开代码', collapse: '收起代码', switchJs: '切换为 JS', switchTs: '切换为 TS',
editor: '示例代码编辑器', switchFailed: '语言切换失败,代码未更改:',
manualCopy: '请展开代码后手动复制。', copyFailed: '无法访问剪贴板,请在展开的编辑器中手动复制。',
}
const en: typeof zh = {
brand: '94AI Common UI', home: '94AI Common UI home', skip: 'Skip to content',
toggleSidebar: 'Toggle sidebar', closeNav: 'Close navigation', navigation: 'Top navigation', sidebar: 'Documentation navigation', outline: 'On this page',
guide: 'Guide', packages: 'Packages', theme: 'Theme', language: 'Language', links: 'Links',
chalk: 'Chalk default theme', oem: 'OEM custom theme', playground: 'Playground',
dark: 'Switch to dark mode', light: 'Switch to light mode',
search: 'Search docs', searchPlaceholder: 'Search docs, headings and components', noResults: 'No matching results',
example: 'Example', loadingDemo: 'Loading example…', preview: ' live preview', actions: 'Example actions',
edit: 'Edit online', editTitle: 'Edit in playground', copy: 'Copy code', copied: 'Code copied',
expand: 'Expand code', collapse: 'Collapse code', switchJs: 'Switch to JS', switchTs: 'Switch to TS',
editor: 'Example code editor', switchFailed: 'Language switch failed; code unchanged: ',
manualCopy: 'Expand the code and copy it manually.', copyFailed: 'Clipboard unavailable. Copy the code manually from the editor.',
}
export const docsMessages: Record = { 'zh-CN': zh, 'en-US': en, ...additionalMessages }
export function localizedPath(path: string, locale: DocsLanguage): string {
return localizePath(path, locale)
}
export function useDocsLanguage() {
const locale = inject(docsLanguageKey)!
const english = computed(() => locale.value !== 'zh-CN')
const ui = computed(() => docsMessages[locale.value])
const docLink = (path: string) => withBase(localizedPath(path, locale.value))
return { locale, english, ui, docLink }
}
```
---
# Confirm {#confirm}
Custom confirmation dialogs with async loading, callbacks, promises and Chalk/OEM themes.
The default export is a component plugin; the named `Confirm` export is the callable service. CommonUI or `app.use(NfConfirm)` installs `this.$openConfirm`. In setup, `useConfirm()` inherits provider injections and locale and cleans up on unmount. `createConfirm(appContext)` creates an app-scoped service. Direct Confirm does not implicitly bind the last installed app; pass appContext as its second argument when needed.
## Basic usage {#basic}
### Basic usage
```vue
Open confirm
```
## Status types {#variants}
### Status types
```vue
{{ type }}
```
## Promises and asynchronous close {#promise}
### Promises and asynchronous close
```vue
Promise
```
## Callbacks and retry {#callbacks}
### Callbacks and retry
```vue
Retry
```
## Text, HTML, VNode and component {#content}
### Text, HTML, VNode and component
```vue
Escaped text')">TextTrusted HTML', true)">HTMLVNodeSlotDefault slot content
```
## Interactive example {#interactive}
See expanded example example-6 (ConfirmExamples).
## Installation {#installation}
```ts
import NfConfirm, { Confirm, useConfirm, createConfirm } from '@94ai-plus/nf-confirm'
import 'element-plus/dist/index.css'
import '@94ai-plus/nf-theme-chalk/nf-confirm.css'
app.use(NfConfirm)
Confirm({ title: 'Confirm', message: 'Continue?' }).then(done => done()).catch(() => {})
// setup(): const confirm = useConfirm()
const confirm = createConfirm(app._context)
```
## Options {#props}
| Attribute | Description | Type | Accepted values | Default |
| --- | --- | --- | --- | --- |
| title | Title | string | — | `''` |
| message | Description text | string / VNode | — | `''` |
| dangerouslyUseHTMLString | Whether to render message as HTML; trusted content only | boolean | — | false |
| width | Confirm width in px | number | — | 400 |
| type | Theme style; unsupported values are ignored | string | success / warning / info / error | `''` |
| iconClass | Custom icon class; a valid type takes precedence | string | — | `''` |
| customClass | Custom class name | string | — | `''` |
| cancelButtonText | Cancel button text | string | — | Current locale |
| confirmButtonText | Confirm button text | string | — | Current locale |
| onCancel | Cancel callback; done() closes Confirm, done(false) only stops loading | `(done: ConfirmDone) => void \| Promise` | — | — |
| onConfirm | Confirm callback; done() closes Confirm, done(false) only stops loading | `(done: ConfirmDone) => void \| Promise` | — | — |
| modelValue | Visibility with v-model; takes precedence over visible | boolean | — | false |
| visible | Visibility with v-model:visible | boolean | — | false |
## Events {#events}
| Event | Description | Payload |
| --- | --- | --- |
| cancel | Cancel callback; done() closes Confirm, done(false) only stops loading | done: ConfirmDone |
| confirm | Confirm callback; done() closes Confirm, done(false) only stops loading | done: ConfirmDone |
| update:modelValue | Emitted when visibility changes | value: boolean |
| update:visible | Emitted when visibility changes | value: boolean |
| close | Emitted on close | — |
| destroy | Emitted after the leave transition | — |
## Slots {#slots}
| Slot | Description | Payload |
| --- | --- | --- |
| default | Body content; takes precedence over message | — |
## Methods and instance {#methods}
| API | Description |
| --- | --- |
| Confirm(options?, appContext?) | `Promise` |
| done() / done(true) | Clear loading and close |
| done(false) | Clear loading, keep dialog open |
| Confirm.closeAll() | Cancel all Confirm instances on the page |
| createConfirm(appContext) / useConfirm() | Scoped service; closeAll only cancels owned instances |
| component ref.close(close?) | Close or clear loading |
## Migration notes {#migration}
Preserves 400px width, 35vh top, four types, both buttons and async loading. No close icon; backdrop clicks do not close. Escape is treated as cancellation, invokes onCancel and rejects with undefined after closing, fixing the legacy unresolved Promise. Default labels follow eight languages; explicit labels win. Recognized type icons take priority over iconClass. Titles/strings are escaped; HTML mode is only for trusted content. VNode content now renders correctly.
Without a custom onConfirm, confirmation resolves with done and does not close automatically. Call done() to close. done(false) only clears loading; a resolved Promise does not run then again. Use onConfirm for retryable operations. With custom callbacks, done(false) keeps the Promise pending; done() settles according to the current action. This fixes promises that never settled with legacy callbacks. Synchronous errors/async rejections clear loading and reject(error), without auto-closing. An internal rejection observer prevents ignored callback-style returns from becoming unhandled; explicit catch still receives cancellations/errors.
Each dialog owns its Promise, fixing the global currentMsg cross-instance bug. Attempt-scoped done functions cannot affect later retries, cancellation or reopened dialogs. Loading blocks repeated confirmation. Adds declarative v-model/v-model:visible, default slot and typed close(); declarative components without action listeners close normally. The default slot is new; the legacy component had no usable slot.
Element Plus Dialog provides focus, scroll locking and layering. App/provider services only clean up owned dialogs; direct Confirm.closeAll() cancels all Confirm instances without touching Message/Notification. Closing/unmount releases the Vue tree; SSR returns a resolved no-op done Promise without DOM access. Dialogs mount into body and follow root data-nf-theme. The duplicate legacy /3 anchor maps to basic usage; its incorrectly named notification Options anchor does not override notification routes.
## Expanded component examples
### ConfirmExamples
Source: docs/.vitepress/theme/components/ConfirmExamples.vue
```vue
{{ english ? 'Without retry, confirm resolves the Promise and waits for done(). Press Escape to cancel.' : '未选重试时,确认后 Promise 已完成,但需调用 done() 关闭。Escape 可取消。' }}
```
Source: docs/.vitepress/theme/locale.ts
```ts
import { computed, inject, type InjectionKey, type Ref } from 'vue'
import { withBase } from 'vitepress'
import { localizePath, type LocaleName } from '../../../packages/common-locale/src/languages'
import { additionalMessages } from '../locales/ui'
export { languageDefinitions, localeFromPath, isLocaleName } from '../../../packages/common-locale/src/languages'
export type DocsLanguage = LocaleName
export const languageStorageKey = 'common-ui-plus:docs-language'
export const docsLanguageKey: InjectionKey> = Symbol('docs-language')
const zh = {
brand: '94智能通用组件库', home: '94智能公共组件库首页', skip: '跳至正文',
toggleSidebar: '切换侧边导航', closeNav: '关闭导航', navigation: '顶部导航', sidebar: '文档导航', outline: '当前页面目录',
guide: '指南', packages: '分包集合', theme: '主题', language: '语言', links: '边缘库',
chalk: 'Chalk 默认主题', oem: 'OEM 定制主题', playground: '演练场',
dark: '切换为暗色模式', light: '切换为亮色模式',
search: '搜索文档', searchPlaceholder: '搜索文档,索引至标题,定位至组件', noResults: '没有匹配结果',
example: '示例', loadingDemo: '正在加载示例…', preview: '实时预览', actions: '示例操作',
edit: '在线编辑', editTitle: '在演练场中编辑', copy: '复制代码', copied: '代码已复制',
expand: '展开代码', collapse: '收起代码', switchJs: '切换为 JS', switchTs: '切换为 TS',
editor: '示例代码编辑器', switchFailed: '语言切换失败,代码未更改:',
manualCopy: '请展开代码后手动复制。', copyFailed: '无法访问剪贴板,请在展开的编辑器中手动复制。',
}
const en: typeof zh = {
brand: '94AI Common UI', home: '94AI Common UI home', skip: 'Skip to content',
toggleSidebar: 'Toggle sidebar', closeNav: 'Close navigation', navigation: 'Top navigation', sidebar: 'Documentation navigation', outline: 'On this page',
guide: 'Guide', packages: 'Packages', theme: 'Theme', language: 'Language', links: 'Links',
chalk: 'Chalk default theme', oem: 'OEM custom theme', playground: 'Playground',
dark: 'Switch to dark mode', light: 'Switch to light mode',
search: 'Search docs', searchPlaceholder: 'Search docs, headings and components', noResults: 'No matching results',
example: 'Example', loadingDemo: 'Loading example…', preview: ' live preview', actions: 'Example actions',
edit: 'Edit online', editTitle: 'Edit in playground', copy: 'Copy code', copied: 'Code copied',
expand: 'Expand code', collapse: 'Collapse code', switchJs: 'Switch to JS', switchTs: 'Switch to TS',
editor: 'Example code editor', switchFailed: 'Language switch failed; code unchanged: ',
manualCopy: 'Expand the code and copy it manually.', copyFailed: 'Clipboard unavailable. Copy the code manually from the editor.',
}
export const docsMessages: Record = { 'zh-CN': zh, 'en-US': en, ...additionalMessages }
export function localizedPath(path: string, locale: DocsLanguage): string {
return localizePath(path, locale)
}
export function useDocsLanguage() {
const locale = inject(docsLanguageKey)!
const english = computed(() => locale.value !== 'zh-CN')
const ui = computed(() => docsMessages[locale.value])
const docLink = (path: string) => withBase(localizedPath(path, locale.value))
return { locale, english, ui, docLink }
}
```
---
# nf-resizable-panels {#resizable-panels}
Resizable panels with horizontal/vertical layouts, minimum sizes and local caching.
Import the components below; see the package README for standalone installation.
## Examples {#examples}
### Basic usage {#example-1}
### Basic usage
```vue
LeftRight
```
### More examples 2 {#example-2}
### More examples 2
```vue
TopBottom⠿
```
### More examples 3 {#example-3}
### More examples 3
```vue
Toggle panelABCD
```
## Props {#props}
Text props follow the library language when omitted; defaults below use this language.
| Parameter | Description | Type | Options | Default |
| --- | --- | --- | --- | --- |
| `resizablePanelsContainerTag` | Container tag. | `string` | — | `'div'` |
| `seperatorSize` | Separator width in pixels; 0 uses the theme default. | `number` | — | `0` |
| `fillSeperator` | Fill the separator; shown on hover in border mode. | `boolean` | — | `false` |
| `dragDirection` | Drag direction: row is horizontal, column is vertical. | `string` | row / column | `'row'` |
| `resizeMinWidth` | Minimum resize dimension: width for row, height for column. | `number` | — | `0` |
| `symbolMode` | Separator symbol or border mode. | `string` | symbol / border | `'symbol'` |
| `seperatorPosition` | Separator position. | `string` | start / end / center | `'start'` |
| `unique` | Cache identifier; use a different value for each layout. | `string` | — | `'resiable-panel-child'` |
| `divideType` | Resize via flex-basis or width/height. | `string` | flex / calc | `'calc'` |
| `cached` | Cache panel sizes after dragging. | `boolean` | — | `false` |
## Events {#events}
| Event | Description | Payload |
| --- | --- | --- |
| `resize` | Fires on drag release and after keyboard resizing. | — |
## Slots {#slots}
| Parameter | Description | Payload |
| --- | --- | --- |
| `default` | Direct child panels; give them initial dimensions or flex. | — |
| `seperator-symbol` | Custom separator symbol. | — |
## Methods {#methods}
| Name | Type | Description |
| --- | --- | --- |
| `refresh()` | `void` | Recollect panels and read compatible cache. |
## Migration notes {#migration}
Legacy `seperator*` spellings and the `nf-resizable-panels-${unique}` key are preserved. Cache restores only when panel count matches and total size differs by at most 4px. Arrow keys resize by 10px, Shift+Arrow by 1px. Drag listeners are cleaned up.
---
# nf-indicator-plane {#indicator-plane}
Metric cards with five layouts and four replaceable slots.
Import the components below; see the package README for standalone installation.
## Scenario 1 {#example-1}
### Scenario 1
```vue
```
## Attribute {#props}
| parameters | Description | Type | Optional value | Default value |
| --- | --- | --- | --- | --- |
| mode | displayed mode | string | dropdown/popover | 'dropdown' |
| unique | The key of the component loop. If there is no loop, it does not need to be passed. | number/string | — | 0 |
| span | The upper limit of the number of child elements that triggers the drop-down; span=0 is calculated based on the available width; when span is exceeded, span−1 operations and one more entry are displayed. | number | — | 3 |
| trigger | The behavior that triggers the drop-down | string | hover/click/focus/manual | 'hover' |
| tabindex | tabindex of dropdown component | number | — | 0 |
| hide-timeout | The delay of dropdown closing the drop-down menu (only valid when trigger is hover) | number | — | 150 |
| show-timeout | The delay of dropdown expansion drop-down menu (only valid when trigger is hover) | number | — | 250 |
| hide-on-click | Whether dropdown hides the menu after clicking the menu item | boolean | — | true |
| placement | popover drop-down position | string | top/top-start/top-end/bottom/bottom-start/bottom-end/left/left-start/left-end/right/right-start/right-end | 'bottom' |
| offset | The offset of where the popover appears | number | — | 0 |
| transition | Popover defines gradient animation | string | — | 'fade-in-linear' |
| popper-class | The custom class name of the popover popup layer. | string | — | — |
| popper-options | Popper 2 configuration of popover; the old version boundariesElement and gpuAcceleration need to be changed to modifiers. | Object | — | { boundariesElement: 'body', gpuAcceleration: false } |
| open-delay | Popover display delay, in milliseconds; handled by Element Plus if not set. | number | — | 200 |
| close-delay | Popover hiding delay, in milliseconds. | number | — | 0 |
| visible-arrow | Whether the popover displays arrows. | boolean | — | true |
| width | popover elastic layer width. | string / number | — | auto |
## Event {#events}
| event name | Description | callback parameters |
| --- | --- | --- |
| show | Triggered when popover is displayed | — |
| after-enter | Triggered after the popover display animation is finished playing | — |
| hide | Triggered when popover is hidden | — |
| after-leave | Triggered after the popover hidden animation finishes playing | — |
| visible-change | Dropdown triggers when the drop-down box appears/hides | visible: boolean |
## Slot {#slots}
| Name | Description |
| --- | --- |
| default | action content |
## Methods {#methods}
| method name | Description | return value |
| --- | --- | --- |
| refreshStyle() | Recalculated after layout changes. | Promise<void> |
| open() | Open the floating layer manually. | void |
| close() | Close the overlay manually. | void |
## Instructions for use {#configuration-notes}
Dynamic DOM child elements also support drop-down, such as buttons added or removed after permission control. The example shows the edit and import buttons after 5 seconds; the width example shows after 3 seconds. Each operation component is instantiated only once, and the floating layer moves the original node through Teleport.
---
# nf-infinite-menu {#infinite-menu}
Data-driven recursive menus with custom fields, hidden/disabled items, routing and external links.
Import the components below; see the package README for standalone installation.
## Examples {#examples}
### Basic usage {#example-1}
### Basic usage
```vue
Update data selected = index" style="max-width:320px" />
```
### More examples 2 {#example-2}
### More examples 2
```vue
```
### More examples 3 {#example-3}
### More examples 3
```vue
OpenClose
```
## Props {#props}
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `data` | `MenuItem[]` | `required` | Menu tree; use unique index values. |
| `name / index / icon / children` | `string` | `name / index / icon / children` | Field names. Icon class is read from item.meta[icon]. |
| `indexPrefix` | `string` | `''` | Prepended to every menu index. |
| `router` | `boolean` | `true` | Element Plus router mode; set false without a router. |
| `link / blank` | `boolean` | `false / true` | External links / open a new tab. Link mode disables native router navigation. |
| `customClass / popperClass` | `string` | `''` | Menu / submenu popup class. |
| `showTimeout / hideTimeout` | `number` | `300 / 300` | Submenu delay in ms; per-item values override. |
| `disabled` | `boolean` | `false` | Disable all items. |
| `popperAppendToBody` | `boolean` | `true` | Submenu teleported; per-item false is preserved. |
| `...MenuProps` | `Element Plus Menu` | `native` | mode, collapse, defaultActive, defaultOpeneds, uniqueOpened, colors, etc. |
## Events {#events}
| Name | Type | Description |
| --- | --- | --- |
| `select / open / close` | `Element Plus Menu events` | All native listeners are forwarded. |
## Methods {#methods}
| Name | Type | Description |
| --- | --- | --- |
| `open(index) / close(index)` | `void` | Open or close a submenu. |
| `handleResize() / updateActiveIndex(index)` | `void` | Native menu methods. |
## Migration notes {#migration}
Data and field mappings remain reactive. Hidden items are omitted; a parent with no visible children becomes a leaf. false/0 overrides are preserved. Unsafe link schemes are rejected and new windows use noopener.
---
# nf-audio {#audio}
Custom audio player with seeking, segment playback, speed, volume and replaceable controls.
Import the components below; see the package README for standalone installation.
## Basic usage {#example-1}
### Basic usage
```vue
Regular version
interval play
Only jumps but does not play automatically
Jump
Simple versionno background Disable small size
```
## Attribute {#props}
| parameters | Description | Type | Optional value | Default value |
| --- | --- | --- | --- | --- |
| src | audio recording file | string | — | '' |
| size | Size | string | mini | undefined |
| disabled | Whether to disable | boolean | — | false |
| background | Whether to display the background; false to remove the background. | boolean | — | true |
| jump-time | Specify frame skip time | number | — | 0 |
| show-jump-time | Turn off frame skipping | number(unit seconds) | — | true |
| back-second | Specify the number of seconds to rewind, 0 turns off the rewind function | number | — | 0 |
| forward-second | Specify the number of seconds to fast forward, 0 turns off the fast forward function | number | — | 0 |
| init-volumn-value | Specify the default volume, ranging from 0 to 1 | number / string | — | 0.8 |
| init-speed-value | Specify default playback speed | number / string | — | 1 |
| multiple-array | Double speed option | Array | — | ['1.0', '1.25', '1.5', '1.75', '2.0', '2.5', '3.0', '3.5', '4.0', '10.0'] |
| show-more-btn | Pass false to turn off double speed and downloading | boolean | — | true |
| speed-desc | Multiplication function description | string | — | undefined |
| download-desc | Download function description | string | — | undefined |
| speed-pre-desc | Speed option description prefix, default such as 1x, 2x | string | — | 'x ' |
| cross-time-tip | The start time cannot be greater than the total duration | string | — | undefined |
| unload-tip | Audio resources cannot be played at the moment | string | — | undefined |
| between-start | Interval playback start time, in seconds. | number | — | 0 |
| between-end | Interval playback end time, unit second; 0 means playback to the end. | number | — | 0 |
| high-precision | Turn on AudioWorklet auxiliary timing, which requires security context; falls back to RAF/timeupdate when unavailable, and does not guarantee a fixed error. | boolean | — | false |
| debuglog | Output fallback logs when a high-precision clock is unavailable. | boolean | — | false |
| download-enabled | Whether to enable downloading functions (including copying audio addresses and opening new tabs) | boolean | — | true |
| copySuccessDesc | Prompt for successful copying of audio address. | string | — | Follow language pack |
| copyAddressDesc | Copy the menu text of the audio address. | string | — | Follow language pack |
| openWindowDesc | Menu text for new tab opening. | string | — | Follow language pack |
## Event {#events}
| event name | Description | callback parameters |
| --- | --- | --- |
| download | Download callback | e:Event |
| volumeChange | Volume change | volume: number(0…100) |
| speedChange | speed change | speed: speed of change |
| jumpToTime | frame skipping | (time: time to jump to,autoPlay:Whether to play automatically Boolean Defaulttrue) |
| updateProgress | Positioning progress | offsetX: Positioning offset |
| pauseOrPlay | play/pause | paused: Whether to pause |
| forward | fast forward | time: Fast forward to time |
| back | Rewind | time: Fast rewind to time |
| error | Resource loading error | error: Event / Error |
| canPlay | Resource loaded successfully | totalTime: string(mm:ss) |
| updateTime | Native timeupdate event. | event: Event |
| native media events | Transparently transmit native events such as play, pause, ended, loadedmetadata, canplay, seeking, seeked, volumechange, ratechange, etc. | event: Event |
## Slot {#slots}
| Name | Description |
| --- | --- |
| jump | Customized frame skipping |
| play | Customized playback and pause |
| time | Customized play time |
| fastBack | Customized rewind |
| progress | Customized progress |
| fastForward | Customized fast forward |
| volume | Custom volume |
| more | Customize more |
| volume-mute | Custom mute icon. |
| volume-unmute | Custom unmute icon. |
| more-btn-list | Customize more menu content. |
| speed-btn-list | Customize double speed menu content. |
## Expose {#methods}
| Name | Type | Description |
| --- | --- | --- |
| locationToTime | Function | frame skipping |
| handleBack | Function | Rewind |
| handleForward | Function | fast forward |
| handlePauseOrPlay | Function | Pause or play |
| pause | Function | pause |
| play | Function | play |
| betweenPlay | Function | interval play |
| jumpToTime(time, autoPlay = true) | void | Jump to a specified number of seconds; autoplay can be turned off. |
| changeSpeed(value) | void | Set playback speed. |
| copyAddress() | Promise<boolean> | Copy the audio address. |
| openWindow() | void | Open the audio address in a new tab. |
## Instructions for use {#configuration-notes}
The audio example follows the recording address of common-ui. download only dispatches download requests, and file downloads are handled by the consumer. High-precision mode requires a security context; falls back when unavailable, and does not promise millisecond accuracy.
---
# nf-form-item {#form-item}
A companion form item preserving native validation, label/error slots and collapse registration.
Import the components below; see the package README for standalone installation.
## Examples {#examples}
### Basic usage {#example-1}
### Basic usage
```vue
result = 'expanded: ' + expanded">
ValidateReset
```
### More examples 2 {#example-2}
### More examples 2
```vue
{{ label }}{{ error }}
```
## Props {#props}
Text props follow the library language when omitted; defaults below use this language.
| Parameter | Description | Type | Options | Default |
| --- | --- | --- | --- | --- |
| `hidden` | Exclude the item from collapsing when true; the item remains visible. | `boolean` | — | `false` |
| `prop` | Field in the form model; required for validation and reset, supports path arrays. | `string \| string[]` | — | `undefined` |
| `label` | Label text. | `string` | — | `undefined` |
| `labelWidth` | Label width, e.g. 50px; supports auto and inherits the form setting when omitted. | `string \| number` | — | `undefined` |
| `labelPosition` | Label position; inherits the form setting when omitted. | `string` | left / right / top | `''` |
| `required` | Whether required; determined by validation rules when omitted. | `boolean` | — | `undefined` |
| `rules` | Validation rules using the Element Plus / async-validator format. | `FormItemRule \| FormItemRule[]` | — | `undefined` |
| `error` | Field error message; setting it immediately enters the error state and displays it. | `string` | — | `undefined` |
| `showMessage` | Whether to show validation error messages. | `boolean` | — | `true` |
| `inlineMessage` | Display validation messages inline. | `boolean` | — | `undefined` |
| `size` | Control size; mini maps to small and medium to default. | `string` | mini / small / medium / default / large | `undefined` |
| `validateStatus` | Field validation state. | `string` | error / validating / success | `undefined` |
| `for` | Native label for attribute, referencing an input ID. | `string` | — | `undefined` |
## Events {#events}
No component events. Listen to validate on the parent NfForm for validation results.
## Slots {#slots}
| Parameter | Description | Payload |
| --- | --- | --- |
| `default` | Form Item content: field controls or action buttons. | — |
| `label` | Custom label content. | `{ label: string }` |
| `error` | Custom rendering of validation messages. | `{ error: string }` |
## Methods {#methods}
| Name | Type | Description |
| --- | --- | --- |
| `validate(trigger, callback?) / resetField() / clearValidate()` | `native` | Element Plus field methods. |
## Migration notes {#migration}
Use with NfForm. hidden excludes the item from collapse; it does not hide it. Use Vue 3 v-model and Element Plus rules rather than private Element UI instance properties.
---
# nf-form {#form}
An Element Plus Form wrapper preserving validation and field APIs with expandable query fields.
Import the components below; see the package README for standalone installation.
## Expand and collapse form fields {#example-1}
### Expand and collapse form fields
```vue
Food/Restaurant online eventsLocal promotion activitiesOffline theme activitiesPure brand exposureOnline brand sponsorshipOffline venues are freeswitch{{ !inline ? 'Inside the industry' : 'block level' }}Increase the number of foldsReduce the number of foldsForm item prefix upwardsForm item prefix to the rightForm item prefix leftform validationreset checksum
```
## Dynamic form fields {#example-2}
### Dynamic form fields
```vue
Delete
.
SubmitresetAdd domain nameIncrease the number of foldsReduce the number of folds
```
## Attribute {#props}
| parameters | Description | Type | Optional value | Default value |
| --- | --- | --- | --- | --- |
| model | form data object | object | — | — |
| rules | form validation rules | object | — | — |
| inline | Inline form mode | boolean | — | false |
| label-position | The position of the form field label. If the value is left or right, label-width needs to be set. | string | right/left/top | right |
| label-width | The width of the form field label, for example '50px'. Form-item elements that are direct children of Form inherit this value. Support auto. | string | — | — |
| label-suffix | Suffix for form field labels | string | — | — |
| hide-required-asterisk | Whether to hide the red asterisk next to the label of a required field | boolean | — | false |
| show-message | Whether to display verification error information | boolean | — | true |
| inline-message | Whether to display verification information inline | boolean | — | false |
| status-icon | Whether to display the verification result feedback icon in the input box | boolean | — | false |
| validate-on-rule-change | Whether to trigger a verification immediately after the rules attribute changes | boolean | — | true |
| size | Control the size of components in the form; compatible with mini→small, medium→default. | string | medium/small/mini | undefined |
| disabled | Whether to disable all components within this form. If set to true, the disabled attribute on components within the form will no longer take effect. | boolean | — | false |
| showBtn | Whether to enable the fold button function | boolean | — | true |
| columns | Fold when exceeding the specified number; retain the first columns-1 participants and the last operation item when folding. | number | — | 3 |
| upIcon | Collapse button icon class name; defaults to built-in SVG. | string | — | 'icon-xiangshang2' |
| downIcon | Expand button icon class name; uses built-in SVG by default. | string | — | 'icon-xiangxia2' |
| isCollapse | Initialize whether to fold | boolean | — | true |
| expandBtnType | Expand button type | string | primary/success/warning/danger/info/text/default | '' |
| expandBtnIcon | Expand button icon | string | — | undefined |
| expandBtnPlain | Expand button plain | boolean | — | true |
| expandBtnSize | Expand button size, the default is based on the form size. It is worth noting that after setting this, if it is not a value in the enumeration, it will be regarded as the default size of the button (the default maximum size, equivalent to large) | string | medium/small/mini | undefined |
| expandBtnRound | Expand button round | boolean | — | false |
| expandBtnCircle | Expand buttoncircle | boolean | — | false |
| expandBtnLoading | Expand button loading | boolean | — | false |
| expandBtnDisabled | Expand buttondisabled | boolean | — | false |
| expandBtnTooltipDesc | Expand button tooltip text. | string | — | Follow language pack |
| shrinkBtnTooltipDesc | Collapse button text. | string | — | Follow language pack |
## Methods {#methods}
| method name | Description | parameters |
| --- | --- | --- |
| validate | A method for validating the entire form. The parameter is a callback function. This callback function will be called after the verification is completed, and two parameters will be passed in: whether the verification was successful and the fields that failed the verification. If no callback function is passed in, a promise will be returned | Function(callback: Function(boolean, object)) |
| validateField | How to verify some form fields | Function(props: array |
| resetFields | Reset the entire form, reset all field values to their initial values and remove validation results | — |
| clearValidate | Remove the validation results from the form item. Pass in the prop attribute or array of props of the form item to be removed. If not passed, the verification result of the entire form will be removed. | Function(props: array |
| scrollToField(prop) | Scroll to the specified field. | string |
| getField(prop) | Get field context. | string |
| getFormItems() | Refresh dynamic form item order. | — |
## Event {#events}
| event name | Description | callback parameters |
| --- | --- | --- |
| validate | Triggered after any form item is verified | The form item being validated prop Value, whether the verification passed, error message (if present) |
| isCollapseChange | Triggered by change of form expansion state, true means expansion. | expanded: boolean |
## Slot {#slots}
| Name | Description |
| --- | --- |
| default | Form content; use NfFormItem to register the collapse item. |
## nf-form-item Attribute {#form-item-props}
| parameters | Description | Type | Optional value | Default value |
| --- | --- | --- | --- | --- |
| hidden | Controls whether the form item participates in the hidden drop-down function, true does not participate | boolean | — | false |
| prop | Form field model field, this attribute is required when using the validate and resetFields methods. | string | incoming Form component model fields in | — |
| label | label text | string | — | — |
| label-width | The width of the form field label, for example '50px'. 'auto' is supported. | string | — | — |
| required | Is it required? If not set, it will be automatically generated based on the verification rules. | boolean | — | false |
| rules | form validation rule | object | — | — |
| error | Form field validation error message. Setting this value will change the form validation status to error and display the error message. | string | — | — |
| show-message | Whether to display verification error information | boolean | — | true |
| inline-message | Display verification information inline | boolean | — | false |
| size | Used to control the size of components under this form field | string | medium/small/mini | - |
## nf-form-item Slot {#form-item-slots}
| Name | Description |
| --- | --- |
| default | Contents of Form Item |
| label | The content of the label text |
## nf-form-item Scoped Slot {#form-item-scoped-slots}
| Name | Description |
| --- | --- |
| error | Customize the display mode of form verification information, the parameter is { error } |
## nf-form-item Methods {#form-item-methods}
| method name | Description | parameters |
| --- | --- | --- |
| resetField | Reset the form item, reset its value to its initial value and remove the verification result | - |
| clearValidate | Remove the verification result of this form item | - |
## Instructions for use {#configuration-notes}
The hidden of NfFormItem means that it does not participate in folding and remains on the page. Validation, reset, and field methods use Element Plus's public API; do not rely on Vue 2 private instances.
---
# nf-rules {#rules}
Rule editor for intention/personal/custom tags, reply keywords, import/call/current time, duration, dialogue rounds, call count, parameters and call status. Chinese enum exports, remapping, merge strategies, per-field disabling and form validation are retained.
## Examples {#examples}
### Add rules {#example-1}
### Add rules
```vue
Get rule dataValidate rulesAND + all rule typesOR + available rule typesDefault type for new rulesDefault data for new rules
```
## Props {#props}
Descriptions preserve common-ui semantics; defaults and signatures follow the current Vue 3 implementation. Compatibility props do not enable unsupported legacy rendering.
| Attribute | Description | Type | Values | Default |
| --- | --- | --- | --- | --- |
| `modelValue / v-model (value)` | Bound value; value remains compatible; prefer v-model in Vue 3 | `SelectModelValue` | — | `undefined` |
| `emitSelectedItemOnClick` | get-selected-data returns values by default; true returns full records | `boolean` | — | `false` |
| `keyValue` | Fields used for option label and value | `[string, string]` | — | `['label', 'value']` |
| `virtualList` | Enable virtual scrolling | `boolean` | — | `false` |
| `dataKey` | Unique virtual row key: field name or function | `string \| ((row: SelectOption) => string \| number)` | — | `'templateId'` |
| `dataComponent` | Custom option component receiving source, index and extraProps | `Component` | — | `undefined` |
| `estimateSize` | Estimated row height in px | `number` | — | `34` |
| `keeps` | Minimum inline virtual window; dropdown virtualization is managed by SelectV2 | `number` | — | `30` |
| `pageSize` | Number of records per request | `number` | — | `10` |
| `keywordAlias` | Request field for search keyword | `string` | — | `'keyword'` |
| `pageNoAlias` | Request field for page number | `string` | — | `'pageNo'` |
| `pageSizeAlias` | Request field for page size | `string` | — | `'pageSize'` |
| `valueAlias` | Initial request field for selected values | `string` | — | `'value'` |
| `loadingDesc` | Loading message | `string` | — | `Locale configuration` |
| `showTip` | Show option tooltip | `boolean` | — | `true` |
| `multiple` | Enable multiple selection | `boolean` | — | `false` |
| `disabled` | Disable interaction | `boolean` | — | `Inherited configuration` |
| `allowEmptySearch` | Allow requests with an empty keyword | `boolean` | — | `true` |
| `size` | Input size; mini / medium map to small / default | `SelectSize` | `small / default / large / mini / medium` | `Inherited configuration` |
| `collapseTags` | Collapse selected tags in multiple mode | `boolean` | — | `multiple` |
| `multipleLimit` | Maximum selected items; 0 means unlimited | `number` | — | `0` |
| `placeholder` | Input placeholder | `string` | — | `Locale configuration` |
| `noDataText` | Empty list text; can use the empty slot | `string` | — | `Locale configuration` |
| `noDataImg` | Show NfEmpty when no data | `boolean` | — | `false` |
| `popperClass` | Dropdown CSS class | `string` | — | `undefined` |
| `popperAppendToBody` | Teleport dropdown to body; maps to Element Plus teleported | `boolean` | — | `true` |
| `start` | Initial inline scroll index | `number` | — | `0` |
| `offset` | Initial inline scroll offset in px | `number` | — | `0` |
| `direction` | Compatibility field; currently has no effect | `String` | `vertical` | `undefined` |
| `pageMode` | Compatibility field; currently has no effect | `boolean` | — | `undefined` |
| `topThreshold` | Top threshold for totop; may fire repeatedly | `number` | — | `0` |
| `bottomThreshold` | Bottom threshold for tobottom; may fire repeatedly | `number` | — | `0` |
| `rootTag` | Inline list root tag | `String` | — | `'div'` |
| `wrapTag` | Inline list wrapper tag | `String` | — | `'div'` |
| `wrapClass` | Compatibility field; currently has no effect | `String` | — | `undefined` |
| `wrapStyle` | Inline list wrapper style | `CSSProperties` | — | `undefined` |
| `itemTag` | Inline row wrapper tag | `String` | — | `'div'` |
| `itemClass` | Inline row CSS class | `String` | — | `undefined` |
| `itemClassAdd` | Extra row class function (index, row) | `(index: number, row: SelectOption) => string` | — | `undefined` |
| `itemStyle` | Inline row style | `CSSProperties` | — | `undefined` |
| `itemScopedSlots` | Compatibility field; currently has no effect | `Object` | — | `undefined` |
| `headerTag` | Compatibility field; currently has no effect | `String` | — | `undefined` |
| `headerClass` | Compatibility field; currently has no effect | `String` | — | `undefined` |
| `headerStyle` | Compatibility field; currently has no effect | `CSSProperties` | — | `undefined` |
| `footerTag` | Compatibility field; currently has no effect | `String` | — | `undefined` |
| `footerClass` | Compatibility field; currently has no effect | `String` | — | `undefined` |
| `footerStyle` | Compatibility field; currently has no effect | `CSSProperties` | — | `undefined` |
| `options` | List of selectable options | `SelectOption[]` | — | `[]` |
| `itemOptions` | Configure list properties and events together; event names accept kebab-case or camelCase | `Record` | — | `{}` |
| `tag` | Custom rendering tag; div or custom-select-dropdown displays an inline list | `string \| Component` | — | `'el-select'` |
| `selectAll` | Show select-all control | `boolean` | — | `false` |
| `selectAllText` | Select-all label | `string` | — | `Locale configuration` |
| `clearable` | Show the clear selection control | `boolean` | — | `true` |
| `reserveKeyword` | Keep the search keyword after selection | `boolean` | — | `true` |
| `filterable` | Enable searching | `boolean` | — | `true` |
| `filterMethod` | Custom filtering function | `(query: string) => void \| Promise` | — | `undefined` |
| `remote` | Use remote filtering | `boolean` | — | `false` |
| `loading` | Loading state | `boolean` | — | `false` |
| `defaultFirstOption` | Select the first match on Enter | `boolean` | — | `false` |
| `allowCreate` | Allow new options; requires filterable | `boolean` | — | `false` |
| `automaticDropdown` | Open non-filterable select on focus | `boolean` | — | `false` |
| `name` | Native input name | `string` | — | `undefined` |
| `keywordHighlight` | Highlight search keyword | `boolean` | — | `true` |
| `keywordLabelAlias` | Compatibility field; highlighting uses text nodes, without HTML injection | `string` | — | `'keywordHighlightLabel'` |
| `echoValueTop` | Move selected rows to top in virtual list | `boolean` | — | `true` |
| `width` | Selector width | `string` | — | `'100%'` |
| `maxWidth` | Maximum selector width | `string` | — | `undefined` |
| `height` | Scrollable list height | `string` | — | `'245px'` |
| `extraProps` | Extra props passed to custom option component | `Record` | — | `undefined` |
| `headeClass` | Compatibility field; currently has no effect | `string` | — | `undefined` |
| `beforeVisibleChange` | Post-visibility hook; return break to skip subsequent internal handling | `(visible: boolean) => void \| "break" \| "discard-cache" \| Promise` | — | `undefined` |
| `placement` | Dropdown placement | `SelectProps["placement"]` | — | `undefined` |
| `request` | Paginated request returning records and total record count; parameters and context below | `LazySelectRequest` | — | `undefined` |
| `initList` | Load initially; false defers loading until focus | `boolean` | — | `true` |
| `initListAssigmentValue` | Compatibility prop; initial data does not overwrite the bound value | `boolean` | — | `false` |
| `visibleChangeKeywordCached` | Preserve keyword across closing and reopening | `boolean` | — | `false` |
| `visibleChangeSelectListCached` | Preserve searched list across closing and reopening | `boolean` | — | `false` |
request(params, context) accepts a synchronous result or Promise. params uses the aliases above for page, page size and keyword; initial echo also includes selected values (including 0 / false). context.data is the normalized list, originData the raw records and allCachedDataList the instance cache. Return total as record count, not page count. In fetch-data, current is the current page; records is the raw response, data the accumulated normalized list and originData the accumulated raw list.
```ts
type RequestParams = Record
interface RequestContext {
data: SelectOption[]
originData: SelectOption[]
allCachedDataList: SelectOption[]
}
type RequestResult = { records: SelectOption[]; total: number }
type LazySelectRequest = (params: RequestParams, context: RequestContext) => RequestResult | Promise
interface FetchCallBackData {
total: number
current: number
hasMore: boolean
keyword: string
records: SelectOption[]
data: SelectOption[]
originData: SelectOption[]
allCachedDataList: SelectOption[]
}
```
## Events {#events}
| Event | Description | Arguments |
| --- | --- | --- |
| `update:modelValue` | Selection changed; update v-model | `(value: SelectModelValue)` |
| `update:value` | Selection changed; compatibility event | `(value: SelectModelValue)` |
| `input` | Selection changed; compatibility event | `(value: SelectModelValue)` |
| `change` | Fires when selection changes | `(value: SelectModelValue)` |
| `focus` | Input gains focus | `(event: FocusEvent)` |
| `blur` | Input loses focus | `(event: FocusEvent)` |
| `clear` | Clear control activated | `()` |
| `remove-tag` | Tag removed in multiple mode | `(value: SelectValue)` |
| `visible-change` | Dropdown shown: true; hidden: false | `(visible: boolean)` |
| `select-item` | Option clicked; returns its value | `(value: SelectValue)` |
| `scroll` | List scroll; Event only, without the old range argument | `(event: Event)` |
| `totop` | List reaches top threshold | `(event?: Event)` |
| `tobottom` | List reaches bottom threshold | `(event?: Event)` |
| `resized` | List viewport measurement | `(id: string \| number, size: number)` |
| `fetch-data` | After each successful request | `(data: FetchCallBackData)` |
| `fetch-error` | Request failed | `(error: unknown)` |
| `get-selected-data` | Selection data; emitSelectedItemOnClick chooses values or full records | `(valueOrRows: SelectModelValue \| SelectOption \| (SelectOption \| undefined)[])` |
## Slots {#slots}
| Slot | Description | Scope |
| --- | --- | --- |
| `default` | Below regular/inline list; use footer for virtual dropdown | — |
| `option` | Custom option content | `{ row: SelectOption, item: SelectOption, index: number }` |
| `header` | List header | — |
| `footer` | List footer | — |
| `prefix` | Input prefix | — |
| `empty` | Empty option list content | — |
| `loading` | Custom loading state | — |
| `tag` | Custom selected tags | `Element Plus tag slot props` |
## Exposed methods and state {#methods}
- `currentVal`
- `nfLazySelect`
- `hasMore`
- `keyword`
- `totalPage`
- `pageNo`
- `loading`
- `focusThrough`
- `initListFetch()`
- `focusFetchHandler(init?, forceRequest?)`
- `fetchHandler(params?, restart?, forceRequest?)`
- `clearHandler()`
- `handleSearch(keyword, matchKeywords?)`
- `visibleChange(boolean)`
- `cachedKeyword()`
- `loadMore()`
- `visibleIntersect`
- `allCachedDataList`
- `allCachedDataMap`
- `data`
- `originData`
- `open()`
## Migration notes {#migration}
Vue 3 uses `modelValue` / `update:modelValue`; legacy `value`, `update:value` and `input` remain available on selection components. The implementation uses public Element Plus APIs, not Element UI internals. `mini` maps to `small`; `medium` maps to `default`.
`request(params, context)` returns `{ records, total }`. Stale requests cannot overwrite the current search. `fetch-error` reports failures; retry the same page. `allCachedDataMap` / `dataMap` are typed Maps.
---
# nf-popup-lazy-select {#popup-lazy-select}
Popover-hosted asynchronous select with a custom trigger, optional assignment, close-on-select, selected object callbacks and manual visibility control.
## Examples {#examples}
### Multiple / single / close / assign {#example-1}
### Multiple / single / close / assign
```vue
{{ test1 }}
{{ selectItemValue1 }}
Add variable
Above: multiple, reversible, all selected items highlighted Below: single selection
{{ test2 }}
{{ selectItemValue2 }}
Add variable
Above: single selection closes the popupBelow: single selection keeps the popup open
{{ test3 }}
{{ selectItemValue3 }}
Add variable
Above: keep open and assign the last selected value Below: keep open and emit without assigning
{{ test4 }}
{{ selectItemValue4 }}
Add variable
```
### Echo {#example-2}
### Echo
```vue
{{ test6 }}
{{ selectItemValue6 }}
Add variable
Above: single selectionBelow: multiple selection
{{ test5 }}
{{ selectItemValue5 }}
Add variable
```
## Props {#props}
Descriptions preserve common-ui semantics; defaults and signatures follow the current Vue 3 implementation. Compatibility props do not enable unsupported legacy rendering.
| Attribute | Description | Type | Values | Default |
| --- | --- | --- | --- | --- |
| `modelValue / v-model (value)` | Bound value; value remains compatible; prefer v-model in Vue 3 | `SelectModelValue` | — | `undefined` |
| `tag` | Custom rendering tag; div or custom-select-dropdown displays an inline list | `string \| Component` | — | `'custom-select-dropdown'` |
| `popdownOnSelect` | Close popup on selection in single mode | `boolean` | — | `false` |
| `assignmentOnSelect` | Update bound value on selection; false still reports clicked item | `boolean` | — | `true` |
| `emitSelectedItemOnClick` | get-selected-data returns values by default; true returns full records | `boolean` | — | `false` |
| `visibleChangeKeywordCached` | Preserve keyword across closing and reopening | `boolean` | — | `true` |
| `visibleChangeSelectListCached` | Preserve searched list across closing and reopening | `boolean` | — | `true` |
| `keyValue` | Fields used for option label and value | `[string, string]` | — | `['label', 'value']` |
| `virtualList` | Enable virtual scrolling | `boolean` | — | `false` |
| `dataKey` | Unique virtual row key: field name or function | `string \| ((row: SelectOption) => string \| number)` | — | `'templateId'` |
| `itemOptions` | Configure list properties and events together; event names accept kebab-case or camelCase | `Record` | — | `{}` |
| `dataComponent` | Custom option component receiving source, index and extraProps | `Component` | — | `undefined` |
| `estimateSize` | Estimated row height in px | `number` | — | `34` |
| `keeps` | Minimum inline virtual window; dropdown virtualization is managed by SelectV2 | `number` | — | `30` |
| `request` | Paginated request returning records and total record count; parameters and context below | `LazySelectRequest` | — | `undefined` |
| `initList` | Load initially; false defers loading until focus | `boolean` | — | `true` |
| `pageSize` | Number of records per request | `number` | — | `10` |
| `keywordAlias` | Request field for search keyword | `string` | — | `'keyword'` |
| `pageNoAlias` | Request field for page number | `string` | — | `'pageNo'` |
| `pageSizeAlias` | Request field for page size | `string` | — | `'pageSize'` |
| `valueAlias` | Initial request field for selected values | `string` | — | `'value'` |
| `loadingDesc` | Loading message | `string` | — | `Locale configuration` |
| `height` | Scrollable list height | `string` | — | `'245px'` |
| `width` | Selector width | `string` | — | `'100%'` |
| `maxWidth` | Maximum selector width | `string` | — | `undefined` |
| `showTip` | Show option tooltip | `boolean` | — | `true` |
| `multiple` | Enable multiple selection | `boolean` | — | `false` |
| `disabled` | Disable interaction | `boolean` | — | `Inherited configuration` |
| `size` | Input size; mini / medium map to small / default | `SelectSize` | `small / default / large / mini / medium` | `'mini'` |
| `collapseTags` | Collapse selected tags in multiple mode | `boolean` | — | `multiple` |
| `multipleLimit` | Maximum selected items; 0 means unlimited | `number` | — | `0` |
| `placeholder` | Input placeholder | `string` | — | `Locale configuration` |
| `noDataText` | Empty list text; can use the empty slot | `string` | — | `Locale configuration` |
| `popperClass` | Dropdown CSS class | `string` | — | `undefined` |
| `start` | Initial inline scroll index | `number` | — | `0` |
| `offset` | Initial inline scroll offset in px | `number` | — | `0` |
| `direction` | Compatibility field; currently has no effect | `String` | `vertical` | `undefined` |
| `pageMode` | Compatibility field; currently has no effect | `boolean` | — | `undefined` |
| `topThreshold` | Top threshold for totop; may fire repeatedly | `number` | — | `0` |
| `bottomThreshold` | Bottom threshold for tobottom; may fire repeatedly | `number` | — | `0` |
| `rootTag` | Inline list root tag | `String` | — | `'div'` |
| `wrapTag` | Inline list wrapper tag | `String` | — | `'div'` |
| `wrapClass` | Compatibility field; currently has no effect | `String` | — | `undefined` |
| `wrapStyle` | Inline list wrapper style | `CSSProperties` | — | `undefined` |
| `itemTag` | Inline row wrapper tag | `String` | — | `'div'` |
| `itemClass` | Inline row CSS class | `String` | — | `undefined` |
| `itemClassAdd` | Extra row class function (index, row) | `(index: number, row: SelectOption) => string` | — | `undefined` |
| `itemStyle` | Inline row style | `CSSProperties` | — | `undefined` |
| `itemScopedSlots` | Compatibility field; currently has no effect | `Object` | — | `undefined` |
| `headerTag` | Compatibility field; currently has no effect | `String` | — | `undefined` |
| `headerClass` | Compatibility field; currently has no effect | `String` | — | `undefined` |
| `headerStyle` | Compatibility field; currently has no effect | `CSSProperties` | — | `undefined` |
| `footerTag` | Compatibility field; currently has no effect | `String` | — | `undefined` |
| `footerClass` | Compatibility field; currently has no effect | `String` | — | `undefined` |
| `footerStyle` | Compatibility field; currently has no effect | `CSSProperties` | — | `undefined` |
| `options` | List of selectable options | `SelectOption[]` | — | `[]` |
| `selectAll` | Show select-all control | `boolean` | — | `false` |
| `selectAllText` | Select-all label | `string` | — | `Locale configuration` |
| `clearable` | Show the clear selection control | `boolean` | — | `true` |
| `reserveKeyword` | Keep the search keyword after selection | `boolean` | — | `true` |
| `filterable` | Enable searching | `boolean` | — | `true` |
| `filterMethod` | Custom filtering function | `(query: string) => void \| Promise` | — | `undefined` |
| `remote` | Use remote filtering | `boolean` | — | `false` |
| `loading` | Loading state | `boolean` | — | `false` |
| `popperAppendToBody` | Teleport dropdown to body; maps to Element Plus teleported | `boolean` | — | `true` |
| `defaultFirstOption` | Select the first match on Enter | `boolean` | — | `false` |
| `allowCreate` | Allow new options; requires filterable | `boolean` | — | `false` |
| `automaticDropdown` | Open non-filterable select on focus | `boolean` | — | `false` |
| `name` | Native input name | `string` | — | `undefined` |
| `keywordHighlight` | Highlight search keyword | `boolean` | — | `true` |
| `keywordLabelAlias` | Compatibility field; highlighting uses text nodes, without HTML injection | `string` | — | `'keywordHighlightLabel'` |
| `echoValueTop` | Move selected rows to top in virtual list | `boolean` | — | `true` |
| `extraProps` | Extra props passed to custom option component | `Record` | — | `undefined` |
| `headeClass` | Compatibility field; currently has no effect | `string` | — | `undefined` |
| `beforeVisibleChange` | Post-visibility hook; return break to skip subsequent internal handling | `(visible: boolean) => void \| "break" \| "discard-cache" \| Promise` | — | `undefined` |
| `placement` | Dropdown placement | `SelectProps["placement"]` | — | `undefined` |
| `initListAssigmentValue` | Compatibility prop; initial data does not overwrite the bound value | `boolean` | — | `false` |
| `noDataImg` | Show NfEmpty when no data | `boolean` | — | `false` |
| `allowEmptySearch` | Allow requests with an empty keyword | `boolean` | — | `true` |
| `popupWidth` | Popup width | `number \| string` | — | `200` |
| `popupClass` | Popup CSS class | `string` | — | `undefined` |
| `popupTitle` | Popup title | `string` | — | `undefined` |
| `popupDisabled` | Disable popup | `boolean` | — | `false` |
| `popupOffset` | Popup offset | `number` | — | `0` |
| `popupPlacement` | Popup placement | `PopoverProps["placement"]` | — | `'bottom'` |
| `popupTrigger` | Popup trigger | `string` | `click / hover / focus / manual` | `'click'` |
| `popupTransition` | Popup transition name | `string` | — | `undefined` |
| `popupVisibleArrow` | Show popup arrow | `boolean` | — | `true` |
| `popupOptions` | Options passed to Popper | `object` | — | `undefined` |
| `popupOpenDelay` | Popup open delay in ms | `number` | — | `undefined` |
| `popupCloseDelay` | Popup close delay in ms | `number` | — | `200` |
| `popupTabindex` | Popup trigger tabindex | `number` | — | `0` |
request(params, context) accepts a synchronous result or Promise. params uses the aliases above for page, page size and keyword; initial echo also includes selected values (including 0 / false). context.data is the normalized list, originData the raw records and allCachedDataList the instance cache. Return total as record count, not page count. In fetch-data, current is the current page; records is the raw response, data the accumulated normalized list and originData the accumulated raw list.
```ts
type RequestParams = Record
interface RequestContext {
data: SelectOption[]
originData: SelectOption[]
allCachedDataList: SelectOption[]
}
type RequestResult = { records: SelectOption[]; total: number }
type LazySelectRequest = (params: RequestParams, context: RequestContext) => RequestResult | Promise
interface FetchCallBackData {
total: number
current: number
hasMore: boolean
keyword: string
records: SelectOption[]
data: SelectOption[]
originData: SelectOption[]
allCachedDataList: SelectOption[]
}
```
## Events {#events}
| Event | Description | Arguments |
| --- | --- | --- |
| `update:modelValue` | Selection changed; update v-model | `(value: SelectModelValue)` |
| `update:value` | Selection changed; compatibility event | `(value: SelectModelValue)` |
| `input` | Selection changed; compatibility event | `(value: SelectModelValue)` |
| `change` | Fires when selection changes | `(value: SelectModelValue)` |
| `focus` | Input gains focus | `(event: FocusEvent)` |
| `blur` | Input loses focus | `(event: FocusEvent)` |
| `clear` | Clear control activated | `()` |
| `remove-tag` | Tag removed in multiple mode | `(value: SelectValue)` |
| `visible-change` | Dropdown shown: true; hidden: false | `(visible: boolean)` |
| `select-item` | Option clicked; returns its value | `(value: SelectValue)` |
| `scroll` | List scroll; Event only, without the old range argument | `(event: Event)` |
| `totop` | List reaches top threshold | `(event?: Event)` |
| `tobottom` | List reaches bottom threshold | `(event?: Event)` |
| `resized` | List viewport measurement | `(id: string \| number, size: number)` |
| `fetch-data` | After each successful request | `(data: FetchCallBackData)` |
| `fetch-error` | Request failed | `(error: unknown)` |
| `get-selected-data` | Selection data; emitSelectedItemOnClick chooses values or full records | `(valueOrRows: SelectModelValue \| SelectOption \| (SelectOption \| undefined)[])` |
| `popup-show` | Popup starts showing; true | `(visible: true)` |
| `popup-hide` | Popup starts hiding; false | `(visible: false)` |
| `popup-after-enter` | Show transition finished; no arguments | `()` |
| `popup-after-leave` | Hide transition finished; no arguments | `()` |
## Slots {#slots}
| Slot | Description | Scope |
| --- | --- | --- |
| `default` | Popup trigger/reference element | — |
| `option` | Custom option content | `{ row: SelectOption, item: SelectOption, index: number }` |
| `header` | List header | — |
| `footer` | List footer | — |
| `prefix` | Input prefix | — |
| `empty` | Empty option list content | — |
| `loading` | Custom loading state | — |
| `tag` | Custom selected tags | `Element Plus tag slot props` |
## Exposed methods and state {#methods}
- `currentVal`
- `popup`
- `popLazySelectRef`
- `dataList`
- `dataMap`
- `allCachedDataList`
## Migration notes {#migration}
Vue 3 uses `modelValue` / `update:modelValue`; legacy `value`, `update:value` and `input` remain available on selection components. The implementation uses public Element Plus APIs, not Element UI internals. `mini` maps to `small`; `medium` maps to `default`.
`request(params, context)` returns `{ records, total }`. Stale requests cannot overwrite the current search. `fetch-error` reports failures; retry the same page. `allCachedDataMap` / `dataMap` are typed Maps.
---
# nf-softphone {#softphone}
Integrates the shared 94AI online web softphone microfrontend through qiankun or wujie. Features include outgoing and incoming calls, transfer to an agent, answering, ignoring, hanging up, breaks, network diagnostics, muting, real-time volume tracking, agent sign-in/sign-out, chat text retrieval, and agent monitoring log reporting. Action dispatch and callback notifications integrate the common softphone capabilities currently available. `NfSoftphone` is an SFC for MVVM applications. Use the default `nfSoftphone` instance for a single phone, or construct multiple instances with `new nfSoftphoneManager()`. The `name` property isolates the microfrontend applications.
## Exports {#exports}
```ts
import NfSoftphone, { nfSoftphone, nfSoftphoneManager, createSoftphoneSign, createSoftphoneAccessToken, createSoftphoneToken, installSoftphoneCryptoJS, SOFTPHONE_CRYPTO_JS_CDN_URL, waitForSoftphoneRender } from '@94ai-plus/nf-softphone'
import type {
SoftphoneAccessToken,
SoftphoneAccessTokenResult,
SoftphoneAccessTokenOptions,
SoftphoneTokenOptions,
SoftphoneEnv,
SoftphoneMode,
SoftphoneSignDone,
SoftphonePayload,
SoftphoneMessageType,
SoftphoneEnvironment,
SoftphoneSign,
SoftphoneCryptoJS,
SoftphoneSignOptions,
SoftphoneState,
SoftphoneShared,
SoftphoneConnection,
SoftphoneMountConfig,
SoftphoneRuntime,
SoftphoneProps,
SoftphoneCallbacks,
SoftphoneOptions,
NfSoftphoneComponent
} from '@94ai-plus/nf-softphone'
import '@94ai-plus/nf-softphone/style.css'
```
## Debug signatures {#debug-signature}
```ts
import { createSoftphoneSign } from '@94ai-plus/nf-softphone'
const appKey = 'xxx'
const appSecret = 'xxx'
const signedAt = Date.now()
const nextSign = await createSoftphoneSign(appKey, signedAt, appSecret, {
// env: 'sg',
// cryptoJsUrl: '',
})
```
| Signature options | CryptoJS script URL |
| --- | --- |
| `env: 'sg'` | `https://seat.teleai.com/CryptoJS.js` |
| Default/`dev`/`test`/`gray`/`prod` | `https://seat.94ai.com/CryptoJS.js` |
| `cryptoJsUrl` | Custom script URL; overrides the default URL selected by `env` |
```ts
import { installSoftphoneCryptoJS } from '@94ai-plus/nf-softphone'
const appKey = 'xxx'
const timestamp = Date.now()
const appSecret = 'xxx'
const CryptoJS = await installSoftphoneCryptoJS({
// env: 'sg',
// cryptoJsUrl: '',
})
// CryptoJS === window.CryptoJS // Expose window.CryptoJS for signature debugging
const sha1 = CryptoJS.HmacSHA1(appKey + timestamp, appSecret)
sign.value = CryptoJS.enc.Base64.stringify(sha1)
```
## General integration {#general-integration}
Examples pass `lang="en"` to the phone bar. Other documentation languages use `zh`, `ja`, `es`, `id`, `th`, `tl`, or `pt`. Switching the documentation language destroys and remounts the example with the new language; it is not a seamless language change during a call. Loading and phone content share one area: an opaque loading layer covers rendering content until detection completes, then reveals it at once. The mount container stays measurable, with no fixed delay.
Online examples render an unconnected preview phone bar by default without embedded secrets. Enter test `appKey`, `appSecret`, and `agentTag` values in the editor to generate credentials and load the live phone bar.
### Async setup {#async-setup}
The `loading` slot appears while the microfrontend loads. Its default “Loading...” text follows the component-library locale. It disappears only after visible phone-bar content renders and browser paint frames complete, not merely after mounting; it does not wait for agent sign-in. qiankun containers and Wujie Shadow DOM / accessible same-origin iframes are supported. Loading failures or no visible content within 30 seconds after mounting show the `error` slot. Retrying shows loading again.
### Async setup requires a parent . Generate production signatures on your backend; do not keep secrets in frontend code. Shows an unconnected preview by default; fill in appKey, appSecret, and agentTag to load.
```vue
Phone loading failed: {{ error.message }}
```
### Async onMounted {#async-on-mounted}
Disable automatic startup and obtain the signature asynchronously after mounting. Use `nextTick()` to synchronize the signature and timestamp to child props before calling `initSoftphone()`. Component unmount automatically destroys the phone, and a late signature response will not initialize it again. The component ref’s `initSoftphone()` waits for rendering detection to finish.
### Without async setup, use :auto-start="false". Generate production signatures on your backend; do not keep secrets in frontend code. Shows an unconnected preview by default; fill in appKey, appSecret, and agentTag to load.
```vue
```
### Overseas environment {#overseas-environment}
Domestic and overseas accounts are separate. To use the overseas environment, set `env="sg"`, `sg-open="1"`, `sg-domain="1"`, `sg-base="1"`, and `sg-gateway="1"`. Pass `{ env: 'sg' }` when generating the signature as well.
### Overseas environment. Generate production signatures on your backend; do not keep secrets in frontend code. Shows an unconnected preview by default; fill in appKey, appSecret, and agentTag to load.
```vue
```
### accessToken authorization {#access-token-authorization}
Use `accessToken` instead of `sign` to authorize and load the phone bar. This example obtains an overseas token with `createSoftphoneAccessToken(appKey, appSecret, { env: 'sg' })`. It renders an unconnected preview bar by default; enter test `appKey`, `appSecret`, and `agentTag` values in the editor to fetch a token and load the live phone bar. Initial loading and renewal both call this helper, without loading the softphone SDK.
### accessToken authorization: fetch credentials after mounting, start manually, and renew through createSoftphoneAccessToken. In production, generate accessToken on your backend and keep secrets out of frontend code. Shows an unconnected preview by default; fill in appKey, appSecret, and agentTag to load.
```vue
```
## Custom runtime {#custom-runtime}
This example uses an offline simulated runtime to demonstrate action dispatch and callback notifications. It neither loads a real microfrontend nor places calls. `runtime` replaces the built-in qiankun / wujie loader. For a real phone bar, remove `:runtime="runtime"` and provide valid agent information and a signature. The runtime customizes loading, communication, and unmounting.
### Intercept dispatched actions and invoke notification callbacks manually
```vue
events = 'Connected: ' + data.status"
@softphone-hangup="events = 'Hang up'"
@error="error => events = error.message"
/>
ConnectDisconnectHang up
```
## Library integration (factory) {#factory-integration}
`loading` starts when signature retrieval begins. `phone.ready` only signals that the microfrontend mounted; then call `waitForSoftphoneRender(host)` and wait for visible phone-bar content before ending loading. It shares detection logic with `NfSoftphone`, defaults to a 30-second timeout, accepts a custom timeout in milliseconds as its second argument, and returns `{ ready, cancel }`. Call `cancel()` on unmount to stop detection if the page disappears before the phone renders. Calling it after completion has no further effect. Do not hide the container with `v-if` / `v-show` during loading, or mounting and visible-content detection cannot work.
### Manager integration. Generate production signatures on your backend; do not keep secrets in frontend code. Shows an unconnected preview by default; fill in appKey, appSecret, and agentTag to load.
```vue
Loading...
Sign inSign outHang up
Phone loading failed: {{ error }}
```
## Library integration (singleton) {#singleton-integration}
For multiple phones, use the constructor with unique `name`, `ancestorOrigin`, and `destinationOrigin` values. The singleton mounts only one phone bar. Ordinary prop updates synchronize shared configuration. Destroy the instance before changing mode, URL, environment, name, or communication namespaces.
### Singleton integration. Generate production signatures on your backend; do not keep secrets in frontend code. Shows an unconnected preview by default; fill in appKey, appSecret, and agentTag to load.
```vue
Loading...
Sign inSign outHang up
Phone loading failed: {{ error }}
```
## Credential helpers {#credential-helpers}
Use these helpers for local integration debugging. Production secrets and credential generation belong on your backend.
| API | Result |
| --- | --- |
| `createSoftphoneAccessToken(appKey, appSecret, options?)` | Returns an OpenAPI access token and the millisecond timestamp used for its request. |
| `createSoftphoneToken(appKey, appSecret, options)` | Returns an agent-system token string, distinct from OpenAPI accessToken. |
Both helpers accept `env`, `cryptoJsUrl`, and `signal` for cancellation; requests time out after 15 seconds. `createSoftphoneAccessToken` also accepts `openGatewayUrl` and `accessTokenTimestamp`. `createSoftphoneToken` accepts `agentId` / `agentTag`, `openGatewayUrl`, and `openBaseUrl`; agentId takes priority, while agentTag triggers an agent-ID lookup. Use `env: 'sg'` overseas; other environments default to domestic gateways.
| env | openGatewayUrl | openBaseUrl |
| --- | --- | --- |
| default / dev / test / gray / prod | `https://seat.94ai.com/openapigateway` | `https://seat.94ai.com/openapi` |
| sg | `https://seat.teleai.com/teleaiopenapigateway` | `https://seat.teleai.com/teleaiopenapi` |
```ts
import { createSoftphoneAccessToken, createSoftphoneToken } from '@94ai-plus/nf-softphone'
const credentials = await createSoftphoneAccessToken(appKey, appSecret, { env: 'sg' })
const token = await createSoftphoneToken(appKey, appSecret, { env: 'sg', agentId })
const tokenByTag = await createSoftphoneToken(appKey, appSecret, { env: 'sg', agentTag })
```
## Props {#props}
| Prop / option | Type | Default / meaning |
| --- | --- | --- |
| mode | `'qiankun' \| 'wujie'` | `qiankun` |
| env / envMap | `SoftphoneEnv` / `Partial>` | Defaults to `prod`; supports `dev` / `test` / `sg` / `gray` / `prod` |
| url | string | Optional HTTP(S) microfrontend entry override; query parameters are preserved |
| name | string | The component generates a unique name; the manager defaults to `nf-microphone` |
| origin | string | The previous-source identifier of an action notification, used to isolate communication namespaces when multiple qiankun / wujie instances share one bus. For manually triggered instance actions, filter self-notifications and accept only notifications from the phone on the shared bus. Defaults to `ai-softphone`. The legacy iframe approach isolates DOM / communication through different iframe `contentWindow` objects and may omit this option; this package only provides qiankun / wujie integration, not the legacy iframe mode. |
| ancestorOrigin | string | The original-source identifier of an action notification, used for multi-instance namespace isolation. Only respond to phone notifications caused by this instance’s manual actions; filter notifications caused by other instances on the shared bus. The manager defaults to `nf-softphone`; the Vue component derives a unique namespace from `name` when not explicitly configured. |
| destinationOrigin | string | The designated responding-source identifier for multi-instance namespace isolation. When notifications across instances share the same `origin` and `ancestorOrigin` (for example, remote applications using `ai-softphone`), only the designated instance responds. The manager defaults to `*`, a wildcard destination identifier; the Vue component derives a namespace from `name` unless explicitly configured. |
| agentId / agentTag / appKey / appSecret | string | Business credentials; prefer backend-issued signatures and do not retain `appSecret` in frontend code |
| sign / timestamp | `string`/`string` or `number` | Use Vue `v-model:sign` / `v-model:timestamp` for two-way binding |
| accessToken / accessTokenTimestamp | `string` / `string` / `number` | Server-issued access token and optional timestamp, forwarded through `shared.getUserInfo()`. Supports `v-model:accessToken` / `v-model:accessTokenTimestamp`. The `softphone-access-token-overdued` event receives `done({ accessToken, accessTokenTimestamp })`; managers use `softphoneAccessTokenOverduedCallBack`. `shared.setUserInfo()` and renewal emit the corresponding `update:*` events. |
| extStatus | string | Defaults to `1` for online; other values indicate a break. Control this externally to keep state transitions consistent |
| callShow / transferToLaborShow / restShow / networkDetectShow / muteShow / logShow / timingShow / signShow | `'0' \| '1'` | Defaults to `1`; `0` hides the corresponding outgoing-call, transfer-to-agent, break, network-diagnostics, mute, call-history, accumulated-status-time, or sign-in/sign-out control |
| lang | string | Defaults to `zh`; supports `id`, `es`, `ja`, `en`, `zh`, `pt`, `th`, `tl` |
| extensionInfo | object | Extension information including `status`, `wsRegisterAddress`, `wsProtocol`, and `accountCode` |
| extPassword / extensionNumber / wsRegisterAddress / wsProtocol | string | Extension configuration |
| isOem | boolean | Enable the OEM theme; defaults to `true` |
| numberKeyBoard | boolean | Enable the number keypad; defaults to `true` |
| accessMode | `'mobile'` or `'pc'` | Mobile / PC mode; defaults to `pc` |
| sipHeaders | string[] | Additional custom SIP communication headers; unset by default |
| open | string | openapi / normal mode: `0` selects normal and `1` selects open. Legacy docs listed `0`; the current manager defaults to `1` and passes it to the remote app through shared configuration. |
| sgGateway | string | Gateway API URL / request prefix: `0` selects domestic production, `1` overseas production; a domain / HTTP(S) URL supplies a custom gateway API. Unset by default. Legacy behavior followed `env` when omitted; the current implementation uses domestic services when omitted and does not follow `env`. Overseas integrations must explicitly pass `1` or a custom URL. |
| sgBase | string | Base API URL / request prefix: `0` selects domestic production, `1` overseas production; a domain / HTTP(S) URL supplies a custom base API. Unset by default. Legacy behavior followed `env` when omitted; the current implementation uses domestic services when omitted and does not follow `env`. Overseas integrations must explicitly pass `1` or a custom URL. |
| sgOpen | string | Overseas softphone proxy selection: `0` domestic production, `1` overseas production; omission uses domestic production. A domain / HTTP(S) URL supplies a custom hosting proxy. Unset by default. |
| sgDomain | string | Select the overseas proxy path for domestic or overseas phones: `0` domestic production, `1` overseas production; omission uses domestic production. Unset by default; currently selects `openapi` / `sgopenapi` respectively. |
| countryId | number | `0` indicates domestic operation by default; nonzero values use English hangup audio |
| getOfflineInfo | function | Custom offline detection. Agent sign-in synchronization may lag by 0–3 seconds; use this to determine precisely whether sign-in completed. Optional callback exposed to the remote app through `shared`; unset by default. |
| changeALittleRest | function | Custom break action. Optional callback exposed to the remote app through `shared`; unset by default. |
| quickCallWin | function | Custom quick-call action. Optional callback exposed to the remote app through `shared`; unset by default. |
| autoStart | boolean | Component only; defaults to `true`, loading the microfrontend on mount. With `:auto-start="false"`, loading starts only after manually calling `initSoftphone()`. |
| runtime | SoftphoneRuntime | Optional host runtime injection, replacing built-in microfrontend loading and communication; useful for offline demos |
| el | `string` or `HTMLElement` | Manager only; a valid mount container is required |
> **tip Tip**
`origin=ai-softphone && ancestorOrigin=ai-softphone && destinationOrigin=*` means that a notification caused by interaction within a phone-bar instance is dispatched for every instance to respond.
`origin=ai-softphone && ancestorOrigin=nf-softphone && destinationOrigin=xxx` means that a notification resulting from a manually triggered action by the instance identified as `nf-softphone` is dispatched to the instance identified as `xxx`.
## Events {#events}
| Component event | Library callback |
| --- | --- |
| `softphone-connect` | `softphoneConnectCallBack` |
| `softphone-call-refresh` | `softphoneCallRefreshCallBack` |
| `softphone-seats-status-change` | `softphoneSeatStatusChangeCallBack` |
| `softphone-accept` | `softphoneAcceptCallBack` |
| `softphone-ignore` | `softphoneIgnoreCallBack` |
| `softphone-hangup` | `softphoneHangupCallBack` |
| `softphone-session-state-change` | `softphoneSessionStateChangeCallBack` |
| `softphone-incoming` | `softphoneIncomingCallBack` |
| `softphone-send-dtmf` | `softphoneSendDtmfCallBack` |
| `softphone-connect-registered` | `softphoneConnectRegisteredCallBack` |
| `softphone-auto-ignore-callback` | `softphoneAutoIgnoreCallback` |
| `softphone-sign-overdued` | `softphoneSignOverduedCallBack` |
| `softphone-access-token-overdued` | `softphoneAccessTokenOverduedCallBack` |
> **tip Tip**
Regular notifications preserve the remote payload reference. `data.commonSoftphone` exposes the remote instance when provided by the online phone API. `softphone-sign-overdued` receives a `done({ sign, timestamp })` callback; stale callbacks after destruction do not send messages. `shared.setUserInfo()` and signature renewal synchronize `update:sign` / `update:timestamp`, even when the initial sign is empty. The component also emits `ready(manager)` and `error(error)`; the class exposes the `ready` Promise / `onError` for initialization results.
## Methods {#methods}
| Method | Description |
| --- | --- |
| initSoftphone(options?) | The manager returns itself; await `ready` before actions. The component method returns an initialization Promise |
| connect() / disconnect() | Sign in / sign out |
| seatsStatusChange(boolean) | Switch online / break state |
| accept() / ignore() / hangup() | Preserve existing remote command aliases: dispatch `connect` / `hangup` / `hangup` respectively |
| sendDtmf(data?) | Send transfer / DTMF command data |
| changeServerToRegister() | Switch the registration server |
| updateOptions(options) | Update the manager’s shared configuration |
| microCommunicat(type, data?, operationType?, ancestorOrigin?, destinationOrigin?) | Advanced manager API to dispatch commands to a designated communication namespace |
| destroy() / destory() | Asynchronous resource cleanup; the legacy spelling `destory()` remains a compatibility alias |
> **tip Tip**
The component ref exposes the manager and common actions. Do not reuse the same active name until `destroy()` completes. Correct the configuration and retry after initialization failures. The default slot adds content; the `error` slot receives `{ error }`; use the `loading` slot for custom loading UI. `phone.ready` only means the microfrontend mounted; actual rendering detection completes through `rendering.ready`.
```vue
Loading phone, please wait...
```
---
# nf-date-picker {#date-picker}
Half-year and week-range pickers complement the missing Element Plus date types. Use native `ElDatePicker` types `week`, `quarter`, `quarterrange`, `year`, and `yearrange` for the other periods.
## Examples {#examples}
###
```vue
{{ { half, halves, weeks } }}
```
## Values {#values}
A half-year value is January 1 or July 1. Half-year ranges contain two sorted half-year start dates. Week ranges use the date-range panel to select two dates and expand to the first day of the first week and the last day of the last week at local midnight. Selecting within one week returns the full week. The week start follows the Element Plus locale; `weekStartsOn` overrides normalization.
Values are `Date` or `Date[]` by default; `valueFormat` returns formatted strings. Clearing returns `null`. Half-years are panel-only; `disabledDate` checks their start dates. Week ranges disable entire weeks containing unavailable days. Native year/quarter panels have four columns; each half-year spans two columns of a four-column grid. Week calendars retain seven days.
## Attributes {#attributes}
| Attribute | Description | Default |
| --- | --- | --- |
| modelValue / v-model | Bound value: Date / string / number / Array / null | null |
| type | Picker type: halfyear / halfyearrange / weekrange | halfyear |
| size | Size: small / default / large | default |
| disabled | Disabled | false |
| clearable | Allow clearing | true |
| placeholder / startPlaceholder / endPlaceholder | Single/range placeholders | — |
| format / valueFormat | Display/bound-value format (Day.js) | — |
| disabledDate | Disabled-date predicate: (date: Date) => boolean | — |
| defaultValue | Initial panel date: Date / [Date, Date] | — |
| weekStartsOn | Week start (0=Sunday, 1=Monday, …6=Saturday) | Element Plus locale |
| teleported / popperClass | Teleport to body / additional popup class | true / — |
## Events {#events}
| Attribute | Description |
| --- | --- |
| update:modelValue / change | Value update / completed selection |
| calendar-change | Range selection progress: date array, null for an unselected endpoint |
| visible-change | Popup visibility |
| clear / focus / blur | Clear / focus / blur |
## Methods {#methods}
`focus()` / `blur()` / `handleOpen()` / `handleClose()`: Focus / blur / open / close the panel.
---
# nf-search-form {#search-form}
Configuration-driven search form with linked options, validation, query/export and field settings.
Field visibility and order use the `nf-search-form` object store in the `common-ui-plus` IndexedDB database, isolated by `storageKey`. Settings are restored asynchronously; save, clear and legacy `*Cookies*` synchronization methods support `await`. If IndexedDB is unavailable, only the current instance state is retained, without a localStorage fallback or automatic migration of old caches. The table’s embedded search form follows the same behavior, isolated by `searchFormStorageKey`.
```ts
import NfSearchForm from '@94ai-plus/nf-search-form'
import type { NfSearchFormItemOption, SearchFormInstance } from '@94ai-plus/nf-search-form'
import '@94ai-plus/nf-search-form/style.css'
```
## Complete usage showcase {#all-controls}
### Complete usage showcase
```vue
NotIn→
Switch block levelIncrease the number of foldsReduce the number of folds
Form item prefix upwardsForm item prefix to the right
Form item prefix leftform validationreset checksum
{{ JSON.stringify(searchForm, null, 2) }}
```
## Block / inline form layouts {#basic}
### Block / inline form layouts
```vue
The above operation buttonsblockmode(blockModal default buttons and custom buttonsslot independent line) The following action buttonsinlinemode (inlineModal default buttons and custom buttonsslot extra as lastform-itempackage)
No folds on top + (btn-model=inline) + (form=inline) + (labelPosition=left)
No folds on top + (btn-model=inline) + (form=inline) + (labelPosition=top)
There are folds on top + (btn-model=inline) + (form=inline) + (labelPosition=left)
There are folds on top + (btn-model=inline) + (form=inline) + (labelPosition=top)
No folds on top + (btn-model=inline) + (form=block) + (labelPosition=top/right) There are folds below + (btn-model=inline) + (form=block) + (labelPosition=top/right)
{{ JSON.stringify(searchForm, null, 2) }}
```
## NfSearchFormItemOption {#item-options}
| parameters | Description | Type |
| --- | --- | --- |
| prop | Field path, associated form data. | string |
| label | Field labels can be dynamically calculated based on form data. | string / Function |
| element / component | Built-in names or custom Vue 3 components. | string / Component |
| initValue | Field initial value. | unknown |
| options | Static options. | object[] |
| getOptions | Asynchronous option callback, done returns list; supports Promise. | (done, model) => void / Promise |
| changeProps | Dependent fields that are reloaded after the current value changes. | string[] |
| exchangeKey | Submit data conversion; type=1 splits the interval, type=2 splits the string. | { type: number; value: string / string[] } |
| show | Dynamic display; when false, the field is not rendered. | boolean / Function |
| hidden | Always shown but does not participate in collapse. | boolean |
| destroy / destory | Dynamically destroy fields, compatible with old spellings. | boolean / Function |
| initHidden | It is not displayed initially and can be restored in field settings. | boolean |
| slot / labelSlot / tooltip.slot | Field content, label, and prompt slot name. | string |
| inputSlot | Input box and slot mapping at both ends of the interval. | object |
| events | Input control event; change receives the current value, retained parameters, and form data. | object |
| rules / required | Field validation rules and required status. | object / boolean |
| width / labelWidth | Content and label width. | string / number |
| category | Group name in field settings. | string |
## Attribute {#props}
| parameters | Description | Type | Optional value | Default value |
| --- | --- | --- | --- | --- |
| formOptions | [json data] Rendering form frame data | NfSearchFormItemOption[] | — | [] |
| columns | Fold when the specified number of form items is exceeded; if not set, it will be detected based on the width of the container. | number | — | 3 |
| upIcon | [Collapse function] button expand icon | string | — | 'icon-xiangshang2' |
| downIcon | [Collapse function] Button to close icon | string | — | 'icon-xiangxia2' |
| showBtn | [Folding function] button is displayed and hidden, and the folding function can be turned on and off. | boolean | — | true |
| isCollapse | [Folding function] Initialize whether to expand or not | boolean | — | false |
| expandBtnIcon | Expand button icon | string | — | — |
| expandBtnType | Expand button type | string | — | default |
| expandBtnPlain | Expand button plain | boolean | — | false |
| expandBtnSize | Expand button size | string | mini/small/medium | — |
| expandBtnRound | Expand button round | boolean | — | false |
| expandBtnCircle | Expand buttoncircle | boolean | — | false |
| expandBtnLoading | Expand button loading | boolean | — | false |
| expandBtnDisabled | Expand buttondisabled | boolean | — | false |
| expandBtnTooltipDesc | Expand button tooltip description | string | — | Follow language pack |
| shrinkBtnTooltipDesc | Collapse button tooltip description | string | — | Follow language pack |
| defaultFormData | Initialize the form data object; Vue 3 two-way binding uses v-model. | object | — | {} |
| rules | [Form function] Verification rules | object | — | undefined |
| labelWidth | [Form function] The width of the form field label, such as '50px'. Form-item elements that are direct children of Form inherit this value. Support auto. | number / string | — | 150 |
| itemWidth | [Form function] Customize the width of each search form item content to achieve alignment of form items. If you need to make a separate custom width, just pass in the width for each item of form-options. | number | — | 227 |
| labelSuffix | [Form function] Suffix of field label | string | — | undefined |
| hideRequiredAsterisk | [Form function] Whether to hide the red asterisk next to the label of required fields | boolean | — | false |
| showMessage | [Form function] Whether to display verification error information | boolean | — | true |
| inlineMessage | [Form function] Whether to display verification information inline | boolean | — | false |
| statusIcon | [Form function] Whether to display the verification result feedback icon in the input box | boolean | — | false |
| validateOnRuleChange | [Form function] Whether to trigger a verification immediately after the rules attribute is changed | boolean | — | true |
| size | Form and button sizes; compatible with mini→small, medium→default. | string | mini/small/medium | 'mini' |
| disabled | [Form Function] Whether to disable all components in the form. If set to true, the disabled attribute on components within the form will no longer take effect. | boolean | — | false |
| btnModel | [Form function] Whether the operation button wraps | string | block/inline | 'block' |
| labelPosition | [Form function] Label position | string | — | 'top' |
| inline | 【Form function】Inline | boolean | — | true |
| btnBoxLabel | Customize the label of the button slot | string | — | '' |
| closable | Whether to display [Control form column item hidden icon], used to control hidden form column item | boolean | — | false |
| columnEdit | Whether to display the [Column Edit Button] to enable displaying and hiding form column items | boolean | — | false |
| checkMode | Set the interactive mode of the column editing function | string | dialog/drawer | 'drawer' |
| storageKey | The IndexedDB cache key set by the field; multiple instances of the same page should use independent keys. | string | - | nf-search-form-columns-cached-key-${routeName} |
| priority | Cache echo priority, handle the echo relationship between item.initHidden, form.showColumn and IndexedDB.cache | string | cached/value | 'cached' |
| showItems | [json data] A collection of rendered form column item prop attributes, used to initialize and control which form column items are displayed and hidden. [] will all be displayed, and can be used in conjunction with initHidden of columns. | string[] | — | undefined |
| checkBtnIcon | Column edit button icon | string | - | - |
| checkBtnType | Column edit button type | string | - | - |
| checkBtnPlain | Column edit button plain | boolean | - | true |
| checkBtnSize | Column edit button size | mini/small/medium | - | — |
| checkBtnRound | column edit button round | boolean | - | false |
| checkBtnCircle | Column edit button circle | boolean | - | false |
| checkBtnLoading | Column edit button loading | boolean | - | false |
| checkBtnDisabled | Column edit button disabled | boolean | - | false |
| checkBtnClass | Column edit button class | string | - | - |
| columnDisplayBtnText | Column edit button tooltip text | string | - | Follow language pack |
| moreDialogTitle | Column editing dialog/drawer mode->pop-up box title | string | — | Follow language pack |
| columnCheckCancelButtonText | Column edit dialog/drawer mode cancel button text | string | - | 'Cancel' |
| columnCheckConfirmButtonText | Column editing dialog/drawer mode determine button text | string | - | 'OK' |
| columnCheckBasicFieldDesc | Default category title | string | - | Follow language pack |
| columnCheckTabs | Column editing drawer mode->Control the data of rendering tabs | ITabItem[] | - | - |
| columnCheckCurrentTab | Column editing drawer mode -> currently displayed tab name | string | - | - |
| selectEmptyWarningTips | Set the warning prompt to clear all columns when editing columns. By default, hiding of all form column items is not allowed. | string | - | Please select at least one option |
| columnCheckSearchPlaceholder | Column editing drawer mode->search box placeholder | string | - | 'Search' |
| columnCheckFixedLeftDesc | Compatible fields; search form field settings do not provide fixed column functionality. | string | - | Follow language pack |
| columnCheckClearDesc | Column editing drawer mode -> clear description | string | - | Follow language pack |
| columnCheckNoFixedDesc | Compatible fields; search form field settings do not provide fixed column functionality. | string | - | Follow language pack |
| columnCheckGetCheckedLengthDesc | Column editing drawer mode->selected description | (length) => string | - | (length) => 'selected (' + length + ')' |
| columnCheckGetAllCheckDesc | Column editing drawer mode->select all description | (length) => string | - | (length) => 'Select all (' + length + ') |
| moreDialogWidth | Column editing dialog mode->pop-up box | string | — | '600px' |
| modalAppendToBody | Column editing dialog mode -> Whether the pop-up mask layer is inserted on the body element. If it is false, the mask layer will be inserted on the parent element of the Dialog. | boolean | — | true |
| modal | Column editing dialog mode->Does the pop-up box require a mask layer? | boolean | — | true |
| fullscreen | Column editing dialog mode -> Whether the pop-up box is a full-screen Dialog | boolean | — | false |
| top | Column editing dialog mode->margin-top value in pop-up dialog CSS | string | — | '15vh' |
| appendToBody | Column editing dialog mode -> Whether the pop-up Dialog itself is inserted into the body element. Nested Dialog must specify this attribute and set the value to true | boolean | — | false |
| lockScroll | Column editing dialog mode -> Whether the pop-up box locks the body scroll when the Dialog appears | boolean | — | true |
| customClass | Column editing dialog mode->Custom class name of pop-up Dialog | string | — | ' |
| closeOnlickModal | Column editing dialog mode -> Whether the pop-up box can close the Dialog by clicking modal | boolean | — | true |
| closeOnPressEscape | Column editing dialog mode -> Whether the pop-up box can close the Dialog by pressing ESC | boolean | — | true |
| showClose | Column editing dialog mode -> whether the pop-up box displays a close button | boolean | — | true |
| beforeClose | Column editing dialog mode -> callback before the pop-up box is closed, which will suspend the closing of the Dialog | Function | — | undefined |
| center | Column editing dialog mode -> Whether the pop-up box uses a centered layout for the head and bottom | boolean | — | false |
| destroyOnClose | Column editing dialog mode->Destroy the elements in the Dialog when the pop-up box is closed | boolean | — | false |
| btnItems | 【Default Button】Shows the default buttons | string[]/IBtnItems[] / 'search'、'export'、'reset'、'' | — | '' |
| reverseBtnSlot | [Default Button] Reverse the order of custom button slots and default buttons | boolean | — | false |
| exportBtnIcon | [Export button] icon | string | — | '' |
| exportBtnType | [Export button] type | string | — | 'primary' |
| exportBtnPlain | [Export button] Hollow out | boolean | — | true |
| exportBtnSize | [Export Button] Size | mini/small/medium | — | — |
| exportBtnRound | [Export button] Rounded corners | boolean | — | false |
| exportBtnCircle | [Export Button] Circle | boolean | — | false |
| exportBtnLoading | 【Export button】Loading | boolean | — | false |
| exportBtnDisabled | [Export button] disabled | boolean | — | false |
| exportBtnText | [Export button] text | string | — | Follow language pack |
| exportBtnClass | [Export button] class name | string | — | '' |
| queryBtnIcon | [Query button] icon | string | — | '' |
| queryBtnType | [Query Button] Type | string | — | 'primary' |
| queryBtnPlain | [Query Button] Hollow | boolean | — | true |
| queryBtnSize | 【Query Button】Dimensions | mini/small/medium | — | — |
| queryBtnRound | [Query Button] Rounded Corners | boolean | — | false |
| queryBtnCircle | [Query Button] Circle | boolean | — | false |
| queryBtnLoading | 【Query Button】Loading | boolean | — | false |
| queryBtnDisabled | [Query Button] Disabled | boolean | — | false |
| queryBtnText | 【Query Button】Text | string | — | Follow language pack |
| queryBtnClass | [Query button] Class name | string | — | '' |
| resetBtnIcon | [Reset button] icon | string | — | '' |
| resetBtnType | [Reset Button] Type | string | — | 'default' |
| resetBtnPlain | 【Reset Button】Skeleton | boolean | — | true |
| resetBtnSize | [Reset Button] Size | mini/small/medium | — | — |
| resetBtnRound | [Reset Button] Rounded corners | boolean | — | false |
| resetBtnCircle | [Reset Button] Round | boolean | — | false |
| resetBtnLoading | 【Reset Button】Loading | boolean | — | false |
| resetBtnDisabled | [Reset Button] Disabled | boolean | — | false |
| resetBtnText | [Reset button] text | string | — | Follow language pack |
| resetBtnClass | [Reset button] class name | string | — | '' |
| modelValue | Form data; use v-model two-way binding. | SearchFormModel | — | undefined |
| requiredValidate | Whether to verify before querying and exporting. | boolean | — | false |
| components | Extended form control mapping. | Record<string, Component> | — | undefined |
| viewIdentity | View or user configuration ID. | string | — | undefined |
| isMvc | Use external data schema. | boolean | — | false |
## Attribute IBtnItems {#button-options}
| parameters | Description | Type | Optional value | Default value |
| --- | --- | --- | --- | --- |
| btnType | [Button type] ('search', 'export', 'reset', '', undefined) | string | Optional | undefined |
| name | Button name | string | Optional | undefined |
| type | nf-button attribute | - | Optional | Attribute.queryBtnType |
| icon | nf-button attribute | - | Optional | Attribute.queryBtnIcon |
| plain | nf-button attribute | - | Optional | Attribute.queryBtnPlain |
| size | nf-button attribute | - | Optional | Attribute.size |
| round | nf-button attribute | - | Optional | Attribute.queryBtnRound |
| circle | nf-button attribute | - | Optional | Attribute.queryBtnCircle |
| loading | nf-button attribute | - | Optional | Attribute.queryBtnLoading |
| disabled | nf-button attribute | - | Optional | Attribute.queryBtnDisabled |
| class | className | string、object | Optional | undefined |
| validate | Whether to trigger the onClick event after verifying the form | boolean | Optional | false |
| onClick | click event | (formData: Current form data) => void | Optional | undefined |
| show | Whether to display | (formData: Current form data) => boolean | Optional | undefined |
## Event {#events}
| event name | Description | callback parameters |
| --- | --- | --- |
| open | Column editing dialog mode -> callback for popup opening | — |
| opened | Column editing dialog mode -> callback at the end of pop-up opening animation | — |
| close | Column editing dialog mode->callback for popup closing | — |
| closed | Column editing dialog mode -> callback at the end of the pop-up closing animation | — |
| changeTab | Column editing drawer mode->switch multiple drawer tabs | name |
| cancel | Column editing drawer mode -> close drawer | Event |
| onSearch | Fired when a query is clicked or a query method is called, and the data has been converted by exchangeKey. | (data, refresh: boolean) |
| onExport | Export callback, passing in the converted form data. | data: SearchFormModel |
| onResetFields | Fires after resetting the form. | — |
| onChange | Form data changes. | model: SearchFormModel |
| itemsChange | Field display list changes. | items: string[] |
| update:modelValue | for v-model. | model: SearchFormModel |
| update:showItems | for v-model:showItems. | items: string[] |
| isCollapseChange | The form expansion state changes; true means expansion. | expanded: boolean |
| options-error | Asynchronous options loading failed. | (error, prop: string) |
## Slot {#slots}
| Name | Description |
| --- | --- |
| btnBox | Compatible with ai-search-form extended operation button |
| dialogTitle | Column editing dialog mode->pop-up box title |
| dialogFooter | Column editing dialog mode->pop-up footer |
| columCheckTitle | Column editing drawer mode->pop-up title |
| columCheckFooter | Column editing drawer mode->pop-up footer |
| NfSearchFormItemOption.tooltip.slot | Customize the icon tooltip of each SearchFormItem |
| NfSearchFormItemOption.slot | Customize each SearchFormItem |
| NfSearchFormItemOption.inputSlot | Customize prepend/append/prefix/suffix and slots at both ends of the digital range. |
| NfSearchFormItemOption.labelSlot | Customize field labels. |
## Expose {#methods}
| Name | Type | Description |
| --- | --- | --- |
| localShowItems | string[] | Column props displayed by column editing |
| getFormData | Function | Get real-time data from the form (deep copy) |
| syncLocalShowColumnToCookies | Function | Column editing sync component to IndexedDB |
| syncCookiesToLocalShowColumn | Function | Column editor synchronizes IndexedDB to component localShowItems |
| syncShowItemToInitHidden | Function | showItems synchronizes props.formOptions[i].initHidden |
| hiddenNfSearchFormItemOptionField | Function | Column editing hides a form column |
| refreshNfSearchFormModel | Function | Refresh form data mode after column edit operation |
| renderSearchFormItemOptions | NfSearchFormItemOption[] | Render form items |
| resetNfSearchFormModel | Function | reset |
| onNfSearchFormValidate | Function | Verify |
| onNfSearchFormSearch | Function | Search |
| onNfSearchFormExport | Function | Export |
| nfSearchFormModel | Record | form data |
| nfSearchFormRef | Ref | form ref |
| columnCheckNfDrawer | Ref | Column editor nf-drawer ref |
| configNfSearchItemVisibleDialog | Boolean | Column editing controls dialog/drawer display/hide |
| syncCookiesToTableColumn | Function | syncCookiesToLocalShowColumn |
| setNfSearchFormModel(model) | Function | Combine form values by field path. |
| clearColumnEditCached() | Function | Clear field settings cache. |
| clearDragCached() | Function | Clear drag cache. |
## Instructions for use {#configuration-notes}
Example headers, layout combinations and feature alignment common-ui. Quarterly, half-year, and weekly intervals are demonstrated through the components extension within the example and are not part of the current built-in controls; values are identified using year and period. The built-in controls use Vue 3 v-model, and the old virtual dropdown uses virtualList configuration.
---
# nf-table {#table}
Data table with search, pagination, column settings, renderers, action bars and virtual scrolling.
Table column settings and resized widths use IndexedDB (the `nf-table` object store in the `common-ui-plus` database), restored asynchronously without a localStorage fallback or automatic migration of old caches. Await `clearColumnEditCached()`, `clearDragCached()` and the legacy `*Cookies*` synchronization methods to wait for completion. If IndexedDB is unavailable, the current instance remains usable. Search form field settings use the `nf-search-form` object store in the same database.
```ts
import NfTable from '@94ai-plus/nf-table'
import type { NfTableColumnAttributes, TableSearchEvent } from '@94ai-plus/nf-table'
import '@94ai-plus/nf-table/style.css'
```
## Easy configuration {#example-1}
### Easy configuration
```vue
timestimesto
The parent container above has no height limitThe height limit of the parent container below
The parent container above has no height limitThe height limit of the parent container below
timestimesto
```
## Custom slots and fixed columns {#example-3}
### Custom slots and fixed columns
```vue
slotDisplay and hide custom table columns{state.search({data,callback:()=>{}});currentPage=1}" >
{{ row.operationName }} {{ row.viceOperationName }}
{{ name }}task completion rateSelect all on this page{{ name }}
CustomizedemptyslotCustomizedappend
When the window is very small, the operation column and selection column are fixed with horizontal dragging.Cooperate belownf-emptyUse
slotCustomizedappend
```
## Data with slots {#example-4}
### Data with slots
```vue
timestimesto
```
## Bordered table and nested headers {#example-5}
### Bordered table and nested headers
```vue
```
## Sorting and filtering {#example-6}
### Sorting and filtering
```vue
```
## Expandable rows and tree data {#example-7}
### Expandable rows and tree data
```vue
{{ row[field.prop] }}xxxxExpand row aboveThe tree form below
```
## Virtual table without pagination {#example-8}
### Virtual table without pagination
```vue
{selected=value.length;all=value.length===rows.length}">
value?table.toggleAllSelection():table.clearSelection()">AllSelected:{{ selected }}Print line information
50Article1500Article
```
## Fixed-right action column resizing and indicator bounds {#example-9}
### Fixed-right action column resizing and indicator bounds
```vue
```
## NfTableColumnAttributes {#column-options}
| parameters | Description | Type |
| --- | --- | --- |
| key | Unique identifier for the column; not set prop used as a fallback identifier. | string / number |
| prop | Column field path. | string |
| type | Select a column, ordinal column, or expand a column. | selection / index / expand |
| label | Column header, also returned by the function. | string / Function |
| attr | Element Plus TableColumn public properties. | ElTableColumnAttributes |
| slot | Cell named slot. | string |
| headerSlot | Header named slot. | string |
| singleHeadMutiColSlot | TableColumn slots are nested under a single table header. | string |
| children | Nested header column definitions. | NfTableColumnAttributes[] |
| render | Customize cells using Vue 3h or VNode. | (row, scope) => VNodeChild |
| labelTooltip / labelTooltipPlacement | Header prompts and location. | string |
| unit | Data unit suffix. | string |
| options / getOptions | Static or asynchronous enum mapping; option supports tagType. | array / Function |
| optionsEnum / optionsTag | Mapping of values to text, label types. | object |
| operationList | A function that operates on a button configuration or returns a configuration by row. | array / Function |
| operationSpan | Collapse when the number of action buttons exceeds the specified number; 0 by width. | number |
| initHidden | The initial hidden state of the column. | boolean |
| destroy / destory / show | Control column display by configuration. | boolean / Function |
| fit.tags | Tags involved in content width estimation. | string[] |
## Attribute {#props}
| parameters | Description | Type | Optional value | Default value |
| --- | --- | --- | --- | --- |
| data | Populate table data | Record<string, any>[] | — | [] |
| columns | Render table header json data | NfTableColumnAttributes[] | — | [] |
| searchFormAttrs | Form attributes, the same as nf-search-form Attributes attributes | NfSearchFormAttributes | — | {} |
| pageAttrs | Pagination properties. Omitting total uses front-end paging; passing total uses server-side paging, and the business party returns the current page data according to the request. | ElPaginationAttributes | — | {} |
| tableAttrs | Table attributes, transparent transmission Element Plus Table public properties. | ElTableAttributes | — | {} |
| searchFormEvents | Form events are consistent with nf-search-form component Events | Partial<Record<NfSearchFormEventKey, Function>> | — | {} |
| pageEvents | Pagination events are consistent with el-pagination component Events | Partial<Record<ElPaginationEventKey, Function>> | — | {} |
| tableEvents | Table events are consistent with el-table component Table Events | Partial<Record<ElTableEventKey, Function>> | — | {} |
| actionBarOptList | actionBar button renders json data | NfTableActionBtnAttributes[] | — | [] |
| operationPropKey | Data-driven rendering of cell operation buttons, the prop value of the specified cell is defined as the key of the button operation column | string | — | 'operation' |
| alwaysShowPage | Whether to always display pagination; virtual tables do not display pagination. | boolean | — | true |
| calHeight | The fixed window fills the screen (or fills the parent container) and the table automatically calculates the height, which is used to implement fixed-height content scrolling of a window table (content is limited to height and self-scrolling). This is a relatively good table interaction effect. | boolean | — | false |
| dragCached | Whether to cache column drag width, use IndexedDB. | boolean | — | true |
| dragIndicatorPaddingLeft | Fixed the minimum distance (px) between the right column drag indicator line and the left side | number | — | 120 |
| dragIndicatorPaddingRight | Fixed the minimum distance (px) between the right column drag indicator line and the right side | number | — | 120 |
| fixedRightDragEnabled | Whether to enable the custom drag handle fixed to the right operation column | boolean | — | false |
| emptyImageSize | Table empty data spatio-temporal component size | number | — | 145 |
| initSearchApi | Whether to automatically query during initialization; follow setEasyConf if not passed. | boolean | If you don’t pass it on, you will follow it.setEasyConf | undefined |
| pageChangeSearchApi | Whether paging changes are automatically queried; if not passed, follow setEasyConf. | boolean | If you don’t pass it on, you will follow it.setEasyConf | undefined |
| pageKeys | Fields used for pagination | string[] | - | ['pageNo', 'pageSize'] |
| setEasyConf | Enable simple configuration and provide initialization query, paging query, search layout and row-key default value. Explicit settings take precedence. | boolean | Please check | false |
| loadingFunction | | | | |
| loading | Table loading | boolean | — | false |
| target | Loading DOM nodes that need to be covered. A DOM object or string can be passed in; if a string is passed in, it will be passed into document.querySelector as a parameter to obtain the corresponding DOM node. | HTMLElement | — | undefined |
| body | Same as body modifier in v-loading directive | boolean | — | false |
| fullscreen | Same as fullscreen modifier in v-loading directive | boolean | — | false |
| lock | Same as the lock modifier in the v-loading directive | boolean | — | false |
| text | Loading Loading text displayed below the loading icon | string | — | undefined |
| spinner | Loading custom loading icon class name | string | — | undefined |
| background | Loading mask background color | string | — | undefined |
| customClass | Custom class name for Loading | string | — | undefined |
| columnEdit | Column editing function switch. | boolean | — | false |
| columnPosition | Column edit button position | string | free/embed | 'embed' |
| showColumn | Column editing initializes the table item field prop collection to be displayed. [] represents displaying all, and can be used in conjunction with initHidden of columns. | string[] | — | undefined |
| priority | Column editing cache echo priority, handles the echo relationship between item.initHidden, form.showColumn and IndexedDB.cache | string | cached/value | 'cached' |
| storageKey | The IndexedDB cache key set by the table column; multiple instances of the same page should use independent keys. | string | - | `nf-table-columns-cached-key-${routeName}` |
| searchFormStorageKey | Optional, the meaning is the same as storageKey. nfSearchForm sets the field cache key. You can also set storageKey in searchFormAttrs. | string | - | `nf-search-form-columns-cached-key-${routeName}` |
| checkMode | Optional, column editing interactive mode, default drawer (drawer/dialog) | string | dialog/drawer | 'drawer' |
| columnDisplayBtnClass | Column edit button class name | string | — | '' |
| columnDisplayBtnIcon | Column edit button icon | string | — | undefined |
| columnDisplayBtnType | Column edit button type | string | — | 'primary' |
| columnDisplayBtnPlain | Column edit button hollow | boolean | — | true |
| columnDisplayBtnSize | Column edit button size | string | — | 'mini' |
| columnDisplayBtnRound | Column edit button rounded corners | boolean | — | false |
| columnDisplayBtnCircle | Column edit button circle | boolean | — | false |
| columnDisplayBtnLoading | Column edit button Loading | boolean | — | false |
| columnDisplayBtnDisabled | Column edit button disabled | boolean | — | false |
| columnDisplayBtnText | Column edit button text | string | — | Follow language pack |
| columnCheckTitle | Column editing dialog/drawer mode->pop-up box title | string | - | Set display fields |
| columnCheckCancelButtonText | Column edit dialog/drawer mode cancel button text | string | - | 'Cancel' |
| columnCheckConfirmButtonText | Column editing dialog/drawer mode determine button text | string | - | 'OK' |
| columnCheckBasicFieldDesc | Default category title | string | - | Follow language pack |
| columnCheckWidth | Column editing dialog mode->pop-up box width | string | - | '600px' |
| columnCheckModalAppendToBody | Column editing dialog mode->pop-up mask layer appendToBody | boolean | - | true |
| columnCheckModal | Column editing dialog mode -> Whether the pop-up box displays the mask layer | boolean | - | true |
| columnCheckFullscreen | Column editing dialog mode -> whether the pop-up box is full screen | boolean | - | false |
| columnCheckTop | Column editing dialog mode->pop-up box Top | string | - | '15vh' |
| columnCheckAppendToBody | Column editing dialog mode->pop-up box appendToBody | boolean | - | false |
| columnCheckLockScroll | Column editing dialog mode->Pop-up LockScroll | boolean | - | true |
| columnCheckCustomClass | Column editing dialog mode->pop-up box CustomClass | string | - | '' |
| columnCheckCloseOnlickModal | Column editing dialog mode->pop-up box CloseOnlickModal | boolean | - | true |
| columnCheckCloseOnPressEscape | Column editing dialog mode->pop-up box CloseOnPressEscape | boolean | - | true |
| columnCheckShowClose | Column editing dialog mode->pop-up box title ShowClose | boolean | - | true |
| columnCheckBeforeClose | Column editing dialog mode->pop-up box beforeClose | Function | - | undefined |
| columnCheckCenter | Column editing dialog mode -> whether the pop-up box is centered | boolean | - | false |
| columnCheckDestroyOnClose | Column editing dialog mode -> popup box destruction whether to delete the sub-dom | boolean | - | false |
| columnCheckTabs | Column editing drawer mode->tab data | ITabItem[] | - | - |
| columnCheckCurrentTab | Column editing drawer mode->Currently displayed tab name | string | - | - |
| selectEmptyWarningTips | Prompt when the column editing setting field is not empty | string | - | Please select at least one option |
| columnCheckSearchPlaceholder | Column editing drawer mode->search box placeholder | string | - | 'Search' |
| columnCheckFixedLeftDesc | Column editing drawer mode -> fixed to left description | string | - | Follow language pack |
| columnCheckClearDesc | Column editing drawer mode -> clear description | string | - | Follow language pack |
| columnCheckNoFixedDesc | Column editing drawer mode -> Unfixed description | string | - | Follow language pack |
| columnCheckGetCheckedLengthDesc | Column editing drawer mode->selected description | (length) => string | - | (length) => 'selected (' + length + ')' |
| columnCheckGetAllCheckDesc | Column editing drawer mode->select all description | (length) => string | - | (length) => 'Select all (' + length + ') |
| virtualized | Enables virtual scrolling with fixed row height. | boolean | — | false |
| virtualTableData | Virtual table complete data source; data is used when not set. | Record<string, any>[] | — | undefined |
| virtualProps | Virtual window configuration: rowHeight/itemSize, height, buffer. | object | — | {} |
| emptyText | Empty status text. | string | — | Follow language pack |
| viewIdentity | View or user configuration ID. | string | — | undefined |
| detectResize | Compatibility properties are retained; container layout is automatically observed by ResizeObserver. | boolean | — | false |
| drawerProps | Transparent column settings drawer properties. | object | — | {} |
## Attribute Easy configuration {#easy-config}
| parameters | Description | Type | Optional value | Default value |
| --- | --- | --- | --- | --- |
| initSearchApi | true | — | — | — |
| pageChangeSearchApi | true | — | — | — |
| searchFormAttrs.labelWidth | 80 | — | — | — |
| searchFormAttrs.columns | 4 | — | — | — |
| searchFormAttrs.btnModel | inline | — | — | — |
| searchFormAttrs.columnEdit | true | — | — | — |
| tableAttrs.row-key | id | — | — | — |
## Methods {#methods}
| method name | Description | parameters |
| --- | --- | --- |
| clearSelection | Used for multi-select forms to clear user selections | — |
| toggleRowSelection | Used for multi-select tables to switch the selected state of a certain row. If the second parameter is used, it is to set whether this row is selected or not (selected is true to select) | row, selected |
| toggleAllSelection | Used for multi-select tables to switch the selected state of all rows | — |
| toggleRowExpansion | Used for expandable tables and tree tables to switch the expanded state of a row. If the second parameter is used, it is set to expand or not the row (expanded is true to expand) | row, expanded |
| setCurrentRow | Used for single-select tables to set a certain behavior to select a row. If called without parameters, the selected state of the currently highlighted row will be cancelled. | row |
| clearSort | Used to clear the sorting conditions and the data will be restored to its unsorted state. | — |
| clearFilter | When no parameters are passed in, it is used to clear all filtering conditions, and the data will be restored to an unfiltered state. You can also pass in an array composed of columnKey to clear the filtering conditions of the specified column. | columnKey |
| doLayout | Relayout the Table. This method may need to be called when the Table or its ancestor elements are switched from hidden to displayed | — |
| sort | Manually sort the Table. The parameter prop attribute specifies the sorting column, and order specifies the sorting order. | prop: string, order: string |
| resetNfSearchFormModel | Perform reset manually | — |
| onNfSearchFormValidate | Manually execute validate | callback: Function |
| onNfSearchFormSearch | Perform a search manually | — |
| onNfSearchFormExport | Execute export manually | — |
| getSelectionRows() | Get the currently selected row. | — |
## Event {#events}
| event name | Description | callback parameters |
| --- | --- | --- |
| tableEvents | Table events are consistent with el-table component Table Events | — |
| pageEvents | Pagination events are consistent with el-pagination component Events | — |
| searchFormEvents | Form events are consistent with nf-search-form component Events | — |
| NfTableActionBtnAttributes.events | actionBtnbar button event | — |
| columns[i].operationList[i].onClick | Operation function cell button click event | — |
| changeTab | Switch multiple drawer tabs | name |
| cancel | Close drawer tab | Event |
| searchApi | Same as searchFormEvents.onSearch, with slight changes in parameters | { data: nfSearchForm.getFormData(), callback: Used to close the listloading } |
| fixedColumnDragEnd | Fixed right operation column (custom handle) dragging ends | { width: number, oldWidth: number, prop?: string, column?: any, nativeEvent?: Event } |
| fieldsChange | The table shows field changes. | columns: string[] |
| update:showColumn | for v-model:showColumn. | columns: string[] |
| update:actionBarOptList | The value of the action bar control changes. | items: NfTableActionBtnAttributes[] |
| options-error | Asynchronous column option loading failed. | (error, prop: string) |
## Slot {#slots}
| Name | Description |
| --- | --- |
| append | Insert content after the last row of the table. If you need to infinitely scroll the content of the table, you may need to use this slot. If the table has a total row, this slot will be above the total row. |
| empty | Customization when table data is empty |
| searchBox | Customized search function above the table |
| actionBar | ActionBar function customization in the lower left corner of the table |
| columnEdit | Customized list editing function |
| pagination | Customization of paging function |
| btnBox | nf-search-form slot, compatible with ai-search-form extended operation button |
| columns[i].headerSlot | Customization of header functions for each tableItem |
| columns[i].slot | Each tableItem content function is customized |
| columns[i].singleHeadMutiColSlot | Customization of nested header functions for each tableItem |
| searchFormColumnEditDialogTitle | nf-search-form list editing function dialog/drawer title |
| searchFormColumnEditDialogFooter | nf-search-form list editing function dialog/drawer footer |
| tableColumnEditDialogTitle | nf-table list editing function dialog/drawer title |
| tableColumnEditDialogFooter | nf-table list editing function dialog/drawer footer |
| operation | Manipulate columns; receives row, column, index, $index. |
| operationIconColumnCheck | Customize the field setting entry embedded in the operation list header. |
| NfSearchFormItemOption.slot | Transparently transmit search form field slot; receive formData, value, update. |
## Expose {#expose}
| Name | Type | Description |
| --- | --- | --- |
| localShowItems | string[] | Column props displayed by column editing |
| tableColumns | NfTableColumnAttributes[] | Render table items |
| syncLocalShowColumnToCookies | Function | Column editing sync component to IndexedDB |
| syncCookiesToLocalShowColumn | Function | Column editor synchronizes IndexedDB to component localShowItems |
| syncCookiesToTableColumn | Function | syncCookiesToLocalShowColumn |
| syncShowItemToInitHidden | Function | showItems synchronizes props.formOptions[i].initHidden |
| resetNfSearchFormModel | Function | reset |
| onNfSearchFormValidate | Function | Verify |
| onNfSearchFormSearch | Function | Search |
| onNfSearchFormExport | Function | Export |
| nfColumCheckDialogVisible | Boolean | Column editing controls dialog/drawer display/hide |
| clearFilter | Function | table clearFilter |
| sort | Function | tablesort |
| doLayout | Function | TabledoLayout |
| clearSort | Function | tableclearSort |
| setCurrentRow | Function | tablesetCurrentRow |
| toggleRowExpansion | Function | TabletoggleRowExpansion |
| toggleAllSelection | Function | TabletoggleAllSelection |
| toggleRowSelection | Function | tabletoggleRowSelection |
| clearSelection | Function | tableclearSelection |
| nfTableRef | Ref | Table nf-table ref(div) |
| elTableRef | Ref | table el-table ref |
| nfTableActionContainerRef | Ref | Table actionBar ref(div) |
| nfTableActionBarRef | Ref | Table actionBar ref(slot) |
| nfTablePaginationRef | Ref | table pagination ref |
| nfSearchFormRef | Ref | formnf-search-form ref |
| loadingInstance | Instance | loadingInstance |
| isLoading | boolean | Table loading status |
| columnCheckNfDrawer | Ref | Column editor nf-drawer ref |
| columnCheckDialog | Ref | Column editor column-check-dialog ref |
| columnCheckDrawer | Ref | Column editor column-check-drawer ref |
| showData | Record | Paginated data (handling front-end paging and back-end paging) |
## Instructions for use {#configuration-notes}
searchApi({data, callback}) receives the converted form data and paging parameters. Callback should be called in finally whether it is successful or failed. Omit pageAttrs.total and use front-end paging. When total is passed in, the business party returns the current page data; asynchronous requests should prevent old responses from overwriting new queries.
The virtual table uses a fixed row height window and stable row-key, and no longer relies on the Vue 2 virtual table plug-in. Use normal mode for tree expansion, merged rows, and variable row height. Column settings and the old cookie naming method actually use IndexedDB. All examples are previewed within the document, and the floating layer will not be clipped by the iframe.