Exemplo n.º 1
0
        internal static List <SearchColumn> Enumerate(SearchContext context, IEnumerable <SearchItem> items)
        {
            var columns = new List <SearchColumn>(ItemSelectors.Enumerate(items));

            var providerTypes = new HashSet <string>(context.providers.Select(p => p.type));

            foreach (var s in SelectorManager.selectors)
            {
                if (!s.printable)
                {
                    continue;
                }

                if (!string.IsNullOrEmpty(s.provider) && !providerTypes.Contains(s.provider))
                {
                    continue;
                }

                columns.Add(new SearchColumn($"Selectors/{s.label}", s.label));
            }

            foreach (var p in context.providers)
            {
                if (p.fetchColumns == null)
                {
                    continue;
                }

                columns.AddRange(p.fetchColumns(context, items.Take(50)));
            }

            return(columns);
        }
Exemplo n.º 2
0
        public void SetupColumns(IEnumerable <SearchItem> items, SearchColumnFlags options)
        {
            var fields = new HashSet <SearchField>();

            foreach (var e in items ?? GetElements())
            {
                fields.UnionWith(e.GetFields().Where(f => f.value != null));
            }

            if (m_TableConfig != null && fields.Count > 0)
            {
                m_TableConfig.columns = fields.Select(f => ItemSelectors.CreateColumn(f.label, f.name, options: options)).ToArray();
                SetSearchTable(m_TableConfig);
            }
            else
            {
                SetSearchTable(LoadDefaultTableConfig(reset: true));
            }
        }