-
Notifications
You must be signed in to change notification settings - Fork 0
MDC: 標準コンポーネントをカスタムコンポーネントに入れ替え機能(ドキュメント) #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tei-syou
wants to merge
4
commits into
main
Choose a base branch
from
feature/1299-mdc-custom-component
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
87 changes: 87 additions & 0 deletions
87
...uide/src/docs/asciidoc/materialdesigncomponents/entityview/customcomponent.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| [[customcomponent]] | ||
| == カスタムコンポーネント | ||
|
|
||
| カスタムコンポーネントをレイアウトに配置することで、独自の画面部品を画面に組み込むことができます。 | ||
|
|
||
| カスタムコンポーネントは、 `コンポーネント種別` によって、テンプレート文字列を直接記述する方法と、登録済みのコンポーネントを呼び出す方法のいずれかを選択できます。 + | ||
| テンプレートの実装方法の詳細については、 link:../../../storybook/index.html?path=/docs/開発者ドキュメント-オリジナルテンプレート[コンポーネントカタログ^]を参照してください。 | ||
|
|
||
|
|
||
| [[customcomponent_settings]] | ||
| === カスタムコンポーネントの設定 | ||
|
|
||
| [cols="1,4a", options="header"] | ||
| |=== | ||
| |設定項目 |設定内容 | ||
|
|
||
| |コンポーネント種別 | ||
| |カスタムコンポーネントの実装方式を選択します。 + | ||
| 選択した種別によって、以降の項目の有効範囲や挙動が異なります。 | ||
|
|
||
| TEMPLATE:: テンプレート文字列を直接記述してコンポーネントを定義します。 + | ||
| `テンプレートの解釈方法` に応じて `HTML` / `VUE_SFC` / `VUE_SFC_LIKE` のいずれかを選択できます。 | ||
|
|
||
| COMPONENT:: 登録済みのコンポーネントを呼び出します。 + | ||
| `コンポーネント名` には呼び出すコンポーネントの名称を指定します。実行時にはコンポーネントが動的にロードされ、コンポーネントとしてレンダリングされます。 + | ||
| 未登録のコンポーネント名を指定した場合、ロードに失敗し、コンポーネントが正しく表示されません。 | ||
|
|
||
| |テンプレート定義名 | ||
| |登録済テンプレート名を設定します。 + | ||
| `コンポーネント種別` が `TEMPLATE` の場合に有効な設定です。 | ||
|
|
||
| |テンプレートの解釈方法 | ||
| |記述されたテンプレート文字列の解釈タイプです。 `コンポーネント種別` が `TEMPLATE` の場合に選択できます。 + | ||
| 以下の3つから選択できます。 | ||
|
|
||
| HTML:: HTMLとして解釈します。HTMLやスクリプトの記述が可能です。 | ||
| VUE_SFC:: Vue.jsのSFC形式(単一ファイルコンポーネント形式)で記述されたコンポーネントとして解釈します。 | ||
| VUE_SFC_LIKE:: Vue.jsのランタイムを用いてコンポーネントとして解釈します。MDCでは、Vue.jsのランタイムに加えてコンパイラもバンドルしており、Vue.jsのテンプレート構文を利用することが可能です。 | ||
|
|
||
| |コンポーネント名 | ||
| |`コンポーネント種別` が `COMPONENT` の場合は必須です。呼び出すコンポーネントの名称を指定します。 + | ||
| `コンポーネント種別` が `TEMPLATE` の場合で `テンプレートの解釈方法` が `VUE_SFC_LIKE` の場合も必須です。 + | ||
| `テンプレートの解釈方法` が `VUE_SFC` でコンポーネント名が未入力の場合、自動でランダムなコンポーネント名を割り当てます。 + | ||
| コンポーネント名は、英文字とハイフン(-)のみを利用したパスカルケースでの命名を推奨します。 | ||
|
|
||
| |VUE_SFC形式のテンプレートをプリコンパイルするか | ||
| |Vue.jsのSFC形式のテンプレートをプリコンパイルするかを指定します。`テンプレートの解釈方法` が `VUE_SFC` であり、Vue.jsのSFC形式のテンプレートを定義保存時にプリコンパイルしておきたい場合にチェックします。プリコンパイルしておくことで、コンポーネントの初期化処理を高速化できます。 | ||
|
|
||
| [NOTE] | ||
| ==== | ||
| プリコンパイルの注意点:: | ||
| - プリコンパイルを実行したい場合には、 `コンポーネント名` の指定が必須となります。 | ||
| - `テンプレート定義名` で指定した登録済みのテンプレートは、定義保存時に実行されてプリコンパイルされるため、テンプレートの内容が変更された場合は再度定義を保存する必要があります。また、JSPやGroovyTemplateなどで記述されたテンプレートには、リクエスト情報やセッション情報、ユーザー固有情報などを使用しないように注意してください。 | ||
| ==== | ||
|
|
||
| |=== | ||
|
|
||
|
|
||
| [[customcomponent_data_binding]] | ||
| === データ受け渡し | ||
|
|
||
| カスタムコンポーネントが受け取る props および発火する emits は、 **カスタムコンポーネントで置き換える対象のMDC標準のコンポーネントが受け取る props および発火する emits と同じ** になります。 + | ||
| 詳細は置き換え対象のMDC標準コンポーネントの実装を参照してください。 | ||
|
|
||
| .例:検索条件ダイアログをカスタムコンポーネントに置き換える場合 | ||
| ==== | ||
| 置き換え対象の `MSearchConditionDialog.vue` が受け取る props と発火する emits がそのままカスタムコンポーネントに引き渡されます。 + | ||
|
|
||
| .置き換え対象の props | ||
| * `viewKey` : EntityView の Key 情報 | ||
| * `title` : 検索画面タイトル | ||
| * `searchConditionSection` : 検索条件セクション | ||
| * `initialSearchCondition` : 初期検索条件 | ||
| * `searchErrorInfo` : 検索エラーメッセージ | ||
| * `aboveConditionSection` : 検索条件上のセクション | ||
| * `belowConditionSection` : 検索条件下のセクション | ||
| * `customSearchCondition` : 検索条件をさらに別のカスタムコンポーネントで置き換える設定 | ||
| * `contextMap` : コンテキストマップ(下位のコンポーネントに引き渡す情報) | ||
|
|
||
| .置き換え対象の emits | ||
| * `change:search-condition` : 検索条件変更 | ||
| * `loaded:definition` : 検索画面定義ロード完了 | ||
| * `error:load` : 検索画面定義ロード失敗 | ||
| * `update:linkProperty` : 連動プロパティ更新 | ||
|
|
||
| カスタムコンポーネントはこれらの props / emits を、置き換え対象が `VUE_SFC` / `VUE_SFC_LIKE` のテンプレートで実装されたコンポーネントか、 `COMPONENT` で読み込まれたコンポーネントかにかかわらず、透過的に受け渡します。 | ||
| ==== | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,4 +21,6 @@ include::bulklayout.adoc[] | |
|
|
||
| include::filter.adoc[] | ||
|
|
||
| include::customcomponent.adoc[] | ||
|
|
||
| include::customize.adoc[] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.