コード例 #1
0
ファイル: BaseMatSlider.cs プロジェクト: zimcoder/MatBlazor
        public BaseMatSlider()
        {
            jsHelper = new JsHelper(this);

            ClassMapper
            .Add("mdc-slider")
            .If("mdc-slider--discrete", () => Discrete);
            CallAfterRender(async() =>
            {
                dotNetObjectRef = dotNetObjectRef ?? CreateDotNetObjectRef(jsHelper);
                await Js.InvokeAsync <object>("matBlazor.matSlider.init", Ref, dotNetObjectRef);
            });
        }
コード例 #2
0
        public BaseMatDataTableOld()
        {
            VirtualScrollHelper = new MatVirtualScrollHelper(this);

            ClassMapper
            .Add("mat-data-table")
            .Add("mdc-data-table")
            .If("mat-data-table__sticky-header", () => StickyHeader)
            .Get(() => VirtualScrollHelper.GetClass());


            CallAfterRender(async() => { await VirtualScrollHelper.InitAsync(Js, Ref, this.VirtualScroll); });
        }
コード例 #3
0
ファイル: BaseMatSelect.cs プロジェクト: novfal/MatBlazor
        public BaseMatSelect()
        {
            ClassMapper
            .Add("mat-select")
            .Add("mdc-select")
            .If("mdc-select--outlined", () => Outlined)
            .If("mdc-select--disabled", () => Disabled)
            .If("mdc-select--with-leading-icon", () => Icon != null);

            HelperTextClassMapper
            .Add("mdc-text-field-helper-text")
            .If("mdc-text-field-helper-text--persistent", () => HelperTextPersistent)
            .If("mdc-text-field-helper-text--validation-msg", () => HelperTextValidation);
        }
コード例 #4
0
        public BaseMatDatePickerInternal()
        {
            ClassMapper.Add("mat-date-picker");
            ClassMapper.Add("mat-text-field-with-actions-container");

            dotNetObject = new MatDatePickerJsHelper()
            {
                OnChangeAction = (value) =>
                {
                    var v = value.FirstOrDefault();
                    CurrentValue = SwitchT.FromDateTimeNull(v);
                    InvokeStateHasChanged();
                },
            };
        }
コード例 #5
0
        public BaseMatVirtualScroll()
        {
            ClassMapper.Add("mat-virtual-scroll");

            CallAfterRender(async() =>
            {
                if (!Disabled)
                {
                    JsHelperReference =
                        new MatDotNetObjectReference <MatVirtualScrollJsHelper>(new MatVirtualScrollJsHelper(this));
                    var scrollView = await Js.InvokeAsync <MatVirtualScrollView>("matBlazor.matVirtualScroll.init", Ref,
                                                                                 JsHelperReference.Reference);
                    this.SetScrollView(scrollView);
                }
            });
        }
コード例 #6
0
        protected override async Task OnInitializedAsync()
        {
            await base.OnInitializedAsync();

            ClassMapper
            .Add("mat-card-media")
            .Add("mdc-card__media")
            .If("mdc-card__media--16-9", () => Wide)
            .If("mdc-card__media--square", () => Square);

            ContentClassMapper
            .Add("mat-card-media-content")
            .Add("mdc-card__media-content")
            .Get(() => ContentClass);

            StyleMapper.GetIf(() => $"background-image: url(\"{ImageUrl}\")", () => ImageUrl != null);
        }
コード例 #7
0
        protected BaseMatInputTextComponent()
        {
            OnFocusEvent    = new MatEventCallback <FocusEventArgs>(this, () => OnFocus);
            OnFocusOutEvent = new MatEventCallback <FocusEventArgs>(this, () => OnFocusOut);

            ClassMapper
            .Add("mat-text-field")
            .Add("mdc-text-field")
            .Get(() => this.FieldClass)
            .If("mdc-text-field--filled", () => !this.Outlined)
            // .Add("_mdc-text-field--upgraded")
            .If("mdc-text-field--with-leading-icon", () => this.Icon != null && !this.IconTrailing)
            .If("mdc-text-field--with-trailing-icon", () => this.Icon != null && this.IconTrailing)
            .If("mdc-text-field--box", () => !this.FullWidth && this.Box)
            .If("mdc-text-field--dense", () => Dense)
            .If("mdc-text-field--outlined", () => !this.FullWidth && this.Outlined)
            .If("mdc-text-field--disabled", () => this.Disabled)
            .If("mdc-text-field--fullwidth", () => this.FullWidth)
            .If("mdc-text-field--fullwidth-with-leading-icon",
                () => this.FullWidth && this.Icon != null && !this.IconTrailing)
            .If("mdc-text-field--fullwidth-with-trailing-icon",
                () => this.FullWidth && this.Icon != null && this.IconTrailing)
            .If("mdc-text-field--textarea", () => this.TextArea);

            bool TextOrPlaceHolderVisible()
            {
                return(!string.IsNullOrEmpty(CurrentValueAsString) ||
                       (!string.IsNullOrWhiteSpace(PlaceHolder) && FullWidth));
            }

            LabelClassMapper
            .Add("mdc-floating-label")
            .If("mat-floating-label--float-above-outlined",
                () => Outlined && TextOrPlaceHolderVisible())
            .If("mdc-floating-label--float-above", () => TextOrPlaceHolderVisible());

            InputClassMapper
            .Get(() => this.InputClass)
            .Add("mat-text-field-input")
            .Add("mdc-text-field__input")
            // .If("_mdc-text-field--upgraded", () => !string.IsNullOrEmpty(CurrentValueAsString))
            .If("mat-hide-clearbutton", () => this.HideClearButton);

            CallAfterRender(async() => { await JsInvokeAsync <object>("matBlazor.matTextField.init", Ref); });
        }
コード例 #8
0
        public BaseMatSlider()
        {
            jsHelper = new MatDotNetObjectReference <MatSliderJsHelper>(new MatSliderJsHelper());
            jsHelper.Value.OnChangeEvent += Value_OnChangeEvent;
            ValueMin = SwitchT.Minimum;
            ValueMax = SwitchT.Maximum;
            Step     = SwitchT.Step;

            ClassMapper
            .Add("mat-slider")
            .Add("mdc-slider")
            .If("mdc-slider--discrete", () => Discrete);

            CallAfterRender(async() =>
            {
                await JsInvokeAsync <object>("matBlazor.matSlider.init", Ref, jsHelper.Reference);
            });
        }
コード例 #9
0
        public BaseMatSelectTypeKey()
        {
            jsHelper = new MatSelectJsHelper();
            jsHelper.SetValueEvent += JsHelper_SetValueEvent;

            ClassMapper
            .Add("mat-select")
            .Add("mdc-select")
            .If("mdc-select--outlined", () => Outlined)
            .If("mdc-select--disabled", () => Disabled)
            .If("mdc-select--with-leading-icon", () => Icon != null);

            HelperTextClassMapper
            .Add("mdc-text-field-helper-text")
            .If("mdc-text-field-helper-text--persistent", () => HelperTextPersistent)
            .If("mdc-text-field-helper-text--validation-msg", () => HelperTextValidation);


            CallAfterRender(async() =>
            {
                jsHelperReference ??= DotNetObjectReference.Create(jsHelper);
                await JsInvokeAsync <object>("matBlazor.matSelect.init", Ref, jsHelperReference);
            });
        }
コード例 #10
0
 public BaseMatMenu()
 {
     ClassMapper.Add("mdc-menu mdc-menu-surface");
 }
コード例 #11
0
 public BaseMatCard()
 {
     ClassMapper
     .Add("mdc-card")
     .If("mdc-card--stroked", () => this.Stroke);
 }
コード例 #12
0
 public BaseMatTable()
 {
     ClassMapper
     .Add("mdc-table")
     .If("mdc-table--striped", () => this.Striped);
 }
コード例 #13
0
 public BaseMatNavItem()
 {
     ClassMapper
     .Add("mdc-nav-item")
     .If("mdc-list-item--selected", () => (Selected && AllowSelection));
 }
コード例 #14
0
ファイル: BaseMatListGroup.cs プロジェクト: sowsan/MatBlazor
 public BaseMatListGroup()
 {
     ClassMapper
     .Add("mdc-list-group");
 }
コード例 #15
0
 public BaseMatToastContainer()
 {
     ClassMapper
     .Add("mat-toast-container")
     .Get(() => MatToatsPositionConvertor.Convert(Toaster.Configuration.Position));
 }
コード例 #16
0
 public BaseMatIconButton()
 {
     ClassMapper
     .Add("mdc-icon-button");
 }
コード例 #17
0
 protected BaseMatComponent()
 {
     ClassMapper.Get(() => this.Class);
 }
コード例 #18
0
 public BaseMatDataTable()
 {
     ClassMapper
     .Add("mat-data-table")
     .Add("mdc-data-table");
 }
コード例 #19
0
 public BaseMatSortHeaderRow()
 {
     ClassMapper.Add("mat-sort-header-row");
 }
コード例 #20
0
 public BaseMatSortHeader()
 {
     ClassMapper.Add("mat-sort-header");
 }
コード例 #21
0
 public BaseMatListItem()
 {
     ClassMapper
     .Add("mdc-list-item")
     .If("mdc-list-item--disabled", () => Disabled);
 }
コード例 #22
0
 public BaseMatDrawerContainer()
 {
     ClassMapper
     .Add("mdc-drawer-app-content");
 }
コード例 #23
0
 public BaseMatNavMenu()
 {
     ClassMapper.Add("mat-accordion");
 }
コード例 #24
0
 public BaseMatList()
 {
     ClassMapper
     .Add("mdc-list")
     .If("mdc-list--two-line", () => TwoLine);
 }
コード例 #25
0
 public BaseMatAccordion()
 {
     ClassMapper.Add("mat-accordion");
 }
コード例 #26
0
 public BaseMatNavItem()
 {
     ClassMapper
     .Add("mdc-nav-item")
     .If("mdc-list-item--selected", () => Selected);
 }
コード例 #27
0
 public BaseMatCheckbox()
 {
     ClassMapper.Add("mdc-checkbox");
 }
コード例 #28
0
ファイル: BaseMatChip.cs プロジェクト: sowsan/MatBlazor
 public BaseMatChip()
 {
     ClassMapper
     .Add("mdc-chip")
     .If("mdc-chip--activated", () => this.Active);
 }
コード例 #29
0
 public BaseMatTabGroup()
 {
     ClassMapper.Add("mat-tab-group");
 }
コード例 #30
0
        protected override async Task OnInitializedAsync()
        {
            await base.OnInitializedAsync();

            ClassMapper.Add("mdc-card__primary-action");
        }