Jelajahi Sumber

Add a `getContainerHeight` option

this makes it a lot easier to size the control to its container. for example, implementations could do `return container_el.clientHeight`
aharpervc 10 tahun lalu
induk
melakukan
52caeec86c
1 mengubah file dengan 4 tambahan dan 0 penghapusan
  1. 4 0
      src/Calendar.js

+ 4 - 0
src/Calendar.js

@@ -667,6 +667,10 @@ function Calendar_constructor(element, overrides) {
 	
 	
 	function _calcSize() { // assumes elementVisible
+		if (typeof options.getContainerHeight === 'function') {
+			suggestedViewHeight = options.getContainerHeight() - (headerElement ? headerElement.outerHeight(true) : 0);
+			return;
+		}
 		if (typeof options.contentHeight === 'number') { // exists and not 'auto'
 			suggestedViewHeight = options.contentHeight;
 		}