From e882c76e69496a36223a1f3323a957ce1660e981 Mon Sep 17 00:00:00 2001 From: Stephen Morton Date: Sun, 21 May 2023 12:58:00 -0400 Subject: [PATCH 01/34] 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 03/34] 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, From 6692f82d62bef2513af560659fcd0b13def7cba7 Mon Sep 17 00:00:00 2001 From: David Ethell Date: Tue, 9 Jan 2024 06:37:28 -0500 Subject: [PATCH 06/34] fix(plugins): bt-checkbox BS5 markup --- src/plugins/bt-checkbox/plugin.js | 8 +------- src/plugins/bt-checkbox/plugin.scss | 12 ------------ 2 files changed, 1 insertion(+), 19 deletions(-) delete mode 100644 src/plugins/bt-checkbox/plugin.scss diff --git a/src/plugins/bt-checkbox/plugin.js b/src/plugins/bt-checkbox/plugin.js index 7f811bf9..9a5b31bb 100644 --- a/src/plugins/bt-checkbox/plugin.js +++ b/src/plugins/bt-checkbox/plugin.js @@ -3,14 +3,9 @@ * @memberof module:plugins * @description Applies Awesome Bootstrap Checkbox for checkbox and radio inputs. * @param {object} [options] - * @param {string} [options.font='glyphicons'] * @param {string} [options.color='default'] */ QueryBuilder.define('bt-checkbox', function(options) { - if (options.font == 'glyphicons') { - this.$el.addClass('bt-checkbox-glyphicons'); - } - this.on('getRuleInput.filter', function(h, rule, name) { var filter = rule.filter; @@ -31,11 +26,10 @@ QueryBuilder.define('bt-checkbox', function(options) { var color = filter.colors[key] || filter.colors._def_ || options.color; var id = name + '_' + (i++); - h.value += `
`; + h.value += `
`; }); } }); }, { - font: 'glyphicons', color: 'default' }); diff --git a/src/plugins/bt-checkbox/plugin.scss b/src/plugins/bt-checkbox/plugin.scss deleted file mode 100644 index 324f610f..00000000 --- a/src/plugins/bt-checkbox/plugin.scss +++ /dev/null @@ -1,12 +0,0 @@ -.query-builder.bt-checkbox-glyphicons { - .checkbox input[type='checkbox']:checked + label::after { - font-family: 'Glyphicons Halflings'; - content: '\e013'; - } - - .checkbox label::after { - padding-left: 4px; - padding-top: 2px; - font-size: 9px; - } -} From 4dd8672ee4ba06748de3ae0acc24d9a735f3200f Mon Sep 17 00:00:00 2001 From: David Ethell Date: Fri, 12 Jan 2024 06:12:47 -0500 Subject: [PATCH 07/34] fix(example): remove bt-selectpicker plugin use --- examples/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/index.html b/examples/index.html index 939d7168..fde4559c 100644 --- a/examples/index.html +++ b/examples/index.html @@ -112,7 +112,7 @@

Output

- + @@ -147,7 +147,7 @@

Output

'bt-tooltip-errors': { delay: 100 }, 'sortable': null, // 'filter-description': { mode: 'bootbox' }, - 'bt-selectpicker': null, + // 'bt-selectpicker': null, // 'chosen-selectpicker': null, 'unique-filter': null, 'bt-checkbox': { color: 'primary' }, From ae3fb1aa74bd6f4b19340e29c825da9dee1195c9 Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 17 Jan 2024 11:19:37 +0000 Subject: [PATCH 08/34] Fix bt-checkbox --- build/jsdoc.md | 2 +- src/plugins/bt-checkbox/plugin.js | 6 ++++++ src/plugins/bt-checkbox/plugin.scss | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/plugins/bt-checkbox/plugin.scss diff --git a/build/jsdoc.md b/build/jsdoc.md index e329af92..04d4a275 100644 --- a/build/jsdoc.md +++ b/build/jsdoc.md @@ -1,4 +1,4 @@ -# [Main documentation](..) +# [Main documentation](..) # Entry point: [$.fn.QueryBuilder](external-_jQuery.fn_.html) diff --git a/src/plugins/bt-checkbox/plugin.js b/src/plugins/bt-checkbox/plugin.js index 9a5b31bb..26b0998f 100644 --- a/src/plugins/bt-checkbox/plugin.js +++ b/src/plugins/bt-checkbox/plugin.js @@ -3,9 +3,14 @@ * @memberof module:plugins * @description Applies Awesome Bootstrap Checkbox for checkbox and radio inputs. * @param {object} [options] + * @param {string} [options.font='bootstrap-icons'] * @param {string} [options.color='default'] */ QueryBuilder.define('bt-checkbox', function(options) { + if (options.font === 'bootstrap-icons') { + this.$el.addClass('bt-checkbox-bootstrap-icons'); + } + this.on('getRuleInput.filter', function(h, rule, name) { var filter = rule.filter; @@ -31,5 +36,6 @@ QueryBuilder.define('bt-checkbox', function(options) { } }); }, { + font: 'bootstrap-icons', color: 'default' }); diff --git a/src/plugins/bt-checkbox/plugin.scss b/src/plugins/bt-checkbox/plugin.scss new file mode 100644 index 00000000..55bea28b --- /dev/null +++ b/src/plugins/bt-checkbox/plugin.scss @@ -0,0 +1,6 @@ +.query-builder.bt-checkbox-bootstrap-icons { + .checkbox input[type='checkbox']:checked + label::after { + font-family: 'bootstrap-icons'; + content: '\F633'; // https://icons.getbootstrap.com/icons/check-lg/ + } +} From 61669d6acf02c15835f4df30871aa9341c27c871 Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 17 Jan 2024 11:20:49 +0000 Subject: [PATCH 09/34] Fix checked squares --- src/plugins/not-group/plugin.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/not-group/plugin.js b/src/plugins/not-group/plugin.js index 9a2b5262..b148b1df 100644 --- a/src/plugins/not-group/plugin.js +++ b/src/plugins/not-group/plugin.js @@ -3,7 +3,7 @@ * @memberof module:plugins * @description Adds a "Not" checkbox in front of group conditions. * @param {object} [options] - * @param {string} [options.icon_checked='bi-square2'] + * @param {string} [options.icon_checked='bi-check2-square'] * @param {string} [options.icon_unchecked='bi-square'] */ QueryBuilder.define('not-group', function(options) { @@ -113,7 +113,7 @@ QueryBuilder.define('not-group', function(options) { }); }, { icon_unchecked: 'bi-square', - icon_checked: 'bi-square2', + icon_checked: 'bi-check2-square', disable_template: false }); From ab1ef49d565e1bd7c59fe85d5f17b74a2050aa71 Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 17 Jan 2024 11:23:37 +0000 Subject: [PATCH 10/34] Latest icons version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ae218070..73393862 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "dependencies": { "bootstrap": "^5.3.0", "@popperjs/core": "^2.11.8", - "bootstrap-icons": "^1.10.5", + "bootstrap-icons": "^1.11.3", "jquery": "^3.5.1", "jquery-extendext": "^1.0.0", "moment": "^2.29.1", From aa70bc8b4b3ea52bd03d29cf1dfbc1e1de3c2f9e Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 17 Jan 2024 11:23:56 +0000 Subject: [PATCH 11/34] better icons --- src/defaults.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/defaults.js b/src/defaults.js index 293cd536..b63b1251 100644 --- a/src/defaults.js +++ b/src/defaults.js @@ -188,9 +188,9 @@ QueryBuilder.DEFAULTS = { icons: { add_group: 'bi-plus-circle-fill', - add_rule: 'bi-plus', - remove_group: 'bi-x', - remove_rule: 'bi-x', + add_rule: 'bi-plus-lg', + remove_group: 'bi-x-lg', + remove_rule: 'bi-x-lg', error: 'bi-exclamation-triangle' } }; From 25153790df5168d9d7343eb5becca10c8555f092 Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 17 Jan 2024 11:24:28 +0000 Subject: [PATCH 12/34] Use local package instead of cdn for icons --- examples/index.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/index.html b/examples/index.html index 743ccc4c..d8838cf4 100644 --- a/examples/index.html +++ b/examples/index.html @@ -8,12 +8,11 @@ - - + From 03b04ec460b08adbfe9a6fd1f9c31be0244702a3 Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 17 Jan 2024 11:25:35 +0000 Subject: [PATCH 13/34] Fix offset for bootstrap 5 --- examples/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/index.html b/examples/index.html index d8838cf4..089e8ac0 100644 --- a/examples/index.html +++ b/examples/index.html @@ -26,7 +26,7 @@
-
+