{"_id":"jquery-bonsai","_rev":"4-42b10e90364be77153e1b4b026d82f84","name":"jquery-bonsai","description":"A lightweight jQuery plugin that takes a big nested list and prunes it down to a small expandable tree control.","dist-tags":{"latest":"2.1.3"},"versions":{"2.1.2":{"name":"jquery-bonsai","version":"2.1.2","description":"A lightweight jQuery plugin that takes a big nested list and prunes it down to a small expandable tree control.","main":"jquery.bonsai.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"dependencies":{"jquery":"*","jquery-qubit":"^2.0.8"},"repository":{"type":"git","url":"git+https://github.com/aexmachina/jquery-bonsai.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/aexmachina/jquery-bonsai/issues"},"homepage":"https://github.com/aexmachina/jquery-bonsai#readme","gitHead":"8a86d8dc843098969cd59ed29e3b6983a97e43d8","_id":"jquery-bonsai@2.1.2","_shasum":"1dd376189178cffe0123a8b62dd6b0c8667c7bfe","_from":".","_npmVersion":"4.0.5","_nodeVersion":"7.4.0","_npmUser":{"name":"aexmachina","email":"simon.wade@gmail.com"},"dist":{"shasum":"1dd376189178cffe0123a8b62dd6b0c8667c7bfe","tarball":"https://registry.npmjs.org/jquery-bonsai/-/jquery-bonsai-2.1.2.tgz","integrity":"sha512-VuVax403l2wDzx0m7v9ZofuU+qHZQHljKpXVVCv41vGARJQhg/4sa3PSHCl74ysgPKvrQqhJUrnenN9AfUGgkw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCv81FxboIyiQgS3tULRJO0jzT03+c2IvH9971kPIqyYAIhAMsvU4Kgh4zvHuOs26U3PguhrMEE7kozuCHOe6aKb24u"}]},"maintainers":[{"name":"aexmachina","email":"simon.wade@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/jquery-bonsai-2.1.2.tgz_1484616453431_0.14764203852973878"}},"2.1.3":{"name":"jquery-bonsai","version":"2.1.3","description":"A lightweight jQuery plugin that takes a big nested list and prunes it down to a small expandable tree control.","main":"jquery.bonsai.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"dependencies":{"jquery":"*","jquery-qubit":"^2.0.8"},"repository":{"type":"git","url":"git+https://github.com/aexmachina/jquery-bonsai.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/aexmachina/jquery-bonsai/issues"},"homepage":"https://github.com/aexmachina/jquery-bonsai#readme","gitHead":"67347bfe88dfa42ac0687634e976f287fdb984e6","_id":"jquery-bonsai@2.1.3","_npmVersion":"5.5.1","_nodeVersion":"9.3.0","_npmUser":{"name":"aexmachina","email":"simon.wade@gmail.com"},"dist":{"integrity":"sha512-NtSKC4X6Zg9g7RRLtL7u1MKTLqa/JcjiXFS9YZmdoL6yreLiFc63adKFPPSMZ0aLOGW7N8wqKFc6QUkvoLifXg==","shasum":"50702e083dd2394d0eecb9f6c73923aa9ed3009e","tarball":"https://registry.npmjs.org/jquery-bonsai/-/jquery-bonsai-2.1.3.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC40iGo6+hhxIQxt8s9K55Le559UAmn99FjhtGtGsKGeAiEA0WuzDTEKj8qwcUPsV5PTlmXd8bQJNou6wCu88ZGVCLY="}]},"maintainers":[{"name":"aexmachina","email":"simon.wade@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/jquery-bonsai-2.1.3.tgz_1515368892823_0.05171786551363766"}}},"readme":"# jQuery Bonsai\n\n#### [Visit project page and demos](http://simonwade.me/jquery-bonsai)\n\n`jquery-bonsai` is a lightweight jQuery plugin that takes a big nested list and prunes it down to a small expandable \ntree control.\n\nAlso includes support for checkboxes (including 'indeterminate' state) and for populating the tree using a JSON data source.\n\nSee [http://simonwade.me/jquery-bonsai/](http://simonwade.me/jquery-bonsai/) for more information.\n\n## Installation\nbower\n```\nbower install jquery-bonsai --save\n```\n\nnpm\n```\nnpm install jquery-bonsai --save\n```\n\n## Usage\n\n```\n$('ul#my-nested-list').bonsai();\n```\n\n## API\n\n### `$.fn.bonsai(options)`\n\n```js\n$('#list').bonsai({\n  expandAll: false, // expand all items\n  expand: null, // optional function to expand an item\n  collapse: null, // optional function to collapse an item\n  addExpandAll: false, // add a link to expand all items\n  addSelectAll: false, // add a link to select all checkboxes\n  selectAllExclude: null, // a filter selector or function for selectAll\n  idAttribute: 'id', // which attribute of the list items to use as an id\n\n  // createInputs: create checkboxes or radio buttons for each list item\n  // using a value of \"checkbox\" or \"radio\".\n  //\n  // The id, name and value for the inputs can be declared in the\n  // markup using `data-id`, `data-name` and `data-value`.\n  //\n  // The name is inherited from parent items if not specified.\n  //\n  // Checked state can be indicated using `data-checked`.\n  createInputs: false,\n  // checkboxes: run qubit(this.options) on the root node (requires jquery.qubit)\n  checkboxes: false,\n  // handleDuplicateCheckboxes: update any other checkboxes that\n  // have the same value\n  handleDuplicateCheckboxes: false\n});\n```\n\n### `Bonsai#update()`\n\nIf the DOM changes then you'll need to call `#update`:\n\n```js\n$('#list').bonsai('update');\n```\n\n### `Bonsai#listItem(id)`\n\nReturn a jQuery object containing the `<li>` with the specified `id`.\n\n### Expanding/collapsing a single items\n\n- `Bonsai#expand(listItem)`\n- `Bonsai#collapse(listItem)`\n- `Bonsai#toggle(listItem)`\n- `Bonsai#expandTo(listItem)`\n\n```js\nvar bonsai = $('#list').data('bonsai');\nbonsai.expand(listItem);\n```\n\nAll of these methods accept either a DOMElement, a jQuery object or an `id` and return a \njQuery object containing the list item.\n\n### Expanding/collapsing the whole tree\n\n- `Bonsai#expandAll(listItem)`\n- `Bonsai#collapseAll(listItem)`\n\n### `Bonsai#serialize()`\n\nReturns an object representing the expanded/collapsed state of the list, using the items' id\nto identify the list items.\n\n```js\nvar bonsai = $('#list').data('bonsai');\nvar state = bonsai.serialize();\n```\n\n### `Bonsai#restore()`\n\nRestores the expanded/collapsed state of the list using the return value of `#serialize()`.\n\n```js\nvar bonsai = $('#list').data('bonsai');\nvar state = bonsai.serialize();\n// do stuff that changes the DOM, and may not retain collapsed state\nbonsai.update(); // update to handle any new DOM elements\nbonsai.restore(state); // restores the collapsed state\n```\n","maintainers":[{"name":"aexmachina","email":"simon.wade@gmail.com"}],"time":{"modified":"2022-06-19T04:59:09.218Z","created":"2017-01-17T01:27:35.098Z","2.1.2":"2017-01-17T01:27:35.098Z","2.1.3":"2018-01-07T23:48:12.916Z"},"homepage":"https://github.com/aexmachina/jquery-bonsai#readme","repository":{"type":"git","url":"git+https://github.com/aexmachina/jquery-bonsai.git"},"bugs":{"url":"https://github.com/aexmachina/jquery-bonsai/issues"},"license":"MIT","readmeFilename":"README.md"}