playbook_ui_docs 14.11.0.pre.rc.17 → 14.11.1.pre.alpha.PBNTR769sticky5359

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d36a4ed75a9f7a9ff312dfaa55cd044c0f1bb36d561e5de66ba66b029789e7d
4
- data.tar.gz: 1a6fbb988aaacc84469d367442af77c5bdfe7405eb29b8f877cd45e89da87d5c
3
+ metadata.gz: f3bdb49fc5fa2ae41cef519b8fc54c5a9fa804baecf7583ef6b16d0dbd1167d4
4
+ data.tar.gz: c61ffaa7be0fb6b1421dd77dcaa4c7653006377abfc564278064e3fea0a9cf94
5
5
  SHA512:
6
- metadata.gz: a94b9030b36267143cfb9476ba2972c738c4bd72df3a9d2e32425861f4b5f3639a0df1dc8b7c34504a2fb34b7c624681941cfc720c6d99c4e41c9fd827e5fdfd
7
- data.tar.gz: 9e68f7284a5c29802a57aa716fd8c2d325c20d70827e6caa5b119caa1ce46ec75fae2b78dac7eb06319f04b9bb0b3bd53fb62747627b8c3b6fd60a8327f6388a
6
+ metadata.gz: fae106e1a12690322c17c135dd21c65cf7af1fc23ddbab77855f4d958e7afce6ee4194b9bcd1a52a2e2395d947365f5a793d1de56de09ecc2ef4f499d4059282
7
+ data.tar.gz: '078f33440cc6284dc9d29952c1d500727d7957b76a147b50af05c62d4005fc16625828295c72e361d64e1dd7cffde0f3ecd884851ca807d392595e4a4f2fef20'
@@ -0,0 +1,52 @@
1
+ import React from "react"
2
+ import { AdvancedTable } from "playbook-ui"
3
+ import MOCK_DATA from "./advanced_table_mock_data.json"
4
+
5
+ const AdvancedTableStickyHeaderResponsive = (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
+
39
+ return (
40
+ <div>
41
+ <AdvancedTable
42
+ columnDefinitions={columnDefinitions}
43
+ htmlOptions={{style: { maxHeight: "100vh" }}}
44
+ tableData={MOCK_DATA}
45
+ tableProps={{sticky:true}}
46
+ {...props}
47
+ />
48
+ </div>
49
+ )
50
+ }
51
+
52
+ export default AdvancedTableStickyHeaderResponsive
@@ -0,0 +1,33 @@
1
+ <% column_definitions = [
2
+ {
3
+ accessor: "year",
4
+ label: "Year",
5
+ cellAccessors: ["quarter", "month", "day"],
6
+ },
7
+ {
8
+ accessor: "newEnrollments",
9
+ label: "New Enrollments",
10
+ },
11
+ {
12
+ accessor: "scheduledMeetings",
13
+ label: "Scheduled Meetings",
14
+ },
15
+ {
16
+ accessor: "attendanceRate",
17
+ label: "Attendance Rate",
18
+ },
19
+ {
20
+ accessor: "completedClasses",
21
+ label: "Completed Classes",
22
+ },
23
+ {
24
+ accessor: "classCompletionRate",
25
+ label: "Class Completion Rate",
26
+ },
27
+ {
28
+ accessor: "graduatedStudents",
29
+ label: "Graduated Students",
30
+ }
31
+ ] %>
32
+
33
+ <%= pb_rails("advanced_table", props: { id: "table_props_table", table_data: @table_data, column_definitions: column_definitions, table_props: { container: false, sticky: true }}) %>
@@ -0,0 +1 @@
1
+ This kit uses the [Table kit](https://playbook.powerapp.cloud/kits/table) 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 `table_props` 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).
@@ -3,6 +3,7 @@ examples:
3
3
  - advanced_table_beta: Default (Required Props)
4
4
  - advanced_table_beta_subrow_headers: SubRow Headers
5
5
  - advanced_table_collapsible_trail_rails: Collapsible Trail
6
+ - advanced_table_table_props: Table Props
6
7
  - advanced_table_beta_sort: Enable Sorting
7
8
  - advanced_table_custom_cell_rails: Custom Components for Cells
8
9
  - advanced_table_column_headers: Multi-Header Columns
@@ -21,6 +22,7 @@ examples:
21
22
  - advanced_table_table_props: Table Props
22
23
  - advanced_table_inline_row_loading: Inline Row Loading
23
24
  - advanced_table_responsive: Responsive Tables
25
+ - advanced_table_sticky_header_responsive: Sticky Header and Responsive
24
26
  - advanced_table_custom_cell: Custom Components for Cells
25
27
  - advanced_table_pagination: Pagination
26
28
  - advanced_table_pagination_with_props: Pagination Props
@@ -13,4 +13,5 @@ export { default as AdvancedTableCustomCell } from './_advanced_table_custom_cel
13
13
  export { default as AdvancedTablePagination } from './_advanced_table_pagination.jsx'
14
14
  export { default as AdvancedTablePaginationWithProps } from './_advanced_table_pagination_with_props.jsx'
15
15
  export { default as AdvancedTableColumnHeaders } from './_advanced_table_column_headers.jsx'
16
- export { default as AdvancedTableColumnHeadersMultiple } from './_advanced_table_column_headers_multiple.jsx'
16
+ export { default as AdvancedTableColumnHeadersMultiple } from './_advanced_table_column_headers_multiple.jsx'
17
+ export { default as AdvancedTableStickyHeaderResponsive } from './_advanced_table_sticky_header_responsive.jsx'
@@ -1,3 +1,5 @@
1
+ /* eslint-disable react/no-multi-comp */
2
+
1
3
  import React, { useState } from 'react'
2
4
 
3
5
  import {
@@ -45,8 +45,7 @@ const promiseOptions = (inputValue) =>
45
45
 
46
46
  const TypeaheadWithPillsAsync = (props) => {
47
47
  const [users, setUsers] = useState([])
48
- const handleOnChange = (value) => setUsers(formatUsers(value))
49
- const formatValue = (users) => formatUsers(users)
48
+
50
49
  const formatUsers = (users) => {
51
50
  const results = () => (users.map((user) => {
52
51
  if (Object.keys(user)[0] === 'name' || Object.keys(user)[1] === 'id'){
@@ -58,6 +57,9 @@ const TypeaheadWithPillsAsync = (props) => {
58
57
  return results()
59
58
  }
60
59
 
60
+ const handleOnChange = (value) => setUsers(formatUsers(value))
61
+ const formatValue = (users) => formatUsers(users)
62
+
61
63
  return (
62
64
  <>
63
65
  {users && users.length > 0 && (
@@ -83,13 +83,13 @@ const TypeaheadWithPillsAsyncCustomOptions = (props) => {
83
83
  onChange={handleOnChange}
84
84
  onMultiValueClick={handleOnMultiValueClick}
85
85
  placeholder="type the name of a Github user"
86
- valueComponent={(props) => (
86
+ valueComponent={({imageUrl, label, territory, type}) => (
87
87
  <User
88
88
  avatar
89
- avatarUrl={props.imageUrl}
90
- name={props.label}
91
- territory={props.territory}
92
- title={props.type}
89
+ avatarUrl={imageUrl}
90
+ name={label}
91
+ territory={territory}
92
+ title={type}
93
93
  />
94
94
  )}
95
95
  {...props}