From a1a83a1ba31490df51fc193ae56f2f79f4dccf66 Mon Sep 17 00:00:00 2001 From: bdalsass <95754414+bdalsass@users.noreply.github.com> Date: Mon, 30 Oct 2023 08:34:53 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B06651=20-=203.1=20bulk=20modify=20n:n=20l?= =?UTF-8?q?ike=20Tagset:=20checkbox=20ignored=20(#552)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - handle selectize enable/disable to update operation hidden input state - don't execute elements click callback when input disabled - merge current and initial values for the initial value --- .../plugin_combodo_multi_values_synthesis.js | 5 +++++ .../plugin_combodo_update_operations.js | 18 ++++++++++++++++++ .../UI/Links/Set/LinksSetUIBlockFactory.php | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/js/selectize/plugin_combodo_multi_values_synthesis.js b/js/selectize/plugin_combodo_multi_values_synthesis.js index 4c33cf395..aaeebbbb4 100644 --- a/js/selectize/plugin_combodo_multi_values_synthesis.js +++ b/js/selectize/plugin_combodo_multi_values_synthesis.js @@ -154,6 +154,11 @@ Selectize.define("combodo_multi_values_synthesis", function (aOptions) { // Listen item element click event $item.on('click', function(){ + // input disabled + if(oSelf.$input.is(':disabled')){ + return; + } + // If element has operation if(aOperations[sItem] === OPERATIONS.add || aOperations[sItem] === OPERATIONS.remove) { diff --git a/js/selectize/plugin_combodo_update_operations.js b/js/selectize/plugin_combodo_update_operations.js index f8bd73811..e670a0207 100644 --- a/js/selectize/plugin_combodo_update_operations.js +++ b/js/selectize/plugin_combodo_update_operations.js @@ -43,6 +43,24 @@ Selectize.define("combodo_update_operations", function (aOptions) { }; })(); + // Override enable function + oSelf.enable = (function () { + let oOriginal = oSelf.enable; + return function () { + oOriginal.apply(oSelf, arguments); + oSelf.$operationsInput.prop('disabled', false); + } + })(); + + // Override disable function + oSelf.disable = (function () { + let oOriginal = oSelf.disable; + return function () { + oOriginal.apply(oSelf, arguments); + oSelf.$operationsInput.prop('disabled', true); + } + })(); + // Override addItem function oSelf.addItem = (function () { let oOriginal = oSelf.addItem; diff --git a/sources/Application/UI/Links/Set/LinksSetUIBlockFactory.php b/sources/Application/UI/Links/Set/LinksSetUIBlockFactory.php index 96137563b..4f7a5fa07 100644 --- a/sources/Application/UI/Links/Set/LinksSetUIBlockFactory.php +++ b/sources/Application/UI/Links/Set/LinksSetUIBlockFactory.php @@ -81,7 +81,7 @@ class LinkSetUIBlockFactory extends SetUIBlockFactory $oSetUIBlock->GetDataProvider()->SetOptions(array_values($aInitialOptions)); // Set value $oSetUIBlock->SetValue(json_encode($aCurrentValues)); - $oSetUIBlock->SetInitialValue(json_encode($aInitialValues)); + $oSetUIBlock->SetInitialValue(json_encode(array_merge($aInitialValues, $aCurrentValues))); } else { $oSetUIBlock->SetHasError(true); }