web: Change import require declaration to ECMAScript 2015 (#805)

This commit is contained in:
Alexander T 2018-09-12 19:51:45 +03:00 коммит произвёл Eric Traut
Родитель 4aa1980e1e
Коммит 13a4452a13
48 изменённых файлов: 639 добавлений и 657 удалений

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

@ -1,12 +1,12 @@
/**
* Accessibility.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web wrapper for subscribing or querying the current state of the
* screen reader.
*/
* Accessibility.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web wrapper for subscribing or querying the current state of the
* screen reader.
*/
import { Accessibility as CommonAccessibility } from '../common/Accessibility';

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

@ -1,19 +1,19 @@
/**
* AccessibilityAnnouncer.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Implements the behavior for announcing text to screen readers, using aria-live regions.
*/
/**
* AccessibilityAnnouncer.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Implements the behavior for announcing text to screen readers, using aria-live regions.
*/
import React = require('react');
import * as React from 'react';
import { SubscriptionToken } from 'subscribableevent';
import { Types } from '../common/Interfaces';
import Accessibility from './Accessibility';
import AccessibilityUtil from './AccessibilityUtil';
import Styles from './Styles';
import Types = require('../common/Types');
export interface AccessibilityAnnouncerState {
// Screen Reader text to be announced.

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

@ -1,17 +1,16 @@
/**
* AccessibilityUtil.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of accessiblity functions for cross-platform
* ReactXP framework.
*/
import _ = require('./utils/lodashMini');
* AccessibilityUtil.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of accessiblity functions for cross-platform
* ReactXP framework.
*/
import * as _ from './utils/lodashMini';
import { AccessibilityUtil as CommonAccessibiltiyUtil } from '../common/AccessibilityUtil';
import Types = require('../common/Types');
import { Types } from '../common/Interfaces';
// Map of accessibility trait to an aria role attribute.
// What's a role attribute? https://www.w3.org/wiki/PF/XTech/HTML5/RoleAttribute

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

@ -1,15 +1,15 @@
/**
* ActivityIndicator.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Control to display an animated activity indicator.
*/
* ActivityIndicator.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Control to display an animated activity indicator.
*/
import React = require('react');
import * as React from 'react';
import Types = require('../common/Types');
import { Types } from '../common/Interfaces';
const _activityIndicatorCss = `
.rx-activity {

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

@ -1,16 +1,15 @@
/**
* Alert.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web Alert dialog boxes.
*/
* Alert.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web Alert dialog boxes.
*/
import React = require('react');
import * as React from 'react';
import RX = require('../common/Interfaces');
import Types = require('../common/Types');
import * as RX from '../common/Interfaces';
import { AlertModalContent } from './AlertModalContent';
import Modal from './Modal';
@ -18,8 +17,8 @@ import Modal from './Modal';
export class Alert extends RX.Alert {
private _modalId = 'RX.Alert_WebModal';
public show(title: string, message?: string, buttons?: Types.AlertButtonSpec[],
options?: Types.AlertOptions): void {
public show(title: string, message?: string, buttons?: RX.Types.AlertButtonSpec[],
options?: RX.Types.AlertOptions): void {
Modal.show(
(
<AlertModalContent

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

@ -1,29 +1,27 @@
/**
* AlertModalContent.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web Alert dialog boxes modal content.
*/
* AlertModalContent.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web Alert dialog boxes modal content.
*/
import React = require('react');
import * as React from 'react';
import RX = require('../common/Interfaces');
import Types = require('../common/Types');
import { ViewProps } from '../common/Types';
import * as RX from '../common/Interfaces';
import Button from './Button';
import Modal from './Modal';
import Styles from './Styles';
import Text from './Text';
import View from './View';
export interface AppModalContentProps extends ViewProps {
buttons?: Types.AlertButtonSpec[];
export interface AppModalContentProps extends RX.Types.ViewProps {
buttons?: RX.Types.AlertButtonSpec[];
title: string;
message?: string;
modalId: string;
theme?: Types.AlertModalTheme;
theme?: RX.Types.AlertModalTheme;
}
export interface AppModalContentState {
@ -165,7 +163,7 @@ export class AlertModalContent extends RX.Component<AppModalContentProps, AppMod
);
}
private _onPressButton(btnSpec: Types.AlertButtonSpec) {
private _onPressButton(btnSpec: RX.Types.AlertButtonSpec) {
Modal.dismiss(this.props.modalId);
if (btnSpec.onPress) {
@ -173,11 +171,11 @@ export class AlertModalContent extends RX.Component<AppModalContentProps, AppMod
}
}
private _onPressBody = (e: Types.SyntheticEvent) => {
private _onPressBody = (e: RX.Types.SyntheticEvent) => {
e.stopPropagation();
}
private _onPressBackground = (e: Types.SyntheticEvent) => {
private _onPressBackground = (e: RX.Types.SyntheticEvent) => {
Modal.dismiss(this.props.modalId);
}
}

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

@ -1,26 +1,25 @@
/**
* Animated.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Implements animated components for web version of ReactXP.
*/
* Animated.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Implements animated components for web version of ReactXP.
*/
import _ = require('./utils/lodashMini');
import React = require('react');
import ReactDOM = require('react-dom');
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import * as _ from './utils/lodashMini';
import * as RX from '../common/Interfaces';
import { executeTransition, TransitionSpec } from './animated/executeTransition';
import AppConfig from '../common/AppConfig';
import Easing from '../common/Easing';
import { executeTransition, TransitionSpec } from './animated/executeTransition';
import RXImage from './Image';
import RXView from './View';
import RXText from './Text';
import RXTextInput from './TextInput';
import RX = require('../common/Interfaces');
import Styles from './Styles';
import Types = require('../common/Types');
// Animated Css Property Units - check /common/Types for the list of available
// css animated properties
@ -62,7 +61,7 @@ export abstract class Animation {
_id: number|undefined;
// Starts the animation
abstract start(onEnd?: Types.Animated.EndCallback): void;
abstract start(onEnd?: RX.Types.Animated.EndCallback): void;
// Stops the animation
abstract stop(): void;
@ -73,12 +72,12 @@ export abstract class Animation {
interface ValueListener {
setValue(valueObject: Value, newValue: number | string): void;
startTransition(valueObject: Value, from: number|string, toValue: number|string, duration: number,
easing: string, delay: number, onEnd: Types.Animated.EndCallback): void;
easing: string, delay: number, onEnd: RX.Types.Animated.EndCallback): void;
stopTransition(valueObject: Value): number|string|undefined;
}
// The animated value object
export class Value extends Types.AnimatedValue {
export class Value extends RX.Types.AnimatedValue {
private _value: number|string;
private _listeners: ValueListener[];
private _interpolationConfig: { [key: number]: string|number } | undefined;
@ -106,7 +105,7 @@ export class Value extends Types.AnimatedValue {
return this._interpolationConfig[key];
}
interpolate(config: Types.Animated.InterpolationConfigType) {
interpolate(config: RX.Types.Animated.InterpolationConfigType) {
if (!config || !config.inputRange || !config.outputRange ||
config.inputRange.length < 2 || config.outputRange.length < 2 ||
config.inputRange.length !== config.outputRange.length) {
@ -167,7 +166,7 @@ export class Value extends Types.AnimatedValue {
// Start a specific animation.
_startTransition(toValue: number|string, duration: number, easing: string, delay: number,
onEnd: Types.Animated.EndCallback): void {
onEnd: RX.Types.Animated.EndCallback): void {
// If there are no listeners, the app probably has a bug where it's
// starting an animation before the associated element is mounted.
@ -204,8 +203,8 @@ export class Value extends Types.AnimatedValue {
}
}
export let timing: Types.Animated.TimingFunction = function(
value: Value, config: Types.Animated.TimingAnimationConfig): Types.Animated.CompositeAnimation {
export let timing: RX.Types.Animated.TimingFunction = function(
value: Value, config: RX.Types.Animated.TimingAnimationConfig): RX.Types.Animated.CompositeAnimation {
if (!value || !config) {
throw 'Timing animation requires value and config';
@ -213,13 +212,13 @@ export let timing: Types.Animated.TimingFunction = function(
let stopLooping = false;
return {
start: function(onEnd?: Types.Animated.EndCallback): void {
start: function(onEnd?: RX.Types.Animated.EndCallback): void {
let animate = () => {
if (config.loop) {
value.setValue(config.loop.restartFrom);
}
let easing: Types.Animated.EasingFunction = config.easing || Easing.Default();
let easing: RX.Types.Animated.EasingFunction = config.easing || Easing.Default();
let duration = config.duration !== undefined ? config.duration : 500;
let delay = config.delay || 0;
value._startTransition(config.toValue, duration, easing.cssName, delay, result => {
@ -247,8 +246,8 @@ export let timing: Types.Animated.TimingFunction = function(
};
};
export let sequence: Types.Animated.SequenceFunction = function (
animations: Array<Types.Animated.CompositeAnimation>): Types.Animated.CompositeAnimation {
export let sequence: RX.Types.Animated.SequenceFunction = function (
animations: Array<RX.Types.Animated.CompositeAnimation>): RX.Types.Animated.CompositeAnimation {
if (!animations) {
throw 'Sequence animation requires a list of animations';
@ -257,7 +256,7 @@ export let sequence: Types.Animated.SequenceFunction = function (
let hasBeenStopped = false;
let doneCount = 0;
let result = {
start: function (onEnd?: Types.Animated.EndCallback) {
start: function (onEnd?: RX.Types.Animated.EndCallback) {
if (!animations || animations.length === 0) {
throw 'No animations were passed to the animated sequence API';
}
@ -294,8 +293,8 @@ export let sequence: Types.Animated.SequenceFunction = function (
return result;
};
export var parallel: Types.Animated.ParallelFunction = function (
animations: Array<Types.Animated.CompositeAnimation>): Types.Animated.CompositeAnimation {
export var parallel: RX.Types.Animated.ParallelFunction = function (
animations: Array<RX.Types.Animated.CompositeAnimation>): RX.Types.Animated.CompositeAnimation {
if (!animations) {
throw 'Parallel animation requires a list of animations';
@ -306,7 +305,7 @@ export var parallel: Types.Animated.ParallelFunction = function (
let doneCount = 0;
var result = {
start: function (onEnd?: Types.Animated.EndCallback) {
start: function (onEnd?: RX.Types.Animated.EndCallback) {
if (!animations || animations.length === 0) {
throw 'No animations were passed to the animated parallel API';
}
@ -354,7 +353,7 @@ interface AnimatedAttribute {
type AnimatedValueMap = { [transform: string]: AnimatedAttribute };
// Function for creating wrapper AnimatedComponent around passed in component
function createAnimatedComponent<PropsType extends Types.CommonProps>(Component: any): any {
function createAnimatedComponent<PropsType extends RX.Types.CommonProps>(Component: any): any {
class AnimatedComponentGenerated extends React.Component<PropsType, void>
implements RX.AnimatedComponent<PropsType, void>, ValueListener {
@ -382,7 +381,7 @@ function createAnimatedComponent<PropsType extends Types.CommonProps>(Component:
}
}
componentWillReceiveProps(props: Types.CommonStyledProps<Types.StyleRuleSet<Object>>) {
componentWillReceiveProps(props: RX.Types.CommonStyledProps<RX.Types.StyleRuleSet<Object>>) {
this._updateStyles(props);
}
@ -413,7 +412,7 @@ function createAnimatedComponent<PropsType extends Types.CommonProps>(Component:
}
startTransition(valueObject: Value, fromValue: number|string, toValue: number|string, duration: number,
easing: string, delay: number, onEnd: Types.Animated.EndCallback): void {
easing: string, delay: number, onEnd: RX.Types.Animated.EndCallback): void {
// We should never get here if the component isn't mounted,
// but we'll add this additional protection.
@ -651,7 +650,7 @@ function createAnimatedComponent<PropsType extends Types.CommonProps>(Component:
return transformList.join(' ');
}
private _updateStyles(props: Types.CommonStyledProps<Types.StyleRuleSet<Object>>) {
private _updateStyles(props: RX.Types.CommonStyledProps<RX.Types.StyleRuleSet<Object>>) {
this._propsWithoutStyle = _.omit(props, 'style');
let rawStyles = Styles.combine(props.style || {}) as any;
@ -814,7 +813,7 @@ function createAnimatedComponent<PropsType extends Types.CommonProps>(Component:
return AnimatedComponentGenerated;
}
export var Image = createAnimatedComponent<Types.ImageProps>(RXImage) as typeof RX.AnimatedImage;
export var Image = createAnimatedComponent<RX.Types.ImageProps>(RXImage) as typeof RX.AnimatedImage;
export var Text = createAnimatedComponent(RXText) as typeof RX.AnimatedText;
export var TextInput = createAnimatedComponent(RXTextInput) as typeof RX.AnimatedTextInput;
export var View = createAnimatedComponent(RXView) as typeof RX.AnimatedView;

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

@ -1,37 +1,35 @@
/**
* App.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Implements App interface for ReactXP.
*/
import RX = require('../common/Interfaces');
import Types = require('../common/Types');
* App.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Implements App interface for ReactXP.
*/
import * as RX from '../common/Interfaces';
import AppVisibilityUtils from './utils/AppVisibilityUtils';
export class App extends RX.App {
private _activationState: Types.AppActivationState;
private _activationState: RX.Types.AppActivationState;
constructor() {
super();
// Handle test environment where document is not defined.
if (typeof(document) !== 'undefined') {
this._activationState = AppVisibilityUtils.isAppInForeground() ?
Types.AppActivationState.Active : Types.AppActivationState.Background;
this._activationState = AppVisibilityUtils.isAppInForeground() ?
RX.Types.AppActivationState.Active : RX.Types.AppActivationState.Background;
AppVisibilityUtils.onAppForegroundedEvent.subscribe(() => {
this._setActivationState(Types.AppActivationState.Active);
this._setActivationState(RX.Types.AppActivationState.Active);
});
AppVisibilityUtils.onAppBackgroundedEvent.subscribe(() => {
this._setActivationState(Types.AppActivationState.Background);
this._setActivationState(RX.Types.AppActivationState.Background);
});
} else {
this._activationState = Types.AppActivationState.Active;
this._activationState = RX.Types.AppActivationState.Active;
}
}
@ -39,11 +37,11 @@ export class App extends RX.App {
super.initialize(debug, development);
}
getActivationState(): Types.AppActivationState {
getActivationState(): RX.Types.AppActivationState {
return this._activationState;
}
private _setActivationState = (currentState: Types.AppActivationState) => {
private _setActivationState = (currentState: RX.Types.AppActivationState) => {
if (this._activationState !== currentState) {
this._activationState = currentState;
this.activationStateChangedEvent.fire(this._activationState);

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

@ -1,25 +1,25 @@
/**
* Button.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform Button abstraction.
*/
* Button.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform Button abstraction.
*/
import React = require('react');
import ReactDOM = require('react-dom');
import PropTypes = require('prop-types');
import * as PropTypes from 'prop-types';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import AccessibilityUtil from './AccessibilityUtil';
import { applyFocusableComponentMixin } from './utils/FocusManager';
import { Button as ButtonBase } from '../common/Interfaces';
import { FocusArbitratorProvider } from '../common/utils/AutoFocusHelper';
import { Types } from '../common/Interfaces';
import AccessibilityUtil from './AccessibilityUtil';
import AppConfig from '../common/AppConfig';
import Styles from './Styles';
import Types = require('../common/Types');
import { applyFocusableComponentMixin } from './utils/FocusManager';
import Timers from '../common/utils/Timers';
import UserInterface from './UserInterface';
import { Button as ButtonBase } from '../common/Interfaces';
const _styles = {
defaultButton: {

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

@ -1,15 +1,15 @@
/**
* Clipboard.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform Clipboard abstraction.
*/
import escape = require('lodash/escape');
* Clipboard.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform Clipboard abstraction.
*/
import * as SyncTasks from 'synctasks';
import escape from 'lodash/escape';
import RX = require('../common/Interfaces');
import SyncTasks = require('synctasks');
import * as RX from '../common/Interfaces';
export class Clipboard extends RX.Clipboard {
public setText(text: string) {
@ -61,7 +61,7 @@ export class Clipboard extends RX.Clipboard {
const range = document.createRange();
range.selectNodeContents(node);
selection.addRange(range);
document.execCommand('copy');
selection.removeAllRanges();
}

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

@ -1,20 +1,20 @@
/**
* CustomScrollbar.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Custom scrollbar implementation for web.
*/
* CustomScrollbar.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Custom scrollbar implementation for web.
*/
import React = require('react');
import * as React from 'react';
import Timers from '../common/utils/Timers';
var UNIT = 'px';
var SCROLLER_MIN_SIZE = 15;
var SCROLLER_NEGATIVE_MARGIN = 30;
var NEUTRAL_OVERRIDE_CLASS = 'neutraloverride';
const UNIT = 'px';
const SCROLLER_MIN_SIZE = 15;
const SCROLLER_NEGATIVE_MARGIN = 30;
const NEUTRAL_OVERRIDE_CLASS = 'neutraloverride';
interface ScrollbarInfo {
size?: number;

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

@ -1,18 +1,18 @@
/**
* FrontLayerViewManager.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Manages the layering of the main view, modals and popups.
*/
* FrontLayerViewManager.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Manages the layering of the main view, modals and popups.
*/
import React = require('react');
import ReactDOM = require('react-dom');
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { PopupDescriptor, RootView } from './RootView';
import { Types } from '../common/Interfaces';
import Timers from '../common/utils/Timers';
import Types = require('../common/Types');
const MAX_CACHED_POPUPS = 4;

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

@ -1,21 +1,21 @@
/**
* GestureView.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform GestureView component.
* It provides support for the scroll wheel, clicks and double clicks.
*/
* GestureView.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform GestureView component.
* It provides support for the scroll wheel, clicks and double clicks.
*/
import _ = require('./utils/lodashMini');
import React = require('react');
import * as React from 'react';
import { clone, isUndefined } from './utils/lodashMini';
import { Types } from '../common/Interfaces';
import AccessibilityUtil from './AccessibilityUtil';
import MouseResponder, { MouseResponderSubscription } from './utils/MouseResponder';
import Styles from './Styles';
import Timers from '../common/utils/Timers';
import Types = require('../common/Types');
const _styles = {
defaultView: {
@ -248,7 +248,7 @@ export class GestureView extends React.Component<Types.GestureViewProps, Types.S
}
private _getPanPixelThreshold = () => {
return (!_.isUndefined(this.props.panPixelThreshold) && this.props.panPixelThreshold > 0) ?
return (!isUndefined(this.props.panPixelThreshold) && this.props.panPixelThreshold > 0) ?
this.props.panPixelThreshold : _panPixelThreshold;
}
@ -366,7 +366,7 @@ export class GestureView extends React.Component<Types.GestureViewProps, Types.S
// Starts a timer that reports a previous tap if it's not canceled by a subsequent gesture.
private _startDoubleTapTimer(e: React.MouseEvent<any>) {
this._lastTapEvent = _.clone(e);
this._lastTapEvent = clone(e);
this._doubleTapTimer = Timers.setTimeout(() => {
this._reportDelayedTap();

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

@ -1,23 +1,23 @@
/**
* Image.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform Image abstraction.
*/
* Image.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform Image abstraction.
*/
import _ = require('./utils/lodashMini');
import React = require('react');
import SyncTasks = require('synctasks');
import PropTypes = require('prop-types');
import restyleForInlineText = require('./utils/restyleForInlineText');
import Styles from './Styles';
import Types = require('../common/Types');
import { DEFAULT_RESIZE_MODE } from '../common/Image';
import * as PropTypes from 'prop-types';
import * as React from 'react';
import * as SyncTasks from 'synctasks';
import { CSSProperties } from 'react';
import * as _ from './utils/lodashMini';
import { DEFAULT_RESIZE_MODE } from '../common/Image';
import { Types } from '../common/Interfaces';
import restyleForInlineText from './utils/restyleForInlineText';
import Styles from './Styles';
const _styles = {
image: {
position: 'absolute',

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

@ -1,21 +1,20 @@
/**
* Input.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web implementation of Input interface.
*/
* Input.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web implementation of Input interface.
*/
import RX = require('../common/Interfaces');
import Types = require('../common/Types');
import * as RX from '../common/Interfaces';
export class Input extends RX.Input {
dispatchKeyDown(e: Types.KeyboardEvent) {
dispatchKeyDown(e: RX.Types.KeyboardEvent) {
this.keyDownEvent.fire(e);
}
dispatchKeyUp(e: Types.KeyboardEvent) {
dispatchKeyUp(e: RX.Types.KeyboardEvent) {
if (this.keyUpEvent.fire(e)) {
e.stopPropagation();
}

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

@ -1,16 +1,16 @@
/**
* International.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation for i18n.
*/
* International.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation for i18n.
*/
import RXInterfaces = require('../common/Interfaces');
import * as RX from '../common/Interfaces';
import FrontLayerViewManager from './FrontLayerViewManager';
export class International implements RXInterfaces.International {
export class International implements RX.International {
allowRTL(allow: boolean): void {
FrontLayerViewManager.allowRTL(allow);
}

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

@ -1,22 +1,22 @@
/**
* Link.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform Link abstraction.
*/
* Link.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform Link abstraction.
*/
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import * as PropTypes from 'prop-types';
import { CSSProperties } from 'react';
import EventHelpers from '../native-common/utils/EventHelpers';
import { FocusArbitratorProvider } from '../common/utils/AutoFocusHelper';
import { applyFocusableComponentMixin } from './utils/FocusManager';
import { FocusArbitratorProvider } from '../common/utils/AutoFocusHelper';
import { Types } from '../common/Interfaces';
import EventHelpers from '../native-common/utils/EventHelpers';
import Styles from './Styles';
import Types = require('../common/Types');
import Timers from '../common/utils/Timers';
const _styles = {

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

@ -1,17 +1,16 @@
/**
* Linking.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation for deep linking
*/
* Linking.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation for deep linking
*/
import SyncTasks = require('synctasks');
import Types = require('../common/Types');
import * as SyncTasks from 'synctasks';
import { Linking as CommonLinking } from '../common/Linking';
import { Types } from '../common/Interfaces';
export class Linking extends CommonLinking {
protected _openUrl(url: string): SyncTasks.Promise<void> {

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

@ -1,24 +1,23 @@
/**
* Modal.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform Modal abstraction.
*/
* Modal.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform Modal abstraction.
*/
import React = require('react');
import * as React from 'react';
import * as RX from '../common/Interfaces';
import FrontLayerViewManager from './FrontLayerViewManager';
import RX = require('../common/Interfaces');
import Types = require('../common/Types');
export class Modal extends RX.Modal {
isDisplayed(modalId?: string): boolean {
return FrontLayerViewManager.isModalDisplayed(modalId);
}
show(modal: React.ReactElement<Types.ViewProps>, modalId: string, options?: Types.ModalOptions): void {
show(modal: React.ReactElement<RX.Types.ViewProps>, modalId: string, options?: RX.Types.ModalOptions): void {
if (!modal) {
throw new Error(`modal must be valid. Actual ${modal}`);
}

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

@ -1,15 +1,15 @@
/**
* ModalContainer.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of a view that's used to render modals.
*/
* ModalContainer.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of a view that's used to render modals.
*/
import React = require('react');
import * as React from 'react';
import Types = require('../common/Types');
import { Types } from '../common/Interfaces';
const _styles = {
modalContainerStyle: {

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

@ -1,22 +1,21 @@
/**
* Network.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of Network information APIs.
*/
* Network.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of Network information APIs.
*/
import SyncTasks = require('synctasks');
import * as SyncTasks from 'synctasks';
import RX = require('../common/Interfaces');
import Types = require('../common/Types');
import * as RX from '../common/Interfaces';
export class Network extends RX.Network {
constructor() {
super();
let onEventOccuredHandler = this._onEventOccured.bind(this);
const onEventOccuredHandler = this._onEventOccured.bind(this);
// Avoid accessing window if it's not defined (for test environment).
if (typeof(window) !== 'undefined') {
@ -29,8 +28,8 @@ export class Network extends RX.Network {
return SyncTasks.Resolved(navigator.onLine);
}
getType(): SyncTasks.Promise<Types.DeviceNetworkType> {
return SyncTasks.Resolved(Types.DeviceNetworkType.Unknown);
getType(): SyncTasks.Promise<RX.Types.DeviceNetworkType> {
return SyncTasks.Resolved(RX.Types.DeviceNetworkType.Unknown);
}
private _onEventOccured() {

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

@ -1,18 +1,17 @@
/**
* Picker.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform Select abstraction.
*/
* Picker.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform Select abstraction.
*/
import _ = require('./utils/lodashMini');
import React = require('react');
import * as React from 'react';
import RX = require('../common/Interfaces');
import * as _ from './utils/lodashMini';
import * as RX from '../common/Interfaces';
import Styles from './Styles';
import Types = require('../common/Types');
export class Picker extends RX.Picker {
render() {
@ -28,7 +27,7 @@ export class Picker extends RX.Picker {
);
}
private _getStyles(): Types.PickerStyleRuleSet {
private _getStyles(): RX.Types.PickerStyleRuleSet {
return Styles.combine(this.props.style) as any;
}

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

@ -1,21 +1,20 @@
/**
* Platform.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of Platform interface.
*/
* Platform.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of Platform interface.
*/
import RX = require('../common/Interfaces');
import Types = require('../common/Types');
import * as RX from '../common/Interfaces';
export class Platform extends RX.Platform {
getType(): Types.PlatformType {
getType(): RX.Types.PlatformType {
return 'web';
}
select<T>(specifics: { [ platform in Types.PlatformType | 'default' ]?: T }): T | undefined {
select<T>(specifics: { [ platform in RX.Types.PlatformType | 'default' ]?: T }): T | undefined {
const platformType = this.getType();
return platformType in specifics ? specifics[platformType] : specifics.default;
}

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

@ -1,18 +1,17 @@
/**
* Popup.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform Popup abstraction.
*/
* Popup.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform Popup abstraction.
*/
import * as RX from '../common/Interfaces';
import FrontLayerViewManager from './FrontLayerViewManager';
import RX = require('../common/Interfaces');
import Types = require('../common/Types');
export class Popup extends RX.Popup {
show(options: Types.PopupOptions, popupId: string, delay?: number): boolean {
show(options: RX.Types.PopupOptions, popupId: string, delay?: number): boolean {
if (!popupId) {
throw new Error(`popupId must be a non-empty string. Actual: ${popupId}`);
}

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

@ -1,17 +1,17 @@
/**
* PopupContainerView.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Common parent of all components rendered into a popup, web version.
*/
* PopupContainerView.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Common parent of all components rendered into a popup, web version.
*/
import _ = require('./utils/lodashMini');
import React = require('react');
import * as React from 'react';
import { clone } from './utils/lodashMini';
import { PopupContainerViewBase, PopupContainerViewBaseProps, PopupContainerViewContext } from '../common/PopupContainerViewBase';
import Types = require('../common/Types');
import { Types } from '../common/Interfaces';
export interface PopupContainerViewProps extends PopupContainerViewBaseProps {
style: React.CSSProperties;
@ -25,7 +25,7 @@ export class PopupContainerView extends PopupContainerViewBase<PopupContainerVie
}
render() {
let style = _.clone(this.props.style);
let style = clone(this.props.style);
if (this.props.hidden) {
style.visibility = 'hidden';
}

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

@ -1,23 +1,23 @@
/**
* RootView.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* The top-most view (rendered into window.body) that's used for proper
* layering or modals, etc. in the web implementation of the ReactXP
* cross-platform library.
*/
/**
* RootView.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* The top-most view (rendered into window.body) that's used for proper
* layering or modals, etc. in the web implementation of the ReactXP
* cross-platform library.
*/
import _ = require('./utils/lodashMini');
import React = require('react');
import ReactDOM = require('react-dom');
import PropTypes = require('prop-types');
import * as PropTypes from 'prop-types';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import * as _ from './utils/lodashMini';
import { Types } from '../common/Interfaces';
import AccessibilityAnnouncer from './AccessibilityAnnouncer';
import Input from './Input';
import ModalContainer from './ModalContainer';
import Types = require('../common/Types');
import FocusManager from './utils/FocusManager';
import PopupContainerView from './PopupContainerView';
import Timers from '../common/utils/Timers';

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

@ -1,21 +1,20 @@
/**
* ScrollView.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform ScrollView abstraction.
*/
* ScrollView.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform ScrollView abstraction.
*/
import _ = require('./utils/lodashMini');
import React = require('react');
import ReactDOM = require('react-dom');
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import * as _ from './utils/lodashMini';
import * as RX from '../common/Interfaces';
import CustomScrollbar from './CustomScrollbar';
import RX = require('../common/Interfaces');
import Styles from './Styles';
import ScrollViewConfig from './ScrollViewConfig';
import Types = require('../common/Types');
import ViewBase from './ViewBase';
let _styles = {
@ -77,10 +76,10 @@ let _customStyles = {
// Default to once per frame.
const _defaultScrollThrottleValue = 1000 / 60;
export class ScrollView extends ViewBase<Types.ScrollViewProps, Types.Stateless> implements RX.ScrollView {
export class ScrollView extends ViewBase<RX.Types.ScrollViewProps, RX.Types.Stateless> implements RX.ScrollView {
private _mountedComponent: HTMLElement|null = null;
constructor(props: Types.ScrollViewProps) {
constructor(props: RX.Types.ScrollViewProps) {
super(props);
// Set final styles upon initialization of the first ScrollView. This was previously done in the head
@ -154,7 +153,7 @@ export class ScrollView extends ViewBase<Types.ScrollViewProps, Types.Stateless>
this.createCustomScrollbarsIfNeeded(this.props);
}
componentWillReceiveProps(newProps: Types.ScrollViewProps) {
componentWillReceiveProps(newProps: RX.Types.ScrollViewProps) {
super.componentWillReceiveProps(newProps);
this._onPropsChange(newProps);
}
@ -204,7 +203,7 @@ export class ScrollView extends ViewBase<Types.ScrollViewProps, Types.Stateless>
}
}, (this.props.scrollEventThrottle || _defaultScrollThrottleValue), { leading: true, trailing: true });
private _onPropsChange(props: Types.ScrollViewProps) {
private _onPropsChange(props: RX.Types.ScrollViewProps) {
this._customScrollbarEnabled = ScrollViewConfig.useCustomScrollbars();
// If we're turning on custom scrollbars or toggling vertical and/or horizontal, we need to re-create
@ -212,7 +211,7 @@ export class ScrollView extends ViewBase<Types.ScrollViewProps, Types.Stateless>
this.createCustomScrollbarsIfNeeded(props);
}
private createCustomScrollbarsIfNeeded(props: Types.ScrollViewProps) {
private createCustomScrollbarsIfNeeded(props: RX.Types.ScrollViewProps) {
if (this._mounted && this._customScrollbarEnabled) {
if (this._customScrollbar) {
if (this.props.horizontal === props.horizontal &&
@ -240,7 +239,7 @@ export class ScrollView extends ViewBase<Types.ScrollViewProps, Types.Stateless>
}
}
private _getContainerStyle(): Types.ScrollViewStyleRuleSet {
private _getContainerStyle(): RX.Types.ScrollViewStyleRuleSet {
let styles: any = [{ display: 'block' }];
let sourceStyles = this._customScrollbarEnabled ? _customStyles : _styles;

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

@ -1,12 +1,12 @@
/**
* ScrollViewConfig.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific scroll view configuration, required to avoid circular
* dependency between application and ScrollView.
*/
* ScrollViewConfig.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific scroll view configuration, required to avoid circular
* dependency between application and ScrollView.
*/
export class ScrollViewConfig {
private _useCustomScrollbars: boolean = false;

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

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

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

@ -1,15 +1,15 @@
/**
* Storage.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform database storage abstraction.
*/
* Storage.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform database storage abstraction.
*/
import SyncTasks = require('synctasks');
import * as SyncTasks from 'synctasks';
import RX = require('../common/Interfaces');
import * as RX from '../common/Interfaces';
export class Storage extends RX.Storage {
getItem(key: string): SyncTasks.Promise<string|undefined> {

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

@ -1,25 +1,23 @@
/**
* Styles.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of style functions.
*/
import _ = require('./utils/lodashMini');
* Styles.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of style functions.
*/
import * as _ from './utils/lodashMini';
import * as RX from '../common/Interfaces';
import AppConfig from '../common/AppConfig';
import RX = require('../common/Interfaces');
import Types = require('../common/Types');
import StyleLeakDetector from '../common/StyleLeakDetector';
type CssAliasMap = { [prop: string]: string };
export class Styles extends RX.Styles {
// Combines a set of styles
combine<S>(ruleSet1: Types.StyleRuleSetRecursive<S>|undefined, ruleSet2?: Types.StyleRuleSetRecursive<S>)
: Types.StyleRuleSetOrArray<S>|undefined {
combine<S>(ruleSet1: RX.Types.StyleRuleSetRecursive<S>|undefined, ruleSet2?: RX.Types.StyleRuleSetRecursive<S>)
: RX.Types.StyleRuleSetOrArray<S>|undefined {
if (!ruleSet1 && !ruleSet2) {
return undefined;
}
@ -62,74 +60,74 @@ export class Styles extends RX.Styles {
}
}
return combinedStyles as Types.StyleRuleSet<S>;
return combinedStyles as RX.Types.StyleRuleSet<S>;
}
return ruleSet as Types.StyleRuleSet<S>;
return ruleSet as RX.Types.StyleRuleSet<S>;
}
// Creates opaque styles that can be used for View
createViewStyle(ruleSet: Types.ViewStyle, cacheStyle: boolean = true): Types.ViewStyleRuleSet {
createViewStyle(ruleSet: RX.Types.ViewStyle, cacheStyle: boolean = true): RX.Types.ViewStyleRuleSet {
return this._adaptStyles(ruleSet, cacheStyle);
}
// Creates opaque styles that can be used for View
createAnimatedViewStyle(ruleSet: Types.AnimatedViewStyle): Types.AnimatedViewStyleRuleSet {
createAnimatedViewStyle(ruleSet: RX.Types.AnimatedViewStyle): RX.Types.AnimatedViewStyleRuleSet {
return this._adaptStyles(ruleSet, false);
}
// Creates opaque styles that can be used for ScrollView
createScrollViewStyle(ruleSet: Types.ScrollViewStyle, cacheStyle: boolean = true): Types.ScrollViewStyleRuleSet {
createScrollViewStyle(ruleSet: RX.Types.ScrollViewStyle, cacheStyle: boolean = true): RX.Types.ScrollViewStyleRuleSet {
return this._adaptStyles(ruleSet, cacheStyle);
}
// Creates opaque styles that can be used for Button
createButtonStyle(ruleSet: Types.ButtonStyle, cacheStyle: boolean = true): Types.ButtonStyleRuleSet {
createButtonStyle(ruleSet: RX.Types.ButtonStyle, cacheStyle: boolean = true): RX.Types.ButtonStyleRuleSet {
return this._adaptStyles(ruleSet, cacheStyle);
}
// Creates opaque styles that can be used for WebView
createWebViewStyle(ruleSet: Types.WebViewStyle, cacheStyle: boolean = true): Types.WebViewStyleRuleSet {
createWebViewStyle(ruleSet: RX.Types.WebViewStyle, cacheStyle: boolean = true): RX.Types.WebViewStyleRuleSet {
return this._adaptStyles(ruleSet, cacheStyle);
}
// Creates opaque styles that can be used for Text
createTextStyle(ruleSet: Types.TextStyle, cacheStyle: boolean = true): Types.TextStyleRuleSet {
createTextStyle(ruleSet: RX.Types.TextStyle, cacheStyle: boolean = true): RX.Types.TextStyleRuleSet {
return this._adaptStyles(ruleSet, cacheStyle, true);
}
// Creates opaque styles that can be used for Text
createAnimatedTextStyle(ruleSet: Types.AnimatedTextStyle): Types.AnimatedTextStyleRuleSet {
createAnimatedTextStyle(ruleSet: RX.Types.AnimatedTextStyle): RX.Types.AnimatedTextStyleRuleSet {
return this._adaptStyles(ruleSet, false);
}
// Creates opaque styles that can be used for TextInput
createTextInputStyle(ruleSet: Types.TextInputStyle, cacheStyle: boolean = true): Types.TextInputStyleRuleSet {
createTextInputStyle(ruleSet: RX.Types.TextInputStyle, cacheStyle: boolean = true): RX.Types.TextInputStyleRuleSet {
return this._adaptStyles(ruleSet, cacheStyle, true);
}
// Creates opaque styles that can be used for TextInput
createAnimatedTextInputStyle(ruleSet: Types.AnimatedTextInputStyle): Types.AnimatedTextInputStyleRuleSet {
createAnimatedTextInputStyle(ruleSet: RX.Types.AnimatedTextInputStyle): RX.Types.AnimatedTextInputStyleRuleSet {
return this._adaptStyles(ruleSet, false);
}
// Creates opaque styles that can be used for Link
createLinkStyle(ruleSet: Types.LinkStyle, cacheStyle: boolean = true): Types.LinkStyleRuleSet {
createLinkStyle(ruleSet: RX.Types.LinkStyle, cacheStyle: boolean = true): RX.Types.LinkStyleRuleSet {
return this._adaptStyles(ruleSet, cacheStyle);
}
// Creates opaque styles that can be used for Image
createImageStyle(ruleSet: Types.ImageStyle, cacheStyle: boolean = true): Types.ImageStyleRuleSet {
createImageStyle(ruleSet: RX.Types.ImageStyle, cacheStyle: boolean = true): RX.Types.ImageStyleRuleSet {
return this._adaptStyles(ruleSet, cacheStyle);
}
// Creates opaque styles that can be used for Image
createAnimatedImageStyle(ruleSet: Types.AnimatedImageStyle): Types.AnimatedImageStyleRuleSet {
createAnimatedImageStyle(ruleSet: RX.Types.AnimatedImageStyle): RX.Types.AnimatedImageStyleRuleSet {
return this._adaptStyles(ruleSet, false);
}
// Creates opaque styles that can be used for Picker
createPickerStyle(ruleSet: Types.PickerStyle, cacheStyle: boolean = true): Types.PickerStyleRuleSet {
createPickerStyle(ruleSet: RX.Types.PickerStyle, cacheStyle: boolean = true): RX.Types.PickerStyleRuleSet {
return this._adaptStyles(ruleSet, cacheStyle);
}
@ -352,7 +350,7 @@ export class Styles extends RX.Styles {
}
// CSS (and React JS) support lineHeight defined as either a multiple of the font
// size or a pixel count. The Types interface always uses a pixel count. We need to
// size or a pixel count. The RX.Types interface always uses a pixel count. We need to
// convert to the string notation to make CSS happy.
if (def.lineHeight !== undefined) {
def['lineHeight'] = def.lineHeight + 'px';

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

@ -1,21 +1,20 @@
/**
* Text.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform Text abstraction.
*/
* Text.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform Text abstraction.
*/
import React = require('react');
import ReactDOM = require('react-dom');
import PropTypes = require('prop-types');
import * as PropTypes from 'prop-types';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import AccessibilityUtil from './AccessibilityUtil';
import { FocusArbitratorProvider } from '../common/utils/AutoFocusHelper';
import { Text as TextBase, Types } from '../common/Interfaces';
import AccessibilityUtil from './AccessibilityUtil';
import Styles from './Styles';
import Types = require('../common/Types');
import { Text as TextBase } from '../common/Interfaces';
// Adding a CSS rule to display non-selectable texts. Those texts
// will be displayed as pseudo elements to prevent them from being copied
@ -139,7 +138,7 @@ export class Text extends TextBase {
combinedStyles['MozUserSelect'] = 'text';
combinedStyles['msUserSelect'] = 'text';
}
// Handle cursor styles
if (!combinedStyles.cursor) {
if (this.props.selectable) {

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

@ -1,19 +1,19 @@
/**
* TextInput.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform TextInput abstraction.
*/
* TextInput.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform TextInput abstraction.
*/
import React = require('react');
import PropTypes = require('prop-types');
import * as React from 'react';
import * as PropTypes from 'prop-types';
import { FocusArbitratorProvider } from '../common/utils/AutoFocusHelper';
import Styles from './Styles';
import Types = require('../common/Types');
import { applyFocusableComponentMixin } from './utils/FocusManager';
import { FocusArbitratorProvider } from '../common/utils/AutoFocusHelper';
import { Types } from '../common/Interfaces';
import Styles from './Styles';
export interface TextInputState {
inputValue?: string;

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

@ -1,21 +1,20 @@
/**
* UserInterface.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the ReactXP interfaces related to
* UI (layout measurements, etc.).
*/
* UserInterface.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the ReactXP interfaces related to
* UI (layout measurements, etc.).
*/
import React = require('react');
import ReactDOM = require('react-dom');
import ScrollViewConfig from './ScrollViewConfig';
import SyncTasks = require('synctasks');
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import * as SyncTasks from 'synctasks';
import * as RX from '../common/Interfaces';
import FrontLayerViewManager from './FrontLayerViewManager';
import RX = require('../common/Interfaces');
import Types = require('../common/Types');
import ScrollViewConfig from './ScrollViewConfig';
export class UserInterface extends RX.UserInterface {
private _isNavigatingWithKeyboard: boolean = false;
@ -26,9 +25,9 @@ export class UserInterface extends RX.UserInterface {
}
measureLayoutRelativeToWindow(component: React.Component<any, any>) :
SyncTasks.Promise<Types.LayoutInfo> {
SyncTasks.Promise<RX.Types.LayoutInfo> {
let deferred = SyncTasks.Defer<Types.LayoutInfo>();
let deferred = SyncTasks.Defer<RX.Types.LayoutInfo>();
const componentDomNode = ReactDOM.findDOMNode(component) as HTMLElement|null;
@ -49,9 +48,9 @@ export class UserInterface extends RX.UserInterface {
}
measureLayoutRelativeToAncestor(component: React.Component<any, any>,
ancestor: React.Component<any, any>) : SyncTasks.Promise<Types.LayoutInfo> {
ancestor: React.Component<any, any>) : SyncTasks.Promise<RX.Types.LayoutInfo> {
let deferred = SyncTasks.Defer<Types.LayoutInfo>();
let deferred = SyncTasks.Defer<RX.Types.LayoutInfo>();
const componentDomNode = ReactDOM.findDOMNode(component) as HTMLElement|null;
const ancestorDomNode = ReactDOM.findDOMNode(ancestor) as HTMLElement|null;
@ -73,7 +72,7 @@ export class UserInterface extends RX.UserInterface {
return deferred.promise();
}
measureWindow(rootViewId?: string): Types.LayoutInfo {
measureWindow(rootViewId?: string): RX.Types.LayoutInfo {
// Mo multi window support, default to main window
return {
x: 0,
@ -134,7 +133,7 @@ export class UserInterface extends RX.UserInterface {
// Nothing to do
}
evaluateTouchLatency(e: Types.MouseEvent) {
evaluateTouchLatency(e: RX.Types.MouseEvent) {
// Nothing to do
}

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

@ -1,18 +1,18 @@
/**
* UserPresence.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the ReactXP interfaces related to
* user presence.
*
* User is considered present when user is focused on the App and has interacted with the App in the last 60 seconds.
* User is considered not present, if app is not focused (backgrounded or blurred) or the app is focused
* but the user has not intereacted with the app in the last 60 seconds.
*/
* UserPresence.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the ReactXP interfaces related to
* user presence.
*
* User is considered present when user is focused on the App and has interacted with the App in the last 60 seconds.
* User is considered not present, if app is not focused (backgrounded or blurred) or the app is focused
* but the user has not intereacted with the app in the last 60 seconds
*/
import RX = require('../common/Interfaces');
import * as RX from '../common/Interfaces';
import AppVisibilityUtils from './utils/AppVisibilityUtils';
export class UserPresence extends RX.UserPresence {
@ -66,5 +66,5 @@ export class UserPresence extends RX.UserPresence {
}
}
var instance = new UserPresence();
const instance = new UserPresence();
export default instance;

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

@ -1,28 +1,28 @@
/**
* View.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform View abstraction.
*/
* View.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform View abstraction.
*/
import React = require('react');
import ReactDOM = require('react-dom');
import PropTypes = require('prop-types');
import * as PropTypes from 'prop-types';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { FocusArbitratorProvider } from '../common/utils/AutoFocusHelper';
import { FocusManager, applyFocusableComponentMixin } from './utils/FocusManager';
import { PopupComponent } from '../common/PopupContainerViewBase';
import { RestrictFocusType } from '../common/utils/FocusManager';
import { Types } from '../common/Interfaces';
import AccessibilityUtil from './AccessibilityUtil';
import AnimateListEdits from './listAnimations/AnimateListEdits';
import AppConfig from '../common/AppConfig';
import { FocusArbitratorProvider } from '../common/utils/AutoFocusHelper';
import restyleForInlineText = require('./utils/restyleForInlineText');
import Styles from './Styles';
import Types = require('../common/Types');
import ViewBase from './ViewBase';
import PopupContainerView from './PopupContainerView';
import { PopupComponent } from '../common/PopupContainerViewBase';
import { RestrictFocusType } from '../common/utils/FocusManager';
import { FocusManager, applyFocusableComponentMixin } from './utils/FocusManager';
import restyleForInlineText from './utils/restyleForInlineText';
import Styles from './Styles';
import ViewBase from './ViewBase';
const _styles = {
defaultStyle: {

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

@ -1,20 +1,19 @@
/**
* ViewBase.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* A base class for the Web-specific implementation of the cross-platform View abstraction.
*/
* ViewBase.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* A base class for the Web-specific implementation of the cross-platform View abstraction.
*/
import _ = require('./utils/lodashMini');
import * as SyncTasks from 'synctasks';
import * as _ from './utils/lodashMini';
import * as RX from '../common/Interfaces';
import FrontLayerViewManager from './FrontLayerViewManager';
import AppConfig from '../common/AppConfig';
import RX = require('../common/Interfaces');
import SyncTasks = require('synctasks');
import Timers from '../common/utils/Timers';
import Types = require('../common/Types');
// We create a periodic timer to detect layout changes that are performed behind
// our back by the browser's layout engine. We do this more aggressively when
@ -22,11 +21,11 @@ import Types = require('../common/Types');
const _layoutTimerActiveDuration = 1000;
const _layoutTimerInactiveDuration = 10000;
export abstract class ViewBase<P extends Types.ViewProps, S> extends RX.ViewBase<P, S> {
export abstract class ViewBase<P extends RX.Types.ViewProps, S> extends RX.ViewBase<P, S> {
private static _viewCheckingTimer: number|undefined;
private static _isResizeHandlerInstalled = false;
private static _viewCheckingList: ViewBase<Types.ViewProps, Types.Stateless>[] = [];
private static _appActivationState = Types.AppActivationState.Active;
private static _viewCheckingList: ViewBase<RX.Types.ViewProps, RX.Types.Stateless>[] = [];
private static _appActivationState = RX.Types.AppActivationState.Active;
abstract render(): JSX.Element;
protected abstract _getContainer(): HTMLElement|null;
@ -35,7 +34,7 @@ export abstract class ViewBase<P extends Types.ViewProps, S> extends RX.ViewBase
// Sets the activation state so we can stop our periodic timer
// when the app is in the background.
static setActivationState(newState: Types.AppActivationState) {
static setActivationState(newState: RX.Types.AppActivationState) {
if (ViewBase._appActivationState !== newState) {
ViewBase._appActivationState = newState;
@ -47,18 +46,18 @@ export abstract class ViewBase<P extends Types.ViewProps, S> extends RX.ViewBase
if (ViewBase._viewCheckingList.length > 0) {
// If we're becoming active, check and report layout changes immediately.
if (newState === Types.AppActivationState.Active) {
if (newState === RX.Types.AppActivationState.Active) {
ViewBase._checkViews();
}
ViewBase._viewCheckingTimer = Timers.setInterval(ViewBase._checkViews,
newState === Types.AppActivationState.Active ?
newState === RX.Types.AppActivationState.Active ?
_layoutTimerActiveDuration : _layoutTimerInactiveDuration);
}
}
}
componentWillReceiveProps(nextProps: Types.ViewProps) {
componentWillReceiveProps(nextProps: RX.Types.ViewProps) {
if (!!this.props.onLayout !== !!nextProps.onLayout) {
if (this.props.onLayout) {
this._checkViewCheckerUnbuild();
@ -161,7 +160,7 @@ export abstract class ViewBase<P extends Types.ViewProps, S> extends RX.ViewBase
// when the app is active versus inactive.
if (!ViewBase._viewCheckingTimer) {
ViewBase._viewCheckingTimer = Timers.setInterval(ViewBase._checkViews,
ViewBase._appActivationState === Types.AppActivationState.Active ?
ViewBase._appActivationState === RX.Types.AppActivationState.Active ?
_layoutTimerActiveDuration : _layoutTimerInactiveDuration);
}

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

@ -1,18 +1,17 @@
/**
* WebView.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* A control that allows the display of an independent web page.
*/
* WebView.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* A control that allows the display of an independent web page.
*/
import React = require('react');
import * as React from 'react';
import RX = require('../common/Interfaces');
import Styles from './Styles';
import Types = require('../common/Types');
import * as RX from '../common/Interfaces';
import { View } from './View';
import Styles from './Styles';
let _styles = {
webViewDefault: Styles.createWebViewStyle({
@ -37,7 +36,7 @@ interface WebViewMessageEventInternal extends RX.Types.WebViewMessageEvent {
__propagationStopped: boolean;
}
export class WebView extends React.Component<Types.WebViewProps, WebViewState> implements RX.WebView {
export class WebView extends React.Component<RX.Types.WebViewProps, WebViewState> implements RX.WebView {
private static _webFrameNumber = 1;
private static _onMessageReceived: RX.Types.SubscribableEvent<(e: WebViewMessageEventInternal) => void>;
private static _messageListenerInstalled = false;
@ -45,7 +44,7 @@ export class WebView extends React.Component<Types.WebViewProps, WebViewState> i
private _mountedComponent: HTMLIFrameElement|null = null;
private _onMessageReceivedToken: RX.Types.SubscriptionToken|undefined;
constructor(props: Types.WebViewProps) {
constructor(props: RX.Types.WebViewProps) {
super(props);
this.state = {
@ -66,7 +65,7 @@ export class WebView extends React.Component<Types.WebViewProps, WebViewState> i
}
}
componentDidUpdate(prevProps: Types.WebViewProps, prevState: WebViewState) {
componentDidUpdate(prevProps: RX.Types.WebViewProps, prevState: WebViewState) {
this._postRender();
let oldCustomContents = this._getCustomHtml(prevProps);
@ -86,7 +85,7 @@ export class WebView extends React.Component<Types.WebViewProps, WebViewState> i
}
}
private _getCustomHtml(props: Types.WebViewProps): string|undefined {
private _getCustomHtml(props: RX.Types.WebViewProps): string|undefined {
if (props.url || !props.source) {
return undefined;
}
@ -173,7 +172,7 @@ export class WebView extends React.Component<Types.WebViewProps, WebViewState> i
let styles = Styles.combine([_styles.webViewDefault, this.props.style]);
let sandbox = this.props.sandbox !== undefined
? this.props.sandbox
: (this.props.javaScriptEnabled ? Types.WebViewSandboxMode.AllowScripts : Types.WebViewSandboxMode.None);
: (this.props.javaScriptEnabled ? RX.Types.WebViewSandboxMode.AllowScripts : RX.Types.WebViewSandboxMode.None);
// width 100% is needed for Edge - it doesn't grow iframe. Resize needs to be done with wrapper
return (
@ -197,43 +196,43 @@ export class WebView extends React.Component<Types.WebViewProps, WebViewState> i
this._mountedComponent = component;
}
private _onLoad = (e: Types.SyntheticEvent) => {
private _onLoad = (e: RX.Types.SyntheticEvent) => {
if (this.props.onLoad) {
this.props.onLoad(e);
}
}
private _sandboxToStringValue = (sandbox: Types.WebViewSandboxMode) => {
private _sandboxToStringValue = (sandbox: RX.Types.WebViewSandboxMode) => {
let values: string[] = [];
if (sandbox & Types.WebViewSandboxMode.AllowForms) {
if (sandbox & RX.Types.WebViewSandboxMode.AllowForms) {
values.push('allow-forms');
}
if (sandbox & Types.WebViewSandboxMode.AllowModals) {
if (sandbox & RX.Types.WebViewSandboxMode.AllowModals) {
values.push('allow-modals');
}
if (sandbox & Types.WebViewSandboxMode.AllowOrientationLock) {
if (sandbox & RX.Types.WebViewSandboxMode.AllowOrientationLock) {
values.push('allow-orientation-lock');
}
if (sandbox & Types.WebViewSandboxMode.AllowPointerLock) {
if (sandbox & RX.Types.WebViewSandboxMode.AllowPointerLock) {
values.push('allow-pointer-lock');
}
if (sandbox & Types.WebViewSandboxMode.AllowPopups) {
if (sandbox & RX.Types.WebViewSandboxMode.AllowPopups) {
values.push('allow-popups');
}
if (sandbox & Types.WebViewSandboxMode.AllowPopupsToEscapeSandbox) {
if (sandbox & RX.Types.WebViewSandboxMode.AllowPopupsToEscapeSandbox) {
values.push('allow-popups-to-escape-sandbox');
}
if (sandbox & Types.WebViewSandboxMode.AllowPresentation) {
if (sandbox & RX.Types.WebViewSandboxMode.AllowPresentation) {
values.push('allow-presentation');
}
if (sandbox & Types.WebViewSandboxMode.AllowSameOrigin) {
if (sandbox & RX.Types.WebViewSandboxMode.AllowSameOrigin) {
values.push('allow-same-origin');
}
if (sandbox & Types.WebViewSandboxMode.AllowScripts) {
if (sandbox & RX.Types.WebViewSandboxMode.AllowScripts) {
values.push('allow-scripts');
}
if (sandbox & Types.WebViewSandboxMode.AllowTopNavigation) {
if (sandbox & RX.Types.WebViewSandboxMode.AllowTopNavigation) {
values.push('allow-top-navigation');
}

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

@ -1,15 +1,14 @@
/**
* executeTransition.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Provides a convenient API for applying a CSS transition to a DOM element and
* notifying when the transition is complete.
*/
import _ = require('./../utils/lodashMini');
* executeTransition.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Provides a convenient API for applying a CSS transition to a DOM element and
* notifying when the transition is complete.
*/
import * as _ from './../utils/lodashMini';
import Timers from '../../common/utils/Timers';
export interface TransitionSpec {

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

@ -1,20 +1,20 @@
/**
* AnimateListEdits.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Each time the component receives new children, animates insertions, removals,
* and moves that occurred since the previous render.
*/
* AnimateListEdits.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Each time the component receives new children, animates insertions, removals,
* and moves that occurred since the previous render.
*/
import _ = require('lodash');
import React = require('react');
import ReactDOM = require('react-dom');
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { clone } from './../utils/lodashMini';
import { MonitorListEdits, Edits } from './MonitorListEdits';
import { Types } from '../../common/Interfaces';
import executeTransition from '../animated/executeTransition';
import Types = require('../../common/Types');
export interface AnimateListEditsProps {
animateChildEnter?: boolean;
@ -92,7 +92,7 @@ export class AnimateListEdits extends React.Component<AnimateListEditsProps, Typ
render() {
// Do a shallow clone and remove the props that don't
// apply to the MontiroListEdits component.
let props = _.clone(this.props) as AnimateListEditsProps;
let props = clone(this.props) as AnimateListEditsProps;
delete props.animateChildEnter;
delete props.animateChildLeave;
delete props.animateChildMove;

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

@ -1,20 +1,20 @@
/**
* MonitorListEdits.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Looks for insertions, removals, and moves each time the component receives new
* children. Communicates these list edits to the consumer giving it the opportunity
* to animate the edits.
*/
* MonitorListEdits.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Looks for insertions, removals, and moves each time the component receives new
* children. Communicates these list edits to the consumer giving it the opportunity
* to animate the edits.
*/
import _ = require('./../utils/lodashMini');
import assert = require('assert');
import React = require('react');
import ReactDOM = require('react-dom');
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import assert from 'assert';
import Types = require('../../common/Types');
import * as _ from './../utils/lodashMini';
import { Types } from '../../common/Interfaces';
function getPosition(el: HTMLElement): { left: number; top: number; } {
return {

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

@ -1,22 +1,22 @@
/**
* AppVisibilityUtils.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific helpers for firing focus/activity related events
*/
* AppVisibilityUtils.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific helpers for firing focus/activity related events
*/
import _ = require('./lodashMini');
import SubscribableEvent from 'subscribableevent';
import { isUndefined } from './lodashMini';
import Timers from '../../common/utils/Timers';
const idleTimeInMs = 60 * 1000;
export class AppVisibilityUtils {
private _isIdle = false;
private _timer: number|undefined;
private _timer: number | undefined;
readonly onFocusedEvent = new SubscribableEvent<() => void>();
readonly onBlurredEvent = new SubscribableEvent<() => void>();
@ -73,7 +73,7 @@ export class AppVisibilityUtils {
}
private _wakeUpAndSetTimerForIdle = () => {
if (!_.isUndefined(this._timer)) {
if (!isUndefined(this._timer)) {
clearTimeout(this._timer);
}

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

@ -1,31 +1,33 @@
/**
* FocusManager.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Manages focusable elements for better keyboard navigation (web version)
*/
* FocusManager.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Manages focusable elements for better keyboard navigation (web version)
*/
import ReactDOM = require('react-dom');
import * as ReactDOM from 'react-dom';
import { FocusManager as FocusManagerBase,
import {
applyFocusableComponentMixin as applyFocusableComponentMixinCommon,
FocusableComponentStateCallback,
FocusableComponentInternal,
StoredFocusableComponent as StoredFocusableComponentBase } from '../../common/utils/FocusManager';
import { FocusArbitratorProvider, FocusCandidateType, FocusCandidateInternal } from '../../common/utils/AutoFocusHelper';
FocusManager as FocusManagerBase,
StoredFocusableComponent as StoredFocusableComponentBase,
} from '../../common/utils/FocusManager';
import {
FocusArbitratorProvider,
FocusCandidateInternal,
FocusCandidateType,
} from '../../common/utils/AutoFocusHelper';
import Timers from '../../common/utils/Timers';
import UserInterface from '../UserInterface';
const ATTR_NAME_TAB_INDEX = 'tabindex';
const ATTR_NAME_ARIA_HIDDEN = 'aria-hidden';
let _isShiftPressed: boolean;
import {
applyFocusableComponentMixin as applyFocusableComponentMixinCommon,
FocusableComponentStateCallback
} from '../../common/utils/FocusManager';
export { FocusableComponentStateCallback };
export interface StoredFocusableComponent extends StoredFocusableComponentBase {

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

@ -1,15 +1,14 @@
/**
* MouseResponder.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Handles tracking of mouse movements.
*/
* MouseResponder.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Handles tracking of mouse movements.
*/
import _ = require('./../utils/lodashMini');
import Types = require('../../common/Types');
import * as _ from './../utils/lodashMini';
import { Types } from '../../common/Interfaces';
const _compareDOMOrder = (a: Responder, b: Responder) => {
if (a.target.compareDocumentPosition(b.target) & Node.DOCUMENT_POSITION_PRECEDING) {

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

@ -1,40 +1,40 @@
/**
* lodashMini.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Import and re-export of part of the lodash module. This helps reduce bundle size.
*/
* lodashMini.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Import and re-export of part of the lodash module. This helps reduce bundle size.
*/
import assign = require('lodash/assign');
import clone = require('lodash/clone');
import cloneDeep = require('lodash/cloneDeep');
import defer = require('lodash/defer');
import each = require('lodash/each');
import endsWith = require('lodash/endsWith');
import extend = require('lodash/extend');
import filter = require('lodash/filter');
import findIndex = require('lodash/findIndex');
import findLast = require('lodash/findLast');
import flatten = require('lodash/flatten');
import get = require('lodash/get');
import isArray = require('lodash/isArray');
import isEmpty = require('lodash/isEmpty');
import isEqual = require('lodash/isEqual');
import isObject = require('lodash/isObject');
import isUndefined = require('lodash/isUndefined');
import kebabCase = require('lodash/kebabCase');
import keys = require('lodash/keys');
import map = require('lodash/map');
import mapValues = require('lodash/mapValues');
import max = require('lodash/max');
import memoize = require('lodash/memoize');
import merge = require('lodash/merge');
import omit = require('lodash/omit');
import remove = require('lodash/remove');
import throttle = require('lodash/throttle');
import union = require('lodash/union');
import assign from 'lodash/assign';
import clone from 'lodash/clone';
import cloneDeep from 'lodash/cloneDeep';
import defer from 'lodash/defer';
import each from 'lodash/each';
import endsWith from 'lodash/endsWith';
import extend from 'lodash/extend';
import filter from 'lodash/filter';
import findIndex from 'lodash/findIndex';
import findLast from 'lodash/findLast';
import flatten from 'lodash/flatten';
import get from 'lodash/get';
import isArray from 'lodash/isArray';
import isEmpty from 'lodash/isEmpty';
import isEqual from 'lodash/isEqual';
import isObject from 'lodash/isObject';
import isUndefined from 'lodash/isUndefined';
import kebabCase from 'lodash/kebabCase';
import keys from 'lodash/keys';
import map from 'lodash/map';
import mapValues from 'lodash/mapValues';
import max from 'lodash/max';
import memoize from 'lodash/memoize';
import merge from 'lodash/merge';
import omit from 'lodash/omit';
import remove from 'lodash/remove';
import throttle from 'lodash/throttle';
import union from 'lodash/union';
export {
assign,

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

@ -1,21 +1,22 @@
/**
* restyleForInlineText.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* When a ReactXP component appears as a child of an RX.Text, it needs to be styled
* specially so that it appears inline with the text rather than introducing line
* breaks.
*
* This utility restyles the component that is passed to it as inline so it flows
* with the text. When a ReactXP component is a child of a text, pass the return value
* of its render method to this utility. See RX.View for an example.
*/
* restyleForInlineText.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* When a ReactXP component appears as a child of an RX.Text, it needs to be styled
* specially so that it appears inline with the text rather than introducing line
* breaks.
*
* This utility restyles the component that is passed to it as inline so it flows
* with the text. When a ReactXP component is a child of a text, pass the return value
* of its render method to this utility. See RX.View for an example.
*/
import _ = require('./../utils/lodashMini');
import assert = require('assert');
import React = require('react');
import * as React from 'react';
import assert from 'assert';
import { assign } from './../utils/lodashMini';
function restyleForInlineText(reactElement: React.ReactElement<any>) {
let style = reactElement.props['style'];
@ -47,7 +48,7 @@ function restyleForInlineText(reactElement: React.ReactElement<any>) {
*/
return React.cloneElement(reactElement, {
style: _.assign({}, style, {
style: assign({}, style, {
display: 'inline-block',
// Reset the line height so the value from outside
@ -57,4 +58,4 @@ function restyleForInlineText(reactElement: React.ReactElement<any>) {
});
}
export = restyleForInlineText;
export default restyleForInlineText;

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

@ -1,10 +1,10 @@
/*
* window.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Window module to enable easy mocking.
*/
* window.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Window module to enable easy mocking.
*/
export = typeof(window) !== 'undefined' ? window : <Window>{};

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

@ -6,6 +6,8 @@
"module": "commonjs",
"target": "es5",
"experimentalDecorators": true,
"esModuleInterop": true,
"importHelpers": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,