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.

138 lines
5.4 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js"><span id='Ext-menu-DateMenu'>/**
  19. </span> * @class Ext.menu.DateMenu
  20. * @extends Ext.menu.Menu
  21. * &lt;p&gt;A menu containing an {@link Ext.DatePicker} Component.&lt;/p&gt;
  22. * &lt;p&gt;Notes:&lt;/p&gt;&lt;div class=&quot;mdetail-params&quot;&gt;&lt;ul&gt;
  23. * &lt;li&gt;Although not listed here, the &lt;b&gt;constructor&lt;/b&gt; for this class
  24. * accepts all of the configuration options of &lt;b&gt;{@link Ext.DatePicker}&lt;/b&gt;.&lt;/li&gt;
  25. * &lt;li&gt;If subclassing DateMenu, any configuration options for the DatePicker must be
  26. * applied to the &lt;tt&gt;&lt;b&gt;initialConfig&lt;/b&gt;&lt;/tt&gt; property of the DateMenu.
  27. * Applying {@link Ext.DatePicker DatePicker} configuration settings to
  28. * &lt;b&gt;&lt;tt&gt;this&lt;/tt&gt;&lt;/b&gt; will &lt;b&gt;not&lt;/b&gt; affect the DatePicker's configuration.&lt;/li&gt;
  29. * &lt;/ul&gt;&lt;/div&gt;
  30. * @xtype datemenu
  31. */
  32. Ext.menu.DateMenu = Ext.extend(Ext.menu.Menu, {
  33. <span id='Ext-menu-DateMenu-cfg-enableScrolling'> /**
  34. </span> * @cfg {Boolean} enableScrolling
  35. * @hide
  36. */
  37. enableScrolling : false,
  38. <span id='Ext-menu-DateMenu-cfg-handler'> /**
  39. </span> * @cfg {Function} handler
  40. * Optional. A function that will handle the select event of this menu.
  41. * The handler is passed the following parameters:&lt;div class=&quot;mdetail-params&quot;&gt;&lt;ul&gt;
  42. * &lt;li&gt;&lt;code&gt;picker&lt;/code&gt; : DatePicker&lt;div class=&quot;sub-desc&quot;&gt;The Ext.DatePicker.&lt;/div&gt;&lt;/li&gt;
  43. * &lt;li&gt;&lt;code&gt;date&lt;/code&gt; : Date&lt;div class=&quot;sub-desc&quot;&gt;The selected date.&lt;/div&gt;&lt;/li&gt;
  44. * &lt;/ul&gt;&lt;/div&gt;
  45. */
  46. <span id='Ext-menu-DateMenu-cfg-scope'> /**
  47. </span> * @cfg {Object} scope
  48. * The scope (&lt;tt&gt;&lt;b&gt;this&lt;/b&gt;&lt;/tt&gt; reference) in which the &lt;code&gt;{@link #handler}&lt;/code&gt;
  49. * function will be called. Defaults to this DateMenu instance.
  50. */
  51. <span id='Ext-menu-DateMenu-cfg-hideOnClick'> /**
  52. </span> * @cfg {Boolean} hideOnClick
  53. * False to continue showing the menu after a date is selected, defaults to true.
  54. */
  55. hideOnClick : true,
  56. <span id='Ext-menu-DateMenu-cfg-pickerId'> /**
  57. </span> * @cfg {String} pickerId
  58. * An id to assign to the underlying date picker. Defaults to &lt;tt&gt;null&lt;/tt&gt;.
  59. */
  60. pickerId : null,
  61. <span id='Ext-menu-DateMenu-cfg-maxHeight'> /**
  62. </span> * @cfg {Number} maxHeight
  63. * @hide
  64. */
  65. <span id='Ext-menu-DateMenu-cfg-scrollIncrement'> /**
  66. </span> * @cfg {Number} scrollIncrement
  67. * @hide
  68. */
  69. <span id='Ext-menu-DateMenu-property-picker'> /**
  70. </span> * The {@link Ext.DatePicker} instance for this DateMenu
  71. * @property picker
  72. * @type DatePicker
  73. */
  74. cls : 'x-date-menu',
  75. <span id='Ext-menu-DateMenu-event-click'> /**
  76. </span> * @event click
  77. * @hide
  78. */
  79. <span id='Ext-menu-DateMenu-event-itemclick'> /**
  80. </span> * @event itemclick
  81. * @hide
  82. */
  83. initComponent : function(){
  84. this.on('beforeshow', this.onBeforeShow, this);
  85. if(this.strict = (Ext.isIE7 &amp;&amp; Ext.isStrict)){
  86. this.on('show', this.onShow, this, {single: true, delay: 20});
  87. }
  88. Ext.apply(this, {
  89. plain: true,
  90. showSeparator: false,
  91. items: this.picker = new Ext.DatePicker(Ext.applyIf({
  92. internalRender: this.strict || !Ext.isIE9m,
  93. ctCls: 'x-menu-date-item',
  94. id: this.pickerId
  95. }, this.initialConfig))
  96. });
  97. this.picker.purgeListeners();
  98. Ext.menu.DateMenu.superclass.initComponent.call(this);
  99. <span id='Ext-menu-DateMenu-event-select'> /**
  100. </span> * @event select
  101. * Fires when a date is selected from the {@link #picker Ext.DatePicker}
  102. * @param {DatePicker} picker The {@link #picker Ext.DatePicker}
  103. * @param {Date} date The selected date
  104. */
  105. this.relayEvents(this.picker, ['select']);
  106. this.on('show', this.picker.focus, this.picker);
  107. this.on('select', this.menuHide, this);
  108. if(this.handler){
  109. this.on('select', this.handler, this.scope || this);
  110. }
  111. },
  112. <span id='Ext-menu-DateMenu-method-menuHide'> menuHide : function() {
  113. </span> if(this.hideOnClick){
  114. this.hide(true);
  115. }
  116. },
  117. <span id='Ext-menu-DateMenu-method-onBeforeShow'> onBeforeShow : function(){
  118. </span> if(this.picker){
  119. this.picker.hideMonthPicker(true);
  120. }
  121. },
  122. <span id='Ext-menu-DateMenu-method-onShow'> onShow : function(){
  123. </span> var el = this.picker.getEl();
  124. el.setWidth(el.getWidth()); //nasty hack for IE7 strict mode
  125. }
  126. });
  127. Ext.reg('datemenu', Ext.menu.DateMenu);
  128. </pre>
  129. </body>
  130. </html>