You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

423 lines
12 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. This file is part of Ext JS 3.4
  3. Copyright (c) 2011-2013 Sencha Inc
  4. Contact: http://www.sencha.com/contact
  5. GNU General Public License Usage
  6. This file may be used under the terms of the GNU General Public License version 3.0 as
  7. published by the Free Software Foundation and appearing in the file LICENSE included in the
  8. packaging of this file.
  9. Please review the following information to ensure the GNU General Public License version 3.0
  10. requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  11. If you are unsure which license is appropriate for your use, please contact the sales department
  12. at http://www.sencha.com/contact.
  13. Build date: 2013-04-03 15:07:25
  14. */
  15. //
  16. // Note that these are all defined as panel configs, rather than instantiated
  17. // as panel objects. You could just as easily do this instead:
  18. //
  19. // var absolute = new Ext.Panel({ ... });
  20. //
  21. // However, by passing configs into the main container instead of objects, we can defer
  22. // layout AND object instantiation until absolutely needed. Since most of these panels
  23. // won't be shown by default until requested, this will save us some processing
  24. // time up front when initially rendering the page.
  25. //
  26. // Since all of these configs are being added into a layout container, they are
  27. // automatically assumed to be panel configs, and so the xtype of 'panel' is
  28. // implicit. To define a config of some other type of component to be added into
  29. // the layout, simply provide the appropriate xtype config explicitly.
  30. //
  31. /*
  32. * ================ Start page config =======================
  33. */
  34. // The default start page, also a simple example of a FitLayout.
  35. var start = {
  36. id: 'start-panel',
  37. title: 'Start Page',
  38. layout: 'fit',
  39. bodyStyle: 'padding:25px',
  40. contentEl: 'start-div' // pull existing content from the page
  41. };
  42. /*
  43. * ================ AbsoluteLayout config =======================
  44. */
  45. var absolute = {
  46. id: 'absolute-panel',
  47. title: 'Absolute Layout',
  48. layout: 'absolute',
  49. defaults: {
  50. bodyStyle: 'padding:15px;',
  51. width: 200,
  52. height: 100,
  53. frame: true
  54. },
  55. items:[{
  56. title: 'Panel 1',
  57. x: 50,
  58. y: 50,
  59. html: 'Positioned at x:50, y:50'
  60. },{
  61. title: 'Panel 2',
  62. x: 125,
  63. y: 125,
  64. html: 'Positioned at x:125, y:125'
  65. }]
  66. };
  67. /*
  68. * ================ AccordionLayout config =======================
  69. */
  70. var accordion = {
  71. id: 'accordion-panel',
  72. title: 'Accordion Layout',
  73. layout: 'accordion',
  74. bodyBorder: false, // useful for accordion containers since the inner panels have borders already
  75. bodyStyle: 'background-color:#DFE8F6', // if all accordion panels are collapsed, this looks better in this layout
  76. defaults: {bodyStyle: 'padding:15px'},
  77. items: [{
  78. title: 'Introduction',
  79. tools: [{id:'gear'},{id:'refresh'}],
  80. html: '<p>Here is some accordion content. Click on one of the other bars below for more.</p>'
  81. },{
  82. title: 'Basic Content',
  83. html: '<br /><p>More content. Open the third panel for a customized look and feel example.</p>',
  84. items: {
  85. xtype: 'button',
  86. text: 'Show Next Panel',
  87. handler: function(){
  88. Ext.getCmp('acc-custom').expand(true);
  89. }
  90. }
  91. },{
  92. id: 'acc-custom',
  93. title: 'Custom Panel Look and Feel',
  94. cls: 'custom-accordion', // look in layout-browser.css to see the CSS rules for this class
  95. html: '<p>Here is an example of how easy it is to completely customize the look and feel of an individual panel simply by adding a CSS class in the config.</p>'
  96. }]
  97. };
  98. /*
  99. * ================ AnchorLayout config =======================
  100. */
  101. var anchor = {
  102. id:'anchor-panel',
  103. title: 'Anchor Layout',
  104. layout:'anchor',
  105. defaults: {bodyStyle: 'padding:15px'},
  106. items: [{
  107. title: 'Panel 1',
  108. height: 100,
  109. anchor: '50%',
  110. html: '<p>Width = 50% of the container</p>'
  111. },{
  112. title: 'Panel 2',
  113. height: 100,
  114. anchor: '-100',
  115. html: '<p>Width = container width - 100 pixels</p>'
  116. },{
  117. title: 'Panel 3',
  118. anchor: '-10, -262',
  119. html: '<p>Width = container width - 10 pixels</p><p>Height = container height - 262 pixels</p>'
  120. }]
  121. };
  122. /*
  123. * ================ BorderLayout config =======================
  124. */
  125. var border = {
  126. id:'border-panel',
  127. title: 'Border Layout',
  128. layout: 'border',
  129. bodyBorder: false,
  130. defaults: {
  131. collapsible: true,
  132. split: true,
  133. animFloat: false,
  134. autoHide: false,
  135. useSplitTips: true,
  136. bodyStyle: 'padding:15px'
  137. },
  138. items: [{
  139. title: 'Footer',
  140. region: 'south',
  141. height: 150,
  142. minSize: 75,
  143. maxSize: 250,
  144. cmargins: '5 0 0 0',
  145. html: '<p>Footer content</p>'
  146. },{
  147. title: 'Navigation',
  148. region:'west',
  149. floatable: false,
  150. margins: '5 0 0 0',
  151. cmargins: '5 5 0 0',
  152. width: 175,
  153. minSize: 100,
  154. maxSize: 250,
  155. html: '<p>Secondary content like navigation links could go here</p>'
  156. },{
  157. title: 'Main Content',
  158. collapsible: false,
  159. region: 'center',
  160. margins: '5 0 0 0',
  161. html: '<h1>Main Page</h1><p>This is where the main content would go</p>'
  162. }]
  163. };
  164. /*
  165. * ================ CardLayout config (TabPanel) =======================
  166. */
  167. // Note that the TabPanel component uses an internal CardLayout -- it is not
  168. // something you have to explicitly configure. However, it is still a perfect
  169. // example of how this layout style can be used in a complex component.
  170. var cardTabs = {
  171. xtype: 'tabpanel',
  172. id: 'card-tabs-panel',
  173. plain: true, //remove the header border
  174. activeTab: 0,
  175. defaults: {bodyStyle: 'padding:15px'},
  176. items:[{
  177. title: 'Tab 1',
  178. html: 'This is tab 1 content.'
  179. },{
  180. title: 'Tab 2',
  181. html: 'This is tab 2 content.'
  182. },{
  183. title: 'Tab 3',
  184. html: 'This is tab 3 content.'
  185. }]
  186. };
  187. // This is a fake CardLayout navigation function. A real implementation would
  188. // likely be more sophisticated, with logic to validate navigation flow. It will
  189. // be assigned next as the handling function for the buttons in the CardLayout example.
  190. var cardNav = function(incr){
  191. var l = Ext.getCmp('card-wizard-panel').getLayout();
  192. var i = l.activeItem.id.split('card-')[1];
  193. var next = parseInt(i, 10) + incr;
  194. l.setActiveItem(next);
  195. Ext.getCmp('card-prev').setDisabled(next==0);
  196. Ext.getCmp('card-next').setDisabled(next==2);
  197. };
  198. /*
  199. * ================ CardLayout config (Wizard) =======================
  200. */
  201. var cardWizard = {
  202. id:'card-wizard-panel',
  203. title: 'Card Layout (Wizard)',
  204. layout:'card',
  205. activeItem: 0,
  206. bodyStyle: 'padding:15px',
  207. defaults: {border:false},
  208. bbar: ['->', {
  209. id: 'card-prev',
  210. text: '&laquo; Previous',
  211. handler: cardNav.createDelegate(this, [-1]),
  212. disabled: true
  213. },{
  214. id: 'card-next',
  215. text: 'Next &raquo;',
  216. handler: cardNav.createDelegate(this, [1])
  217. }],
  218. items: [{
  219. id: 'card-0',
  220. html: '<h1>Welcome to the Demo Wizard!</h1><p>Step 1 of 3</p><p>Please click the "Next" button to continue...</p>'
  221. },{
  222. id: 'card-1',
  223. html: '<p>Step 2 of 3</p><p>Almost there. Please click the "Next" button to continue...</p>'
  224. },{
  225. id: 'card-2',
  226. html: '<h1>Congratulations!</h1><p>Step 3 of 3 - Complete</p>'
  227. }]
  228. };
  229. /*
  230. * ================ ColumnLayout config =======================
  231. */
  232. var column = {
  233. id:'column-panel',
  234. title: 'Column Layout',
  235. layout: 'column',
  236. bodyStyle: 'padding:5px',
  237. defaults: {bodyStyle:'padding:15px'},
  238. items: [{
  239. title: 'Width = 0.25',
  240. columnWidth: 0.25,
  241. html: '<p>This is some short content.</p>'
  242. },{
  243. title: 'Width = 0.75',
  244. columnWidth: 0.75,
  245. html: '<p>This is some longer content.</p><p>This is some longer content.</p><p>This is some longer content.</p><p>This is some longer content.</p><p>This is some longer content.</p><p>This is some longer content.</p>'
  246. },{
  247. title: 'Width = 250px',
  248. width: 250,
  249. html: 'Not much here!'
  250. }]
  251. };
  252. /*
  253. * ================ FitLayout config =======================
  254. */
  255. var fit = {
  256. id: 'fit-panel',
  257. title: 'Fit Layout',
  258. layout: 'fit',
  259. items: {
  260. title: 'Inner Panel',
  261. html: '<p>This panel is fit within its container.</p>',
  262. bodyStyle: 'margin:15px',
  263. border: false
  264. }
  265. };
  266. /*
  267. * ================ FormLayout config =======================
  268. */
  269. // NOTE: While you can create a basic Panel with layout:'form', practically
  270. // you should usually use a FormPanel to also get its form-specific functionality.
  271. // Note that the layout config is not required on FormPanels.
  272. var form = {
  273. xtype: 'form', // since we are not using the default 'panel' xtype, we must specify it
  274. id: 'form-panel',
  275. labelWidth: 75,
  276. title: 'Form Layout',
  277. bodyStyle: 'padding:15px',
  278. width: 350,
  279. labelPad: 20,
  280. layoutConfig: {
  281. labelSeparator: ''
  282. },
  283. defaults: {
  284. width: 230,
  285. msgTarget: 'side'
  286. },
  287. defaultType: 'textfield',
  288. items: [{
  289. fieldLabel: 'First Name',
  290. name: 'first',
  291. allowBlank:false
  292. },{
  293. fieldLabel: 'Last Name',
  294. name: 'last'
  295. },{
  296. fieldLabel: 'Company',
  297. name: 'company'
  298. },{
  299. fieldLabel: 'Email',
  300. name: 'email',
  301. vtype:'email'
  302. }
  303. ],
  304. buttons: [{text: 'Save'},{text: 'Cancel'}]
  305. };
  306. /*
  307. * ================ TableLayout config =======================
  308. */
  309. var table = {
  310. id: 'table-panel',
  311. title: 'Table Layout',
  312. layout: 'table',
  313. layoutConfig: {
  314. columns: 4
  315. },
  316. defaults: {
  317. bodyStyle:'padding:15px 20px'
  318. },
  319. items: [{
  320. title: 'Lots of Spanning',
  321. html: '<p>Row spanning.</p><br /><p>Row spanning.</p><br /><p>Row spanning.</p><br /><p>Row spanning.</p><br /><p>Row spanning.</p><br /><p>Row spanning.</p>',
  322. rowspan: 3
  323. },{
  324. title: 'Basic Table Cell',
  325. html: '<p>Basic panel in a table cell.</p>',
  326. cellId: 'basic-cell',
  327. cellCls: 'custom-cls'
  328. },{
  329. html: '<p>Plain panel</p>'
  330. },{
  331. title: 'Another Cell',
  332. html: '<p>Row spanning.</p><br /><p>Row spanning.</p><br /><p>Row spanning.</p><br /><p>Row spanning.</p>',
  333. width: 300,
  334. rowspan: 2
  335. },{
  336. html: 'Plain cell spanning two columns',
  337. colspan: 2
  338. },{
  339. title: 'More Column Spanning',
  340. html: '<p>Spanning three columns.</p>',
  341. colspan: 3
  342. },{
  343. title: 'Spanning All Columns',
  344. html: '<p>Spanning all columns.</p>',
  345. colspan: 4
  346. }]
  347. };
  348. /*
  349. * ================ VBoxLayout config =======================
  350. */
  351. var vbox = {
  352. id: 'vbox-panel',
  353. title: 'vBox Layout',
  354. layout: {
  355. type: 'vbox',
  356. pack: 'start',
  357. align: 'stretch'
  358. },
  359. defaults: {
  360. frame: true
  361. },
  362. items: [{
  363. title: 'Panel 1',
  364. flex: 1,
  365. html: 'flex : 1'
  366. }, {
  367. title: 'Panel 2',
  368. height: 100,
  369. html: 'height: 100'
  370. }, {
  371. title: 'Panel 3',
  372. flex: 2,
  373. html: 'flex : 2'
  374. }]
  375. };
  376. /*
  377. * ================ HBoxLayout config =======================
  378. */
  379. var hbox = {
  380. id: 'hbox-panel',
  381. title: 'hBox Layout',
  382. layout: {
  383. type: 'hbox',
  384. pack: 'start',
  385. align: 'stretch'
  386. },
  387. defaults: {
  388. frame: true
  389. },
  390. items: [{
  391. title: 'Panel 1',
  392. flex: 1,
  393. html: 'flex : 1'
  394. }, {
  395. title: 'Panel 2',
  396. width: 100,
  397. html: 'width : 100'
  398. }, {
  399. title: 'Panel 3',
  400. flex: 2,
  401. html: 'flex : 2'
  402. }]
  403. };