mirror of
https://github.com/Insality/druid
synced 2025-11-27 11:20:54 +01:00
Update doc links, update emmylua generator
This commit is contained in:
@@ -8,10 +8,10 @@
|
||||
|
||||
|
||||
--- The Druid scroll component
|
||||
-- @tfield druid.scroll scroll
|
||||
-- @tfield Scroll scroll @{Scroll}
|
||||
|
||||
--- The Druid Grid component
|
||||
-- @tfield druid.static_grid grid
|
||||
-- @tfield StaticGrid|DynamicGrid grid @{StaticGrid}, @{DynamicGrid}
|
||||
|
||||
--- The current visual top data index
|
||||
-- @tfield number top_index
|
||||
@@ -23,7 +23,7 @@
|
||||
-- @tfield number scroll_progress
|
||||
|
||||
--- Event triggered when scroll progress is changed; event(self, progress_value)
|
||||
-- @tfield druid_event on_scroll_progress_change
|
||||
-- @tfield DruidEvent on_scroll_progress_change @{DruidEvent}
|
||||
|
||||
---
|
||||
|
||||
@@ -36,9 +36,9 @@ local DataList = component.create("data_list")
|
||||
|
||||
|
||||
--- Data list constructor
|
||||
-- @tparam DataList self
|
||||
-- @tparam druid.scroll scroll The Scroll instance for Data List component
|
||||
-- @tparam druid.grid grid The Grid instance for Data List component
|
||||
-- @tparam DataList self @{DataList}
|
||||
-- @tparam Scroll scroll The @{Scroll} instance for Data List component
|
||||
-- @tparam StaticGrid|DynamicGrid grid The @{StaticGrid} or @{DynamicGrid} instance for Data List component
|
||||
-- @tparam function create_function The create function callback(self, data, index, data_list). Function should return (node, [component])
|
||||
function DataList.init(self, scroll, grid, create_function)
|
||||
self.druid = self:get_druid()
|
||||
@@ -65,14 +65,14 @@ end
|
||||
|
||||
|
||||
--- Druid System on_remove function
|
||||
-- @tparam DataList self
|
||||
-- @tparam DataList self @{DataList}
|
||||
function DataList.on_remove(self)
|
||||
self.scroll.on_scroll:unsubscribe(self._check_elements, self)
|
||||
end
|
||||
|
||||
|
||||
--- Set new data set for DataList component
|
||||
-- @tparam DataList self
|
||||
-- @tparam DataList self @{DataList}
|
||||
-- @tparam table data The new data array
|
||||
-- @treturn druid.data_list Current DataList instance
|
||||
function DataList.set_data(self, data)
|
||||
@@ -85,7 +85,7 @@ end
|
||||
|
||||
|
||||
--- Add element to DataList. Currenly untested
|
||||
-- @tparam DataList self
|
||||
-- @tparam DataList self @{DataList}
|
||||
-- @tparam table data
|
||||
-- @tparam number index
|
||||
-- @tparam number shift_policy The constant from const.SHIFT.*
|
||||
@@ -113,7 +113,7 @@ end
|
||||
|
||||
|
||||
--- Remove element from DataList. Currenly untested
|
||||
-- @tparam DataList self
|
||||
-- @tparam DataList self @{DataList}
|
||||
-- @tparam number index
|
||||
-- @tparam number shift_policy The constant from const.SHIFT.*
|
||||
-- @local
|
||||
@@ -124,7 +124,7 @@ end
|
||||
|
||||
|
||||
--- Remove element from DataList by data value. Currenly untested
|
||||
-- @tparam DataList self
|
||||
-- @tparam DataList self @{DataList}
|
||||
-- @tparam tabe data
|
||||
-- @tparam number shift_policy The constant from const.SHIFT.*
|
||||
-- @local
|
||||
@@ -138,7 +138,7 @@ end
|
||||
|
||||
|
||||
--- Clear the DataList and refresh visuals
|
||||
-- @tparam DataList self
|
||||
-- @tparam DataList self @{DataList}
|
||||
function DataList.clear(self)
|
||||
self._data = {}
|
||||
self:_refresh()
|
||||
@@ -146,28 +146,28 @@ end
|
||||
|
||||
|
||||
--- Return first index from data. It not always equals to 1
|
||||
-- @tparam DataList self
|
||||
-- @tparam DataList self @{DataList}
|
||||
function DataList.get_first_index(self)
|
||||
return self._data_first_index
|
||||
end
|
||||
|
||||
|
||||
--- Return last index from data
|
||||
-- @tparam DataList self
|
||||
-- @tparam DataList self @{DataList}
|
||||
function DataList.get_last_index(self)
|
||||
return self._data_last_index
|
||||
end
|
||||
|
||||
|
||||
--- Return amount of data
|
||||
-- @tparam DataList self
|
||||
-- @tparam DataList self @{DataList}
|
||||
function DataList.get_length(self)
|
||||
return self._data_length
|
||||
end
|
||||
|
||||
|
||||
--- Return index for data value
|
||||
-- @tparam DataList self
|
||||
-- @tparam DataList self @{DataList}
|
||||
-- @tparam table data
|
||||
function DataList.get_index(self, data)
|
||||
for index, value in pairs(self._data) do
|
||||
@@ -181,7 +181,7 @@ end
|
||||
|
||||
|
||||
--- Instant scroll to element with passed index
|
||||
-- @tparam DataList self
|
||||
-- @tparam DataList self @{DataList}
|
||||
-- @tparam number index
|
||||
function DataList.scroll_to_index(self, index)
|
||||
local target = helper.clamp(index, self:get_first_index(), self:get_last_index())
|
||||
@@ -195,7 +195,7 @@ end
|
||||
|
||||
|
||||
--- Add element at passed index
|
||||
-- @tparam DataList self
|
||||
-- @tparam DataList self @{DataList}
|
||||
-- @tparam number index
|
||||
-- @local
|
||||
function DataList._add_at(self, index)
|
||||
@@ -213,7 +213,7 @@ end
|
||||
|
||||
|
||||
--- Remove element from passed index
|
||||
-- @tparam DataList self
|
||||
-- @tparam DataList self @{DataList}
|
||||
-- @tparam number index
|
||||
-- @local
|
||||
function DataList._remove_at(self, index)
|
||||
@@ -230,7 +230,7 @@ end
|
||||
|
||||
|
||||
--- Fully refresh all DataList elements
|
||||
-- @tparam DataList self
|
||||
-- @tparam DataList self @{DataList}
|
||||
-- @local
|
||||
function DataList._refresh(self)
|
||||
for index, _ in pairs(self._data_visual) do
|
||||
@@ -241,7 +241,7 @@ end
|
||||
|
||||
|
||||
--- Check elements which should be created
|
||||
-- @tparam DataList self
|
||||
-- @tparam DataList self @{DataList}
|
||||
-- @local
|
||||
function DataList._check_elements(self)
|
||||
for index, data in pairs(self._data_visual) do
|
||||
@@ -279,7 +279,7 @@ end
|
||||
|
||||
--- Check elements which should be created.
|
||||
-- Start from index with step until element is outside of scroll view
|
||||
-- @tparam DataList self
|
||||
-- @tparam DataList self @{DataList}
|
||||
-- @tparam number index
|
||||
-- @tparam number step
|
||||
-- @local
|
||||
@@ -314,7 +314,7 @@ end
|
||||
|
||||
|
||||
--- Update actual data params
|
||||
-- @tparam DataList self
|
||||
-- @tparam DataList self @{DataList}
|
||||
-- @local
|
||||
function DataList._update_data_info(self)
|
||||
self._data_first_index = false
|
||||
|
||||
Reference in New Issue
Block a user