Files
metabuilder/qml/components/data-display/CTable.qml
johndoe6345789 c406b8df96 refactor: Reorganize FakeMUI by implementation type
Move FakeMUI content to appropriate root-level folders by implementation:

**React Components → components/fakemui/**
- 537 components (inputs, surfaces, layout, data-display, feedback,
  navigation, utils, atoms, lab, x, email, workflows)
- 416 SVG icons
- Full barrel exports in components/fakemui/index.ts

**QML Components → qml/**
- 104 Material Design 3 components (11 categories)
- 7 hybrid application views
- 8 desktop widgets
- qmldir module registration

**Python Bindings → python/fakemui/**
- 15 PyQt6 modules (120+ components)
- Full Python package structure with pyproject.toml

**SCSS/Styles → fakemui/** (renamed purpose)
- scss/ - Material Design 3 stylesheets
- styles/ - Component SCSS modules
- src/utils/ - Accessibility utilities
- index.ts now re-exports from components/fakemui/

This separation allows:
- React: import { Button } from '@metabuilder/components/fakemui'
- QML: import QmlComponents 1.0
- Python: from fakemui import Button, Card
- Backward compat: import { Button } from '@metabuilder/fakemui'

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 12:59:24 +00:00

122 lines
4.3 KiB
QML

import QtQuick
import QtQuick.Layouts
/**
* CTable.qml - Data table (mirrors _table.scss)
* Simple table with headers and rows
*/
Rectangle {
id: root
property var headers: [] // Array of header strings
property var rows: [] // Array of row arrays
property var columnWidths: [] // Optional column width ratios
property bool striped: true
property bool bordered: true
color: "transparent"
radius: StyleVariables.radiusSm
border.width: bordered ? 1 : 0
border.color: Theme.divider
implicitWidth: parent ? parent.width : 400
implicitHeight: tableCol.implicitHeight
clip: true
ColumnLayout {
id: tableCol
anchors.fill: parent
spacing: 0
// Header row
Rectangle {
Layout.fillWidth: true
implicitHeight: headerRow.implicitHeight
color: Theme.mode === "dark" ? Qt.rgba(255, 255, 255, 0.08) : Qt.rgba(0, 0, 0, 0.04)
RowLayout {
id: headerRow
anchors.fill: parent
spacing: 0
Repeater {
model: root.headers
Rectangle {
Layout.fillWidth: root.columnWidths.length === 0
Layout.preferredWidth: root.columnWidths[index] || -1
implicitHeight: headerText.implicitHeight + StyleVariables.spacingSm * 2
color: "transparent"
border.width: root.bordered && index > 0 ? 1 : 0
border.color: Theme.divider
Text {
id: headerText
anchors.fill: parent
anchors.margins: StyleVariables.spacingSm
text: modelData
color: Theme.onSurface
font.pixelSize: StyleVariables.fontSizeSm
font.weight: Font.DemiBold
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
}
}
}
}
// Data rows
Repeater {
model: root.rows
Rectangle {
Layout.fillWidth: true
implicitHeight: dataRow.implicitHeight
color: root.striped && index % 2 === 1
? (Theme.mode === "dark" ? Qt.rgba(255, 255, 255, 0.02) : Qt.rgba(0, 0, 0, 0.02))
: "transparent"
// Top border
Rectangle {
width: parent.width
height: root.bordered ? 1 : 0
color: Theme.divider
}
RowLayout {
id: dataRow
anchors.fill: parent
anchors.topMargin: root.bordered ? 1 : 0
spacing: 0
Repeater {
model: modelData
Rectangle {
Layout.fillWidth: root.columnWidths.length === 0
Layout.preferredWidth: root.columnWidths[index] || -1
implicitHeight: cellText.implicitHeight + StyleVariables.spacingSm * 2
color: "transparent"
border.width: root.bordered && index > 0 ? 1 : 0
border.color: Theme.divider
Text {
id: cellText
anchors.fill: parent
anchors.margins: StyleVariables.spacingSm
text: modelData
color: Theme.onSurface
font.pixelSize: StyleVariables.fontSizeSm
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
}
}
}
}
}
}
}