rc-mentions
Advanced tools
Comparing version 1.7.0 to 1.7.1
@@ -23,8 +23,4 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _super.apply(this, arguments); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_this.renderDropdown = function (_ref) { | ||
@@ -31,0 +27,0 @@ var notFoundContent = _ref.notFoundContent, |
@@ -53,8 +53,4 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _super.apply(this, arguments); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_this.getDropdownPrefix = function () { | ||
@@ -61,0 +57,0 @@ return "".concat(_this.props.prefixCls, "-dropdown"); |
@@ -41,3 +41,3 @@ import * as React from 'react'; | ||
declare class Mentions extends React.Component<MentionsProps, MentionsState> { | ||
static Option: React.SFC<OptionProps>; | ||
static Option: React.FC<OptionProps>; | ||
textarea?: HTMLTextAreaElement; | ||
@@ -44,0 +44,0 @@ measure?: HTMLDivElement; |
@@ -8,3 +8,2 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import _createSuper from "@babel/runtime/helpers/esm/createSuper"; | ||
var _excluded = ["prefixCls", "placement", "direction", "transitionName", "className", "style", "autoFocus", "notFoundContent", "getPopupContainer", "dropdownClassName"]; | ||
import classNames from 'classnames'; | ||
@@ -25,3 +24,3 @@ import toArray from "rc-util/es/Children/toArray"; | ||
function Mentions(_props) { | ||
function Mentions(props) { | ||
var _this; | ||
@@ -31,5 +30,3 @@ | ||
_this = _super.call(this, _props); | ||
_this.textarea = void 0; | ||
_this.measure = void 0; | ||
_this = _super.call(this, props); | ||
_this.focusId = undefined; | ||
@@ -55,4 +52,5 @@ | ||
_this.triggerChange(value); | ||
}; | ||
}; // Check if hit the measure keyword | ||
_this.onKeyDown = function (event) { | ||
@@ -105,3 +103,16 @@ var which = event.which; | ||
}; | ||
/** | ||
* When to start measure: | ||
* 1. When user press `prefix` | ||
* 2. When measureText !== prevMeasureText | ||
* - If measure hit | ||
* - If measuring | ||
* | ||
* When to stop measure: | ||
* 1. Selection is out of range | ||
* 2. Contains `space` | ||
* 3. ESC or select one | ||
*/ | ||
_this.onKeyUp = function (event) { | ||
@@ -290,3 +301,3 @@ var key = event.key, | ||
_this.state = { | ||
value: _props.defaultValue || _props.value || '', | ||
value: props.defaultValue || props.value || '', | ||
measuring: false, | ||
@@ -362,3 +373,3 @@ measureLocation: 0, | ||
dropdownClassName = _this$props4.dropdownClassName, | ||
restProps = _objectWithoutProperties(_this$props4, _excluded); | ||
restProps = _objectWithoutProperties(_this$props4, ["prefixCls", "placement", "direction", "transitionName", "className", "style", "autoFocus", "notFoundContent", "getPopupContainer", "dropdownClassName"]); | ||
@@ -365,0 +376,0 @@ var inputProps = omit(restProps, 'value', 'defaultValue', 'prefix', 'split', 'children', 'validateSearch', 'filterOption', 'onSelect', 'onSearch'); |
@@ -10,3 +10,3 @@ import * as React from 'react'; | ||
} | ||
declare const Option: React.SFC<OptionProps>; | ||
declare const Option: React.FC<OptionProps>; | ||
export default Option; |
@@ -39,9 +39,4 @@ "use strict"; | ||
(0, _classCallCheck2.default)(this, DropdownMenu); | ||
_this = _super.apply(this, arguments); | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_this.renderDropdown = function (_ref) { | ||
@@ -48,0 +43,0 @@ var notFoundContent = _ref.notFoundContent, |
@@ -70,9 +70,4 @@ "use strict"; | ||
(0, _classCallCheck2.default)(this, KeywordTrigger); | ||
_this = _super.apply(this, arguments); | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_this.getDropdownPrefix = function () { | ||
@@ -79,0 +74,0 @@ return "".concat(_this.props.prefixCls, "-dropdown"); |
@@ -41,3 +41,3 @@ import * as React from 'react'; | ||
declare class Mentions extends React.Component<MentionsProps, MentionsState> { | ||
static Option: React.SFC<OptionProps>; | ||
static Option: React.FC<OptionProps>; | ||
textarea?: HTMLTextAreaElement; | ||
@@ -44,0 +44,0 @@ measure?: HTMLDivElement; |
"use strict"; | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -44,4 +44,2 @@ value: true | ||
var _excluded = ["prefixCls", "placement", "direction", "transitionName", "className", "style", "autoFocus", "notFoundContent", "getPopupContainer", "dropdownClassName"]; | ||
var Mentions = /*#__PURE__*/function (_React$Component) { | ||
@@ -52,9 +50,7 @@ (0, _inherits2.default)(Mentions, _React$Component); | ||
function Mentions(_props) { | ||
function Mentions(props) { | ||
var _this; | ||
(0, _classCallCheck2.default)(this, Mentions); | ||
_this = _super.call(this, _props); | ||
_this.textarea = void 0; | ||
_this.measure = void 0; | ||
_this = _super.call(this, props); | ||
_this.focusId = undefined; | ||
@@ -80,4 +76,5 @@ | ||
_this.triggerChange(value); | ||
}; | ||
}; // Check if hit the measure keyword | ||
_this.onKeyDown = function (event) { | ||
@@ -130,3 +127,16 @@ var which = event.which; | ||
}; | ||
/** | ||
* When to start measure: | ||
* 1. When user press `prefix` | ||
* 2. When measureText !== prevMeasureText | ||
* - If measure hit | ||
* - If measuring | ||
* | ||
* When to stop measure: | ||
* 1. Selection is out of range | ||
* 2. Contains `space` | ||
* 3. ESC or select one | ||
*/ | ||
_this.onKeyUp = function (event) { | ||
@@ -315,3 +325,3 @@ var key = event.key, | ||
_this.state = { | ||
value: _props.defaultValue || _props.value || '', | ||
value: props.defaultValue || props.value || '', | ||
measuring: false, | ||
@@ -386,3 +396,3 @@ measureLocation: 0, | ||
dropdownClassName = _this$props4.dropdownClassName, | ||
restProps = (0, _objectWithoutProperties2.default)(_this$props4, _excluded); | ||
restProps = (0, _objectWithoutProperties2.default)(_this$props4, ["prefixCls", "placement", "direction", "transitionName", "className", "style", "autoFocus", "notFoundContent", "getPopupContainer", "dropdownClassName"]); | ||
var inputProps = (0, _util.omit)(restProps, 'value', 'defaultValue', 'prefix', 'split', 'children', 'validateSearch', 'filterOption', 'onSelect', 'onSearch'); | ||
@@ -389,0 +399,0 @@ var options = measuring ? this.getOptions() : []; |
@@ -8,3 +8,3 @@ "use strict"; | ||
}); | ||
exports.MentionsContextProvider = exports.MentionsContextConsumer = void 0; | ||
exports.MentionsContextConsumer = exports.MentionsContextProvider = void 0; | ||
@@ -11,0 +11,0 @@ var React = _interopRequireWildcard(require("react")); |
@@ -10,3 +10,3 @@ import * as React from 'react'; | ||
} | ||
declare const Option: React.SFC<OptionProps>; | ||
declare const Option: React.FC<OptionProps>; | ||
export default Option; |
@@ -8,9 +8,9 @@ "use strict"; | ||
}); | ||
exports.filterOption = filterOption; | ||
exports.getBeforeSelectionText = getBeforeSelectionText; | ||
exports.getLastMeasureIndex = getLastMeasureIndex; | ||
exports.omit = void 0; | ||
exports.replaceWithMeasure = replaceWithMeasure; | ||
exports.setInputSelection = setInputSelection; | ||
exports.validateSearch = validateSearch; | ||
exports.filterOption = filterOption; | ||
exports.omit = void 0; | ||
@@ -17,0 +17,0 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); |
{ | ||
"name": "rc-mentions", | ||
"version": "1.7.0", | ||
"version": "1.7.1", | ||
"description": "React Mentions", | ||
@@ -44,4 +44,4 @@ "keywords": [ | ||
"@types/enzyme": "^3.1.15", | ||
"@types/react": "^17.0.13", | ||
"@types/react-dom": "^17.0.8", | ||
"@types/react": "^18.0.8", | ||
"@types/react-dom": "^18.0.3", | ||
"@types/warning": "^3.0.0", | ||
@@ -48,0 +48,0 @@ "@umijs/fabric": "^2.0.8", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1735
71233