@economic/taco 2.7.3 → 2.7.5
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/index.css +4 -2
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +1 -3
- package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +3 -5
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +2 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +35 -13
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
- 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/index.css +4 -2
- package/dist/taco.cjs.development.js +53 -31
- 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 +180 -128
|
@@ -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,KAA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CAAC;IAErD,IAAIA,OAAO,CAACtD,MAAM,EAAE;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,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AM;IACHtC,SAAS,CAACM,MAAM,CAAC0F,2BAA2B,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;;;;"}
|
package/dist/index.css
CHANGED
|
@@ -778,7 +778,8 @@
|
|
|
778
778
|
}
|
|
779
779
|
|
|
780
780
|
[data-font-size='small'] [role='cell'] [data-taco='input'],
|
|
781
|
-
[data-font-size='small'] [role='cell'] [data-taco='Select2']
|
|
781
|
+
[data-font-size='small'] [role='cell'] [data-taco='Select2'],
|
|
782
|
+
[data-font-size='small'] [role='cell'] [data-taco='textarea'] {
|
|
782
783
|
@apply h-6 min-h-[theme(spacing.6)] px-1.5 text-xs;
|
|
783
784
|
}
|
|
784
785
|
|
|
@@ -823,7 +824,8 @@
|
|
|
823
824
|
}
|
|
824
825
|
|
|
825
826
|
[data-font-size='large'] [role='cell'] [data-taco='input'],
|
|
826
|
-
[data-font-size='large'] [role='cell'] [data-taco='Select2']
|
|
827
|
+
[data-font-size='large'] [role='cell'] [data-taco='Select2'],
|
|
828
|
+
[data-font-size='large'] [role='cell'] [data-taco='textarea'] {
|
|
827
829
|
@apply h-10 px-2.5 text-lg;
|
|
828
830
|
}
|
|
829
831
|
|
|
@@ -10531,10 +10531,8 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
|
10531
10531
|
}), flattenedChildren)), /*#__PURE__*/React__default.createElement(PopoverPrimitive.Portal, null, /*#__PURE__*/React__default.createElement(PopoverPrimitive.Content, {
|
|
10532
10532
|
asChild: true,
|
|
10533
10533
|
align: "start",
|
|
10534
|
-
onOpenAutoFocus:
|
|
10534
|
+
onOpenAutoFocus: () => {
|
|
10535
10535
|
var _internalRef$current;
|
|
10536
|
-
event.preventDefault();
|
|
10537
|
-
event.stopPropagation();
|
|
10538
10536
|
(_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.focus();
|
|
10539
10537
|
},
|
|
10540
10538
|
onCloseAutoFocus: event => {
|
|
@@ -17604,6 +17602,22 @@ const Textarea = /*#__PURE__*/React.forwardRef(function Textarea(props, ref) {
|
|
|
17604
17602
|
}));
|
|
17605
17603
|
});
|
|
17606
17604
|
|
|
17605
|
+
// By UX design, textarea should fold to min size when blured and extend to max 5 lines height when edited in enableTruncate mode,
|
|
17606
|
+
// for this reason we need to set min/max height limits for each font size value.
|
|
17607
|
+
const heights = {
|
|
17608
|
+
small: {
|
|
17609
|
+
min: 24,
|
|
17610
|
+
max: 86
|
|
17611
|
+
},
|
|
17612
|
+
medium: {
|
|
17613
|
+
min: 34,
|
|
17614
|
+
max: 100
|
|
17615
|
+
},
|
|
17616
|
+
large: {
|
|
17617
|
+
min: 40,
|
|
17618
|
+
max: 140
|
|
17619
|
+
}
|
|
17620
|
+
};
|
|
17607
17621
|
const TextareaControl = /*#__PURE__*/React__default.forwardRef(function TextareaControl(props, externalRef) {
|
|
17608
17622
|
const {
|
|
17609
17623
|
onKeyDown: handleKeyDown,
|
|
@@ -17613,19 +17627,25 @@ const TextareaControl = /*#__PURE__*/React__default.forwardRef(function Textarea
|
|
|
17613
17627
|
align,
|
|
17614
17628
|
isCurrentRow,
|
|
17615
17629
|
value,
|
|
17630
|
+
fontSize,
|
|
17616
17631
|
...attributes
|
|
17617
17632
|
} = props;
|
|
17618
|
-
const
|
|
17619
|
-
const textareaMinHeight = 32;
|
|
17633
|
+
const minMaxHeight = heights[fontSize];
|
|
17620
17634
|
const columnMeta = column.columnDef.meta;
|
|
17621
17635
|
const ref = useMergedRef(externalRef);
|
|
17622
17636
|
React__default.useEffect(() => {
|
|
17623
|
-
|
|
17624
|
-
|
|
17625
|
-
|
|
17626
|
-
|
|
17637
|
+
if (ref !== null && ref !== void 0 && ref.current) {
|
|
17638
|
+
// Need to reset textarea to min height when font size got changed and if column in enable truncate mode.
|
|
17639
|
+
if (columnMeta !== null && columnMeta !== void 0 && columnMeta.enableTruncate) {
|
|
17640
|
+
const textareaElement = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
17641
|
+
textareaElement.style.height = `${minMaxHeight.min}px`;
|
|
17642
|
+
// If truncation is not enabled, then textarea should re-calculate it's height to fit with it's own content, when initialized or fonsSize got changed.
|
|
17643
|
+
} else {
|
|
17644
|
+
const textareaElement = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
17645
|
+
resizeTextArea(textareaElement);
|
|
17646
|
+
}
|
|
17627
17647
|
}
|
|
17628
|
-
}, []);
|
|
17648
|
+
}, [fontSize]);
|
|
17629
17649
|
React__default.useEffect(() => {
|
|
17630
17650
|
// If truncation is enabled, then textarea should only adjust to it's own content, when in detail mode.
|
|
17631
17651
|
// Otherwise it should collapse to minimal height.
|
|
@@ -17634,7 +17654,7 @@ const TextareaControl = /*#__PURE__*/React__default.forwardRef(function Textarea
|
|
|
17634
17654
|
if (isCellInDetailMode) {
|
|
17635
17655
|
resizeTextArea(textareaElement);
|
|
17636
17656
|
} else {
|
|
17637
|
-
textareaElement.style.height = `${
|
|
17657
|
+
textareaElement.style.height = `${minMaxHeight.min}px`;
|
|
17638
17658
|
}
|
|
17639
17659
|
}
|
|
17640
17660
|
}, [isCellInDetailMode]);
|
|
@@ -17644,9 +17664,9 @@ const TextareaControl = /*#__PURE__*/React__default.forwardRef(function Textarea
|
|
|
17644
17664
|
const textareaRect = textareaElement.getBoundingClientRect();
|
|
17645
17665
|
const prevHeight = textareaRect.height;
|
|
17646
17666
|
if (columnMeta !== null && columnMeta !== void 0 && columnMeta.enableTruncate) {
|
|
17647
|
-
if (prevHeight <
|
|
17667
|
+
if (prevHeight < minMaxHeight.max) {
|
|
17648
17668
|
textareaElement.style.height = 'inherit';
|
|
17649
|
-
textareaElement.style.height = `${Math.min(textareaElement.scrollHeight,
|
|
17669
|
+
textareaElement.style.height = `${Math.min(textareaElement.scrollHeight, minMaxHeight.max)}px`;
|
|
17650
17670
|
}
|
|
17651
17671
|
} else {
|
|
17652
17672
|
textareaElement.style.height = 'inherit';
|
|
@@ -17683,13 +17703,13 @@ const TextareaControl = /*#__PURE__*/React__default.forwardRef(function Textarea
|
|
|
17683
17703
|
// If truncation is enabled, then textarea should shring back to min height, when loosing focus.
|
|
17684
17704
|
if (columnMeta !== null && columnMeta !== void 0 && columnMeta.enableTruncate) {
|
|
17685
17705
|
const textareaElement = event.currentTarget;
|
|
17686
|
-
textareaElement.style.height = `${
|
|
17706
|
+
textareaElement.style.height = `${minMaxHeight.min}px`;
|
|
17687
17707
|
}
|
|
17688
17708
|
},
|
|
17689
17709
|
className: cn(getCellAlignmentClasses$1(align), `z-20 h-fit resize-none`, {
|
|
17690
|
-
[`!min-h-[${
|
|
17710
|
+
[`!min-h-[${minMaxHeight.min}px]`]: columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.enableTruncate,
|
|
17691
17711
|
'!yt-focus-dark': isCellInDetailMode,
|
|
17692
|
-
[`h-[${
|
|
17712
|
+
[`h-[${minMaxHeight.min}px]`]: !isCellInDetailMode && (columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.enableTruncate),
|
|
17693
17713
|
// Only allow resizing when focused and truncation enabled
|
|
17694
17714
|
'focus:resize-y': isCurrentRow && (columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.enableTruncate)
|
|
17695
17715
|
}),
|
|
@@ -17825,7 +17845,8 @@ const EditingControl = /*#__PURE__*/React__default.forwardRef(function Control(p
|
|
|
17825
17845
|
return /*#__PURE__*/React__default.createElement(TextareaControl, Object.assign({}, props, {
|
|
17826
17846
|
isCellInDetailMode: isCellInDetailMode,
|
|
17827
17847
|
onKeyDown: handleInputKeyDown,
|
|
17828
|
-
ref: refCallback
|
|
17848
|
+
ref: refCallback,
|
|
17849
|
+
fontSize: tableMeta.fontSize.size
|
|
17829
17850
|
}));
|
|
17830
17851
|
}
|
|
17831
17852
|
return /*#__PURE__*/React__default.createElement(Input, Object.assign({}, attributes, {
|
|
@@ -17936,11 +17957,9 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
|
17936
17957
|
const controlRenderer = (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.control;
|
|
17937
17958
|
const className = cn('!px-[0.4375rem] py-[calc(var(--table3-row-padding)_-_0.06rem)]', {
|
|
17938
17959
|
relative: (isCurrentRow || isHovered) && controlRenderer === 'textarea',
|
|
17939
|
-
// Need to set higher z-index, so that the current row textarea (in expanded state) overlaps rows below
|
|
17940
|
-
|
|
17941
|
-
|
|
17942
|
-
// as result we need to set lower z-index for the hovered row -> cell.
|
|
17943
|
-
'z-0': isHovered
|
|
17960
|
+
// Need to set higher z-index, so that the current row textarea (in expanded state, when positioned absolute) overlaps rows below,
|
|
17961
|
+
// but at the same time it should not overlap the table headers which has z-10.
|
|
17962
|
+
'z-[9]': isCurrentRow && controlRenderer === 'textarea'
|
|
17944
17963
|
},
|
|
17945
17964
|
// component overrides - grayscale for editing hover
|
|
17946
17965
|
'[[role="row"][data-current="false"]:hover_&>*]:!grayscale [[role="row"][data-current="false"]:hover_&_.bg-white]:!bg-grey-100',
|
|
@@ -19348,10 +19367,13 @@ function resetHighlightedColumnIndexes(enabled, value, table) {
|
|
|
19348
19367
|
table.getRowModel().rows.forEach((row, rowIndex) => {
|
|
19349
19368
|
columns.forEach((column, columnIndex) => {
|
|
19350
19369
|
try {
|
|
19351
|
-
var
|
|
19352
|
-
|
|
19353
|
-
|
|
19354
|
-
|
|
19370
|
+
var _column$columnDef$met;
|
|
19371
|
+
if ((_column$columnDef$met = column.columnDef.meta) !== null && _column$columnDef$met !== void 0 && _column$columnDef$met.enableSearch) {
|
|
19372
|
+
var _row$original, _column$columnDef$met2;
|
|
19373
|
+
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);
|
|
19374
|
+
if (cellValue && globalFilterFn$1(cellValue, value)) {
|
|
19375
|
+
indexes.push([rowIndex, columnIndex]);
|
|
19376
|
+
}
|
|
19355
19377
|
}
|
|
19356
19378
|
} catch (e) {
|
|
19357
19379
|
//
|
|
@@ -20125,14 +20147,14 @@ function PrintIFrame({
|
|
|
20125
20147
|
};
|
|
20126
20148
|
}, [mountNode, stylesReady]);
|
|
20127
20149
|
React__default.useEffect(() => {
|
|
20128
|
-
var
|
|
20129
|
-
if (!iframeWindow || !stylesReady) {
|
|
20150
|
+
var _contentRef$closest, _parentElement$innerH;
|
|
20151
|
+
if (!contentRef || !iframeWindow || !stylesReady) {
|
|
20130
20152
|
return;
|
|
20131
20153
|
}
|
|
20154
|
+
// get the closest parent/container of the table, and the table itself
|
|
20155
|
+
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
20156
|
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;
|
|
20157
|
+
iframeDocument.body.innerHTML = (_parentElement$innerH = parentElement === null || parentElement === void 0 ? void 0 : parentElement.innerHTML) !== null && _parentElement$innerH !== void 0 ? _parentElement$innerH : '';
|
|
20136
20158
|
const tableElement = iframeDocument.querySelector('[role="table"]');
|
|
20137
20159
|
const tableColumnFreezingStyles = iframeDocument.querySelector('[data-taco="table3-column-freezing-styles"]');
|
|
20138
20160
|
const tableWrapper = iframeDocument.createElement('div');
|