@fluentui/react-table 9.0.0-alpha.11 → 9.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +191 -1
- package/CHANGELOG.md +44 -2
- package/dist/index.d.ts +108 -58
- package/lib/components/DataGrid/DataGrid.types.js.map +1 -1
- package/lib/components/DataGrid/useDataGrid.js +27 -5
- package/lib/components/DataGrid/useDataGrid.js.map +1 -1
- package/lib/components/DataGrid/useDataGridContextValues.js +4 -1
- package/lib/components/DataGrid/useDataGridContextValues.js.map +1 -1
- package/lib/components/DataGridBody/useDataGridBody.js +12 -2
- package/lib/components/DataGridBody/useDataGridBody.js.map +1 -1
- package/lib/components/DataGridHeaderCell/useDataGridHeaderCell.js +24 -2
- package/lib/components/DataGridHeaderCell/useDataGridHeaderCell.js.map +1 -1
- package/lib/components/DataGridRow/DataGridRow.types.js.map +1 -1
- package/lib/components/DataGridRow/renderDataGridRow.js +9 -2
- package/lib/components/DataGridRow/renderDataGridRow.js.map +1 -1
- package/lib/components/DataGridRow/useDataGridRow.js +57 -4
- package/lib/components/DataGridRow/useDataGridRow.js.map +1 -1
- package/lib/components/DataGridRow/useDataGridRowStyles.js +7 -1
- package/lib/components/DataGridRow/useDataGridRowStyles.js.map +1 -1
- package/lib/components/DataGridSelectionCell/useDataGridSelectionCell.js +36 -1
- package/lib/components/DataGridSelectionCell/useDataGridSelectionCell.js.map +1 -1
- package/lib/components/Table/Table.types.js.map +1 -1
- package/lib/components/TableCell/TableCell.types.js.map +1 -1
- package/lib/components/TableCell/useTableCell.js +4 -2
- package/lib/components/TableCell/useTableCell.js.map +1 -1
- package/lib/components/TableCell/useTableCellStyles.js +31 -5
- package/lib/components/TableCell/useTableCellStyles.js.map +1 -1
- package/lib/components/TableCellActions/useTableCellActions.js +2 -3
- package/lib/components/TableCellActions/useTableCellActions.js.map +1 -1
- package/lib/components/TableCellActions/useTableCellActionsStyles.js +2 -8
- package/lib/components/TableCellActions/useTableCellActionsStyles.js.map +1 -1
- package/lib/components/TableCellLayout/TableCellLayout.types.js.map +1 -1
- package/lib/components/TableCellLayout/useTableCellLayout.js +3 -2
- package/lib/components/TableCellLayout/useTableCellLayout.js.map +1 -1
- package/lib/components/TableCellLayout/useTableCellLayoutStyles.js +20 -6
- package/lib/components/TableCellLayout/useTableCellLayoutStyles.js.map +1 -1
- package/lib/components/TableHeader/useTableHeader.js +1 -8
- package/lib/components/TableHeader/useTableHeader.js.map +1 -1
- package/lib/components/TableHeaderCell/TableHeaderCell.types.js.map +1 -1
- package/lib/components/TableHeaderCell/useTableHeaderCell.js +6 -2
- package/lib/components/TableHeaderCell/useTableHeaderCell.js.map +1 -1
- package/lib/components/TableHeaderCell/useTableHeaderCellStyles.js +6 -5
- package/lib/components/TableHeaderCell/useTableHeaderCellStyles.js.map +1 -1
- package/lib/components/TableRow/TableRow.types.js.map +1 -1
- package/lib/components/TableRow/useTableRow.js +3 -2
- package/lib/components/TableRow/useTableRow.js.map +1 -1
- package/lib/components/TableRow/useTableRowStyles.js +19 -30
- package/lib/components/TableRow/useTableRowStyles.js.map +1 -1
- package/lib/components/TableSelectionCell/TableSelectionCell.types.js.map +1 -1
- package/lib/components/TableSelectionCell/useTableSelectionCellStyles.js +3 -5
- package/lib/components/TableSelectionCell/useTableSelectionCellStyles.js.map +1 -1
- package/lib/contexts/columnIdContext.js +10 -0
- package/lib/contexts/columnIdContext.js.map +1 -0
- package/lib/contexts/dataGridContext.js +3 -0
- package/lib/contexts/dataGridContext.js.map +1 -1
- package/lib/contexts/rowIdContext.js +10 -0
- package/lib/contexts/rowIdContext.js.map +1 -0
- package/lib/hooks/index.js +3 -3
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/selectionManager.js +16 -16
- package/lib/hooks/selectionManager.js.map +1 -1
- package/lib/hooks/types.js.map +1 -1
- package/lib/hooks/{useTable.js → useTableFeatures.js} +4 -4
- package/lib/hooks/useTableFeatures.js.map +1 -0
- package/lib/hooks/{useSelection.js → useTableSelection.js} +16 -12
- package/lib/hooks/useTableSelection.js.map +1 -0
- package/lib/hooks/{useSort.js → useTableSort.js} +8 -8
- package/lib/hooks/useTableSort.js.map +1 -0
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/components/DataGrid/useDataGrid.js +27 -5
- package/lib-commonjs/components/DataGrid/useDataGrid.js.map +1 -1
- package/lib-commonjs/components/DataGrid/useDataGridContextValues.js +4 -1
- package/lib-commonjs/components/DataGrid/useDataGridContextValues.js.map +1 -1
- package/lib-commonjs/components/DataGridBody/useDataGridBody.js +15 -2
- package/lib-commonjs/components/DataGridBody/useDataGridBody.js.map +1 -1
- package/lib-commonjs/components/DataGridHeaderCell/useDataGridHeaderCell.js +28 -2
- package/lib-commonjs/components/DataGridHeaderCell/useDataGridHeaderCell.js.map +1 -1
- package/lib-commonjs/components/DataGridRow/renderDataGridRow.js +10 -2
- package/lib-commonjs/components/DataGridRow/renderDataGridRow.js.map +1 -1
- package/lib-commonjs/components/DataGridRow/useDataGridRow.js +64 -4
- package/lib-commonjs/components/DataGridRow/useDataGridRow.js.map +1 -1
- package/lib-commonjs/components/DataGridRow/useDataGridRowStyles.js +7 -1
- package/lib-commonjs/components/DataGridRow/useDataGridRowStyles.js.map +1 -1
- package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCell.js +40 -1
- package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCell.js.map +1 -1
- package/lib-commonjs/components/TableCell/useTableCell.js +4 -2
- package/lib-commonjs/components/TableCell/useTableCell.js.map +1 -1
- package/lib-commonjs/components/TableCell/useTableCellStyles.js +32 -5
- package/lib-commonjs/components/TableCell/useTableCellStyles.js.map +1 -1
- package/lib-commonjs/components/TableCellActions/useTableCellActions.js +1 -3
- package/lib-commonjs/components/TableCellActions/useTableCellActions.js.map +1 -1
- package/lib-commonjs/components/TableCellActions/useTableCellActionsStyles.js +2 -9
- package/lib-commonjs/components/TableCellActions/useTableCellActionsStyles.js.map +1 -1
- package/lib-commonjs/components/TableCellLayout/useTableCellLayout.js +3 -2
- package/lib-commonjs/components/TableCellLayout/useTableCellLayout.js.map +1 -1
- package/lib-commonjs/components/TableCellLayout/useTableCellLayoutStyles.js +21 -6
- package/lib-commonjs/components/TableCellLayout/useTableCellLayoutStyles.js.map +1 -1
- package/lib-commonjs/components/TableHeader/useTableHeader.js +1 -9
- package/lib-commonjs/components/TableHeader/useTableHeader.js.map +1 -1
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCell.js +6 -2
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCell.js.map +1 -1
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCellStyles.js +6 -5
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCellStyles.js.map +1 -1
- package/lib-commonjs/components/TableRow/useTableRow.js +2 -1
- package/lib-commonjs/components/TableRow/useTableRow.js.map +1 -1
- package/lib-commonjs/components/TableRow/useTableRowStyles.js +19 -30
- package/lib-commonjs/components/TableRow/useTableRowStyles.js.map +1 -1
- package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.js +3 -5
- package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.js.map +1 -1
- package/lib-commonjs/contexts/columnIdContext.js +21 -0
- package/lib-commonjs/contexts/columnIdContext.js.map +1 -0
- package/lib-commonjs/contexts/dataGridContext.js +3 -0
- package/lib-commonjs/contexts/dataGridContext.js.map +1 -1
- package/lib-commonjs/contexts/rowIdContext.js +21 -0
- package/lib-commonjs/contexts/rowIdContext.js.map +1 -0
- package/lib-commonjs/hooks/index.js +3 -3
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/selectionManager.js +16 -16
- package/lib-commonjs/hooks/selectionManager.js.map +1 -1
- package/lib-commonjs/hooks/{useTable.js → useTableFeatures.js} +10 -10
- package/lib-commonjs/hooks/useTableFeatures.js.map +1 -0
- package/lib-commonjs/hooks/{useSelection.js → useTableSelection.js} +19 -15
- package/lib-commonjs/hooks/useTableSelection.js.map +1 -0
- package/lib-commonjs/hooks/{useSort.js → useTableSort.js} +11 -11
- package/lib-commonjs/hooks/useTableSort.js.map +1 -0
- package/lib-commonjs/index.js +7 -7
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +9 -9
- package/lib/hooks/useSelection.js.map +0 -1
- package/lib/hooks/useSort.js.map +0 -1
- package/lib/hooks/useTable.js.map +0 -1
- package/lib-commonjs/hooks/useSelection.js.map +0 -1
- package/lib-commonjs/hooks/useSort.js.map +0 -1
- package/lib-commonjs/hooks/useTable.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGrid/useDataGrid.ts"],"names":[],"mappings":"AACA,SAAS,uBAAT,QAAwC,yBAAxC;AAEA,SAAS,iBAAT,QAAkC,mBAAlC;AACA,SAAS,
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGrid/useDataGrid.ts"],"names":[],"mappings":"AACA,SAAS,uBAAT,QAAwC,yBAAxC;AAEA,SAAS,iBAAT,QAAkC,mBAAlC;AACA,SAAS,gBAAT,EAA2B,YAA3B,EAAyC,iBAAzC,QAAkE,aAAlE;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,oBAAoB,GAAG,CAAC,KAAD,EAAuB,GAAvB,KAAqE;EACvG,MAAM;IACJ,KADI;IAEJ,OAFI;IAGJ,SAAS,GAAG,MAHR;IAIJ,aAJI;IAKJ,YALI;IAMJ,iBANI;IAOJ,gBAPI;IAQJ,SARI;IASJ,aATI;IAUJ,oBAVI;IAWJ,eAAe,GAAG,KAXd;IAYJ,mBAAmB,GAAG;EAZlB,IAaF,KAbJ;EAeA,MAAM,SAAS,GAAG,SAAS,KAAK,MAAhC;EACA,MAAM,eAAe,GAAG,uBAAuB,CAAC;IAAE,IAAI,EAAE;EAAR,CAAD,CAA/C;EAEA,MAAM,UAAU,GAAG,gBAAgB,CAAC;IAAE,KAAF;IAAS;EAAT,CAAD,EAAqB,CACtD,YAAY,CAAC;IACX,gBADW;IAEX,SAFW;IAGX;EAHW,CAAD,CAD0C,EAMtD,iBAAiB,CAAC;IAChB,oBADgB;IAEhB,aAFgB;IAGhB,iBAHgB;IAIhB,aAAa,EAAE,aAAa,KAAA,IAAb,IAAA,aAAa,KAAA,KAAA,CAAb,GAAA,aAAA,GAAiB;EAJhB,CAAD,CANqC,CAArB,CAAnC;EAcA,MAAM,cAAc,GAAG,iBAAiB,CACtC;IAAE,IAAI,EAAE,MAAR;IAAgB,EAAE,EAAE,KAApB;IAA2B,gBAAgB,EAAE,IAA7C;IAAmD,IAAI,SAAS,IAAI,eAAjB,CAAnD;IAAsF,GAAG;EAAzF,CADsC,EAEtC,GAFsC,CAAxC;EAKA,OAAO,EACL,GAAG,cADE;IAEL,SAFK;IAGL,UAHK;IAIL,cAAc,EAAE,CAAC,CAAC,aAJb;IAKL,eALK;IAML;EANK,CAAP;AAQD,CA9CM","sourcesContent":["import * as React from 'react';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport type { DataGridProps, DataGridState } from './DataGrid.types';\nimport { useTable_unstable } from '../Table/useTable';\nimport { useTableFeatures, useTableSort, useTableSelection } from '../../hooks';\n\n/**\n * Create the state required to render DataGrid.\n *\n * The returned state can be modified with hooks such as useDataGridStyles_unstable,\n * before being passed to renderDataGrid_unstable.\n *\n * @param props - props from this instance of DataGrid\n * @param ref - reference to root HTMLElement of DataGrid\n */\nexport const useDataGrid_unstable = (props: DataGridProps, ref: React.Ref<HTMLElement>): DataGridState => {\n const {\n items,\n columns,\n focusMode = 'none',\n selectionMode,\n onSortChange,\n onSelectionChange,\n defaultSortState,\n sortState,\n selectedItems,\n defaultSelectedItems,\n subtleSelection = false,\n selectionAppearance = 'brand',\n } = props;\n\n const navigable = focusMode !== 'none';\n const keyboardNavAttr = useArrowNavigationGroup({ axis: 'grid' });\n\n const tableState = useTableFeatures({ items, columns }, [\n useTableSort({\n defaultSortState,\n sortState,\n onSortChange,\n }),\n useTableSelection({\n defaultSelectedItems,\n selectedItems,\n onSelectionChange,\n selectionMode: selectionMode ?? 'multiselect',\n }),\n ]);\n\n const baseTableState = useTable_unstable(\n { role: 'grid', as: 'div', noNativeElements: true, ...(navigable && keyboardNavAttr), ...props },\n ref,\n );\n\n return {\n ...baseTableState,\n focusMode,\n tableState,\n selectableRows: !!selectionMode,\n subtleSelection,\n selectionAppearance,\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -3,7 +3,10 @@ export function useDataGridContextValues_unstable(state) {
|
|
|
3
3
|
const tableContextValues = useTableContextValues_unstable(state);
|
|
4
4
|
return { ...tableContextValues,
|
|
5
5
|
dataGrid: { ...state.tableState,
|
|
6
|
-
focusMode: state.focusMode
|
|
6
|
+
focusMode: state.focusMode,
|
|
7
|
+
selectableRows: state.selectableRows,
|
|
8
|
+
subtleSelection: state.subtleSelection,
|
|
9
|
+
selectionAppearance: state.selectionAppearance
|
|
7
10
|
}
|
|
8
11
|
};
|
|
9
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGrid/useDataGridContextValues.ts"],"names":[],"mappings":"AAAA,SAAS,8BAAT,QAA+C,gCAA/C;AAGA,OAAM,SAAU,iCAAV,CAA4C,KAA5C,EAAgE;EACpE,MAAM,kBAAkB,GAAG,8BAA8B,CAAC,KAAD,CAAzD;EACA,OAAO,EACL,GAAG,kBADE;IAEL,QAAQ,EAAE,EACR,GAAG,KAAK,CAAC,UADD;MAER,SAAS,EAAE,KAAK,CAAC;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGrid/useDataGridContextValues.ts"],"names":[],"mappings":"AAAA,SAAS,8BAAT,QAA+C,gCAA/C;AAGA,OAAM,SAAU,iCAAV,CAA4C,KAA5C,EAAgE;EACpE,MAAM,kBAAkB,GAAG,8BAA8B,CAAC,KAAD,CAAzD;EACA,OAAO,EACL,GAAG,kBADE;IAEL,QAAQ,EAAE,EACR,GAAG,KAAK,CAAC,UADD;MAER,SAAS,EAAE,KAAK,CAAC,SAFT;MAGR,cAAc,EAAE,KAAK,CAAC,cAHd;MAIR,eAAe,EAAE,KAAK,CAAC,eAJf;MAKR,mBAAmB,EAAE,KAAK,CAAC;IALnB;EAFL,CAAP;AAUD","sourcesContent":["import { useTableContextValues_unstable } from '../Table/useTableContextValues';\nimport { DataGridContextValues, DataGridState } from './DataGrid.types';\n\nexport function useDataGridContextValues_unstable(state: DataGridState): DataGridContextValues {\n const tableContextValues = useTableContextValues_unstable(state);\n return {\n ...tableContextValues,\n dataGrid: {\n ...state.tableState,\n focusMode: state.focusMode,\n selectableRows: state.selectableRows,\n subtleSelection: state.subtleSelection,\n selectionAppearance: state.selectionAppearance,\n },\n };\n}\n"],"sourceRoot":"../src/"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import { useTableBody_unstable } from '../TableBody/useTableBody';
|
|
2
3
|
import { useDataGridContext_unstable } from '../../contexts/dataGridContext';
|
|
4
|
+
import { useTableContext } from '../../contexts/tableContext';
|
|
5
|
+
import { RowIdContextProvider } from '../../contexts/rowIdContext';
|
|
3
6
|
/**
|
|
4
7
|
* Create the state required to render DataGridBody.
|
|
5
8
|
*
|
|
@@ -11,12 +14,19 @@ import { useDataGridContext_unstable } from '../../contexts/dataGridContext';
|
|
|
11
14
|
*/
|
|
12
15
|
|
|
13
16
|
export const useDataGridBody_unstable = (props, ref) => {
|
|
17
|
+
const {
|
|
18
|
+
sortable
|
|
19
|
+
} = useTableContext();
|
|
14
20
|
const getRows = useDataGridContext_unstable(ctx => ctx.getRows);
|
|
15
|
-
const
|
|
21
|
+
const sort = useDataGridContext_unstable(ctx => ctx.sort.sort);
|
|
22
|
+
const rows = sortable ? sort(getRows()) : getRows();
|
|
16
23
|
const {
|
|
17
24
|
children: renderRow
|
|
18
25
|
} = props;
|
|
19
|
-
const children = rows.map(row =>
|
|
26
|
+
const children = rows.map(row => /*#__PURE__*/React.createElement(RowIdContextProvider, {
|
|
27
|
+
key: row.rowId,
|
|
28
|
+
value: row.rowId
|
|
29
|
+
}, renderRow(row)));
|
|
20
30
|
return useTableBody_unstable({ ...props,
|
|
21
31
|
children,
|
|
22
32
|
as: 'div'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridBody/useDataGridBody.
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridBody/useDataGridBody.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAEA,SAAS,qBAAT,QAAsC,2BAAtC;AACA,SAAS,2BAAT,QAA4C,gCAA5C;AACA,SAAS,eAAT,QAAgC,6BAAhC;AACA,SAAS,oBAAT,QAAqC,6BAArC;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,wBAAwB,GAAG,CAAC,KAAD,EAA2B,GAA3B,KAA6E;EACnH,MAAM;IAAE;EAAF,IAAe,eAAe,EAApC;EACA,MAAM,OAAO,GAAG,2BAA2B,CAAC,GAAG,IAAI,GAAG,CAAC,OAAZ,CAA3C;EACA,MAAM,IAAI,GAAG,2BAA2B,CAAC,GAAG,IAAI,GAAG,CAAC,IAAJ,CAAS,IAAjB,CAAxC;EACA,MAAM,IAAI,GAAG,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAR,CAAP,GAAqB,OAAO,EAAjD;EAEA,MAAM;IAAE,QAAQ,EAAE;EAAZ,IAA0B,KAAhC;EACA,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAL,CAAS,GAAG,iBAC3B,KAAA,CAAA,aAAA,CAAC,oBAAD,EAAqB;IAAC,GAAG,EAAE,GAAG,CAAC,KAAV;IAAiB,KAAK,EAAE,GAAG,CAAC;EAA5B,CAArB,EACG,SAAS,CAAC,GAAD,CADZ,CADe,CAAjB;EAKA,OAAO,qBAAqB,CAAC,EAAE,GAAG,KAAL;IAAY,QAAZ;IAAsB,EAAE,EAAE;EAA1B,CAAD,EAAoC,GAApC,CAA5B;AACD,CAbM","sourcesContent":["import * as React from 'react';\nimport type { DataGridBodyProps, DataGridBodyState } from './DataGridBody.types';\nimport { useTableBody_unstable } from '../TableBody/useTableBody';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { useTableContext } from '../../contexts/tableContext';\nimport { RowIdContextProvider } from '../../contexts/rowIdContext';\n\n/**\n * Create the state required to render DataGridBody.\n *\n * The returned state can be modified with hooks such as useDataGridBodyStyles_unstable,\n * before being passed to renderDataGridBody_unstable.\n *\n * @param props - props from this instance of DataGridBody\n * @param ref - reference to root HTMLElement of DataGridBody\n */\nexport const useDataGridBody_unstable = (props: DataGridBodyProps, ref: React.Ref<HTMLElement>): DataGridBodyState => {\n const { sortable } = useTableContext();\n const getRows = useDataGridContext_unstable(ctx => ctx.getRows);\n const sort = useDataGridContext_unstable(ctx => ctx.sort.sort);\n const rows = sortable ? sort(getRows()) : getRows();\n\n const { children: renderRow } = props;\n const children = rows.map(row => (\n <RowIdContextProvider key={row.rowId} value={row.rowId}>\n {renderRow(row)}\n </RowIdContextProvider>\n ));\n return useTableBody_unstable({ ...props, children, as: 'div' }, ref);\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { useEventCallback } from '@fluentui/react-utilities';
|
|
1
2
|
import { useTableHeaderCell_unstable } from '../TableHeaderCell/useTableHeaderCell';
|
|
3
|
+
import { useDataGridContext_unstable } from '../../contexts/dataGridContext';
|
|
4
|
+
import { useColumnIdContext } from '../../contexts/columnIdContext';
|
|
5
|
+
import { useTableContext } from '../../contexts/tableContext';
|
|
2
6
|
/**
|
|
3
7
|
* Create the state required to render DataGridHeaderCell.
|
|
4
8
|
*
|
|
@@ -10,8 +14,26 @@ import { useTableHeaderCell_unstable } from '../TableHeaderCell/useTableHeaderCe
|
|
|
10
14
|
*/
|
|
11
15
|
|
|
12
16
|
export const useDataGridHeaderCell_unstable = (props, ref) => {
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
const columnId = useColumnIdContext();
|
|
18
|
+
const {
|
|
19
|
+
sortable
|
|
20
|
+
} = useTableContext();
|
|
21
|
+
const toggleColumnSort = useDataGridContext_unstable(ctx => ctx.sort.toggleColumnSort);
|
|
22
|
+
const sortDirection = useDataGridContext_unstable(ctx => sortable ? ctx.sort.getSortDirection(columnId) : undefined);
|
|
23
|
+
const onClick = useEventCallback(e => {
|
|
24
|
+
var _a;
|
|
25
|
+
|
|
26
|
+
if (sortable) {
|
|
27
|
+
toggleColumnSort(e, columnId);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
31
|
+
});
|
|
32
|
+
return useTableHeaderCell_unstable({
|
|
33
|
+
sortDirection,
|
|
34
|
+
as: 'div',
|
|
35
|
+
...props,
|
|
36
|
+
onClick
|
|
15
37
|
}, ref);
|
|
16
38
|
};
|
|
17
39
|
//# sourceMappingURL=useDataGridHeaderCell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridHeaderCell/useDataGridHeaderCell.ts"],"names":[],"mappings":"AAEA,SAAS,2BAAT,QAA4C,uCAA5C;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,8BAA8B,GAAG,CAC5C,KAD4C,EAE5C,GAF4C,KAGjB;EAC3B,
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridHeaderCell/useDataGridHeaderCell.ts"],"names":[],"mappings":"AACA,SAAS,gBAAT,QAAiC,2BAAjC;AAEA,SAAS,2BAAT,QAA4C,uCAA5C;AACA,SAAS,2BAAT,QAA4C,gCAA5C;AACA,SAAS,kBAAT,QAAmC,gCAAnC;AACA,SAAS,eAAT,QAAgC,6BAAhC;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,8BAA8B,GAAG,CAC5C,KAD4C,EAE5C,GAF4C,KAGjB;EAC3B,MAAM,QAAQ,GAAG,kBAAkB,EAAnC;EACA,MAAM;IAAE;EAAF,IAAe,eAAe,EAApC;EACA,MAAM,gBAAgB,GAAG,2BAA2B,CAAC,GAAG,IAAI,GAAG,CAAC,IAAJ,CAAS,gBAAjB,CAApD;EACA,MAAM,aAAa,GAAG,2BAA2B,CAAC,GAAG,IACnD,QAAQ,GAAG,GAAG,CAAC,IAAJ,CAAS,gBAAT,CAA0B,QAA1B,CAAH,GAAyC,SADF,CAAjD;EAGA,MAAM,OAAO,GAAG,gBAAgB,CAAE,CAAD,IAAoD;;;IACnF,IAAI,QAAJ,EAAc;MACZ,gBAAgB,CAAC,CAAD,EAAI,QAAJ,CAAhB;IACD;;IACD,CAAA,EAAA,GAAA,KAAK,CAAC,OAAN,MAAa,IAAb,IAAa,EAAA,KAAA,KAAA,CAAb,GAAa,KAAA,CAAb,GAAa,EAAA,CAAA,IAAA,CAAb,KAAa,EAAG,CAAH,CAAb;EACD,CAL+B,CAAhC;EAOA,OAAO,2BAA2B,CAAC;IAAE,aAAF;IAAiB,EAAE,EAAE,KAArB;IAA4B,GAAG,KAA/B;IAAsC;EAAtC,CAAD,EAAkD,GAAlD,CAAlC;AACD,CAlBM","sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport type { DataGridHeaderCellProps, DataGridHeaderCellState } from './DataGridHeaderCell.types';\nimport { useTableHeaderCell_unstable } from '../TableHeaderCell/useTableHeaderCell';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { useColumnIdContext } from '../../contexts/columnIdContext';\nimport { useTableContext } from '../../contexts/tableContext';\n\n/**\n * Create the state required to render DataGridHeaderCell.\n *\n * The returned state can be modified with hooks such as useDataGridHeaderCellStyles_unstable,\n * before being passed to renderDataGridHeaderCell_unstable.\n *\n * @param props - props from this instance of DataGridHeaderCell\n * @param ref - reference to root HTMLElement of DataGridHeaderCell\n */\nexport const useDataGridHeaderCell_unstable = (\n props: DataGridHeaderCellProps,\n ref: React.Ref<HTMLElement>,\n): DataGridHeaderCellState => {\n const columnId = useColumnIdContext();\n const { sortable } = useTableContext();\n const toggleColumnSort = useDataGridContext_unstable(ctx => ctx.sort.toggleColumnSort);\n const sortDirection = useDataGridContext_unstable(ctx =>\n sortable ? ctx.sort.getSortDirection(columnId) : undefined,\n );\n const onClick = useEventCallback((e: React.MouseEvent<HTMLTableHeaderCellElement>) => {\n if (sortable) {\n toggleColumnSort(e, columnId);\n }\n props.onClick?.(e);\n });\n\n return useTableHeaderCell_unstable({ sortDirection, as: 'div', ...props, onClick }, ref);\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataGridRow.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridRow/DataGridRow.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { ColumnDefinition } from '../../hooks';\nimport { TableRowProps, TableRowSlots, TableRowState } from '../TableRow/TableRow.types';\n\nexport type DataGridRowSlots = TableRowSlots;\n\n// Use any here since we can't know the user types\n// The user is responsible for narrowing the type downstream\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type CellRenderFunction = (column: ColumnDefinition<any>) => React.ReactNode;\n\n/**\n * DataGridRow Props\n */\nexport type DataGridRowProps = Omit<TableRowProps, 'children'> & {\n
|
|
1
|
+
{"version":3,"file":"DataGridRow.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridRow/DataGridRow.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { Slot, ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport type { ColumnDefinition } from '../../hooks';\nimport type { TableRowProps, TableRowSlots, TableRowState } from '../TableRow/TableRow.types';\nimport type { TableSelectionCell } from '../TableSelectionCell/TableSelectionCell';\n\nexport type DataGridRowSlots = TableRowSlots & {\n /**\n * When selection is enabled on the @see DataGrid, all rows\n * will render the selection cell.\n */\n selectionCell?: Slot<typeof TableSelectionCell>;\n};\n\n// Use any here since we can't know the user types\n// The user is responsible for narrowing the type downstream\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type CellRenderFunction = (column: ColumnDefinition<any>) => React.ReactNode;\n\n/**\n * DataGridRow Props\n */\nexport type DataGridRowProps = Omit<TableRowProps, 'children'> &\n ComponentProps<DataGridRowSlots> & {\n children: CellRenderFunction;\n };\n\n/**\n * State used in rendering DataGridRow\n */\nexport type DataGridRowState = TableRowState & ComponentState<DataGridRowSlots>;\n"]}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { getSlots } from '@fluentui/react-utilities';
|
|
2
3
|
/**
|
|
3
4
|
* Render the final JSX of DataGridRow
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
7
|
export const renderDataGridRow_unstable = state => {
|
|
7
|
-
|
|
8
|
+
const {
|
|
9
|
+
slots,
|
|
10
|
+
slotProps
|
|
11
|
+
} = getSlots(state);
|
|
12
|
+
return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
|
|
13
|
+
}, slots.selectionCell && /*#__PURE__*/React.createElement(slots.selectionCell, { ...slotProps.selectionCell
|
|
14
|
+
}), slotProps.root.children);
|
|
8
15
|
};
|
|
9
16
|
//# sourceMappingURL=renderDataGridRow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridRow/renderDataGridRow.tsx"],"names":[],"mappings":"AACA,SAAS,
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridRow/renderDataGridRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,0BAA0B,GAAI,KAAD,IAA4B;EACpE,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,QAAQ,CAAmB,KAAnB,CAArC;EAEA,oBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,EACG,KAAK,CAAC,aAAN,iBAAuB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,aAAP,EAAoB,EAAA,GAAK,SAAS,CAAC;EAAf,CAApB,CAD1B,EAEG,SAAS,CAAC,IAAV,CAAe,QAFlB,CADF;AAMD,CATM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { DataGridRowState, DataGridRowSlots } from './DataGridRow.types';\n\n/**\n * Render the final JSX of DataGridRow\n */\nexport const renderDataGridRow_unstable = (state: DataGridRowState) => {\n const { slots, slotProps } = getSlots<DataGridRowSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.selectionCell && <slots.selectionCell {...slotProps.selectionCell} />}\n {slotProps.root.children}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import { useTableRow_unstable } from '../TableRow/useTableRow';
|
|
2
3
|
import { useDataGridContext_unstable } from '../../contexts/dataGridContext';
|
|
4
|
+
import { ColumnIdContextProvider } from '../../contexts/columnIdContext';
|
|
5
|
+
import { DataGridSelectionCell } from '../DataGridSelectionCell/DataGridSelectionCell';
|
|
6
|
+
import { useRowIdContext } from '../../contexts/rowIdContext';
|
|
7
|
+
import { useEventCallback } from '@fluentui/react-utilities';
|
|
8
|
+
import { useIsInTableHeader } from '../../contexts/tableHeaderContext';
|
|
9
|
+
import { resolveShorthand } from '@fluentui/react-utilities';
|
|
3
10
|
/**
|
|
4
11
|
* Create the state required to render DataGridRow.
|
|
5
12
|
*
|
|
@@ -11,14 +18,60 @@ import { useDataGridContext_unstable } from '../../contexts/dataGridContext';
|
|
|
11
18
|
*/
|
|
12
19
|
|
|
13
20
|
export const useDataGridRow_unstable = (props, ref) => {
|
|
21
|
+
const rowId = useRowIdContext();
|
|
22
|
+
const isHeader = useIsInTableHeader();
|
|
14
23
|
const columnDefs = useDataGridContext_unstable(ctx => ctx.columns);
|
|
24
|
+
const selectable = useDataGridContext_unstable(ctx => ctx.selectableRows);
|
|
25
|
+
const selected = useDataGridContext_unstable(ctx => ctx.selection.isRowSelected(rowId));
|
|
26
|
+
const appearance = useDataGridContext_unstable(ctx => {
|
|
27
|
+
if (!isHeader && selectable && ctx.selection.isRowSelected(rowId)) {
|
|
28
|
+
return ctx.selectionAppearance;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return 'none';
|
|
32
|
+
});
|
|
33
|
+
const toggleRow = useDataGridContext_unstable(ctx => ctx.selection.toggleRow);
|
|
15
34
|
const cellRenderFunction = props.children;
|
|
16
|
-
const
|
|
17
|
-
return
|
|
35
|
+
const cells = columnDefs.map(columnDef => {
|
|
36
|
+
return /*#__PURE__*/React.createElement(ColumnIdContextProvider, {
|
|
37
|
+
value: columnDef.columnId,
|
|
38
|
+
key: columnDef.columnId
|
|
39
|
+
}, cellRenderFunction(columnDef));
|
|
40
|
+
});
|
|
41
|
+
const onClick = useEventCallback(e => {
|
|
42
|
+
var _a;
|
|
43
|
+
|
|
44
|
+
if (selectable && !isHeader) {
|
|
45
|
+
toggleRow(e, rowId);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
49
|
+
});
|
|
50
|
+
const onKeyDown = useEventCallback(e => {
|
|
51
|
+
var _a;
|
|
52
|
+
|
|
53
|
+
if (selectable && !isHeader && e.key === ' ') {
|
|
54
|
+
toggleRow(e, rowId);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
(_a = props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
18
58
|
});
|
|
19
|
-
|
|
20
|
-
|
|
59
|
+
const baseState = useTableRow_unstable({
|
|
60
|
+
appearance,
|
|
61
|
+
'aria-selected': selectable ? selected : undefined,
|
|
62
|
+
...props,
|
|
63
|
+
onClick,
|
|
64
|
+
onKeyDown,
|
|
65
|
+
children: cells,
|
|
21
66
|
as: 'div'
|
|
22
67
|
}, ref);
|
|
68
|
+
return { ...baseState,
|
|
69
|
+
components: { ...baseState.components,
|
|
70
|
+
selectionCell: DataGridSelectionCell
|
|
71
|
+
},
|
|
72
|
+
selectionCell: resolveShorthand(props.selectionCell, {
|
|
73
|
+
required: selectable
|
|
74
|
+
})
|
|
75
|
+
};
|
|
23
76
|
};
|
|
24
77
|
//# sourceMappingURL=useDataGridRow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridRow/useDataGridRow.
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridRow/useDataGridRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAEA,SAAS,oBAAT,QAAqC,yBAArC;AACA,SAAS,2BAAT,QAA4C,gCAA5C;AACA,SAAS,uBAAT,QAAwC,gCAAxC;AACA,SAAS,qBAAT,QAAsC,gDAAtC;AACA,SAAS,eAAT,QAAgC,6BAAhC;AACA,SAAS,gBAAT,QAAiC,2BAAjC;AACA,SAAS,kBAAT,QAAmC,mCAAnC;AACA,SAAS,gBAAT,QAAiC,2BAAjC;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,uBAAuB,GAAG,CAAC,KAAD,EAA0B,GAA1B,KAA2E;EAChH,MAAM,KAAK,GAAG,eAAe,EAA7B;EACA,MAAM,QAAQ,GAAG,kBAAkB,EAAnC;EACA,MAAM,UAAU,GAAG,2BAA2B,CAAC,GAAG,IAAI,GAAG,CAAC,OAAZ,CAA9C;EACA,MAAM,UAAU,GAAG,2BAA2B,CAAC,GAAG,IAAI,GAAG,CAAC,cAAZ,CAA9C;EACA,MAAM,QAAQ,GAAG,2BAA2B,CAAC,GAAG,IAAI,GAAG,CAAC,SAAJ,CAAc,aAAd,CAA4B,KAA5B,CAAR,CAA5C;EACA,MAAM,UAAU,GAAG,2BAA2B,CAAC,GAAG,IAAG;IACnD,IAAI,CAAC,QAAD,IAAa,UAAb,IAA2B,GAAG,CAAC,SAAJ,CAAc,aAAd,CAA4B,KAA5B,CAA/B,EAAmE;MACjE,OAAO,GAAG,CAAC,mBAAX;IACD;;IAED,OAAO,MAAP;EACD,CAN6C,CAA9C;EAOA,MAAM,SAAS,GAAG,2BAA2B,CAAC,GAAG,IAAI,GAAG,CAAC,SAAJ,CAAc,SAAtB,CAA7C;EAEA,MAAM,kBAAkB,GAAG,KAAK,CAAC,QAAjC;EACA,MAAM,KAAK,GAAG,UAAU,CAAC,GAAX,CAAe,SAAS,IAAG;IACvC,oBACE,KAAA,CAAA,aAAA,CAAC,uBAAD,EAAwB;MAAC,KAAK,EAAE,SAAS,CAAC,QAAlB;MAA4B,GAAG,EAAE,SAAS,CAAC;IAA3C,CAAxB,EACG,kBAAkB,CAAC,SAAD,CADrB,CADF;EAKD,CANa,CAAd;EAQA,MAAM,OAAO,GAAG,gBAAgB,CAAE,CAAD,IAA6C;;;IAC5E,IAAI,UAAU,IAAI,CAAC,QAAnB,EAA6B;MAC3B,SAAS,CAAC,CAAD,EAAI,KAAJ,CAAT;IACD;;IAED,CAAA,EAAA,GAAA,KAAK,CAAC,OAAN,MAAa,IAAb,IAAa,EAAA,KAAA,KAAA,CAAb,GAAa,KAAA,CAAb,GAAa,EAAA,CAAA,IAAA,CAAb,KAAa,EAAG,CAAH,CAAb;EACD,CAN+B,CAAhC;EAQA,MAAM,SAAS,GAAG,gBAAgB,CAAE,CAAD,IAAgD;;;IACjF,IAAI,UAAU,IAAI,CAAC,QAAf,IAA2B,CAAC,CAAC,GAAF,KAAU,GAAzC,EAA8C;MAC5C,SAAS,CAAC,CAAD,EAAI,KAAJ,CAAT;IACD;;IAED,CAAA,EAAA,GAAA,KAAK,CAAC,SAAN,MAAe,IAAf,IAAe,EAAA,KAAA,KAAA,CAAf,GAAe,KAAA,CAAf,GAAe,EAAA,CAAA,IAAA,CAAf,KAAe,EAAG,CAAH,CAAf;EACD,CANiC,CAAlC;EAQA,MAAM,SAAS,GAAG,oBAAoB,CACpC;IACE,UADF;IAEE,iBAAiB,UAAU,GAAG,QAAH,GAAc,SAF3C;IAGE,GAAG,KAHL;IAIE,OAJF;IAKE,SALF;IAME,QAAQ,EAAE,KANZ;IAOE,EAAE,EAAE;EAPN,CADoC,EAUpC,GAVoC,CAAtC;EAaA,OAAO,EACL,GAAG,SADE;IAEL,UAAU,EAAE,EACV,GAAG,SAAS,CAAC,UADH;MAEV,aAAa,EAAE;IAFL,CAFP;IAML,aAAa,EAAE,gBAAgB,CAAC,KAAK,CAAC,aAAP,EAAsB;MAAE,QAAQ,EAAE;IAAZ,CAAtB;EAN1B,CAAP;AAQD,CA7DM","sourcesContent":["import * as React from 'react';\nimport type { DataGridRowProps, DataGridRowState } from './DataGridRow.types';\nimport { useTableRow_unstable } from '../TableRow/useTableRow';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { ColumnIdContextProvider } from '../../contexts/columnIdContext';\nimport { DataGridSelectionCell } from '../DataGridSelectionCell/DataGridSelectionCell';\nimport { useRowIdContext } from '../../contexts/rowIdContext';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { useIsInTableHeader } from '../../contexts/tableHeaderContext';\nimport { resolveShorthand } from '@fluentui/react-utilities';\n\n/**\n * Create the state required to render DataGridRow.\n *\n * The returned state can be modified with hooks such as useDataGridRowStyles_unstable,\n * before being passed to renderDataGridRow_unstable.\n *\n * @param props - props from this instance of DataGridRow\n * @param ref - reference to root HTMLElement of DataGridRow\n */\nexport const useDataGridRow_unstable = (props: DataGridRowProps, ref: React.Ref<HTMLElement>): DataGridRowState => {\n const rowId = useRowIdContext();\n const isHeader = useIsInTableHeader();\n const columnDefs = useDataGridContext_unstable(ctx => ctx.columns);\n const selectable = useDataGridContext_unstable(ctx => ctx.selectableRows);\n const selected = useDataGridContext_unstable(ctx => ctx.selection.isRowSelected(rowId));\n const appearance = useDataGridContext_unstable(ctx => {\n if (!isHeader && selectable && ctx.selection.isRowSelected(rowId)) {\n return ctx.selectionAppearance;\n }\n\n return 'none';\n });\n const toggleRow = useDataGridContext_unstable(ctx => ctx.selection.toggleRow);\n\n const cellRenderFunction = props.children;\n const cells = columnDefs.map(columnDef => {\n return (\n <ColumnIdContextProvider value={columnDef.columnId} key={columnDef.columnId}>\n {cellRenderFunction(columnDef)}\n </ColumnIdContextProvider>\n );\n });\n\n const onClick = useEventCallback((e: React.MouseEvent<HTMLTableRowElement>) => {\n if (selectable && !isHeader) {\n toggleRow(e, rowId);\n }\n\n props.onClick?.(e);\n });\n\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLTableRowElement>) => {\n if (selectable && !isHeader && e.key === ' ') {\n toggleRow(e, rowId);\n }\n\n props.onKeyDown?.(e);\n });\n\n const baseState = useTableRow_unstable(\n {\n appearance,\n 'aria-selected': selectable ? selected : undefined,\n ...props,\n onClick,\n onKeyDown,\n children: cells,\n as: 'div',\n },\n ref,\n );\n\n return {\n ...baseState,\n components: {\n ...baseState.components,\n selectionCell: DataGridSelectionCell,\n },\n selectionCell: resolveShorthand(props.selectionCell, { required: selectable }),\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { mergeClasses } from '@griffel/react';
|
|
2
2
|
import { useTableRowStyles_unstable } from '../TableRow/useTableRowStyles';
|
|
3
3
|
export const dataGridRowClassNames = {
|
|
4
|
-
root: 'fui-DataGridRow'
|
|
4
|
+
root: 'fui-DataGridRow',
|
|
5
|
+
selectionCell: 'fui-DataGridRow__selectionCell'
|
|
5
6
|
};
|
|
6
7
|
/**
|
|
7
8
|
* Apply styling to the DataGridRow slots based on the state
|
|
@@ -10,6 +11,11 @@ export const dataGridRowClassNames = {
|
|
|
10
11
|
export const useDataGridRowStyles_unstable = state => {
|
|
11
12
|
useTableRowStyles_unstable(state);
|
|
12
13
|
state.root.className = mergeClasses(dataGridRowClassNames.root, state.root.className);
|
|
14
|
+
|
|
15
|
+
if (state.selectionCell) {
|
|
16
|
+
state.selectionCell.className = mergeClasses(dataGridRowClassNames.selectionCell, state.selectionCell.className);
|
|
17
|
+
}
|
|
18
|
+
|
|
13
19
|
return state;
|
|
14
20
|
};
|
|
15
21
|
//# sourceMappingURL=useDataGridRowStyles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridRow/useDataGridRowStyles.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,QAA6B,gBAA7B;AAGA,SAAS,0BAAT,QAA2C,+BAA3C;AAEA,OAAO,MAAM,qBAAqB,GAAqC;EACrE,IAAI,EAAE
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridRow/useDataGridRowStyles.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,QAA6B,gBAA7B;AAGA,SAAS,0BAAT,QAA2C,+BAA3C;AAEA,OAAO,MAAM,qBAAqB,GAAqC;EACrE,IAAI,EAAE,iBAD+D;EAErE,aAAa,EAAE;AAFsD,CAAhE;AAKP;;AAEG;;AACH,OAAO,MAAM,6BAA6B,GAAI,KAAD,IAA8C;EACzF,0BAA0B,CAAC,KAAD,CAA1B;EACA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,qBAAqB,CAAC,IAAvB,EAA6B,KAAK,CAAC,IAAN,CAAW,SAAxC,CAAnC;;EACA,IAAI,KAAK,CAAC,aAAV,EAAyB;IACvB,KAAK,CAAC,aAAN,CAAoB,SAApB,GAAgC,YAAY,CAAC,qBAAqB,CAAC,aAAvB,EAAsC,KAAK,CAAC,aAAN,CAAoB,SAA1D,CAA5C;EACD;;EAED,OAAO,KAAP;AACD,CARM","sourcesContent":["import { mergeClasses } from '@griffel/react';\nimport type { DataGridRowSlots, DataGridRowState } from './DataGridRow.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { useTableRowStyles_unstable } from '../TableRow/useTableRowStyles';\n\nexport const dataGridRowClassNames: SlotClassNames<DataGridRowSlots> = {\n root: 'fui-DataGridRow',\n selectionCell: 'fui-DataGridRow__selectionCell',\n};\n\n/**\n * Apply styling to the DataGridRow slots based on the state\n */\nexport const useDataGridRowStyles_unstable = (state: DataGridRowState): DataGridRowState => {\n useTableRowStyles_unstable(state);\n state.root.className = mergeClasses(dataGridRowClassNames.root, state.root.className);\n if (state.selectionCell) {\n state.selectionCell.className = mergeClasses(dataGridRowClassNames.selectionCell, state.selectionCell.className);\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { useEventCallback } from '@fluentui/react-utilities';
|
|
2
|
+
import { useDataGridContext_unstable } from '../../contexts/dataGridContext';
|
|
3
|
+
import { useRowIdContext } from '../../contexts/rowIdContext';
|
|
4
|
+
import { useIsInTableHeader } from '../../contexts/tableHeaderContext';
|
|
1
5
|
import { useTableSelectionCell_unstable } from '../TableSelectionCell/useTableSelectionCell';
|
|
2
6
|
/**
|
|
3
7
|
* Create the state required to render DataGridSelectionCell.
|
|
@@ -10,10 +14,41 @@ import { useTableSelectionCell_unstable } from '../TableSelectionCell/useTableSe
|
|
|
10
14
|
*/
|
|
11
15
|
|
|
12
16
|
export const useDataGridSelectionCell_unstable = (props, ref) => {
|
|
17
|
+
const isHeader = useIsInTableHeader();
|
|
18
|
+
const rowId = useRowIdContext();
|
|
19
|
+
const multiselect = useDataGridContext_unstable(ctx => ctx.selection.selectionMode === 'multiselect');
|
|
20
|
+
const subtle = useDataGridContext_unstable(ctx => ctx.subtleSelection);
|
|
21
|
+
const checked = useDataGridContext_unstable(ctx => {
|
|
22
|
+
if (isHeader && multiselect) {
|
|
23
|
+
return ctx.selection.allRowsSelected ? true : ctx.selection.someRowsSelected ? 'mixed' : false;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return ctx.selection.isRowSelected(rowId);
|
|
27
|
+
});
|
|
28
|
+
const toggleAllRows = useDataGridContext_unstable(ctx => ctx.selection.toggleAllRows);
|
|
29
|
+
const type = useDataGridContext_unstable(ctx => ctx.selection.selectionMode === 'multiselect' ? 'checkbox' : 'radio');
|
|
30
|
+
const onClick = useEventCallback(e => {
|
|
31
|
+
var _a;
|
|
32
|
+
|
|
33
|
+
if (isHeader) {
|
|
34
|
+
toggleAllRows(e);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
38
|
+
});
|
|
13
39
|
return useTableSelectionCell_unstable({
|
|
14
40
|
as: 'div',
|
|
15
41
|
role: 'gridcell',
|
|
16
|
-
|
|
42
|
+
checked,
|
|
43
|
+
type,
|
|
44
|
+
tabIndex: 0,
|
|
45
|
+
hidden: isHeader && !multiselect,
|
|
46
|
+
subtle,
|
|
47
|
+
checkboxIndicator: {
|
|
48
|
+
tabIndex: -1
|
|
49
|
+
},
|
|
50
|
+
...props,
|
|
51
|
+
onClick
|
|
17
52
|
}, ref);
|
|
18
53
|
};
|
|
19
54
|
//# sourceMappingURL=useDataGridSelectionCell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridSelectionCell/useDataGridSelectionCell.ts"],"names":[],"mappings":"AACA,SAAS,8BAAT,QAA+C,6CAA/C;AAGA;;;;;;;;AAQG;;AACH,OAAO,MAAM,iCAAiC,GAAG,CAC/C,KAD+C,EAE/C,GAF+C,KAGjB;EAC9B,OAAO,
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridSelectionCell/useDataGridSelectionCell.ts"],"names":[],"mappings":"AACA,SAAS,gBAAT,QAAiC,2BAAjC;AACA,SAAS,2BAAT,QAA4C,gCAA5C;AACA,SAAS,eAAT,QAAgC,6BAAhC;AACA,SAAS,kBAAT,QAAmC,mCAAnC;AACA,SAAS,8BAAT,QAA+C,6CAA/C;AAGA;;;;;;;;AAQG;;AACH,OAAO,MAAM,iCAAiC,GAAG,CAC/C,KAD+C,EAE/C,GAF+C,KAGjB;EAC9B,MAAM,QAAQ,GAAG,kBAAkB,EAAnC;EACA,MAAM,KAAK,GAAG,eAAe,EAA7B;EACA,MAAM,WAAW,GAAG,2BAA2B,CAAC,GAAG,IAAI,GAAG,CAAC,SAAJ,CAAc,aAAd,KAAgC,aAAxC,CAA/C;EACA,MAAM,MAAM,GAAG,2BAA2B,CAAC,GAAG,IAAI,GAAG,CAAC,eAAZ,CAA1C;EACA,MAAM,OAAO,GAAG,2BAA2B,CAAC,GAAG,IAAG;IAChD,IAAI,QAAQ,IAAI,WAAhB,EAA6B;MAC3B,OAAO,GAAG,CAAC,SAAJ,CAAc,eAAd,GAAgC,IAAhC,GAAuC,GAAG,CAAC,SAAJ,CAAc,gBAAd,GAAiC,OAAjC,GAA2C,KAAzF;IACD;;IAED,OAAO,GAAG,CAAC,SAAJ,CAAc,aAAd,CAA4B,KAA5B,CAAP;EACD,CAN0C,CAA3C;EAQA,MAAM,aAAa,GAAG,2BAA2B,CAAC,GAAG,IAAI,GAAG,CAAC,SAAJ,CAAc,aAAtB,CAAjD;EACA,MAAM,IAAI,GAAG,2BAA2B,CAAC,GAAG,IAC1C,GAAG,CAAC,SAAJ,CAAc,aAAd,KAAgC,aAAhC,GAAgD,UAAhD,GAA6D,OADvB,CAAxC;EAIA,MAAM,OAAO,GAAG,gBAAgB,CAAE,CAAD,IAA8C;;;IAC7E,IAAI,QAAJ,EAAc;MACZ,aAAa,CAAC,CAAD,CAAb;IACD;;IAED,CAAA,EAAA,GAAA,KAAK,CAAC,OAAN,MAAa,IAAb,IAAa,EAAA,KAAA,KAAA,CAAb,GAAa,KAAA,CAAb,GAAa,EAAA,CAAA,IAAA,CAAb,KAAa,EAAG,CAAH,CAAb;EACD,CAN+B,CAAhC;EAQA,OAAO,8BAA8B,CACnC;IACE,EAAE,EAAE,KADN;IAEE,IAAI,EAAE,UAFR;IAGE,OAHF;IAIE,IAJF;IAKE,QAAQ,EAAE,CALZ;IAME,MAAM,EAAE,QAAQ,IAAI,CAAC,WANvB;IAOE,MAPF;IAQE,iBAAiB,EAAE;MAAE,QAAQ,EAAE,CAAC;IAAb,CARrB;IASE,GAAG,KATL;IAUE;EAVF,CADmC,EAanC,GAbmC,CAArC;AAeD,CA5CM","sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { useRowIdContext } from '../../contexts/rowIdContext';\nimport { useIsInTableHeader } from '../../contexts/tableHeaderContext';\nimport { useTableSelectionCell_unstable } from '../TableSelectionCell/useTableSelectionCell';\nimport type { DataGridSelectionCellProps, DataGridSelectionCellState } from './DataGridSelectionCell.types';\n\n/**\n * Create the state required to render DataGridSelectionCell.\n *\n * The returned state can be modified with hooks such as useDataGridSelectionCellStyles_unstable,\n * before being passed to renderDataGridSelectionCell_unstable.\n *\n * @param props - props from this instance of DataGridSelectionCell\n * @param ref - reference to root HTMLElement of DataGridSelectionCell\n */\nexport const useDataGridSelectionCell_unstable = (\n props: DataGridSelectionCellProps,\n ref: React.Ref<HTMLElement>,\n): DataGridSelectionCellState => {\n const isHeader = useIsInTableHeader();\n const rowId = useRowIdContext();\n const multiselect = useDataGridContext_unstable(ctx => ctx.selection.selectionMode === 'multiselect');\n const subtle = useDataGridContext_unstable(ctx => ctx.subtleSelection);\n const checked = useDataGridContext_unstable(ctx => {\n if (isHeader && multiselect) {\n return ctx.selection.allRowsSelected ? true : ctx.selection.someRowsSelected ? 'mixed' : false;\n }\n\n return ctx.selection.isRowSelected(rowId);\n });\n\n const toggleAllRows = useDataGridContext_unstable(ctx => ctx.selection.toggleAllRows);\n const type = useDataGridContext_unstable(ctx =>\n ctx.selection.selectionMode === 'multiselect' ? 'checkbox' : 'radio',\n );\n\n const onClick = useEventCallback((e: React.MouseEvent<HTMLTableCellElement>) => {\n if (isHeader) {\n toggleAllRows(e);\n }\n\n props.onClick?.(e);\n });\n\n return useTableSelectionCell_unstable(\n {\n as: 'div',\n role: 'gridcell',\n checked,\n type,\n tabIndex: 0,\n hidden: isHeader && !multiselect,\n subtle,\n checkboxIndicator: { tabIndex: -1 },\n ...props,\n onClick,\n },\n ref,\n );\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/Table/Table.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type TableSlots = {\n root: Slot<'table', 'div'>;\n};\n\nexport type TableContextValue = {\n /**\n * Affects the sizes of all table subcomponents\n * @default medium\n */\n size: 'small' | '
|
|
1
|
+
{"version":3,"file":"Table.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/Table/Table.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type TableSlots = {\n root: Slot<'table', 'div'>;\n};\n\nexport type TableContextValue = {\n /**\n * Affects the sizes of all table subcomponents\n * @default medium\n */\n size: 'extra-small' | 'small' | 'medium';\n\n /**\n * Render all table elements as divs intead of semantic table elements\n * Using divs no longer uses `display: table` layout but `display: flex`\n * @default false\n */\n noNativeElements: boolean;\n\n /**\n * Whether the table is sortable\n * @default false\n */\n sortable: boolean;\n};\n\nexport type SortDirection = 'ascending' | 'descending';\n\nexport type TableContextValues = {\n table: TableContextValue;\n};\n\n/**\n * Table Props\n */\nexport type TableProps = ComponentProps<TableSlots> & Partial<TableContextValue>;\n\n/**\n * State used in rendering Table\n */\nexport type TableState = ComponentState<TableSlots> &\n Pick<Required<TableProps>, 'size' | 'noNativeElements'> &\n TableContextValue;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCell.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/TableCell/TableCell.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { TableContextValue } from '../Table/Table.types';\n\nexport type TableCellSlots = {\n root: Slot<'td', 'div'>;\n};\n\n/**\n * TableCell Props\n */\nexport type TableCellProps = ComponentProps<TableCellSlots> & {};\n\n/**\n * State used in rendering TableCell\n */\nexport type TableCellState = ComponentState<TableCellSlots> & Pick<TableContextValue, 'noNativeElements'>;\n"]}
|
|
1
|
+
{"version":3,"file":"TableCell.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/TableCell/TableCell.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { TableContextValue } from '../Table/Table.types';\n\nexport type TableCellSlots = {\n root: Slot<'td', 'div'>;\n};\n\n/**\n * TableCell Props\n */\nexport type TableCellProps = ComponentProps<TableCellSlots> & {};\n\n/**\n * State used in rendering TableCell\n */\nexport type TableCellState = ComponentState<TableCellSlots> & Pick<TableContextValue, 'noNativeElements' | 'size'>;\n"]}
|
|
@@ -14,7 +14,8 @@ export const useTableCell_unstable = (props, ref) => {
|
|
|
14
14
|
var _a;
|
|
15
15
|
|
|
16
16
|
const {
|
|
17
|
-
noNativeElements
|
|
17
|
+
noNativeElements,
|
|
18
|
+
size
|
|
18
19
|
} = useTableContext();
|
|
19
20
|
const rootComponent = ((_a = props.as) !== null && _a !== void 0 ? _a : noNativeElements) ? 'div' : 'td';
|
|
20
21
|
return {
|
|
@@ -26,7 +27,8 @@ export const useTableCell_unstable = (props, ref) => {
|
|
|
26
27
|
role: rootComponent === 'div' ? 'cell' : undefined,
|
|
27
28
|
...props
|
|
28
29
|
}),
|
|
29
|
-
noNativeElements
|
|
30
|
+
noNativeElements,
|
|
31
|
+
size
|
|
30
32
|
};
|
|
31
33
|
};
|
|
32
34
|
//# sourceMappingURL=useTableCell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/TableCell/useTableCell.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,QAAsC,2BAAtC;AAEA,SAAS,eAAT,QAAgC,6BAAhC;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,qBAAqB,GAAG,CAAC,KAAD,EAAwB,GAAxB,KAAuE;;;EAC1G,MAAM;IAAE;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/TableCell/useTableCell.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,QAAsC,2BAAtC;AAEA,SAAS,eAAT,QAAgC,6BAAhC;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,qBAAqB,GAAG,CAAC,KAAD,EAAwB,GAAxB,KAAuE;;;EAC1G,MAAM;IAAE,gBAAF;IAAoB;EAApB,IAA6B,eAAe,EAAlD;EAEA,MAAM,aAAa,GAAG,CAAA,CAAA,EAAA,GAAA,KAAK,CAAC,EAAN,MAAQ,IAAR,IAAQ,EAAA,KAAA,KAAA,CAAR,GAAQ,EAAR,GAAY,gBAAZ,IAA+B,KAA/B,GAAuC,IAA7D;EAEA,OAAO;IACL,UAAU,EAAE;MACV,IAAI,EAAE;IADI,CADP;IAIL,IAAI,EAAE,qBAAqB,CAAC,aAAD,EAAgB;MACzC,GADyC;MAEzC,IAAI,EAAE,aAAa,KAAK,KAAlB,GAA0B,MAA1B,GAAmC,SAFA;MAGzC,GAAG;IAHsC,CAAhB,CAJtB;IASL,gBATK;IAUL;EAVK,CAAP;AAYD,CAjBM","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport type { TableCellProps, TableCellState } from './TableCell.types';\nimport { useTableContext } from '../../contexts/tableContext';\n\n/**\n * Create the state required to render TableCell.\n *\n * The returned state can be modified with hooks such as useTableCellStyles_unstable,\n * before being passed to renderTableCell_unstable.\n *\n * @param props - props from this instance of TableCell\n * @param ref - reference to root HTMLElement of TableCell\n */\nexport const useTableCell_unstable = (props: TableCellProps, ref: React.Ref<HTMLElement>): TableCellState => {\n const { noNativeElements, size } = useTableContext();\n\n const rootComponent = props.as ?? noNativeElements ? 'div' : 'td';\n\n return {\n components: {\n root: rootComponent,\n },\n root: getNativeElementProps(rootComponent, {\n ref,\n role: rootComponent === 'div' ? 'cell' : undefined,\n ...props,\n }),\n noNativeElements,\n size,\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __styles, mergeClasses, shorthands } from '@griffel/react';
|
|
2
2
|
import { tokens } from '@fluentui/react-theme';
|
|
3
|
+
import { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';
|
|
3
4
|
export const tableCellClassName = 'fui-TableCell';
|
|
4
5
|
export const tableCellClassNames = {
|
|
5
6
|
root: tableCellClassName
|
|
@@ -9,9 +10,18 @@ const useTableLayoutStyles = /*#__PURE__*/__styles({
|
|
|
9
10
|
"root": {
|
|
10
11
|
"mc9l5x": "f15pt5es",
|
|
11
12
|
"ha4doy": "fmrv4ls"
|
|
13
|
+
},
|
|
14
|
+
"medium": {
|
|
15
|
+
"Bqenvij": "f1ft4266"
|
|
16
|
+
},
|
|
17
|
+
"small": {
|
|
18
|
+
"Bqenvij": "fbsu25e"
|
|
19
|
+
},
|
|
20
|
+
"extra-small": {
|
|
21
|
+
"Bqenvij": "frvgh55"
|
|
12
22
|
}
|
|
13
23
|
}, {
|
|
14
|
-
"d": [".f15pt5es{display:table-cell;}", ".fmrv4ls{vertical-align:middle;}"]
|
|
24
|
+
"d": [".f15pt5es{display:table-cell;}", ".fmrv4ls{vertical-align:middle;}", ".f1ft4266{height:44px;}", ".fbsu25e{height:34px;}", ".frvgh55{height:24px;}"]
|
|
15
25
|
});
|
|
16
26
|
|
|
17
27
|
const useFlexLayoutStyles = /*#__PURE__*/__styles({
|
|
@@ -22,9 +32,18 @@ const useFlexLayoutStyles = /*#__PURE__*/__styles({
|
|
|
22
32
|
"Bh6795r": "fqerorx",
|
|
23
33
|
"Bnnss6s": "f1neuvcm",
|
|
24
34
|
"xawz": "fkjuxzh"
|
|
35
|
+
},
|
|
36
|
+
"medium": {
|
|
37
|
+
"sshi5w": "f5pgtk9"
|
|
38
|
+
},
|
|
39
|
+
"small": {
|
|
40
|
+
"sshi5w": "fcep9tg"
|
|
41
|
+
},
|
|
42
|
+
"extra-small": {
|
|
43
|
+
"sshi5w": "f1pha7fy"
|
|
25
44
|
}
|
|
26
45
|
}, {
|
|
27
|
-
"d": [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f10tiqix{min-width:0px;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".fqerorx{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".f1neuvcm{-webkit-flex-shrink:1;-ms-flex-negative:1;flex-shrink:1;}", ".fkjuxzh{-webkit-flex-basis:0px;-ms-flex-preferred-size:0px;flex-basis:0px;}"]
|
|
46
|
+
"d": [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f10tiqix{min-width:0px;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".fqerorx{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".f1neuvcm{-webkit-flex-shrink:1;-ms-flex-negative:1;flex-shrink:1;}", ".fkjuxzh{-webkit-flex-basis:0px;-ms-flex-preferred-size:0px;flex-basis:0px;}", ".f5pgtk9{min-height:44px;}", ".fcep9tg{min-height:34px;}", ".f1pha7fy{min-height:24px;}"]
|
|
28
47
|
});
|
|
29
48
|
/**
|
|
30
49
|
* Styles for the root slot
|
|
@@ -37,10 +56,17 @@ const useStyles = /*#__PURE__*/__styles({
|
|
|
37
56
|
"z8tnut": "f1nbblvp",
|
|
38
57
|
"z189sj": ["f1vdfbxk", "f1f5gg8d"],
|
|
39
58
|
"Byoj8tv": "f1ov4xf1",
|
|
40
|
-
"uwmqm3": ["f1f5gg8d", "f1vdfbxk"]
|
|
59
|
+
"uwmqm3": ["f1f5gg8d", "f1vdfbxk"],
|
|
60
|
+
"Bn4voq9": "fz36nt7",
|
|
61
|
+
"g9k6zt": "f9znhxp",
|
|
62
|
+
"Bfpq7zp": "fqrak0z",
|
|
63
|
+
"kdpuga": ["f1o2ludy", "f1kjnpwc"],
|
|
64
|
+
"Bw81rd7": ["f1kjnpwc", "f1o2ludy"],
|
|
65
|
+
"B6xbmo0": ["fxmnebo", "f1witrsb"],
|
|
66
|
+
"dm238s": ["f1witrsb", "fxmnebo"]
|
|
41
67
|
}
|
|
42
68
|
}, {
|
|
43
|
-
"d": [".f10pi13n{position:relative;}", ".f1nbblvp{padding-top:0px;}", ".f1vdfbxk{padding-right:var(--spacingHorizontalS);}", ".f1f5gg8d{padding-left:var(--spacingHorizontalS);}", ".f1ov4xf1{padding-bottom:0px;}"]
|
|
69
|
+
"d": [".f10pi13n{position:relative;}", ".f1nbblvp{padding-top:0px;}", ".f1vdfbxk{padding-right:var(--spacingHorizontalS);}", ".f1f5gg8d{padding-left:var(--spacingHorizontalS);}", ".f1ov4xf1{padding-bottom:0px;}", ".fz36nt7[data-fui-focus-visible]{outline-width:2px;}", ".f9znhxp[data-fui-focus-visible]{outline-style:solid;}", ".fqrak0z[data-fui-focus-visible]{outline-color:var(--colorStrokeFocus2);}", ".f1o2ludy[data-fui-focus-visible]{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f1kjnpwc[data-fui-focus-visible]{border-bottom-left-radius:var(--borderRadiusMedium);}", ".fxmnebo[data-fui-focus-visible]{border-top-right-radius:var(--borderRadiusMedium);}", ".f1witrsb[data-fui-focus-visible]{border-top-left-radius:var(--borderRadiusMedium);}"]
|
|
44
70
|
});
|
|
45
71
|
/**
|
|
46
72
|
* Apply styling to the TableCell slots based on the state
|
|
@@ -53,7 +79,7 @@ export const useTableCellStyles_unstable = state => {
|
|
|
53
79
|
table: useTableLayoutStyles(),
|
|
54
80
|
flex: useFlexLayoutStyles()
|
|
55
81
|
};
|
|
56
|
-
state.root.className = mergeClasses(tableCellClassNames.root, styles.root, state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root, state.root.className);
|
|
82
|
+
state.root.className = mergeClasses(tableCellClassNames.root, styles.root, state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root, state.noNativeElements ? layoutStyles.flex[state.size] : layoutStyles.table[state.size], state.root.className);
|
|
57
83
|
return state;
|
|
58
84
|
};
|
|
59
85
|
//# sourceMappingURL=useTableCellStyles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/TableCell/useTableCellStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,EAAmC,UAAnC,QAAqD,gBAArD;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAIA,OAAO,MAAM,kBAAkB,GAAG,eAA3B;AACP,OAAO,MAAM,mBAAmB,GAAmC;EACjE,IAAI,EAAE;AAD2D,CAA5D;;AAIP,MAAM,oBAAoB,gBAAG;EAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAA7B;;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/TableCell/useTableCellStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,EAAmC,UAAnC,QAAqD,gBAArD;AACA,SAAS,MAAT,QAAuB,uBAAvB;AACA,SAAS,+BAAT,QAAgD,yBAAhD;AAIA,OAAO,MAAM,kBAAkB,GAAG,eAA3B;AACP,OAAO,MAAM,mBAAmB,GAAmC;EACjE,IAAI,EAAE;AAD2D,CAA5D;;AAIP,MAAM,oBAAoB,gBAAG;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAA7B;;AAmBA,MAAM,mBAAmB,gBAAG;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAA5B;AAqBA;;AAEG;;;AACH,MAAM,SAAS,gBAAG;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAlB;AAeA;;AAEG;;;AACH,OAAO,MAAM,2BAA2B,GAAI,KAAD,IAA0C;EACnF,MAAM,MAAM,GAAG,SAAS,EAAxB;EACA,MAAM,YAAY,GAAG;IACnB,KAAK,EAAE,oBAAoB,EADR;IAEnB,IAAI,EAAE,mBAAmB;EAFN,CAArB;EAIA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,mBAAmB,CAAC,IADa,EAEjC,MAAM,CAAC,IAF0B,EAGjC,KAAK,CAAC,gBAAN,GAAyB,YAAY,CAAC,IAAb,CAAkB,IAA3C,GAAkD,YAAY,CAAC,KAAb,CAAmB,IAHpC,EAIjC,KAAK,CAAC,gBAAN,GAAyB,YAAY,CAAC,IAAb,CAAkB,KAAK,CAAC,IAAxB,CAAzB,GAAyD,YAAY,CAAC,KAAb,CAAmB,KAAK,CAAC,IAAzB,CAJxB,EAKjC,KAAK,CAAC,IAAN,CAAW,SALsB,CAAnC;EAOA,OAAO,KAAP;AACD,CAdM","sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport type { TableCellSlots, TableCellState } from './TableCell.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const tableCellClassName = 'fui-TableCell';\nexport const tableCellClassNames: SlotClassNames<TableCellSlots> = {\n root: tableCellClassName,\n};\n\nconst useTableLayoutStyles = makeStyles({\n root: {\n display: 'table-cell',\n verticalAlign: 'middle',\n },\n\n medium: {\n height: '44px',\n },\n\n small: {\n height: '34px',\n },\n\n 'extra-small': {\n height: '24px',\n },\n});\n\nconst useFlexLayoutStyles = makeStyles({\n root: {\n display: 'flex',\n minWidth: '0px',\n alignItems: 'center',\n ...shorthands.flex(1, 1, '0px'),\n },\n\n medium: {\n minHeight: '44px',\n },\n\n small: {\n minHeight: '34px',\n },\n\n 'extra-small': {\n minHeight: '24px',\n },\n});\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n position: 'relative',\n ...shorthands.padding('0px', tokens.spacingHorizontalS),\n\n ...createCustomFocusIndicatorStyle(\n {\n ...shorthands.outline('2px', 'solid', tokens.colorStrokeFocus2),\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n },\n { selector: 'focus', enableOutline: true },\n ),\n },\n});\n\n/**\n * Apply styling to the TableCell slots based on the state\n */\nexport const useTableCellStyles_unstable = (state: TableCellState): TableCellState => {\n const styles = useStyles();\n const layoutStyles = {\n table: useTableLayoutStyles(),\n flex: useFlexLayoutStyles(),\n };\n state.root.className = mergeClasses(\n tableCellClassNames.root,\n styles.root,\n state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root,\n state.noNativeElements ? layoutStyles.flex[state.size] : layoutStyles.table[state.size],\n state.root.className,\n );\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { getNativeElementProps
|
|
2
|
-
import { useFocusWithin } from '@fluentui/react-tabster';
|
|
1
|
+
import { getNativeElementProps } from '@fluentui/react-utilities';
|
|
3
2
|
/**
|
|
4
3
|
* Create the state required to render TableCellActions.
|
|
5
4
|
*
|
|
@@ -18,7 +17,7 @@ export const useTableCellActions_unstable = (props, ref) => {
|
|
|
18
17
|
root: 'div'
|
|
19
18
|
},
|
|
20
19
|
root: getNativeElementProps('div', {
|
|
21
|
-
ref
|
|
20
|
+
ref,
|
|
22
21
|
...props
|
|
23
22
|
}),
|
|
24
23
|
visible: (_a = props.visible) !== null && _a !== void 0 ? _a : false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/TableCellActions/useTableCellActions.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/TableCellActions/useTableCellActions.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,QAAsC,2BAAtC;AAGA;;;;;;;;AAQG;;AACH,OAAO,MAAM,4BAA4B,GAAG,CAC1C,KAD0C,EAE1C,GAF0C,KAGjB;;;EACzB,OAAO;IACL,UAAU,EAAE;MACV,IAAI,EAAE;IADI,CADP;IAIL,IAAI,EAAE,qBAAqB,CAAC,KAAD,EAAQ;MACjC,GADiC;MAEjC,GAAG;IAF8B,CAAR,CAJtB;IAQL,OAAO,EAAE,CAAA,EAAA,GAAA,KAAK,CAAC,OAAN,MAAa,IAAb,IAAa,EAAA,KAAA,KAAA,CAAb,GAAa,EAAb,GAAiB;EARrB,CAAP;AAUD,CAdM","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport type { TableCellActionsProps, TableCellActionsState } from './TableCellActions.types';\n\n/**\n * Create the state required to render TableCellActions.\n *\n * The returned state can be modified with hooks such as useTableCellActionsStyles_unstable,\n * before being passed to renderTableCellActions_unstable.\n *\n * @param props - props from this instance of TableCellActions\n * @param ref - reference to root HTMLElement of TableCellActions\n */\nexport const useTableCellActions_unstable = (\n props: TableCellActionsProps,\n ref: React.Ref<HTMLElement>,\n): TableCellActionsState => {\n return {\n components: {\n root: 'div',\n },\n root: getNativeElementProps('div', {\n ref,\n ...props,\n }),\n visible: props.visible ?? false,\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { __styles, mergeClasses } from '@griffel/react';
|
|
2
|
-
import { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';
|
|
3
2
|
export const tableCellActionsClassNames = {
|
|
4
3
|
root: 'fui-TableCellActions'
|
|
5
4
|
};
|
|
@@ -14,18 +13,13 @@ const useStyles = /*#__PURE__*/__styles({
|
|
|
14
13
|
"Bhzewxz": "f1i1t8d1",
|
|
15
14
|
"Bz10aip": "f188r07x",
|
|
16
15
|
"abs64n": "fk73vx1",
|
|
17
|
-
"Frg6f3": ["fcgxt0o", "f1ujusj6"]
|
|
18
|
-
"Brovlpu": "ftqa4ok",
|
|
19
|
-
"B486eqv": "f2hkw1w",
|
|
20
|
-
"B113ap8": "f1upwfw9"
|
|
16
|
+
"Frg6f3": ["fcgxt0o", "f1ujusj6"]
|
|
21
17
|
},
|
|
22
18
|
"visible": {
|
|
23
19
|
"abs64n": "f5p0z4x"
|
|
24
20
|
}
|
|
25
21
|
}, {
|
|
26
|
-
"d": [".f1euv43f{position:absolute;}", ".f10k790i{right:0px;}", ".f1xynx9j{left:0px;}", ".f1i1t8d1{top:50%;}", ".f188r07x{-webkit-transform:translateY(-50%);-moz-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);}", ".fk73vx1{opacity:0;}", ".fcgxt0o{margin-left:auto;}", ".f1ujusj6{margin-right:auto;}", ".
|
|
27
|
-
"f": [".ftqa4ok:focus{outline-style:none;}"],
|
|
28
|
-
"i": [".f2hkw1w:focus-visible{outline-style:none;}"]
|
|
22
|
+
"d": [".f1euv43f{position:absolute;}", ".f10k790i{right:0px;}", ".f1xynx9j{left:0px;}", ".f1i1t8d1{top:50%;}", ".f188r07x{-webkit-transform:translateY(-50%);-moz-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);}", ".fk73vx1{opacity:0;}", ".fcgxt0o{margin-left:auto;}", ".f1ujusj6{margin-right:auto;}", ".f5p0z4x{opacity:1;}"]
|
|
29
23
|
});
|
|
30
24
|
/**
|
|
31
25
|
* Apply styling to the TableCellActions slots based on the state
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/TableCellActions/useTableCellActionsStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,gBAAzC;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/TableCellActions/useTableCellActionsStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,gBAAzC;AAIA,OAAO,MAAM,0BAA0B,GAA0C;EAC/E,IAAI,EAAE;AADyE,CAA1E;AAIP;;AAEG;;AACH,MAAM,SAAS,gBAAG;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAlB;AAeA;;AAEG;;;AACH,OAAO,MAAM,kCAAkC,GAAI,KAAD,IAAwD;EACxG,MAAM,MAAM,GAAG,SAAS,EAAxB;EACA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,0BAA0B,CAAC,IADM,EAEjC,MAAM,CAAC,IAF0B,EAGjC,KAAK,CAAC,OAAN,IAAiB,MAAM,CAAC,OAHS,EAIjC,KAAK,CAAC,IAAN,CAAW,SAJsB,CAAnC;EAOA,OAAO,KAAP;AACD,CAVM","sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport type { TableCellActionsSlots, TableCellActionsState } from './TableCellActions.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const tableCellActionsClassNames: SlotClassNames<TableCellActionsSlots> = {\n root: 'fui-TableCellActions',\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n position: 'absolute',\n right: '0px',\n top: '50%',\n transform: 'translateY(-50%)',\n opacity: 0,\n marginLeft: 'auto',\n },\n\n visible: {\n opacity: 1,\n },\n});\n\n/**\n * Apply styling to the TableCellActions slots based on the state\n */\nexport const useTableCellActionsStyles_unstable = (state: TableCellActionsState): TableCellActionsState => {\n const styles = useStyles();\n state.root.className = mergeClasses(\n tableCellActionsClassNames.root,\n styles.root,\n state.visible && styles.visible,\n state.root.className,\n );\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCellLayout.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/TableCellLayout/TableCellLayout.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { AvatarSizes } from '@fluentui/react-avatar';\n\nexport type TableCellLayoutContextValues = {\n avatar: {\n size?: AvatarSizes;\n };\n};\n\nexport type TableCellLayoutSlots = {\n root: Slot<'div'>;\n\n /**\n * Slot for an icon or other visual element\n */\n media: Slot<'span'>;\n\n /**\n * Main text for the table cell. Children of the root slot are automatically rendered here\n */\n main: Slot<'span'>;\n\n /**\n * Secondary text that describes or complements the main text\n */\n description: Slot<'span'>;\n\n /**\n * A layout wrapper for the main and description slots\n */\n wrapper: Slot<'div'>;\n};\n\n/**\n * TableCellLayout Props\n */\nexport type TableCellLayoutProps = ComponentProps<Partial<TableCellLayoutSlots>> & {\n appearance?: 'primary';\n};\n\n/**\n * State used in rendering TableCellLayout\n */\nexport type TableCellLayoutState = ComponentState<TableCellLayoutSlots> &\n Pick<TableCellLayoutProps, 'appearance'> & { avatarSize: AvatarSizes | undefined }
|
|
1
|
+
{"version":3,"file":"TableCellLayout.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/TableCellLayout/TableCellLayout.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { AvatarSizes } from '@fluentui/react-avatar';\nimport { TableContextValue } from '../Table/Table.types';\n\nexport type TableCellLayoutContextValues = {\n avatar: {\n size?: AvatarSizes;\n };\n};\n\nexport type TableCellLayoutSlots = {\n root: Slot<'div'>;\n\n /**\n * Slot for an icon or other visual element\n */\n media: Slot<'span'>;\n\n /**\n * Main text for the table cell. Children of the root slot are automatically rendered here\n */\n main: Slot<'span'>;\n\n /**\n * Secondary text that describes or complements the main text\n */\n description: Slot<'span'>;\n\n /**\n * A layout wrapper for the main and description slots\n */\n wrapper: Slot<'div'>;\n};\n\n/**\n * TableCellLayout Props\n */\nexport type TableCellLayoutProps = ComponentProps<Partial<TableCellLayoutSlots>> & {\n /**\n * Renders design variants of the table cell\n * @default undefined\n */\n appearance?: 'primary';\n};\n\n/**\n * State used in rendering TableCellLayout\n */\nexport type TableCellLayoutState = ComponentState<TableCellLayoutSlots> &\n Pick<TableCellLayoutProps, 'appearance'> & { avatarSize: AvatarSizes | undefined } & Pick<TableContextValue, 'size'>;\n"]}
|