Skip to content

Commit 1f637e4

Browse files
author
ricwilson
committed
Closes Issue #349 and #342 for height on subgrid
1 parent 0a96bc0 commit 1f637e4

File tree

7 files changed

+47
-51
lines changed

7 files changed

+47
-51
lines changed

AzureMapsGrid/AzureMapsGrid/AzureMapsGridControl/Other/Solution.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<LocalizedName description="AzureMapsGridControl" languagecode="1033" />
77
</LocalizedNames>
88
<Descriptions />
9-
<Version>1.0.196</Version>
9+
<Version>1.0.198</Version>
1010
<Managed>2</Managed>
1111
<Publisher>
1212
<UniqueName>RAW</UniqueName>

AzureMapsGrid/AzureMapsGrid/ControlManifest.Input.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest>
3-
<control namespace="RAW.AzureMapsGrid" constructor="AzureMapsGrid" version="0.0.254" display-name-key="Azure Maps Grid" description-key="AzureMapsGrid description" control-type="standard">
3+
<control namespace="RAW.AzureMapsGrid" constructor="AzureMapsGrid" version="0.0.256" display-name-key="Azure Maps Grid" description-key="AzureMapsGrid description" control-type="standard">
44
<!-- dataset node represents a set of entity records on CDS; allow more than one datasets -->
55
<data-set name="mapDataSet" display-name-key="Map Data Set">
66
</data-set>

AzureMapsGrid/AzureMapsGrid/index.ts

Lines changed: 27 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as ReactDOM from 'react-dom';
2-
import {IInputs, IOutputs} from "./generated/ManifestTypes";
2+
import { IInputs, IOutputs } from "./generated/ManifestTypes";
33
import DataSetInterfaces = ComponentFramework.PropertyHelper.DataSetApi;
4-
import {AzureMapsGridControl} from "./AzureMapsGridControl"
5-
import {Spinner} from 'spin.js'
4+
import { AzureMapsGridControl } from "./AzureMapsGridControl"
5+
import { Spinner } from 'spin.js'
66
import * as atlas from "azure-maps-control";
77
import { isNumber, isString } from "util";
88
import { IProps } from "./AzureMapsGridControl";
@@ -14,33 +14,21 @@ interface IPosition {
1414
}
1515

1616
export class AzureMapsGrid implements ComponentFramework.StandardControl<IInputs, IOutputs> {
17-
17+
1818
//contains all the elements for the control
1919
private _container: HTMLDivElement;
2020
private _mapDiv: HTMLDivElement;
2121
private _mapInfoDiv: HTMLDivElement;
22-
23-
//map parameters
24-
private _aMap: atlas.Map;
25-
private _aMapSource: atlas.source.DataSource;
26-
//private _bMapOptions: atlas.Map.options//.Maps.IViewOptions;
27-
private _aMapPushpinDefaultColor: string;
28-
private _aMapPopup: atlas.Popup;
29-
private _aMapPopupInvalidRecords: atlas.Popup;
30-
private _aMapPopupTemplate: string;
31-
private _loadingSpinner: Spinner;
22+
private _aMapPushpinDefaultColor: string;
3223

3324
private props: IProps;
3425

3526
// PCF framework delegate which will be assigned to this object which would be called whenever any update happens.
36-
private _notifyOutputChanged: () => void;
37-
// Event Handler 'refreshData' reference
38-
private _refreshData: EventListenerOrEventListenerObject;
27+
private _notifyOutputChanged: () => void;
3928
// Reference to ComponentFramework Context object
4029
private _context: ComponentFramework.Context<IInputs>;
41-
42-
constructor()
43-
{
30+
31+
constructor() {
4432

4533
}
4634

@@ -52,60 +40,62 @@ export class AzureMapsGrid implements ComponentFramework.StandardControl<IInputs
5240
* @param state A piece of data that persists in one session for a single user. Can be set at any point in a controls life cycle by calling 'setControlState' in the Mode interface.
5341
* @param container If a control is marked control-type='standard', it will receive an empty div element within which it can render its content.
5442
*/
55-
public init(context: ComponentFramework.Context<IInputs>, notifyOutputChanged: () => void, state: ComponentFramework.Dictionary, container:HTMLDivElement)
56-
{
43+
public init(context: ComponentFramework.Context<IInputs>, notifyOutputChanged: () => void, state: ComponentFramework.Dictionary, container: HTMLDivElement) {
44+
context.mode.trackContainerResize(true);
5745
this._notifyOutputChanged = notifyOutputChanged;
5846
this._context = context;
5947
this._container = container;
60-
this._aMapPushpinDefaultColor = this._context.parameters?.defaultPushpinColor?.raw || "#4288f7";
48+
this._aMapPushpinDefaultColor = this._context.parameters?.defaultPushpinColor?.raw || "#4288f7";
6149

6250
this.props = {
6351
pcfContext: this._context
6452
};
6553

54+
//@ts-expect-error - we are setting the height of the container to 100% if we are in a model driven app
55+
this._container.style.height = this._context.mode?.rowSpan ? `${(this._context.mode.rowSpan * 1.5).toString()}em` : "100%"
56+
57+
this._container.style.zIndex = "0";
58+
6659
//set the paging size to 5000
67-
context.parameters.mapDataSet.paging.setPageSize(5000);
68-
}
60+
context.parameters.mapDataSet.paging.setPageSize(5000);
61+
}
6962

7063
/**
7164
* Called when any value in the property bag has changed. This includes field values, data-sets, global values such as container height and width, offline status, control metadata values such as label, visible, etc.
7265
* @param context The entire property bag available to control via Context Object; It contains values as set up by the customizer mapped to names defined in the manifest, as well as utility functions
7366
*/
74-
public updateView(context: ComponentFramework.Context<IInputs>): void
75-
{
76-
const dataSet = context.parameters.mapDataSet;
67+
public updateView(context: ComponentFramework.Context<IInputs>): void {
68+
const dataSet = context.parameters.mapDataSet;
7769

7870
if (dataSet.loading) return;
7971

8072
//if data set has additional pages retrieve them before running anything else
8173
if (dataSet.paging.hasNextPage) {
8274
dataSet.paging.loadNextPage();
8375
return;
84-
}
76+
}
8577

8678
ReactDOM.render(
8779
React.createElement(
8880
AzureMapsGridControl, this.props
89-
),
81+
),
9082
this._container
91-
);
92-
}
93-
83+
);
84+
}
85+
9486
/**
9587
* It is called by the framework prior to a control receiving new data.
9688
* @returns an object based on nomenclature defined in manifest, expecting object[s] for property marked as “bound” or “output”
9789
*/
98-
public getOutputs(): IOutputs
99-
{
90+
public getOutputs(): IOutputs {
10091
return {};
10192
}
10293

10394
/**
10495
* Called when the control is to be removed from the DOM tree. Controls should use this call for cleanup.
10596
* i.e. cancelling any pending remote calls, removing listeners, etc.
10697
*/
107-
public destroy(): void
108-
{
98+
public destroy(): void {
10999
//unmount control on destroy
110100
ReactDOM.unmountComponentAtNode(this._container);
111101
}

AzureMapsGrid/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,18 @@ Pushpin Color Field - Enter the Pushpin Color field schema name if available, th
6262

6363
Default Pushpin Color - Enter a hex value for the default color of the Pushpins(example: #ffffff). Otherwise the default Azure Maps color will be used. Also this default color will be overwritten with specific colors if the Pushpin Color Field is also utilized and that field contains data.
6464

65+
# Configuring for Subgrid Usage
66+
67+
To use the Azure Maps control within a subgrid:
68+
69+
1. Open the form in the Classic view (not the modern form designer).
70+
2. Select the subgrid where you want to add the Azure Maps control.
71+
3. In the subgrid properties, update the number of rows to your desired value.
72+
4. Make sure to **uncheck** the "Auto expand to use available space" option. This ensures the map displays correctly and does not stretch unexpectedly.
73+
5. Save and publish your changes.
74+
75+
![Subgrid Configuration Example](./images/azuremaps-subgrid-settings.png)
76+
6577
# Useful Links
6678

6779
[Github react-azure-maps](https://github.com/WiredSolutions/react-azure-maps)
Loading

AzureMapsGrid/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
"scripts": {
66
"build": "pcf-scripts build",
77
"clean": "pcf-scripts clean",
8+
"lint": "pcf-scripts lint",
9+
"lint:fix": "pcf-scripts lint fix",
810
"rebuild": "pcf-scripts rebuild",
9-
"start": "pcf-scripts start"
11+
"start": "pcf-scripts start",
12+
"start:watch": "pcf-scripts start watch",
13+
"refreshTypes": "pcf-scripts refreshTypes"
1014
},
1115
"dependencies": {
1216
"@types/node": "^10.17.24",

ImageCrop/Solution/RAW!ImageCropControl/RAW!ImageCropControl.cdsproj

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
<PropertyGroup>
44
<PowerAppsTargetsPath>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\PowerApps</PowerAppsTargetsPath>
55
</PropertyGroup>
6-
76
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
87
<Import Project="$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Solution.props" Condition="Exists('$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Solution.props')" />
9-
108
<PropertyGroup>
119
<ProjectGuid>c63799fc-c977-4c5a-9d0c-05546b540ec9</ProjectGuid>
1210
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
@@ -15,7 +13,6 @@
1513
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
1614
<SolutionRootPath>src</SolutionRootPath>
1715
</PropertyGroup>
18-
1916
<!--
2017
Solution Packager overrides, un-comment to use: SolutionPackagerType (Managed, Unmanaged, Both)
2118
Solution Localization Control, if you want to enabled localization of your solution, un-comment SolutionPackageEnableLocalization and set the value to true. - Requires use of -loc flag on Solution Clone or Sync
@@ -24,13 +21,10 @@
2421
<SolutionPackageType>Both</SolutionPackageType>
2522
<SolutionPackageEnableLocalization>false</SolutionPackageEnableLocalization>
2623
</PropertyGroup>
27-
28-
2924
<ItemGroup>
3025
<PackageReference Include="Microsoft.PowerApps.MSBuild.Solution" Version="1.*" />
3126
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
3227
</ItemGroup>
33-
3428
<ItemGroup>
3529
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\.gitignore" />
3630
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\bin\**" />
@@ -39,19 +33,15 @@
3933
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.cdsproj.user" />
4034
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.sln" />
4135
</ItemGroup>
42-
4336
<ItemGroup>
4437
<None Include="$(MSBuildThisFileDirectory)\**" Exclude="@(ExcludeDirectories)" />
4538
<Content Include="$(SolutionPackageZipFilePath)">
4639
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
4740
</Content>
4841
</ItemGroup>
49-
5042
<ItemGroup>
5143
<ProjectReference Include="..\..\ImageCrop.pcfproj" />
5244
</ItemGroup>
53-
5445
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
5546
<Import Project="$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Solution.targets" Condition="Exists('$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Solution.targets')" />
56-
57-
</Project>
47+
</Project>

0 commit comments

Comments
 (0)