├── .gitignore ├── LICENSE.md ├── README.md ├── bower.json ├── demo ├── app │ └── app.js └── index.html ├── dist ├── proton.multi-list-picker.css └── proton.multi-list-picker.min.js ├── gulpfile.js ├── package.json └── src ├── proton.multi-list-picker.js ├── proton.multi-list-picker.scss └── proton.multi-list-picker.xsd /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | *.ipr 4 | *.iws 5 | node_modules/ 6 | bower_components/ 7 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Milad Naseri 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | software and associated documentation files (the "Software"), to deal in the Software 5 | without restriction, including without limitation the rights to use, copy, modify, merge, 6 | publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | to whom the Software is furnished to do so, subject to the following conditions: 8 | 9 | The above copyright notice and this permission notice shall be included in all copies or 10 | substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 16 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 17 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Multi-list Picker 2 | ================= 3 | 4 | ### This project is not being maintained 5 | 6 | Most of the code should work, and it has been tested well enough. However, without any need from my own projects for such component at the time, I simply do not have the time to properly maintain it. If anyone is interested in owning this project, I am more than happy to transfer ownership. 7 | 8 | Meanwhile, you can check out https://github.com/jasonmamy/cordova-wheel-selector-plugin which seems to be a maintained project with some of the same capabilities as this one. 9 | 10 | ## Introduction 11 | 12 | The multi-list picker is a component that lets you pick a value 13 | from a list. Imagine a combobox, but only better. 14 | 15 | The picker helps you define lists that are bound to various properties 16 | of a model and specify the available values. 17 | 18 | Here is a simple example with static values and a single list: 19 | 20 | 21 | 22 | iPhone 5 23 | iPhone 6 24 | iPhone 6 Plus 25 | iPhone 6s 26 | iPhone 6s Plus 27 | iPhone 5se 28 | 29 | 30 | 31 | which results in this list-picker: 32 | 33 | ![list-picker](http://i.imgur.com/0iMxtSb.png) 34 | 35 | This comes with support for scrolling the list to select an item with 36 | momentum and every other thing you would expect to see in a native iOS 37 | list-picker. You can easily change the `attachment` type and other 38 | options on the list-picker to achieve a more sophisticated setting. 39 | 40 | Usage 41 | ----- 42 | 43 | You have to import the following two files into your `index.html`: 44 | 45 | * `dist/proton.multi-list-picker.min.js` 46 | * `dist/proton.multi-list-picker.css` 47 | 48 | and add a dependency to the parent module to your application: 49 | 50 | angular.module('myApplication', [..., 'proton.multi-list-picker']); 51 | 52 | Dependencies 53 | ------------ 54 | 55 | This directive does not have any dependencies whatsoever. The only dependency is 56 | AngularJS itself, and there is a soft dependency on `ngSanitize` if you need HTML 57 | captions. 58 | 59 | Directives 60 | ---------- 61 | 62 | This module comes with multiple, nested directives. 63 | 64 | > ##### Development Tip 65 | > To help you with your development and benefit from IDE completion, and 66 | XSD file is included with detailed instructions on the 67 | directives. To use the XSD, add the following to your `index.html` file: 68 | > 69 | > xmlns:proton="http://github.com/mmnaseri/proton.multi-list-picker" 70 | > 71 | > and if necessary, add a local path, as well. Now, you can use all the directives 72 | > with the benefit of code completion. Just remember to use the *namespace* form 73 | > when using the directives. This means using `` instead 74 | > of `` 75 | 76 | ## proton-multi-list-picker 77 | 78 | This is the root element for defining a multi-list picker component. 79 | 80 | ##### Format 81 | 82 | 87 | : 88 | 89 | 90 | ##### Options 91 | 92 | * `ngModel`: this is to let you bind the top-level object for the list picker 93 | to the directive. 94 | * `attachment` (`enum`, default: `inline`): This attribute will let you define 95 | the attachment type of the component to the screen. Possible values are: 96 | * `inline`: the component will be displayed as an inline block 97 | * `modal`: the component will be displayed as a modal dialog with appropriate 98 | close buttons 99 | * `bottom`: the component will be affixed to the bottom of the screen 100 | * `top`: the component will be affixed to the top of the screen 101 | * `bindHtml` (`boolean`, default: `false`): Whether or not list item labels should 102 | be interpreted as HTML values or normal text. If you set this to `true` you will need 103 | to add a dependency to [`ngSanitize`](https://docs.angularjs.org/api/ngSanitize) to 104 | your application, as the template will internally use [`ngBindHtml`](https://docs.angularjs.org/api/ng/directive/ngBindHtml) 105 | to accomplish proper rendering. 106 | * `done` (`AngularJS Expression`, default: `""`): this expression will be executed with 107 | the value `$model` interpolated with the bound model object (or the resolved model, if no 108 | model is bound) once the `Done` button in the toolbar is clicked. There will be no 109 | toolbar displayed if the attachment is set to `inline`. 110 | 111 | ##### Nested Children 112 | 113 | * ``: to specify a child list 114 | * ``: to specify a divider 115 | 116 | ## proton-multi-list-picker-list 117 | 118 | Let's you define a list for the multi-list picker component. 119 | 120 | ##### Format 121 | 122 | 128 | 129 | 130 | ##### Options 131 | 132 | * `alias` (`string`, default: numerical index of the list): the name of the model 133 | property to which the value of this list is bound. If none is specified, then the 134 | numerical value of the list will be used as the property. In the example above, it 135 | would create a property named `0` in any model bound (or if an array was bound, the 136 | first item would have been set to the value picked via the list). 137 | * `source` (`AngularJS expression`, default: `undefined`): the source for the items 138 | within this list. If nothing is provided, the contents will be used instead. If you 139 | are providing a method, beware that it is going to be called a lot, since we are 140 | watching for changes in the source to update the list picker accordingly. If you 141 | want to disable this feature use `static` binding. 142 | * `static` (`boolean`, default: `false`): Sets the binding type to static so that 143 | once read first, the value of the `source` property is not read again. If you do 144 | not specify a `source` this will be automatically set to `true`. Set this to `true` 145 | if you are providing the items in this list via an AngularJS expression and you know 146 | the contents of the list are not going to change. 147 | * `cycle` (`boolean`, default: `false`): whether the list should *cycle*. If you set 148 | this to `true`, the list will have no end. It will be like working with a circular 149 | dial (thus the name). This means that you will get infinite scrolling on this list. 150 | * `strictMatching` (`boolean`, default: `false`): this property directs the directive 151 | to perform strict label matching when determining the absolute width of a list. Since 152 | setting this to `true` means every item in the list will be tried as a separate HTML 153 | object to account for the width, only set it to `true` if you are experiencing 154 | problems with the width of the list and if the width is changing when you are scrolling 155 | through the items. 156 | 157 | ##### Nested Children 158 | 159 | * ``: use this to specify static items for the 160 | list. If the `` directive specifies a `source` these 161 | items will be completely ignored. Also note that since this is a *static* definition, 162 | you will not benefit from any bindings or other DOM manipulations after the items are 163 | initially scanned. 164 | 165 | ## proton-multi-list-picker-divider 166 | 167 | A divider element between lists. The content of the element will be picked up and 168 | placed in the component. If `bindHtml` is set to `true` on the parent 169 | `proton-multi-list-picker`, it will be treated as HTML content. 170 | 171 | You can leave the content as blank if you want a breaking divider that visually 172 | divides the multi-list picker into two sections. Since the value of the divider 173 | is treated statically, it will not be updated once the picker is rendered. This 174 | means no further DOM manipulations or AngularJS bindings. 175 | 176 | ##### Format 177 | 178 | ... 179 | 180 | ##### Options 181 | 182 | This directive has no options 183 | 184 | ##### Nested Children 185 | 186 | Anything nested within this directive will be treated as the caption for the divider. 187 | 188 | ## proton-multi-list-picker-list-item 189 | 190 | This element let's you define a single list item. The contents of this tag 191 | will be treated as the caption for the item, and if `bindHtml` is set to `true` 192 | on the parent `` it will be treated as HTML. 193 | You will need to specify a `value` attribute if you want to have values 194 | that are different from the inline HTML value of the tag. 195 | 196 | ##### Format 197 | 198 | 200 | ... 201 | 202 | 203 | ##### Options 204 | 205 | * `value` (`string`, default: same as caption): the value bound to this item. This 206 | is the same as specifying a `value` on an `