Sid Gifari File Manager
🏠 Root
/
home2
/
meumer25
/
www
/
wp-content
/
plugins
/
wpforms-lite
/
assets
/
js
/
admin
/
builder
/
modules
/
undo-redo
/
Editing: input-toggle.min.js
export default function(e,t,o){class n extends WPForms.Admin.Builder.UndoRedoInputCommandBase.get(){static id="ToggleChangeCommand";constructor(e,t,o,n){super(e,t,o),this.args=n,this.$settingsStatusButton=e.siblings(i.sel.settingsStatusButton)}applyValue(e){i.preventRecordingCommand=!0;var t,o=this.getElement();this.$settingsStatusButton?.length?(t=Number(e)?1:0,o.val(t).attr("value",t),WPFormsBuilder.changeStatusButton(this.$settingsStatusButton,Boolean(t))):o.prop("checked",e).trigger("change"),!0===e&&this.args.$trackConditionalBlock?.length&&(t=o.closest(i.sel.conditionalBlock),i.UndoRedoHelpers.replaceDOMElementContent(t,this.args.$trackConditionalBlock)),i.preventRecordingCommand=!1}canMerge(){return!1}getActionName(){var e,t,o;return this.actionName||(e=i.UndoRedoHelpers.getSectionTitle(this.$input),this.$settingsStatusButton=this.$settingsStatusButton??this.$input.siblings(i.sel.settingsStatusButton),((t=i.getSettingsStatusButtonLabel(this.$settingsStatusButton,this.newValue))?.length?[wp.i18n.__("Set","wpforms"),e,i.actionNameSeparator,t]:(t=this.newValue?wp.i18n.__("On","wpforms"):wp.i18n.__("Off","wpforms"),o=(o=(o=i.getToggleInputLabel(this.$input))?.length?o:i.getDayLimitInputLabel(this.$input))?.length?o:i.getSettingsCheckboxInputLabel(this.$input),[wp.i18n.__("Set","wpforms"),e,i.actionNameSeparator,o,t])).filter(Boolean).join(" "))}}let i={el:{},sel:{inputToggle:'input[type="checkbox"]:not( .choices-list input.default )',settingsStatusButton:".wpforms-builder-settings-block-status",conditionalBlock:".wpforms-conditional-block"},undoManager:null,init(){i.setup(),i.el.$builder.on("wpformsBuilderReady",_.debounce(i.ready,250))},setup(){i.el.$document=o(e),i.el.$builder=o("#wpforms-builder")},ready(){try{i.UndoRedo=WPForms.Admin.Builder.UndoRedo,i.UndoRedoHelpers=WPForms.Admin.Builder.UndoRedoHelpers,i.undoManager=i.UndoRedo.undoManager,i.actionNameSeparator=i.UndoRedo.config.actionNameSeparator,i.el={...i.el,...i.UndoRedo.el}}catch(e){return void wpf.debug("UndoRedoInputToggle: Dependency modules are not available.")}i.UndoRedo.registerCommand(n),i.events()},events(){i.el.$document.on("mousedown",".wpforms-toggle-control",i.onToggleMousedown).on("change",i.sel.inputToggle,i.onToggleChange),i.el.$builder.on("WPFormsChangeStatusButton",i.onSettingsStatusButton).on("wpformsDisableConditionalLogicCanceled",i.onDisableConditionalLogicCanceled)},onToggleMousedown(e){e=o(e.currentTarget).find(i.sel.inputToggle);e.attr("name")?.includes("[conditional_logic]")&&e.is(":checked")?(i.$trackConditionalBlock=e.closest(i.sel.conditionalBlock),i.UndoRedoHelpers.getCurrentContainer(i.$trackConditionalBlock)):i.$trackConditionalBlock=null},onToggleChange(e){i.preventRecordingCommand||i.UndoRedo.isRecordPrevented()||(e=o(e.target),i.recordCommand(e))},onSettingsStatusButton(e,t){i.preventRecordingCommand||i.UndoRedo.isRecordPrevented()||(t=t.siblings("input"),i.recordCommand(t))},onDisableConditionalLogicCanceled(e,t){var o=i.UndoRedo.lastExecuted?.command;o instanceof n&&o?.$input.attr("id")===t.attr("id")&&o.args.$trackConditionalBlock?.length&&i.UndoRedo.revertRun()},recordCommand(e){let t,o;e.siblings(".wpforms-builder-settings-block-status").length?(o=Number(e.val()),t=1===o?0:1):(t=e.is(":checked"),o=!t);var n={},e=(i.$trackConditionalBlock?.length&&(n.$trackConditionalBlock=i.UndoRedoHelpers.getTrackedContainer(i.$trackConditionalBlock),i.$trackConditionalBlock=null),i.UndoRedo.getCommand("ToggleChangeCommand",e,o,t,n));i.UndoRedo.record(e)},getToggleInputLabel(e){let t=e.siblings(".wpforms-toggle-control-label").text().trim();var e=e.closest(".wpforms-field-header");return e.length&&(e=e.find("label").first().text().trim(),t=[e,i.UndoRedo.config.actionNameSeparator,t].filter(Boolean).join(" ")),t},getDayLimitInputLabel(e){var t=e.closest(".wpforms-field-option-row").prev(".wpforms-field-option-row").find(".wpforms-toggle-control-label").text().trim(),e=e.closest(".sub-label").text().trim();return(t+e)?.length?[t,i.UndoRedo.config.actionNameSeparator,e].filter(Boolean).join(" "):""},getSettingsCheckboxInputLabel(e){var t=e.closest(".wpforms-panel-field").prevAll(".wpforms-panel-fields-group").first().find(".wpforms-panel-fields-group-title").text().trim(),e=e.siblings("label").text().trim();let o=i.UndoRedo.config.actionNameSeparator;return[t,o=t?.length&&e?.length?o:"",e].filter(Boolean).join(" ")},getSettingsStatusButtonLabel(e,t){return e?.length?(e=wp.i18n.__("Settings block","wpforms"),t=t?wp.i18n.__("Active","wpforms"):wp.i18n.__("Inactive","wpforms"),[e,i.actionNameSeparator,t].filter(Boolean).join(" ")):""}};return i}
Save
Cancel