Преглед на файлове

Make column-only categories viewable

Leonardo Jeanteur преди 3 години
родител
ревизия
1da33e75b9
променени са 6 файла, в които са добавени 25 реда и са изтрити 9 реда
  1. 1 1
      hide/comp/cdb/Cell.hx
  2. 12 2
      hide/comp/cdb/Editor.hx
  3. 2 2
      hide/comp/cdb/Formulas.hx
  4. 3 3
      hide/comp/cdb/ModalColumnForm.hx
  5. 6 0
      hide/comp/cdb/SubTable.hx
  6. 1 1
      hide/comp/cdb/Table.hx

+ 1 - 1
hide/comp/cdb/Cell.hx

@@ -24,7 +24,7 @@ class Cell extends Component {
 		root.addClass("t_" + typeNames[column.type.getIndex()]);
 		root.addClass("n_" + column.name);
 		if(line.table.parent == null) {
-			var editProps = editor.getColumnProps(column);
+			var editProps = Editor.getColumnProps(column);
 			root.toggleClass("cat", editProps.categories != null);
 			if(editProps.categories != null)
 				for(c in editProps.categories)

+ 12 - 2
hide/comp/cdb/Editor.hx

@@ -952,7 +952,7 @@ class Editor extends Component {
 		return null;
 	}
 
-	public function getColumnProps( c : cdb.Data.Column ) {
+	static public function getColumnProps( c : cdb.Data.Column ) {
 		var pr : EditorColumnProps = c.editor;
 		if( pr == null ) pr = {};
 		return pr;
@@ -1498,9 +1498,19 @@ class Editor extends Component {
 		for( s in db.sheets ) {
 			var props = getSheetProps(s);
 			if(props.categories != null) {
-				for(n in props.categories)
+				for(n in props.categories) {
 					if(names.indexOf(n) < 0)
 						names.push(n);
+				}
+			}
+			for(c in s.columns) {
+				var cProps = getColumnProps(c);
+				if(cProps.categories != null) {
+					for(n in cProps.categories) {
+						if(names.indexOf(n) < 0)
+							names.push(n);
+					}
+				}
 			}
 		}
 		names.sort((a, b) -> Reflect.compare(a, b));

+ 2 - 2
hide/comp/cdb/Formulas.hx

@@ -36,7 +36,7 @@ class Formulas {
 			var columns = [];
 			for( c in s.columns )
 				if( c.type == TInt || c.type == TFloat ) {
-					var def = editor.getColumnProps(c).formula;
+					var def = Editor.getColumnProps(c).formula;
 					columns.push({ name : c.name, def : def, opt : c.opt });
 				}
 			for( o in s.getLines() ) {
@@ -172,7 +172,7 @@ class Formulas {
 
 	public function setForValue( obj : Dynamic, sheet : cdb.Sheet, c : cdb.Data.Column, fname : String ) {
 		var field = c.name+"__f";
-		var fdef = editor.getColumnProps(c).formula;
+		var fdef = Editor.getColumnProps(c).formula;
 		if( fname != null && fdef == fname )
 			fname = null;
 		if( fname == null ) {

+ 3 - 3
hide/comp/cdb/ModalColumnForm.hx

@@ -214,7 +214,7 @@ class ModalColumnForm extends Modal {
 			case TCustom(name):
 				form.find("[name=ctype]").val(name);
 			case TInt, TFloat:
-				var p = editor.getColumnProps(column);
+				var p = Editor.getColumnProps(column);
 				form.find("[name=formula]").val( p.formula == null ? "" : p.formula );
 				form.find("[name=export]").prop( "checked", !p.ignoreExport );
 			default:
@@ -234,7 +234,7 @@ class ModalColumnForm extends Modal {
 		contentModal.click( function(e) e.stopPropagation());
 
 		form.find("#cancelBtn").click(function(e) closeModal());
-		if( column != null && editor.getColumnProps(column).formula != null )
+		if( column != null && Editor.getColumnProps(column).formula != null )
 			toggleHide();
 	}
 
@@ -335,7 +335,7 @@ class ModalColumnForm extends Modal {
 		}
 		if( form.find("[name=hidden]").is(":checked") ) c.kind = Hidden;
 
-		var props = editor.getColumnProps(c);
+		var props = Editor.getColumnProps(c);
 		switch( t ) {
 		case TFloat, TInt:
 			props.formula = form.find("[name=formula]").val();

+ 6 - 0
hide/comp/cdb/SubTable.hx

@@ -26,6 +26,12 @@ class SubTable extends Table {
 		if( editor.displayMode == AllProperties && cell.table.parent == null ) {
 			group = new Element("<td>").attr("colspan","2").appendTo(insertedTR);
 		} else if( mode == Properties ) {
+			if (parent.displayMode == Properties) {
+				new Element("<td>")
+					.appendTo(insertedTR)
+					.toggleClass("sublist-pad-" + parent.nestedIndex);
+			}
+
 			var count = cell.columnIndex + 1;
 			if (count < 3 && cell.table.columns.length >= 8)
 				count += 2; // fix when a lot of columns but the subproperty is on the left

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

@@ -140,7 +140,7 @@ class Table extends Component {
 		var colCount = columns.length;
 
 		for( c in columns ) {
-			var editProps = editor.getColumnProps(c);
+			var editProps = Editor.getColumnProps(c);
 			var col = J("<th>");
 			col.text(c.name);
 			col.addClass( "t_"+c.type.getName().substr(1).toLowerCase() );