Skip to content

Commit

Permalink
Merge branch 'master' into users/awentzel/add-ops-scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
awentzel authored Nov 12, 2020
2 parents 5da0b29 + a37b204 commit 312ca2d
Show file tree
Hide file tree
Showing 56 changed files with 440 additions and 100 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import HTML5Backend from "react-dnd-html5-backend";
import { DndProvider } from "react-dnd";
import { ControlType } from "../templates";
import { DataType, ValidationError } from "@microsoft/fast-tooling";
import defaultStrings from "../form.strings";

const TestArrayControl: React.FC<any> = (
props: React.PropsWithChildren<any>
Expand Down Expand Up @@ -58,6 +59,7 @@ const arrayProps: ArrayControlProps = {
validationErrors: [],
required: false,
messageSystem: void 0,
strings: defaultStrings,
messageSystemOptions: null,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ArrayControl extends React.Component<
return (
<button
className={this.props.managedClasses.arrayControl_addItemButton}
aria-label={"Select to add item"}
aria-label={this.props.strings.arrayAddItemTip}
onClick={this.arrayItemClickHandlerFactory(ArrayAction.add)}
/>
);
Expand All @@ -83,7 +83,9 @@ class ArrayControl extends React.Component<
if (this.props.maxItems > existingItemLength) {
return (
<div className={arrayControl_addItem}>
<div className={arrayControl_addItemLabel}>Add item</div>
<div className={arrayControl_addItemLabel}>
{this.props.strings.arrayAddItemLabel}
</div>
{this.renderAddArrayItemTrigger()}
</div>
);
Expand Down Expand Up @@ -190,6 +192,7 @@ class ArrayControl extends React.Component<
dropDragItem={this.handleDropDragItem}
dragStart={this.handleDragStart}
dragEnd={this.handleDragEnd}
strings={this.props.strings}
>
{text}
</DragItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ButtonControl } from "./control.button";
import { ButtonControlProps } from "./control.button.props";
import { ButtonControlClassNameContract } from "./control.button.style";
import { ControlType } from "../templates";
import defaultStrings from "../form.strings";

/*
* Configure Enzyme
Expand Down Expand Up @@ -33,6 +34,7 @@ const buttonProps: ButtonControlProps = {
validationErrors: [],
required: false,
messageSystem: void 0,
strings: defaultStrings,
messageSystemOptions: null,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { CheckboxControl } from "./control.checkbox";
import { CheckboxControlProps } from "./control.checkbox.props";
import { CheckboxControlClassNameContract } from "./control.checkbox.style";
import { ControlType } from "../templates";
import defaultStrings from "../form.strings";

/*
* Configure Enzyme
Expand Down Expand Up @@ -33,6 +34,7 @@ const checkboxProps: CheckboxControlProps = {
validationErrors: [],
required: false,
messageSystem: void 0,
strings: defaultStrings,
messageSystemOptions: null,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { DisplayControl } from "./control.display";
import { DisplayControlProps } from "./control.display.props";
import { DisplayControlClassNameContract } from "./control.display.style";
import { ControlType } from "../templates";
import defaultStrings from "../form.strings";

/*
* Configure Enzyme
Expand Down Expand Up @@ -33,6 +34,7 @@ const displayProps: DisplayControlProps = {
validationErrors: [],
required: false,
messageSystem: void 0,
strings: defaultStrings,
messageSystemOptions: null,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { LinkedDataControlProps } from "./control.linked-data.props";
import { LinkedDataControlClassNameContract } from "./control.linked-data.style";
import { ControlType } from "../templates";
import { LinkedDataActionType } from "../templates/types";
import defaultStrings from "../form.strings";

const LinkedDataFormControlWithDragAndDrop: React.FC<any> = (
props: React.PropsWithChildren<any>
Expand Down Expand Up @@ -99,6 +100,7 @@ const linkedDataProps: LinkedDataControlProps = {
elementRef: null,
validationErrors: [],
messageSystem: void 0,
strings: defaultStrings,
messageSystemOptions: null,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class LinkedDataControl extends React.Component<
list={this.getLinkedDataInputId()}
aria-controls={this.getLinkedDataInputId()}
value={this.state.searchTerm}
placeholder={"Add"}
placeholder={this.props.strings.linkedDataPlaceholder}
onChange={this.handleSearchTermUpdate}
onKeyDown={this.handleLinkedDataKeydown}
/>
Expand Down Expand Up @@ -140,6 +140,7 @@ class LinkedDataControl extends React.Component<
dropDragItem={this.handleDropItem}
dragStart={this.handleDragStart}
dragEnd={this.handleDragEnd}
strings={this.props.strings}
>
{
this.props.schemaDictionary[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { NumberFieldControl } from "./control.number-field";
import { NumberFieldControlProps } from "./control.number-field.props";
import { NumberFieldControlClassNameContract } from "./control.number-field.style";
import { ControlType } from "../templates";
import defaultStrings from "../form.strings";

/*
* Configure Enzyme
Expand Down Expand Up @@ -36,6 +37,7 @@ const numberFieldProps: NumberFieldControlProps = {
validationErrors: [],
required: false,
messageSystem: void 0,
strings: defaultStrings,
messageSystemOptions: null,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { SectionLinkControl } from "./control.section-link";
import { SectionLinkControlProps } from "./control.section-link.props";
import { SectionLinkControlClassNameContract } from "./control.section-link.style";
import { ControlType } from "../templates";
import defaultStrings from "../form.strings";

/*
* Configure Enzyme
Expand Down Expand Up @@ -38,6 +39,7 @@ const sectionLinkProps: SectionLinkControlProps = {
validationErrors: [],
required: false,
messageSystem: void 0,
strings: defaultStrings,
messageSystemOptions: null,
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import manageJss, { ManagedJSSProps } from "@microsoft/fast-jss-manager-react";
import { ManagedClasses } from "@microsoft/fast-components-class-name-contracts-base";
import { classNames } from "@microsoft/fast-web-utilities";
import { classNames, format } from "@microsoft/fast-web-utilities";
import styles, {
SectionLinkControlClassNameContract,
} from "./control.section-link.style";
Expand Down Expand Up @@ -44,7 +44,7 @@ class SectionLinkControl extends React.Component<
)}
onClick={this.handleUpdateSection}
>
Edit: {this.props.label}
{format(this.props.strings.sectionLinkEditLabel, this.props.label)}
</a>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CombiningKeyword } from "@microsoft/fast-tooling";
import { FormStrings } from "../form.props";
import { SectionControlConfig } from "../templates";

/**
Expand Down Expand Up @@ -87,6 +88,8 @@ export interface FormControlParameters {
* The invalid message for this property
*/
invalidMessage: string;

strings: FormStrings;
}

export interface FormControlItem {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
TextareaControl,
} from "../index";
import { DataType } from "@microsoft/fast-tooling";
import defaultStrings from "../form.strings";

const TestSectionControl: any = (
props: React.PropsWithChildren<SectionControlProps>
Expand Down Expand Up @@ -92,6 +93,7 @@ const sectionControlProps: SectionControlProps = {
updateValidity: jest.fn(),
required: false,
messageSystem: void 0,
strings: defaultStrings,
messageSystemOptions: null,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
SchemaSetValidationMessageRequest,
TreeNavigationItem,
} from "@microsoft/fast-tooling";
import { FormStrings } from "../form.props";

/**
* Schema form component definition
Expand Down Expand Up @@ -222,6 +223,7 @@ class SectionControl extends React.Component<
}
displayValidationInline={this.props.displayValidationInline}
messageSystem={this.props.messageSystem}
strings={this.props.strings}
messageSystemOptions={this.props.messageSystemOptions}
/>
);
Expand Down Expand Up @@ -273,7 +275,7 @@ class SectionControl extends React.Component<
this.props.schema[this.state.oneOfAnyOf.type]
) {
const unselectedOption: React.ReactNode = (
<option value={-1}>{"Select an option"}</option>
<option value={-1}>{this.props.strings.sectionSelectDefault}</option>
);
const options: React.ReactNode = getOneOfAnyOfSelectOptions(
this.props.schema,
Expand All @@ -282,7 +284,11 @@ class SectionControl extends React.Component<

return (
<FormOneOfAnyOf
label={get(this.props, "schema.title", "Configuration")}
label={get(
this.props,
"schema.title",
this.props.strings.sectionSelectLabel
)}
activeIndex={this.state.oneOfAnyOf.activeIndex}
onUpdate={this.handleAnyOfOneOfClick}
>
Expand Down Expand Up @@ -319,11 +325,14 @@ class SectionControl extends React.Component<
dataDictionary={this.props.dataDictionary}
navigation={this.props.navigation}
schemaLocation={navigationItem.schemaLocation}
examples={get(navigationItem.schema, "examples")}
examples={get(
navigationItem.schema,
this.props.strings.sectionAdditionalPropExample
)}
propertyLabel={get(
navigationItem.schema,
`propertyTitle`,
"Property key"
this.props.strings.sectionAdditionalPropLabel
)}
additionalProperties={navigationItem.schema.additionalProperties}
enumeratedProperties={this.getEnumeratedProperties(
Expand All @@ -342,6 +351,7 @@ class SectionControl extends React.Component<
}
displayValidationInline={this.props.displayValidationInline}
messageSystem={this.props.messageSystem}
strings={this.props.strings}
messageSystemOptions={this.props.messageSystemOptions}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { SelectControl } from "./control.select";
import { SelectControlProps } from "./control.select.props";
import { SelectControlClassNameContract } from "./control.select.style";
import { ControlType } from "../templates";
import defaultStrings from "../form.strings";

/*
* Configure Enzyme
Expand Down Expand Up @@ -35,6 +36,7 @@ const selectProps: SelectControlProps = {
validationErrors: [],
required: false,
messageSystem: void 0,
strings: defaultStrings,
messageSystemOptions: null,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { TextareaControl } from "./control.textarea";
import { TextareaControlProps } from "./control.textarea.props";
import { TextareaControlClassNameContract } from "./control.textarea.style";
import { ControlType } from "../templates";
import defaultStrings from "../form.strings";

/*
* Configure Enzyme
Expand Down Expand Up @@ -33,6 +34,7 @@ const textareaProps: TextareaControlProps = {
validationErrors: [],
required: false,
messageSystem: void 0,
strings: defaultStrings,
messageSystemOptions: null,
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { FormStrings } from "../../form.props";
import { ControlTemplateUtilitiesProps, StandardControlPlugin } from "../../templates";
import { AttributeSettingsMappingToPropertyNames } from "../../types";
import { Controls } from "./types";
Expand Down Expand Up @@ -50,4 +51,9 @@ export interface ControlSwitchProps
* defaults to true
*/
softRemove?: boolean;

/**
* Localized strings
*/
strings: FormStrings;
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
SelectControl,
TextareaControl,
} from "../index";
import defaultStrings from "../../form.strings";

const selectControl: StandardControlPlugin = new StandardControlPlugin({
control: (config: ListControlConfig): React.ReactNode => {
Expand Down Expand Up @@ -161,6 +162,7 @@ const formControlSwitchProps: ControlSwitchProps = {
[ControlType.textarea]: TextareaControl,
},
messageSystem: void 0,
strings: defaultStrings,
messageSystemOptions: null,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ class ControlSwitch extends React.Component<ControlSwitchProps, {}> {
controlPlugins: this.props.controlPlugins,
untitled: this.props.untitled,
messageSystem: this.props.messageSystem,
strings: this.props.strings,
messageSystemOptions: this.props.messageSystemOptions,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
SelectControl,
TextareaControl,
} from "../../index";
import defaultStrings from "../../form.strings";

/*
* Configure Enzyme
Expand Down Expand Up @@ -73,6 +74,7 @@ const dictionaryProps: DictionaryProps = {
[ControlType.textarea]: TextareaControl,
},
messageSystem: void 0,
strings: defaultStrings,
messageSystemOptions: null,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ class Dictionary extends React.Component<
displayValidationBrowserDefault={
this.props.displayValidationBrowserDefault
}
strings={this.props.strings}
/>
</div>
</React.Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Alignment } from "./control.align.props";
import { AlignControl } from "./control.align";
import { AlignControlClassNameContract } from "./control.align.style";
import { ControlType } from "../templates";
import defaultStrings from "../form.strings";

/*
* Configure Enzyme
Expand All @@ -29,6 +30,7 @@ const alignControlProps: AlignControlProps = {
validationErrors: [],
required: false,
messageSystem: void 0,
strings: defaultStrings,
messageSystemOptions: null,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { FileUploadControl } from "./control.file-upload";
import { FileUploadControl as StyledFileUploadControl } from "./control.file-upload";
import { FileUploadControlProps } from "./control.file-upload.props";
import { ControlType } from "../templates";
import defaultStrings from "../form.strings";

/*
* Configure Enzyme
Expand All @@ -27,6 +28,7 @@ const fileUploadControlProps: FileUploadControlProps = {
validationErrors: [],
required: false,
messageSystem: void 0,
strings: defaultStrings,
messageSystemOptions: null,
};

Expand Down
Loading

0 comments on commit 312ca2d

Please sign in to comment.