示例#1
0
        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
        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);
            });
        }
        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
 public BaseMatListGroup()
 {
     ClassMapper
     .Add("mdc-list-group");
 }
 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
 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");
        }