@@ -16,6 +16,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
1616 var currentPage = 1 ;
1717 var currentCategory = "" ;
1818 var currentType = "" ;
19+ var currentColorType = "" ;
1920 var allCategory = /*#__PURE__*/ function ( ) {
2021 var _ref = _asyncToGenerator ( /*#__PURE__*/ _regeneratorRuntime ( ) . mark ( function _callee ( ) {
2122 return _regeneratorRuntime ( ) . wrap ( function _callee$ ( _context ) {
@@ -96,6 +97,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
9697 var category ,
9798 type ,
9899 page ,
100+ color_type ,
99101 result ,
100102 query_domain ,
101103 response ,
@@ -107,6 +109,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
107109 category = _args3 . length > 0 && _args3 [ 0 ] !== undefined ? _args3 [ 0 ] : "" ;
108110 type = _args3 . length > 1 ? _args3 [ 1 ] : undefined ;
109111 page = _args3 . length > 2 && _args3 [ 2 ] !== undefined ? _args3 [ 2 ] : 1 ;
112+ color_type = _args3 . length > 3 && _args3 [ 3 ] !== undefined ? _args3 [ 3 ] : "" ;
110113 result = [ ] ;
111114 query_domain = new URL ( aae_domain ) ;
112115 if ( type ) {
@@ -119,35 +122,38 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
119122 query_domain . searchParams . set ( "page" , page ) ;
120123 currentPage = page ;
121124 }
122- _context3 . prev = 8 ;
123- _context3 . next = 11 ;
125+ if ( color_type ) {
126+ query_domain . searchParams . set ( "color_type" , color_type ) ;
127+ }
128+ _context3 . prev = 10 ;
129+ _context3 . next = 13 ;
124130 return fetch ( query_domain ) ;
125- case 11 :
131+ case 13 :
126132 response = _context3 . sent ;
127133 if ( response . ok ) {
128- _context3 . next = 14 ;
134+ _context3 . next = 16 ;
129135 break ;
130136 }
131137 throw new Error ( "HTTP error! Status: " . concat ( response . status ) ) ;
132- case 14 :
133- _context3 . next = 16 ;
134- return response . json ( ) ;
135138 case 16 :
139+ _context3 . next = 18 ;
140+ return response . json ( ) ;
141+ case 18 :
136142 data = _context3 . sent ;
137143 result = data . templates || [ ] ;
138- _context3 . next = 23 ;
144+ _context3 . next = 25 ;
139145 break ;
140- case 20 :
141- _context3 . prev = 20 ;
142- _context3 . t0 = _context3 [ "catch" ] ( 8 ) ;
146+ case 22 :
147+ _context3 . prev = 22 ;
148+ _context3 . t0 = _context3 [ "catch" ] ( 10 ) ;
143149 console . error ( "Fetch Error:" , _context3 . t0 ) ;
144- case 23 :
150+ case 25 :
145151 return _context3 . abrupt ( "return" , templates_validate ( result ) ) ;
146- case 24 :
152+ case 26 :
147153 case "end" :
148154 return _context3 . stop ( ) ;
149155 }
150- } , _callee3 , null , [ [ 8 , 20 ] ] ) ;
156+ } , _callee3 , null , [ [ 10 , 22 ] ] ) ;
151157 } ) ) ;
152158 return function get_category_templates ( ) {
153159 return _ref3 . apply ( this , arguments ) ;
@@ -263,6 +269,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
263269
264270 //category select
265271 selected_category ( t ) ;
272+ selected_color_type ( t ) ;
266273 render_single_template ( t ) ;
267274 search_function ( ) ;
268275 template_import ( ) ;
@@ -273,6 +280,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
273280 function _render_templates ( ) {
274281 _render_templates = _asyncToGenerator ( /*#__PURE__*/ _regeneratorRuntime ( ) . mark ( function _callee6 ( t , activeMenu ) {
275282 var category ,
283+ color_type ,
276284 templates ,
277285 is_loading ,
278286 container ,
@@ -282,28 +290,30 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
282290 while ( 1 ) switch ( _context6 . prev = _context6 . next ) {
283291 case 0 :
284292 category = _args6 . length > 2 && _args6 [ 2 ] !== undefined ? _args6 [ 2 ] : "" ;
293+ color_type = _args6 . length > 3 && _args6 [ 3 ] !== undefined ? _args6 [ 3 ] : "" ;
285294 templates = wp . template ( "wcf-templates" ) ;
286295 contents = null ;
287296 is_loading = true ;
288297 loading ( is_loading ) ;
289- _context6 . next = 7 ;
298+ _context6 . next = 8 ;
290299 return templates ( {
291300 templates : [ ] ,
292301 categories : storeCategory
293302 } ) ;
294- case 7 :
303+ case 8 :
295304 contents = _context6 . sent ;
296305 t . append ( contents ) ;
297306 container = document . querySelector ( ".wcf-library-templates" ) ;
298307 currentCategory = category ;
299308 currentType = activeMenu ;
309+ currentColorType = color_type ;
300310 if ( active_resize_first_load === 0 ) {
301311 $ ( window ) . trigger ( "resize" ) ;
302312 active_resize_first_load ++ ;
303313 }
304- _context6 . next = 15 ;
305- return get_category_templates ( category , activeMenu ) ;
306- case 15 :
314+ _context6 . next = 17 ;
315+ return get_category_templates ( category , activeMenu , 1 , color_type ) ;
316+ case 17 :
307317 getTemplate = _context6 . sent ;
308318 getTemplate . forEach ( function ( item ) {
309319 var templateHtml = generateTemplate ( item ) ;
@@ -319,8 +329,12 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
319329 if ( category ) {
320330 $ ( "#wcf-template-library-filter-subtype option[value='" + category + "']" ) . attr ( "selected" , "selected" ) ;
321331 }
332+ if ( color_type ) {
333+ $ ( "#wcf-template-library-color-subtype option[value='" + color_type + "']" ) . attr ( "selected" , "selected" ) ;
334+ }
335+
322336 //window.backContent = $('#wcf-template-library .dialog-widget-content').html();
323- case 20 :
337+ case 23 :
324338 case "end" :
325339 return _context6 . stop ( ) ;
326340 }
@@ -405,7 +419,16 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
405419 var activeMenu = $ ( ".wcf-template-library--header .elementor-active" ) . attr ( "data-tab" ) ;
406420 var valueSelected = this . value ;
407421 $ ( t ) . find ( ".dialog-message" ) . remove ( ) ;
408- render_templates ( t , activeMenu , valueSelected ) ;
422+ render_templates ( t , activeMenu , valueSelected , currentColorType ) ;
423+ template_import ( ) ;
424+ } ) ;
425+ }
426+ function selected_color_type ( t ) {
427+ $ ( document ) . on ( "change" , "#wcf-template-library-color-subtype" , function ( e ) {
428+ var activeMenu = $ ( ".wcf-template-library--header .elementor-active" ) . attr ( "data-tab" ) ;
429+ var valueSelected = this . value ;
430+ $ ( t ) . find ( ".dialog-message" ) . remove ( ) ;
431+ render_templates ( t , activeMenu , currentCategory , valueSelected ) ;
409432 template_import ( ) ;
410433 } ) ;
411434 }
@@ -528,7 +551,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
528551 break ;
529552 }
530553 _context7 . next = 3 ;
531- return get_category_templates ( currentCategory , currentType , currentPage + 1 ) ;
554+ return get_category_templates ( currentCategory , currentType , currentPage + 1 , currentColorType ) ;
532555 case 3 :
533556 currentchunk = _context7 . sent ;
534557 container = document . querySelector ( ".wcf-library-templates" ) ;
0 commit comments