@economic/taco 8.1.0-EC-81716-test-release.0 → 8.1.0
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/primitives/Table/Core/features/useTableRenderer.cjs +1 -1
- package/dist/primitives/Table/Core/features/useTableRenderer.cjs.map +1 -1
- package/dist/primitives/Table/Core/features/useTableRenderer.js +1 -1
- package/dist/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
- package/package.json +4 -4
|
@@ -114,7 +114,7 @@ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIn
|
|
|
114
114
|
return /* @__PURE__ */ React.createElement(SkeletonRow.SkeletonRow, { key: skeletonKey, index: virtualRow.index, table });
|
|
115
115
|
}
|
|
116
116
|
const measureRow = (rowHeight) => {
|
|
117
|
-
virtualiser.resizeItem(virtualRow, rowHeight);
|
|
117
|
+
virtualiser.resizeItem(virtualRow.index, rowHeight);
|
|
118
118
|
};
|
|
119
119
|
return /* @__PURE__ */ React.createElement(
|
|
120
120
|
Row.Row,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTableRenderer.cjs","sources":["../../../../../src/primitives/Table/Core/features/useTableRenderer.tsx"],"sourcesContent":["import React, { CSSProperties } from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta, Row as ReactTableRow } from '@tanstack/react-table';\nimport {\n useVirtualizer,\n defaultRangeExtractor,\n ScrollToOptions as ReactVirtualScrollToOptions,\n Range,\n} from '@tanstack/react-virtual';\nimport sortBy from 'lodash/sortBy';\nimport without from 'lodash/without';\n\nimport { ROW_HEIGHT_ESTIMATES } from '../util/rows';\nimport { Row } from '../components/Row/Row';\nimport { useTableRenderers } from '../types';\nimport { TableRef } from '../../types';\nimport { SkeletonRow } from '../components/Row/BuiltIns/SkeletonRow';\n\n// scroll padding end is designed to always show half of the next row\nfunction getScrollPaddingEndOffset<TType = unknown>(table: ReactTable<TType>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n let offset = 2;\n\n if (tableMeta.footer.isEnabled) {\n offset += 1;\n }\n\n if (table.getHeaderGroups().length > 1) {\n offset += table.getHeaderGroups().length - 1;\n }\n\n let height = ROW_HEIGHT_ESTIMATES.medium * offset;\n\n const bottomRows = table.getBottomRows();\n\n if (bottomRows.length) {\n // 1.4 offsets for half rows and also accounts for increased row heights (which is likely in pinned rows)\n height += ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height] * 1.4 * bottomRows.length;\n }\n\n return height;\n}\n\n// scroll padding end is designed to always show half of the next row\nfunction getPaddingEndOffset<TType = unknown>(table: ReactTable<TType>) {\n const bottomRows = table.getBottomRows() ?? [];\n return ROW_HEIGHT_ESTIMATES.medium * 1 * bottomRows.length;\n}\n\n// A higher number ensure less scroll jumping for dynamic row heights, but too high can reduce performance. 8 worked well\nconst OVERSCAN_ROW_COUNT = 8;\n\nexport function useTableRenderer<TType = unknown>(\n renderers: useTableRenderers<TType>,\n table: ReactTable<TType>,\n tableRef: React.RefObject<TableRef>,\n length: number,\n defaultRowActiveIndex?: number | undefined\n) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const isTableRowGrouped = !!table.getState().grouping?.length;\n const rows = table.getCenterRows() ?? [];\n\n // row groups\n const rangeExtractor = useRowGroupVirtualisation<TType>(table);\n\n // account for thead and tfoot in the scroll area - both are always medium row height\n const scrollPaddingStart = ROW_HEIGHT_ESTIMATES.medium;\n\n const count = tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2 ? length : rows.length;\n\n const virtualiser = useVirtualizer({\n count,\n estimateSize: () => {\n return tableMeta.rowHeight.height ? ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height] : ROW_HEIGHT_ESTIMATES.medium;\n },\n getScrollElement: () => tableRef.current,\n overscan: tableMeta.printing.isPrinting ? count : OVERSCAN_ROW_COUNT,\n rangeExtractor,\n // correctly sets the scroll padding offset, e.g. when keyboard navigating rows in the list\n scrollPaddingStart,\n scrollPaddingEnd: getScrollPaddingEndOffset(table),\n paddingEnd: getPaddingEndOffset(table),\n });\n\n const expandedState = table.getState().expanded;\n const previousExpandedStateRef = React.useRef(false);\n\n React.useEffect(() => {\n // only remeasure when transitioning between expand all and not expand all\n const isEmpty = JSON.stringify(expandedState) === '{}';\n\n if (expandedState === true || (isEmpty && previousExpandedStateRef.current === true)) {\n previousExpandedStateRef.current = expandedState === true;\n virtualiser.measure();\n }\n }, [expandedState]);\n\n const totalSize = virtualiser.getTotalSize();\n const virtualItems = virtualiser.getVirtualItems();\n\n const scrollToIndex = React.useCallback(\n (index: number, options: ReactVirtualScrollToOptions = { align: 'auto', behavior: 'smooth' }) => {\n const notSmooth: ReactVirtualScrollToOptions = { ...options, behavior: 'auto' };\n\n if (tableRef.current) {\n if (index === 0) {\n virtualiser.scrollToOffset(0, notSmooth);\n } else if (index === count - 1) {\n // sometimes the last row doesn't fully show, so we just force scroll to the bottom\n tableRef.current.scrollTop = tableRef.current.scrollHeight;\n } else {\n virtualiser.scrollToIndex(index, options);\n }\n }\n },\n [virtualItems.length, tableRef.current, totalSize, count]\n );\n\n // use row 1 not 0, because 0 might be sticky in grouped tables and it's start value will always be 0\n const paddingStartIndex = isTableRowGrouped && count > 1 ? 1 : 0;\n\n const startValue = isTableRowGrouped\n ? (virtualItems[paddingStartIndex]?.start ?? 0) - (virtualItems[paddingStartIndex]?.size ?? 0)\n : virtualItems[paddingStartIndex]?.start;\n\n // styling for offsetting rows - this \"is\" the virtualisation\n const [paddingTop, paddingBottom] =\n virtualItems.length > 0\n ? [Math.max(0, startValue ?? 0), Math.max(0, totalSize - (virtualItems[virtualItems.length - 1]?.end ?? 0))]\n : [0, 0];\n\n // ensure default active rows are scrolled to\n React.useEffect(() => {\n if (defaultRowActiveIndex) {\n scrollToIndex(defaultRowActiveIndex, { align: 'center', behavior: 'auto' });\n }\n }, []);\n\n // rendered output\n let style: CSSProperties = {};\n let content: (JSX.Element | null)[] | null = null;\n\n // bottom rows aren't virtualised (they're sticky) but we need to set the height\n if (count || table.getBottomRows().length) {\n style = {\n height: totalSize,\n paddingBottom: Number.isNaN(paddingBottom) ? 0 : paddingBottom,\n paddingTop: Number.isNaN(paddingTop) ? 0 : paddingTop,\n };\n }\n\n // only render non sticky rows\n if (count) {\n content = virtualItems.map(virtualRow => {\n // there appears to be a react-virtual bug where it inserts a single `undefined` item at the end of the row, which crashes here\n if (!virtualRow) {\n return null;\n }\n\n let row: ReactTableRow<TType> | undefined;\n\n if (tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2) {\n const currentPageIndex =\n (Math.floor(virtualRow.index / tableMeta.server.pageSize) * tableMeta.server.pageSize) /\n tableMeta.server.pageSize;\n const pagePosition = tableMeta.server.pages?.indexOf(currentPageIndex) ?? -1;\n\n if (pagePosition > -1) {\n // \"flatten\" row indexes down into the dataloader2 dataset size\n // for example, with a page size of 100...\n // row index 14267 is actually one of index 67, 167, 267 etc within the dataset (depending on number of pages stored)\n const fakeIndex = pagePosition * tableMeta.server.pageSize + (virtualRow.index % tableMeta.server.pageSize);\n row = rows[fakeIndex];\n }\n } else {\n row = rows[virtualRow.index];\n }\n\n if (!row?.original) {\n // Prefix skeleton keys to prevent collision with real data row keys\n const skeletonKey = `skeleton-${virtualRow.index}`;\n return <SkeletonRow key={skeletonKey} index={virtualRow.index} table={table} />;\n }\n\n const measureRow = (rowHeight: number) => {\n virtualiser.resizeItem(virtualRow, rowHeight);\n };\n\n return (\n <Row\n key={row.id}\n row={row}\n index={virtualRow.index}\n table={table}\n measureRow={measureRow}\n renderer={renderers.row}\n cellRenderer={renderers.cell}\n />\n );\n });\n }\n\n return {\n rows: content,\n style,\n scrollToIndex,\n };\n}\n\n// support virtualised row groups (where the row group headers are sticky)\nfunction useRowGroupVirtualisation<TType = unknown>(table: ReactTable<TType>) {\n const rows = table.getRowModel().rows;\n const isTableGrouped = !!table.getState().grouping.length;\n\n const rowGroupIndexes = React.useMemo(() => {\n const indexes: number[] = [];\n\n if (isTableGrouped) {\n rows.forEach((row, index) => {\n if (row.getIsGrouped()) {\n indexes.push(index);\n }\n });\n }\n\n return indexes;\n }, [rows]);\n\n // this is taken from the react-virtual docs/examples\n const rangeExtractor = React.useCallback(\n (range: Range) => {\n const activeRowGroupIndex =\n [...rowGroupIndexes].reverse().find(index => range.startIndex >= index) ?? rowGroupIndexes[0];\n\n return activeRowGroupIndex === undefined\n ? defaultRangeExtractor(range)\n : sortBy([activeRowGroupIndex, ...without(defaultRangeExtractor(range), activeRowGroupIndex)], a => a);\n },\n [rowGroupIndexes]\n );\n\n return isTableGrouped ? rangeExtractor : undefined;\n}\n"],"names":["ROW_HEIGHT_ESTIMATES","rows","useVirtualizer","_a","SkeletonRow","Row","defaultRangeExtractor"],"mappings":";;;;;;;;;AAkBA,SAAS,0BAA2C,OAA0B;AACpE,QAAA,YAAY,MAAM,QAAQ;AAChC,MAAI,SAAS;AAET,MAAA,UAAU,OAAO,WAAW;AAClB,cAAA;AAAA,EAAA;AAGd,MAAI,MAAM,kBAAkB,SAAS,GAAG;AAC1B,cAAA,MAAM,gBAAgB,EAAE,SAAS;AAAA,EAAA;AAG3C,MAAA,SAASA,0BAAqB,SAAS;AAErC,QAAA,aAAa,MAAM,cAAc;AAEvC,MAAI,WAAW,QAAQ;AAEnB,cAAUA,0BAAqB,UAAU,UAAU,MAAM,IAAI,MAAM,WAAW;AAAA,EAAA;AAG3E,SAAA;AACX;AAGA,SAAS,oBAAqC,OAA0B;AACpE,QAAM,aAAa,MAAM,cAAc,KAAK,CAAC;AACtC,SAAAA,0BAAqB,SAAS,IAAI,WAAW;AACxD;AAGA,MAAM,qBAAqB;AAEpB,SAAS,iBACZ,WACA,OACA,UACA,QACA,uBACF;;AACQ,QAAA,YAAY,MAAM,QAAQ;AAChC,QAAM,oBAAoB,CAAC,GAAC,WAAM,WAAW,aAAjB,mBAA2B;AACvD,QAAMC,SAAO,MAAM,cAAc,KAAK,CAAC;AAGjC,QAAA,iBAAiB,0BAAiC,KAAK;AAG7D,QAA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AK,IAC3B,OAAO,CAAC,qBAAqB,GAAG,QAAQA,aAAAA,sBAAsB,KAAK,GAAG,mBAAmB,CAAC,GAAG,OAAK,CAAC;AAAA,IAC7G;AAAA,IACA,CAAC,eAAe;AAAA,EACpB;AAEA,SAAO,iBAAiB,iBAAiB;AAC7C;;"}
|
|
1
|
+
{"version":3,"file":"useTableRenderer.cjs","sources":["../../../../../src/primitives/Table/Core/features/useTableRenderer.tsx"],"sourcesContent":["import React, { CSSProperties } from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta, Row as ReactTableRow } from '@tanstack/react-table';\nimport {\n useVirtualizer,\n defaultRangeExtractor,\n ScrollToOptions as ReactVirtualScrollToOptions,\n Range,\n} from '@tanstack/react-virtual';\nimport sortBy from 'lodash/sortBy';\nimport without from 'lodash/without';\n\nimport { ROW_HEIGHT_ESTIMATES } from '../util/rows';\nimport { Row } from '../components/Row/Row';\nimport { useTableRenderers } from '../types';\nimport { TableRef } from '../../types';\nimport { SkeletonRow } from '../components/Row/BuiltIns/SkeletonRow';\n\n// scroll padding end is designed to always show half of the next row\nfunction getScrollPaddingEndOffset<TType = unknown>(table: ReactTable<TType>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n let offset = 2;\n\n if (tableMeta.footer.isEnabled) {\n offset += 1;\n }\n\n if (table.getHeaderGroups().length > 1) {\n offset += table.getHeaderGroups().length - 1;\n }\n\n let height = ROW_HEIGHT_ESTIMATES.medium * offset;\n\n const bottomRows = table.getBottomRows();\n\n if (bottomRows.length) {\n // 1.4 offsets for half rows and also accounts for increased row heights (which is likely in pinned rows)\n height += ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height] * 1.4 * bottomRows.length;\n }\n\n return height;\n}\n\n// scroll padding end is designed to always show half of the next row\nfunction getPaddingEndOffset<TType = unknown>(table: ReactTable<TType>) {\n const bottomRows = table.getBottomRows() ?? [];\n return ROW_HEIGHT_ESTIMATES.medium * 1 * bottomRows.length;\n}\n\n// A higher number ensure less scroll jumping for dynamic row heights, but too high can reduce performance. 8 worked well\nconst OVERSCAN_ROW_COUNT = 8;\n\nexport function useTableRenderer<TType = unknown>(\n renderers: useTableRenderers<TType>,\n table: ReactTable<TType>,\n tableRef: React.RefObject<TableRef>,\n length: number,\n defaultRowActiveIndex?: number | undefined\n) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const isTableRowGrouped = !!table.getState().grouping?.length;\n const rows = table.getCenterRows() ?? [];\n\n // row groups\n const rangeExtractor = useRowGroupVirtualisation<TType>(table);\n\n // account for thead and tfoot in the scroll area - both are always medium row height\n const scrollPaddingStart = ROW_HEIGHT_ESTIMATES.medium;\n\n const count = tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2 ? length : rows.length;\n\n const virtualiser = useVirtualizer({\n count,\n estimateSize: () => {\n return tableMeta.rowHeight.height ? ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height] : ROW_HEIGHT_ESTIMATES.medium;\n },\n getScrollElement: () => tableRef.current,\n overscan: tableMeta.printing.isPrinting ? count : OVERSCAN_ROW_COUNT,\n rangeExtractor,\n // correctly sets the scroll padding offset, e.g. when keyboard navigating rows in the list\n scrollPaddingStart,\n scrollPaddingEnd: getScrollPaddingEndOffset(table),\n paddingEnd: getPaddingEndOffset(table),\n });\n\n const expandedState = table.getState().expanded;\n const previousExpandedStateRef = React.useRef(false);\n\n React.useEffect(() => {\n // only remeasure when transitioning between expand all and not expand all\n const isEmpty = JSON.stringify(expandedState) === '{}';\n\n if (expandedState === true || (isEmpty && previousExpandedStateRef.current === true)) {\n previousExpandedStateRef.current = expandedState === true;\n virtualiser.measure();\n }\n }, [expandedState]);\n\n const totalSize = virtualiser.getTotalSize();\n const virtualItems = virtualiser.getVirtualItems();\n\n const scrollToIndex = React.useCallback(\n (index: number, options: ReactVirtualScrollToOptions = { align: 'auto', behavior: 'smooth' }) => {\n const notSmooth: ReactVirtualScrollToOptions = { ...options, behavior: 'auto' };\n\n if (tableRef.current) {\n if (index === 0) {\n virtualiser.scrollToOffset(0, notSmooth);\n } else if (index === count - 1) {\n // sometimes the last row doesn't fully show, so we just force scroll to the bottom\n tableRef.current.scrollTop = tableRef.current.scrollHeight;\n } else {\n virtualiser.scrollToIndex(index, options);\n }\n }\n },\n [virtualItems.length, tableRef.current, totalSize, count]\n );\n\n // use row 1 not 0, because 0 might be sticky in grouped tables and it's start value will always be 0\n const paddingStartIndex = isTableRowGrouped && count > 1 ? 1 : 0;\n\n const startValue = isTableRowGrouped\n ? (virtualItems[paddingStartIndex]?.start ?? 0) - (virtualItems[paddingStartIndex]?.size ?? 0)\n : virtualItems[paddingStartIndex]?.start;\n\n // styling for offsetting rows - this \"is\" the virtualisation\n const [paddingTop, paddingBottom] =\n virtualItems.length > 0\n ? [Math.max(0, startValue ?? 0), Math.max(0, totalSize - (virtualItems[virtualItems.length - 1]?.end ?? 0))]\n : [0, 0];\n\n // ensure default active rows are scrolled to\n React.useEffect(() => {\n if (defaultRowActiveIndex) {\n scrollToIndex(defaultRowActiveIndex, { align: 'center', behavior: 'auto' });\n }\n }, []);\n\n // rendered output\n let style: CSSProperties = {};\n let content: (JSX.Element | null)[] | null = null;\n\n // bottom rows aren't virtualised (they're sticky) but we need to set the height\n if (count || table.getBottomRows().length) {\n style = {\n height: totalSize,\n paddingBottom: Number.isNaN(paddingBottom) ? 0 : paddingBottom,\n paddingTop: Number.isNaN(paddingTop) ? 0 : paddingTop,\n };\n }\n\n // only render non sticky rows\n if (count) {\n content = virtualItems.map(virtualRow => {\n // there appears to be a react-virtual bug where it inserts a single `undefined` item at the end of the row, which crashes here\n if (!virtualRow) {\n return null;\n }\n\n let row: ReactTableRow<TType> | undefined;\n\n if (tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2) {\n const currentPageIndex =\n (Math.floor(virtualRow.index / tableMeta.server.pageSize) * tableMeta.server.pageSize) /\n tableMeta.server.pageSize;\n const pagePosition = tableMeta.server.pages?.indexOf(currentPageIndex) ?? -1;\n\n if (pagePosition > -1) {\n // \"flatten\" row indexes down into the dataloader2 dataset size\n // for example, with a page size of 100...\n // row index 14267 is actually one of index 67, 167, 267 etc within the dataset (depending on number of pages stored)\n const fakeIndex = pagePosition * tableMeta.server.pageSize + (virtualRow.index % tableMeta.server.pageSize);\n row = rows[fakeIndex];\n }\n } else {\n row = rows[virtualRow.index];\n }\n\n if (!row?.original) {\n // Prefix skeleton keys to prevent collision with real data row keys\n const skeletonKey = `skeleton-${virtualRow.index}`;\n return <SkeletonRow key={skeletonKey} index={virtualRow.index} table={table} />;\n }\n\n const measureRow = (rowHeight: number) => {\n virtualiser.resizeItem(virtualRow.index, rowHeight);\n };\n\n return (\n <Row\n key={row.id}\n row={row}\n index={virtualRow.index}\n table={table}\n measureRow={measureRow}\n renderer={renderers.row}\n cellRenderer={renderers.cell}\n />\n );\n });\n }\n\n return {\n rows: content,\n style,\n scrollToIndex,\n };\n}\n\n// support virtualised row groups (where the row group headers are sticky)\nfunction useRowGroupVirtualisation<TType = unknown>(table: ReactTable<TType>) {\n const rows = table.getRowModel().rows;\n const isTableGrouped = !!table.getState().grouping.length;\n\n const rowGroupIndexes = React.useMemo(() => {\n const indexes: number[] = [];\n\n if (isTableGrouped) {\n rows.forEach((row, index) => {\n if (row.getIsGrouped()) {\n indexes.push(index);\n }\n });\n }\n\n return indexes;\n }, [rows]);\n\n // this is taken from the react-virtual docs/examples\n const rangeExtractor = React.useCallback(\n (range: Range) => {\n const activeRowGroupIndex =\n [...rowGroupIndexes].reverse().find(index => range.startIndex >= index) ?? rowGroupIndexes[0];\n\n return activeRowGroupIndex === undefined\n ? defaultRangeExtractor(range)\n : sortBy([activeRowGroupIndex, ...without(defaultRangeExtractor(range), activeRowGroupIndex)], a => a);\n },\n [rowGroupIndexes]\n );\n\n return isTableGrouped ? rangeExtractor : undefined;\n}\n"],"names":["ROW_HEIGHT_ESTIMATES","rows","useVirtualizer","_a","SkeletonRow","Row","defaultRangeExtractor"],"mappings":";;;;;;;;;AAkBA,SAA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A,UAAU,UAAU;AAAA,UACpB,cAAc,UAAU;AAAA,QAAA;AAAA,MAC5B;AAAA,IAAA,CAEP;AAAA,EAAA;AAGE,SAAA;AAAA,IACH,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACJ;AACJ;AAGA,SAAS,0BAA2C,OAA0B;AACpE,QAAAJ,QAAO,MAAM,YAAA,EAAc;AACjC,QAAM,iBAAiB,CAAC,CAAC,MAAM,WAAW,SAAS;AAE7C,QAAA,kBAAkB,MAAM,QAAQ,MAAM;AACxC,UAAM,UAAoB,CAAC;AAE3B,QAAI,gBAAgB;AACX,MAAAA,MAAA,QAAQ,CAAC,KAAK,UAAU;AACrB,YAAA,IAAI,gBAAgB;AACpB,kBAAQ,KAAK,KAAK;AAAA,QAAA;AAAA,MACtB,CACH;AAAA,IAAA;AAGE,WAAA;AAAA,EAAA,GACR,CAACA,KAAI,CAAC;AAGT,QAAM,iBAAiB,MAAM;AAAA,IACzB,CAAC,UAAiB;AACd,YAAM,sBACF,CAAC,GAAG,eAAe,EAAE,QAAQ,EAAE,KAAK,CAAA,UAAS,MAAM,cAAc,KAAK,KAAK,gBAAgB,CAAC;AAEhG,aAAO,wBAAwB,SACzBK,aAAAA,sBAAsB,KAAK,IAC3B,OAAO,CAAC,qBAAqB,GAAG,QAAQA,aAAAA,sBAAsB,KAAK,GAAG,mBAAmB,CAAC,GAAG,OAAK,CAAC;AAAA,IAC7G;AAAA,IACA,CAAC,eAAe;AAAA,EACpB;AAEA,SAAO,iBAAiB,iBAAiB;AAC7C;;"}
|
|
@@ -112,7 +112,7 @@ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIn
|
|
|
112
112
|
return /* @__PURE__ */ React__default.createElement(SkeletonRow, { key: skeletonKey, index: virtualRow.index, table });
|
|
113
113
|
}
|
|
114
114
|
const measureRow = (rowHeight) => {
|
|
115
|
-
virtualiser.resizeItem(virtualRow, rowHeight);
|
|
115
|
+
virtualiser.resizeItem(virtualRow.index, rowHeight);
|
|
116
116
|
};
|
|
117
117
|
return /* @__PURE__ */ React__default.createElement(
|
|
118
118
|
Row,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTableRenderer.js","sources":["../../../../../src/primitives/Table/Core/features/useTableRenderer.tsx"],"sourcesContent":["import React, { CSSProperties } from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta, Row as ReactTableRow } from '@tanstack/react-table';\nimport {\n useVirtualizer,\n defaultRangeExtractor,\n ScrollToOptions as ReactVirtualScrollToOptions,\n Range,\n} from '@tanstack/react-virtual';\nimport sortBy from 'lodash/sortBy';\nimport without from 'lodash/without';\n\nimport { ROW_HEIGHT_ESTIMATES } from '../util/rows';\nimport { Row } from '../components/Row/Row';\nimport { useTableRenderers } from '../types';\nimport { TableRef } from '../../types';\nimport { SkeletonRow } from '../components/Row/BuiltIns/SkeletonRow';\n\n// scroll padding end is designed to always show half of the next row\nfunction getScrollPaddingEndOffset<TType = unknown>(table: ReactTable<TType>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n let offset = 2;\n\n if (tableMeta.footer.isEnabled) {\n offset += 1;\n }\n\n if (table.getHeaderGroups().length > 1) {\n offset += table.getHeaderGroups().length - 1;\n }\n\n let height = ROW_HEIGHT_ESTIMATES.medium * offset;\n\n const bottomRows = table.getBottomRows();\n\n if (bottomRows.length) {\n // 1.4 offsets for half rows and also accounts for increased row heights (which is likely in pinned rows)\n height += ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height] * 1.4 * bottomRows.length;\n }\n\n return height;\n}\n\n// scroll padding end is designed to always show half of the next row\nfunction getPaddingEndOffset<TType = unknown>(table: ReactTable<TType>) {\n const bottomRows = table.getBottomRows() ?? [];\n return ROW_HEIGHT_ESTIMATES.medium * 1 * bottomRows.length;\n}\n\n// A higher number ensure less scroll jumping for dynamic row heights, but too high can reduce performance. 8 worked well\nconst OVERSCAN_ROW_COUNT = 8;\n\nexport function useTableRenderer<TType = unknown>(\n renderers: useTableRenderers<TType>,\n table: ReactTable<TType>,\n tableRef: React.RefObject<TableRef>,\n length: number,\n defaultRowActiveIndex?: number | undefined\n) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const isTableRowGrouped = !!table.getState().grouping?.length;\n const rows = table.getCenterRows() ?? [];\n\n // row groups\n const rangeExtractor = useRowGroupVirtualisation<TType>(table);\n\n // account for thead and tfoot in the scroll area - both are always medium row height\n const scrollPaddingStart = ROW_HEIGHT_ESTIMATES.medium;\n\n const count = tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2 ? length : rows.length;\n\n const virtualiser = useVirtualizer({\n count,\n estimateSize: () => {\n return tableMeta.rowHeight.height ? ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height] : ROW_HEIGHT_ESTIMATES.medium;\n },\n getScrollElement: () => tableRef.current,\n overscan: tableMeta.printing.isPrinting ? count : OVERSCAN_ROW_COUNT,\n rangeExtractor,\n // correctly sets the scroll padding offset, e.g. when keyboard navigating rows in the list\n scrollPaddingStart,\n scrollPaddingEnd: getScrollPaddingEndOffset(table),\n paddingEnd: getPaddingEndOffset(table),\n });\n\n const expandedState = table.getState().expanded;\n const previousExpandedStateRef = React.useRef(false);\n\n React.useEffect(() => {\n // only remeasure when transitioning between expand all and not expand all\n const isEmpty = JSON.stringify(expandedState) === '{}';\n\n if (expandedState === true || (isEmpty && previousExpandedStateRef.current === true)) {\n previousExpandedStateRef.current = expandedState === true;\n virtualiser.measure();\n }\n }, [expandedState]);\n\n const totalSize = virtualiser.getTotalSize();\n const virtualItems = virtualiser.getVirtualItems();\n\n const scrollToIndex = React.useCallback(\n (index: number, options: ReactVirtualScrollToOptions = { align: 'auto', behavior: 'smooth' }) => {\n const notSmooth: ReactVirtualScrollToOptions = { ...options, behavior: 'auto' };\n\n if (tableRef.current) {\n if (index === 0) {\n virtualiser.scrollToOffset(0, notSmooth);\n } else if (index === count - 1) {\n // sometimes the last row doesn't fully show, so we just force scroll to the bottom\n tableRef.current.scrollTop = tableRef.current.scrollHeight;\n } else {\n virtualiser.scrollToIndex(index, options);\n }\n }\n },\n [virtualItems.length, tableRef.current, totalSize, count]\n );\n\n // use row 1 not 0, because 0 might be sticky in grouped tables and it's start value will always be 0\n const paddingStartIndex = isTableRowGrouped && count > 1 ? 1 : 0;\n\n const startValue = isTableRowGrouped\n ? (virtualItems[paddingStartIndex]?.start ?? 0) - (virtualItems[paddingStartIndex]?.size ?? 0)\n : virtualItems[paddingStartIndex]?.start;\n\n // styling for offsetting rows - this \"is\" the virtualisation\n const [paddingTop, paddingBottom] =\n virtualItems.length > 0\n ? [Math.max(0, startValue ?? 0), Math.max(0, totalSize - (virtualItems[virtualItems.length - 1]?.end ?? 0))]\n : [0, 0];\n\n // ensure default active rows are scrolled to\n React.useEffect(() => {\n if (defaultRowActiveIndex) {\n scrollToIndex(defaultRowActiveIndex, { align: 'center', behavior: 'auto' });\n }\n }, []);\n\n // rendered output\n let style: CSSProperties = {};\n let content: (JSX.Element | null)[] | null = null;\n\n // bottom rows aren't virtualised (they're sticky) but we need to set the height\n if (count || table.getBottomRows().length) {\n style = {\n height: totalSize,\n paddingBottom: Number.isNaN(paddingBottom) ? 0 : paddingBottom,\n paddingTop: Number.isNaN(paddingTop) ? 0 : paddingTop,\n };\n }\n\n // only render non sticky rows\n if (count) {\n content = virtualItems.map(virtualRow => {\n // there appears to be a react-virtual bug where it inserts a single `undefined` item at the end of the row, which crashes here\n if (!virtualRow) {\n return null;\n }\n\n let row: ReactTableRow<TType> | undefined;\n\n if (tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2) {\n const currentPageIndex =\n (Math.floor(virtualRow.index / tableMeta.server.pageSize) * tableMeta.server.pageSize) /\n tableMeta.server.pageSize;\n const pagePosition = tableMeta.server.pages?.indexOf(currentPageIndex) ?? -1;\n\n if (pagePosition > -1) {\n // \"flatten\" row indexes down into the dataloader2 dataset size\n // for example, with a page size of 100...\n // row index 14267 is actually one of index 67, 167, 267 etc within the dataset (depending on number of pages stored)\n const fakeIndex = pagePosition * tableMeta.server.pageSize + (virtualRow.index % tableMeta.server.pageSize);\n row = rows[fakeIndex];\n }\n } else {\n row = rows[virtualRow.index];\n }\n\n if (!row?.original) {\n // Prefix skeleton keys to prevent collision with real data row keys\n const skeletonKey = `skeleton-${virtualRow.index}`;\n return <SkeletonRow key={skeletonKey} index={virtualRow.index} table={table} />;\n }\n\n const measureRow = (rowHeight: number) => {\n virtualiser.resizeItem(virtualRow, rowHeight);\n };\n\n return (\n <Row\n key={row.id}\n row={row}\n index={virtualRow.index}\n table={table}\n measureRow={measureRow}\n renderer={renderers.row}\n cellRenderer={renderers.cell}\n />\n );\n });\n }\n\n return {\n rows: content,\n style,\n scrollToIndex,\n };\n}\n\n// support virtualised row groups (where the row group headers are sticky)\nfunction useRowGroupVirtualisation<TType = unknown>(table: ReactTable<TType>) {\n const rows = table.getRowModel().rows;\n const isTableGrouped = !!table.getState().grouping.length;\n\n const rowGroupIndexes = React.useMemo(() => {\n const indexes: number[] = [];\n\n if (isTableGrouped) {\n rows.forEach((row, index) => {\n if (row.getIsGrouped()) {\n indexes.push(index);\n }\n });\n }\n\n return indexes;\n }, [rows]);\n\n // this is taken from the react-virtual docs/examples\n const rangeExtractor = React.useCallback(\n (range: Range) => {\n const activeRowGroupIndex =\n [...rowGroupIndexes].reverse().find(index => range.startIndex >= index) ?? rowGroupIndexes[0];\n\n return activeRowGroupIndex === undefined\n ? defaultRangeExtractor(range)\n : sortBy([activeRowGroupIndex, ...without(defaultRangeExtractor(range), activeRowGroupIndex)], a => a);\n },\n [rowGroupIndexes]\n );\n\n return isTableGrouped ? rangeExtractor : undefined;\n}\n"],"names":["React","_a"],"mappings":";;;;;;;AAkBA,SAAS,0BAA2C,OAA0B;AACpE,QAAA,YAAY,MAAM,QAAQ;AAChC,MAAI,SAAS;AAET,MAAA,UAAU,OAAO,WAAW;AAClB,cAAA;AAAA,EAAA;AAGd,MAAI,MAAM,kBAAkB,SAAS,GAAG;AAC1B,cAAA,MAAM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c;AACjC,QAAM,iBAAiB,CAAC,CAAC,MAAM,WAAW,SAAS;AAE7C,QAAA,kBAAkBA,eAAM,QAAQ,MAAM;AACxC,UAAM,UAAoB,CAAC;AAE3B,QAAI,gBAAgB;AACX,WAAA,QAAQ,CAAC,KAAK,UAAU;AACrB,YAAA,IAAI,gBAAgB;AACpB,kBAAQ,KAAK,KAAK;AAAA,QAAA;AAAA,MACtB,CACH;AAAA,IAAA;AAGE,WAAA;AAAA,EAAA,GACR,CAAC,IAAI,CAAC;AAGT,QAAM,iBAAiBA,eAAM;AAAA,IACzB,CAAC,UAAiB;AACd,YAAM,sBACF,CAAC,GAAG,eAAe,EAAE,QAAQ,EAAE,KAAK,CAAA,UAAS,MAAM,cAAc,KAAK,KAAK,gBAAgB,CAAC;AAEhG,aAAO,wBAAwB,SACzB,sBAAsB,KAAK,IAC3B,OAAO,CAAC,qBAAqB,GAAG,QAAQ,sBAAsB,KAAK,GAAG,mBAAmB,CAAC,GAAG,OAAK,CAAC;AAAA,IAC7G;AAAA,IACA,CAAC,eAAe;AAAA,EACpB;AAEA,SAAO,iBAAiB,iBAAiB;AAC7C;"}
|
|
1
|
+
{"version":3,"file":"useTableRenderer.js","sources":["../../../../../src/primitives/Table/Core/features/useTableRenderer.tsx"],"sourcesContent":["import React, { CSSProperties } from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta, Row as ReactTableRow } from '@tanstack/react-table';\nimport {\n useVirtualizer,\n defaultRangeExtractor,\n ScrollToOptions as ReactVirtualScrollToOptions,\n Range,\n} from '@tanstack/react-virtual';\nimport sortBy from 'lodash/sortBy';\nimport without from 'lodash/without';\n\nimport { ROW_HEIGHT_ESTIMATES } from '../util/rows';\nimport { Row } from '../components/Row/Row';\nimport { useTableRenderers } from '../types';\nimport { TableRef } from '../../types';\nimport { SkeletonRow } from '../components/Row/BuiltIns/SkeletonRow';\n\n// scroll padding end is designed to always show half of the next row\nfunction getScrollPaddingEndOffset<TType = unknown>(table: ReactTable<TType>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n let offset = 2;\n\n if (tableMeta.footer.isEnabled) {\n offset += 1;\n }\n\n if (table.getHeaderGroups().length > 1) {\n offset += table.getHeaderGroups().length - 1;\n }\n\n let height = ROW_HEIGHT_ESTIMATES.medium * offset;\n\n const bottomRows = table.getBottomRows();\n\n if (bottomRows.length) {\n // 1.4 offsets for half rows and also accounts for increased row heights (which is likely in pinned rows)\n height += ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height] * 1.4 * bottomRows.length;\n }\n\n return height;\n}\n\n// scroll padding end is designed to always show half of the next row\nfunction getPaddingEndOffset<TType = unknown>(table: ReactTable<TType>) {\n const bottomRows = table.getBottomRows() ?? [];\n return ROW_HEIGHT_ESTIMATES.medium * 1 * bottomRows.length;\n}\n\n// A higher number ensure less scroll jumping for dynamic row heights, but too high can reduce performance. 8 worked well\nconst OVERSCAN_ROW_COUNT = 8;\n\nexport function useTableRenderer<TType = unknown>(\n renderers: useTableRenderers<TType>,\n table: ReactTable<TType>,\n tableRef: React.RefObject<TableRef>,\n length: number,\n defaultRowActiveIndex?: number | undefined\n) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const isTableRowGrouped = !!table.getState().grouping?.length;\n const rows = table.getCenterRows() ?? [];\n\n // row groups\n const rangeExtractor = useRowGroupVirtualisation<TType>(table);\n\n // account for thead and tfoot in the scroll area - both are always medium row height\n const scrollPaddingStart = ROW_HEIGHT_ESTIMATES.medium;\n\n const count = tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2 ? length : rows.length;\n\n const virtualiser = useVirtualizer({\n count,\n estimateSize: () => {\n return tableMeta.rowHeight.height ? ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height] : ROW_HEIGHT_ESTIMATES.medium;\n },\n getScrollElement: () => tableRef.current,\n overscan: tableMeta.printing.isPrinting ? count : OVERSCAN_ROW_COUNT,\n rangeExtractor,\n // correctly sets the scroll padding offset, e.g. when keyboard navigating rows in the list\n scrollPaddingStart,\n scrollPaddingEnd: getScrollPaddingEndOffset(table),\n paddingEnd: getPaddingEndOffset(table),\n });\n\n const expandedState = table.getState().expanded;\n const previousExpandedStateRef = React.useRef(false);\n\n React.useEffect(() => {\n // only remeasure when transitioning between expand all and not expand all\n const isEmpty = JSON.stringify(expandedState) === '{}';\n\n if (expandedState === true || (isEmpty && previousExpandedStateRef.current === true)) {\n previousExpandedStateRef.current = expandedState === true;\n virtualiser.measure();\n }\n }, [expandedState]);\n\n const totalSize = virtualiser.getTotalSize();\n const virtualItems = virtualiser.getVirtualItems();\n\n const scrollToIndex = React.useCallback(\n (index: number, options: ReactVirtualScrollToOptions = { align: 'auto', behavior: 'smooth' }) => {\n const notSmooth: ReactVirtualScrollToOptions = { ...options, behavior: 'auto' };\n\n if (tableRef.current) {\n if (index === 0) {\n virtualiser.scrollToOffset(0, notSmooth);\n } else if (index === count - 1) {\n // sometimes the last row doesn't fully show, so we just force scroll to the bottom\n tableRef.current.scrollTop = tableRef.current.scrollHeight;\n } else {\n virtualiser.scrollToIndex(index, options);\n }\n }\n },\n [virtualItems.length, tableRef.current, totalSize, count]\n );\n\n // use row 1 not 0, because 0 might be sticky in grouped tables and it's start value will always be 0\n const paddingStartIndex = isTableRowGrouped && count > 1 ? 1 : 0;\n\n const startValue = isTableRowGrouped\n ? (virtualItems[paddingStartIndex]?.start ?? 0) - (virtualItems[paddingStartIndex]?.size ?? 0)\n : virtualItems[paddingStartIndex]?.start;\n\n // styling for offsetting rows - this \"is\" the virtualisation\n const [paddingTop, paddingBottom] =\n virtualItems.length > 0\n ? [Math.max(0, startValue ?? 0), Math.max(0, totalSize - (virtualItems[virtualItems.length - 1]?.end ?? 0))]\n : [0, 0];\n\n // ensure default active rows are scrolled to\n React.useEffect(() => {\n if (defaultRowActiveIndex) {\n scrollToIndex(defaultRowActiveIndex, { align: 'center', behavior: 'auto' });\n }\n }, []);\n\n // rendered output\n let style: CSSProperties = {};\n let content: (JSX.Element | null)[] | null = null;\n\n // bottom rows aren't virtualised (they're sticky) but we need to set the height\n if (count || table.getBottomRows().length) {\n style = {\n height: totalSize,\n paddingBottom: Number.isNaN(paddingBottom) ? 0 : paddingBottom,\n paddingTop: Number.isNaN(paddingTop) ? 0 : paddingTop,\n };\n }\n\n // only render non sticky rows\n if (count) {\n content = virtualItems.map(virtualRow => {\n // there appears to be a react-virtual bug where it inserts a single `undefined` item at the end of the row, which crashes here\n if (!virtualRow) {\n return null;\n }\n\n let row: ReactTableRow<TType> | undefined;\n\n if (tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2) {\n const currentPageIndex =\n (Math.floor(virtualRow.index / tableMeta.server.pageSize) * tableMeta.server.pageSize) /\n tableMeta.server.pageSize;\n const pagePosition = tableMeta.server.pages?.indexOf(currentPageIndex) ?? -1;\n\n if (pagePosition > -1) {\n // \"flatten\" row indexes down into the dataloader2 dataset size\n // for example, with a page size of 100...\n // row index 14267 is actually one of index 67, 167, 267 etc within the dataset (depending on number of pages stored)\n const fakeIndex = pagePosition * tableMeta.server.pageSize + (virtualRow.index % tableMeta.server.pageSize);\n row = rows[fakeIndex];\n }\n } else {\n row = rows[virtualRow.index];\n }\n\n if (!row?.original) {\n // Prefix skeleton keys to prevent collision with real data row keys\n const skeletonKey = `skeleton-${virtualRow.index}`;\n return <SkeletonRow key={skeletonKey} index={virtualRow.index} table={table} />;\n }\n\n const measureRow = (rowHeight: number) => {\n virtualiser.resizeItem(virtualRow.index, rowHeight);\n };\n\n return (\n <Row\n key={row.id}\n row={row}\n index={virtualRow.index}\n table={table}\n measureRow={measureRow}\n renderer={renderers.row}\n cellRenderer={renderers.cell}\n />\n );\n });\n }\n\n return {\n rows: content,\n style,\n scrollToIndex,\n };\n}\n\n// support virtualised row groups (where the row group headers are sticky)\nfunction useRowGroupVirtualisation<TType = unknown>(table: ReactTable<TType>) {\n const rows = table.getRowModel().rows;\n const isTableGrouped = !!table.getState().grouping.length;\n\n const rowGroupIndexes = React.useMemo(() => {\n const indexes: number[] = [];\n\n if (isTableGrouped) {\n rows.forEach((row, index) => {\n if (row.getIsGrouped()) {\n indexes.push(index);\n }\n });\n }\n\n return indexes;\n }, [rows]);\n\n // this is taken from the react-virtual docs/examples\n const rangeExtractor = React.useCallback(\n (range: Range) => {\n const activeRowGroupIndex =\n [...rowGroupIndexes].reverse().find(index => range.startIndex >= index) ?? rowGroupIndexes[0];\n\n return activeRowGroupIndex === undefined\n ? defaultRangeExtractor(range)\n : sortBy([activeRowGroupIndex, ...without(defaultRangeExtractor(range), activeRowGroupIndex)], a => a);\n },\n [rowGroupIndexes]\n );\n\n return isTableGrouped ? rangeExtractor : undefined;\n}\n"],"names":["React","_a"],"mappings":";;;;;;;AAkBA,SAAS,0BAA2C,OAA0B;AACpE,QAAA,YAAY,MAAM,QAAQ;AAChC,MAAI,SAAS;AAET,MAAA,UAAU,OAAO,WAAW;AAClB,cAAA;AAAA,EAAA;AAGd,MAAI,MAAM,kBAAkB,SAAS,GAAG;AAC1B,cAAA,MAAM,gBAAgB,EAAE,SAAS;AAAA,EAAA;AAG3C,MAAA,SAAS,qBAAqB,SAAS;AAErC,QAAA,aAAa,MAAM,cAAc;AAEvC,MAAI,WAAW,QAAQ;AAEnB,cAAU,qBAAqB,UAAU,UAAU,MAAM,IAAI,MAAM,WAAW;AAAA,EAAA;AAG3E,SAAA;AACX;AAGA,SAAS,oBAAqC,OAA0B;AACpE,QAAM,aAAa,MAAM,cAAc,KAAK,CAAC;AACtC,SAAA,qBAAqB,SAAS,IAAI,WAAW;AACxD;AAGA,MAAM,qBAAqB;AAEpB,SAAS,iBACZ,WACA,OACA,UACA,QACA,uBACF;;AACQ,QAAA,YAAY,MAAM,QAAQ;AAChC,QAAM,oBAAoB,CAAC,GAAC,WAAM,WAAW,aAAjB,mBAA2B;AACvD,QAAM,OAAO,MAAM,cAAc,KAAK,CAAC;AAGjC,QAAA,iBAAiB,0BAAiC,KAAK;AAG7D,QAAM,qBAAqB,qBAAqB;AAE1C,QAAA,Q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AAG,OAAK,CAAC;AAAA,IAC7G;AAAA,IACA,CAAC,eAAe;AAAA,EACpB;AAEA,SAAO,iBAAiB,iBAAiB;AAC7C;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@economic/taco",
|
|
3
|
-
"version": "8.1.0
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"@dnd-kit/modifiers": "^7.0.0",
|
|
44
44
|
"@dnd-kit/sortable": "^7.0.2",
|
|
45
45
|
"@dnd-kit/utilities": "^3.2.2",
|
|
46
|
-
"@economic/taco-tokens": "^2.2.4
|
|
46
|
+
"@economic/taco-tokens": "^2.2.4",
|
|
47
47
|
"@radix-ui/react-popover": "1.0.2",
|
|
48
48
|
"@radix-ui/react-scroll-area": "1.2.10",
|
|
49
49
|
"@react-aria/focus": "^3.19.0",
|
|
50
50
|
"@react-aria/interactions": "^3.12.0",
|
|
51
51
|
"@tanstack/react-table": "^8.21.3",
|
|
52
|
-
"@tanstack/react-virtual": "3.
|
|
52
|
+
"@tanstack/react-virtual": "3.13.23",
|
|
53
53
|
"clsx": "^2.1.1",
|
|
54
54
|
"date-fns": "^3.6.0",
|
|
55
55
|
"framer-motion": "12.38.0",
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
"optionalDependencies": {
|
|
100
100
|
"@rollup/rollup-linux-x64-gnu": "^4.60.4"
|
|
101
101
|
},
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "5d7f026827fc0f2ce4b41d7ac92c25e0aed8473b"
|
|
103
103
|
}
|