Skip to content

Commit

Permalink
update non-infobox widgets too
Browse files Browse the repository at this point in the history
  • Loading branch information
Rathoz committed Sep 6, 2024
1 parent f2b69db commit 69c5036
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions components/widget/widget_table.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ function Table:addClass(class)
return self
end

---@param injector WidgetInjector?
---@param props {injector: WidgetInjector?}
---@return {[1]: Html}
function Table:make(injector)
function Table:make(props)
local displayTable = mw.html.create('div'):addClass('csstable-widget')
displayTable:css{
['grid-template-columns'] = 'repeat(' .. (self.columns or self:_getMaxCells()) .. ', auto)',
Expand All @@ -64,7 +64,7 @@ function Table:make(injector)
displayTable:css(self.css)

for _, row in ipairs(self.rows) do
for _, node in ipairs(WidgetFactory.work(row, injector)) do
for _, node in ipairs(WidgetFactory.work(row, props.injector)) do
displayTable:node(node)
end
end
Expand Down
4 changes: 2 additions & 2 deletions components/widget/widget_table_cell.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ function TableCell:addCss(key, value)
return self
end

---@param injector WidgetInjector?
---@param props {injector: WidgetInjector?}
---@return {[1]: Html}
function TableCell:make(injector)
function TableCell:make(props)
local cell = mw.html.create('div'):addClass('csstable-widget-cell')
cell:css{
['grid-row'] = self.rowSpan and 'span ' .. self.rowSpan or nil,
Expand Down
4 changes: 2 additions & 2 deletions components/widget/widget_table_cell_new.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ local TableCell = Class.new(
end
)

---@param injector WidgetInjector?
---@param props {injector: WidgetInjector?}
---@return {[1]: Html}
function TableCell:make(injector)
function TableCell:make(props)
local cell = mw.html.create(self.isHeader and 'th' or 'td')
cell:attr('colspan', self.colSpan)
cell:attr('rowspan', self.rowSpan)
Expand Down
6 changes: 3 additions & 3 deletions components/widget/widget_table_new.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ local Table = Class.new(
end
)

---@param injector WidgetInjector?
---@param props {injector: WidgetInjector?}
---@return {[1]: Html}
function Table:make(injector)
function Table:make(props)
local wrapper = mw.html.create('div'):addClass('table-responsive')
local output = mw.html.create('table'):addClass('wikitable')

Expand All @@ -44,7 +44,7 @@ function Table:make(injector)
output:css(self.css)

Array.forEach(self.children, function(child)
Array.forEach(WidgetFactory.work(child, injector), FnUtil.curry(output.node, output))
Array.forEach(WidgetFactory.work(child, props.injector), FnUtil.curry(output.node, output))
end)

wrapper:node(output)
Expand Down
6 changes: 3 additions & 3 deletions components/widget/widget_table_row.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ function TableRow:getCellCount()
return #self.cells
end

---@param injector WidgetInjector?
---@param props {injector: WidgetInjector?}
---@return {[1]: Html}
function TableRow:make(injector)
function TableRow:make(props)
local row = mw.html.create('div'):addClass('csstable-widget-row')

for _, class in ipairs(self.classes) do
Expand All @@ -70,7 +70,7 @@ function TableRow:make(injector)
row:css(self.css)

for _, cell in ipairs(self.cells) do
for _, node in ipairs(WidgetFactory.work(cell, injector)) do
for _, node in ipairs(WidgetFactory.work(cell, props.injector)) do
row:node(node)
end
end
Expand Down
6 changes: 3 additions & 3 deletions components/widget/widget_table_row_new.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ local TableRow = Class.new(
end
)

---@param injector WidgetInjector?
---@param props {injector: WidgetInjector?}
---@return {[1]: Html}
function TableRow:make(injector)
function TableRow:make(props)
local row = mw.html.create('tr')

Array.forEach(self.classes, FnUtil.curry(row.addClass, row))

row:css(self.css)

Array.forEach(self.children, function(child)
Array.forEach(WidgetFactory.work(child, injector), FnUtil.curry(row.node, row))
Array.forEach(WidgetFactory.work(child, props.injector), FnUtil.curry(row.node, row))
end)

return {row}
Expand Down

0 comments on commit 69c5036

Please sign in to comment.