Latest updates from IceHrmPro
This commit is contained in:
9
web/node_modules/rmc-feedback/es/PropTypes.d.ts
generated
vendored
Normal file
9
web/node_modules/rmc-feedback/es/PropTypes.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export interface ITouchProps {
|
||||
disabled?: boolean;
|
||||
activeClassName?: string;
|
||||
activeStyle?: any;
|
||||
children?: any;
|
||||
}
|
||||
export interface ITouchState {
|
||||
active: boolean;
|
||||
}
|
||||
0
web/node_modules/rmc-feedback/es/PropTypes.js
generated
vendored
Normal file
0
web/node_modules/rmc-feedback/es/PropTypes.js
generated
vendored
Normal file
21
web/node_modules/rmc-feedback/es/TouchFeedback.d.ts
generated
vendored
Normal file
21
web/node_modules/rmc-feedback/es/TouchFeedback.d.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/// <reference types="react" />
|
||||
import React from 'react';
|
||||
import { ITouchProps, ITouchState } from './PropTypes';
|
||||
export default class TouchFeedback extends React.Component<ITouchProps, ITouchState> {
|
||||
static defaultProps: {
|
||||
disabled: boolean;
|
||||
};
|
||||
state: {
|
||||
active: boolean;
|
||||
};
|
||||
componentDidUpdate(): void;
|
||||
triggerEvent(type: any, isActive: any, ev: any): void;
|
||||
onTouchStart: (e: any) => void;
|
||||
onTouchMove: (e: any) => void;
|
||||
onTouchEnd: (e: any) => void;
|
||||
onTouchCancel: (e: any) => void;
|
||||
onMouseDown: (e: any) => void;
|
||||
onMouseUp: (e: any) => void;
|
||||
onMouseLeave: (e: any) => void;
|
||||
render(): React.ReactElement<any>;
|
||||
}
|
||||
113
web/node_modules/rmc-feedback/es/TouchFeedback.js
generated
vendored
Normal file
113
web/node_modules/rmc-feedback/es/TouchFeedback.js
generated
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
import _extends from 'babel-runtime/helpers/extends';
|
||||
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
|
||||
import _createClass from 'babel-runtime/helpers/createClass';
|
||||
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
||||
import _inherits from 'babel-runtime/helpers/inherits';
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
|
||||
var TouchFeedback = function (_React$Component) {
|
||||
_inherits(TouchFeedback, _React$Component);
|
||||
|
||||
function TouchFeedback() {
|
||||
_classCallCheck(this, TouchFeedback);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (TouchFeedback.__proto__ || Object.getPrototypeOf(TouchFeedback)).apply(this, arguments));
|
||||
|
||||
_this.state = {
|
||||
active: false
|
||||
};
|
||||
_this.onTouchStart = function (e) {
|
||||
_this.triggerEvent('TouchStart', true, e);
|
||||
};
|
||||
_this.onTouchMove = function (e) {
|
||||
_this.triggerEvent('TouchMove', false, e);
|
||||
};
|
||||
_this.onTouchEnd = function (e) {
|
||||
_this.triggerEvent('TouchEnd', false, e);
|
||||
};
|
||||
_this.onTouchCancel = function (e) {
|
||||
_this.triggerEvent('TouchCancel', false, e);
|
||||
};
|
||||
_this.onMouseDown = function (e) {
|
||||
// pc simulate mobile
|
||||
_this.triggerEvent('MouseDown', true, e);
|
||||
};
|
||||
_this.onMouseUp = function (e) {
|
||||
_this.triggerEvent('MouseUp', false, e);
|
||||
};
|
||||
_this.onMouseLeave = function (e) {
|
||||
_this.triggerEvent('MouseLeave', false, e);
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(TouchFeedback, [{
|
||||
key: 'componentDidUpdate',
|
||||
value: function componentDidUpdate() {
|
||||
if (this.props.disabled && this.state.active) {
|
||||
this.setState({
|
||||
active: false
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'triggerEvent',
|
||||
value: function triggerEvent(type, isActive, ev) {
|
||||
var eventType = 'on' + type;
|
||||
var children = this.props.children;
|
||||
|
||||
if (children.props[eventType]) {
|
||||
children.props[eventType](ev);
|
||||
}
|
||||
if (isActive !== this.state.active) {
|
||||
this.setState({
|
||||
active: isActive
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _props = this.props,
|
||||
children = _props.children,
|
||||
disabled = _props.disabled,
|
||||
activeClassName = _props.activeClassName,
|
||||
activeStyle = _props.activeStyle;
|
||||
|
||||
var events = disabled ? undefined : {
|
||||
onTouchStart: this.onTouchStart,
|
||||
onTouchMove: this.onTouchMove,
|
||||
onTouchEnd: this.onTouchEnd,
|
||||
onTouchCancel: this.onTouchCancel,
|
||||
onMouseDown: this.onMouseDown,
|
||||
onMouseUp: this.onMouseUp,
|
||||
onMouseLeave: this.onMouseLeave
|
||||
};
|
||||
var child = React.Children.only(children);
|
||||
if (!disabled && this.state.active) {
|
||||
var _child$props = child.props,
|
||||
style = _child$props.style,
|
||||
className = _child$props.className;
|
||||
|
||||
if (activeStyle !== false) {
|
||||
if (activeStyle) {
|
||||
style = _extends({}, style, activeStyle);
|
||||
}
|
||||
className = classNames(className, activeClassName);
|
||||
}
|
||||
return React.cloneElement(child, _extends({ className: className,
|
||||
style: style }, events));
|
||||
}
|
||||
return React.cloneElement(child, events);
|
||||
}
|
||||
}]);
|
||||
|
||||
return TouchFeedback;
|
||||
}(React.Component);
|
||||
|
||||
export default TouchFeedback;
|
||||
|
||||
TouchFeedback.defaultProps = {
|
||||
disabled: false
|
||||
};
|
||||
1
web/node_modules/rmc-feedback/es/index.d.ts
generated
vendored
Normal file
1
web/node_modules/rmc-feedback/es/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from './TouchFeedback';
|
||||
1
web/node_modules/rmc-feedback/es/index.js
generated
vendored
Normal file
1
web/node_modules/rmc-feedback/es/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from './TouchFeedback';
|
||||
Reference in New Issue
Block a user