Skip to content

Commit a918439

Browse files
committed
more typing support, cosmetic changes
1 parent b870819 commit a918439

File tree

7 files changed

+209
-135
lines changed

7 files changed

+209
-135
lines changed

docs/documentation/docs/controls/LocationPicker.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ The `LocationPicker` can be configured with the following properties:
7171
| className | string | no | Applies custom styling |
7272
| label | string | no | Label to use for the control. |
7373
| placeholder | string | no | Placeholder label to show in the dropdown. |
74-
| onSelectionChanged | (locItem: ILocationPickerItem) => void | no | The method that returns location data JSON object. |
74+
| onChange | (locItem: ILocationPickerItem) => void | no | The method that returns location data JSON object. |

src/controls/dynamicForm/dynamicField/DynamicField.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export class DynamicField extends React.Component<IDynamicFieldProps, IDynamicFi
195195
context={context}
196196
disabled={disabled}
197197
placeholder={placeholder}
198-
onSelectionChanged={(newValue) => { this.onChange(newValue); }}
198+
onChange={(newValue) => { this.onChange(newValue); }}
199199
defaultValue={defaultValue}
200200
errorMessage={errorText}
201201
/>
@@ -503,7 +503,13 @@ export class DynamicField extends React.Component<IDynamicFieldProps, IDynamicFi
503503
}
504504

505505
private onURLChange = (value: string, isUrl: boolean) => {
506-
let currValue = this.state.changedValue || this.props.fieldDefaultValue || {
506+
const {
507+
fieldDefaultValue,
508+
onChanged,
509+
columnInternalName
510+
} = this.props;
511+
512+
let currValue = this.state.changedValue || fieldDefaultValue || {
507513
Url: '',
508514
Description: ''
509515
};
@@ -521,7 +527,10 @@ export class DynamicField extends React.Component<IDynamicFieldProps, IDynamicFi
521527
this.setState({
522528
changedValue: currValue
523529
});
524-
this.props.onChanged(this.props.columnInternalName, currValue);
530+
531+
if (onChanged) {
532+
onChanged(columnInternalName, currValue);
533+
}
525534
}
526535

527536
private onChange = (value: any) => {

src/controls/locationPicker/ILocationPicker.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ export interface ILocationPickerItem {
1616
Coordinates?: any;
1717
}
1818

19-
interface IAddress
20-
{
21-
City?:string;
22-
CountryOrRegion?:string;
23-
State?:string;
24-
Street?:string;
19+
interface IAddress {
20+
City?: string;
21+
CountryOrRegion?: string;
22+
State?: string;
23+
Street?: string;
2524
}
2625

2726
export interface ILocationPickerProps {
@@ -52,19 +51,19 @@ export interface ILocationPickerProps {
5251
/**
5352
* Callback issued when the selected option changes
5453
*/
55-
onSelectionChanged?: (newValue: ILocationPickerItem) => void;
54+
onChange?: (newValue: ILocationPickerItem) => void;
5655

5756
/**
5857
* This can be use to show error message for combobox
5958
*/
60-
errorMessage?:string;
59+
errorMessage?: string;
6160
}
6261

6362
export interface ILocationPickerState {
6463
currentMode: Mode;
6564
searchText: string;
6665
isCalloutVisible: boolean;
67-
seletedItem: any;
66+
seletedItem: ILocationPickerItem;
6867
/**
6968
* The options available to the listPicker
7069
*/

src/controls/locationPicker/LocationPicker.module.scss

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
max-height: 300px;
66
}
77

8-
.pickerItemcontainer {
8+
.pickerItemContainer {
99
display: -webkit-box;
1010
display: -ms-flexbox;
1111
border-style: solid;
1212
border-color: "[theme: themePrimary, default: #0078d7]";
1313
border-radius: 22px;
1414
min-width: 16px;
15+
border-width: 2px;
1516
width: fit-content;
1617
}
1718

@@ -29,16 +30,14 @@
2930
white-space: nowrap;
3031
}
3132

32-
.locationAddressContainer:hover {
33-
background-color: "[theme:listItemBackgroundHover, default:#f4f4f4]";
34-
}
35-
36-
.locationAddressContainer:active {
37-
border-color: "[theme: themePrimary, default: #0078d7]";
38-
}
39-
4033
.locationAddressContainer {
4134
border: 2px solid transparent;
35+
&:hover {
36+
background-color: "[theme:listItemBackgroundHover, default:#f4f4f4]";
37+
}
38+
&:active {
39+
border-color: "[theme: themePrimary, default: #0078d7]";
40+
}
4241
}
4342

4443
.locationContainer {

0 commit comments

Comments
 (0)