@economic/taco 2.7.3 → 2.7.4
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/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +5 -5
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js +7 -4
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js.map +1 -1
- package/dist/taco.cjs.development.js +12 -9
- 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
- package/types.json +177 -125
package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js
CHANGED
@@ -139,14 +139,14 @@ function PrintIFrame({
|
|
139
139
|
};
|
140
140
|
}, [mountNode, stylesReady]);
|
141
141
|
React__default.useEffect(() => {
|
142
|
-
var
|
143
|
-
if (!iframeWindow || !stylesReady) {
|
142
|
+
var _contentRef$closest, _parentElement$innerH;
|
143
|
+
if (!contentRef || !iframeWindow || !stylesReady) {
|
144
144
|
return;
|
145
145
|
}
|
146
|
+
// get the closest parent/container of the table, and the table itself
|
147
|
+
const parentElement = (_contentRef$closest = contentRef === null || contentRef === void 0 ? void 0 : contentRef.closest('[role=dialog], [data-taco=drawer], main')) !== null && _contentRef$closest !== void 0 ? _contentRef$closest : iframeWindow.parent.document.body;
|
146
148
|
const iframeDocument = iframeWindow.document;
|
147
|
-
|
148
|
-
const parentDocumentContent = ((_iframeWindow$parent$ = iframeWindow.parent.document.querySelector('main')) === null || _iframeWindow$parent$ === void 0 ? void 0 : _iframeWindow$parent$.innerHTML) || ((_iframeWindow$parent$2 = iframeWindow.parent.document.body) === null || _iframeWindow$parent$2 === void 0 ? void 0 : _iframeWindow$parent$2.innerHTML) || '';
|
149
|
-
iframeDocument.body.innerHTML = parentDocumentContent;
|
149
|
+
iframeDocument.body.innerHTML = (_parentElement$innerH = parentElement === null || parentElement === void 0 ? void 0 : parentElement.innerHTML) !== null && _parentElement$innerH !== void 0 ? _parentElement$innerH : '';
|
150
150
|
const tableElement = iframeDocument.querySelector('[role="table"]');
|
151
151
|
const tableColumnFreezingStyles = iframeDocument.querySelector('[data-taco="table3-column-freezing-styles"]');
|
152
152
|
const tableWrapper = iframeDocument.createElement('div');
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"PrintIFrame.js","sources":["../../../../../../../../../../src/components/Table3/components/toolbar/PrintButton/PrintIFrame.tsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { Table3 } from '../../../../..';\nimport { Table3Props } from '../../../types';\nimport { useParentStylesheets } from './hooks/useParentStylesheets';\n\nexport type PrintIFrameProps<TType = unknown> = {\n onAfterPrint?: () => void;\n onBeforePrint?: () => void;\n tableProps: Table3Props<TType>;\n};\n\nexport function PrintIFrame<TType = unknown>({ onAfterPrint, onBeforePrint, tableProps }: PrintIFrameProps<TType>) {\n const [contentRef, setContentRef] = React.useState<HTMLIFrameElement | null>(null);\n const [mountNode, setMountNode] = React.useState<HTMLElement | null>(null);\n\n const isFirefoxBrowser = React.useMemo(() => navigator.userAgent.toLowerCase().includes('firefox'), []);\n\n const iframeWindow = contentRef?.contentWindow;\n\n const stylesReady = useParentStylesheets(iframeWindow);\n\n // Calls print method when table has loaded in the iframe.\n React.useEffect(() => {\n let intervalId: NodeJS.Timer;\n let timeoutId: NodeJS.Timer;\n\n // Invoke the print functionality on the window once the table has finished rendering and all print styles are\n // added.\n if (mountNode && stylesReady) {\n intervalId = setInterval(async () => {\n const tableWrapper = mountNode;\n const table = tableWrapper.querySelector('[role=\"table\"]') as HTMLElement;\n const hasTableRendered = !!table;\n\n if (hasTableRendered && intervalId) {\n clearInterval(intervalId);\n\n // Calling the onBeforePrint method here as a fallback because certain browsers, like Safari,\n // do not call the beforeprint event.\n // Bug - Even though onBeforePrint is called before printing, the execution doesn't finish before\n // the print dialog shows up, which results into having a visible loading toast.\n onBeforePrint?.();\n\n // By adding height to the tableWrapper, we make sure the content below absolutely positioned table\n // doesn't hide\n if (isFirefoxBrowser) {\n const tableHeight = `${table.offsetHeight}px`;\n tableWrapper.style.height = tableHeight;\n }\n\n contentRef?.contentWindow?.print();\n\n // Calling the onAfterPrint method here as a fallback to do the cleanup, as certain browsers,\n // like Safari, do not trigger the beforeprint or afterprint events when a confirmation dialog\n // asking if the user wants to print the document, is cancelled.\n\n // Added a setTimeout to prevent calling onAfterPrint immediately after the print function\n // to ensure that the print dialog doesn't close abruptly. Although this behavior is uncommon,\n // there are cases where the print function may not run synchronously, causing onAfterPrint to be\n // invoked right after it.\n timeoutId = setTimeout(() => {\n onAfterPrint?.();\n }, 0);\n }\n }, 1000);\n }\n\n return () => {\n clearInterval(intervalId);\n clearTimeout(timeoutId);\n };\n }, [mountNode, stylesReady]);\n\n React.useEffect(() => {\n if (!iframeWindow || !stylesReady) {\n return;\n }\n\n const iframeDocument = iframeWindow.document;\n // Only the content inside the main element will get printed along with the table.\n const parentDocumentContent =\n iframeWindow.parent.document.querySelector('main')?.innerHTML || iframeWindow.parent.document.body?.innerHTML || '';\n\n iframeDocument.body.innerHTML = parentDocumentContent;\n\n const tableElement = iframeDocument.querySelector('[role=\"table\"]');\n const tableColumnFreezingStyles = iframeDocument.querySelector('[data-taco=\"table3-column-freezing-styles\"]');\n const tableWrapper = iframeDocument.createElement('div');\n\n tableWrapper.setAttribute('data-role', 'table-wrapper');\n // Adding h-fit class makes sure that table is rendered with the whole content.\n tableWrapper.classList.add('h-fit');\n tableWrapper.classList.add('[&>[role=\"table\"]]:!h-fit');\n\n if (isFirefoxBrowser) {\n // Fix for firefox bug which adds page-long whitespace between page's top content and table\n tableWrapper.classList.add('[&>[role=\"table\"]]:!absolute');\n }\n\n // Safari print preview assigns no width to the table when w-screen class is used.\n // By assigning table a big static width and hiding the horizontal scrollbar, the table on chrome\n // and safari will always take full page width.\n tableWrapper.classList.add('w-[10000px]');\n\n if (tableElement) {\n tableElement.parentNode?.insertBefore(tableWrapper, tableElement);\n tableElement.remove();\n } else {\n iframeDocument.body.append(tableWrapper);\n }\n\n // Remove the already existing column freezing styles.\n if (tableColumnFreezingStyles) {\n tableColumnFreezingStyles.remove();\n }\n\n let currentNode = tableWrapper.parentNode as HTMLElement | null;\n\n while (currentNode !== null && currentNode !== iframeDocument.body) {\n // Add the 'h-fit' class to the 'table-wrapper' element's parent chain.\n // This ensures that the table is not cropped and fits within its container.\n currentNode?.classList.add('!h-fit');\n currentNode = currentNode.parentNode as HTMLElement | null;\n }\n\n setMountNode(tableWrapper);\n }, [iframeWindow, stylesReady]);\n\n const printTableProps: Table3Props<TType> = {\n ...tableProps,\n actionsForRow: undefined,\n // Not the best way to remove the active/current row styles, but a temporary solution for now\n defaultCurrentRowIndex: -1,\n defaultSettings: {\n ...tableProps?.defaultSettings,\n rowHeight: 'short',\n },\n enableColumnFreezing: false,\n enableRowHeight: true,\n enableRowSelection: false,\n enableEditing: false,\n enablePrinting: false,\n enableRowDrag: false,\n enableRowDrop: false,\n enableRowSelectionSingle: false,\n preset: undefined,\n // The presence of the onChangeSettings prop ensures that settings won't be stored in local storage.\n onChangeSettings: () => undefined,\n };\n\n // -top-60 -left-60 styles make sure that iframe is added outside of the viewport\n return (\n <iframe\n className=\"fixed -left-60 -top-60 !h-0 !w-0\"\n ref={setContentRef}\n // Temporary fix to support printing in firefox: Find another solution while upgrading React\n src=\"javascript:void(0);\">\n {mountNode && stylesReady ? ReactDOM.createPortal(<Table3 {...printTableProps} />, mountNode) : null}\n </iframe>\n );\n}\n"],"names":["PrintIFrame","onAfterPrint","onBeforePrint","tableProps","contentRef","setContentRef","React","useState","mountNode","setMountNode","isFirefoxBrowser","useMemo","navigator","userAgent","toLowerCase","includes","iframeWindow","contentWindow","stylesReady","useParentStylesheets","useEffect","intervalId","timeoutId","setInterval","tableWrapper","table","querySelector","hasTableRendered","_contentRef$contentWi","clearInterval","tableHeight","offsetHeight","style","height","print","setTimeout","Promise","resolve","e","reject","clearTimeout","iframeDocument","document","parentDocumentContent","_iframeWindow$parent$","parent","innerHTML","_iframeWindow$parent$2","body","tableElement","tableColumnFreezingStyles","createElement","setAttribute","classList","add","_tableElement$parentN","parentNode","insertBefore","remove","append","currentNode","_currentNode","printTableProps","actionsForRow","undefined","defaultCurrentRowIndex","defaultSettings","rowHeight","enableColumnFreezing","enableRowHeight","enableRowSelection","enableEditing","enablePrinting","enableRowDrag","enableRowDrop","enableRowSelectionSingle","preset","onChangeSettings","className","ref","src","ReactDOM","createPortal","Table3"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAagBA,WAAWA,CAAkB;EAAEC,YAAY;EAAEC,aAAa;EAAEC;CAAqC;EAC7G,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAA2B,IAAI,CAAC;EAClF,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGH,cAAK,CAACC,QAAQ,CAAqB,IAAI,CAAC;EAE1E,MAAMG,gBAAgB,GAAGJ,cAAK,CAACK,OAAO,CAAC,MAAMC,SAAS,CAACC,SAAS,CAACC,WAAW,EAAE,CAACC,QAAQ,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC;EAEvG,MAAMC,YAAY,GAAGZ,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEa,aAAa;EAE9C,MAAMC,WAAW,GAAGC,oBAAoB,CAACH,YAAY,CAAC;;EAGtDV,cAAK,CAACc,SAAS,CAAC;IACZ,IAAIC,UAAwB;IAC5B,IAAIC,SAAuB;;;IAI3B,IAAId,SAAS,IAAIU,WAAW,EAAE;MAC1BG,UAAU,GAAGE,WAAW;QAAA;UACpB,MAAMC,YAAY,GAAGhB,SAAS;UAC9B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aR,SAAS,CAACC,GAAG,CAAC,QAAQ,CAAC;MACpCM,WAAW,GAAGA,WAAW,CAACJ,UAAgC;;IAG9D/C,YAAY,CAACe,YAAY,CAAC;GAC7B,EAAE,CAACR,YAAY,EAAEE,WAAW,CAAC,CAAC;EAE/B,MAAM4C,eAAe,GAAuB;IACxC,GAAG3D,UAAU;IACb4D,aAAa,EAAEC,SAAS;;IAExBC,sBAAsB,EAAE,CAAC,CAAC;IAC1BC,eAAe,EAAE;MACb,IAAG/D,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAE+D,eAAe;MAC9BC,SAAS,EAAE;KACd;IACDC,oBAAoB,EAAE,KAAK;IAC3BC,eAAe,EAAE,IAAI;IACrBC,kBAAkB,EAAE,KAAK;IACzBC,aAAa,EAAE,KAAK;IACpBC,cAAc,EAAE,KAAK;IACrBC,aAAa,EAAE,KAAK;IACpBC,aAAa,EAAE,KAAK;IACpBC,wBAAwB,EAAE,KAAK;IAC/BC,MAAM,EAAEZ,SAAS;;IAEjBa,gBAAgB,EAAEA,MAAMb;GAC3B;;EAGD,oBACI1D;IACIwE,SAAS,EAAC,kCAAkC;IAC5CC,GAAG,EAAE1E,aAAa;;IAElB2E,GAAG,EAAC;KACHxE,SAAS,IAAIU,WAAW,gBAAG+D,QAAQ,CAACC,YAAY,eAAC5E,6BAAC6E,MAAM,oBAAKrB,eAAe,EAAI,EAAEtD,SAAS,CAAC,GAAG,IAAI,CAC/F;AAEjB;;;;"}
|
1
|
+
{"version":3,"file":"PrintIFrame.js","sources":["../../../../../../../../../../src/components/Table3/components/toolbar/PrintButton/PrintIFrame.tsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { Table3 } from '../../../../..';\nimport { Table3Props } from '../../../types';\nimport { useParentStylesheets } from './hooks/useParentStylesheets';\n\nexport type PrintIFrameProps<TType = unknown> = {\n onAfterPrint?: () => void;\n onBeforePrint?: () => void;\n tableProps: Table3Props<TType>;\n};\n\nexport function PrintIFrame<TType = unknown>({ onAfterPrint, onBeforePrint, tableProps }: PrintIFrameProps<TType>) {\n const [contentRef, setContentRef] = React.useState<HTMLIFrameElement | null>(null);\n const [mountNode, setMountNode] = React.useState<HTMLElement | null>(null);\n\n const isFirefoxBrowser = React.useMemo(() => navigator.userAgent.toLowerCase().includes('firefox'), []);\n\n const iframeWindow = contentRef?.contentWindow;\n\n const stylesReady = useParentStylesheets(iframeWindow);\n\n // Calls print method when table has loaded in the iframe.\n React.useEffect(() => {\n let intervalId: NodeJS.Timer;\n let timeoutId: NodeJS.Timer;\n\n // Invoke the print functionality on the window once the table has finished rendering and all print styles are\n // added.\n if (mountNode && stylesReady) {\n intervalId = setInterval(async () => {\n const tableWrapper = mountNode;\n const table = tableWrapper.querySelector('[role=\"table\"]') as HTMLElement;\n const hasTableRendered = !!table;\n\n if (hasTableRendered && intervalId) {\n clearInterval(intervalId);\n\n // Calling the onBeforePrint method here as a fallback because certain browsers, like Safari,\n // do not call the beforeprint event.\n // Bug - Even though onBeforePrint is called before printing, the execution doesn't finish before\n // the print dialog shows up, which results into having a visible loading toast.\n onBeforePrint?.();\n\n // By adding height to the tableWrapper, we make sure the content below absolutely positioned table\n // doesn't hide\n if (isFirefoxBrowser) {\n const tableHeight = `${table.offsetHeight}px`;\n tableWrapper.style.height = tableHeight;\n }\n\n contentRef?.contentWindow?.print();\n\n // Calling the onAfterPrint method here as a fallback to do the cleanup, as certain browsers,\n // like Safari, do not trigger the beforeprint or afterprint events when a confirmation dialog\n // asking if the user wants to print the document, is cancelled.\n\n // Added a setTimeout to prevent calling onAfterPrint immediately after the print function\n // to ensure that the print dialog doesn't close abruptly. Although this behavior is uncommon,\n // there are cases where the print function may not run synchronously, causing onAfterPrint to be\n // invoked right after it.\n timeoutId = setTimeout(() => {\n onAfterPrint?.();\n }, 0);\n }\n }, 1000);\n }\n\n return () => {\n clearInterval(intervalId);\n clearTimeout(timeoutId);\n };\n }, [mountNode, stylesReady]);\n\n React.useEffect(() => {\n if (!contentRef || !iframeWindow || !stylesReady) {\n return;\n }\n\n // get the closest parent/container of the table, and the table itself\n const parentElement = contentRef?.closest('[role=dialog], [data-taco=drawer], main') ?? iframeWindow.parent.document.body;\n\n const iframeDocument = iframeWindow.document;\n iframeDocument.body.innerHTML = parentElement?.innerHTML ?? '';\n\n const tableElement = iframeDocument.querySelector('[role=\"table\"]');\n const tableColumnFreezingStyles = iframeDocument.querySelector('[data-taco=\"table3-column-freezing-styles\"]');\n const tableWrapper = iframeDocument.createElement('div');\n\n tableWrapper.setAttribute('data-role', 'table-wrapper');\n // Adding h-fit class makes sure that table is rendered with the whole content.\n tableWrapper.classList.add('h-fit');\n tableWrapper.classList.add('[&>[role=\"table\"]]:!h-fit');\n\n if (isFirefoxBrowser) {\n // Fix for firefox bug which adds page-long whitespace between page's top content and table\n tableWrapper.classList.add('[&>[role=\"table\"]]:!absolute');\n }\n\n // Safari print preview assigns no width to the table when w-screen class is used.\n // By assigning table a big static width and hiding the horizontal scrollbar, the table on chrome\n // and safari will always take full page width.\n tableWrapper.classList.add('w-[10000px]');\n\n if (tableElement) {\n tableElement.parentNode?.insertBefore(tableWrapper, tableElement);\n tableElement.remove();\n } else {\n iframeDocument.body.append(tableWrapper);\n }\n\n // Remove the already existing column freezing styles.\n if (tableColumnFreezingStyles) {\n tableColumnFreezingStyles.remove();\n }\n\n let currentNode = tableWrapper.parentNode as HTMLElement | null;\n\n while (currentNode !== null && currentNode !== iframeDocument.body) {\n // Add the 'h-fit' class to the 'table-wrapper' element's parent chain.\n // This ensures that the table is not cropped and fits within its container.\n currentNode?.classList.add('!h-fit');\n currentNode = currentNode.parentNode as HTMLElement | null;\n }\n\n setMountNode(tableWrapper);\n }, [iframeWindow, stylesReady]);\n\n const printTableProps: Table3Props<TType> = {\n ...tableProps,\n actionsForRow: undefined,\n // Not the best way to remove the active/current row styles, but a temporary solution for now\n defaultCurrentRowIndex: -1,\n defaultSettings: {\n ...tableProps?.defaultSettings,\n rowHeight: 'short',\n },\n enableColumnFreezing: false,\n enableRowHeight: true,\n enableRowSelection: false,\n enableEditing: false,\n enablePrinting: false,\n enableRowDrag: false,\n enableRowDrop: false,\n enableRowSelectionSingle: false,\n preset: undefined,\n // The presence of the onChangeSettings prop ensures that settings won't be stored in local storage.\n onChangeSettings: () => undefined,\n };\n\n // -top-60 -left-60 styles make sure that iframe is added outside of the viewport\n return (\n <iframe\n className=\"fixed -left-60 -top-60 !h-0 !w-0\"\n ref={setContentRef}\n // Temporary fix to support printing in firefox: Find another solution while upgrading React\n src=\"javascript:void(0);\">\n {mountNode && stylesReady ? ReactDOM.createPortal(<Table3 {...printTableProps} />, mountNode) : null}\n </iframe>\n );\n}\n"],"names":["PrintIFrame","onAfterPrint","onBeforePrint","tableProps","contentRef","setContentRef","React","useState","mountNode","setMountNode","isFirefoxBrowser","useMemo","navigator","userAgent","toLowerCase","includes","iframeWindow","contentWindow","stylesReady","useParentStylesheets","useEffect","intervalId","timeoutId","setInterval","tableWrapper","table","querySelector","hasTableRendered","_contentRef$contentWi","clearInterval","tableHeight","offsetHeight","style","height","print","setTimeout","Promise","resolve","e","reject","clearTimeout","parentElement","_contentRef$closest","closest","parent","document","body","iframeDocument","innerHTML","_parentElement$innerH","tableElement","tableColumnFreezingStyles","createElement","setAttribute","classList","add","_tableElement$parentN","parentNode","insertBefore","remove","append","currentNode","_currentNode","printTableProps","actionsForRow","undefined","defaultCurrentRowIndex","defaultSettings","rowHeight","enableColumnFreezing","enableRowHeight","enableRowSelection","enableEditing","enablePrinting","enableRowDrag","enableRowDrop","enableRowSelectionSingle","preset","onChangeSettings","className","ref","src","ReactDOM","createPortal","Table3"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAagBA,WAAWA,CAAkB;EAAEC,YAAY;EAAEC,aAAa;EAAEC;CAAqC;EAC7G,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGC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Z,SAAS;;IAEjBa,gBAAgB,EAAEA,MAAMb;GAC3B;;EAGD,oBACI3D;IACIyE,SAAS,EAAC,kCAAkC;IAC5CC,GAAG,EAAE3E,aAAa;;IAElB4E,GAAG,EAAC;KACHzE,SAAS,IAAIU,WAAW,gBAAGgE,QAAQ,CAACC,YAAY,eAAC7E,6BAAC8E,MAAM,oBAAKrB,eAAe,EAAI,EAAEvD,SAAS,CAAC,GAAG,IAAI,CAC/F;AAEjB;;;;"}
|
@@ -135,10 +135,13 @@ function resetHighlightedColumnIndexes(enabled, value, table) {
|
|
135
135
|
table.getRowModel().rows.forEach((row, rowIndex) => {
|
136
136
|
columns.forEach((column, columnIndex) => {
|
137
137
|
try {
|
138
|
-
var
|
139
|
-
|
140
|
-
|
141
|
-
|
138
|
+
var _column$columnDef$met;
|
139
|
+
if ((_column$columnDef$met = column.columnDef.meta) !== null && _column$columnDef$met !== void 0 && _column$columnDef$met.enableSearch) {
|
140
|
+
var _row$original, _column$columnDef$met2;
|
141
|
+
const cellValue = getCellValueAsString((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original[column.id], (_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.dataType);
|
142
|
+
if (cellValue && globalFilterFn(cellValue, value)) {
|
143
|
+
indexes.push([rowIndex, columnIndex]);
|
144
|
+
}
|
142
145
|
}
|
143
146
|
} catch (e) {
|
144
147
|
//
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Search.js","sources":["../../../../../../../../../src/components/Table3/components/toolbar/Search.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Switch } from '../../../Switch/Switch';\nimport { globalFilterFn } from '../../util/filtering';\nimport { SearchInput2 } from '../../../SearchInput2/SearchInput2';\nimport { useDebouncedEffect } from '../../../../hooks/useDebouncedEffect';\nimport { getCellValueAsString } from '../../util/columns';\n\ntype SearchProps<TType = unknown> = {\n scrollToIndex: any;\n table: RTable<TType>;\n};\n\nenum LoadingState {\n Incomplete,\n Loading,\n Completed,\n}\n\nexport function Search<TType = unknown>(props: SearchProps<TType>) {\n const { scrollToIndex, table } = props;\n const { texts } = useLocalization();\n const ref = React.useRef<HTMLInputElement>(null);\n const tableMeta = table.options.meta as TableMeta<TType>;\n const [query, setQuery] = React.useState(tableMeta.search.query);\n const [loading, setLoading] = React.useState<LoadingState>(LoadingState.Incomplete);\n\n const scrollTo = (rowIndex: number) => scrollToIndex(rowIndex, { align: 'center' });\n\n // update the indexes if the row length changes (e.g. when filtering)\n React.useEffect(() => {\n const firstRowIndex = resetHighlightedColumnIndexes(tableMeta.search.isHighlightingEnabled, ref.current?.value, table);\n\n if (firstRowIndex) {\n scrollTo(firstRowIndex);\n }\n }, [\n tableMeta.search.query,\n tableMeta.search.excludeUnmatchedResults,\n table.getRowModel().rows.length,\n JSON.stringify(table.getState().sorting),\n JSON.stringify(table.getState().columnVisibility),\n loading,\n ]);\n\n // update the table search and filtering on a debounce\n useDebouncedEffect(() => {\n tableMeta.search.setQuery(query);\n\n if (tableMeta.search.excludeUnmatchedResults) {\n if (query?.length) {\n table.setGlobalFilter(query);\n } else {\n table.resetGlobalFilter();\n }\n }\n }, [query]);\n\n const handleFocus = async () => {\n // load all data if that is possible\n if (tableMeta.search.loadAll && loading === LoadingState.Incomplete) {\n setLoading(LoadingState.Loading);\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.search.loadAll(table.getState().sorting, table.getState().columnFilters, undefined);\n setLoading(LoadingState.Completed);\n }\n };\n\n const handleChange = (query: any) => {\n setQuery(String(query ?? ''));\n };\n\n const handleToggleExcludeUnmatchedResults = (enabled: boolean) => {\n tableMeta.search.toggleExcludeUnmatchedResults(enabled);\n\n if (enabled) {\n if (ref.current?.value) {\n table.setGlobalFilter(ref.current?.value);\n } else {\n table.resetGlobalFilter();\n }\n } else {\n table.resetGlobalFilter();\n }\n\n requestAnimationFrame(() => ref.current?.focus());\n };\n\n const handleNextResult = () => {\n if (!tableMeta.search.highlightedColumnIndexes.length) {\n return;\n }\n\n const nextIndex =\n tableMeta.search.currentHighlightColumnIndex === undefined ||\n tableMeta.search.currentHighlightColumnIndex === tableMeta.search.highlightedColumnIndexes.length - 1\n ? 0\n : tableMeta.search.currentHighlightColumnIndex + 1;\n\n tableMeta.search.setCurrentHighlightColumnIndex(nextIndex);\n // we scroll to the row here, the cell scrolls itself into view\n scrollTo(tableMeta.search.highlightedColumnIndexes[nextIndex][0]);\n };\n\n const handlePreviousResult = () => {\n if (!tableMeta.search.highlightedColumnIndexes.length) {\n return;\n }\n\n const nextIndex =\n tableMeta.search.currentHighlightColumnIndex === undefined\n ? 0\n : tableMeta.search.currentHighlightColumnIndex === 0\n ? tableMeta.search.highlightedColumnIndexes.length - 1\n : tableMeta.search.currentHighlightColumnIndex - 1;\n\n tableMeta.search.setCurrentHighlightColumnIndex(nextIndex);\n // we scroll to the row here, the cell scrolls itself into view\n scrollTo(tableMeta.search.highlightedColumnIndexes[nextIndex][0]);\n };\n\n const settings = (\n <Switch\n label={texts.table3.search.excludeUnmatchedResults}\n checked={tableMeta.search.excludeUnmatchedResults}\n onChange={handleToggleExcludeUnmatchedResults}\n />\n );\n\n return (\n <>\n <SearchInput2\n findCurrent={\n tableMeta.search.currentHighlightColumnIndex !== undefined\n ? tableMeta.search.currentHighlightColumnIndex + 1\n : null\n }\n findTotal={tableMeta.search.highlightedColumnIndexes ? tableMeta.search.highlightedColumnIndexes.length : null}\n loading={loading === LoadingState.Loading}\n onClickFindPrevious={handlePreviousResult}\n onClickFindNext={handleNextResult}\n onChange={handleChange}\n onFocus={handleFocus}\n placeholder={texts.table3.search.placeholder}\n settingsContent={settings}\n ref={ref}\n shortcut={{ key: 'f', meta: true, shift: false }}\n value={query}\n />\n </>\n );\n}\n\nfunction resetHighlightedColumnIndexes<TType = unknown>(enabled: boolean, value: string | undefined, table: RTable<TType>) {\n const tableMeta = table.options.meta as TableMeta<TType>;\n let firstRowIndex: undefined | number;\n\n if (enabled && value) {\n const rowIndexes: number[] = [];\n const indexes: number[][] = [];\n const columns = table.getVisibleLeafColumns();\n\n table.getRowModel().rows.forEach((row, rowIndex) => {\n columns.forEach((column, columnIndex) => {\n try {\n const cellValue = getCellValueAsString(row.original?.[column.id], column.columnDef.meta?.dataType);\n\n if (cellValue && globalFilterFn(cellValue, value)) {\n indexes.push([rowIndex, columnIndex]);\n }\n } catch (e) {\n //\n }\n });\n\n if (indexes.length) {\n rowIndexes.push(rowIndex);\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.currentRow.setCurrentRowIndex(firstRowIndex);\n }\n\n return firstRowIndex;\n}\n"],"names":["LoadingState","Search","props","scrollToIndex","table","texts","useLocalization","ref","React","useRef","tableMeta","options","meta","query","setQuery","useState","search","loading","setLoading","Incomplete","scrollTo","rowIndex","align","useEffect","firstRowIndex","resetHighlightedColumnIndexes","isHighlightingEnabled","_ref$current","current","value","excludeUnmatchedResults","getRowModel","rows","length","JSON","stringify","getState","sorting","columnVisibility","useDebouncedEffect","setGlobalFilter","resetGlobalFilter","handleFocus","loadAll","Loading","Promise","resolve","columnFilters","undefined","then","Completed","_temp","e","reject","handleChange","String","handleToggleExcludeUnmatchedResults","enabled","toggleExcludeUnmatchedResults","_ref$current2","_ref$current3","requestAnimationFrame","_ref$current4","focus","handleNextResult","highlightedColumnIndexes","nextIndex","currentHighlightColumnIndex","setCurrentHighlightColumnIndex","handlePreviousResult","settings","Switch","label","table3","checked","onChange","SearchInput2","findCurrent","findTotal","onClickFindPrevious","onClickFindNext","onFocus","placeholder","settingsContent","shortcut","key","shift","indexes","columns","getVisibleLeafColumns","forEach","row","column","columnIndex","_row$original","_column$columnDef$met","cellValue","getCellValueAsString","original","id","columnDef","dataType","globalFilterFn","push","setHighlightedColumnIndexes","currentRow","setCurrentRowIndex"],"mappings":";;;;;;;;AAcA,IAAKA,YAIJ;AAJD,WAAKA,YAAY;EACbA,2DAAU;EACVA,qDAAO;EACPA,yDAAS;AACb,CAAC,EAJIA,YAAY,KAAZA,YAAY;SAMDC,MAAMA,CAAkBC,KAAyB;EAC7D,MAAM;IAAEC,aAAa;IAAEC;GAAO,GAAGF,KAAK;EACtC,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,GAAG,GAAGC,cAAK,CAACC,MAAM,CAAmB,IAAI,CAAC;EAChD,MAAMC,SAAS,GAAGN,KAAK,CAACO,OAAO,CAACC,IAAwB;EACxD,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGN,cAAK,CAACO,QAAQ,CAACL,SAAS,CAACM,MAAM,CAACH,KAAK,CAAC;EAChE,MAAM,CAACI,OAAO,EAAEC,UAAU,CAAC,GAAGV,cAAK,CAACO,QAAQ,CAAef,YAAY,CAACmB,UAAU,CAAC;EAEnF,MAAMC,QAAQ,GAAIC,QAAgB,IAAKlB,aAAa,CAACkB,QAAQ,EAAE;IAAEC,KAAK,EAAE;GAAU,CAAC;;EAGnFd,cAAK,CAACe,SAAS,CAAC;;IACZ,MAAMC,aAAa,GAAGC,6BAA6B,CAACf,SAAS,CAACM,MAAM,CAACU,qBAAqB,GAAAC,YAAA,GAAEpB,GAAG,CAACqB,OAAO,cAAAD,YAAA,uBAAXA,YAAA,CAAaE,KAAK,EAAEzB,KAAK,CAAC;IAEtH,IAAIoB,aAAa,EAAE;MACfJ,QAAQ,CAACI,aAAa,CAAC;;GAE9B,EAAE,CACCd,SAAS,CAACM,MAAM,CAACH,KAAK,EACtBH,SAAS,CAACM,MAAM,CAACc,uBAAu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AAE;MAChBT,aAAa,GAAG+D,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;MAC7B7E,SAAS,CAACM,MAAM,CAACoD,8BAA8B,CAAC,CAAC,CAAC;KACrD,MAAM;MACH1D,SAAS,CAACM,MAAM,CAACoD,8BAA8B,CAACpB,SAAS,CAAC;;GAEjE,MAAM;IACHtC,SAAS,CAACM,MAAM,CAACwF,2BAA2B,CAAC,EAAE,CAAC;IAChD9F,SAAS,CAACM,MAAM,CAACoD,8BAA8B,CAACpB,SAAS,CAAC;;EAG9D,IAAIxB,aAAa,KAAKwB,SAAS,EAAE;IAC7BtC,SAAS,CAAC+F,UAAU,CAACC,kBAAkB,CAAClF,aAAa,CAAC;;EAG1D,OAAOA,aAAa;AACxB;;;;"}
|
1
|
+
{"version":3,"file":"Search.js","sources":["../../../../../../../../../src/components/Table3/components/toolbar/Search.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Switch } from '../../../Switch/Switch';\nimport { globalFilterFn } from '../../util/filtering';\nimport { SearchInput2 } from '../../../SearchInput2/SearchInput2';\nimport { useDebouncedEffect } from '../../../../hooks/useDebouncedEffect';\nimport { getCellValueAsString } from '../../util/columns';\n\ntype SearchProps<TType = unknown> = {\n scrollToIndex: any;\n table: RTable<TType>;\n};\n\nenum LoadingState {\n Incomplete,\n Loading,\n Completed,\n}\n\nexport function Search<TType = unknown>(props: SearchProps<TType>) {\n const { scrollToIndex, table } = props;\n const { texts } = useLocalization();\n const ref = React.useRef<HTMLInputElement>(null);\n const tableMeta = table.options.meta as TableMeta<TType>;\n const [query, setQuery] = React.useState(tableMeta.search.query);\n const [loading, setLoading] = React.useState<LoadingState>(LoadingState.Incomplete);\n\n const scrollTo = (rowIndex: number) => scrollToIndex(rowIndex, { align: 'center' });\n\n // update the indexes if the row length changes (e.g. when filtering)\n React.useEffect(() => {\n const firstRowIndex = resetHighlightedColumnIndexes(tableMeta.search.isHighlightingEnabled, ref.current?.value, table);\n\n if (firstRowIndex) {\n scrollTo(firstRowIndex);\n }\n }, [\n tableMeta.search.query,\n tableMeta.search.excludeUnmatchedResults,\n table.getRowModel().rows.length,\n JSON.stringify(table.getState().sorting),\n JSON.stringify(table.getState().columnVisibility),\n loading,\n ]);\n\n // update the table search and filtering on a debounce\n useDebouncedEffect(() => {\n tableMeta.search.setQuery(query);\n\n if (tableMeta.search.excludeUnmatchedResults) {\n if (query?.length) {\n table.setGlobalFilter(query);\n } else {\n table.resetGlobalFilter();\n }\n }\n }, [query]);\n\n const handleFocus = async () => {\n // load all data if that is possible\n if (tableMeta.search.loadAll && loading === LoadingState.Incomplete) {\n setLoading(LoadingState.Loading);\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.search.loadAll(table.getState().sorting, table.getState().columnFilters, undefined);\n setLoading(LoadingState.Completed);\n }\n };\n\n const handleChange = (query: any) => {\n setQuery(String(query ?? ''));\n };\n\n const handleToggleExcludeUnmatchedResults = (enabled: boolean) => {\n tableMeta.search.toggleExcludeUnmatchedResults(enabled);\n\n if (enabled) {\n if (ref.current?.value) {\n table.setGlobalFilter(ref.current?.value);\n } else {\n table.resetGlobalFilter();\n }\n } else {\n table.resetGlobalFilter();\n }\n\n requestAnimationFrame(() => ref.current?.focus());\n };\n\n const handleNextResult = () => {\n if (!tableMeta.search.highlightedColumnIndexes.length) {\n return;\n }\n\n const nextIndex =\n tableMeta.search.currentHighlightColumnIndex === undefined ||\n tableMeta.search.currentHighlightColumnIndex === tableMeta.search.highlightedColumnIndexes.length - 1\n ? 0\n : tableMeta.search.currentHighlightColumnIndex + 1;\n\n tableMeta.search.setCurrentHighlightColumnIndex(nextIndex);\n // we scroll to the row here, the cell scrolls itself into view\n scrollTo(tableMeta.search.highlightedColumnIndexes[nextIndex][0]);\n };\n\n const handlePreviousResult = () => {\n if (!tableMeta.search.highlightedColumnIndexes.length) {\n return;\n }\n\n const nextIndex =\n tableMeta.search.currentHighlightColumnIndex === undefined\n ? 0\n : tableMeta.search.currentHighlightColumnIndex === 0\n ? tableMeta.search.highlightedColumnIndexes.length - 1\n : tableMeta.search.currentHighlightColumnIndex - 1;\n\n tableMeta.search.setCurrentHighlightColumnIndex(nextIndex);\n // we scroll to the row here, the cell scrolls itself into view\n scrollTo(tableMeta.search.highlightedColumnIndexes[nextIndex][0]);\n };\n\n const settings = (\n <Switch\n label={texts.table3.search.excludeUnmatchedResults}\n checked={tableMeta.search.excludeUnmatchedResults}\n onChange={handleToggleExcludeUnmatchedResults}\n />\n );\n\n return (\n <>\n <SearchInput2\n findCurrent={\n tableMeta.search.currentHighlightColumnIndex !== undefined\n ? tableMeta.search.currentHighlightColumnIndex + 1\n : null\n }\n findTotal={tableMeta.search.highlightedColumnIndexes ? tableMeta.search.highlightedColumnIndexes.length : null}\n loading={loading === LoadingState.Loading}\n onClickFindPrevious={handlePreviousResult}\n onClickFindNext={handleNextResult}\n onChange={handleChange}\n onFocus={handleFocus}\n placeholder={texts.table3.search.placeholder}\n settingsContent={settings}\n ref={ref}\n shortcut={{ key: 'f', meta: true, shift: false }}\n value={query}\n />\n </>\n );\n}\n\nfunction resetHighlightedColumnIndexes<TType = unknown>(enabled: boolean, value: string | undefined, table: RTable<TType>) {\n const tableMeta = table.options.meta as TableMeta<TType>;\n let firstRowIndex: undefined | number;\n\n if (enabled && value) {\n const rowIndexes: number[] = [];\n const indexes: number[][] = [];\n const columns = table.getVisibleLeafColumns();\n\n table.getRowModel().rows.forEach((row, rowIndex) => {\n columns.forEach((column, columnIndex) => {\n try {\n if (column.columnDef.meta?.enableSearch) {\n const cellValue = getCellValueAsString(row.original?.[column.id], column.columnDef.meta?.dataType);\n\n if (cellValue && globalFilterFn(cellValue, value)) {\n indexes.push([rowIndex, columnIndex]);\n }\n }\n } catch (e) {\n //\n }\n });\n\n if (indexes.length) {\n rowIndexes.push(rowIndex);\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.currentRow.setCurrentRowIndex(firstRowIndex);\n }\n\n return firstRowIndex;\n}\n"],"names":["LoadingState","Search","props","scrollToIndex","table","texts","useLocalization","ref","React","useRef","tableMeta","options","meta","query","setQuery","useState","search","loading","setLoading","Incomplete","scrollTo","rowIndex","align","useEffect","firstRowIndex","resetHighlightedColumnIndexes","isHighlightingEnabled","_ref$current","current","value","excludeUnmatchedResults","getRowModel","rows","length","JSON","stringify","getState","sorting","columnVisibility","useDebouncedEffect","setGlobalFilter","resetGlobalFilter","handleFocus","loadAll","Loading","Promise","resolve","columnFilters","undefined","then","Completed","_temp","e","reject","handleChange","String","handleToggleExcludeUnmatchedResults","enabled","toggleExcludeUnmatchedResults","_ref$current2","_ref$current3","requestAnimationFrame","_ref$current4","focus","handleNextResult","highlightedColumnIndexes","nextIndex","currentHighlightColumnIndex","setCurrentHighlightColumnIndex","handlePreviousResult","settings","Switch","label","table3","checked","onChange","SearchInput2","findCurrent","findTotal","onClickFindPrevious","onClickFindNext","onFocus","placeholder","settingsContent","shortcut","key","shift","indexes","columns","getVisibleLeafColumns","forEach","row","column","columnIndex","_column$columnDef$met","columnDef","enableSearch","_row$original","_column$columnDef$met2","cellValue","getCellValueAsString","original","id","dataType","globalFilterFn","push","setHighlightedColumnIndexes","currentRow","setCurrentRowIndex"],"mappings":";;;;;;;;AAcA,IAAKA,YAIJ;AAJD,WAAKA,YAAY;EACbA,2DAAU;EACVA,qDAAO;EACPA,yDAAS;AACb,CAAC,EAJIA,YAAY,KAAZA,YAAY;SAMDC,MAAMA,CAAkBC,KAAyB;EAC7D,MAAM;IAAEC,aAAa;IAAEC;GAAO,GAAGF,KA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2B,CAAC,EAAE,CAAC;IAChDhG,SAAS,CAACM,MAAM,CAACoD,8BAA8B,CAACpB,SAAS,CAAC;;EAG9D,IAAIxB,aAAa,KAAKwB,SAAS,EAAE;IAC7BtC,SAAS,CAACiG,UAAU,CAACC,kBAAkB,CAACpF,aAAa,CAAC;;EAG1D,OAAOA,aAAa;AACxB;;;;"}
|
@@ -19348,10 +19348,13 @@ function resetHighlightedColumnIndexes(enabled, value, table) {
|
|
19348
19348
|
table.getRowModel().rows.forEach((row, rowIndex) => {
|
19349
19349
|
columns.forEach((column, columnIndex) => {
|
19350
19350
|
try {
|
19351
|
-
var
|
19352
|
-
|
19353
|
-
|
19354
|
-
|
19351
|
+
var _column$columnDef$met;
|
19352
|
+
if ((_column$columnDef$met = column.columnDef.meta) !== null && _column$columnDef$met !== void 0 && _column$columnDef$met.enableSearch) {
|
19353
|
+
var _row$original, _column$columnDef$met2;
|
19354
|
+
const cellValue = getCellValueAsString((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original[column.id], (_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.dataType);
|
19355
|
+
if (cellValue && globalFilterFn$1(cellValue, value)) {
|
19356
|
+
indexes.push([rowIndex, columnIndex]);
|
19357
|
+
}
|
19355
19358
|
}
|
19356
19359
|
} catch (e) {
|
19357
19360
|
//
|
@@ -20125,14 +20128,14 @@ function PrintIFrame({
|
|
20125
20128
|
};
|
20126
20129
|
}, [mountNode, stylesReady]);
|
20127
20130
|
React__default.useEffect(() => {
|
20128
|
-
var
|
20129
|
-
if (!iframeWindow || !stylesReady) {
|
20131
|
+
var _contentRef$closest, _parentElement$innerH;
|
20132
|
+
if (!contentRef || !iframeWindow || !stylesReady) {
|
20130
20133
|
return;
|
20131
20134
|
}
|
20135
|
+
// get the closest parent/container of the table, and the table itself
|
20136
|
+
const parentElement = (_contentRef$closest = contentRef === null || contentRef === void 0 ? void 0 : contentRef.closest('[role=dialog], [data-taco=drawer], main')) !== null && _contentRef$closest !== void 0 ? _contentRef$closest : iframeWindow.parent.document.body;
|
20132
20137
|
const iframeDocument = iframeWindow.document;
|
20133
|
-
|
20134
|
-
const parentDocumentContent = ((_iframeWindow$parent$ = iframeWindow.parent.document.querySelector('main')) === null || _iframeWindow$parent$ === void 0 ? void 0 : _iframeWindow$parent$.innerHTML) || ((_iframeWindow$parent$2 = iframeWindow.parent.document.body) === null || _iframeWindow$parent$2 === void 0 ? void 0 : _iframeWindow$parent$2.innerHTML) || '';
|
20135
|
-
iframeDocument.body.innerHTML = parentDocumentContent;
|
20138
|
+
iframeDocument.body.innerHTML = (_parentElement$innerH = parentElement === null || parentElement === void 0 ? void 0 : parentElement.innerHTML) !== null && _parentElement$innerH !== void 0 ? _parentElement$innerH : '';
|
20136
20139
|
const tableElement = iframeDocument.querySelector('[role="table"]');
|
20137
20140
|
const tableColumnFreezingStyles = iframeDocument.querySelector('[data-taco="table3-column-freezing-styles"]');
|
20138
20141
|
const tableWrapper = iframeDocument.createElement('div');
|