Skip to content

Commit 5079296

Browse files
committed
additional localization, comments for the component props, bing API key
1 parent e9da69f commit 5079296

File tree

5 files changed

+64
-35
lines changed

5 files changed

+64
-35
lines changed

src/controls/dynamicForm/IDynamicFormProps.ts

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,36 @@ import { ExtensionContext } from '@microsoft/sp-extension-base';
22
import { WebPartContext } from '@microsoft/sp-webpart-base';
33

44
export interface IDynamicFormProps {
5-
context: WebPartContext | ExtensionContext;
6-
disabled?: boolean;
7-
listId: string;
8-
onSubmitted?: (ListItem: any) => void;
9-
onCancelled?: () => void;
10-
listItemId?: number;
11-
contentTypeId?: string;
5+
/**
6+
* Current context
7+
*/
8+
context: WebPartContext | ExtensionContext;
9+
/**
10+
* Specifies if the form is disabled
11+
*/
12+
disabled?: boolean;
13+
/**
14+
* List id
15+
*/
16+
listId: string;
17+
/**
18+
* Handler for form submitted event
19+
*/
20+
onSubmitted?: (ListItem: any) => void;
21+
/**
22+
* Handler for form cancelled event
23+
*/
24+
onCancelled?: () => void;
25+
/**
26+
* ID of the list item to display on the form
27+
*/
28+
listItemId?: number;
29+
/**
30+
* Content type id of the item
31+
*/
32+
contentTypeId?: string;
33+
/**
34+
* Used to execute WebSearch. If not provided SearchTab will not be available.
35+
*/
36+
bingAPIKey?: string;
1237
}

src/controls/dynamicForm/dynamicField/DynamicField.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ export class DynamicField extends React.Component<IDynamicFieldProps, IDynamicFi
6363
label,
6464
placeholder,
6565
required,
66-
isRichText
66+
isRichText,
67+
bingAPIKey
6768
} = this.props;
6869

6970
const {
@@ -319,7 +320,7 @@ export class DynamicField extends React.Component<IDynamicFieldProps, IDynamicFi
319320
}
320321
<FilePicker
321322
buttonClassName={styles.feildDisplay}
322-
bingAPIKey="<BING API KEY>"
323+
bingAPIKey={bingAPIKey}
323324
accepts={[".gif", ".jpg", ".jpeg", ".bmp", ".dib", ".tif", ".tiff", ".ico", ".png", ".jxr", ".svg"]}
324325
buttonIcon="FileImage"
325326
onSave={this.saveIntoSharePoint}
@@ -345,7 +346,7 @@ export class DynamicField extends React.Component<IDynamicFieldProps, IDynamicFi
345346
/>
346347
<FilePicker
347348
buttonClassName={styles.feildDisplay}
348-
bingAPIKey="<BING API KEY>"
349+
bingAPIKey={bingAPIKey}
349350
accepts={[".gif", ".jpg", ".jpeg", ".bmp", ".dib", ".tif", ".tiff", ".ico", ".png", ".jxr", ".svg"]}
350351
buttonIcon="FileImage"
351352
onSave={this.saveIntoSharePoint}
@@ -368,7 +369,7 @@ export class DynamicField extends React.Component<IDynamicFieldProps, IDynamicFi
368369
placeholder={placeholder}
369370
allowMultipleSelections={true}
370371
termsetNameOrID={fieldTermSetId}
371-
panelTitle="Select Term"
372+
panelTitle={strings.DynamicFormTermPanelTitle}
372373
context={context}
373374
onChange={(newValue?: IPickerTerms) => { this.onChange(newValue); }}
374375
isTermSetSelectable={false}
@@ -388,7 +389,7 @@ export class DynamicField extends React.Component<IDynamicFieldProps, IDynamicFi
388389
placeholder={placeholder}
389390
allowMultipleSelections={false}
390391
termsetNameOrID={fieldTermSetId}
391-
panelTitle="Select Term"
392+
panelTitle={strings.DynamicFormTermPanelTitle}
392393
context={context}
393394
onChange={(newValue?: IPickerTerms) => { this.onChange(newValue); }}
394395
isTermSetSelectable={false} />

src/controls/dynamicForm/dynamicField/IDynamicFieldProps.ts

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,27 @@ import { IDropdownOption } from "office-ui-fabric-react/lib/Dropdown";
33
import { WebPartContext } from '@microsoft/sp-webpart-base';
44

55
export interface IDynamicFieldProps {
6-
context: WebPartContext | ExtensionContext;
7-
className?: string;
8-
disabled?: boolean;
9-
listId: string;
10-
columnInternalName: string;
11-
label?: string;
12-
placeholder?: string;
13-
onChanged?: (columnInternalName: string, newValue: any) => void;
14-
value?: any;
15-
required: boolean;
16-
newValue?: any;
17-
fieldType: string;
18-
fieldTitle: string;
19-
fieldDefaultValue: any;
20-
options: IDropdownOption[];
21-
fieldTermSetId: string;
22-
lookupListID?: string;
23-
lookupField?: string;
24-
changedvalue: any;
25-
hiddenFieldName?: string;
26-
Order: number;
27-
isRichText:boolean;
6+
context: WebPartContext | ExtensionContext;
7+
className?: string;
8+
disabled?: boolean;
9+
listId: string;
10+
columnInternalName: string;
11+
label?: string;
12+
placeholder?: string;
13+
onChanged?: (columnInternalName: string, newValue: any) => void;
14+
value?: any;
15+
required: boolean;
16+
newValue?: any;
17+
fieldType: string;
18+
fieldTitle: string;
19+
fieldDefaultValue: any;
20+
options: IDropdownOption[];
21+
fieldTermSetId: string;
22+
lookupListID?: string;
23+
lookupField?: string;
24+
changedvalue: any;
25+
hiddenFieldName?: string;
26+
Order: number;
27+
isRichText: boolean;
28+
bingAPIKey?: string;
2829
}

src/loc/en-us.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ define([], () => {
376376

377377
DynamicFormLoading: "Loading...",
378378
DynamicFormPleaseWait: "Please wait...",
379-
DynamicFormRequiredErrorMessage: "You can't leave this blank."
379+
DynamicFormRequiredErrorMessage: "You can't leave this blank.",
380+
DynamicFormTermPanelTitle: "Select Term"
380381
};
381382
});

src/loc/mystrings.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ declare interface IControlStrings {
350350
DynamicFormLoading: string;
351351
DynamicFormPleaseWait: string;
352352
DynamicFormRequiredErrorMessage: string;
353+
DynamicFormTermPanelTitle: string;
353354
}
354355

355356
declare interface IDateTimeStrings {

0 commit comments

Comments
 (0)