Merge pull request #15773 from sanyatuning/master

react-widgets: add disabled, readonly, dropUp
This commit is contained in:
Ryan Cavanaugh
2017-04-17 12:52:34 -07:00
committed by GitHub
11 changed files with 60 additions and 99 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for react-widgets v3.2.1
// Project: https://github.com/jquense/react-widgets
// Definitions by: Rogier Schouten <https://github.com/rogierschouten/>
// Definitions by: Rogier Schouten <https://github.com/rogierschouten/>, Balázs Sándor <https://github.com/sanyatuning>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
+2 -7
View File
@@ -1,6 +1,7 @@
import * as React from 'react';
import {ReactWidgetsCommonProps} from './CommonProps';
interface CalendarProps extends React.Props<CalendarClass>{
interface CalendarProps extends ReactWidgetsCommonProps<CalendarClass>{
/**
* The current selected date, should be a Date object or null.
*/
@@ -97,12 +98,6 @@ interface CalendarProps extends React.Props<CalendarClass>{
* 1900 - 1999.
*/
centuryFormat?: string | ((day: Date) => string);
/**
* Mark whether the widget should render right-to-left. This property can also be implicitly
* passed to the widget through a childContext prop (isRtl) this allows higher level
* application components to specify the direction.
*/
isRtl?: boolean;
messages?: CalendarMessages;
}
+2 -17
View File
@@ -1,4 +1,5 @@
import * as React from 'react';
import {ReactWidgetsCommonDropdownProps} from './CommonProps';
interface ComboBoxMessages {
/**
@@ -15,7 +16,7 @@ interface ComboBoxMessages {
emptyFilter: string | ((props: ComboBoxProps) => string);
}
interface ComboBoxProps extends React.Props<ComboBoxClass> {
interface ComboBoxProps extends ReactWidgetsCommonDropdownProps<ComboBoxClass> {
/**
* The current value of the Combobox. This can be an object (such as a member of the data
* array) or a primitive value, hinted to by the valueField. The widget value does not need
@@ -62,16 +63,6 @@ interface ComboBoxProps extends React.Props<ComboBoxClass> {
* component renders the text of the selected item (specified by textfield)
*/
itemComponent?: React.ReactType;
/**
* Disable the widget, if an Array of values is passed in only those values will be
* disabled.
*/
disabled?: boolean | any[];
/**
* Place the Combobox in a read-only mode, If an Array of values is passed in only those
* values will be read-only.
*/
readOnly?: boolean | any[];
/**
* Determines how to group the Combobox. Providing a string will group the data array by
* that property. You can also provide a function which should return the group value.
@@ -127,12 +118,6 @@ interface ComboBoxProps extends React.Props<ComboBoxClass> {
* The speed, in milliseconds, of the dropdown animation.
*/
duration?: number;
/**
* mark whether the widget should render right-to-left. This property can also be implicitly
* passed to the widget through a childContext prop (isRtl) this allows higher level
* application components to specify the direction.
*/
isRtl?: boolean;
/**
* Object hash containing display text and/or text for screen readers. Use the messages
* object to localize widget text and increase accessibility.
+30
View File
@@ -0,0 +1,30 @@
import * as React from 'react';
interface ReactWidgetsCommonProps<C> extends React.Props<C> {
/**
* Disable the widget, if an Array of values is passed in only those values will be disabled.
* @default false
*/
disabled?: boolean | any[];
/**
* Place the widget in a read-only mode, If an Array of values is passed in only those
* values will be read-only.
* @default false
*/
readOnly?: boolean | any[];
/**
* Mark whether the SelectList should render right-to-left. This property can also be
* implicitly passed to the widget through a childContext prop (isRtl) this allows higher
* level application components to specify the direction.
* @default false
*/
isRtl?: boolean;
}
interface ReactWidgetsCommonDropdownProps<C> extends ReactWidgetsCommonProps<C> {
/**
* Show "drop up" not "drop down"
* @default false
*/
dropUp?: boolean;
}
+2 -7
View File
@@ -1,6 +1,7 @@
import * as React from 'react';
import {ReactWidgetsCommonDropdownProps} from './CommonProps';
interface DateTimePickerProps extends React.Props<DateTimePickerClass> {
interface DateTimePickerProps extends ReactWidgetsCommonDropdownProps<DateTimePickerClass> {
/**
* Whether to show the date picker button.
* @default true
@@ -116,12 +117,6 @@ interface DateTimePickerProps extends React.Props<DateTimePickerClass> {
* The speed, in milliseconds, of the either dropdown animation.
*/
duration?: number;
/**
* Mark whether the widget should render right-to-left. This property can also be implicitly
* passed to the widget through a childContext prop (isRtl) this allows higher level
* application components to specify the direction.
*/
isRtl?: boolean;
/**
* Object hash containing display text and/or text for screen readers. Use the messages
* object to localize widget text and increase accessibility.
+2 -16
View File
@@ -1,6 +1,7 @@
import * as React from 'react';
import {ReactWidgetsCommonDropdownProps} from './CommonProps';
interface DropdownListProps extends React.Props<DropdownListClass> {
interface DropdownListProps extends ReactWidgetsCommonDropdownProps<DropdownListClass> {
/**
* The current value of the DropdownList. This can be an object (such as a member of the
* data array) or a primitive value, hinted to by the valueField. The widget value does not
@@ -50,15 +51,6 @@ interface DropdownListProps extends React.Props<DropdownListClass> {
* component renders the text of the selected item (specified by textfield)
*/
itemComponent?: React.ReactType;
/**
* Disable the widget, if an Array of values is passed in only those values will be disabled.
*/
disabled?: boolean | any[];
/**
* Place the DropdownList in a read-only mode, If an Array of values is passed in only those
* values will be read-only.
*/
readOnly?: boolean | any[];
/**
* Determines how to group the DropdownList. Providing a string will group the data array by
* that property. You can also provide a function which should return the group value.
@@ -131,12 +123,6 @@ interface DropdownListProps extends React.Props<DropdownListClass> {
* @default 250
*/
duration?: number;
/**
* Mark whether the widget should render right-to-left. This property can also be implicitly
* passed to the widget through a childContext prop (isRtl) this allows higher level
* application components to specify the direction.
*/
isRtl?: boolean;
/**
* Object hash containing display text and/or text for screen readers. Use the messages
* object to localize widget text and increase accessibility.
+2 -18
View File
@@ -1,6 +1,7 @@
import * as React from 'react';
import {ReactWidgetsCommonDropdownProps} from './CommonProps';
interface MultiselectProps extends React.Props<MultiselectClass> {
interface MultiselectProps extends ReactWidgetsCommonDropdownProps<MultiselectClass> {
/**
* The current values of the Multiselect. The value should can null, or an array of
* valueField values, or an array of objects (such as a few items in the data array)
@@ -127,23 +128,6 @@ interface MultiselectProps extends React.Props<MultiselectClass> {
* @default 250
*/
duration?: number;
/**
* Disable the widget, If an Array of values is passed in only the tags specified will be
* disabled.
*/
disabled?: boolean | any[];
/**
* Place the widget in a readonly mode, If an Array of values is passed in only the tags
* specified will be readonly.
*/
readOnly?: boolean | any[];
/**
* Mark whether the widget should render right-to-left. This property can also be implicitly
* passed to the widget through a childContext prop (isRtl) this allows higher level
* application components to specify the direction.
* @default false
*/
isRtl?: boolean;
/**
* Object hash containing display text and/or text for screen readers. Use the messages
* object to localize widget text and increase accessibility.
+2 -8
View File
@@ -1,6 +1,7 @@
import * as React from 'react';
import {ReactWidgetsCommonProps} from './CommonProps';
interface NumberPickerProps extends React.Props<NumberPickerClass>{
interface NumberPickerProps extends ReactWidgetsCommonProps<NumberPickerClass>{
/**
* The current value of the NumberPicker.
*/
@@ -45,13 +46,6 @@ interface NumberPickerProps extends React.Props<NumberPickerClass>{
* value. When empty, precision is parsed from the current format and culture.
*/
precision?: number;
/**
* Mark whether the widget should render right-to-left. This property can also be implicitly
* passed to the widget through a childContext prop (isRtl) this allows higher level
* application components to specify the direction.
* @default false
*/
isRtl?: boolean;
/**
* Object hash containing display text and/or text for screen readers. Use the messages
* object to localize widget text and increase accessibility.
+2 -18
View File
@@ -1,6 +1,7 @@
import * as React from 'react';
import {ReactWidgetsCommonProps} from './CommonProps';
interface SelectListProps extends React.Props<SelectListClass>{
interface SelectListProps extends ReactWidgetsCommonProps<SelectListClass>{
/**
* The current value or values of the SelectList. This can be an object (such as a member of
* the data array) or a primitive value, hinted to by the valueField. The widget value does
@@ -71,23 +72,6 @@ interface SelectListProps extends React.Props<SelectListClass>{
* @default false
*/
busy?: boolean;
/**
* Disable the widget, if an Array of values is passed in only those values will be
* disabled.
*/
disabled?: boolean | any[];
/**
* Place the SelectList in a read-only mode, If an Array of values is passed in only those
* values will be read-only.
*/
readOnly?: boolean | any[];
/**
* Mark whether the SelectList should render right-to-left. This property can also be
* implicitly passed to the widget through a childContext prop (isRtl) this allows higher
* level application components to specify the direction.
* @default false
*/
isRtl?: boolean;
/**
* Object hash containing display text and/or text for screen readers. Use the messages
* object to localize widget text and increase accessibility.
+14 -7
View File
@@ -1,7 +1,7 @@
import * as React from "react"
import * as ReactDOM from "react-dom"
import * as React from "react";
import * as ReactDOM from "react-dom";
import { Calendar, Combobox, DateTimePicker, DropdownList, Multiselect, NumberPicker, SelectList } from "react-widgets"
import { Calendar, Combobox, DateTimePicker, DropdownList, Multiselect, NumberPicker, SelectList } from "react-widgets";
function tagComponent(props: { value: string }) {
return <span>{props.value}</span>;
@@ -12,7 +12,6 @@ function itemComponent(props: { value: string }) {
}
class Test extends React.Component<React.Props<{}>, {}> {
render() {
return (
<div>
@@ -46,8 +45,16 @@ class Test extends React.Component<React.Props<{}>, {}> {
itemComponent={itemComponent}
/>
</div>
<div>
<Calendar disabled readOnly />
<Combobox disabled readOnly dropUp />
<DateTimePicker disabled readOnly dropUp />
<DropdownList disabled readOnly dropUp />
<Multiselect disabled readOnly dropUp />
<NumberPicker disabled readOnly />
<SelectList disabled readOnly/>
</div>
</div>
)
);
}
}
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }