{"_id":"depends-on-js","_rev":"2-dedea65e6ea9ecaa9705dfaeba364a7d","name":"depends-on-js","dist-tags":{"latest":"1.5.1"},"versions":{"1.5.1":{"name":"depends-on-js","version":"1.5.1","description":"A jQuery plugin to facilitate the handling of form field dependencies.","main":"index.js","repository":{"type":"git","url":"https://github.com/dstreet/dependsOn"},"author":{"name":"dstreet"},"license":"MIT","licenseText":"The MIT License (MIT)\n\nCopyright (c) 2016 David Street\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"depends-on-js@1.5.1","dist":{"shasum":"6354b5d0805564e5f8fbb6699878576c4a30c975","tarball":"https://registry.npmjs.org/depends-on-js/-/depends-on-js-1.5.1.tgz","fileCount":7,"unpackedSize":93783,"integrity":"sha512-xVmsTh9IKKp8GBdPXojt9gy8scsGOa2Ke5VQT68wvM+C/76HcPQjmo8d+vFU7sCVRoDlL4Dt19w3o0Mdkz62Vg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGbU+bwoZpe/TNvmsNG4BnDxw778YlsXRMw/Q5JtguNBAiAPccUWxQ6zWg4F43RX5d/nSBycH8cABbABQE9A2868iQ=="}]},"maintainers":[{"name":"selimchiki","email":"selimchiki@yahoo.fr"}],"_npmUser":{"name":"selimchiki","email":"selimchiki@yahoo.fr"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/depends-on-js_1.5.1_1530965485715_0.5599043088344462"},"_hasShrinkwrap":false}},"time":{"created":"2018-07-07T12:11:25.714Z","1.5.1":"2018-07-07T12:11:25.799Z","modified":"2022-06-15T00:56:38.678Z"},"maintainers":[{"name":"selimchiki","email":"selimchiki@yahoo.fr"}],"description":"A jQuery plugin to facilitate the handling of form field dependencies.","repository":{"type":"git","url":"https://github.com/dstreet/dependsOn"},"author":{"name":"dstreet"},"license":"MIT","readme":"# dependsOn\n[![Support](https://supporterhq.com/api/b/43xsfofk4c2xlijz6mvrx5yga/dependsOn)](https://supporterhq.com/support/43xsfofk4c2xlijz6mvrx5yga/dependsOn)\n\nA jQuery plugin to facilitate the handling of form field dependencies.\n\n$( subject ).dependsOn( dependencySet, [options] );\n\n## Examples\n\n[Demo](http://dstreet.github.com/dependsOn)\n\n## Installation\n\n### with npm\n\n```\nnpm install --save jquery-depends-on\n```\n\n### with Bower\n```\nbower install --save jquery-depends-on\n```\n\n### Download directly\n\n[Latest Release](https://github.com/dstreet/dependsOn/releases/latest)\n\n### Build from source\n```\ngit clone https://github.com/dstreet/dependsOn.git\ncd dependsOn\nnpm install\ngulp\n\n# --> dist/dependsOn.min.js\n```\n\n## Usage\n\n**Include jQuery (requires v1.7 or higher)**\n\n```<script type=\"text/javascript\" src=\"jquery/jquery-1.7.2.min.js\"></script>```\n\n\n**Include dependsOn**\n\n```<script type=\"text/javascript\" src=\"dependsOn.min.js\"></script>```\n\n**Add form components**\n\n```html\n<form id=\"myForm\">\n\t<label for=\"myCheck\">Check Me</label>\n\t<input type=\"checkbox\" id=\"myCheck\">\n\n\t<label for=\"myText\">Input</label>\n\t<input type=\"text\" id=\"myText\" value=\"\">\n</form>\n```\n\n**Activate plugin**\n\n```js\n$('#myText').dependsOn({\n\t// The selector for the depenency\n\t'#myCheck': {\n\t\t// The dependency qualifiers\n\t\tenabled: true,\n\t\tchecked: true\n\t}\n});\n```\n\n## Qualifiers\n\n* `enabled`: (Boolean) If true, then dependency must not have the \"disabled\" attribute.\n* `checked`: (Boolean) If true, then dependency must not have the \"checked\" attribute. Used for checkboxes only.\n* `values`: (Array) Dependency value must equal one of the provided values.\n* `not`: (Array) Dependency value must not equal any of the provided values.\n* `match`: (RegEx) Dependency value must match the regular expression.\n* `notMatch`: (RegEx) Dependency value must not match the regular expression.\n* `contains`: (Array) One of the provided values must be contained in an array of dependency values. Used for select fields with the \"multiple\" attribute.\n* `email`: (Boolean) If true, dependency value must match an email address.\n* `url`: (Boolean) If true, Dependency value must match an URL.\n* `range`: (Array) Dependency value must be within the given range.\n* `Custom`: (Function) Custom function which return true or false.\n\n## Options\n\n* `disable`: (Boolean) Add \"disabled\" attribute to the subject's form field. **Default**: true\n* `readonly`: (Boolean) Add \"readonly\" attribute to the subject's form field. **Default**: false\n* `hide`: (Boolean) Hide the subject on disable and reveal the subject on enable. **Default**: true\n* `duration`: (Number) The time in milliseconds for the fade transition. Used only if `hide` is set to true. **Default**: 200\n* `trigger`: (String) The event used to check dependencies. **Default**: 'change'\n* `onEnable`: (Function) The callback function to execute when the subject has been enabled. **Default**: Empty Function\n* `onDisable`: (Function) The callback function to execute when the subject has been disabled. **Default**: Empty Function\n* `valueOnEnable`: (String) The value to set the subject to when enabled.\n* `valueOnDisable`: (String) The value to set the subject to when disabled.\n* `checkOnEnable`: (Boolean) If true, \"checked\" attribute will be added to subject when enabled. If false, \"checked\" attribute will be removed from subject when enabled. For checkboxes and radio buttons.\n* `checkOnDisable`: (Boolean) If true, \"checked\" attribute will be added to subject when disabled. If false, \"checked\" attribute will be removed from subject when disabled. For checkboxes and radio buttons.\n* `valueTarget`: (String) jQuery selector for the object to you want to target for editing the value. Use if you want to alter the value of something other than the subject.\n* `toggleClass`: (String) The class you wish to be appended to the subject when enabled. The class will be removed when the subject is disabled.\n\n## Callbacks\n\nWhen the `onEnable` and `onDisable` callbacks are called, `this` is set to the last triggered dependency, and the function is passed two arguments:\n* `e`: The triggering event object\n* `$subject`: The jQuery object of the subject\n\n## Other Libraries\n\n* [rails_depends_on](https://github.com/francescob/rails_depends_on) - Rails Gem for dependsOn\n","readmeFilename":"README.md"}