فهرست منبع

added cdb.view.forbid support (close #58)

Nicolas Cannasse 5 سال پیش
والد
کامیت
6a4bd7e4e7
7فایلهای تغییر یافته به همراه9 افزوده شده و 17 حذف شده
  1. 2 1
      bin/cdb.css
  2. 1 1
      bin/cdb.less
  3. 0 10
      hide/comp/cdb/ConfigView.hx
  4. 1 1
      hide/comp/cdb/Cursor.hx
  5. 1 1
      hide/comp/cdb/Editor.hx
  6. 3 2
      hide/comp/cdb/Table.hx
  7. 1 1
      hide/view/CdbTable.hx

+ 2 - 1
bin/cdb.css

@@ -100,7 +100,8 @@
 .cdb .cdb-sheet td.edit_long {
   padding-bottom: 0px;
 }
-.cdb .cdb-sheet tr.filtered {
+.cdb .cdb-sheet tr.filtered,
+.cdb .cdb-sheet tr.hidden {
   display: none;
 }
 .cdb .cdb-sheet tr.clickable {

+ 1 - 1
bin/cdb.less

@@ -110,7 +110,7 @@
 			padding-bottom : 0px;
 		}
 
-		tr.filtered {
+		tr.filtered, tr.hidden {
 			display : none;
 		}
 

+ 0 - 10
hide/comp/cdb/ConfigView.hx

@@ -1,10 +0,0 @@
-package hide.comp.cdb;
-
-typedef SheetView = {
-	var insert : Bool;
-	var ?show : Array<String>;
-	var ?edit : Array<String>;
-	var sub : haxe.DynamicAccess<SheetView>;
-}
-
-typedef ConfigView = haxe.DynamicAccess<SheetView>;

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

@@ -83,7 +83,7 @@ class Cursor {
 		var line = getLine();
 		if( line != null && dy != 0 ) {
 			var allLines = line.element.parent().children("tr").not(".separator");
-			var lines = allLines.not(".filtered");
+			var lines = allLines.not(".filtered").not(".hidden");
 			var index = lines.index(line.element);
 			var targetLine = lines.get(hxd.Math.imax(index + dy,0));
 			if( targetLine == null || targetLine == line.element.get(0) ) return;

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

@@ -38,7 +38,7 @@ class Editor extends Component {
 	var api : EditorApi;
 	var undoState : Array<UndoState> = [];
 	var currentValue : Any;
-	public var view : ConfigView;
+	public var view : cdb.DiffFile.ConfigView;
 	public var config : hide.Config;
 	public var cursor : Cursor;
 	public var keys : hide.ui.Keys;

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

@@ -16,7 +16,7 @@ class Table extends Component {
 	public var displayMode(default,null) : DisplayMode;
 
 	public var columns : Array<cdb.Data.Column>;
-	public var view : ConfigView.SheetView;
+	public var view : cdb.DiffFile.SheetView;
 
 	public function new(editor, sheet, root, mode) {
 		super(null,root);
@@ -157,7 +157,8 @@ class Table extends Component {
 				var line = lines[index];
 				v.appendTo(line.element);
 				var cell = new Cell(v, line, c);
-
+				if( c.type == TId && view != null && view.forbid != null && view.forbid.indexOf(cell.value) >= 0 )
+					line.element.addClass("hidden");
 				v.click(function(e) {
 					editor.cursor.clickCell(cell, e.shiftKey);
 					e.stopPropagation();

+ 1 - 1
hide/view/CdbTable.hx

@@ -6,7 +6,7 @@ class CdbTable extends hide.ui.View<{}> {
 	var editor : hide.comp.cdb.Editor;
 	var currentSheet : String;
 	var tabCache : String;
-	var view : hide.comp.cdb.ConfigView;
+	var view : cdb.DiffFile.ConfigView;
 
 	public function new( ?state ) {
 		super(state);