Browse Source

cursor fixes wrt separator toggle

Nicolas Cannasse 5 years ago
parent
commit
f972277bf7
2 changed files with 16 additions and 3 deletions
  1. 3 2
      hide/comp/cdb/Line.hx
  2. 13 1
      hide/comp/cdb/Table.hx

+ 3 - 2
hide/comp/cdb/Line.hx

@@ -21,6 +21,7 @@ class Line extends Component {
 
 	public function create() {
 		var view = table.view;
+		element.removeClass("hidden");
 		for( c in columns ) {
 			var v = new Element("<td>").addClass("c");
 			v.appendTo(this.element);
@@ -32,12 +33,12 @@ class Line extends Component {
 				e.stopPropagation();
 			});
 		}
-		element.css({ display : "" });
 	}
 
 	public function hide() {
+		cells = [];
 		element.children('td.c').remove();
-		element.css({ display : "none" });
+		element.addClass("hidden");
 	}
 
 }

+ 13 - 1
hide/comp/cdb/Table.hx

@@ -226,8 +226,20 @@ class Table extends Component {
 			toggle.css({ display : title == null ? "none" : "" });
 			toggle.text(hidden ? "🡆" : "🡇");
 			content.text(title == null ? "" : title+(hidden ? " ("+getLines().length+")" : ""));
+			sep.toggleClass("sep-hidden", hidden == true);
 		}
 
+		sep.contextmenu(function(e) {
+			new hide.comp.ContextMenu([
+				{ label : "Expand All", click : function() {
+					element.find("tr.separator.sep-hidden a.toggle").click();
+				}},
+				{ label : "Collapse All", click : function() {
+					element.find("tr.separator").not(".sep-hidden").find("a.toggle").click();
+				}},
+			]);
+		});
+
 		sep.dblclick(function(e) {
 			if( !canInsert() ) return;
 			content.empty();
@@ -259,7 +271,7 @@ class Table extends Component {
 
 		sync();
 		toggle.dblclick(function(e) e.stopPropagation());
-		toggle.click(function(_) {
+		toggle.click(function(e) {
 			hidden = !hidden;
 			saveDisplayState("sep/"+title, !hidden);
 			sync();