浏览代码

added support (search(clear) button) for bulma

Dustin Utecht 6 年之前
父节点
当前提交
8f59da8b2f
共有 3 个文件被更改,包括 8 次插入2 次删除
  1. 1 1
      src/bootstrap-table.js
  2. 2 0
      src/constants/index.js
  3. 5 1
      src/themes/bulma/bootstrap-table-bulma.js

+ 1 - 1
src/bootstrap-table.js

@@ -604,7 +604,7 @@ class BootstrapTable {
         </div>
       `,
       Utils.sprintf(this.constants.html.inputGroup,
-        `<input class="${this.constants.classes.input}${Utils.sprintf(' input-%s', o.iconSize)}" type="text" placeholder="${o.formatSearch()}">`,
+        Utils.sprintf(this.constants.html.searchInput, this.constants.classes.input, Utils.sprintf(' input-%s', o.iconSize), o.formatSearch()),
         (o.showSearchButton ? Utils.sprintf(this.constants.html.searchButton, o.formatSearch(), this.options.iconsPrefix, this.options.icons.search) : '') +
         (o.showSearchClearButton ? Utils.sprintf(this.constants.html.searchClearButton, o.formatClearSearch(), this.options.iconsPrefix, this.options.icons.clearSearch) : ''))
       ))

+ 2 - 0
src/constants/index.js

@@ -53,6 +53,7 @@ const CONSTANTS = {
       paginationItem: '<li class="page-item%s"><a class="page-link" href="#">%s</a></li>',
       icon: '<i class="%s %s"></i>',
       inputGroup: '<div class="input-group">%s<span class="input-group-btn">%s</span></div>',
+      searchInput: '<input class="%s%s" type="text" placeholder="%s">',
       searchButton: '<button class="btn btn-default" type="button" name="search" title="%s"><i class="%s %s"></i></button>',
       searchClearButton: '<button class="btn btn-default" type="button" name="clearSearch" title="%s"><i class="%s %s"></i></button>'
     }
@@ -96,6 +97,7 @@ const CONSTANTS = {
       paginationItem: '<li class="page-item%s"><a class="page-link" href="#">%s</a></li>',
       icon: '<i class="%s %s"></i>',
       inputGroup: '<div class="input-group">%s<div class="input-group-append">%s</div></div>',
+      searchInput: '<input class="%s%s" type="text" placeholder="%s">',
       searchButton: '<button class="btn btn-secondary" type="button" name="search" title="%s"><i class="%s %s"></i></button>',
       searchClearButton: '<button class="btn btn-secondary" type="button" name="clearSearch" title="%s"><i class="%s %s"></i></button>'
     }

+ 5 - 1
src/themes/bulma/bootstrap-table-bulma.js

@@ -30,8 +30,12 @@ $.BootstrapTable = class extends $.BootstrapTable {
     this.constants.html.pageDropdown = ['<div class="dropdown-menu"><div class="dropdown-content">', '</div></div>']
     this.constants.html.pageDropdownItem = '<a class="dropdown-item %s" href="#">%s</a>'
     this.constants.html.dropdownCaret = '<span class="icon is-small"><i class="fas fa-angle-down" aria-hidden="true"></i></span>'
-    this.constants.html.pagination = ['<ul class="pagination%s">', '</ul>'],
+    this.constants.html.pagination = ['<ul class="pagination%s">', '</ul>']
     this.constants.html.paginationItem = '<li><a class="page-item pagination-link%s" href="#">%s</a></li>'
+    this.constants.html.searchInput = '<p class="control"><input class="%s input-%s" type="text" placeholder="%s"></p>'
+    this.constants.html.inputGroup = '<div class="field has-addons has-addons-right">%s%s</div>'
+    this.constants.html.searchButton = '<p class="control"><button class="button" type="button" name="search" title="%s"><i class="%s %s"></i></button></p>'
+    this.constants.html.searchClearButton = '<p class="control"><button class="button" type="button" name="clearSearch" title="%s"><i class="%s %s"></i></button></p>'
   }
 
   initToolbar () {