YetiForceCompany/YetiForceCRM

View on GitHub
public_html/layouts/basic/modules/Vtiger/resources/ChangesJsonModal.min.js.map

Summary

Maintainability
Test Coverage
{"version":3,"file":"ChangesJsonModal.min.js","sources":["ChangesJsonModal.js"],"sourcesContent":["/* {[The file is published on the basis of YetiForce Public License 6.5 that can be found in the following directory: licenses/LicenseEN.txt or yetiforce.com]} */\n'use strict';\n$.Class(\n\t'Base_ChangesJsonModal_JS',\n\t{},\n\t{\n\t\t/**\n\t\t * Register select field\n\t\t */\n\t\tregisterSelectField: function () {\n\t\t\tlet editInstance = Vtiger_Edit_Js.getInstance(this.module);\n\t\t\tlet form = this.container.find('form');\n\t\t\tthis.container.find('.js-changesjson-select').on('change', (e) => {\n\t\t\t\tlet element = $(e.currentTarget);\n\t\t\t\tlet blockElement = element.closest('.js-form-row-container').find('.fieldValue');\n\t\t\t\tlet fieldElement = blockElement.find('[data-validation-engine],[data-invalid-validation-engine]');\n\t\t\t\tlet fieldInfo = fieldElement.data('fieldinfo');\n\t\t\t\tif (element.prop('checked')) {\n\t\t\t\t\tthis.activeFieldValidation(fieldElement);\n\t\t\t\t} else {\n\t\t\t\t\tthis.inactiveFieldValidation(fieldElement);\n\t\t\t\t}\n\t\t\t\tif (fieldInfo !== undefined && fieldInfo.type === 'reference') {\n\t\t\t\t\tlet mapFields = editInstance.getMappingRelatedField(\n\t\t\t\t\t\tfieldInfo.name,\n\t\t\t\t\t\teditInstance.getReferencedModuleName(blockElement),\n\t\t\t\t\t\tform\n\t\t\t\t\t);\n\t\t\t\t\t$.each(mapFields, function (key, _) {\n\t\t\t\t\t\tlet checkboxElement = form.find('[id=\"selectRow' + key + '\"]');\n\t\t\t\t\t\tif (checkboxElement.length && checkboxElement.prop('disabled')) {\n\t\t\t\t\t\t\tcheckboxElement.prop('disabled', false);\n\t\t\t\t\t\t\tcheckboxElement.trigger('click');\n\t\t\t\t\t\t\tcheckboxElement.prop('disabled', true);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t\t/**\n\t\t * Deactivate field validation\n\t\t * @param {jQuery}\n\t\t */\n\t\tinactiveFieldValidation: function (field) {\n\t\t\tfield.validationEngine('hide');\n\t\t\tlet form = field.closest('form');\n\t\t\tlet invalidFields = form.data('jqv').InvalidFields;\n\t\t\tlet fields = [field.get(0)];\n\t\t\tfield.attr('data-invalid-validation-engine', field.attr('data-validation-engine'));\n\t\t\tfield.removeAttr('data-validation-engine');\n\n\t\t\tif (field.is('select') && field.hasClass('select2')) {\n\t\t\t\tlet selectElement = app.getSelect2ElementFromSelect(field);\n\t\t\t\tselectElement.validationEngine('hide');\n\t\t\t\tfields.push(selectElement.get(0));\n\t\t\t}\n\t\t\tfor (let i in fields) {\n\t\t\t\tlet response = jQuery.inArray(fields[i], invalidFields);\n\t\t\t\tif (response != '-1') {\n\t\t\t\t\tinvalidFields.splice(response, 1);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * Activate field validation\n\t\t * @param {jQuery}\n\t\t */\n\t\tactiveFieldValidation: function (field) {\n\t\t\tlet validationVal = field.attr('data-invalid-validation-engine');\n\t\t\tif (typeof validationVal === 'undefined') return;\n\t\t\tfield.attr('data-validation-engine', validationVal);\n\t\t\tfield.removeAttr('data-invalid-validation-engine');\n\t\t},\n\t\t/**\n\t\t * Function to inactive field for validation in a form\n\t\t * this will remove data-validation-engine attr of all the elements\n\t\t */\n\t\tinactiveFieldsValidation: function () {\n\t\t\tlet editFieldList = this.container.find('.js-edit-field-list').data('value');\n\t\t\tlet form = this.container.find('form');\n\t\t\tfor (let fieldName in editFieldList) {\n\t\t\t\tlet fieldInfo = editFieldList[fieldName];\n\n\t\t\t\tlet fieldElement = form.find('[name=\"' + fieldInfo.name + '\"]');\n\t\t\t\tif (fieldInfo.type == 'reference') {\n\t\t\t\t\tfieldElement = form.find('[name=\"' + fieldInfo.name + '_display\"]');\n\t\t\t\t} else if (fieldInfo.type == 'multipicklist' || fieldInfo.type == 'sharedOwner') {\n\t\t\t\t\tfieldElement = form.find('[name=\"' + fieldInfo.name + '[]\"]');\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\tfieldElement.length == 0 ||\n\t\t\t\t\tfieldElement.closest('.js-form-row-container').find('.js-changesjson-select').prop('checked')\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tlet elemData = fieldElement.data();\n\t\t\t\tlet validationVal = 'validate[]';\n\t\t\t\tif ('validationEngine' in elemData) {\n\t\t\t\t\tvalidationVal = elemData.validationEngine;\n\t\t\t\t\tdelete elemData.validationEngine;\n\t\t\t\t}\n\t\t\t\tfieldElement.attr('data-invalid-validation-engine', validationVal);\n\t\t\t\tfieldElement.removeAttr('data-validation-engine');\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * Register change tab\n\t\t */\n\t\tregisterEventForTabClick: function () {\n\t\t\tlet form = this.container.find('form');\n\t\t\tthis.container.on('click', 'a[data-toggle=\"tab\"]', function (e) {\n\t\t\t\tform.validationEngine('validate');\n\t\t\t\tlet invalidFields = form.data('jqv').InvalidFields;\n\t\t\t\tif (invalidFields.length > 0) {\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t\t/**\n\t\t * Register events\n\t\t * @param {jQuery} container\n\t\t */\n\t\tregisterEvents(container) {\n\t\t\tthis.container = container;\n\t\t\tthis.module = container.find('[name=\"module\"]').val();\n\t\t\tthis.container.find('form').validationEngine(app.validationEngineOptions);\n\t\t\tthis.inactiveFieldsValidation();\n\t\t\tthis.registerEventForTabClick();\n\t\t\tthis.registerSelectField();\n\t\t\tVtiger_Edit_Js.getInstance(this.module).registerBasicEvents(container);\n\t\t}\n\t}\n);\n"],"names":["$","Class","registerSelectField","_this","editInstance","Vtiger_Edit_Js","getInstance","module","form","container","find","on","e","element","currentTarget","blockElement","closest","fieldElement","fieldInfo","data","prop","activeFieldValidation","inactiveFieldValidation","type","mapFields","getMappingRelatedField","name","getReferencedModuleName","each","key","checkboxElement","length","trigger","field","validationEngine","invalidFields","InvalidFields","fields","get","attr","removeAttr","is","hasClass","selectElement","app","getSelect2ElementFromSelect","push","i","response","jQuery","inArray","splice","validationVal","inactiveFieldsValidation","editFieldList","fieldName","elemData","registerEventForTabClick","stopPropagation","registerEvents","val","validationEngineOptions","registerBasicEvents"],"mappings":";;AAAA,kKACA,YAAY,CACZA,CAAC,CAACC,KAAK,CACN,0BAA0B,CAC1B,EAAE,CACF;AAED;AACA,KACEC,mBAAmB,CAAE,SAAAA,mBAAAA,EAAY,CAAAC,IAAAA,KAAA,CAC5BC,IAAAA,CAAAA,YAAY,CAAGC,cAAc,CAACC,WAAW,CAAC,IAAI,CAACC,MAAM,CAAC,CACtDC,IAAI,CAAG,IAAI,CAACC,SAAS,CAACC,IAAI,CAAC,MAAM,CAAC,CACtC,IAAI,CAACD,SAAS,CAACC,IAAI,CAAC,wBAAwB,CAAC,CAACC,EAAE,CAAC,QAAQ,CAAE,SAACC,CAAC,CAAK,CAAA,IAC7DC,OAAO,CAAGb,CAAC,CAACY,CAAC,CAACE,aAAa,CAAC,CAC5BC,YAAY,CAAGF,OAAO,CAACG,OAAO,CAAC,wBAAwB,CAAC,CAACN,IAAI,CAAC,aAAa,CAAC,CAC5EO,YAAY,CAAGF,YAAY,CAACL,IAAI,CAAC,2DAA2D,CAAC,CAC7FQ,SAAS,CAAGD,YAAY,CAACE,IAAI,CAAC,WAAW,CAAC,CAM9C,GALIN,OAAO,CAACO,IAAI,CAAC,SAAS,CAAC,CAC1BjB,KAAI,CAACkB,qBAAqB,CAACJ,YAAY,CAAC,CAExCd,KAAI,CAACmB,uBAAuB,CAACL,YAAY,CAAC,CAEvC,KAAAC,CAAAA,GAAAA,SAAuB,EAAuB,WAAW,GAA9BA,SAAS,CAACK,IAAoB,CAAE,CAC9D,IAAIC,SAAS,CAAGpB,YAAY,CAACqB,sBAAsB,CAClDP,SAAS,CAACQ,IAAI,CACdtB,Y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