Skip to content

Commit 465ca08

Browse files
authored
Merge pull request #381 from microsoft/beta
Merging beta to main for Messagebar release
2 parents 51a6a36 + 9cd53c3 commit 465ca08

40 files changed

+17628
-0
lines changed

.github/workflows/create-release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ jobs:
5757
`${process.env.GITHUB_WORKSPACE}/DonutChart/DonutChart`,
5858
`${process.env.GITHUB_WORKSPACE}/Elevation/Elevation`,
5959
`${process.env.GITHUB_WORKSPACE}/Facepile/Facepile`,
60+
`${process.env.GITHUB_WORKSPACE}/FluentMessageBar/FluentMessageBar`,
6061
`${process.env.GITHUB_WORKSPACE}/GaugeChart/GaugeChart`,
6162
`${process.env.GITHUB_WORKSPACE}/HorizontalBarChart/HorizontalBarChart`,
6263
`${process.env.GITHUB_WORKSPACE}/Icon/Icon`,
@@ -143,6 +144,12 @@ jobs:
143144
npm install
144145
npm ci
145146
147+
- name: Install Dependencies in FluentMessageBar
148+
run: |
149+
cd ./FluentMessageBar
150+
npm install
151+
npm ci
152+
146153
- name: Install Dependencies in GaugeChart
147154
run: |
148155
cd ./GaugeChart

.github/workflows/pr_validate_all.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
- "./DonutChart"
2323
- "./Elevation"
2424
- "./Facepile"
25+
- "./FluentMessageBar"
2526
- "./GaugeChart"
2627
- "./HorizontalBarChart"
2728
- "./Icon"

FluentMessageBar/.eslintrc.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2020": true
5+
},
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:@typescript-eslint/recommended",
9+
"plugin:react/recommended",
10+
"plugin:sonarjs/recommended"
11+
],
12+
"globals": {
13+
"ComponentFramework": true
14+
},
15+
"parser": "@typescript-eslint/parser",
16+
"parserOptions": {
17+
"ecmaFeatures": {
18+
"jsx": true
19+
},
20+
"ecmaVersion": 12,
21+
"sourceType": "module"
22+
},
23+
"plugins": [
24+
"react",
25+
"@microsoft/power-apps",
26+
"@typescript-eslint",
27+
"sonarjs"
28+
],
29+
"ignorePatterns": [
30+
"**/generated/*.ts"
31+
],
32+
"rules": {
33+
"indent": [
34+
"error",
35+
4
36+
],
37+
"quotes": [
38+
"error",
39+
"single"
40+
],
41+
"semi": [
42+
"error",
43+
"always"
44+
]
45+
},
46+
"settings": {
47+
"react": {
48+
"version": "detect"
49+
}
50+
}
51+
}

FluentMessageBar/.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
6+
# generated directory
7+
**/generated
8+
9+
# output directory
10+
/out
11+
12+
# msbuild output directories
13+
/bin
14+
/obj
15+
16+
# MSBuild Binary and Structured Log
17+
*.binlog
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<PowerAppsTargetsPath>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\PowerApps</PowerAppsTargetsPath>
5+
</PropertyGroup>
6+
7+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
8+
<Import Project="$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Pcf.props" Condition="Exists('$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Pcf.props')" />
9+
10+
<PropertyGroup>
11+
<Name>FluentMessageBar</Name>
12+
<ProjectGuid>83e9e0ca-0753-45c4-893a-ed5ffca3f1f5</ProjectGuid>
13+
<OutputPath>$(MSBuildThisFileDirectory)out\controls</OutputPath>
14+
<PcfBuildMode>production</PcfBuildMode>
15+
</PropertyGroup>
16+
17+
<PropertyGroup>
18+
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
19+
<!--Remove TargetFramework when this is available in 16.1-->
20+
<TargetFramework>net462</TargetFramework>
21+
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
22+
</PropertyGroup>
23+
24+
<ItemGroup>
25+
<PackageReference Include="Microsoft.PowerApps.MSBuild.Pcf" Version="1.*" />
26+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
27+
</ItemGroup>
28+
29+
<ItemGroup>
30+
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\.gitignore" />
31+
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\bin\**" />
32+
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\obj\**" />
33+
<ExcludeDirectories Include="$(OutputPath)\**" />
34+
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.pcfproj" />
35+
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.pcfproj.user" />
36+
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.sln" />
37+
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\node_modules\**" />
38+
</ItemGroup>
39+
40+
<ItemGroup>
41+
<None Include="$(MSBuildThisFileDirectory)\**" Exclude="@(ExcludeDirectories)" />
42+
</ItemGroup>
43+
44+
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
45+
<Import Project="$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Pcf.targets" Condition="Exists('$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Pcf.targets')" />
46+
47+
</Project>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# msbuild output directories
4+
/bin
5+
/obj
6+
7+
# MSBuild Binary and Structured Log
8+
*.binlog
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest>
3+
<control namespace="PowerCAT" constructor="FluentMessageBar" version="0.0.33" display-name-key="FluentMessageBar_Display_Key" description-key="FluentMessageBar_Descripition_Key" control-type="virtual">
4+
<!-- property node identifies a specific, configurable piece of data that the control expects from CDS -->
5+
<property name="Shape" display-name-key="Shape_Key" description-key="Defines the shape of the message bar (rounded, square, etc.)." of-type="Enum" usage="input" required="true" default-value="square">
6+
<value name="square" display-name-key="Square" description-key="Square">square</value>
7+
<value name="rounded" display-name-key="Rounded" description-key="Rounded">rounded</value>
8+
</property>
9+
<property name="Intent" display-name-key="Intent_Key" description-key="Determines the message type, such as informational, success, warning, or error." of-type="Enum" usage="input" required="true" default-value="info">
10+
<value name="info" display-name-key="Info" description-key="Info message type">info</value>
11+
<value name="warning" display-name-key="Warning" description-key="Warning message type">warning</value>
12+
<value name="error" display-name-key="Error" description-key="Error message type">error</value>
13+
<value name="success" display-name-key="Success" description-key="Success message type">success</value>
14+
</property>
15+
<property name="Title" display-name-key="Title_Key" description-key="The title displayed on the message bar." of-type="SingleLine.Text" usage="input" required="false" />
16+
<property name="Body" display-name-key="Body_Key" description-key="The main content or message body." of-type="SingleLine.Text" usage="input" required="true" />
17+
<property name="LinkText" display-name-key="LinkText_Key" description-key="link text that appears in the message bar." of-type="SingleLine.Text" usage="input" required="false" />
18+
<property name="URL" display-name-key="URL_Key" description-key="link that appears in the message bar." of-type="SingleLine.Text" usage="input" required="false" />
19+
<property name="AutoHeight" display-name-key="Messagebar_AutoHeight_Display_Key" description-key="Messagebar_AutoHeight_Display_Key" usage="output" of-type="Whole.None" />
20+
<property name="HideDismiss" display-name-key="Messagebar_HideDismiss_Display_Key" of-type="TwoOptions" usage="input" required="true" default-value="false" />
21+
<common-property name="Width" default-value="350" />
22+
<common-property name="Height" default-value="55" pfx-default-value="Self.AutoHeight" />
23+
<!-- -->
24+
<data-set name="Items" display-name-key="Messagebar_Toolbar_Items_Display_Key" description-key="Messagebar_Toolbar_Items_Desc_Key" pfx-default-value="Table(&#xD;&#xA; {ItemKey: &quot;mail&quot;, ItemDisplayName: &quot;Contact&quot;, ItemIconName: &quot;Mail&quot;, ItemAppearance: &quot;&quot;, ItemIconStyle: &quot;Regular&quot;, ItemTooltip: &quot;Send mail&quot;, ItemVisible: true, ItemDisabled: false},{ItemKey: &quot;chat&quot;, ItemDisplayName: &quot;Chat&quot;, ItemIconName: &quot;Chat&quot;, ItemAppearance: &quot;&quot;, ItemIconStyle: &quot;Regular&quot;, ItemTooltip: &quot;Chat&quot;})">
25+
<property-set name="ItemDisplayName" display-name-key="Messagebar_Toolbar_Items_ItemDisplayName" of-type="SingleLine.Text" usage="bound" required="true" />
26+
<property-set name="ItemKey" display-name-key="Messagebar_Toolbar_Items_ItemKey" of-type="SingleLine.Text" usage="bound" required="true" />
27+
<property-set name="ItemDisabled" display-name-key="Messagebar_Toolbar_Items_ItemDisabled" of-type="TwoOptions" usage="bound" required="false" />
28+
<property-set name="ItemVisible" display-name-key="Messagebar_Toolbar_Items_ItemVisible" of-type="TwoOptions" usage="bound" required="false" />
29+
<property-set name="ItemIconName" display-name-key="Messagebar_Toolbar_Items_ItemIconName" of-type="SingleLine.Text" usage="bound" required="false" />
30+
<property-set name="ItemIconStyle" display-name-key="Messagebar_Toolbar_Items_ItemIconStyle" of-type="SingleLine.Text" usage="bound" required="false" />
31+
<property-set name="ItemAppearance" display-name-key="Messagebar_Toolbar_Items_ItemAppearance" of-type="SingleLine.Text" usage="bound" required="false" />
32+
<property-set name="ItemTooltip" display-name-key="Messagebar_Toolbar_Items_ItemTooltip" of-type="SingleLine.Text" usage="bound" required="false" />
33+
</data-set>
34+
<!-- Custom Events -->
35+
<event name="OnDismiss" display-name-key="OnDismiss" description-key="OnDismiss_Desc" />
36+
<common-event name="OnSelect" pfx-default-value="Switch(Self.Selected.ItemKey,/* Action for Key 'mail' */&quot;mail&quot;,Notify(&quot;Contact clicked&quot;),/* Action for 'chat' */&quot;chat&quot;,Notify(&quot;Chat clicked&quot;),/* Default action */ Notify(&quot;Unrecognized button clicked&quot;))" />
37+
<resources>
38+
<code path="index.ts" order="1" />
39+
<resx path="strings/FluentMessageBar.1033.resx" version="1.0.0" />
40+
<platform-library name="React" version="16.14.0" />
41+
<platform-library name="Fluent" version="9.46.2" />
42+
<css path="css/messagebar.css" order="1" />
43+
</resources>
44+
</control>
45+
</manifest>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
export const enum ItemColumns {
2+
DisplayName = 'ItemDisplayName',
3+
Key = 'ItemKey',
4+
IconName = 'ItemIconName',
5+
IconStyle = 'ItemIconStyle',
6+
Visible = 'ItemVisible',
7+
Disabled = 'ItemDisabled',
8+
Appearance = 'ItemAppearance',
9+
Tooltip = 'ItemTooltip',
10+
}
11+
12+
export const enum StringConstants {
13+
Regular = 'Regular',
14+
Subtle = 'subtle',
15+
AboveHeader = 'Above header',
16+
BelowHeader = 'Below header',
17+
}
18+
19+
export const Size = {
20+
Large: 'large',
21+
Medium: 'medium',
22+
Small: 'small',
23+
};
24+
25+
export const Layout = {
26+
'Icon only': 'icon',
27+
'Text only': 'text',
28+
'Icon before': 'before',
29+
'Icon after': 'after',
30+
'Icon above': 'above',
31+
};
32+
33+
export const enum ManifestPropertyNames {
34+
dataset = 'dataset',
35+
}
36+
37+
export const Orientation = {
38+
Vertical: 'vertical',
39+
Horizontal: 'horizontal',
40+
};
41+
42+
export const enum Alignment {
43+
Alignment = 'Alignment',
44+
}
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/* istanbul ignore file */
2+
3+
export class MockContext<T> implements ComponentFramework.Context<T> {
4+
constructor(parameters: T) {
5+
this.parameters = parameters;
6+
this.mode = {
7+
allocatedHeight: -1,
8+
allocatedWidth: -1,
9+
isControlDisabled: false,
10+
isVisible: true,
11+
label: '',
12+
setControlState: jest.fn(),
13+
setFullScreen: jest.fn(),
14+
trackContainerResize: jest.fn(),
15+
};
16+
this.client = {
17+
disableScroll: false,
18+
getClient: jest.fn(),
19+
getFormFactor: jest.fn(),
20+
isOffline: jest.fn(),
21+
isNetworkAvailable: jest.fn(),
22+
};
23+
24+
// Canvas apps currently assigns a positive tab-index
25+
// so we must use this property to assign a positive tab-index also
26+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
27+
(this as any).accessibility = { assignedTabIndex: 0 };
28+
}
29+
client: ComponentFramework.Client;
30+
device: ComponentFramework.Device;
31+
factory: ComponentFramework.Factory;
32+
formatting: ComponentFramework.Formatting;
33+
mode: ComponentFramework.Mode;
34+
navigation: ComponentFramework.Navigation;
35+
resources: ComponentFramework.Resources;
36+
userSettings: ComponentFramework.UserSettings;
37+
utils: ComponentFramework.Utility;
38+
webAPI: ComponentFramework.WebApi;
39+
parameters: T;
40+
updatedProperties: string[] = [];
41+
events: IEventBag;
42+
}
43+
44+
export class MockState implements ComponentFramework.Dictionary {}
45+
46+
export class MockStringProperty implements ComponentFramework.PropertyTypes.StringProperty {
47+
constructor(raw?: string | null, formatted?: string | undefined) {
48+
this.raw = raw ?? null;
49+
this.formatted = formatted;
50+
}
51+
raw: string | null;
52+
attributes?: ComponentFramework.PropertyHelper.FieldPropertyMetadata.StringMetadata | undefined;
53+
error: boolean;
54+
errorMessage: string;
55+
formatted?: string | undefined;
56+
security?: ComponentFramework.PropertyHelper.SecurityValues | undefined;
57+
type: string;
58+
}
59+
60+
export class MockWholeNumberProperty implements ComponentFramework.PropertyTypes.WholeNumberProperty {
61+
constructor(raw?: number | null, formatted?: string | undefined) {
62+
this.raw = raw ?? null;
63+
this.formatted = formatted;
64+
}
65+
attributes?: ComponentFramework.PropertyHelper.FieldPropertyMetadata.WholeNumberMetadata | undefined;
66+
raw: number | null;
67+
error: boolean;
68+
errorMessage: string;
69+
formatted?: string | undefined;
70+
security?: ComponentFramework.PropertyHelper.SecurityValues | undefined;
71+
type: string;
72+
}
73+
74+
export class MockEnumProperty<T> implements ComponentFramework.PropertyTypes.EnumProperty<T> {
75+
constructor(raw?: T, type?: string) {
76+
if (raw) this.raw = raw;
77+
if (type) this.type = type;
78+
}
79+
type: string;
80+
raw: T;
81+
}
82+
83+
export class MockTwoOptionsProperty implements ComponentFramework.PropertyTypes.TwoOptionsProperty {
84+
constructor(raw?: boolean) {
85+
if (raw) this.raw = raw;
86+
}
87+
raw: boolean;
88+
attributes?: ComponentFramework.PropertyHelper.FieldPropertyMetadata.TwoOptionMetadata | undefined;
89+
error: boolean;
90+
errorMessage: string;
91+
formatted?: string | undefined;
92+
security?: ComponentFramework.PropertyHelper.SecurityValues | undefined;
93+
type: string;
94+
}
95+
96+
export class MockDateTimeProperty implements ComponentFramework.PropertyTypes.DateTimeProperty {
97+
constructor(raw?: Date) {
98+
if (raw) this.raw = raw;
99+
}
100+
raw: Date;
101+
attributes?: ComponentFramework.PropertyHelper.FieldPropertyMetadata.DateTimeMetadata | undefined;
102+
error: boolean;
103+
errorMessage: string;
104+
formatted?: string | undefined;
105+
security?: ComponentFramework.PropertyHelper.SecurityValues | undefined;
106+
type: string;
107+
}
108+
109+
export declare type IEventBag = Record<string, () => void>;

0 commit comments

Comments
 (0)