Files
redash/client/app/lib/highlight.js
Levko Kravets 0c45d69662 Dashboard Parameters (#2756)
* getredash/redash#2641 Step 1: split Add Widget/Add Textbox buttons

* Convert Add widget/textbox dialogs to React components

* getredash/redash#2641 Step 2: Implement new dashboard parameters logic

* Resolve conflicts and fix build errors

* getredash/redash#2641 Refactoring and improve code quality

* Add Edit parameter mappings dialog to the widget

* getredash/redash#2641 Changes after code review

* Use Ant's Select component instead on <select> tags

* Fix Antd imports

* Fix Antd imports

* Fix Cannot read property 'getParametersDefs' of undefined

* Fix widgets static params bugs (don't show input, don't init from URL)

* Minor UI/UX fixes
2019-01-15 13:14:54 +02:00

9 lines
420 B
JavaScript

function escapeRegexp(queryToEscape) {
return ('' + queryToEscape).replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
}
// https://github.com/angular-ui/ui-select/blob/master/src/common.js#L146
export default function highlight(matchItem, query, template = '<span class="ui-select-highlight">$&</span>') {
return query && matchItem ? ('' + matchItem).replace(new RegExp(escapeRegexp(query), 'gi'), template) : matchItem;
}