/home/vianto5/duettowers.mx/wp-content/plugins/wpforms/assets/js/admin/builder
NameSizeModeActions
fields/-0755rm
themes/-0755rm
admin-builder-providers.js178180644editdlrm
admin-builder-providers.min.js84540644editdlrm
admin-builder.js3114480644editdlrm
admin-builder.min.js1420590644editdlrm
chocolate-choices.js23340644editdlrm
chocolate-choices.min.js4700644editdlrm
choices-list.js37840644editdlrm
choices-list.min.js7140644editdlrm
context-menu.js185400644editdlrm
context-menu.min.js81830644editdlrm
drag-fields.js247250644editdlrm
drag-fields.min.js96530644editdlrm
dropdown-list.js99920644editdlrm
dropdown-list.min.js38630644editdlrm
email-template.js51440644editdlrm
email-template.min.js14480644editdlrm
field-map.js65920644editdlrm
field-map.min.js23720644editdlrm
form-templates.js198210644editdlrm
form-templates.min.js83010644editdlrm
help.js115720644editdlrm
help.min.js50160644editdlrm
image-upload.js45430644editdlrm
image-upload.min.js20200644editdlrm
multiple-choices.js154180644editdlrm
multiple-choices.min.js63670644editdlrm
panel-loader.js50710644editdlrm
panel-loader.min.js22520644editdlrm
payments-utils.js34930644editdlrm
payments-utils.min.js19630644editdlrm
providers.js355060644editdlrm
providers.min.js127910644editdlrm
search-fields.js46710644editdlrm
search-fields.min.js25080644editdlrm
settings.js114120644editdlrm
settings.min.js48200644editdlrm
setup.js202880644editdlrm
setup.min.js95460644editdlrm
smart-tags.js458990644editdlrm
smart-tags.min.js152750644editdlrm
templates.js40700644editdlrm
templates.min.js10790644editdlrm
wpforms-choicesjs.js81940644editdlrm
wpforms-choicesjs.min.js26310644editdlrm
Edit: /home/vianto5/duettowers.mx/wp-content/plugins/wpforms/assets/js/admin/builder/choices-list.js (3784B)
/** * Checkbox selection functionality. * * @since 1.9.6.1 */ // eslint-disable-next-line no-unused-vars const WPFormsChoicesList = { /** * Creates and returns a checkbox selection manager. * * @since 1.9.6.1 * * @param {jQuery} $container The container element with checkboxes. */ init( $container ) { if ( $container.data( 'choices-list-initialized' ) ) { return; } $container.data( 'choices-list-initialized', true ); // Private variables to store state. const $selectAllCheckbox = $container.find( 'input[value="select-all"]' ); const $itemCheckboxes = $container.find( '.item-checkbox' ); /** * Checks if the container has the necessary elements to initialize. * * @since 1.9.6.1 * * @param {Object} $rootContainer The root container element to query for required elements. * * @return {boolean} True if the root container contains specific elements required for initialization, otherwise false. */ const canInitialize = ( $rootContainer ) => { const hasSelectAll = $rootContainer.find( 'input[value="select-all"]' ).length > 0; const hasItemCheckboxes = $rootContainer.find( '.item-checkbox' ).length > 0; return hasSelectAll && hasItemCheckboxes; }; /** * Updates the state of the "Select All" checkbox based on the current * state of individual item checkboxes. Determines whether all, none, * or some items are selected and updates the "Select All" checkbox. * * @since 1.9.6.1 */ const updateSelectAllState = () => { this.updateSelectAllState( $container ); }; /** * Handles the change event for the "Select All" checkbox. Updates the state * of individual item checkboxes and clears the indeterminate state of the * "Select All" checkbox. * * @since 1.9.6.1 * * @param {Event} event The event object associated with the change event triggered on the "Select All" checkbox. */ const handleSelectAllChange = ( event ) => { const isChecked = jQuery( event.target ).prop( 'checked' ); // Update all item checkboxes. $itemCheckboxes.prop( 'checked', isChecked ); // Clear indeterminate state. $selectAllCheckbox.prop( 'indeterminate', false ); }; /** * Binds event listeners to the "select all" checkbox and item checkboxes. * * @since 1.9.6.1 */ const bindEvents = () => { // Add event listener to "select all" checkbox. $selectAllCheckbox.on( 'change', handleSelectAllChange ); // Add event listeners to item checkboxes. $itemCheckboxes.on( 'change', updateSelectAllState ); }; // Return early if required elements aren't found. if ( ! canInitialize( $container ) ) { return; } // Initialize event bindings. bindEvents(); // Initialize the state. updateSelectAllState(); }, /** * Updates the select all checkbox state based on the current checked state of item checkboxes. * This method can be called from outside the class to refresh the state after DOM changes. * * @since 1.9.6.1 * * @param {jQuery} $container The container element with checkboxes. */ updateSelectAllState( $container ) { const $selectAllCheckbox = $container.find( 'input[value="select-all"]' ); const $itemCheckboxes = $container.find( '.item-checkbox' ); const totalItems = $itemCheckboxes.length; const checkedItems = $itemCheckboxes.filter( ':checked' ).length; if ( checkedItems === 0 ) { // None checked. $selectAllCheckbox.prop( { checked: false, indeterminate: false, } ); } else if ( checkedItems === totalItems ) { // All checked. $selectAllCheckbox.prop( { checked: true, indeterminate: false, } ); } else { // Some checked. $selectAllCheckbox.prop( { checked: false, indeterminate: true, } ); } }, };