lodash APIs
- cloneDeep
- get
- isEqual
- isEmpty
- debounce
- merge
- uniq
- omit
- isString
- isArray
- pick
- sortBy
- groupBy
- flatten
- set
- find
- orderBy
- mapValues
- isObject
- last
- isNil
- isNumber
- range
- chunk
- throttle
- filter
- uniqBy
- difference
- pickBy
- noop
- capitalize
- uniqueId
- has
- isUndefined
- map
- camelCase
- isFunction
- kebabCase
- intersection
- random
- includes
- isPlainObject
- compact
- Dictionary
- findIndex
- keyBy
- forEach
- trim
- clamp
- identity
- remove
- keys
- isNull
- times
- startCase
- first
- values
- mapKeys
- sumBy
- max
- reduce
- some
- zip
- every
- memoize
- clone
- countBy
- concat
- snakeCase
- assign
- isBoolean
- uniqWith
- omitBy
- without
- minBy
- head
- maxBy
- min
- upperFirst
- escapeRegExp
- reverse
- sample
- shuffle
- defaults
- inRange
- flattenDeep
- take
- union
- sum
- mergeWith
- castArray
- replace
- flatMap
- reject
- zipObject
- template
- isNaN
- mean
- size
- findLast
- unset
- partition
- round
- fromPairs
- floor
- toPairs
- indexOf
- toString
- sampleSize
- differenceBy
- update
- chain
- startsWith
- xor
- pull
- DebouncedFunc
- defaultsDeep
- split
- findKey
- unescape
- partial
- toNumber
- invert
- each
- differenceWith
- endsWith
- slice
- isDate
- unionBy
- findLastIndex
- join
- isInteger
- delay
- isObjectLike
- padStart
- result
- isError
- extend
- cloneDeepWith
- upperCase
- trimStart
- constant
- matches
- lowerCase
- forIn
- lowerFirst
- once
- transform
- isMatch
- escape
- isEqualWith
- zipWith
- isRegExp
- entries
- sortedIndexBy
- dropWhile
- takeWhile
- isElement
- forEachRight
- ReplaceFunction
- TemplateExecutor
- keysIn
- IsEqualCustomizer
- isTypedArray
- cond
- stubTrue
- toUpper
- isMap
- isSet
- meanBy
- rangeRight
- repeat
- trimEnd
- now
- nth
- pullAt
- toPath
- eq
- lt
- lte
- gt
- gte
- pullAllBy
- pullAll
- toLower
- fill
- ceil
- flatMapDeep
- CloneDeepWithCustomizer
- negate
- takeRightWhile
- invoke
- tap
- intersectionWith
- truncate
- Collection
- bind
- curry
- partialRight
- sortedUniq
- sortedIndexOf
- Object
- drop
- _
Other Related APIs
lodash#invoke TypeScript Examples
The following examples show how to use
lodash#invoke.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FilterPopover.tsx From gio-design with Apache License 2.0 | 4 votes |
FilterPopover = (props: FilterPopoverProps): React.ReactElement => {
const locale = useLocale('Table');
const { clearText, okText, searchText }: typeof defaultLocale = {
...defaultLocale,
...locale,
};
const { children, onClick, filters = [], values, prefixCls, placeholder = searchText } = props;
const [searchValue, setSearchValue] = useState<string>('');
const [selectFilterKeys, setSelectFilterKeys] = useState<Key[]>(values);
const [visible, setVisible] = useState<boolean>(false);
const { tableRef } = useContext(TableContext);
const withClick = (
trigger: React.ReactElement<{
onClick?: (event: React.MouseEvent) => void;
}>
) => {
if (React.isValidElement(trigger)) {
return React.cloneElement(trigger, {
onClick: (event: React.MouseEvent) => {
setVisible((oldVisible) => !oldVisible);
invoke(trigger, 'props.onClick', event);
},
});
}
return trigger;
};
useEffect(() => {
if (visible) {
setSelectFilterKeys(values);
}
}, [values, visible]);
return (
<Popover
getContainer={(triggerNode) =>
(!isFunction(tableRef) && tableRef?.current) || triggerNode.parentElement || document.body
}
visible={visible}
onVisibleChange={(_visible: boolean) => {
setVisible(_visible);
if (_visible === false) {
setSearchValue('');
setSelectFilterKeys(values);
}
}}
placement="bottomLeft"
trigger="click"
overlayClassName={`${prefixCls}-filter-popover`}
content={
<>
<SearchBar
placeholder={placeholder}
size="small"
value={searchValue}
onChange={(event) => setSearchValue(event.target.value)}
className={`${prefixCls}-search-bar`}
autoFocus
/>
<FilterList
prefixCls={prefixCls}
value={selectFilterKeys}
onChange={(keys) => {
setSelectFilterKeys(keys);
}}
empty={searchValue ? <Result type="empty-result" title size="small" /> : undefined}
dataSource={filters
.filter((item) => {
if (isObject(item)) {
return item.label.includes(searchValue);
}
return item.toString().includes(searchValue);
})
.map((item) => {
if (isObject(item)) {
return { value: item.value, label: item.label };
}
return { value: item.toString(), label: item.toString() };
})}
/>
<div className={`${prefixCls}-filter-popover-footer`}>
<Button
type="secondary"
size="small"
onClick={() => {
setSearchValue('');
setSelectFilterKeys([]);
}}
>
{clearText}
</Button>
<Button
style={{ float: 'right' }}
size="small"
onClick={() => {
onClick(selectFilterKeys);
setVisible(false);
}}
>
{okText}
</Button>
</div>
</>
}
>
{withClick(children)}
</Popover>
);
}