浏览代码

Merge branch 'develop' into fix/6070

文翼 3 年之前
父节点
当前提交
ec0d371ef5

+ 3 - 3
.travis.yml

@@ -7,7 +7,7 @@ jobs:
     - stage: test
       language: node_js
       node_js:
-        - 12
+        - 14
       name: "Lint src and check docs"
       cache:
         npm: true
@@ -22,7 +22,7 @@ jobs:
     - stage: test
       language: node_js
       node_js:
-        - 12
+        - 14
       name: "Cypress Test"
       cache:
         npm: true
@@ -40,7 +40,7 @@ jobs:
       rvm:
         - 2.4.1
       before_install:
-        - nvm install 12
+        - nvm install 14
       script: ./deploy.sh
       if: branch = master AND type = push
       cache: bundler

+ 1 - 1
site/docs/api/column-options.md

@@ -156,7 +156,7 @@ The column options is defined in `jQuery.fn.bootstrapTable.columnDefaults`.
 
   Escapes a string for insertion into HTML, replacing &, <, >, ", \`, and ' characters.
 
-- **Default:** `false`
+- **Default:** `undefined`
 
 - **Example:** [Column Escape](https://examples.bootstrap-table.com/#column-options/escape.html)
 

+ 3 - 3
src/bootstrap-table.js

@@ -1512,8 +1512,9 @@ class BootstrapTable {
     }
 
     this.header.fields.forEach((field, j) => {
+      const column = this.columns[j]
       let text = ''
-      let value_ = Utils.getItemField(item, field, this.options.escape)
+      let value_ = Utils.getItemField(item, field, this.options.escape, column.escape)
       let value = ''
       let type = ''
       let cellStyle = {}
@@ -1525,7 +1526,6 @@ class BootstrapTable {
       let rowspan_ = ''
       let colspan_ = ''
       let title_ = ''
-      const column = this.columns[j]
 
       if ((this.fromHtml || this.autoMergeCells) && typeof value_ === 'undefined') {
         if ((!column.checkbox) && (!column.radio)) {
@@ -1794,7 +1794,7 @@ class BootstrapTable {
       const fields = this.getVisibleFields()
       const field = fields[index - Utils.getDetailViewIndexOffset(this.options)]
       const column = this.columns[this.fieldsColumnsIndex[field]]
-      const value = Utils.getItemField(item, field, this.options.escape)
+      const value = Utils.getItemField(item, field, this.options.escape, column.escape)
 
       if ($td.find('.detail-icon').length) {
         return

+ 1 - 1
src/constants/index.js

@@ -445,7 +445,7 @@ const COLUMN_DEFAULTS = {
   detailFormatter: undefined,
   searchFormatter: true,
   searchHighlightFormatter: false,
-  escape: false,
+  escape: undefined,
   events: undefined
 }
 

+ 1 - 1
src/extensions/fixed-columns/bootstrap-table-fixed-columns.js

@@ -144,7 +144,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
       const inputSelector = `[name="${this.options.selectItemName}"]`
       const $input = $el.find(inputSelector)
 
-      if (typeof index === undefined) {
+      if (typeof index === 'undefined') {
         return
       }
 

+ 1 - 1
src/locale/README.md

@@ -156,7 +156,7 @@ Table bellow is sorted ascending by language code. If case of add new translatio
 | Central Kurdish                                                | ku-Arab        | ku         | missing        |
 | Central Kurdish (Iraq)                                         | ku-Arab-IQ     |            | missing        |
 | Kyrgyz (Kyrgyzstan)                                            | ky-KG          | ky         | missing        |
-| Luxembourgish (Luxembourg)                                     | lb-LU          | lb         | missing        |
+| Luxembourgish (Luxembourg)                                     | lb-LU          | lb         |                |
 | Lao (Lao P.D.R.)                                               | lo-LA          | lo         | missing        |
 | Lithuanian (Lithuania)                                         | lt-LT          | lt         | missing        |
 | Latvian (Latvia)                                               | lv-LV          | lv         | missing        |

+ 3 - 2
src/locale/bootstrap-table-fr-LU.js

@@ -1,14 +1,15 @@
 /**
  * Bootstrap Table French (Luxembourg) translation
  * Author: Nevets82 <Nevets82@gmail.com>
+ * Editor: David Morais Ferreira (https://github.com/DavidMoraisFerreira/)
  */
 
 $.fn.bootstrapTable.locales['fr-LU'] = {
   formatCopyRows () {
-    return 'Copy Rows'
+    return 'Copier les lignes'
   },
   formatPrint () {
-    return 'Print'
+    return 'Imprimer'
   },
   formatLoadingMessage () {
     return 'Chargement en cours'

+ 106 - 0
src/locale/bootstrap-table-lb-LU.js

@@ -0,0 +1,106 @@
+/**
+ * Bootstrap Table Luxembourgish translation
+ * Author: David Morais Ferreira (https://github.com/DavidMoraisFerreira)
+ */
+
+$.fn.bootstrapTable.locales['lb-LU'] = $.fn.bootstrapTable.locales['lb'] = {
+  formatCopyRows () {
+    return 'Zeilen kopéieren'
+  },
+  formatPrint () {
+    return 'Drécken'
+  },
+  formatLoadingMessage () {
+    return 'Gëtt gelueden, gedellëgt Iech wannechgelift ee Moment'
+  },
+  formatRecordsPerPage (pageNumber) {
+    return `${pageNumber} Zeilen per Säit`
+  },
+  formatShowingRows (pageFrom, pageTo, totalRows, totalNotFiltered) {
+    if (totalNotFiltered !== undefined && totalNotFiltered > 0 && totalNotFiltered > totalRows) {
+      return `Weist Zeil ${pageFrom} bis ${pageTo} vun ${totalRows} Zeil${(totalRows > 1) ? 'en' : ''} (gefiltert vun insgesamt ${totalNotFiltered} Zeil${(totalRows > 1) ? 'en' : ''})`
+    }
+
+    return `Weist Zeil ${pageFrom} bis ${pageTo} vun ${totalRows} Zeil${(totalRows > 1) ? 'en' : ''}`
+  },
+  formatSRPaginationPreText () {
+    return 'viregt Säit'
+  },
+  formatSRPaginationPageText (page) {
+    return `op Säit ${page}`
+  },
+  formatSRPaginationNextText () {
+    return 'nächst Säit'
+  },
+  formatDetailPagination (totalRows) {
+    return `Weist ${totalRows} Zeilen`
+  },
+  formatClearSearch () {
+    return 'Sich réckgängeg maachen'
+  },
+  formatSearch () {
+    return 'Sich'
+  },
+  formatNoMatches () {
+    return 'Keng passend Anträg fonnt'
+  },
+  formatPaginationSwitch () {
+    return 'Paginatioun uweisen/verstoppen'
+  },
+  formatPaginationSwitchDown () {
+    return 'Paginatioun uweisen'
+  },
+  formatPaginationSwitchUp () {
+    return 'Paginatioun verstoppen'
+  },
+  formatRefresh () {
+    return 'Nei lueden'
+  },
+  formatToggle () {
+    return 'Ëmschalten'
+  },
+  formatToggleOn () {
+    return 'Kaartenusiicht uweisen'
+  },
+  formatToggleOff () {
+    return 'Kaartenusiicht verstoppen'
+  },
+  formatColumns () {
+    return 'Kolonnen'
+  },
+  formatColumnsToggleAll () {
+    return 'All ëmschalten'
+  },
+  formatFullscreen () {
+    return 'Vollbild'
+  },
+  formatAllRows () {
+    return 'All'
+  },
+  formatAutoRefresh () {
+    return 'Automatescht neilueden'
+  },
+  formatExport () {
+    return 'Daten exportéieren'
+  },
+  formatJumpTo () {
+    return 'Sprangen'
+  },
+  formatAdvancedSearch () {
+    return 'Erweidert Sich'
+  },
+  formatAdvancedCloseButton () {
+    return 'Zoumaachen'
+  },
+  formatFilterControlSwitch () {
+    return 'Schaltelementer uweisen/verstoppen'
+  },
+  formatFilterControlSwitchHide () {
+    return 'Schaltelementer verstoppen'
+  },
+  formatFilterControlSwitchShow () {
+    return 'Schaltelementer uweisen'
+  }
+}
+
+$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['lb-LU'])

+ 6 - 1
src/utils/index.js

@@ -364,9 +364,14 @@ export default {
     return dataAttr
   },
 
-  getItemField (item, field, escape) {
+  getItemField (item, field, escape, columnEscape = undefined) {
     let value = item
 
+    // use column escape if it is defined
+    if (typeof columnEscape !== 'undefined') {
+      escape = columnEscape
+    }
+
     if (typeof field !== 'string' || item.hasOwnProperty(field)) {
       return escape ? this.escapeHTML(item[field]) : item[field]
     }