@fluentui/react-table 9.14.0 → 9.15.1
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.md +35 -2
- package/dist/index.d.ts +10 -3
- package/lib/components/DataGridSelectionCell/useDataGridSelectionCell.js +2 -2
- package/lib/components/DataGridSelectionCell/useDataGridSelectionCell.js.map +1 -1
- package/lib/components/TableSelectionCell/TableSelectionCell.types.js.map +1 -1
- package/lib/components/TableSelectionCell/useTableSelectionCell.js +5 -4
- package/lib/components/TableSelectionCell/useTableSelectionCell.js.map +1 -1
- package/lib/components/TableSelectionCell/useTableSelectionCellStyles.styles.js +2 -2
- package/lib/components/TableSelectionCell/useTableSelectionCellStyles.styles.js.map +1 -1
- package/lib/hooks/useTableColumnResizeMouseHandler.js +4 -8
- package/lib/hooks/useTableColumnResizeMouseHandler.js.map +1 -1
- package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCell.js +2 -2
- package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCell.js.map +1 -1
- package/lib-commonjs/components/TableSelectionCell/useTableSelectionCell.js +4 -4
- package/lib-commonjs/components/TableSelectionCell/useTableSelectionCell.js.map +1 -1
- package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.styles.js +2 -3
- package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.styles.js.map +1 -1
- package/lib-commonjs/hooks/useTableColumnResizeMouseHandler.js +3 -7
- package/lib-commonjs/hooks/useTableColumnResizeMouseHandler.js.map +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,45 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-table
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 02 May 2024 11:31:31 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.15.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-table_v9.15.1)
|
|
8
|
+
|
|
9
|
+
Thu, 02 May 2024 11:31:31 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-table_v9.15.0..@fluentui/react-table_v9.15.1)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- chore: upgrade @fluentui/react-icons to 2.0.237. ([PR #31139](https://github.com/microsoft/fluentui/pull/31139) by ololubek@microsoft.com)
|
|
15
|
+
- refactor: use timeout and animation frame utilities ([PR #31168](https://github.com/microsoft/fluentui/pull/31168) by lingfangao@hotmail.com)
|
|
16
|
+
- Bump @fluentui/react-aria to v9.11.0 ([PR #31231](https://github.com/microsoft/fluentui/pull/31231) by beachball)
|
|
17
|
+
- Bump @fluentui/react-avatar to v9.6.23 ([PR #31231](https://github.com/microsoft/fluentui/pull/31231) by beachball)
|
|
18
|
+
- Bump @fluentui/react-checkbox to v9.2.22 ([PR #31231](https://github.com/microsoft/fluentui/pull/31231) by beachball)
|
|
19
|
+
- Bump @fluentui/react-radio to v9.2.17 ([PR #31231](https://github.com/microsoft/fluentui/pull/31231) by beachball)
|
|
20
|
+
- Bump @fluentui/react-tabster to v9.21.0 ([PR #31231](https://github.com/microsoft/fluentui/pull/31231) by beachball)
|
|
21
|
+
|
|
22
|
+
## [9.15.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-table_v9.15.0)
|
|
23
|
+
|
|
24
|
+
Tue, 23 Apr 2024 08:17:49 GMT
|
|
25
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-table_v9.14.0..@fluentui/react-table_v9.15.0)
|
|
26
|
+
|
|
27
|
+
### Minor changes
|
|
28
|
+
|
|
29
|
+
- fix: Table and DataGrid should not remove cells from the accessibility tree ([PR #31068](https://github.com/microsoft/fluentui/pull/31068) by sarah.higley@microsoft.com)
|
|
30
|
+
- Bump @fluentui/react-aria to v9.10.5 ([PR #31113](https://github.com/microsoft/fluentui/pull/31113) by beachball)
|
|
31
|
+
- Bump @fluentui/react-avatar to v9.6.22 ([PR #31113](https://github.com/microsoft/fluentui/pull/31113) by beachball)
|
|
32
|
+
- Bump @fluentui/react-checkbox to v9.2.21 ([PR #31113](https://github.com/microsoft/fluentui/pull/31113) by beachball)
|
|
33
|
+
- Bump @fluentui/react-context-selector to v9.1.58 ([PR #31113](https://github.com/microsoft/fluentui/pull/31113) by beachball)
|
|
34
|
+
- Bump @fluentui/react-radio to v9.2.16 ([PR #31113](https://github.com/microsoft/fluentui/pull/31113) by beachball)
|
|
35
|
+
- Bump @fluentui/react-shared-contexts to v9.17.0 ([PR #31113](https://github.com/microsoft/fluentui/pull/31113) by beachball)
|
|
36
|
+
- Bump @fluentui/react-tabster to v9.20.1 ([PR #31113](https://github.com/microsoft/fluentui/pull/31113) by beachball)
|
|
37
|
+
- Bump @fluentui/react-utilities to v9.18.7 ([PR #31113](https://github.com/microsoft/fluentui/pull/31113) by beachball)
|
|
38
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.36 ([PR #31113](https://github.com/microsoft/fluentui/pull/31113) by beachball)
|
|
39
|
+
|
|
7
40
|
## [9.14.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-table_v9.14.0)
|
|
8
41
|
|
|
9
|
-
Wed, 17 Apr 2024 21:
|
|
42
|
+
Wed, 17 Apr 2024 21:53:59 GMT
|
|
10
43
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-table_v9.13.0..@fluentui/react-table_v9.14.0)
|
|
11
44
|
|
|
12
45
|
### Minor changes
|
package/dist/index.d.ts
CHANGED
|
@@ -784,10 +784,15 @@ export declare type TableSelectionCellProps = ComponentProps<Partial<TableSelect
|
|
|
784
784
|
*/
|
|
785
785
|
subtle?: boolean;
|
|
786
786
|
/**
|
|
787
|
-
* Completely hides the selection cell
|
|
788
|
-
* @
|
|
787
|
+
* Completely hides the selection cell
|
|
788
|
+
* @deprecated cells should never use hidden, since doing so breaks table structure and screen reader navigation. Use `invisible` instead.
|
|
789
789
|
*/
|
|
790
790
|
hidden?: boolean;
|
|
791
|
+
/**
|
|
792
|
+
* Hides the selection cell visually but takes up the same space
|
|
793
|
+
* @default false
|
|
794
|
+
*/
|
|
795
|
+
invisible?: boolean;
|
|
791
796
|
};
|
|
792
797
|
|
|
793
798
|
export declare type TableSelectionCellSlots = {
|
|
@@ -804,7 +809,9 @@ export declare type TableSelectionCellSlots = {
|
|
|
804
809
|
/**
|
|
805
810
|
* State used in rendering TableSelectionCell
|
|
806
811
|
*/
|
|
807
|
-
export declare type TableSelectionCellState = ComponentState<TableSelectionCellSlots> & Pick<Required<TableSelectionCellProps>, 'type' | 'checked' | 'subtle'
|
|
812
|
+
export declare type TableSelectionCellState = ComponentState<TableSelectionCellSlots> & Pick<Required<TableSelectionCellProps>, 'type' | 'checked' | 'subtle'> & Pick<TableContextValue, 'noNativeElements'> & {
|
|
813
|
+
hidden: boolean;
|
|
814
|
+
};
|
|
808
815
|
|
|
809
816
|
export declare interface TableSelectionState {
|
|
810
817
|
/**
|
|
@@ -36,8 +36,8 @@ import { useTableSelectionCell_unstable } from '../TableSelectionCell/useTableSe
|
|
|
36
36
|
role: 'gridcell',
|
|
37
37
|
checked,
|
|
38
38
|
type,
|
|
39
|
-
|
|
40
|
-
'aria-checked': isHeader ? checked : undefined,
|
|
39
|
+
invisible: isHeader && type === 'radio',
|
|
40
|
+
'aria-checked': isHeader && type !== 'radio' ? checked : undefined,
|
|
41
41
|
'aria-selected': isHeader || checked === 'mixed' ? undefined : checked,
|
|
42
42
|
subtle,
|
|
43
43
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDataGridSelectionCell.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { useTableRowIdContext } 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 = useTableRowIdContext();\n const subtle = useDataGridContext_unstable(ctx => ctx.subtleSelection);\n const checked = useDataGridContext_unstable(ctx => {\n if (isHeader && ctx.selection.selectionMode === '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
|
|
1
|
+
{"version":3,"sources":["useDataGridSelectionCell.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { useTableRowIdContext } 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 = useTableRowIdContext();\n const subtle = useDataGridContext_unstable(ctx => ctx.subtleSelection);\n const checked = useDataGridContext_unstable(ctx => {\n if (isHeader && ctx.selection.selectionMode === '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 invisible: isHeader && type === 'radio',\n 'aria-checked': isHeader && type !== 'radio' ? checked : undefined,\n 'aria-selected': isHeader || checked === 'mixed' ? undefined : checked,\n subtle,\n ...props,\n onClick,\n },\n ref,\n );\n};\n"],"names":["React","useEventCallback","useDataGridContext_unstable","useTableRowIdContext","useIsInTableHeader","useTableSelectionCell_unstable","useDataGridSelectionCell_unstable","props","ref","isHeader","rowId","subtle","ctx","subtleSelection","checked","selection","selectionMode","allRowsSelected","someRowsSelected","isRowSelected","toggleAllRows","type","onClick","e","as","role","invisible","undefined"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,2BAA2B,QAAQ,iCAAiC;AAC7E,SAASC,oBAAoB,QAAQ,8BAA8B;AACnE,SAASC,kBAAkB,QAAQ,oCAAoC;AACvE,SAASC,8BAA8B,QAAQ,8CAA8C;AAG7F;;;;;;;;CAQC,GACD,OAAO,MAAMC,oCAAoC,CAC/CC,OACAC;IAEA,MAAMC,WAAWL;IACjB,MAAMM,QAAQP;IACd,MAAMQ,SAAST,4BAA4BU,CAAAA,MAAOA,IAAIC,eAAe;IACrE,MAAMC,UAAUZ,4BAA4BU,CAAAA;QAC1C,IAAIH,YAAYG,IAAIG,SAAS,CAACC,aAAa,KAAK,eAAe;YAC7D,OAAOJ,IAAIG,SAAS,CAACE,eAAe,GAAG,OAAOL,IAAIG,SAAS,CAACG,gBAAgB,GAAG,UAAU;QAC3F;QAEA,OAAON,IAAIG,SAAS,CAACI,aAAa,CAACT;IACrC;IAEA,MAAMU,gBAAgBlB,4BAA4BU,CAAAA,MAAOA,IAAIG,SAAS,CAACK,aAAa;IACpF,MAAMC,OAAOnB,4BAA4BU,CAAAA,MACvCA,IAAIG,SAAS,CAACC,aAAa,KAAK,gBAAgB,aAAa;IAG/D,MAAMM,UAAUrB,iBAAiB,CAACsB;YAKhChB;QAJA,IAAIE,UAAU;YACZW,cAAcG;QAChB;SAEAhB,iBAAAA,MAAMe,OAAO,cAAbf,qCAAAA,oBAAAA,OAAgBgB;IAClB;IAEA,OAAOlB,+BACL;QACEmB,IAAI;QACJC,MAAM;QACNX;QACAO;QACAK,WAAWjB,YAAYY,SAAS;QAChC,gBAAgBZ,YAAYY,SAAS,UAAUP,UAAUa;QACzD,iBAAiBlB,YAAYK,YAAY,UAAUa,YAAYb;QAC/DH;QACA,GAAGJ,KAAK;QACRe;IACF,GACAd;AAEJ,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["TableSelectionCell.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { Checkbox, CheckboxProps } from '@fluentui/react-checkbox';\nimport type { Radio } from '@fluentui/react-radio';\nimport { TableCellSlots } from '../TableCell/TableCell.types';\nimport { TableContextValue } from '../Table/Table.types';\n\nexport type TableSelectionCellSlots = {\n /**\n * Selection indicator if selection type is checkbox\n */\n checkboxIndicator: Slot<typeof Checkbox>;\n /**\n * Selection indicator if selection type is radio\n */\n radioIndicator: Slot<typeof Radio>;\n} & Pick<TableCellSlots, 'root'>;\n\n/**\n * TableSelectionCell Props\n */\nexport type TableSelectionCellProps = ComponentProps<Partial<TableSelectionCellSlots>> & {\n /**\n * A table can have two kinds of selection modes.\n * @default checkbox\n */\n type?: 'checkbox' | 'radio';\n\n /**\n * @default false\n */\n checked?: CheckboxProps['checked'];\n\n /**\n * Only visible when checked or the parent row is hovered/focused\n * @default false\n */\n subtle?: boolean;\n\n /**\n * Completely hides the selection cell visually but takes up the same space\n * @default false\n */\n
|
|
1
|
+
{"version":3,"sources":["TableSelectionCell.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { Checkbox, CheckboxProps } from '@fluentui/react-checkbox';\nimport type { Radio } from '@fluentui/react-radio';\nimport { TableCellSlots } from '../TableCell/TableCell.types';\nimport { TableContextValue } from '../Table/Table.types';\n\nexport type TableSelectionCellSlots = {\n /**\n * Selection indicator if selection type is checkbox\n */\n checkboxIndicator: Slot<typeof Checkbox>;\n /**\n * Selection indicator if selection type is radio\n */\n radioIndicator: Slot<typeof Radio>;\n} & Pick<TableCellSlots, 'root'>;\n\n/**\n * TableSelectionCell Props\n */\nexport type TableSelectionCellProps = ComponentProps<Partial<TableSelectionCellSlots>> & {\n /**\n * A table can have two kinds of selection modes.\n * @default checkbox\n */\n type?: 'checkbox' | 'radio';\n\n /**\n * @default false\n */\n checked?: CheckboxProps['checked'];\n\n /**\n * Only visible when checked or the parent row is hovered/focused\n * @default false\n */\n subtle?: boolean;\n\n /**\n * Completely hides the selection cell\n * @deprecated cells should never use hidden, since doing so breaks table structure and screen reader navigation. Use `invisible` instead.\n */\n hidden?: boolean;\n\n /**\n * Hides the selection cell visually but takes up the same space\n * @default false\n */\n invisible?: boolean;\n};\n\n/**\n * State used in rendering TableSelectionCell\n */\nexport type TableSelectionCellState = ComponentState<TableSelectionCellSlots> &\n Pick<Required<TableSelectionCellProps>, 'type' | 'checked' | 'subtle'> &\n Pick<TableContextValue, 'noNativeElements'> & {\n /* Visually hides the selection cell; not deprecated on state */\n hidden: boolean;\n };\n"],"names":[],"mappings":"AAAA,WA2DI"}
|
|
@@ -15,7 +15,8 @@ import { useTableContext } from '../../contexts/tableContext';
|
|
|
15
15
|
*/ export const useTableSelectionCell_unstable = (props, ref)=>{
|
|
16
16
|
const tableCellState = useTableCell_unstable(props, ref);
|
|
17
17
|
const { noNativeElements } = useTableContext();
|
|
18
|
-
const { type = 'checkbox', checked = false, subtle = false,
|
|
18
|
+
const { type = 'checkbox', checked = false, subtle = false, // eslint-disable-next-line deprecation/deprecation
|
|
19
|
+
hidden = false, invisible = false } = props;
|
|
19
20
|
return {
|
|
20
21
|
...tableCellState,
|
|
21
22
|
components: {
|
|
@@ -24,14 +25,14 @@ import { useTableContext } from '../../contexts/tableContext';
|
|
|
24
25
|
radioIndicator: Radio
|
|
25
26
|
},
|
|
26
27
|
checkboxIndicator: slot.optional(props.checkboxIndicator, {
|
|
27
|
-
renderByDefault: type === 'checkbox',
|
|
28
|
+
renderByDefault: type === 'checkbox' && !invisible,
|
|
28
29
|
defaultProps: {
|
|
29
30
|
checked: props.checked
|
|
30
31
|
},
|
|
31
32
|
elementType: Checkbox
|
|
32
33
|
}),
|
|
33
34
|
radioIndicator: slot.optional(props.radioIndicator, {
|
|
34
|
-
renderByDefault: type === 'radio',
|
|
35
|
+
renderByDefault: type === 'radio' && !invisible,
|
|
35
36
|
defaultProps: {
|
|
36
37
|
checked: !!checked,
|
|
37
38
|
input: {
|
|
@@ -44,6 +45,6 @@ import { useTableContext } from '../../contexts/tableContext';
|
|
|
44
45
|
checked,
|
|
45
46
|
noNativeElements,
|
|
46
47
|
subtle,
|
|
47
|
-
hidden
|
|
48
|
+
hidden: invisible || hidden
|
|
48
49
|
};
|
|
49
50
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useTableSelectionCell.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useId, slot } from '@fluentui/react-utilities';\nimport { Checkbox } from '@fluentui/react-checkbox';\nimport { Radio } from '@fluentui/react-radio';\nimport type { TableSelectionCellProps, TableSelectionCellState } from './TableSelectionCell.types';\nimport { useTableCell_unstable } from '../TableCell/useTableCell';\nimport { useTableContext } from '../../contexts/tableContext';\n\n/**\n * Create the state required to render TableSelectionCell.\n *\n * The returned state can be modified with hooks such as useTableSelectionCellStyles_unstable,\n * before being passed to renderTableSelectionCell_unstable.\n *\n * @param props - props from this instance of TableSelectionCell\n * @param ref - reference to root HTMLElement of TableSelectionCell\n */\nexport const useTableSelectionCell_unstable = (\n props: TableSelectionCellProps,\n ref: React.Ref<HTMLElement>,\n): TableSelectionCellState => {\n const tableCellState = useTableCell_unstable(props, ref);\n const { noNativeElements } = useTableContext();\n const {
|
|
1
|
+
{"version":3,"sources":["useTableSelectionCell.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useId, slot } from '@fluentui/react-utilities';\nimport { Checkbox } from '@fluentui/react-checkbox';\nimport { Radio } from '@fluentui/react-radio';\nimport type { TableSelectionCellProps, TableSelectionCellState } from './TableSelectionCell.types';\nimport { useTableCell_unstable } from '../TableCell/useTableCell';\nimport { useTableContext } from '../../contexts/tableContext';\n\n/**\n * Create the state required to render TableSelectionCell.\n *\n * The returned state can be modified with hooks such as useTableSelectionCellStyles_unstable,\n * before being passed to renderTableSelectionCell_unstable.\n *\n * @param props - props from this instance of TableSelectionCell\n * @param ref - reference to root HTMLElement of TableSelectionCell\n */\nexport const useTableSelectionCell_unstable = (\n props: TableSelectionCellProps,\n ref: React.Ref<HTMLElement>,\n): TableSelectionCellState => {\n const tableCellState = useTableCell_unstable(props, ref);\n const { noNativeElements } = useTableContext();\n const {\n type = 'checkbox',\n checked = false,\n subtle = false,\n // eslint-disable-next-line deprecation/deprecation\n hidden = false,\n invisible = false,\n } = props;\n\n return {\n ...tableCellState,\n components: {\n ...tableCellState.components,\n checkboxIndicator: Checkbox,\n radioIndicator: Radio,\n },\n checkboxIndicator: slot.optional(props.checkboxIndicator, {\n renderByDefault: type === 'checkbox' && !invisible,\n defaultProps: { checked: props.checked },\n elementType: Checkbox,\n }),\n radioIndicator: slot.optional(props.radioIndicator, {\n renderByDefault: type === 'radio' && !invisible,\n defaultProps: { checked: !!checked, input: { name: useId('table-selection-radio') } },\n elementType: Radio,\n }),\n type,\n checked,\n noNativeElements,\n subtle,\n hidden: invisible || hidden,\n };\n};\n"],"names":["React","useId","slot","Checkbox","Radio","useTableCell_unstable","useTableContext","useTableSelectionCell_unstable","props","ref","tableCellState","noNativeElements","type","checked","subtle","hidden","invisible","components","checkboxIndicator","radioIndicator","optional","renderByDefault","defaultProps","elementType","input","name"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,KAAK,EAAEC,IAAI,QAAQ,4BAA4B;AACxD,SAASC,QAAQ,QAAQ,2BAA2B;AACpD,SAASC,KAAK,QAAQ,wBAAwB;AAE9C,SAASC,qBAAqB,QAAQ,4BAA4B;AAClE,SAASC,eAAe,QAAQ,8BAA8B;AAE9D;;;;;;;;CAQC,GACD,OAAO,MAAMC,iCAAiC,CAC5CC,OACAC;IAEA,MAAMC,iBAAiBL,sBAAsBG,OAAOC;IACpD,MAAM,EAAEE,gBAAgB,EAAE,GAAGL;IAC7B,MAAM,EACJM,OAAO,UAAU,EACjBC,UAAU,KAAK,EACfC,SAAS,KAAK,EACd,mDAAmD;IACnDC,SAAS,KAAK,EACdC,YAAY,KAAK,EAClB,GAAGR;IAEJ,OAAO;QACL,GAAGE,cAAc;QACjBO,YAAY;YACV,GAAGP,eAAeO,UAAU;YAC5BC,mBAAmBf;YACnBgB,gBAAgBf;QAClB;QACAc,mBAAmBhB,KAAKkB,QAAQ,CAACZ,MAAMU,iBAAiB,EAAE;YACxDG,iBAAiBT,SAAS,cAAc,CAACI;YACzCM,cAAc;gBAAET,SAASL,MAAMK,OAAO;YAAC;YACvCU,aAAapB;QACf;QACAgB,gBAAgBjB,KAAKkB,QAAQ,CAACZ,MAAMW,cAAc,EAAE;YAClDE,iBAAiBT,SAAS,WAAW,CAACI;YACtCM,cAAc;gBAAET,SAAS,CAAC,CAACA;gBAASW,OAAO;oBAAEC,MAAMxB,MAAM;gBAAyB;YAAE;YACpFsB,aAAanB;QACf;QACAQ;QACAC;QACAF;QACAG;QACAC,QAAQC,aAAaD;IACvB;AACF,EAAE"}
|
|
@@ -58,10 +58,10 @@ const useStyles = /*#__PURE__*/__styles({
|
|
|
58
58
|
B8a84jv: "f1y7ij6c"
|
|
59
59
|
},
|
|
60
60
|
hidden: {
|
|
61
|
-
|
|
61
|
+
abs64n: "fk73vx1"
|
|
62
62
|
}
|
|
63
63
|
}, {
|
|
64
|
-
d: [".f17mccla{text-align:center;}", ".fz5stix{white-space:nowrap;}", ".f1g0x7ka{padding-top:0;}", ".fhxju0i{padding-right:0;}", ".f1cnd47f{padding-left:0;}", ".f1qch9an{padding-bottom:0;}", ".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);}", ".f22iagw{display:flex;}", ".fqerorx{flex-grow:1;}", ".f122n59{align-items:center;}", ".f4d9j23{justify-content:center;}", ".fk73vx1{opacity:0;}", ".f1y7ij6c[data-fui-focus-within]:focus-within{opacity:1;}"
|
|
64
|
+
d: [".f17mccla{text-align:center;}", ".fz5stix{white-space:nowrap;}", ".f1g0x7ka{padding-top:0;}", ".fhxju0i{padding-right:0;}", ".f1cnd47f{padding-left:0;}", ".f1qch9an{padding-bottom:0;}", ".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);}", ".f22iagw{display:flex;}", ".fqerorx{flex-grow:1;}", ".f122n59{align-items:center;}", ".f4d9j23{justify-content:center;}", ".fk73vx1{opacity:0;}", ".f1y7ij6c[data-fui-focus-within]:focus-within{opacity:1;}"]
|
|
65
65
|
});
|
|
66
66
|
/**
|
|
67
67
|
* Apply styling to the TableSelectionCell slots based on the state
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__styles","mergeClasses","shorthands","createCustomFocusIndicatorStyle","tokens","CELL_WIDTH","tableSelectionCellClassNames","root","checkboxIndicator","radioIndicator","useTableLayoutStyles","mc9l5x","a9b677","d","useFlexLayoutStyles","Bh6795r","Bnnss6s","xawz","Bf4jedk","B2u0y6b","Brf1p80","useStyles","fsow6f","Huce71","z8tnut","z189sj","Byoj8tv","uwmqm3","Bn4voq9","g9k6zt","Bfpq7zp","kdpuga","Bw81rd7","B6xbmo0","dm238s","Bt984gj","subtle","abs64n","B8a84jv","hidden","
|
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","shorthands","createCustomFocusIndicatorStyle","tokens","CELL_WIDTH","tableSelectionCellClassNames","root","checkboxIndicator","radioIndicator","useTableLayoutStyles","mc9l5x","a9b677","d","useFlexLayoutStyles","Bh6795r","Bnnss6s","xawz","Bf4jedk","B2u0y6b","Brf1p80","useStyles","fsow6f","Huce71","z8tnut","z189sj","Byoj8tv","uwmqm3","Bn4voq9","g9k6zt","Bfpq7zp","kdpuga","Bw81rd7","B6xbmo0","dm238s","Bt984gj","subtle","abs64n","B8a84jv","hidden","useTableSelectionCellStyles_unstable","state","styles","layoutStyles","table","flex","className","noNativeElements","checked"],"sources":["useTableSelectionCellStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nexport const CELL_WIDTH = 44;\nexport const tableSelectionCellClassNames = {\n root: 'fui-TableSelectionCell',\n checkboxIndicator: 'fui-TableSelectionCell__checkboxIndicator',\n radioIndicator: 'fui-TableSelectionCell__radioIndicator'\n};\nconst useTableLayoutStyles = makeStyles({\n root: {\n display: 'table-cell',\n width: `${CELL_WIDTH}px`\n }\n});\nconst useFlexLayoutStyles = makeStyles({\n root: {\n display: 'flex',\n ...shorthands.flex(1, 1, '0px'),\n minWidth: `${CELL_WIDTH}px`,\n maxWidth: `${CELL_WIDTH}px`,\n justifyContent: 'center'\n }\n});\n/**\n * Styles for the root slot\n */ const useStyles = makeStyles({\n root: {\n textAlign: 'center',\n whiteSpace: 'nowrap',\n ...shorthands.padding(0),\n ...createCustomFocusIndicatorStyle({\n ...shorthands.outline('2px', 'solid', tokens.colorStrokeFocus2),\n ...shorthands.borderRadius(tokens.borderRadiusMedium)\n }, {\n selector: 'focus'\n })\n },\n radioIndicator: {\n display: 'flex',\n flexGrow: 1,\n alignItems: 'center',\n justifyContent: 'center'\n },\n subtle: {\n opacity: 0,\n ...createCustomFocusIndicatorStyle({\n opacity: 1\n }, {\n selector: 'focus-within'\n })\n },\n hidden: {\n opacity: 0\n }\n});\n/**\n * Apply styling to the TableSelectionCell slots based on the state\n */ export const useTableSelectionCellStyles_unstable = (state)=>{\n const styles = useStyles();\n const layoutStyles = {\n table: useTableLayoutStyles(),\n flex: useFlexLayoutStyles()\n };\n state.root.className = mergeClasses(tableSelectionCellClassNames.root, styles.root, state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root, state.subtle && state.checked === false && styles.subtle, state.hidden && styles.hidden, state.root.className);\n if (state.checkboxIndicator) {\n state.checkboxIndicator.className = mergeClasses(tableSelectionCellClassNames.checkboxIndicator, state.checkboxIndicator.className);\n }\n if (state.radioIndicator) {\n state.radioIndicator.className = mergeClasses(tableSelectionCellClassNames.radioIndicator, styles.radioIndicator, state.radioIndicator.className);\n }\n return state;\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAqBC,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AACrE,SAASC,+BAA+B,QAAQ,yBAAyB;AACzE,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,OAAO,MAAMC,UAAU,GAAG,EAAE;AAC5B,OAAO,MAAMC,4BAA4B,GAAG;EACxCC,IAAI,EAAE,wBAAwB;EAC9BC,iBAAiB,EAAE,2CAA2C;EAC9DC,cAAc,EAAE;AACpB,CAAC;AACD,MAAMC,oBAAoB,gBAAGV,QAAA;EAAAO,IAAA;IAAAI,MAAA;IAAAC,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAK5B,CAAC;AACF,MAAMC,mBAAmB,gBAAGd,QAAA;EAAAO,IAAA;IAAAI,MAAA;IAAAI,OAAA;IAAAC,OAAA;IAAAC,IAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;AAAA;EAAAP,CAAA;AAAA,CAQ3B,CAAC;AACF;AACA;AACA;AAAI,MAAMQ,SAAS,gBAAGrB,QAAA;EAAAO,IAAA;IAAAe,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MA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Ac,CAACqC,SAAS,CAAC;EACrJ;EACA,OAAOL,KAAK;AAChB,CAAC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
|
|
3
|
-
import { getEventClientCoords, isMouseEvent, isTouchEvent } from '@fluentui/react-utilities';
|
|
3
|
+
import { getEventClientCoords, isMouseEvent, isTouchEvent, useAnimationFrame } from '@fluentui/react-utilities';
|
|
4
4
|
export function useTableColumnResizeMouseHandler(columnResizeState) {
|
|
5
5
|
const mouseX = React.useRef(0);
|
|
6
6
|
const currentWidth = React.useRef(0);
|
|
7
7
|
const colId = React.useRef(undefined);
|
|
8
8
|
const [dragging, setDragging] = React.useState(false);
|
|
9
9
|
const { targetDocument } = useFluent();
|
|
10
|
-
const globalWin = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView;
|
|
11
10
|
const { getColumnWidth, setColumnWidth } = columnResizeState;
|
|
12
11
|
const recalculatePosition = React.useCallback((e)=>{
|
|
13
12
|
const { clientX } = getEventClientCoords(e);
|
|
@@ -22,15 +21,12 @@ export function useTableColumnResizeMouseHandler(columnResizeState) {
|
|
|
22
21
|
}, [
|
|
23
22
|
setColumnWidth
|
|
24
23
|
]);
|
|
24
|
+
const [requestRecalcFrame] = useAnimationFrame();
|
|
25
25
|
const onDrag = React.useCallback((e)=>{
|
|
26
26
|
// Using requestAnimationFrame here drastically improves resizing experience on slower CPUs
|
|
27
|
-
|
|
28
|
-
requestAnimationFrame(()=>recalculatePosition(e));
|
|
29
|
-
} else {
|
|
30
|
-
recalculatePosition(e);
|
|
31
|
-
}
|
|
27
|
+
requestRecalcFrame(()=>recalculatePosition(e));
|
|
32
28
|
}, [
|
|
33
|
-
|
|
29
|
+
requestRecalcFrame,
|
|
34
30
|
recalculatePosition
|
|
35
31
|
]);
|
|
36
32
|
const onDragEnd = React.useCallback((event)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useTableColumnResizeMouseHandler.ts"],"sourcesContent":["import * as React from 'react';\nimport { TableColumnId, ColumnResizeState } from './types';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport {\n NativeTouchOrMouseEvent,\n ReactTouchOrMouseEvent,\n getEventClientCoords,\n isMouseEvent,\n isTouchEvent,\n} from '@fluentui/react-utilities';\n\nexport function useTableColumnResizeMouseHandler(columnResizeState: ColumnResizeState) {\n const mouseX = React.useRef(0);\n const currentWidth = React.useRef(0);\n const colId = React.useRef<TableColumnId | undefined>(undefined);\n const [dragging, setDragging] = React.useState<boolean>(false);\n\n const { targetDocument } = useFluent();\n
|
|
1
|
+
{"version":3,"sources":["useTableColumnResizeMouseHandler.ts"],"sourcesContent":["import * as React from 'react';\nimport { TableColumnId, ColumnResizeState } from './types';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport {\n NativeTouchOrMouseEvent,\n ReactTouchOrMouseEvent,\n getEventClientCoords,\n isMouseEvent,\n isTouchEvent,\n useAnimationFrame,\n} from '@fluentui/react-utilities';\n\nexport function useTableColumnResizeMouseHandler(columnResizeState: ColumnResizeState) {\n const mouseX = React.useRef(0);\n const currentWidth = React.useRef(0);\n const colId = React.useRef<TableColumnId | undefined>(undefined);\n const [dragging, setDragging] = React.useState<boolean>(false);\n\n const { targetDocument } = useFluent();\n\n const { getColumnWidth, setColumnWidth } = columnResizeState;\n\n const recalculatePosition = React.useCallback(\n (e: NativeTouchOrMouseEvent) => {\n const { clientX } = getEventClientCoords(e);\n const dx = clientX - mouseX.current;\n\n // Update the local width for the column and set it\n currentWidth.current += dx;\n colId.current && setColumnWidth(e, { columnId: colId.current, width: currentWidth.current });\n mouseX.current = clientX;\n },\n [setColumnWidth],\n );\n\n const [requestRecalcFrame] = useAnimationFrame();\n\n const onDrag = React.useCallback(\n (e: NativeTouchOrMouseEvent) => {\n // Using requestAnimationFrame here drastically improves resizing experience on slower CPUs\n requestRecalcFrame(() => recalculatePosition(e));\n },\n [requestRecalcFrame, recalculatePosition],\n );\n\n const onDragEnd = React.useCallback(\n (event: NativeTouchOrMouseEvent) => {\n if (isMouseEvent(event)) {\n targetDocument?.removeEventListener('mouseup', onDragEnd);\n targetDocument?.removeEventListener('mousemove', onDrag);\n }\n if (isTouchEvent(event)) {\n targetDocument?.removeEventListener('touchend', onDragEnd);\n targetDocument?.removeEventListener('touchmove', onDrag);\n }\n setDragging(false);\n },\n [onDrag, targetDocument],\n );\n\n const getOnMouseDown = React.useCallback(\n (columnId: TableColumnId) => (event: ReactTouchOrMouseEvent) => {\n // Keep the width locally so that we decouple the calculation of the next with from rendering.\n // This makes the whole experience much faster and more precise\n currentWidth.current = getColumnWidth(columnId);\n mouseX.current = getEventClientCoords(event).clientX;\n colId.current = columnId;\n\n if (isMouseEvent(event)) {\n // ignore other buttons than primary mouse button\n if (event.target !== event.currentTarget || event.button !== 0) {\n return;\n }\n targetDocument?.addEventListener('mouseup', onDragEnd);\n targetDocument?.addEventListener('mousemove', onDrag);\n setDragging(true);\n }\n\n if (isTouchEvent(event)) {\n targetDocument?.addEventListener('touchend', onDragEnd);\n targetDocument?.addEventListener('touchmove', onDrag);\n setDragging(true);\n }\n },\n [getColumnWidth, onDrag, onDragEnd, targetDocument],\n );\n\n return {\n getOnMouseDown,\n dragging,\n };\n}\n"],"names":["React","useFluent_unstable","useFluent","getEventClientCoords","isMouseEvent","isTouchEvent","useAnimationFrame","useTableColumnResizeMouseHandler","columnResizeState","mouseX","useRef","currentWidth","colId","undefined","dragging","setDragging","useState","targetDocument","getColumnWidth","setColumnWidth","recalculatePosition","useCallback","e","clientX","dx","current","columnId","width","requestRecalcFrame","onDrag","onDragEnd","event","removeEventListener","getOnMouseDown","target","currentTarget","button","addEventListener"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAGEC,oBAAoB,EACpBC,YAAY,EACZC,YAAY,EACZC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B,MAAMgB,iBAAiBjC,MAAMqB,WAAW,CACtC,CAACK,WAA4B,CAACK;YAC5B,8FAA8F;YAC9F,+DAA+D;YAC/DpB,aAAac,OAAO,GAAGP,eAAeQ;YACtCjB,OAAOgB,OAAO,GAAGtB,qBAAqB4B,OAAOR,OAAO;YACpDX,MAAMa,OAAO,GAAGC;YAEhB,IAAItB,aAAa2B,QAAQ;gBACvB,iDAAiD;gBACjD,IAAIA,MAAMG,MAAM,KAAKH,MAAMI,aAAa,IAAIJ,MAAMK,MAAM,KAAK,GAAG;oBAC9D;gBACF;gBACAnB,2BAAAA,qCAAAA,eAAgBoB,gBAAgB,CAAC,WAAWP;gBAC5Cb,2BAAAA,qCAAAA,eAAgBoB,gBAAgB,CAAC,aAAaR;gBAC9Cd,YAAY;YACd;YAEA,IAAIV,aAAa0B,QAAQ;gBACvBd,2BAAAA,qCAAAA,eAAgBoB,gBAAgB,CAAC,YAAYP;gBAC7Cb,2BAAAA,qCAAAA,eAAgBoB,gBAAgB,CAAC,aAAaR;gBAC9Cd,YAAY;YACd;QACF,GACA;QAACG;QAAgBW;QAAQC;QAAWb;KAAe;IAGrD,OAAO;QACLgB;QACAnB;IACF;AACF"}
|
|
@@ -39,8 +39,8 @@ const useDataGridSelectionCell_unstable = (props, ref)=>{
|
|
|
39
39
|
role: 'gridcell',
|
|
40
40
|
checked,
|
|
41
41
|
type,
|
|
42
|
-
|
|
43
|
-
'aria-checked': isHeader ? checked : undefined,
|
|
42
|
+
invisible: isHeader && type === 'radio',
|
|
43
|
+
'aria-checked': isHeader && type !== 'radio' ? checked : undefined,
|
|
44
44
|
'aria-selected': isHeader || checked === 'mixed' ? undefined : checked,
|
|
45
45
|
subtle,
|
|
46
46
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDataGridSelectionCell.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { useTableRowIdContext } from '../../contexts/rowIdContext';\nimport { useIsInTableHeader } from '../../contexts/tableHeaderContext';\nimport { useTableSelectionCell_unstable } from '../TableSelectionCell/useTableSelectionCell';\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 */ export const useDataGridSelectionCell_unstable = (props, ref)=>{\n const isHeader = useIsInTableHeader();\n const rowId = useTableRowIdContext();\n const subtle = useDataGridContext_unstable((ctx)=>ctx.subtleSelection);\n const checked = useDataGridContext_unstable((ctx)=>{\n if (isHeader && ctx.selection.selectionMode === 'multiselect') {\n return ctx.selection.allRowsSelected ? true : ctx.selection.someRowsSelected ? 'mixed' : false;\n }\n return ctx.selection.isRowSelected(rowId);\n });\n const toggleAllRows = useDataGridContext_unstable((ctx)=>ctx.selection.toggleAllRows);\n const type = useDataGridContext_unstable((ctx)=>ctx.selection.selectionMode === 'multiselect' ? 'checkbox' : 'radio');\n const onClick = useEventCallback((e)=>{\n var _props_onClick;\n if (isHeader) {\n toggleAllRows(e);\n }\n (_props_onClick = props.onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(props, e);\n });\n return useTableSelectionCell_unstable({\n as: 'div',\n role: 'gridcell',\n checked,\n type,\n
|
|
1
|
+
{"version":3,"sources":["useDataGridSelectionCell.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { useTableRowIdContext } from '../../contexts/rowIdContext';\nimport { useIsInTableHeader } from '../../contexts/tableHeaderContext';\nimport { useTableSelectionCell_unstable } from '../TableSelectionCell/useTableSelectionCell';\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 */ export const useDataGridSelectionCell_unstable = (props, ref)=>{\n const isHeader = useIsInTableHeader();\n const rowId = useTableRowIdContext();\n const subtle = useDataGridContext_unstable((ctx)=>ctx.subtleSelection);\n const checked = useDataGridContext_unstable((ctx)=>{\n if (isHeader && ctx.selection.selectionMode === 'multiselect') {\n return ctx.selection.allRowsSelected ? true : ctx.selection.someRowsSelected ? 'mixed' : false;\n }\n return ctx.selection.isRowSelected(rowId);\n });\n const toggleAllRows = useDataGridContext_unstable((ctx)=>ctx.selection.toggleAllRows);\n const type = useDataGridContext_unstable((ctx)=>ctx.selection.selectionMode === 'multiselect' ? 'checkbox' : 'radio');\n const onClick = useEventCallback((e)=>{\n var _props_onClick;\n if (isHeader) {\n toggleAllRows(e);\n }\n (_props_onClick = props.onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(props, e);\n });\n return useTableSelectionCell_unstable({\n as: 'div',\n role: 'gridcell',\n checked,\n type,\n invisible: isHeader && type === 'radio',\n 'aria-checked': isHeader && type !== 'radio' ? checked : undefined,\n 'aria-selected': isHeader || checked === 'mixed' ? undefined : checked,\n subtle,\n ...props,\n onClick\n }, ref);\n};\n"],"names":["useDataGridSelectionCell_unstable","props","ref","isHeader","useIsInTableHeader","rowId","useTableRowIdContext","subtle","useDataGridContext_unstable","ctx","subtleSelection","checked","selection","selectionMode","allRowsSelected","someRowsSelected","isRowSelected","toggleAllRows","type","onClick","useEventCallback","e","_props_onClick","call","useTableSelectionCell_unstable","as","role","invisible","undefined"],"mappings":";;;;+BAciBA;;;eAAAA;;;;iEAdM;gCACU;iCACW;8BACP;oCACF;uCACY;AASpC,MAAMA,oCAAoC,CAACC,OAAOC;IACzD,MAAMC,WAAWC,IAAAA,sCAAkB;IACnC,MAAMC,QAAQC,IAAAA,kCAAoB;IAClC,MAAMC,SAASC,IAAAA,4CAA2B,EAAC,CAACC,MAAMA,IAAIC,eAAe;IACrE,MAAMC,UAAUH,IAAAA,4CAA2B,EAAC,CAACC;QACzC,IAAIN,YAAYM,IAAIG,SAAS,CAACC,aAAa,KAAK,eAAe;YAC3D,OAAOJ,IAAIG,SAAS,CAACE,eAAe,GAAG,OAAOL,IAAIG,SAAS,CAACG,gBAAgB,GAAG,UAAU;QAC7F;QACA,OAAON,IAAIG,SAAS,CAACI,aAAa,CAACX;IACvC;IACA,MAAMY,gBAAgBT,IAAAA,4CAA2B,EAAC,CAACC,MAAMA,IAAIG,SAAS,CAACK,aAAa;IACpF,MAAMC,OAAOV,IAAAA,4CAA2B,EAAC,CAACC,MAAMA,IAAIG,SAAS,CAACC,aAAa,KAAK,gBAAgB,aAAa;IAC7G,MAAMM,UAAUC,IAAAA,gCAAgB,EAAC,CAACC;QAC9B,IAAIC;QACJ,IAAInB,UAAU;YACVc,cAAcI;QAClB;QACCC,CAAAA,iBAAiBrB,MAAMkB,OAAO,AAAD,MAAO,QAAQG,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeC,IAAI,CAACtB,OAAOoB;IACjH;IACA,OAAOG,IAAAA,qDAA8B,EAAC;QAClCC,IAAI;QACJC,MAAM;QACNf;QACAO;QACAS,WAAWxB,YAAYe,SAAS;QAChC,gBAAgBf,YAAYe,SAAS,UAAUP,UAAUiB;QACzD,iBAAiBzB,YAAYQ,YAAY,UAAUiB,YAAYjB;QAC/DJ;QACA,GAAGN,KAAK;QACRkB;IACJ,GAAGjB;AACP"}
|
|
@@ -18,7 +18,7 @@ const _tableContext = require("../../contexts/tableContext");
|
|
|
18
18
|
const useTableSelectionCell_unstable = (props, ref)=>{
|
|
19
19
|
const tableCellState = (0, _useTableCell.useTableCell_unstable)(props, ref);
|
|
20
20
|
const { noNativeElements } = (0, _tableContext.useTableContext)();
|
|
21
|
-
const { type = 'checkbox', checked = false, subtle = false, hidden = false } = props;
|
|
21
|
+
const { type = 'checkbox', checked = false, subtle = false, hidden = false, invisible = false } = props;
|
|
22
22
|
return {
|
|
23
23
|
...tableCellState,
|
|
24
24
|
components: {
|
|
@@ -27,14 +27,14 @@ const useTableSelectionCell_unstable = (props, ref)=>{
|
|
|
27
27
|
radioIndicator: _reactradio.Radio
|
|
28
28
|
},
|
|
29
29
|
checkboxIndicator: _reactutilities.slot.optional(props.checkboxIndicator, {
|
|
30
|
-
renderByDefault: type === 'checkbox',
|
|
30
|
+
renderByDefault: type === 'checkbox' && !invisible,
|
|
31
31
|
defaultProps: {
|
|
32
32
|
checked: props.checked
|
|
33
33
|
},
|
|
34
34
|
elementType: _reactcheckbox.Checkbox
|
|
35
35
|
}),
|
|
36
36
|
radioIndicator: _reactutilities.slot.optional(props.radioIndicator, {
|
|
37
|
-
renderByDefault: type === 'radio',
|
|
37
|
+
renderByDefault: type === 'radio' && !invisible,
|
|
38
38
|
defaultProps: {
|
|
39
39
|
checked: !!checked,
|
|
40
40
|
input: {
|
|
@@ -47,6 +47,6 @@ const useTableSelectionCell_unstable = (props, ref)=>{
|
|
|
47
47
|
checked,
|
|
48
48
|
noNativeElements,
|
|
49
49
|
subtle,
|
|
50
|
-
hidden
|
|
50
|
+
hidden: invisible || hidden
|
|
51
51
|
};
|
|
52
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useTableSelectionCell.js"],"sourcesContent":["import * as React from 'react';\nimport { useId, slot } from '@fluentui/react-utilities';\nimport { Checkbox } from '@fluentui/react-checkbox';\nimport { Radio } from '@fluentui/react-radio';\nimport { useTableCell_unstable } from '../TableCell/useTableCell';\nimport { useTableContext } from '../../contexts/tableContext';\n/**\n * Create the state required to render TableSelectionCell.\n *\n * The returned state can be modified with hooks such as useTableSelectionCellStyles_unstable,\n * before being passed to renderTableSelectionCell_unstable.\n *\n * @param props - props from this instance of TableSelectionCell\n * @param ref - reference to root HTMLElement of TableSelectionCell\n */ export const useTableSelectionCell_unstable = (props, ref)=>{\n const tableCellState = useTableCell_unstable(props, ref);\n const { noNativeElements } = useTableContext();\n const { type = 'checkbox', checked = false, subtle = false, hidden = false } = props;\n return {\n ...tableCellState,\n components: {\n ...tableCellState.components,\n checkboxIndicator: Checkbox,\n radioIndicator: Radio\n },\n checkboxIndicator: slot.optional(props.checkboxIndicator, {\n renderByDefault: type === 'checkbox',\n defaultProps: {\n checked: props.checked\n },\n elementType: Checkbox\n }),\n radioIndicator: slot.optional(props.radioIndicator, {\n renderByDefault: type === 'radio',\n defaultProps: {\n checked: !!checked,\n input: {\n name: useId('table-selection-radio')\n }\n },\n elementType: Radio\n }),\n type,\n checked,\n noNativeElements,\n subtle,\n hidden\n };\n};\n"],"names":["useTableSelectionCell_unstable","props","ref","tableCellState","useTableCell_unstable","noNativeElements","useTableContext","type","checked","subtle","hidden","components","checkboxIndicator","Checkbox","radioIndicator","Radio","slot","optional","renderByDefault","defaultProps","elementType","input","name","useId"],"mappings":";;;;+BAciBA;;;eAAAA;;;;iEAdM;gCACK;+BACH;4BACH;8BACgB;8BACN;AASrB,MAAMA,iCAAiC,CAACC,OAAOC;IACtD,MAAMC,iBAAiBC,IAAAA,mCAAqB,EAACH,OAAOC;IACpD,MAAM,EAAEG,gBAAgB,EAAE,GAAGC,IAAAA,6BAAe;IAC5C,MAAM,EAAEC,OAAO,UAAU,EAAEC,UAAU,KAAK,EAAEC,SAAS,KAAK,
|
|
1
|
+
{"version":3,"sources":["useTableSelectionCell.js"],"sourcesContent":["import * as React from 'react';\nimport { useId, slot } from '@fluentui/react-utilities';\nimport { Checkbox } from '@fluentui/react-checkbox';\nimport { Radio } from '@fluentui/react-radio';\nimport { useTableCell_unstable } from '../TableCell/useTableCell';\nimport { useTableContext } from '../../contexts/tableContext';\n/**\n * Create the state required to render TableSelectionCell.\n *\n * The returned state can be modified with hooks such as useTableSelectionCellStyles_unstable,\n * before being passed to renderTableSelectionCell_unstable.\n *\n * @param props - props from this instance of TableSelectionCell\n * @param ref - reference to root HTMLElement of TableSelectionCell\n */ export const useTableSelectionCell_unstable = (props, ref)=>{\n const tableCellState = useTableCell_unstable(props, ref);\n const { noNativeElements } = useTableContext();\n const { type = 'checkbox', checked = false, subtle = false, // eslint-disable-next-line deprecation/deprecation\n hidden = false, invisible = false } = props;\n return {\n ...tableCellState,\n components: {\n ...tableCellState.components,\n checkboxIndicator: Checkbox,\n radioIndicator: Radio\n },\n checkboxIndicator: slot.optional(props.checkboxIndicator, {\n renderByDefault: type === 'checkbox' && !invisible,\n defaultProps: {\n checked: props.checked\n },\n elementType: Checkbox\n }),\n radioIndicator: slot.optional(props.radioIndicator, {\n renderByDefault: type === 'radio' && !invisible,\n defaultProps: {\n checked: !!checked,\n input: {\n name: useId('table-selection-radio')\n }\n },\n elementType: Radio\n }),\n type,\n checked,\n noNativeElements,\n subtle,\n hidden: invisible || hidden\n };\n};\n"],"names":["useTableSelectionCell_unstable","props","ref","tableCellState","useTableCell_unstable","noNativeElements","useTableContext","type","checked","subtle","hidden","invisible","components","checkboxIndicator","Checkbox","radioIndicator","Radio","slot","optional","renderByDefault","defaultProps","elementType","input","name","useId"],"mappings":";;;;+BAciBA;;;eAAAA;;;;iEAdM;gCACK;+BACH;4BACH;8BACgB;8BACN;AASrB,MAAMA,iCAAiC,CAACC,OAAOC;IACtD,MAAMC,iBAAiBC,IAAAA,mCAAqB,EAACH,OAAOC;IACpD,MAAM,EAAEG,gBAAgB,EAAE,GAAGC,IAAAA,6BAAe;IAC5C,MAAM,EAAEC,OAAO,UAAU,EAAEC,UAAU,KAAK,EAAEC,SAAS,KAAK,EAC1DC,SAAS,KAAK,EAAEC,YAAY,KAAK,EAAE,GAAGV;IACtC,OAAO;QACH,GAAGE,cAAc;QACjBS,YAAY;YACR,GAAGT,eAAeS,UAAU;YAC5BC,mBAAmBC,uBAAQ;YAC3BC,gBAAgBC,iBAAK;QACzB;QACAH,mBAAmBI,oBAAI,CAACC,QAAQ,CAACjB,MAAMY,iBAAiB,EAAE;YACtDM,iBAAiBZ,SAAS,cAAc,CAACI;YACzCS,cAAc;gBACVZ,SAASP,MAAMO,OAAO;YAC1B;YACAa,aAAaP,uBAAQ;QACzB;QACAC,gBAAgBE,oBAAI,CAACC,QAAQ,CAACjB,MAAMc,cAAc,EAAE;YAChDI,iBAAiBZ,SAAS,WAAW,CAACI;YACtCS,cAAc;gBACVZ,SAAS,CAAC,CAACA;gBACXc,OAAO;oBACHC,MAAMC,IAAAA,qBAAK,EAAC;gBAChB;YACJ;YACAH,aAAaL,iBAAK;QACtB;QACAT;QACAC;QACAH;QACAI;QACAC,QAAQC,aAAaD;IACzB;AACJ"}
|
|
@@ -105,7 +105,7 @@ const useFlexLayoutStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
|
105
105
|
B8a84jv: "f1y7ij6c"
|
|
106
106
|
},
|
|
107
107
|
hidden: {
|
|
108
|
-
|
|
108
|
+
abs64n: "fk73vx1"
|
|
109
109
|
}
|
|
110
110
|
}, {
|
|
111
111
|
d: [
|
|
@@ -127,8 +127,7 @@ const useFlexLayoutStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
|
127
127
|
".f122n59{align-items:center;}",
|
|
128
128
|
".f4d9j23{justify-content:center;}",
|
|
129
129
|
".fk73vx1{opacity:0;}",
|
|
130
|
-
".f1y7ij6c[data-fui-focus-within]:focus-within{opacity:1;}"
|
|
131
|
-
".fd7fpy0{visibility:hidden;}"
|
|
130
|
+
".f1y7ij6c[data-fui-focus-within]:focus-within{opacity:1;}"
|
|
132
131
|
]
|
|
133
132
|
});
|
|
134
133
|
const useTableSelectionCellStyles_unstable = (state)=>{
|
package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useTableSelectionCellStyles.styles.js"],"sourcesContent":["import { __styles, mergeClasses, shorthands } from '@griffel/react';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nexport const CELL_WIDTH = 44;\nexport const tableSelectionCellClassNames = {\n root: 'fui-TableSelectionCell',\n checkboxIndicator: 'fui-TableSelectionCell__checkboxIndicator',\n radioIndicator: 'fui-TableSelectionCell__radioIndicator'\n};\nconst useTableLayoutStyles = /*#__PURE__*/__styles({\n root: {\n mc9l5x: \"f15pt5es\",\n a9b677: \"fksc0bp\"\n }\n}, {\n d: [\".f15pt5es{display:table-cell;}\", \".fksc0bp{width:44px;}\"]\n});\nconst useFlexLayoutStyles = /*#__PURE__*/__styles({\n root: {\n mc9l5x: \"f22iagw\",\n Bh6795r: \"fqerorx\",\n Bnnss6s: \"f1neuvcm\",\n xawz: \"fkjuxzh\",\n Bf4jedk: \"fvrlu0f\",\n B2u0y6b: \"f1c71y05\",\n Brf1p80: \"f4d9j23\"\n }\n}, {\n d: [\".f22iagw{display:flex;}\", \".fqerorx{flex-grow:1;}\", \".f1neuvcm{flex-shrink:1;}\", \".fkjuxzh{flex-basis:0px;}\", \".fvrlu0f{min-width:44px;}\", \".f1c71y05{max-width:44px;}\", \".f4d9j23{justify-content:center;}\"]\n});\n/**\n * Styles for the root slot\n */\nconst useStyles = /*#__PURE__*/__styles({\n root: {\n fsow6f: \"f17mccla\",\n Huce71: \"fz5stix\",\n z8tnut: \"f1g0x7ka\",\n z189sj: [\"fhxju0i\", \"f1cnd47f\"],\n Byoj8tv: \"f1qch9an\",\n uwmqm3: [\"f1cnd47f\", \"fhxju0i\"],\n Bn4voq9: \"fz36nt7\",\n g9k6zt: \"f9znhxp\",\n Bfpq7zp: \"fqrak0z\",\n kdpuga: [\"f1o2ludy\", \"f1kjnpwc\"],\n Bw81rd7: [\"f1kjnpwc\", \"f1o2ludy\"],\n B6xbmo0: [\"fxmnebo\", \"f1witrsb\"],\n dm238s: [\"f1witrsb\", \"fxmnebo\"]\n },\n radioIndicator: {\n mc9l5x: \"f22iagw\",\n Bh6795r: \"fqerorx\",\n Bt984gj: \"f122n59\",\n Brf1p80: \"f4d9j23\"\n },\n subtle: {\n abs64n: \"fk73vx1\",\n B8a84jv: \"f1y7ij6c\"\n },\n hidden: {\n
|
|
1
|
+
{"version":3,"sources":["useTableSelectionCellStyles.styles.js"],"sourcesContent":["import { __styles, mergeClasses, shorthands } from '@griffel/react';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nexport const CELL_WIDTH = 44;\nexport const tableSelectionCellClassNames = {\n root: 'fui-TableSelectionCell',\n checkboxIndicator: 'fui-TableSelectionCell__checkboxIndicator',\n radioIndicator: 'fui-TableSelectionCell__radioIndicator'\n};\nconst useTableLayoutStyles = /*#__PURE__*/__styles({\n root: {\n mc9l5x: \"f15pt5es\",\n a9b677: \"fksc0bp\"\n }\n}, {\n d: [\".f15pt5es{display:table-cell;}\", \".fksc0bp{width:44px;}\"]\n});\nconst useFlexLayoutStyles = /*#__PURE__*/__styles({\n root: {\n mc9l5x: \"f22iagw\",\n Bh6795r: \"fqerorx\",\n Bnnss6s: \"f1neuvcm\",\n xawz: \"fkjuxzh\",\n Bf4jedk: \"fvrlu0f\",\n B2u0y6b: \"f1c71y05\",\n Brf1p80: \"f4d9j23\"\n }\n}, {\n d: [\".f22iagw{display:flex;}\", \".fqerorx{flex-grow:1;}\", \".f1neuvcm{flex-shrink:1;}\", \".fkjuxzh{flex-basis:0px;}\", \".fvrlu0f{min-width:44px;}\", \".f1c71y05{max-width:44px;}\", \".f4d9j23{justify-content:center;}\"]\n});\n/**\n * Styles for the root slot\n */\nconst useStyles = /*#__PURE__*/__styles({\n root: {\n fsow6f: \"f17mccla\",\n Huce71: \"fz5stix\",\n z8tnut: \"f1g0x7ka\",\n z189sj: [\"fhxju0i\", \"f1cnd47f\"],\n Byoj8tv: \"f1qch9an\",\n uwmqm3: [\"f1cnd47f\", \"fhxju0i\"],\n Bn4voq9: \"fz36nt7\",\n g9k6zt: \"f9znhxp\",\n Bfpq7zp: \"fqrak0z\",\n kdpuga: [\"f1o2ludy\", \"f1kjnpwc\"],\n Bw81rd7: [\"f1kjnpwc\", \"f1o2ludy\"],\n B6xbmo0: [\"fxmnebo\", \"f1witrsb\"],\n dm238s: [\"f1witrsb\", \"fxmnebo\"]\n },\n radioIndicator: {\n mc9l5x: \"f22iagw\",\n Bh6795r: \"fqerorx\",\n Bt984gj: \"f122n59\",\n Brf1p80: \"f4d9j23\"\n },\n subtle: {\n abs64n: \"fk73vx1\",\n B8a84jv: \"f1y7ij6c\"\n },\n hidden: {\n abs64n: \"fk73vx1\"\n }\n}, {\n d: [\".f17mccla{text-align:center;}\", \".fz5stix{white-space:nowrap;}\", \".f1g0x7ka{padding-top:0;}\", \".fhxju0i{padding-right:0;}\", \".f1cnd47f{padding-left:0;}\", \".f1qch9an{padding-bottom:0;}\", \".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);}\", \".f22iagw{display:flex;}\", \".fqerorx{flex-grow:1;}\", \".f122n59{align-items:center;}\", \".f4d9j23{justify-content:center;}\", \".fk73vx1{opacity:0;}\", \".f1y7ij6c[data-fui-focus-within]:focus-within{opacity:1;}\"]\n});\n/**\n * Apply styling to the TableSelectionCell slots based on the state\n */\nexport const useTableSelectionCellStyles_unstable = state => {\n const styles = useStyles();\n const layoutStyles = {\n table: useTableLayoutStyles(),\n flex: useFlexLayoutStyles()\n };\n state.root.className = mergeClasses(tableSelectionCellClassNames.root, styles.root, state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root, state.subtle && state.checked === false && styles.subtle, state.hidden && styles.hidden, state.root.className);\n if (state.checkboxIndicator) {\n state.checkboxIndicator.className = mergeClasses(tableSelectionCellClassNames.checkboxIndicator, state.checkboxIndicator.className);\n }\n if (state.radioIndicator) {\n state.radioIndicator.className = mergeClasses(tableSelectionCellClassNames.radioIndicator, styles.radioIndicator, state.radioIndicator.className);\n }\n return state;\n};\n//# sourceMappingURL=useTableSelectionCellStyles.styles.js.map"],"names":["CELL_WIDTH","tableSelectionCellClassNames","useTableSelectionCellStyles_unstable","root","checkboxIndicator","radioIndicator","useTableLayoutStyles","__styles","mc9l5x","a9b677","d","useFlexLayoutStyles","Bh6795r","Bnnss6s","xawz","Bf4jedk","B2u0y6b","Brf1p80","useStyles","fsow6f","Huce71","z8tnut","z189sj","Byoj8tv","uwmqm3","Bn4voq9","g9k6zt","Bfpq7zp","kdpuga","Bw81rd7","B6xbmo0","dm238s","Bt984gj","subtle","abs64n","B8a84jv","hidden","state","styles","layoutStyles","table","flex","className","mergeClasses","noNativeElements","checked"],"mappings":";;;;;;;;;;;IAGaA,UAAU;eAAVA;;IACAC,4BAA4B;eAA5BA;;IAgEAC,oCAAoC;eAApCA;;;uBApEsC;AAG5C,MAAMF,aAAa;AACnB,MAAMC,+BAA+B;IAC1CE,MAAM;IACNC,mBAAmB;IACnBC,gBAAgB;AAClB;AACA,MAAMC,uBAAuB,WAAW,GAAEC,IAAAA,eAAQ,EAAC;IACjDJ,MAAM;QACJK,QAAQ;QACRC,QAAQ;IACV;AACF,GAAG;IACDC,GAAG;QAAC;QAAkC;KAAwB;AAChE;AACA,MAAMC,sBAAsB,WAAW,GAAEJ,IAAAA,eAAQ,EAAC;IAChDJ,MAAM;QACJK,QAAQ;QACRI,SAAS;QACTC,SAAS;QACTC,MAAM;QACNC,SAAS;QACTC,SAAS;QACTC,SAAS;IACX;AACF,GAAG;IACDP,GAAG;QAAC;QAA2B;QAA0B;QAA6B;QAA6B;QAA6B;QAA8B;KAAoC;AACpN;AACA;;CAEC,GACD,MAAMQ,YAAY,WAAW,GAAEX,IAAAA,eAAQ,EAAC;I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AS;IACpI;IACA,IAAIL,MAAMhC,cAAc,EAAE;QACxBgC,MAAMhC,cAAc,CAACqC,SAAS,GAAGC,IAAAA,mBAAY,EAAC1C,6BAA6BI,cAAc,EAAEiC,OAAOjC,cAAc,EAAEgC,MAAMhC,cAAc,CAACqC,SAAS;IAClJ;IACA,OAAOL;AACT,GACA,8DAA8D"}
|
|
@@ -18,7 +18,6 @@ function useTableColumnResizeMouseHandler(columnResizeState) {
|
|
|
18
18
|
const colId = _react.useRef(undefined);
|
|
19
19
|
const [dragging, setDragging] = _react.useState(false);
|
|
20
20
|
const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
|
|
21
|
-
const globalWin = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView;
|
|
22
21
|
const { getColumnWidth, setColumnWidth } = columnResizeState;
|
|
23
22
|
const recalculatePosition = _react.useCallback((e)=>{
|
|
24
23
|
const { clientX } = (0, _reactutilities.getEventClientCoords)(e);
|
|
@@ -33,15 +32,12 @@ function useTableColumnResizeMouseHandler(columnResizeState) {
|
|
|
33
32
|
}, [
|
|
34
33
|
setColumnWidth
|
|
35
34
|
]);
|
|
35
|
+
const [requestRecalcFrame] = (0, _reactutilities.useAnimationFrame)();
|
|
36
36
|
const onDrag = _react.useCallback((e)=>{
|
|
37
37
|
// Using requestAnimationFrame here drastically improves resizing experience on slower CPUs
|
|
38
|
-
|
|
39
|
-
requestAnimationFrame(()=>recalculatePosition(e));
|
|
40
|
-
} else {
|
|
41
|
-
recalculatePosition(e);
|
|
42
|
-
}
|
|
38
|
+
requestRecalcFrame(()=>recalculatePosition(e));
|
|
43
39
|
}, [
|
|
44
|
-
|
|
40
|
+
requestRecalcFrame,
|
|
45
41
|
recalculatePosition
|
|
46
42
|
]);
|
|
47
43
|
const onDragEnd = _react.useCallback((event)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useTableColumnResizeMouseHandler.js"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { getEventClientCoords, isMouseEvent, isTouchEvent } from '@fluentui/react-utilities';\nexport function useTableColumnResizeMouseHandler(columnResizeState) {\n const mouseX = React.useRef(0);\n const currentWidth = React.useRef(0);\n const colId = React.useRef(undefined);\n const [dragging, setDragging] = React.useState(false);\n const { targetDocument } = useFluent();\n const
|
|
1
|
+
{"version":3,"sources":["useTableColumnResizeMouseHandler.js"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { getEventClientCoords, isMouseEvent, isTouchEvent, useAnimationFrame } from '@fluentui/react-utilities';\nexport function useTableColumnResizeMouseHandler(columnResizeState) {\n const mouseX = React.useRef(0);\n const currentWidth = React.useRef(0);\n const colId = React.useRef(undefined);\n const [dragging, setDragging] = React.useState(false);\n const { targetDocument } = useFluent();\n const { getColumnWidth, setColumnWidth } = columnResizeState;\n const recalculatePosition = React.useCallback((e)=>{\n const { clientX } = getEventClientCoords(e);\n const dx = clientX - mouseX.current;\n // Update the local width for the column and set it\n currentWidth.current += dx;\n colId.current && setColumnWidth(e, {\n columnId: colId.current,\n width: currentWidth.current\n });\n mouseX.current = clientX;\n }, [\n setColumnWidth\n ]);\n const [requestRecalcFrame] = useAnimationFrame();\n const onDrag = React.useCallback((e)=>{\n // Using requestAnimationFrame here drastically improves resizing experience on slower CPUs\n requestRecalcFrame(()=>recalculatePosition(e));\n }, [\n requestRecalcFrame,\n recalculatePosition\n ]);\n const onDragEnd = React.useCallback((event)=>{\n if (isMouseEvent(event)) {\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener('mouseup', onDragEnd);\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener('mousemove', onDrag);\n }\n if (isTouchEvent(event)) {\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener('touchend', onDragEnd);\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener('touchmove', onDrag);\n }\n setDragging(false);\n }, [\n onDrag,\n targetDocument\n ]);\n const getOnMouseDown = React.useCallback((columnId)=>(event)=>{\n // Keep the width locally so that we decouple the calculation of the next with from rendering.\n // This makes the whole experience much faster and more precise\n currentWidth.current = getColumnWidth(columnId);\n mouseX.current = getEventClientCoords(event).clientX;\n colId.current = columnId;\n if (isMouseEvent(event)) {\n // ignore other buttons than primary mouse button\n if (event.target !== event.currentTarget || event.button !== 0) {\n return;\n }\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener('mouseup', onDragEnd);\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener('mousemove', onDrag);\n setDragging(true);\n }\n if (isTouchEvent(event)) {\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener('touchend', onDragEnd);\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener('touchmove', onDrag);\n setDragging(true);\n }\n }, [\n getColumnWidth,\n onDrag,\n onDragEnd,\n targetDocument\n ]);\n return {\n getOnMouseDown,\n dragging\n };\n}\n"],"names":["useTableColumnResizeMouseHandler","columnResizeState","mouseX","React","useRef","currentWidth","colId","undefined","dragging","setDragging","useState","targetDocument","useFluent","getColumnWidth","setColumnWidth","recalculatePosition","useCallback","e","clientX","getEventClientCoords","dx","current","columnId","width","requestRecalcFrame","useAnimationFrame","onDrag","onDragEnd","event","isMouseEvent","removeEventListener","isTouchEvent","getOnMouseDown","target","currentTarget","button","addEventListener"],"mappings":";;;;+BAGgBA;;;eAAAA;;;;iEAHO;qCACyB;gCACoC;AAC7E,SAASA,iCAAiCC,iBAAiB;IAC9D,MAAMC,SAASC,OAAMC,MAAM,CAAC;IAC5B,MAAMC,eAAeF,OAAMC,MAAM,CAAC;IAClC,MAAME,QAAQH,OAAMC,MAAM,CAACG;IAC3B,MAAM,CAACC,UAAUC,YAAY,GAAGN,OAAMO,QAAQ,CAAC;IAC/C,MAAM,EAAEC,cAAc,EAAE,GAAGC,I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aAAagB,OAAO,GAAGR,eAAeS;YACtCpB,OAAOmB,OAAO,GAAGF,IAAAA,oCAAoB,EAACS,OAAOV,OAAO;YACpDZ,MAAMe,OAAO,GAAGC;YAChB,IAAIO,IAAAA,4BAAY,EAACD,QAAQ;gBACrB,iDAAiD;gBACjD,IAAIA,MAAMK,MAAM,KAAKL,MAAMM,aAAa,IAAIN,MAAMO,MAAM,KAAK,GAAG;oBAC5D;gBACJ;gBACAxB,mBAAmB,QAAQA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeyB,gBAAgB,CAAC,WAAWT;gBAC3GhB,mBAAmB,QAAQA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeyB,gBAAgB,CAAC,aAAaV;gBAC7GjB,YAAY;YAChB;YACA,IAAIsB,IAAAA,4BAAY,EAACH,QAAQ;gBACrBjB,mBAAmB,QAAQA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeyB,gBAAgB,CAAC,YAAYT;gBAC5GhB,mBAAmB,QAAQA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeyB,gBAAgB,CAAC,aAAaV;gBAC7GjB,YAAY;YAChB;QACJ,GAAG;QACHI;QACAa;QACAC;QACAhB;KACH;IACD,OAAO;QACHqB;QACAxB;IACJ;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-table",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.15.1",
|
|
4
4
|
"description": "React components for building web experiences",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -36,17 +36,17 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@fluentui/keyboard-keys": "^9.0.7",
|
|
39
|
-
"@fluentui/react-aria": "^9.
|
|
40
|
-
"@fluentui/react-avatar": "^9.6.
|
|
41
|
-
"@fluentui/react-checkbox": "^9.2.
|
|
42
|
-
"@fluentui/react-context-selector": "^9.1.
|
|
43
|
-
"@fluentui/react-icons": "^2.0.
|
|
44
|
-
"@fluentui/react-radio": "^9.2.
|
|
45
|
-
"@fluentui/react-shared-contexts": "^9.
|
|
46
|
-
"@fluentui/react-tabster": "^9.
|
|
39
|
+
"@fluentui/react-aria": "^9.11.0",
|
|
40
|
+
"@fluentui/react-avatar": "^9.6.23",
|
|
41
|
+
"@fluentui/react-checkbox": "^9.2.22",
|
|
42
|
+
"@fluentui/react-context-selector": "^9.1.58",
|
|
43
|
+
"@fluentui/react-icons": "^2.0.237",
|
|
44
|
+
"@fluentui/react-radio": "^9.2.17",
|
|
45
|
+
"@fluentui/react-shared-contexts": "^9.17.0",
|
|
46
|
+
"@fluentui/react-tabster": "^9.21.0",
|
|
47
47
|
"@fluentui/react-theme": "^9.1.19",
|
|
48
|
-
"@fluentui/react-utilities": "^9.18.
|
|
49
|
-
"@fluentui/react-jsx-runtime": "^9.0.
|
|
48
|
+
"@fluentui/react-utilities": "^9.18.7",
|
|
49
|
+
"@fluentui/react-jsx-runtime": "^9.0.36",
|
|
50
50
|
"@griffel/react": "^1.5.14",
|
|
51
51
|
"@swc/helpers": "^0.5.1"
|
|
52
52
|
},
|