playbook_ui 14.22.0.pre.alpha.PLAY22588587 → 14.22.0.pre.alpha.customheaderat8564

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 911865c34980d9a3e4456c6d6261d2c78bcc4be2295b4250f639415c020c6557
4
- data.tar.gz: ffbc96ad87820c2ecedb124a431d654e168ce906b0dff718ca65af44017c2bf0
3
+ metadata.gz: ae6b3ef179ba514261a9c3f24c44b3609980ad8295193eca7bf5ea78599e3f32
4
+ data.tar.gz: 59f4da05e7dc18142518d658c9dcb6e02938972abce9ca14af52a725839bf150
5
5
  SHA512:
6
- metadata.gz: 439099c3f2922db547ad9f6b41a9424b07da3cdd25f97c0c881ab41b727858d3e81bac0ace6737a96dfb98b02c70e4014f199f40f5c9941d45fef77aeb01a60d
7
- data.tar.gz: 31ce0f8177eb5fe6e5a4752ddd67f59abf21c91255d2d9deee8af886b2fcc23dbab7b7df1a8fc964cab98aadbdaf7abf85b15f344fa566ec35ed64056220d29b
6
+ metadata.gz: e891d0c03d22b2b4d0ae5faeac636fb884e54619f00b236a6cba2988a4432880f305f1d894f06005c4aa45dfefd83a440bf13395d43303cb875d129a140b6d24
7
+ data.tar.gz: 72d84a27a4f5ec1c18d7f7b1da0d093336282250ebf56351639b7da26ee64593ae9ac79caa56a8a15df148e7091642afb56f390860a9a97c095c6e964128b178
@@ -7,7 +7,6 @@ import { GlobalProps } from "../../utilities/globalProps"
7
7
 
8
8
  import Flex from "../../pb_flex/_flex"
9
9
  import Caption from "../../pb_caption/_caption"
10
- import Icon from "../../pb_icon/_icon"
11
10
 
12
11
  import { ToggleIconButton } from "./ToggleIconButton"
13
12
  import { renderCollapsibleTrail } from "./CollapsibleTrail"
@@ -33,19 +32,17 @@ export const SubRowHeaderRow = ({
33
32
  subRowHeaders,
34
33
  table,
35
34
  }: SubRowHeaderRowProps & GlobalProps) => {
36
- const { inlineRowLoading, customSort, onCustomSortClick } = useContext(AdvancedTableContext)
35
+ const { inlineRowLoading } = useContext(AdvancedTableContext)
37
36
 
38
37
  const numberOfColumns = table.getAllFlatColumns().length
39
38
  const rowHasChildren = row.original.children ? true : false
40
39
  const canExpand = inlineRowLoading ? rowHasChildren : row.getCanExpand()
41
- const hasSubrowsToSort = row.getParentRow()?.subRows
42
-
43
40
 
44
41
  return (
45
42
  <tr className="custom-row bg-silver">
46
43
  <td
47
44
  className={`custom-row-first-column ${
48
- isChrome() ? "chrome-styles" : ""
45
+ isChrome() ? "chrome-styles" : ""
49
46
  }`}
50
47
  colSpan={1}
51
48
  >
@@ -53,39 +50,21 @@ export const SubRowHeaderRow = ({
53
50
  <div style={{ paddingLeft: `${row.depth * 1.25}em` }}>
54
51
  <Flex align="center"
55
52
  columnGap="xs"
56
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
57
- //@ts-ignore
58
- justifyContent={customSort && hasSubrowsToSort && hasSubrowsToSort.length > 1 ? "between" : undefined}
59
53
  >
60
- <Flex columnGap="xs">
61
- {enableToggleExpansion === "all" && canExpand ? (
62
- <ToggleIconButton onClick={onClick}
63
- row={row}
64
- />
65
- ) : null}
66
- <Caption
67
- marginLeft={canExpand ? "none" : "xs"}
68
- text={subRowHeaders[row.depth - 1]}
54
+ {enableToggleExpansion === "all" && canExpand ? (
55
+ <ToggleIconButton onClick={onClick}
56
+ row={row}
69
57
  />
70
- </Flex>
71
- {customSort && hasSubrowsToSort && hasSubrowsToSort.length > 1 && (
72
- <button
73
- aria-label="Sort this group"
74
- className="sort-button-icon gray-icon"
75
- onClick={() => { onCustomSortClick && onCustomSortClick(row.getParentRow()?.subRows)}}
76
- >
77
- <Icon
78
- cursor="pointer"
79
- fixedWidth
80
- icon="sort"
81
- />
82
- </button>
83
- )}
58
+ ) : null}
59
+ <Caption
60
+ marginLeft={canExpand ? "none" : "xs"}
61
+ text={subRowHeaders[row.depth - 1]}
62
+ />
84
63
  </Flex>
85
64
  </div>
86
65
  </td>
87
66
 
88
67
  <td colSpan={numberOfColumns - 1} />
89
68
  </tr>
90
- );
69
+ )
91
70
  }
@@ -87,7 +87,7 @@ export function useTableState({
87
87
  // Handle grouped columns
88
88
  if (column.columns && column.columns.length > 0) {
89
89
  return {
90
- header: column.label || "",
90
+ header: column.header || column.label || "",
91
91
  columns: buildColumns(column.columns, false),
92
92
  };
93
93
  }
@@ -95,7 +95,7 @@ export function useTableState({
95
95
  // Define the base column structure
96
96
  const columnStructure = {
97
97
  ...columnHelper.accessor(column.accessor, {
98
- header: column.label || "",
98
+ header: column.header ?? column.label ?? "",
99
99
  }),
100
100
  };
101
101
 
@@ -189,6 +189,11 @@
189
189
  box-sizing: border-box !important;
190
190
  }
191
191
  }
192
+ // Fixes for tooltip picking up th styling from Table kit
193
+ .pb_tooltip_kit {
194
+ font-weight: unset;
195
+ text-transform: unset;
196
+ }
192
197
  }
193
198
 
194
199
  .pb_advanced_table_body {
@@ -36,7 +36,6 @@ type AdvancedTableProps = {
36
36
  columnDefinitions: GenericObject[]
37
37
  columnGroupBorderColor?: "text_lt_default" | "text_lt_light" | "text_lt_lighter" | "text_dk_default" | "text_dk_light" | "text_dk_lighter"
38
38
  columnVisibilityControl?: GenericObject
39
- customSort?:boolean;
40
39
  dark?: boolean
41
40
  data?: { [key: string]: string }
42
41
  enableToggleExpansion?: "all" | "header" | "none"
@@ -68,7 +67,6 @@ type AdvancedTableProps = {
68
67
  tableProps?: GenericObject
69
68
  toggleExpansionIcon?: string | string[]
70
69
  onRowSelectionChange?: (arg: RowSelectionState) => void
71
- onCustomSortClick?: (arg: GenericObject[]) => void
72
70
  virtualizedRows?: boolean
73
71
  allowFullScreen?: boolean
74
72
  fullScreenControl?: (controls: FullscreenControls) => void
@@ -83,7 +81,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
83
81
  columnDefinitions,
84
82
  columnGroupBorderColor,
85
83
  columnVisibilityControl,
86
- customSort,
87
84
  dark = false,
88
85
  data = {},
89
86
  enableToggleExpansion = "header",
@@ -98,7 +95,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
98
95
  maxHeight,
99
96
  onRowToggleClick,
100
97
  onToggleExpansionClick,
101
- onCustomSortClick,
102
98
  pagination = false,
103
99
  paginationProps,
104
100
  pinnedRows,
@@ -329,7 +325,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
329
325
  columnDefinitions={columnDefinitions}
330
326
  columnGroupBorderColor={columnGroupBorderColor}
331
327
  columnVisibilityControl={columnVisibilityControl}
332
- customSort={customSort}
333
328
  enableToggleExpansion={enableToggleExpansion}
334
329
  enableVirtualization={virtualizedRows}
335
330
  expandByDepth={expandByDepth}
@@ -341,7 +336,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
341
336
  isActionBarVisible={isActionBarVisible}
342
337
  isFullscreen={isFullscreen}
343
338
  loading={loading}
344
- onCustomSortClick={onCustomSortClick}
345
339
  onExpandByDepthClick={onExpandByDepthClick}
346
340
  pinnedRows={pinnedRows}
347
341
  responsive={responsive}
@@ -1,65 +1,69 @@
1
1
  import React from "react"
2
2
  import AdvancedTable from '../../pb_advanced_table/_advanced_table'
3
+ import Icon from "../../pb_icon/_icon"
4
+ import Flex from "../../pb_flex/_flex"
5
+ import Caption from "../../pb_caption/_caption"
6
+ import Tooltip from "../../pb_tooltip/_tooltip"
3
7
  import MOCK_DATA from "./advanced_table_mock_data.json"
4
8
 
5
- const AdvancedTableCustomSort = (props) => {
9
+ const AdvancedTableWithCustomHeader = (props) => {
6
10
  const columnDefinitions = [
7
11
  {
8
12
  accessor: "year",
9
13
  label: "Year",
10
- id: "year",
11
14
  cellAccessors: ["quarter", "month", "day"],
12
15
  },
13
16
  {
14
17
  accessor: "newEnrollments",
15
- id: "newEnrollments",
16
18
  label: "New Enrollments",
19
+ header: () => (
20
+ <Flex alignItems="center"
21
+ justifyContent="center"
22
+ >
23
+ <Caption marginRight="xs">New Enrollments</Caption>
24
+ <Tooltip placement="top"
25
+ text="Whoa. I'm a Tooltip"
26
+ zIndex={10}
27
+ >
28
+ <Icon cursor="pointer"
29
+ icon="info"
30
+ size="xs"
31
+ />
32
+ </Tooltip>
33
+ </Flex>
34
+ ),
17
35
  },
18
36
  {
19
37
  accessor: "scheduledMeetings",
20
- id: "scheduledMeetings",
21
38
  label: "Scheduled Meetings",
22
39
  },
23
40
  {
24
41
  accessor: "attendanceRate",
25
- id: "attendanceRate",
26
42
  label: "Attendance Rate",
27
43
  },
28
44
  {
29
45
  accessor: "completedClasses",
30
- id: "completedClasses",
31
46
  label: "Completed Classes",
32
47
  },
33
48
  {
34
49
  accessor: "classCompletionRate",
35
- id: "classCompletionRate",
36
50
  label: "Class Completion Rate",
37
51
  },
38
52
  {
39
53
  accessor: "graduatedStudents",
40
- id: "graduatedStudents",
41
54
  label: "Graduated Students",
42
55
  },
43
- ]
44
-
45
- //Render the subRow header rows
46
- const subRowHeaders = ["Quarter", "Month", "Day"]
56
+ ];
47
57
 
48
58
  return (
49
59
  <div>
50
60
  <AdvancedTable
51
61
  columnDefinitions={columnDefinitions}
52
- customSort
53
- enableToggleExpansion="all"
54
- onCustomSortClick={(subrows)=>{console.log("Custom sort clicked", subrows)}}
55
62
  tableData={MOCK_DATA}
56
63
  {...props}
57
- >
58
- <AdvancedTable.Header enableSorting />
59
- <AdvancedTable.Body subRowHeaders={subRowHeaders} />
60
- </AdvancedTable>
64
+ />
61
65
  </div>
62
66
  )
63
67
  }
64
68
 
65
- export default AdvancedTableCustomSort
69
+ export default AdvancedTableWithCustomHeader
@@ -0,0 +1 @@
1
+ The optional `header` key/value pair can be used within `columnDefinitions` to render a custom header. This example shows an Icon and Tooltip being used but other kits can be used as well.
@@ -19,15 +19,14 @@ examples:
19
19
  - advanced_table_selectable_rows_actions_rails: Selectable Rows (With Actions)
20
20
  - advanced_table_selectable_rows_header_rails: Selectable Rows (No Actions Bar)
21
21
  - advanced_table_scrollbar_none: Advanced Table Scrollbar None
22
- - advanced_table_column_styling_rails: Column Styling
23
- - advanced_table_column_styling_column_headers_rails: Column Styling with Multiple Headers
22
+ # - advanced_table_column_styling_rails: Column Styling
23
+ # - advanced_table_column_styling_column_headers_rails: Column Styling with Multiple Headers
24
24
 
25
25
  react:
26
26
  - advanced_table_default: Default (Required Props)
27
27
  - advanced_table_loading: Loading State
28
28
  - advanced_table_sort: Enable Sorting
29
29
  - advanced_table_sort_control: Sort Control
30
- - advanced_table_custom_sort: Custom Sort
31
30
  - advanced_table_expanded_control: Expanded Control
32
31
  - advanced_table_expand_by_depth: Expand by Depth
33
32
  - advanced_table_subrow_headers: SubRow Headers
@@ -41,6 +40,7 @@ examples:
41
40
  - advanced_table_inline_row_loading: Inline Row Loading
42
41
  - advanced_table_responsive: Responsive Tables
43
42
  - advanced_table_custom_cell: Custom Components for Cells
43
+ - advanced_table_with_custom_header: Custom Header Cell
44
44
  - advanced_table_pagination: Pagination
45
45
  - advanced_table_pagination_with_props: Pagination Props
46
46
  - advanced_table_column_headers: Multi-Header Columns
@@ -38,4 +38,4 @@ export { default as AdvancedTableRowStyling } from './_advanced_table_row_stylin
38
38
  export { default as AdvancedTableColumnStyling } from './_advanced_table_column_styling.jsx'
39
39
  export { default as AdvancedTableColumnStylingColumnHeaders } from './_advanced_table_column_styling_column_headers.jsx'
40
40
  export { default as AdvancedTableInfiniteScroll} from './_advanced_table_infinite_scroll.jsx'
41
- export { default as AdvancedTableCustomSort } from './_advanced_table_custom_sort.jsx'
41
+ export {default as AdvancedTableWithCustomHeader} from './_advanced_table_with_custom_header.jsx'