瀏覽代碼

cdb: added ability to set display column/icon

Nicolas Cannasse 5 年之前
父節點
當前提交
d7027beefd
共有 3 個文件被更改,包括 28 次插入0 次删除
  1. 3 0
      bin/cdb.css
  2. 3 0
      bin/cdb.less
  3. 22 0
      hide/comp/cdb/Editor.hx

+ 3 - 0
bin/cdb.css

@@ -40,6 +40,7 @@
 .cdb .cdb-sheet th.start {
 .cdb .cdb-sheet th.start {
   width: 30px;
   width: 30px;
   border-left-color: #333;
   border-left-color: #333;
+  cursor: default;
 }
 }
 .cdb .cdb-sheet td.start {
 .cdb .cdb-sheet td.start {
   text-align: center;
   text-align: center;
@@ -120,6 +121,8 @@
   width: auto;
   width: auto;
   white-space: nowrap;
   white-space: nowrap;
   overflow: hidden;
   overflow: hidden;
+  cursor: pointer;
+  user-select: none;
 }
 }
 .cdb .cdb-sheet tr.head .display {
 .cdb .cdb-sheet tr.head .display {
   font-style: italic;
   font-style: italic;

+ 3 - 0
bin/cdb.less

@@ -46,6 +46,7 @@
 		th.start {
 		th.start {
 			width : 30px;
 			width : 30px;
 			border-left-color : #333;
 			border-left-color : #333;
+			cursor:default;
 		}
 		}
 		td.start {
 		td.start {
 			text-align : center;
 			text-align : center;
@@ -132,6 +133,8 @@
 			width: auto;
 			width: auto;
 			white-space: nowrap;
 			white-space: nowrap;
 			overflow: hidden;
 			overflow: hidden;
+			cursor: pointer;
+			user-select: none;
 		}
 		}
 
 
 		tr.head .display {
 		tr.head .display {

+ 22 - 0
hide/comp/cdb/Editor.hx

@@ -666,6 +666,28 @@ class Editor extends Component {
 				refresh();
 				refresh();
 			}}
 			}}
 		];
 		];
+
+		if( table.parent == null ) {
+			var props = table.sheet.props;
+			switch( col.type ) {
+			case TString, TRef(_):
+				menu.push({ label : "Display Name", click : function() {
+					beginChanges();
+					props.displayColumn = (props.displayColumn == col.name ? null : col.name);
+					endChanges();
+					refresh();
+				}, checked: props.displayColumn == col.name });
+			case TTilePos:
+				menu.push({ label : "Display Icon", click : function() {
+					beginChanges();
+					props.displayIcon = (props.displayIcon == col.name ? null : col.name);
+					endChanges();
+					refresh();
+				}, checked: props.displayIcon == col.name });
+			default:
+			}
+		}
+
 		if( col.type == TString && col.kind == Script )
 		if( col.type == TString && col.kind == Script )
 			menu.insert(1,{ label : "Edit all", click : function() editScripts(table,col) });
 			menu.insert(1,{ label : "Edit all", click : function() editScripts(table,col) });
 		if( table.displayMode == Properties ) {
 		if( table.displayMode == Properties ) {