playbook_ui 16.9.0.pre.alpha.PLAY3039advancedtablerowstylingfontweight17275 → 16.9.0.pre.alpha.PLAY296917309
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 +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +5 -12
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/CellRendererUtils.tsx +2 -4
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/RowUtils.ts +0 -17
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +0 -71
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +1 -80
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +1 -68
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.html.erb +0 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.jsx +0 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling_rails.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling_react.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.json +1 -9
- data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.overrides.json +1 -8
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/kit.schema.json +0 -12
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +1 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +2 -16
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +1 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_independent_containers.html.erb +35 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_independent_containers_rails.md +8 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_rails.md +3 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_react.md +1 -1
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_draggable/index.js +10 -3
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +2 -2
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_breached.html.erb +1 -1
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_common.html.erb +1 -1
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_meter_settings.html.erb +5 -5
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_strength_change.html.erb +1 -1
- data/app/pb_kits/playbook/pb_passphrase/index.ts +58 -0
- data/app/pb_kits/playbook/pb_passphrase/kit.schema.json +13 -0
- data/app/pb_kits/playbook/pb_passphrase/passphrase.html.erb +70 -1
- data/app/pb_kits/playbook/pb_passphrase/passphrase.rb +70 -0
- data/app/pb_kits/playbook/pb_select/_select.tsx +1 -0
- data/app/pb_kits/playbook/pb_select/select.html.erb +1 -1
- data/dist/chunks/{_pb_line_graph-D8PSzzEY.js → _pb_line_graph-CtCojY_S.js} +1 -1
- data/dist/chunks/_typeahead-CvKcMcSg.js +5 -0
- data/dist/chunks/{globalProps-B8stOeTI.js → globalProps-BkLcOUZ1.js} +1 -1
- data/dist/chunks/{lib-BAri19Ko.js → lib-C_55jUZx.js} +1 -1
- data/dist/chunks/vendor.js +4 -4
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +9 -8
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.jsx +0 -92
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.md +0 -3
- data/dist/chunks/_typeahead-CuXG_NFx.js +0 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 97faa7a55c20413300483dd41c7a96ddfe7e48b7d614f81f189e89fc69d4fbcf
|
|
4
|
+
data.tar.gz: 67815662958bd8ac1d55ccdf78414cda7f7bb1985192bdb6dc71848e6109e7e0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c8995b74810117c3bea3a67463740e0d495a83c2a0b6b42869654f85e5711943d45aca45d959df29538d339ded23ce50cbd40f6020a1c35ad5f7cc3adbf6804a
|
|
7
|
+
data.tar.gz: cbc8380debcdd9a5c368c7c209ce0ddc9be5bdcec1a99c9afc72cae8d4f462b34018bf597821fd84a33a13fb96da2fb4ce14705ad759fa149cd5687cdf2118b7
|
|
@@ -6,7 +6,7 @@ import { GenericObject } from "../../types"
|
|
|
6
6
|
import { isChrome } from "../Utilities/BrowserCheck"
|
|
7
7
|
import { findColumnDefByAccessor } from "../Utilities/ColumnStylingHelper"
|
|
8
8
|
import { playbookColumnLayoutStylesFromMeta } from "../Utilities/ColumnLayoutHelper"
|
|
9
|
-
import {
|
|
9
|
+
import { getRowColorClass, shouldShowLoadingIndicator } from "../Utilities/RowUtils"
|
|
10
10
|
|
|
11
11
|
import LoadingInline from "../../pb_loading_inline/_loading_inline"
|
|
12
12
|
import Checkbox from "../../pb_checkbox/_checkbox"
|
|
@@ -81,7 +81,6 @@ const TableCellRenderer = ({
|
|
|
81
81
|
|
|
82
82
|
const paddingValue = colDef?.columnStyling?.cellPadding ?? customRowStyle?.cellPadding
|
|
83
83
|
const paddingClass = paddingValue ? `p_${paddingValue}` : undefined
|
|
84
|
-
const fontWeight = getFontWeight(customRowStyle)
|
|
85
84
|
|
|
86
85
|
return (
|
|
87
86
|
<td
|
|
@@ -104,7 +103,6 @@ const TableCellRenderer = ({
|
|
|
104
103
|
: undefined,
|
|
105
104
|
backgroundColor: cellBackgroundColor || (i === 0 && customRowStyle?.backgroundColor),
|
|
106
105
|
color: cellFontColor || customRowStyle?.fontColor,
|
|
107
|
-
fontWeight,
|
|
108
106
|
}}
|
|
109
107
|
>
|
|
110
108
|
{collapsibleTrail && i === 0 && row.depth > 0 && renderCollapsibleTrail(row.depth)}
|
|
@@ -163,7 +161,7 @@ export const RegularTableView = ({
|
|
|
163
161
|
|
|
164
162
|
// Row pinning
|
|
165
163
|
function PinnedRow({ row }: { row: Row<any> }) {
|
|
166
|
-
const customRowStyle =
|
|
164
|
+
const customRowStyle = rowStyling?.length > 0 && rowStyling?.find((s: GenericObject) => s?.rowId === row.id);
|
|
167
165
|
return (
|
|
168
166
|
<tr
|
|
169
167
|
className={classnames(
|
|
@@ -177,8 +175,7 @@ export const RegularTableView = ({
|
|
|
177
175
|
row.getIsPinned() === 'top'
|
|
178
176
|
? `${row.getPinnedIndex() * rowHeight + headerHeight + actionBarHeight}px`
|
|
179
177
|
: undefined,
|
|
180
|
-
zIndex: '3'
|
|
181
|
-
fontWeight: getFontWeight(customRowStyle),
|
|
178
|
+
zIndex: '3'
|
|
182
179
|
}}
|
|
183
180
|
>
|
|
184
181
|
<TableCellRenderer
|
|
@@ -208,7 +205,7 @@ export const RegularTableView = ({
|
|
|
208
205
|
const isFirstChildofSubrow = row.depth > 0 && row.index === 0;
|
|
209
206
|
const numberOfColumns = table.getAllFlatColumns().length;
|
|
210
207
|
const isFirstRegularRow = rowIndex === 0 && !row.getIsPinned();
|
|
211
|
-
const customRowStyle =
|
|
208
|
+
const customRowStyle = rowStyling?.length > 0 && rowStyling?.find((s: GenericObject) => s?.rowId === row.id);
|
|
212
209
|
|
|
213
210
|
// Use functions from RowUtils for consistent cell coloring
|
|
214
211
|
const rowColor = getRowColorClass(row, inlineRowLoading || false);
|
|
@@ -231,11 +228,7 @@ export const RegularTableView = ({
|
|
|
231
228
|
className={`${rowColor} ${row.depth > 0 ? `depth-sub-row-${row.depth}` : ""}`}
|
|
232
229
|
id={`${row.index}-${row.id}-${row.depth}-row`}
|
|
233
230
|
ref={isFirstRegularRow ? sampleRowRef : null}
|
|
234
|
-
style={{
|
|
235
|
-
backgroundColor: customRowStyle?.backgroundColor,
|
|
236
|
-
color: customRowStyle?.fontColor,
|
|
237
|
-
fontWeight: getFontWeight(customRowStyle),
|
|
238
|
-
}}
|
|
231
|
+
style={{backgroundColor: customRowStyle?.backgroundColor, color: customRowStyle?.fontColor}}
|
|
239
232
|
>
|
|
240
233
|
{/* Render custom checkbox column when we want selectableRows for non-expanding tables */}
|
|
241
234
|
{selectableRows && !hasAnySubRows && (
|
|
@@ -39,7 +39,7 @@ interface UseTableStateProps {
|
|
|
39
39
|
tableOptions?: GenericObject;
|
|
40
40
|
onRowSelectionChange?: (arg: RowSelectionState) => void;
|
|
41
41
|
columnVisibilityControl?: GenericObject;
|
|
42
|
-
rowStyling?: GenericObject
|
|
42
|
+
rowStyling?: GenericObject;
|
|
43
43
|
inlineRowLoading?: boolean;
|
|
44
44
|
sortParentOnly?: boolean;
|
|
45
45
|
}
|
|
@@ -150,7 +150,7 @@ export function useTableState({
|
|
|
150
150
|
|
|
151
151
|
return columnStructure;
|
|
152
152
|
}) || [];
|
|
153
|
-
}, [columnHelper, onRowToggleClick,
|
|
153
|
+
}, [columnHelper, onRowToggleClick, selectableRows]);
|
|
154
154
|
|
|
155
155
|
const columns = useMemo(() => buildColumns(columnDefinitions), [buildColumns, columnDefinitions]);
|
|
156
156
|
|
|
@@ -2,7 +2,6 @@ import React from "react";
|
|
|
2
2
|
import { Row, Getter } from "@tanstack/react-table";
|
|
3
3
|
import { GenericObject } from "../../types";
|
|
4
4
|
import { CustomCell } from "../Components/CustomCell";
|
|
5
|
-
import { getRowStyle } from "./RowUtils";
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Creates a cell render function for table columns
|
|
@@ -19,7 +18,7 @@ export const createCellFunction = (
|
|
|
19
18
|
isFirstColumn?: boolean,
|
|
20
19
|
onRowToggleClick?: (row: Row<GenericObject>) => void,
|
|
21
20
|
selectableRows?: boolean,
|
|
22
|
-
rowStyling?: GenericObject
|
|
21
|
+
rowStyling?: GenericObject
|
|
23
22
|
) => {
|
|
24
23
|
// Add display name to the returned function
|
|
25
24
|
const cellRenderer = ({
|
|
@@ -30,7 +29,7 @@ export const createCellFunction = (
|
|
|
30
29
|
getValue: Getter<string>
|
|
31
30
|
}) => {
|
|
32
31
|
const rowData = row.original;
|
|
33
|
-
const customStyle =
|
|
32
|
+
const customStyle = rowStyling?.length > 0 && rowStyling?.find((s:GenericObject) => s?.rowId === row.id);
|
|
34
33
|
|
|
35
34
|
if (isFirstColumn) {
|
|
36
35
|
switch (row.depth) {
|
|
@@ -53,7 +52,6 @@ export const createCellFunction = (
|
|
|
53
52
|
return accessorValue ? (
|
|
54
53
|
<CustomCell
|
|
55
54
|
customRenderer={customRenderer}
|
|
56
|
-
customStyle={customStyle}
|
|
57
55
|
onRowToggleClick={onRowToggleClick}
|
|
58
56
|
row={row}
|
|
59
57
|
selectableRows={selectableRows}
|
|
@@ -36,23 +36,6 @@ export const shouldShowLoadingIndicator = (
|
|
|
36
36
|
(row.depth < cellAccessorsLength);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
export const getRowStyle = (
|
|
40
|
-
rowStyling: GenericObject[] | undefined,
|
|
41
|
-
row: Row<GenericObject>
|
|
42
|
-
) => {
|
|
43
|
-
const rowId = row.original?.id ?? row.id
|
|
44
|
-
if (rowId == null) return
|
|
45
|
-
|
|
46
|
-
return rowStyling?.find((style: GenericObject) => (
|
|
47
|
-
String(style?.rowId) === String(rowId)
|
|
48
|
-
))
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export const getFontWeight = (rowStyle?: GenericObject) => {
|
|
52
|
-
if (rowStyle?.fontWeight === "bold") return 700
|
|
53
|
-
if (rowStyle?.fontWeight === "regular") return 400
|
|
54
|
-
}
|
|
55
|
-
|
|
56
39
|
/**
|
|
57
40
|
* Creates a virtual item style object for virtualized rows
|
|
58
41
|
*/
|
|
@@ -429,55 +429,6 @@
|
|
|
429
429
|
@include scrollbar-styling;
|
|
430
430
|
}
|
|
431
431
|
|
|
432
|
-
// Fullscreen
|
|
433
|
-
&.advanced-table-allow-fullscreen {
|
|
434
|
-
transition: all 0.3s ease;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
&.advanced-table-fullscreen {
|
|
438
|
-
background-color: $bg_light;
|
|
439
|
-
box-sizing: border-box;
|
|
440
|
-
height: 100vh;
|
|
441
|
-
left: 0;
|
|
442
|
-
overflow: auto;
|
|
443
|
-
position: fixed;
|
|
444
|
-
top: 0;
|
|
445
|
-
width: 100%;
|
|
446
|
-
z-index: $z_10;
|
|
447
|
-
|
|
448
|
-
.pb_table {
|
|
449
|
-
th,
|
|
450
|
-
td,
|
|
451
|
-
div,
|
|
452
|
-
button {
|
|
453
|
-
font-size: calc(100%);
|
|
454
|
-
}
|
|
455
|
-
box-sizing: border-box;
|
|
456
|
-
margin: $space_lg;
|
|
457
|
-
max-width: calc(100% - 64px);
|
|
458
|
-
width: calc(100% - 64px);
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
.pb_table.sticky-header {
|
|
462
|
-
thead,
|
|
463
|
-
.pb_advanced_table_header {
|
|
464
|
-
position: sticky !important;
|
|
465
|
-
top: calc(44px + var(--advanced-table-action-bar-height, 0px)) !important;
|
|
466
|
-
z-index: $z_10;
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
.advanced-table-fullscreen-header {
|
|
472
|
-
background-color: $white;
|
|
473
|
-
height: 44px;
|
|
474
|
-
padding: 13px 20px;
|
|
475
|
-
position: sticky;
|
|
476
|
-
top: 0;
|
|
477
|
-
width: 100%;
|
|
478
|
-
z-index: $z_10;
|
|
479
|
-
}
|
|
480
|
-
|
|
481
432
|
// Icons
|
|
482
433
|
.button-icon {
|
|
483
434
|
display: flex;
|
|
@@ -535,16 +486,6 @@
|
|
|
535
486
|
}
|
|
536
487
|
}
|
|
537
488
|
|
|
538
|
-
.fullscreen-icon {
|
|
539
|
-
@extend .button-icon;
|
|
540
|
-
@extend %primary-color-pseudo;
|
|
541
|
-
padding: 2px 0;
|
|
542
|
-
|
|
543
|
-
&:focus-visible {
|
|
544
|
-
border-radius: $border_rad_lighter;
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
|
|
548
489
|
// First column separator/border
|
|
549
490
|
.table-header-cells:first-child,
|
|
550
491
|
.table-header-cells-custom:first-child,
|
|
@@ -1037,18 +978,6 @@
|
|
|
1037
978
|
}
|
|
1038
979
|
}
|
|
1039
980
|
|
|
1040
|
-
// Fullscreen
|
|
1041
|
-
&.advanced-table-fullscreen {
|
|
1042
|
-
background: $bg_dark;
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1045
|
-
.advanced-table-fullscreen-header {
|
|
1046
|
-
background-color: $bg_dark_card;
|
|
1047
|
-
position: sticky;
|
|
1048
|
-
top: 0;
|
|
1049
|
-
z-index: $z_10;
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
981
|
&[class*="advanced-table-sticky-left-columns"] {
|
|
1053
982
|
.sticky-left {
|
|
1054
983
|
background-color: $bg_dark;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useRef, useEffect
|
|
1
|
+
import React, { useRef, useEffect } from "react";
|
|
2
2
|
import classnames from "classnames";
|
|
3
3
|
|
|
4
4
|
import { GenericObject } from "../types";
|
|
@@ -20,15 +20,6 @@ import { useTableState } from "./Hooks/useTableState";
|
|
|
20
20
|
import { useTableActions } from "./Hooks/useTableActions";
|
|
21
21
|
import { updateStickyLayoutHeights, scheduleStickyActionBarHeightUpdate } from "./Utilities/StickyLayoutHelper";
|
|
22
22
|
|
|
23
|
-
import Card from "../pb_card/_card"
|
|
24
|
-
import Flex from "../pb_flex/_flex"
|
|
25
|
-
import Icon from "../pb_icon/_icon"
|
|
26
|
-
|
|
27
|
-
type FullscreenControls = {
|
|
28
|
-
toggleFullscreen: () => void;
|
|
29
|
-
isFullscreen: boolean;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
23
|
type AdvancedTableProps = {
|
|
33
24
|
aria?: { [key: string]: string }
|
|
34
25
|
actions?: React.ReactNode[] | React.ReactNode
|
|
@@ -75,8 +66,6 @@ type AdvancedTableProps = {
|
|
|
75
66
|
onRowSelectionChange?: (arg: RowSelectionState) => void
|
|
76
67
|
onCustomSortClick?: (arg: GenericObject[]) => void
|
|
77
68
|
virtualizedRows?: boolean
|
|
78
|
-
allowFullScreen?: boolean
|
|
79
|
-
fullScreenControl?: (controls: FullscreenControls) => void
|
|
80
69
|
} & GlobalProps;
|
|
81
70
|
|
|
82
71
|
/**
|
|
@@ -136,8 +125,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
136
125
|
toggleExpansionIcon = "arrows-from-line",
|
|
137
126
|
onRowSelectionChange,
|
|
138
127
|
virtualizedRows = false,
|
|
139
|
-
allowFullScreen = false,
|
|
140
|
-
fullScreenControl,
|
|
141
128
|
} = props;
|
|
142
129
|
|
|
143
130
|
const noTableCardContainer = tableProps?.container === false;
|
|
@@ -215,68 +202,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
215
202
|
);
|
|
216
203
|
}, [fetchMoreOnBottomReached, fetchNextPage, isFetching, totalFetched, fullData.length]);
|
|
217
204
|
|
|
218
|
-
// Fullscreen
|
|
219
|
-
const [isFullscreen, setIsFullscreen] = useState(false)
|
|
220
|
-
|
|
221
|
-
const toggleFullscreen = useCallback(() => {
|
|
222
|
-
setIsFullscreen(prevState => !prevState)
|
|
223
|
-
}, [])
|
|
224
|
-
|
|
225
|
-
useEffect(() => {
|
|
226
|
-
if (allowFullScreen && fullScreenControl) {
|
|
227
|
-
fullScreenControl({
|
|
228
|
-
toggleFullscreen,
|
|
229
|
-
isFullscreen
|
|
230
|
-
})
|
|
231
|
-
}
|
|
232
|
-
}, [allowFullScreen, fullScreenControl, toggleFullscreen, isFullscreen])
|
|
233
|
-
|
|
234
|
-
const renderFullscreenHeader = () => {
|
|
235
|
-
if (!isFullscreen) return null
|
|
236
|
-
|
|
237
|
-
const defaultMinimizeIcon = (
|
|
238
|
-
<button
|
|
239
|
-
className="gray-icon fullscreen-icon"
|
|
240
|
-
onClick={toggleFullscreen}
|
|
241
|
-
>
|
|
242
|
-
<Icon
|
|
243
|
-
cursor="pointer"
|
|
244
|
-
fixedWidth
|
|
245
|
-
icon="arrow-down-left-and-arrow-up-right-to-center"
|
|
246
|
-
{...props}
|
|
247
|
-
/>
|
|
248
|
-
</button>
|
|
249
|
-
)
|
|
250
|
-
|
|
251
|
-
return (
|
|
252
|
-
<Card
|
|
253
|
-
borderNone
|
|
254
|
-
borderRadius="none"
|
|
255
|
-
className="advanced-table-fullscreen-header"
|
|
256
|
-
{...props}
|
|
257
|
-
>
|
|
258
|
-
<Flex justify="end">
|
|
259
|
-
{defaultMinimizeIcon}
|
|
260
|
-
</Flex>
|
|
261
|
-
</Card>
|
|
262
|
-
)
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
useEffect(() => {
|
|
266
|
-
if (!allowFullScreen) return
|
|
267
|
-
|
|
268
|
-
const handleKeyDown = (event: KeyboardEvent) => {
|
|
269
|
-
if (event.key === 'Escape' && isFullscreen) {
|
|
270
|
-
event.preventDefault()
|
|
271
|
-
toggleFullscreen()
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
document.addEventListener('keydown', handleKeyDown)
|
|
275
|
-
return () => {
|
|
276
|
-
document.removeEventListener('keydown', handleKeyDown)
|
|
277
|
-
}
|
|
278
|
-
}, [allowFullScreen, toggleFullscreen, isFullscreen])
|
|
279
|
-
|
|
280
205
|
// Build CSS classes and props
|
|
281
206
|
const ariaProps = buildAriaProps(aria);
|
|
282
207
|
const dataProps = buildDataProps(data);
|
|
@@ -317,8 +242,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
317
242
|
`advanced-table-responsive-${responsive}`,
|
|
318
243
|
maxHeight ? `advanced-table-max-height-${maxHeight}` : '',
|
|
319
244
|
{
|
|
320
|
-
'advanced-table-fullscreen': isFullscreen,
|
|
321
|
-
'advanced-table-allow-fullscreen': allowFullScreen,
|
|
322
245
|
// Add the hidden-action-bar class when action bar functionality exists but is not visible
|
|
323
246
|
'hidden-action-bar': (selectableRows || columnVisibilityControl) && !isActionBarVisible,
|
|
324
247
|
},
|
|
@@ -387,7 +310,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
387
310
|
ref={tableWrapperRef}
|
|
388
311
|
style={tableWrapperStyle as React.CSSProperties}
|
|
389
312
|
>
|
|
390
|
-
{renderFullscreenHeader()}
|
|
391
313
|
<AdvancedTableProvider
|
|
392
314
|
cascadeCollapse={cascadeCollapse}
|
|
393
315
|
columnDefinitions={columnDefinitions}
|
|
@@ -404,7 +326,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
404
326
|
hasAnySubRows={hasAnySubRows}
|
|
405
327
|
inlineRowLoading={inlineRowLoading}
|
|
406
328
|
isActionBarVisible={isActionBarVisible}
|
|
407
|
-
isFullscreen={isFullscreen}
|
|
408
329
|
loading={loading}
|
|
409
330
|
onCustomSortClick={onCustomSortClick}
|
|
410
331
|
onExpandByDepthClick={onExpandByDepthClick}
|
|
@@ -696,19 +696,6 @@ test("customRenderer prop functions as expected", () => {
|
|
|
696
696
|
expect(pill).toBeInTheDocument()
|
|
697
697
|
})
|
|
698
698
|
|
|
699
|
-
test("allowFullScreen prop adds fullscreen class", () => {
|
|
700
|
-
render(
|
|
701
|
-
<AdvancedTable
|
|
702
|
-
allowFullScreen
|
|
703
|
-
columnDefinitions={columnDefinitions}
|
|
704
|
-
tableData={MOCK_DATA}
|
|
705
|
-
/>
|
|
706
|
-
)
|
|
707
|
-
|
|
708
|
-
const tableContainer = screen.getByRole("table").closest("div")
|
|
709
|
-
expect(tableContainer).toHaveClass("advanced-table-allow-fullscreen")
|
|
710
|
-
})
|
|
711
|
-
|
|
712
699
|
test("pinnedRows prop renders pinned rows at top", () => {
|
|
713
700
|
const pinnedRowsControl = {
|
|
714
701
|
value: { top: ["1", "3"] },
|
|
@@ -1055,12 +1042,7 @@ test("rowStyling prop works as expected", () => {
|
|
|
1055
1042
|
{
|
|
1056
1043
|
rowId: "1",
|
|
1057
1044
|
backgroundColor: colors.white,
|
|
1058
|
-
fontColor: colors.black
|
|
1059
|
-
fontWeight: "bold",
|
|
1060
|
-
},
|
|
1061
|
-
{
|
|
1062
|
-
rowId: "2",
|
|
1063
|
-
fontWeight: "regular",
|
|
1045
|
+
fontColor: colors.black
|
|
1064
1046
|
},
|
|
1065
1047
|
];
|
|
1066
1048
|
|
|
@@ -1077,55 +1059,6 @@ test("rowStyling prop works as expected", () => {
|
|
|
1077
1059
|
const tableBody = kit.querySelector('tbody')
|
|
1078
1060
|
const row1 = tableBody.querySelector('tr:nth-child(1)')
|
|
1079
1061
|
expect(row1).toHaveStyle({backgroundColor: colors.white, color: colors.black})
|
|
1080
|
-
expect(row1).toHaveStyle({fontWeight: "700"})
|
|
1081
|
-
const row2 = tableBody.querySelector('tr:nth-child(2)')
|
|
1082
|
-
expect(row2).toHaveStyle({fontWeight: "400"})
|
|
1083
|
-
})
|
|
1084
|
-
|
|
1085
|
-
test("rowStyling fontWeight applies to expandable rows", () => {
|
|
1086
|
-
const rowStyling = [
|
|
1087
|
-
{
|
|
1088
|
-
rowId: "1",
|
|
1089
|
-
fontWeight: "bold",
|
|
1090
|
-
},
|
|
1091
|
-
];
|
|
1092
|
-
|
|
1093
|
-
const tableData = [
|
|
1094
|
-
{
|
|
1095
|
-
id: "1",
|
|
1096
|
-
year: "2021",
|
|
1097
|
-
quarter: null,
|
|
1098
|
-
month: null,
|
|
1099
|
-
day: null,
|
|
1100
|
-
newEnrollments: "20",
|
|
1101
|
-
scheduledMeetings: "10",
|
|
1102
|
-
children: [
|
|
1103
|
-
{
|
|
1104
|
-
id: "1-1",
|
|
1105
|
-
year: "2021",
|
|
1106
|
-
quarter: "Q1",
|
|
1107
|
-
month: null,
|
|
1108
|
-
day: null,
|
|
1109
|
-
newEnrollments: "2",
|
|
1110
|
-
scheduledMeetings: "35",
|
|
1111
|
-
},
|
|
1112
|
-
],
|
|
1113
|
-
},
|
|
1114
|
-
];
|
|
1115
|
-
|
|
1116
|
-
render(
|
|
1117
|
-
<AdvancedTable
|
|
1118
|
-
columnDefinitions={columnDefinitions}
|
|
1119
|
-
data={{ testid: testId }}
|
|
1120
|
-
rowStyling={rowStyling}
|
|
1121
|
-
tableData={tableData}
|
|
1122
|
-
/>
|
|
1123
|
-
)
|
|
1124
|
-
|
|
1125
|
-
const kit = screen.getByTestId(testId)
|
|
1126
|
-
const tableBody = kit.querySelector('tbody')
|
|
1127
|
-
const expandableRow = tableBody.querySelector('tr:nth-child(1)')
|
|
1128
|
-
expect(expandableRow).toHaveStyle({fontWeight: "700"})
|
|
1129
1062
|
})
|
|
1130
1063
|
|
|
1131
1064
|
test("rowStyling prop to allow padding control", () => {
|
|
@@ -41,10 +41,6 @@
|
|
|
41
41
|
font_color: "white",
|
|
42
42
|
expand_button_color: "white",
|
|
43
43
|
},
|
|
44
|
-
{
|
|
45
|
-
row_id: "15",
|
|
46
|
-
font_weight: "bold",
|
|
47
|
-
},
|
|
48
44
|
] %>
|
|
49
45
|
|
|
50
46
|
<%= pb_rails("advanced_table", props: { id: "row-styling", table_data: @table_data_with_id, column_definitions: column_definitions, row_styling: row_styling }) %>
|
|
@@ -3,6 +3,5 @@ The `row_styling` prop can be used in conjunction with row ids to control certai
|
|
|
3
3
|
- `background_color` : use this to control the background color of the row
|
|
4
4
|
- `font_color`: use this to control font color for each row if needed, for example if using a darker background color.
|
|
5
5
|
- `expand_button_color`: use this to control the color of the expand icon if needed, for example if using a darker background color.
|
|
6
|
-
- `font_weight`: use this to control row font weight. Accepted values are `regular` (default appearance) and `bold`.
|
|
7
6
|
|
|
8
7
|
**NOTE:** Each object within the `table_data` Array must contain a unique id in order to attach an id to all Rows for this to function.
|
|
@@ -3,6 +3,5 @@ The `rowStyling` prop can be used in conjunction with row ids to control certain
|
|
|
3
3
|
- `backgroundColor` : use this to control the background color of the row
|
|
4
4
|
- `fontColor`: use this to control font color for each row if needed, for example if using a darker background color.
|
|
5
5
|
- `expandButtonColor`: use this to control the color of the expand icon if needed, for example if using a darker background color.
|
|
6
|
-
- `fontWeight`: use this to control row font weight. Accepted values are `regular` (default appearance) and `bold`.
|
|
7
6
|
|
|
8
7
|
**NOTE:** Each object within the `tableData` Array must contain a unique id in order to attach an id to all Rows for this to function.
|
|
@@ -28,8 +28,7 @@
|
|
|
28
28
|
"rowId": "1",
|
|
29
29
|
"backgroundColor": "#0056CF",
|
|
30
30
|
"fontColor": "#FFFFFF",
|
|
31
|
-
"expandButtonColor": "#FFFFFF"
|
|
32
|
-
"fontWeight": "bold"
|
|
31
|
+
"expandButtonColor": "#FFFFFF"
|
|
33
32
|
}
|
|
34
33
|
],
|
|
35
34
|
"expandByDepth": [
|
|
@@ -234,11 +233,6 @@
|
|
|
234
233
|
"customSort": true
|
|
235
234
|
}
|
|
236
235
|
},
|
|
237
|
-
"fullScreenControl": {
|
|
238
|
-
"requires": {
|
|
239
|
-
"allowFullScreen": true
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
236
|
"enableSortingRemoval": {
|
|
243
237
|
"requires": {
|
|
244
238
|
"enableSorting": true
|
|
@@ -2955,9 +2949,7 @@
|
|
|
2955
2949
|
},
|
|
2956
2950
|
"hiddenProps": [
|
|
2957
2951
|
"sortControl",
|
|
2958
|
-
"fullScreenControl",
|
|
2959
2952
|
"expandedControl",
|
|
2960
|
-
"allowFullScreen",
|
|
2961
2953
|
"pagination",
|
|
2962
2954
|
"paginationProps"
|
|
2963
2955
|
],
|
|
@@ -73,9 +73,7 @@
|
|
|
73
73
|
},
|
|
74
74
|
"hiddenProps": [
|
|
75
75
|
"sortControl",
|
|
76
|
-
"fullScreenControl",
|
|
77
76
|
"expandedControl",
|
|
78
|
-
"allowFullScreen",
|
|
79
77
|
"pagination",
|
|
80
78
|
"paginationProps"
|
|
81
79
|
],
|
|
@@ -106,7 +104,7 @@
|
|
|
106
104
|
"tableProps": {
|
|
107
105
|
"container": false
|
|
108
106
|
},
|
|
109
|
-
"rowStyling": [{ "rowId": "1", "backgroundColor": "#0056CF", "fontColor": "#FFFFFF", "expandButtonColor": "#FFFFFF"
|
|
107
|
+
"rowStyling": [{ "rowId": "1", "backgroundColor": "#0056CF", "fontColor": "#FFFFFF", "expandButtonColor": "#FFFFFF" }],
|
|
110
108
|
"expandByDepth": [
|
|
111
109
|
{
|
|
112
110
|
"depth": 0,
|
|
@@ -291,11 +289,6 @@
|
|
|
291
289
|
"customSort": true
|
|
292
290
|
}
|
|
293
291
|
},
|
|
294
|
-
"fullScreenControl": {
|
|
295
|
-
"requires": {
|
|
296
|
-
"allowFullScreen": true
|
|
297
|
-
}
|
|
298
|
-
},
|
|
299
292
|
"enableSortingRemoval": {
|
|
300
293
|
"requires": {
|
|
301
294
|
"enableSorting": true
|
|
@@ -23,7 +23,6 @@ export { default as AdvancedTableTablePropsStickyHeader } from './_advanced_tabl
|
|
|
23
23
|
export { default as AdvancedTableColumnHeadersCustomCell } from './_advanced_table_column_headers_custom_cell.jsx'
|
|
24
24
|
export { default as AdvancedTableColumnHeadersVerticalBorder } from './_advanced_table_column_headers_vertical_border.jsx'
|
|
25
25
|
export { default as AdvancedTableInlineEditing } from './_advanced_table_inline_editing.jsx'
|
|
26
|
-
export { default as AdvancedTableFullscreen } from './_advanced_table_fullscreen.jsx'
|
|
27
26
|
export { default as AdvancedTableStickyColumns } from './_advanced_table_sticky_columns.jsx'
|
|
28
27
|
export { default as AdvancedTableStickyHeader } from './_advanced_table_sticky_header.jsx'
|
|
29
28
|
export { default as AdvancedTableStickyColumnsAndHeader } from './_advanced_table_sticky_columns_and_header.jsx'
|
|
@@ -274,18 +274,6 @@
|
|
|
274
274
|
"react"
|
|
275
275
|
]
|
|
276
276
|
},
|
|
277
|
-
"allowFullScreen": {
|
|
278
|
-
"type": "boolean",
|
|
279
|
-
"platforms": [
|
|
280
|
-
"react"
|
|
281
|
-
]
|
|
282
|
-
},
|
|
283
|
-
"fullScreenControl": {
|
|
284
|
-
"type": "function",
|
|
285
|
-
"platforms": [
|
|
286
|
-
"react"
|
|
287
|
-
]
|
|
288
|
-
},
|
|
289
277
|
"enableSorting": {
|
|
290
278
|
"type": "boolean",
|
|
291
279
|
"platforms": [
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
button_color = row_style&.[](:expand_button_color)
|
|
4
4
|
bg_color = row_style&.[](:background_color)
|
|
5
5
|
font_color = row_style&.[](:font_color)
|
|
6
|
-
font_weight = row_style&.[](:font_weight)
|
|
7
6
|
tr_options = (object.html_options || {}).stringify_keys
|
|
8
7
|
tr_options["class"] = [tr_options["class"], object.classname].reject(&:blank?).join(" ")
|
|
9
8
|
%>
|
|
@@ -15,7 +14,7 @@
|
|
|
15
14
|
<% end %>
|
|
16
15
|
<% object.column_definitions.each_with_index do |column, index| %>
|
|
17
16
|
<% next unless column[:accessor].present? %>
|
|
18
|
-
<% component_info = object.cell_component_info(column, index, bg_color, font_color
|
|
17
|
+
<% component_info = object.cell_component_info(column, index, bg_color, font_color) %>
|
|
19
18
|
<%= pb_rails(component_info[:name], props: component_info[:props]) do %>
|
|
20
19
|
<%= pb_rails("flex", props:{ align: "center", justify: object.justify_for(column, index), classname: object.loading ? "loading-cell" : "" }) do %>
|
|
21
20
|
<% if collapsible_trail && index.zero? %>
|
|
@@ -107,10 +107,9 @@ module Playbook
|
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
# Uses a regular table/table_cell component if there is no custom background color; if there is a cell_background_color uses a background component with tag "td"
|
|
110
|
-
def cell_component_info(column, index, bg_color, font_color
|
|
110
|
+
def cell_component_info(column, index, bg_color, font_color)
|
|
111
111
|
column_font_color = cell_font_color(column)
|
|
112
112
|
effective_font_color = column_font_color || font_color
|
|
113
|
-
effective_font_weight = font_weight_value(font_weight)
|
|
114
113
|
|
|
115
114
|
if has_custom_background_color?(column)
|
|
116
115
|
custom_bg_color = cell_background_color(column)
|
|
@@ -120,15 +119,11 @@ module Playbook
|
|
|
120
119
|
tag: "td",
|
|
121
120
|
classname: td_classname(column, index),
|
|
122
121
|
}
|
|
123
|
-
|
|
124
|
-
style_hash[:color] = effective_font_color if effective_font_color.present?
|
|
125
|
-
style_hash[:"font-weight"] = effective_font_weight if effective_font_weight.present?
|
|
126
|
-
component_props[:html_options] = { style: style_hash } if style_hash.present?
|
|
122
|
+
component_props[:html_options] = { style: { color: effective_font_color } } if effective_font_color.present?
|
|
127
123
|
else
|
|
128
124
|
component_name = "table/table_cell"
|
|
129
125
|
style_hash = { "background-color": bg_color }
|
|
130
126
|
style_hash[:color] = effective_font_color if effective_font_color.present?
|
|
131
|
-
style_hash[:"font-weight"] = effective_font_weight if effective_font_weight.present?
|
|
132
127
|
component_props = {
|
|
133
128
|
html_options: {
|
|
134
129
|
style: style_hash,
|
|
@@ -221,15 +216,6 @@ module Playbook
|
|
|
221
216
|
end
|
|
222
217
|
end
|
|
223
218
|
|
|
224
|
-
def font_weight_value(font_weight)
|
|
225
|
-
case font_weight.to_s
|
|
226
|
-
when "bold"
|
|
227
|
-
"700"
|
|
228
|
-
when "regular"
|
|
229
|
-
"400"
|
|
230
|
-
end
|
|
231
|
-
end
|
|
232
|
-
|
|
233
219
|
private
|
|
234
220
|
|
|
235
221
|
def custom_renderer_value(column, index)
|