playbook_ui 14.21.2.pre.alpha.PLAY22558410 → 14.21.2

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.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +2 -5
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +4 -20
  4. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +5 -25
  5. data/app/pb_kits/playbook/pb_advanced_table/Components/VirtualizedTableView.tsx +16 -36
  6. data/app/pb_kits/playbook/pb_advanced_table/Context/AdvancedTableContext.tsx +5 -18
  7. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +17 -37
  8. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +5 -30
  9. data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +0 -3
  10. data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +40 -91
  11. data/app/pb_kits/playbook/pb_advanced_table/Utilities/CellRendererUtils.tsx +1 -4
  12. data/app/pb_kits/playbook/pb_advanced_table/Utilities/TableContainerStyles.ts +2 -3
  13. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +4 -49
  14. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +18 -36
  15. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +2 -105
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +1 -1
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb +1 -1
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color_rails.html.erb +1 -1
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.html.erb +1 -1
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows.jsx +1 -1
  21. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_react.md +3 -5
  22. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.jsx +2 -2
  23. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.html.erb +2 -3
  24. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.html.erb +1 -1
  25. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -6
  26. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -4
  27. data/app/pb_kits/playbook/pb_advanced_table/flat_advanced_table.js +84 -60
  28. data/app/pb_kits/playbook/pb_advanced_table/index.js +213 -125
  29. data/app/pb_kits/playbook/pb_advanced_table/table_action_bar.html.erb +1 -1
  30. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +1 -1
  31. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +0 -5
  32. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +2 -2
  33. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +0 -33
  34. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection.html.erb +3 -3
  35. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection.jsx +4 -7
  36. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_clear_selection.jsx +3 -6
  37. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.jsx +3 -6
  38. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.html.erb +3 -3
  39. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_value.html.erb +3 -3
  40. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_value.jsx +4 -7
  41. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.html.erb +3 -3
  42. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.jsx +4 -7
  43. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select.jsx +10 -19
  44. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display.jsx +10 -19
  45. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display_rails.html.erb +10 -10
  46. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_rails.html.erb +10 -10
  47. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.html.erb +10 -10
  48. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.jsx +11 -20
  49. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.html.erb +3 -3
  50. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.jsx +8 -8
  51. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.html.erb +10 -10
  52. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.jsx +14 -23
  53. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.html.erb +3 -3
  54. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.jsx +3 -6
  55. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.jsx +3 -6
  56. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure_rails.html.erb +3 -3
  57. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.html.erb +3 -3
  58. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.jsx +3 -6
  59. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.html.erb +3 -3
  60. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +3 -3
  61. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_with_subcomponents.html.erb +4 -4
  62. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_with_subcomponents.jsx +4 -4
  63. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +4 -4
  64. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +4 -4
  65. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx +3 -3
  66. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options_rails.html.erb +3 -3
  67. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.html.erb +3 -3
  68. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.jsx +3 -3
  69. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.jsx +3 -3
  70. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger_rails.html.erb +3 -3
  71. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx +3 -3
  72. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.html.erb +3 -3
  73. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.jsx +3 -6
  74. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_search.jsx +3 -3
  75. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_search_rails.html.erb +3 -3
  76. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +0 -4
  77. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +1 -3
  78. data/app/pb_kits/playbook/pb_filter/Filter/index.tsx +0 -13
  79. data/app/pb_kits/playbook/pb_filter/_filter.scss +0 -4
  80. data/app/pb_kits/playbook/pb_filter/docs/example.yml +0 -1
  81. data/app/pb_kits/playbook/pb_filter/docs/index.js +0 -1
  82. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns.html.erb +8 -8
  83. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns_rails.md +1 -1
  84. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.html.erb +12 -12
  85. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_rails.md +2 -2
  86. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns.html.erb +12 -12
  87. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns_rails.md +2 -2
  88. data/app/pb_kits/playbook/pb_table/index.ts +4 -4
  89. data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +0 -4
  90. data/dist/chunks/_typeahead-BlPRej0F.js +22 -0
  91. data/dist/chunks/_weekday_stacked-CzxoxxCR.js +45 -0
  92. data/dist/chunks/lazysizes-DHz07jlL.js +1 -0
  93. data/dist/chunks/lib-D4vXIZF5.js +29 -0
  94. data/dist/chunks/{pb_form_validation-BVF3TmcL.js → pb_form_validation-DyvJ8iPe.js} +1 -1
  95. data/dist/chunks/vendor.js +1 -1
  96. data/dist/playbook-doc.js +3 -3
  97. data/dist/playbook-rails-react-bindings.js +1 -1
  98. data/dist/playbook-rails.js +1 -1
  99. data/dist/playbook.css +1 -1
  100. data/lib/playbook/version.rb +2 -2
  101. metadata +7 -31
  102. data/app/pb_kits/playbook/pb_advanced_table/Utilities/ColumnStylingHelper.ts +0 -15
  103. data/app/pb_kits/playbook/pb_advanced_table/advanced_table_action_bar.js +0 -36
  104. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.jsx +0 -51
  105. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.md +0 -7
  106. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers.jsx +0 -77
  107. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers.md +0 -1
  108. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers_rails.html.erb +0 -63
  109. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers_rails.md +0 -1
  110. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.html.erb +0 -38
  111. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.md +0 -7
  112. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_infinite_scroll.md +0 -3
  113. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.jsx +0 -64
  114. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.md +0 -7
  115. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_icon_options.html.erb +0 -52
  116. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_icon_options.jsx +0 -99
  117. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_icon_options_rails.md +0 -1
  118. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_icon_options_react.md +0 -1
  119. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options.html.erb +0 -28
  120. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options.jsx +0 -47
  121. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options_rails.md +0 -1
  122. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options_react.md +0 -1
  123. data/app/pb_kits/playbook/pb_filter/Filter/FilterSection.tsx +0 -49
  124. data/app/pb_kits/playbook/pb_filter/Filter/FilterSidebar.tsx +0 -69
  125. data/app/pb_kits/playbook/pb_filter/docs/_filter_sidebar.jsx +0 -224
  126. data/dist/chunks/_typeahead-B80UsDrG.js +0 -22
  127. data/dist/chunks/_weekday_stacked-D1bqIne1.js +0 -45
  128. data/dist/chunks/lazysizes-B7xYodB-.js +0 -1
  129. data/dist/chunks/lib-CTkMyvfQ.js +0 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e74ebcaf8b226f04a617fc63083c59c61951a3f792409c906b7556ef4976f6c0
4
- data.tar.gz: 755270c0eee4c986ca9d0534ffd31bec09383994a038ab4a6da7e43740537e10
3
+ metadata.gz: c56ad47c1f53eb40bac67e374299659f3ad5cdcd2cb61f4cb674830b10eb8bbc
4
+ data.tar.gz: 9dfb9ddd7c1d200d680757e083b9ce21bacc896c9ff5b14a8a7ba2490fc9c45d
5
5
  SHA512:
6
- metadata.gz: f7329823f5e763a4aa9712a78d7467fde07db90542cb2d6416ade72983d3984651f03fb3bb847f92582293623569a9c24a8756b051eec84a524b525a2164b9ce
7
- data.tar.gz: 5fab13b2c33b5ee332beb81aed83254723ed0808a7d0b85cc68acadde24d79f8cdf773c7b97e73025e1a6ed00e118304533fab5581ce7bcfd46db7c7b98a843d
6
+ metadata.gz: f79b70fd74d0721049b8cde8a212f8f0df9030ac5506c4e2600269eb6cc9e8564e9159ee8874decc50bfbadd3fdfc5542381d9e54195d48fed0a9d6c7208b59d
7
+ data.tar.gz: 7a08df80bcc0f05516c60ebdc42e44a2a098a49d45bdd9d5e5ab9f3e7dd0f5936a2878761a17b14dc62c234ac37ad66bcb9c5e7704378717d4338fe8c9d67f86
@@ -19,7 +19,6 @@ interface CustomCellProps {
19
19
  value?: string
20
20
  customRenderer?: (row: Row<GenericObject>, value: string | undefined) => React.ReactNode
21
21
  selectableRows?: boolean
22
- customStyle?: GenericObject
23
22
  }
24
23
 
25
24
  export const CustomCell = ({
@@ -29,7 +28,6 @@ export const CustomCell = ({
29
28
  value,
30
29
  customRenderer,
31
30
  selectableRows,
32
- customStyle = {},
33
31
  }: CustomCellProps & GlobalProps) => {
34
32
  const { setExpanded, expanded, expandedControl, inlineRowLoading, hasAnySubRows } = useContext(AdvancedTableContext);
35
33
 
@@ -45,11 +43,11 @@ export const CustomCell = ({
45
43
  const renderButton = inlineRowLoading ? RowHasChildren : row.getCanExpand()
46
44
 
47
45
  return (
48
- <div style={{ paddingLeft: `${row.depth * 1.25}em`}}>
46
+ <div style={{ paddingLeft: `${row.depth * 1.25}em` }}>
49
47
  <Flex
50
48
  alignItems="center"
51
49
  columnGap="xs"
52
- justify="start"
50
+ justify={"start"}
53
51
  orientation="row"
54
52
  >
55
53
  {
@@ -67,7 +65,6 @@ export const CustomCell = ({
67
65
  <button
68
66
  className="gray-icon expand-toggle-icon"
69
67
  onClick={() => handleOnExpand(row)}
70
- style={{ color: customStyle?.expandButtonColor }}
71
68
  >
72
69
  {row.getIsExpanded() ? (
73
70
  <Icon cursor="pointer"
@@ -4,7 +4,6 @@ import { flexRender, Row, Cell } from "@tanstack/react-table"
4
4
 
5
5
  import { GenericObject } from "../../types"
6
6
  import { isChrome } from "../Utilities/BrowserCheck"
7
- import { findColumnDefByAccessor } from "../Utilities/ColumnStylingHelper"
8
7
 
9
8
  import LoadingInline from "../../pb_loading_inline/_loading_inline"
10
9
  import Checkbox from "../../pb_checkbox/_checkbox"
@@ -26,17 +25,13 @@ const TableCellRenderer = ({
26
25
  collapsibleTrail = true,
27
26
  loading = false,
28
27
  stickyLeftColumn,
29
- columnPinning,
30
- customRowStyle,
31
- columnDefinitions,
28
+ columnPinning
32
29
  }: {
33
30
  row: Row<GenericObject>
34
31
  collapsibleTrail?: boolean
35
32
  loading?: boolean | string
36
33
  stickyLeftColumn?: string[]
37
34
  columnPinning: { left: string[] }
38
- customRowStyle?: GenericObject
39
- columnDefinitions?: {[key:string]:any}[]
40
35
  }) => {
41
36
  return (
42
37
  <>
@@ -54,14 +49,10 @@ const TableCellRenderer = ({
54
49
  })();
55
50
 
56
51
  const { column } = cell;
57
-
58
- // Find the “owning” colDefinition by accessor. Needed for multi column logic
59
- const colDef = findColumnDefByAccessor(columnDefinitions ?? [], column.id)
60
- const cellAlignment = colDef?.columnStyling?.cellAlignment ?? "right"
61
-
52
+
62
53
  return (
63
54
  <td
64
- align={cellAlignment}
55
+ align="right"
65
56
  className={classnames(
66
57
  `${cell.id}-cell position_relative`,
67
58
  isChrome() ? "chrome-styles" : "",
@@ -76,8 +67,6 @@ const TableCellRenderer = ({
76
67
  ? '180px'
77
68
  : `${column.getStart("left")}px`
78
69
  : undefined,
79
- backgroundColor: i === 0 && customRowStyle?.backgroundColor,
80
- color: customRowStyle?.fontColor,
81
70
  }}
82
71
  >
83
72
  {collapsibleTrail && i === 0 && row.depth > 0 && renderCollapsibleTrail(row.depth)}
@@ -111,7 +100,6 @@ export const RegularTableView = ({
111
100
  pinnedRows,
112
101
  headerHeight,
113
102
  rowHeight,
114
- rowStyling = [],
115
103
  sampleRowRef,
116
104
  } = useContext(AdvancedTableContext)
117
105
 
@@ -129,6 +117,7 @@ export const RegularTableView = ({
129
117
 
130
118
  const columnPinning = table.getState().columnPinning || { left: [] };
131
119
  const columnDefinitions = table.options.meta?.columnDefinitions || [];
120
+
132
121
  // Row pinning
133
122
  function PinnedRow({ row }: { row: Row<any> }) {
134
123
  return (
@@ -148,7 +137,6 @@ export const RegularTableView = ({
148
137
  >
149
138
  <TableCellRenderer
150
139
  collapsibleTrail={collapsibleTrail}
151
- columnDefinitions={columnDefinitions}
152
140
  columnPinning={columnPinning}
153
141
  loading={loading}
154
142
  row={row}
@@ -176,7 +164,6 @@ export const RegularTableView = ({
176
164
  const rowBackground = isExpandable && ((!inlineRowLoading && row.getCanExpand()) || (inlineRowLoading && rowHasNoChildren));
177
165
  const rowColor = row.getIsSelected() ? "bg-row-selection" : rowBackground ? "bg-silver" : "bg-white";
178
166
  const isFirstRegularRow = rowIndex === 0 && !row.getIsPinned();
179
- const customRowStyle = rowStyling?.length > 0 && rowStyling?.find((s: GenericObject) => s?.rowId === row.id);
180
167
 
181
168
  return (
182
169
  <React.Fragment key={`${row.index}-${row.id}-${row.depth}-row`}>
@@ -195,7 +182,6 @@ export const RegularTableView = ({
195
182
  className={`${rowColor} ${row.depth > 0 ? `depth-sub-row-${row.depth}` : ""}`}
196
183
  id={`${row.index}-${row.id}-${row.depth}-row`}
197
184
  ref={isFirstRegularRow ? sampleRowRef : null}
198
- style={{backgroundColor: customRowStyle?.backgroundColor, color: customRowStyle?.fontColor}}
199
185
  >
200
186
  {/* Render custom checkbox column when we want selectableRows for non-expanding tables */}
201
187
  {selectableRows && !hasAnySubRows && (
@@ -211,9 +197,7 @@ export const RegularTableView = ({
211
197
  )}
212
198
  <TableCellRenderer
213
199
  collapsibleTrail={collapsibleTrail}
214
- columnDefinitions={columnDefinitions}
215
200
  columnPinning={columnPinning}
216
- customRowStyle={customRowStyle}
217
201
  loading={loading}
218
202
  row={row}
219
203
  stickyLeftColumn={stickyLeftColumn}
@@ -15,7 +15,6 @@ import Icon from "../../pb_icon/_icon"
15
15
  import { SortIconButton } from "./SortIconButton"
16
16
  import { ToggleIconButton } from "./ToggleIconButton"
17
17
  import { displayIcon } from "../Utilities/IconHelpers"
18
- import { findColumnDefByAccessor } from "../Utilities/ColumnStylingHelper"
19
18
  import { updateExpandAndCollapseState } from "../Utilities/ExpansionControlHelpers"
20
19
 
21
20
  import { isChrome } from "../Utilities/BrowserCheck"
@@ -46,7 +45,6 @@ export const TableHeaderCell = ({
46
45
  table
47
46
  }: TableHeaderCellProps) => {
48
47
  const {
49
- columnDefinitions,
50
48
  expanded,
51
49
  setExpanded,
52
50
  expandByDepth,
@@ -74,18 +72,6 @@ export const TableHeaderCell = ({
74
72
  header?.column.getToggleSortingHandler()(event)
75
73
  }
76
74
  }
77
- const alignmentMap: Record<string, "start" | "center" | "end"> = {
78
- left: "start",
79
- center: "center",
80
- right: "end",
81
- };
82
-
83
- // Look up the “owning” columnDefinition by accessor. Needed for multi column logic
84
- const colDef = header
85
- ? findColumnDefByAccessor(columnDefinitions, header.column.id)
86
- : undefined
87
-
88
- const headerAlignment = colDef?.columnStyling?.headerAlignment ?? colDef?.columnStyling?.headerAligment
89
75
 
90
76
  const isLeafColumn =
91
77
  header?.column.getLeafColumns().length === 1 &&
@@ -140,15 +126,9 @@ const isToggleExpansionEnabled =
140
126
  (enableToggleExpansion === "all" || "header") &&
141
127
  enableToggleExpansion !== "none"
142
128
 
143
- let justifyHeader: justifyTypes;
129
+ let justifyHeader:justifyTypes;
144
130
 
145
- if (headerAlignment && alignmentMap[headerAlignment]) {
146
- justifyHeader = alignmentMap[headerAlignment];
147
- } else if (
148
- (header?.index === 0 && hasAnySubRows) ||
149
- (header?.index === 0 && inlineRowLoading) ||
150
- (header?.index === 0 && isToggleExpansionEnabled)
151
- ) {
131
+ if (header?.index === 0 && hasAnySubRows || (header?.index === 0 && inlineRowLoading) || (header?.index === 0 && isToggleExpansionEnabled)) {
152
132
  justifyHeader = enableSorting ? "between" : "start";
153
133
  } else {
154
134
  justifyHeader = isLeafColumn ? "end" : "center";
@@ -185,7 +165,7 @@ const isToggleExpansionEnabled =
185
165
 
186
166
  return (
187
167
  <th
188
- align={headerAlignment ? headerAlignment : "right"}
168
+ align="right"
189
169
  className={cellClassName}
190
170
  colSpan={header?.colSpan}
191
171
  id={cellId}
@@ -273,8 +253,8 @@ const isToggleExpansionEnabled =
273
253
  tabIndex: 0,
274
254
  },
275
255
  })}
276
- justify={header?.index === 0 && enableSorting ? "between" : headerAlignment ? alignmentMap[headerAlignment] : "none"}
277
- paddingLeft={header?.index === 0 ? enableSorting ? "xxs" : "xs" : "none"}
256
+ justify={header?.index === 0 && enableSorting ? "between" : "none"}
257
+ paddingLeft={enableSorting ? "xxs" : "xs"}
278
258
  >
279
259
  <div>
280
260
  {flexRender(header?.column.columnDef.header, header?.getContext())}
@@ -1,6 +1,6 @@
1
- import React, { useContext, useLayoutEffect, useState, useEffect, useRef } from "react"
1
+ import React, { useContext, useLayoutEffect, useState, useEffect } from "react"
2
2
  import classnames from "classnames"
3
- import { flexRender, Cell, Row } from "@tanstack/react-table"
3
+ import { flexRender, Cell } from "@tanstack/react-table"
4
4
  import { VirtualItem } from "@tanstack/react-virtual"
5
5
 
6
6
  import { GenericObject } from "../../types"
@@ -10,8 +10,6 @@ import { getVirtualizedRowStyle } from "../Utilities/TableContainerStyles"
10
10
 
11
11
  import LoadingInline from "../../pb_loading_inline/_loading_inline"
12
12
  import Checkbox from "../../pb_checkbox/_checkbox"
13
- import Detail from "../../pb_detail/_detail"
14
- import Flex from "../../pb_flex/_flex"
15
13
 
16
14
  import { SubRowHeaderRow } from "../Components/SubRowHeaderRow"
17
15
  import { LoadingCell } from "../Components/LoadingCell"
@@ -22,13 +20,11 @@ import AdvancedTableContext from "../Context/AdvancedTableContext"
22
20
  type VirtualizedTableViewProps = {
23
21
  collapsibleTrail?: boolean
24
22
  subRowHeaders?: string[]
25
- isFetching: boolean
26
23
  }
27
24
 
28
25
  export const VirtualizedTableView = ({
29
26
  collapsibleTrail = true,
30
27
  subRowHeaders,
31
- isFetching,
32
28
  }: VirtualizedTableViewProps) => {
33
29
  const {
34
30
  enableToggleExpansion,
@@ -40,7 +36,6 @@ export const VirtualizedTableView = ({
40
36
  hasAnySubRows,
41
37
  virtualizer,
42
38
  flattenedItems,
43
- totalAvailableCount,
44
39
  } = useContext(AdvancedTableContext)
45
40
 
46
41
  const columnPinning = table.getState().columnPinning || { left: [] };
@@ -126,7 +121,19 @@ export const VirtualizedTableView = ({
126
121
  }
127
122
 
128
123
  // Get virtual items
129
- const virtualItems: VirtualItem[] = virtualizer.getVirtualItems?.() || [];
124
+ let virtualItems: VirtualItem[] = [];
125
+ try {
126
+ virtualItems = virtualizer.getVirtualItems();
127
+ } catch (err) {
128
+ return (
129
+ <tr>
130
+ <td colSpan={table.getAllFlatColumns().length || 1}>
131
+ Error loading virtualized data.
132
+ </td>
133
+ </tr>
134
+ );
135
+ }
136
+
130
137
  if (!virtualItems.length) {
131
138
  return (
132
139
  <tr>
@@ -136,9 +143,6 @@ export const VirtualizedTableView = ({
136
143
  </tr>
137
144
  );
138
145
  }
139
-
140
- // Establish # of Parent Rows (so that Footer count does not include every single row)
141
- const topLevelRowCount = table.getRowModel().flatRows.filter((row: Row<GenericObject>) => row.depth === 0).length;
142
146
 
143
147
  return (
144
148
  <>
@@ -173,7 +177,7 @@ export const VirtualizedTableView = ({
173
177
  if (item.type === 'row') {
174
178
  const row = item.row;
175
179
  const isExpandable = row.getIsExpanded();
176
- const rowHasNoChildren = row.original?.children && !row.original.children.length;
180
+ const rowHasNoChildren = row.original?.children && !row.original.children.length ? true : false;
177
181
  const rowBackground = isExpandable && ((!inlineRowLoading && row.getCanExpand()) || (inlineRowLoading && rowHasNoChildren));
178
182
  const rowColor = row.getIsSelected() ? "bg-row-selection" : rowBackground ? "bg-silver" : "bg-white";
179
183
 
@@ -262,30 +266,6 @@ export const VirtualizedTableView = ({
262
266
  );
263
267
  }
264
268
 
265
- if (item.type === 'footer') {
266
- // Render footer
267
- return (
268
- <tr
269
- className="virtualized-table-row virtualized-footer"
270
- key={`footer-row`}
271
- style={virtualItemStyle}
272
- >
273
- <td colSpan={table.getAllFlatColumns().length}>
274
- <Flex align="center"
275
- justify="center"
276
- >
277
-
278
- {isFetching ? (
279
- <LoadingInline />
280
- ) : (
281
- <Detail text={`Showing ${topLevelRowCount} of ${totalAvailableCount} rows`} />
282
- )}
283
- </Flex>
284
- </td>
285
- </tr>
286
- )
287
- }
288
-
289
269
  return null;
290
270
  })}
291
271
  </>
@@ -8,7 +8,7 @@ import { getRowHeightEstimate } from '../Utilities/TableContainerStyles';
8
8
  const AdvancedTableContext = createContext<any>({});
9
9
 
10
10
  interface FlattenedItem {
11
- type: 'header' | 'row' | 'loading' | 'footer';
11
+ type: 'header' | 'row' | 'loading';
12
12
  row: Row<GenericObject>;
13
13
  id: string;
14
14
  }
@@ -116,17 +116,6 @@ export const AdvancedTableProvider = ({ children, ...props }: {
116
116
  }
117
117
  });
118
118
 
119
- const isFetching = props.isFetching || false;
120
- const shouldAddFooter = table && !isFetching && tableRows.length > 0
121
-
122
- if (shouldAddFooter) {
123
- items.push({
124
- type: 'footer',
125
- row: {} as Row<GenericObject>,
126
- id: `footer-row`,
127
- });
128
- }
129
-
130
119
  return items;
131
120
  }, [
132
121
  isVirtualized,
@@ -170,11 +159,10 @@ export const AdvancedTableProvider = ({ children, ...props }: {
170
159
  useEffect(() => {
171
160
  if (isVirtualized && virtualizer && table && containerRef.current) {
172
161
  // Force recalculation of all virtual items
173
- virtualizer.setOptions({
174
- ...virtualizer.options,
175
- count: flattenedItems.length,
176
- });
177
162
  virtualizer.measure();
163
+
164
+ // Reset scroll position when sorting changes
165
+ containerRef.current.scrollTop = 0;
178
166
  }
179
167
  }, [
180
168
  isVirtualized,
@@ -182,8 +170,7 @@ export const AdvancedTableProvider = ({ children, ...props }: {
182
170
  table,
183
171
  containerRef,
184
172
  JSON.stringify(table?.getState().sorting || []),
185
- JSON.stringify(table?.getState().expanded || {}),
186
- flattenedItems.length,
173
+ JSON.stringify(table?.getState().expanded || {})
187
174
  ]);
188
175
 
189
176
  const contextValue = {
@@ -1,4 +1,4 @@
1
- import { useCallback, useEffect, useRef, useState } from "react";
1
+ import { useCallback, useEffect } from 'react';
2
2
  import { Row, RowPinningState } from "@tanstack/react-table";
3
3
  import { GenericObject } from "../../types";
4
4
  import { updateExpandAndCollapseState } from "../Utilities/ExpansionControlHelpers";
@@ -19,21 +19,13 @@ export function useTableActions({
19
19
  onRowSelectionChange
20
20
  }: UseTableActionsProps) {
21
21
 
22
- // State to achieve 1 second delay before fetching more rows
23
- const [bottomReached, setBottomReached] = useState(false)
24
- const bottomTimeout = useRef<NodeJS.Timeout | null>(null)
25
-
26
22
  // Handle expand/collapse
27
23
  const handleExpandOrCollapse = useCallback(async (row: Row<GenericObject>) => {
28
- if (onToggleExpansionClick) onToggleExpansionClick(row)
29
- const updatedExpandedState = await updateExpandAndCollapseState(
30
- table.getRowModel(),
31
- expanded,
32
- row?.parentId,
33
- undefined
34
- )
35
-
36
- setExpanded(updatedExpandedState)
24
+ onToggleExpansionClick && onToggleExpansionClick(row);
25
+ const expandedState = expanded;
26
+ const targetParent = row?.parentId;
27
+ const updatedRows = await updateExpandAndCollapseState(table.getRowModel(), expandedState, targetParent, undefined);
28
+ setExpanded(updatedRows);
37
29
  }, [expanded, setExpanded, onToggleExpansionClick, table]);
38
30
 
39
31
  // Handle pagination
@@ -43,32 +35,20 @@ export function useTableActions({
43
35
 
44
36
  // Handle scroll detection for infinite scroll/virtualization
45
37
  const fetchMoreOnBottomReached = useCallback((
46
- containerRef: HTMLDivElement | null,
47
- fetchNextPage: () => void,
48
- isFetching: boolean,
49
- totalFetched: number,
50
- totalDBRowCount: number
38
+ containerRefElement: HTMLDivElement | null,
39
+ fetchNextPage: () => void,
40
+ isFetching: boolean,
41
+ totalFetched: number,
42
+ totalDBRowCount: number
51
43
  ) => {
52
- if (!containerRef || isFetching || totalFetched >= totalDBRowCount) return
53
- const { scrollTop, scrollHeight, clientHeight } = containerRef
54
- const distanceFromBottom = scrollHeight - scrollTop - clientHeight
55
- // If user scrolls near bottom, fetch more data after 1 second delay
56
- if (distanceFromBottom < 50) {
57
- if (!bottomReached) {
58
- setBottomReached(true)
59
- bottomTimeout.current = setTimeout(() => {
60
- fetchNextPage()
61
- setBottomReached(false)
62
- }, 1000)
63
- }
64
- } else {
65
- setBottomReached(false)
66
- if (bottomTimeout.current) {
67
- clearTimeout(bottomTimeout.current)
68
- bottomTimeout.current = null
44
+ if (containerRefElement) {
45
+ const { scrollHeight, scrollTop, clientHeight } = containerRefElement;
46
+ // If user scrolls near bottom, fetch more data
47
+ if (scrollHeight - scrollTop - clientHeight < 500 && !isFetching && totalFetched < totalDBRowCount) {
48
+ fetchNextPage();
69
49
  }
70
50
  }
71
- },[bottomReached]);
51
+ }, []);
72
52
 
73
53
  // Update selection state
74
54
  useEffect(() => {
@@ -1,4 +1,4 @@
1
- import { useState, useCallback, useMemo, useEffect } from 'react';
1
+ import { useState, useCallback, useMemo } from 'react';
2
2
  import {
3
3
  useReactTable,
4
4
  getCoreRowModel,
@@ -32,7 +32,6 @@ interface UseTableStateProps {
32
32
  tableOptions?: GenericObject;
33
33
  onRowSelectionChange?: (arg: RowSelectionState) => void;
34
34
  columnVisibilityControl?: GenericObject;
35
- rowStyling?: GenericObject;
36
35
  }
37
36
 
38
37
  export function useTableState({
@@ -50,9 +49,7 @@ export function useTableState({
50
49
  tableOptions,
51
50
  columnVisibilityControl,
52
51
  pinnedRows,
53
- rowStyling
54
52
  }: UseTableStateProps) {
55
-
56
53
  // Create a local state for expanded and setExpanded if expandedControl not used
57
54
  const [localExpanded, setLocalExpanded] = useState({});
58
55
  const [loadingStateRowCount, setLoadingStateRowCount] = useState(initialLoadingRowsCount);
@@ -66,8 +63,8 @@ export function useTableState({
66
63
  const setExpanded = expandedControl ? expandedControl.onChange : setLocalExpanded;
67
64
  const columnVisibility = (columnVisibilityControl && columnVisibilityControl.value) ? columnVisibilityControl.value : localColumnVisibility;
68
65
  const setColumnVisibility = (columnVisibilityControl && columnVisibilityControl.onChange) ? columnVisibilityControl.onChange : setLocalColumnVisibility;
69
- const rowPinning = pinnedRows?.value ?? localRowPinning
70
- const onRowPinningChange = pinnedRows?.onChange ?? setLocalRowPinning
66
+ const rowPinning = pinnedRows && pinnedRows.value || localRowPinning;
67
+ const setRowPinning = (pinnedRows && pinnedRows.onChange) ? pinnedRows.onChange : setLocalRowPinning;
71
68
 
72
69
  // Virtualized data handling (chunked loading)
73
70
  const fetchSize = 20; // Number of rows per "page"
@@ -105,8 +102,7 @@ export function useTableState({
105
102
  column.customRenderer,
106
103
  isFirstColumn,
107
104
  onRowToggleClick,
108
- selectableRows,
109
- rowStyling
105
+ selectableRows
110
106
  );
111
107
  }
112
108
 
@@ -169,8 +165,7 @@ export function useTableState({
169
165
  enableSortingRemoval: false,
170
166
  sortDescFirst: true,
171
167
  onRowSelectionChange: setRowSelection,
172
- onRowPinningChange,
173
- getRowId: (selectableRows || pinnedRows || rowStyling) ? row => row.id : undefined,
168
+ getRowId: (selectableRows || pinnedRows) ? row => row.id : undefined,
174
169
  onColumnVisibilityChange: setColumnVisibility,
175
170
  meta: {
176
171
  columnDefinitions
@@ -180,26 +175,6 @@ export function useTableState({
180
175
  ...tableOptions,
181
176
  });
182
177
 
183
- // Handle row pinning changes
184
- useEffect(() => {
185
- const topPins = pinnedRows?.value?.top ?? [];
186
- if (topPins.length === 0) {
187
- onRowPinningChange({ top: [] });
188
- return;
189
- }
190
- const rows = table.getRowModel().rows;
191
- const collectAllDescendantIds = (subs: Row<GenericObject>[]): string[] =>
192
- subs.flatMap(r => [r.id, ...collectAllDescendantIds(r.subRows)]);
193
- const allPinned: string[] = [];
194
- topPins.forEach(id => {
195
- const parent = rows.find(r => r.id === id && r.depth === 0);
196
- if (parent) {
197
- allPinned.push(parent.id, ...collectAllDescendantIds(parent.subRows));
198
- }
199
- });
200
- onRowPinningChange({ top: allPinned });
201
- }, [table, pinnedRows?.value?.top?.join(',')]);
202
-
203
178
  // Check if table has any sub-rows
204
179
  const hasAnySubRows = table.getRowModel().rows.some(row => row.subRows && row.subRows.length > 0);
205
180
  const selectedRowsLength = Object.keys(table.getState().rowSelection).length;
@@ -16,7 +16,6 @@ type TableBodyProps = {
16
16
  dark?: boolean
17
17
  id?: string
18
18
  subRowHeaders?: string[]
19
- isFetching: boolean
20
19
  }
21
20
 
22
21
  export const TableBody = ({
@@ -25,7 +24,6 @@ export const TableBody = ({
25
24
  dark = false,
26
25
  id,
27
26
  subRowHeaders,
28
- isFetching,
29
27
  ...props
30
28
  }: TableBodyProps) => {
31
29
 
@@ -65,7 +63,6 @@ export const TableBody = ({
65
63
  // Virtualized table view
66
64
  <VirtualizedTableView
67
65
  collapsibleTrail={collapsibleTrail}
68
- isFetching={isFetching}
69
66
  subRowHeaders={subRowHeaders}
70
67
  />
71
68
  ) : (