feat(dashboard,types,js-sdk,ui): Add missing Price List features (#7856)

**What**
- Adds missing features to Price List domain
- Adds `StackedFocusModal` and `StackedDrawer` components that should replace SplitView across the project.
- Add Footer to FocusModal
- Adds missing js-sdk functions and types

**Note**
The DatePickers in the PriceLists forms do not work as intended atm. The component is broken, and needs to be fixed. I am working on a fix, but choose to move that work into a separate branch, to prevent this PR from getting bigger then it already is. Will update once the fixes have been merged.
This commit is contained in:
Kasper Fabricius Kristensen
2024-06-28 16:08:23 +02:00
committed by GitHub
parent 9f3998393b
commit c1740218e9
295 changed files with 4488 additions and 2350 deletions
@@ -7,11 +7,11 @@ import {
useState,
} from "react"
import { Adjustments } from "@medusajs/icons"
import { Button, DropdownMenu, clx } from "@medusajs/ui"
import {
CellContext,
ColumnDef,
OnChangeFn,
Row,
VisibilityState,
flexRender,
@@ -41,7 +41,7 @@ interface DataGridRootProps<
data?: TData[]
columns: ColumnDef<TData>[]
state: UseFormReturn<TFieldValues>
getSubRows?: (row: TData) => TData[]
getSubRows?: (row: TData) => TData[] | undefined
}
const ARROW_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]
@@ -93,13 +93,6 @@ export const DataGridRoot = <
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({})
const onColumnVisibilityChange: OnChangeFn<VisibilityState> = useCallback(
(next) => {
const update = typeof next === "function" ? next(columnVisibility) : next
},
[columnVisibility]
)
const grid = useReactTable({
data: data,
columns,
@@ -663,7 +656,8 @@ export const DataGridRoot = <
<DropdownMenu>
<DropdownMenu.Trigger asChild>
<Button size="small" variant="secondary">
Columns
<Adjustments />
Edit columns
</Button>
</DropdownMenu.Trigger>
<DropdownMenu.Content>
@@ -799,6 +793,7 @@ export const DataGridRoot = <
{flexRender(cell.column.columnDef.cell, {
...cell.getContext(),
columnIndex,
rowIndex: virtualRow.index,
} as CellContext<TData, any>)}
{isAnchor && (
<div
@@ -29,11 +29,14 @@ export const useDataGridCell = <TData, TValue>({
field,
context,
}: UseDataGridCellProps<TData, TValue>) => {
const { row, columnIndex } = context as DataGridCellContext<TData, TValue>
const { rowIndex, columnIndex } = context as DataGridCellContext<
TData,
TValue
>
const coords: CellCoords = useMemo(
() => ({ row: row.index, col: columnIndex }),
[row, columnIndex]
() => ({ row: rowIndex, col: columnIndex }),
[rowIndex, columnIndex]
)
const id = generateCellId(coords)
@@ -22,6 +22,10 @@ export interface DataGridCellContext<TData = unknown, TValue = any>
* The index of the column in the grid.
*/
columnIndex: number
/**
* The index of the row in the grid.
*/
rowIndex: number
}
export interface DataGridCellContainerProps {