返回

VibeFox JS UI — 帮助

概述

VibeFox JS UI 是一个面向 Web 应用的库,包含 60 多个用户界面组件:按钮、表单字段、选择器、列表、导航、对话框和窗口、通知、布局容器,以及看板、带 AI 提示的聊天、文件管理器、电子表格、图像编辑器、查询构建器、签名板、二维码和条形码生成器等大型现成组件。它是纯 JavaScript 实现,无依赖,既可以配合框架使用,也可以独立使用。

每个组件都通过一次调用创建:create<Name>(target, options)(例如 createSelect、createDialog、createKanban),并通过与所有 VibeFox JS 库相同的方法进行控制:setOptions、on、getState、setState、setTheme、destroy;值类组件还提供 getValue / setValue。

主要功能

  • 表单控件:带掩码的输入框、数字输入框、支持搜索和标签的下拉选择、带异步数据源的自动完成、复选框、开关、单选组、分段控件、滑块、评分、一次性验证码输入框;日期、时间、日期时间和颜色选择器;支持分块和重试的文件上传;列表框、穿梭列表、树。
  • 原生表单:控件通过 <form> 提交各自的值,并参与该表单的校验和重置;带规则的表单构建器。
  • 导航:标签页、手风琴、菜单和右键菜单、工具栏、面包屑、分页、步骤条和向导、命令面板。
  • 浮层:对话框、可移动且可调整大小的窗口、抽屉、Toast、工具提示、弹出框、引导导览。
  • 布局:分隔条、可在区域之间移动面板的停靠布局,以及支持拖动、调整大小和断点的磁贴式布局。
  • 数据展示:卡片、头像、芯片、徽标、进度条、加载指示器、骨架屏、轮播。
  • 大型组件:看板、聊天与 AI 提示(来自自有模型的流式回答)、基于后端的文件管理器、支持公式和 Excel 文件的电子表格、图像编辑器、查询构建器(SQL、文本、筛选函数)、签名板、二维码、Data Matrix 和一维条形码。
  • 每个组件都提供三种外观(填充、轮廓、幽灵)和三种尺寸;所有颜色和尺寸均为 CSS 变量;支持主题、从右到左布局、WCAG 2.2 AA 键盘访问、名称与播报;每一项拖放操作都提供菜单替代方案。

环境要求

  • 现代 Web 浏览器。
  • 无运行时依赖。组件自身不发出任何网络请求:上传、文件管理器操作、自动完成的数据源和 AI 回答均发送到你提供的 URL 或函数。
  • 浏览器中不需要 Node.js。ES 模块可以在 Node 中导入(导入时不会访问 DOM):encodeBarcode 和 applyMask 可以在服务器上运行。

安装

库文件

VibeFox JS UI 是一个独立产品,拥有自己的文件。库的全部 JavaScript 是一个文件,样式是一个 CSS 文件:页面只需要这两个文件,其他文件都是可选的。

文件说明
vibefox-js-ui.global.js用于经典 <script> 标签的库;定义一个全局变量 VibeFoxJSUi。压缩版:vibefox-js-ui.global.min.js。
vibefox-js-ui.esm.js相同代码的 ES 模块版本。压缩版:vibefox-js-ui.esm.min.js。
vibefox-js-ui.css库的全部样式,位于 @layer vfjs 中;包含主题 light、dark 和 high-contrast。压缩版:vibefox-js-ui.min.css。
vibefox-js-themes.css可选的主题包:18 套现成主题(参见 主题与样式)。压缩版:vibefox-js-themes.min.css。
locales/vibefox-js-ui.<lang>.js可选的语言包文件,除英语外每种语言各一个(参见 本地化与 RTL)。同一语言的 ES 模块版本:.esm.js;纯字符串版本:.json。
vibefox-js-ui.d.tsTypeScript 声明文件(另有 vibefox-js-ui.esm.d.ts)。
*.js.mapSource Map(源映射)文件。
vibefox-js-ui-react.js、vibefox-js-ui-vue.js、vibefox-js-ui-svelte.js、vibefox-js-ui-jquery.js可选的框架封装包(每个都附带 .d.ts)。
vibefox-js-ui-angular可选的 Angular 包(Angular Package Format)。
vibefox-js-ui-wc.js可选的 Web Components 封装包(自定义元素)。

Script 标签

引入 CSS 文件和脚本。全局变量 VibeFoxJSUi 包含库的全部导出内容。从磁盘打开的文件(file://)同样可以使用这种方式。

<link rel="stylesheet" href="vibefox-js-ui.css">
<script src="vibefox-js-ui.global.js"></script>
<script>
  const select = VibeFoxJSUi.createSelect('#app', { options: items });
</script>

ES 模块

导入 ES 模块文件并引入 CSS 文件。浏览器只能通过 http(s) 加载模块,不能从 file:// 加载。

<link rel="stylesheet" href="vibefox-js-ui.css">
<script type="module">
  import { createSelect } from './vibefox-js-ui.esm.js';
  const select = createSelect('#app', { options: items });
</script>

npm

该库同时以名为 @vibefox/js-ui 的 npm 包形式提供。从你收到的包文件夹(或其打包的 .tgz 文件)安装,然后按名称导入。打包工具通过 @vibefox/js-ui/css 导出获取 CSS。

npm install ./vibefox-js-ui
import { createSelect } from '@vibefox/js-ui';
import '@vibefox/js-ui/css';

包的导出路径:@vibefox/js-ui(ES 模块)、@vibefox/js-ui/min、@vibefox/js-ui/global、@vibefox/js-ui/global.min、@vibefox/js-ui/css、@vibefox/js-ui/min.css、@vibefox/js-ui/themes、@vibefox/js-ui/themes.min.css、@vibefox/js-ui/locales/<lang>、@vibefox/js-ui/locales/<lang>.json。TypeScript 会自动找到声明文件。

框架封装包

封装包是独立的小文件;不使用它们,库同样可以工作。每个封装包只需要 VibeFox JS UI 及其框架(对等依赖)。封装包不会加载 CSS:请自行引入 vibefox-js-ui.css。

框架文件npm 包支持的版本
Reactvibefox-js-ui-react.js@vibefox/js-ui-reactReact 16.8 及更高版本
Vue 3vibefox-js-ui-vue.js@vibefox/js-ui-vueVue 3.3 及更高版本
Angularvibefox-js-ui-angular@vibefox/js-ui-angularAngular 17 及更高版本
Sveltevibefox-js-ui-svelte.js@vibefox/js-ui-svelteSvelte 3、4 和 5
jQueryvibefox-js-ui-jquery.js@vibefox/js-ui-jqueryjQuery 1.12 至 4.x
Web Componentsvibefox-js-ui-wc.js@vibefox/js-ui-wc无框架

ES 模块封装包将库作为 @vibefox/js-ui 导入。不使用 npm 时,请在打包工具的设置或导入映射(import map)中把该名称映射到 vibefox-js-ui.esm.js。jQuery 封装包从全局变量 VibeFoxJSUi 获取库。

所有封装包的通用规则:属性(props)/ 输入(inputs)即库的选项(修改后的选项通过 setData 或一次 setOptions 调用传入);事件为框架事件,其负载对象与 on() 相同;每个方法都可以通过实例调用;在服务端(SSR)上会渲染出空容器,实例仅在浏览器中创建。VibeFox JS UI 的外观选项在封装包中同样称为 variant 和 size。带内容的组件(Dialog、Drawer、Popover、Tooltip、Tabs、Accordion、Splitter、DockLayout、TileLayout、Toolbar、Card、Carousel、Stepper、Wizard)接受框架子元素作为插槽:默认插槽为内容,具名插槽则通过 id 把内容填入标签页、面板、步骤或磁贴。

Web Components

在库文件之后加载 vibefox-js-ui-wc.js。它基于全局变量 VibeFoxJSUi 为每个组件定义一个元素:<vfjs-button>、<vfjs-select>、<vfjs-date-picker>、<vfjs-dialog>、<vfjs-kanban> 等(组件名采用 kebab-case 格式)。特性(attribute)为 kebab-case 格式的选项(对象和数组使用 JSON),属性(property)同样对应选项,组件的方法即为元素的方法;事件是以组件命名的 CustomEvent,例如 vfjsselect:<event> 或 vfjsdatepicker:<event>,负载位于 detail 中。该元素使用 light DOM,因此库的 CSS 和页面自身的 CSS 会照常生效。

<link rel="stylesheet" href="vibefox-js-ui.css">
<script src="vibefox-js-ui.global.js"></script>
<script type="module" src="vibefox-js-ui-wc.js"></script>
<vfjs-select id="g" placeholder="Country" name="country"></vfjs-select>
<script>
  const el = document.getElementById('g');
  el.options = [{ value: 'de', label: 'Germany' }, { value: 'fr', label: 'France' }];
  el.addEventListener('vfjsselect:valueChange', (e) => console.log(e.detail.value));
</script>

使用打包工具时:import * as lib from '@vibefox/js-ui'; import { define } from '@vibefox/js-ui-wc'; define(lib);

封装包的名称与组件相对应:React 为 VibeFoxJSSelectReact、VibeFoxJSDialogReact …;Vue 为 VibeFoxJSSelectVue …;Angular 为 VibeFoxJSSelectComponent,选择器为 vfjs-select-ng(NgModule:VibeFoxJSUiModule);Svelte 为 vfjsSelect 等动作(action);jQuery 为 $(el).vfjsSelect(…);Web Components 为 <vfjs-select>。

快速开始

纯 HTML

<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <link rel="stylesheet" href="vibefox-js-ui.css">
  <script src="vibefox-js-ui.global.js"></script>
</head>
<body>
  <form id="order">
    <label for="country">Country</label> <div id="country"></div>
    <label for="date">Delivery date</label> <div id="date"></div>
    <div id="send"></div>
  </form>
  <div id="toasts"></div>
  <script>
    const { createSelect, createDatePicker, createButton, createToast } = VibeFoxJSUi;
    createSelect('#country', { options: [{ value: 'de', label: 'Germany' }, { value: 'fr', label: 'France' }], searchable: true });
    createDatePicker('#date', { min: new Date() });
    const toast = createToast('#toasts', { position: 'bottom-right' });
    createButton('#send', { label: 'Order', on: { click: () => toast.success('Order sent') } });
  </script>
</body>
</html>

指向挂载元素的 <label for="…"> 会为屏幕阅读器标明控件的名称;选项 label 也能起到同样的作用,且无需可见的标签。

React

import { useState } from 'react';
import { VibeFoxJSSelectReact, VibeFoxJSDialogReact, VibeFoxJSButtonReact } from '@vibefox/js-ui-react';
import '@vibefox/js-ui/css';

export function Settings() {
  const [lang, setLang] = useState('en');
  const [open, setOpen] = useState(false);
  return (
    <>
      <VibeFoxJSSelectReact label="Language" value={lang} options={[{ value: 'en', label: 'English' }, { value: 'de', label: 'Deutsch' }]}
        onValueChange={(e) => setLang(e.value)} />
      <VibeFoxJSButtonReact label="About" onClick={() => setOpen(true)} />
      {open && <VibeFoxJSDialogReact title="About" onClose={() => setOpen(false)}><p>Version 1.0</p></VibeFoxJSDialogReact>}
    </>
  );
}

Vue 3

<script setup>
import { ref } from 'vue';
import { VibeFoxJSSelectVue, VibeFoxJSSliderVue } from '@vibefox/js-ui-vue';
import '@vibefox/js-ui/css';
const lang = ref('en');
const volume = ref(40);
</script>
<template>
  <VibeFoxJSSelectVue v-model="lang" label="Language" :options="[{ value: 'en', label: 'English' }, { value: 'de', label: 'Deutsch' }]" />
  <VibeFoxJSSliderVue v-model="volume" label="Volume" :min="0" :max="100" />
</template>

v-model 即值类组件的值(value;复选框和开关使用 checked)。

Angular

import { Component } from '@angular/core';
import { VibeFoxJSSelectComponent, VibeFoxJSTabsComponent } from '@vibefox/js-ui-angular';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [VibeFoxJSSelectComponent, VibeFoxJSTabsComponent],
  template: `
    <vfjs-select-ng label="Language" [options]="langs" [value]="lang" (valueChange)="lang = $event.value"></vfjs-select-ng>
    <vfjs-tabs-ng [tabs]="[{ id: 'a', label: 'General' }, { id: 'b', label: 'Advanced' }]">
      <ng-template vfjsUiSlot="a">General settings</ng-template>
      <ng-template vfjsUiSlot="b">Advanced settings</ng-template>
    </vfjs-tabs-ng>`,
})
export class AppComponent {
  langs = [{ value: 'en', label: 'English' }, { value: 'de', label: 'Deutsch' }];
  lang = 'en';
}

请在 angular.json(styles)或 index.html 中引入 vibefox-js-ui.css。对于基于 NgModule 的应用,请导入 VibeFoxJSUiModule。

Svelte

<script>
  import { vfjsSwitch } from '@vibefox/js-ui-svelte';
  let dark = false;
</script>
<div use:vfjsSwitch={{ label: 'Dark mode', checked: dark }}
     on:vfjsswitch:valueChange={(e) => (dark = e.detail.checked)}></div>

jQuery

<script src="jquery.min.js"></script>
<link rel="stylesheet" href="vibefox-js-ui.css">
<script src="vibefox-js-ui.global.js"></script>
<script src="vibefox-js-ui-jquery.js"></script>
<script>
  $('#rating').vfjsRating({ value: 3, max: 5 })
    .on('vfjsrating:valueChange', (e, payload) => console.log(payload.value));
  $('#rating').vfjsRating('setValue', 4);
</script>

核心概念

组件

每个组件都有一个工厂函数 create<Name>(target, options) 和一个类 VibeFoxJS<Name>(new VibeFoxJSSelect(target, options) 与之等效)。target 是一个元素或选择器。浮于页面之上的组件(Dialog、Drawer、Toast、Menu、CommandPalette、Tour)会将其浮层放入 <body> 中。请将它们挂载到 document.body(或 'body'、document)上:页面元素不会被修改,组件会在 <body> 末尾使用其自有的隐藏占位元素(即其 el),destroy() 会将其移除。普通的挂载元素在组件存在期间保持隐藏,调用 destroy() 后会重新显示。Tooltip 和 Popover 以挂载元素作为定位锚点。

const select = VibeFoxJSUi.createSelect('#app', { options: [{ value: 1, label: 'One' }, { value: 2, label: 'Two' }], value: 1 });
select.setValue(2);
console.log(select.getValue());
select.setOptions({ disabled: true, placeholder: 'Pick one' });
select.destroy();

事件

每个事件处理函数都会接收一个负载对象。可以在选项中订阅(on: { valueChange: fn }),也可以之后通过 on、once 和 off 订阅;on('*', (event, payload) => …) 会接收所有事件。值类组件触发 valueChange;弹出层触发 open 和 close;负载中带有 preventDefault() 的事件(看板放置、聊天发送、文件管理器操作……)可以被取消。

const slider = VibeFoxJSUi.createSlider('#app2', { min: 0, max: 100, value: 20, label: 'Volume' });
slider.on('valueChange', (e) => console.log('dragging', e.value));
slider.on('slideEnd', (e) => console.log('released', e.value));

每个 VibeFox JS 组件都会触发 ready、dataChange、optionsChange、themeChange 和 destroy。

状态快照

getState() 返回用户所做更改的 JSON 安全快照(值、当前激活的标签页、分隔条尺寸、停靠或磁贴布局、看板的列顺序、文件管理器的文件夹和视图……);setState(state) 用于恢复该快照。

const tabs = VibeFoxJSUi.createTabs('#app2', { tabs: [{ id: 'a', label: 'A', content: 'First' }, { id: 'b', label: 'B', content: 'Second' }] });
tabs.setActive('b');
localStorage.setItem('tabs', JSON.stringify(tabs.getState()));   // { active: 'b', order: ['a', 'b'] }
tabs.setState(JSON.parse(localStorage.getItem('tabs')));

内容

用于保存内容的选项(对话框、标签页、面板、磁贴、卡片等的 content)接受文本 / HTML 字符串、DOM Node,或用于填充元素的渲染函数 (host) => void。文本选项(标签、标题)按纯文本处理。HTML 字符串即为你自己的标记:请勿传入不受信任的 HTML。

按钮

Button

const save = VibeFoxJSUi.createButton('#app', { label: 'Save', icon: 'check', variant: 'primary' });
save.on('click', async () => { save.setLoading(true); await new Promise((r) => setTimeout(r, 300)); save.setLoading(false); });

选项:label、variant('primary'、'secondary'、'danger'、'filled'、'outline'、'ghost')、size、icon、iconRight、loading、disabled、block(占满整行宽度)。方法:setLabel()、setLoading()、setDisabled()、focus()。事件:click。未设置 variant 的按钮显示为主要外观,并带有类 vfjs-ui-btn--primary vfjs-ui-btn--default(在带有 data-vfjs-ui-variant 的容器下:该外观对应的类,例如 vfjs-ui-btn--outline,外加 vfjs-ui-btn--default),因此你为 .vfjs-ui-btn--primary 编写的 CSS 同样会作用于它。

图标

icon、iconRight、prefix 和 suffix 等选项接受内置图标的名称,也可以接受你自己的 SVG / HTML / 文本。VibeFoxJSUi.listIcons() 返回所有内置图标的名称(已排序;TypeScript 类型为 UiIconName)。名称使用连字符书写('chevron-down'、'align-start');小驼峰写法同样有效('alignLeft' 等同于 'align-left');其他任何值都会按原样显示(文本或 SVG)。

console.log(VibeFoxJSUi.listIcons());   // ['align-center', 'align-end', 'align-left', …, 'zoom-out']

内置图标:align-start、align-center、align-end、align-left(= align-start)、align-right(= align-end)、arrow-up、arrow-down(也可用 arrowdown)、arrow-left、arrow-right、arrow-up-right、chevron-up、chevron-down、chevron-left、chevron-right、chevrons-left、chevrons-right、check、check2、close、plus、minus、dots、grip、search、calendar、clock、phone、user、folder、folder-plus、file、image、paperclip、clipboard、copy、scissors、trash、pencil、download、upload、send、reply、retry、undo、redo、eye、info、success、warning、error、star、heart、circle、square、smile、sparkle、spinner、play、pause、stop、grid、list、sliders、expand、shrink、move、resize、swap、pointer、zoom-in、zoom-out、bold、italic、underline、strike、type、text-color、brush、eraser、fill、blur、crop、rotate-cw、rotate-ccw、flip-h、flip-v、eyedropper。

ButtonGroup 与 SplitButton

const align = VibeFoxJSUi.createButtonGroup('#app', { label: 'Alignment', selection: 'single', required: true, value: 'left',
  items: [{ id: 'left', icon: 'alignLeft', title: 'Left' }, { id: 'center', label: 'Center' }, { id: 'right', label: 'Right' }] });
const send = VibeFoxJSUi.createSplitButton('#app2', { label: 'Send', items: [{ id: 'later', label: 'Send later' }, { id: 'draft', label: 'Save draft' }] });
send.on('itemClick', (e) => console.log(e.item.id));

ButtonGroup:items、selection('none'、'single'、'multiple':切换按钮)、value、required、vertical、block、label;事件 itemClick、valueChange。SplitButton:一个主按钮加一个菜单(items 与 Menu 中相同,另有 menuLabel);方法 open()、close()、isOpen()、setLabel();事件 click、itemClick、open、close。

表单控件

Input 与 NumberInput

const phone = VibeFoxJSUi.createInput('#app', { label: 'Phone', mask: '+9 (999) 999-99-99', clearable: true, prefix: 'phone' });
phone.on('enterPress', (e) => console.log(e.value));
const qty = VibeFoxJSUi.createNumberInput('#app2', { label: 'Quantity', value: 1, min: 1, max: 99, step: 1, suffix: 'pcs' });
qty.stepUp();

Input:value、type、placeholder、mask(9 表示数字,a 表示字母,* 表示任意字符;applyMask(raw, mask))、clearable、prefix、suffix、maxLength、disabled、label;方法 setValue()、getValue()、clear()、focus();事件 valueChange、clear、enterPress。NumberInput:value、min、max、step、precision、prefix、suffix(数字前后的文本或图标名称,不属于值的一部分;屏幕阅读器会将文本与数字一起朗读,例如 "12 pcs");方法 stepUp()、stepDown();ArrowUp / ArrowDown 按步长调整值。获得焦点的字段在整个字段周围显示一个焦点环。

Select

const tags = VibeFoxJSUi.createSelect('#app', { label: 'Tags', multiple: true, searchable: true, clearable: true, maxTagCount: 2,
  options: [{ value: 'js', label: 'JavaScript', group: 'Web' }, { value: 'css', label: 'CSS', group: 'Web' }, { value: 'go', label: 'Go', group: 'Server' }] });
tags.setValue(['js', 'go']);

选项:options({ value, label, disabled, group })、value、multiple、tags、searchable、clearable、placeholder、maxTagCount、disabled、label。方法:open()、close()、isOpen()、setValue()、getValue()。事件:valueChange、open、close、searchInput。

AutoComplete

const city = VibeFoxJSUi.createAutoComplete('#app', {
  label: 'City',
  source: async (query, { signal }) => (await fetch('/api/cities?q=' + encodeURIComponent(query), { signal })).json(),
  minLength: 2, delay: 250, textField: 'name', keyField: 'id',
});
const fruit = VibeFoxJSUi.createAutoComplete('#app2', { data: ['Apple', 'Apricot', 'Banana', 'Cherry'], filter: 'fuzzy', multiple: true });

选项:data(静态项)或 source(带有 AbortSignal 的函数,或像 /api?q={query} 这样的 URL 模板,返回 JSON 数组或 { items })、delay、cache、minLength、filter('contains'、'startsWith'、'fuzzy' 或函数)、keyField、textField、groupField、disabledField、template、highlight、virtual、itemHeight、multiple(芯片)、value、freeInput、autoHighlight、closeOnSelect、toggle、clearable、placeholder、label、inputId、readonly。方法:search(query)、getItems()、getSelectedItems()、open()、close()、clearCache()。事件:valueChange、searchInput、load、error、open、close。

Checkbox, Switch, RadioGroup, Segmented

VibeFoxJSUi.createCheckbox('#app', { label: 'I agree', checked: false });
VibeFoxJSUi.createSwitch('#app2', { label: 'Notifications', checked: true });
const plan = VibeFoxJSUi.createRadioGroup('#preview', { label: 'Plan', inline: true, value: 'm',
  options: [{ value: 'm', label: 'Monthly' }, { value: 'y', label: 'Yearly' }] });
const view = VibeFoxJSUi.createSegmented('#sidebar', { label: 'View', items: [{ value: 'list', label: 'List' }, { value: 'grid', icon: 'grid', title: 'Grid' }], value: 'list' });

Checkbox:checked、label、indeterminate、disabled、name、required、value(选中时随表单一起提交,默认为 'on');方法 setChecked()、getChecked()、toggle()、setIndeterminate()。Switch:与 Checkbox 相同,但没有半选状态。RadioGroup:options、value、inline。Segmented:items(值、字符串或 { value, label, icon, title, disabled })、value、block、vertical。以上组件均会触发 valueChange。

Slider and Rating

const price = VibeFoxJSUi.createSlider('#app', { label: 'Price', min: 0, max: 500, step: 10, value: [50, 300], tooltip: true });
const stars = VibeFoxJSUi.createRating('#app2', { value: 3.5, max: 5, step: 0.5, labels: ['Bad', 'Poor', 'OK', 'Good', 'Great'] });

Slider:min、max、step、value(两个值即为范围)、range、tooltip;事件 valueChange(拖动过程中)、slideEnd。Rating:value、max、step(1 或 0.5)、icon('star'、'heart'、'circle' 或 SVG)、labels、clearable、readonly;事件 valueChange、hoverChange。

OTP 输入框

const code = VibeFoxJSUi.createOTPInput('#app', { length: 6, type: 'numeric', groups: [3, 3], name: 'code', autoSubmit: true });
code.on('complete', (e) => console.log('code', e.value));

选项:length、value、type('numeric'、'alphanumeric'、'alpha'、'any')、pattern、uppercase、mask、placeholder、groups、separator、autoFocus、autoSubmit、label、readonly。粘贴的验证码会填满每个单元格。方法:isComplete()、clear()、focus(index)。事件:valueChange、complete。

原生表单中的表单字段

每个值类控件都参与原生 <form>:Input、NumberInput、Select、Checkbox、Switch、RadioGroup、Slider、DatePicker、ButtonGroup、ChipGroup、TimePicker、DateTimePicker、ColorPicker、Rating、FileUpload、ListView / ListBox、AutoComplete、QueryBuilder、OTPInput、Segmented、TransferList 和 SignaturePad。设置 name 后,控件会在其挂载元素中放入隐藏的 input 元素,因此提交表单和 new FormData(form) 都会包含它的值。required 会在控件为空时阻止提交,并在控件下方显示该控件自己的消息(aria-invalid;焦点会移到第一个无效控件);form.reset() 会恢复初始值;禁用的控件既不会被提交,也不会被校验。方法:checkValidity()、reportValidity()(在控件旁显示消息)、getValidationMessage()、reset()、focus();事件 validate({ valid, message })。

提交的内容与原生字段一致:Input 提交其文本(空字段以空值提交);NumberInput 提交数字;Select 为每个选中的选项提交一个值;Checkbox 和 Switch 在选中时提交 name=value(选项 value,默认为 'on');RadioGroup 提交选中的值;Slider 提交数字(范围时为两个值;Slider 没有 required,它始终有值);DatePicker 提交 YYYY-MM-DD(范围时为开始和结束日期;required 需要两者都填写);ButtonGroup(配合 selection 使用)和 ChipGroup 提交被按下或选中的 id。除 Input 外,空值不会被提交。位于 <form> 内但没有 name 的控件仍会随 form.reset() 恢复。

document.querySelector('#app').innerHTML = '<form id="order"><div id="qty"></div><div id="gift"></div><div id="day"></div></form>';
VibeFoxJSUi.createNumberInput('#qty', { label: 'Quantity', name: 'qty', value: 2 });
VibeFoxJSUi.createCheckbox('#gift', { label: 'Gift wrap', name: 'gift', checked: true });   // sends gift=on
const day = VibeFoxJSUi.createDatePicker('#day', { label: 'Delivery', name: 'day', required: true });
const order = document.querySelector('#order');
console.log(order.checkValidity(), day.getValidationMessage());   // false, the "required" message
day.setValue('2026-11-05');
console.log([...new FormData(order)]);                            // qty=2, gift=on, day=2026-11-05
const rating = VibeFoxJSUi.createRating('#app2', { name: 'score', required: true });
console.log(rating.checkValidity(), rating.getValidationMessage());

日期、时间和颜色选择器

const stay = VibeFoxJSUi.createDatePicker('#app', { label: 'Stay', range: true, format: 'DD.MM.YYYY', firstDay: 1, min: '2026-01-01' });
stay.setValue(['2026-07-01', '2026-07-14']);
const meet = VibeFoxJSUi.createDateTimePicker('#app2', { label: 'Meeting', step: 15, hour12: false, value: '2026-11-03T10:30' });
const time = VibeFoxJSUi.createTimePicker('#preview', { label: 'Start', min: '08:00', max: '18:00', step: 30 });
const color = VibeFoxJSUi.createColorPicker('#sidebar', { label: 'Brand color', value: '#2563eb', format: 'hex', alpha: true });
console.log(stay.getState(), color.getRgba());

DatePicker:value(一个日期,使用 range 时为 [start, end])、format(YYYY、MM、DD 等格式标记)、min、max、firstDay、inline(常驻日历)、placeholder;方法 open()、close()、isOpen()、setValue()、getValue()(返回 Date;使用 range 时返回由 Date 对象组成的数组 [start, end],结束日期为空时为 null;全部为空时返回 null);getState() 以 'YYYY-MM-DD' 字符串的形式返回日期。TimePicker:value('HH:mm')、min、max、step(列表中的分钟间隔)、seconds、hour12(null 表示按区域设置决定)、clearable、readonly。DateTimePicker:value(本地日期时间)、min、max、step、seconds、hour12、format、firstDay、inline。ColorPicker:value(任意 CSS 颜色)、format('hex'、'rgb'、'hsl')、alpha、swatches(null 表示使用主题调色板)、inline;getRgba();在浏览器支持时提供吸管取色(eyedropper)。以上组件均会触发 valueChange、open、close。日历遵循区域设置(月份和星期名称、每周的第一天),并且是完整的键盘网格。

列表与树

ListView and ListBox

const people = VibeFoxJSUi.createListBox('#app', {
  label: 'Assignees', selection: 'multiple', checkboxes: true, keyField: 'id', textField: 'name', height: 200,
  data: [{ id: 1, name: 'Ann' }, { id: 2, name: 'Bob' }, { id: 3, name: 'Cleo', off: true }], disabledField: 'off',
  draggable: true,
});
people.on('itemMove', (e) => console.log(e.from, '→', e.to));
people.setValue([1, 2]);

选项:data、keyField、textField、disabledField、template、selection('none'、'single'、'multiple')、value、checkboxes、virtual('auto':从 100 项起启用)、itemHeight、height、draggable(通过拖动重新排序,或使用 Alt+ArrowUp / Down,或移动菜单)、dragGroup(同一分组(group)中的列表之间互相交换项目)、moveMenu、emptyText、label。ListBox 是带字段边框、默认为单选的 ListView。方法:getSelectedItems()、selectAll()、clearSelection()、scrollToIndex()。事件:valueChange、itemClick、itemActivate、itemMove。

TransferList

const columns = VibeFoxJSUi.createTransferList('#app2', { titles: ['Available', 'Shown'], reorder: true, max: 4,
  data: ['Name', 'Email', 'Phone', 'City', 'Company'], value: ['Name', 'Email'] });
columns.transfer('City', 'target');
console.log(columns.getValue());

选项:data、keyField、textField、disabledField、value(已选项的键)、titles、search、template、reorder、draggable、moveAll、max、virtual、itemHeight、height、label。方法:getItems()、transfer(keys, to)、transferAll(to)、setSearch()、getLists()。事件:valueChange、transfer、searchChange。

Tree

const tree = VibeFoxJSUi.createTree('#preview', { label: 'Folders', checkboxes: true, search: true,
  data: [{ id: 'src', label: 'src', expanded: true, children: [{ id: 'a', label: 'app.js' }, { id: 'b', label: 'lib', lazy: true }] }],
  load: async (node) => [{ id: node.id + '/x', label: 'x.js' }] });
tree.setChecked('a', true);
console.log(tree.getChecked(), tree.getState());

选项:data({ id, label, children, expanded, disabled, lazy })、checkboxes(三态,并支持向上下级传播)、selectable、search、load(惰性加载子节点)、label。方法:setData()、getData()、findNode()、selectNode()、toggleNode()、setChecked()、getChecked()、filter(query)。事件:nodeSelect、nodeToggle、checkChange、nodeLoad。

表单与文件上传

Form

createForm 根据带校验规则的字段描述构建表单;每个字段都是一个 VibeFox JS 控件。

const form = VibeFoxJSUi.createForm('#app', {
  fields: [
    { name: 'email', label: 'Email', type: 'input', props: { type: 'email' }, rules: [{ required: true }, { pattern: '^[^@]+@[^@]+$', message: 'Not an email' }] },
    { name: 'age', label: 'Age', type: 'number', rules: [{ min: 18, message: 'Adults only' }] },
    { name: 'plan', label: 'Plan', type: 'segmented', props: { items: ['Free', 'Pro'] } },
    { name: 'terms', label: 'I accept the terms', type: 'checkbox', rules: [{ required: true, message: 'Please accept the terms' }] },
  ],
  value: { plan: 'Free' }, layout: 'horizontal', validateOn: 'change', submitLabel: 'Register',
});
form.on('submit', (e) => console.log(e.value));
console.log(form.validate());

字段类型:input、number、select、checkbox、switch、radio、slider、date、time、datetime、color、rating、file、listbox、otp、segmented、transfer;props 即该控件的选项。规则:required、pattern、min、max、minLength、custom((value, all) => boolean | string:true 表示有效,false 表示使用 message,字符串表示该错误文本)、message。只有 required 会检查空值;其他规则(包括 custom)仅对非空值运行(空值指 null、''、[],以及未勾选的复选框或开关的 false),因此必须勾选的复选框需要使用 { required: true, message: '…' }。每个字段的 name 都会传递给其控件,因此表单元素的 new FormData() 包含所有字段。选项:fields、value、layout、validateOn、submitLabel、resetLabel。方法:validate()、submit()、reset()、getValue()、setValue()、getField(name)。事件:submit(仅在有效时触发)、fieldChange、validate。错误会与其字段关联,焦点会移到第一个无效字段。

FileUpload

const files = VibeFoxJSUi.createFileUpload('#app2', {
  url: '/api/upload', fieldName: 'file', headers: { 'X-CSRF': 'token' },
  multiple: true, accept: 'image/*,.pdf', maxFileSize: 20e6, maxFiles: 5,
  chunkSize: 5e6, retries: 3, concurrency: 2, autoUpload: true, name: 'attachments',
});
files.on('uploadComplete', (e) => console.log(e.file.name, e.response));

上传通过 XMLHttpRequest 发送到 url(可设置 method、fieldName、headers、params、withCredentials、timeout),按 chunkSize 分块,失败时按 retries 和 retryDelay 重试,并可同时上传 concurrency 个文件;也可以通过你自己的 transport 上传(它可以是接收分块上下文的函数,或 { upload, complete })。其他选项:autoUpload、multiple、accept、maxFileSize、minFileSize、maxFiles、value(此前已上传的文件)、fileValue(文件的表单值)。方法:addFiles()、open()、upload(id)、retry(id)、cancel(id)、removeFile(id)、clear()、getFiles()。事件:filesAdd、fileReject、uploadStart、uploadProgress、chunkUpload、uploadRetry、uploadComplete、uploadError、uploadCancel、fileRemove、queueComplete、valueChange。文件大小按区域设置的单位显示,数字与单位之间加一个空格,格式与 Intl 的输出一致("20 B"、"46 kB";文件管理器中同样如此)。

导航

Tabs and Accordion

const tabs = VibeFoxJSUi.createTabs('#app', { label: 'Document', closable: true, reorder: true,
  tabs: [{ id: 'a', label: 'Overview', content: '<p>Text</p>' }, { id: 'b', label: 'Details', content: (host) => { host.textContent = 'Rendered'; } }] });
tabs.addTab({ id: 'c', label: 'History', content: 'Log' }, { activate: true });
const faq = VibeFoxJSUi.createAccordion('#app2', { multiple: true, headingLevel: 3,
  items: [{ id: 'q1', title: 'Shipping?', content: '3–5 days' }, { id: 'q2', title: 'Returns?', content: '30 days' }] });
faq.expand('q1');

Tabs:tabs({ id, label, content, icon, closable, disabled })、active、closable、reorder、label;方法 setActive()、getActive()、addTab()、removeTab()、moveTab();事件 tabChange、tabClose、tabReorder。Accordion:items({ id, title, content, disabled })、active、multiple、headingLevel;方法 toggle()、expand()、collapse();事件 itemToggle。

Menu and Toolbar

const menu = VibeFoxJSUi.createMenu('#app', { label: 'Actions', items: [
  { id: 'copy', label: 'Copy', shortcut: 'Ctrl+C', icon: 'copy' },
  { id: 'wrap', label: 'Word wrap', checked: true },
  { divider: true },
  { id: 'export', label: 'Export', children: [{ id: 'pdf', label: 'PDF' }, { id: 'csv', label: 'CSV' }] },
] });
menu.attachContext('#app2');                      // right click
menu.on('itemClick', (e) => console.log(e.path));
const bar = VibeFoxJSUi.createToolbar('#preview', { label: 'Formatting', items: [
  { type: 'toggle', id: 'bold', icon: 'bold', label: 'Bold' }, { type: 'separator' },
  { type: 'button', id: 'undo', icon: 'undo', tooltip: 'Undo' }, { type: 'spacer' },
  { type: 'custom', render: (host) => { host.textContent = 'Saved'; } },
] });
bar.on('toggleChange', (e) => console.log(e.id, e.pressed));

Menu:items({ id, label, icon, shortcut, disabled, checked, children } 或 { divider: true })、closeOnClick、label;方法 openAt(x, y)、openFor(anchor)、close()、isOpen()、attachContext(el)(右键菜单)、attachTrigger(el)(下拉菜单);事件 itemClick、open、close。Toolbar:类型为 button、toggle、separator、spacer、custom 的 items;方法 getItem()、setItem();事件 itemClick、toggleChange。

Breadcrumb and Pagination

VibeFoxJSUi.createBreadcrumb('#app', { maxItems: 4, items: [{ label: 'Home', href: '/' }, { label: 'Docs', href: '/docs' }, { label: 'UI' }] });
const pages = VibeFoxJSUi.createPagination('#app2', { total: 240, pageSize: 20, page: 3, pageSizes: [10, 20, 50], showTotal: true });
pages.on('pageChange', (e) => console.log(e.page, e.pageSize));

Breadcrumb:items({ id, label, href, icon })、separator、maxItems;setItems();事件 itemClick。Pagination:total、page、pageSize、siblings、pageSizes、showTotal;setPage()、getPage();事件 pageChange。

Stepper and Wizard

const wizard = VibeFoxJSUi.createWizard('#app', { steps: [
  { id: 'account', title: 'Account', content: '<p>Account data</p>', validate: () => true },
  { id: 'address', title: 'Address', optional: true, content: '<p>Address</p>' },
  { id: 'done', title: 'Confirm', content: '<p>Check and finish</p>' },
] });
await wizard.next();
wizard.on('finish', () => console.log('finished'));

选项:steps({ id, title, description, icon, optional, disabled, content, validate })、active、linear(只能向前,且只能经过有效的步骤)、validate(用于每一步)、orientation、buttons(Back / Next / Finish;在 Wizard 中默认开启)、disabled。校验函数返回 true、false 或一条消息(也可以返回其 Promise)。方法:goTo()、next()、prev()、finish()(返回 true / false 的 Promise)、getActive()、setCompleted()、setStepError()、reset()。事件:stepChange、stepValidate、finish。

CommandPalette

const palette = VibeFoxJSUi.createCommandPalette('#app2', { hotkey: 'mod+k', commands: [
  { id: 'new', title: 'New document', category: 'File', shortcut: 'Ctrl+N', handler: () => console.log('new') },
  { id: 'theme', title: 'Toggle dark theme', keywords: ['night', 'dark'], handler: () => VibeFoxJSUi.setTheme('dark') },
] });
palette.open();
palette.run('new');

对命令进行模糊搜索,可用 Ctrl+K / Cmd+K 打开(hotkey,设为 null 可将其关闭);最近使用的命令排在最前(recent)。选项:commands({ id, title, category, shortcut, icon, keywords, handler })、hotkey、placeholder、recent、maxResults。方法:open()、close()、isOpen()、run(id)、addCommand()、removeCommand()。事件:commandRun、open、close。

对话框与浮层

Dialog

对话框默认为模态(带遮罩层,焦点保持在对话框内);设置 modal: false 后则为窗口:多个窗口可同时保持打开,被点击的窗口会置于顶层,窗口可通过标题栏移动、通过角落调整大小,并可最大化和最小化。

const dlg = VibeFoxJSUi.createDialog('#app', {
  title: 'Delete file?', content: '<p>This cannot be undone.</p>',
  buttons: [{ id: 'cancel', label: 'Cancel', variant: 'secondary' }, { id: 'ok', label: 'Delete', variant: 'danger' }],
});
dlg.on('buttonClick', (e) => { console.log(e.id); dlg.close(); });
const win = VibeFoxJSUi.createDialog('#app2', { title: 'Properties', modal: false, resizable: true, maximizable: true, minimizable: true,
  width: 360, x: 40, y: 40, content: 'Window content' });
win.setPosition(80, 60);

选项:title、content、modal、width、height、x、y、draggable、resizable、maximizable、minimizable、closable、buttons、openOnInit(默认为 true)、escClose。方法:open()、close()(关闭并移除窗口)、isOpen()、focus()(置于顶层)、toggleMaximize()、toggleMinimize()、setPosition()。事件:open、close、buttonClick、focus、moveEnd、resizeEnd、maximizeChange、minimizeChange。设置 draggable 或 resizable 后,标题栏开头会有一个窗口菜单按钮(标题栏的右键菜单会打开同一菜单):可按步长左移、右移、上移、下移,居中,变宽、变窄、变高、变矮——这是无需拖动即可移动和调整窗口大小的方式。

Drawer

const drawer = VibeFoxJSUi.createDrawer('#app', { side: 'right', size: 'm', title: 'Filters', content: '<p>Filter controls</p>', openOnInit: false });
drawer.open();

选项:side('left'、'right'、'top'、'bottom')、size(px、CSS 长度,或 's' / 'm' / 'l')、title、content、modal、escClose、openOnInit。方法:open()、close()、toggle()、isOpen()。事件:open、close。

Toast

const toast = VibeFoxJSUi.createToast('#app2', { position: 'bottom-right', duration: 4000, max: 3 });
toast.success('Saved');
const id = toast.show({ type: 'warning', title: 'Offline', message: 'Changes are kept locally.', duration: 0, actions: [{ id: 'retry', label: 'Retry' }] });
toast.on('actionClick', (e) => { if (e.action === 'retry') toast.hide(id); });
await toast.promise(new Promise((r) => setTimeout(r, 200)), { loading: 'Uploading…', success: 'Uploaded', error: 'Upload failed' });

选项:position('top-right'、'top-left'、'top-center'、'bottom-right'、'bottom-left'、'bottom-center')、duration(0 表示持续显示)、max(超出的部分在队列中等待)。方法:show()、info()、success()、warning()、error()、promise()、hide(id)、clear()。事件:toastShow、toastClose、actionClick。Toast 会由屏幕阅读器朗读;鼠标悬停或获得焦点时,计时器暂停。

Tooltip and Popover

document.querySelector('#app').innerHTML = '<button>Help</button>';
VibeFoxJSUi.createTooltip('#app button', { content: 'Opens the manual', placement: 'bottom' });
document.querySelector('#app2').innerHTML = '<button>Details</button>';
const pop = VibeFoxJSUi.createPopover('#app2 button', { title: 'Order 42', content: '<p>3 items, 120 EUR</p>', placement: 'right' });

两者都附加到挂载元素(锚点)上,且不改变其类名和外观:VibeFox JS 按钮会保留其 variant。Tooltip:content、placement、trigger('hover'、'focus'、'click')、delay、disabled;show()、hide()、setContent()。Popover:另有 title 和富内容 content,默认在点击时打开。事件:open、close。

Tour

document.querySelector('#app').innerHTML = '<button id="new">New</button> <button id="share">Share</button>';
const tour = VibeFoxJSUi.createTour('#app2', { steps: [
  { target: '#new', title: 'Create', content: 'Start a new document here.', placement: 'bottom' },
  { target: '#share', title: 'Share', content: 'Invite your team.' },
] });
tour.start();
tour.on('finish', () => localStorage.setItem('tour-done', '1'));

每个目标都会以聚光高亮显示,并附带一张步骤卡片。选项:steps({ target, title, content, placement })、padding、scroll。方法:start(index)、next()、prev()、stop()、isActive()。事件:stepChange、finish、skip。

布局

Splitter

const split = VibeFoxJSUi.createSplitter('#app', { direction: 'horizontal', panes: [
  { content: 'Navigation', size: 25, min: 120, collapsible: true }, { content: 'Editor', size: 75 },
] });
split.setSizes([30, 70]);
split.on('paneResize', (e) => console.log(e.sizes));

选项:direction、panes({ content, size, min, collapsible })。方法:collapse(index)、getSizes()、setSizes()。事件:paneResize、paneCollapse。双击分隔槽会折叠其窗格;单击会打开其移动菜单;方向键可移动分隔条。

DockLayout

面板位于类似 IDE 的五个区域中;用户可以在区域之间拖动面板(或使用移动菜单 / Alt+方向键),布局会以 JSON 形式保存。

const dock = VibeFoxJSUi.createDockLayout('#app2', { zoneSizes: { left: 220, bottom: 160 }, panels: [
  { id: 'files', title: 'Files', zone: 'left', content: 'Tree' },
  { id: 'code', title: 'main.js', zone: 'center', content: 'Code', closable: true },
  { id: 'log', title: 'Console', zone: 'bottom', content: 'Output' },
] });
dock.movePanel('log', 'right');
dock.on('layoutChange', (e) => localStorage.setItem('dock', JSON.stringify(e.state)));

选项:panels({ id, title, zone, content, closable })、zoneSizes。方法:getPanel()、addPanel()、removePanel()、movePanel()、activatePanel()、collapseZone()。事件:panelMove、panelClose、panelActivate、zoneCollapse、layoutChange。

TileLayout

仪表板网格:磁贴在列网格上拖动和调整大小,会绕开静态磁贴排布,并在不同宽度下使用其他布局。

const tiles = VibeFoxJSUi.createTileLayout('#preview', {
  columns: 12, breakpoints: { 0: 4, 600: 8, 1000: 12 }, rowHeight: 80,
  tiles: [
    { id: 'sales', title: 'Sales', x: 0, y: 0, w: 6, h: 3, content: 'Chart' },
    { id: 'kpi', title: 'KPI', x: 6, y: 0, w: 3, h: 2, minW: 2, content: '42' },
    { id: 'news', title: 'News', x: 9, y: 0, w: 3, h: 4, collapsible: true, content: 'Text' },
  ],
});
tiles.moveTile('kpi', 0, 3);
tiles.on('layoutChange', (e) => console.log(e.reason, e.layout));
const saved = tiles.toJSON();

选项:tiles({ id, title, content, x, y, w, h, minW, minH, maxW, maxH, static, draggable, resizable, closable, collapsible, maximizable, collapsed, actions, className })、columns、breakpoints、layouts(按列数保存的布局)、rowHeight、compact、draggable、resizable、header、headingLevel、closable、collapsible、maximizable、template、undoLimit、label、disabled。方法:getLayout()、setLayout()、getColumns()、getTile()、getTiles()、addTile()、removeTile()、updateTile()、moveTile()、resizeTile()、collapseTile()、maximizeTile()、compact()、undo()、redo()、canUndo()、canRedo()、toJSON()。事件:layoutChange、dragStart、dragEnd、tileCollapse、tileMaximize、tileClose、tileAction、breakpointChange。layoutChange 的 reason 可以是 'drag'、'resize'、'keyboard'、'menu'(移动菜单)、'api'、'add'、'remove'、'collapse'、'undo'、'redo' 或 'compact'。

数据展示

Card

const card = VibeFoxJSUi.createCard('#app', { title: 'Mountain lodge', subtitle: 'From 120 EUR', media: 'data:image/gif;base64,R0lGODlhAQABAAAAACw=', mediaAlt: 'Lodge',   // an image URL
  content: '<p>Quiet place near the lake.</p>', variant: 'elevated', actions: [{ id: 'book', label: 'Book', variant: 'primary' }] });
card.on('action', (e) => console.log(e.id));

选项:title、subtitle、headingLevel、content、footer、media、mediaAlt、mediaPosition、actions、variant('outlined'、'elevated' 或某种外观)、size、href / target(卡片作为链接)、clickable、disabled。事件:click、action。

Avatar, Chip, Badge

VibeFoxJSUi.createAvatarGroup('#app', { max: 3, items: ['Ann Lee', 'Bob Stone', { name: 'Cleo', status: 'online' }, 'Dan', 'Eve'] });
const filters = VibeFoxJSUi.createChipGroup('#app2', { selection: 'multiple', removable: true, items: ['Open', 'Urgent', { id: 'me', label: 'Mine', icon: 'user' }] });
filters.on('itemRemove', (e) => console.log('removed', e.item));
document.querySelector('#preview').innerHTML = '<button>Inbox</button>';
const badge = VibeFoxJSUi.createBadge('#preview button', { count: 7, max: 99, type: 'error', attached: true });
badge.setCount(12);

Avatar:src、name(根据名称生成首字母和颜色)、alt、icon、status、color、size('xs' … 'xl' 或 px)、shape;AvatarGroup:items、max(显示的头像数量,默认为 4;其余的以 "+N" 头像计数:共 5 个时,max: 3 即显示 3 个头像和 "+2";0 表示全部显示);事件 imageError。Chip:label、icon、avatar、selectable、selected、clickable、removable、color、variant;ChipGroup:items、selection、value、removable;事件 click、selectedChange、remove / valueChange、itemClick、itemRemove。Badge:count、text、max、dot、type、attached(位于挂载元素(例如按钮)的角上,并保留其外观);setCount()。

Progress, Spinner, Skeleton

const bar = VibeFoxJSUi.createProgressBar('#app', { value: 30, max: 100, label: true, striped: true });
bar.setValue(80);
const spin = VibeFoxJSUi.createSpinner('#app2', { size: 'l', shape: 'dots', label: 'Loading orders…', delay: 200 });
VibeFoxJSUi.createSkeleton('#preview', { rows: 3, avatar: true, animated: true, widths: ['60%', '90%', '40%'] });

ProgressBar:value、max、indeterminate、striped、label;事件 valueChange、complete。Spinner:size、shape('ring'、'dots')、label、showLabel、visible、delay、overlay(覆盖已定位的父元素);show()、hide()、isVisible()、setLabel()。Skeleton:rows、avatar、animated、widths。

Carousel

const slides = VibeFoxJSUi.createCarousel('#app', { label: 'Products', loop: true, autoplay: 5000, perView: { 0: 1, 600: 2, 900: 3 }, perMove: 1,
  items: [{ content: '<p>One</p>' }, { content: '<p>Two</p>' }, { content: '<p>Three</p>' }, { content: '<p>Four</p>' }] });
slides.goTo(2);

选项:items、active、loop、autoplay(在用户启用了减少动态效果(reduced motion)时不会启动)、interval、pauseOnHover、arrows、indicators、swipe、effect('slide'、'fade')、perView(数字、'auto' 或按宽度设置)、perMove、label。方法:next()、prev()、goTo()、getActive()、play()、pause()、isPlaying()、getPerView()。事件:slideChange、autoplayChange。

看板

由列(以及可选的泳道)组成的看板,卡片由你的数据定义。卡片可以通过拖放、键盘或其 "Move" 菜单移动;内置 WIP 限制、搜索、快速添加、撤销 / 重做,以及用于长列的虚拟单元格。

const board = VibeFoxJSUi.createKanban('#app', {
  columns: [{ id: 'todo', title: 'To do' }, { id: 'doing', title: 'In progress', limit: 3 }, { id: 'done', title: 'Done' }],
  cards: [
    { id: 1, column: 'todo', title: 'Write docs', labels: [{ text: 'docs', color: 'info' }], assignees: ['Ann'], due: '2026-11-10' },
    { id: 2, column: 'doing', title: 'Fix login', labels: ['bug'], progress: 40 },
  ],
  swimlaneField: null, wipStrict: true,
});
board.on('cardDrop', (e) => { if (e.to.column === 'done' && !confirm('Done?')) e.preventDefault(); });
board.on('cardsChange', (e) => console.log(e.reason, e.ids));
board.moveCard(1, { column: 'doing', index: 0 });
board.addCard({ id: 3, title: 'Review PR' }, { column: 'todo' });

选项:cards(或 data)、columns({ id, title, limit, wipStrict, collapsed, width, color })、swimlanes、keyField、columnField、swimlaneField、fields(卡片各部分的字段名)、template、cardLabel、draggable、columnDraggable、wipStrict、collapsible、search(搜索文本:字符串,每个词都必须出现在标题、描述、标签或负责人中)、filter(函数)、toolbar(看板上方的搜索栏,默认为 true)、quickAdd、virtual、cardHeight、dateFormat、headingLevel、undoLimit、label、disabled。卡片字段:id、column、title、description、labels、assignees、due、progress、color。方法:getCards()、getCard()、getCardPlace()、getCardParts()、getColumns()、getSwimlanes()、addCard()、updateCard()、removeCard()、moveCard()、moveColumn()、collapseColumn()、collapseSwimlane()、setSearch()、getSearch()、setFilter()、scrollToCard()、focusCard()、undo()、redo()、canUndo()、canRedo()。事件:cardClick、cardDragStart、cardDrop(可取消)、cardMove、cardDragEnd、cardAdd(可取消)、cardsChange、columnDrop、columnMove、columnCollapse、swimlaneCollapse、wipExceed、searchChange。cardMove 和 columnMove 携带 reason:'drag'、'keyboard'、'menu'(移动菜单)或 'api'。

聊天与 AI 提示

Chat

消息列表与编辑框:支持 Markdown 消息、按作者和时间分组、日期分隔线、回复、表情反应、复制、附件(发送前通过 FileUpload 选项上传)、提及、输入中提示、建议、加载更早的消息以及流式消息。

const chat = VibeFoxJSUi.createChat('#app', {
  user: { id: 'me', name: 'Me' },
  users: [{ id: 'ann', name: 'Ann', status: 'online' }],
  messages: [{ id: 1, author: 'ann', text: 'Hi! Did you see **the report**?', time: Date.now() - 60000 }],
  attachments: true, mentions: true, suggestions: ['Yes', 'Not yet'],
});
chat.on('send', (e) => { fetch('/api/messages', { method: 'POST', body: JSON.stringify(e.message) }); });
chat.addMessage({ author: 'ann', text: 'Great, thanks.' });
chat.setTyping(['ann']);

选项:messages(或 data;{ id, author, text, time, status, replyTo, reactions, attachments, kind, edited })、user、users、markdown、messageTemplate、linkTarget、groupWindow、dateSeparators、showAvatars、showNames、timeFormat、reactions、allowReactions、allowReply、allowCopy、value、placeholder、inputLabel、sendOnEnter、maxRows、maxLength、mentions、attachments、accept、maxFileSize、pasteImages、upload、typing、suggestions、showSuggestions、sendStatus、hasMore、announce、virtual、label、composer、disabled。方法:getMessages()、getMessage()、addMessage(m, { prepend })、updateMessage()、removeMessage()、clear()、setTyping()、setHasMore()、send()、reply()、cancelReply()、toggleReaction()、copyMessage()、streamMessage()、stop()、isStreaming()、addFiles()、scrollToBottom()、scrollToMessage()、getValue()、setValue()。事件:send(可取消)、messageAdd、messageUpdate、messageRemove、reactionToggle、reply、copy、resend、attachmentClick、typingChange、mention、loadMore、streamStart、streamEnd、valueChange、suggestionClick。

AI Prompt

AIPrompt 是与助手的聊天:你的 request 函数接收提示和对话内容,并返回回答——可以是字符串、异步可迭代对象、ReadableStream、来自你服务器的 Response,或通过 ctx.push() / ctx.done() 推送的片段。库本身从不调用模型或服务;Stop 会中止 ctx.signal。

const ai = VibeFoxJSUi.createAIPrompt('#app2', {
  assistant: { name: 'Assistant' },
  suggestions: ['Summarize my week', 'Draft an e-mail'],
  request: (prompt, ctx) => fetch('/api/ai', { method: 'POST', body: JSON.stringify({ messages: ctx.messages }), signal: ctx.signal }),
});
ai.ask('What can you do?');

AIPrompt 专有选项:request、assistant({ id, name, avatar, icon })、retry(最后一条回答上的 Retry 按钮);另外支持 Chat 的全部选项。方法:ask(prompt)、retry(id) 以及 Chat 的方法。事件:retry 以及 Chat 的事件。chat.streamMessage(source) 会以相同方式将任意回答以流式输出到普通的 Chat 中。

文件管理器

基于后端的资源管理器:文件夹树、详细信息视图和磁贴视图、排序、搜索、预览、新建文件夹、重命名、剪切 / 复制 / 粘贴、拖放、删除、上传(支持分块,也支持拖入的文件夹)和下载。后端由你编写的适配器(adapter)提供;createMemoryFileAdapter(tree) 是一个内存中的适配器,适用于原型开发。

const fm = VibeFoxJSUi.createFileManager('#app', {
  adapter: VibeFoxJSUi.createMemoryFileAdapter([
    { name: 'Documents', children: [{ name: 'report.pdf', size: 120000 }, { name: 'notes.txt', content: 'Hello' }] },
    { name: 'Images', children: [] },
  ]),
  view: 'details', tree: true, preview: true, height: 420,
});
await fm.navigate('/Documents');
fm.on('fileOpen', (e) => console.log('open', e.entry.path));
await fm.createFolder('Archive');

适配器必须实现 list(path, { signal }),并可选实现 mkdir、rename、move、copy、remove、upload(每个分块调用一次)、download、search、thumbnail;适配器缺少的方法会隐藏对应的命令;带有 code 'EEXIST'、'ENOENT'、'EINVAL' 或 'EACCES' 的错误会显示本地化消息。选项:adapter、data(内存适配器的树)、path、rootName、view、sort、foldersFirst、columns、thumbnails、tree、treeWidth、preview、selection、readonly、disabled、confirmDelete、conflict('rename'、'overwrite'、'error')、renameNew、upload(FileUpload 的选项)、search、searchDelay、filter、contextMenu、virtual、height、label。方法:navigate()、back()、forward()、up()、refresh()、open()、getPath()、getEntries()、getAdapter()、setView()、setSort()、setSearch()、getSelected()、select()、selectAll()、clearSelection()、createFolder()、rename()、startRename()、copy()、cut()、paste()、getClipboard()、clearClipboard()、move()、copyTo()、remove()、upload()、download()、execute(command)。事件:pathChange、load、selectionChange、fileOpen、beforeAction(可取消)、action、error、viewChange、sortChange、searchChange、clipboardChange、contextMenu、menuAction、layoutChange。

查询构建器

可视化的筛选条件编辑器,支持 AND / OR 分组。其模型与 VibeFox JS Grid 的筛选模型相同({ op, not, rules: [{ field, op, value }] }),并可将该模型转换为带参数的 SQL、可读文本或筛选函数。

const qb = VibeFoxJSUi.createQueryBuilder('#app', {
  fields: [
    { field: 'name', label: 'Name', type: 'text' },
    { field: 'score', label: 'Score', type: 'number' },
    { field: 'city', label: 'City', type: 'list', options: ['Berlin', 'Paris'] },
    { field: 'active', label: 'Active', type: 'boolean' },
  ],
  value: { op: 'and', rules: [{ field: 'score', op: '>=', value: 50 }, { field: 'city', op: 'in', values: ['Berlin'] }] },
  summary: true,
});
console.log(qb.toSQL({ params: true }));     // { sql, params }
console.log(qb.toText());
const rows = [{ name: 'Ann', score: 70, city: 'Berlin', active: true }].filter(qb.getPredicate());

运算符:文本使用 contains、notContains、equals、notEquals、startsWith、endsWith、blank、notBlank;数字和日期使用 =、!=、>、>=、<、<=、between;布尔值使用 isTrue、isFalse;列表使用 in、notIn。选项:fields({ field, label, type, options, operators, editor };VibeFox JS Grid 的列定义同样适用)、value、maxDepth、allowNot、allowGroups、summary、label、readonly。方法:getValue()、setValue()、getFilterModel()、setFilterModel()、getDraft()、clear()、addRule()、validate()、toSQL()、toText()、getPredicate()、toJSON()。事件:valueChange、filterChange、validate。

电子表格

工作簿,包含多个工作表、公式栏、格式设置、数字格式、跨工作表公式(VibeFox JS 的公式引擎,采用 Excel 语法)、自定义函数和名称、撤销 / 重做,以及 Excel (.xlsx) 的导入和导出。

const sheet = VibeFoxJSUi.createSpreadsheet('#app', {
  data: { sheets: [{ name: 'Sales', rows: [['Month', 'Units', 'Price', 'Total'], ['Jan', 10, 2.5, '=B2*C2'], ['Feb', 14, 2.5, '=B3*C3']],
    styles: { 'A1': { bold: true }, 'D2': { numFmt: '#,##0.00' } }, colWidths: { A: 120 } }] },
  functions: { TAX: (x) => x * 0.2 },
  names: { RATE: 0.2 },
});
sheet.setCell('D4', '=SUM(D2:D3)');
console.log(sheet.getValue('D4'), sheet.evaluate('=TAX(100)'));
sheet.setStyle('D2:D4', { fill: '#fef3c7', align: 'end' });
const bytes = await sheet.getXlsx();

选项:data({ sheets: [{ name, cells, rows, styles, colWidths, rowCount, colCount }], active })、rows、cols、toolbar、formulaBar、tabs、status、readOnly、functions、names、currency、fileName、label、historyLimit。单元格样式:bold、italic、underline、strike、color、fill、align、numFmt(Excel 格式代码)。方法:getData()、getSheets()、getActiveSheet()、setActiveSheet()、addSheet()、removeSheet()、renameSheet()、moveSheet()、getCell()、getValue()、setCell()、getRange()、setRange()、setStyle()、setColumnWidth()、select()、selectAll()、getSelection()、editCell()、evaluate()、registerFunction()、getFormulaEngine()、undo()、redo()、canUndo()、canRedo()、getXlsx()、exportXlsx()、importXlsx()。事件:change、cellChange、selectionChange、sheetChange、sheetRemove(可取消)、editStart、editEnd、historyChange、import、export。

图像编辑器

裁剪(自由裁剪或按比例)、旋转、翻转、拉直、调整大小、滤镜(亮度、对比度、饱和度、灰度、复古褐色、模糊、锐化)和标注(画笔、箭头、矩形、椭圆、文本、模糊 / 像素化区域),并带有历史记录,可导出为 PNG、JPEG 或 WebP。编辑内容以 JSON 文档保存,导出时才会应用到原图上。

const canvas = document.createElement('canvas'); canvas.width = 400; canvas.height = 300;
canvas.getContext('2d').fillRect(50, 50, 200, 120);
const img = VibeFoxJSUi.createImageEditor('#app2', { src: canvas, history: true, format: 'image/jpeg', quality: 0.9 });
await img.load(canvas);
img.rotate(90);
img.setFilters({ brightness: 10, contrast: 15 });
img.addShape({ type: 'text', x: 20, y: 20, text: 'Draft', size: 32, color: '#dc2626' });
const blob = await img.export({ type: 'image/png' });

选项:src、tools、tool、history、historyLimit、cropRatios、cropRatio、previewMaxPixels、maxPixels、format、quality、fileName、open(一个 Open 按钮和文件拖放)、colors、label。方法:load()、getTool()、setTool()、rotate()、flip()、setFilters()、getFilters()、resize()、resetEdits()、setCropRatio()、swapCropFrame()、setAngle()、getCrop()、setCrop()、applyCrop()、cancelCrop()、addShape()、deleteShape()、getShapes()、selectShape()、undo()、redo()、canUndo()、canRedo()、goTo()、getHistory()、toCanvas()、export()、toDataURL()、save()、getZoom()、setZoom()、getImageSize()、getOutputSize()。事件:load、change、toolChange、historyChange、selectionChange、save(可取消)、error。

签名板与条形码

SignaturePad

const sign = VibeFoxJSUi.createSignaturePad('#app', { name: 'signature', required: true, format: 'svg', penWidth: 2.5, velocity: 0.6 });
sign.setValue({ width: 300, height: 120, strokes: [{ points: [[20, 80, 1], [120, 40, 1], [220, 90, 1]] }] });
console.log(sign.isEmpty(), sign.toSVG().length);
const png = sign.toDataURL('image/png', { trim: true, scale: 2 });

选项:value、color、penWidth、minWidth、maxWidth、pressure、velocity、smoothing、background、guide、placeholder、toolbar(撤销、重做、清除)、label、format(表单值:'png'、'svg'、'json')、readonly。方法:isEmpty()、getValue()、setValue()、undo()、redo()、clear()、toCanvas()、toDataURL()、toBlob()、toSVG()、download()。事件:strokeStart、strokeEnd、valueChange、clear。

二维码与条形码

VibeFoxJSUi.createQRCode('#app2', { value: 'https://example.com/ticket/42', ecLevel: 'M', moduleSize: 4, label: 'Ticket link' });
const ean = VibeFoxJSUi.createBarcode('#preview', { type: 'ean13', value: '400638133393', text: true, height: 60 });
console.log(ean.isValid(), ean.getValue());
const symbol = VibeFoxJSUi.encodeBarcode('qr', 'HELLO');    // modules, version, mask … (also in Node)

类型:qr、datamatrix、code128、ean13、ean8、upca、code39、itf、itf14。选项:type、value、render('svg' 或 'canvas')、moduleSize、height、margin、text、color、background、label;QR:ecLevel、version、mask、mode、eci、logo(位于中央的图片);Data Matrix:shape、symbolSize;Code 39 / ITF:checksum、fullAscii、wide、bearer。方法:getValue()、setValue()、isValid()、getSymbol()、toSVG()、toCanvas()、toDataURL()、toBlob()、download()。事件:render、error。

主题与样式

主题

每个 VibeFox JS 组件的 CSS 文件中都内置了主题 light(默认)、dark 和 high-contrast。可选的 vibefox-js-themes.css 会添加主题包:high-contrast-light、paper、paper-dark、glass、glass-dark、classic、classic-dark、ocean、ocean-dark、forest、forest-dark、sunset、sunset-dark、graphite、graphite-dark。同一个文件适用于所有 VibeFox JS 库。

VibeFoxJSUi.setTheme('dark');                 // the whole page
VibeFoxJSUi.setTheme('ocean', '#sidebar');    // every component inside a container
select.setTheme('glass');                    // one component (also: the theme option)
select.setTheme(null);                       // follow the page / container again

未设置自身 theme 的组件会跟随最近的带有主题的容器,然后是页面。调用 setTheme(name, container) 后,主题变量也会设置在容器本身上,因此容器的 CSS 可以使用它们(#sidebar { background: var(--vfjs-bg); })。自定义主题:使用 registerTheme(name, vars) 并传入主题变量(bg、fg、border、accent、accent-fg、muted、surface、radius、font、shadow、palette-0 … palette-9 以及任何其他设计令牌);它会立即作用于所有使用该主题的组件。getTheme() 返回页面主题,themes 列出已注册的主题;切换主题时会触发 themeChange 事件。

VibeFoxJSUi.registerTheme('brand', { accent: '#e11d48', 'accent-fg': '#ffffff', radius: '10px' });
select.setTheme('brand');

CSS 变量

VibeFox JS UI 的每种颜色、尺寸、间距、字体、圆角、阴影和时长都是 CSS 变量,因此任何设置都只需在一处修改。变量分为三个层级:

  • 所有 VibeFox JS 组件共享的主题变量:--vfjs-bg、--vfjs-fg、--vfjs-border、--vfjs-accent、--vfjs-accent-fg、--vfjs-muted、--vfjs-surface、--vfjs-radius、--vfjs-font、--vfjs-shadow、--vfjs-palette-0 … --vfjs-palette-9;
  • 设计令牌:间距 --vfjs-space-1 … --vfjs-space-8、字号 --vfjs-font-size、--vfjs-font-size-sm 等、圆角 --vfjs-radius-sm …、状态颜色 --vfjs-danger、--vfjs-success、--vfjs-warning、--vfjs-info、尺寸单位 --vfjs-size-unit、动画时长 --vfjs-motion-duration、焦点环 --vfjs-focus-ring-color 和 --vfjs-focus-ring-width;
  • 库自身的变量 --vfjs-ui-*,其默认值取自上述令牌。
/* all VibeFox JS components of the page */
.vfjs { --vfjs-accent: #0f766e; --vfjs-radius: 4px; }
/* only this form */
#checkout {
  --vfjs-ui-field-bg: #f8fafc;
  --vfjs-ui-btn-bg: #0f766e;
  --vfjs-ui-control-border: #94a3b8;
}

约 750 个变量,均以 --vfjs-ui- 开头。共享变量包括:尺寸比例(--vfjs-ui-scale、--vfjs-ui-scale-s、--vfjs-ui-scale-l、--vfjs-ui-font-size)、外观(--vfjs-ui-filled-bg、--vfjs-ui-outline-border、--vfjs-ui-ghost-hover-bg)、控件颜色(--vfjs-ui-control-border、--vfjs-ui-accent-text)、最小指针目标(--vfjs-ui-target-min)。各组件专用:按钮(--vfjs-ui-btn-bg …)、字段(--vfjs-ui-field-bg、--vfjs-ui-field-border …)、选项(--vfjs-ui-option-selected-bg …)、标签页(--vfjs-ui-tab-active-fg …)、窗口(--vfjs-ui-window-bg、--vfjs-ui-dialog-width)、抽屉(--vfjs-ui-drawer-size)、Toast(--vfjs-ui-toast-accent)、徽标(--vfjs-ui-badge-hue)、列表(--vfjs-ui-list-item-height)、芯片(--vfjs-ui-chip-height)、头像(--vfjs-ui-avatar-size)、磁贴(--vfjs-ui-tile-row-height)、看板(--vfjs-ui-kanban-card-estimate)、文件管理器(--vfjs-ui-fm-tree-width)、轮播(--vfjs-ui-carousel-slide-width)、签名(--vfjs-ui-sign-pen)、编码(--vfjs-ui-code-module、--vfjs-ui-barcode-height)。

按钮:--vfjs-ui-btn-bg 为未设置自身 variant 的按钮着色;--vfjs-ui-btn-primary-bg 为所有主要按钮着色(也包括 variant: 'primary');其他外观各有自己的变量(--vfjs-ui-btn-secondary-bg …)。

在 JavaScript 中:可以在挂载元素(el.style.setProperty('--vfjs-ui-btn-bg', '#0f766e'))或某个容器上设置这些变量。

设置位置:可以设在 :root 上、页面的任意容器上(#checkout { --vfjs-accent: #0f766e; })、组件元素本身上,或主题(registerTheme)中。以最近的值为准;拥有自身主题(选项 theme 或 component.setTheme(name))的组件,即使位于设置了这些变量的容器内,仍会保留该主题的主题变量。位于另一个组件内部的容器(例如对话框或卡片中的表单)同样会把库的变量传递给其中的组件。只有共享设计令牌(--vfjs-space、--vfjs-danger、--vfjs-selected-bg …)不会向下传递:请将它们设置在外层组件之外的容器上,或直接设置在嵌套的组件上(#form .vfjs { … })。部分尺寸变量会在每个组件上计算(--vfjs-ui-scale、--vfjs-ui-font-size、--vfjs-ui-font-size-xs、--vfjs-ui-font-size-sm、--vfjs-ui-font-size-lg、--vfjs-ui-avatar-size、--vfjs-ui-chip-height、--vfjs-ui-list-item-height、--vfjs-ui-rating-size、--vfjs-ui-spinner-size、--vfjs-ui-step-marker-size、--vfjs-ui-carousel-btn-size、--vfjs-ui-carousel-dot-size):可以在容器上设置它们的基础变量(--vfjs-ui-scale-s、--vfjs-ui-scale-m、--vfjs-ui-scale-l、--vfjs-ui-font-size-s、--vfjs-ui-font-size-m、--vfjs-ui-font-size-l、--vfjs-ui-avatar-size-md …),也可以直接在组件本身上设置该变量。放在 <body> 中的弹出层、菜单和对话框采用页面(:root)上设置的值,而不是其所属组件容器的值。

默认值:主题变量通过 @property 注册(其初始值为浅色主题),因此页面上的每个元素都有值。库的变量(--vfjs-ui-*)在样式表中、即在使用处保留其默认值,因此你未设置的变量在你的元素上没有值:

  • 在你自己的 CSS 中使用库的变量时,请像库本身那样为其提供回退值:var(--vfjs-ui-field-bg, var(--vfjs-bg)),或直接使用主题变量;
  • 在 JavaScript 中,使用 cssVar(element, '--vfjs-ui-font-size') 读取当前值(由库导出;它同样会返回组件计算出的默认值);对于没有人设置过的库变量,getComputedStyle(element).getPropertyValue() 可能返回空字符串。
/* your own element in the colors of the component */
.my-summary { background: var(--vfjs-ui-field-bg, var(--vfjs-bg)); color: var(--vfjs-fg); }
const el = document.querySelector('#orders');
console.log(VibeFoxJSUi.cssVar(el, '--vfjs-ui-font-size'));                    // the value in use (also a default)
console.log(getComputedStyle(el).getPropertyValue('--vfjs-ui-font-size'));  // can be '' unless you set it

如果库的 CSS 文件来自未启用 CORS 的其他源(即没有 crossorigin 属性的 <link>),浏览器不允许脚本读取该样式表,因此对于在组件根元素上没有值的变量,cssVar() 会返回空字符串。从你自己的源加载,或加上该属性之后,即可正常工作。

--vfjs-ui-sheet-ref 本身没有值:库会为电子表格中的每个公式引用设置它,取值来自 --vfjs-ui-sheet-ref-0 … --vfjs-ui-sheet-ref-7;请修改这些变量。--vfjs-ui-ac-mark-fg 和 --vfjs-ui-md-link 默认为 inherit(周围文本的颜色),cssVar() 会返回 inherit。

样式表使用原生 CSS 嵌套编写;引入它们时无需任何特殊处理,你自己的 CSS 可以采用任意写法。

外观与尺寸

每个组件都有选项 variant('filled'、'outline'、'ghost')和 size('s'、'm'、'l';也可使用 'sm'、'md'、'lg')。null(默认值)会采用最近容器的外观,否则采用默认外观。无需 JavaScript,也可以在容器上设置属性 data-vfjs-ui-variant="outline" / data-vfjs-ui-size="s"(或类 vfjs-ui-variant-outline / vfjs-ui-size-s):其中的每个组件都会跟随;组件自身的选项优先。弹出层(下拉列表、菜单、对话框、Toast)采用其所属组件的外观。

document.querySelector('#app').setAttribute('data-vfjs-ui-variant', 'outline');   // everything inside
const name = VibeFoxJSUi.createInput('#app', { label: 'Name' });                       // outline
const go = VibeFoxJSUi.createButton('#app2', { label: 'Go', variant: 'ghost', size: 'l' });

部分组件还有各自的取值:Button 的 'primary'、'secondary'、'danger';Card 的 'outlined'、'elevated';Chip 的 'outlined';Avatar 和 Spinner 的尺寸 'xs'、'xl' 或 px。尺寸会缩放控件高度(默认尺寸单位下为 26 / 32 / 40 px)、字体和内部尺寸。

密度与尺寸

在页面或任意容器上设置 data-vfjs-density="compact"、"normal" 或 "comfortable":其中每个 VibeFox JS 组件的高度和内边距都会随之变化。--vfjs-size-unit(默认为 1px)可以一次性缩放组件的所有尺寸,例如 #orders { --vfjs-size-unit: 1.25px; }。在选项中以数字给出的尺寸单位为像素,不会被缩放。

默认高度:当 Chat、AI Prompt、DockLayout、FileManager、Spreadsheet 或 ImageEditor 的元素没有自身高度时,它会获得类 vfjs-auto-height,并使用某个变量所定义的默认高度:--vfjs-ui-chat-min-height(Chat 和 AI Prompt,400 px)、--vfjs-ui-dock-min-height(400 px)、--vfjs-ui-fm-height(440 px)、--vfjs-ui-sheet-height(420 px)、--vfjs-ui-imged-height(520 px);以上均需乘以 --vfjs-size-unit;消息、文件和行在其内部滚动。有自身高度的元素(设置了 height、仅设置了 min-height、作为弹性项或 CSS Grid 项、父元素有高度时设置了 height: 100%,或使用绝对定位的 insets)会获得类 vfjs-fit,并被精确填满,即使内容更小也是如此;内容永远不会使它变高。将变量设为 0(类 vfjs-content-height)后,Chat、FileManager 和 Spreadsheet 的高度与其全部消息、文件或行一致,自身不滚动;DockLayout 和 ImageEditor 则由宽度决定高度(--vfjs-ui-dock-aspect-ratio、--vfjs-ui-imged-aspect-ratio;默认值来自令牌 --vfjs-aspect-ratio,即 2 / 1)。其他组件的高度与其内容一致。

自定义 CSS

库的全部规则都位于级联层 @layer vfjs 中,因此你自己的 CSS 无需使用 !important 即可始终优先生效。VibeFox JS UI 的类名均以 vfjs-ui- 开头(修饰符类同样如此,例如 vfjs-ui-btn--pressed),因此页面上的其他 CSS 框架不会改变其样式。

.vfjs-ui-btn--primary { text-transform: uppercase; }
.vfjs-ui-btn--pressed { font-weight: 600; }

库不附带字体文件。它使用令牌 --vfjs-font、--vfjs-font-mono 和 --vfjs-font-serif 所指定的系统字体栈;如有需要,可将它们设置为你自己的字体。动画遵循 prefers-reduced-motion,颜色遵循强制颜色模式(Windows 高对比度)。

本地化与 RTL

语言

VibeFox JS UI 提供 14 种界面语言。英语(en)内置于库文件中;其余每种语言各有一个独立的语言文件(包中的 dist/locales/vibefox-js-ui.<lang>.js),页面只加载其所用的语言:俄语(ru)、西班牙语(es)、德语(de)、法语(fr)、意大利语(it)、葡萄牙语(巴西)(pt)、乌克兰语(uk)、土耳其语(tr)、中文(简体)(zh)、日语(ja)、韩语(ko)、印地语(hi)和阿拉伯语(ar)。locale 选项用于设置单个组件的语言;setLocale(lang) 用于设置页面的默认语言,所有未设置自身 locale 的组件都会跟随它(切换时会重新渲染)。

VibeFoxJSUi.setLocale('ru');                                  // page default
const select = VibeFoxJSUi.createSelect('#app', { options: items, locale: 'en' }); // this select only
select.setOptions({ locale: 'de' });

上面的示例需要其所用语言的文件。使用 script 标签时,请在库之后加载语言文件。顺序很重要:如果先加载,语言文件不会添加任何语言,并会在控制台中输出一条警告。

<link rel="stylesheet" href="vibefox-js-ui.css">
<script src="vibefox-js-ui.global.min.js"></script>
<script src="locales/vibefox-js-ui.ru.js"></script>

使用 npm 或打包工具时,请在库之后导入语言。不使用 npm 时,ES 模块页面可导入 ./locales/vibefox-js-ui.ru.esm.js,它会在 vibefox-js-ui.esm.js 中注册该语言。

import { createSelect } from '@vibefox/js-ui';
import '@vibefox/js-ui/locales/ru';

.esm.js 语言文件不适用于压缩构建版本 @vibefox/js-ui/min(会加载库的第二份副本)。在该版本中,请使用 .json 文件:

import { createSelect, addLocale } from '@vibefox/js-ui/min';
import ru from '@vibefox/js-ui/locales/ru.json';
addLocale('ru', ru);

若缺少对应文件,locale: 'ru' 会显示英文,并在控制台中输出一条警告。

语言代码:uk、ko、zh 和 pt 为正式代码;ua 和 kr 同样可用,作为 uk 和 ko 的别名。对于每个字符串,库会依次尝试精确代码、别名、基础语言(pt-BR → pt、zh-CN → zh)、英语,最后是键名本身。normalizeLocale(code) 返回别名对应的正式代码。

语言本身不设置文字方向:使用 locale: 'ar' 时,还需在容器上设置 rtl: true 或 dir="rtl"。

添加语言

addLocale(lang, dictionary) 为某种语言添加字符串(若该语言不存在则创建):可用于你自己的语言,或在语言文件之上替换为你自己的措辞。缺失的键会按上述顺序查找,因此部分词典同样有效;addLocale('ua', …) 会填充 uk。请在创建使用该词典的组件之前添加词典,或之后再切换语言。

VibeFoxJSUi.addLocale('de', {
  'ui.select.placeholder': 'Auswählen…',
  'ui.select.empty': 'Nichts gefunden',
});

VibeFox JS UI 的键以 ui. 和组件名开头(ui.select.placeholder、ui.date.prevMonth、ui.toast.close …;约 730 个键:占位符、按钮名称、屏幕阅读器文本,以及大型组件的菜单)。语言文件列出了每一个键(locales/vibefox-js-ui.ru.json);英文文本位于可读的文件 vibefox-js-ui.esm.js 中。花括号中的占位符(如 {count})由库填充。t(key, params) 按页面语言翻译键,select.t(key) 按组件的语言翻译;getLocale() 返回页面语言,onLocaleChange(fn) 用于接收语言变更通知。

复数形式:带数字的文本使用键 <key>.zero、.one、.two、.few、.many 和 .other(即 Intl.PluralRules 的类别);.other 为回退项,因此你的词典可以只提供该形式。{count} 和 {n} 会被填充。tPlural(key, count, params, lang) 用于选择形式;方法 select.tPlural(key, count, params) 则按组件的语言执行同样的操作。

VibeFoxJSUi.addLocale('de', {
  'ui.upload.maxFiles.one': 'Bis zu {count} Datei',
  'ui.upload.maxFiles.other': 'Bis zu {count} Dateien',
});
VibeFoxJSUi.tPlural('ui.upload.maxFiles', 5, {}, 'de');  // 'Bis zu 5 Dateien'

日期和时间选择器会从区域设置(Intl)获取月份和星期名称、每周的第一天以及 12 / 24 小时制,除非你设置了 firstDay、hour12 或 format;看板和聊天使用 dateFormat / timeFormat 格式化日期;电子表格则采用该区域设置的小数分隔符和货币。

从右到左(RTL)

选项 rtl: true 使组件按从右到左排布(其元素上设置 dir="rtl");rtl: false 强制从左到右;未设置时,组件跟随页面或其容器(<html dir="rtl">)。方向键遵循阅读顺序。isRtl(element) 返回元素的文字方向。

在 VibeFox JS UI 中,每个组件都会镜像:箭头、菜单和子菜单、抽屉、滑块和轮播都会随阅读方向调整,方向键也随之调整。二维码、条形码、签名和图像永远不会被镜像。

无障碍

组件遵循 WAI-ARIA Authoring Practices,并已按 WCAG 2.2 AA 进行审核:角色、名称、状态和播报;键盘访问,每个复合组件(工具栏、标签列表、树、网格、列表)只有一个 Tab 停靠点;可见的焦点;所有主题和外观下文本、控件边框和状态的对比度;在每种尺寸和密度下,指针目标至少为 24 × 24 px(--vfjs-ui-target-min × --vfjs-size-unit),尺寸 's' 与紧凑密度同样如此:尺寸 s 和紧凑密度保留更小的字体、内边距和图标,只有小于 24 px 的方框会被放大(颜色色块保持其尺寸,并在它们之间留出更大的间距;对话框的调整大小角由窗口菜单提供等效操作)。若需要更紧凑的控件,请将 --vfjs-ui-target-min 设置得更小。焦点可见(焦点环由 CSS 变量 --vfjs-focus-ring-color、--vfjs-focus-ring-width、--vfjs-focus-ring-offset、--vfjs-focus-ring-style 控制);对话框会将焦点保持在其内部,并在关闭时将其归还。支持 high-contrast 和 high-contrast-light 主题、强制颜色模式以及 prefers-reduced-motion。

键盘

按键遵循各类组件的常用模式:

按键操作
Tab, Shift+Tab移到下一个 / 上一个组件(工具栏、标签列表、树、列表、网格各占一个停靠点)。
方向键, Home, End在复合组件内部:标签页、菜单项、工具栏按钮、树行、列表选项、日历日期、单选按钮、分段。
Enter, Space激活、选择、切换。
↓, ↑, Enter, Space(下拉选择);↓, Alt+↓(自动完成、选择器)打开列表或弹出层;Alt+↑ 关闭自动完成列表。
Esc关闭弹出层、菜单、对话框或抽屉,并归还焦点。
PageUp, PageDown日历:上一月 / 下一月(按 Shift 时切换年份)。
Delete关闭可关闭的标签页或停靠面板,在允许的情况下删除芯片或列表项。
Alt+↑, Alt+↓(可拖动列表、穿梭列表)上移 / 下移该项。
Shift+F10, Menu 键当前焦点项的右键菜单;对于可拖动的项,则打开其 "Move…" 菜单。
Alt+方向键(停靠面板)将面板移到另一个区域。
Alt+Shift+方向键, Ctrl+Alt+Shift+方向键(窗口)移动 / 调整窗口大小。
Ctrl+K, Cmd+K命令面板(选项 hotkey)。
Ctrl+Z, Ctrl+Y撤销 / 重做,适用于看板、TileLayout、电子表格、图像编辑器、SignaturePad。

无需拖动的拖放

所有可拖动的内容也都有 "Move…" 菜单(WCAG 2.5.7),其中列出了可移动到的位置和尺寸调整步骤。菜单可通过以下方式打开:

  • 在拖动手柄上不移动地单击或轻触(磁贴和列的抓手、分隔条、电子表格的列边缘、裁剪框),或点击某个项上的小型 "Move" 手柄(该项自身的单击会执行其他操作,例如看板卡片、列表项、标签页、停靠标签;悬停和获得焦点时显示,在触摸屏上始终显示);
  • 对话框标题栏开头的窗口菜单按钮;
  • 项目的右键菜单(右键单击,或在浏览器触发 contextmenu 的情况下长按);
  • 在焦点项上按 Shift+F10 或 Menu 键。

选择菜单项与拖放的效果相同:触发相同的可取消事件,reason: 'menu'(看板的 cardMove / columnMove,TileLayout 的 layoutChange),产生一个撤销步骤并进行播报;随后焦点移至被移动的项,按 Esc 则将焦点归还给该项。在模态窗口中,菜单保持焦点,并列出目标而不使用子菜单。

组件菜单
看板卡片:上移、下移、移到顶部、移到底部、移到另一列或泳道(已满的严格 WIP 列会被禁用)。列(其抓手或标题):左移、右移、移到开头、移到末尾。
TileLayout左 / 右 / 上 / 下移动;变宽、变窄、变高、变矮(不产生任何变化的步骤会被禁用)。
DockLayout将面板停靠到左侧、顶部、中央、底部或右侧。
ListView、ListBox(draggable、dragGroup)上移、下移、移到顶部、移到底部、移到同一分组中的其他每个列表;选中的项会一起移动。moveMenu: false 会关闭该菜单及其手柄。
Tabs(reorder)左移、右移、移到开头、移到末尾。
Dialog按步长移动、居中、变宽 / 变窄 / 变高 / 变矮。
Splitter、FileManager 树分隔条按步长向前 / 向后移动、移到开头、移到末尾(双击分隔槽仍会折叠其窗格)。
电子表格列边缘:变宽、变窄、恢复默认宽度。工作表标签:手柄会打开工作表菜单(左移 / 右移 …)。
图像编辑器裁剪框:移动和调整大小的步骤;选中的图形:移动步骤。使用图形工具单击时会以默认尺寸添加该图形;自由画笔(与签名板相同)本质上是路径。

手柄通过 --vfjs-ui-movebtn-size、--vfjs-ui-movebtn-fg、--vfjs-ui-movebtn-bg、--vfjs-ui-movebtn-hover-bg、--vfjs-ui-movebtn-hover-fg、--vfjs-ui-movebtn-radius 和 --vfjs-ui-movebtn-idle-opacity 设置样式(1 表示始终显示)。TransferList、Carousel、Slider 和 ColorPicker 不需要菜单:它们的按钮、箭头以及对轨道的点击同样能完成相同的操作。

屏幕阅读器

控件的名称由选项 label 指定,或由页面中指向挂载元素的 <label for="…"> 指定(点击它会使控件获得焦点)。表单错误会设置 aria-invalid,并通过 aria-describedby 与之关联;Toast、结果数量和移动操作都通过同一个实时区域进行播报。

大多数组件都有 focus()。库还导出了它自身使用的辅助函数:announce(message)、trapFocus、rovingFocus、setAria、prefersReducedMotion() 等(参见 API 参考)。

与其他 VibeFox JS 库配合使用

VibeFox JS UI 可以独立使用。每个 VibeFox JS 库都是一个独立文件,并拥有各自的共享核心副本;同一页面中的多个库可以无冲突地协同工作:每个库有一个全局变量(VibeFoxJSUi、VibeFoxJSCharts 等)、带有库前缀的类名、统一的页面主题,以及相同的事件。

使用 link() 连接组件

link(source, event, target, method, transform) 会在一个组件触发某事件时调用另一个组件的方法;它返回一个用于移除该链接的函数。connect(source, event, handler) 用于订阅事件,并返回取消订阅的函数。bus 是整个页面范围的事件通道,页面上的所有 VibeFox JS 库共享。

// a query builder filters a table of VibeFox JS Grid (both files loaded on the page)
const unlink = VibeFoxJSUi.link(qb, 'filterChange', grid, 'setFilterModel', (e) => e.filterModel);
VibeFoxJSUi.bus.emit('filters:changed', { at: Date.now() });   // any library can listen: VibeFoxJSGrid.bus.on('filters:changed', fn)

页面中存在其他库时的作用

  • VibeFox JS Charts 的仪表板:当两个文件都在页面中时,图表仪表板的 layout: { engine: 'tiles' } 会使用 VibeFox JS UI 的 TileLayout(用户可以拖动和调整大小的磁贴)。
  • QueryBuilder 的模型即 VibeFox JS Grid 的筛选模型:表格的 setFilterModel() 可直接接收该模型,无需转换。
  • VibeFox JS UI 的每个组件都可以独立工作;电子表格拥有自己的公式引擎和 Excel 文件支持,无需其他库。

AI 工具

库将其主要操作描述为供语言模型进行函数调用的工具。库本身从不调用模型或服务:你需要将这些描述发送给你的模型,并执行模型请求的调用。

工具功能
sheet_list电子表格的工作表和当前选区。
sheet_get_range区域的值(或公式)。
sheet_set_range写入值和公式(一个撤销步骤)。
sheet_format_range设置区域的格式。
sheet_manage添加、重命名、删除或显示工作表。
const { describeTools, callTool, createToolKit } = VibeFoxJSUi;
const sheet = VibeFoxJSUi.createSpreadsheet('#app', { data: { sheets: [{ name: 'Sales', rows: [['Month', 'Units'], ['Jan', 10]] }] } });
const tools = describeTools(sheet, { format: 'openai' });   // 'plain' / 'anthropic', 'openai', 'webmcp'
const result = await callTool(sheet, 'sheet_get_range', { range: 'A1:D3' }); // { ok: true, result } or { ok: false, error }
const kit = createToolKit({ budget: sheet });               // tool names get the prefix 'budget_'
const answer = await kit.ask('Add a total row under the units', {
  format: 'anthropic',
  model: async (request) => (await fetch('/api/llm', { method: 'POST', body: JSON.stringify(request.body) })).json(),
});

callTool 在运行前会根据工具的 schema 检查参数,并且对错误的输入从不抛出异常。createToolKit(components, { webmcp, readOnly }) 会将多个组件(也包括其他 VibeFox JS 库的组件)的工具合并到一起,并赋予唯一的名称;kit.ask(prompt, { model, format, system, maxSteps, signal, onToolCall }) 使用你的 model 函数运行 "模型 → 工具调用 → 结果" 的循环;kit.registerWebMCP() 会在浏览器支持时将这些工具注册到 navigator.modelContext 中。registerTools(target, provider) 用于添加你自己的工具;validateSchema(value, schema) 是 schema 校验函数。

电子表格是 VibeFox JS UI 中提供工具的组件;AI Prompt 和 Chat 组件则展示与你的模型之间的对话(参见 聊天与 AI 提示)。

API 参考

组件

分组工厂函数(类为 VibeFoxJS<Name>)
按钮createButton, createButtonGroup, createSplitButton
表单控件createInput, createNumberInput, createSelect, createAutoComplete, createCheckbox, createSwitch, createRadioGroup, createSegmented, createSlider, createRating, createOTPInput
选择器createDatePicker, createTimePicker, createDateTimePicker, createColorPicker
列表createListView, createListBox, createTransferList, createTree
表单与文件createForm, createFileUpload, createQueryBuilder
导航createTabs, createAccordion, createMenu, createToolbar, createBreadcrumb, createPagination, createStepper, createWizard, createCommandPalette
浮层createDialog, createDrawer, createToast, createTooltip, createPopover, createTour
布局createSplitter, createDockLayout, createTileLayout
数据展示createCard, createAvatar, createAvatarGroup, createChip, createChipGroup, createBadge, createProgressBar, createSpinner, createSkeleton, createCarousel
大型组件createKanban, createChat, createAIPrompt, createFileManager, createSpreadsheet, createImageEditor, createSignaturePad, createQRCode, createBarcode

辅助函数:applyMask、encodeBarcode、listIcons、createMemoryFileAdapter、ensureUiStyles、VERSION。各组件的选项、方法和事件列在上文对应的章节中。

共享核心(所有 VibeFox JS 库中相同):setTheme, getTheme, registerTheme, themes, tokens, componentTokens, densities, cssVar, cssColor, cssLength, observeTokens, setLocale, getLocale, addLocale, normalizeLocale, t, tPlural, withLocale, onLocaleChange, link, connect, bus, Emitter, VibeFoxJSComponent, factory, toCSV, downloadFile, downloadCanvasPNG, createXlsx, readXlsx, XLSX_MIME, describeTools, callTool, createToolKit, registerTools, validateSchema, announce, trapFocus, rovingFocus, getFocusable, focusFirst, saveFocus, setAria, ensureId, addAriaRef, removeAriaRef, isRtl, mirrorArrow, prefersReducedMotion, prefersHighContrast, motionDuration, onPreferenceChange, injectStyles, ensureBaseStyles, formatNumber, formatDate, escapeHtml, createEl, deepMerge, isPlainObject, getPath, setPath, uid, clamp, debounce, throttle。

通用选项

此外,每个 VibeFox JS 组件都接受 theme、locale、rtl 和 on(参见 核心概念)。

选项类型默认值说明
variant'filled' | 'outline' | 'ghost'(以及各组件自身的取值)null外观;null 表示使用容器的外观或默认外观。
size's' | 'm' | 'l'null尺寸;null 表示使用容器的尺寸或 'm'。
labelstring 或 nullnull控件的无障碍名称。
disabledbooleanfalse不可用。
namestring 或 nullnull表单字段名称(与表单关联的控件)。
requiredbooleanfalse参与表单校验(Slider 除外:它始终有值)。
readonlybooleanfalse显示但不可编辑(选择器、评分、OTP、自动完成、查询构建器、签名、文件管理器)。

通用方法与事件

方法返回值说明
setOptions, setOption, getOption, getState, setState, setTheme, on, once, off, use, t, destroy—每个组件。
getValue, setValuevalue / this值类组件。
checkValidity, reportValidity, getValidationMessage, reset, focusboolean / string / this与表单关联的控件。
open, close, isOpenthis / boolean弹出层、选择器、菜单、对话框、抽屉、命令面板。
事件负载说明
ready, dataChange, optionsChange, themeChange, destroy参见 核心概念每个组件。
valueChange{ value, … }(复选框和开关为 { checked })值已更改。
open, close{}弹出层已打开 / 已关闭。
validate{ valid, message }与表单关联的控件的校验。

TypeScript 声明文件(vibefox-js-ui.d.ts)详细描述了每个选项、负载和返回类型:SelectOptions、DialogOptions、KanbanOptions、ChatOptions、FileAdapter、QueryGroup、SpreadsheetOptions、ImageEditDoc、BarcodeOptions 以及其他类型。

故障排除

没有样式

请在 script 旁边引入 vibefox-js-ui.css。缺少它时组件仍可工作,但没有任何样式,控制台会显示一条警告 "VibeFox JS stylesheet is not loaded"。在打包工具中,请导入 @vibefox/js-ui/css。框架封装包不会自动添加 CSS。

自定义 CSS 不生效,或页面 CSS 框架改变了组件

由于库的 CSS 位于 @layer vfjs 中,你的规则无需 !important 即可优先于库的规则。如果仍然不生效,请检查类名:它们都带有库前缀(应使用 vfjs-ui-btn--primary,而不是 btn-primary)。库从不使用通用类名,因此页面的 CSS 框架不会改变它。

ES 模块无法从磁盘加载

浏览器只能通过 http(s) 加载 <script type="module">。请使用本地 Web 服务器,或使用 vibefox-js-ui.global.js(它同样可以从 file:// 运行)。

内容安全策略(CSP)

库不使用 eval 或内联脚本,也不会从网络加载任何内容。它会在其元素上设置内联样式(尺寸和位置),因此使用 style-src 的策略必须允许这些样式(为 style 属性设置 'unsafe-inline')。上传、自动完成的数据源、文件管理器适配器和 AI 请求均为你自己发出的请求(connect-src);头像、卡片媒体和图像编辑器的图片源需要 img-src(对于本地文件和导出内容,还需要 blob: / data:)。

对话框、Toast 或菜单没有出现在挂载元素所在的位置

Dialog、Drawer、Toast、Menu、CommandPalette 和 Tour 会将其浮层放入 <body> 中。请将它们挂载到 document.body(或 'body'、document)上(库不会改动这些元素),或挂载到其自有的空元素上:该元素在组件存在期间会被隐藏。请勿将它们挂载到含有其他内容的容器上,否则该容器同样会被隐藏。

控件没有无障碍名称

请设置选项 label,或设置一个 <label for="id">,其 for 为挂载元素的 id。

表单提交时不包含我的值

为控件设置 name(createForm 的字段会将其 name 传递给控件)。禁用的控件以及空值(Input 除外)不会被提交;Checkbox 和 Switch 只在选中时提交其 value;ButtonGroup 需要设置 selection 才能有值。

虚拟列表中的高度不一致

虚拟列表(ListView、AutoComplete、TransferList、FileManager)要求各行高度相同。使用多行模板时,请设置 virtual: false。

复制和粘贴不起作用

浏览器只会在安全页面(https 或 localhost)上、并且在用户操作之后才开放剪贴板访问。

限制

  • 表单:DatePicker 的 min / max 不参与校验(范围之外的日期无法被选中,但通过代码设置的超范围日期不会被报告);设置 selection: 'none' 的 ChipGroup 不提交任何内容。通过长按打开移动菜单:iOS Safari 不会触发 contextmenu,此时只能使用可见的手柄。
  • 容器的 variant 会在组件创建时或其外观选项变化时读取(容器的 size 会实时生效)。
  • 虚拟列表要求行高相同。ListView 在触摸屏上的拖放会与滚动冲突(请使用移动菜单或 Alt+方向键)。时间列表以整分钟为步长;颜色选择器的吸管仅在浏览器提供时可用。
  • DatePicker、DateTimePicker 和 ColorPicker 的 inline 在创建时确定;Stepper 的面板在创建时以及调用 setOptions({ steps }) 时渲染;Toolbar 的 custom 项会在每次重新渲染时再次渲染。
  • TileLayout:拖动到窗口边缘附近时页面不会自动滚动;磁贴的尺寸限制在所有列数下都相同。QueryBuilder:条件不支持拖动。
  • 看板:不支持多卡片拖动;列宽固定。Chat:没有内置的消息编辑 / 删除界面(仅支持 API);表情反应使用固定的表情列表;Markdown 不支持嵌套列表、图片或 HTML;Retry 仅适用于最后一条回答。
  • FileManager:树节点不能拖动或重命名;不支持系统剪贴板;从系统拖入文件夹需要浏览器支持;同时进行多个下载可能会被浏览器拦截。
  • 图像编辑器:不支持双指缩放;滤镜在主线程上运行(非常大的导出可能需要一两秒);不支持图层。
  • 电子表格:不支持插入 / 删除行和列、合并单元格、边框、字体、换行、冻结窗格、填充柄、排序 / 筛选或图表;仅支持英文函数名称;导入 .xlsx 时仅读取值和公式,不包括样式和合并单元格。
  • 框架封装包:选项中的函数按引用比较;移除某个属性并不会将该选项重置为默认值;Vue 对对象属性仅进行浅层监听。

Bug Report

感谢您帮助我们改进。我们会认真审阅每一份报告,但不会逐一回复。如果您的报告促成了改动,该改动将连同报告编号一起列入产品更新日志。如需详细沟通, 请提交支持工单。

拖动滑块完成拼图