@meshmakers/octo-ui

中文文档
3.5.550发布于 2026/11/02TypeScriptES Module

Angular library providing reusable UI components for OctoMesh applications.

原始使用文档
文档目录18 节
  1. Features
  2. Documentation
  3. Quick Start
  4. 1. Import Components
  5. 2. Use Property Grid
  6. 3. Use CK Type Selector
  7. 4. Use Data Source with List View
  8. Available Components
  9. Available Services
  10. Data Source Classes
  11. Branding
  12. Page layout ( mm-page )
  13. Theme tokens (overridable CSS variables)
  14. Component styling in octo.styles() (Deep Sea, AB#5526)
  15. Secondary Entry Points
  16. Build
  17. Test
  18. Lint

@meshmakers/octo-ui

Angular library providing reusable UI components for OctoMesh applications.

Features

  • Data Sources - GraphQL-based data source abstractions for list views and hierarchies
  • Property Grid - Dynamic property editor with type-aware value display
  • Runtime Browser - Tree/detail view with create and update editors for runtime entities
  • Selector Dialogs - Attribute and CK type selection dialogs
  • Filter Editor - Visual query filter configuration
  • Theme Independent - Works with any Kendo UI theme

Documentation

Quick Start

1. Import Components

import {
  PropertyGridComponent,
  CkTypeSelectorInputComponent,
  AttributeSelectorDialogService
} from '@meshmakers/octo-ui';

@Component({
  imports: [PropertyGridComponent, CkTypeSelectorInputComponent],
  // ...
})
export class MyComponent {}

2. Use Property Grid

import { PropertyGridComponent, PropertyGridItem, AttributeValueTypeDto } from '@meshmakers/octo-ui';

@Component({
  template: `
    <mm-property-grid
      [properties]="properties"
      [readOnlyMode]="false"
      (propertyChange)="onPropertyChange($event)">
    </mm-property-grid>
  `
})
export class EntityDetailComponent {
  properties: PropertyGridItem[] = [
    {
      id: 'name',
      name: 'name',
      displayName: 'Customer Name',
      value: 'Acme Corp',
      type: AttributeValueTypeDto.StringDto,
      readOnly: false,
      category: 'General'
    }
  ];

  onPropertyChange(event: PropertyChangeEvent) {
    console.log('Property changed:', event.propertyId, event.newValue);
  }
}

3. Use CK Type Selector

import { CkTypeSelectorInputComponent, CkTypeSelectorItem } from '@meshmakers/octo-ui';

@Component({
  template: `
    <mm-ck-type-selector-input
      [(ngModel)]="selectedType"
      [ckModelIds]="['OctoSdkDemo']"
      (ckTypeSelected)="onTypeSelected($event)">
    </mm-ck-type-selector-input>
  `
})
export class TypeSelectorComponent {
  selectedType: CkTypeSelectorItem | null = null;

  onTypeSelected(type: CkTypeSelectorItem) {
    // Use type.rtCkTypeId for runtime queries
    console.log('Selected:', type.rtCkTypeId);
  }
}

4. Use Data Source with List View

import { OctoGraphQlDataSource, FetchDataOptions, FetchResultTyped } from '@meshmakers/octo-ui';
import { DataSourceBase, ListViewComponent } from '@meshmakers/shared-ui';

@Directive({
  selector: '[appCustomerDataSource]',
  exportAs: 'appCustomerDataSource',
  providers: [{ provide: DataSourceBase, useExisting: forwardRef(() => CustomerDataSourceDirective) }]
})
export class CustomerDataSourceDirective extends OctoGraphQlDataSource<CustomerDto> {
  private readonly getCustomersGQL = inject(GetCustomersDtoGQL);

  constructor() {
    super(inject(ListViewComponent));
    this.searchFilterAttributePaths = ['name', 'email'];
  }

  fetchData(options: FetchDataOptions): Observable<FetchResultTyped<CustomerDto>> {
    return this.getCustomersGQL.fetch({
      variables: {
        first: options.state.take,
        after: GraphQL.offsetToCursor(options.state.skip ?? 0),
        sortOrder: this.getSortDefinitions(options.state),
        fieldFilter: this.getFieldFilterDefinitions(options.state),
        searchFilter: this.getSearchFilterDefinitions(options.textSearch)
      },
      fetchPolicy: 'network-only'
    }).pipe(map(result => new FetchResultTyped<CustomerDto>(
      result.data?.runtime?.customers?.items ?? [],
      result.data?.runtime?.customers?.totalCount ?? 0
    )));
  }
}

Available Components

ComponentDescription
PropertyGridComponentDynamic property grid with type-aware editing
PropertyValueDisplayComponentRead-only value display with type formatting
CkTypeSelectorInputComponentAutocomplete input for CK type selection
FieldFilterEditorComponentVisual filter editor for queries
EntityIdInfoComponentEntity ID display with copy-to-clipboard dropdown
OctoLoaderComponentAnimated OctoMesh logo loading indicator
PageComponent (MM_PAGE)<mm-page> page layout: optional header (title, subtitle, actions) + scrolling content, no footer

Available Services

ServiceDescription
PropertyConverterServiceConvert entities to property grid items
AttributeSelectorDialogServiceOpen attribute selection dialog
AttributeSortSelectorDialogServiceOpen attribute selection with sort order
CkTypeSelectorDialogServiceOpen CK type selection dialog

Data Source Classes

ClassDescription
OctoGraphQlDataSourceBase class for GraphQL list data sources
OctoGraphQlHierarchyDataSourceBase class for tree/hierarchy data sources
FetchResultTypedTyped result wrapper with items and totalCount

Branding

Per-tenant branding (logo, title, palette) with light/dark mode and a configurable Settings page. See src/lib/branding/BRANDING_USAGE.md.

// app.config.ts
import { provideOctoBranding } from '@meshmakers/octo-ui';

providers: [
  provideOctoBranding({
    defaults: { appName: 'MyApp', appTitle: 'MyApp' },
    fallbackAssets: { headerLogo: '/logo.svg', favicon: '/favicon.ico' },
  }),
];

Wire /settings route:

// app.routes.ts
import { BRANDING_ROUTES } from '@meshmakers/octo-ui';

{ path: 'settings', canActivate: [adminGuard], children: BRANDING_ROUTES }

Drop the standalone components into your shell wherever they belong, and bind your header/footer chrome to the CSS vars the library writes:

<header class="my-header">
  <mm-theme-switcher />
  <!-- Render the logo inline; inject BrandingDataSource and bind .branding().headerLogoUrl -->
  <img [src]="logoUrl()" alt="" class="my-header-logo" />
</header>
.my-header {
  background: linear-gradient(
    to right,
    var(--app-header-gradient-start),
    var(--app-header-gradient-end)
  );
  color: var(--app-header-text);
}

See src/lib/branding/BRANDING_USAGE.md for the full list of CSS variables the library updates and the host-app contract for the surface ladder.

Page layout (mm-page)

<mm-page> (PageComponent) is the token-based page frame that replaces the LCARS header / content panel / footer triple: an optional header (title, subtitle, [mmPageActions]) and a scrolling content area, no footer. Import MM_PAGE (component + slot directives); the title defaults to heading level 2 and the header is a plain <div>. See src/lib/page/README.md.

<mm-page pageTitle="Adapters" pageSubtitle="12 registered">
  <div mmPageActions><button kendoButton themeColor="primary">New adapter</button></div>
  <mm-list-view …></mm-list-view>
</mm-page>

Theme tokens (overridable CSS variables)

@include octo.theme() emits the "Deep Sea" token set on :root (dark default, light via prefers-color-scheme or data-theme="light"); source: src/lib/runtime-browser/styles/_theme.scss. Hosts may override any of these custom properties after the include. All --theme-* names of the former theme are kept; tokens marked new were added in AB#5519.

GroupTokens
Surfaces--theme-bg-app, --theme-bg-app-end, --theme-bg-surface, --theme-bg-elevated, --theme-bg-overlay, --theme-bg-input, new: --theme-bg-sunken, --theme-bg-selected, --theme-bg-hover
Text--theme-text-primary, --theme-text-secondary, --theme-text-muted, --theme-text-on-accent, --theme-text-accent, new: --theme-text-code
Borders--theme-border-subtle, --theme-border-strong, --theme-border-divider (= subtle), new: --theme-border-default, --theme-focus-ring (a box-shadow value)
Accent / AI (new)--theme-accent, --theme-accent-hover, --theme-accent-subtle, --theme-accent-2, --theme-ai, --theme-ai-subtle
Status--theme-status-success, -warning, -error, -info, new: --theme-status-neutral, --theme-status-{success,warning,error,info,neutral}-subtle
Effects--theme-shadow-panel, --theme-shadow-popup; --theme-glow-primary, --theme-glow-accent (both none); --theme-gradient-page, --theme-gradient-header, --theme-accent-bar, --theme-accent-line, --theme-panel-rule (now flat colours)
Charts--theme-chart-1 … --theme-chart-8
Ink overlays--theme-ink-02 … --theme-ink-70 (text colour at n % — flips with the theme)
Typography (new, theme-invariant)--theme-font-display (Montserrat), --theme-font-ui (Roboto), --theme-font-mono (Roboto Mono)
Spacing (new)--theme-space-1 … --theme-space-8 (4 px grid: 4, 8, 12, 16, 20, 24, 28, 32 px)
Radius (new)--theme-radius-xs 2 px (chips), -sm 4 px (buttons, inputs), -md 6 px (cards, panels), -lg 8 px (dialogs, popovers)
Motion (new)--theme-motion-fast 120 ms, --theme-motion-base 200 ms, --theme-motion-easing; both durations become 0ms under prefers-reduced-motion: reduce

Legacy aliases (AB#5526 phase 2): only --lcars-font-primary → --theme-font-display, --lcars-font-mono → --theme-font-mono and --lcars-transition-fast → --theme-motion-fast + easing remain, kept for the Meshmakers App until it migrates. All other --lcars-* variables (glows, button bases, input focus, radii, panel tokens, --lcars-transition-normal) were deleted — use the --theme-* tokens.

Body text: octo.styles() sets body { font-family: var(--theme-font-ui) } (Roboto) since AB#5526; h1–h3, page and dialog titles, mm-page titles and KPI numbers use --theme-font-display (Montserrat 600).

Component styling in octo.styles() (Deep Sea, AB#5526)

  • Buttons are flat: primary = --theme-accent with --theme-text-on-accent (hover --theme-accent-hover), base = --theme-bg-elevated with a --theme-border-default hairline (hover --theme-bg-hover + --theme-border-strong), outline/flat variants transparent; error = --theme-status-error. Sentence case, --theme-font-ui, --theme-radius-sm, keyboard focus --theme-focus-ring. Both themes use the same rules, so the former light-only button overrides are no-ops.
  • No decoration: no gradients (sliders included), glows, pulses, scanlines or text-shadows; grid headers, tabs (Kendo and dockview), process designer palette/inspector headers, dialog titles and context menus are sentence case in --theme-font-ui (the only uppercase left is the avatar initials); popups, dialogs and menus use --theme-bg-overlay + --theme-border-default + --theme-shadow-popup; the drawer is flat --theme-bg-elevated.
  • theme-overrides(): light-theme-surface-overrides was reduced to what the tokens cannot express (the old light card, #d7ebe5 table band, drawer and app-bar treatments are gone — both themes agree now). It also emits a sentence-case rule (html:root .k-label, kendo-label, .section-title) that outranks host component styles in both themes.
  • Legacy LCARS page classes — kept only for the Meshmakers App (AB#5526 phase 2; the Refinery Studio no longer uses them): .lcars-page-header, .page-title / .title-prefix / .title-main, .header-content and .lcars-content-panel (surface card, with its .k-grid rule) keep a neutral Deep Sea definition; .lcars-header-accent, .lcars-header-line, .panel-accent-top/-bottom, .lcars-footer and .footer-* render nothing (display: none). Everything else was deleted: .header-stats, .stat-badge, .lcars-panel, .lcars-panel-asymmetric, .lcars-header-bar, .lcars-divider, .lcars-text-*, .lcars-bg-*, .lcars-border-mint, the glow/scanline/pulse utilities, and the _lcars-button.scss, _lcars-flat-btn.scss and _lcars-input.scss mixin files (now the internal _button.scss / octo-button, _flat-button.scss / flat-button and _field-input.scss / field-input). New pages use <mm-page>.

Deviations from concept §6.2 (contrast-driven): light --theme-text-accent / --theme-accent #2c7d6d (concept #2e8473, 4.16:1 on the light canvas → 4.55:1), light --theme-accent-hover #24685a (concept #266f61), --theme-text-muted dark #77869c (concept #687890) and light #657189 (concept #75829a), both ≥ 4.5:1 on --theme-bg-input. The Kendo bridge points --kendo-color-primary, --kendo-color-surface(-alt), --kendo-color-border, --kendo-color-base*, --kendo-border-radius-* and --kendo-font-family at these tokens.

Fonts are not bundled: the host loads Montserrat, Roboto and Roboto Mono (the Refinery Studio does so via Google Fonts in index.html).

Secondary Entry Points

Heavy admin editors live in their own entry points so apps that do not use them keep the primary bundle small. Each one imports only the public API of @meshmakers/octo-ui.

Entry pointContents
@meshmakers/octo-ui/brandingBranding services, provideOctoBranding, theme switcher
@meshmakers/octo-ui/branding-settingsBranding settings page (BRANDING_ROUTES)
@meshmakers/octo-ui/tree-navigation-settingsEditor for System.UI/TreeNavigationConfiguration
@meshmakers/octo-ui/entity-formsForm-driven entity list / create / edit pages (<mm-entity-page>, <mm-entity-list>, <mm-entity-form>, entityFormRoutes()), driven by System.UI/EntityForm — see entity-forms/README.md

Build

# From frontend-libraries directory
npm run build:octo-ui

Test

npm run test:octo-ui

Lint

npm run lint:octo-ui

版本与发布记录

@meshmakers/octo-ui 共发布 716 个版本,首次发布于 2022/11/14;过去 12 个月发布了 288 个版本。

版本发布日期距今
3.5.550latest2026/11/021 天前
3.5.5302026/11/012 天前
3.5.5202026/10/313 天前
3.5.5102026/10/303 天前
3.5.5002026/10/304 天前
3.5.4902026/10/304 天前

关于 @meshmakers/octo-ui 的常见问题

@meshmakers/octo-ui 是什么?

为OctoMesh应用程序提供可重用UI组件的Angular库。

如何安装 @meshmakers/octo-ui?

在项目目录运行 npm install @meshmakers/octo-ui,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@angular/core(^22.0.0)、@angular/forms(^22.0.0)、apollo-angular(^14.0.0)、@angular/common(^22.0.0)、@angular/animations(^22.0.0)、@meshmakers/shared-ui(*)、@meshmakers/shared-auth(*)、@meshmakers/octo-services(*)、@progress/kendo-svg-icons(^4.8.0)、@progress/kendo-data-query(^1.7.3)、@meshmakers/shared-services(*)、@progress/kendo-angular-grid(^24.1.0)、@progress/kendo-angular-icons(^24.1.0)、@progress/kendo-angular-popup(^24.1.0)、@progress/kendo-angular-dialog(^24.1.0)、@progress/kendo-angular-inputs(^24.1.0)、@progress/kendo-angular-buttons(^24.1.0)、@progress/kendo-angular-dropdowns(^24.1.0)、@progress/kendo-angular-indicators(^24.1.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@meshmakers/octo-ui 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@meshmakers/octo-ui 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@meshmakers/octo-ui 可以商用吗?

@meshmakers/octo-ui 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@meshmakers/octo-ui 还在维护吗?

最新版本 3.5.550 发布于 2026/11/02(1 天前);至今共发布 716 个版本,其中过去 12 个月发布了 288 个;首次发布于 2022/11/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。