Adv_Accordion.php
2 years ago
Adv_Tabs.php
2 years ago
Advanced_Data_Table.php
2 years ago
Better_Payment.php
4 years ago
Betterdocs_Category_Box.php
2 years ago
Betterdocs_Category_Grid.php
2 years ago
Betterdocs_Search_Form.php
2 years ago
Business_Reviews.php
2 years ago
Caldera_Forms.php
2 years ago
Career_Page.php
4 years ago
Contact_Form_7.php
2 years ago
Content_Ticker.php
2 years ago
Countdown.php
2 years ago
Creative_Button.php
2 years ago
Crowdfundly_All_Campaign.php
4 years ago
Crowdfundly_Organization.php
4 years ago
Crowdfundly_Single_Campaign.php
4 years ago
Cta_Box.php
2 years ago
Data_Table.php
2 years ago
Dual_Color_Header.php
2 years ago
EmbedPress.php
4 years ago
Event_Calendar.php
2 years ago
Facebook_Feed.php
2 years ago
Fancy_Text.php
2 years ago
Feature_List.php
2 years ago
Filterable_Gallery.php
2 years ago
Flip_Box.php
2 years ago
FluentForm.php
2 years ago
Formstack.php
2 years ago
GravityForms.php
2 years ago
Image_Accordion.php
2 years ago
Info_Box.php
2 years ago
Interactive_Circle.php
2 years ago
Login_Register.php
2 years ago
NFT_Gallery.php
2 years ago
NinjaForms.php
2 years ago
Post_Grid.php
2 years ago
Post_Timeline.php
2 years ago
Pricing_Table.php
2 years ago
Product_Grid.php
2 years ago
Progress_Bar.php
2 years ago
SVG_Draw.php
3 years ago
Simple_Menu.php
2 years ago
Sticky_Video.php
2 years ago
Team_Member.php
2 years ago
Testimonial.php
2 years ago
Tooltip.php
2 years ago
Twitter_Feed.php
2 years ago
TypeForm.php
2 years ago
WeForms.php
2 years ago
Woo_Cart.php
2 years ago
Woo_Checkout.php
2 years ago
Woo_Product_Carousel.php
2 years ago
Woo_Product_Compare.php
4 years ago
Woo_Product_Gallery.php
2 years ago
Woocommerce_Review.php
4 years ago
WpForms.php
2 years ago
index.php
3 years ago
Advanced_Data_Table.php
1670 lines
| 1 | <?php |
| 2 | namespace Essential_Addons_Elementor\Elements; |
| 3 | |
| 4 | // If this file is called directly, abort. |
| 5 | if (!defined('ABSPATH')) { |
| 6 | exit; |
| 7 | } |
| 8 | |
| 9 | use \Elementor\Controls_Manager; |
| 10 | use \Elementor\Group_Control_Border; |
| 11 | use \Elementor\Group_Control_Box_Shadow; |
| 12 | use \Elementor\Group_Control_Typography; |
| 13 | use \Elementor\Plugin; |
| 14 | use \Elementor\Widget_Base; |
| 15 | use Essential_Addons_Elementor\Classes\Helper; |
| 16 | |
| 17 | class Advanced_Data_Table extends Widget_Base |
| 18 | { |
| 19 | public function get_name() |
| 20 | { |
| 21 | return 'eael-advanced-data-table'; |
| 22 | } |
| 23 | |
| 24 | public function get_title() |
| 25 | { |
| 26 | return esc_html__('Advanced Data Table', 'essential-addons-for-elementor-lite'); |
| 27 | } |
| 28 | |
| 29 | public function get_icon() |
| 30 | { |
| 31 | return 'eaicon-advanced-data-table'; |
| 32 | } |
| 33 | |
| 34 | public function get_categories() |
| 35 | { |
| 36 | return ['essential-addons-elementor']; |
| 37 | } |
| 38 | |
| 39 | public function get_keywords() |
| 40 | { |
| 41 | return [ |
| 42 | 'table', |
| 43 | 'ea table', |
| 44 | 'ea advanced table', |
| 45 | 'ea advanced data table', |
| 46 | 'CSV', |
| 47 | 'google sheet', |
| 48 | 'spreadsheet', |
| 49 | 'excel', |
| 50 | 'tablepress', |
| 51 | 'ninja tables', |
| 52 | 'data dable', |
| 53 | 'comparison table', |
| 54 | 'grid', |
| 55 | 'import data', |
| 56 | 'import table', |
| 57 | 'ea', |
| 58 | 'essential addons', |
| 59 | ]; |
| 60 | } |
| 61 | |
| 62 | public function get_custom_help_url() |
| 63 | { |
| 64 | return 'https://essential-addons.com/elementor/docs/advanced-data-table/'; |
| 65 | } |
| 66 | |
| 67 | protected function register_controls() |
| 68 | { |
| 69 | // general |
| 70 | $this->start_controls_section( |
| 71 | 'ea_section_adv_data_table_source', |
| 72 | [ |
| 73 | 'label' => esc_html__('Data Source', 'essential-addons-for-elementor-lite'), |
| 74 | ] |
| 75 | ); |
| 76 | |
| 77 | $this->add_control( |
| 78 | 'ea_adv_data_table_source', |
| 79 | [ |
| 80 | 'label' => esc_html__('Source', 'essential-addons-for-elementor-lite'), |
| 81 | 'type' => Controls_Manager::SELECT, |
| 82 | 'options' => call_user_func(function () { |
| 83 | $source = []; |
| 84 | $source['static'] = __('Static Data', 'essential-addons-for-elementor-lite'); |
| 85 | $source['ninja'] = __('Ninja Tables', 'essential-addons-for-elementor-lite'); |
| 86 | if (apply_filters('eael/pro_enabled', false)) { |
| 87 | $source['database'] = __('Database', 'essential-addons-for-elementor-lite'); |
| 88 | $source['remote'] = __('Remote Database', 'essential-addons-for-elementor-lite'); |
| 89 | $source['google'] = __('Google Sheets', 'essential-addons-for-elementor-lite'); |
| 90 | $source['tablepress'] = __('TablePress', 'essential-addons-for-elementor-lite'); |
| 91 | } else { |
| 92 | $source['database'] = __('Database (Pro)', 'essential-addons-for-elementor-lite'); |
| 93 | $source['remote'] = __('Remote Database (Pro)', 'essential-addons-for-elementor-lite'); |
| 94 | $source['google'] = __('Google Sheets (Pro)', 'essential-addons-for-elementor-lite'); |
| 95 | $source['tablepress'] = __('TablePress (Pro)', 'essential-addons-for-elementor-lite'); |
| 96 | } |
| 97 | |
| 98 | |
| 99 | |
| 100 | return $source; |
| 101 | }), |
| 102 | 'default' => 'static', |
| 103 | ] |
| 104 | ); |
| 105 | |
| 106 | if (!apply_filters('eael/pro_enabled', false)) { |
| 107 | $this->add_control( |
| 108 | 'eael_adv_data_table_pro_enable_warning', |
| 109 | [ |
| 110 | 'label' => sprintf( '<a target="_blank" href="https://wpdeveloper.com/upgrade/ea-pro">%s</a>', esc_html__('Only Available in Pro Version!', 'essential-addons-for-elementor-lite')), |
| 111 | 'type' => Controls_Manager::RAW_HTML, |
| 112 | 'condition' => [ |
| 113 | 'ea_adv_data_table_source' => ['database','remote','google','tablepress'], |
| 114 | ], |
| 115 | ] |
| 116 | ); |
| 117 | } |
| 118 | |
| 119 | // TODO: RM |
| 120 | do_action('eael/advanced-data-table/source/control', $this); |
| 121 | |
| 122 | do_action('eael/controls/advanced-data-table/source', $this); |
| 123 | |
| 124 | $this->add_control( |
| 125 | 'ea_adv_data_table_static_html', |
| 126 | [ |
| 127 | 'type' => Controls_Manager::HIDDEN, |
| 128 | 'default' => '<thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr></tbody>', |
| 129 | ] |
| 130 | ); |
| 131 | |
| 132 | $this->end_controls_section(); |
| 133 | |
| 134 | // features |
| 135 | $this->start_controls_section( |
| 136 | 'ea_section_adv_data_table_features', |
| 137 | [ |
| 138 | 'label' => esc_html__('Advanced Features', 'essential-addons-for-elementor-lite'), |
| 139 | ] |
| 140 | ); |
| 141 | |
| 142 | $this->add_control( |
| 143 | 'ea_adv_data_table_sort', |
| 144 | [ |
| 145 | 'label' => esc_html__('Sort', 'essential-addons-for-elementor-lite'), |
| 146 | 'type' => Controls_Manager::SWITCHER, |
| 147 | 'return_value' => 'yes', |
| 148 | 'default' => 'yes', |
| 149 | ] |
| 150 | ); |
| 151 | |
| 152 | $this->add_control( |
| 153 | 'ea_adv_data_table_search', |
| 154 | [ |
| 155 | 'label' => esc_html__('Search', 'essential-addons-for-elementor-lite'), |
| 156 | 'type' => Controls_Manager::SWITCHER, |
| 157 | 'return_value' => 'yes', |
| 158 | 'default' => 'yes', |
| 159 | ] |
| 160 | ); |
| 161 | |
| 162 | $this->add_control( |
| 163 | 'ea_adv_data_table_search_placeholder', |
| 164 | [ |
| 165 | 'label' => __('Placeholder', 'essential-addons-for-elementor-lite'), |
| 166 | 'type' => Controls_Manager::TEXT, |
| 167 | 'dynamic' => [ |
| 168 | 'active' => true, |
| 169 | ], |
| 170 | 'default' => __('Search', 'essential-addons-for-elementor-lite'), |
| 171 | 'condition' => [ |
| 172 | 'ea_adv_data_table_search' => 'yes', |
| 173 | ], |
| 174 | 'ai' => [ |
| 175 | 'active' => false, |
| 176 | ], |
| 177 | ] |
| 178 | ); |
| 179 | |
| 180 | $this->add_control( |
| 181 | 'ea_adv_data_table_pagination', |
| 182 | [ |
| 183 | 'label' => esc_html__('Pagination', 'essential-addons-for-elementor-lite'), |
| 184 | 'type' => Controls_Manager::SWITCHER, |
| 185 | 'return_value' => 'yes', |
| 186 | 'default' => 'yes', |
| 187 | ] |
| 188 | ); |
| 189 | |
| 190 | $this->add_control( |
| 191 | 'ea_adv_data_table_pagination_type', |
| 192 | [ |
| 193 | 'label' => esc_html__('Pagination Type', 'essential-addons-for-elementor-lite'), |
| 194 | 'type' => Controls_Manager::SELECT, |
| 195 | 'options' => [ |
| 196 | 'button' => esc_html__('Button', 'essential-addons-for-elementor-lite'), |
| 197 | 'select' => esc_html__('Select', 'essential-addons-for-elementor-lite'), |
| 198 | ], |
| 199 | 'default' => 'button', |
| 200 | 'condition' => [ |
| 201 | 'ea_adv_data_table_pagination' => 'yes', |
| 202 | ], |
| 203 | ] |
| 204 | ); |
| 205 | |
| 206 | $this->add_control( |
| 207 | 'ea_adv_data_table_items_per_page', |
| 208 | [ |
| 209 | 'label' => esc_html__('Rows Per Page', 'essential-addons-for-elementor-lite'), |
| 210 | 'type' => Controls_Manager::NUMBER, |
| 211 | 'min' => 1, |
| 212 | 'default' => 10, |
| 213 | 'condition' => [ |
| 214 | 'ea_adv_data_table_pagination' => 'yes', |
| 215 | ], |
| 216 | ] |
| 217 | ); |
| 218 | |
| 219 | $this->add_control( |
| 220 | 'eael_global_warning_text', |
| 221 | [ |
| 222 | 'type' => Controls_Manager::RAW_HTML, |
| 223 | 'raw' => __('Note: Pagination will be applied on Live Preview only.', 'essential-addons-for-elementor-lite'), |
| 224 | 'content_classes' => 'eael-warning', |
| 225 | 'condition' => [ |
| 226 | 'ea_adv_data_table_pagination' => 'yes', |
| 227 | ], |
| 228 | ] |
| 229 | ); |
| 230 | |
| 231 | $this->end_controls_section(); |
| 232 | |
| 233 | // export/import |
| 234 | $this->start_controls_section( |
| 235 | 'ea_section_adv_data_table_export_import', |
| 236 | [ |
| 237 | 'label' => esc_html__('Export/Import', 'essential-addons-for-elementor-lite'), |
| 238 | ] |
| 239 | ); |
| 240 | |
| 241 | $this->add_control( |
| 242 | 'ea_adv_data_table_export_csv_button', |
| 243 | [ |
| 244 | 'label' => __('Export table as CSV file', 'essential-addons-for-elementor-lite'), |
| 245 | 'type' => Controls_Manager::BUTTON, |
| 246 | 'text' => __('Export', 'essential-addons-for-elementor-lite'), |
| 247 | 'event' => 'ea:advTable:export', |
| 248 | ] |
| 249 | ); |
| 250 | |
| 251 | $this->add_control( |
| 252 | 'heading-import', |
| 253 | [ |
| 254 | 'label' => __('Import', 'essential-addons-for-elementor-lite'), |
| 255 | 'type' => Controls_Manager::HEADING, |
| 256 | 'condition' => [ |
| 257 | 'ea_adv_data_table_source' => 'static', |
| 258 | ], |
| 259 | ] |
| 260 | ); |
| 261 | |
| 262 | $this->add_control( |
| 263 | 'ea_adv_data_table_csv_string', |
| 264 | [ |
| 265 | 'type' => Controls_Manager::RAW_HTML, |
| 266 | 'raw' => '<textarea class="ea_adv_table_csv_string" rows="5" placeholder="Paste CSV string"></textarea><label for="ea_adv_table_csv_string_table"><input type="checkbox" id="ea_adv_table_csv_string_table" class="ea_adv_table_csv_string_table"> Import first row as Header</label>', |
| 267 | 'condition' => [ |
| 268 | 'ea_adv_data_table_source' => 'static', |
| 269 | ], |
| 270 | ] |
| 271 | ); |
| 272 | |
| 273 | $this->add_control( |
| 274 | 'ea_adv_data_table_import_csv_button', |
| 275 | [ |
| 276 | 'label' => __('Import', 'essential-addons-for-elementor-lite'), |
| 277 | 'type' => Controls_Manager::BUTTON, |
| 278 | 'show_label' => false, |
| 279 | 'text' => __('Import', 'essential-addons-for-elementor-lite'), |
| 280 | 'event' => 'ea:advTable:import', |
| 281 | 'condition' => [ |
| 282 | 'ea_adv_data_table_source' => 'static', |
| 283 | ], |
| 284 | ] |
| 285 | ); |
| 286 | |
| 287 | $this->end_controls_section(); |
| 288 | |
| 289 | /** |
| 290 | * Data cache setting |
| 291 | */ |
| 292 | $this->start_controls_section( |
| 293 | 'ea_adv_data_table_data_cache', |
| 294 | [ |
| 295 | 'label' => __('Data Cache Setting', 'essential-addons-for-elementor-lite'), |
| 296 | 'condition' => [ |
| 297 | 'ea_adv_data_table_source' => 'google', |
| 298 | ], |
| 299 | ] |
| 300 | ); |
| 301 | |
| 302 | $this->add_control( |
| 303 | 'ea_adv_data_table_data_cache_limit', |
| 304 | [ |
| 305 | 'label' => __('Data Cache Time', 'essential-addons-for-elementor-lite'), |
| 306 | 'type' => Controls_Manager::NUMBER, |
| 307 | 'min' => 1, |
| 308 | 'default' => 60, |
| 309 | 'description' => __('Cache expiration time (Minutes)', 'essential-addons-for-elementor-lite') |
| 310 | ] |
| 311 | ); |
| 312 | |
| 313 | $this->end_controls_section(); |
| 314 | |
| 315 | // style |
| 316 | $this->start_controls_section( |
| 317 | 'ea_section_adv_data_table_style_table', |
| 318 | [ |
| 319 | 'label' => __('Table', 'essential-addons-for-elementor-lite'), |
| 320 | 'tab' => Controls_Manager::TAB_STYLE, |
| 321 | ] |
| 322 | ); |
| 323 | |
| 324 | $this->add_responsive_control( |
| 325 | 'ea_adv_data_table_width', |
| 326 | [ |
| 327 | 'label' => __('Width', 'essential-addons-for-elementor-lite'), |
| 328 | 'type' => Controls_Manager::SLIDER, |
| 329 | 'size_units' => ['px', '%'], |
| 330 | 'range' => [ |
| 331 | 'px' => [ |
| 332 | 'min' => 100, |
| 333 | 'max' => 10000, |
| 334 | 'step' => 1, |
| 335 | ], |
| 336 | '%' => [ |
| 337 | 'min' => 10, |
| 338 | 'max' => 100, |
| 339 | 'step' => 1, |
| 340 | ], |
| 341 | ], |
| 342 | 'desktop_default' => [ |
| 343 | 'unit' => '%', |
| 344 | 'size' => 100, |
| 345 | ], |
| 346 | 'tablet_default' => [ |
| 347 | 'unit' => '%', |
| 348 | 'size' => 100, |
| 349 | ], |
| 350 | 'mobile_default' => [ |
| 351 | 'unit' => '%', |
| 352 | 'size' => 100, |
| 353 | ], |
| 354 | 'selectors' => [ |
| 355 | '{{WRAPPER}} .ea-advanced-data-table' => 'width: {{SIZE}}{{UNIT}}', |
| 356 | ], |
| 357 | ] |
| 358 | ); |
| 359 | |
| 360 | $this->add_group_control( |
| 361 | Group_Control_Border::get_type(), |
| 362 | [ |
| 363 | 'name' => 'ea_adv_data_table_border', |
| 364 | 'label' => __('Border', 'essential-addons-for-elementor-lite'), |
| 365 | 'fields_options' => [ |
| 366 | 'border' => [ |
| 367 | 'default' => 'solid', |
| 368 | ], |
| 369 | 'width' => [ |
| 370 | 'default' => [ |
| 371 | 'unit' => 'px', |
| 372 | 'top' => '1', |
| 373 | 'right' => '1', |
| 374 | 'bottom' => '1', |
| 375 | 'left' => '1', |
| 376 | 'isLinked' => true, |
| 377 | ], |
| 378 | ], |
| 379 | 'color' => [ |
| 380 | 'default' => '#eeeeee', |
| 381 | ], |
| 382 | ], |
| 383 | 'selector' => '{{WRAPPER}} .ea-advanced-data-table', |
| 384 | ] |
| 385 | ); |
| 386 | |
| 387 | $this->add_control( |
| 388 | 'ea_adv_data_table_border_radius', |
| 389 | [ |
| 390 | 'label' => __('Border Radius', 'essential-addons-for-elementor-lite'), |
| 391 | 'type' => Controls_Manager::DIMENSIONS, |
| 392 | 'size_units' => ['px'], |
| 393 | 'selectors' => [ |
| 394 | '{{WRAPPER}} .ea-advanced-data-table-wrap .ea-advanced-data-table-wrap-inner' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 395 | ], |
| 396 | ] |
| 397 | ); |
| 398 | |
| 399 | $this->add_group_control( |
| 400 | Group_Control_Box_Shadow::get_type(), |
| 401 | [ |
| 402 | 'name' => 'ea_adv_data_table_width_box_shadow', |
| 403 | 'label' => __('Box Shadow', 'essential-addons-for-elementor-lite'), |
| 404 | 'selector' => '{{WRAPPER}} .ea-advanced-data-table-wrap .ea-advanced-data-table-wrap-inner', |
| 405 | ] |
| 406 | ); |
| 407 | |
| 408 | $this->end_controls_section(); |
| 409 | |
| 410 | $this->start_controls_section( |
| 411 | 'ea_section_adv_data_table_style_head', |
| 412 | [ |
| 413 | 'label' => __('Head', 'essential-addons-for-elementor-lite'), |
| 414 | 'tab' => Controls_Manager::TAB_STYLE, |
| 415 | ] |
| 416 | ); |
| 417 | |
| 418 | $this->add_group_control( |
| 419 | Group_Control_Typography::get_type(), |
| 420 | [ |
| 421 | 'name' => 'ea_adv_data_table_head_typography', |
| 422 | 'label' => __('Typography', 'essential-addons-for-elementor-lite'), |
| 423 | 'selector' => '{{WRAPPER}} th', |
| 424 | ] |
| 425 | ); |
| 426 | |
| 427 | $this->add_control( |
| 428 | 'ea_adv_data_table_head_horizontal_alignment', |
| 429 | [ |
| 430 | 'label' => esc_html__('Text Alignment', 'essential-addons-for-elementor-lite'), |
| 431 | 'type' => Controls_Manager::CHOOSE, |
| 432 | 'options' => [ |
| 433 | 'left' => [ |
| 434 | 'title' => esc_html__('Left', 'essential-addons-for-elementor-lite'), |
| 435 | 'icon' => 'eicon-text-align-left', |
| 436 | ], |
| 437 | 'center' => [ |
| 438 | 'title' => esc_html__('Center', 'essential-addons-for-elementor-lite'), |
| 439 | 'icon' => 'eicon-text-align-center', |
| 440 | ], |
| 441 | 'right' => [ |
| 442 | 'title' => esc_html__('Right', 'essential-addons-for-elementor-lite'), |
| 443 | 'icon' => 'eicon-text-align-right', |
| 444 | ], |
| 445 | ], |
| 446 | 'default' => 'left', |
| 447 | 'selectors' => [ |
| 448 | '{{WRAPPER}} th' => 'text-align: {{VALUE}};', |
| 449 | '{{WRAPPER}} th .ql-editor' => 'text-align: {{VALUE}};', |
| 450 | ], |
| 451 | ] |
| 452 | ); |
| 453 | |
| 454 | $this->add_control( |
| 455 | 'ea_adv_data_table_head_color', |
| 456 | [ |
| 457 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 458 | 'type' => Controls_Manager::COLOR, |
| 459 | 'default' => '#444444', |
| 460 | 'selectors' => [ |
| 461 | '{{WRAPPER}} th' => 'color: {{VALUE}};', |
| 462 | '{{WRAPPER}} th:before' => 'border-bottom-color: {{VALUE}};', |
| 463 | '{{WRAPPER}} th:after' => 'border-top-color: {{VALUE}};', |
| 464 | ], |
| 465 | ] |
| 466 | ); |
| 467 | |
| 468 | $this->add_control( |
| 469 | 'ea_adv_data_table_head_background', |
| 470 | [ |
| 471 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 472 | 'type' => Controls_Manager::COLOR, |
| 473 | 'default' => '#fbfbfb', |
| 474 | 'selectors' => [ |
| 475 | '{{WRAPPER}} thead' => 'background-color: {{VALUE}};', |
| 476 | ], |
| 477 | ] |
| 478 | ); |
| 479 | |
| 480 | $this->add_group_control( |
| 481 | Group_Control_Border::get_type(), |
| 482 | [ |
| 483 | 'name' => 'ea_adv_data_table_head_cell_border', |
| 484 | 'label' => __('Cell Border', 'essential-addons-for-elementor-lite'), |
| 485 | 'fields_options' => [ |
| 486 | 'border' => [ |
| 487 | 'default' => 'solid', |
| 488 | ], |
| 489 | 'width' => [ |
| 490 | 'default' => [ |
| 491 | 'unit' => 'px', |
| 492 | 'top' => '1', |
| 493 | 'right' => '1', |
| 494 | 'bottom' => '1', |
| 495 | 'left' => '1', |
| 496 | 'isLinked' => true, |
| 497 | ], |
| 498 | ], |
| 499 | 'color' => [ |
| 500 | 'default' => '#eeeeee', |
| 501 | ], |
| 502 | ], |
| 503 | 'selector' => '{{WRAPPER}} th', |
| 504 | ] |
| 505 | ); |
| 506 | |
| 507 | $this->add_responsive_control( |
| 508 | 'ea_adv_data_table_head_cell_padding', |
| 509 | [ |
| 510 | 'label' => __('Padding', 'essential-addons-for-elementor-lite'), |
| 511 | 'type' => Controls_Manager::DIMENSIONS, |
| 512 | 'size_units' => ['px'], |
| 513 | 'desktop_default' => [ |
| 514 | 'unit' => 'px', |
| 515 | 'top' => '10', |
| 516 | 'right' => '10', |
| 517 | 'bottom' => '10', |
| 518 | 'left' => '10', |
| 519 | 'isLinked' => true, |
| 520 | ], |
| 521 | 'selectors' => [ |
| 522 | '{{WRAPPER}} .ea-advanced-data-table th' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 523 | ], |
| 524 | ] |
| 525 | ); |
| 526 | |
| 527 | $this->end_controls_section(); |
| 528 | |
| 529 | $this->start_controls_section( |
| 530 | 'ea_section_adv_data_table_style_body', |
| 531 | [ |
| 532 | 'label' => __('Body', 'essential-addons-for-elementor-lite'), |
| 533 | 'tab' => Controls_Manager::TAB_STYLE, |
| 534 | ] |
| 535 | ); |
| 536 | |
| 537 | $this->add_group_control( |
| 538 | Group_Control_Typography::get_type(), |
| 539 | [ |
| 540 | 'name' => 'ea_adv_data_table_body_typography', |
| 541 | 'label' => __('Typography', 'essential-addons-for-elementor-lite'), |
| 542 | 'selector' => '{{WRAPPER}} td', |
| 543 | ] |
| 544 | ); |
| 545 | |
| 546 | $this->add_control( |
| 547 | 'ea_adv_data_table_body_horizontal_alignment', |
| 548 | [ |
| 549 | 'label' => esc_html__('Text Alignment', 'essential-addons-for-elementor-lite'), |
| 550 | 'type' => Controls_Manager::CHOOSE, |
| 551 | 'options' => [ |
| 552 | 'left' => [ |
| 553 | 'title' => esc_html__('Left', 'essential-addons-for-elementor-lite'), |
| 554 | 'icon' => 'eicon-text-align-left', |
| 555 | ], |
| 556 | 'center' => [ |
| 557 | 'title' => esc_html__('Center', 'essential-addons-for-elementor-lite'), |
| 558 | 'icon' => 'eicon-text-align-center', |
| 559 | ], |
| 560 | 'right' => [ |
| 561 | 'title' => esc_html__('Right', 'essential-addons-for-elementor-lite'), |
| 562 | 'icon' => 'eicon-text-align-right', |
| 563 | ], |
| 564 | ], |
| 565 | 'default' => 'left', |
| 566 | 'selectors' => [ |
| 567 | '{{WRAPPER}} td' => 'text-align: {{VALUE}};', |
| 568 | '{{WRAPPER}} td .ql-editor' => 'text-align: {{VALUE}};', |
| 569 | ], |
| 570 | ] |
| 571 | ); |
| 572 | |
| 573 | $this->add_control( |
| 574 | 'ea_adv_data_table_body_color', |
| 575 | [ |
| 576 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 577 | 'type' => Controls_Manager::COLOR, |
| 578 | 'default' => '#666666', |
| 579 | 'selectors' => [ |
| 580 | '{{WRAPPER}} td' => 'color: {{VALUE}};', |
| 581 | ], |
| 582 | ] |
| 583 | ); |
| 584 | |
| 585 | $this->add_control( |
| 586 | 'ea_adv_data_table_body_link_color', |
| 587 | [ |
| 588 | 'label' => __('Link Color', 'essential-addons-for-elementor-lite'), |
| 589 | 'type' => Controls_Manager::COLOR, |
| 590 | 'default' => '', |
| 591 | 'selectors' => [ |
| 592 | '{{WRAPPER}} td a' => 'color: {{VALUE}};', |
| 593 | ], |
| 594 | ] |
| 595 | ); |
| 596 | |
| 597 | $this->add_control( |
| 598 | 'ea_adv_data_table_body_link_hovercolor', |
| 599 | [ |
| 600 | 'label' => __('Link Hover Color', 'essential-addons-for-elementor-lite'), |
| 601 | 'type' => Controls_Manager::COLOR, |
| 602 | 'default' => '', |
| 603 | 'selectors' => [ |
| 604 | '{{WRAPPER}} td a:hover' => 'color: {{VALUE}};', |
| 605 | ], |
| 606 | ] |
| 607 | ); |
| 608 | |
| 609 | $this->add_control( |
| 610 | 'ea_adv_data_table_body_background', |
| 611 | [ |
| 612 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 613 | 'type' => Controls_Manager::COLOR, |
| 614 | 'default' => '#ffffff', |
| 615 | 'selectors' => [ |
| 616 | '{{WRAPPER}} tbody' => 'background-color: {{VALUE}};', |
| 617 | ], |
| 618 | ] |
| 619 | ); |
| 620 | |
| 621 | $this->add_group_control( |
| 622 | Group_Control_Border::get_type(), |
| 623 | [ |
| 624 | 'name' => 'ea_adv_data_table_body_cell_border', |
| 625 | 'label' => __('Cell Border', 'essential-addons-for-elementor-lite'), |
| 626 | 'fields_options' => [ |
| 627 | 'border' => [ |
| 628 | 'default' => 'solid', |
| 629 | ], |
| 630 | 'width' => [ |
| 631 | 'default' => [ |
| 632 | 'unit' => 'px', |
| 633 | 'top' => '1', |
| 634 | 'right' => '1', |
| 635 | 'bottom' => '1', |
| 636 | 'left' => '1', |
| 637 | 'isLinked' => true, |
| 638 | ], |
| 639 | ], |
| 640 | 'color' => [ |
| 641 | 'default' => '#eeeeee', |
| 642 | ], |
| 643 | ], |
| 644 | 'selector' => '{{WRAPPER}} td', |
| 645 | ] |
| 646 | ); |
| 647 | |
| 648 | $this->add_control( |
| 649 | 'ea_adv_data_table_body_highlight', |
| 650 | [ |
| 651 | 'label' => esc_html__('Highlight', 'essential-addons-for-elementor-lite'), |
| 652 | 'type' => Controls_Manager::SELECT, |
| 653 | 'options' => [ |
| 654 | 'none' => esc_html__('None', 'essential-addons-for-elementor-lite'), |
| 655 | 'f-col' => esc_html__('First Column', 'essential-addons-for-elementor-lite'), |
| 656 | 'l-col' => esc_html__('Last Column', 'essential-addons-for-elementor-lite'), |
| 657 | 'e-col' => esc_html__('Even Column', 'essential-addons-for-elementor-lite'), |
| 658 | 'o-col' => esc_html__('Odd Column', 'essential-addons-for-elementor-lite'), |
| 659 | 'e-row' => esc_html__('Even Row', 'essential-addons-for-elementor-lite'), |
| 660 | 'o-row' => esc_html__('Odd Row', 'essential-addons-for-elementor-lite'), |
| 661 | ], |
| 662 | 'default' => 'none', |
| 663 | ] |
| 664 | ); |
| 665 | |
| 666 | // first col |
| 667 | $this->add_control( |
| 668 | 'ea_adv_data_table_body_f_col_highlight_color', |
| 669 | [ |
| 670 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 671 | 'type' => Controls_Manager::COLOR, |
| 672 | 'default' => '#444444', |
| 673 | 'selectors' => [ |
| 674 | '{{WRAPPER}} tbody td:first-child' => 'color: {{VALUE}}', |
| 675 | ], |
| 676 | 'condition' => [ |
| 677 | 'ea_adv_data_table_body_highlight' => 'f-col', |
| 678 | ], |
| 679 | ] |
| 680 | ); |
| 681 | |
| 682 | $this->add_control( |
| 683 | 'ea_adv_data_table_body_f_col_highlight_background', |
| 684 | [ |
| 685 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 686 | 'type' => Controls_Manager::COLOR, |
| 687 | 'default' => '#fbfbfb', |
| 688 | 'selectors' => [ |
| 689 | '{{WRAPPER}} tbody td:first-child' => 'background-color: {{VALUE}} !important', |
| 690 | ], |
| 691 | 'condition' => [ |
| 692 | 'ea_adv_data_table_body_highlight' => 'f-col', |
| 693 | ], |
| 694 | ] |
| 695 | ); |
| 696 | |
| 697 | // last col |
| 698 | $this->add_control( |
| 699 | 'ea_adv_data_table_body_l_col_highlight_color', |
| 700 | [ |
| 701 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 702 | 'type' => Controls_Manager::COLOR, |
| 703 | 'default' => '#444444', |
| 704 | 'selectors' => [ |
| 705 | '{{WRAPPER}} tbody td:last-child' => 'color: {{VALUE}}', |
| 706 | ], |
| 707 | 'condition' => [ |
| 708 | 'ea_adv_data_table_body_highlight' => 'l-col', |
| 709 | ], |
| 710 | ] |
| 711 | ); |
| 712 | |
| 713 | $this->add_control( |
| 714 | 'ea_adv_data_table_body_l_col_highlight_background', |
| 715 | [ |
| 716 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 717 | 'type' => Controls_Manager::COLOR, |
| 718 | 'default' => '#fbfbfb', |
| 719 | 'selectors' => [ |
| 720 | '{{WRAPPER}} tbody td:last-child' => 'background-color: {{VALUE}} !important', |
| 721 | ], |
| 722 | 'condition' => [ |
| 723 | 'ea_adv_data_table_body_highlight' => 'l-col', |
| 724 | ], |
| 725 | ] |
| 726 | ); |
| 727 | |
| 728 | // even col |
| 729 | $this->add_control( |
| 730 | 'ea_adv_data_table_body_e_col_highlight_color', |
| 731 | [ |
| 732 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 733 | 'type' => Controls_Manager::COLOR, |
| 734 | 'default' => '#444444', |
| 735 | 'selectors' => [ |
| 736 | '{{WRAPPER}} tbody td:nth-child(even)' => 'color: {{VALUE}}', |
| 737 | ], |
| 738 | 'condition' => [ |
| 739 | 'ea_adv_data_table_body_highlight' => 'e-col', |
| 740 | ], |
| 741 | ] |
| 742 | ); |
| 743 | |
| 744 | $this->add_control( |
| 745 | 'ea_adv_data_table_body_e_col_highlight_background', |
| 746 | [ |
| 747 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 748 | 'type' => Controls_Manager::COLOR, |
| 749 | 'default' => '#fbfbfb', |
| 750 | 'selectors' => [ |
| 751 | '{{WRAPPER}} tbody td:nth-child(even)' => 'background-color: {{VALUE}} !important', |
| 752 | ], |
| 753 | 'condition' => [ |
| 754 | 'ea_adv_data_table_body_highlight' => 'e-col', |
| 755 | ], |
| 756 | ] |
| 757 | ); |
| 758 | |
| 759 | // odd col |
| 760 | $this->add_control( |
| 761 | 'ea_adv_data_table_body_o_col_highlight_color', |
| 762 | [ |
| 763 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 764 | 'type' => Controls_Manager::COLOR, |
| 765 | 'default' => '#444444', |
| 766 | 'selectors' => [ |
| 767 | '{{WRAPPER}} tbody td:nth-child(odd)' => 'color: {{VALUE}}', |
| 768 | ], |
| 769 | 'condition' => [ |
| 770 | 'ea_adv_data_table_body_highlight' => 'o-col', |
| 771 | ], |
| 772 | ] |
| 773 | ); |
| 774 | |
| 775 | $this->add_control( |
| 776 | 'ea_adv_data_table_body_o_col_highlight_background', |
| 777 | [ |
| 778 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 779 | 'type' => Controls_Manager::COLOR, |
| 780 | 'default' => '#fbfbfb', |
| 781 | 'selectors' => [ |
| 782 | '{{WRAPPER}} tbody td:nth-child(odd)' => 'background-color: {{VALUE}} !important', |
| 783 | ], |
| 784 | 'condition' => [ |
| 785 | 'ea_adv_data_table_body_highlight' => 'o-col', |
| 786 | ], |
| 787 | ] |
| 788 | ); |
| 789 | |
| 790 | // even row |
| 791 | $this->add_control( |
| 792 | 'ea_adv_data_table_body_e_row_highlight_color', |
| 793 | [ |
| 794 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 795 | 'type' => Controls_Manager::COLOR, |
| 796 | 'default' => '#444444', |
| 797 | 'selectors' => [ |
| 798 | '{{WRAPPER}} tbody tr:nth-child(even)' => 'color: {{VALUE}}', |
| 799 | '{{WRAPPER}} tbody tr:nth-child(even) td' => 'color: {{VALUE}}', |
| 800 | ], |
| 801 | 'condition' => [ |
| 802 | 'ea_adv_data_table_body_highlight' => 'e-row', |
| 803 | ], |
| 804 | ] |
| 805 | ); |
| 806 | |
| 807 | $this->add_control( |
| 808 | 'ea_adv_data_table_body_e_row_highlight_background', |
| 809 | [ |
| 810 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 811 | 'type' => Controls_Manager::COLOR, |
| 812 | 'default' => '#fbfbfb', |
| 813 | 'selectors' => [ |
| 814 | '{{WRAPPER}} tbody tr:nth-child(even)' => 'background-color: {{VALUE}} !important', |
| 815 | ], |
| 816 | 'condition' => [ |
| 817 | 'ea_adv_data_table_body_highlight' => 'e-row', |
| 818 | ], |
| 819 | ] |
| 820 | ); |
| 821 | |
| 822 | // odd row |
| 823 | $this->add_control( |
| 824 | 'ea_adv_data_table_body_o_row_highlight_color', |
| 825 | [ |
| 826 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 827 | 'type' => Controls_Manager::COLOR, |
| 828 | 'default' => '#444444', |
| 829 | 'selectors' => [ |
| 830 | '{{WRAPPER}} tbody tr:nth-child(odd)' => 'color: {{VALUE}}', |
| 831 | '{{WRAPPER}} tbody tr:nth-child(odd) td' => 'color: {{VALUE}}', |
| 832 | ], |
| 833 | 'condition' => [ |
| 834 | 'ea_adv_data_table_body_highlight' => 'o-row', |
| 835 | ], |
| 836 | ] |
| 837 | ); |
| 838 | |
| 839 | $this->add_control( |
| 840 | 'ea_adv_data_table_body_o_row_highlight_background', |
| 841 | [ |
| 842 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 843 | 'type' => Controls_Manager::COLOR, |
| 844 | 'default' => '#fbfbfb', |
| 845 | 'selectors' => [ |
| 846 | '{{WRAPPER}} tbody tr:nth-child(odd)' => 'background-color: {{VALUE}} !important', |
| 847 | ], |
| 848 | 'condition' => [ |
| 849 | 'ea_adv_data_table_body_highlight' => 'o-row', |
| 850 | ], |
| 851 | ] |
| 852 | ); |
| 853 | |
| 854 | $this->add_responsive_control( |
| 855 | 'ea_adv_data_table_body_cell_padding', |
| 856 | [ |
| 857 | 'label' => __('Padding', 'essential-addons-for-elementor-lite'), |
| 858 | 'type' => Controls_Manager::DIMENSIONS, |
| 859 | 'size_units' => ['px'], |
| 860 | 'desktop_default' => [ |
| 861 | 'unit' => 'px', |
| 862 | 'top' => '10', |
| 863 | 'right' => '10', |
| 864 | 'bottom' => '10', |
| 865 | 'left' => '10', |
| 866 | 'isLinked' => true, |
| 867 | ], |
| 868 | 'selectors' => [ |
| 869 | '{{WRAPPER}} .ea-advanced-data-table td' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 870 | ], |
| 871 | ] |
| 872 | ); |
| 873 | |
| 874 | $this->end_controls_section(); |
| 875 | |
| 876 | $this->start_controls_section( |
| 877 | 'ea_section_adv_data_table_style_search', |
| 878 | [ |
| 879 | 'label' => __('Search', 'essential-addons-for-elementor-lite'), |
| 880 | 'tab' => Controls_Manager::TAB_STYLE, |
| 881 | 'condition' => [ |
| 882 | 'ea_adv_data_table_search' => 'yes', |
| 883 | ], |
| 884 | ] |
| 885 | ); |
| 886 | |
| 887 | $this->add_control( |
| 888 | 'ea_adv_data_table_search_width', |
| 889 | [ |
| 890 | 'label' => __('Width', 'essential-addons-for-elementor-lite'), |
| 891 | 'type' => Controls_Manager::SLIDER, |
| 892 | 'size_units' => ['px', '%'], |
| 893 | 'range' => [ |
| 894 | 'px' => [ |
| 895 | 'min' => 100, |
| 896 | 'max' => 1000, |
| 897 | 'step' => 1, |
| 898 | ], |
| 899 | '%' => [ |
| 900 | 'min' => 1, |
| 901 | 'max' => 100, |
| 902 | 'step' => 1, |
| 903 | ], |
| 904 | ], |
| 905 | 'default' => [ |
| 906 | 'unit' => 'px', |
| 907 | 'size' => 200, |
| 908 | ], |
| 909 | 'selectors' => [ |
| 910 | '{{WRAPPER}} .ea-advanced-data-table-search' => 'width: {{SIZE}}{{UNIT}}', |
| 911 | ], |
| 912 | ] |
| 913 | ); |
| 914 | |
| 915 | $this->add_control( |
| 916 | 'ea_adv_data_table_search_height', |
| 917 | [ |
| 918 | 'label' => __('Height', 'essential-addons-for-elementor-lite'), |
| 919 | 'type' => Controls_Manager::SLIDER, |
| 920 | 'size_units' => ['px'], |
| 921 | 'range' => [ |
| 922 | 'px' => [ |
| 923 | 'min' => 10, |
| 924 | 'max' => 100, |
| 925 | 'step' => 1, |
| 926 | ], |
| 927 | ], |
| 928 | 'default' => [ |
| 929 | 'unit' => 'px', |
| 930 | 'size' => 40, |
| 931 | ], |
| 932 | 'selectors' => [ |
| 933 | '{{WRAPPER}} .ea-advanced-data-table-search' => 'height: {{SIZE}}{{UNIT}}', |
| 934 | ], |
| 935 | ] |
| 936 | ); |
| 937 | |
| 938 | $this->add_responsive_control( |
| 939 | 'ea_adv_data_table_search_padding', |
| 940 | [ |
| 941 | 'label' => esc_html__('Padding', 'essential-addons-for-elementor-lite'), |
| 942 | 'type' => Controls_Manager::DIMENSIONS, |
| 943 | 'size_units' => ['px'], |
| 944 | 'selectors' => [ |
| 945 | '{{WRAPPER}} .ea-advanced-data-table-search' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 946 | ], |
| 947 | ] |
| 948 | ); |
| 949 | |
| 950 | $this->add_control( |
| 951 | 'ea_adv_data_table_search_margin', |
| 952 | [ |
| 953 | 'label' => __('Margin Bottom', 'essential-addons-for-elementor-lite'), |
| 954 | 'type' => Controls_Manager::SLIDER, |
| 955 | 'size_units' => ['px'], |
| 956 | 'range' => [ |
| 957 | 'px' => [ |
| 958 | 'min' => 0, |
| 959 | 'max' => 100, |
| 960 | 'step' => 1, |
| 961 | ], |
| 962 | ], |
| 963 | 'default' => [ |
| 964 | 'unit' => 'px', |
| 965 | 'size' => 10, |
| 966 | ], |
| 967 | 'selectors' => [ |
| 968 | '{{WRAPPER}} .ea-advanced-data-table-search' => 'margin-bottom: {{SIZE}}{{UNIT}}', |
| 969 | ], |
| 970 | ] |
| 971 | ); |
| 972 | |
| 973 | $this->add_control( |
| 974 | 'ea_adv_data_table_search_alignment', |
| 975 | [ |
| 976 | 'label' => esc_html__('Alignment', 'essential-addons-for-elementor-lite'), |
| 977 | 'type' => Controls_Manager::CHOOSE, |
| 978 | 'label_block' => true, |
| 979 | 'options' => [ |
| 980 | 'left' => [ |
| 981 | 'title' => esc_html__('Left', 'essential-addons-for-elementor-lite'), |
| 982 | 'icon' => 'eicon-text-align-left', |
| 983 | ], |
| 984 | 'center' => [ |
| 985 | 'title' => esc_html__('Center', 'essential-addons-for-elementor-lite'), |
| 986 | 'icon' => 'eicon-text-align-center', |
| 987 | ], |
| 988 | 'right' => [ |
| 989 | 'title' => esc_html__('Right', 'essential-addons-for-elementor-lite'), |
| 990 | 'icon' => 'eicon-text-align-right', |
| 991 | ], |
| 992 | ], |
| 993 | 'default' => 'right', |
| 994 | ] |
| 995 | ); |
| 996 | |
| 997 | $this->add_group_control( |
| 998 | Group_Control_Typography::get_type(), |
| 999 | [ |
| 1000 | 'name' => 'ea_adv_data_table_search_typography', |
| 1001 | 'label' => __('Typography', 'essential-addons-for-elementor-lite'), |
| 1002 | 'selector' => '{{WRAPPER}} .ea-advanced-data-table-search', |
| 1003 | ] |
| 1004 | ); |
| 1005 | |
| 1006 | $this->add_control( |
| 1007 | 'ea_adv_data_table_search_color', |
| 1008 | [ |
| 1009 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 1010 | 'type' => Controls_Manager::COLOR, |
| 1011 | 'default' => '#666666', |
| 1012 | 'selectors' => [ |
| 1013 | '{{WRAPPER}} .ea-advanced-data-table-search' => 'color: {{VALUE}};', |
| 1014 | ], |
| 1015 | ] |
| 1016 | ); |
| 1017 | |
| 1018 | $this->add_control( |
| 1019 | 'ea_adv_data_table_search_background', |
| 1020 | [ |
| 1021 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 1022 | 'type' => Controls_Manager::COLOR, |
| 1023 | 'default' => '#ffffff', |
| 1024 | 'selectors' => [ |
| 1025 | '{{WRAPPER}} .ea-advanced-data-table-search' => 'background-color: {{VALUE}};', |
| 1026 | ], |
| 1027 | ] |
| 1028 | ); |
| 1029 | |
| 1030 | $this->add_group_control( |
| 1031 | Group_Control_Border::get_type(), |
| 1032 | [ |
| 1033 | 'name' => 'ea_adv_data_table_search_border', |
| 1034 | 'label' => __('Border', 'essential-addons-for-elementor-lite'), |
| 1035 | 'fields_options' => [ |
| 1036 | 'border' => [ |
| 1037 | 'default' => 'solid', |
| 1038 | ], |
| 1039 | 'width' => [ |
| 1040 | 'default' => [ |
| 1041 | 'unit' => 'px', |
| 1042 | 'top' => '1', |
| 1043 | 'right' => '1', |
| 1044 | 'bottom' => '1', |
| 1045 | 'left' => '1', |
| 1046 | 'isLinked' => true, |
| 1047 | ], |
| 1048 | ], |
| 1049 | 'color' => [ |
| 1050 | 'default' => '#eeeeee', |
| 1051 | ], |
| 1052 | ], |
| 1053 | 'selector' => '{{WRAPPER}} .ea-advanced-data-table-search', |
| 1054 | ] |
| 1055 | ); |
| 1056 | |
| 1057 | $this->add_control( |
| 1058 | 'ea_adv_data_table_search_border_radius', |
| 1059 | [ |
| 1060 | 'label' => __('Border Radius', 'essential-addons-for-elementor-lite'), |
| 1061 | 'type' => Controls_Manager::DIMENSIONS, |
| 1062 | 'size_units' => ['px'], |
| 1063 | 'selectors' => [ |
| 1064 | '{{WRAPPER}} .ea-advanced-data-table-search' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1065 | ], |
| 1066 | ] |
| 1067 | ); |
| 1068 | |
| 1069 | $this->end_controls_section(); |
| 1070 | |
| 1071 | $this->start_controls_section( |
| 1072 | 'ea_section_adv_data_table_style_pagination', |
| 1073 | [ |
| 1074 | 'label' => __('Pagination', 'essential-addons-for-elementor-lite'), |
| 1075 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1076 | 'condition' => [ |
| 1077 | 'ea_adv_data_table_pagination' => 'yes', |
| 1078 | ], |
| 1079 | ] |
| 1080 | ); |
| 1081 | |
| 1082 | $this->add_responsive_control( |
| 1083 | 'ea_adv_data_table_pagination_select_width', |
| 1084 | [ |
| 1085 | 'label' => __('Width', 'essential-addons-for-elementor-lite'), |
| 1086 | 'type' => Controls_Manager::SLIDER, |
| 1087 | 'size_units' => ['px', '%'], |
| 1088 | 'range' => [ |
| 1089 | 'px' => [ |
| 1090 | 'min' => 100, |
| 1091 | 'max' => 10000, |
| 1092 | 'step' => 1, |
| 1093 | ], |
| 1094 | '%' => [ |
| 1095 | 'min' => 10, |
| 1096 | 'max' => 100, |
| 1097 | 'step' => 1, |
| 1098 | ], |
| 1099 | ], |
| 1100 | 'desktop_default' => [ |
| 1101 | 'unit' => 'px', |
| 1102 | 'size' => 100, |
| 1103 | ], |
| 1104 | 'tablet_default' => [ |
| 1105 | 'unit' => 'px', |
| 1106 | 'size' => 100, |
| 1107 | ], |
| 1108 | 'mobile_default' => [ |
| 1109 | 'unit' => '%', |
| 1110 | 'size' => 100, |
| 1111 | ], |
| 1112 | 'selectors' => [ |
| 1113 | '{{WRAPPER}} .ea-advanced-data-table-pagination select' => 'width: {{SIZE}}{{UNIT}}', |
| 1114 | ], |
| 1115 | 'condition' => [ |
| 1116 | 'ea_adv_data_table_pagination_type' => 'select', |
| 1117 | ], |
| 1118 | ] |
| 1119 | ); |
| 1120 | |
| 1121 | $this->add_control( |
| 1122 | 'ea_adv_data_table_pagination_alignment', |
| 1123 | [ |
| 1124 | 'label' => esc_html__('Alignment', 'essential-addons-for-elementor-lite'), |
| 1125 | 'type' => Controls_Manager::CHOOSE, |
| 1126 | 'options' => [ |
| 1127 | 'left' => [ |
| 1128 | 'title' => esc_html__('Left', 'essential-addons-for-elementor-lite'), |
| 1129 | 'icon' => 'eicon-text-align-left', |
| 1130 | ], |
| 1131 | 'center' => [ |
| 1132 | 'title' => esc_html__('Center', 'essential-addons-for-elementor-lite'), |
| 1133 | 'icon' => 'eicon-text-align-center', |
| 1134 | ], |
| 1135 | 'right' => [ |
| 1136 | 'title' => esc_html__('Right', 'essential-addons-for-elementor-lite'), |
| 1137 | 'icon' => 'eicon-text-align-right', |
| 1138 | ], |
| 1139 | ], |
| 1140 | 'default' => 'left', |
| 1141 | 'selectors' => [ |
| 1142 | '{{WRAPPER}} .ea-advanced-data-table-pagination' => 'text-align: {{VALUE}};', |
| 1143 | ], |
| 1144 | ] |
| 1145 | ); |
| 1146 | |
| 1147 | $this->add_group_control( |
| 1148 | Group_Control_Typography::get_type(), |
| 1149 | [ |
| 1150 | 'name' => 'ea_adv_data_table_pagination_typography', |
| 1151 | 'label' => __('Typography', 'essential-addons-for-elementor-lite'), |
| 1152 | 'selector' => '{{WRAPPER}} .ea-advanced-data-table-pagination a, {{WRAPPER}} .ea-advanced-data-table-pagination select', |
| 1153 | ] |
| 1154 | ); |
| 1155 | |
| 1156 | $this->add_responsive_control( |
| 1157 | 'ea_adv_data_table_pagination_padding', |
| 1158 | [ |
| 1159 | 'label' => esc_html__('Padding', 'essential-addons-for-elementor-lite'), |
| 1160 | 'type' => Controls_Manager::DIMENSIONS, |
| 1161 | 'size_units' => ['px'], |
| 1162 | 'desktop_default' => [ |
| 1163 | 'unit' => 'px', |
| 1164 | 'top' => '5', |
| 1165 | 'right' => '15', |
| 1166 | 'bottom' => '5', |
| 1167 | 'left' => '15', |
| 1168 | 'isLinked' => false, |
| 1169 | ], |
| 1170 | 'selectors' => [ |
| 1171 | '{{WRAPPER}} .ea-advanced-data-table-pagination a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1172 | '{{WRAPPER}} .ea-advanced-data-table-pagination select' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1173 | ], |
| 1174 | ] |
| 1175 | ); |
| 1176 | |
| 1177 | $this->add_responsive_control( |
| 1178 | 'ea_adv_data_table_pagination_margin', |
| 1179 | [ |
| 1180 | 'label' => esc_html__('Margin', 'essential-addons-for-elementor-lite'), |
| 1181 | 'type' => Controls_Manager::DIMENSIONS, |
| 1182 | 'size_units' => ['px'], |
| 1183 | 'desktop_default' => [ |
| 1184 | 'unit' => 'px', |
| 1185 | 'top' => '5', |
| 1186 | 'right' => '5', |
| 1187 | 'bottom' => '0', |
| 1188 | 'left' => '0', |
| 1189 | 'isLinked' => false, |
| 1190 | ], |
| 1191 | 'selectors' => [ |
| 1192 | '{{WRAPPER}} .ea-advanced-data-table-pagination a' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1193 | '{{WRAPPER}} .ea-advanced-data-table-pagination select' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1194 | ], |
| 1195 | ] |
| 1196 | ); |
| 1197 | |
| 1198 | $this->start_controls_tabs('ea_adv_data_table_pagination_tabs'); |
| 1199 | |
| 1200 | $this->start_controls_tab('normal', ['label' => esc_html__('Normal', 'essential-addons-for-elementor-lite')]); |
| 1201 | |
| 1202 | $this->add_control( |
| 1203 | 'ea_adv_data_table_pagination_color', |
| 1204 | [ |
| 1205 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 1206 | 'type' => Controls_Manager::COLOR, |
| 1207 | 'default' => '#666666', |
| 1208 | 'selectors' => [ |
| 1209 | '{{WRAPPER}} .ea-advanced-data-table-pagination a' => 'color: {{VALUE}};', |
| 1210 | '{{WRAPPER}} .ea-advanced-data-table-pagination select' => 'color: {{VALUE}};', |
| 1211 | ], |
| 1212 | ] |
| 1213 | ); |
| 1214 | |
| 1215 | $this->add_control( |
| 1216 | 'ea_adv_data_table_pagination_background', |
| 1217 | [ |
| 1218 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 1219 | 'type' => Controls_Manager::COLOR, |
| 1220 | 'default' => '#ffffff', |
| 1221 | 'selectors' => [ |
| 1222 | '{{WRAPPER}} .ea-advanced-data-table-pagination a' => 'background-color: {{VALUE}};', |
| 1223 | '{{WRAPPER}} .ea-advanced-data-table-pagination select' => 'background-color: {{VALUE}};', |
| 1224 | ], |
| 1225 | ] |
| 1226 | ); |
| 1227 | |
| 1228 | $this->add_group_control( |
| 1229 | Group_Control_Border::get_type(), |
| 1230 | [ |
| 1231 | 'name' => 'ea_adv_data_table_pagination_border', |
| 1232 | 'label' => __('Border', 'essential-addons-for-elementor-lite'), |
| 1233 | 'fields_options' => [ |
| 1234 | 'border' => [ |
| 1235 | 'default' => 'solid', |
| 1236 | ], |
| 1237 | 'width' => [ |
| 1238 | 'default' => [ |
| 1239 | 'unit' => 'px', |
| 1240 | 'top' => '1', |
| 1241 | 'right' => '1', |
| 1242 | 'bottom' => '1', |
| 1243 | 'left' => '1', |
| 1244 | 'isLinked' => true, |
| 1245 | ], |
| 1246 | ], |
| 1247 | 'color' => [ |
| 1248 | 'default' => '#eeeeee', |
| 1249 | ], |
| 1250 | ], |
| 1251 | 'selector' => '{{WRAPPER}} .ea-advanced-data-table-pagination a, {{WRAPPER}} .ea-advanced-data-table-pagination select', |
| 1252 | ] |
| 1253 | ); |
| 1254 | |
| 1255 | $this->add_control( |
| 1256 | 'ea_adv_data_table_pagination_border_radius', |
| 1257 | [ |
| 1258 | 'label' => __('Border Radius', 'essential-addons-for-elementor-lite'), |
| 1259 | 'type' => Controls_Manager::DIMENSIONS, |
| 1260 | 'size_units' => ['px'], |
| 1261 | 'selectors' => [ |
| 1262 | '{{WRAPPER}} .ea-advanced-data-table-pagination a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1263 | '{{WRAPPER}} .ea-advanced-data-table-pagination select' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1264 | ], |
| 1265 | ] |
| 1266 | ); |
| 1267 | |
| 1268 | $this->end_controls_tab(); |
| 1269 | |
| 1270 | $this->start_controls_tab('hover', ['label' => esc_html__('Hover', 'essential-addons-for-elementor-lite')]); |
| 1271 | |
| 1272 | $this->add_control( |
| 1273 | 'ea_adv_data_table_pagination_color_hover', |
| 1274 | [ |
| 1275 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 1276 | 'type' => Controls_Manager::COLOR, |
| 1277 | 'default' => '#666666', |
| 1278 | 'selectors' => [ |
| 1279 | '{{WRAPPER}} .ea-advanced-data-table-pagination a:hover' => 'color: {{VALUE}};', |
| 1280 | '{{WRAPPER}} .ea-advanced-data-table-pagination a.ea-adtp-current' => 'color: {{VALUE}};', |
| 1281 | '{{WRAPPER}} .ea-advanced-data-table-pagination select:hover' => 'color: {{VALUE}};', |
| 1282 | ], |
| 1283 | ] |
| 1284 | ); |
| 1285 | |
| 1286 | $this->add_control( |
| 1287 | 'ea_adv_data_table_pagination_background_hover', |
| 1288 | [ |
| 1289 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 1290 | 'type' => Controls_Manager::COLOR, |
| 1291 | 'default' => '#fafafa', |
| 1292 | 'selectors' => [ |
| 1293 | '{{WRAPPER}} .ea-advanced-data-table-pagination a:hover' => 'background-color: {{VALUE}};', |
| 1294 | '{{WRAPPER}} .ea-advanced-data-table-pagination a.ea-adtp-current' => 'background-color: {{VALUE}};', |
| 1295 | '{{WRAPPER}} .ea-advanced-data-table-pagination select:hover' => 'background-color: {{VALUE}};', |
| 1296 | ], |
| 1297 | ] |
| 1298 | ); |
| 1299 | |
| 1300 | $this->add_group_control( |
| 1301 | Group_Control_Border::get_type(), |
| 1302 | [ |
| 1303 | 'name' => 'ea_adv_data_table_pagination_border_hover', |
| 1304 | 'label' => __('Border', 'essential-addons-for-elementor-lite'), |
| 1305 | 'fields_options' => [ |
| 1306 | 'border' => [ |
| 1307 | 'default' => 'solid', |
| 1308 | ], |
| 1309 | 'width' => [ |
| 1310 | 'default' => [ |
| 1311 | 'unit' => 'px', |
| 1312 | 'top' => '1', |
| 1313 | 'right' => '1', |
| 1314 | 'bottom' => '1', |
| 1315 | 'left' => '1', |
| 1316 | 'isLinked' => true, |
| 1317 | ], |
| 1318 | ], |
| 1319 | 'color' => [ |
| 1320 | 'default' => '#eeeeee', |
| 1321 | ], |
| 1322 | ], |
| 1323 | 'selector' => '{{WRAPPER}} .ea-advanced-data-table-pagination a:hover, {{WRAPPER}} .ea-advanced-data-table-pagination a.ea-adtp-current, {{WRAPPER}} .ea-advanced-data-table-pagination select:hover', |
| 1324 | ] |
| 1325 | ); |
| 1326 | |
| 1327 | $this->add_control( |
| 1328 | 'ea_adv_data_table_pagination_border_radius_hover', |
| 1329 | [ |
| 1330 | 'label' => __('Border Radius', 'essential-addons-for-elementor-lite'), |
| 1331 | 'type' => Controls_Manager::DIMENSIONS, |
| 1332 | 'size_units' => ['px'], |
| 1333 | 'selectors' => [ |
| 1334 | '{{WRAPPER}} .ea-advanced-data-table-pagination a:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1335 | '{{WRAPPER}} .ea-advanced-data-table-pagination a.ea-adtp-current' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1336 | '{{WRAPPER}} .ea-advanced-data-table-pagination select' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1337 | ], |
| 1338 | ] |
| 1339 | ); |
| 1340 | |
| 1341 | $this->end_controls_tab(); |
| 1342 | |
| 1343 | $this->end_controls_tabs(); |
| 1344 | |
| 1345 | $this->end_controls_section(); |
| 1346 | |
| 1347 | $this->start_controls_section( |
| 1348 | 'ea_section_adv_data_table_style_button', |
| 1349 | [ |
| 1350 | 'label' => __('Button', 'essential-addons-for-elementor-lite'), |
| 1351 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1352 | 'condition' => [ |
| 1353 | 'ea_adv_data_table_source' => 'ninja' |
| 1354 | ] |
| 1355 | ] |
| 1356 | ); |
| 1357 | |
| 1358 | $this->add_group_control( |
| 1359 | Group_Control_Typography::get_type(), |
| 1360 | [ |
| 1361 | 'name' => 'ea_adv_data_table_button_typography', |
| 1362 | 'label' => __('Typography', 'essential-addons-for-elementor-lite'), |
| 1363 | 'selector' => '{{WRAPPER}} td button, {{WRAPPER}} td .button', |
| 1364 | ] |
| 1365 | ); |
| 1366 | |
| 1367 | $this->start_controls_tabs('ea_adv_data_table_button_tabs'); |
| 1368 | |
| 1369 | $this->start_controls_tab('ea_adv_data_table_button_tab_normal', ['label' => esc_html__('Normal', 'essential-addons-for-elementor-lite')]); |
| 1370 | |
| 1371 | $this->add_control( |
| 1372 | 'ea_adv_data_table_button_color', |
| 1373 | [ |
| 1374 | 'label' => __('Color', 'essential-addons-for-elementor-lite'), |
| 1375 | 'type' => Controls_Manager::COLOR, |
| 1376 | 'default' => '', |
| 1377 | 'selectors' => [ |
| 1378 | '{{WRAPPER}} td button' => 'color: {{VALUE}};', |
| 1379 | '{{WRAPPER}} td .button' => 'color: {{VALUE}};', |
| 1380 | ], |
| 1381 | ] |
| 1382 | ); |
| 1383 | |
| 1384 | $this->add_control( |
| 1385 | 'ea_adv_data_table_button_background_color', |
| 1386 | [ |
| 1387 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 1388 | 'type' => Controls_Manager::COLOR, |
| 1389 | 'default' => '', |
| 1390 | 'selectors' => [ |
| 1391 | '{{WRAPPER}} td button' => 'background-color: {{VALUE}};', |
| 1392 | '{{WRAPPER}} td .button' => 'background-color: {{VALUE}};', |
| 1393 | ], |
| 1394 | ] |
| 1395 | ); |
| 1396 | |
| 1397 | $this->end_controls_tab(); |
| 1398 | |
| 1399 | $this->start_controls_tab('ea_adv_data_table_button_tab_hover', ['label' => esc_html__('Hover', 'essential-addons-for-elementor-lite')]); |
| 1400 | |
| 1401 | $this->add_control( |
| 1402 | 'ea_adv_data_table_button_color_hover', |
| 1403 | [ |
| 1404 | 'label' => __('Color', 'essential-addons-for-elementor-lite'), |
| 1405 | 'type' => Controls_Manager::COLOR, |
| 1406 | 'default' => '', |
| 1407 | 'selectors' => [ |
| 1408 | '{{WRAPPER}} td button:hover' => 'color: {{VALUE}};', |
| 1409 | '{{WRAPPER}} td .button:hover' => 'color: {{VALUE}};', |
| 1410 | ], |
| 1411 | ] |
| 1412 | ); |
| 1413 | |
| 1414 | $this->add_control( |
| 1415 | 'ea_adv_data_table_button_background_color_hover', |
| 1416 | [ |
| 1417 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 1418 | 'type' => Controls_Manager::COLOR, |
| 1419 | 'default' => '', |
| 1420 | 'selectors' => [ |
| 1421 | '{{WRAPPER}} td button:hover' => 'background-color: {{VALUE}};', |
| 1422 | '{{WRAPPER}} td .button:hover' => 'background-color: {{VALUE}};', |
| 1423 | ], |
| 1424 | ] |
| 1425 | ); |
| 1426 | |
| 1427 | $this->end_controls_tab(); |
| 1428 | |
| 1429 | $this->end_controls_tabs(); |
| 1430 | |
| 1431 | $this->add_group_control( |
| 1432 | Group_Control_Border::get_type(), |
| 1433 | [ |
| 1434 | 'name' => 'ea_adv_data_table_button_border', |
| 1435 | 'label' => __('Border', 'essential-addons-for-elementor-lite'), |
| 1436 | 'fields_options' => [ |
| 1437 | 'border' => [ |
| 1438 | 'default' => '', |
| 1439 | ], |
| 1440 | 'width' => [ |
| 1441 | 'default' => [ |
| 1442 | 'unit' => 'px', |
| 1443 | 'isLinked' => true, |
| 1444 | ], |
| 1445 | ], |
| 1446 | 'color' => [ |
| 1447 | 'default' => '', |
| 1448 | ], |
| 1449 | ], |
| 1450 | 'selector' => '{{WRAPPER}} td button, {{WRAPPER}} td .button', |
| 1451 | ] |
| 1452 | ); |
| 1453 | |
| 1454 | $this->add_control( |
| 1455 | 'ea_adv_data_table_button_border_radius', |
| 1456 | [ |
| 1457 | 'label' => __('Border Radius', 'essential-addons-for-elementor-lite'), |
| 1458 | 'type' => Controls_Manager::DIMENSIONS, |
| 1459 | 'size_units' => ['px'], |
| 1460 | 'selectors' => [ |
| 1461 | '{{WRAPPER}} td button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1462 | '{{WRAPPER}} td .button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1463 | ], |
| 1464 | ] |
| 1465 | ); |
| 1466 | |
| 1467 | $this->add_group_control( |
| 1468 | Group_Control_Box_Shadow::get_type(), |
| 1469 | [ |
| 1470 | 'name' => 'ea_adv_data_table_button_box_shadow', |
| 1471 | 'label' => __('Box Shadow', 'essential-addons-for-elementor-lite'), |
| 1472 | 'selector' => '{{WRAPPER}} td button, {{WRAPPER}} td .button', |
| 1473 | ] |
| 1474 | ); |
| 1475 | |
| 1476 | $this->add_control( |
| 1477 | 'ea_adv_data_table_button_border_padding', |
| 1478 | [ |
| 1479 | 'label' => __('Padding', 'essential-addons-for-elementor-lite'), |
| 1480 | 'type' => Controls_Manager::DIMENSIONS, |
| 1481 | 'size_units' => ['px'], |
| 1482 | 'selectors' => [ |
| 1483 | '{{WRAPPER}} td button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1484 | '{{WRAPPER}} td .button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1485 | ], |
| 1486 | ] |
| 1487 | ); |
| 1488 | |
| 1489 | $this->end_controls_section(); |
| 1490 | } |
| 1491 | |
| 1492 | protected function render() |
| 1493 | { |
| 1494 | $settings = $this->get_settings_for_display(); |
| 1495 | |
| 1496 | if (in_array($settings['ea_adv_data_table_source'], ['database', 'remote', 'google'])) { |
| 1497 | if (!apply_filters('eael/pro_enabled', false)) { |
| 1498 | return; |
| 1499 | } |
| 1500 | } else if ($settings['ea_adv_data_table_source'] == "tablepress") { |
| 1501 | if (!apply_filters('eael/pro_enabled', false)) { |
| 1502 | return; |
| 1503 | } |
| 1504 | |
| 1505 | if (!apply_filters('eael/is_plugin_active', 'tablepress/tablepress.php')) { |
| 1506 | return; |
| 1507 | } |
| 1508 | } else if ($settings['ea_adv_data_table_source'] == "ninja") { |
| 1509 | if (!apply_filters('eael/is_plugin_active', 'ninja-tables/ninja-tables.php')) { |
| 1510 | return; |
| 1511 | } |
| 1512 | } |
| 1513 | |
| 1514 | $this->add_render_attribute('ea-adv-data-table-wrap', [ |
| 1515 | 'class' => "ea-advanced-data-table-wrap", |
| 1516 | 'data-id' => $this->get_id(), |
| 1517 | ]); |
| 1518 | |
| 1519 | $this->add_render_attribute('ea-adv-data-table', [ |
| 1520 | 'class' => "ea-advanced-data-table ea-advanced-data-table-{$settings['ea_adv_data_table_source']} ea-advanced-data-table-{$this->get_id()}", |
| 1521 | 'data-id' => $this->get_id(), |
| 1522 | ]); |
| 1523 | |
| 1524 | if (Plugin::$instance->editor->is_edit_mode()) { |
| 1525 | $this->add_render_attribute('ea-adv-data-table', [ |
| 1526 | 'class' => "ea-advanced-data-table-editable", |
| 1527 | ]); |
| 1528 | } |
| 1529 | |
| 1530 | if ($settings['ea_adv_data_table_sort'] == 'yes') { |
| 1531 | $this->add_render_attribute('ea-adv-data-table', [ |
| 1532 | 'class' => "ea-advanced-data-table-sortable", |
| 1533 | ]); |
| 1534 | } |
| 1535 | |
| 1536 | if ($settings['ea_adv_data_table_pagination'] == 'yes') { |
| 1537 | $this->add_render_attribute('ea-adv-data-table', [ |
| 1538 | 'class' => "ea-advanced-data-table-paginated", |
| 1539 | 'data-items-per-page' => $settings['ea_adv_data_table_items_per_page'], |
| 1540 | ]); |
| 1541 | } |
| 1542 | |
| 1543 | if ($settings['ea_adv_data_table_search'] == 'yes') { |
| 1544 | $this->add_render_attribute('ea-adv-data-table', [ |
| 1545 | 'class' => "ea-advanced-data-table-searchable", |
| 1546 | ]); |
| 1547 | |
| 1548 | $this->add_render_attribute('ea-adv-data-table-search-wrap', [ |
| 1549 | 'class' => "ea-advanced-data-table-search-wrap ea-advanced-data-table-search-{$settings['ea_adv_data_table_search_alignment']}", |
| 1550 | ]); |
| 1551 | } |
| 1552 | |
| 1553 | echo '<div ' . $this->get_render_attribute_string('ea-adv-data-table-wrap') . '>'; |
| 1554 | |
| 1555 | if ($content = $this->get_table_content()) { |
| 1556 | if ($settings['ea_adv_data_table_search'] == 'yes') { |
| 1557 | echo '<div ' . $this->get_render_attribute_string('ea-adv-data-table-search-wrap') . '><input type="search" placeholder="' . Helper::eael_wp_kses($settings['ea_adv_data_table_search_placeholder'] ). '" class="ea-advanced-data-table-search"></div>'; |
| 1558 | } |
| 1559 | |
| 1560 | echo '<div class="ea-advanced-data-table-wrap-inner"> |
| 1561 | <table ' . $this->get_render_attribute_string('ea-adv-data-table') . '>' . Helper::eael_wp_kses( $content ) . '</table> |
| 1562 | </div>'; |
| 1563 | |
| 1564 | if ($settings['ea_adv_data_table_pagination'] == 'yes') { |
| 1565 | if (Plugin::$instance->editor->is_edit_mode()) { |
| 1566 | if ($settings['ea_adv_data_table_pagination_type'] == 'button') { |
| 1567 | echo '<div class="ea-advanced-data-table-pagination clearfix"> |
| 1568 | <a href="#">«</a> |
| 1569 | <a href="#">1</a> |
| 1570 | <a href="#">2</a> |
| 1571 | <a href="#">»</a> |
| 1572 | </div>'; |
| 1573 | } else { |
| 1574 | echo '<div class="ea-advanced-data-table-pagination clearfix"> |
| 1575 | <select> |
| 1576 | <option value="1">1</option> |
| 1577 | <option value="2">2</option> |
| 1578 | </select> |
| 1579 | </div>'; |
| 1580 | } |
| 1581 | } else { |
| 1582 | echo '<div class="ea-advanced-data-table-pagination ea-advanced-data-table-pagination-' . $settings['ea_adv_data_table_pagination_type'] . ' clearfix"></div>'; |
| 1583 | } |
| 1584 | } |
| 1585 | } else { |
| 1586 | $no_content = apply_filters( 'eael/advanced-data-table/no-content-found-text', __( 'No content found', 'essential-addons-for-elementor-lite' ) ); |
| 1587 | echo esc_html( $no_content ); |
| 1588 | } |
| 1589 | |
| 1590 | echo '</div>'; |
| 1591 | } |
| 1592 | |
| 1593 | public function get_table_content() |
| 1594 | { |
| 1595 | $settings = $this->get_settings_for_display(); |
| 1596 | |
| 1597 | if ($settings['ea_adv_data_table_source'] == 'static') { |
| 1598 | return $settings['ea_adv_data_table_static_html']; |
| 1599 | } else if ($settings['ea_adv_data_table_source'] == 'ninja') { |
| 1600 | return $this->ninja_integration(); |
| 1601 | } |
| 1602 | |
| 1603 | if ( $settings[ 'ea_adv_data_table_source' ] == 'remote' ) { |
| 1604 | $settings_legacy = $this->get_settings(); |
| 1605 | $settings[ 'ea_adv_data_table_source_remote_host' ] = $settings_legacy[ 'ea_adv_data_table_source_remote_host' ]; |
| 1606 | $settings[ 'ea_adv_data_table_source_remote_username' ] = $settings_legacy[ 'ea_adv_data_table_source_remote_username' ]; |
| 1607 | $settings[ 'ea_adv_data_table_source_remote_password' ] = $settings_legacy[ 'ea_adv_data_table_source_remote_password' ]; |
| 1608 | $settings[ 'ea_adv_data_table_source_remote_database' ] = $settings_legacy[ 'ea_adv_data_table_source_remote_database' ]; |
| 1609 | } |
| 1610 | |
| 1611 | $content = apply_filters('eael/advanced-data-table/table_html/integration/' . $settings['ea_adv_data_table_source'], $settings); |
| 1612 | |
| 1613 | if (is_array($content)) { |
| 1614 | return ''; |
| 1615 | } |
| 1616 | |
| 1617 | return $content; |
| 1618 | } |
| 1619 | |
| 1620 | public function ninja_integration() |
| 1621 | { |
| 1622 | $settings = $this->get_settings_for_display(); |
| 1623 | |
| 1624 | if (empty($settings['ea_adv_data_table_source_ninja_table_id'])) { |
| 1625 | return; |
| 1626 | } |
| 1627 | |
| 1628 | $html = ''; |
| 1629 | $table_settings = ninja_table_get_table_settings($settings['ea_adv_data_table_source_ninja_table_id']); |
| 1630 | $table_headers = ninja_table_get_table_columns($settings['ea_adv_data_table_source_ninja_table_id']); |
| 1631 | $table_rows = ninjaTablesGetTablesDataByID($settings['ea_adv_data_table_source_ninja_table_id']); |
| 1632 | |
| 1633 | if (!empty($table_rows)) { |
| 1634 | if (!isset($table_settings['hide_header_row']) || $table_settings['hide_header_row'] != true) { |
| 1635 | $html .= '<thead><tr>'; |
| 1636 | foreach ($table_headers as $key => $th) { |
| 1637 | $style = isset($settings['ea_adv_data_table_dynamic_th_width']) && isset($settings['ea_adv_data_table_dynamic_th_width'][$key]) ? ' style="width:' . $settings['ea_adv_data_table_dynamic_th_width'][$key] . '"' : ''; |
| 1638 | $html .= '<th' . $style . '>' . $th['name'] . '</th>'; |
| 1639 | } |
| 1640 | $html .= '</tr></thead>'; |
| 1641 | } |
| 1642 | |
| 1643 | $html .= '<tbody>'; |
| 1644 | foreach ($table_rows as $key => $tr) { |
| 1645 | $html .= '<tr>'; |
| 1646 | foreach ($table_headers as $th) { |
| 1647 | if (!isset($th['data_type'])) { |
| 1648 | $th['data_type'] = ''; |
| 1649 | } |
| 1650 | |
| 1651 | if ($th['data_type'] == 'image') { |
| 1652 | $html .= '<td>' . (isset($tr[$th['key']]['image_thumb']) ? '<a href="' . $tr[$th['key']]['image_full'] . '"><img src="' . $tr[$th['key']]['image_thumb'] . '"></a>' : '') . '</td>'; |
| 1653 | } elseif ($th['data_type'] == 'selection') { |
| 1654 | $html .= '<td>' . (!empty($tr[$th['key']]) ? implode((array) $tr[$th['key']], ', ') : '') . '</td>'; |
| 1655 | } elseif ($th['data_type'] == 'button') { |
| 1656 | $html .= '<td>' . (!empty($tr[$th['key']]) ? '<a href="' . $tr[$th['key']] . '" class="button" target="' . $th['link_target'] . '">' . $th['button_text'] . '</a>' : '') . '</td>'; |
| 1657 | } else { |
| 1658 | $html .= '<td>' . ( isset( $tr[ $th['key'] ] ) ? $tr[ $th['key'] ] : '' ) . '</td>'; |
| 1659 | } |
| 1660 | } |
| 1661 | $html .= '</tr>'; |
| 1662 | } |
| 1663 | $html .= '</tbody>'; |
| 1664 | } |
| 1665 | |
| 1666 | return $html; |
| 1667 | } |
| 1668 | |
| 1669 | } |
| 1670 |