From 77e0ebe5f8969fb2aef1a828ae53d825ddb538ca Mon Sep 17 00:00:00 2001 From: "tina-cloud-app[bot]" <58178390+tina-cloud-app[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 04:39:31 +0000 Subject: [PATCH 01/11] TinaCMS content update Co-authored-by: Ben Neoh --- content/docs/reference/types/reference.mdx | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/content/docs/reference/types/reference.mdx b/content/docs/reference/types/reference.mdx index 55f113675..c7a2f4578 100644 --- a/content/docs/reference/types/reference.mdx +++ b/content/docs/reference/types/reference.mdx @@ -141,6 +141,69 @@ You can search your reference with reference selector. } ``` +### Filter reference + +If you have a long list of reference item, you can filter them in the schema before build time using `ui.collectionFilter` + +> Senario: You have a list of author in different location, and you only want the reference select in your post collection to show the desired location. + +```typescript +const referenceField = { + label: 'Author', + name: 'author', + type: 'reference', + ui: { + collectionFilter: { + author: { + location: 'Australia' + } + }, + }, + collections: ['author'], +} +``` + +**Figure: **Show author at location `Australia` + +```typescript +const referenceField = { + label: 'Author', + name: 'author', + type: 'reference', + ui: { + collectionFilter: { + author: { + location: ['Australia','United States'] + } + }, + }, + collections: ['author'], +} +``` + +**Figure: **Show author at location `Australia` and `United State` + +```typescript +const referenceField = { + label: 'Author & Post', + name: 'author and post', + type: 'reference', + ui: { + collectionFilter: { + author: { + location: ['Australia','United States'] + }, + post: { + status: 'published', + }, + }, + }, + collections: ['author', 'post'], +} +``` + +**Figure: **Multiple filter for multiple referenced collection + ### Customizing Reference Selector with optionComponent The default reference selector displays the file path, there are cases where you may want to customize what is displayed in the dropdown to provide a better user experience. For example, showing the author's name instead of the file name can make the selection process more intuitive. From d22a813591af200b26c20366f07556722747f17b Mon Sep 17 00:00:00 2001 From: "tina-cloud-app[bot]" <58178390+tina-cloud-app[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 23:14:48 +0000 Subject: [PATCH 02/11] TinaCMS content update Co-authored-by: Ben Neoh --- content/docs/reference/types/reference.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/docs/reference/types/reference.mdx b/content/docs/reference/types/reference.mdx index c7a2f4578..f273cd46a 100644 --- a/content/docs/reference/types/reference.mdx +++ b/content/docs/reference/types/reference.mdx @@ -1,6 +1,6 @@ --- title: The "reference" field -last_edited: '2024-09-12T01:50:26.823Z' +last_edited: '2024-09-19T23:14:48.048Z' next: '' previous: '' --- @@ -163,7 +163,7 @@ const referenceField = { } ``` -**Figure: **Show author at location `Australia` +**Figure:** Show author at location `Australia` ```typescript const referenceField = { @@ -181,7 +181,7 @@ const referenceField = { } ``` -**Figure: **Show author at location `Australia` and `United State` +\*\*Figure: \*\*Show author at location `Australia` and `United State` ```typescript const referenceField = { @@ -202,7 +202,7 @@ const referenceField = { } ``` -**Figure: **Multiple filter for multiple referenced collection +\*\*Figure: \*\*Multiple filter for multiple referenced collection ### Customizing Reference Selector with optionComponent From f3af3ba1e3a8edeaaddee8589f9349318e4276f5 Mon Sep 17 00:00:00 2001 From: "tina-cloud-app[bot]" <58178390+tina-cloud-app[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 23:17:09 +0000 Subject: [PATCH 03/11] TinaCMS content update Co-authored-by: Ben Neoh --- content/docs/reference/types/reference.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/docs/reference/types/reference.mdx b/content/docs/reference/types/reference.mdx index f273cd46a..976116475 100644 --- a/content/docs/reference/types/reference.mdx +++ b/content/docs/reference/types/reference.mdx @@ -1,6 +1,6 @@ --- title: The "reference" field -last_edited: '2024-09-19T23:14:48.048Z' +last_edited: '2024-09-19T23:17:07.825Z' next: '' previous: '' --- @@ -181,7 +181,7 @@ const referenceField = { } ``` -\*\*Figure: \*\*Show author at location `Australia` and `United State` +**Figure: **Show author at location `Australia` and `United State` ```typescript const referenceField = { From c8acad761a4e662fc234b5319da31cc3668f6033 Mon Sep 17 00:00:00 2001 From: "tina-cloud-app[bot]" <58178390+tina-cloud-app[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 23:17:33 +0000 Subject: [PATCH 04/11] TinaCMS content update Co-authored-by: Ben Neoh --- content/docs/reference/types/reference.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/docs/reference/types/reference.mdx b/content/docs/reference/types/reference.mdx index 976116475..e4bd8d1b5 100644 --- a/content/docs/reference/types/reference.mdx +++ b/content/docs/reference/types/reference.mdx @@ -1,6 +1,6 @@ --- title: The "reference" field -last_edited: '2024-09-19T23:17:07.825Z' +last_edited: '2024-09-19T23:17:33.092Z' next: '' previous: '' --- @@ -202,7 +202,7 @@ const referenceField = { } ``` -\*\*Figure: \*\*Multiple filter for multiple referenced collection +**Figure:** Multiple filter for multiple referenced collection ### Customizing Reference Selector with optionComponent From 68a9c13342d81f91bcded956f28f4c31095cbb67 Mon Sep 17 00:00:00 2001 From: "tina-cloud-app[bot]" <58178390+tina-cloud-app[bot]@users.noreply.github.com> Date: Fri, 20 Sep 2024 05:34:13 +0000 Subject: [PATCH 05/11] TinaCMS content update Co-authored-by: Ben Neoh --- content/docs/reference/types/reference.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/docs/reference/types/reference.mdx b/content/docs/reference/types/reference.mdx index e4bd8d1b5..9db005cae 100644 --- a/content/docs/reference/types/reference.mdx +++ b/content/docs/reference/types/reference.mdx @@ -1,6 +1,6 @@ --- title: The "reference" field -last_edited: '2024-09-19T23:17:33.092Z' +last_edited: '2024-09-20T05:34:11.844Z' next: '' previous: '' --- @@ -181,7 +181,7 @@ const referenceField = { } ``` -**Figure: **Show author at location `Australia` and `United State` +**Figure:** Show author at location `Australia` and `United State` ```typescript const referenceField = { From 8d87bc056e754c04f937cd57c3860f33ba439936 Mon Sep 17 00:00:00 2001 From: "Ben Neoh [SSW]" <87377903+Ben0189@users.noreply.github.com> Date: Fri, 20 Sep 2024 15:40:45 +1000 Subject: [PATCH 06/11] Update content/docs/reference/types/reference.mdx Co-authored-by: Isaac Lombard [SSW] <152236421+isaaclombardssw@users.noreply.github.com> --- content/docs/reference/types/reference.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/reference/types/reference.mdx b/content/docs/reference/types/reference.mdx index 9db005cae..dd5631ef0 100644 --- a/content/docs/reference/types/reference.mdx +++ b/content/docs/reference/types/reference.mdx @@ -143,7 +143,7 @@ You can search your reference with reference selector. ### Filter reference -If you have a long list of reference item, you can filter them in the schema before build time using `ui.collectionFilter` +If you have a long list of reference items, you can filter them in the schema before build time using the `ui.collectionFilter` field. > Senario: You have a list of author in different location, and you only want the reference select in your post collection to show the desired location. From 8fc9c8235b59002a3b9ae2adb56e8038bec9733d Mon Sep 17 00:00:00 2001 From: "Ben Neoh [SSW]" <87377903+Ben0189@users.noreply.github.com> Date: Fri, 20 Sep 2024 15:41:31 +1000 Subject: [PATCH 07/11] reword --- content/docs/reference/types/reference.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/reference/types/reference.mdx b/content/docs/reference/types/reference.mdx index dd5631ef0..531934c1b 100644 --- a/content/docs/reference/types/reference.mdx +++ b/content/docs/reference/types/reference.mdx @@ -143,7 +143,7 @@ You can search your reference with reference selector. ### Filter reference -If you have a long list of reference items, you can filter them in the schema before build time using the `ui.collectionFilter` field. +If you have a long list of reference items, you can filter them in the schema using the `ui.collectionFilter` field. > Senario: You have a list of author in different location, and you only want the reference select in your post collection to show the desired location. From c7c8738f6c760e7d931055a5e7844977401c9a7a Mon Sep 17 00:00:00 2001 From: "Ben Neoh [SSW]" <87377903+Ben0189@users.noreply.github.com> Date: Fri, 20 Sep 2024 15:43:30 +1000 Subject: [PATCH 08/11] Update content/docs/reference/types/reference.mdx Co-authored-by: Isaac Lombard [SSW] <152236421+isaaclombardssw@users.noreply.github.com> --- content/docs/reference/types/reference.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/content/docs/reference/types/reference.mdx b/content/docs/reference/types/reference.mdx index 531934c1b..793cc19ce 100644 --- a/content/docs/reference/types/reference.mdx +++ b/content/docs/reference/types/reference.mdx @@ -164,6 +164,7 @@ const referenceField = { ``` **Figure:** Show author at location `Australia` +It's also possible to filter references options based on a list of values. ```typescript const referenceField = { From 939a3e12abffa46e0128847df8081ae28d36446e Mon Sep 17 00:00:00 2001 From: "Ben Neoh [SSW]" <87377903+Ben0189@users.noreply.github.com> Date: Fri, 20 Sep 2024 15:43:51 +1000 Subject: [PATCH 09/11] Update content/docs/reference/types/reference.mdx Co-authored-by: Isaac Lombard [SSW] <152236421+isaaclombardssw@users.noreply.github.com> --- content/docs/reference/types/reference.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/reference/types/reference.mdx b/content/docs/reference/types/reference.mdx index 793cc19ce..a89190121 100644 --- a/content/docs/reference/types/reference.mdx +++ b/content/docs/reference/types/reference.mdx @@ -183,7 +183,7 @@ const referenceField = { ``` **Figure:** Show author at location `Australia` and `United State` - +Reference fields on multiple collections can be filtered by the values in either collection. ```typescript const referenceField = { label: 'Author & Post', From e22b51ed6c443755ed780e69a1aa2eebc80941c6 Mon Sep 17 00:00:00 2001 From: "Ben Neoh [SSW]" <87377903+Ben0189@users.noreply.github.com> Date: Fri, 20 Sep 2024 15:46:45 +1000 Subject: [PATCH 10/11] Update reference.mdx --- content/docs/reference/types/reference.mdx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/content/docs/reference/types/reference.mdx b/content/docs/reference/types/reference.mdx index a89190121..ad1ffa70a 100644 --- a/content/docs/reference/types/reference.mdx +++ b/content/docs/reference/types/reference.mdx @@ -163,7 +163,6 @@ const referenceField = { } ``` -**Figure:** Show author at location `Australia` It's also possible to filter references options based on a list of values. ```typescript @@ -182,7 +181,6 @@ const referenceField = { } ``` -**Figure:** Show author at location `Australia` and `United State` Reference fields on multiple collections can be filtered by the values in either collection. ```typescript const referenceField = { @@ -203,8 +201,6 @@ const referenceField = { } ``` -**Figure:** Multiple filter for multiple referenced collection - ### Customizing Reference Selector with optionComponent The default reference selector displays the file path, there are cases where you may want to customize what is displayed in the dropdown to provide a better user experience. For example, showing the author's name instead of the file name can make the selection process more intuitive. From e817bd89233ea9cf29f00f6b59b4d3dd7416db0d Mon Sep 17 00:00:00 2001 From: "tina-cloud-app[bot]" <58178390+tina-cloud-app[bot]@users.noreply.github.com> Date: Fri, 20 Sep 2024 07:19:51 +0000 Subject: [PATCH 11/11] TinaCMS content update Co-authored-by: Ben Neoh --- content/docs/reference/types/reference.mdx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/content/docs/reference/types/reference.mdx b/content/docs/reference/types/reference.mdx index ad1ffa70a..b280f3dbf 100644 --- a/content/docs/reference/types/reference.mdx +++ b/content/docs/reference/types/reference.mdx @@ -1,6 +1,6 @@ --- title: The "reference" field -last_edited: '2024-09-20T05:34:11.844Z' +last_edited: '2024-09-20T07:19:50.080Z' next: '' previous: '' --- @@ -143,7 +143,9 @@ You can search your reference with reference selector. ### Filter reference -If you have a long list of reference items, you can filter them in the schema using the `ui.collectionFilter` field. +If you have a long list of reference items, you can filter them in the schema using the `ui.collectionFilter` field with any property you defined in the referenced collection. + +> Note: Current `collectionFilter`only support property of type string. > Senario: You have a list of author in different location, and you only want the reference select in your post collection to show the desired location. @@ -182,6 +184,7 @@ const referenceField = { ``` Reference fields on multiple collections can be filtered by the values in either collection. + ```typescript const referenceField = { label: 'Author & Post',