From a90fbc813d41db98aaf8dc69894b31a884176987 Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Thu, 23 May 2024 11:22:00 -0300 Subject: [PATCH] Fixes access to undefined filterTypeOptions in text autocomplete scenario. --- ...enberg-block-carousel-collections-list.css | 4 +-- ...an-gutenberg-block-carousel-items-list.css | 4 +-- ...an-gutenberg-block-carousel-terms-list.css | 4 +-- .../tainacan-gutenberg-block-item-gallery.css | 4 +-- src/views/admin/js/filter-types-mixin.js | 30 +++++++++---------- 5 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/assets/css/tainacan-gutenberg-block-carousel-collections-list.css b/src/assets/css/tainacan-gutenberg-block-carousel-collections-list.css index 8203fd2a5..4e07a930e 100644 --- a/src/assets/css/tainacan-gutenberg-block-carousel-collections-list.css +++ b/src/assets/css/tainacan-gutenberg-block-carousel-collections-list.css @@ -9,7 +9,7 @@ border: 0; } /** - * Swiper 11.1.1 + * Swiper 11.1.3 * Most modern mobile touch slider and framework with hardware accelerated transitions * https://swiperjs.com * @@ -17,7 +17,7 @@ * * Released under the MIT License * - * Released on: April 9, 2024 + * Released on: May 13, 2024 */ @font-face { font-family: 'swiper-icons'; diff --git a/src/assets/css/tainacan-gutenberg-block-carousel-items-list.css b/src/assets/css/tainacan-gutenberg-block-carousel-items-list.css index 17225d9e0..2cafe7791 100644 --- a/src/assets/css/tainacan-gutenberg-block-carousel-items-list.css +++ b/src/assets/css/tainacan-gutenberg-block-carousel-items-list.css @@ -9,7 +9,7 @@ border: 0; } /** - * Swiper 11.1.1 + * Swiper 11.1.3 * Most modern mobile touch slider and framework with hardware accelerated transitions * https://swiperjs.com * @@ -17,7 +17,7 @@ * * Released under the MIT License * - * Released on: April 9, 2024 + * Released on: May 13, 2024 */ @font-face { font-family: 'swiper-icons'; diff --git a/src/assets/css/tainacan-gutenberg-block-carousel-terms-list.css b/src/assets/css/tainacan-gutenberg-block-carousel-terms-list.css index 4fb6cd3fd..f65068fc0 100644 --- a/src/assets/css/tainacan-gutenberg-block-carousel-terms-list.css +++ b/src/assets/css/tainacan-gutenberg-block-carousel-terms-list.css @@ -9,7 +9,7 @@ border: 0; } /** - * Swiper 11.1.1 + * Swiper 11.1.3 * Most modern mobile touch slider and framework with hardware accelerated transitions * https://swiperjs.com * @@ -17,7 +17,7 @@ * * Released under the MIT License * - * Released on: April 9, 2024 + * Released on: May 13, 2024 */ @font-face { font-family: 'swiper-icons'; diff --git a/src/assets/css/tainacan-gutenberg-block-item-gallery.css b/src/assets/css/tainacan-gutenberg-block-item-gallery.css index be9ce44bf..4bfdcbb86 100644 --- a/src/assets/css/tainacan-gutenberg-block-item-gallery.css +++ b/src/assets/css/tainacan-gutenberg-block-item-gallery.css @@ -1,5 +1,5 @@ /** - * Swiper 11.1.1 + * Swiper 11.1.3 * Most modern mobile touch slider and framework with hardware accelerated transitions * https://swiperjs.com * @@ -7,7 +7,7 @@ * * Released under the MIT License * - * Released on: April 9, 2024 + * Released on: May 13, 2024 */ @font-face { font-family: 'swiper-icons'; diff --git a/src/views/admin/js/filter-types-mixin.js b/src/views/admin/js/filter-types-mixin.js index e459f5941..c01f95675 100644 --- a/src/views/admin/js/filter-types-mixin.js +++ b/src/views/admin/js/filter-types-mixin.js @@ -268,31 +268,30 @@ export const dynamicFilterTypeMixin = { } } - if (this.shouldAddOptions === true && this.searchResults && this.searchResults.length) + if ( this.shouldAddOptions === true && this.searchResults && this.searchResults.length ) this.searchResults = this.searchResults.concat(sResults); else this.searchResults = sResults; - if (opts) { + if ( opts ) { if (this.shouldAddOptions === true && this.options && this.options.length) this.options = this.options.concat(opts) else this.options = opts; } - else if(!search) + else if ( !search ) this.noMorePage = 1; - if (this.options.length < this.maxNumOptionsCheckboxList && !search) + if ( this.options.length < this.maxNumOptionsCheckboxList && !search ) this.noMorePage = 1; - if ((this.filterTypeOptions.use_max_options == true && this.filter.max_options) && this.options.length >= this.filter.max_options) { + if ( ( this.filterTypeOptions && this.filterTypeOptions.use_max_options == true && this.filter.max_options ) && this.options.length >= this.filter.max_options ) { let showViewAllButton = true; - if (this.options.length === this.filter.max_options){ + if ( this.options.length === this.filter.max_options ) this.options[this.filter.max_options-1].showViewAllButton = showViewAllButton; - } else { + else this.options[this.options.length-1].showViewAllButton = showViewAllButton; - } } }, prepareOptionsForRelationship(items, search, valuesToIgnore, isInCheckboxModal) { @@ -340,32 +339,31 @@ export const dynamicFilterTypeMixin = { } } - if (this.shouldAddOptions === true && this.searchResults && this.searchResults.length) + if ( this.shouldAddOptions === true && this.searchResults && this.searchResults.length ) this.searchResults = this.searchResults.concat(sResults); else this.searchResults = sResults; - if (opts) { + if ( opts ) { if (this.shouldAddOptions === true && this.options && this.options.length) this.options = this.options.concat(opts) else this.options = opts; } - else if(!search) + else if ( !search ) this.noMorePage = 1; - if (this.options.length < this.maxNumOptionsCheckboxList) + if ( this.options.length < this.maxNumOptionsCheckboxList ) this.noMorePage = 1; - if ((this.filterTypeOptions.use_max_options == true && this.filter.max_options) && this.options.length >= this.filter.max_options) { + if ( ( this.filterTypeOptions && this.filterTypeOptions.use_max_options == true && this.filter.max_options ) && this.options.length >= this.filter.max_options ) { let showViewAllButton = true; - if(this.options.length === this.filter.max_options){ + if ( this.options.length === this.filter.max_options ) this.options[this.filter.max_options-1].showViewAllButton = showViewAllButton; - } else { + else this.options[this.options.length-1].showViewAllButton = showViewAllButton; - } } }, },