Change import require declaration to ECMAScript 2015 (#802)

This commit is contained in:
Alexander T 2018-09-11 18:11:34 +03:00 коммит произвёл Eric Traut
Родитель bb2b1f94da
Коммит faafff18f8
15 изменённых файлов: 177 добавлений и 171 удалений

Просмотреть файл

@ -8,14 +8,14 @@
* implemented for each platform.
*/
import React = require('react');
import * as React from 'react';
import * as SyncTasks from 'synctasks';
import SubscribableEvent from 'subscribableevent';
import SyncTasks = require('synctasks');
import * as Types from './Types';
import AppConfig from './AppConfig';
import Types = require('./Types');
export import Types = Types;
export { Types };
export abstract class ActivityIndicator extends React.Component<Types.ActivityIndicatorProps> {}

Просмотреть файл

@ -7,10 +7,10 @@
* Type definitions for ReactXP framework.
*/
import React = require('react');
import * as React from 'react';
// Use only for type data
import RX = require('./Interfaces');
import * as RX from './Interfaces';
export { default as SubscribableEvent, SubscriptionToken } from 'subscribableevent';

Просмотреть файл

@ -1,11 +1,11 @@
/**
* Accessibility.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*/
* Accessibility.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*/
import RN = require('react-native');
import * as RN from 'react-native';
// Be aware that we import class and extend it here, but the default export of native-common/Accessibility
// is an instance of the class we import here. So any state in the default export from native-common will be in
// a different instance than default export of this windows/Accessibility. For example, susbscribing to

Просмотреть файл

@ -1,21 +1,21 @@
/**
* AccessibilityAnnouncer.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Implements the behavior for announcing text via screen readers.
*/
* AccessibilityAnnouncer.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Implements the behavior for announcing text via screen readers.
*/
import React = require('react');
import RN = require('react-native');
import * as React from 'react';
import * as RN from 'react-native';
import { SubscriptionToken } from 'subscribableevent';
import { Types } from '../common/Interfaces';
import Accessibility from './Accessibility';
import AccessibilityUtil from '../native-common/AccessibilityUtil';
import Styles from '../native-common/Styles';
import Timers from '../common/utils/Timers';
import Types = require('../common/Types');
const _styles = {
liveRegionContainer: Styles.createViewStyle({

Просмотреть файл

@ -1,14 +1,13 @@
/**
* AccessibilityUtil.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Windows-specific accessibility utils.
*/
import React = require('react');
* AccessibilityUtil.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Windows-specific accessibility utils.
*/
import * as React from 'react';
import { AccessibilityPlatformUtil } from '../common/AccessibilityUtil';
export class AccessibilityUtil extends AccessibilityPlatformUtil {

Просмотреть файл

@ -1,15 +1,15 @@
/**
* App.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Windows implementation of App API namespace.
*/
* App.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Windows implementation of App API namespace.
*/
import { ComponentProvider } from 'react-native';
import { RootView, RootViewUsingProps } from './RootView';
import { App as AppCommon } from '../native-common/App';
import { RootView, RootViewUsingProps } from './RootView';
export class App extends AppCommon {

Просмотреть файл

@ -1,23 +1,23 @@
/**
* Button.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* RN Windows-specific implementation of the cross-platform Button abstraction.
*/
* Button.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* RN Windows-specific implementation of the cross-platform Button abstraction.
*/
import PropTypes = require('prop-types');
import React = require('react');
import RN = require('react-native');
import RNW = require('react-native-windows');
import Types = require('../common/Types');
import * as PropTypes from 'prop-types';
import * as React from 'react';
import * as RN from 'react-native';
import * as RNW from 'react-native-windows';
import AccessibilityUtil, { ImportantForAccessibilityValue } from '../native-common/AccessibilityUtil';
import { applyFocusableComponentMixin, FocusManagerFocusableComponent } from '../native-desktop/utils/FocusManager';
import { Button as ButtonBase, ButtonContext as ButtonContextBase } from '../native-common/Button';
import { Types } from '../common/Interfaces';
import AccessibilityUtil, { ImportantForAccessibilityValue } from '../native-common/AccessibilityUtil';
import EventHelpers from '../native-common/utils/EventHelpers';
import UserInterface from '../native-common/UserInterface';
import { applyFocusableComponentMixin, FocusManagerFocusableComponent } from '../native-desktop/utils/FocusManager';
const KEY_CODE_ENTER = 13;
const KEY_CODE_SPACE = 32;
@ -158,25 +158,25 @@ export class Button extends ButtonBase implements React.ChildContextProvider<But
// ENTER triggers press on key down
if (key === KEY_CODE_ENTER) {
this.props.onPress(keyEvent);
}
}
}
if (this.props.onContextMenu) {
let key = keyEvent.keyCode;
if ((key === KEY_CODE_APP) || (key === KEY_CODE_F10 && keyEvent.shiftKey)) {
if (this._isMounted) {
UserInterface.measureLayoutRelativeToWindow(this).then( layoutInfo => {
// need to simulate the mouse event so that we
// can show the context menu in the right position
if (this._isMounted) {
let mouseEvent = EventHelpers.keyboardToMouseEvent(keyEvent, layoutInfo,
this._getContextMenuOffset());
if (this._isMounted) {
UserInterface.measureLayoutRelativeToWindow(this).then( layoutInfo => {
// need to simulate the mouse event so that we
// can show the context menu in the right position
if (this._isMounted) {
let mouseEvent = EventHelpers.keyboardToMouseEvent(keyEvent, layoutInfo,
this._getContextMenuOffset());
if (this.props.onContextMenu) {
this.props.onContextMenu(mouseEvent);
}
}
this.props.onContextMenu(mouseEvent);
}
}
});
}
}
}
}
}

Просмотреть файл

@ -1,14 +1,14 @@
/**
* GestureView.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Windows-specific implementation of RN GestureView component.
*/
* GestureView.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Windows-specific implementation of RN GestureView component.
*/
import { GestureView as BaseGestureView } from '../native-common/GestureView';
import Types = require('../common/Types');
import { Types } from '../common/Interfaces';
const _preferredPanRatio = 3;

Просмотреть файл

@ -1,23 +1,22 @@
/**
* Link.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* RN Desktop-specific implementation of the cross-platform Link abstraction.
*/
* Link.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* RN Desktop-specific implementation of the cross-platform Link abstraction.
*/
import React = require('react');
import RN = require('react-native');
import RNW = require('react-native-windows');
import Types = require('../common/Types');
import * as React from 'react';
import * as RN from 'react-native';
import * as RNW from 'react-native-windows';
import AccessibilityUtil, { ImportantForAccessibilityValue } from '../native-common/AccessibilityUtil';
import { applyFocusableComponentMixin, FocusManager, FocusManagerFocusableComponent } from '../native-desktop/utils/FocusManager';
import EventHelpers from '../native-common/utils/EventHelpers';
import { FocusArbitratorProvider } from '../common/utils/AutoFocusHelper';
import { LinkBase } from '../native-common/Link';
import { Types } from '../common/Interfaces';
import AccessibilityUtil, { ImportantForAccessibilityValue } from '../native-common/AccessibilityUtil';
import EventHelpers from '../native-common/utils/EventHelpers';
import UserInterface from '../native-common/UserInterface';
const KEY_CODE_ENTER = 13;
@ -35,7 +34,7 @@ export interface LinkState {
}
export class Link extends LinkBase<LinkState> implements FocusManagerFocusableComponent {
// Offset to show context menu using keyboard.
protected _getContextMenuOffset() {
return { x: 0, y: 0 };
@ -197,23 +196,22 @@ export class Link extends LinkBase<LinkState> implements FocusManagerFocusableCo
// Defer to base class
this._onPress(keyEvent);
}
if (this.props.onContextMenu) {
let key = keyEvent.keyCode;
if ((key === KEY_CODE_APP) || (key === KEY_CODE_F10 && keyEvent.shiftKey)) {
if (this._isMounted) {
UserInterface.measureLayoutRelativeToWindow(this).then( layoutInfo => {
// need to simulate the mouse event so that we
// can show the context menu in the right position
if (this._isMounted) {
if (this._isMounted) {
UserInterface.measureLayoutRelativeToWindow(this).then( layoutInfo => {
// need to simulate the mouse event so that we
// can show the context menu in the right position
if (this._isMounted) {
let mouseEvent = EventHelpers.keyboardToMouseEvent(keyEvent, layoutInfo, this._getContextMenuOffset());
if (this.props.onContextMenu) {
this.props.onContextMenu(mouseEvent);
}
}
this.props.onContextMenu(mouseEvent);
}
}
});
}
}
}
}
}

Просмотреть файл

@ -1,19 +1,25 @@
/**
* RootView.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* The top-most view that's used for proper layering or modals and popups.
*/
* RootView.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* The top-most view that's used for proper layering or modals and popups.
*/
import React = require('react');
import RN = require('react-native');
import RNW = require('react-native-windows');
import * as React from 'react';
import * as RN from 'react-native';
import * as RNW from 'react-native-windows';
import { RootView as RootViewBase, RootViewUsingProps as RootViewUsingPropsBase,
BaseRootViewProps, RootViewPropsWithMainViewType, RootViewState, BaseRootView } from '../native-desktop/RootView';
import { AccessibilityAnnouncer } from './AccessibilityAnnouncer';
import {
RootView as RootViewBase,
RootViewUsingProps as RootViewUsingPropsBase,
BaseRootViewProps,
RootViewPropsWithMainViewType,
RootViewState,
BaseRootView,
} from '../native-desktop/RootView';
//
// We use a custom RNW provided component to capture key input before being dispatched to native controls.
@ -24,7 +30,7 @@ const _styles = RN.StyleSheet.create({
appWrapperStyle : {
flex: 1
}
});
});
type Handler = (e: RN.NativeSyntheticEvent<any>) => void;
@ -45,7 +51,7 @@ function _renderTopView(
class RootViewUsingStore extends RootViewBase {
renderTopView(content: JSX.Element): JSX.Element {
if (_isRootInputViewSupported) {
return _renderTopView (
return _renderTopView(
content,
this._onKeyDown,
this._onKeyDownCapture,

Просмотреть файл

@ -1,18 +1,18 @@
/**
* ScrollView.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* RN Windows-specific implementation of the cross-platform ScrollView abstraction.
*/
* ScrollView.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* RN Windows-specific implementation of the cross-platform ScrollView abstraction.
*/
import React = require('react');
import RN = require('react-native');
import * as React from 'react';
import * as RN from 'react-native';
import { ScrollView as ScrollViewBase } from '../native-common/ScrollView';
import { Types } from '../common/Interfaces';
import EventHelpers from '../native-common/utils/EventHelpers';
import Types = require('../common/Types');
export class ScrollView extends ScrollViewBase {

Просмотреть файл

@ -1,13 +1,13 @@
/**
* StatusBar.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Windows-specific implementation of StatusBar APIs.
*/
* StatusBar.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Windows-specific implementation of StatusBar APIs.
*/
import RX = require('../common/Interfaces');
import * as RX from '../common/Interfaces';
export class StatusBar extends RX.StatusBar {
isOverlay(): boolean {

Просмотреть файл

@ -1,16 +1,17 @@
/**
* Text.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* RN Windows-specific implementation of the cross-platform Text abstraction.
*/
* Text.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* RN Windows-specific implementation of the cross-platform Text abstraction.
*/
import * as PropTypes from 'prop-types';
import AccessibilityUtil, { ImportantForAccessibilityValue } from '../native-common/AccessibilityUtil';
import PropTypes = require('prop-types');
import { Text as TextBase, TextContext as TextContextBase } from '../native-common/Text';
import Types = require('../common/Types');
import { Types } from '../common/Interfaces';
import { applyFocusableComponentMixin, FocusManagerFocusableComponent } from '../native-desktop/utils/FocusManager';
export interface TextContext extends TextContextBase {

Просмотреть файл

@ -1,20 +1,19 @@
/**
* TextInput.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* RN Windows-specific implementation of the cross-platform TextInput abstraction.
*/
* TextInput.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* RN Windows-specific implementation of the cross-platform TextInput abstraction.
*/
import React = require('react');
import RN = require('react-native');
import Types = require('../common/Types');
import * as React from 'react';
import * as RN from 'react-native';
import AccessibilityUtil, { ImportantForAccessibilityValue } from '../native-common/AccessibilityUtil';
import { applyFocusableComponentMixin, FocusManagerFocusableComponent } from '../native-desktop/utils/FocusManager';
import { TextInput as TextInputBase } from '../native-common/TextInput';
import { Types } from '../common/Interfaces';
import AccessibilityUtil, { ImportantForAccessibilityValue } from '../native-common/AccessibilityUtil';
export class TextInput extends TextInputBase implements FocusManagerFocusableComponent {

Просмотреть файл

@ -1,28 +1,31 @@
/**
* View.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Windows-specific implementation of View.
*/
* View.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Windows-specific implementation of View.
*/
import _ = require('../native-common/lodashMini');
import React = require('react');
import RN = require('react-native');
import RNW = require('react-native-windows');
import Types = require('../common/Types');
import PropTypes = require('prop-types');
import * as PropTypes from 'prop-types';
import * as React from 'react';
import * as RN from 'react-native';
import * as RNW from 'react-native-windows';
import * as _ from '../native-common/lodashMini';
import {
applyFocusableComponentMixin,
FocusManagerFocusableComponent,
FocusManager,
} from '../native-desktop/utils/FocusManager';
import { PopupComponent } from '../common/PopupContainerViewBase';
import { RestrictFocusType } from '../common/utils/FocusManager';
import { Types } from '../common/Interfaces';
import { View as ViewCommon, ViewContext as ViewContextCommon } from '../native-common/View';
import AccessibilityUtil, { ImportantForAccessibilityValue } from '../native-common/AccessibilityUtil';
import AppConfig from '../common/AppConfig';
import { View as ViewCommon, ViewContext as ViewContextCommon } from '../native-common/View';
import EventHelpers from '../native-common/utils/EventHelpers';
import { RestrictFocusType } from '../common/utils/FocusManager';
import { applyFocusableComponentMixin, FocusManagerFocusableComponent, FocusManager }
from '../native-desktop/utils/FocusManager';
import PopupContainerView from '../native-common/PopupContainerView';
import { PopupComponent } from '../common/PopupContainerViewBase';
import UserInterface from '../native-common/UserInterface';
const KEY_CODE_ENTER = 13;