-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(@dpc-sdp/ripple-ui-core): add support for custom components in d…
…ata table extra content this also adds support for extra content in search listings/custom collections, and removes some unused props like content and items
- Loading branch information
David Featherston
committed
Jan 25, 2024
1 parent
d1e0761
commit e8f53e4
Showing
9 changed files
with
531 additions
and
36 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
examples/nuxt-app/components/global/TableExtraContentComponentExample.vue
This file contains 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,28 @@ | ||
<template> | ||
<div class="tide-extra-component-example"> | ||
<RplTag | ||
v-if="item?.field_fv_recommendation_number" | ||
:label="item.field_fv_recommendation_number[0]" | ||
/> | ||
<p v-if="item?.fv_recommendation_status"> | ||
{{ ` ${item.fv_recommendation_status[0]}` }} | ||
</p> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
interface Props { | ||
item: any | ||
} | ||
defineProps<Props>() | ||
</script> | ||
|
||
<style> | ||
.tide-extra-component-example { | ||
display: flex; | ||
gap: var(--rpl-sp-2); | ||
align-items: center; | ||
padding: var(--rpl-sp-5); | ||
} | ||
</style> |
This file contains 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
133 changes: 133 additions & 0 deletions
133
examples/nuxt-app/test/fixtures/search-listing/table/page-extra-component.json
This file contains 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,133 @@ | ||
{ | ||
"title": "Table with component extra data", | ||
"changed": "2022-11-02T12:47:29+11:00", | ||
"created": "2022-11-02T12:47:29+11:00", | ||
"type": "tide_search_listing", | ||
"nid": "11dede11-10c0-111e1-1100-000000000330", | ||
"showTopicTags": true, | ||
"summary": "On 28 January 2023 the Victorian Government announced the implementation of the final recommendations of the Royal Commission into Family Violence. This marks our public commitment to implementing all 227 recommendations.", | ||
"config": { | ||
"searchListingConfig": { | ||
"resultsPerPage": 40, | ||
"customSort": [ | ||
{ "_score": "desc" }, | ||
{ "field_fv_recommendation_number": "asc" }, | ||
{ "_doc": "desc" } | ||
] | ||
}, | ||
"queryConfig": { | ||
"multi_match": { | ||
"query": "{{query}}", | ||
"fields": [ | ||
"title^3", | ||
"field_landing_page_summary^2", | ||
"body", | ||
"field_paragraph_body", | ||
"summary_processed" | ||
] | ||
} | ||
}, | ||
"results": { | ||
"layout": { | ||
"component": "TideSearchResultsTable", | ||
"props": { | ||
"offset": 0, | ||
"showExtraContent": true, | ||
"caption": "My Table", | ||
"footer": "Some notes about the table", | ||
"headingType": { "horizontal": true, "vertical": true }, | ||
"columns": [ | ||
{ | ||
"label": "Recommendation", | ||
"objectKey": "field_fv_recommendation_number" | ||
}, | ||
{ "label": "Title", "component": "TideSearchListingTableLink" }, | ||
{ | ||
"label": "Category", | ||
"objectKey": "field_fv_recommendation_category_name" | ||
}, | ||
{ "label": "Status", "objectKey": "fv_recommendation_status" } | ||
], | ||
"extraContent": { | ||
"component": "TableExtraContentComponentExample" | ||
} | ||
} | ||
} | ||
}, | ||
"globalFilters": [ | ||
{ "terms": { "type": ["fv_recommendation"] } }, | ||
{ "terms": { "field_node_site": ["4"] } } | ||
], | ||
"userFilters": [ | ||
{ | ||
"id": "category", | ||
"component": "TideSearchFilterDropdown", | ||
"filter": { | ||
"type": "terms", | ||
"value": "field_fv_recommendation_category_name.keyword" | ||
}, | ||
"aggregations": { | ||
"field": "field_fv_recommendation_category_name.keyword", | ||
"source": "elastic" | ||
}, | ||
"props": { | ||
"id": "category", | ||
"label": "Category", | ||
"placeholder": "Select a category", | ||
"type": "RplFormDropdown", | ||
"multiple": true | ||
} | ||
}, | ||
{ | ||
"id": "department", | ||
"component": "TideSearchFilterDropdown", | ||
"filter": { | ||
"type": "terms", | ||
"value": "field_fv_recommendation_dpt_name.keyword" | ||
}, | ||
"aggregations": { | ||
"field": "field_fv_recommendation_dpt_name.keyword", | ||
"source": "elastic" | ||
}, | ||
"props": { | ||
"id": "department", | ||
"label": "Deparment", | ||
"placeholder": "Select a department", | ||
"type": "RplFormDropdown", | ||
"multiple": true | ||
} | ||
}, | ||
{ | ||
"id": "status", | ||
"component": "TideSearchFilterDropdown", | ||
"filter": { | ||
"type": "terms", | ||
"value": "fv_recommendation_status.keyword" | ||
}, | ||
"aggregations": { | ||
"field": "recommendation_status", | ||
"source": "taxonomy" | ||
}, | ||
"props": { | ||
"id": "status", | ||
"label": "Status", | ||
"placeholder": "Select a status", | ||
"type": "RplFormDropdown", | ||
"multiple": true, | ||
"options": [ | ||
{ | ||
"id": "1", | ||
"label": "Implemented", | ||
"value": "Implemented" | ||
}, | ||
{ | ||
"id": "2", | ||
"label": "Not Implemented", | ||
"value": "Not Implemented" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} |
137 changes: 137 additions & 0 deletions
137
examples/nuxt-app/test/fixtures/search-listing/table/page-extra-structured.json
This file contains 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,137 @@ | ||
{ | ||
"title": "Table with structure extra data", | ||
"changed": "2022-11-02T12:47:29+11:00", | ||
"created": "2022-11-02T12:47:29+11:00", | ||
"type": "tide_search_listing", | ||
"nid": "11dede11-10c0-111e1-1100-000000000330", | ||
"showTopicTags": true, | ||
"summary": "On 28 January 2023 the Victorian Government announced the implementation of the final recommendations of the Royal Commission into Family Violence. This marks our public commitment to implementing all 227 recommendations.", | ||
"config": { | ||
"searchListingConfig": { | ||
"resultsPerPage": 40, | ||
"customSort": [ | ||
{ "_score": "desc" }, | ||
{ "field_fv_recommendation_number": "asc" }, | ||
{ "_doc": "desc" } | ||
] | ||
}, | ||
"queryConfig": { | ||
"multi_match": { | ||
"query": "{{query}}", | ||
"fields": [ | ||
"title^3", | ||
"field_landing_page_summary^2", | ||
"body", | ||
"field_paragraph_body", | ||
"summary_processed" | ||
] | ||
} | ||
}, | ||
"results": { | ||
"layout": { | ||
"component": "TideSearchResultsTable", | ||
"props": { | ||
"showExtraContent": true, | ||
"caption": "My Table", | ||
"footer": "Some notes about the table", | ||
"headingType": { "horizontal": true, "vertical": true }, | ||
"columns": [ | ||
{ | ||
"label": "Recommendation", | ||
"objectKey": "field_fv_recommendation_number" | ||
}, | ||
{ "label": "Title", "component": "TideSearchListingTableLink" }, | ||
{ | ||
"label": "Category", | ||
"objectKey": "field_fv_recommendation_category_name" | ||
}, | ||
{ "label": "Status", "objectKey": "fv_recommendation_status" } | ||
], | ||
"extraContent": { | ||
"items": [ | ||
{ | ||
"label": "More info", | ||
"objectKey": "title" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"globalFilters": [ | ||
{ "terms": { "type": ["fv_recommendation"] } }, | ||
{ "terms": { "field_node_site": ["4"] } } | ||
], | ||
"userFilters": [ | ||
{ | ||
"id": "category", | ||
"component": "TideSearchFilterDropdown", | ||
"filter": { | ||
"type": "terms", | ||
"value": "field_fv_recommendation_category_name.keyword" | ||
}, | ||
"aggregations": { | ||
"field": "field_fv_recommendation_category_name.keyword", | ||
"source": "elastic" | ||
}, | ||
"props": { | ||
"id": "category", | ||
"label": "Category", | ||
"placeholder": "Select a category", | ||
"type": "RplFormDropdown", | ||
"multiple": true | ||
} | ||
}, | ||
{ | ||
"id": "department", | ||
"component": "TideSearchFilterDropdown", | ||
"filter": { | ||
"type": "terms", | ||
"value": "field_fv_recommendation_dpt_name.keyword" | ||
}, | ||
"aggregations": { | ||
"field": "field_fv_recommendation_dpt_name.keyword", | ||
"source": "elastic" | ||
}, | ||
"props": { | ||
"id": "department", | ||
"label": "Deparment", | ||
"placeholder": "Select a department", | ||
"type": "RplFormDropdown", | ||
"multiple": true | ||
} | ||
}, | ||
{ | ||
"id": "status", | ||
"component": "TideSearchFilterDropdown", | ||
"filter": { | ||
"type": "terms", | ||
"value": "fv_recommendation_status.keyword" | ||
}, | ||
"aggregations": { | ||
"field": "recommendation_status", | ||
"source": "taxonomy" | ||
}, | ||
"props": { | ||
"id": "status", | ||
"label": "Status", | ||
"placeholder": "Select a status", | ||
"type": "RplFormDropdown", | ||
"multiple": true, | ||
"options": [ | ||
{ | ||
"id": "1", | ||
"label": "Implemented", | ||
"value": "Implemented" | ||
}, | ||
{ | ||
"id": "2", | ||
"label": "Not Implemented", | ||
"value": "Not Implemented" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} |
This file contains 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
Oops, something went wrong.