Communitygithub.com

allianz/ng-aquila

适用于使用 Aquila / Angular Brand Kit(原 Angular NDBX)组件的场景。涵盖导入方式、使用模式、表单处理、网格布局及组件 API。

ng-aquila 是什么?

该技能用于处理 Allianz 设计系统的 Angular 组件库——Aquila(开源)/ Angular Brand Kit(原 NDBX)。它专门针对 Angular v19+ 的现代开发模式设计,支持独立组件、信号(Signals)、新控制流语法(`@if`、`@for`)以及 `inject()` 函数等特性。技能提供了严格的导入规范,例如组件必须直接从 `@allianz/ng-aquila/{组件名}` 路径导入,并强调了一些最佳实践:`NxInputDirective` 必须包裹在 `<nx-formfield>` 内,按钮需设置 `type="button"` 以防止意外的表单提交,以及优先使用响应式表单。此外,该技能还涵盖了 12 列响应式网格系统、模态对话框(`NxDialogService`)、下拉选择框以及丰富的表单验证示例。适用于 Cursor、Claude Code 等支持技能定义的 AI 编码助手,帮助开发者在项目中高效、正确地使用 Aquila 组件库。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/allianz/ng-aquila/tree/HEAD/skills/aquila

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Aquila – Angular Brand Kit 组件库

Aquila(开源)/ Angular Brand Kit(原 NDBX)是 Allianz 设计系统的 Angular 组件库。请使用现代 Angular(v19+)模式:独立组件、信号(Signals)、新控制流(@if、@for)、inject() 等。

导入规则

Aquila 组件为独立组件。直接导入组件:

import { NxButtonComponent } from '@allianz/ng-aquila/button';
import { NxFormfieldComponent } from '@allianz/ng-aquila/formfield';
import { NxInputDirective } from '@allianz/ng-aquila/input';

@Component({
  imports: [NxButtonComponent, NxFormfieldComponent, NxInputDirective],
})

导入路径模式:@allianz/ng-aquila/{组件名}

Aquila 特有规则

  • 绝不要在没有将 <input nxInput> 包裹在 <nx-formfield> 中的情况下使用 NxInputDirective
  • 在表单域内使用 <nx-error nxFormfieldError> 显示验证消息
  • 始终在 <button nxButton> 上设置 type="button" 以防止意外的表单提交
  • 优先使用响应式表单与 Aquila 表单组件
  • 不要使用内联 CSS 样式;依赖 Aquila 的内置样式

带验证的表单域(响应式表单)

<form [formGroup]="form">
  <nx-formfield label="邮箱">
    <input nxInput formControlName="email" type="email" />
    @if (form.controls.email.errors) {
      <nx-error nxFormfieldError>请输入有效的邮箱地址</nx-error>
    }
  </nx-formfield>
</form>

下拉选择框

<nx-formfield label="国家">
  <nx-dropdown formControlName="country">
    <nx-dropdown-item value="DE">德国</nx-dropdown-item>
    <nx-dropdown-item value="CH">瑞士</nx-dropdown-item>
    <nx-dropdown-item value="AT">奥地利</nx-dropdown-item>
  </nx-dropdown>
</nx-formfield>

模态对话框

import { NxDialogService } from '@allianz/ng-aquila/modal';

const modalRef = inject(NxDialogService).open(MyDialogComponent);
modalRef.afterClosed().subscribe(result => { /* 处理结果 */ });

网格系统

12 列响应式网格。nxCol 最多可接受 7 个以逗号分隔的断点值,顺序为: tiny, small, medium, large, xlarge, 2xlarge, 3xlarge。 如果提供的值少于 7 个,则最后一个值会重复用于剩余断点(例如 nxCol="12,8" → 12,8,8,8,8,8,8)。

<div nxLayout="grid">
  <div nxRow>
    <div nxCol="12,12,6">左侧</div>
    <div nxCol="12,12,6">右侧</div>
  </div>
</div>

最常用组件

组件选择器
formfieldnx-formfield
inputinput[nxInput]
buttonbutton[nxButton]
iconnx-icon
dropdownnx-dropdown
checkboxnx-checkbox
grid[nxLayout]
headline[nxHeadline]
copytext[nxCopytext]
linknx-link
accordionnx-accordion
popover[nxPopoverTriggerFor]
badgenx-badge
datefieldinput[nxDatefield]
modalnx-modal
messagenx-message
data-displaynx-data-display
table[nxHeaderCell]
tabsnx-tab
listul[nxList]
radio-togglenx-radio-toggle
tooltip[nxTooltip]
switchernx-switcher
spinnernx-spinner
paginationnx-pagination

按用例查找组件

  • 表单:autocomplete, checkbox, circle-toggle, code-input, datefield, dropdown, file-uploader, formfield, input, natural-language-form, phone-input, radio-toggle, rating, slider, switcher, timefield
  • 导航:breadcrumb, header, menu, tabs, pagination
  • 表格:comparison-table, dynamic-table, table
  • 反馈:badge, indicator, message, modal, notification-panel, progress-stepper, progressbar, spinner, tooltip
  • 布局:accordion, card, footer, grid, sidepanel, small-stage, toolbar
  • 覆盖层:modal, overlay, popover
  • 媒体:avatar, icon, image, video
  • 交互:action, button, link, page-search, signal-button
  • 选择:checkbox, circle-toggle, dropdown, radio-toggle, taglist

详细 API

要获取完整的组件 API(输入、输出、方法),请阅读项目已安装包中的组件文档:通常位于 node_modules/@allianz/ng-aquila/mcp/generated/components/{组件名}.md 或根据项目设置位于类似路径下。后备方案:使用 glob 搜索 **/mcp/generated/**/。

相关技能