From 062fdad40c2ed9db1f74b806bbb365ef2b9d6562 Mon Sep 17 00:00:00 2001 From: ncla Date: Sat, 1 Oct 2022 18:06:08 +0300 Subject: [PATCH 1/5] Toggle all data list button now selects maximum possible entries while respecting max entries limit --- resources/js/components/data-list/HasFilters.js | 4 ++-- resources/js/components/data-list/Table.vue | 2 +- resources/js/components/data-list/ToggleAll.vue | 14 ++++++-------- resources/js/components/entries/Listing.vue | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/resources/js/components/data-list/HasFilters.js b/resources/js/components/data-list/HasFilters.js index 731b8814606..eb3c182199b 100644 --- a/resources/js/components/data-list/HasFilters.js +++ b/resources/js/components/data-list/HasFilters.js @@ -70,8 +70,8 @@ export default { }, unselectAllItems() { - if (this.$refs.toggleAll) { - this.$refs.toggleAll.uncheckAllItems(); + if (this.$refs.dataList) { + this.$refs.dataList.clearSelections(); } }, diff --git a/resources/js/components/data-list/Table.vue b/resources/js/components/data-list/Table.vue index 39494b5b6ef..1a64f97ef70 100644 --- a/resources/js/components/data-list/Table.vue +++ b/resources/js/components/data-list/Table.vue @@ -3,7 +3,7 @@ - + 0; }, }, methods: { toggle() { - this.anyItemsChecked ? this.uncheckAllItems() : this.checkAllItems() + this.anyItemsChecked ? this.uncheckAllItems() : this.checkMaximumAmountOfItems() }, - checkAllItems() { - this.sharedState.selections = _.values(_.map(this.sharedState.rows, item => item.id)) + checkMaximumAmountOfItems() { + this.sharedState.selections = _.chain(this.sharedState.rows) + .map(item => item.id) + .first(this.sharedState.maxSelections ?? Infinity) + .value() }, uncheckAllItems() { diff --git a/resources/js/components/entries/Listing.vue b/resources/js/components/entries/Listing.vue index be71f791cf8..6d15afff310 100644 --- a/resources/js/components/entries/Listing.vue +++ b/resources/js/components/entries/Listing.vue @@ -7,6 +7,7 @@ Date: Sat, 1 Oct 2022 18:13:05 +0300 Subject: [PATCH 2/5] Identation --- resources/js/components/data-list/ToggleAll.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/js/components/data-list/ToggleAll.vue b/resources/js/components/data-list/ToggleAll.vue index 9ef34b11dd2..d9cb923b03f 100644 --- a/resources/js/components/data-list/ToggleAll.vue +++ b/resources/js/components/data-list/ToggleAll.vue @@ -18,10 +18,10 @@ export default { }, checkMaximumAmountOfItems() { - this.sharedState.selections = _.chain(this.sharedState.rows) - .map(item => item.id) - .first(this.sharedState.maxSelections ?? Infinity) - .value() + this.sharedState.selections = _.chain(this.sharedState.rows) + .map(item => item.id) + .first(this.sharedState.maxSelections ?? Infinity) + .value() }, uncheckAllItems() { From 18b905e3cf73e35b227342315abdf99004c3e707 Mon Sep 17 00:00:00 2001 From: ncla Date: Sat, 1 Oct 2022 18:14:12 +0300 Subject: [PATCH 3/5] Readd newline that I yoinked away --- resources/js/components/entries/Listing.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/js/components/entries/Listing.vue b/resources/js/components/entries/Listing.vue index 6d15afff310..8a54642e768 100644 --- a/resources/js/components/entries/Listing.vue +++ b/resources/js/components/entries/Listing.vue @@ -128,6 +128,7 @@ export default { initialSite: this.site, } }, + computed: { actionContext() { return {collection: this.collection}; From 00b371216c31225b77e8c4c3c4a5aba3a49763b5 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Tue, 1 Nov 2022 11:16:33 -0400 Subject: [PATCH 4/5] restore ref --- resources/js/components/data-list/Table.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/js/components/data-list/Table.vue b/resources/js/components/data-list/Table.vue index 1a64f97ef70..39494b5b6ef 100644 --- a/resources/js/components/data-list/Table.vue +++ b/resources/js/components/data-list/Table.vue @@ -3,7 +3,7 @@ - + Date: Tue, 1 Nov 2022 11:31:32 -0400 Subject: [PATCH 5/5] Add ref in a few other places --- resources/js/components/collections/Listing.vue | 2 +- resources/js/components/inputs/relationship/Selector.vue | 1 + resources/js/components/terms/Listing.vue | 1 + resources/js/components/users/Listing.vue | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/js/components/collections/Listing.vue b/resources/js/components/collections/Listing.vue index ba6e5e40132..f2c62e6e8ff 100644 --- a/resources/js/components/collections/Listing.vue +++ b/resources/js/components/collections/Listing.vue @@ -1,5 +1,5 @@