Skip to content

Commit

Permalink
feat: [ANDROAPP-6693] multiplatform resources code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
andresmr committed Jan 13, 2025
1 parent 549e4e3 commit 3b8e884
Show file tree
Hide file tree
Showing 28 changed files with 105 additions and 67 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hisp.dhis.mobile.ui.designsystem.component.table.model
package org.hisp.dhis.mobile.ui.designsystem.component.table.model.internal

/**
* Data class representing the measures of a table header.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package org.hisp.dhis.mobile.ui.designsystem.component.table.model
package org.hisp.dhis.mobile.ui.designsystem.component.table.model.internal

import androidx.compose.foundation.layout.PaddingValues
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.CellStyle
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.TableHeaderCell
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.TableDimensions
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.semantics.HEADER_CELL
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.CellStyle
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.semantics.HEADER_CELL

/**
* Data class representing the UI state of an item column header in a table.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package org.hisp.dhis.mobile.ui.designsystem.component.table.model
package org.hisp.dhis.mobile.ui.designsystem.component.table.model.internal

import androidx.compose.ui.unit.Dp
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.CellStyle
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.RowHeader
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.TableDialogModel
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.CellStyle

/**
* Data class representing the UI state of an item header in a table.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hisp.dhis.mobile.ui.designsystem.component.table.model
package org.hisp.dhis.mobile.ui.designsystem.component.table.model.internal

import androidx.compose.ui.geometry.Offset

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hisp.dhis.mobile.ui.designsystem.component.table.model
package org.hisp.dhis.mobile.ui.designsystem.component.table.model.internal

/**
* Data class representing the UI state of the table corner.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hisp.dhis.mobile.ui.designsystem.component.table.model.extensions
package org.hisp.dhis.mobile.ui.designsystem.component.table.model.internal.extensions

import org.hisp.dhis.mobile.ui.designsystem.component.table.model.TableModel

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalDensity
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.ResizingCell
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.TableCornerUiState
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.TableModel
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.internal.ResizingCell
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.internal.TableCornerUiState
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.TableTheme.tableSelection
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.compositions.LocalInteraction
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.compositions.LocalTableResizeActions
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.Table
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.TableHeaderRow
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.TableItemRow
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.VerticalResizingView
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.styleForColumnHeader
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.styleForRowHeader

/**
* Composable function to display a data table.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
Expand All @@ -11,6 +11,7 @@ import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Color
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.LocalTableDimensions

/**
* Composable function to display a cell with a legend color.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal

import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.LocalTableColors
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.TableColors
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.TableTheme

internal sealed class CellStyle {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal

import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
Expand All @@ -14,6 +14,7 @@ import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.dp
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.TableTheme

// TODO review dividers
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
Expand All @@ -18,11 +18,14 @@ import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.zIndex
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.ItemColumnHeaderUiState
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.semantics.columnBackground
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.semantics.columnIndexHeader
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.semantics.rowIndexHeader
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.semantics.tableIdColumnHeader
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.internal.ItemColumnHeaderUiState
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.LocalTableSelection
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.TableSelection
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.TableTheme
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.semantics.columnBackground
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.semantics.columnIndexHeader
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.semantics.rowIndexHeader
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.semantics.tableIdColumnHeader

/**
* Composable function to display a header cell.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
Expand All @@ -22,13 +22,16 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.style.TextOverflow
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.ItemHeaderUiState
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.TableDialogModel
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.semantics.INFO_ICON
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.semantics.infoIconId
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.semantics.rowBackground
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.semantics.rowIndexSemantic
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.semantics.tableIdSemantic
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.internal.ItemHeaderUiState
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.LocalTableSelection
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.TableSelection
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.TableTheme
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.semantics.INFO_ICON
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.semantics.infoIconId
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.semantics.rowBackground
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.semantics.rowIndexSemantic
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.semantics.tableIdSemantic
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal

import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.horizontalScroll
Expand All @@ -11,7 +11,8 @@ import androidx.compose.ui.Modifier
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.DropdownOption
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.TableCell
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.TableHeader
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.semantics.CELL_TEST_TAG
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.TableTheme
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.semantics.CELL_TEST_TAG

/**
* Composable function to display item values in a table row.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal

import androidx.compose.runtime.Composable
import org.hisp.dhis.mobile.ui.designsystem.component.CheckBoxData
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal

import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
Expand Down Expand Up @@ -31,10 +31,14 @@ import org.hisp.dhis.mobile.ui.designsystem.component.internal.Keyboard
import org.hisp.dhis.mobile.ui.designsystem.component.internal.keyboardAsState
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.TableModel
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.TableRowModel
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.extensions.areAllValuesEmpty
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.internal.extensions.areAllValuesEmpty
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.LocalTableDimensions
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.LocalTableSelection
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.TableSelection
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.TableTheme
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.TableTheme.tableSelection
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.compositions.LocalTableResizeActions
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.extensions.fixedStickyHeader
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.extensions.fixedStickyHeader

/**
* Composable function to display a table.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
Expand All @@ -14,6 +14,7 @@ import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.TableTheme

/**
* Composable function to display table actions with a title and action icons.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal

import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.clickable
Expand Down Expand Up @@ -39,19 +39,23 @@ import androidx.compose.ui.unit.dp
import kotlinx.coroutines.launch
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.DropdownOption
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.TableCell
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.LocalTableColors
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.LocalTableSelection
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.TableSelection
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.TableTheme
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.compositions.LocalCurrentCellValue
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.compositions.LocalInteraction
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.compositions.LocalUpdatingCell
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.extensions.isNumeric
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.modifiers.cellBorder
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.semantics.CELL_ERROR_UNDERLINE_TEST_TAG
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.semantics.CELL_TEST_TAG
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.semantics.CELL_VALUE_TEST_TAG
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.semantics.MANDATORY_ICON_TEST_TAG
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.semantics.cellSelected
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.semantics.hasError
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.semantics.isBlocked
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.semantics.rowBackground
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.extensions.isNumeric
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.modifiers.cellBorder
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.semantics.CELL_ERROR_UNDERLINE_TEST_TAG
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.semantics.CELL_TEST_TAG
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.semantics.CELL_VALUE_TEST_TAG
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.semantics.MANDATORY_ICON_TEST_TAG
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.semantics.cellSelected
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.semantics.hasError
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.semantics.isBlocked
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.semantics.rowBackground

/**
* Composable function to display a table cell.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
Expand All @@ -11,8 +11,12 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.dp
import androidx.compose.ui.zIndex
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.TableCornerUiState
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.modifiers.cornerBackground
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.internal.TableCornerUiState
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.LocalTableColors
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.LocalTableSelection
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.TableSelection
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.TableTheme
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal.modifiers.cornerBackground

/**
* Composable function to display the table corner.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal

import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.horizontalScroll
Expand All @@ -11,11 +11,11 @@ import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.zIndex
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.HeaderMeasures
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.ItemColumnHeaderUiState
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.ResizingCell
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.TableHeader
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.TableHeaderCell
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.internal.HeaderMeasures
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.internal.ItemColumnHeaderUiState
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.internal.ResizingCell
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.TableTheme.dimensions

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui
package org.hisp.dhis.mobile.ui.designsystem.component.table.ui.internal

import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.layout.Column
Expand All @@ -13,9 +13,10 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.compose.ui.zIndex
import org.hisp.dhis.mobile.ui.designsystem.component.IconButton
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.ResizingCell
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.TableCornerUiState
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.TableModel
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.internal.ResizingCell
import org.hisp.dhis.mobile.ui.designsystem.component.table.model.internal.TableCornerUiState
import org.hisp.dhis.mobile.ui.designsystem.component.table.ui.TableTheme

/**
* Composable function to display the table header row.
Expand Down
Loading

0 comments on commit 3b8e884

Please sign in to comment.