@economic/taco 2.34.1 → 2.35.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Drawer/Context.d.ts +1 -0
- package/dist/components/Drawer/Drawer.d.ts +6 -0
- package/dist/components/Provider/Localization.d.ts +1 -0
- package/dist/components/Select2/Select2.d.ts +25 -4
- package/dist/esm/index.css +4 -0
- package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +13 -3
- package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/Context.js +1 -0
- package/dist/esm/packages/taco/src/components/Drawer/Context.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/Drawer.js +3 -1
- package/dist/esm/packages/taco/src/components/Drawer/Drawer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +41 -8
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/util.js +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/List/components/Toggle.js +26 -15
- package/dist/esm/packages/taco/src/components/List/components/Toggle.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +2 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +48 -10
- package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/util.js +2 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/Body.js +2 -2
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/Body.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/util.js +12 -5
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/util.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js +9 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js +3 -4
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.js +3 -4
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js +0 -4
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js +3 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js.map +1 -1
- package/dist/index.css +4 -0
- package/dist/primitives/Table/Core/components/Body/util.d.ts +2 -2
- package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.d.ts +1 -1
- package/dist/taco.cjs.development.js +164 -62
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +2 -2
@@ -18,7 +18,7 @@ function Row(props) {
|
|
18
18
|
}
|
19
19
|
}, [tableMeta.editing.isEditing, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.lastFocusedCellIndex]);
|
20
20
|
const handleFocus = React__default.useCallback(event => {
|
21
|
-
if (tableMeta.editing.isEditing
|
21
|
+
if (tableMeta.editing.isEditing) {
|
22
22
|
var _event$target$closest, _event$target$closest2;
|
23
23
|
const cellIndex = Number((_event$target$closest = (_event$target$closest2 = event.target.closest('td')) === null || _event$target$closest2 === void 0 ? void 0 : _event$target$closest2.getAttribute('data-cell-index')) !== null && _event$target$closest !== void 0 ? _event$target$closest : undefined);
|
24
24
|
if (!isNaN(cellIndex)) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Row.js","sources":["../../../../../../../../../src/components/Table3/components/Row/Row.tsx"],"sourcesContent":["import React from 'react';\nimport { TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { DisplayRow, DisplayRowProps } from '../../../../primitives/Table/Core/components/Row/BuiltIns/DisplayRow';\nimport { SaveStatus } from './Editing/SaveStatus';\nimport { useAugmentedFocusManager } from '../../../../primitives/Table/Core/components/Body/util';\n\nexport function Row<TType = unknown>(props: DisplayRowProps<TType>) {\n const { row, index, table } = props;\n const focusManager = useAugmentedFocusManager();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === index;\n\n React.useEffect(() => {\n if (tableMeta.editing.isEditing && isActiveRow && tableMeta.editing.lastFocusedCellIndex === undefined) {\n focusManager.focusFirst();\n }\n }, [tableMeta.editing.isEditing, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.lastFocusedCellIndex]);\n\n const handleFocus = React.useCallback(\n (event: React.FocusEvent<HTMLTableRowElement>) => {\n if (tableMeta.editing.isEditing
|
1
|
+
{"version":3,"file":"Row.js","sources":["../../../../../../../../../src/components/Table3/components/Row/Row.tsx"],"sourcesContent":["import React from 'react';\nimport { TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { DisplayRow, DisplayRowProps } from '../../../../primitives/Table/Core/components/Row/BuiltIns/DisplayRow';\nimport { SaveStatus } from './Editing/SaveStatus';\nimport { useAugmentedFocusManager } from '../../../../primitives/Table/Core/components/Body/util';\n\nexport function Row<TType = unknown>(props: DisplayRowProps<TType>) {\n const { row, index, table } = props;\n const focusManager = useAugmentedFocusManager();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === index;\n\n React.useEffect(() => {\n if (tableMeta.editing.isEditing && isActiveRow && tableMeta.editing.lastFocusedCellIndex === undefined) {\n focusManager.focusFirst();\n }\n }, [tableMeta.editing.isEditing, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.lastFocusedCellIndex]);\n\n const handleFocus = React.useCallback(\n (event: React.FocusEvent<HTMLTableRowElement>) => {\n if (tableMeta.editing.isEditing) {\n const cellIndex = Number(event.target.closest('td')?.getAttribute('data-cell-index') ?? undefined);\n\n if (!isNaN(cellIndex)) {\n tableMeta.editing.setLastFocusedCellIndex(Number(cellIndex));\n }\n }\n },\n [tableMeta.editing.isEditing, isActiveRow]\n );\n\n const attributes = {\n 'data-row-editing-invalid':\n tableMeta.editing.isEnabled && tableMeta.editing.hasRowErrors(row.id)\n ? !tableMeta.editing.hasRowErrorsSeen(row.id)\n ? 'unseen'\n : true\n : undefined,\n 'data-row-editing-status':\n tableMeta.editing.isEnabled && tableMeta.editing.getRowSaveStatus(row.id)\n ? tableMeta.editing.getRowSaveStatus(row.id)\n : undefined,\n onFocus: handleFocus,\n };\n\n return (\n <DisplayRow<TType> {...props} {...attributes}>\n {tableMeta.editing.getRowSaveStatus(row.id) ? <SaveStatus rowId={row.id} table={table} /> : null}\n </DisplayRow>\n );\n}\n"],"names":["Row","props","row","index","table","focusManager","useAugmentedFocusManager","tableMeta","options","meta","isActiveRow","rowActive","rowActiveIndex","React","useEffect","editing","isEditing","lastFocusedCellIndex","undefined","focusFirst","handleFocus","useCallback","event","_event$target$closest","_event$target$closest2","cellIndex","Number","target","closest","getAttribute","isNaN","setLastFocusedCellIndex","attributes","isEnabled","hasRowErrors","id","hasRowErrorsSeen","getRowSaveStatus","onFocus","DisplayRow","SaveStatus","rowId"],"mappings":";;;;;SAMgBA,GAAGA,CAAkBC,KAA6B;EAC9D,MAAM;IAAEC,GAAG;IAAEC,KAAK;IAAEC;GAAO,GAAGH,KAAK;EACnC,MAAMI,YAAY,GAAGC,wBAAwB,EAAE;EAC/C,MAAMC,SAA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GAAG,CAACiC,EAAE,CAAC,GACvC,QAAQ,GACR,IAAI,GACRjB,SAAS;IACnB,yBAAyB,EACrBX,SAAS,CAACQ,OAAO,CAACkB,SAAS,IAAI1B,SAAS,CAACQ,OAAO,CAACsB,gBAAgB,CAACnC,GAAG,CAACiC,EAAE,CAAC,GACnE5B,SAAS,CAACQ,OAAO,CAACsB,gBAAgB,CAACnC,GAAG,CAACiC,EAAE,CAAC,GAC1CjB,SAAS;IACnBoB,OAAO,EAAElB;GACZ;EAED,oBACIP,6BAAC0B,UAAU,oBAAYtC,KAAK,EAAM+B,UAAU,GACvCzB,SAAS,CAACQ,OAAO,CAACsB,gBAAgB,CAACnC,GAAG,CAACiC,EAAE,CAAC,gBAAGtB,6BAAC2B,UAAU;IAACC,KAAK,EAAEvC,GAAG,CAACiC,EAAE;IAAE/B,KAAK,EAAEA;IAAS,GAAG,IAAI,CACvF;AAErB;;;;"}
|
@@ -30,10 +30,10 @@ function Body(props) {
|
|
30
30
|
let focusedElement;
|
31
31
|
switch (event.key) {
|
32
32
|
case 'ArrowLeft':
|
33
|
-
focusedElement = isMetaKeyPressed ? focusManager.focusFirst() : focusManager.focusPrevious();
|
33
|
+
focusedElement = isMetaKeyPressed ? focusManager.focusFirst() : focusManager.focusPrevious(true);
|
34
34
|
break;
|
35
35
|
case 'ArrowRight':
|
36
|
-
focusedElement = isMetaKeyPressed ? focusManager.focusLast() : focusManager.focusNext();
|
36
|
+
focusedElement = isMetaKeyPressed ? focusManager.focusLast() : focusManager.focusNext(true);
|
37
37
|
// Scrolls table all the way to the right
|
38
38
|
if (isMetaKeyPressed && tableElement) {
|
39
39
|
tableElement.scrollLeft = tableElement.scrollWidth;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Body.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Body/Body.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { useAugmentedFocusManager } from './util';\nimport { hasFocusableElement } from '../../../../../utils/dom';\nimport { isPressingMetaKey } from '../../../../../utils/keyboard';\nimport { TableRef } from '../../../types';\n\ntype BodyProps<TType = unknown> = React.HTMLAttributes<HTMLTableSectionElement> & {\n enableHorizontalArrowKeyNavigation?: boolean;\n scrollToIndex: (index: number) => void;\n table: ReactTable<TType>;\n tableElement: TableRef | null;\n};\n\nexport function Body<TType = unknown>(props: BodyProps<TType>) {\n const { enableHorizontalArrowKeyNavigation = false, scrollToIndex, table, tableElement, ...attributes } = props;\n const ref = React.useRef<HTMLTableSectionElement>(null);\n const focusManager = useAugmentedFocusManager();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.isDefaultPrevented() || event.isPropagationStopped()) {\n return;\n }\n\n if (tableMeta.rowActive.rowActiveIndex !== undefined) {\n const isFirstRow = tableMeta.rowActive.rowActiveIndex === 0;\n const isLastRow = tableMeta.rowActive.rowActiveIndex === tableMeta.length - 1;\n if (\n event.key === 'Tab' ||\n (enableHorizontalArrowKeyNavigation && (event.key === 'ArrowLeft' || event.key === 'ArrowRight'))\n ) {\n if (event.key === 'Tab' && !hasFocusableElement((event.target as HTMLElement).closest('tr[data-row-id]'))) {\n return;\n }\n\n tableMeta.rowActive.setHoverStatePaused(true);\n\n const isMetaKeyPressed = isPressingMetaKey(event);\n let focusedElement;\n\n switch (event.key) {\n case 'ArrowLeft':\n focusedElement = isMetaKeyPressed ? focusManager.focusFirst() : focusManager.focusPrevious();\n break;\n case 'ArrowRight':\n focusedElement = isMetaKeyPressed ? focusManager.focusLast() : focusManager.focusNext();\n\n // Scrolls table all the way to the right\n if (isMetaKeyPressed && tableElement) {\n tableElement.scrollLeft = tableElement.scrollWidth;\n }\n\n break;\n default:\n focusedElement = event.shiftKey ? focusManager.focusPrevious() : focusManager.focusNext();\n break;\n }\n\n if (focusedElement) {\n // override default behaviour, since we're handling focus internally now\n event.preventDefault();\n return;\n }\n\n // The code below only executes when focusedElement was undefined/null. This happens only when arrow-left/shift+tab\n // is pressed on the first cell or arrow-right/tab is pressed on the last cell.\n if (event.shiftKey || event.key === 'ArrowLeft') {\n if (!isFirstRow) {\n // there are no previous elements to focus, go up a row or go outside the table\n // but only if there are actually any focusable elements in the row\n event.preventDefault();\n const prevIndex = tableMeta.rowActive.rowActiveIndex - 1;\n tableMeta.rowActive.setRowActiveIndex(prevIndex);\n requestAnimationFrame(() => {\n focusManager.focusLast();\n scrollToIndex(prevIndex);\n });\n }\n } else {\n if (!isLastRow) {\n // there are no next elements to focus, go down a row or go outside the table\n // but only if there are actually any focusable elements in the row\n event.preventDefault();\n const nextIndex = tableMeta.rowActive.rowActiveIndex + 1;\n tableMeta.rowActive.setRowActiveIndex(nextIndex);\n requestAnimationFrame(() => {\n focusManager.focusFirst();\n scrollToIndex(nextIndex);\n });\n }\n }\n }\n }\n };\n const handleMouseMove = React.useCallback((event: React.MouseEvent<HTMLTableSectionElement>) => {\n const index = (event.target as HTMLElement)?.closest('tr')?.getAttribute('data-row-index');\n\n if (index) {\n tableMeta.rowActive.setRowHoverIndex(Number.parseInt(index));\n }\n }, []);\n\n // Sometimes this event does not trigger if the mouse leaves the window without leaving boundary of the table\n // this is a browser level bug and there's not much to be done about it\n const handleMouseLeave = React.useCallback(() => tableMeta.rowActive.setRowHoverIndex(undefined), []);\n\n return (\n <tbody\n {...attributes}\n onKeyDown={handleKeyDown}\n onMouseLeave={handleMouseLeave}\n onMouseMove={handleMouseMove}\n ref={ref}\n />\n );\n}\n"],"names":["Body","props","enableHorizontalArrowKeyNavigation","scrollToIndex","table","tableElement","attributes","ref","React","useRef","focusManager","useAugmentedFocusManager","tableMeta","options","meta","handleKeyDown","event","isDefaultPrevented","isPropagationStopped","rowActive","rowActiveIndex","undefined","isFirstRow","isLastRow","length","key","hasFocusableElement","target","closest","setHoverStatePaused","isMetaKeyPressed","isPressingMetaKey","focusedElement","focusFirst","focusPrevious","focusLast","focusNext","scrollLeft","scrollWidth","shiftKey","preventDefault","prevIndex","setRowActiveIndex","requestAnimationFrame","nextIndex","handleMouseMove","useCallback","index","_event$target","_event$target$closest","getAttribute","setRowHoverIndex","Number","parseInt","handleMouseLeave","onKeyDown","onMouseLeave","onMouseMove"],"mappings":";;;;;SAcgBA,IAAIA,CAAkBC,KAAuB;EACzD,MAAM;IAAEC,kCAAkC,GAAG,KAAK;IAAEC,aAAa;IAAEC,KAAK;IAAEC,YAAY;IAAE,GAAGC;GAAY,GAAGL,KAAK;EAC/G,MAAMM,GAAG,GAAGC,cAAK,CAACC,MAAM,CAA0B,IAAI,CAAC;EACvD,MAAMC,YAAY,GAAGC,wBAAwB,EAAE;EAC/C,MAAMC,SAAS,GAAGR,KAAK,CAACS,OAAO,CAACC,IAA6B;EAE7D,MAAMC,aAAa,GAAIC,KAA0B;IAC7C,IAAIA,KAAK,CAACC,kBAAkB,EAAE,IAAID,KAAK,CAACE,oBAAoB,EAAE,EAAE;MAC5D;;IAGJ,IAAIN,SAAS,CAACO,SAAS,CAACC,cAAc,KAAKC,SAAS,EAAE;MAClD,MAAMC,UAAU,GAAGV,SAAS,CAACO,SAAS,CAACC,cAAc,KAAK,CAAC;MAC3D,MAAMG,SAAS,GAAGX,SAAS,CAACO,SAAS,CAACC,cAAc,KAAKR,SAAS,CAACY,MAAM,GAAG,CAAC;MAC7E,IACIR,KAAK,CAACS,GAAG,KAAK,KAAK,IAClBvB,kCAAkC,KAAKc,KAAK,CAACS,GAAG,KAAK,WAAW,IAAIT,KAAK,CAACS,GAAG,KAAK,YAAY,CAAE,EACnG;QACE,IAAIT,KAAK,CAACS,GAAG,KAAK,KAAK,IAAI,CAACC,mBAAmB,CAAEV,KAAK,CAACW,MAAsB,CAACC,OAAO,CAAC,iBAAiB,CAAC,CAAC,EAAE;UACvG;;QAGJhB,SAAS,CAACO,SAAS,CAACU,mBAAmB,CAAC,IAAI,CAAC;QAE7C,MAAMC,gBAAgB,GAAGC,iBAAiB,CAACf,KAAK,CAAC;QACjD,IAAIgB,cAAc;QAElB,QAAQhB,KAAK,CAACS,GAAG;UACb,KAAK,WAAW;YACZO,cAAc,GAAGF,gBAAgB,GAAGpB,YAAY,CAACuB,UAAU,EAAE,GAAGvB,YAAY,CAACwB,aAAa,
|
1
|
+
{"version":3,"file":"Body.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Body/Body.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { useAugmentedFocusManager } from './util';\nimport { hasFocusableElement } from '../../../../../utils/dom';\nimport { isPressingMetaKey } from '../../../../../utils/keyboard';\nimport { TableRef } from '../../../types';\n\ntype BodyProps<TType = unknown> = React.HTMLAttributes<HTMLTableSectionElement> & {\n enableHorizontalArrowKeyNavigation?: boolean;\n scrollToIndex: (index: number) => void;\n table: ReactTable<TType>;\n tableElement: TableRef | null;\n};\n\nexport function Body<TType = unknown>(props: BodyProps<TType>) {\n const { enableHorizontalArrowKeyNavigation = false, scrollToIndex, table, tableElement, ...attributes } = props;\n const ref = React.useRef<HTMLTableSectionElement>(null);\n const focusManager = useAugmentedFocusManager();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.isDefaultPrevented() || event.isPropagationStopped()) {\n return;\n }\n\n if (tableMeta.rowActive.rowActiveIndex !== undefined) {\n const isFirstRow = tableMeta.rowActive.rowActiveIndex === 0;\n const isLastRow = tableMeta.rowActive.rowActiveIndex === tableMeta.length - 1;\n if (\n event.key === 'Tab' ||\n (enableHorizontalArrowKeyNavigation && (event.key === 'ArrowLeft' || event.key === 'ArrowRight'))\n ) {\n if (event.key === 'Tab' && !hasFocusableElement((event.target as HTMLElement).closest('tr[data-row-id]'))) {\n return;\n }\n\n tableMeta.rowActive.setHoverStatePaused(true);\n\n const isMetaKeyPressed = isPressingMetaKey(event);\n let focusedElement;\n\n switch (event.key) {\n case 'ArrowLeft':\n focusedElement = isMetaKeyPressed ? focusManager.focusFirst() : focusManager.focusPrevious(true);\n break;\n case 'ArrowRight':\n focusedElement = isMetaKeyPressed ? focusManager.focusLast() : focusManager.focusNext(true);\n\n // Scrolls table all the way to the right\n if (isMetaKeyPressed && tableElement) {\n tableElement.scrollLeft = tableElement.scrollWidth;\n }\n\n break;\n default:\n focusedElement = event.shiftKey ? focusManager.focusPrevious() : focusManager.focusNext();\n break;\n }\n\n if (focusedElement) {\n // override default behaviour, since we're handling focus internally now\n event.preventDefault();\n return;\n }\n\n // The code below only executes when focusedElement was undefined/null. This happens only when arrow-left/shift+tab\n // is pressed on the first cell or arrow-right/tab is pressed on the last cell.\n if (event.shiftKey || event.key === 'ArrowLeft') {\n if (!isFirstRow) {\n // there are no previous elements to focus, go up a row or go outside the table\n // but only if there are actually any focusable elements in the row\n event.preventDefault();\n const prevIndex = tableMeta.rowActive.rowActiveIndex - 1;\n tableMeta.rowActive.setRowActiveIndex(prevIndex);\n requestAnimationFrame(() => {\n focusManager.focusLast();\n scrollToIndex(prevIndex);\n });\n }\n } else {\n if (!isLastRow) {\n // there are no next elements to focus, go down a row or go outside the table\n // but only if there are actually any focusable elements in the row\n event.preventDefault();\n const nextIndex = tableMeta.rowActive.rowActiveIndex + 1;\n tableMeta.rowActive.setRowActiveIndex(nextIndex);\n requestAnimationFrame(() => {\n focusManager.focusFirst();\n scrollToIndex(nextIndex);\n });\n }\n }\n }\n }\n };\n const handleMouseMove = React.useCallback((event: React.MouseEvent<HTMLTableSectionElement>) => {\n const index = (event.target as HTMLElement)?.closest('tr')?.getAttribute('data-row-index');\n\n if (index) {\n tableMeta.rowActive.setRowHoverIndex(Number.parseInt(index));\n }\n }, []);\n\n // Sometimes this event does not trigger if the mouse leaves the window without leaving boundary of the table\n // this is a browser level bug and there's not much to be done about it\n const handleMouseLeave = React.useCallback(() => tableMeta.rowActive.setRowHoverIndex(undefined), []);\n\n return (\n <tbody\n {...attributes}\n onKeyDown={handleKeyDown}\n onMouseLeave={handleMouseLeave}\n onMouseMove={handleMouseMove}\n ref={ref}\n />\n );\n}\n"],"names":["Body","props","enableHorizontalArrowKeyNavigation","scrollToIndex","table","tableElement","attributes","ref","React","useRef","focusManager","useAugmentedFocusManager","tableMeta","options","meta","handleKeyDown","event","isDefaultPrevented","isPropagationStopped","rowActive","rowActiveIndex","undefined","isFirstRow","isLastRow","length","key","hasFocusableElement","target","closest","setHoverStatePaused","isMetaKeyPressed","isPressingMetaKey","focusedElement","focusFirst","focusPrevious","focusLast","focusNext","scrollLeft","scrollWidth","shiftKey","preventDefault","prevIndex","setRowActiveIndex","requestAnimationFrame","nextIndex","handleMouseMove","useCallback","index","_event$target","_event$target$closest","getAttribute","setRowHoverIndex","Number","parseInt","handleMouseLeave","onKeyDown","onMouseLeave","onMouseMove"],"mappings":";;;;;SAcgBA,IAAIA,CAAkBC,KAAuB;EACzD,MAAM;IAAEC,kCAAkC,GAAG,KAAK;IAAEC,aAAa;IAAEC,KAAK;IAAEC,YAAY;IAAE,GAAGC;GAAY,GAAGL,KAAK;EAC/G,MAAMM,GAAG,GAAGC,cAAK,CAACC,MAAM,CAA0B,IAAI,CAAC;EACvD,MAAMC,YAAY,GAAGC,wBAAwB,EAAE;EAC/C,MAAMC,SAAS,GAAGR,KAAK,CAACS,OAAO,CAACC,IAA6B;EAE7D,MAAMC,aAAa,GAAIC,KAA0B;IAC7C,IAAIA,KAAK,CAACC,kBAAkB,EAAE,IAAID,KAAK,CAACE,oBAAoB,EAAE,EAAE;MAC5D;;IAGJ,IAAIN,SAAS,CAACO,SAAS,CAACC,cAAc,KAAKC,SAAS,EAAE;MAClD,MAAMC,UAAU,GAAGV,SAAS,CAACO,SAAS,CAACC,cAAc,KAAK,CAAC;MAC3D,MAAMG,SAAS,GAAGX,SAAS,CAACO,SAAS,CAACC,cAAc,KAAKR,SAAS,CAACY,MAAM,GAAG,CAAC;MAC7E,IACIR,KAAK,CAACS,GAAG,KAAK,KAAK,IAClBvB,kCAAkC,KAAKc,KAA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B,CAAC;cAClBjC,YAAY,CAACyB,SAAS,EAAE;cACxBhC,aAAa,CAACsC,SAAS,CAAC;aAC3B,CAAC;;SAET,MAAM;UACH,IAAI,CAAClB,SAAS,EAAE;;;YAGZP,KAAK,CAACwB,cAAc,EAAE;YACtB,MAAMI,SAAS,GAAGhC,SAAS,CAACO,SAAS,CAACC,cAAc,GAAG,CAAC;YACxDR,SAAS,CAACO,SAAS,CAACuB,iBAAiB,CAACE,SAAS,CAAC;YAChDD,qBAAqB,CAAC;cAClBjC,YAAY,CAACuB,UAAU,EAAE;cACzB9B,aAAa,CAACyC,SAAS,CAAC;aAC3B,CAAC;;;;;GAKrB;EACD,MAAMC,eAAe,GAAGrC,cAAK,CAACsC,WAAW,CAAE9B,KAAgD;;IACvF,MAAM+B,KAAK,IAAAC,aAAA,GAAIhC,KAAK,CAACW,MAAsB,cAAAqB,aAAA,wBAAAC,qBAAA,GAA5BD,aAAA,CAA8BpB,OAAO,CAAC,IAAI,CAAC,cAAAqB,qBAAA,uBAA3CA,qBAAA,CAA6CC,YAAY,CAAC,gBAAgB,CAAC;IAE1F,IAAIH,KAAK,EAAE;MACPnC,SAAS,CAACO,SAAS,CAACgC,gBAAgB,CAACC,MAAM,CAACC,QAAQ,CAACN,KAAK,CAAC,CAAC;;GAEnE,EAAE,EAAE,CAAC;;;EAIN,MAAMO,gBAAgB,GAAG9C,cAAK,CAACsC,WAAW,CAAC,MAAMlC,SAAS,CAACO,SAAS,CAACgC,gBAAgB,CAAC9B,SAAS,CAAC,EAAE,EAAE,CAAC;EAErG,oBACIb,wDACQF,UAAU;IACdiD,SAAS,EAAExC,aAAa;IACxByC,YAAY,EAAEF,gBAAgB;IAC9BG,WAAW,EAAEZ,eAAe;IAC5BtC,GAAG,EAAEA;KACP;AAEV;;;;"}
|
@@ -1,15 +1,22 @@
|
|
1
|
+
import { isElementInteractive, hasFocusableElement } from '../../../../../utils/dom.js';
|
1
2
|
import { useFocusManager } from '@react-aria/focus';
|
2
3
|
|
3
|
-
const
|
4
|
+
const FOCUS_MANAGER_OPTIONS_TAB = {
|
4
5
|
accept: element => !!element.closest('tr[data-row-active="true"]'),
|
5
6
|
tabbable: true
|
6
7
|
};
|
8
|
+
const FOCUS_MANAGER_OPTIONS_ARROW_KEYS = {
|
9
|
+
accept: element => {
|
10
|
+
const acceptTabbable = isElementInteractive(element) ? element.getAttribute('tabindex') !== '-1' : true;
|
11
|
+
return !!element.closest('tr[data-row-active="true"]') && !hasFocusableElement(element) && acceptTabbable;
|
12
|
+
}
|
13
|
+
};
|
7
14
|
function useAugmentedFocusManager() {
|
8
15
|
const focusManager = useFocusManager();
|
9
|
-
const focusPrevious = () => focusManager.focusPrevious(
|
10
|
-
const focusNext = () => focusManager.focusNext(
|
11
|
-
const focusFirst = () => focusManager.focusFirst(
|
12
|
-
const focusLast = () => focusManager.focusLast(
|
16
|
+
const focusPrevious = (arrowNavigation = false) => focusManager.focusPrevious(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);
|
17
|
+
const focusNext = (arrowNavigation = false) => focusManager.focusNext(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);
|
18
|
+
const focusFirst = () => focusManager.focusFirst(FOCUS_MANAGER_OPTIONS_TAB);
|
19
|
+
const focusLast = () => focusManager.focusLast(FOCUS_MANAGER_OPTIONS_TAB);
|
13
20
|
return {
|
14
21
|
focusPrevious,
|
15
22
|
focusNext,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"util.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Body/util.ts"],"sourcesContent":["import { useFocusManager } from '@react-aria/focus';\n\nconst
|
1
|
+
{"version":3,"file":"util.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Body/util.ts"],"sourcesContent":["import { useFocusManager } from '@react-aria/focus';\nimport { hasFocusableElement, isElementInteractive } from '../../../../../utils/dom';\n\nconst FOCUS_MANAGER_OPTIONS_TAB = {\n accept: (element: Element) => !!element.closest('tr[data-row-active=\"true\"]'),\n tabbable: true,\n};\n\nconst FOCUS_MANAGER_OPTIONS_ARROW_KEYS = {\n accept: (element: Element) => {\n const acceptTabbable = isElementInteractive(element) ? element.getAttribute('tabindex') !== '-1' : true;\n return !!element.closest('tr[data-row-active=\"true\"]') && !hasFocusableElement(element as HTMLElement) && acceptTabbable;\n },\n};\n\nexport function useAugmentedFocusManager() {\n const focusManager = useFocusManager();\n\n const focusPrevious = (arrowNavigation = false) =>\n focusManager.focusPrevious(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);\n const focusNext = (arrowNavigation = false) =>\n focusManager.focusNext(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);\n const focusFirst = () => focusManager.focusFirst(FOCUS_MANAGER_OPTIONS_TAB);\n const focusLast = () => focusManager.focusLast(FOCUS_MANAGER_OPTIONS_TAB);\n\n return {\n focusPrevious,\n focusNext,\n focusFirst,\n focusLast,\n };\n}\n"],"names":["FOCUS_MANAGER_OPTIONS_TAB","accept","element","closest","tabbable","FOCUS_MANAGER_OPTIONS_ARROW_KEYS","acceptTabbable","isElementInteractive","getAttribute","hasFocusableElement","useAugmentedFocusManager","focusManager","useFocusManager","focusPrevious","arrowNavigation","focusNext","focusFirst","focusLast"],"mappings":";;;AAGA,MAAMA,yBAAyB,GAAG;EAC9BC,MAAM,EAAGC,OAAgB,IAAK,CAAC,CAACA,OAAO,CAACC,OAAO,CAAC,4BAA4B,CAAC;EAC7EC,QAAQ,EAAE;CACb;AAED,MAAMC,gCAAgC,GAAG;EACrCJ,MAAM,EAAGC,OAAgB;IACrB,MAAMI,cAAc,GAAGC,oBAAoB,CAACL,OAAO,CAAC,GAAGA,OAAO,CAACM,YAAY,CAAC,UAAU,CAAC,KAAK,IAAI,GAAG,IAAI;IACvG,OAAO,CAAC,CAACN,OAAO,CAACC,OAAO,CAAC,4BAA4B,CAAC,IAAI,CAACM,mBAAmB,CAACP,OAAsB,CAAC,IAAII,cAAc;;CAE/H;SAEeI,wBAAwBA;EACpC,MAAMC,YAAY,GAAGC,eAAe,EAAE;EAEtC,MAAMC,aAAa,GAAGA,CAACC,eAAe,GAAG,KAAK,KAC1CH,YAAY,CAACE,aAAa,CAACC,eAAe,GAAGT,gCAAgC,GAAGL,yBAAyB,CAAC;EAC9G,MAAMe,SAAS,GAAGA,CAACD,eAAe,GAAG,KAAK,KACtCH,YAAY,CAACI,SAAS,CAACD,eAAe,GAAGT,gCAAgC,GAAGL,yBAAyB,CAAC;EAC1G,MAAMgB,UAAU,GAAGA,MAAML,YAAY,CAACK,UAAU,CAAChB,yBAAyB,CAAC;EAC3E,MAAMiB,SAAS,GAAGA,MAAMN,YAAY,CAACM,SAAS,CAACjB,yBAAyB,CAAC;EAEzE,OAAO;IACHa,aAAa;IACbE,SAAS;IACTC,UAAU;IACVC;GACH;AACL;;;;"}
|
package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js
CHANGED
@@ -150,7 +150,15 @@ function HeaderMenu(props) {
|
|
150
150
|
icon: "more",
|
151
151
|
menu: popoverElement ? undefined : menuProps => ( /*#__PURE__*/React__default.createElement(Menu, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu.Content, null, memoedMenuItems))),
|
152
152
|
popover: popoverElement,
|
153
|
-
onClickCapture: event => event.preventDefault()
|
153
|
+
onClickCapture: event => event.preventDefault(),
|
154
|
+
onKeyDown: event => {
|
155
|
+
// Removes focus from the column header menu button so that active row shortcuts execute when Tab,
|
156
|
+
// Shift+Tab, or any other keydown event occurs.
|
157
|
+
if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
|
158
|
+
var _event$currentTarget;
|
159
|
+
(_event$currentTarget = event.currentTarget) === null || _event$currentTarget === void 0 ? void 0 : _event$currentTarget.blur();
|
160
|
+
}
|
161
|
+
}
|
154
162
|
});
|
155
163
|
}
|
156
164
|
|
package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Menu.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Header/components/Menu.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { IconButton } from '../../../../../../components/IconButton/IconButton';\nimport { Menu as MenuPrimitive } from '../../../../../../components/Menu/Menu';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { GotoPopover } from './Goto';\nimport { TableColumnMenu, TableColumnSortDirection } from '../../../../types';\n\nexport type HeaderMenuProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {\n canFilter: boolean;\n canGoto: boolean;\n canHide: boolean;\n canPin: boolean;\n canSort: boolean;\n customMenu?: TableColumnMenu;\n index: number;\n isFiltered: boolean;\n onFilter?: () => void;\n onGoto?: (query: string) => Promise<number>;\n onHide?: (event: unknown) => void;\n onPin?: (index: number | undefined) => void;\n onSortToggle?: (sortDirection: TableColumnSortDirection | false) => void;\n scrollToIndex: (index: number) => void;\n setRowActiveIndex: (index: number) => void;\n sortDirection?: TableColumnSortDirection | false;\n};\n\nexport function HeaderMenu(props: HeaderMenuProps) {\n const {\n canFilter,\n canGoto,\n canHide,\n canPin,\n canSort,\n customMenu,\n index,\n isFiltered,\n onFilter: handleFilter,\n onGoto: handleGoto,\n onHide: handleHide,\n onPin: handlePin,\n onSortToggle: handleSortToggle,\n scrollToIndex,\n setRowActiveIndex,\n sortDirection,\n } = props;\n const { texts } = useLocalization();\n const [popover, setPopover] = React.useState<string | undefined>(undefined);\n\n let popoverElement;\n\n if (popover) {\n const handleClosePopover = () => setPopover(undefined);\n\n switch (popover) {\n case 'goto': {\n if (handleGoto) {\n const goto = async (query: string) => {\n try {\n const index = await handleGoto(query);\n setRowActiveIndex(index);\n scrollToIndex(index);\n } catch (e) {\n console.error(e);\n //\n } finally {\n handleClosePopover();\n }\n };\n popoverElement = props => <GotoPopover {...props} open onChange={handleClosePopover} onGoto={goto} />;\n }\n }\n }\n }\n\n const memoedMenuItems = React.useMemo(() => {\n const menuItems: JSX.Element[] = [];\n\n if (canHide && handleHide) {\n // we do this in the next tick, otherwise the menu closes and react throws a \"state update on unmounted component\" error\n const handleClick = event => setTimeout(() => handleHide(event), 1);\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"eye-off\" onClick={handleClick}>\n {texts.table.columns.menu.hideColumn}\n </MenuPrimitive.Item>\n );\n }\n\n if (canSort) {\n menuItems.push(\n <MenuPrimitive.Item\n icon=\"sort-by\"\n subMenu={() => (\n <MenuPrimitive.SubMenu>\n <MenuPrimitive.RadioGroup onChange={handleSortToggle as any} value={sortDirection}>\n <MenuPrimitive.RadioGroup.Item value=\"asc\">\n {texts.table.columns.menu.sortingOrder.ascending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value=\"desc\">\n {texts.table.columns.menu.sortingOrder.descending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={false}>\n {texts.table.columns.menu.sortingOrder.unsorted}\n </MenuPrimitive.RadioGroup.Item>\n </MenuPrimitive.RadioGroup>\n </MenuPrimitive.SubMenu>\n )}>\n {texts.table.columns.menu.sorting}\n </MenuPrimitive.Item>\n );\n }\n\n if (canGoto) {\n menuItems.push(\n <MenuPrimitive.Item icon=\"move\" onClick={() => setPopover('goto')} shortcut=\"g\">\n {texts.table.columns.menu.gotoRow}...\n </MenuPrimitive.Item>\n );\n }\n\n if (canPin && handlePin) {\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-freeze\" onClick={() => handlePin(index)}>\n {index === 0\n ? texts.table.columns.menu.freezeFirstColumn\n : texts.table.columns.menu.freezeUptoColumn.replace('[TOTAL]', String(index + 1))}\n </MenuPrimitive.Item>\n );\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-unfreeze\" onClick={() => handlePin(undefined)}>\n {texts.table.columns.menu.unfreezeColumns}\n </MenuPrimitive.Item>\n );\n }\n if (canFilter && handleFilter) {\n menuItems.push(\n <MenuPrimitive.Item icon={isFiltered ? 'filter-solid' : 'filter'} onClick={() => handleFilter()}>\n {isFiltered ? texts.table.columns.menu.editFilter : texts.table.columns.menu.filter}\n </MenuPrimitive.Item>\n );\n }\n\n if (customMenu) {\n const menu = customMenu({ trigger: undefined });\n const customItems = React.Children.toArray(menu.props.children.props.children) as JSX.Element[];\n\n if (customItems.length) {\n if (menuItems.length) {\n menuItems.push(<MenuPrimitive.Separator />);\n }\n\n menuItems.push(...customItems);\n }\n }\n\n return menuItems.map((item, key) => React.cloneElement(item, { key }));\n }, [\n canFilter,\n canGoto,\n canHide,\n canPin,\n canSort,\n customMenu,\n handleGoto,\n handleSortToggle,\n index,\n isFiltered,\n sortDirection,\n ]);\n\n // can't use display: none because the button needs to be focusable\n const className = cn(\n // positioning\n 'justify-end overflow-hidden',\n // sizing\n '!h-6 !w-0 !min-h-[theme(spacing.6)] !min-w-0',\n // visible - hover\n 'group-hover/header:!w-6 group-hover/header:!min-w-[theme(spacing.6)] group-hover/header:-mr-1',\n // visible - expanded\n 'aria-expanded:!w-6 aria-expanded:!min-w-[theme(spacing.6)]',\n // visible - focus\n 'focus:!w-6 focus:!min-w-[theme(spacing.6)]',\n {\n '!w-6 !min-w-[theme(spacing.6)]': !!popoverElement,\n },\n props.className\n );\n\n return (\n <IconButton\n className={className}\n icon=\"more\"\n menu={\n popoverElement\n ? undefined\n : menuProps => (\n <MenuPrimitive {...menuProps}>\n <MenuPrimitive.Content>{memoedMenuItems}</MenuPrimitive.Content>\n </MenuPrimitive>\n )\n }\n popover={popoverElement}\n onClickCapture={event => event.preventDefault()}\n />\n );\n}\n"],"names":["HeaderMenu","props","canFilter","canGoto","canHide","canPin","canSort","customMenu","index","isFiltered","onFilter","handleFilter","onGoto","handleGoto","onHide","handleHide","onPin","handlePin","onSortToggle","handleSortToggle","scrollToIndex","setRowActiveIndex","sortDirection","texts","useLocalization","popover","setPopover","React","useState","undefined","popoverElement","handleClosePopover","goto","query","Promise","resolve","then","e","console","error","_wasThrown","_result","_temp","reject","GotoPopover","open","onChange","memoedMenuItems","useMemo","menuItems","handleClick","event","setTimeout","push","MenuPrimitive","Item","icon","onClick","table","columns","menu","hideColumn","subMenu","SubMenu","RadioGroup","value","sortingOrder","ascending","descending","unsorted","sorting","shortcut","gotoRow","freezeFirstColumn","freezeUptoColumn","replace","String","unfreezeColumns","editFilter","filter","trigger","customItems","Children","toArray","children","length","Separator","map","item","key","cloneElement","className","cn","IconButton","menuProps","Content","onClickCapture","preventDefault"],"mappings":";;;;;;;;SA2BgBA,UAAUA,CAACC,KAAsB;EAC7C,MAAM;IACFC,SAAS;IACTC,OAAO;IACPC,OAAO;IACPC,MAAM;IACNC,OAAO;IACPC,UAAU;IACVC,KAAK;IACLC,UAAU;IACVC,QAAQ,EAAEC,YAAY;IACtBC,MAAM,EAAEC,UAAU;IAClBC,MAAM,EAAEC,UAAU;IAClBC,KAAK,EAAEC,SAAS;IAChBC,YAAY,EAAEC,gBAAgB;IAC9BC,aAAa;IACbC,iBAAiB;IACjBC;GACH,GAAGrB,KAAK;EACT,MAAM;IAAEsB;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAqBC,SAAS,CAAC;EAE3E,IAAIC,cAAc;EAElB,IAAIL,OAAO,EAAE;IACT,MAAMM,kBAAkB,GAAGA,MAAML,UAAU,CAACG,SAAS,CAAC;IAEtD,QAAQJ,OAAO;MACX,KAAK,MAAM;QAAE;UACT,IAAIZ,UAAU,EAAE;YACZ,MAAMmB,IAAI,aAAUC,KAAa;cAAA;;4CACzB;oBAAA,OAAAC,OAAA,CAAAC,OAAA,CACoBtB,UAAU,CAACoB,KAAK,CAAC,EAAAG,IAAA,WAA/B5B,KAAK;sBACXa,iBAAiB,CAACb,KAAK,CA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,UAAU,EACVa,aAAa,CAChB,CAAC;;EAGF,MAAMqE,SAAS,GAAGC,EAAE;;EAEhB,6BAA6B;;EAE7B,8CAA8C;;EAE9C,+FAA+F;;EAE/F,4DAA4D;;EAE5D,4CAA4C,EAC5C;IACI,gCAAgC,EAAE,CAAC,CAAC9D;GACvC,EACD7B,KAAK,CAAC0F,SAAS,CAClB;EAED,oBACIhE,6BAACkE,UAAU;IACPF,SAAS,EAAEA,SAAS;IACpBnC,IAAI,EAAC,MAAM;IACXI,IAAI,EACA9B,cAAc,GACRD,SAAS,GACTiE,SAAS,mBACLnE,6BAAC2B,IAAa,oBAAKwC,SAAS,gBACxBnE,6BAAC2B,IAAa,CAACyC,OAAO,QAAEhD,eAAe,CAAyB,CACpD,CACnB;IAEXtB,OAAO,EAAEK,cAAc;IACvBkE,cAAc,EAAE7C,KAAK,IAAIA,KAAK,CAAC8C,cAAc;IAC/C;AAEV;;;;"}
|
1
|
+
{"version":3,"file":"Menu.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Header/components/Menu.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { IconButton } from '../../../../../../components/IconButton/IconButton';\nimport { Menu as MenuPrimitive } from '../../../../../../components/Menu/Menu';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { GotoPopover } from './Goto';\nimport { TableColumnMenu, TableColumnSortDirection } from '../../../../types';\n\nexport type HeaderMenuProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {\n canFilter: boolean;\n canGoto: boolean;\n canHide: boolean;\n canPin: boolean;\n canSort: boolean;\n customMenu?: TableColumnMenu;\n index: number;\n isFiltered: boolean;\n onFilter?: () => void;\n onGoto?: (query: string) => Promise<number>;\n onHide?: (event: unknown) => void;\n onPin?: (index: number | undefined) => void;\n onSortToggle?: (sortDirection: TableColumnSortDirection | false) => void;\n scrollToIndex: (index: number) => void;\n setRowActiveIndex: (index: number) => void;\n sortDirection?: TableColumnSortDirection | false;\n};\n\nexport function HeaderMenu(props: HeaderMenuProps) {\n const {\n canFilter,\n canGoto,\n canHide,\n canPin,\n canSort,\n customMenu,\n index,\n isFiltered,\n onFilter: handleFilter,\n onGoto: handleGoto,\n onHide: handleHide,\n onPin: handlePin,\n onSortToggle: handleSortToggle,\n scrollToIndex,\n setRowActiveIndex,\n sortDirection,\n } = props;\n const { texts } = useLocalization();\n const [popover, setPopover] = React.useState<string | undefined>(undefined);\n\n let popoverElement;\n\n if (popover) {\n const handleClosePopover = () => setPopover(undefined);\n\n switch (popover) {\n case 'goto': {\n if (handleGoto) {\n const goto = async (query: string) => {\n try {\n const index = await handleGoto(query);\n setRowActiveIndex(index);\n scrollToIndex(index);\n } catch (e) {\n console.error(e);\n //\n } finally {\n handleClosePopover();\n }\n };\n popoverElement = props => <GotoPopover {...props} open onChange={handleClosePopover} onGoto={goto} />;\n }\n }\n }\n }\n\n const memoedMenuItems = React.useMemo(() => {\n const menuItems: JSX.Element[] = [];\n\n if (canHide && handleHide) {\n // we do this in the next tick, otherwise the menu closes and react throws a \"state update on unmounted component\" error\n const handleClick = event => setTimeout(() => handleHide(event), 1);\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"eye-off\" onClick={handleClick}>\n {texts.table.columns.menu.hideColumn}\n </MenuPrimitive.Item>\n );\n }\n\n if (canSort) {\n menuItems.push(\n <MenuPrimitive.Item\n icon=\"sort-by\"\n subMenu={() => (\n <MenuPrimitive.SubMenu>\n <MenuPrimitive.RadioGroup onChange={handleSortToggle as any} value={sortDirection}>\n <MenuPrimitive.RadioGroup.Item value=\"asc\">\n {texts.table.columns.menu.sortingOrder.ascending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value=\"desc\">\n {texts.table.columns.menu.sortingOrder.descending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={false}>\n {texts.table.columns.menu.sortingOrder.unsorted}\n </MenuPrimitive.RadioGroup.Item>\n </MenuPrimitive.RadioGroup>\n </MenuPrimitive.SubMenu>\n )}>\n {texts.table.columns.menu.sorting}\n </MenuPrimitive.Item>\n );\n }\n\n if (canGoto) {\n menuItems.push(\n <MenuPrimitive.Item icon=\"move\" onClick={() => setPopover('goto')} shortcut=\"g\">\n {texts.table.columns.menu.gotoRow}...\n </MenuPrimitive.Item>\n );\n }\n\n if (canPin && handlePin) {\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-freeze\" onClick={() => handlePin(index)}>\n {index === 0\n ? texts.table.columns.menu.freezeFirstColumn\n : texts.table.columns.menu.freezeUptoColumn.replace('[TOTAL]', String(index + 1))}\n </MenuPrimitive.Item>\n );\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-unfreeze\" onClick={() => handlePin(undefined)}>\n {texts.table.columns.menu.unfreezeColumns}\n </MenuPrimitive.Item>\n );\n }\n if (canFilter && handleFilter) {\n menuItems.push(\n <MenuPrimitive.Item icon={isFiltered ? 'filter-solid' : 'filter'} onClick={() => handleFilter()}>\n {isFiltered ? texts.table.columns.menu.editFilter : texts.table.columns.menu.filter}\n </MenuPrimitive.Item>\n );\n }\n\n if (customMenu) {\n const menu = customMenu({ trigger: undefined });\n const customItems = React.Children.toArray(menu.props.children.props.children) as JSX.Element[];\n\n if (customItems.length) {\n if (menuItems.length) {\n menuItems.push(<MenuPrimitive.Separator />);\n }\n\n menuItems.push(...customItems);\n }\n }\n\n return menuItems.map((item, key) => React.cloneElement(item, { key }));\n }, [\n canFilter,\n canGoto,\n canHide,\n canPin,\n canSort,\n customMenu,\n handleGoto,\n handleSortToggle,\n index,\n isFiltered,\n sortDirection,\n ]);\n\n // can't use display: none because the button needs to be focusable\n const className = cn(\n // positioning\n 'justify-end overflow-hidden',\n // sizing\n '!h-6 !w-0 !min-h-[theme(spacing.6)] !min-w-0',\n // visible - hover\n 'group-hover/header:!w-6 group-hover/header:!min-w-[theme(spacing.6)] group-hover/header:-mr-1',\n // visible - expanded\n 'aria-expanded:!w-6 aria-expanded:!min-w-[theme(spacing.6)]',\n // visible - focus\n 'focus:!w-6 focus:!min-w-[theme(spacing.6)]',\n {\n '!w-6 !min-w-[theme(spacing.6)]': !!popoverElement,\n },\n props.className\n );\n\n return (\n <IconButton\n className={className}\n icon=\"more\"\n menu={\n popoverElement\n ? undefined\n : menuProps => (\n <MenuPrimitive {...menuProps}>\n <MenuPrimitive.Content>{memoedMenuItems}</MenuPrimitive.Content>\n </MenuPrimitive>\n )\n }\n popover={popoverElement}\n onClickCapture={event => event.preventDefault()}\n onKeyDown={event => {\n // Removes focus from the column header menu button so that active row shortcuts execute when Tab,\n // Shift+Tab, or any other keydown event occurs.\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n event.currentTarget?.blur();\n }\n }}\n />\n );\n}\n"],"names":["HeaderMenu","props","canFilter","canGoto","canHide","canPin","canSort","customMenu","index","isFiltered","onFilter","handleFilter","onGoto","handleGoto","onHide","handleHide","onPin","handlePin","onSortToggle","handleSortToggle","scrollToIndex","setRowActiveIndex","sortDirection","texts","useLocalization","popover","setPopover","React","useState","undefined","popoverElement","handleClosePopover","goto","query","Promise","resolve","then","e","console","error","_wasThrown","_result","_temp","reject","GotoPopover","open","onChange","memoedMenuItems","useMemo","menuItems","handleClick","event","setTimeout","push","MenuPrimitive","Item","icon","onClick","table","columns","menu","hideColumn","subMenu","SubMenu","RadioGroup","value","sortingOrder","ascending","descending","unsorted","sorting","shortcut","gotoRow","freezeFirstColumn","freezeUptoColumn","replace","String","unfreezeColumns","editFilter","filter","trigger","customItems","Children","toArray","children","length","Separator","map","item","key","cloneElement","className","cn","IconButton","menuProps","Content","onClickCapture","preventDefault","onKeyDown","_event$currentTarget","currentTarget","blur"],"mappings":";;;;;;;;SA2BgBA,UAAUA,CAACC,KAAsB;EAC7C,MAAM;IACFC,SAAS;IACTC,OAAO;IACPC,OAAO;IACPC,MAAM;IACNC,OAAO;IACPC,UAAU;IACVC,KAAK;IACLC,UAAU;IACVC,QAAQ,EAAEC,YAAY;IACtBC,MAAM,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,IAAIA,KAAK,CAACsC,GAAG,KAAK,SAAS,IAAItC,KAAK,CAACsC,GAAG,KAAK,WAAW,EAAE;QAAA,IAAAU,oBAAA;QACtD,CAAAA,oBAAA,GAAAhD,KAAK,CAACiD,aAAa,cAAAD,oBAAA,uBAAnBA,oBAAA,CAAqBE,IAAI,EAAE;;;IAGrC;AAEV;;;;"}
|
@@ -10,8 +10,7 @@ const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
10
10
|
allColumns,
|
11
11
|
filters,
|
12
12
|
onChange: handleChange,
|
13
|
-
value = null
|
14
|
-
...attributes
|
13
|
+
value = null
|
15
14
|
} = props;
|
16
15
|
const {
|
17
16
|
texts
|
@@ -24,13 +23,13 @@ const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
24
23
|
message: warning ? texts.table.filters.hiddenColumn : undefined,
|
25
24
|
warning: warning,
|
26
25
|
className: "min-h-[theme(spacing.8)]"
|
27
|
-
}, /*#__PURE__*/React__default.createElement(Select2,
|
26
|
+
}, /*#__PURE__*/React__default.createElement(Select2, {
|
28
27
|
ref: ref,
|
29
28
|
className: "focus:yt-focus !w-32 flex-shrink-0 ",
|
30
29
|
emptyValue: null,
|
31
30
|
onChange: handleChange,
|
32
31
|
value: value
|
33
|
-
}
|
32
|
+
}, allColumns.map(column => {
|
34
33
|
var _column$columnDef$met, _column$parent, _column$parent$column;
|
35
34
|
return /*#__PURE__*/React__default.createElement(Select2.Option, {
|
36
35
|
key: column.id,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FilterColumn.js","sources":["../../../../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as ReactTableColumn } from '@tanstack/react-table';\nimport { Select2, Select2Props } from '../../../../../../../../components/Select2/Select2';\nimport { Icon } from '../../../../../../../../components/Icon/Icon';\nimport { Tooltip } from '../../../../../../../../components/Tooltip/Tooltip';\nimport { useLocalization } from '../../../../../../../../components/Provider/Localization';\nimport { Field } from '../../../../../../../../components/Field/Field';\nimport { TableFilter } from '../../../../../../types';\n\nexport type FilterColumnProps<TType = unknown> = Omit<Select2Props, 'children'> & {\n allColumns: ReactTableColumn<TType, unknown>[];\n filters: TableFilter[];\n};\n\nexport const FilterColumn = React.forwardRef<HTMLButtonElement, FilterColumnProps>((props, ref) => {\n const { allColumns, filters, onChange: handleChange, value = null
|
1
|
+
{"version":3,"file":"FilterColumn.js","sources":["../../../../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as ReactTableColumn } from '@tanstack/react-table';\nimport { Select2, Select2Props } from '../../../../../../../../components/Select2/Select2';\nimport { Icon } from '../../../../../../../../components/Icon/Icon';\nimport { Tooltip } from '../../../../../../../../components/Tooltip/Tooltip';\nimport { useLocalization } from '../../../../../../../../components/Provider/Localization';\nimport { Field } from '../../../../../../../../components/Field/Field';\nimport { TableFilter } from '../../../../../../types';\n\nexport type FilterColumnProps<TType = unknown> = Omit<Select2Props, 'children'> & {\n allColumns: ReactTableColumn<TType, unknown>[];\n filters: TableFilter[];\n};\n\nexport const FilterColumn = React.forwardRef<HTMLButtonElement, FilterColumnProps>((props, ref) => {\n const { allColumns, filters, onChange: handleChange, value = null } = props;\n const { texts } = useLocalization();\n const selectedColumn = allColumns.find(column => column.id === value);\n const warning = selectedColumn && !selectedColumn.getIsVisible();\n\n return (\n <div className=\"flex flex-col\">\n <Field\n message={warning ? texts.table.filters.hiddenColumn : undefined}\n warning={warning}\n className=\"min-h-[theme(spacing.8)]\">\n <Select2\n ref={ref}\n className=\"focus:yt-focus !w-32 flex-shrink-0 \"\n emptyValue={null}\n onChange={handleChange}\n value={value}>\n {allColumns.map(column => (\n <Select2.Option\n key={column.id}\n value={column.id}\n postfix={\n !column.getIsVisible() || column.getIsGrouped() ? (\n <Tooltip\n title={\n column.getIsGrouped()\n ? texts.table.filters.hiddenGroupedColumn\n : texts.table.filters.hiddenColumn\n }>\n <Icon name=\"eye-off\" className=\"text-grey-500 !h-5 !w-5\" />\n </Tooltip>\n ) : undefined\n }\n disabled={column.id !== value && (!column.getCanFilter() || !!filters.find(f => f.id === column.id))}>\n {(column.columnDef.meta?.header as string) +\n (column.parent ? ` (${column.parent?.columnDef.meta?.header})` : '')}\n </Select2.Option>\n ))}\n </Select2>\n </Field>\n </div>\n );\n});\n"],"names":["FilterColumn","React","forwardRef","props","ref","allColumns","filters","onChange","handleChange","value","texts","useLocalization","selectedColumn","find","column","id","warning","getIsVisible","className","Field","message","table","hiddenColumn","undefined","Select2","emptyValue","map","_column$columnDef$met","_column$parent","_column$parent$column","Option","key","postfix","getIsGrouped","Tooltip","title","hiddenGroupedColumn","Icon","name","disabled","getCanFilter","f","columnDef","meta","header","parent"],"mappings":";;;;;;;MAcaA,YAAY,gBAAGC,cAAK,CAACC,UAAU,CAAuC,CAACC,KAAK,EAAEC,GAAG;EAC1F,MAAM;IAAEC,UAAU;IAAEC,OAAO;IAAEC,QAAQ,EAAEC,YAAY;IAAEC,KAAK,GAAG;GAAM,GAAGN,KAAK;EAC3E,MAAM;IAAEO;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,cAAc,GAAGP,UAAU,CAACQ,IAAI,CAACC,MAAM,IAAIA,MAAM,CAACC,EAAE,KAAKN,KAAK,CAAC;EACrE,MAAMO,OAAO,GAAGJ,cAAc,IAAI,CAACA,cAAc,CAACK,YAAY,EAAE;EAEhE,oBACIhB;IAAKiB,SAAS,EAAC;kBACXjB,6BAACkB,KAAK;IACFC,OAAO,EAAEJ,OAAO,GAAGN,KAAK,CAACW,KAAK,CAACf,OAAO,CAACgB,YAAY,GAAGC,SAAS;IAC/DP,OAAO,EAAEA,OAAO;IAChBE,SAAS,EAAC;kBACVjB,6BAACuB,OAAO;IACJpB,GAAG,EAAEA,GAAG;IACRc,SAAS,EAAC,qCAAqC;IAC/CO,UAAU,EAAE,IAA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10
|
onChange: handleChange,
|
11
|
-
value
|
12
|
-
...attributes
|
11
|
+
value
|
13
12
|
} = props;
|
14
13
|
const {
|
15
14
|
texts
|
16
15
|
} = useLocalization();
|
17
16
|
const validComparators = guessComparatorsBasedOnControl(column);
|
18
|
-
return /*#__PURE__*/React__default.createElement(Select2,
|
17
|
+
return /*#__PURE__*/React__default.createElement(Select2, {
|
19
18
|
className: "!w-32 flex-shrink-0",
|
20
19
|
disabled: !column,
|
21
20
|
onChange: handleChange,
|
22
21
|
value: value
|
23
|
-
}
|
22
|
+
}, validComparators.map(comparator => ( /*#__PURE__*/React__default.createElement(Select2.Option, {
|
24
23
|
key: comparator,
|
25
24
|
value: comparator
|
26
25
|
}, getComparatorText(comparator, texts, column)))));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FilterComparator.js","sources":["../../../../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as ReactTableColumn } from '@tanstack/react-table';\nimport { Select2, Select2Props } from '../../../../../../../../components/Select2/Select2';\nimport { LocalizationTexts, useLocalization } from '../../../../../../../../components/Provider/Localization';\nimport { TableFilterComparator } from '../../../../../../types';\nimport { guessComparatorsBasedOnControl } from '../util';\n\nexport type FilterComparatorProps<TType = unknown> = Omit<Select2Props, 'children'> & {\n column?: ReactTableColumn<TType, unknown>;\n};\n\nexport function FilterComparator<TType = unknown>(props: FilterComparatorProps<TType>) {\n const { column, onChange: handleChange, value
|
1
|
+
{"version":3,"file":"FilterComparator.js","sources":["../../../../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as ReactTableColumn } from '@tanstack/react-table';\nimport { Select2, Select2Props } from '../../../../../../../../components/Select2/Select2';\nimport { LocalizationTexts, useLocalization } from '../../../../../../../../components/Provider/Localization';\nimport { TableFilterComparator } from '../../../../../../types';\nimport { guessComparatorsBasedOnControl } from '../util';\n\nexport type FilterComparatorProps<TType = unknown> = Omit<Select2Props, 'children'> & {\n column?: ReactTableColumn<TType, unknown>;\n};\n\nexport function FilterComparator<TType = unknown>(props: FilterComparatorProps<TType>) {\n const { column, onChange: handleChange, value } = props;\n const { texts } = useLocalization();\n\n const validComparators = guessComparatorsBasedOnControl(column);\n\n return (\n <Select2 className=\"!w-32 flex-shrink-0\" disabled={!column} onChange={handleChange} value={value}>\n {validComparators.map(comparator => (\n <Select2.Option key={comparator} value={comparator}>\n {getComparatorText(comparator, texts, column)}\n </Select2.Option>\n ))}\n </Select2>\n );\n}\n\nfunction getComparatorText<TType = unknown>(\n comparator: TableFilterComparator,\n texts: LocalizationTexts,\n column?: ReactTableColumn<TType, unknown>\n) {\n const isDate = column?.columnDef?.meta?.control === 'datepicker';\n\n switch (comparator) {\n case TableFilterComparator.Contains:\n return texts.table.filters.comparators.contains;\n\n case TableFilterComparator.DoesNotContain:\n return texts.table.filters.comparators.doesNotContain;\n\n case TableFilterComparator.IsEqualTo:\n return texts.table.filters.comparators.isEqualTo;\n\n case TableFilterComparator.IsNotEqualTo:\n return texts.table.filters.comparators.isNotEqualTo;\n\n case TableFilterComparator.IsGreaterThan:\n return isDate ? texts.table.filters.comparators.isAfter : texts.table.filters.comparators.isGreaterThan;\n\n case TableFilterComparator.IsLessThan:\n return isDate ? texts.table.filters.comparators.isBefore : texts.table.filters.comparators.isLessThan;\n\n case TableFilterComparator.IsBetween:\n return texts.table.filters.comparators.isBetween;\n\n case TableFilterComparator.IsEmpty:\n return texts.table.filters.comparators.isEmpty;\n\n case TableFilterComparator.IsNotEmpty:\n return texts.table.filters.comparators.isNotEmpty;\n\n case TableFilterComparator.IsLessThanOrEqualTo:\n return isDate ? texts.table.filters.comparators.isOnOrBefore : texts.table.filters.comparators.isLessThanOrEqualTo;\n\n case TableFilterComparator.IsGreaterThanOrEqualTo:\n return isDate ? texts.table.filters.comparators.isOnOrAfter : texts.table.filters.comparators.isGreaterThanOrEqualTo;\n\n case TableFilterComparator.HasAnyOf:\n return texts.table.filters.comparators.hasAnyOf;\n\n case TableFilterComparator.HasAllOf:\n return texts.table.filters.comparators.hasAllOf;\n\n case TableFilterComparator.HasNoneOf:\n return texts.table.filters.comparators.hasNoneOf;\n\n default:\n return '';\n }\n}\n"],"names":["FilterComparator","props","column","onChange","handleChange","value","texts","useLocalization","validComparators","guessComparatorsBasedOnControl","React","Select2","className","disabled","map","comparator","Option","key","getComparatorText","isDate","_column$columnDef","columnDef","_column$columnDef$met","meta","control","TableFilterComparator","Contains","table","filters","comparators","contains","DoesNotContain","doesNotContain","IsEqualTo","isEqualTo","IsNotEqualTo","isNotEqualTo","IsGreaterThan","isAfter","isGreaterThan","IsLessThan","isBefore","isLessThan","IsBetween","isBetween","IsEmpty","isEmpty","IsNotEmpty","isNotEmpty","IsLessThanOrEqualTo","isOnOrBefore","isLessThanOrEqualTo","IsGreaterThanOrEqualTo","isOnOrAfter","isGreaterThanOrEqualTo","HasAnyOf","hasAnyOf","HasAllOf","hasAllOf","HasNoneOf","hasNoneOf"],"mappings":";;;;;;SAWgBA,gBAAgBA,CAAkBC,KAAmC;EACjF,MAAM;IAAEC,MAAM;IAAEC,QAAQ,EAAEC,YAAY;IAAEC;GAAO,GAAGJ,KAAK;EACvD,MAAM;IAAEK;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,gBAAgB,GAAGC,8BAA8B,CAACP,MAAM,CAAC;EAE/D,oBACIQ,6BAACC,OAAO;IAACC,SAAS,EAAC,qBAAqB;IAACC,QAAQ,EAAE,CAACX,MAAM;IAAEC,QAAQ,EAAEC,YAAY;IAAEC,KAAK,EAAEA;KACtFG,gBAAgB,CAACM,GAAG,CAACC,UAAU,mBAC5BL,6BAACC,OAAO,CAACK,MAAM;IAACC,GAAG,EAAEF,UAAU;IAAEV,KAAK,EAAEU;KACnCG,iBAAiB,CAACH,UAAU,EAAET,KAAK,EAAEJ,MAAM,CAAC,CAChC,CACpB,CAAC,CACI;A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B,OAAO;MAC9B,OAAOvC,KAAK,CAACqB,KAAK,CAACC,OAAO,CAACC,WAAW,CAACiB,OAAO;IAElD,KAAKrB,qBAAqB,CAACsB,UAAU;MACjC,OAAOzC,KAAK,CAACqB,KAAK,CAACC,OAAO,CAACC,WAAW,CAACmB,UAAU;IAErD,KAAKvB,qBAAqB,CAACwB,mBAAmB;MAC1C,OAAO9B,MAAM,GAAGb,KAAK,CAACqB,KAAK,CAACC,OAAO,CAACC,WAAW,CAACqB,YAAY,GAAG5C,KAAK,CAACqB,KAAK,CAACC,OAAO,CAACC,WAAW,CAACsB,mBAAmB;IAEtH,KAAK1B,qBAAqB,CAAC2B,sBAAsB;MAC7C,OAAOjC,MAAM,GAAGb,KAAK,CAACqB,KAAK,CAACC,OAAO,CAACC,WAAW,CAACwB,WAAW,GAAG/C,KAAK,CAACqB,KAAK,CAACC,OAAO,CAACC,WAAW,CAACyB,sBAAsB;IAExH,KAAK7B,qBAAqB,CAAC8B,QAAQ;MAC/B,OAAOjD,KAAK,CAACqB,KAAK,CAACC,OAAO,CAACC,WAAW,CAAC2B,QAAQ;IAEnD,KAAK/B,qBAAqB,CAACgC,QAAQ;MAC/B,OAAOnD,KAAK,CAACqB,KAAK,CAACC,OAAO,CAACC,WAAW,CAAC6B,QAAQ;IAEnD,KAAKjC,qBAAqB,CAACkC,SAAS;MAChC,OAAOrD,KAAK,CAACqB,KAAK,CAACC,OAAO,CAACC,WAAW,CAAC+B,SAAS;IAEpD;MACI,OAAO,EAAE;;AAErB;;;;"}
|
@@ -107,8 +107,6 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
107
107
|
// if a search is currently "active", we need to re load all because
|
108
108
|
const handleSort = function (sorting) {
|
109
109
|
try {
|
110
|
-
// set the sorting so we can track if it changed between loads
|
111
|
-
_lastUsedSorting.current = sorting;
|
112
110
|
if (_lastUsedSearch.current) {
|
113
111
|
// we're searching, which means we need to refetch all with the correct sorting applied
|
114
112
|
loadAll(sorting, _lastUsedFilters.current);
|
@@ -123,8 +121,6 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
123
121
|
};
|
124
122
|
const handleFilter = function (filters) {
|
125
123
|
try {
|
126
|
-
// set the filters so we can track if it changed between loads
|
127
|
-
_lastUsedFilters.current = filters;
|
128
124
|
if (_lastUsedSearch.current) {
|
129
125
|
// we're searching, which means we need to refetch all with the correct sorting applied
|
130
126
|
loadAll(_lastUsedSorting.current, filters);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useTableDataLoader.js","sources":["../../../../../../../src/primitives/Table/useTableDataLoader.ts"],"sourcesContent":["import React from 'react';\nimport {\n TableColumnFilter,\n TableColumnSort,\n TableFilterHandler,\n TableServerLoadPageHandler,\n TableServerLoadAllHandler,\n TableSortHandler,\n TableSearchHandler,\n} from './types';\n\nexport const DEFAULT_PAGE_SIZE = 100;\n\nexport type useTableDataPageFetcher<TType = unknown> = (\n pageIndex: number,\n pageSize: number,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[]\n) => Promise<{ data: TType[]; length: number }>;\n\nexport type useTableDataAllFetcher<TType = unknown> = (\n sorting: TableColumnSort[],\n filters: TableColumnFilter[]\n) => Promise<{ data: TType[]; length: number }>;\n\nexport type useTableDataLoaderOptions = { pageSize: number };\n\nexport type useTableDataLoaderValues<TType = unknown> = {\n data: TType[];\n length: number | undefined;\n loadAll: TableServerLoadAllHandler;\n loadPage: TableServerLoadPageHandler;\n onChangeFilter: TableFilterHandler;\n onChangeSearch: TableSearchHandler;\n onChangeSort: TableSortHandler;\n pageSize: number;\n};\n\nexport function useTableDataLoader<TType = unknown>(\n fetchPage: useTableDataPageFetcher<TType>,\n fetchAll: useTableDataAllFetcher<TType>,\n options: useTableDataLoaderOptions = { pageSize: DEFAULT_PAGE_SIZE }\n): [useTableDataLoaderValues<TType>, () => void] {\n const { pageSize } = options;\n\n // track the data length, we don't know it until the first request\n const length = React.useRef<number | undefined>(undefined);\n // data will be filled after the first request, then we'll update values in place\n const [data, setData] = React.useState<any[]>([]);\n // track which pages have been loaded to dedupe requests\n const _pendingPageRequests = React.useRef({});\n const _lastUsedSorting = React.useRef<TableColumnSort[]>([]);\n const _lastUsedFilters = React.useRef<TableColumnFilter[]>([]);\n const _lastUsedSearch = React.useRef<string>();\n const _forceReset = React.useRef(false);\n\n const loadPage = async (pageIndex: number, sorting: TableColumnSort[], filters: TableColumnFilter[]) => {\n let reset = false;\n\n // sorting or filters changed, reset everything\n if (\n _forceReset.current ||\n JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) ||\n JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current)\n ) {\n _pendingPageRequests.current = {};\n // nuke the dataset so that we \"start again\" after sorting\n reset = true;\n }\n\n if (_pendingPageRequests.current[pageIndex]) {\n // if page is already loaded/loading, abort, otherwise mark it as loading\n return;\n } else {\n _pendingPageRequests.current[pageIndex] = true;\n }\n\n _forceReset.current = false;\n // set the sorting so we can track if it changed between loads\n _lastUsedSorting.current = sorting;\n // set the filters so we can track if it changed between loads\n _lastUsedFilters.current = filters;\n\n try {\n const response = await fetchPage(pageIndex, pageSize, sorting, filters);\n\n // update state, here we do some \"magic\" to support \"load in place\"\n setData(currentData => {\n let nextData;\n\n // reset table state if:\n // - the length isn't set at all (first load)\n // - the client length and server length are different (the data changed)\n if (reset || length.current !== response.length) {\n length.current = response.length;\n nextData = Array(length.current).fill(undefined);\n } else {\n nextData = [...currentData];\n }\n\n const startIndex = pageIndex * pageSize;\n nextData.splice(startIndex, pageSize, ...response.data);\n return nextData;\n });\n } catch {\n //\n } finally {\n _pendingPageRequests.current[pageIndex] = false;\n }\n };\n\n const loadAll = async (sorting: TableColumnSort[], filters: TableColumnFilter[]) => {\n // set the sorting so we can track if it changed between loads\n _lastUsedSorting.current = sorting;\n // set the filters so we can track if it changed between loads\n _lastUsedFilters.current = filters;\n\n try {\n const response = await fetchAll(sorting, filters);\n length.current = response.length;\n\n setData(() => {\n let nextData;\n\n if (response.data.length !== response.length) {\n nextData = Array(response.length).fill(undefined);\n nextData.splice(0, response.data.length, ...response.data);\n } else {\n nextData = [...response.data];\n }\n\n return nextData;\n });\n } catch {\n //\n }\n };\n\n const invalidate = async () => {\n _forceReset.current = true;\n return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current);\n };\n\n // search works client side - it fetches all then works client side - so these handlers are a little \"weird\"\n // if a search is currently \"active\", we need to re load all because\n const handleSort = async (sorting: TableColumnSort[]) => {\n // set the sorting so we can track if it changed between loads\n _lastUsedSorting.current = sorting;\n\n if (_lastUsedSearch.current) {\n // we're searching, which means we need to refetch all with the correct sorting applied\n loadAll(sorting, _lastUsedFilters.current);\n } else {\n // reset the page to 0 whenever sorting\n loadPage(0, sorting, _lastUsedFilters.current);\n }\n };\n const handleFilter = async (filters: TableColumnFilter[]) => {\n // set the filters so we can track if it changed between loads\n _lastUsedFilters.current = filters;\n\n if (_lastUsedSearch.current) {\n // we're searching, which means we need to refetch all with the correct sorting applied\n loadAll(_lastUsedSorting.current, filters);\n } else {\n // reset the page to 0 whenever sorting\n loadPage(0, _lastUsedSorting.current, filters);\n }\n };\n const handleSearch = async (search: string | undefined) => {\n // set the search so we can track if it changed between loads\n _lastUsedSearch.current = search || undefined;\n // search works client side, and focusing the search field triggers a load of all so we don't actually\n // want to load anything when search gets changed, we just store the value for other handlers\n };\n\n return [\n {\n data,\n length: length.current,\n loadAll,\n loadPage,\n onChangeFilter: handleFilter,\n onChangeSearch: handleSearch,\n onChangeSort: handleSort,\n pageSize,\n },\n invalidate,\n ];\n}\n"],"names":["DEFAULT_PAGE_SIZE","useTableDataLoader","fetchPage","fetchAll","options","pageSize","length","React","useRef","undefined","data","setData","useState","_pendingPageRequests","_lastUsedSorting","_lastUsedFilters","_lastUsedSearch","_forceReset","loadPage","pageIndex","sorting","filters","reset","current","JSON","stringify","Promise","resolve","_temp","_finallyRethrows","_catch","then","response","currentData","nextData","Array","fill","startIndex","splice","_wasThrown","_result","e","reject","loadAll","_temp2","invalidate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DN,gBAAgB,CAACS,OAAO,GAAGH,OAAO;MAElC,IAAIJ,eAAe,CAACO,OAAO,EAAE;;QAEzBoB,OAAO,CAACvB,OAAO,EAAEL,gBAAgB,CAACQ,OAAO,CAAC;OAC7C,MAAM;;QAEHL,QAAQ,CAAC,CAAC,EAAEE,OAAO,EAAEL,gBAAgB,CAACQ,OAAO,CAAC;;MACjD,OAAAG,OAAA,CAAAC,OAAA;KACJ,QAAAc,CAAA;MAAA,OAAAf,OAAA,CAAAgB,MAAA,CAAAD,CAAA;;;EACD,MAAMM,YAAY,aAAU1B,OAA4B;IAAA;;MAEpDN,gBAAgB,CAACQ,OAAO,GAAGF,OAAO;MAElC,IAAIL,eAAe,CAACO,OAAO,EAAE;;QAEzBoB,OAAO,CAAC7B,gBAAgB,CAACS,OAAO,EAAEF,OAAO,CAAC;OAC7C,MAAM;;QAEHH,QAAQ,CAAC,CAAC,EAAEJ,gBAAgB,CAACS,OAAO,EAAEF,OAAO,CAAC;;MACjD,OAAAK,OAAA,CAAAC,OAAA;KACJ,QAAAc,CAAA;MAAA,OAAAf,OAAA,CAAAgB,MAAA,CAAAD,CAAA;;;EACD,MAAMO,YAAY,aAAUC,MAA0B;IAAA;;MAElDjC,eAAe,CAACO,OAAO,GAAG0B,MAAM,IAAIxC,SAAS;;;MAE7C,OAAAiB,OAAA,CAAAC,OAAA;KACH,QAAAc,CAAA;MAAA,OAAAf,OAAA,CAAAgB,MAAA,CAAAD,CAAA;;;EAED,OAAO,CACH;IACI/B,IAAI;IACJJ,MAAM,EAAEA,MAAM,CAACiB,OAAO;IACtBoB,OAAO;IACPzB,QAAQ;IACRgC,cAAc,EAAEH,YAAY;IAC5BI,cAAc,EAAEH,YAAY;IAC5BI,YAAY,EAAEN,UAAU;IACxBzC;GACH,EACDwC,UAAU,CACb;AACL;;;;"}
|
1
|
+
{"version":3,"file":"useTableDataLoader.js","sources":["../../../../../../../src/primitives/Table/useTableDataLoader.ts"],"sourcesContent":["import React from 'react';\nimport {\n TableColumnFilter,\n TableColumnSort,\n TableFilterHandler,\n TableServerLoadPageHandler,\n TableServerLoadAllHandler,\n TableSortHandler,\n TableSearchHandler,\n} from './types';\n\nexport const DEFAULT_PAGE_SIZE = 100;\n\nexport type useTableDataPageFetcher<TType = unknown> = (\n pageIndex: number,\n pageSize: number,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[]\n) => Promise<{ data: TType[]; length: number }>;\n\nexport type useTableDataAllFetcher<TType = unknown> = (\n sorting: TableColumnSort[],\n filters: TableColumnFilter[]\n) => Promise<{ data: TType[]; length: number }>;\n\nexport type useTableDataLoaderOptions = { pageSize: number };\n\nexport type useTableDataLoaderValues<TType = unknown> = {\n data: TType[];\n length: number | undefined;\n loadAll: TableServerLoadAllHandler;\n loadPage: TableServerLoadPageHandler;\n onChangeFilter: TableFilterHandler;\n onChangeSearch: TableSearchHandler;\n onChangeSort: TableSortHandler;\n pageSize: number;\n};\n\nexport function useTableDataLoader<TType = unknown>(\n fetchPage: useTableDataPageFetcher<TType>,\n fetchAll: useTableDataAllFetcher<TType>,\n options: useTableDataLoaderOptions = { pageSize: DEFAULT_PAGE_SIZE }\n): [useTableDataLoaderValues<TType>, () => void] {\n const { pageSize } = options;\n\n // track the data length, we don't know it until the first request\n const length = React.useRef<number | undefined>(undefined);\n // data will be filled after the first request, then we'll update values in place\n const [data, setData] = React.useState<any[]>([]);\n // track which pages have been loaded to dedupe requests\n const _pendingPageRequests = React.useRef({});\n const _lastUsedSorting = React.useRef<TableColumnSort[]>([]);\n const _lastUsedFilters = React.useRef<TableColumnFilter[]>([]);\n const _lastUsedSearch = React.useRef<string>();\n const _forceReset = React.useRef(false);\n\n const loadPage = async (pageIndex: number, sorting: TableColumnSort[], filters: TableColumnFilter[]) => {\n let reset = false;\n\n // sorting or filters changed, reset everything\n if (\n _forceReset.current ||\n JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) ||\n JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current)\n ) {\n _pendingPageRequests.current = {};\n // nuke the dataset so that we \"start again\" after sorting\n reset = true;\n }\n\n if (_pendingPageRequests.current[pageIndex]) {\n // if page is already loaded/loading, abort, otherwise mark it as loading\n return;\n } else {\n _pendingPageRequests.current[pageIndex] = true;\n }\n\n _forceReset.current = false;\n // set the sorting so we can track if it changed between loads\n _lastUsedSorting.current = sorting;\n // set the filters so we can track if it changed between loads\n _lastUsedFilters.current = filters;\n\n try {\n const response = await fetchPage(pageIndex, pageSize, sorting, filters);\n\n // update state, here we do some \"magic\" to support \"load in place\"\n setData(currentData => {\n let nextData;\n\n // reset table state if:\n // - the length isn't set at all (first load)\n // - the client length and server length are different (the data changed)\n if (reset || length.current !== response.length) {\n length.current = response.length;\n nextData = Array(length.current).fill(undefined);\n } else {\n nextData = [...currentData];\n }\n\n const startIndex = pageIndex * pageSize;\n nextData.splice(startIndex, pageSize, ...response.data);\n return nextData;\n });\n } catch {\n //\n } finally {\n _pendingPageRequests.current[pageIndex] = false;\n }\n };\n\n const loadAll = async (sorting: TableColumnSort[], filters: TableColumnFilter[]) => {\n // set the sorting so we can track if it changed between loads\n _lastUsedSorting.current = sorting;\n // set the filters so we can track if it changed between loads\n _lastUsedFilters.current = filters;\n\n try {\n const response = await fetchAll(sorting, filters);\n length.current = response.length;\n\n setData(() => {\n let nextData;\n\n if (response.data.length !== response.length) {\n nextData = Array(response.length).fill(undefined);\n nextData.splice(0, response.data.length, ...response.data);\n } else {\n nextData = [...response.data];\n }\n\n return nextData;\n });\n } catch {\n //\n }\n };\n\n const invalidate = async () => {\n _forceReset.current = true;\n return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current);\n };\n\n // search works client side - it fetches all then works client side - so these handlers are a little \"weird\"\n // if a search is currently \"active\", we need to re load all because\n const handleSort = async (sorting: TableColumnSort[]) => {\n if (_lastUsedSearch.current) {\n // we're searching, which means we need to refetch all with the correct sorting applied\n loadAll(sorting, _lastUsedFilters.current);\n } else {\n // reset the page to 0 whenever sorting\n loadPage(0, sorting, _lastUsedFilters.current);\n }\n };\n const handleFilter = async (filters: TableColumnFilter[]) => {\n if (_lastUsedSearch.current) {\n // we're searching, which means we need to refetch all with the correct sorting applied\n loadAll(_lastUsedSorting.current, filters);\n } else {\n // reset the page to 0 whenever sorting\n loadPage(0, _lastUsedSorting.current, filters);\n }\n };\n const handleSearch = async (search: string | undefined) => {\n // set the search so we can track if it changed between loads\n _lastUsedSearch.current = search || undefined;\n // search works client side, and focusing the search field triggers a load of all so we don't actually\n // want to load anything when search gets changed, we just store the value for other handlers\n };\n\n return [\n {\n data,\n length: length.current,\n loadAll,\n loadPage,\n onChangeFilter: handleFilter,\n onChangeSearch: handleSearch,\n onChangeSort: handleSort,\n pageSize,\n },\n invalidate,\n ];\n}\n"],"names":["DEFAULT_PAGE_SIZE","useTableDataLoader","fetchPage","fetchAll","options","pageSize","length","React","useRef","undefined","data","setData","useState","_pendingPageRequests","_lastUsedSorting","_lastUsedFilters","_lastUsedSearch","_forceReset","loadPage","pageIndex","sorting","filters","reset","current","JSON","stringify","Promise","resolve","_temp","_finallyRethrows","_catch","then","response","currentData","nextData","Array","fill","startIndex","splice","_wasThrown","_result","e","reject","loadAll","_temp2","invalidate","handleSort","handleFilter","handleSearch","search","onChangeFilter","onChangeSearch","onChangeSort"],"mappings":";;;MAWaA,iBAAiB,GAAG;SA2BjBC,kBAAkBA,CAC9BC,SAAyC,EACzCC,QAAuC,EACvCC,UAAqC;EAAEC,QAAQ,EAAEL;CAAmB;EAEpE,MAAM;IAAEK;GAAU,GAAGD,OAAO;;EAG5B,MAAME,MAAM,GAAGC,cAAK,CAACC,MAAM,CAAqBC,SAAS,CAAC;;EAE1D,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGJ,cAAK,CAACK,QAAQ,CAAQ,EAAE,CAAC;;EAEjD,MAAMC,oBAAoB,GAAGN,cAAK,CAACC,MAAM,CAAC,EAAE,CAAC;EAC7C,MAAMM,gBAAgB,GAAGP,cAAK,CAACC,MA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,CAACS,OAAO,EAAEF,OAAO,CAAC;;MACjD,OAAAK,OAAA,CAAAC,OAAA;KACJ,QAAAc,CAAA;MAAA,OAAAf,OAAA,CAAAgB,MAAA,CAAAD,CAAA;;;EACD,MAAMO,YAAY,aAAUC,MAA0B;IAAA;;MAElDjC,eAAe,CAACO,OAAO,GAAG0B,MAAM,IAAIxC,SAAS;;;MAE7C,OAAAiB,OAAA,CAAAC,OAAA;KACH,QAAAc,CAAA;MAAA,OAAAf,OAAA,CAAAgB,MAAA,CAAAD,CAAA;;;EAED,OAAO,CACH;IACI/B,IAAI;IACJJ,MAAM,EAAEA,MAAM,CAACiB,OAAO;IACtBoB,OAAO;IACPzB,QAAQ;IACRgC,cAAc,EAAEH,YAAY;IAC5BI,cAAc,EAAEH,YAAY;IAC5BI,YAAY,EAAEN,UAAU;IACxBzC;GACH,EACDwC,UAAU,CACb;AACL;;;;"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import get from 'lodash-es/get';
|
1
2
|
import { getCellValueAsString } from './columns.js';
|
2
3
|
import { isWeakContains } from './filtering.js';
|
3
4
|
|
@@ -23,8 +24,8 @@ function resetHighlightedColumnIndexes(value, table) {
|
|
23
24
|
}
|
24
25
|
}
|
25
26
|
if (column.getIsVisible() && column.columnDef.enableGlobalFilter && allowSearch) {
|
26
|
-
var
|
27
|
-
const cellValue = getCellValueAsString((
|
27
|
+
var _column$columnDef$met;
|
28
|
+
const cellValue = getCellValueAsString(get(row.original, column.id), (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.dataType);
|
28
29
|
// indexes don't map to sorted data
|
29
30
|
if (cellValue !== undefined && isWeakContains(cellValue, value)) {
|
30
31
|
indexes.push([rowIndex, columnIndex]);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"search.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/search.ts"],"sourcesContent":["import { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { getCellValueAsString } from './columns';\nimport { isWeakContains } from './filtering';\n\nexport function resetHighlightedColumnIndexes<TType = unknown>(value: string | undefined, table: ReactTable<TType>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n let firstRowIndex: undefined | number;\n\n if (value) {\n const indexes: number[][] = [];\n const columns = table.getVisibleLeafColumns();\n const rowGrouping = table.getState().grouping;\n\n table.getRowModel().rows.forEach((row, rowIndex) => {\n columns.forEach((column, columnIndex) => {\n try {\n let allowSearch = true;\n\n if (rowGrouping?.length) {\n // if it's the grouped row, only allow search of the grouped column - because that's all that's visible\n if (row.getIsGrouped()) {\n allowSearch = column.getIsGrouped();\n }\n // otherwise for other rows, don't search the grouped column - because it isn't visible\n else if (rowGrouping.includes(column.id)) {\n allowSearch = false;\n }\n }\n\n if (column.getIsVisible() && column.columnDef.enableGlobalFilter && allowSearch) {\n const cellValue = getCellValueAsString(row.original
|
1
|
+
{"version":3,"file":"search.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/search.ts"],"sourcesContent":["import { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport get from 'lodash/get';\nimport { getCellValueAsString } from './columns';\nimport { isWeakContains } from './filtering';\n\nexport function resetHighlightedColumnIndexes<TType = unknown>(value: string | undefined, table: ReactTable<TType>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n let firstRowIndex: undefined | number;\n\n if (value) {\n const indexes: number[][] = [];\n const columns = table.getVisibleLeafColumns();\n const rowGrouping = table.getState().grouping;\n\n table.getRowModel().rows.forEach((row, rowIndex) => {\n columns.forEach((column, columnIndex) => {\n try {\n let allowSearch = true;\n\n if (rowGrouping?.length) {\n // if it's the grouped row, only allow search of the grouped column - because that's all that's visible\n if (row.getIsGrouped()) {\n allowSearch = column.getIsGrouped();\n }\n // otherwise for other rows, don't search the grouped column - because it isn't visible\n else if (rowGrouping.includes(column.id)) {\n allowSearch = false;\n }\n }\n\n if (column.getIsVisible() && column.columnDef.enableGlobalFilter && allowSearch) {\n const cellValue = getCellValueAsString(get(row.original, column.id), column.columnDef.meta?.dataType);\n\n // indexes don't map to sorted data\n if (cellValue !== undefined && isWeakContains(cellValue, value)) {\n indexes.push([rowIndex, columnIndex]);\n }\n }\n } catch (e) {\n //\n }\n });\n });\n\n tableMeta.search.setHighlightedColumnIndexes(indexes);\n\n if (indexes.length) {\n firstRowIndex = indexes[0][0];\n tableMeta.search.setCurrentHighlightColumnIndex(0);\n } else {\n tableMeta.search.setCurrentHighlightColumnIndex(undefined);\n }\n } else {\n tableMeta.search.setHighlightedColumnIndexes([]);\n tableMeta.search.setCurrentHighlightColumnIndex(undefined);\n }\n\n if (firstRowIndex !== undefined) {\n tableMeta.rowActive.setRowActiveIndex(firstRowIndex);\n }\n\n return firstRowIndex;\n}\n"],"names":["resetHighlightedColumnIndexes","value","table","tableMeta","options","meta","firstRowIndex","indexes","columns","getVisibleLeafColumns","rowGrouping","getState","grouping","getRowModel","rows","forEach","row","rowIndex","column","columnIndex","allowSearch","length","getIsGrouped","includes","id","getIsVisible","columnDef","enableGlobalFilter","_column$columnDef$met","cellValue","getCellValueAsString","get","original","dataType","undefined","isWeakContains","push","e","search","setHighlightedColumnIndexes","setCurrentHighlightColumnIndex","rowActive","setRowActiveIndex"],"mappings":";;;;SAKgBA,6BAA6BA,CAAkBC,KAAyB,EAAEC,KAAwB;EAC9G,MAAMC,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAC7D,IAAIC,aAAiC;EAErC,IAAIL,KAAK,EAAE;IACP,MAAMM,OAAO,GAAe,EAAE;IAC9B,MAAMC,OAAO,GAAGN,KAAK,CAACO,qBAAqB,EAAE;IAC7C,MAAMC,WAAW,GAAGR,KAAK,CAACS,QAAQ,EAAE,CAACC,QAAQ;IAE7CV,KAAK,CAACW,WAAW,EAAE,CAACC,IAAI,CAACC,OAAO,CAAC,CAACC,GAAG,EAAEC,QAAQ;MAC3CT,OAAO,CAACO,OAAO,CAAC,C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AAC,EAAE,CAAC;IAChDpC,SAAS,CAACmC,MAAM,CAACE,8BAA8B,CAACN,SAAS,CAAC;;EAG9D,IAAI5B,aAAa,KAAK4B,SAAS,EAAE;IAC7B/B,SAAS,CAACsC,SAAS,CAACC,iBAAiB,CAACpC,aAAa,CAAC;;EAGxD,OAAOA,aAAa;AACxB;;;;"}
|
package/dist/index.css
CHANGED
@@ -1216,6 +1216,10 @@ table[data-taco='table3'][data-table-editing-mode='detailed'] td [data-taco='tex
|
|
1216
1216
|
@apply yt-focus-dark;
|
1217
1217
|
}
|
1218
1218
|
|
1219
|
+
table[data-taco='table3'] td:focus {
|
1220
|
+
@apply rounded-sm ring-2 ring-inset ring-[#4573D2];
|
1221
|
+
}
|
1222
|
+
|
1219
1223
|
table[data-taco='table3'][data-table-editing-mode] tbody tr:not([data-row-active='true']):hover td [data-taco='input'],
|
1220
1224
|
table[data-taco='table3'][data-table-editing-mode] tbody tr:not([data-row-active='true']):hover td [data-taco='textarea'],
|
1221
1225
|
table[data-taco='table3'][data-table-editing-mode] tbody tr:not([data-row-active='true']):hover td [data-taco='Select2'] {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
export declare function useAugmentedFocusManager(): {
|
2
|
-
focusPrevious: () => import("@react-types/shared").FocusableElement;
|
3
|
-
focusNext: () => import("@react-types/shared").FocusableElement;
|
2
|
+
focusPrevious: (arrowNavigation?: boolean) => import("@react-types/shared").FocusableElement;
|
3
|
+
focusNext: (arrowNavigation?: boolean) => import("@react-types/shared").FocusableElement;
|
4
4
|
focusFirst: () => import("@react-types/shared").FocusableElement;
|
5
5
|
focusLast: () => import("@react-types/shared").FocusableElement;
|
6
6
|
};
|
@@ -6,7 +6,7 @@ export declare type FilterColumnProps<TType = unknown> = Omit<Select2Props, 'chi
|
|
6
6
|
allColumns: ReactTableColumn<TType, unknown>[];
|
7
7
|
filters: TableFilter[];
|
8
8
|
};
|
9
|
-
export declare const FilterColumn: React.ForwardRefExoticComponent<Pick<Select2Props, "defaultValue" | "onChange" | "value" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "autoFocus" | "emptyValue" | "disabled" | "fontSize" | "highlighted" | "invalid" | "loading" | "multiple" | "name" | "
|
9
|
+
export declare const FilterColumn: React.ForwardRefExoticComponent<Pick<Select2Props, "defaultValue" | "onChange" | "value" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onCreate" | "dialogTriggerTitle" | "dialogTriggerDisabled" | "dialog" | "autoFocus" | "emptyValue" | "disabled" | "fontSize" | "highlighted" | "invalid" | "loading" | "multiple" | "name" | "onDelete" | "onEdit" | "readOnly" | "required" | "tags"> & {
|
10
10
|
allColumns: ReactTableColumn<unknown, unknown>[];
|
11
11
|
filters: TableFilter[];
|
12
12
|
} & React.RefAttributes<HTMLButtonElement>>;
|