mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Refactor DisplayManager for admin field display rules centralization.
This commit is contained in:
parent
93f7e5dca6
commit
e31e09f0c7
20 changed files with 619 additions and 273 deletions
|
@ -0,0 +1,35 @@
|
|||
import BaseAction from "./BaseAction";
|
||||
|
||||
class ElementAction extends BaseAction {
|
||||
|
||||
run(status) {
|
||||
|
||||
if (status) {
|
||||
if (this.config.action === 'visible') {
|
||||
jQuery(this.config.selector).removeClass('ppcp-field-hidden');
|
||||
}
|
||||
if (this.config.action === 'enable') {
|
||||
jQuery(this.config.selector).removeClass('ppcp-field-disabled')
|
||||
.off('mouseup')
|
||||
.find('> *')
|
||||
.css('pointer-events', '');
|
||||
}
|
||||
} else {
|
||||
if (this.config.action === 'visible') {
|
||||
jQuery(this.config.selector).addClass('ppcp-field-hidden');
|
||||
}
|
||||
if (this.config.action === 'enable') {
|
||||
jQuery(this.config.selector).addClass('ppcp-field-disabled')
|
||||
.on('mouseup', function(event) {
|
||||
event.stopImmediatePropagation();
|
||||
})
|
||||
.find('> *')
|
||||
.css('pointer-events', 'none');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default ElementAction;
|
Loading…
Add table
Add a link
Reference in a new issue