Пример #1
0
        public void Test()
        {
            var builder = new TreeTableColumnBuilder();

            builder.SetColumn("a", "b", 20);
            var result = new String();

            result.Append("<td ");
            result.Append("(nzExpandChange)=\"a.collapse(row,$event)\" ");
            result.Append("[nzExpand]=\"a.isExpand(row)\" ");
            result.Append("[nzIndentSize]=\"row.level*20\" ");
            result.Append("[nzShowExpand]=\"!a.isLeaf(row)\"");
            result.Append(">");
            result.Append("<label ");
            result.Append("(nzCheckedChange)=\"a.toggle(row)\" ");
            result.Append("*ngIf=\"a.isShowCheckbox()\" ");
            result.Append("nz-checkbox=\"\" ");
            result.Append("[nzChecked]=\"a.isChecked(row)\" ");
            result.Append("[nzIndeterminate]=\"a.isIndeterminate(row)\">");
            result.Append("{{b}}");
            result.Append("</label>");
            result.Append("<label ");
            result.Append("(click)=\"$event.stopPropagation()\" ");
            result.Append("(ngModelChange)=\"a.checkRowOnly(row)\" ");
            result.Append("*ngIf=\"a.isShowRadio(row)\" name=\"radio_a\" ");
            result.Append("nz-radio=\"\" ");
            result.Append("[ngModel]=\"a.isChecked(row)\">");
            result.Append("{{b}}");
            result.Append("</label>");
            result.Append("<ng-container *ngIf=\"a.isShowText(row)\">");
            result.Append("{{b}}");
            result.Append("</ng-container>");
            result.Append("</td>");
            Assert.Equal(result.ToString(), builder.ToString());
        }
Пример #2
0
        public void Test()
        {
            var builder = new TreeTableColumnBuilder();

            builder.SetColumn("a", "b", 20);
            var result = new String();

            result.Append("<td ");
            result.Append("(nzExpandChange)=\"a.collapse(row,$event)\" ");
            result.Append("[nzExpand]=\"a.isExpand(row)\" ");
            result.Append("[nzIndentSize]=\"row.level*20\" ");
            result.Append("[nzShowExpand]=\"!a.isLeaf(row)\"");
            result.Append(">");
            result.Append("<label ");
            result.Append("(nzCheckedChange)=\"a.toggle(row)\" ");
            result.Append("*ngIf=\"a.showCheckbox\" ");
            result.Append("nz-checkbox=\"\" ");
            result.Append("[nzChecked]=\"a.isChecked(row)\" ");
            result.Append("[nzIndeterminate]=\"a.isIndeterminate(row)\">");
            result.Append("{{b}}");
            result.Append("</label>");
            result.Append("<ng-container *ngIf=\"!a.showCheckbox\">");
            result.Append("{{b}}");
            result.Append("</ng-container>");
            result.Append("</td>");
            Assert.Equal(result.ToString(), builder.ToString());
        }
Пример #3
0
        /// <summary>
        /// 添加默认列
        /// </summary>
        protected void AddDefaultColumn(TreeTableColumnBuilder builder, string column)
        {
            if (column.IsEmpty())
            {
                return;
            }
            if (IsFirstColumn())
            {
                var tableWrapperId = _shareConfig?.TableWrapperId;
                builder.SetColumn(tableWrapperId, $"row.{column}", 20);
                return;
            }
            var length = _config.GetValue <int?>(UiConst.Truncate);

            if (length == null)
            {
                builder.AppendContent($"{{{{row.{column}}}}}");
                return;
            }
            builder.Truncate(column, length.SafeValue());
        }