```
--------------------------------
### Initialize Calendar Instances
Source: https://github.com/easysoft/zui/blob/main/lib/calendar/docs/lib/components/index.md
Example usage of multiple calendar configurations including basic, header actions, and categorized events within a Vue component.
```js
new zui.Calendar('#calendarBasic', {
headerTitle: '我的日程',
events: [
{id: '1', title: '项目周会', start: today},
{id: '2', title: '提交版本', start: today + day, allDay: true},
{id: '3', title: '客户拜访', start: today + 2 * day, color: 'var(--color-warning-500)'},
],
});
new zui.Calendar('#calendarHeader', {
headerTitle: '团队日历',
headerActions: [
{text: '导出'},
{text: '新建日程', btnType: 'primary'},
],
events: [
{id: '1', title: '需求评审', start: today},
],
});
new zui.Calendar('#calendarCategories', {
headerTitle: '多日历集',
categories: [
{id: 'work', name: '工作', color: 'var(--color-primary-500)'},
{id: 'personal', name: '个人', color: 'var(--color-success-500)'},
{id: 'travel', name: '出行', color: 'var(--color-warning-500)'},
],
events: [
{id: '1', title: '版本发布', category: 'work', start: today},
{id: '2', title: '健身', category: 'personal', start: today + day},
{id: '3', title: '出差北京', category: 'travel', start: today + 2 * day, allDay: true},
],
});
```
--------------------------------
### Visualize Nested Hierarchy
Source: https://github.com/easysoft/zui/blob/main/lib/dtable/docs/lib/components/plugins.md
Example representation of the nested data structure.
```txt
研发部
├── 客户端开发部
└── 移动开发部
├── iOS 开发小组
└── Android 开发小组
```
--------------------------------
### Configure Actions via Column Definition
Source: https://github.com/easysoft/zui/blob/main/lib/dtable/docs/lib/components/plugins.md
Example of configuring specific actions to display in a column using the actions array.
```javascript
const colSetting = {
name: 'actions',
type: 'actions',
actions: ['edit', 'delete', 'close', 'start', 'pause', 'active', 'other'],
actionsMap: {
edit: {icon: 'icon-edit', hint: '编辑'},
group: {icon: 'icon-group', hint: '团队'},
split: {icon: 'icon-split', hint: '添加子项目集'},
delete: {icon: 'icon-trash', hint: '删除', text: '删除'},
close: {icon: 'icon-off', hint: '关闭', 'data-toggle': 'modal', url: '#test?id={id}'},
start: {icon: 'icon-start', hint: '开始'},
pause: {icon: 'icon-pause', text: '挂起项目集'},
active: {icon: 'icon-magic', text: '激活项目集', 'data-toggle': 'modal', url: '#test?id={id}'},
other: {type: 'dropdown', caret: true, hint: '其他操作'},
link: {name: 'link', icon: 'icon-link', text: '关联产品'},
whitelist: {name: 'whitelist', icon: 'icon-shield-check', text: '项目白名单'},
more: {type: 'dropdown', icon: 'icon-ellipsis-v', caret: false, hint: '更多'},
}
}
```
--------------------------------
### Z-Index Visual Example
Source: https://github.com/easysoft/zui/blob/main/lib/utilities/docs/utilities/layout/z-index.md
HTML structure demonstrating the visual stacking order of elements using different z-index utility classes.
```html
z-50
z-40
z-30
z-20
z-10
z-0
z-auto
```
--------------------------------
### Configure nested plugin options
Source: https://github.com/easysoft/zui/blob/main/lib/dtable/docs/lib/components/index.md
Example configuration for the nested plugin including column toggle settings and change callbacks.
```js
new zui.DTable(element, {
plugins: ['nested'],
cols: [
...
{name: 'project', title: '项目名称', flex: 3, fixed: false, nestedToggle: true},
...
],
data: [...],
onNestedChange: (changes) => {
console.log('折叠展开状态变更了', changes);
}
});
```
--------------------------------
### Tab Event Handling Example
Source: https://github.com/easysoft/zui/blob/main/lib/tabs/docs/lib/components/index.md
Demonstrates how to bind to 'show' and 'shown' events using jQuery and structure the HTML for tab navigation.
```html
```
--------------------------------
### Get Schema by Path Usage Example
Source: https://github.com/easysoft/zui/blob/main/lib/form-builder/docs/lib/forms/index.md
Example of calling the getSchemaByPath method.
```ts
const schema = formBuilder.getSchemaByPath('object.property');
```
--------------------------------
### Install Dependencies
Source: https://github.com/easysoft/zui/blob/main/README.md
Install project dependencies using pnpm.
```sh
pnpm install
```
--------------------------------
### Component Initialization with Options
Source: https://github.com/easysoft/zui/blob/main/lib/core/docs/lib/basic/zui-create.md
Pass configuration options to a component using the zui-create-
attribute.
```html
```
--------------------------------
### Set Schema by Path Usage Example
Source: https://github.com/easysoft/zui/blob/main/lib/form-builder/docs/lib/forms/index.md
Example of calling the setSchemaByPath method with a new schema object.
```ts
formBuilder.setSchemaByPath('object.property', {
type: 'string',
title: '新标题',
});
```
--------------------------------
### Initialize ZUI Toolbar components
Source: https://github.com/easysoft/zui/blob/main/lib/toolbar/docs/lib/components/js.md
Demonstrates various toolbar configurations including dropdowns, active states, formatting tools, dividers, spacing, and disabled items.
```javascript
```
--------------------------------
### Initialize a Multi-level Menu
Source: https://github.com/easysoft/zui/blob/main/lib/menu/docs/lib/components/js.md
Demonstrates creating a menu with nested items, icons, and a divider using the zui.Menu constructor.
```html
```
--------------------------------
### 读取数据
Source: https://github.com/easysoft/zui/blob/main/lib/store/docs/lib/helpers/index.md
使用 get 方法从本地存储中获取数据。
```js
store.get('mySecretCode'); // 基于存储数据的例子应该返回 1314520
```
--------------------------------
### Basic Component Initialization
Source: https://github.com/easysoft/zui/blob/main/lib/core/docs/lib/basic/zui-create.md
Use the zui-create attribute to initialize a component on an element.
```html
```
--------------------------------
### 获取组件实例
Source: https://github.com/easysoft/zui/blob/main/docs/docs/guide/start/tutorial.md
使用组件类的静态 get 方法获取已绑定到元素的组件实例。
```html
```
--------------------------------
### new zui.fileSelector(options)
Source: https://github.com/easysoft/zui/blob/main/lib/file-selector/docs/lib/components/index.md
Initializes a new FileSelector instance with the provided configuration options.
```APIDOC
## Constructor: new zui.fileSelector(options)
### Description
Creates and initializes a new file selector component instance.
### Parameters
#### Options (FileSelectorProps)
- **name** (string) - Optional - Form field name.
- **accept** (string) - Optional - File type restriction.
- **disabled** (boolean) - Optional - Whether the component is disabled.
- **mode** ('button' | 'box' | 'grid') - Optional - UI display mode.
- **maxFileSize** (FileSize) - Optional - Maximum size per file (default: "100MB").
- **maxFileCount** (number) - Optional - Maximum number of files allowed.
- **totalFileSize** (FileSize) - Optional - Maximum total size for all files.
- **onDuplicated** (Function) - Optional - Callback when a duplicate file is added. Return `true` to allow.
- **onExceededSize** (Function) - Optional - Callback when file size exceeds limit. Return `true` to allow.
- **onExceededTotalSize** (Function) - Optional - Callback when total size exceeds limit. Return `true` to allow.
- **onExceededCount** (Function) - Optional - Callback when file count exceeds limit. Return `true` to allow.
```
--------------------------------
### Basic Button Example
Source: https://github.com/easysoft/zui/blob/main/lib/table/README.md
A simple button element with a data-@click attribute.
```html
Test
```
--------------------------------
### Initialize simple list
Source: https://github.com/easysoft/zui/blob/main/lib/list/README.md
Use this HTML element to host a basic, non-nested list.
```html
```
--------------------------------
### Initialize Multiple Upload Instances
Source: https://github.com/easysoft/zui/blob/main/lib/upload/docs/lib/components/index.md
Shows various configuration patterns for the Upload component, including multiple file support, size limits, and UI customization.
```js
export default {
mounted() {
onZUIReady(() => {
new zui.Upload('#example1', {name: 'files1'});
new zui.Upload('#example2', {name: 'files2', multiple: false});
new zui.Upload('#example3', {name: 'files3', multiple: true, limitCount: 5, exceededCountHint: '超出上传文件数量限制'});
new zui.Upload('#example4', {name: 'files4', multiple: true, limitSize: '50MB', exceededSizeHint: '超出上传文件大小限制'});
new zui.Upload('#example5', {name: 'files5', renameBtn: false, deleteBtn: false});
new zui.Upload('#example6', {name: 'files6', useIconBtn: false});
new zui.Upload('#example7', {name: 'files7', draggable: true, tip: '可点击添加或拖拽上传,不超过50M'});
const file1 = new File(['file1'], 'file1.txt', {type: 'text/plain'});
const file2 = new File(['file2'], 'file2.txt', {type: 'text/plain'});
new zui.Upload('#example8', {name: 'files8', defaultFileList: [file1, file2]});
});
}
};
```
--------------------------------
### Active Tooltip Trigger
Source: https://github.com/easysoft/zui/blob/main/lib/tooltip/README.md
Example of a button element configured for programmatic tooltip activation.
```html
点击触发
```
--------------------------------
### Configure Dynamic Context Menu
Source: https://github.com/easysoft/zui/blob/main/lib/contextmenu/README.md
Initialize a context menu with a dynamic items configuration object.
```html
```
```js
const contextMenu = new ContextMenu('#menuToggle1', {
items: [
{text: '复制', icon: 'icon-copy'},
{text: '粘贴', icon: 'icon-paste'},
{text: '剪切'},
{type: 'heading', text: '更多操作'},
{text: '导入', icon: 'icon-upload-alt'},
{text: '导出', icon: 'icon-download-alt'},
{
text: '保存', icon: 'icon-save', onClick: (event) => console.log('> menuItem.clicked', event),
items: [
{text: '保存到云端'},
{
text: '下载到本地',
items: [
{text: '下载为 PDF'},
{text: '下载为 Excel'},
],
},
],
},
],
menu: {
onClickItem: (info) => {
console.log('> menu.onClickItem', info);
},
},
});
```
--------------------------------
### Start Development Server
Source: https://github.com/easysoft/zui/blob/main/README.md
Launch the development server, optionally including extension libraries.
```sh
pnpm dev
# 启动带扩展库的开发服务
pnpm dev:exts
```
--------------------------------
### Static Toolbar Implementation
Source: https://github.com/easysoft/zui/blob/main/lib/toolbar/README.md
Create a toolbar using standard HTML elements with ZUI CSS classes.
```html
首页
动态
论坛
博客
关注我们
登录
注册
```
--------------------------------
### Initialize Basic Pager Components
Source: https://github.com/easysoft/zui/blob/main/lib/pager/docs/lib/components/js.md
Demonstrates setting up standard pagers and pagers with a restricted page count display.
```html
```
--------------------------------
### Z-Index Utility Usage
Source: https://github.com/easysoft/zui/blob/main/lib/utilities/docs/utilities/layout/z-index.md
Basic HTML usage examples for applying z-index utility classes to elements.
```html
z-50
z-40
z-30
z-20
z-10
z-0
z-auto
```
--------------------------------
### Initialize JS Components
Source: https://github.com/easysoft/zui/blob/main/README.md
Instantiate a component by targeting an element ID and providing configuration options.
```html
```
--------------------------------
### Define actionsMap for Action Column
Source: https://github.com/easysoft/zui/blob/main/lib/dtable/docs/lib/components/plugins.md
Example configuration for the actionsMap object, which maps action names to ToolbarItemOptions.
```javascript
const colSetting = {
name: 'actions',
type: 'actions',
actionsMap: {
edit: {icon: 'icon-edit', hint: '编辑'},
group: {icon: 'icon-group', hint: '团队'},
split: {icon: 'icon-split', hint: '添加子项目集'},
delete: {icon: 'icon-trash', hint: '删除', text: '删除'},
close: {icon: 'icon-off', hint: '关闭', 'data-toggle': 'modal', url: '#test?id={id}'},
start: {icon: 'icon-start', hint: '开始'},
pause: {icon: 'icon-pause', text: '挂起项目集'},
active: {icon: 'icon-magic', text: '激活项目集', 'data-toggle': 'modal', url: '#test?id={id}'},
other: {type: 'dropdown', caret: true, hint: '其他操作'},
link: {name: 'link', icon: 'icon-link', text: '关联产品'},
whitelist: {name: 'whitelist', icon: 'icon-shield-check', text: '项目白名单'},
more: {type: 'dropdown', icon: 'icon-ellipsis-v', caret: false, hint: '更多'},
}
}
```
--------------------------------
### new zui.Menu(element, options)
Source: https://github.com/easysoft/zui/blob/main/lib/menu/docs/lib/components/js.md
Initializes a new Menu instance on the specified element with the provided configuration options.
```APIDOC
## constructor(element, options)
### Description
Initializes a new Menu component instance.
### Parameters
- **element** (HTMLElement | string) - Required - The container element or a selector string for the menu.
- **options** (MenuOptions) - Required - Configuration object for the menu.
### Example
```ts
new zui.Menu('#menu', {
items: [
{text: 'Copy', icon: 'icon-copy'},
{text: 'Paste', icon: 'icon-paste'},
]
});
```
```
--------------------------------
### zui.fileSelector(options)
Source: https://github.com/easysoft/zui/blob/main/lib/file-selector/docs/lib/components/index.md
Initializes the FileSelector component with a configuration object.
```APIDOC
## Constructor: new zui.fileSelector(options)
### Description
Initializes a new instance of the FileSelector component.
### Options
- **defaultFiles** (array) - Optional - An array of objects representing pre-loaded files. Each object can contain `name`, `size`, and `url`.
- **disabled** (boolean) - Optional - If set to `true`, disables the file selector.
- **tip** (string) - Optional - Custom tooltip text. Supports placeholders: `{size}`, `{count}`, `{maxFileSize}`, `{maxFileCount}`.
- **fileIcons** (object) - Optional - Maps file types (extensions) to icon names. Includes keys like `image`, `video`, `audio`, `text`, `pdf`, `word`, `excel`, `ppt`, `zip`, and `default`.
- **thumbnail** (boolean) - Optional - Whether to display thumbnails for image files. Defaults to `true`.
- **draggable** (boolean) - Optional - Whether to allow drag-and-drop file uploading. Defaults to `true`.
- **multiple** (boolean) - Optional - Whether to allow selecting multiple files. Defaults to `true`.
- **mode** (string) - Optional - Display mode, e.g., 'grid'.
- **gridWidth** (string) - Optional - Width of grid items (e.g., '200px').
- **gridHeight** (string) - Optional - Height of grid items (e.g., '200px').
- **gridGap** (string) - Optional - Gap between grid items (e.g., '20px').
- **uploadBtn** (object) - Optional - Configuration for the upload button, including `text`, `icon`, `className`, and `size`.
```
--------------------------------
### Align Content Template Usage
Source: https://github.com/easysoft/zui/blob/main/lib/utilities/docs/utilities/flex/align-content.md
Example of applying align-content classes to a flex container within a Vue template.
```html
{{item}}
```
--------------------------------
### 使用 zui-init 属性初始化脚本
Source: https://github.com/easysoft/zui/blob/main/docs/docs/guide/start/tutorial.md
通过 HTML 元素属性 zui-init 定义初始化脚本,在元素呈现后自动执行。
```html
hello
```
--------------------------------
### Define CalendarEvent type
Source: https://github.com/easysoft/zui/blob/main/lib/calendar/docs/lib/components/index.md
Represents an individual event in the calendar, requiring a unique ID, title, and start time.
```ts
type CalendarEvent = {
/** 唯一标识 */
id: string;
/** 标题 */
title: string;
/** 所属日历集 ID */
category?: string;
/** 是否全天事件 */
allDay?: boolean;
/** 描述 */
desc?: string;
/** 开始时间 */
start: DateLike;
/** 结束时间 */
end?: DateLike;
/** 文字颜色 */
color?: string;
/** 背景颜色 */
background?: string;
/** 图标 */
icon?: IconType;
/** 是否只读 */
readonly?: boolean;
/** 是否隐藏 */
hidden?: boolean;
/** 排序 */
order?: number;
/** 自定义数据 */
data?: Record;
};
```
--------------------------------
### Define Navigation Types Data
Source: https://github.com/easysoft/zui/blob/main/lib/nav/docs/lib/components/index.md
A script setup block defining an array of navigation types for use in templates.
```javascript
const navTypes = [
{class: 'primary', name: '主要'},
{class: 'secondary', name: '次要'},
{class: 'tabs', name: '标签风格'},
{class: 'pills', name: '圆点'},
];
```
--------------------------------
### Initialize Moveable Component
Source: https://github.com/easysoft/zui/blob/main/lib/dnd/docs/lib/components/moveable.md
Demonstrates how to initialize the Moveable component using either the ES module import or the global ZUI object.
```javascript
import {Moveable} from '@zui/dnd';
const moveable = new Moveable('#board', {
container: 'self',
containerPadding: 8,
});
```
```javascript
const moveable = new zui.Moveable('#board', options);
```
--------------------------------
### Applying Colors via CSS Utility Classes
Source: https://github.com/easysoft/zui/blob/main/lib/base/docs/guide/config/color.md
Demonstrates applying colors using ZUI's Tailwind-compatible utility classes.
```html
这是一段使用 Primary 调色板上的第 500 号颜色的文本
```
```html
这是一段使用 Primary 调色板上的第 500 号颜色的文本
```
--------------------------------
### Configure checkable plugin options
Source: https://github.com/easysoft/zui/blob/main/lib/dtable/docs/lib/components/index.md
Example configuration for the checkable plugin including column checkbox settings and change callbacks.
```js
new zui.DTable(element, {
plugins: ['checkable'],
checkOnClickRow: true,
cols: [
{name: 'id', title: 'ID', width: 60, fixed: 'left', sortType: 'down', checkbox: true},
...
],
data: [...],
onCheckChange: (changes) => {
console.log('选中状态变更', changes);
}
});
```