Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cocreate/conditional-logic

Package Overview
Dependencies
Maintainers
1
Versions
208
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cocreate/conditional-logic - npm Package Compare versions

Comparing version 1.1.29 to 1.2.0

12

CHANGELOG.md

@@ -0,1 +1,13 @@

# [1.2.0](https://github.com/CoCreate-app/CoCreate-conditional-logic/compare/v1.1.29...v1.2.0) (2021-10-14)
### Bug Fixes
* updated dependencies ([40531bd](https://github.com/CoCreate-app/CoCreate-conditional-logic/commit/40531bd7b22011d0f041d3c868c17df92378c93a))
### Features
* supports using as a action. action name is showHide ([5afc8a3](https://github.com/CoCreate-app/CoCreate-conditional-logic/commit/5afc8a327ffa3d5f6e9276d69989f2795045aa69))
## [1.1.29](https://github.com/CoCreate-app/CoCreate-conditional-logic/compare/v1.1.28...v1.1.29) (2021-10-13)

@@ -2,0 +14,0 @@

8

package.json
{
"name": "@cocreate/conditional-logic",
"version": "1.1.29",
"version": "1.2.0",
"description": "Simple JS component show & hide elements conditionally with inputs,checkbox,radio,btn etc.Great for creating tabs, accordions, dynamic forms, etc. Easy Configuration using HTML5 data attributes and/or JavaScript API.",

@@ -64,6 +64,6 @@ "keywords": [

"dependencies": {
"@cocreate/docs": "^1.2.30",
"@cocreate/observer": "^1.3.28",
"@cocreate/utils": "^1.1.29"
"@cocreate/docs": "^1.2.32",
"@cocreate/observer": "^1.3.29",
"@cocreate/utils": "^1.1.31"
}
}

@@ -7,3 +7,3 @@ /*

*/
/*globals CustomEvent, CoCreate*/
import observer from '@cocreate/observer'

@@ -24,8 +24,15 @@

el = el.closest('select');
let actions = el.getAttribute('actions');
if (actions && actions.includes('validate')){
el.removeEventListener('change', selectShowHideEle);
el.removeEventListener('change', selectShowHideEle);
el.removeEventListener("click", clickShowHideEle);
el.addEventListener("change", selectShowHideEle);
el.addEventListener("click", clickShowHideEle);
el.addEventListener("change", selectShowHideEle);
}
else {
el.removeEventListener('change', selectShowHideEle);
el.removeEventListener("click", clickShowHideEle);
el.addEventListener("change", selectShowHideEle);
el.addEventListener("click", clickShowHideEle);
}
}

@@ -55,8 +62,11 @@

function clickShowHideEle(e) {
var show = this.getAttribute('show');
var hide = this.getAttribute('hide');
let tagName = this.tagName.toLowerCase();
let element = e.currentTarget;
if (!element)
element = e;
var show = element.getAttribute('show');
var hide = element.getAttribute('hide');
let tagName = element.tagName.toLowerCase();
if (tagName == 'input' && this.getAttribute("type").toLowerCase() == 'radio') {
let name = this.getAttribute("name");
if (tagName == 'input' && element.getAttribute("type").toLowerCase() == 'radio') {
let name = element.getAttribute("name");
let radios = document.querySelectorAll(tagName + '[name="' + name + '"]');

@@ -99,2 +109,7 @@ for (let radio of radios) {

}
document.dispatchEvent(new CustomEvent('showHide', {
detail: {}
}));
}

@@ -117,3 +132,12 @@

CoCreate.action.init({
action: "showHide",
endEvent: "showHide",
callback: (btn, data) => {
clickShowHideEle(btn);
}
});
const CoCreateConditionalLogic = { initElements, selectShowHideEle, clickShowHideEle };
export default CoCreateConditionalLogic;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc