playbook_ui 13.16.0.pre.alpha.PBNTR178AdvancedTableDocs2072 → 13.16.0.pre.alpha.PBNTR181stripedtable2103

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.md +1 -4
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort.jsx +6 -1
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +4 -10
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -7
  6. data/app/pb_kits/playbook/pb_table/_table.tsx +3 -0
  7. data/app/pb_kits/playbook/pb_table/docs/_table_striped.html.erb +48 -0
  8. data/app/pb_kits/playbook/pb_table/docs/_table_striped.jsx +58 -0
  9. data/app/pb_kits/playbook/pb_table/docs/_table_striped.md +1 -0
  10. data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
  11. data/app/pb_kits/playbook/pb_table/docs/index.js +1 -0
  12. data/app/pb_kits/playbook/pb_table/styles/_all.scss +1 -0
  13. data/app/pb_kits/playbook/pb_table/styles/_striped.scss +19 -0
  14. data/app/pb_kits/playbook/pb_table/table.rb +7 -1
  15. data/app/pb_kits/playbook/pb_table/table.test.js +5 -0
  16. data/lib/playbook/version.rb +1 -1
  17. metadata +6 -17
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail.jsx +0 -52
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail.md +0 -1
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx +0 -59
  21. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.md +0 -18
  22. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.jsx +0 -60
  23. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.md +0 -3
  24. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort.md +0 -5
  25. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_control.jsx +0 -63
  26. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_control.md +0 -3
  27. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_subrow_headers.jsx +0 -57
  28. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_subrow_headers.md +0 -3
  29. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_options.jsx +0 -61
  30. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_options.md +0 -3
  31. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +0 -55
  32. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.md +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a3f84c9ada938622a17b30501cba912f98fe09c68fb50d2f9880f1b55026d6c1
4
- data.tar.gz: ace64b8414d943043df0acaf4809bf139e226dc681dd059a36540e646327444d
3
+ metadata.gz: aae6e47ae52e5b9c14b3801cf5edc5266a9592ea797e1418b6170395c30a8f66
4
+ data.tar.gz: a882e0194ed45cfa9641ff5dfe99187f806a30d3fb6ead81bdbe8859a45b3a40
5
5
  SHA512:
6
- metadata.gz: 2a49054e9f6ec1d8603aee090092392f5a4f3dde7b1f687bd3f1318b47dce1670f859a42b1e09aaff370333aef5e613df175f1a1ff000707f99c5705d373c14f
7
- data.tar.gz: f287762d5c8446c9594b02a24d5dd7a178f24802725318f906061fd8edf12907b085700e7b2c788e92c0b69446ffa91df23e7b79e231188419aea5efec78b9c3
6
+ metadata.gz: c41634573bbbbcfcb2e9cc2695a881aa74a3b9a35e948aa6fd88ef36a9a6b3666c4fe715daadf182ad86c3e037b0b90a6e1c0c1a995d2f7184cb96e9ed30196c
7
+ data.tar.gz: fbda5aabd791414a112a8fc50931c7177b4db0333c090b2407842ffc0a4b584039ed2540349ab070d426bf3437508f7f41b57027dfa7dcc316a8a47bf1edd3ff
@@ -1,10 +1,7 @@
1
- The AdvancedTable kit takes the table data and automatically renders expandable subrows for nested items to any depth needed. In it's simplest form, __the kit has two required props__:
2
-
3
- ### tableData
1
+ The AdvancedTable kit takes the table data and automatically renders expandable subrows for nested items to any depth needed. In it's simplest form, the kit has two required props:
4
2
 
5
3
  `tableData` is the data that the kit needs to consume to render the table. This data will take the structure of an array of objects where each object will be rendered as a row with the key/value pairs being the column values. If an object within that data has children, the kit will automatically create subRows with icon buttons on the parent rows to toggle the subRows open or closed. The toggleExpansionAll button in the first column header can also be used to toggle expansion for the top level parent rows. For a visual of the data structure needed for `tableData`, see [here](https://github.com/powerhome/playbook/blob/PBNTR-177-New-Advanced-Table-Kit/playbook/app/pb_kits/playbook/pb_advanced_table/README.md).
6
4
 
7
- ### columnDefinitions
8
5
 
9
6
  `columnDefinitions` maps to the columns prop on the Tanstack table. Column definitions are the single most important part of building a table as they are responsible for building the underlying data model that is used for all sorting, expansion, etc. `ColumnDefinitions` in the AdvancedTable kit is a array of objects as seen in the code snippet below. Each object within the array has two REQUIRED items:
10
7
 
@@ -35,15 +35,20 @@ const AdvancedTableSort = (props) => {
35
35
  },
36
36
  ];
37
37
 
38
+ //Render the subRow header rows
39
+ const subRowHeaders = ["Quarter", "Month", "Day"]
40
+
41
+
38
42
  return (
39
43
  <div>
40
44
  <AdvancedTable
41
45
  columnDefinitions={columnDefinitions}
46
+ enableToggleExpansion="all"
42
47
  tableData={MOCK_DATA}
43
48
  {...props}
44
49
  >
45
50
  <AdvancedTable.Header enableSorting />
46
- <AdvancedTable.Body />
51
+ <AdvancedTable.Body subRowHeaders={subRowHeaders} />
47
52
  </AdvancedTable>
48
53
  </div>
49
54
  );
@@ -1,12 +1,6 @@
1
1
  examples:
2
2
  react:
3
- - advanced_table_default: Default (Required Props)
4
- - advanced_table_loading: Loading State
5
- - advanced_table_sort: enable Sorting
6
- - advanced_table_sort_control: Sort Control
7
- - advanced_table_expanded_control: Expanded Control
8
- - advanced_table_subrow_headers: SubRow Headers
9
- - advanced_table_collapsible_trail: Collapsible Trail
10
- - advanced_table_table_options: Table Options
11
- - advanced_table_table_props: Table Props
12
-
3
+ - advanced_table_default: Default
4
+ # - advanced_table_sort: enableSorting
5
+
6
+
@@ -1,9 +1,2 @@
1
1
  export { default as AdvancedTableDefault } from './_advanced_table_default.jsx'
2
2
  export { default as AdvancedTableSort } from './_advanced_table_sort.jsx'
3
- export { default as AdvancedTableSortControl } from './_advanced_table_sort_control.jsx'
4
- export { default as AdvancedTableLoading } from './_advanced_table_loading.jsx'
5
- export { default as AdvancedTableExpandedControl } from './_advanced_table_expanded_control.jsx'
6
- export { default as AdvancedTableSubrowHeaders } from './_advanced_table_subrow_headers.jsx'
7
- export { default as AdvancedTableCollapsibleTrail } from './_advanced_table_collapsible_trail.jsx'
8
- export { default as AdvancedTableTableOptions } from './_advanced_table_table_options.jsx'
9
- export { default as AdvancedTableTableProps } from './_advanced_table_table_props.jsx'
@@ -20,6 +20,7 @@ type TableProps = {
20
20
  singleLine?: boolean,
21
21
  size?: "sm" | "md" | "lg",
22
22
  sticky?: boolean,
23
+ striped?: boolean,
23
24
  verticalBorder?: boolean,
24
25
  } & GlobalProps
25
26
 
@@ -40,6 +41,7 @@ const Table = (props: TableProps) => {
40
41
  singleLine = false,
41
42
  size = 'sm',
42
43
  sticky = false,
44
+ striped = false,
43
45
  verticalBorder = false,
44
46
  } = props
45
47
 
@@ -70,6 +72,7 @@ const Table = (props: TableProps) => {
70
72
  'single-line': singleLine,
71
73
  'no-hover': disableHover,
72
74
  'sticky-header': sticky,
75
+ 'striped': striped,
73
76
  },
74
77
  globalProps(props),
75
78
  tableCollapseCss,
@@ -0,0 +1,48 @@
1
+ <%= pb_rails("table", props: { striped: true }) do %>
2
+ <thead>
3
+ <tr>
4
+ <th>Column 1</th>
5
+ <th>Column 2</th>
6
+ <th>Column 3</th>
7
+ <th>Column 4</th>
8
+ <th>Column 5</th>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+ <tr>
13
+ <td>Value 1</td>
14
+ <td>Value 2</td>
15
+ <td>Value 3</td>
16
+ <td>Value 4</td>
17
+ <td>Value 5</td>
18
+ </tr>
19
+ <tr>
20
+ <td>Value 1</td>
21
+ <td>Value 2</td>
22
+ <td>Value 3</td>
23
+ <td>Value 4</td>
24
+ <td>Value 5</td>
25
+ </tr>
26
+ <tr>
27
+ <td>Value 1</td>
28
+ <td>Value 2</td>
29
+ <td>Value 3</td>
30
+ <td>Value 4</td>
31
+ <td>Value 5</td>
32
+ </tr>
33
+ <tr>
34
+ <td>Value 1</td>
35
+ <td>Value 2</td>
36
+ <td>Value 3</td>
37
+ <td>Value 4</td>
38
+ <td>Value 5</td>
39
+ </tr>
40
+ <tr>
41
+ <td>Value 1</td>
42
+ <td>Value 2</td>
43
+ <td>Value 3</td>
44
+ <td>Value 4</td>
45
+ <td>Value 5</td>
46
+ </tr>
47
+ </tbody>
48
+ <% end %>
@@ -0,0 +1,58 @@
1
+ import React from "react"
2
+ import Table from "../_table"
3
+
4
+ const TableStriped = (props) => (
5
+ <Table
6
+ striped
7
+ {...props}
8
+ >
9
+ <thead>
10
+ <tr>
11
+ <th>{'Column 1'}</th>
12
+ <th>{'Column 2'}</th>
13
+ <th>{'Column 3'}</th>
14
+ <th>{'Column 4'}</th>
15
+ <th>{'Column 5'}</th>
16
+ </tr>
17
+ </thead>
18
+ <tbody>
19
+ <tr>
20
+ <td>{'Value 1'}</td>
21
+ <td>{'Value 2'}</td>
22
+ <td>{'Value 3'}</td>
23
+ <td>{'Value 4'}</td>
24
+ <td>{'Value 5'}</td>
25
+ </tr>
26
+ <tr>
27
+ <td>{'Value 1'}</td>
28
+ <td>{'Value 2'}</td>
29
+ <td>{'Value 3'}</td>
30
+ <td>{'Value 4'}</td>
31
+ <td>{'Value 5'}</td>
32
+ </tr>
33
+ <tr>
34
+ <td>{'Value 1'}</td>
35
+ <td>{'Value 2'}</td>
36
+ <td>{'Value 3'}</td>
37
+ <td>{'Value 4'}</td>
38
+ <td>{'Value 5'}</td>
39
+ </tr>
40
+ <tr>
41
+ <td>{'Value 1'}</td>
42
+ <td>{'Value 2'}</td>
43
+ <td>{'Value 3'}</td>
44
+ <td>{'Value 4'}</td>
45
+ <td>{'Value 5'}</td>
46
+ </tr>
47
+ <tr>
48
+ <td>{'Value 1'}</td>
49
+ <td>{'Value 2'}</td>
50
+ <td>{'Value 3'}</td>
51
+ <td>{'Value 4'}</td>
52
+ <td>{'Value 5'}</td>
53
+ </tr>
54
+ </tbody>
55
+ </Table>
56
+ )
57
+
58
+ export default TableStriped
@@ -0,0 +1 @@
1
+ Optionally pass the `striped` (boolean, defaults to false) prop to set odd rows to a contrasting background color. This helps with readability on larger tables with lots of data.
@@ -23,6 +23,7 @@ examples:
23
23
  - table_icon_buttons: Table with Icon Buttons
24
24
  - table_with_background_kit: Table With Background Kit
25
25
  - table_vertical_border: Vertical Borders
26
+ - table_striped: Striped Table
26
27
 
27
28
  react:
28
29
  - table_sm: Small
@@ -47,3 +48,4 @@ examples:
47
48
  - table_icon_buttons: Table with Icon Buttons
48
49
  - table_with_background_kit: Table With Background Kit
49
50
  - table_vertical_border: Vertical Borders
51
+ - table_striped: Striped Table
@@ -20,3 +20,4 @@ export { default as TableAlignmentShiftRow } from './_table_alignment_shift_row.
20
20
  export { default as TableAlignmentShiftData } from './_table_alignment_shift_data.jsx'
21
21
  export { default as TableWithBackgroundKit } from './_table_with_background_kit.jsx'
22
22
  export { default as TableVerticalBorder } from './_table_vertical_border.jsx'
23
+ export { default as TableStriped } from './_table_striped.jsx'
@@ -18,3 +18,4 @@
18
18
  @import "sticky_header";
19
19
  @import "vertical_border";
20
20
  @import "table_header";
21
+ @import "striped";
@@ -0,0 +1,19 @@
1
+ [class^=pb_table] {
2
+ &.striped {
3
+ tbody {
4
+ tr:nth-child(odd) {
5
+ background-color: $bg_light;
6
+ }
7
+ }
8
+ }
9
+
10
+ &.dark {
11
+ &.striped {
12
+ tbody {
13
+ tr:nth-child(odd) {
14
+ background-color: $bg_dark;
15
+ }
16
+ }
17
+ }
18
+ }
19
+ }
@@ -25,12 +25,14 @@ module Playbook
25
25
  default: false
26
26
  prop :vertical_border, type: Playbook::Props::Boolean,
27
27
  default: false
28
+ prop :striped, type: Playbook::Props::Boolean,
29
+ default: false
28
30
 
29
31
  def classname
30
32
  generate_classname(
31
33
  "pb_table", "table-#{size}", single_line_class, dark_class,
32
34
  disable_hover_class, container_class, data_table_class, sticky_class, collapse_class,
33
- vertical_border_class, "table-responsive-#{responsive}", separator: " "
35
+ vertical_border_class, striped_class, "table-responsive-#{responsive}", separator: " "
34
36
  )
35
37
  end
36
38
 
@@ -64,6 +66,10 @@ module Playbook
64
66
  sticky ? "sticky-header" : nil
65
67
  end
66
68
 
69
+ def striped_class
70
+ striped ? "striped" : nil
71
+ end
72
+
67
73
  def vertical_border_class
68
74
  vertical_border ? "vertical-border" : nil
69
75
  end
@@ -15,3 +15,8 @@ test("when sticky is true", () => {
15
15
  const kit = renderKit(Table, props, { sticky: true })
16
16
  expect(kit).toHaveClass("pb_table table-sm table-responsive-collapse table-card sticky-header table-collapse-sm")
17
17
  })
18
+
19
+ test("when striped is true", () => {
20
+ const kit = renderKit(Table, props, { striped: true })
21
+ expect(kit).toHaveClass("pb_table table-sm table-responsive-collapse table-card striped table-collapse-sm")
22
+ })
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Playbook
4
4
  PREVIOUS_VERSION = "13.16.0"
5
- VERSION = "13.16.0.pre.alpha.PBNTR178AdvancedTableDocs2072"
5
+ VERSION = "13.16.0.pre.alpha.PBNTR181stripedtable2103"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.16.0.pre.alpha.PBNTR178AdvancedTableDocs2072
4
+ version: 13.16.0.pre.alpha.PBNTR181stripedtable2103
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-02-02 00:00:00.000000000 Z
12
+ date: 2024-02-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -287,24 +287,9 @@ files:
287
287
  - app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss
288
288
  - app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx
289
289
  - app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx
290
- - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail.jsx
291
- - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail.md
292
290
  - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.jsx
293
291
  - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.md
294
- - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx
295
- - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.md
296
- - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.jsx
297
- - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.md
298
292
  - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort.jsx
299
- - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort.md
300
- - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_control.jsx
301
- - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_control.md
302
- - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_subrow_headers.jsx
303
- - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_subrow_headers.md
304
- - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_options.jsx
305
- - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_options.md
306
- - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx
307
- - app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.md
308
293
  - app/pb_kits/playbook/pb_advanced_table/docs/_description.md
309
294
  - app/pb_kits/playbook/pb_advanced_table/docs/_mock_data.js
310
295
  - app/pb_kits/playbook/pb_advanced_table/docs/example.yml
@@ -2264,6 +2249,9 @@ files:
2264
2249
  - app/pb_kits/playbook/pb_table/docs/_table_sticky.html.erb
2265
2250
  - app/pb_kits/playbook/pb_table/docs/_table_sticky.jsx
2266
2251
  - app/pb_kits/playbook/pb_table/docs/_table_sticky.md
2252
+ - app/pb_kits/playbook/pb_table/docs/_table_striped.html.erb
2253
+ - app/pb_kits/playbook/pb_table/docs/_table_striped.jsx
2254
+ - app/pb_kits/playbook/pb_table/docs/_table_striped.md
2267
2255
  - app/pb_kits/playbook/pb_table/docs/_table_two_actions.html.erb
2268
2256
  - app/pb_kits/playbook/pb_table/docs/_table_two_actions.jsx
2269
2257
  - app/pb_kits/playbook/pb_table/docs/_table_two_actions.md
@@ -2289,6 +2277,7 @@ files:
2289
2277
  - app/pb_kits/playbook/pb_table/styles/_side_highlight.scss
2290
2278
  - app/pb_kits/playbook/pb_table/styles/_single-line.scss
2291
2279
  - app/pb_kits/playbook/pb_table/styles/_sticky_header.scss
2280
+ - app/pb_kits/playbook/pb_table/styles/_striped.scss
2292
2281
  - app/pb_kits/playbook/pb_table/styles/_structure.scss
2293
2282
  - app/pb_kits/playbook/pb_table/styles/_table-card.scss
2294
2283
  - app/pb_kits/playbook/pb_table/styles/_table-dark.scss
@@ -1,52 +0,0 @@
1
- import React from "react";
2
- import { AdvancedTable } from "../../";
3
- import { MOCK_DATA } from "./_mock_data";
4
-
5
- const AdvancedTableCollapsibleTrail = (props) => {
6
- const columnDefinitions = [
7
- {
8
- accessor: "year",
9
- label: "Year",
10
- cellAccessors: ["quarter", "month", "day"],
11
- },
12
- {
13
- accessor: "newEnrollments",
14
- label: "New Enrollments",
15
- },
16
- {
17
- accessor: "scheduledMeetings",
18
- label: "Scheduled Meetings",
19
- },
20
- {
21
- accessor: "attendanceRate",
22
- label: "Attendance Rate",
23
- },
24
- {
25
- accessor: "completedClasses",
26
- label: "Completed Classes",
27
- },
28
- {
29
- accessor: "classCompletionRate",
30
- label: "Class Completion Rate",
31
- },
32
- {
33
- accessor: "graduatedStudents",
34
- label: "Graduated Students",
35
- },
36
- ];
37
-
38
- return (
39
- <div>
40
- <AdvancedTable
41
- columnDefinitions={columnDefinitions}
42
- tableData={MOCK_DATA}
43
- {...props}
44
- >
45
- <AdvancedTable.Header />
46
- <AdvancedTable.Body collapsibleTrail={false} />
47
- </AdvancedTable>
48
- </div>
49
- );
50
- };
51
-
52
- export default AdvancedTableCollapsibleTrail;
@@ -1 +0,0 @@
1
- `collapsibleTrail` is an optional prop that is set to 'true' by default. If set to 'false', it will remove the trail on the left of rows when subRows are toggled open.
@@ -1,59 +0,0 @@
1
- import React, { useState } from "react";
2
- import { AdvancedTable } from "../../";
3
- import { MOCK_DATA } from "./_mock_data";
4
-
5
- const AdvancedTableExpandedControl = (props) => {
6
- const columnDefinitions = [
7
- {
8
- accessor: "year",
9
- label: "Year",
10
- cellAccessors: ["quarter", "month", "day"],
11
- },
12
- {
13
- accessor: "newEnrollments",
14
- label: "New Enrollments",
15
- },
16
- {
17
- accessor: "scheduledMeetings",
18
- label: "Scheduled Meetings",
19
- },
20
- {
21
- accessor: "attendanceRate",
22
- label: "Attendance Rate",
23
- },
24
- {
25
- accessor: "completedClasses",
26
- label: "Completed Classes",
27
- },
28
- {
29
- accessor: "classCompletionRate",
30
- label: "Class Completion Rate",
31
- },
32
- {
33
- accessor: "graduatedStudents",
34
- label: "Graduated Students",
35
- },
36
- ];
37
-
38
- //State for manually effecting what is expanded
39
- const [expanded, setExpanded] = useState({'0': true, '0.0': true, '0.0.1': true})
40
-
41
- //Passing expanded state to AdvancedTable as prop
42
- const expandedControl = {
43
- value: expanded,
44
- onChange: setExpanded,
45
- }
46
-
47
- return (
48
- <div>
49
- <AdvancedTable
50
- columnDefinitions={columnDefinitions}
51
- expandedControl={expandedControl}
52
- tableData={MOCK_DATA}
53
- {...props}
54
- />
55
- </div>
56
- );
57
- };
58
-
59
- export default AdvancedTableExpandedControl;
@@ -1,18 +0,0 @@
1
- `expandedControl` is an optional prop that can be used to gain greater control over the expansion state of the Advanced Table. Tanstack handles expansion itself, however it does provide for a way to handle the state manually if needed. Usecases for this include needing to store the expansion state so it persists on page reload, set an initial expansion state, etc.
2
-
3
- In this example we are showing that if initial expansion state is set, it will render the table expanded according to that state.
4
-
5
- The expanded state must be an object with key/value pairs where the key is the row id and the value is a boolean, true or false. Tanstack by default assigns row ids based on index and depth of the row as can be seen in this example. For more information on row ids, see [here](https://tanstack.com/table/v8/docs/api/core/row#id).
6
-
7
- ### Single Row Expansion
8
-
9
- By default, the click event on the row level toggleExpansion icon simply toggles the immediate sub rows open or closed. If you want to attach further logic to that button, the optional `onRowToggleClick` prop can be used. This click event provides one argument that can be hooked into: the current `row` object. Any additional functionality provided through this onClick will be applied in addition to the default.
10
-
11
- ### Multi-Row Expansion
12
-
13
- Similar to the row level click event, the default of the click event on the toggleExpansion buttons that render in the first column header (and the subRow Header rows if prop enabled) toggles all top level rows open and closed. If you want to attach further logic to that button, the optional `onToggleExpansionClick` prop can be used. This click event provides one argument that can be hooked into: the current `row` object. Any additional functionality provided through this onClick will be applied in addition to the default.
14
-
15
- ### ToggleExpansionIcon
16
-
17
- `ToggleExpansionIcon` is another optional prop that can be used to customize the icon for the toggleExpansion button. This prop takes a string value with the default set to `arrows-from-line`. All strings must be valid FA icons.
18
-
@@ -1,60 +0,0 @@
1
- import React, { useState } from "react";
2
- import { AdvancedTable } from "../../";
3
- import { Button } from "../../"
4
- import { MOCK_DATA } from "./_mock_data";
5
-
6
- const AdvancedTableLoading = (props) => {
7
-
8
- const [isloading, setIsLoading] = useState(true)
9
-
10
- const columnDefinitions = [
11
- {
12
- accessor: "year",
13
- label: "Year",
14
- cellAccessors: ["quarter", "month", "day"],
15
- },
16
- {
17
- accessor: "newEnrollments",
18
- label: "New Enrollments",
19
- },
20
- {
21
- accessor: "scheduledMeetings",
22
- label: "Scheduled Meetings",
23
- },
24
- {
25
- accessor: "attendanceRate",
26
- label: "Attendance Rate",
27
- },
28
- {
29
- accessor: "completedClasses",
30
- label: "Completed Classes",
31
- },
32
- {
33
- accessor: "classCompletionRate",
34
- label: "Class Completion Rate",
35
- },
36
- {
37
- accessor: "graduatedStudents",
38
- label: "Graduated Students",
39
- },
40
- ];
41
-
42
- return (
43
- <div>
44
- <Button marginBottom="md"
45
- onClick={()=> setIsLoading(!isloading)}
46
- text="Toggle Loading State"
47
- variant="secondary"
48
- {...props}
49
- />
50
- <AdvancedTable
51
- columnDefinitions={columnDefinitions}
52
- loading={isloading}
53
- tableData={MOCK_DATA}
54
- {...props}
55
- />
56
- </div>
57
- );
58
- };
59
-
60
- export default AdvancedTableLoading;
@@ -1,3 +0,0 @@
1
- the optional `loading` prop takes a boolean value that can be managed using state. If loading is true, the table will display the loading skeleton and once loading is false, the table will render with the data provided.
2
-
3
- By default, the inital row count of the loading skeleton is set to 10. If you want more control over this initial row count, the optional `initialLoadingRowCount` prop can be used to to pass in a number. __NOTE__: This is only for the first render of the table, subsequent loading skeleton row count logic is handled within the kit itself.
@@ -1,5 +0,0 @@
1
- the `enableSorting` prop is a boolean prop set to false by default. If true, the table will add sort logic linked to the sort button in the header. Clicking the sort button will toggle sort between ascending and descending. Currently this sort functionality is only available on the first column.
2
-
3
- ### sortIcon
4
-
5
- An optional prop, `sortIcon` allows you to customize your icon sets by passing it an array of any comma-separated pair of icon values. The first icon value will replace the kit's default icon when sort direction is desc, and the second value will replace the default icon when sort direction is asc. `sortIcon` also allows you to pass it a single icon as a string, in which case the icon will not toggle with the sort state. Default for this prop is `["arrow-up-short-wide", "arrow-down-short-wide"]`. All strings must be valid FA icons.
@@ -1,63 +0,0 @@
1
- import React, { useState } from "react";
2
- import { AdvancedTable } from "../..";
3
- import { MOCK_DATA } from "./_mock_data";
4
-
5
- const AdvancedTableSortControl = (props) => {
6
- const columnDefinitions = [
7
- {
8
- accessor: "year",
9
- label: "Year",
10
- cellAccessors: ["quarter", "month", "day"],
11
- },
12
- {
13
- accessor: "newEnrollments",
14
- label: "New Enrollments",
15
- },
16
- {
17
- accessor: "scheduledMeetings",
18
- label: "Scheduled Meetings",
19
- },
20
- {
21
- accessor: "attendanceRate",
22
- label: "Attendance Rate",
23
- },
24
- {
25
- accessor: "completedClasses",
26
- label: "Completed Classes",
27
- },
28
- {
29
- accessor: "classCompletionRate",
30
- label: "Class Completion Rate",
31
- },
32
- {
33
- accessor: "graduatedStudents",
34
- label: "Graduated Students",
35
- },
36
- ];
37
-
38
- //State for sort direction
39
- const [isSortDesc, setIsSortDesc] = useState({desc: false})
40
-
41
- // //Passing sort state to AdvancedTable as prop
42
- const sortControl = {
43
- value: isSortDesc,
44
- onChange: setIsSortDesc,
45
- }
46
-
47
-
48
- return (
49
- <div>
50
- <AdvancedTable
51
- columnDefinitions={columnDefinitions}
52
- sortControl={sortControl}
53
- tableData={MOCK_DATA}
54
- {...props}
55
- >
56
- <AdvancedTable.Header enableSorting />
57
- <AdvancedTable.Body />
58
- </AdvancedTable>
59
- </div>
60
- );
61
- };
62
-
63
- export default AdvancedTableSortControl;
@@ -1,3 +0,0 @@
1
- `sortControl` is an optional prop that can be used to gain greater control over the sort state of the Advanced Table. Tanstack handles sort itself, however it does provide for a way to handle the state manually if needed. Usecases for this include needing to store the sort state so it persists on page reload, set an initial sort state, etc.
2
-
3
- The sort state must be an object with a single key/value pair, with the key being "desc" and the value being a boolean. The default for sort directino is `desc: true`.
@@ -1,57 +0,0 @@
1
- import React from "react";
2
- import { AdvancedTable } from "../..";
3
- import { MOCK_DATA } from "./_mock_data";
4
-
5
- const AdvancedTableSubrowHeaders = (props) => {
6
- const columnDefinitions = [
7
- {
8
- accessor: "year",
9
- label: "Year",
10
- cellAccessors: ["quarter", "month", "day"],
11
- },
12
- {
13
- accessor: "newEnrollments",
14
- label: "New Enrollments",
15
- },
16
- {
17
- accessor: "scheduledMeetings",
18
- label: "Scheduled Meetings",
19
- },
20
- {
21
- accessor: "attendanceRate",
22
- label: "Attendance Rate",
23
- },
24
- {
25
- accessor: "completedClasses",
26
- label: "Completed Classes",
27
- },
28
- {
29
- accessor: "classCompletionRate",
30
- label: "Class Completion Rate",
31
- },
32
- {
33
- accessor: "graduatedStudents",
34
- label: "Graduated Students",
35
- },
36
- ];
37
-
38
- //Render the subRow header rows
39
- const subRowHeaders = ["Quarter", "Month", "Day"]
40
-
41
-
42
- return (
43
- <div>
44
- <AdvancedTable
45
- columnDefinitions={columnDefinitions}
46
- enableToggleExpansion="all"
47
- tableData={MOCK_DATA}
48
- {...props}
49
- >
50
- <AdvancedTable.Header />
51
- <AdvancedTable.Body subRowHeaders={subRowHeaders}/>
52
- </AdvancedTable>
53
- </div>
54
- );
55
- };
56
-
57
- export default AdvancedTableSubrowHeaders;
@@ -1,3 +0,0 @@
1
- `subRowHeaders` is an optional prop that if present will add header rows at each level of the nested data. The prop takes an array of strings, each string being the text for each header row. The array of strings must be in the order in which they need to be rendered in the UI according to depth.
2
-
3
- `enableToggleExpansion` is an additional optional prop that can be used in conjunction with the subRowHeaders prop. `enableToggleExpansion` is a string that can be 'all' or 'header". If set to 'all', the toggle exapansion button will appear in the table header as well as in the subRow headers. If set to 'header' button will only appear in header and NOT in subRow headers. This is set to 'headeer' by default.
@@ -1,61 +0,0 @@
1
- import React from "react";
2
- import { AdvancedTable } from "../../";
3
- import { MOCK_DATA } from "./_mock_data";
4
-
5
- const AdvancedTableTableOptions = (props) => {
6
- const columnDefinitions = [
7
- {
8
- accessor: "year",
9
- label: "Year",
10
- cellAccessors: ["quarter", "month", "day"],
11
- },
12
- {
13
- accessor: "newEnrollments",
14
- label: "New Enrollments",
15
- },
16
- {
17
- accessor: "scheduledMeetings",
18
- label: "Scheduled Meetings",
19
- },
20
- {
21
- accessor: "attendanceRate",
22
- label: "Attendance Rate",
23
- },
24
- {
25
- accessor: "completedClasses",
26
- label: "Completed Classes",
27
- },
28
- {
29
- accessor: "classCompletionRate",
30
- label: "Class Completion Rate",
31
- },
32
- {
33
- accessor: "graduatedStudents",
34
- label: "Graduated Students",
35
- },
36
- ];
37
-
38
- const tableOptions = {
39
- initialState: {
40
- sorting: [
41
- {
42
- id: "year",
43
- desc: true,
44
- },
45
- ],
46
- },
47
- }
48
-
49
- return (
50
- <div>
51
- <AdvancedTable
52
- columnDefinitions={columnDefinitions}
53
- tableData={MOCK_DATA}
54
- tableOptions={tableOptions}
55
- {...props}
56
- />
57
- </div>
58
- );
59
- };
60
-
61
- export default AdvancedTableTableOptions;
@@ -1,3 +0,0 @@
1
- The Tanstack table consumes the useReactTable hook to create the table. This hook takes an object that can contain any of the functions that the Tanstack table provides. The advancedTable's optional `tableOptions` can be used to pass tanstack options to the kit.
2
-
3
- In the above example, we are using the initialState option provided by tanstack that takes sort as one of it's values. Setting it to true for the first column is reversing the sort order on first render of the table. For a complete list of possible options and hoe to use them, see [here](https://tanstack.com/table/v8/docs/api/core/table#usereacttable--createsolidtable--usevuetable--createsveltetable)
@@ -1,55 +0,0 @@
1
- import React from "react";
2
- import { AdvancedTable } from "../../";
3
- import { MOCK_DATA } from "./_mock_data";
4
-
5
- const AdvancedTableTableProps = (props) => {
6
- const columnDefinitions = [
7
- {
8
- accessor: "year",
9
- label: "Year",
10
- cellAccessors: ["quarter", "month", "day"],
11
- },
12
- {
13
- accessor: "newEnrollments",
14
- label: "New Enrollments",
15
- },
16
- {
17
- accessor: "scheduledMeetings",
18
- label: "Scheduled Meetings",
19
- },
20
- {
21
- accessor: "attendanceRate",
22
- label: "Attendance Rate",
23
- },
24
- {
25
- accessor: "completedClasses",
26
- label: "Completed Classes",
27
- },
28
- {
29
- accessor: "classCompletionRate",
30
- label: "Class Completion Rate",
31
- },
32
- {
33
- accessor: "graduatedStudents",
34
- label: "Graduated Students",
35
- },
36
- ];
37
-
38
- const tableProps = {
39
- container: false,
40
- sticky: true
41
- }
42
-
43
- return (
44
- <div>
45
- <AdvancedTable
46
- columnDefinitions={columnDefinitions}
47
- tableData={MOCK_DATA}
48
- tableProps={tableProps}
49
- {...props}
50
- />
51
- </div>
52
- );
53
- };
54
-
55
- export default AdvancedTableTableProps;
@@ -1 +0,0 @@
1
- This kit uses the [Table kit](https://playbook.powerapp.cloud/kits/table/react) under the hood which comes with it's own set of props. If you want to apply certain Table props to that underlying kit, you can do so by using the optional `tableProps` prop. This prop must be an object that contains valid Table props. For a full list of Table props, see [here](https://playbook.powerapp.cloud/kits/table/react).