Update docs, annotations and style for checkbox

This commit is contained in:
Insality
2022-02-12 17:17:36 +02:00
parent 4e0fd264b1
commit 3b329f9c25
38 changed files with 67 additions and 48 deletions

View File

@@ -44,10 +44,11 @@ end
--- Set checkbox group state
-- @tparam CheckboxGroup self
-- @tparam bool[] indexes Array of checkbox state
function CheckboxGroup.set_state(self, indexes)
-- @tparam boolean is_instant If instant state change
function CheckboxGroup.set_state(self, indexes, is_instant)
for i = 1, #indexes do
if self.checkboxes[i] then
self.checkboxes[i]:set_state(indexes[i], true)
self.checkboxes[i]:set_state(indexes[i], true, is_instant)
end
end
end

View File

@@ -19,9 +19,9 @@ local component = require("druid.component")
local RadioGroup = component.create("radio_group")
local function on_checkbox_click(self, index)
local function on_checkbox_click(self, index, is_instant)
for i = 1, #self.checkboxes do
self.checkboxes[i]:set_state(i == index, true)
self.checkboxes[i]:set_state(i == index, true, is_instant)
end
self.on_radio_click:trigger(self:get_context(), index)
@@ -53,8 +53,9 @@ end
--- Set radio group state
-- @tparam RadioGroup self
-- @tparam number index Index in radio group
function RadioGroup.set_state(self, index)
on_checkbox_click(self, index)
-- @tparam boolean is_instant If is instant state change
function RadioGroup.set_state(self, index, is_instant)
on_checkbox_click(self, index, is_instant)
end