coffeescript-ui
Version:
Coffeescript User Interface System
53 lines (42 loc) • 1.07 kB
text/coffeescript
###
* coffeescript-ui - Coffeescript User Interface System (CUI)
* Copyright (c) 2013 - 2016 Programmfabrik GmbH
* MIT Licence
* https://github.com/programmfabrik/coffeescript-ui, http://www.coffeescript-ui.org
###
class CUI.DocumentBrowser.SearchQuery extends CUI.Element
initOpts: ->
super()
search:
mandatory: true
check: String
readOpts: ->
super()
for str in @_search.trim().split(/\s+/)
if str.trim() == ""
continue
return
getRegExps: ->
getSearch: ->
match: (str, strip) ->
search_match = null
if CUI.util.isEmpty(str)
return search_match
for regExp, idx in @__regExpe
matches = []
while ((match = regExp.exec(str)) != null)
matches.push(match)
if matches.length > 0
if not search_match
search_match = new CUI.DocumentBrowser.SearchMatch
searchQuery: @
string: str
for match in matches
match.regExp_idx = idx
search_match.addMatch(match)
search_match