• Projects
  • Service
  • About
  • branding.bz
  • Podcast
  • Tips
  • FAQ
  • Recruit
  • Download
  • Contact
  • branding.bz(ブランド構築SaaS)
  • DESIGN NOW(デザインメディア)
  • X
  • LinkedIn
  • Spotify
  • Facebook

213-0011 神奈川県川崎市高津区久本3-6-7-303

© 2026 ID INC. All rights reserved

claude-skills/スキル
SKILLOfficialdevelopment

ui5-best-practices-mdc

プラグイン
ui5
ソース
GitHub で見る ↗
説明

UI5 MDC(SAP UIフレームワークのモデル駆動型コントロール)のOData V4との組み合わせにおけるベストプラクティスです。FilterBar、Chart、Field、FilterField、ValueHelp、Link、MultiValueField、Tableなどのコントロールを作成・トラブルシューティングする際に使用します。 デリゲートパターン(処理の委譲)、fetchProperties、PropertyInfo、p13nMode(個人用設定モード)、updateBindingInfo、Condition.createCondition、および一般的なエラー(デリゲートが読み込まれない、チャートにデータが表示されない、フィールドが表示されないなど)に対応しています。 JSONモデル(ODataではない通常のデータ形式)を使用するMDCの場合にも適用できます。 **対象となるユースケース:** - MDC、sap.ui.mdc、デリゲートパターンに関する質問 - fetchProperties、PropertyInfo、個人用設定モードの使用方法 - MDCフィールドが表示されない、チャートがデータにバインドされないなどの問題 - MDCの条件設定に関する事項 - OData V4を使用したモデル駆動型のUI開発 **対応キーワード:** sap.ui.mdc、FilterBar、Chart、Field、FilterField、ValueHelp、Link、MultiValueField、デリゲート、fetchProperties、updateBindingInfo、PropertyInfo、OData V4、JSONモデル、TypeMap、個人用設定モード、条件、FilterBarDelegate、ChartDelegate、ValueHelpDelegate、LinkDelegate、Condition.createCondition

原文を表示

UI5 MDC (sap.ui.mdc) best practices for OData V4 delegate-based controls. Use when creating/troubleshooting MDC FilterBar, Chart, Field, FilterField, ValueHelp, Link, MultiValueField, or Table. Covers delegate pattern, fetchProperties, PropertyInfo, p13nMode, updateBindingInfo, Condition.createCondition, and common errors (delegate not loaded, chart no data, fields not appearing). Also applies to JSON model (non-OData) MDC usage. Triggers: "MDC", "sap.ui.mdc", "delegate pattern", "fetchProperties", "PropertyInfo", "MDC personalization", "p13nMode", "MDC field not rendering", "MDC chart not binding", "MDC conditions", OData V4 freestyle with model-driven controls. Keywords: sap.ui.mdc, FilterBar, Chart, Field, FilterField, ValueHelp, Link, MultiValueField, delegate, fetchProperties, updateBindingInfo, PropertyInfo, OData V4, JSON model, TypeMap, p13nMode, conditions, FilterBarDelegate, ChartDelegate, ValueHelpDelegate, LinkDelegate, Condition.createCondition

ユースケース
  • MDCコントロール作成・トラブルシューティング
  • OData V4とMDCの連携設定
  • デリゲートパターンの実装
  • fetchPropertiesやPropertyInfo設定時
  • フィールド非表示やデータバインド問題解決時
本文(日本語訳)

UI5 MDCコントロール ベストプラクティス

OData V4サービスを使用するフリースタイルアプリケーションで、MDC(メタデータドリブン・コントロール)コントロールコードを生成・レビュー・トラブルシューティングする際には、以下のガイドラインを適用してください。

UI5バージョンの基準: SAPUI5 1.136+ LTS。特に記載がない限り、ここで紹介するすべての機能はこのバージョン以降で利用可能です。

各リファレンスの参照タイミング

トリガー 参照するドキュメント
sap.ui.mdc.FilterBar を作成または計画する references/mdc-filter-bar.md
sap.ui.mdc.Chart を作成または計画する references/mdc-chart.md
sap.ui.mdc.Field を作成または計画する references/mdc-field.md
sap.ui.mdc.FilterField を作成または計画する references/mdc-filter-field.md
sap.ui.mdc.ValueHelp を作成または計画する references/mdc-value-help.md
sap.ui.mdc.Link を作成または計画する references/mdc-link.md
sap.ui.mdc.MultiValueField を作成または計画する references/mdc-multi-value-field.md
JSONモデルで MDCコントロールを使用する(OData以外) references/mdc-json-delegates.md

アウトプットを生成する前に必ずこれらを参照してください。記憶に頼らないでください。


デリゲートパターン

すべての MDCコントロールは、デリゲート(処理の委譲元)を使用してコントロールをデータソース固有のロジックから切り離しています。アプリ開発者は次の手順が必要です:

  1. XMLでデリゲートを指定: delegate="{name: 'my/app/delegate/MyDelegate', payload: {entitySet: 'Products'}}"
  2. 適切なベースデリゲートを拡張してデリゲートモジュールを実装する
  3. キーとなるメソッド(最低限 fetchProperties)をオーバーライドする

OData V4用のベースデリゲート:

コントロール ベースデリゲート
Table(テーブル) sap/ui/mdc/odata/v4/TableDelegate
FilterBar(フィルタバー) sap/ui/mdc/odata/v4/FilterBarDelegate
Chart(グラフ) sap/ui/mdc/odata/v4/vizChart/Delegate
ValueHelp(値の補助) sap/ui/mdc/ValueHelpDelegate
Link(リンク) sap/ui/mdc/LinkDelegate
MultiValueField(複数値フィールド) sap/ui/mdc/field/MultiValueFieldDelegate

JSONモデルの場合: MDCコントロールはJSONモデルでも動作します。OData V4バージョンではなく、ベースデリゲート(sap/ui/mdc/TableDelegate、sap/ui/mdc/FilterBarDelegate)を直接拡張してください。詳しくは references/mdc-json-delegates.md をご覧ください。

PropertyInfo — fetchProperties が返すコアメタデータ形式:

{
    key: "propertyName",        // 一意の識別子(必須)
    label: "Display Label",     // ユーザーに表示されるラベル(必須)
    dataType: "sap.ui.model.odata.v4.type.String"  // データ型(必須)
}

コアルール

必須項目

  • すべての MDCコントロールには、有効なモジュールパスを指す delegate プロパティが必要です。
  • デリゲートに fetchProperties を実装し、最低限 key、label、dataType を含む PropertyInfo[] を返してください。
  • OData V4サービスの場合は、適切な OData V4ベースデリゲート(上記の表を参照)を拡張してください。JSON/その他のモデルの場合は、ジェネリックベースデリゲートを直接拡張してください。
  • p13nMode を使用してパーソナライゼーション(テーブルはColumn(列)、Sort(並べ替え)、Filter(フィルタ)、Group(グループ化);グラフはItem(項目)、Sort、Filter、Type(タイプ);フィルタバーはItem)を有効にしてください。
  • 条件を プログラムで構築する場合は sap.ui.mdc.condition.Condition.createCondition() を使用してください。
  • PropertyInfo の dataType フィールドで OData V4モデルの場合は sap.ui.model.odata.v4.type.* タイプを、JSONモデルの場合は sap.ui.model.type.* を使用してください。TypeMapにタイプを登録してください。
  • アクセシビリティのため、FilterBarと Chartに ariaLabelledBy を設定してください。
  • フリースタイル MDCより Fiori要素のビルディングブロック(再利用可能なコンポーネント)を優先してください。Fiori要素が適用外の場合のみ MDCを使用してください。
  • get_api_reference MCPツール を使用してコントロール APIを確認してください。run_ui5_linter を使用してコードを検証してください。

禁止事項

  • OData V2モデルで MDCコントロールを使用しないでください。代わりに Smart コントロール(sap.ui.comp)を使用してください。MDCは OData V4と JSONモデルで動作します。
  • 内部コントロール(例:内部の sap.chart.Chart や sap.m.Table)に直接アクセスしないでください。デリゲートまたは MDCコントロールの公開 APIを使用してください。
  • PropertyInfoオブジェクトから key を省略しないでください(以前の name は廃止されました)。
  • 条件オブジェクトを JSON形式で手動で構築しないでください。常に Condition.createCondition(operator, values) を使用してください。
  • 本番環境コードでデリゲート実装をスキップしないでください。組み込みデフォルトはデモ用です。
  • インラインスタイルやスクリプトを使用しないでください(CSP(コンテンツセキュリティポリシー)対応)。
  • グローバルアクセス(sap.ui.mdc.FilterBar)を使用しないでください。sap.ui.define または ES6インポートを使用してください。

選択マトリックス

コントロール 次のような場合に使用 次のような場合は使用しないでください
MDC FilterBar OData V4または JSONモデル、デリゲート駆動フィルタUI、MDC Table/Chart OData V2(SmartFilterBarを使用)、シンプルな検索バー
MDC Chart OData V4、デリゲート駆動グラフ表示、ドリルダウン機能 OData V2(SmartChartを使用)、シンプルな静的グラフ、分析データがない
MDC Field OData V4または JSON、データ型に基づく自動レンダリング対応の単一フィールド OData V2(SmartFieldを使用)、完全にカスタムなレンダリングが必要
MDC FilterField MDC FilterBar内の個別フィルタ条件用 FilterBar外のスタンドアロンフィルタリング
MDC ValueHelp OData V4または JSON、入力候補+ダイアログでの値選択 OData V2(ValueHelpDialogを使用)、検索なしのシンプルドロップダウン
MDC Link OData V4、セマンティックオブジェクトナビゲーション、デリゲート駆動リンク先 OData V2(SmartLinkを使用)、シンプルな静的リンク
MDC MultiValueField OData V4または JSON、items集約を通じた複数値トークン入力 OData V2(SmartMultiInputを使用)、シンプルな単一値フィールド

よくあるエラー

症状 原因 対処法
「Delegate module could not be loaded」(デリゲートモジュールが読み込めません) delegate プロパティのパスが間違っている デリゲートプロパティのモジュールパスがプロジェクト内の実際のファイル位置と一致することを確認してください。
グラフにデータが表示されない fetchProperties が間違った PropertyInfoを返している(groupable/aggregatable がない) ディメンション(集計の軸)には groupable: true、メジャー(集計値)には aggregatable: true があることを確認してください。
FilterBarのフィールドが表示されない PropertyInfoが見当たらない、または hiddenFilter: true デリゲートの fetchProperties が正しい可視性を持つプロパティを返していることを確認してください。
フィールドに予期しない内部コントロールが表示される PropertyInfoの dataType が予期される形式と一致していない dataType が完全修飾型名(例:sap.ui.model.odata.v4.type.String)を使用していることを確認してください。
パーソナライゼーションダイアログが空 p13nMode が設定されていない、または PropertyInfoが不完全 p13nMode="Column,Sort,Filter" を追加し、PropertyInfoに sortable/filterable フラグがあることを確認してください。
ValueHelpが開かない ValueHelpが Field に接続されていない、またはコンテナが見当たらない Field の valueHelp 関連付けを確認し、Popover/Dialogコンテナが定義されていることを確認してください。
条件がバインディングに適用されない デリゲートに updateBindingInfo が実装されていない デリゲートに updateBindingInfo を実装して、フィルタ条件を ODataバインディングに適用してください。
リンクが常にテキストとしてレンダリングされる fetchLinkType が LinkType.Text を返すか失敗している Popup または DirectLink タイプを返すように fetchLinkType を実装してください。

パフォーマンスとアクセシビリティ

避けるべき悪いパターン

  • 必要なサブセットのみが必要な場合に、すべての PropertyInfoを一気に読み込む(fetchProperties から最小限のセットを返す)。
  • updateBindingInfo を実装しない(条件がデータバインディングに適用されない)。
  • p13nMode 設定をスキップする(パーソナライゼーション機能がデフォルトで無効化される)。
  • 大規模なデリゲートモジュールを作成する(複雑なロジックはオンデマンド読み込みのヘルパーモジュールに分割する)。
  • デリゲートメソッドで同期処理を使用する(すべてのデリゲートメソッドは Promise を返す必要があります)。

アクセシビリティチェックリスト

  • FilterBarに ariaLabelledBy を設定し、表示されるタイトルを参照させてください。
  • Chartに ariaLabelledBy を設定し、表示されるタイトルを参照させてください。
  • パーソナライゼーションダイアログのキーボードナビゲーションが機能することを確認してください。
  • ValueHelpの入力候補とダイアログをスクリーンリーダーでテストしてください。
  • すべての FilterFieldが PropertyInfo の label を通じて意味のあるラベルを持つことを確認してください。
原文(English)を表示

UI5 MDC Controls Best Practices

Apply these guidelines whenever generating, reviewing, or troubleshooting MDC control code in freestyle applications using OData V4 services.

UI5 version baseline: SAPUI5 1.136+ LTS. All features mentioned are available from this version unless noted.

When to load each reference

Trigger Load
Working on or planning a sap.ui.mdc.FilterBar references/mdc-filter-bar.md
Working on or planning a sap.ui.mdc.Chart references/mdc-chart.md
Working on or planning a sap.ui.mdc.Field references/mdc-field.md
Working on or planning a sap.ui.mdc.FilterField references/mdc-filter-field.md
Working on or planning a sap.ui.mdc.ValueHelp references/mdc-value-help.md
Working on or planning a sap.ui.mdc.Link references/mdc-link.md
Working on or planning a sap.ui.mdc.MultiValueField references/mdc-multi-value-field.md
Using MDC controls with JSON model (non-OData) references/mdc-json-delegates.md

Load before producing any output. Do not work from memory.


The Delegate Pattern

All MDC controls use a delegate to decouple the control from data-source-specific logic. App developers must:

  1. Specify the delegate in XML: delegate="{name: 'my/app/delegate/MyDelegate', payload: {entitySet: 'Products'}}"
  2. Implement the delegate module extending the appropriate base delegate
  3. Override key methods (at minimum fetchProperties)

Base delegates for OData V4:

Control Base Delegate
Table sap/ui/mdc/odata/v4/TableDelegate
FilterBar sap/ui/mdc/odata/v4/FilterBarDelegate
Chart sap/ui/mdc/odata/v4/vizChart/Delegate
ValueHelp sap/ui/mdc/ValueHelpDelegate
Link sap/ui/mdc/LinkDelegate
MultiValueField sap/ui/mdc/field/MultiValueFieldDelegate

JSON model usage: MDC controls also work with JSON models. Extend the base delegates directly (sap/ui/mdc/TableDelegate, sap/ui/mdc/FilterBarDelegate) — not the OData V4 variants. See references/mdc-json-delegates.md for details.

PropertyInfo — the core metadata format returned by fetchProperties:

{
    key: "propertyName",        // Unique identifier (required)
    label: "Display Label",     // User-visible label (required)
    dataType: "sap.ui.model.odata.v4.type.String"  // Data type (required)
}

Core Rules

Mandatory

  • Every MDC control requires a delegate property pointing to a valid module path.
  • Implement fetchProperties in the delegate returning PropertyInfo[] with at minimum: key, label, dataType.
  • Extend the appropriate OData V4 base delegate (see table above) for OData V4 services. For JSON/other models, extend the generic base delegate directly.
  • Use p13nMode to enable personalization (Column, Sort, Filter, Group for Table; Item, Sort, Filter, Type for Chart; Item for FilterBar).
  • Use sap.ui.mdc.condition.Condition.createCondition() to construct conditions programmatically.
  • Use sap.ui.model.odata.v4.type.* types in PropertyInfo dataType field for OData V4 models. Use sap.ui.model.type.* with JSON models. Register types in the TypeMap.
  • Set ariaLabelledBy on FilterBar and Chart for accessibility.
  • Prefer Fiori elements building blocks over freestyle MDC. Use MDC only when Fiori elements is out of scope.
  • Use get_api_reference MCP tool to verify control APIs. Use run_ui5_linter to validate code.

Prohibitions

  • Do not use MDC controls with OData V2 models. Use Smart controls (sap.ui.comp) instead. MDC works with OData V4 and JSON models.
  • Do not access inner controls directly (e.g., inner sap.chart.Chart or sap.m.Table). Use the delegate or MDC control's public API.
  • Do not omit key from PropertyInfo objects (formerly name, now deprecated).
  • Do not construct condition objects manually as plain JSON. Always use Condition.createCondition(operator, values).
  • Do not skip delegate implementation for production code (built-in defaults are for demos only).
  • Do not use inline styles or scripts (CSP compliance).
  • Do not use global access (sap.ui.mdc.FilterBar). Use sap.ui.define or ES6 imports.

Selection Matrix

Control Use when Do not use when
MDC FilterBar OData V4 or JSON model, delegate-driven filter UI, MDC Table/Chart OData V2 (use SmartFilterBar), simple search bar
MDC Chart OData V4, delegate-driven chart visualization, drill-down OData V2 (use SmartChart), simple static charts, no analytical data
MDC Field OData V4 or JSON, single field with auto-rendering by data type OData V2 (use SmartField), purely custom rendering needed
MDC FilterField Inside MDC FilterBar for individual filter conditions Standalone filtering outside FilterBar context
MDC ValueHelp OData V4 or JSON, type-ahead + dialog value selection OData V2 (use ValueHelpDialog), simple dropdowns without search
MDC Link OData V4, semantic object navigation, delegate-driven link targets OData V2 (use SmartLink), simple static links
MDC MultiValueField OData V4 or JSON, multi-value token entry via items aggregation OData V2 (use SmartMultiInput), simple single-value fields

Common Errors

Symptom Cause Fix
"Delegate module could not be loaded" Wrong path in delegate property Verify module path matches actual file location in project.
Chart shows no data fetchProperties returns wrong PropertyInfo (missing groupable/aggregatable) Ensure dimensions have groupable: true, measures have aggregatable: true.
FilterBar fields not appearing PropertyInfo missing or hiddenFilter: true Check delegate fetchProperties returns properties with correct visibility.
Field shows wrong inner control dataType in PropertyInfo doesn't match expected format Verify dataType uses full qualified type name (e.g., sap.ui.model.odata.v4.type.String).
Personalization dialog empty p13nMode not set or PropertyInfo incomplete Add p13nMode="Column,Sort,Filter" and ensure PropertyInfo has sortable/filterable flags.
ValueHelp not opening ValueHelp not connected to Field or containers missing Verify valueHelp association on Field and that Popover/Dialog containers are defined.
Conditions not applied to binding updateBindingInfo not implemented in delegate Implement updateBindingInfo to apply filter conditions to the OData binding.
Link always rendered as text fetchLinkType returns LinkType.Text or fails Implement fetchLinkType returning Popup or DirectLink type.

Performance & Accessibility

Anti-patterns to avoid

  • Loading all PropertyInfo eagerly when only a subset is needed (return minimal set from fetchProperties).
  • Not implementing updateBindingInfo (conditions are never applied to the data binding).
  • Skipping p13nMode configuration (personalization features are disabled by default).
  • Creating large delegate modules (split complex logic into helper modules loaded on demand).
  • Using synchronous operations in delegate methods (all delegate methods should return Promises).

Accessibility checklist

  • Set ariaLabelledBy on FilterBar referencing a visible title.
  • Set ariaLabelledBy on Chart referencing a visible title.
  • Verify keyboard navigation works for personalization dialogs.
  • Test ValueHelp type-ahead and dialog with screen reader.
  • Ensure all FilterFields have meaningful labels via PropertyInfo label.

原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。