rc-mentions
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -0,1 +1,3 @@ | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -7,3 +9,3 @@ | ||
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
@@ -10,0 +12,0 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } |
@@ -11,2 +11,3 @@ import * as React from 'react'; | ||
transitionName?: string; | ||
getPopupContainer?: () => HTMLElement; | ||
} | ||
@@ -13,0 +14,0 @@ declare class KeywordTrigger extends React.Component<KeywordTriggerProps, {}> { |
@@ -0,1 +1,3 @@ | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -7,3 +9,3 @@ | ||
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
@@ -74,3 +76,4 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
placement = _this$props.placement, | ||
transitionName = _this$props.transitionName; | ||
transitionName = _this$props.transitionName, | ||
getPopupContainer = _this$props.getPopupContainer; | ||
var popupElement = this.getDropdownElement(); | ||
@@ -83,3 +86,4 @@ return React.createElement(Trigger, { | ||
popupTransitionName: transitionName, | ||
builtinPlacements: BUILT_IN_PLACEMENTS | ||
builtinPlacements: BUILT_IN_PLACEMENTS, | ||
getPopupContainer: getPopupContainer | ||
}, children); | ||
@@ -86,0 +90,0 @@ } |
@@ -25,2 +25,3 @@ import * as React from 'react'; | ||
onBlur?: React.FocusEventHandler<HTMLTextAreaElement>; | ||
getPopupContainer?: () => HTMLElement; | ||
} | ||
@@ -72,3 +73,3 @@ interface MentionsState { | ||
onDropdownFocus: () => void; | ||
onFocus: (event?: React.FocusEvent<HTMLTextAreaElement> | undefined) => void; | ||
onFocus: (event?: React.FocusEvent<HTMLTextAreaElement>) => void; | ||
onBlur: (event: React.FocusEvent<HTMLTextAreaElement>) => void; | ||
@@ -79,3 +80,3 @@ selectOption: (option: OptionProps) => void; | ||
setMeasureRef: (element: HTMLDivElement) => void; | ||
getOptions: (measureText?: string | undefined) => OptionProps[]; | ||
getOptions: (measureText?: string) => OptionProps[]; | ||
startMeasure(measureText: string, measurePrefix: string, measureLocation: number): void; | ||
@@ -82,0 +83,0 @@ stopMeasure(callback?: () => void): void; |
@@ -1,3 +0,7 @@ | ||
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 _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
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"); } } | ||
@@ -9,3 +13,3 @@ | ||
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
@@ -20,15 +24,2 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
var __rest = this && this.__rest || function (s, e) { | ||
var t = {}; | ||
for (var p in s) { | ||
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; | ||
} | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
import classNames from 'classnames'; | ||
@@ -102,4 +93,2 @@ import toArray from "rc-util/es/Children/toArray"; | ||
_this.stopMeasure(); | ||
return; | ||
} else if (which === KeyCode.ENTER) { | ||
@@ -347,11 +336,12 @@ // Measure hit | ||
var _a = this.props, | ||
prefixCls = _a.prefixCls, | ||
placement = _a.placement, | ||
transitionName = _a.transitionName, | ||
className = _a.className, | ||
style = _a.style, | ||
autoFocus = _a.autoFocus, | ||
notFoundContent = _a.notFoundContent, | ||
restProps = __rest(_a, ["prefixCls", "placement", "transitionName", "className", "style", "autoFocus", "notFoundContent"]); | ||
var _this$props4 = this.props, | ||
prefixCls = _this$props4.prefixCls, | ||
placement = _this$props4.placement, | ||
transitionName = _this$props4.transitionName, | ||
className = _this$props4.className, | ||
style = _this$props4.style, | ||
autoFocus = _this$props4.autoFocus, | ||
notFoundContent = _this$props4.notFoundContent, | ||
getPopupContainer = _this$props4.getPopupContainer, | ||
restProps = _objectWithoutProperties(_this$props4, ["prefixCls", "placement", "transitionName", "className", "style", "autoFocus", "notFoundContent", "getPopupContainer"]); | ||
@@ -363,3 +353,3 @@ var inputProps = omit(restProps, 'value', 'defaultValue', 'prefix', 'split', 'children', 'validateSearch', 'filterOption', 'onSelect', 'onSearch'); | ||
style: style | ||
}, React.createElement("textarea", _extends({ | ||
}, React.createElement("textarea", Object.assign({ | ||
autoFocus: autoFocus, | ||
@@ -390,3 +380,4 @@ ref: this.setTextAreaRef, | ||
options: options, | ||
visible: true | ||
visible: true, | ||
getPopupContainer: getPopupContainer | ||
}, React.createElement("span", null, measurePrefix))), value.slice(measureLocation + measurePrefix.length))); | ||
@@ -393,0 +384,0 @@ } |
/* tslint:disable: no-object-literal-type-assertion */ | ||
import createReactContext from '@ant-design/create-react-context'; // We will never use default, here only to fix TypeScript warning | ||
var MentionsContext = createReactContext({}); | ||
var MentionsContext = createReactContext(null); | ||
export var MentionsContextProvider = MentionsContext.Provider; | ||
export var MentionsContextConsumer = MentionsContext.Consumer; |
import { MentionsProps } from './Mentions'; | ||
import { OptionProps } from './Option'; | ||
export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; | ||
declare type OmitFunc = <T extends object, K extends [...Array<keyof T>]>(obj: T, ...keys: K) => { | ||
declare type OmitFunc = <T extends object, K extends [...(keyof T)[]]>(obj: T, ...keys: K) => { | ||
[K2 in Exclude<keyof T, K[number]>]: T[K2]; | ||
@@ -6,0 +6,0 @@ }; |
@@ -1,5 +0,9 @@ | ||
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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
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; } | ||
export var omit = function omit(obj) { | ||
var clone = _extends({}, obj); | ||
var clone = _objectSpread({}, obj); | ||
@@ -47,4 +51,4 @@ for (var _len = arguments.length, keys = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
function lower(_char) { | ||
return (_char || '').toLowerCase(); | ||
function lower(char) { | ||
return (char || '').toLowerCase(); | ||
} | ||
@@ -51,0 +55,0 @@ |
# History | ||
---- | ||
## 0.4.0 / 2019-08-06 | ||
- Support `getPopupContainer` prop. | ||
## 0.3.0 / 2019-05-14 | ||
@@ -14,2 +18,2 @@ | ||
- Initial release. | ||
- Initial release. |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports["default"] = void 0; | ||
exports.default = void 0; | ||
@@ -15,4 +15,6 @@ var _rcMenu = _interopRequireWildcard(require("rc-menu")); | ||
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 _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 _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -24,3 +26,3 @@ | ||
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
@@ -61,3 +63,3 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
var activeOption = options[activeIndex] || {}; | ||
return React.createElement(_rcMenu["default"], { | ||
return React.createElement(_rcMenu.default, { | ||
prefixCls: "".concat(prefixCls, "-menu"), | ||
@@ -108,2 +110,2 @@ activeKey: activeOption.value, | ||
var _default = DropdownMenu; | ||
exports["default"] = _default; | ||
exports.default = _default; |
@@ -6,9 +6,9 @@ "use strict"; | ||
}); | ||
exports["default"] = void 0; | ||
exports.default = void 0; | ||
var _Mentions = _interopRequireDefault(require("./Mentions")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _default = _Mentions["default"]; | ||
exports["default"] = _default; | ||
var _default = _Mentions.default; | ||
exports.default = _default; |
@@ -11,2 +11,3 @@ import * as React from 'react'; | ||
transitionName?: string; | ||
getPopupContainer?: () => HTMLElement; | ||
} | ||
@@ -13,0 +14,0 @@ declare class KeywordTrigger extends React.Component<KeywordTriggerProps, {}> { |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports["default"] = void 0; | ||
exports.default = void 0; | ||
@@ -15,6 +15,8 @@ var _rcTrigger = _interopRequireDefault(require("rc-trigger")); | ||
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 _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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -26,3 +28,3 @@ | ||
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
@@ -74,3 +76,3 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
var options = _this.props.options; | ||
return React.createElement(_DropdownMenu["default"], { | ||
return React.createElement(_DropdownMenu.default, { | ||
prefixCls: _this.getDropdownPrefix(), | ||
@@ -91,5 +93,6 @@ options: options | ||
placement = _this$props.placement, | ||
transitionName = _this$props.transitionName; | ||
transitionName = _this$props.transitionName, | ||
getPopupContainer = _this$props.getPopupContainer; | ||
var popupElement = this.getDropdownElement(); | ||
return React.createElement(_rcTrigger["default"], { | ||
return React.createElement(_rcTrigger.default, { | ||
prefixCls: this.getDropdownPrefix(), | ||
@@ -100,3 +103,4 @@ popupVisible: visible, | ||
popupTransitionName: transitionName, | ||
builtinPlacements: BUILT_IN_PLACEMENTS | ||
builtinPlacements: BUILT_IN_PLACEMENTS, | ||
getPopupContainer: getPopupContainer | ||
}, children); | ||
@@ -110,2 +114,2 @@ } | ||
var _default = KeywordTrigger; | ||
exports["default"] = _default; | ||
exports.default = _default; |
@@ -25,2 +25,3 @@ import * as React from 'react'; | ||
onBlur?: React.FocusEventHandler<HTMLTextAreaElement>; | ||
getPopupContainer?: () => HTMLElement; | ||
} | ||
@@ -72,3 +73,3 @@ interface MentionsState { | ||
onDropdownFocus: () => void; | ||
onFocus: (event?: React.FocusEvent<HTMLTextAreaElement> | undefined) => void; | ||
onFocus: (event?: React.FocusEvent<HTMLTextAreaElement>) => void; | ||
onBlur: (event: React.FocusEvent<HTMLTextAreaElement>) => void; | ||
@@ -79,3 +80,3 @@ selectOption: (option: OptionProps) => void; | ||
setMeasureRef: (element: HTMLDivElement) => void; | ||
getOptions: (measureText?: string | undefined) => OptionProps[]; | ||
getOptions: (measureText?: string) => OptionProps[]; | ||
startMeasure(measureText: string, measurePrefix: string, measureLocation: number): void; | ||
@@ -82,0 +83,0 @@ stopMeasure(callback?: () => void): void; |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports["default"] = void 0; | ||
exports.default = void 0; | ||
@@ -27,8 +27,12 @@ var _classnames = _interopRequireDefault(require("classnames")); | ||
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 _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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
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 _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
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"); } } | ||
@@ -40,3 +44,3 @@ | ||
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
@@ -51,15 +55,2 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
var __rest = void 0 && (void 0).__rest || function (s, e) { | ||
var t = {}; | ||
for (var p in s) { | ||
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; | ||
} | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
var Mentions = | ||
@@ -109,7 +100,7 @@ /*#__PURE__*/ | ||
if (which === _KeyCode["default"].UP || which === _KeyCode["default"].DOWN) { | ||
if (which === _KeyCode.default.UP || which === _KeyCode.default.DOWN) { | ||
// Control arrow function | ||
var optionLen = _this.getOptions().length; | ||
var offset = which === _KeyCode["default"].UP ? -1 : 1; | ||
var offset = which === _KeyCode.default.UP ? -1 : 1; | ||
var newActiveIndex = (activeIndex + offset + optionLen) % optionLen; | ||
@@ -122,7 +113,5 @@ | ||
event.preventDefault(); | ||
} else if (which === _KeyCode["default"].ESC) { | ||
} else if (which === _KeyCode.default.ESC) { | ||
_this.stopMeasure(); | ||
return; | ||
} else if (which === _KeyCode["default"].ENTER) { | ||
} else if (which === _KeyCode.default.ENTER) { | ||
// Measure hit | ||
@@ -169,3 +158,3 @@ var option = _this.getOptions()[activeIndex]; | ||
if ([_KeyCode["default"].ESC, _KeyCode["default"].UP, _KeyCode["default"].DOWN, _KeyCode["default"].ENTER].indexOf(which) !== -1) { | ||
if ([_KeyCode.default.ESC, _KeyCode.default.UP, _KeyCode.default.DOWN, _KeyCode.default.ENTER].indexOf(which) !== -1) { | ||
return; | ||
@@ -295,3 +284,3 @@ } | ||
filterOption = _this$props3.filterOption; | ||
var list = (0, _toArray["default"])(children).map(function (_ref2) { | ||
var list = (0, _toArray.default)(children).map(function (_ref2) { | ||
var props = _ref2.props; | ||
@@ -371,11 +360,12 @@ return props; | ||
var _a = this.props, | ||
prefixCls = _a.prefixCls, | ||
placement = _a.placement, | ||
transitionName = _a.transitionName, | ||
className = _a.className, | ||
style = _a.style, | ||
autoFocus = _a.autoFocus, | ||
notFoundContent = _a.notFoundContent, | ||
restProps = __rest(_a, ["prefixCls", "placement", "transitionName", "className", "style", "autoFocus", "notFoundContent"]); | ||
var _this$props4 = this.props, | ||
prefixCls = _this$props4.prefixCls, | ||
placement = _this$props4.placement, | ||
transitionName = _this$props4.transitionName, | ||
className = _this$props4.className, | ||
style = _this$props4.style, | ||
autoFocus = _this$props4.autoFocus, | ||
notFoundContent = _this$props4.notFoundContent, | ||
getPopupContainer = _this$props4.getPopupContainer, | ||
restProps = _objectWithoutProperties(_this$props4, ["prefixCls", "placement", "transitionName", "className", "style", "autoFocus", "notFoundContent", "getPopupContainer"]); | ||
@@ -385,5 +375,5 @@ var inputProps = (0, _util.omit)(restProps, 'value', 'defaultValue', 'prefix', 'split', 'children', 'validateSearch', 'filterOption', 'onSelect', 'onSearch'); | ||
return React.createElement("div", { | ||
className: (0, _classnames["default"])(prefixCls, className), | ||
className: (0, _classnames.default)(prefixCls, className), | ||
style: style | ||
}, React.createElement("textarea", _extends({ | ||
}, React.createElement("textarea", Object.assign({ | ||
autoFocus: autoFocus, | ||
@@ -409,3 +399,3 @@ ref: this.setTextAreaRef, | ||
} | ||
}, React.createElement(_KeywordTrigger["default"], { | ||
}, React.createElement(_KeywordTrigger.default, { | ||
prefixCls: prefixCls, | ||
@@ -415,3 +405,4 @@ transitionName: transitionName, | ||
options: options, | ||
visible: true | ||
visible: true, | ||
getPopupContainer: getPopupContainer | ||
}, React.createElement("span", null, measurePrefix))), value.slice(measureLocation + measurePrefix.length))); | ||
@@ -435,3 +426,3 @@ } | ||
Mentions.Option = _Option["default"]; | ||
Mentions.Option = _Option.default; | ||
Mentions.defaultProps = { | ||
@@ -448,2 +439,2 @@ prefixCls: 'rc-mentions', | ||
var _default = Mentions; | ||
exports["default"] = _default; | ||
exports.default = _default; |
@@ -10,7 +10,7 @@ "use strict"; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/* tslint:disable: no-object-literal-type-assertion */ | ||
// We will never use default, here only to fix TypeScript warning | ||
var MentionsContext = (0, _createReactContext["default"])({}); | ||
var MentionsContext = (0, _createReactContext.default)(null); | ||
var MentionsContextProvider = MentionsContext.Provider; | ||
@@ -17,0 +17,0 @@ exports.MentionsContextProvider = MentionsContextProvider; |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports["default"] = void 0; | ||
exports.default = void 0; | ||
@@ -14,2 +14,2 @@ var Option = function Option() { | ||
var _default = Option; | ||
exports["default"] = _default; | ||
exports.default = _default; |
import { MentionsProps } from './Mentions'; | ||
import { OptionProps } from './Option'; | ||
export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; | ||
declare type OmitFunc = <T extends object, K extends [...Array<keyof T>]>(obj: T, ...keys: K) => { | ||
declare type OmitFunc = <T extends object, K extends [...(keyof T)[]]>(obj: T, ...keys: K) => { | ||
[K2 in Exclude<keyof T, K[number]>]: T[K2]; | ||
@@ -6,0 +6,0 @@ }; |
@@ -14,6 +14,10 @@ "use strict"; | ||
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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
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 omit = function omit(obj) { | ||
var clone = _extends({}, obj); | ||
var clone = _objectSpread({}, obj); | ||
@@ -65,4 +69,4 @@ for (var _len = arguments.length, keys = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
function lower(_char) { | ||
return (_char || '').toLowerCase(); | ||
function lower(char) { | ||
return (char || '').toLowerCase(); | ||
} | ||
@@ -69,0 +73,0 @@ |
{ | ||
"name": "rc-mentions", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "React Mentions", | ||
@@ -16,2 +16,3 @@ "keywords": [ | ||
"es", | ||
"dist", | ||
"lib" | ||
@@ -28,23 +29,14 @@ ], | ||
"license": "MIT", | ||
"config": { | ||
"port": 8093 | ||
}, | ||
"scripts": { | ||
"build": "rc-tools run build", | ||
"compile": "rc-tools run compile --babel-runtime", | ||
"gh-pages": "rc-tools run gh-pages", | ||
"start": "rc-tools run storybook", | ||
"pub": "rc-tools run pub --babel-runtime", | ||
"lint": "rc-tools run lint", | ||
"lint:fix": "rc-tools run lint --fix", | ||
"prettier": "rc-tools run prettier", | ||
"test": "rc-tools run test", | ||
"prepublish": "rc-tools run guard", | ||
"init-tslint": "rc-tools run gen-lint-config", | ||
"coverage": "rc-tools run test --coverage", | ||
"pre-commit": "rc-tools run pre-commit", | ||
"storybook": "rc-tools run storybook", | ||
"lint-staged": "lint-staged", | ||
"start": "father doc dev --storybook", | ||
"build": "father doc build --storybook", | ||
"compile": "father build", | ||
"prepublishOnly": "npm run compile && np --no-cleanup --yolo --no-publish", | ||
"lint": "eslint src/ --ext .tsx,.ts", | ||
"test": "father test", | ||
"now-build": "npm run build" | ||
}, | ||
"peerDependencies": { | ||
"react": "*" | ||
}, | ||
"devDependencies": { | ||
@@ -56,10 +48,7 @@ "@types/classnames": "^2.2.6", | ||
"@types/warning": "^3.0.0", | ||
"enzyme": "^3.8.0", | ||
"enzyme-adapter-react-16": "^1.7.1", | ||
"@umijs/fabric": "^1.1.9", | ||
"enzyme-to-json": "^3.1.4", | ||
"lint-staged": "^8.1.0", | ||
"father": "^2.13.6", | ||
"lodash.debounce": "^4.0.8", | ||
"pre-commit": "1.x", | ||
"querystring": "^0.2.0", | ||
"rc-tools": "^9.5.0", | ||
"np": "^5.0.3", | ||
"react": "^16.0.0", | ||
@@ -71,3 +60,2 @@ "react-dom": "^16.0.0", | ||
"@ant-design/create-react-context": "^0.2.4", | ||
"babel-runtime": "^6.23.0", | ||
"classnames": "^2.2.6", | ||
@@ -78,12 +66,3 @@ "rc-menu": "^7.4.22", | ||
"react-lifecycles-compat": "^3.0.4" | ||
}, | ||
"pre-commit": [ | ||
"lint-staged" | ||
], | ||
"lint-staged": { | ||
"*.{js,jsx,ts,tsx}": [ | ||
"npm run pre-commit", | ||
"git add" | ||
] | ||
} | ||
} |
@@ -83,2 +83,3 @@ # rc-mentions | ||
| onBlur | Trigger when mentions lose focus | React.FocusEventHandler<HTMLTextAreaElement> | - | | ||
| getPopupContainer | DOM Container for suggestions | () => HTMLElement | - | | ||
@@ -85,0 +86,0 @@ ### Methods |
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
80665
13
121
32
1652
- Removedbabel-runtime@^6.23.0