@meshmakers/shared-ui

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

Angular UI component library for OctoMesh Platform applications.

原始使用文档
文档目录24 节
  1. Installation
  2. Environment Setup
  3. Build & Test
  4. Architecture
  5. Components
  6. ListViewComponent ( mm-list-view )
  7. BaseFormComponent ( mm-base-form )
  8. CronBuilderComponent ( mm-cron-builder )
  9. TimeRangePickerComponent ( mm-time-range-picker )
  10. TreeComponent ( mm-tree )
  11. CopyableTextComponent ( mm-copyable-text )
  12. Actions ( mm-row-actions , mm-action-button )
  13. OctoBot ( mm-octobot , mm-empty-state )
  14. EntitySelectInputComponent ( mm-entity-select-input )
  15. Dialog Services
  16. Data Sources
  17. Guards & Directives
  18. Unsaved Changes Protection
  19. MmListViewDataBindingDirective
  20. Pipes
  21. Models
  22. Dependencies
  23. Detailed Documentation
  24. Documentation and Testing Standards

@meshmakers/shared-ui

Angular UI component library for OctoMesh Platform applications.

Provides reusable components, dialog services, data sources, pipes, and guards for building consistent UIs across OctoMesh frontend applications.

Note: This library requires a Kendo UI for Angular license.

Part of the @meshmakers package ecosystem.

Installation

npm install @meshmakers/shared-ui

Environment Setup

Register all services via the environment provider:

import { provideMmSharedUi } from '@meshmakers/shared-ui';

export const appConfig: ApplicationConfig = {
  providers: [
    provideMmSharedUi(),
    // ...
  ]
};

Build & Test

# Build
npm run build:shared-ui

# Lint
npm run lint:shared-ui

# Run tests
npm run test:shared-ui

Architecture

shared-ui/
├── src/
│   ├── public-api.ts                          # Public API exports
│   └── lib/
│       ├── list-view/                         # Configurable grid/table
│       │   ├── list-view.component.ts|html|scss
│       │   └── list-view.model.ts             # TableColumn, StatusIconMapping
│       ├── base-form/                         # Form wrapper with save/cancel
│       │   └── base-form.component.ts|html|scss
│       ├── base-tree-detail/                  # Tree + detail panel layout
│       │   └── base-tree-detail.component.ts|scss
│       ├── tree/                              # Hierarchical tree view
│       │   └── tree.component.ts|html|scss
│       ├── cron-builder/                      # Visual cron expression editor
│       │   ├── cron-builder.component.ts|html|scss
│       │   ├── cron-builder.models.ts
│       │   ├── cron-parser.service.ts
│       │   ├── cron-humanizer.service.ts
│       │   └── cron-builder.constants.ts
│       ├── time-range-picker/                 # Flexible time range selector
│       │   ├── time-range-picker.component.ts|html|scss
│       │   ├── time-range-picker.models.ts
│       │   └── time-range-utils.ts
│       ├── copyable-text/                     # Text with copy-to-clipboard
│       │   └── copyable-text.component.ts|html|scss
│       ├── entity-select-input/               # Entity autocomplete input
│       │   └── entity-select-input.component.ts
│       ├── entity-select-dialog/              # Entity selection modal
│       │   ├── entity-select-dialog.component.ts
│       │   ├── entity-select-dialog.service.ts
│       │   └── entity-select-dialog-data-source.ts
│       ├── confirmation-window/               # Confirmation dialog
│       │   └── confirmation-window.component.ts|html
│       ├── input-dialog/                      # Text input dialog
│       │   └── input-dialog.component.ts|html|scss
│       ├── progress-window/                   # Progress dialog
│       │   ├── progress-window.component.ts|html|scss
│       │   ├── progress-window.service.ts
│       │   └── USAGE.md
│       ├── upload-file-dialog/                # File upload dialog
│       │   └── upload-file-dialog.component.ts|html
│       ├── save-as-dialog/                    # Save-as dialog
│       │   ├── save-as-dialog.component.ts
│       │   ├── save-as-dialog.service.ts
│       │   └── save-as-dialog-data-source.ts
│       ├── import-strategy-dialog/            # Import strategy dialog
│       │   ├── import-strategy-dialog.component.ts|html
│       │   └── import-strategy-dialog.service.ts
│       ├── message-details-dialog/            # Message details dialog
│       │   ├── message-details-dialog.component.ts
│       │   └── message-details-dialog.service.ts
│       ├── data-sources/                      # Base data source classes
│       │   ├── data-source-base.ts
│       │   ├── data-source-typed.ts
│       │   ├── hierarchy-data-source-base.ts
│       │   └── hierarchy-data-source.ts
│       ├── guards/                            # Unsaved changes protection
│       │   ├── unsaved-changes.interface.ts
│       │   ├── unsaved-changes.guard.ts
│       │   └── unsaved-changes.directive.ts
│       ├── directives/
│       │   └── mm-list-view-data-binding.directive.ts
│       ├── pipes/
│       │   ├── pascal-case.pipe.ts
│       │   └── bytes-to-size.pipe.ts
│       ├── models/
│       │   ├── fetchResult.ts                 # FetchResult, FetchResultTyped<T>
│       │   ├── confirmation.ts                # ConfirmationWindowData, DialogType
│       │   ├── progressValue.ts               # ProgressValue
│       │   ├── inputDialogResult.ts
│       │   ├── importStrategyDto.ts
│       │   └── node-dropped-event.ts
│       ├── services/
│       │   ├── confirmation.service.ts
│       │   ├── file-upload.service.ts
│       │   ├── input.service.ts
│       │   ├── notification-display.service.ts
│       │   └── message-listener.service.ts
│       └── svg-icons.ts                       # Kendo SVG icon re-exports
├── docs/
│   ├── time-range-picker.md                   # Time Range Picker guide
│   └── unsaved-changes-guard.md               # Unsaved Changes Guard guide

Components

ListViewComponent (mm-list-view)

Configurable data grid with Kendo Grid integration.

Features: Pagination, sorting, filtering, row selection, search, context menus, action menus, Excel/PDF export, toolbar actions, column types (text, numeric, boolean, date, bytes, status icons, cron expressions).

Empty state (AB#3444): [emptyState]="{ title, text }" shows the shared mm-empty-state (OctoBot idle) for a list without records and the "no results" variant (OctoBot look) while a search or filter is active; [emptyTemplate] replaces it. Without either the list keeps the plain "No records available." line.

Toolbar actions (leftToolbarActions / rightToolbarActions, AB#6211) render flat and neutral by default: a page has exactly one solid primary action and it sits in the page header ([mmPageActions], Studio action guideline §9). Set primary: true on a CommandItem only for a list without a page header (the list is the page). A toolbar action with isDisabled + disabledReason — plain, split or dropdown button — stays focusable (aria-disabled), announces the reason (aria-describedby), shows it in the tooltip ("Run scripts — No fixup scripts to run") and as a hint bubble on keyboard focus; clicks and the menu are blocked. A disabledReason callback receives the current selection.

The toolbar's "Reset Filters" button only appears while something narrows the default view: a row filter, a column sort, a free-text search, or host-side filters. Hosts with their own quick-view/bar filters announce them via [hasExternalFilters]="myBarFilterIsSet" so the button shows (and (resetFilters) lets them clear those filters when it is clicked).

<mm-list-view
  appMyDataSource
  #dir="appMyDataSource"
  [sortable]="true"
  [rowFilterEnabled]="true"
  [searchTextBoxEnabled]="true"
  [selectable]="{mode: 'single', enabled: true}"
  [pageable]="{buttonCount: 3, pageSizes: [10, 20, 50, 100]}"
  [pageSize]="20"
  [columns]="columns"
  [contextMenuCommandItems]="contextMenu"
  [leftToolbarActions]="toolbarActions"
  (rowClicked)="onRowClicked($event)">
</mm-list-view>

BaseFormComponent (mm-base-form)

Form wrapper with save/cancel buttons, title, validation, and unsaved changes detection.

<mm-base-form [form]="form" [config]="formConfig" (saveForm)="onSave()" (cancelForm)="onCancel()">
  <!-- Form fields -->
</mm-base-form>

CronBuilderComponent (mm-cron-builder)

Visual cron expression editor with 6-field format support, preset quick-selects, human-readable descriptions, next execution preview, and ControlValueAccessor integration.

TimeRangePickerComponent (mm-time-range-picker)

Flexible time range selector with Year, Quarter, Month, Relative, and Custom modes. Outputs both Date objects and ISO 8601 strings.

See Time Range Picker Documentation for detailed API and examples.

TreeComponent (mm-tree)

Hierarchical tree view with Kendo TreeView, drag-drop support, and expandable nodes.

CopyableTextComponent (mm-copyable-text)

Display text with a one-click copy-to-clipboard button.

Actions (mm-row-actions, mm-action-button)

Row, toolbar and page actions from one shared MmAction definition (id, label, icon, danger, disabled reason, visible): icon buttons with tooltip and a row-specific accessible name, max. 3 inline slots with a "More actions" menu, focusable disabled actions that announce their reason, and a canonical verb→icon map (MM_ACTION_ICONS). See Actions.

<mm-row-actions [actions]="actionsFor(row)" [rowLabel]="row.name" (triggered)="onAction($event, row)" />
<mm-action-button [action]="refresh" context="toolbar" (triggered)="reload()" />

OctoBot (mm-octobot, mm-empty-state)

The meshmakers mascot as a small animated pixel-art image (idle, blink, look, swim, thinking, wave; sm/md/lg), loaded by URL from the library assets (copy node_modules/@meshmakers/shared-ui/assets/octobot to /assets/octobot in angular.json; base URL via OCTOBOT_ASSET_BASE_URL). Decorative unless labelled; still frame under prefers-reduced-motion. mm-empty-state is the shared empty / no-results / error block, and mm-list-view [emptyState] renders it once per list. Placement rules (never in rows, tiles, buttons, toasts or errors): see OctoBot.

<mm-octobot animation="wave" size="md" playOnce />
<mm-list-view [emptyState]="{ title: 'No data flows yet', text: 'Create your first data flow.' }" ...></mm-list-view>

EntitySelectInputComponent (mm-entity-select-input)

Autocomplete input for entity selection with dialog fallback.

Dialog Services

All complex dialogs are opened via injected services:

ServiceMethodDescription
ConfirmationServiceshowYesNoConfirmationDialog()Yes/No confirmation
showYesNoCancelConfirmationDialog()Yes/No/Cancel with result
showOkCancelConfirmationDialog()Ok/Cancel confirmation
showOkDialog()Ok-only information dialog
showDestructiveConfirmationDialog(title, message, confirmLabel, cancelLabel = 'Cancel')Destructive action: verb labels (e.g. Rotate / Cancel), confirming button styled as danger

All confirmation dialogs are min(320px, 100vw − 32px) to min(560px, 100vw − 32px) wide, so a long message wraps instead of stretching the dialog across the viewport. | InputService | — | Text input dialog | | FileUploadService | — | File upload dialog | | ProgressWindowService | showDeterminateProgress() | Progress bar with percentage | | | showIndeterminateProgress() | Spinning loader | | NotificationDisplayService | showSuccess(), showError(), showWarning(), showInfo() | Toast notifications | | EntitySelectDialogService | — | Entity selection modal | | SaveAsDialogService | — | Save-as dialog with path navigation | | ImportStrategyDialogService | — | Import strategy selection | | MessageDetailsDialogService | — | Detailed message/error display |

Toast stacking is configurable with NOTIFICATION_DISPLAY_OPTIONS: identical visible toasts (same type, text and details) are never stacked twice (dedupe, default on); errorHideAfter / warningHideAfter (ms, default 0 = until interaction or navigation) auto-hide non-critical errors and warnings — a caller passing hideAfter: 0 still gets a sticky one, and stickyWithDetails keeps every error/warning that has details; a timed toast pauses while hovered or focused; maxVisible (default 0 = unlimited) hides the oldest toast of the lowest severity, so an error or warning is never dropped for a success or info.

{ provide: NOTIFICATION_DISPLAY_OPTIONS, useValue: { errorHideAfter: 10000, warningHideAfter: 8000, stickyWithDetails: true, maxVisible: 3 } }

See Progress Window Usage for progress dialog examples.

Data Sources

Base classes for data binding with ListViewComponent:

ClassDescription
DataSourceBaseAbstract base with pagination, filtering, sorting
DataSourceTyped<T>Generic typed data source
HierarchyDataSourceBaseBase for tree/hierarchical data
HierarchyDataSourceImplementation for tree structures

Guards & Directives

Unsaved Changes Protection

Two-level protection against accidental data loss:

ComponentProtects Against
UnsavedChangesDirectiveBrowser back/refresh/close (beforeunload)
UnsavedChangesGuardIn-app navigation (Angular Router canDeactivate)
HasUnsavedChangesInterface for components to implement

See Unsaved Changes Guard Documentation for implementation guide.

MmListViewDataBindingDirective

Data binding directive for ListViewComponent, managing data source and pagination.

Pipes

PipeUsageExample
PascalCasePipe{{ value | pascalCase }}"my_field" → "MyField"
BytesToSizePipe{{ value | bytesToSize }}1048576 → "1.0 MB"

Models

ModelDescription
FetchResult / FetchResultTyped<T>Paginated query result wrapper
TableColumn / ColumnDefinitionColumn definitions for ListViewComponent
StatusIconMapping / StatusFieldConfigStatus icon configuration
ProgressValueProgress status text + percentage
TimeRange / TimeRangeISO / TimeRangeSelectionTime range types
CronBuilderConfig / CronSchedule / CronFieldsCron builder types
ImportStrategyDtoImport configuration
NodeDroppedEventTree drag-drop event data
ConfirmationWindowData / ConfirmationWindowResultDialog configuration

Dependencies

  • Angular 21 with standalone components and signals
  • Kendo UI Angular 21 (Grid, Buttons, Dialog, Dropdowns, Inputs, Indicators, Layout, Notifications, TreeView)
  • @meshmakers/shared-services (sibling library)

Detailed Documentation

Documentation and Testing Standards

  • All developer documentation must be written in English
  • Every code change must include updated documentation — update README.md, CLAUDE.md, or inline docs when adding, modifying, or removing features
  • Unit tests and integration tests must be executed after every code change
  • Existing tests must be updated when the behavior of tested code changes
  • New tests must be added when new features, components, or services are implemented
  • Never commit code with failing tests

版本与发布记录

@meshmakers/shared-ui 共发布 719 个版本,首次发布于 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/shared-ui 的常见问题

@meshmakers/shared-ui 是什么?

用于OctoMesh平台应用的Angular UI组件库。

如何安装 @meshmakers/shared-ui?

在项目目录运行 npm install @meshmakers/shared-ui,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@angular/core(^22.0.0)、@angular/forms(^22.0.0)、@angular/common(^22.0.0)、@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-label(^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-layout(^24.1.0)、@progress/kendo-angular-buttons(^24.1.0)、@progress/kendo-angular-treeview(^24.1.0)、@progress/kendo-angular-dropdowns(^24.1.0)、@progress/kendo-angular-indicators(^24.1.0)、@progress/kendo-angular-notification(^24.1.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@meshmakers/shared-ui 支持 TypeScript 吗?

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

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

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

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

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

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

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