Latest updates from IceHrmPro
This commit is contained in:
21
web/node_modules/rc-switch/HISTORY.md
generated
vendored
Normal file
21
web/node_modules/rc-switch/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
## 1.9.0
|
||||
|
||||
- onChange and onClick support pass event as argument.
|
||||
|
||||
## 1.7.0
|
||||
|
||||
- Add `loadingIcon`.
|
||||
|
||||
## 1.6.0
|
||||
|
||||
- Add `focus()` `blur()` and `autoFocus`.
|
||||
|
||||
## 1.5.0
|
||||
|
||||
- Add `onClick` and `tabIndex`.
|
||||
- Add `es` library and module field in package.json.
|
||||
|
||||
## 1.4.0
|
||||
|
||||
- Add focus style
|
||||
- Add keyboard support
|
||||
9
web/node_modules/rc-switch/LICENSE.md
generated
vendored
Normal file
9
web/node_modules/rc-switch/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-present yiminghe
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
130
web/node_modules/rc-switch/README.md
generated
vendored
Normal file
130
web/node_modules/rc-switch/README.md
generated
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
# rc-switch
|
||||
---
|
||||
|
||||
switch ui component for react.
|
||||
|
||||
[![NPM version][npm-image]][npm-url]
|
||||
[![build status][travis-image]][travis-url]
|
||||
[![Test coverage][coveralls-image]][coveralls-url]
|
||||
[![gemnasium deps][gemnasium-image]][gemnasium-url]
|
||||
[![node version][node-image]][node-url]
|
||||
[![npm download][download-image]][download-url]
|
||||
|
||||
[npm-image]: http://img.shields.io/npm/v/rc-switch.svg?style=flat-square
|
||||
[npm-url]: http://npmjs.org/package/rc-switch
|
||||
[travis-image]: https://img.shields.io/travis/react-component/switch.svg?style=flat-square
|
||||
[travis-url]: https://travis-ci.org/react-component/switch
|
||||
[coveralls-image]: https://img.shields.io/coveralls/react-component/switch.svg?style=flat-square
|
||||
[coveralls-url]: https://coveralls.io/r/react-component/switch?branch=master
|
||||
[gemnasium-image]: http://img.shields.io/gemnasium/react-component/switch.svg?style=flat-square
|
||||
[gemnasium-url]: https://gemnasium.com/react-component/switch
|
||||
[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square
|
||||
[node-url]: http://nodejs.org/download/
|
||||
[download-image]: https://img.shields.io/npm/dm/rc-switch.svg?style=flat-square
|
||||
[download-url]: https://npmjs.org/package/rc-switch
|
||||
|
||||
## Feature
|
||||
|
||||
* support ie8,ie8+,chrome,firefox,safari
|
||||
|
||||
## install
|
||||
|
||||
[](https://npmjs.org/package/rc-switch)
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import ReactDOM from 'react-dom';
|
||||
import Switch from 'rc-switch';
|
||||
|
||||
ReactDOM.render(<Switch />, container);
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### props
|
||||
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 100px;">name</th>
|
||||
<th style="width: 50px;">type</th>
|
||||
<th style="width: 50px;">default</th>
|
||||
<th>description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>prefixCls</td>
|
||||
<td>String</td>
|
||||
<td>rc-switch</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>className</td>
|
||||
<td>String</td>
|
||||
<td>''</td>
|
||||
<td>additional class name of root node</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>checked</td>
|
||||
<td>boolean</td>
|
||||
<td>false</td>
|
||||
<td>whether switch is checked</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>defaultChecked</td>
|
||||
<td>boolean</td>
|
||||
<td>false</td>
|
||||
<td>whether switch is checked on init</td>
|
||||
<tr>
|
||||
<td>onChange</td>
|
||||
<td>Function(checked, event)</td>
|
||||
<td></td>
|
||||
<td>called when switch is checked or unchecked</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>tabIndex</td>
|
||||
<td>number</td>
|
||||
<td></td>
|
||||
<td>tab-index of switch node</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>onClick</td>
|
||||
<td>Function(checked, event)</td>
|
||||
<td></td>
|
||||
<td>called when switch is clicked</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>autoFocus</td>
|
||||
<td>boolean</td>
|
||||
<td></td>
|
||||
<td>get focus when mounts</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>disabled</td>
|
||||
<td>boolean</td>
|
||||
<td>false</td>
|
||||
<td>whether switch is disabled</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>loadingIcon</td>
|
||||
<td>React.ReactNode</td>
|
||||
<td></td>
|
||||
<td>specific the extra node. generally used in loading icon.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
## Development
|
||||
|
||||
```
|
||||
npm install
|
||||
npm start
|
||||
```
|
||||
|
||||
Online demo: http://react-component.github.io/switch/examples/
|
||||
|
||||
## License
|
||||
|
||||
rc-switch is released under the MIT license.
|
||||
141
web/node_modules/rc-switch/assets/index.css
generated
vendored
Normal file
141
web/node_modules/rc-switch/assets/index.css
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
.rc-switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
box-sizing: border-box;
|
||||
width: 44px;
|
||||
height: 22px;
|
||||
line-height: 20px;
|
||||
padding: 0;
|
||||
vertical-align: middle;
|
||||
border-radius: 20px 20px;
|
||||
border: 1px solid #ccc;
|
||||
background-color: #ccc;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s cubic-bezier(0.35, 0, 0.25, 1);
|
||||
}
|
||||
.rc-switch-inner {
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
position: absolute;
|
||||
left: 24px;
|
||||
top: 0;
|
||||
}
|
||||
.rc-switch:after {
|
||||
position: absolute;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
left: 2px;
|
||||
top: 1px;
|
||||
border-radius: 50% 50%;
|
||||
background-color: #fff;
|
||||
content: " ";
|
||||
cursor: pointer;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.26);
|
||||
-webkit-transform: scale(1);
|
||||
transform: scale(1);
|
||||
transition: left 0.3s cubic-bezier(0.35, 0, 0.25, 1);
|
||||
-webkit-animation-timing-function: cubic-bezier(0.35, 0, 0.25, 1);
|
||||
animation-timing-function: cubic-bezier(0.35, 0, 0.25, 1);
|
||||
-webkit-animation-duration: 0.3s;
|
||||
animation-duration: 0.3s;
|
||||
-webkit-animation-name: rcSwitchOff;
|
||||
animation-name: rcSwitchOff;
|
||||
}
|
||||
.rc-switch:hover:after {
|
||||
-webkit-transform: scale(1.1);
|
||||
transform: scale(1.1);
|
||||
-webkit-animation-name: rcSwitchOn;
|
||||
animation-name: rcSwitchOn;
|
||||
}
|
||||
.rc-switch:focus {
|
||||
box-shadow: 0 0 0 2px #d5f1fd;
|
||||
outline: none;
|
||||
}
|
||||
.rc-switch-checked {
|
||||
border: 1px solid #87d068;
|
||||
background-color: #87d068;
|
||||
}
|
||||
.rc-switch-checked .rc-switch-inner {
|
||||
left: 6px;
|
||||
}
|
||||
.rc-switch-checked:after {
|
||||
left: 22px;
|
||||
}
|
||||
.rc-switch-disabled {
|
||||
cursor: no-drop;
|
||||
background: #ccc;
|
||||
border-color: #ccc;
|
||||
}
|
||||
.rc-switch-disabled:after {
|
||||
background: #9e9e9e;
|
||||
-webkit-animation-name: none;
|
||||
animation-name: none;
|
||||
cursor: no-drop;
|
||||
}
|
||||
.rc-switch-disabled:hover:after {
|
||||
-webkit-transform: scale(1);
|
||||
transform: scale(1);
|
||||
-webkit-animation-name: none;
|
||||
animation-name: none;
|
||||
}
|
||||
.rc-switch-label {
|
||||
display: inline-block;
|
||||
line-height: 20px;
|
||||
font-size: 14px;
|
||||
padding-left: 10px;
|
||||
vertical-align: middle;
|
||||
white-space: normal;
|
||||
pointer-events: none;
|
||||
-webkit-user-select: text;
|
||||
-moz-user-select: text;
|
||||
-ms-user-select: text;
|
||||
user-select: text;
|
||||
}
|
||||
@-webkit-keyframes rcSwitchOn {
|
||||
0% {
|
||||
-webkit-transform: scale(1);
|
||||
transform: scale(1);
|
||||
}
|
||||
50% {
|
||||
-webkit-transform: scale(1.25);
|
||||
transform: scale(1.25);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: scale(1.1);
|
||||
transform: scale(1.1);
|
||||
}
|
||||
}
|
||||
@keyframes rcSwitchOn {
|
||||
0% {
|
||||
-webkit-transform: scale(1);
|
||||
transform: scale(1);
|
||||
}
|
||||
50% {
|
||||
-webkit-transform: scale(1.25);
|
||||
transform: scale(1.25);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: scale(1.1);
|
||||
transform: scale(1.1);
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes rcSwitchOff {
|
||||
0% {
|
||||
-webkit-transform: scale(1.1);
|
||||
transform: scale(1.1);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: scale(1);
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
@keyframes rcSwitchOff {
|
||||
0% {
|
||||
-webkit-transform: scale(1.1);
|
||||
transform: scale(1.1);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: scale(1);
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
207
web/node_modules/rc-switch/es/Switch.js
generated
vendored
Normal file
207
web/node_modules/rc-switch/es/Switch.js
generated
vendored
Normal file
@@ -0,0 +1,207 @@
|
||||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { polyfill } from 'react-lifecycles-compat';
|
||||
|
||||
var classNames = require('classnames');
|
||||
|
||||
var Switch =
|
||||
/*#__PURE__*/
|
||||
function (_Component) {
|
||||
_inherits(Switch, _Component);
|
||||
|
||||
function Switch(props) {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, Switch);
|
||||
|
||||
_this = _possibleConstructorReturn(this, _getPrototypeOf(Switch).call(this, props));
|
||||
|
||||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleClick", function (e) {
|
||||
var checked = _this.state.checked;
|
||||
var onClick = _this.props.onClick;
|
||||
var newChecked = !checked;
|
||||
|
||||
_this.setChecked(newChecked, e);
|
||||
|
||||
if (onClick) {
|
||||
onClick(newChecked, e);
|
||||
}
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleKeyDown", function (e) {
|
||||
if (e.keyCode === 37) {
|
||||
// Left
|
||||
_this.setChecked(false, e);
|
||||
} else if (e.keyCode === 39) {
|
||||
// Right
|
||||
_this.setChecked(true, e);
|
||||
}
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleMouseUp", function (e) {
|
||||
var onMouseUp = _this.props.onMouseUp;
|
||||
|
||||
if (_this.node) {
|
||||
_this.node.blur();
|
||||
}
|
||||
|
||||
if (onMouseUp) {
|
||||
onMouseUp(e);
|
||||
}
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "saveNode", function (node) {
|
||||
_this.node = node;
|
||||
});
|
||||
|
||||
var _checked = false;
|
||||
|
||||
if ('checked' in props) {
|
||||
_checked = !!props.checked;
|
||||
} else {
|
||||
_checked = !!props.defaultChecked;
|
||||
}
|
||||
|
||||
_this.state = {
|
||||
checked: _checked
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(Switch, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
var _this$props = this.props,
|
||||
autoFocus = _this$props.autoFocus,
|
||||
disabled = _this$props.disabled;
|
||||
|
||||
if (autoFocus && !disabled) {
|
||||
this.focus();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "setChecked",
|
||||
value: function setChecked(checked, e) {
|
||||
var _this$props2 = this.props,
|
||||
disabled = _this$props2.disabled,
|
||||
onChange = _this$props2.onChange;
|
||||
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!('checked' in this.props)) {
|
||||
this.setState({
|
||||
checked: checked
|
||||
});
|
||||
}
|
||||
|
||||
if (onChange) {
|
||||
onChange(checked, e);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "focus",
|
||||
value: function focus() {
|
||||
this.node.focus();
|
||||
}
|
||||
}, {
|
||||
key: "blur",
|
||||
value: function blur() {
|
||||
this.node.blur();
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _classNames;
|
||||
|
||||
var _this$props3 = this.props,
|
||||
className = _this$props3.className,
|
||||
prefixCls = _this$props3.prefixCls,
|
||||
disabled = _this$props3.disabled,
|
||||
loadingIcon = _this$props3.loadingIcon,
|
||||
checkedChildren = _this$props3.checkedChildren,
|
||||
unCheckedChildren = _this$props3.unCheckedChildren,
|
||||
restProps = _objectWithoutProperties(_this$props3, ["className", "prefixCls", "disabled", "loadingIcon", "checkedChildren", "unCheckedChildren"]);
|
||||
|
||||
var checked = this.state.checked;
|
||||
var switchClassName = classNames((_classNames = {}, _defineProperty(_classNames, className, !!className), _defineProperty(_classNames, prefixCls, true), _defineProperty(_classNames, "".concat(prefixCls, "-checked"), checked), _defineProperty(_classNames, "".concat(prefixCls, "-disabled"), disabled), _classNames));
|
||||
return React.createElement("button", _extends({}, restProps, {
|
||||
type: "button",
|
||||
role: "switch",
|
||||
"aria-checked": checked,
|
||||
disabled: disabled,
|
||||
className: switchClassName,
|
||||
ref: this.saveNode,
|
||||
onKeyDown: this.handleKeyDown,
|
||||
onClick: this.handleClick,
|
||||
onMouseUp: this.handleMouseUp
|
||||
}), loadingIcon, React.createElement("span", {
|
||||
className: "".concat(prefixCls, "-inner")
|
||||
}, checked ? checkedChildren : unCheckedChildren));
|
||||
}
|
||||
}], [{
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function getDerivedStateFromProps(nextProps) {
|
||||
var newState = {};
|
||||
var checked = nextProps.checked;
|
||||
|
||||
if ('checked' in nextProps) {
|
||||
newState.checked = !!checked;
|
||||
}
|
||||
|
||||
return newState;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Switch;
|
||||
}(Component);
|
||||
|
||||
Switch.propTypes = {
|
||||
className: PropTypes.string,
|
||||
prefixCls: PropTypes.string,
|
||||
disabled: PropTypes.bool,
|
||||
checkedChildren: PropTypes.any,
|
||||
unCheckedChildren: PropTypes.any,
|
||||
onChange: PropTypes.func,
|
||||
onMouseUp: PropTypes.func,
|
||||
onClick: PropTypes.func,
|
||||
tabIndex: PropTypes.number,
|
||||
checked: PropTypes.bool,
|
||||
defaultChecked: PropTypes.bool,
|
||||
autoFocus: PropTypes.bool,
|
||||
loadingIcon: PropTypes.node
|
||||
};
|
||||
Switch.defaultProps = {
|
||||
prefixCls: 'rc-switch',
|
||||
checkedChildren: null,
|
||||
unCheckedChildren: null,
|
||||
className: '',
|
||||
defaultChecked: false
|
||||
};
|
||||
polyfill(Switch);
|
||||
export default Switch;
|
||||
1
web/node_modules/rc-switch/es/index.js
generated
vendored
Normal file
1
web/node_modules/rc-switch/es/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./Switch');
|
||||
221
web/node_modules/rc-switch/lib/Switch.js
generated
vendored
Normal file
221
web/node_modules/rc-switch/lib/Switch.js
generated
vendored
Normal file
@@ -0,0 +1,221 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
|
||||
var _reactLifecyclesCompat = require("react-lifecycles-compat");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
|
||||
|
||||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
var classNames = require('classnames');
|
||||
|
||||
var Switch =
|
||||
/*#__PURE__*/
|
||||
function (_Component) {
|
||||
_inherits(Switch, _Component);
|
||||
|
||||
function Switch(props) {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, Switch);
|
||||
|
||||
_this = _possibleConstructorReturn(this, _getPrototypeOf(Switch).call(this, props));
|
||||
|
||||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleClick", function (e) {
|
||||
var checked = _this.state.checked;
|
||||
var onClick = _this.props.onClick;
|
||||
var newChecked = !checked;
|
||||
|
||||
_this.setChecked(newChecked, e);
|
||||
|
||||
if (onClick) {
|
||||
onClick(newChecked, e);
|
||||
}
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleKeyDown", function (e) {
|
||||
if (e.keyCode === 37) {
|
||||
// Left
|
||||
_this.setChecked(false, e);
|
||||
} else if (e.keyCode === 39) {
|
||||
// Right
|
||||
_this.setChecked(true, e);
|
||||
}
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleMouseUp", function (e) {
|
||||
var onMouseUp = _this.props.onMouseUp;
|
||||
|
||||
if (_this.node) {
|
||||
_this.node.blur();
|
||||
}
|
||||
|
||||
if (onMouseUp) {
|
||||
onMouseUp(e);
|
||||
}
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "saveNode", function (node) {
|
||||
_this.node = node;
|
||||
});
|
||||
|
||||
var _checked = false;
|
||||
|
||||
if ('checked' in props) {
|
||||
_checked = !!props.checked;
|
||||
} else {
|
||||
_checked = !!props.defaultChecked;
|
||||
}
|
||||
|
||||
_this.state = {
|
||||
checked: _checked
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(Switch, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
var _this$props = this.props,
|
||||
autoFocus = _this$props.autoFocus,
|
||||
disabled = _this$props.disabled;
|
||||
|
||||
if (autoFocus && !disabled) {
|
||||
this.focus();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "setChecked",
|
||||
value: function setChecked(checked, e) {
|
||||
var _this$props2 = this.props,
|
||||
disabled = _this$props2.disabled,
|
||||
onChange = _this$props2.onChange;
|
||||
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!('checked' in this.props)) {
|
||||
this.setState({
|
||||
checked: checked
|
||||
});
|
||||
}
|
||||
|
||||
if (onChange) {
|
||||
onChange(checked, e);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "focus",
|
||||
value: function focus() {
|
||||
this.node.focus();
|
||||
}
|
||||
}, {
|
||||
key: "blur",
|
||||
value: function blur() {
|
||||
this.node.blur();
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _classNames;
|
||||
|
||||
var _this$props3 = this.props,
|
||||
className = _this$props3.className,
|
||||
prefixCls = _this$props3.prefixCls,
|
||||
disabled = _this$props3.disabled,
|
||||
loadingIcon = _this$props3.loadingIcon,
|
||||
checkedChildren = _this$props3.checkedChildren,
|
||||
unCheckedChildren = _this$props3.unCheckedChildren,
|
||||
restProps = _objectWithoutProperties(_this$props3, ["className", "prefixCls", "disabled", "loadingIcon", "checkedChildren", "unCheckedChildren"]);
|
||||
|
||||
var checked = this.state.checked;
|
||||
var switchClassName = classNames((_classNames = {}, _defineProperty(_classNames, className, !!className), _defineProperty(_classNames, prefixCls, true), _defineProperty(_classNames, "".concat(prefixCls, "-checked"), checked), _defineProperty(_classNames, "".concat(prefixCls, "-disabled"), disabled), _classNames));
|
||||
return _react["default"].createElement("button", _extends({}, restProps, {
|
||||
type: "button",
|
||||
role: "switch",
|
||||
"aria-checked": checked,
|
||||
disabled: disabled,
|
||||
className: switchClassName,
|
||||
ref: this.saveNode,
|
||||
onKeyDown: this.handleKeyDown,
|
||||
onClick: this.handleClick,
|
||||
onMouseUp: this.handleMouseUp
|
||||
}), loadingIcon, _react["default"].createElement("span", {
|
||||
className: "".concat(prefixCls, "-inner")
|
||||
}, checked ? checkedChildren : unCheckedChildren));
|
||||
}
|
||||
}], [{
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function getDerivedStateFromProps(nextProps) {
|
||||
var newState = {};
|
||||
var checked = nextProps.checked;
|
||||
|
||||
if ('checked' in nextProps) {
|
||||
newState.checked = !!checked;
|
||||
}
|
||||
|
||||
return newState;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Switch;
|
||||
}(_react.Component);
|
||||
|
||||
Switch.propTypes = {
|
||||
className: _propTypes["default"].string,
|
||||
prefixCls: _propTypes["default"].string,
|
||||
disabled: _propTypes["default"].bool,
|
||||
checkedChildren: _propTypes["default"].any,
|
||||
unCheckedChildren: _propTypes["default"].any,
|
||||
onChange: _propTypes["default"].func,
|
||||
onMouseUp: _propTypes["default"].func,
|
||||
onClick: _propTypes["default"].func,
|
||||
tabIndex: _propTypes["default"].number,
|
||||
checked: _propTypes["default"].bool,
|
||||
defaultChecked: _propTypes["default"].bool,
|
||||
autoFocus: _propTypes["default"].bool,
|
||||
loadingIcon: _propTypes["default"].node
|
||||
};
|
||||
Switch.defaultProps = {
|
||||
prefixCls: 'rc-switch',
|
||||
checkedChildren: null,
|
||||
unCheckedChildren: null,
|
||||
className: '',
|
||||
defaultChecked: false
|
||||
};
|
||||
(0, _reactLifecyclesCompat.polyfill)(Switch);
|
||||
var _default = Switch;
|
||||
exports["default"] = _default;
|
||||
3
web/node_modules/rc-switch/lib/index.js
generated
vendored
Normal file
3
web/node_modules/rc-switch/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require('./Switch');
|
||||
98
web/node_modules/rc-switch/package.json
generated
vendored
Normal file
98
web/node_modules/rc-switch/package.json
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
{
|
||||
"_from": "rc-switch@~1.9.0",
|
||||
"_id": "rc-switch@1.9.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-Isas+egaK6qSk64jaEw4GgPStY4umYDbT7ZY93bZF1Af+b/JEsKsJdNOU2qG3WI0Z6tXo2DDq0kJCv8Yhu0zww==",
|
||||
"_location": "/rc-switch",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "rc-switch@~1.9.0",
|
||||
"name": "rc-switch",
|
||||
"escapedName": "rc-switch",
|
||||
"rawSpec": "~1.9.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~1.9.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/antd"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/rc-switch/-/rc-switch-1.9.0.tgz",
|
||||
"_shasum": "ab2b878f2713c681358a453391976c9b95b290f7",
|
||||
"_spec": "rc-switch@~1.9.0",
|
||||
"_where": "/Users/thilina/TestProjects/icehrm-pro/web/node_modules/antd",
|
||||
"bugs": {
|
||||
"url": "http://github.com/react-component/switch/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"config": {
|
||||
"port": 8001
|
||||
},
|
||||
"dependencies": {
|
||||
"classnames": "^2.2.1",
|
||||
"prop-types": "^15.5.6",
|
||||
"react-lifecycles-compat": "^3.0.4"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "switch ui component for react",
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.11.15",
|
||||
"enzyme": "^3.0.0",
|
||||
"enzyme-adapter-react-16": "^1.0.1",
|
||||
"enzyme-to-json": "^3.0.0",
|
||||
"lint-staged": "^8.1.0",
|
||||
"pre-commit": "1.x",
|
||||
"rc-tools": "^9.3.4",
|
||||
"react": "^16.0.0",
|
||||
"react-dom": "^16.0.0",
|
||||
"react-test-renderer": "^16.0.0"
|
||||
},
|
||||
"files": [
|
||||
"assets/*.css",
|
||||
"es",
|
||||
"lib"
|
||||
],
|
||||
"homepage": "http://github.com/react-component/switch",
|
||||
"keywords": [
|
||||
"react",
|
||||
"react-component",
|
||||
"react-switch",
|
||||
"switch"
|
||||
],
|
||||
"license": "MIT",
|
||||
"lint-staged": {
|
||||
"*.{js,jsx,ts,tsx}": [
|
||||
"npm run pre-commit",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"main": "lib/index",
|
||||
"module": "./es/index",
|
||||
"name": "rc-switch",
|
||||
"peerDependencies": {
|
||||
"react": "^16.0.0",
|
||||
"react-dom": "^16.0.0"
|
||||
},
|
||||
"pre-commit": [
|
||||
"lint-staged"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/react-component/switch.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rc-tools run build",
|
||||
"compile": "rc-tools run compile --babel-runtime",
|
||||
"coverage": "rc-tools run test --coverage",
|
||||
"gh-pages": "rc-tools run gh-pages",
|
||||
"lint": "rc-tools run lint",
|
||||
"lint-staged": "lint-staged",
|
||||
"pre-commit": "rc-tools run pre-commit",
|
||||
"prepublish": "rc-tools run guard",
|
||||
"pub": "rc-tools run pub --babel-runtime",
|
||||
"start": "rc-tools run server",
|
||||
"test": "rc-tools run test"
|
||||
},
|
||||
"version": "1.9.0"
|
||||
}
|
||||
Reference in New Issue
Block a user