@c-time/frelio-data-json-recipe 3.7.2 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/index.d.ts +14 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -70,6 +70,14 @@ if (isListPageRecipeWithPagination(listRecipe)) {
|
|
|
70
70
|
|
|
71
71
|
`string`, `date`, `number`, `escape`, `toc`, `truncate`, `stripHtml`, `slug`, `lowercase`, `uppercase`, `default`, `count`, `first`, `last`, `join`, `url`, `picture`, `img`, `srcset`, `fileLink`, `relationList`, `constant` など 25 種類以上。
|
|
72
72
|
|
|
73
|
+
`fallbackSource`(任意): `source` の解決結果が空(未定義 / null / 空文字 / 空白のみ)のときに代わりに使う式。
|
|
74
|
+
フォーマットはフォールバック後の値に適用される。先に定義した customField も参照できる。
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{ "field": "titleEscaped", "source": "{$this.title}", "type": "escape" },
|
|
78
|
+
{ "field": "titleHtml", "source": "{$this.titleDisplay}", "type": "string", "fallbackSource": "{$this.titleEscaped}" }
|
|
79
|
+
```
|
|
80
|
+
|
|
73
81
|
---
|
|
74
82
|
|
|
75
83
|
## 型ガード
|
package/dist/index.d.ts
CHANGED
|
@@ -79,8 +79,22 @@ type CustomFieldTransform = {
|
|
|
79
79
|
suffix?: string;
|
|
80
80
|
/** join用の区切り文字(デフォルト: ", ") */
|
|
81
81
|
separator?: string;
|
|
82
|
+
/**
|
|
83
|
+
* join用: 配列の各要素(オブジェクト)から取り出すキー(ドット記法可)。issue #338
|
|
84
|
+
* 指定時は各要素の該当値だけを取り出して結合し、空(未定義 / null / 空文字)の要素は除外する。
|
|
85
|
+
* 例: 繰り返しグループ downloads の各行の fileId をカンマ区切りにする
|
|
86
|
+
* { "field": "deliveryFileIds", "source": "{$this.downloads}", "type": "join", "key": "fileId", "separator": "," }
|
|
87
|
+
*/
|
|
88
|
+
key?: string;
|
|
82
89
|
/** default用のデフォルト値 */
|
|
83
90
|
defaultValue?: string;
|
|
91
|
+
/**
|
|
92
|
+
* source の解決結果が「空」(未定義 / null / 空文字・空白のみ)のときに代わりに使う式。
|
|
93
|
+
* source と同じ書式(例: "{$this.titleEscaped}")で、先に定義した customField も参照できる。
|
|
94
|
+
* フォーマット(type)はフォールバック後の値に適用する。
|
|
95
|
+
* 用途例: 見出し用の HTML フィールド(改行制御つき)が未入力なら、素のタイトルを使う。
|
|
96
|
+
*/
|
|
97
|
+
fallbackSource?: string;
|
|
84
98
|
};
|
|
85
99
|
/**
|
|
86
100
|
* カスタムフィールド(RelationList)
|