mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Add FieldDisplayManager.
Refactor admin field show/hide.
This commit is contained in:
parent
d3a02e79c5
commit
0cddf83b9d
13 changed files with 320 additions and 100 deletions
|
@ -1,10 +1,24 @@
|
|||
import FieldDisplayManager from "./common/FieldDisplayManager";
|
||||
import moveWrappedElements from "./common/wrapped-elements";
|
||||
|
||||
document.addEventListener(
|
||||
'DOMContentLoaded',
|
||||
() => {
|
||||
|
||||
// Wait for current execution context to end.
|
||||
setTimeout(function () {
|
||||
moveWrappedElements();
|
||||
}, 0);
|
||||
|
||||
|
||||
// Initialize FieldDisplayManager.
|
||||
const fieldDisplayManager = new FieldDisplayManager();
|
||||
|
||||
jQuery( '*[data-ppcp-display]' ).each( (index, el) => {
|
||||
const rules = jQuery(el).data('ppcpDisplay');
|
||||
for (const rule of rules) {
|
||||
fieldDisplayManager.addRule(rule);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue