Compare commits
2 Commits
5bf098e0f2
...
ee45c23a80
Author | SHA1 | Date |
---|---|---|
Matija Koželj | ee45c23a80 | 2 years ago |
markosteger | 5f8215c5c5 | 2 years ago |
@ -0,0 +1,88 @@
|
||||
@page "/datagrid"
|
||||
@using Connected.Classes.Grid;
|
||||
@using Connected.Components;
|
||||
@using Connected.Enums;
|
||||
@using Connected.Models.Modal;
|
||||
@using Connected.Models;
|
||||
@using Connected.Services;
|
||||
@using Connected.Utilities;
|
||||
@using System.Collections.ObjectModel;
|
||||
|
||||
@if (loaded)
|
||||
{
|
||||
<h1 style="text-align:center;">DATA GRID EXAMPLE</h1>
|
||||
|
||||
<Grid Items="Data" Context="number" Options="dataGridOptions">
|
||||
<RowTemplate>
|
||||
@number
|
||||
</RowTemplate>
|
||||
<RowDetailTemplate>
|
||||
@(number * 2)
|
||||
</RowDetailTemplate>
|
||||
</Grid>
|
||||
|
||||
<Grid Items="DData" Context="dummy" Options="dataGridOptions">
|
||||
<RowTemplate>
|
||||
@dummy.Value
|
||||
</RowTemplate>
|
||||
<RowDetailTemplate>
|
||||
@dummy.Value
|
||||
</RowDetailTemplate>
|
||||
</Grid>
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
<h4>Data filling...</h4>
|
||||
}
|
||||
|
||||
@code {
|
||||
bool loaded = false;
|
||||
|
||||
DataGridOptions dataGridOptions = new DataGridOptions()
|
||||
{
|
||||
ImagePosition = SmScrn_GridImgPos.Top,
|
||||
ShowImage = true,
|
||||
Dense = true,
|
||||
ShowSelect = true,
|
||||
ItemsPerPage = 10,
|
||||
SelectedPage = 1,
|
||||
DataSet_ImgColName = "Img",
|
||||
};
|
||||
|
||||
ObservableCollection<int> Data = new();
|
||||
ObservableCollection<DummyData> DData = new();
|
||||
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
if (Data is null) Data = new();
|
||||
if (DData is null) DData = new();
|
||||
Random r = new Random();
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
//int l = r.Next(50);
|
||||
Data.Add(r.Next(50));
|
||||
DData.Add(new DummyData() { Value = r.Next(50) });
|
||||
}
|
||||
loaded = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
public string RandomString(int length)
|
||||
{
|
||||
|
||||
Random random = new Random(DateTime.Now.Millisecond);
|
||||
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
string result = new string(Enumerable.Repeat(chars, length)
|
||||
.Select(s => s[random.Next(s.Length)]).ToArray());
|
||||
return result;
|
||||
}
|
||||
|
||||
public class DummyData
|
||||
{
|
||||
public object Value { get; set; } = null;
|
||||
public string Img { get; set; } = "https://source.unsplash.com/random?face";
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
@page "/datepicker"
|
||||
@using Connected.Components;
|
||||
@using Connected.Enums;
|
||||
@using Connected.Models.Modal;
|
||||
@using Connected.Models;
|
||||
@using Connected.Services;
|
||||
@using Connected.Utilities;
|
||||
|
||||
@inject ModalDialogService modalDialog;
|
||||
|
||||
|
||||
<h1 style="text-align:center;">DATE PICKER EXAMPLE</h1>
|
||||
|
||||
|
||||
<DatePicker @bind-SelectedDate=@date></DatePicker>
|
||||
|
||||
|
||||
<h4>Selected date: @date.ToString("dd. MM. yyyy")</h4>
|
||||
|
||||
|
||||
@code {
|
||||
DateTime date = DateTime.Now;
|
||||
}
|
@ -1,71 +1,31 @@
|
||||
@page "/"
|
||||
@using Connected.Enums;
|
||||
@using Connected.Models;
|
||||
@using Connected.Components;
|
||||
|
||||
|
||||
<h1 style="text-align:center;">Component Sandbox</h1>
|
||||
|
||||
<Grid>
|
||||
@for (int i = 0; i < 5; i++)
|
||||
{
|
||||
int num = i;
|
||||
<GridRow>
|
||||
<GridRowContent>
|
||||
Fixed content @num.ToString()
|
||||
</GridRowContent>
|
||||
<GridRowContent Collapsable=true>
|
||||
Collapsable content @num.ToString()
|
||||
</GridRowContent>
|
||||
</GridRow>
|
||||
}
|
||||
</Grid>
|
||||
|
||||
<p>Izbran datum je: @date</p>
|
||||
|
||||
<FormWizard Id="Wizard1">
|
||||
<FormWizardStep Name="Step1">
|
||||
Step1
|
||||
</FormWizardStep>
|
||||
<FormWizardStep Name="Step2">
|
||||
Step2
|
||||
</FormWizardStep>
|
||||
<FormWizardStep Name="Step3">
|
||||
Step3
|
||||
</FormWizardStep>
|
||||
<FormWizardStep Name="Step4">
|
||||
Step4
|
||||
</FormWizardStep>
|
||||
</FormWizard>
|
||||
<DatePicker @bind-SelectedDate=@date>
|
||||
|
||||
</DatePicker>
|
||||
|
||||
<NumberStepper @bind-Value=number ></NumberStepper>
|
||||
|
||||
<Button OnClick="ChangeErrorText" >Error text</Button>
|
||||
|
||||
<NumberInput @bind-Value=@dnumber Step=0.03 DecimalPlaces=2 HelperText="Helper text" ErrorText="@ErrorText" Clearable=true></NumberInput>
|
||||
|
||||
<p>Selected date is @date.ToString()</p>
|
||||
|
||||
<p>Number is: @number.ToString()</p>
|
||||
<p>DNumber is: @dnumber.ToString()</p>
|
||||
@using Connected.Services;
|
||||
@using Connected.Utilities;
|
||||
|
||||
@if (loaded)
|
||||
{
|
||||
<h1 style="text-align:center;">Component Example page</h1>
|
||||
|
||||
<ul>
|
||||
<li><Link Class="m-1" Url="modal" Text="Modal dialog" Target="Target.Self" /></li>
|
||||
<li><Link Class="m-1" Url="button" Text="Button" Target="Target.Self" /></li>
|
||||
<li><Link Class="m-1" Url="datepicker" Text="Date picker" Target="Target.Self" /></li>
|
||||
<li><Link Class="m-1" Url="datagrid" Text="Data Grid" Target="Target.Self" /></li>
|
||||
</ul>
|
||||
} else
|
||||
{
|
||||
<h3>Loading...</h3>
|
||||
}
|
||||
|
||||
@code {
|
||||
DateTime date = DateTime.Today;
|
||||
|
||||
double dnumber = 0;
|
||||
|
||||
int number = 0;
|
||||
|
||||
string ErrorText = "";
|
||||
bool loaded = false;
|
||||
|
||||
public void ChangeErrorText()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
if (string.IsNullOrEmpty(ErrorText))
|
||||
ErrorText = "Test string: Error has ocurred!";
|
||||
else
|
||||
ErrorText = string.Empty;
|
||||
//StateHasChanged();
|
||||
loaded=true;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
@ -1,5 +1,18 @@
|
||||
<CascadingValue Value="this">
|
||||
<div class="@GridClass">
|
||||
@ChildContent
|
||||
@attribute [CascadingTypeParameter(nameof(DataType))]
|
||||
@typeparam DataType
|
||||
|
||||
<CascadingValue Value="this">
|
||||
<div class="@GridClassList.ToString()">
|
||||
@foreach (var Item in ItemsToShow)
|
||||
{
|
||||
<GridRow DataType="DataType" Item="@Item" ImgSrc="" >
|
||||
<FixedContent>
|
||||
@RowTemplate(Item)
|
||||
</FixedContent>
|
||||
<CollapsibleContent>
|
||||
@RowDetailTemplate(Item)
|
||||
</CollapsibleContent>
|
||||
</GridRow>
|
||||
}
|
||||
</div>
|
||||
</CascadingValue>
|
||||
|
@ -1,3 +0,0 @@
|
||||
<div class="@GeneratedRowContentClass">
|
||||
@ChildContent
|
||||
</div>
|
Loading…
Reference in new issue