Пример #1
0
        private static void RegisterGridRendererTree(IServiceCollection services)
        {
            services.AddSingleton(typeof(BlazorComponentColumnCollection <>));
            services.AddSingleton <GridContextsFactory>();
            services.AddSingleton <EditInputRendererTree>();

            services.AddSingleton(typeof(IGridRenderer), provider =>
            {
                var measurableLogger = provider.GetRequiredService <ILogger <GridMesurablePartRenderer> >();

                var gridRowRenderer = new GridRowRenderer()
                                      .AddRenderer(new GridCellMasterActionRenderer())
                                      .AddRenderer(new GridCellRenderer(provider.GetRequiredService <EditInputRendererTree>()))
                                      .AddRenderer(new GridTabControlRenderer(provider.GetRequiredService <ITableDataAdapterProvider>()), RendererType.AfterTag)
                                      .AddRenderer(new GridActionButtonsRenderer());

                var gridBodyRenderer = new GridBodyRenderer(provider.GetRequiredService <ILogger <GridBodyRenderer> >())
                                       .AddRenderer(gridRowRenderer);

                var gridRenderer = new GridMesurablePartRenderer(
                    new GridRenderer(provider.GetRequiredService <ILogger <GridRenderer> >()), measurableLogger)
                                   .AddRenderer(new GridLoadingRenderer(), RendererType.BeforeTag)
                                   .AddRenderer(new GridMesurablePartRenderer(new GridHeaderRenderer(), measurableLogger))
                                   .AddRenderer(new GridMesurablePartRenderer(gridBodyRenderer, measurableLogger))
                                   .AddRenderer(new GridPaginationRenderer(), RendererType.AfterTag);

                return(gridRenderer);
            });
        }
        private static void RegisterRendererTreeBuilders(IServiceCollection services)
        {
            services.AddSingleton(typeof(CreateItemFormRenderer <>));
            services.AddSingleton(typeof(BlazorComponentColumnCollection <>));
            services.AddSingleton <GridContextsFactory>();
            services.AddSingleton <EditInputRendererTree>();

            services.AddSingleton(typeof(IGridRendererTreeBuilder), provider =>
            {
                var measurableLogger = provider.GetRequiredService <ILogger <GridMesurablePartRenderer> >();

                var gridRowRenderer = new GridRowRenderer()
                                      .AddRenderer(new GridCellMasterActionRenderer())
                                      .AddRenderer(new GridCellRenderer(provider.GetRequiredService <EditInputRendererTree>()))
                                      .AddRenderer(new GridTabControlRenderer(provider.GetRequiredService <ITableDataAdapterProvider>()), RendererType.AfterTag)
                                      .AddRenderer(new GridActionButtonsRenderer());

                var gridGroupRowRenderer = new GridGroupRowRenderer()
                                           .AddRenderer(gridRowRenderer);

                var gridBodyRenderer = new GridBodyRenderer(provider.GetRequiredService <ILogger <GridBodyRenderer> >())
                                       .AddRenderer(gridRowRenderer)
                                       .AddRenderer(gridGroupRowRenderer);

                var gridRenderer = new GridMesurablePartRenderer(
                    new GridRenderer(provider.GetRequiredService <ILogger <GridRenderer> >()), measurableLogger)
                                   .AddRenderer(new GridLoadingRenderer(), RendererType.BeforeTag)
                                   .AddRenderer(new GridMesurablePartRenderer(new GridHeaderRenderer(provider.GetRequiredService <FlexGridInterop>()), measurableLogger))
                                   .AddRenderer(new GridMesurablePartRenderer(gridBodyRenderer, measurableLogger))
                                   .AddRenderer(new GridFooterRenderer(), RendererType.AfterTag);

                return(gridRenderer);
            });

            services.AddSingleton <IFormInputRendererBuilder, TextInputBuilder>();
            services.AddSingleton <IFormInputRendererBuilder, NumberInputBuilder>();
            services.AddSingleton <IFormInputRendererBuilder, DateInputBuilder>();
            services.AddSingleton <IFormInputRendererBuilder, SelectInputBuilder>();
            services.AddSingleton <IFormInputRendererTreeProvider, FormInputsRendererTreeProvider>();
        }