From e882c76e69496a36223a1f3323a957ce1660e981 Mon Sep 17 00:00:00 2001 From: Stephen Morton Date: Sun, 21 May 2023 12:58:00 -0400 Subject: [PATCH 1/5] Bootstrap 5 - package.json --- examples/index.html | 11 +- package.json | 13 +- yarn.lock | 4694 +++++++++++++++++++++---------------------- 3 files changed, 2358 insertions(+), 2360 deletions(-) diff --git a/examples/index.html b/examples/index.html index 0b697b7d..2a3916e4 100644 --- a/examples/index.html +++ b/examples/index.html @@ -11,7 +11,7 @@ - + @@ -106,14 +106,15 @@

Output

- + + - + @@ -121,7 +122,7 @@

Output

+ diff --git a/src/plugins/bt-checkbox/plugin.js b/src/plugins/bt-checkbox/plugin.js index 7a7311c2..7f811bf9 100644 --- a/src/plugins/bt-checkbox/plugin.js +++ b/src/plugins/bt-checkbox/plugin.js @@ -31,11 +31,7 @@ QueryBuilder.define('bt-checkbox', function(options) { var color = filter.colors[key] || filter.colors._def_ || options.color; var id = name + '_' + (i++); - h.value+= '\ - \ - \ - \ -'; + h.value += `
`; }); } }); diff --git a/src/plugins/bt-tooltip-errors/plugin.js b/src/plugins/bt-tooltip-errors/plugin.js index 68423252..3863078b 100644 --- a/src/plugins/bt-tooltip-errors/plugin.js +++ b/src/plugins/bt-tooltip-errors/plugin.js @@ -16,7 +16,7 @@ QueryBuilder.define('bt-tooltip-errors', function(options) { // add BT Tooltip data this.on('getRuleTemplate.filter getGroupTemplate.filter', function(h) { var $h = $($.parseHTML(h.value)); - $h.find(QueryBuilder.selectors.error_container).attr('data-toggle', 'tooltip'); + $h.find(QueryBuilder.selectors.error_container).attr('data-bs-toggle', 'tooltip'); h.value = $h.prop('outerHTML'); }); diff --git a/src/plugins/filter-description/plugin.js b/src/plugins/filter-description/plugin.js index 472dd328..373f94e2 100644 --- a/src/plugins/filter-description/plugin.js +++ b/src/plugins/filter-description/plugin.js @@ -49,7 +49,7 @@ QueryBuilder.define('filter-description', function(options) { } else { if ($b.length === 0) { - $b = $($.parseHTML('')); + $b = $($.parseHTML('')); $b.prependTo(rule.$el.find(QueryBuilder.selectors.rule_actions)); $b.popover({ @@ -89,7 +89,7 @@ QueryBuilder.define('filter-description', function(options) { } else { if ($b.length === 0) { - $b = $($.parseHTML('')); + $b = $($.parseHTML('')); $b.prependTo(rule.$el.find(QueryBuilder.selectors.rule_actions)); $b.on('click', function() { diff --git a/src/scss/default.scss b/src/scss/default.scss index bc0a4524..4507586a 100644 --- a/src/scss/default.scss +++ b/src/scss/default.scss @@ -45,6 +45,15 @@ $ticks-position: 5px, 10px !default; vertical-align: middle; } +// Bootstrap >3 lacks button-xs +.btn-xs, +.btn-group-xs > .btn { + padding: 1px 5px; + font-size: 12px; + line-height: 1.5; + border-radius: 3px; +} + .query-builder { // GROUPS diff --git a/src/template.js b/src/template.js index d1475745..7385697e 100644 --- a/src/template.js +++ b/src/template.js @@ -2,7 +2,7 @@ QueryBuilder.templates.group = ({ group_id, level, conditions, icons, settings, return `
-
+
@@ -38,7 +38,7 @@ QueryBuilder.templates.rule = ({ rule_id, icons, settings, translate, builder }) return `
-
+
diff --git a/tests/common.js b/tests/common.js index c8a5919d..c4473ed7 100644 --- a/tests/common.js +++ b/tests/common.js @@ -15,7 +15,7 @@ QUnit.begin(function() { */ QUnit.begin(function(){ $('#qunit-header').append( - '
' + + '
' + '' + '' + '' + diff --git a/tests/plugins-gui.module.js b/tests/plugins-gui.module.js index 00a131a1..b7f91fe4 100644 --- a/tests/plugins-gui.module.js +++ b/tests/plugins-gui.module.js @@ -131,9 +131,9 @@ $(function(){ $b.queryBuilder('validate'); assert.equal( - $('#builder_group_0 .error-container').eq(0).data('toggle'), + $('#builder_group_0 .error-container').eq(0).data('bs-toggle'), 'tooltip', - 'Should have added data-toggle="tooltip" in the template' + 'Should have added data-bs-toggle="tooltip" in the template' ); assert.equal( @@ -201,7 +201,7 @@ $(function(){ }); assert.ok( - $('#builder_rule_0 button.filter-description').data('toggle') == 'popover', + $('#builder_rule_0 button.filter-description').data('bs-toggle') == 'popover', 'Rule should contain a new button enabled with Popover' ); @@ -216,7 +216,7 @@ $(function(){ }); assert.ok( - $('#builder_rule_0 button.filter-description').data('toggle') == 'bootbox', + $('#builder_rule_0 button.filter-description').data('bs-toggle') == 'bootbox', 'Rule should contain a new button enabled with Bootbox' ); }); From 60e5e818b3a6dda258f573ac679e4ea0ef4a5e3b Mon Sep 17 00:00:00 2001 From: Stephen Morton Date: Sun, 21 May 2023 12:33:35 -0400 Subject: [PATCH 3/5] Bootstrap 5 - Popover library conversion --- examples/index.html | 4 +++- src/plugins/bt-tooltip-errors/plugin.js | 9 ++++----- src/plugins/filter-description/plugin.js | 12 +++++------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/examples/index.html b/examples/index.html index 00230b0d..fc9f31e5 100644 --- a/examples/index.html +++ b/examples/index.html @@ -123,7 +123,9 @@

Output

- + @@ -146,7 +146,7 @@

Output

plugins: { 'bt-tooltip-errors': { delay: 100 }, 'sortable': null, - 'filter-description': { mode: 'bootbox' }, + // 'filter-description': { mode: 'bootbox' }, 'bt-selectpicker': null, // 'chosen-selectpicker': null, 'unique-filter': null,