filter arity input inprovement
This commit is contained in:
@@ -735,6 +735,7 @@ function private.initialize_filter_dropdown()
|
||||
m.filter_input:Hide()
|
||||
else
|
||||
local _, _, suggestions = Aux.filter.parse_query_string(UIDropDownMenu_GetSelectedValue(m.filter_dropdown)..'/')
|
||||
m.filter_input:SetNumeric(Aux.safe(Aux.filter.filters[this.value]).input_type/'number' == 'number')
|
||||
m.filter_input.complete = Aux.completion.complete(function() return suggestions or {} end)
|
||||
m.filter_input:Show()
|
||||
m.filter_input:SetFocus()
|
||||
@@ -757,7 +758,7 @@ function private.get_form()
|
||||
query_string = query_string == '' and part or query_string..'/'..part
|
||||
end
|
||||
|
||||
add('"'..m.name_input:GetText()..'"')
|
||||
add(Aux.filter.quote(m.name_input:GetText()))
|
||||
|
||||
if m.exact_checkbox:GetChecked() then
|
||||
add('exact')
|
||||
@@ -811,7 +812,7 @@ function private.set_form(components)
|
||||
if name and strsub(name, 1, 1) == '"' and strsub(name, -1, -1) == '"' then
|
||||
name = strsub(name, 2, -2)
|
||||
end
|
||||
m.name_input:SetText(name)
|
||||
m.name_input:SetText(Aux.filter.unquote(filter[2]))
|
||||
elseif filter[1] == 'exact' then
|
||||
m.exact_checkbox:SetChecked(true)
|
||||
elseif filter[1] == 'min_level' then
|
||||
@@ -863,16 +864,18 @@ end
|
||||
|
||||
private.post_components = {}
|
||||
|
||||
function private.add_post_filter()
|
||||
function private.add_post_component()
|
||||
local name = UIDropDownMenu_GetSelectedValue(m.filter_dropdown)
|
||||
if name then
|
||||
local filter = name
|
||||
if not Aux.filter.filters[name] and filter == 'and' or filter == 'or' then
|
||||
if m.filter_input:GetText() ~= '' and m.filter_input:GetText() ~= '*' and (tonumber(m.filter_input:GetText() or 3 <= 2)) then
|
||||
local arity = m.filter_input:GetText()
|
||||
arity = tonumber(arity) and Aux.round(tonumber(arity))
|
||||
if arity and arity < 2 then
|
||||
Aux.log('Invalid operator suffix')
|
||||
return
|
||||
end
|
||||
filter = filter..m.filter_input:GetText()
|
||||
filter = filter..Aux.filter.operator_suffix(arity)
|
||||
end
|
||||
if Aux.filter.filters[name] and Aux.filter.filters[name].input_type ~= '' then
|
||||
filter = filter..'/'..m.filter_input:GetText()
|
||||
|
||||
+5
-16
@@ -386,10 +386,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
m.min_level_input:SetFocus()
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:ClearFocus()
|
||||
m.execute()
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', Aux.f(editbox.ClearFocus, editbox))
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
||||
label:SetText('Name')
|
||||
@@ -418,10 +415,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
m.max_level_input:SetFocus()
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:ClearFocus()
|
||||
m.execute()
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', Aux.f(editbox.ClearFocus, editbox))
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
||||
label:SetText('Level Range')
|
||||
@@ -440,10 +434,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
m.name_input:SetFocus()
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:ClearFocus()
|
||||
m.execute()
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', Aux.f(editbox.ClearFocus, editbox))
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -3.5, 0)
|
||||
label:SetText('-')
|
||||
@@ -539,7 +530,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
btn:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
|
||||
btn:SetScript('OnClick', function()
|
||||
if arg1 == 'LeftButton' then
|
||||
m.add_post_filter()
|
||||
m.add_post_component()
|
||||
elseif arg1 == 'RightButton' then
|
||||
m.remove_post_filter()
|
||||
end
|
||||
@@ -551,12 +542,10 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
input:SetPoint('LEFT', m.filter_dropdown, 'RIGHT', 10, 0)
|
||||
input:SetWidth(150)
|
||||
input:SetHeight(25)
|
||||
-- editbox:SetNumeric(true)
|
||||
-- editbox:SetMaxLetters(2)
|
||||
input:SetScript('OnChar', function()
|
||||
this:complete()
|
||||
end)
|
||||
input:SetScript('OnEnterPressed', m.add_post_filter)
|
||||
input:SetScript('OnEnterPressed', m.add_post_component)
|
||||
input:Hide()
|
||||
private.filter_input = input
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user