mcpField
S
syncfusion-angular-common

syncfusion-angular-common

github.com/syncfusion开发0331 次安装1 周前更新
代码仓库

关于 syncfusion-angular-common

面向使用 Syncfusion 组件构建 Angular 应用的开发者,提供配置与常用功能指南,涵盖全球化、动画、状态持久化、拖放和安全。

主要功能

  1. 01Angular 组件配置指南
  2. 02本地化与国际化
  3. 03RTL 与日期格式化
  4. 04动画与拖放交互
  5. 05状态持久化与安全

适用场景

  1. 01启动 Syncfusion Angular 项目
  2. 02添加多语言和 RTL 支持
  3. 03实现组件动画或拖放
  4. 04检查状态持久化与 HTML 清理

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/syncfusion/angular-ui-components-skills --skill syncfusion-angular-common

安装后在 Claude Code 中输入/syncfusion-angular-common确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

references/
advanced-features.md
getting-started.md
globalization.md

详细介绍

Syncfusion Angular 组件的常见功能

Syncfusion Angular 组件包含全面的通用实用工具和功能,可提升用户体验、确保跨文化支持,并为所有组件提供基础功能。本技能涵盖安装设置、动画、全球化、状态管理和安全注意事项,帮助你构建稳健的 Angular 应用。

目录

文档与导航指南

入门与框架设置

📄 阅读: references/getting-started.md

  • 安装 Angular CLI 并创建项目
  • 独立组件与基于模块的配置
  • 使用 ng add 命令安装 npm 包
  • 集成 ASP.NET Core 和 ASP.NET MVC
  • 初始化组件
  • 快速入门示例
全球化

📄 阅读: references/globalization.md

  • 支持阿拉伯语、希伯来语和波斯语的从右向左(RTL)布局
  • 多语言支持的本地化(l10n)
  • 使用 CLDR 数据进行国际化(i18n)
  • 数字和货币格式设置
  • 日期和时间格式设置
高级功能与实用工具

📄 阅读: references/advanced-features.md

  • 动画效果(FadeIn、ZoomOut、SlideUp 等)
  • 动画时序(持续时间、延迟、全局设置)
  • 拖放交互(Draggable、Droppable)
  • 模板自定义与优化
  • 使用 enablePersistence 持久化状态
  • 安全最佳实践与 HTML 清理

快速入门

安装 Syncfusion Angular 包
ng add @syncfusion/ej2-angular-grids@latest

注意: @syncfusion/ej2-base 包是所有 Syncfusion 组件的依赖项,安装任何 Syncfusion Angular 包时都会自动安装。你无需在 package.json 文件中显式添加该包。

安装主题包并导入样式

首先,安装所需的 Tailwind 3 主题包,使用以下命令:

npm install @syncfusion/ej2-tailwind3-theme --save

接下来,将所需样式导入样式表:

@import "../node_modules/@syncfusion/ej2-tailwind3-theme/styles/grid/index.css";
注册许可证密钥

步骤 1: 设置环境变量:

# Windows
setx SYNCFUSION_LICENSE "Your_License_Key_Here"

# Mac/Linux
export SYNCFUSION_LICENSE='Your_License_Key_Here'

步骤 2: 使用 NPX 命令激活许可证:

npx syncfusion-license activate

注意: 有关其他许可证注册方法,请参阅 Syncfusion 许可证密钥注册文档。

基本组件设置
import { Component } from '@angular/core';
import { GridModule, PageService } from '@syncfusion/ej2-angular-grids';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [GridModule],
  providers: [PageService],
  template: `
    <ejs-grid [dataSource]="data" [allowPaging]="true">
      <e-columns>
        <e-column field="OrderID" width="100"></e-column>
        <e-column field="CustomerID" width="100"></e-column>
        <e-column field="Freight" width="100" format="C2"></e-column>
      </e-columns>
    </ejs-grid>
  `
})
export class AppComponent {
  data = [
    { OrderID: 10248, CustomerID: 'VINET', Freight: 32.38 },
    { OrderID: 10249, CustomerID: 'TOMSP', Freight: 11.61 }
  ];
}

常见功能

启用状态持久化
<ejs-grid 
  id="persistGrid"
  [dataSource]="data" 
  [enablePersistence]="true"
>
  
</ejs-grid>
启用 RTL 支持
import { enableRtl } from '@syncfusion/ej2-base';

// Global RTL enablement
enableRtl(true);

// OR per-component
<ejs-grid [dataSource]="data" enableRtl="true"></ejs-grid>
添加动画效果
import { Component, ViewChild } from '@angular/core';
import { Animation } from '@syncfusion/ej2-base';

@Component({
  template: `<div #element class="box"></div>`
})
export class AnimationComponent {
  @ViewChild('element') element!: any;

  ngAfterViewInit() {
    const animation = new Animation({ duration: 5000, delay: 2000 });
    animation.animate(this.element.nativeElement, { name: 'FadeOut' });
  }
}
实现拖放
import { Component, ViewChild } from '@angular/core';
import { Draggable, Droppable } from '@syncfusion/ej2-base';

@Component({
  template: `
    <div #draggable id="draggable">Drag me</div>
    <div #droppable id="droppable">Drop here</div>
  `
})
export class DragDropComponent {
  @ViewChild('draggable') draggable!: any;
  @ViewChild('droppable') droppable!: any;

  ngAfterViewInit() {
    new Draggable(this.draggable.nativeElement, { clone: false });
    
    new Droppable(this.droppable.nativeElement, {
      drop: (e) => {
        console.log('Dropped!', e.droppedElement);
      }
    });
  }
}

评论

支持 Markdown