Skip to content

Commit a709975

Browse files
authored
Merge pull request #1890 from IgniteUI/localization-2026-02-09
[JA] Update topics with the latest Grid Lite breaking changes
2 parents 7ab6d90 + e611935 commit a709975

File tree

6 files changed

+405
-314
lines changed

6 files changed

+405
-314
lines changed

doc/jp/components/grid-lite/binding.md

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,69 +24,75 @@ _language: ja
2424

2525
コンポーネントは実行時にデータ ソースの変更をサポートします。新しいソースが前のものと異なる「形状」を持つ場合、列の設定も更新する必要があります。
2626

27+
<!-- WebComponents -->
2728
```typescript
2829
grid.data = [...{
29-
/** レコードが続きます */
30+
/** レコードが続きます*/
3031
}];
32+
```
3133

32-
// 新しいデータを反映するように列の構成を更新します。
33-
grid.columns = [...];
34+
```html
35+
<igc-grid-lite>
36+
<!-- 新しいデータを表すために、必要に応じて列の構成を更新し、列を追加または削除します。 -->
37+
<igc-grid-lite-column field="id"></igc-grid-lite-column>
38+
</igc-grid-lite>
3439
```
40+
<!-- end: WebComponents -->
3541

36-
```typescript
37-
grid.data = [...{
38-
/** レコードが続きます */
42+
```tsx
43+
this.gridRef.current.data = [...{
44+
/** レコードが続きます*/
3945
}];
4046

41-
// 新しいデータを反映するように列の構成を更新します。
42-
grid.columns = [...];
47+
return (
48+
<igc-grid-lite data={data}>
49+
{/* 新しいデータを表すために、必要に応じて列の構成を更新し、列を追加または削除します。 */}
50+
<igc-grid-lite-column field="id"></igc-grid-lite-column>
51+
</igc-grid-lite>
52+
);
4353
```
4454

4555
```razor
46-
<IgbGridLite Data="data" Columns="columns" />
56+
<IgbGridLite Data="data">
57+
<!-- 新しいデータを表すために、必要に応じて列の構成を更新し、列を追加または削除します。 -->
58+
<IgbGridLiteColumn Field="Id" />
59+
</IgbGridLite>
60+
4761
@code {
4862
this.data = new List<T>
4963
{
5064
// レコードが続きます
5165
};
52-
53-
// 新しいデータを反映するように列の構成を更新します。
54-
this.columns = new List<IgbColumnConfiguration>
55-
{
56-
// 列定義
57-
};
5866
}
5967
```
68+
6069
<!-- React, WebComponents -->
61-
グリッドで `autoGenerate` が有効になっている場合、古い列設定をリセットした場合にのみ、新しい列設定を「推測します」。
70+
グリッドで `autoGenerate` が有効になっている場合、データが変更されると新しい列の構成が自動的に「推測されます」。
6271
<!-- end: React, WebComponents -->
6372

6473
<!-- Blazor -->
65-
グリッドで `AutoGenerate` が有効になっている場合、古い列設定をリセットした場合にのみ、新しい列設定を「推測します」。
74+
グリッドで `AutoGenerate` が有効になっている場合、データが変更されると新しい列の構成が自動的に「推測されます」。
6675
<!-- end: Blazor -->
6776

77+
<!-- React, WebComponents -->
6878
```typescript
6979
grid.autoGenerate = true;
7080

71-
/** 列定義 */
72-
grid.columns = [];
73-
7481
/** 新しいバインディング後、グリッドはバインドされたデータから列コレクションを推論します。 */
7582
grid.data = [];
7683
```
84+
<!-- end: React, WebComponents -->
7785

86+
<!-- Blazor -->
7887
```razor
79-
<IgbGridLite Data="data" AutoGenerate="true" Columns="columns" />
88+
<IgbGridLite Data="data" AutoGenerate="true" />
8089
8190
@code {
82-
83-
// 列定義
84-
this.columns = new List<IgbColumnConfiguration>();
85-
8691
// 新しいバインディング後、グリッドはバインドされたデータから列コレクションを推論します。
8792
this.data = new List<T>();
8893
}
8994
```
95+
<!-- end: Blazor -->
9096
<!-- React, WebComponents -->
9197
>[!NOTE]
9298
>{GridLiteTitle} のソート/フィルター状態は、この方法でデータ ソースを変更しても保持されます。
@@ -106,8 +112,8 @@ grid.data = [];
106112

107113
<!-- TODO ## API References
108114
109-
* `{ComponentName}`
110-
* `Column`
115+
- `{ComponentName}`
116+
- `Column`
111117
112118
-->
113119

doc/jp/components/grid-lite/cell-template.md

Lines changed: 60 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,57 +10,83 @@ _language: ja
1010

1111
# 列セル テンプレート
1212

13-
デフォルトでは、グリッドは列のキーを使用してセル内の値を文字列としてレンダリングします。基本的なシナリオではこれで問題ありませんが、レンダリング結果をカスタマイズしたい場合や、最終出力が異なるデータ フィールドの組み合わせである場合は、セル テンプレート レンダラーを使用します
13+
デフォルトでは、グリッドは列のフィールドを使用してセル内の値を文字列としてレンダリングします。これは基本的なシナリオでは問題ありませんが、レンダリングされる出力をカスタマイズしたい場合や、最終的な出力が異なるデータ フィールドの組み合わせである場合は、セル テンプレートをカスタマイズできます
1414

1515
列の `cellTemplate` プロパティを設定することで、これを実現できます。
1616

1717
<!-- React, WebComponents -->
1818

1919
```typescript
20-
{
21-
cellTemplate?: (params: GridLiteCellContext<T, K>) => TemplateResult;
22-
}
20+
// 列要素への参照を取得します
21+
const column = document.querySelector('igc-grid-lite-column[field="price"]');
22+
23+
// cellTemplate プロパティを設定します
24+
column.cellTemplate = (params: IgcCellContext<T, K>) => { return html`<!-- template content -->`};
2325
```
2426

2527
<!-- End: React, WebComponents -->
2628

29+
<!-- Blazor -->
30+
31+
```razor
32+
<!-- Templates TBD in Blazor -->
33+
<IgbGridLiteColumn Field="Price"></IgbGridLiteColumn>
34+
```
35+
36+
<!-- End: Blazor -->
37+
2738
## フォーマッタ関数として使用する
2839

2940
簡単なシナリオでは、必要に応じてフォーマット済みの値を返すだけで済みます。以下は数値をロケール通貨形式で表示する例です。
3041

3142
<!-- React, WebComponents -->
3243

3344
```typescript
34-
const { format: asCurrency } = new Intl.NumberFormat('en-EN', { style: 'currency', currency: 'EUR' });
45+
const { format: asCurrency } = new Intl.NumberFormat('en-150', { style: 'currency', currency: 'EUR' });
3546

36-
{
37-
...
38-
/** 値 `value = 123456.789` に対してカスタム通貨形式を返します。 */
39-
cellTemplate: (params) => asCurrency(params.value) // => "€123,456.79"
40-
...
41-
}
47+
// 列要素への参照を取得します
48+
const column = document.querySelector('igc-grid-lite-column');
49+
50+
// 値 `value = 123456.789` に対してカスタム通貨形式を返します。
51+
column.cellTemplate = (params) => asCurrency(params.value); // => "€123,456.79"
4252
```
4353

4454
<!-- End: React, WebComponents -->
4555

56+
<!-- Blazor -->
57+
58+
```razor
59+
<!-- Templates TBD in Blazor -->
60+
<IgbGridLiteColumn Field="Price"></IgbGridLiteColumn>
61+
```
62+
63+
<!-- End: Blazor -->
64+
4665
データ ソース内の異なるフィールドの値を組み合わせることも可能です。
47-
<!-- TODO:
48-
Refer to the API documentation for `GridLiteCellContext` for more information. -->
66+
<!-- TODO:
67+
詳細については、`GridLiteCellContext` の API ドキュメントを参照してください。 -->
4968

5069
<!-- React, WebComponents -->
5170

5271
```typescript
53-
const { format: asCurrency } = new Intl.NumberFormat('en-EN', { style: 'currency', currency: 'EUR' });
72+
const { format: asCurrency } = new Intl.NumberFormat('en-150', { style: 'currency', currency: 'EUR' });
5473

55-
{
56-
...
57-
/** 価格が 99.99 の品目 10 個の注文に対してカスタム通貨形式を返します。 */
58-
cellTemplate: ({value, row}) => asCurrency(value * row.data.count) // => "€999.90"
59-
...
60-
}
74+
// 列要素への参照を取得します
75+
const column = document.querySelector('igc-grid-lite-column');
76+
77+
// 価格が 99.99 の品目 10 個の注文に対してカスタム通貨形式を返します
78+
column.cellTemplate = ({value, row}) => asCurrency(value * row.data.count); // => "€999.90"
6179
```
6280
<!-- End: React, WebComponents -->
6381

82+
<!-- Blazor -->
83+
84+
```razor
85+
<!-- Templates TBD in Blazor -->
86+
<IgbGridLiteColumn Field="Price"></IgbGridLiteColumn>
87+
```
88+
<!-- End: Blazor -->
89+
6490
## カスタム DOM テンプレート
6591

6692
`cellTemplate` プロパティを値フォーマッタとして使用する以外に、独自の DOM テンプレートを作成することもできます。これはセルコンテナー内にレンダリングされます。
@@ -75,16 +101,24 @@ const { format: asCurrency } = new Intl.NumberFormat('en-EN', { style: 'currency
75101
// Lit パッケージから `html` タグ関数をインポートします。
76102
import { html } from "lit";
77103

78-
{
79-
key: 'rating',
80-
// グリッド内の `rating` 値を表すために別の Web コンポーネントを使用します。
81-
cellTemplate: ({ value }) => html`<igc-rating readonly value=${value}></igc-rating>`
82-
...
83-
}
104+
// 列要素への参照を取得します
105+
const column = document.querySelector('igc-grid-lite-column[field="rating"]');
106+
107+
// グリッド内の `rating` 値を表すために別の Web コンポーネントを使用します
108+
column.cellTemplate = ({ value }) => html`<igc-rating readonly value=${value}></igc-rating>`;
84109
```
85110

86111
<!-- End: React, WebComponents -->
87112

113+
<!-- Blazor -->
114+
115+
```razor
116+
<!-- Templates TBD in Blazor -->
117+
<IgbGridLiteColumn Field="Rating"></IgbGridLiteColumn>
118+
```
119+
120+
<!-- End: Blazor -->
121+
88122
>[!NOTE]
89123
>テンプレートが複雑であればあるほど、パフォーマンス コストが増加します。パフォーマンスが重要な場合は複雑な DOM 構造を避けてください。
90124

0 commit comments

Comments
 (0)