mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 22:04:56 +00:00
- Added type annotations and class definitions in the dashboard layout, stats, and data table modules for improved type safety and documentation. - Introduced new classes for UI components, props, and configuration in the form builder, navigation menu, notification center, and UI dialogs packages. - Implemented detailed type definitions for actions, fields, and pagination components to streamline usage and enhance clarity. - Updated initialization functions in multiple packages to include versioning and installation context. - Improved structure and readability of the codebase by organizing and documenting component properties and methods.
53 lines
1.5 KiB
Lua
53 lines
1.5 KiB
Lua
-- User management dialog
|
|
|
|
---@class UserDialog
|
|
local M = {}
|
|
|
|
---@class User
|
|
---@field username string
|
|
---@field email string
|
|
---@field role string
|
|
---@field active boolean
|
|
|
|
---@class UIComponent
|
|
---@field type string
|
|
---@field props? table
|
|
---@field children? table
|
|
|
|
---@return UIComponent
|
|
function M.render_create()
|
|
return {
|
|
type = "dialog",
|
|
props = {
|
|
title = "Create User",
|
|
size = "medium"
|
|
},
|
|
children = {
|
|
{ type = "text_field", props = { label = "Username", name = "username", required = true } },
|
|
{ type = "text_field", props = { label = "Email", name = "email", type = "email", required = true } },
|
|
{ type = "password_field", props = { label = "Password", name = "password", required = true } },
|
|
{ type = "select", props = { label = "Role", name = "role", options = {"user", "admin"} } }
|
|
}
|
|
}
|
|
end
|
|
|
|
---@param user User
|
|
---@return UIComponent
|
|
function M.render_edit(user)
|
|
return {
|
|
type = "dialog",
|
|
props = {
|
|
title = "Edit User",
|
|
size = "medium"
|
|
},
|
|
children = {
|
|
{ type = "text_field", props = { label = "Username", name = "username", value = user.username } },
|
|
{ type = "text_field", props = { label = "Email", name = "email", value = user.email } },
|
|
{ type = "select", props = { label = "Role", name = "role", value = user.role, options = {"user", "admin"} } },
|
|
{ type = "checkbox", props = { label = "Active", name = "active", checked = user.active } }
|
|
}
|
|
}
|
|
end
|
|
|
|
return M
|