Skip to content

Commit

Permalink
0.2.24
Browse files Browse the repository at this point in the history
  • Loading branch information
kprajapatii committed Aug 29, 2024
1 parent 91ccbf2 commit 0a557f4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 26 deletions.
3 changes: 3 additions & 0 deletions change-log.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
= 0.2.24 - 2024-08-29 =
* Changes for search form conditional fields - CHANGED

= 0.2.23 - 2024-08-08 =
* Conditional field set default value changes - CHANGED

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ayecode/wp-ayecode-ui",
"version": "0.2.21",
"version": "0.2.24",
"type": "library",
"description": "A Bootstrap UI for WordPress plugins and themes.",
"keywords": ["bootstrap","boot","ayecode"],
Expand Down
4 changes: 2 additions & 2 deletions example-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
Plugin Name: AyeCode UI
Plugin URI: https://ayecode.io/
Description: This is an example plugin to test AyeCode UI Quickly.
Version: 1.0.0
Version: 0.2.24
Author: AyeCode Ltd
Author URI: https://userswp.io
License: GPL-2.0+
License URI: http://www.gnu.org/licenses/gpl-2.0.txt
Text Domain: ayecode-ui
Domain Path: /languages
Requires at least: 4.9
Tested up to: 5.4
Tested up to: 6.6
*/

// If this file is called directly, abort.
Expand Down
46 changes: 23 additions & 23 deletions includes/ayecode-ui-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AyeCode_UI_Settings {
*
* @var string
*/
public $version = '0.2.23';
public $version = '0.2.24';

/**
* Class textdomain.
Expand Down Expand Up @@ -2975,30 +2975,30 @@ function aui_cf_field_reset_default_value($el, bHide, setVal) {
$el.find('select').val(setVal);
} else {
jQuery.each(setVal, function(i, v) {
$el.find('select').find('option[value="' + v + '"]').attr('selected', true);
$el.find('select').find('option[value="' + v + '"]').prop('selected', true);
});
}
$el.find('select').trigger('change');
break;
case 'checkbox':
if ($el.find('input[type="checkbox"]:checked').length >= 1) {
$el.find('input[type="checkbox"]:checked').prop('checked', false);
if (Array.isArray(setVal)) {
jQuery.each(setVal, function(i, v) {
$el.find('input[type="checkbox"][value="' + v + '"]').attr('checked', true);
});
} else {
$el.find('input[type="checkbox"][value="' + setVal + '"]').attr('checked', true);
}
$el.find('input[type="checkbox"]:checked').prop('checked', false).removeAttr('checked');
}
if (Array.isArray(setVal)) {
jQuery.each(setVal, function(i, v) {
$el.find('input[type="checkbox"][value="' + v + '"]').prop('checked', true);
});
} else {
$el.find('input[type="checkbox"][value="' + setVal + '"]').prop('checked', true);
}
break;
case 'radio':
if ($el.find('input[type="radio"]:checked').length >= 1) {
setTimeout(function() {
$el.find('input[type="radio"]:checked').prop('checked', false);
$el.find('input[type="radio"][value="' + setVal + '"]').attr('checked', true);
}, 100);
}
setTimeout(function() {
if ($el.find('input[type="radio"]:checked').length >= 1) {
$el.find('input[type="radio"]:checked').prop('checked', false).removeAttr('checked');
}
$el.find('input[type="radio"][value="' + setVal + '"]').prop('checked', true);
}, 100);
break;
default:
jQuery(document.body).trigger('aui_cf_field_reset_default_value', type, $el, field);
Expand Down Expand Up @@ -3050,27 +3050,27 @@ function aui_cf_field_in_array(find, item, exact, match) {
* App the field condition action.
*/
function aui_cf_field_apply_action($el, rule, isTrue) {
var $destEl = jQuery('[data-rule-key="' + rule.key + '"]');
var $destEl = jQuery('[data-rule-key="' + rule.key + '"]'), $inputEl = (rule.key && $destEl.find('[name="' + rule.key + '"]').length) ? $destEl.find('[name="' + rule.key + '"]') : null;

if (rule.action === 'show' && isTrue) {
if ($destEl.is(':hidden') && !$destEl.hasClass('aui-cf-skip-reset')) {
if ($destEl.is(':hidden') && !($destEl.hasClass('aui-cf-skip-reset') || ($inputEl && $inputEl.hasClass('aui-cf-skip-reset')))) {
aui_cf_field_reset_default_value($destEl);
}
aui_cf_field_show_element($destEl);
} else if (rule.action === 'show' && !isTrue) {
if ((!$destEl.is(':hidden') || ($destEl.is(':hidden') && ($destEl.hasClass('aui-cf-force-reset') || ($destEl.closest('.aui-cf-use-parent').length && $destEl.closest('.aui-cf-use-parent').is(':hidden'))))) && !$destEl.hasClass('aui-cf-skip-reset')) {
var _setVal = $destEl.hasClass('aui-cf-force-empty') ? '' : null;
if ((!$destEl.is(':hidden') || ($destEl.is(':hidden') && ($destEl.hasClass('aui-cf-force-reset') || ($inputEl && $inputEl.hasClass('aui-cf-skip-reset')) || ($destEl.closest('.aui-cf-use-parent').length && $destEl.closest('.aui-cf-use-parent').is(':hidden'))))) && !($destEl.hasClass('aui-cf-skip-reset') || ($inputEl && $inputEl.hasClass('aui-cf-skip-reset')))) {
var _setVal = $destEl.hasClass('aui-cf-force-empty') || ($inputEl && $inputEl.hasClass('aui-cf-force-empty')) ? '' : null;
aui_cf_field_reset_default_value($destEl, true, _setVal);
}
aui_cf_field_hide_element($destEl);
} else if (rule.action === 'hide' && isTrue) {
if ((!$destEl.is(':hidden') || ($destEl.is(':hidden') && ($destEl.hasClass('aui-cf-force-reset') || ($destEl.closest('.aui-cf-use-parent').length && $destEl.closest('.aui-cf-use-parent').is(':hidden'))))) && !$destEl.hasClass('aui-cf-skip-reset')) {
var _setVal = $destEl.hasClass('aui-cf-force-empty') ? '' : null;
if ((!$destEl.is(':hidden') || ($destEl.is(':hidden') && ($destEl.hasClass('aui-cf-force-reset') || ($inputEl && $inputEl.hasClass('aui-cf-skip-reset')) || ($destEl.closest('.aui-cf-use-parent').length && $destEl.closest('.aui-cf-use-parent').is(':hidden'))))) && !($destEl.hasClass('aui-cf-skip-reset') || ($inputEl && $inputEl.hasClass('aui-cf-skip-reset')))) {
var _setVal = $destEl.hasClass('aui-cf-force-empty') || ($inputEl && $inputEl.hasClass('aui-cf-force-empty')) ? '' : null;
aui_cf_field_reset_default_value($destEl, true, _setVal);
}
aui_cf_field_hide_element($destEl);
} else if (rule.action === 'hide' && !isTrue) {
if ($destEl.is(':hidden') && !$destEl.hasClass('aui-cf-skip-reset')) {
if ($destEl.is(':hidden') && !($destEl.hasClass('aui-cf-skip-reset') || ($inputEl && $inputEl.hasClass('aui-cf-skip-reset')))) {
aui_cf_field_reset_default_value($destEl);
}
aui_cf_field_show_element($destEl);
Expand Down

0 comments on commit 0a557f4

Please sign in to comment.