Пример #1
0
        public Element Build()
        {
            var row = Element.Create("div");

            row.Class = "form-row";

            var builder = new LaraBuilder(row);

            builder.Push("div", "form-group my-1")
            .Push("div", "form-check")
            .Push(_checkbox)
            .Pop()
            .Push("label", "form-check-label")
            .Attribute("for", _checkbox.Id)
            .AddTextNode("Check me out")
            .Pop()
            .Pop()
            .Pop()
            .Push("div", "form-group")
            .Push(_toggle)
            .AddTextNode("Toggle")
            .Pop()
            .Pop();

            return(row);
        }
Пример #2
0
        public Element Build()
        {
            var row = Element.Create("div");

            row.Class = "form-row";

            var builder = new LaraBuilder(row);

            builder
            .Push("div", "form-group")
            .Push(_number)
            .Pop()
            .Pop()
            .Push("div", "form-group")
            .Push(_increase)
            .Pop()
            .Pop();

            return(row);
        }
Пример #3
0
        public Task OnGet()
        {
            var document = LaraUI.Page.Document;

            SampleAppBootstrap.AppendTo(document.Head);
            var builder = new LaraBuilder(document.Body);

            builder.Push("div", "p-2")
            .Push("span")
            .BindInnerText(_data, x => x.Counter.ToString())
            .Pop()
            .Pop()
            .Push("div", "p-2")
            .Push("button", "btn btn-primary")
            .On("click", () => _data.IncreaseCounter())
            .AppendText("increase")
            .Pop()
            .Pop();
            return(Task.CompletedTask);
        }
Пример #4
0
        public Task OnGet()
        {
            var builder = new LaraBuilder(LaraUI.Document.Body);

            builder.Push("div")
            .Push(_file)
            .Attribute("type", "file")
            .FlagAttribute("multiple", true)
            .Pop()
            .Pop()
            .Push("div")
            .Push("button")
            .InnerText("Upload via Ajax")
            .On(new EventSettings
            {
                EventName   = "click",
                UploadFiles = true,
                Handler     = ClickHandler
            })
            .Pop()
            .Pop()
            .Push("div")
            .Push("button")
            .InnerText("Upload via WebSocket")
            .On(new EventSettings
            {
                EventName   = "click",
                UploadFiles = true,
                Handler     = ClickHandler,
                LongRunning = true
            })
            .Pop()
            .Pop()
            .Push("div")
            .AddNode(_span)
            .Pop();
            return(Task.CompletedTask);
        }
Пример #5
0
        public CheckboxSample()
        {
            var checkbox = new InputElement
            {
                Id    = "mycheckbox",
                Type  = "checkbox",
                Class = "form-check-input"
            };
            var toggle = new Button
            {
                Class = "btn btn-primary",
            };

            toggle.On("click", () =>
            {
                checkbox.Checked = !checkbox.Checked;
                return(Task.CompletedTask);
            });
            Root       = Element.Create("div");
            Root.Class = "form-row";
            var builder = new LaraBuilder(Root);

            builder.Push("div", "form-group col-md-2 my-1")
            .Push("div", "form-check")
            .Push(checkbox)
            .Pop()
            .Push("label", "form-check-label")
            .Attribute("for", checkbox.Id)
            .AppendText("Check me out")
            .Pop()
            .Pop()
            .Pop()
            .Push("div", "form-group col-md-1")
            .Push(toggle)
            .AppendText("Toggle")
            .Pop()
            .Pop();
        }