public FilterModel(LambdaExpression getFieldExpression, string fieldName, Expression <Func <TField, TField, bool> > onFilter, IList <TableFilter> filters, TableFilterType filterType) { this._getFieldExpression = getFieldExpression; this.FieldName = fieldName; if (onFilter == null) { this.OnFilter = (value, field) => field.Equals(value); } else { this.OnFilter = onFilter; } this.SelectedValues = filters.Select(x => x.Value?.ToString()); this.Filters = filters; this.FilterType = filterType; }
public FilterModel(PropertyInfo propertyInfo, Expression <Func <TField, TField, bool> > onFilter, IList <TableFilter <TField> > filters, TableFilterType filterType) { this._propertyInfo = propertyInfo; this.FieldName = _propertyInfo.Name; if (onFilter == null) { this.OnFilter = (value, field) => field.Equals(value); } else { this.OnFilter = onFilter; } this.SelectedValues = filters.Select(x => x.Value?.ToString()); this.Filters = filters; this.FilterType = filterType; }
public static string AsString(this TableFilterType type) { switch (type) { case TableFilterType.Const: return("CONST"); case TableFilterType.Field: return("FIELD"); case TableFilterType.Filter: return("FILTER"); default: throw new ArgumentOutOfRangeException("type"); } }
public TableRelationTableFilterLine(string fieldName, TableFilterType type, string value) { FieldName = fieldName; Type = type; Value = value; }
protected override void OnInitialized() { base.OnInitialized(); Sortable = Sortable || SorterMultiple != default || SorterCompare != default || DefaultSortOrder != default || SortDirections?.Any() == true; if (IsHeader) { if (FieldExpression != null) { var paramExp = Expression.Parameter(ItemType); var member = ColumnExpressionHelper.GetReturnMemberInfo(FieldExpression); var bodyExp = Expression.MakeMemberAccess(paramExp, member); GetFieldExpression = Expression.Lambda(bodyExp, paramExp); } else if (DataIndex != null) { (_, GetFieldExpression) = ColumnDataIndexHelper <TData> .GetDataIndexConfig(this); } if (GetFieldExpression != null) { var member = ColumnExpressionHelper.GetReturnMemberInfo(GetFieldExpression); DisplayName = member.GetCustomAttribute <DisplayNameAttribute>(true)?.DisplayName ?? member.GetCustomAttribute <DisplayAttribute>(true)?.GetName() ?? member.Name; FieldName = DataIndex ?? member.Name; } if (Sortable && GetFieldExpression != null) { SortModel = new SortModel <TData>(GetFieldExpression, FieldName, SorterMultiple, DefaultSortOrder, SorterCompare); } } else if (IsBody) { SortModel = Context.HeaderColumns[ColIndex] is IFieldColumn fieldColumn ? fieldColumn.SortModel : null; (GetValue, _) = ColumnDataIndexHelper <TData> .GetDataIndexConfig(this); } SortDirections ??= Table.SortDirections; Sortable = Sortable || SortModel != null; _sortDirection = SortModel?.SortDirection ?? DefaultSortOrder ?? SortDirection.None; if (Filters?.Any() == true) { Filterable = true; _columnFilterType = TableFilterType.List; } else if (Filterable) { _columnDataType = THelper.GetUnderlyingType <TData>(); if (_columnDataType == typeof(bool)) { _columnFilterType = TableFilterType.List; Filters = new List <TableFilter <TData> >(); var trueFilterOption = GetNewFilter(); trueFilterOption.Text = Table.Locale.FilterOptions.True; trueFilterOption.Value = THelper.ChangeType <TData>(true); ((List <TableFilter <TData> >)Filters).Add(trueFilterOption); var falseFilterOption = GetNewFilter(); falseFilterOption.Text = Table.Locale.FilterOptions.False; falseFilterOption.Value = THelper.ChangeType <TData>(false); ((List <TableFilter <TData> >)Filters).Add(falseFilterOption); } else { _columnFilterType = TableFilterType.FeildType; InitFilters(); } } ClassMapper .If("ant-table-column-has-sorters", () => Sortable) .If($"ant-table-column-sort", () => Sortable && SortModel != null && SortModel.SortDirection.IsIn(SortDirection.Ascending, SortDirection.Descending)); }
public RunObjectLinkLine(string fieldName, TableFilterType type, string value) { FieldName = fieldName; Type = type; Value = value; }
public CalcFormulaTableFilterLine(string fieldName, TableFilterType type, string value) { FieldName = fieldName; Type = type; Value = value; }