mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 05:32:18 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
15
web/node_modules/react-input-autosize/.babelrc
generated
vendored
Normal file
15
web/node_modules/react-input-autosize/.babelrc
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"presets": [
|
||||
["env"],
|
||||
"stage-2",
|
||||
"react"
|
||||
],
|
||||
"env": {
|
||||
"production": {
|
||||
"ignore": ["node-modules/**", "src/__tests__/**"]
|
||||
},
|
||||
"test": {
|
||||
"ignore": ["node-modules/**"]
|
||||
}
|
||||
}
|
||||
}
|
15
web/node_modules/react-input-autosize/.editorconfig
generated
vendored
Normal file
15
web/node_modules/react-input-autosize/.editorconfig
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
# This file is for unifying the coding style for different editors and IDEs
|
||||
# editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = false
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
4
web/node_modules/react-input-autosize/.eslintignore
generated
vendored
Normal file
4
web/node_modules/react-input-autosize/.eslintignore
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
lib/*
|
||||
dist/*
|
||||
examples/dist/*
|
||||
node_modules/*
|
4
web/node_modules/react-input-autosize/.eslintrc.js
generated
vendored
Normal file
4
web/node_modules/react-input-autosize/.eslintrc.js
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
extends: 'keystone-react',
|
||||
parser: 'babel-eslint',
|
||||
};
|
63
web/node_modules/react-input-autosize/HISTORY.md
generated
vendored
Normal file
63
web/node_modules/react-input-autosize/HISTORY.md
generated
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
# react-input-autosize
|
||||
|
||||
## v3.0.0 / 2020-12-11
|
||||
|
||||
This release adds support for React 17 and removes usage of UNSAFE React lifecycle methods, thanks to [Nathan Bierema](https://github.com/Methuselah96).
|
||||
|
||||
It should be a fairly painless major upgrade since the API hasn't been changed at all. It's being published as `3.0.0` because the peer dependency range has been updated and the internal implementation has changed.
|
||||
|
||||
## v2.2.2 / 2019-01-10
|
||||
|
||||
* added UNSAFE prefix to out of date react lifecycle hooks. thanks [RanneyD](https://github.com/ranneyd)
|
||||
|
||||
## v2.2.1 / 2018-01-10
|
||||
|
||||
* fixed; invalid logic in SSR support check, thanks [Rakha Kanz Kautsar](https://github.com/rkkautsar)
|
||||
|
||||
## v2.2.0 / 2018-01-09
|
||||
|
||||
* added; `extraWidth` prop allows you to customise how much width is added to the detected width
|
||||
* fixed; SSR support is more robust, thanks [Ivo Bathke](https://github.com/ivoba)
|
||||
|
||||
## v2.1.2 / 2017-11-27
|
||||
|
||||
* fixed; `window` reference is now guarded for SSR support, thanks [Wout Mertens](https://github.com/wmertens)
|
||||
|
||||
## v2.1.1 / 2017-11-26
|
||||
|
||||
* fixed; `props.id` was overriding the internal `inputId` on the input element, but not being used in the stylesheet
|
||||
* fixed; IE stylesheet is now only injected when IE is detected in navigator.userAgent
|
||||
|
||||
## v2.1.0 / 2017-11-23
|
||||
|
||||
* fixed; inputId wasn't being applied correctly, thanks [Jacco Flenter](https://github.com/flenter)
|
||||
* added; new `injectStyles` prop controls whether the IE stylesheet it injected
|
||||
* improved; allow override of `boxSizing` and `width` styles via `inputStyles`, thanks [Mike Fanger](https://github.com/mvf4z7)
|
||||
* improved; propTypes are now stripped from the production build, thanks [jochenberger](https://github.com/jochenberger)
|
||||
|
||||
## v2.0.1 / 2017-09-13
|
||||
|
||||
* fixed; peer dependencies for `prop-types`
|
||||
|
||||
## v2.0.0 / 2017-09-12
|
||||
|
||||
* fixed; converted to es6 Class and removed `create-react-class`
|
||||
* changed; default export is now an es6 module
|
||||
|
||||
### Note:
|
||||
|
||||
As of 2.0.0 this package exports an es6 module in the main entry
|
||||
(`/lib/AutoSizeInput.js`). If you are in an older environment, you'll need to
|
||||
refer to the `.default` export:
|
||||
|
||||
```js
|
||||
var AutoSizeInput = require('react-input-autosize').default;
|
||||
```
|
||||
|
||||
Aside from this, the new version doesn't change any public API.
|
||||
|
||||
## v1.2.0 / 2017-09-12
|
||||
|
||||
* added; `inputRef` prop (function, passed the reference to the input node)
|
||||
* fixed; resize issues in IE11, thanks [Constantine](https://github.com/costagolub)
|
||||
* fixed; `copyInputStyles()` never running, thanks [Michael Elsdörfer](https://github.com/miracle2k)
|
21
web/node_modules/react-input-autosize/LICENSE
generated
vendored
Normal file
21
web/node_modules/react-input-autosize/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Jed Watson
|
||||
|
||||
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.
|
84
web/node_modules/react-input-autosize/README.md
generated
vendored
Normal file
84
web/node_modules/react-input-autosize/README.md
generated
vendored
Normal file
|
@ -0,0 +1,84 @@
|
|||
React-Input-Autosize
|
||||
====================
|
||||
|
||||
A text input for [React](http://facebook.github.io/react/index.html) that resizes itself to the current content.
|
||||
|
||||
|
||||
## Demo & Examples
|
||||
|
||||
Live demo: [jedwatson.github.io/react-input-autosize](http://jedwatson.github.io/react-input-autosize/)
|
||||
|
||||
To run the examples locally, run:
|
||||
|
||||
```
|
||||
npm install
|
||||
npm start
|
||||
```
|
||||
|
||||
Then open [localhost:8000](http://localhost:8000) in a browser.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
The easiest way to use React-Input-Autosize is to install it from NPM and include it in your own React build process (using Browserify, rollup, webpack, etc).
|
||||
|
||||
You can also use the umd build by including `dist/AutosizeInput.js` in your page. If you use this, make sure you have already included a umd React build.
|
||||
|
||||
```
|
||||
npm install react-input-autosize --save
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
React-Input-Autosize generates an input field, wrapped in a `<div>` tag so it can detect the size of its value. Otherwise it behaves very similarly to a standard React input.
|
||||
|
||||
|
||||
```es6
|
||||
import AutosizeInput from 'react-input-autosize';
|
||||
|
||||
<AutosizeInput
|
||||
name="form-field-name"
|
||||
value={inputValue}
|
||||
onChange={function(event) {
|
||||
// event.target.value contains the new value
|
||||
}}
|
||||
/>
|
||||
```
|
||||
|
||||
## Gotchas
|
||||
|
||||
### Changing the styles at runtime
|
||||
The styles applied to the input are only copied when the component mounts. Because of this, subsequent changes to the stylesheet may cause size to be detected incorrectly.
|
||||
|
||||
To work around this, either re-mount the input (e.g. by providing a different `key` prop) or call the `copyInputStyles()` method after the styles change.
|
||||
|
||||
### CSP and the IE "clear" indicator
|
||||
The input will automatically inject a stylesheet that hides IE/Edge's "clear" indicator, which otherwise breaks the UI. This has the downside of being incompatible with some CSP policies.
|
||||
|
||||
To work around this, you can pass the `injectStyles={false}` prop, but if you do this I *strongly* recommend targeting the `input` element in your own stylesheet with the following rule:
|
||||
|
||||
```css
|
||||
input::-ms-clear {display: none;}
|
||||
```
|
||||
|
||||
### Custom font sizes
|
||||
If your input uses custom font sizes, you will need to provide the custom size to `AutosizeInput`.
|
||||
|
||||
```es6
|
||||
<AutosizeInput
|
||||
name="form-field-name"
|
||||
value={inputValue}
|
||||
inputStyle={{ fontSize: 36 }}
|
||||
onChange={function(event) {
|
||||
// event.target.value contains the new value
|
||||
}}
|
||||
/>
|
||||
```
|
||||
|
||||
### Uncontrolled input
|
||||
`AutosizeInput` is a [controlled input](https://facebook.github.io/react/docs/forms.html#controlled-components) and depends on the `value` prop to work as intended. It does not support being used as an uncontrolled input.
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2018 Jed Watson. [MIT](LICENSE) License.
|
449
web/node_modules/react-input-autosize/dist/react-input-autosize.es.js
generated
vendored
Normal file
449
web/node_modules/react-input-autosize/dist/react-input-autosize.es.js
generated
vendored
Normal file
|
@ -0,0 +1,449 @@
|
|||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
var asyncGenerator = function () {
|
||||
function AwaitValue(value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
function AsyncGenerator(gen) {
|
||||
var front, back;
|
||||
|
||||
function send(key, arg) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var request = {
|
||||
key: key,
|
||||
arg: arg,
|
||||
resolve: resolve,
|
||||
reject: reject,
|
||||
next: null
|
||||
};
|
||||
|
||||
if (back) {
|
||||
back = back.next = request;
|
||||
} else {
|
||||
front = back = request;
|
||||
resume(key, arg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function resume(key, arg) {
|
||||
try {
|
||||
var result = gen[key](arg);
|
||||
var value = result.value;
|
||||
|
||||
if (value instanceof AwaitValue) {
|
||||
Promise.resolve(value.value).then(function (arg) {
|
||||
resume("next", arg);
|
||||
}, function (arg) {
|
||||
resume("throw", arg);
|
||||
});
|
||||
} else {
|
||||
settle(result.done ? "return" : "normal", result.value);
|
||||
}
|
||||
} catch (err) {
|
||||
settle("throw", err);
|
||||
}
|
||||
}
|
||||
|
||||
function settle(type, value) {
|
||||
switch (type) {
|
||||
case "return":
|
||||
front.resolve({
|
||||
value: value,
|
||||
done: true
|
||||
});
|
||||
break;
|
||||
|
||||
case "throw":
|
||||
front.reject(value);
|
||||
break;
|
||||
|
||||
default:
|
||||
front.resolve({
|
||||
value: value,
|
||||
done: false
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
front = front.next;
|
||||
|
||||
if (front) {
|
||||
resume(front.key, front.arg);
|
||||
} else {
|
||||
back = null;
|
||||
}
|
||||
}
|
||||
|
||||
this._invoke = send;
|
||||
|
||||
if (typeof gen.return !== "function") {
|
||||
this.return = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof Symbol === "function" && Symbol.asyncIterator) {
|
||||
AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
|
||||
return this;
|
||||
};
|
||||
}
|
||||
|
||||
AsyncGenerator.prototype.next = function (arg) {
|
||||
return this._invoke("next", arg);
|
||||
};
|
||||
|
||||
AsyncGenerator.prototype.throw = function (arg) {
|
||||
return this._invoke("throw", arg);
|
||||
};
|
||||
|
||||
AsyncGenerator.prototype.return = function (arg) {
|
||||
return this._invoke("return", arg);
|
||||
};
|
||||
|
||||
return {
|
||||
wrap: function (fn) {
|
||||
return function () {
|
||||
return new AsyncGenerator(fn.apply(this, arguments));
|
||||
};
|
||||
},
|
||||
await: function (value) {
|
||||
return new AwaitValue(value);
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var classCallCheck = function (instance, Constructor) {
|
||||
if (!(instance instanceof Constructor)) {
|
||||
throw new TypeError("Cannot call a class as a function");
|
||||
}
|
||||
};
|
||||
|
||||
var createClass = 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);
|
||||
}
|
||||
}
|
||||
|
||||
return function (Constructor, protoProps, staticProps) {
|
||||
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
};
|
||||
}();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var _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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
var inherits = function (subClass, superClass) {
|
||||
if (typeof superClass !== "function" && superClass !== null) {
|
||||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
||||
}
|
||||
|
||||
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
||||
constructor: {
|
||||
value: subClass,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var objectWithoutProperties = function (obj, keys) {
|
||||
var target = {};
|
||||
|
||||
for (var i in obj) {
|
||||
if (keys.indexOf(i) >= 0) continue;
|
||||
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
|
||||
target[i] = obj[i];
|
||||
}
|
||||
|
||||
return target;
|
||||
};
|
||||
|
||||
var possibleConstructorReturn = function (self, call) {
|
||||
if (!self) {
|
||||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
}
|
||||
|
||||
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
||||
};
|
||||
|
||||
var sizerStyle = {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
visibility: 'hidden',
|
||||
height: 0,
|
||||
overflow: 'scroll',
|
||||
whiteSpace: 'pre'
|
||||
};
|
||||
|
||||
var INPUT_PROPS_BLACKLIST = ['extraWidth', 'injectStyles', 'inputClassName', 'inputRef', 'inputStyle', 'minWidth', 'onAutosize', 'placeholderIsMinWidth'];
|
||||
|
||||
var cleanInputProps = function cleanInputProps(inputProps) {
|
||||
INPUT_PROPS_BLACKLIST.forEach(function (field) {
|
||||
return delete inputProps[field];
|
||||
});
|
||||
return inputProps;
|
||||
};
|
||||
|
||||
var copyStyles = function copyStyles(styles, node) {
|
||||
node.style.fontSize = styles.fontSize;
|
||||
node.style.fontFamily = styles.fontFamily;
|
||||
node.style.fontWeight = styles.fontWeight;
|
||||
node.style.fontStyle = styles.fontStyle;
|
||||
node.style.letterSpacing = styles.letterSpacing;
|
||||
node.style.textTransform = styles.textTransform;
|
||||
};
|
||||
|
||||
var isIE = typeof window !== 'undefined' && window.navigator ? /MSIE |Trident\/|Edge\//.test(window.navigator.userAgent) : false;
|
||||
|
||||
var generateId = function generateId() {
|
||||
// we only need an auto-generated ID for stylesheet injection, which is only
|
||||
// used for IE. so if the browser is not IE, this should return undefined.
|
||||
return isIE ? '_' + Math.random().toString(36).substr(2, 12) : undefined;
|
||||
};
|
||||
|
||||
var AutosizeInput = function (_Component) {
|
||||
inherits(AutosizeInput, _Component);
|
||||
createClass(AutosizeInput, null, [{
|
||||
key: 'getDerivedStateFromProps',
|
||||
value: function getDerivedStateFromProps(props, state) {
|
||||
var id = props.id;
|
||||
|
||||
return id !== state.prevId ? { inputId: id || generateId(), prevId: id } : null;
|
||||
}
|
||||
}]);
|
||||
|
||||
function AutosizeInput(props) {
|
||||
classCallCheck(this, AutosizeInput);
|
||||
|
||||
var _this = possibleConstructorReturn(this, (AutosizeInput.__proto__ || Object.getPrototypeOf(AutosizeInput)).call(this, props));
|
||||
|
||||
_this.inputRef = function (el) {
|
||||
_this.input = el;
|
||||
if (typeof _this.props.inputRef === 'function') {
|
||||
_this.props.inputRef(el);
|
||||
}
|
||||
};
|
||||
|
||||
_this.placeHolderSizerRef = function (el) {
|
||||
_this.placeHolderSizer = el;
|
||||
};
|
||||
|
||||
_this.sizerRef = function (el) {
|
||||
_this.sizer = el;
|
||||
};
|
||||
|
||||
_this.state = {
|
||||
inputWidth: props.minWidth,
|
||||
inputId: props.id || generateId(),
|
||||
prevId: props.id
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
|
||||
createClass(AutosizeInput, [{
|
||||
key: 'componentDidMount',
|
||||
value: function componentDidMount() {
|
||||
this.mounted = true;
|
||||
this.copyInputStyles();
|
||||
this.updateInputWidth();
|
||||
}
|
||||
}, {
|
||||
key: 'componentDidUpdate',
|
||||
value: function componentDidUpdate(prevProps, prevState) {
|
||||
if (prevState.inputWidth !== this.state.inputWidth) {
|
||||
if (typeof this.props.onAutosize === 'function') {
|
||||
this.props.onAutosize(this.state.inputWidth);
|
||||
}
|
||||
}
|
||||
this.updateInputWidth();
|
||||
}
|
||||
}, {
|
||||
key: 'componentWillUnmount',
|
||||
value: function componentWillUnmount() {
|
||||
this.mounted = false;
|
||||
}
|
||||
}, {
|
||||
key: 'copyInputStyles',
|
||||
value: function copyInputStyles() {
|
||||
if (!this.mounted || !window.getComputedStyle) {
|
||||
return;
|
||||
}
|
||||
var inputStyles = this.input && window.getComputedStyle(this.input);
|
||||
if (!inputStyles) {
|
||||
return;
|
||||
}
|
||||
copyStyles(inputStyles, this.sizer);
|
||||
if (this.placeHolderSizer) {
|
||||
copyStyles(inputStyles, this.placeHolderSizer);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'updateInputWidth',
|
||||
value: function updateInputWidth() {
|
||||
if (!this.mounted || !this.sizer || typeof this.sizer.scrollWidth === 'undefined') {
|
||||
return;
|
||||
}
|
||||
var newInputWidth = void 0;
|
||||
if (this.props.placeholder && (!this.props.value || this.props.value && this.props.placeholderIsMinWidth)) {
|
||||
newInputWidth = Math.max(this.sizer.scrollWidth, this.placeHolderSizer.scrollWidth) + 2;
|
||||
} else {
|
||||
newInputWidth = this.sizer.scrollWidth + 2;
|
||||
}
|
||||
// add extraWidth to the detected width. for number types, this defaults to 16 to allow for the stepper UI
|
||||
var extraWidth = this.props.type === 'number' && this.props.extraWidth === undefined ? 16 : parseInt(this.props.extraWidth) || 0;
|
||||
newInputWidth += extraWidth;
|
||||
if (newInputWidth < this.props.minWidth) {
|
||||
newInputWidth = this.props.minWidth;
|
||||
}
|
||||
if (newInputWidth !== this.state.inputWidth) {
|
||||
this.setState({
|
||||
inputWidth: newInputWidth
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'getInput',
|
||||
value: function getInput() {
|
||||
return this.input;
|
||||
}
|
||||
}, {
|
||||
key: 'focus',
|
||||
value: function focus() {
|
||||
this.input.focus();
|
||||
}
|
||||
}, {
|
||||
key: 'blur',
|
||||
value: function blur() {
|
||||
this.input.blur();
|
||||
}
|
||||
}, {
|
||||
key: 'select',
|
||||
value: function select() {
|
||||
this.input.select();
|
||||
}
|
||||
}, {
|
||||
key: 'renderStyles',
|
||||
value: function renderStyles() {
|
||||
// this method injects styles to hide IE's clear indicator, which messes
|
||||
// with input size detection. the stylesheet is only injected when the
|
||||
// browser is IE, and can also be disabled by the `injectStyles` prop.
|
||||
var injectStyles = this.props.injectStyles;
|
||||
|
||||
return isIE && injectStyles ? React.createElement('style', { dangerouslySetInnerHTML: {
|
||||
__html: 'input#' + this.state.inputId + '::-ms-clear {display: none;}'
|
||||
} }) : null;
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var sizerValue = [this.props.defaultValue, this.props.value, ''].reduce(function (previousValue, currentValue) {
|
||||
if (previousValue !== null && previousValue !== undefined) {
|
||||
return previousValue;
|
||||
}
|
||||
return currentValue;
|
||||
});
|
||||
|
||||
var wrapperStyle = _extends({}, this.props.style);
|
||||
if (!wrapperStyle.display) wrapperStyle.display = 'inline-block';
|
||||
|
||||
var inputStyle = _extends({
|
||||
boxSizing: 'content-box',
|
||||
width: this.state.inputWidth + 'px'
|
||||
}, this.props.inputStyle);
|
||||
|
||||
var inputProps = objectWithoutProperties(this.props, []);
|
||||
|
||||
cleanInputProps(inputProps);
|
||||
inputProps.className = this.props.inputClassName;
|
||||
inputProps.id = this.state.inputId;
|
||||
inputProps.style = inputStyle;
|
||||
|
||||
return React.createElement(
|
||||
'div',
|
||||
{ className: this.props.className, style: wrapperStyle },
|
||||
this.renderStyles(),
|
||||
React.createElement('input', _extends({}, inputProps, { ref: this.inputRef })),
|
||||
React.createElement(
|
||||
'div',
|
||||
{ ref: this.sizerRef, style: sizerStyle },
|
||||
sizerValue
|
||||
),
|
||||
this.props.placeholder ? React.createElement(
|
||||
'div',
|
||||
{ ref: this.placeHolderSizerRef, style: sizerStyle },
|
||||
this.props.placeholder
|
||||
) : null
|
||||
);
|
||||
}
|
||||
}]);
|
||||
return AutosizeInput;
|
||||
}(Component);
|
||||
|
||||
AutosizeInput.propTypes = {
|
||||
className: PropTypes.string, // className for the outer element
|
||||
defaultValue: PropTypes.any, // default field value
|
||||
extraWidth: PropTypes.oneOfType([// additional width for input element
|
||||
PropTypes.number, PropTypes.string]),
|
||||
id: PropTypes.string, // id to use for the input, can be set for consistent snapshots
|
||||
injectStyles: PropTypes.bool, // inject the custom stylesheet to hide clear UI, defaults to true
|
||||
inputClassName: PropTypes.string, // className for the input element
|
||||
inputRef: PropTypes.func, // ref callback for the input element
|
||||
inputStyle: PropTypes.object, // css styles for the input element
|
||||
minWidth: PropTypes.oneOfType([// minimum width for input element
|
||||
PropTypes.number, PropTypes.string]),
|
||||
onAutosize: PropTypes.func, // onAutosize handler: function(newWidth) {}
|
||||
onChange: PropTypes.func, // onChange handler: function(event) {}
|
||||
placeholder: PropTypes.string, // placeholder text
|
||||
placeholderIsMinWidth: PropTypes.bool, // don't collapse size to less than the placeholder
|
||||
style: PropTypes.object, // css styles for the outer element
|
||||
value: PropTypes.any // field value
|
||||
};
|
||||
AutosizeInput.defaultProps = {
|
||||
minWidth: 1,
|
||||
injectStyles: true
|
||||
};
|
||||
|
||||
export default AutosizeInput;
|
457
web/node_modules/react-input-autosize/dist/react-input-autosize.js
generated
vendored
Normal file
457
web/node_modules/react-input-autosize/dist/react-input-autosize.js
generated
vendored
Normal file
|
@ -0,0 +1,457 @@
|
|||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('prop-types')) :
|
||||
typeof define === 'function' && define.amd ? define(['react', 'prop-types'], factory) :
|
||||
(global.AutosizeInput = factory(global.React,global.PropTypes));
|
||||
}(this, (function (React,PropTypes) { 'use strict';
|
||||
|
||||
var React__default = 'default' in React ? React['default'] : React;
|
||||
PropTypes = PropTypes && PropTypes.hasOwnProperty('default') ? PropTypes['default'] : PropTypes;
|
||||
|
||||
var asyncGenerator = function () {
|
||||
function AwaitValue(value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
function AsyncGenerator(gen) {
|
||||
var front, back;
|
||||
|
||||
function send(key, arg) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var request = {
|
||||
key: key,
|
||||
arg: arg,
|
||||
resolve: resolve,
|
||||
reject: reject,
|
||||
next: null
|
||||
};
|
||||
|
||||
if (back) {
|
||||
back = back.next = request;
|
||||
} else {
|
||||
front = back = request;
|
||||
resume(key, arg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function resume(key, arg) {
|
||||
try {
|
||||
var result = gen[key](arg);
|
||||
var value = result.value;
|
||||
|
||||
if (value instanceof AwaitValue) {
|
||||
Promise.resolve(value.value).then(function (arg) {
|
||||
resume("next", arg);
|
||||
}, function (arg) {
|
||||
resume("throw", arg);
|
||||
});
|
||||
} else {
|
||||
settle(result.done ? "return" : "normal", result.value);
|
||||
}
|
||||
} catch (err) {
|
||||
settle("throw", err);
|
||||
}
|
||||
}
|
||||
|
||||
function settle(type, value) {
|
||||
switch (type) {
|
||||
case "return":
|
||||
front.resolve({
|
||||
value: value,
|
||||
done: true
|
||||
});
|
||||
break;
|
||||
|
||||
case "throw":
|
||||
front.reject(value);
|
||||
break;
|
||||
|
||||
default:
|
||||
front.resolve({
|
||||
value: value,
|
||||
done: false
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
front = front.next;
|
||||
|
||||
if (front) {
|
||||
resume(front.key, front.arg);
|
||||
} else {
|
||||
back = null;
|
||||
}
|
||||
}
|
||||
|
||||
this._invoke = send;
|
||||
|
||||
if (typeof gen.return !== "function") {
|
||||
this.return = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof Symbol === "function" && Symbol.asyncIterator) {
|
||||
AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
|
||||
return this;
|
||||
};
|
||||
}
|
||||
|
||||
AsyncGenerator.prototype.next = function (arg) {
|
||||
return this._invoke("next", arg);
|
||||
};
|
||||
|
||||
AsyncGenerator.prototype.throw = function (arg) {
|
||||
return this._invoke("throw", arg);
|
||||
};
|
||||
|
||||
AsyncGenerator.prototype.return = function (arg) {
|
||||
return this._invoke("return", arg);
|
||||
};
|
||||
|
||||
return {
|
||||
wrap: function (fn) {
|
||||
return function () {
|
||||
return new AsyncGenerator(fn.apply(this, arguments));
|
||||
};
|
||||
},
|
||||
await: function (value) {
|
||||
return new AwaitValue(value);
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var classCallCheck = function (instance, Constructor) {
|
||||
if (!(instance instanceof Constructor)) {
|
||||
throw new TypeError("Cannot call a class as a function");
|
||||
}
|
||||
};
|
||||
|
||||
var createClass = 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);
|
||||
}
|
||||
}
|
||||
|
||||
return function (Constructor, protoProps, staticProps) {
|
||||
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
};
|
||||
}();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var _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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
var inherits = function (subClass, superClass) {
|
||||
if (typeof superClass !== "function" && superClass !== null) {
|
||||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
||||
}
|
||||
|
||||
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
||||
constructor: {
|
||||
value: subClass,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var objectWithoutProperties = function (obj, keys) {
|
||||
var target = {};
|
||||
|
||||
for (var i in obj) {
|
||||
if (keys.indexOf(i) >= 0) continue;
|
||||
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
|
||||
target[i] = obj[i];
|
||||
}
|
||||
|
||||
return target;
|
||||
};
|
||||
|
||||
var possibleConstructorReturn = function (self, call) {
|
||||
if (!self) {
|
||||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
}
|
||||
|
||||
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
||||
};
|
||||
|
||||
var sizerStyle = {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
visibility: 'hidden',
|
||||
height: 0,
|
||||
overflow: 'scroll',
|
||||
whiteSpace: 'pre'
|
||||
};
|
||||
|
||||
var INPUT_PROPS_BLACKLIST = ['extraWidth', 'injectStyles', 'inputClassName', 'inputRef', 'inputStyle', 'minWidth', 'onAutosize', 'placeholderIsMinWidth'];
|
||||
|
||||
var cleanInputProps = function cleanInputProps(inputProps) {
|
||||
INPUT_PROPS_BLACKLIST.forEach(function (field) {
|
||||
return delete inputProps[field];
|
||||
});
|
||||
return inputProps;
|
||||
};
|
||||
|
||||
var copyStyles = function copyStyles(styles, node) {
|
||||
node.style.fontSize = styles.fontSize;
|
||||
node.style.fontFamily = styles.fontFamily;
|
||||
node.style.fontWeight = styles.fontWeight;
|
||||
node.style.fontStyle = styles.fontStyle;
|
||||
node.style.letterSpacing = styles.letterSpacing;
|
||||
node.style.textTransform = styles.textTransform;
|
||||
};
|
||||
|
||||
var isIE = typeof window !== 'undefined' && window.navigator ? /MSIE |Trident\/|Edge\//.test(window.navigator.userAgent) : false;
|
||||
|
||||
var generateId = function generateId() {
|
||||
// we only need an auto-generated ID for stylesheet injection, which is only
|
||||
// used for IE. so if the browser is not IE, this should return undefined.
|
||||
return isIE ? '_' + Math.random().toString(36).substr(2, 12) : undefined;
|
||||
};
|
||||
|
||||
var AutosizeInput = function (_Component) {
|
||||
inherits(AutosizeInput, _Component);
|
||||
createClass(AutosizeInput, null, [{
|
||||
key: 'getDerivedStateFromProps',
|
||||
value: function getDerivedStateFromProps(props, state) {
|
||||
var id = props.id;
|
||||
|
||||
return id !== state.prevId ? { inputId: id || generateId(), prevId: id } : null;
|
||||
}
|
||||
}]);
|
||||
|
||||
function AutosizeInput(props) {
|
||||
classCallCheck(this, AutosizeInput);
|
||||
|
||||
var _this = possibleConstructorReturn(this, (AutosizeInput.__proto__ || Object.getPrototypeOf(AutosizeInput)).call(this, props));
|
||||
|
||||
_this.inputRef = function (el) {
|
||||
_this.input = el;
|
||||
if (typeof _this.props.inputRef === 'function') {
|
||||
_this.props.inputRef(el);
|
||||
}
|
||||
};
|
||||
|
||||
_this.placeHolderSizerRef = function (el) {
|
||||
_this.placeHolderSizer = el;
|
||||
};
|
||||
|
||||
_this.sizerRef = function (el) {
|
||||
_this.sizer = el;
|
||||
};
|
||||
|
||||
_this.state = {
|
||||
inputWidth: props.minWidth,
|
||||
inputId: props.id || generateId(),
|
||||
prevId: props.id
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
|
||||
createClass(AutosizeInput, [{
|
||||
key: 'componentDidMount',
|
||||
value: function componentDidMount() {
|
||||
this.mounted = true;
|
||||
this.copyInputStyles();
|
||||
this.updateInputWidth();
|
||||
}
|
||||
}, {
|
||||
key: 'componentDidUpdate',
|
||||
value: function componentDidUpdate(prevProps, prevState) {
|
||||
if (prevState.inputWidth !== this.state.inputWidth) {
|
||||
if (typeof this.props.onAutosize === 'function') {
|
||||
this.props.onAutosize(this.state.inputWidth);
|
||||
}
|
||||
}
|
||||
this.updateInputWidth();
|
||||
}
|
||||
}, {
|
||||
key: 'componentWillUnmount',
|
||||
value: function componentWillUnmount() {
|
||||
this.mounted = false;
|
||||
}
|
||||
}, {
|
||||
key: 'copyInputStyles',
|
||||
value: function copyInputStyles() {
|
||||
if (!this.mounted || !window.getComputedStyle) {
|
||||
return;
|
||||
}
|
||||
var inputStyles = this.input && window.getComputedStyle(this.input);
|
||||
if (!inputStyles) {
|
||||
return;
|
||||
}
|
||||
copyStyles(inputStyles, this.sizer);
|
||||
if (this.placeHolderSizer) {
|
||||
copyStyles(inputStyles, this.placeHolderSizer);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'updateInputWidth',
|
||||
value: function updateInputWidth() {
|
||||
if (!this.mounted || !this.sizer || typeof this.sizer.scrollWidth === 'undefined') {
|
||||
return;
|
||||
}
|
||||
var newInputWidth = void 0;
|
||||
if (this.props.placeholder && (!this.props.value || this.props.value && this.props.placeholderIsMinWidth)) {
|
||||
newInputWidth = Math.max(this.sizer.scrollWidth, this.placeHolderSizer.scrollWidth) + 2;
|
||||
} else {
|
||||
newInputWidth = this.sizer.scrollWidth + 2;
|
||||
}
|
||||
// add extraWidth to the detected width. for number types, this defaults to 16 to allow for the stepper UI
|
||||
var extraWidth = this.props.type === 'number' && this.props.extraWidth === undefined ? 16 : parseInt(this.props.extraWidth) || 0;
|
||||
newInputWidth += extraWidth;
|
||||
if (newInputWidth < this.props.minWidth) {
|
||||
newInputWidth = this.props.minWidth;
|
||||
}
|
||||
if (newInputWidth !== this.state.inputWidth) {
|
||||
this.setState({
|
||||
inputWidth: newInputWidth
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'getInput',
|
||||
value: function getInput() {
|
||||
return this.input;
|
||||
}
|
||||
}, {
|
||||
key: 'focus',
|
||||
value: function focus() {
|
||||
this.input.focus();
|
||||
}
|
||||
}, {
|
||||
key: 'blur',
|
||||
value: function blur() {
|
||||
this.input.blur();
|
||||
}
|
||||
}, {
|
||||
key: 'select',
|
||||
value: function select() {
|
||||
this.input.select();
|
||||
}
|
||||
}, {
|
||||
key: 'renderStyles',
|
||||
value: function renderStyles() {
|
||||
// this method injects styles to hide IE's clear indicator, which messes
|
||||
// with input size detection. the stylesheet is only injected when the
|
||||
// browser is IE, and can also be disabled by the `injectStyles` prop.
|
||||
var injectStyles = this.props.injectStyles;
|
||||
|
||||
return isIE && injectStyles ? React__default.createElement('style', { dangerouslySetInnerHTML: {
|
||||
__html: 'input#' + this.state.inputId + '::-ms-clear {display: none;}'
|
||||
} }) : null;
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var sizerValue = [this.props.defaultValue, this.props.value, ''].reduce(function (previousValue, currentValue) {
|
||||
if (previousValue !== null && previousValue !== undefined) {
|
||||
return previousValue;
|
||||
}
|
||||
return currentValue;
|
||||
});
|
||||
|
||||
var wrapperStyle = _extends({}, this.props.style);
|
||||
if (!wrapperStyle.display) wrapperStyle.display = 'inline-block';
|
||||
|
||||
var inputStyle = _extends({
|
||||
boxSizing: 'content-box',
|
||||
width: this.state.inputWidth + 'px'
|
||||
}, this.props.inputStyle);
|
||||
|
||||
var inputProps = objectWithoutProperties(this.props, []);
|
||||
|
||||
cleanInputProps(inputProps);
|
||||
inputProps.className = this.props.inputClassName;
|
||||
inputProps.id = this.state.inputId;
|
||||
inputProps.style = inputStyle;
|
||||
|
||||
return React__default.createElement(
|
||||
'div',
|
||||
{ className: this.props.className, style: wrapperStyle },
|
||||
this.renderStyles(),
|
||||
React__default.createElement('input', _extends({}, inputProps, { ref: this.inputRef })),
|
||||
React__default.createElement(
|
||||
'div',
|
||||
{ ref: this.sizerRef, style: sizerStyle },
|
||||
sizerValue
|
||||
),
|
||||
this.props.placeholder ? React__default.createElement(
|
||||
'div',
|
||||
{ ref: this.placeHolderSizerRef, style: sizerStyle },
|
||||
this.props.placeholder
|
||||
) : null
|
||||
);
|
||||
}
|
||||
}]);
|
||||
return AutosizeInput;
|
||||
}(React.Component);
|
||||
|
||||
AutosizeInput.propTypes = {
|
||||
className: PropTypes.string, // className for the outer element
|
||||
defaultValue: PropTypes.any, // default field value
|
||||
extraWidth: PropTypes.oneOfType([// additional width for input element
|
||||
PropTypes.number, PropTypes.string]),
|
||||
id: PropTypes.string, // id to use for the input, can be set for consistent snapshots
|
||||
injectStyles: PropTypes.bool, // inject the custom stylesheet to hide clear UI, defaults to true
|
||||
inputClassName: PropTypes.string, // className for the input element
|
||||
inputRef: PropTypes.func, // ref callback for the input element
|
||||
inputStyle: PropTypes.object, // css styles for the input element
|
||||
minWidth: PropTypes.oneOfType([// minimum width for input element
|
||||
PropTypes.number, PropTypes.string]),
|
||||
onAutosize: PropTypes.func, // onAutosize handler: function(newWidth) {}
|
||||
onChange: PropTypes.func, // onChange handler: function(event) {}
|
||||
placeholder: PropTypes.string, // placeholder text
|
||||
placeholderIsMinWidth: PropTypes.bool, // don't collapse size to less than the placeholder
|
||||
style: PropTypes.object, // css styles for the outer element
|
||||
value: PropTypes.any // field value
|
||||
};
|
||||
AutosizeInput.defaultProps = {
|
||||
minWidth: 1,
|
||||
injectStyles: true
|
||||
};
|
||||
|
||||
return AutosizeInput;
|
||||
|
||||
})));
|
1
web/node_modules/react-input-autosize/dist/react-input-autosize.min.js
generated
vendored
Normal file
1
web/node_modules/react-input-autosize/dist/react-input-autosize.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
30
web/node_modules/react-input-autosize/examples/dist/app.js
generated
vendored
Normal file
30
web/node_modules/react-input-autosize/examples/dist/app.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
web/node_modules/react-input-autosize/examples/dist/common.js
generated
vendored
Normal file
1
web/node_modules/react-input-autosize/examples/dist/common.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
!function(r){function n(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,n),t.l=!0,t.exports}var e=window.webpackJsonp;window.webpackJsonp=function(o,u,c){for(var f,i,p,a=0,l=[];a<o.length;a++)i=o[a],t[i]&&l.push(t[i][0]),t[i]=0;for(f in u)Object.prototype.hasOwnProperty.call(u,f)&&(r[f]=u[f]);for(e&&e(o,u,c);l.length;)l.shift()();if(c)for(a=0;a<c.length;a++)p=n(n.s=c[a]);return p};var o={},t={1:0};n.m=r,n.c=o,n.d=function(r,e,o){n.o(r,e)||Object.defineProperty(r,e,{configurable:!1,enumerable:!0,get:o})},n.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(e,"a",e),e},n.o=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)},n.p="/",n.oe=function(r){throw console.error(r),r}}([]);
|
1
web/node_modules/react-input-autosize/examples/dist/example.css
generated
vendored
Normal file
1
web/node_modules/react-input-autosize/examples/dist/example.css
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
body{font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:14px;color:#333;margin:0;padding:0}a{color:#08c;text-decoration:none}a:hover{text-decoration:underline}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{margin:0;appearance:none}.container{margin-left:auto;margin-right:auto;max-width:400px;padding:1em}.footer{margin-top:50px;border-top:1px solid #eee;padding:20px 0;font-size:12px;color:#999}h1,h2,h3,h4,h5,h6{color:#222;font-weight:100;margin:.5em 0}label{color:#999;display:inline-block;font-size:.85em;font-weight:700;margin:1em 0;text-transform:uppercase}.hint{margin:15px 0;font-style:italic;color:#999}
|
1
web/node_modules/react-input-autosize/examples/dist/index.html
generated
vendored
Normal file
1
web/node_modules/react-input-autosize/examples/dist/index.html
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
<!doctype html> <head> <title>React-Autosize-Input Example</title> <link rel=stylesheet href=example.css> </head> <body> <div class=container> <h1>React Autosize Input</h1> <h2><a href=http://github.com/JedWatson/react-input-autosize>View project on GitHub</a></h2> <form><div id=app></div></form> <div class=hint> Type in the text fields above to test the auto-size input. </div> <div class=footer> Copyright © Jed Watson 2018. MIT Licensed. </div> </div> <script src=common.js></script> <script src=app.js></script> </body>
|
42
web/node_modules/react-input-autosize/examples/dist/standalone.html
generated
vendored
Normal file
42
web/node_modules/react-input-autosize/examples/dist/standalone.html
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
<!doctype html>
|
||||
<head>
|
||||
<title>react-autosize-input umd example</title>
|
||||
<link rel="stylesheet" href="example.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>React Autosize Input</h1>
|
||||
<h2>Standalone example</h2>
|
||||
<!-- the React application is loaded in the #example element -->
|
||||
<div id="example"></div>
|
||||
<div class="hint">
|
||||
The component above is provided by the umd build, and React is loaded from <a href="https://unpkg.com/">unpkg</a>.
|
||||
</div>
|
||||
<div class="footer">
|
||||
Copyright © Jed Watson 2018. MIT Licensed.
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://unpkg.com/babel-standalone@6/babel.min.js" charset="utf-8"></script>
|
||||
<script src="https://unpkg.com/react@15.6.1/dist/react.js"></script>
|
||||
<script src="https://unpkg.com/react-dom@15.6.1/dist/react-dom.js"></script>
|
||||
<script src="https://unpkg.com/prop-types@15.5.10/prop-types.js"></script>
|
||||
<script src="../../dist/react-input-autosize.js"></script>
|
||||
<script type="text/babel">
|
||||
var Example = React.createClass({
|
||||
getInitialState: function() {
|
||||
return {
|
||||
inputValue: ''
|
||||
};
|
||||
},
|
||||
updateValue: function(event) {
|
||||
this.setState({
|
||||
inputValue: event.target.value
|
||||
});
|
||||
},
|
||||
render: function() {
|
||||
return <AutosizeInput autoFocus value={this.state.inputValue} onChange={this.updateValue} />
|
||||
}
|
||||
});
|
||||
ReactDOM.render(<Example />, document.getElementById('example'));
|
||||
</script>
|
||||
</body>
|
69
web/node_modules/react-input-autosize/examples/src/app.js
generated
vendored
Normal file
69
web/node_modules/react-input-autosize/examples/src/app.js
generated
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
/* eslint-disable react/jsx-no-bind */
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import AutosizeInput from 'react-input-autosize';
|
||||
|
||||
import './example.less';
|
||||
|
||||
class App extends Component {
|
||||
constructor (props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
value1: '',
|
||||
value2: 'example',
|
||||
value3: 3,
|
||||
value4: '',
|
||||
value5: '',
|
||||
};
|
||||
}
|
||||
updateInputValue = (input, event) => {
|
||||
const newState = {};
|
||||
newState[input] = event.target.value;
|
||||
this.setState(newState);
|
||||
};
|
||||
render () {
|
||||
return (
|
||||
<div>
|
||||
<h3>Simple example:</h3>
|
||||
<AutosizeInput
|
||||
autoFocus
|
||||
value={this.state.value1}
|
||||
onChange={this.updateInputValue.bind(this, 'value1')}
|
||||
/>
|
||||
<h3>Styled example with default value:</h3>
|
||||
<AutosizeInput
|
||||
value={this.state.value2}
|
||||
onChange={this.updateInputValue.bind(this, 'value2')}
|
||||
style={{ background: '#eee', borderRadius: 5, padding: 5 }}
|
||||
inputStyle={{ border: '1px solid #999', borderRadius: 3, padding: 3, fontSize: 14 }}
|
||||
/>
|
||||
<h3>Typed example with default value:</h3>
|
||||
<AutosizeInput
|
||||
value={this.state.value3}
|
||||
type="number"
|
||||
onChange={this.updateInputValue.bind(this, 'value3')}
|
||||
/>
|
||||
<h3>Input with placeholder:</h3>
|
||||
<AutosizeInput
|
||||
placeholder="Placeholder"
|
||||
value={this.state.value4}
|
||||
onChange={this.updateInputValue.bind(this, 'value4')}
|
||||
style={{ background: '#eee', borderRadius: 5, padding: 5 }}
|
||||
inputStyle={{ border: '1px solid #999', borderRadius: 3, padding: 3, fontSize: 14 }}
|
||||
/>
|
||||
<h3>Input with placeholder as minimum width:</h3>
|
||||
<AutosizeInput
|
||||
placeholder="Placeholder"
|
||||
placeholderIsMinWidth
|
||||
value={this.state.value5}
|
||||
onChange={this.updateInputValue.bind(this, 'value5')}
|
||||
style={{ background: '#eee', borderRadius: 5, padding: 5 }}
|
||||
inputStyle={{ border: '1px solid #999', borderRadius: 3, padding: 3, fontSize: 14 }}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById('app'));
|
63
web/node_modules/react-input-autosize/examples/src/example.less
generated
vendored
Normal file
63
web/node_modules/react-input-autosize/examples/src/example.less
generated
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
// Examples Stylesheet
|
||||
// -------------------
|
||||
*/
|
||||
|
||||
body {
|
||||
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #08c;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
input[type="number"]::-webkit-inner-spin-button,
|
||||
input[type="number"]::-webkit-outer-spin-button {
|
||||
margin: 0;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
.container {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
max-width: 400px;
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
.footer {
|
||||
margin-top: 50px;
|
||||
border-top: 1px solid #eee;
|
||||
padding: 20px 0;
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
color: #222;
|
||||
font-weight: 100;
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
|
||||
label {
|
||||
color: #999;
|
||||
display: inline-block;
|
||||
font-size: 0.85em;
|
||||
font-weight: bold;
|
||||
margin: 1em 0;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.hint {
|
||||
margin: 15px 0;
|
||||
font-style: italic;
|
||||
color: #999;
|
||||
}
|
20
web/node_modules/react-input-autosize/examples/src/index.html
generated
vendored
Normal file
20
web/node_modules/react-input-autosize/examples/src/index.html
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
<!doctype html>
|
||||
<head>
|
||||
<title>React-Autosize-Input Example</title>
|
||||
<link rel="stylesheet" href="example.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>React Autosize Input</h1>
|
||||
<h2><a href="http://github.com/JedWatson/react-input-autosize">View project on GitHub</a></h2>
|
||||
<form><div id="app"></div></form>
|
||||
<div class="hint">
|
||||
Type in the text fields above to test the auto-size input.
|
||||
</div>
|
||||
<div class="footer">
|
||||
Copyright © Jed Watson 2018. MIT Licensed.
|
||||
</div>
|
||||
</div>
|
||||
<script src="common.js"></script>
|
||||
<script src="app.js"></script>
|
||||
</body>
|
42
web/node_modules/react-input-autosize/examples/src/standalone.html
generated
vendored
Normal file
42
web/node_modules/react-input-autosize/examples/src/standalone.html
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
<!doctype html>
|
||||
<head>
|
||||
<title>react-autosize-input umd example</title>
|
||||
<link rel="stylesheet" href="example.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>React Autosize Input</h1>
|
||||
<h2>Standalone example</h2>
|
||||
<!-- the React application is loaded in the #example element -->
|
||||
<div id="example"></div>
|
||||
<div class="hint">
|
||||
The component above is provided by the umd build, and React is loaded from <a href="https://unpkg.com/">unpkg</a>.
|
||||
</div>
|
||||
<div class="footer">
|
||||
Copyright © Jed Watson 2018. MIT Licensed.
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://unpkg.com/babel-standalone@6/babel.min.js" charset="utf-8"></script>
|
||||
<script src="https://unpkg.com/react@15.6.1/dist/react.js"></script>
|
||||
<script src="https://unpkg.com/react-dom@15.6.1/dist/react-dom.js"></script>
|
||||
<script src="https://unpkg.com/prop-types@15.5.10/prop-types.js"></script>
|
||||
<script src="../../dist/react-input-autosize.js"></script>
|
||||
<script type="text/babel">
|
||||
var Example = React.createClass({
|
||||
getInitialState: function() {
|
||||
return {
|
||||
inputValue: ''
|
||||
};
|
||||
},
|
||||
updateValue: function(event) {
|
||||
this.setState({
|
||||
inputValue: event.target.value
|
||||
});
|
||||
},
|
||||
render: function() {
|
||||
return <AutosizeInput autoFocus value={this.state.inputValue} onChange={this.updateValue} />
|
||||
}
|
||||
});
|
||||
ReactDOM.render(<Example />, document.getElementById('example'));
|
||||
</script>
|
||||
</body>
|
269
web/node_modules/react-input-autosize/lib/AutosizeInput.js
generated
vendored
Normal file
269
web/node_modules/react-input-autosize/lib/AutosizeInput.js
generated
vendored
Normal file
|
@ -0,0 +1,269 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _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; };
|
||||
|
||||
var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _propTypes = require('prop-types');
|
||||
|
||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var sizerStyle = {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
visibility: 'hidden',
|
||||
height: 0,
|
||||
overflow: 'scroll',
|
||||
whiteSpace: 'pre'
|
||||
};
|
||||
|
||||
var INPUT_PROPS_BLACKLIST = ['extraWidth', 'injectStyles', 'inputClassName', 'inputRef', 'inputStyle', 'minWidth', 'onAutosize', 'placeholderIsMinWidth'];
|
||||
|
||||
var cleanInputProps = function cleanInputProps(inputProps) {
|
||||
INPUT_PROPS_BLACKLIST.forEach(function (field) {
|
||||
return delete inputProps[field];
|
||||
});
|
||||
return inputProps;
|
||||
};
|
||||
|
||||
var copyStyles = function copyStyles(styles, node) {
|
||||
node.style.fontSize = styles.fontSize;
|
||||
node.style.fontFamily = styles.fontFamily;
|
||||
node.style.fontWeight = styles.fontWeight;
|
||||
node.style.fontStyle = styles.fontStyle;
|
||||
node.style.letterSpacing = styles.letterSpacing;
|
||||
node.style.textTransform = styles.textTransform;
|
||||
};
|
||||
|
||||
var isIE = typeof window !== 'undefined' && window.navigator ? /MSIE |Trident\/|Edge\//.test(window.navigator.userAgent) : false;
|
||||
|
||||
var generateId = function generateId() {
|
||||
// we only need an auto-generated ID for stylesheet injection, which is only
|
||||
// used for IE. so if the browser is not IE, this should return undefined.
|
||||
return isIE ? '_' + Math.random().toString(36).substr(2, 12) : undefined;
|
||||
};
|
||||
|
||||
var AutosizeInput = function (_Component) {
|
||||
_inherits(AutosizeInput, _Component);
|
||||
|
||||
_createClass(AutosizeInput, null, [{
|
||||
key: 'getDerivedStateFromProps',
|
||||
value: function getDerivedStateFromProps(props, state) {
|
||||
var id = props.id;
|
||||
|
||||
return id !== state.prevId ? { inputId: id || generateId(), prevId: id } : null;
|
||||
}
|
||||
}]);
|
||||
|
||||
function AutosizeInput(props) {
|
||||
_classCallCheck(this, AutosizeInput);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (AutosizeInput.__proto__ || Object.getPrototypeOf(AutosizeInput)).call(this, props));
|
||||
|
||||
_this.inputRef = function (el) {
|
||||
_this.input = el;
|
||||
if (typeof _this.props.inputRef === 'function') {
|
||||
_this.props.inputRef(el);
|
||||
}
|
||||
};
|
||||
|
||||
_this.placeHolderSizerRef = function (el) {
|
||||
_this.placeHolderSizer = el;
|
||||
};
|
||||
|
||||
_this.sizerRef = function (el) {
|
||||
_this.sizer = el;
|
||||
};
|
||||
|
||||
_this.state = {
|
||||
inputWidth: props.minWidth,
|
||||
inputId: props.id || generateId(),
|
||||
prevId: props.id
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(AutosizeInput, [{
|
||||
key: 'componentDidMount',
|
||||
value: function componentDidMount() {
|
||||
this.mounted = true;
|
||||
this.copyInputStyles();
|
||||
this.updateInputWidth();
|
||||
}
|
||||
}, {
|
||||
key: 'componentDidUpdate',
|
||||
value: function componentDidUpdate(prevProps, prevState) {
|
||||
if (prevState.inputWidth !== this.state.inputWidth) {
|
||||
if (typeof this.props.onAutosize === 'function') {
|
||||
this.props.onAutosize(this.state.inputWidth);
|
||||
}
|
||||
}
|
||||
this.updateInputWidth();
|
||||
}
|
||||
}, {
|
||||
key: 'componentWillUnmount',
|
||||
value: function componentWillUnmount() {
|
||||
this.mounted = false;
|
||||
}
|
||||
}, {
|
||||
key: 'copyInputStyles',
|
||||
value: function copyInputStyles() {
|
||||
if (!this.mounted || !window.getComputedStyle) {
|
||||
return;
|
||||
}
|
||||
var inputStyles = this.input && window.getComputedStyle(this.input);
|
||||
if (!inputStyles) {
|
||||
return;
|
||||
}
|
||||
copyStyles(inputStyles, this.sizer);
|
||||
if (this.placeHolderSizer) {
|
||||
copyStyles(inputStyles, this.placeHolderSizer);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'updateInputWidth',
|
||||
value: function updateInputWidth() {
|
||||
if (!this.mounted || !this.sizer || typeof this.sizer.scrollWidth === 'undefined') {
|
||||
return;
|
||||
}
|
||||
var newInputWidth = void 0;
|
||||
if (this.props.placeholder && (!this.props.value || this.props.value && this.props.placeholderIsMinWidth)) {
|
||||
newInputWidth = Math.max(this.sizer.scrollWidth, this.placeHolderSizer.scrollWidth) + 2;
|
||||
} else {
|
||||
newInputWidth = this.sizer.scrollWidth + 2;
|
||||
}
|
||||
// add extraWidth to the detected width. for number types, this defaults to 16 to allow for the stepper UI
|
||||
var extraWidth = this.props.type === 'number' && this.props.extraWidth === undefined ? 16 : parseInt(this.props.extraWidth) || 0;
|
||||
newInputWidth += extraWidth;
|
||||
if (newInputWidth < this.props.minWidth) {
|
||||
newInputWidth = this.props.minWidth;
|
||||
}
|
||||
if (newInputWidth !== this.state.inputWidth) {
|
||||
this.setState({
|
||||
inputWidth: newInputWidth
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'getInput',
|
||||
value: function getInput() {
|
||||
return this.input;
|
||||
}
|
||||
}, {
|
||||
key: 'focus',
|
||||
value: function focus() {
|
||||
this.input.focus();
|
||||
}
|
||||
}, {
|
||||
key: 'blur',
|
||||
value: function blur() {
|
||||
this.input.blur();
|
||||
}
|
||||
}, {
|
||||
key: 'select',
|
||||
value: function select() {
|
||||
this.input.select();
|
||||
}
|
||||
}, {
|
||||
key: 'renderStyles',
|
||||
value: function renderStyles() {
|
||||
// this method injects styles to hide IE's clear indicator, which messes
|
||||
// with input size detection. the stylesheet is only injected when the
|
||||
// browser is IE, and can also be disabled by the `injectStyles` prop.
|
||||
var injectStyles = this.props.injectStyles;
|
||||
|
||||
return isIE && injectStyles ? _react2.default.createElement('style', { dangerouslySetInnerHTML: {
|
||||
__html: 'input#' + this.state.inputId + '::-ms-clear {display: none;}'
|
||||
} }) : null;
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var sizerValue = [this.props.defaultValue, this.props.value, ''].reduce(function (previousValue, currentValue) {
|
||||
if (previousValue !== null && previousValue !== undefined) {
|
||||
return previousValue;
|
||||
}
|
||||
return currentValue;
|
||||
});
|
||||
|
||||
var wrapperStyle = _extends({}, this.props.style);
|
||||
if (!wrapperStyle.display) wrapperStyle.display = 'inline-block';
|
||||
|
||||
var inputStyle = _extends({
|
||||
boxSizing: 'content-box',
|
||||
width: this.state.inputWidth + 'px'
|
||||
}, this.props.inputStyle);
|
||||
|
||||
var inputProps = _objectWithoutProperties(this.props, []);
|
||||
|
||||
cleanInputProps(inputProps);
|
||||
inputProps.className = this.props.inputClassName;
|
||||
inputProps.id = this.state.inputId;
|
||||
inputProps.style = inputStyle;
|
||||
|
||||
return _react2.default.createElement(
|
||||
'div',
|
||||
{ className: this.props.className, style: wrapperStyle },
|
||||
this.renderStyles(),
|
||||
_react2.default.createElement('input', _extends({}, inputProps, { ref: this.inputRef })),
|
||||
_react2.default.createElement(
|
||||
'div',
|
||||
{ ref: this.sizerRef, style: sizerStyle },
|
||||
sizerValue
|
||||
),
|
||||
this.props.placeholder ? _react2.default.createElement(
|
||||
'div',
|
||||
{ ref: this.placeHolderSizerRef, style: sizerStyle },
|
||||
this.props.placeholder
|
||||
) : null
|
||||
);
|
||||
}
|
||||
}]);
|
||||
|
||||
return AutosizeInput;
|
||||
}(_react.Component);
|
||||
|
||||
AutosizeInput.propTypes = {
|
||||
className: _propTypes2.default.string, // className for the outer element
|
||||
defaultValue: _propTypes2.default.any, // default field value
|
||||
extraWidth: _propTypes2.default.oneOfType([// additional width for input element
|
||||
_propTypes2.default.number, _propTypes2.default.string]),
|
||||
id: _propTypes2.default.string, // id to use for the input, can be set for consistent snapshots
|
||||
injectStyles: _propTypes2.default.bool, // inject the custom stylesheet to hide clear UI, defaults to true
|
||||
inputClassName: _propTypes2.default.string, // className for the input element
|
||||
inputRef: _propTypes2.default.func, // ref callback for the input element
|
||||
inputStyle: _propTypes2.default.object, // css styles for the input element
|
||||
minWidth: _propTypes2.default.oneOfType([// minimum width for input element
|
||||
_propTypes2.default.number, _propTypes2.default.string]),
|
||||
onAutosize: _propTypes2.default.func, // onAutosize handler: function(newWidth) {}
|
||||
onChange: _propTypes2.default.func, // onChange handler: function(event) {}
|
||||
placeholder: _propTypes2.default.string, // placeholder text
|
||||
placeholderIsMinWidth: _propTypes2.default.bool, // don't collapse size to less than the placeholder
|
||||
style: _propTypes2.default.object, // css styles for the outer element
|
||||
value: _propTypes2.default.any // field value
|
||||
};
|
||||
AutosizeInput.defaultProps = {
|
||||
minWidth: 1,
|
||||
injectStyles: true
|
||||
};
|
||||
|
||||
exports.default = AutosizeInput;
|
32
web/node_modules/react-input-autosize/package-scripts.js
generated
vendored
Normal file
32
web/node_modules/react-input-autosize/package-scripts.js
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
const npsUtils = require('nps-utils');
|
||||
const series = npsUtils.series;
|
||||
const rimraf = npsUtils.rimraf;
|
||||
const concurrent = npsUtils.concurrent;
|
||||
|
||||
module.exports = {
|
||||
scripts: {
|
||||
build: {
|
||||
description: 'clean dist directory and run all builds',
|
||||
default: series(
|
||||
rimraf('dist'),
|
||||
rimraf('lib'),
|
||||
concurrent.nps('build.rollup', 'build.babel')
|
||||
),
|
||||
rollup: 'rollup --config',
|
||||
babel: 'babel src -d lib',
|
||||
},
|
||||
examples: {
|
||||
default: series(
|
||||
rimraf('examples/dist'),
|
||||
'mkdir examples/dist',
|
||||
concurrent.nps('examples.webpack', 'examples.standalone'),
|
||||
'cp examples/src/.gitignore examples/dist/.gitignore'
|
||||
),
|
||||
webpack: 'webpack --progress -p',
|
||||
standalone: series(
|
||||
'cp examples/src/standalone.html examples/dist/standalone.html',
|
||||
'lessc examples/src/example.less examples/dist/example.css'
|
||||
),
|
||||
},
|
||||
},
|
||||
};
|
80
web/node_modules/react-input-autosize/package.json
generated
vendored
Normal file
80
web/node_modules/react-input-autosize/package.json
generated
vendored
Normal file
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
"name": "react-input-autosize",
|
||||
"version": "3.0.0",
|
||||
"description": "Auto-resizing Input Component for React",
|
||||
"main": "lib/AutosizeInput.js",
|
||||
"js:next": "dist/react-input-autosize.es.js",
|
||||
"author": "Jed Watson",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/JedWatson/react-input-autosize.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"prop-types": "^15.5.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-eslint": "^7.2.3",
|
||||
"babel-jest": "^6.0.1",
|
||||
"babel-loader": "^7.1.1",
|
||||
"babel-plugin-external-helpers": "^6.22.0",
|
||||
"babel-plugin-transform-react-remove-prop-types": "^0.4.8",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"babel-preset-react": "^6.24.1",
|
||||
"babel-preset-stage-2": "^6.24.1",
|
||||
"css-loader": "^0.28.7",
|
||||
"eslint": "^3.19.0",
|
||||
"eslint-config-keystone": "^3.0.0",
|
||||
"eslint-config-keystone-react": "^1.0.0",
|
||||
"eslint-plugin-react": "^6.10.3",
|
||||
"extract-text-webpack-plugin": "^3.0.0",
|
||||
"gh-pages": "^1.1.0",
|
||||
"html-loader": "^0.5.1",
|
||||
"html-webpack-plugin": "^2.30.1",
|
||||
"jest-cli": "^21.0.2",
|
||||
"less": "^2.3.1",
|
||||
"less-loader": "^4.0.5",
|
||||
"nps": "^5.7.1",
|
||||
"nps-utils": "^1.3.0",
|
||||
"react": "^17.0.1",
|
||||
"react-dom": "^17.0.1",
|
||||
"rollup": "^0.49.2",
|
||||
"rollup-plugin-babel": "^3.0.2",
|
||||
"rollup-plugin-commonjs": "^8.2.0",
|
||||
"rollup-plugin-node-resolve": "^3.0.0",
|
||||
"rollup-plugin-uglify": "^2.0.1",
|
||||
"style-loader": "^0.18.2",
|
||||
"uglify-es": "^3.0.28",
|
||||
"webpack": "^3.5.5",
|
||||
"webpack-dev-server": "^2.7.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.3.0 || ^17.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "NODE_ENV=production nps build",
|
||||
"build-examples": "nps examples",
|
||||
"deploy": "nps examples && gh-pages -d examples/dist",
|
||||
"lint": "eslint ./; true",
|
||||
"start": "webpack-dev-server --progress",
|
||||
"test": "jest; true"
|
||||
},
|
||||
"jest": {
|
||||
"unmockedModulePathPatterns": [
|
||||
"<rootDir>/node_modules/react",
|
||||
"<rootDir>/node_modules/fbjs",
|
||||
"<rootDir>/node_modules/react-dom"
|
||||
],
|
||||
"roots": [
|
||||
"<rootDir>/src"
|
||||
]
|
||||
},
|
||||
"keywords": [
|
||||
"react",
|
||||
"react-component",
|
||||
"input",
|
||||
"autosize"
|
||||
]
|
||||
}
|
59
web/node_modules/react-input-autosize/rollup.config.js
generated
vendored
Normal file
59
web/node_modules/react-input-autosize/rollup.config.js
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
import babel from 'rollup-plugin-babel';
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
import uglify from 'rollup-plugin-uglify';
|
||||
import { minify } from 'uglify-es';
|
||||
|
||||
const name = 'AutosizeInput';
|
||||
const path = 'dist/react-input-autosize';
|
||||
const globals = {
|
||||
'prop-types': 'PropTypes',
|
||||
'react-dom': 'ReactDOM',
|
||||
'react': 'React',
|
||||
};
|
||||
|
||||
const external = Object.keys(globals);
|
||||
const babelOptions = production => {
|
||||
let result = {
|
||||
babelrc: false,
|
||||
presets: [['env', { modules: false }], 'stage-2', 'react'],
|
||||
plugins: ['external-helpers'],
|
||||
};
|
||||
if (production) {
|
||||
result.plugins.push('transform-react-remove-prop-types');
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
export default [
|
||||
{
|
||||
input: 'src/AutosizeInput.js',
|
||||
output: {
|
||||
file: path + '.es.js',
|
||||
format: 'es',
|
||||
},
|
||||
external: external,
|
||||
plugins: [babel(babelOptions(false))],
|
||||
},
|
||||
{
|
||||
input: 'src/AutosizeInput.js',
|
||||
output: {
|
||||
name: name,
|
||||
file: path + '.js',
|
||||
format: 'umd',
|
||||
},
|
||||
globals: globals,
|
||||
external: external,
|
||||
plugins: [babel(babelOptions(false)), resolve()],
|
||||
},
|
||||
{
|
||||
input: 'src/AutosizeInput.js',
|
||||
output: {
|
||||
name: name,
|
||||
file: path + '.min.js',
|
||||
format: 'umd',
|
||||
},
|
||||
globals: globals,
|
||||
external: external,
|
||||
plugins: [babel(babelOptions(true)), resolve(), uglify({}, minify)],
|
||||
},
|
||||
];
|
212
web/node_modules/react-input-autosize/src/AutosizeInput.js
generated
vendored
Normal file
212
web/node_modules/react-input-autosize/src/AutosizeInput.js
generated
vendored
Normal file
|
@ -0,0 +1,212 @@
|
|||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
const sizerStyle = {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
visibility: 'hidden',
|
||||
height: 0,
|
||||
overflow: 'scroll',
|
||||
whiteSpace: 'pre',
|
||||
};
|
||||
|
||||
const INPUT_PROPS_BLACKLIST = [
|
||||
'extraWidth',
|
||||
'injectStyles',
|
||||
'inputClassName',
|
||||
'inputRef',
|
||||
'inputStyle',
|
||||
'minWidth',
|
||||
'onAutosize',
|
||||
'placeholderIsMinWidth',
|
||||
];
|
||||
|
||||
const cleanInputProps = (inputProps) => {
|
||||
INPUT_PROPS_BLACKLIST.forEach(field => delete inputProps[field]);
|
||||
return inputProps;
|
||||
};
|
||||
|
||||
const copyStyles = (styles, node) => {
|
||||
node.style.fontSize = styles.fontSize;
|
||||
node.style.fontFamily = styles.fontFamily;
|
||||
node.style.fontWeight = styles.fontWeight;
|
||||
node.style.fontStyle = styles.fontStyle;
|
||||
node.style.letterSpacing = styles.letterSpacing;
|
||||
node.style.textTransform = styles.textTransform;
|
||||
};
|
||||
|
||||
const isIE = (typeof window !== 'undefined' && window.navigator) ? /MSIE |Trident\/|Edge\//.test(window.navigator.userAgent) : false;
|
||||
|
||||
const generateId = () => {
|
||||
// we only need an auto-generated ID for stylesheet injection, which is only
|
||||
// used for IE. so if the browser is not IE, this should return undefined.
|
||||
return isIE ? '_' + Math.random().toString(36).substr(2, 12) : undefined;
|
||||
};
|
||||
|
||||
class AutosizeInput extends Component {
|
||||
static getDerivedStateFromProps (props, state) {
|
||||
const { id } = props;
|
||||
return id !== state.prevId ? { inputId: id || generateId(), prevId: id } : null;
|
||||
}
|
||||
constructor (props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
inputWidth: props.minWidth,
|
||||
inputId: props.id || generateId(),
|
||||
prevId: props.id,
|
||||
};
|
||||
}
|
||||
componentDidMount () {
|
||||
this.mounted = true;
|
||||
this.copyInputStyles();
|
||||
this.updateInputWidth();
|
||||
}
|
||||
componentDidUpdate (prevProps, prevState) {
|
||||
if (prevState.inputWidth !== this.state.inputWidth) {
|
||||
if (typeof this.props.onAutosize === 'function') {
|
||||
this.props.onAutosize(this.state.inputWidth);
|
||||
}
|
||||
}
|
||||
this.updateInputWidth();
|
||||
}
|
||||
componentWillUnmount () {
|
||||
this.mounted = false;
|
||||
}
|
||||
inputRef = (el) => {
|
||||
this.input = el;
|
||||
if (typeof this.props.inputRef === 'function') {
|
||||
this.props.inputRef(el);
|
||||
}
|
||||
};
|
||||
placeHolderSizerRef = (el) => {
|
||||
this.placeHolderSizer = el;
|
||||
};
|
||||
sizerRef = (el) => {
|
||||
this.sizer = el;
|
||||
};
|
||||
copyInputStyles () {
|
||||
if (!this.mounted || !window.getComputedStyle) {
|
||||
return;
|
||||
}
|
||||
const inputStyles = this.input && window.getComputedStyle(this.input);
|
||||
if (!inputStyles) {
|
||||
return;
|
||||
}
|
||||
copyStyles(inputStyles, this.sizer);
|
||||
if (this.placeHolderSizer) {
|
||||
copyStyles(inputStyles, this.placeHolderSizer);
|
||||
}
|
||||
}
|
||||
updateInputWidth () {
|
||||
if (!this.mounted || !this.sizer || typeof this.sizer.scrollWidth === 'undefined') {
|
||||
return;
|
||||
}
|
||||
let newInputWidth;
|
||||
if (this.props.placeholder && (!this.props.value || (this.props.value && this.props.placeholderIsMinWidth))) {
|
||||
newInputWidth = Math.max(this.sizer.scrollWidth, this.placeHolderSizer.scrollWidth) + 2;
|
||||
} else {
|
||||
newInputWidth = this.sizer.scrollWidth + 2;
|
||||
}
|
||||
// add extraWidth to the detected width. for number types, this defaults to 16 to allow for the stepper UI
|
||||
const extraWidth = (this.props.type === 'number' && this.props.extraWidth === undefined)
|
||||
? 16 : parseInt(this.props.extraWidth) || 0;
|
||||
newInputWidth += extraWidth;
|
||||
if (newInputWidth < this.props.minWidth) {
|
||||
newInputWidth = this.props.minWidth;
|
||||
}
|
||||
if (newInputWidth !== this.state.inputWidth) {
|
||||
this.setState({
|
||||
inputWidth: newInputWidth,
|
||||
});
|
||||
}
|
||||
}
|
||||
getInput () {
|
||||
return this.input;
|
||||
}
|
||||
focus () {
|
||||
this.input.focus();
|
||||
}
|
||||
blur () {
|
||||
this.input.blur();
|
||||
}
|
||||
select () {
|
||||
this.input.select();
|
||||
}
|
||||
renderStyles () {
|
||||
// this method injects styles to hide IE's clear indicator, which messes
|
||||
// with input size detection. the stylesheet is only injected when the
|
||||
// browser is IE, and can also be disabled by the `injectStyles` prop.
|
||||
const { injectStyles } = this.props;
|
||||
return isIE && injectStyles ? (
|
||||
<style dangerouslySetInnerHTML={{
|
||||
__html: `input#${this.state.inputId}::-ms-clear {display: none;}`,
|
||||
}} />
|
||||
) : null;
|
||||
}
|
||||
render () {
|
||||
const sizerValue = [this.props.defaultValue, this.props.value, ''].reduce((previousValue, currentValue) => {
|
||||
if (previousValue !== null && previousValue !== undefined) {
|
||||
return previousValue;
|
||||
}
|
||||
return currentValue;
|
||||
});
|
||||
|
||||
const wrapperStyle = { ...this.props.style };
|
||||
if (!wrapperStyle.display) wrapperStyle.display = 'inline-block';
|
||||
|
||||
const inputStyle = {
|
||||
boxSizing: 'content-box',
|
||||
width: `${this.state.inputWidth}px`,
|
||||
...this.props.inputStyle,
|
||||
};
|
||||
|
||||
const { ...inputProps } = this.props;
|
||||
cleanInputProps(inputProps);
|
||||
inputProps.className = this.props.inputClassName;
|
||||
inputProps.id = this.state.inputId;
|
||||
inputProps.style = inputStyle;
|
||||
|
||||
return (
|
||||
<div className={this.props.className} style={wrapperStyle}>
|
||||
{this.renderStyles()}
|
||||
<input {...inputProps} ref={this.inputRef} />
|
||||
<div ref={this.sizerRef} style={sizerStyle}>{sizerValue}</div>
|
||||
{this.props.placeholder
|
||||
? <div ref={this.placeHolderSizerRef} style={sizerStyle}>{this.props.placeholder}</div>
|
||||
: null
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
AutosizeInput.propTypes = {
|
||||
className: PropTypes.string, // className for the outer element
|
||||
defaultValue: PropTypes.any, // default field value
|
||||
extraWidth: PropTypes.oneOfType([ // additional width for input element
|
||||
PropTypes.number,
|
||||
PropTypes.string,
|
||||
]),
|
||||
id: PropTypes.string, // id to use for the input, can be set for consistent snapshots
|
||||
injectStyles: PropTypes.bool, // inject the custom stylesheet to hide clear UI, defaults to true
|
||||
inputClassName: PropTypes.string, // className for the input element
|
||||
inputRef: PropTypes.func, // ref callback for the input element
|
||||
inputStyle: PropTypes.object, // css styles for the input element
|
||||
minWidth: PropTypes.oneOfType([ // minimum width for input element
|
||||
PropTypes.number,
|
||||
PropTypes.string,
|
||||
]),
|
||||
onAutosize: PropTypes.func, // onAutosize handler: function(newWidth) {}
|
||||
onChange: PropTypes.func, // onChange handler: function(event) {}
|
||||
placeholder: PropTypes.string, // placeholder text
|
||||
placeholderIsMinWidth: PropTypes.bool, // don't collapse size to less than the placeholder
|
||||
style: PropTypes.object, // css styles for the outer element
|
||||
value: PropTypes.any, // field value
|
||||
};
|
||||
AutosizeInput.defaultProps = {
|
||||
minWidth: 1,
|
||||
injectStyles: true,
|
||||
};
|
||||
|
||||
export default AutosizeInput;
|
67
web/node_modules/react-input-autosize/webpack.config.js
generated
vendored
Normal file
67
web/node_modules/react-input-autosize/webpack.config.js
generated
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
const webpack = require('webpack');
|
||||
const path = require('path');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
context: path.resolve(__dirname, 'examples/src'),
|
||||
entry: {
|
||||
app: './app.js',
|
||||
},
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'examples/dist'),
|
||||
filename: '[name].js',
|
||||
publicPath: '/',
|
||||
},
|
||||
devServer: {
|
||||
contentBase: path.resolve(__dirname, 'examples/src'),
|
||||
port: 8000,
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: [/node_modules/],
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.less$/,
|
||||
use: ExtractTextPlugin.extract({
|
||||
fallback: 'style-loader',
|
||||
use: ['css-loader', 'less-loader'],
|
||||
}),
|
||||
},
|
||||
{
|
||||
test: /\.html$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'html-loader',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'react-input-autosize': path.resolve(
|
||||
__dirname,
|
||||
'src/AutosizeInput'
|
||||
),
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'common',
|
||||
filename: 'common.js',
|
||||
minChunk: 2,
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
filename: 'index.html',
|
||||
inject: false,
|
||||
template: path.resolve(__dirname, 'examples/src/index.html'),
|
||||
}),
|
||||
new ExtractTextPlugin('example.css'),
|
||||
],
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue