]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | /**\r |
2 | * This example shows how to use the three types of Color Picker.\r | |
3 | *\r | |
4 | * The "colorbutton" is a small color swatch in the panel header.\r | |
5 | * This displays the color as a small swatch and on click shows the\r | |
6 | * "colorselector". This window also has the "colorselector" as a\r | |
7 | * hidden item that is revealed by pressing the "More" button.\r | |
8 | *\r | |
9 | * The "colorfield" is a combobox-like picker that shows the color\r | |
10 | * as a swatch and hex value.\r | |
11 | */\r | |
12 | Ext.define('KitchenSink.view.form.ColorPicker', {\r | |
13 | extend: 'Ext.panel.Panel',\r | |
14 | xtype: 'form-color-picker',\r | |
15 | controller: 'form-color-picker',\r | |
16 | //<example>\r | |
17 | requires: [\r | |
18 | 'Ext.ux.colorpick.*'\r | |
19 | ],\r | |
20 | otherContent: [{\r | |
21 | type: 'Controller',\r | |
22 | path: 'classic/samples/view/form/ColorPickerController.js'\r | |
23 | }],\r | |
24 | \r | |
25 | exampleTitle: 'Color Picker',\r | |
26 | //</example>\r | |
27 | \r | |
28 | title: 'Color Picker Components',\r | |
29 | bodyPadding: 5,\r | |
30 | frame: true,\r | |
31 | resizable: true,\r | |
32 | width: 600,\r | |
33 | minWidth: 550,\r | |
34 | layout: {\r | |
35 | type: 'vbox',\r | |
36 | align: 'stretch'\r | |
37 | },\r | |
38 | \r | |
39 | viewModel: {\r | |
40 | data: {\r | |
41 | color: '#0f0',\r | |
42 | full: false\r | |
43 | }\r | |
44 | },\r | |
45 | \r | |
46 | header: {\r | |
47 | items: [{\r | |
48 | xtype: 'component',\r | |
49 | cls: 'x-panel-header-title-default-framed',\r | |
50 | html: 'colorbutton ⇨'\r | |
51 | },{\r | |
52 | xtype: 'colorbutton',\r | |
53 | bind: '{color}',\r | |
54 | width: 15,\r | |
55 | height: 15,\r | |
56 | listeners: {\r | |
57 | change: 'onChange'\r | |
58 | }\r | |
59 | }]\r | |
60 | },\r | |
61 | \r | |
62 | items: [{\r | |
63 | xtype: 'colorfield',\r | |
64 | fieldLabel: 'Color Field',\r | |
65 | labelWidth: 75,\r | |
66 | bind: '{color}',\r | |
67 | listeners: {\r | |
68 | change: 'onChange'\r | |
69 | }\r | |
70 | },{\r | |
71 | xtype: 'colorselector',\r | |
72 | hidden: true,\r | |
73 | flex: 1,\r | |
74 | bind: {\r | |
75 | value: '{color}',\r | |
76 | visible: '{full}'\r | |
77 | }\r | |
78 | }],\r | |
79 | \r | |
80 | buttons: [{\r | |
81 | text: 'Show colorselector >>',\r | |
82 | bind: {\r | |
83 | visible: '{!full}'\r | |
84 | },\r | |
85 | value: true,\r | |
86 | listeners: {\r | |
87 | click: 'onShowMoreLess'\r | |
88 | }\r | |
89 | },{\r | |
90 | text: 'Hide colorselector <<',\r | |
91 | bind: {\r | |
92 | visible: '{full}'\r | |
93 | },\r | |
94 | value: false,\r | |
95 | listeners: {\r | |
96 | click: 'onShowMoreLess'\r | |
97 | }\r | |
98 | }]\r | |
99 | });\r |