From a07f54a579686983b4d90c556179ea4c642af4fe Mon Sep 17 00:00:00 2001 From: Bao NGUYEN <lazzyvn@yahoo.com> Date: Mon, 15 Jan 2024 19:37:07 +0100 Subject: [PATCH] Update version 1.22.2, add Language --- bootstrap_table.libraries.yml | 84 ++++++++++++----------- bootstrap_table.module | 1 + src/Plugin/views/style/BootstrapTable.php | 58 ++++++++++++++++ 3 files changed, 103 insertions(+), 40 deletions(-) diff --git a/bootstrap_table.libraries.yml b/bootstrap_table.libraries.yml index ebb1006..817e913 100644 --- a/bootstrap_table.libraries.yml +++ b/bootstrap_table.libraries.yml @@ -5,96 +5,100 @@ bootstrapTable: name: GNU url: https://github.com/wenzhixin/bootstrap-table/blob/develop/LICENSE gpl-compatible: true - version: 1.22.1 + version: 1.22.2 js: - //unpkg.com/bootstrap-table@1.22.1/dist/bootstrap-table.min.js: {type: external, minified: true } - //unpkg.com/bootstrap-table@1.22.1/dist/extensions/mobile/bootstrap-table-mobile.min.js: {type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/bootstrap-table.min.js: {type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile.min.js: {type: external, minified: true } css: component: - //unpkg.com/bootstrap-table@1.22.1/dist/bootstrap-table.min.css: { type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/bootstrap-table.min.css: { type: external, minified: true } auto-refresh: - version: 1.22.1 + version: 1.22.2 js: - //unpkg.com/bootstrap-table@1.22.1/dist/extensions/auto-refresh/bootstrap-table-auto-refresh.min.js: { type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/extensions/auto-refresh/bootstrap-table-auto-refresh.min.js: { type: external, minified: true } cookie: - version: 1.22.1 + version: 1.22.2 js: - //unpkg.com/bootstrap-table@1.22.1/dist/extensions/cookie/bootstrap-table-cookie.min.js: { type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/extensions/cookie/bootstrap-table-cookie.min.js: { type: external, minified: true } show-copy-rows: - version: 1.22.1 + version: 1.22.2 js: - //unpkg.com/bootstrap-table@1.22.1/dist/extensions/copy-rows/bootstrap-table-copy-rows.min.js: {type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/extensions/copy-rows/bootstrap-table-copy-rows.min.js: {type: external, minified: true } show-print: - version: 1.22.1 + version: 1.22.2 js: - //unpkg.com/bootstrap-table@1.22.1/dist/extensions/print/bootstrap-table-print.min.js: {type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/extensions/print/bootstrap-table-print.min.js: {type: external, minified: true } show-export: - version: 1.22.1 + version: 1.22.2 js: - //unpkg.com/tableexport.jquery.plugin/tableExport.min.js: { type: external, minified: true, crossorigin: anonymous } - //cdn.jsdelivr.net/npm/tableexport.jquery.plugin@1.10.21/tableExport.min.js: {type: external, minified: true } - //cdn.jsdelivr.net/npm/tableexport.jquery.plugin@1.10.21/libs/jsPDF/jspdf.min.js: {type: external, minified: true } - //cdn.jsdelivr.net/npm/tableexport.jquery.plugin@1.10.21/libs/jsPDF-AutoTable/jspdf.plugin.autotable.js: {type: external, minified: true } - //unpkg.com/bootstrap-table@1.22.1/dist/extensions/export/bootstrap-table-export.min.js: {type: external, minified: true } + //cdn.jsdelivr.net/npm/tableexport.jquery.plugin/tableExport.min.js: {type: external, minified: true } + //cdn.jsdelivr.net/npm/tableexport.jquery.plugin/libs/jsPDF/jspdf.min.js: {type: external, minified: true } + //cdn.jsdelivr.net/npm/tableexport.jquery.plugin/libs/jsPDF-AutoTable/jspdf.plugin.autotable.js: {type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/extensions/export/bootstrap-table-export.min.js: {type: external, minified: true } defer-url: - version: 1.22.1 + version: 1.22.2 js: - //unpkg.com/bootstrap-table@1.22.1/dist/extensions/defer-url/bootstrap-table-defer-url.min.js: {type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/extensions/defer-url/bootstrap-table-defer-url.min.js: {type: external, minified: true } filter-control: - version: 1.22.1 + version: 1.22.2 js: - //unpkg.com/bootstrap-table@1.22.1/dist/extensions/filter-control/bootstrap-table-filter-control.min.js: {type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/extensions/filter-control/bootstrap-table-filter-control.min.js: {type: external, minified: true } group-by: - version: 1.22.1 + version: 1.22.2 js: - //unpkg.com/bootstrap-table@1.22.1/dist/extensions/group-by-v2/bootstrap-table-group-by.min.js: {type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/extensions/group-by-v2/bootstrap-table-group-by.min.js: {type: external, minified: true } css: component: - //unpkg.com/bootstrap-table@1.22.1/dist/extensions/group-by-v2/bootstrap-table-group-by.css: { type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/extensions/group-by-v2/bootstrap-table-group-by.css: { type: external, minified: true } show-multi-sort: - version: 1.22.1 + version: 1.22.2 js: - //unpkg.com/bootstrap-table@1.22.1/dist/extensions/multiple-sort/bootstrap-table-multiple-sort.js: {type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/extensions/multiple-sort/bootstrap-table-multiple-sort.js: {type: external, minified: true } show-jump-to: - version: 1.22.1 + version: 1.22.2 js: - //unpkg.com/bootstrap-table@1.22.1/dist/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js: {type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js: {type: external, minified: true } css: component: - //unpkg.com/bootstrap-table@1.22.1/dist/extensions/page-jump-to/bootstrap-table-page-jump-to.min.css: { type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/extensions/page-jump-to/bootstrap-table-page-jump-to.min.css: { type: external, minified: true } reorderable-rows: - version: 1.22.1 + version: 1.22.2 js: //cdn.jsdelivr.net/npm/tablednd@1.0.5/dist/jquery.tablednd.min.js: {type: external, minified: true } - //unpkg.com/bootstrap-table@1.22.1/dist/extensions/reorder-rows/bootstrap-table-reorder-rows.min.js: {type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/extensions/reorder-rows/bootstrap-table-reorder-rows.min.js: {type: external, minified: true } css: component: - //unpkg.com/bootstrap-table@1.22.1/dist/extensions/reorder-rows/bootstrap-table-reorder-rows.css: { type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/extensions/reorder-rows/bootstrap-table-reorder-rows.css: { type: external, minified: true } resizable: - version: 1.22.1 + version: 1.22.2 js: - //unpkg.com/jquery-resizable-columns@0.2.3/dist/jquery.resizableColumns.min.js: {type: external, minified: true } - //unpkg.com/bootstrap-table@1.22.1/dist/extensions/resizable/bootstrap-table-resizable.min.js: {type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/jquery.resizableColumns.min.js: {type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/extensions/resizable/bootstrap-table-resizable.min.js: {type: external, minified: true } css: component: - //unpkg.com/jquery-resizable-columns@0.2.3/dist/jquery.resizableColumns.css: { type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/jquery.resizableColumns.css: { type: external, minified: true } sticky-header: - version: 1.22.1 + version: 1.22.2 js: - //unpkg.com/bootstrap-table@1.22.1/dist/extensions/sticky-header/bootstrap-table-sticky-header.min.js: {type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/extensions/sticky-header/bootstrap-table-sticky-header.min.js: {type: external, minified: true } css: component: - //unpkg.com/bootstrap-table@1.22.1/dist/extensions/sticky-header/bootstrap-table-sticky-header.css: { type: external, minified: true } + //cdn.jsdelivr.net/npm/bootstrap-table/dist/extensions/sticky-header/bootstrap-table-sticky-header.css: { type: external, minified: true } + +locale: + version: 1.22.2 + js: + //cdn.jsdelivr.net/npm/bootstrap-table/dist/bootstrap-table-locale-all.min.js: {type: external, minified: true } diff --git a/bootstrap_table.module b/bootstrap_table.module index 5e748b3..02a0d5c 100644 --- a/bootstrap_table.module +++ b/bootstrap_table.module @@ -43,6 +43,7 @@ function bootstrap_table_help($route_name, RouteMatchInterface $route_match) { $output .= '<li>' . t('Ajax support') . '</li>'; $output .= '</ul>'; return $output; + default: break; } diff --git a/src/Plugin/views/style/BootstrapTable.php b/src/Plugin/views/style/BootstrapTable.php index 5e8b546..b3c8511 100644 --- a/src/Plugin/views/style/BootstrapTable.php +++ b/src/Plugin/views/style/BootstrapTable.php @@ -76,6 +76,7 @@ class BootstrapTable extends Table { 'resizable' => FALSE, 'sticky-header' => FALSE, 'defer-url' => FALSE, + 'locale' => 'en-US', ], ]; @@ -281,6 +282,63 @@ class BootstrapTable extends Table { '#default_value' => $this->options['extension']['defer_url'] ?? '', ]; + $form['extension']['locale'] = [ + '#type' => 'select', + '#title' => $this->t('Locale'), + '#options' => [ + "af-ZA" => $this->t('Afrikaans'), + "ar-SA" => $this->t('Arabic'), + "ca-ES" => $this->t('Catalan'), + "cs-CZ" => $this->t('Czech'), + "da-DK" => $this->t('Danish'), + "de-DE" => $this->t('German'), + "el-GR" => $this->t('Greek'), + "en-US" => $this->t('English'), + "es-AR" => $this->t('Spanish, Argentina'), + "es-CL" => $this->t('Spanish, Chile'), + "es-CR" => $this->t('Spanish, Costa Rica'), + "es-ES" => $this->t('Spanish, Spain'), + "es-MX" => $this->t('Spanish, Mexico'), + "es-NI" => $this->t('Spanish, Nicaragua'), + "es-SP" => $this->t('Spanish'), + "et-EE" => $this->t('Estonian'), + "eu-EU" => $this->t('Basque'), + "fa-IR" => $this->t('Persian'), + "fi-FI" => $this->t('Finnish'), + "fr-BE" => $this->t('French, Belgium'), + "fr-FR" => $this->t('French'), + "he-IL" => $this->t('Hebrew'), + "hr-HR" => $this->t('Croatian'), + "hu-HU" => $this->t('Hungarian'), + "id-ID" => $this->t('Indonesian'), + "it-IT" => $this->t('Italian'), + "ja-JP" => $this->t('Japanese'), + "ka-GE" => $this->t('Georgian'), + "ko-KR" => $this->t('Korean'), + "ms-MY" => $this->t('Malay'), + "nb-NO" => $this->t('Norwegian'), + "nl-NL" => $this->t('Dutch'), + "pl-PL" => $this->t('Polish'), + "pt-BR" => $this->t('Portuguese, Brazil'), + "pt-PT" => $this->t('Portuguese, Portugal'), + "ro-RO" => $this->t('Romanian'), + "ru-RU" => $this->t('Russian'), + "sk-SK" => $this->t('Slovak'), + "sv-SE" => $this->t('Swedish'), + "th-TH" => $this->t('Thai'), + "tr-TR" => $this->t('Turkish'), + "uk-UA" => $this->t('Ukrainian'), + "ur-PK" => $this->t('Urdu'), + "uz-Latn-UZ" => $this->t('Uzbek'), + "vi-VN" => $this->t('Vietnamese'), + "zh-CN" => $this->t('Chinese'), + "zh-TW" => $this->t('Taiwanese'), + ], + '#empty_option' => $this->t('- None -'), + '#description' => $this->t('Use locale option to set the i18n'), + '#default_value' => $this->options['extension']['locale'], + ]; + $form['pages'] = [ '#type' => 'details', '#title' => $this->t('Pagination and Page Length'), -- GitLab