Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify deploying js/css #657

Merged
merged 5 commits into from
Jul 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions src/MatBlazor.Demo/Demo/DemoMatSelect.razor
Original file line number Diff line number Diff line change
@@ -82,6 +82,47 @@
</SourceContent>
</DemoContainer>


<MatAnchorContainer Anchor="MatSelectInt">
<MatH5>MatSelect Guid?</MatH5>
</MatAnchorContainer>
<DemoContainer>
<Content>
<MatSelect Label="Pick a Food Group" @bind-Value="@guidValue">
<MatOption TValue="Guid?" Value="@(null)"></MatOption>
<MatOption TValue="Guid?" Value="@(new Guid("20A82054-F493-4C7B-81A4-4F9A1EDD7C2E"))">Bread, Cereal, Rice, and Pasta</MatOption>
<MatOption TValue="Guid?" Value="@(new Guid("4451642D-24F7-418F-8741-BA5089A1CC65"))">Vegetables</MatOption>
<MatOption TValue="Guid?" Value="@(new Guid("5717DBBE-C205-4E33-9E07-892A51F64021"))">Fruit</MatOption>
</MatSelect>

<span>@guidValue</span>

@code
{
Guid? guidValue = new Guid("20A82054-F493-4C7B-81A4-4F9A1EDD7C2E");
}

</Content>
<SourceContent>
<BlazorFiddle Template="MatBlazor" Code=@(@"
<MatSelect Label=""Pick a Food Group"" @bind-Value=""@guidValue"">
<MatOption TValue=""Guid?"" Value=""@(null)""></MatOption>
<MatOption TValue=""Guid?"" Value=""@(new Guid(""20A82054-F493-4C7B-81A4-4F9A1EDD7C2E""))"">Bread, Cereal, Rice, and Pasta</MatOption>
<MatOption TValue=""Guid?"" Value=""@(new Guid(""4451642D-24F7-418F-8741-BA5089A1CC65""))"">Vegetables</MatOption>
<MatOption TValue=""Guid?"" Value=""@(new Guid(""5717DBBE-C205-4E33-9E07-892A51F64021""))"">Fruit</MatOption>
</MatSelect>

<span>@guidValue</span>

@code
{
Guid? guidValue = new Guid(""20A82054-F493-4C7B-81A4-4F9A1EDD7C2E"");
}

")></BlazorFiddle>
</SourceContent>
</DemoContainer>

<h5 class="mat-h5">Helper Text</h5>
<DemoContainer>
<Content>
10 changes: 9 additions & 1 deletion src/MatBlazor.Web/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# es6-webpack2-starter
To deploy static web assets, one needs to use `npm`. If you have NPM installed, see the "Manual deploy with NPM" section. If you prefer running `npm` isolated in a docker container, run `deploy.ps1` (requires powershell).

# Powershell deploy script

In this folder, run `.\deploy.ps1`.

⚠️ This overwrites the static web assets in `MatBlazor/src/MatBlazor/wwwroot/dist` ⚠️

# Manual deploy with NPM

[![npm](https://img.shields.io/npm/v/es6-webpack2-starter.svg?maxAge=2592000?style=flat-square)](https://www.npmjs.com/package/es6-webpack2-starter)
[![npm](https://img.shields.io/npm/l/es6-webpack2-starter.svg?maxAge=2592000?style=flat-square)](https://github.com/micooz/es6-webpack2-starter/blob/master/LICENSE)
8 changes: 8 additions & 0 deletions src/MatBlazor.Web/deploy.df
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node
WORKDIR src
COPY package.json .
COPY .babelrc .
COPY .eslintrc.js .
RUN npm install
COPY . .
RUN npm run build
6 changes: 6 additions & 0 deletions src/MatBlazor.Web/deploy.df.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
deploy.ps1
deploy.df
deploy.df.dockerignore
README.md
LICENSE
test.html
3 changes: 3 additions & 0 deletions src/MatBlazor.Web/deploy.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docker build -t matblazor_deploy -f deploy.df .
docker run -it --rm matblazor_deploy cat /MatBlazor/wwwroot/dist/matBlazor.js | Set-Content -Encoding ASCII ..\MatBlazor\wwwroot\dist\matBlazor.js
docker run -it --rm matblazor_deploy cat /MatBlazor/wwwroot/dist/matBlazor.css | Set-Content -Encoding ASCII ..\MatBlazor\wwwroot\dist\matBlazor.css
4 changes: 3 additions & 1 deletion src/MatBlazor/Core/MatBlazorSwitchT.cs
Original file line number Diff line number Diff line change
@@ -65,7 +65,9 @@ public virtual T FromBool(bool v)
.Case<MatBlazorSwitchT<DateTime>>(new MatBlazorSwitchTDateTime())
.Case<MatBlazorSwitchT<DateTime?>>(new MatBlazorSwitchTDateTimeNull())
.Case<MatBlazorSwitchT<bool>>(new MatBlazorSwitchTBool())
.Case<MatBlazorSwitchT<bool?>>(new MatBlazorSwitchTBoolNull());
.Case<MatBlazorSwitchT<bool?>>(new MatBlazorSwitchTBoolNull())
.Case<MatBlazorSwitchT<Guid>>(new MatBlazorSwitchTGuid())
.Case<MatBlazorSwitchT<Guid?>>(new MatBlazorSwitchTGuidNull());

public static MatBlazorSwitchT<T> Get()
{
67 changes: 67 additions & 0 deletions src/MatBlazor/Core/MatBlazorSwitchTGuid.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
using System;

namespace MatBlazor
{
public class MatBlazorSwitchTGuid : MatBlazorSwitchT<Guid>
{
public override Guid Increase(Guid v, Guid step, Guid max)
{
throw new NotImplementedException();
}

public override Guid Decrease(Guid v, Guid step, Guid min)
{
throw new NotImplementedException();
}

public override Guid Round(Guid v, int dp)
{
throw new NotImplementedException();
}

public override Guid GetMinimum()
{
throw new NotImplementedException();
}

public override Guid GetMaximum()
{
throw new NotImplementedException();
}

public override Guid GetStep()
{
throw new NotImplementedException();
}

public override string FormatValueAsString(Guid v, string format)
{
return v.ToString(format);
}

public override Guid ParseFromString(string v, string format)
{
return Guid.Parse(v);
}

public override Guid FromDateTimeNull(DateTime? v)
{
throw new NotImplementedException();
}

public override DateTime? ToDateTimeNull(Guid v)
{
throw new NotImplementedException();
}

public override Guid FromBoolNull(bool? v, bool indeterminate)
{
throw new NotImplementedException();
}

public override Guid FromDecimal(decimal v)
{
throw new NotImplementedException();
}
}
}
72 changes: 72 additions & 0 deletions src/MatBlazor/Core/MatBlazorSwitchTGuidNull.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using System;

namespace MatBlazor
{
public class MatBlazorSwitchTGuidNull : MatBlazorSwitchT<Guid?>
{
public override Guid? Increase(Guid? v, Guid? step, Guid? max)
{
throw new NotImplementedException();
}

public override Guid? Decrease(Guid? v, Guid? step, Guid? min)
{
throw new NotImplementedException();
}

public override Guid? Round(Guid? v, int dp)
{
throw new NotImplementedException();
}

public override Guid? GetMinimum()
{
throw new NotImplementedException();
}

public override Guid? GetMaximum()
{
throw new NotImplementedException();
}

public override Guid? GetStep()
{
throw new NotImplementedException();
}

public override string FormatValueAsString(Guid? v, string format)
{
return v?.ToString(format);
}

public override Guid? ParseFromString(string v, string format)
{
if (Guid.TryParse(v, out var result))
{
return result;
}

return null;
}

public override Guid? FromDateTimeNull(DateTime? v)
{
throw new NotImplementedException();
}

public override DateTime? ToDateTimeNull(Guid? v)
{
throw new NotImplementedException();
}

public override Guid? FromBoolNull(bool? v, bool indeterminate)
{
throw new NotImplementedException();
}

public override Guid? FromDecimal(decimal v)
{
throw new NotImplementedException();
}
}
}