├── _config.yml ├── BlazorTimePicker ├── _Imports.razor ├── wwwroot │ └── images │ │ └── icon.png ├── CRXTimePicker.razor ├── BlazorTimePicker.csproj └── CRXTimePicker.razor.cs ├── BlazorTimePicker.sln ├── .gitattributes ├── README.md └── .gitignore /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /BlazorTimePicker/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNetCore.Components.Web -------------------------------------------------------------------------------- /BlazorTimePicker/wwwroot/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tossnet/BlazorTimePicker/master/BlazorTimePicker/wwwroot/images/icon.png -------------------------------------------------------------------------------- /BlazorTimePicker/CRXTimePicker.razor: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 10 |
11 | 12 |
13 | 19 |
20 |
21 |
-------------------------------------------------------------------------------- /BlazorTimePicker.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29926.136 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorTimePicker", "BlazorTimePicker\BlazorTimePicker.csproj", "{C81F091A-560D-4952-B03D-6C6C36A765F3}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {C81F091A-560D-4952-B03D-6C6C36A765F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {C81F091A-560D-4952-B03D-6C6C36A765F3}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {C81F091A-560D-4952-B03D-6C6C36A765F3}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {C81F091A-560D-4952-B03D-6C6C36A765F3}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {AC405C1F-7EA6-4429-96F8-FD74158E5D27} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /BlazorTimePicker/BlazorTimePicker.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 3.0 6 | true 7 | Justin 8 | CRX Solutions Malta 9 | BlazorTimePicker is aimed facilitate time picking functionality for Blazor applications. By default it will be styled using the Boostrap classes but one can easily pass custom css class to all elements of the component. 10 | MIT 11 | https://github.com/CRX-Solutions/BlazorTimePicker 12 | blazor, component, timepicker 13 | 1.2.0 14 | true 15 | icon.png 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | True 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /BlazorTimePicker/CRXTimePicker.razor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Microsoft.AspNetCore.Components; 5 | 6 | namespace BlazorTimePicker 7 | { 8 | public partial class CRXTimePicker 9 | { 10 | [Parameter] 11 | public TimeSpan Time { get; set; } = TimeSpan.Zero; 12 | 13 | [Parameter] 14 | public int MinutesSteps { get; set; } = 5; 15 | 16 | [Parameter] 17 | public TimeSpan StartTime { get; set; } = TimeSpan.Zero; 18 | 19 | 20 | [Parameter] 21 | public string ContainerClass { get; set; } = "container"; 22 | 23 | [Parameter] 24 | public string RowClass { get; set; } = "row"; // two fields 25 | 26 | [Parameter] 27 | public string ColumnClass { get; set; } = "col-sm"; // column 28 | 29 | [Parameter] 30 | public string SelectClass { get; set; } = "form-control"; // ui fluid dropdown 31 | 32 | 33 | [Parameter] 34 | public EventCallback TimeChanged { get; set; } 35 | 36 | protected void OnTimeChanged(ChangeEventArgs e, bool hours) 37 | { 38 | Time = (hours) 39 | ? TimeSpan.Parse($"{e.Value}:{Time.Minutes}") 40 | : TimeSpan.Parse($"{((StartTime != TimeSpan.Zero && Time.Hours < StartTime.Hours) ? StartTime.Hours : Time.Hours)}:{e.Value}"); 41 | 42 | TimeChanged.InvokeAsync(Time); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BlazorTimePicker ![BlazorTimePicker Nuget Package](https://img.shields.io/nuget/dt/BlazorTimePicker) 2 | Time picker for Blazor developed by **CRX Solutions**. 3 | 4 | ## Description 5 | This is a component that will facilitate time picking in a Blazor project. By default it is designed to use the Bootstrap styling. But you can pass your own CSS classes through the following parameters (**ContainerClass**, **RowClass**, **ColumnClass**, and **SelectClass**) 6 | 7 | ### UI Structure 8 | ``` 9 |
10 |
11 |
12 | 13 |
14 |
15 | 16 |
17 |
18 |
19 | ``` 20 | 21 | ## Notice 22 | This component is still in development and is not completely finished yet. 23 | 24 | ## Installation 25 | 1. [Download](https://www.nuget.org/packages/BlazorTimePicker) and install the **BlazorTimePicker** package from NuGet 26 | 27 | ## Usage 28 | 1. In **_imports.razor** file add the following using reference `@using BlazorTimePicker` 29 | 1. Then in the razor page add the **CRXTimePicker** component `` 30 | 31 | ### Parameters 32 | 33 | Parameter Name|Description 34 | --------------|----------- 35 | **Time**
[TimeSpan]|Initial time you want the BlazorTimePicker to be set to

**Default value:** 0
**Example:** `Time="@(new TimeSpan(8,30,0))` 36 | **MinutesSteps**
[int]|Minute interval

**Default value:** 5
**Example:** `MinutesSteps="10"` 37 | **StartTime**
[TimeSpan]|From which time you want the BlazorTimePicker to start from *e.g. when you have 'Time From' and 'Time To' and you want the 'Time To' to start from the selected 'Time From'*

**Default value:** 0
**Example:** `StartTime="@(new TimeSpan(12,45,0))` 38 | **ContainerClass**
[string]|

**Default value:** "container"
**Example:** `ContainerClass="container"` 39 | **RowClass**
[string]|

**Default value:** "row"
**Example:** `RowClass="two fields"` 40 | **ColumnClass**
[string]|

**Default value:** "col-sm"
**Example:** `ColumnClass="column"` 41 | **SelectClass**
[string]|

**Default value:** "form-control"
**Example:** `SelectClass="ui fluid dropdown"` 42 | **TimeChanged**
[`EventCallback`]|

**Default value:** N/A
**Example:** N/A 43 | 44 | ### Examples 45 | Description|Example 46 | -----------|------- 47 | Setting initial time|`` 48 | Setting initial time and minutes interval|`` 49 | Two way data binding for Time property|`@code {`
` private TimeSpan timeTo;`
`}`
`` 50 | 51 | ## Versions 52 | ### 1.1.9 53 | Replaced `