Skip to content

Commit d223c51

Browse files
committed
feat(picker): new picker snippets
1 parent 8a35539 commit d223c51

File tree

2 files changed

+84
-1
lines changed

2 files changed

+84
-1
lines changed

Diff for: README.md

+4
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,10 @@ Type part of a snippet, press enter, and the snippet unfolds.
239239
| `i-modal` | Ionic modal dialog method |
240240
| `i-modal-will-dismiss` | Ionic modal dialog method wit `onWillDismiss` |
241241
| `i-modal-ctrl` | Ionic ModalController |
242+
| `i-picker` | Ionic Picker |
243+
| `i-picker-colum` | Ionic Picker Column |
244+
| `i-picker-option` | Ionic Picker Option |
245+
| `i-picker-ctrl` | Ionic PickerController |
242246
| `i-popover` | Ionic popover dialog method |
243247
| `i-popover-ctrl` | Ionic PopoverController |
244248
| `i-on-did-dismiss` | Ionic `onDidDismiss` for dialogs |

Diff for: snippets/angular/typescript.json

+80-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
"ion-ctrl-import": {
131131
"prefix": "i-ctrl-import",
132132
"body": [
133-
"import { ${1|ActionSheetController,AlertController,LoadingController,ModalController,ToastController,PopoverController|} } from '@ionic/angular';"
133+
"import { ${1|ActionSheetController,AlertController,LoadingController,ModalController,ToastController,PopoverController,PickerController|} } from '@ionic/angular';"
134134
],
135135
"description": "Imports from @ionic/angular package"
136136
},
@@ -225,6 +225,85 @@
225225
],
226226
"description": "Ionic ModalController"
227227
},
228+
"ion-picker": {
229+
"prefix": "i-picker",
230+
"body": [
231+
"async ${1:presentPicker}() {",
232+
"\tconst ${2:picker} = await this.${3:pickerController}.create({",
233+
"\tanimated: ${4:true},",
234+
"\tbuttons: [{",
235+
"\t\ttext: '${5:Save}',",
236+
"\t\thandler: () => console.log('Clicked Save!')",
237+
"\t}, {",
238+
"\t\ttext: '${6:Log}',",
239+
"\t\thandler: (val) => {",
240+
"\t\t\tconsole.log('Clicked Log. Do not Dismiss.', val);",
241+
"\t\t\treturn false;",
242+
"\t\t}",
243+
"\t}],",
244+
"\tcolumns: [",
245+
"\t\t{",
246+
"\t\t\tname: '${7:hours}',",
247+
"\t\t\tprefix: '${8:total}',",
248+
"\t\t\tsuffix: '${9:hours}',",
249+
"\t\t\toptions: [",
250+
"\t\t\t\t{",
251+
"\t\t\t\t\ttext: '${10:1}',",
252+
"\t\t\t\t\tvalue: '${11:01}'",
253+
"\t\t\t\t},",
254+
"\t\t\t\t{",
255+
"\t\t\t\t\ttext: '${12:2}',",
256+
"\t\t\t\t\tvalue: '${13:02}'",
257+
"\t\t\t\t}",
258+
"\t\t\t]",
259+
"\t\t}",
260+
"\t],",
261+
"\tcssClass: '${14:picker-hours}',",
262+
"\tmode: '${15|ios,md|}',",
263+
"\t});",
264+
"\t${2:picker}.present();",
265+
"}"
266+
],
267+
"description": "Ionic Picker"
268+
},
269+
"ion-picker-column": {
270+
"prefix": "i-picker-column",
271+
"body": [
272+
"{",
273+
"\tname: '${1:hours}',",
274+
"\tprefix: '${2:total}',",
275+
"\tsuffix: '${3:hours}',",
276+
"\toptions: [",
277+
"\t\t{",
278+
"\t\t\ttext: '${4:1}',",
279+
"\t\t\tvalue: '${5:01}'",
280+
"\t\t},",
281+
"\t\t{",
282+
"\t\t\ttext: '${6:2}',",
283+
"\t\t\tvalue: '${7:02}'",
284+
"\t\t}",
285+
"\t]",
286+
"}"
287+
],
288+
"description": "Ionic Picker Column"
289+
},
290+
"ion-picker-options": {
291+
"prefix": "i-picker-options",
292+
"body": [
293+
"{",
294+
"\ttext: '${1:1}',",
295+
"\tvalue: '${2:01}'",
296+
"}"
297+
],
298+
"description": "Ionic Picker Options"
299+
},
300+
"ion-picker-ctrl": {
301+
"prefix": "i-picker-ctrl",
302+
"body": [
303+
"public ${1:pickerController}: PickerController"
304+
],
305+
"description": "Ionic PickerController"
306+
},
228307
"ion-popover": {
229308
"prefix": "i-popover",
230309
"body": [

0 commit comments

Comments
 (0)