playbook_ui 16.8.0.pre.alpha.PLAY2935formbuilderrequiredindicatorbug16780 → 16.8.0.pre.alpha.PLAY2945selectformblankselection16424
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 +0 -2
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +0 -2
- data/app/pb_kits/playbook/pb_advanced_table/Components/VirtualizedTableView.tsx +1 -5
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +0 -24
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +0 -144
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.jsx +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.md +0 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.jsx +4 -12
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.md +0 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.html.erb +2 -16
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.md +0 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.html.erb +2 -16
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.jsx +5 -12
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md +0 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md +3 -5
- data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.json +2 -5
- data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.overrides.json +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_column_definitions_styling.json +1 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_card/_card.tsx +1 -1
- data/app/pb_kits/playbook/pb_card/card.html.erb +1 -1
- data/app/pb_kits/playbook/pb_currency/_currency.tsx +6 -9
- data/app/pb_kits/playbook/pb_currency/currency.rb +10 -5
- data/app/pb_kits/playbook/pb_currency/currency.test.js +1 -44
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +21 -36
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_dialog_submission.jsx +2 -2
- data/app/pb_kits/playbook/pb_draggable/_draggable.scss +0 -19
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.md +0 -2
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_react.md +0 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.md +0 -2
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_react.md +1 -3
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.md +1 -3
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_react.md +1 -3
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +0 -16
- data/app/pb_kits/playbook/pb_draggable/draggable_container.html.erb +1 -3
- data/app/pb_kits/playbook/pb_draggable/draggable_item.html.erb +0 -1
- data/app/pb_kits/playbook/pb_draggable/index.js +7 -149
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +0 -1
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableItem.tsx +1 -67
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_select_examples.html.erb +31 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_with_required_indicator.html.erb +19 -20
- data/app/pb_kits/playbook/pb_form/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_icon/_icon.scss +1 -2
- data/app/pb_kits/playbook/pb_icon/docs/_icon_fa_kit.html.erb +1 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_fa_kit.jsx +21 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_fa_kit.md +7 -0
- data/app/pb_kits/playbook/pb_icon/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_icon/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_list/_list_item.tsx +1 -4
- data/app/pb_kits/playbook/pb_list/item.html.erb +1 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky.html.erb +83 -85
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky.jsx +86 -88
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky.md +1 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_external_filter_rails.md +1 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +0 -37
- data/dist/chunks/{_typeahead-DA__Kgp5.js → _typeahead-D2TWdJTn.js} +1 -1
- data/dist/chunks/vendor.js +2 -2
- data/dist/menu.yml +130 -70
- 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/forms/builder/collection_select_field.rb +1 -1
- data/lib/playbook/forms/builder/form_field_builder.rb +0 -2
- data/lib/playbook/forms/builder/select_field.rb +1 -1
- data/lib/playbook/forms/builder/time_zone_select_field.rb +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +8 -16
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/ColumnLayoutHelper.ts +0 -138
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_width.jsx +0 -57
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_width.md +0 -66
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_enable_toggle_expansion_rails.html.erb +0 -62
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_enable_toggle_expansion_rails.md +0 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_scroll_limitation.jsx +0 -68
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_scroll_limitation.md +0 -7
- data/app/pb_kits/playbook/pb_draggable/touchDrag.test.js +0 -38
- data/app/pb_kits/playbook/pb_draggable/utilities/touchDrag.ts +0 -173
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_centered_data.html.erb +0 -90
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_centered_data.jsx +0 -100
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_centered_data.md +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 051d8585a19ec6dbe0ad7a956006391f137fab3699a87ecdd8a72a31d064b581
|
|
4
|
+
data.tar.gz: 3abce6f7201b7db708d4fac79487a115f66827daa30a4cea1a0af61575309229
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c0974744f65ce5e1ec6baa822ed4adc1e763eedfc85c470e8ba7181c3651a4a685d45c4cfb93082558de059d7744438f2ce82929ebc5a9c04023b1105c0935d0
|
|
7
|
+
data.tar.gz: 44d6e614f5dcc91a0e7bbfd1a2e85a28e98c8e14994aac336d2cb3b3efccbed609706057455888cc4ad36fa76fbe11c6c4e06121cc8f35b4725b77b1f90a2a11
|
|
@@ -5,7 +5,6 @@ import { flexRender, Row, Cell } from "@tanstack/react-table"
|
|
|
5
5
|
import { GenericObject } from "../../types"
|
|
6
6
|
import { isChrome } from "../Utilities/BrowserCheck"
|
|
7
7
|
import { findColumnDefByAccessor } from "../Utilities/ColumnStylingHelper"
|
|
8
|
-
import { playbookColumnLayoutStylesFromMeta } from "../Utilities/ColumnLayoutHelper"
|
|
9
8
|
import { getRowColorClass, shouldShowLoadingIndicator } from "../Utilities/RowUtils"
|
|
10
9
|
|
|
11
10
|
import LoadingInline from "../../pb_loading_inline/_loading_inline"
|
|
@@ -95,7 +94,6 @@ const TableCellRenderer = ({
|
|
|
95
94
|
)}
|
|
96
95
|
key={`${cell.id}-data`}
|
|
97
96
|
style={{
|
|
98
|
-
...playbookColumnLayoutStylesFromMeta(column.columnDef),
|
|
99
97
|
left: isPinnedLeft
|
|
100
98
|
? i === 1 // Accounting for set min-width for first column
|
|
101
99
|
? '180px'
|
|
@@ -16,7 +16,6 @@ import { SortIconButton } from "./SortIconButton"
|
|
|
16
16
|
import { ToggleIconButton } from "./ToggleIconButton"
|
|
17
17
|
import { displayIcon } from "../Utilities/IconHelpers"
|
|
18
18
|
import { findColumnDefByAccessor } from "../Utilities/ColumnStylingHelper"
|
|
19
|
-
import { playbookColumnLayoutStylesFromMeta } from "../Utilities/ColumnLayoutHelper"
|
|
20
19
|
import { updateExpandAndCollapseState } from "../Utilities/ExpansionControlHelpers"
|
|
21
20
|
|
|
22
21
|
import { isChrome } from "../Utilities/BrowserCheck"
|
|
@@ -199,7 +198,6 @@ const isToggleExpansionEnabled =
|
|
|
199
198
|
id={cellId}
|
|
200
199
|
key={`${header?.id}-header`}
|
|
201
200
|
style={{
|
|
202
|
-
...playbookColumnLayoutStylesFromMeta(header?.column?.columnDef),
|
|
203
201
|
backgroundColor: headerBackgroundColor,
|
|
204
202
|
color: headerFontColor,
|
|
205
203
|
left: isPinnedLeft
|
|
@@ -19,7 +19,6 @@ import { LoadingCell } from "../Components/LoadingCell"
|
|
|
19
19
|
import { renderCollapsibleTrail } from "../Components/CollapsibleTrail"
|
|
20
20
|
|
|
21
21
|
import AdvancedTableContext from "../Context/AdvancedTableContext"
|
|
22
|
-
import { playbookColumnLayoutStylesFromMeta } from "../Utilities/ColumnLayoutHelper"
|
|
23
22
|
|
|
24
23
|
type VirtualizedTableViewProps = {
|
|
25
24
|
collapsibleTrail?: boolean
|
|
@@ -225,10 +224,7 @@ export const VirtualizedTableView = ({
|
|
|
225
224
|
isLastCell && 'last-cell',
|
|
226
225
|
)}
|
|
227
226
|
key={`${cell.id}-data`}
|
|
228
|
-
style={{
|
|
229
|
-
...playbookColumnLayoutStylesFromMeta(cell.column.columnDef),
|
|
230
|
-
width: cellWidth,
|
|
231
|
-
}}
|
|
227
|
+
style={{ width: cellWidth }}
|
|
232
228
|
>
|
|
233
229
|
{collapsibleTrail && i === 0 && row.depth > 0 && renderCollapsibleTrail(row.depth)}
|
|
234
230
|
<span id={`${cell.id}-span`}>
|
|
@@ -12,10 +12,6 @@ import {
|
|
|
12
12
|
import { GenericObject } from "../../types";
|
|
13
13
|
import { createColumnHelper } from "@tanstack/react-table";
|
|
14
14
|
import { createCellFunction } from "../Utilities/CellRendererUtils";
|
|
15
|
-
import {
|
|
16
|
-
buildPlaybookColumnLayoutStyles,
|
|
17
|
-
buildTanStackSizingFromColumn,
|
|
18
|
-
} from "../Utilities/ColumnLayoutHelper";
|
|
19
15
|
import { getParentOnlySortedRowModel } from "../Utilities/RowModelUtils";
|
|
20
16
|
|
|
21
17
|
interface UseTableStateProps {
|
|
@@ -109,31 +105,11 @@ export function useTableState({
|
|
|
109
105
|
columns: buildColumns(column.columns, false),
|
|
110
106
|
};
|
|
111
107
|
}
|
|
112
|
-
const tanStackSizing = buildTanStackSizingFromColumn(column);
|
|
113
|
-
const layoutStyles = buildPlaybookColumnLayoutStyles(column, tanStackSizing);
|
|
114
|
-
const userMeta =
|
|
115
|
-
column.meta &&
|
|
116
|
-
typeof column.meta === "object" &&
|
|
117
|
-
!Array.isArray(column.meta)
|
|
118
|
-
? column.meta
|
|
119
|
-
: {};
|
|
120
|
-
const hasLayoutStyles =
|
|
121
|
-
layoutStyles.width !== undefined ||
|
|
122
|
-
layoutStyles.minWidth !== undefined ||
|
|
123
|
-
layoutStyles.maxWidth !== undefined;
|
|
124
|
-
|
|
125
108
|
// Define the base column structure
|
|
126
109
|
const columnStructure = {
|
|
127
110
|
...columnHelper.accessor(column.accessor, {
|
|
128
111
|
header: column.header ?? column.label ?? "",
|
|
129
112
|
enableSorting: isFirstColumn || column.enableSort === true,
|
|
130
|
-
...tanStackSizing,
|
|
131
|
-
meta: {
|
|
132
|
-
...userMeta,
|
|
133
|
-
...(hasLayoutStyles
|
|
134
|
-
? { playbookColumnLayoutStyles: layoutStyles }
|
|
135
|
-
: {}),
|
|
136
|
-
},
|
|
137
113
|
}),
|
|
138
114
|
};
|
|
139
115
|
|
|
@@ -774,150 +774,6 @@ test("columnStyling.cellPadding sets cell padding", () => {
|
|
|
774
774
|
expect(firstEnrollmentCell).toHaveClass('p_none')
|
|
775
775
|
});
|
|
776
776
|
|
|
777
|
-
test("columnStyling minWidth, width, and maxWidth apply to header and body cells", () => {
|
|
778
|
-
const styledColumnDefs = [
|
|
779
|
-
{
|
|
780
|
-
accessor: "year",
|
|
781
|
-
label: "Year",
|
|
782
|
-
cellAccessors: ["quarter", "month", "day"],
|
|
783
|
-
columnStyling: { minWidth: 240, width: 260, maxWidth: 400 },
|
|
784
|
-
},
|
|
785
|
-
{
|
|
786
|
-
accessor: "newEnrollments",
|
|
787
|
-
label: "New Enrollments",
|
|
788
|
-
},
|
|
789
|
-
{
|
|
790
|
-
accessor: "scheduledMeetings",
|
|
791
|
-
label: "Scheduled Meetings",
|
|
792
|
-
},
|
|
793
|
-
];
|
|
794
|
-
|
|
795
|
-
render(
|
|
796
|
-
<AdvancedTable
|
|
797
|
-
columnDefinitions={styledColumnDefs}
|
|
798
|
-
data={{ testid: testId }}
|
|
799
|
-
tableData={MOCK_DATA}
|
|
800
|
-
/>
|
|
801
|
-
);
|
|
802
|
-
|
|
803
|
-
const yearHeader = screen.getByText("Year").closest("th");
|
|
804
|
-
expect(yearHeader).toHaveStyle({ minWidth: "240px", width: "260px", maxWidth: "400px" });
|
|
805
|
-
|
|
806
|
-
const yearCell = screen.getAllByText("2021")[0].closest("td");
|
|
807
|
-
expect(yearCell).toHaveStyle({ minWidth: "240px", width: "260px", maxWidth: "400px" });
|
|
808
|
-
});
|
|
809
|
-
|
|
810
|
-
test("columnStyling width only locks minWidth and maxWidth to the same value", () => {
|
|
811
|
-
const styledColumnDefs = [
|
|
812
|
-
{
|
|
813
|
-
accessor: "year",
|
|
814
|
-
label: "Year",
|
|
815
|
-
cellAccessors: ["quarter", "month", "day"],
|
|
816
|
-
columnStyling: { width: 128 },
|
|
817
|
-
},
|
|
818
|
-
{
|
|
819
|
-
accessor: "newEnrollments",
|
|
820
|
-
label: "New Enrollments",
|
|
821
|
-
},
|
|
822
|
-
{
|
|
823
|
-
accessor: "scheduledMeetings",
|
|
824
|
-
label: "Scheduled Meetings",
|
|
825
|
-
},
|
|
826
|
-
];
|
|
827
|
-
|
|
828
|
-
render(
|
|
829
|
-
<AdvancedTable
|
|
830
|
-
columnDefinitions={styledColumnDefs}
|
|
831
|
-
data={{ testid: testId }}
|
|
832
|
-
tableData={MOCK_DATA}
|
|
833
|
-
/>
|
|
834
|
-
);
|
|
835
|
-
|
|
836
|
-
const yearHeader = screen.getByText("Year").closest("th");
|
|
837
|
-
expect(yearHeader).toHaveStyle({
|
|
838
|
-
width: "128px",
|
|
839
|
-
minWidth: "128px",
|
|
840
|
-
maxWidth: "128px",
|
|
841
|
-
});
|
|
842
|
-
});
|
|
843
|
-
|
|
844
|
-
test("columnDefinitions size only locks minSize and maxSize to the same value", () => {
|
|
845
|
-
const styledColumnDefs = [
|
|
846
|
-
{
|
|
847
|
-
accessor: "year",
|
|
848
|
-
label: "Year",
|
|
849
|
-
cellAccessors: ["quarter", "month", "day"],
|
|
850
|
-
},
|
|
851
|
-
{
|
|
852
|
-
accessor: "newEnrollments",
|
|
853
|
-
label: "New Enrollments",
|
|
854
|
-
size: 200,
|
|
855
|
-
},
|
|
856
|
-
{
|
|
857
|
-
accessor: "scheduledMeetings",
|
|
858
|
-
label: "Scheduled Meetings",
|
|
859
|
-
},
|
|
860
|
-
];
|
|
861
|
-
|
|
862
|
-
render(
|
|
863
|
-
<AdvancedTable
|
|
864
|
-
columnDefinitions={styledColumnDefs}
|
|
865
|
-
data={{ testid: testId }}
|
|
866
|
-
tableData={MOCK_DATA}
|
|
867
|
-
/>
|
|
868
|
-
);
|
|
869
|
-
|
|
870
|
-
const enrollmentsHeader = screen.getByText("New Enrollments").closest("th");
|
|
871
|
-
expect(enrollmentsHeader).toHaveStyle({
|
|
872
|
-
width: "200px",
|
|
873
|
-
minWidth: "200px",
|
|
874
|
-
maxWidth: "200px",
|
|
875
|
-
});
|
|
876
|
-
});
|
|
877
|
-
|
|
878
|
-
test("columnDefinitions size, minSize, and maxSize apply layout styles", () => {
|
|
879
|
-
const styledColumnDefs = [
|
|
880
|
-
{
|
|
881
|
-
accessor: "year",
|
|
882
|
-
label: "Year",
|
|
883
|
-
cellAccessors: ["quarter", "month", "day"],
|
|
884
|
-
},
|
|
885
|
-
{
|
|
886
|
-
accessor: "newEnrollments",
|
|
887
|
-
label: "New Enrollments",
|
|
888
|
-
size: 180,
|
|
889
|
-
minSize: 160,
|
|
890
|
-
maxSize: 320,
|
|
891
|
-
},
|
|
892
|
-
{
|
|
893
|
-
accessor: "scheduledMeetings",
|
|
894
|
-
label: "Scheduled Meetings",
|
|
895
|
-
},
|
|
896
|
-
];
|
|
897
|
-
|
|
898
|
-
render(
|
|
899
|
-
<AdvancedTable
|
|
900
|
-
columnDefinitions={styledColumnDefs}
|
|
901
|
-
data={{ testid: testId }}
|
|
902
|
-
tableData={MOCK_DATA}
|
|
903
|
-
/>
|
|
904
|
-
);
|
|
905
|
-
|
|
906
|
-
const enrollmentsHeader = screen.getByText("New Enrollments").closest("th");
|
|
907
|
-
expect(enrollmentsHeader).toHaveStyle({
|
|
908
|
-
width: "180px",
|
|
909
|
-
minWidth: "160px",
|
|
910
|
-
maxWidth: "320px",
|
|
911
|
-
});
|
|
912
|
-
|
|
913
|
-
const enrollmentsCell = screen.getAllByText("20")[0].closest("td");
|
|
914
|
-
expect(enrollmentsCell).toHaveStyle({
|
|
915
|
-
width: "180px",
|
|
916
|
-
minWidth: "160px",
|
|
917
|
-
maxWidth: "320px",
|
|
918
|
-
});
|
|
919
|
-
});
|
|
920
|
-
|
|
921
777
|
test("columnStyling.fontColor sets cell font color", () => {
|
|
922
778
|
const styledColumnDefs = [
|
|
923
779
|
{
|
|
@@ -6,10 +6,4 @@ The `columnStyling` prop is an optional item that can be used within `columnDefi
|
|
|
6
6
|
|
|
7
7
|
3) `fontColor`: This will allow you to control the font color for a given column.
|
|
8
8
|
|
|
9
|
-
4) Column width: optional keys on `columnStyling` are `minWidth`, `width`, and `maxWidth` (numbers = pixels; CSS strings allowed). This example sets `width` on Year for a fixed hierarchy column (see the width doc for `minWidth` and bands).
|
|
10
|
-
|
|
11
|
-
Fixed width: pass `width` only (or TanStack `size` only) and Playbook sets min and max to the same value automatically — you do not need all three for an exact width.
|
|
12
|
-
|
|
13
|
-
See [Column Styling: Width](https://playbook.powerapp.cloud/kits/advanced_table/react#column-styling-width) for the full guide (Playbook ↔ TanStack mapping, floor-only vs bands, and when to use one vs three values).
|
|
14
|
-
|
|
15
9
|
`columnStyling` can be used within the columnDefinition of all the columns or some of them, as shown. Each column has its own individual control in this way.
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import AdvancedTable from '../../pb_advanced_table/_advanced_table'
|
|
3
|
-
|
|
4
|
-
const tableData = Array.from({ length: 15 }, (_, index) => ({
|
|
5
|
-
year: String(2020 + index),
|
|
6
|
-
newEnrollments: String(20 + index),
|
|
7
|
-
scheduledMeetings: String(10 + index),
|
|
8
|
-
attendanceRate: `${50 + index}%`,
|
|
9
|
-
completedClasses: String(3 + index),
|
|
10
|
-
classCompletionRate: `${30 + index}%`,
|
|
11
|
-
graduatedStudents: String(19 + index),
|
|
12
|
-
}))
|
|
3
|
+
import MOCK_DATA from "./advanced_table_mock_data.json"
|
|
13
4
|
|
|
14
5
|
const AdvancedTableStickyHeader = (props) => {
|
|
15
6
|
const columnDefinitions = [
|
|
16
7
|
{
|
|
17
8
|
accessor: "year",
|
|
18
9
|
label: "Year",
|
|
10
|
+
cellAccessors: ["quarter", "month", "day"],
|
|
19
11
|
},
|
|
20
12
|
{
|
|
21
13
|
accessor: "newEnrollments",
|
|
@@ -48,11 +40,11 @@ const AdvancedTableStickyHeader = (props) => {
|
|
|
48
40
|
}
|
|
49
41
|
|
|
50
42
|
return (
|
|
51
|
-
<div
|
|
43
|
+
<div>
|
|
52
44
|
<AdvancedTable
|
|
53
45
|
columnDefinitions={columnDefinitions}
|
|
54
46
|
responsive="none"
|
|
55
|
-
tableData={
|
|
47
|
+
tableData={MOCK_DATA}
|
|
56
48
|
tableProps={tableProps}
|
|
57
49
|
{...props}
|
|
58
50
|
/>
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
The `TableProps` prop can also be used to render a sticky header for the Advanced Table.
|
|
2
2
|
|
|
3
|
-
This doc example uses a scroll container with flat rows so sticky behavior is visible in the docs without expanding subrows. Scroll inside the preview to see the header stick.
|
|
4
|
-
|
|
5
|
-
This example builds flat table data inline for the docs preview. For typical `tableData` setup, see [Default (Required Props)](/kits/advanced_table/default/react#advanced_table_default).
|
|
6
|
-
|
|
7
3
|
This doc example showcases how to set a sticky header for a nonresponsive table (see the `responsive` prop set to "none"). To achieve sticky header AND responsive functionality, see the "Sticky Header for Responsive Table" doc example below.
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.html.erb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
{
|
|
3
3
|
accessor: "year",
|
|
4
4
|
label: "Year",
|
|
5
|
+
cellAccessors: ["quarter", "month", "day"],
|
|
5
6
|
},
|
|
6
7
|
{
|
|
7
8
|
accessor: "newEnrollments",
|
|
@@ -29,19 +30,4 @@
|
|
|
29
30
|
}
|
|
30
31
|
] %>
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
{
|
|
34
|
-
year: (2020 + index).to_s,
|
|
35
|
-
id: (2020 + index).to_s,
|
|
36
|
-
newEnrollments: (20 + index).to_s,
|
|
37
|
-
scheduledMeetings: (10 + index).to_s,
|
|
38
|
-
attendanceRate: "#{50 + index}%",
|
|
39
|
-
completedClasses: (3 + index).to_s,
|
|
40
|
-
classCompletionRate: "#{30 + index}%",
|
|
41
|
-
graduatedStudents: (19 + index).to_s,
|
|
42
|
-
}
|
|
43
|
-
end %>
|
|
44
|
-
|
|
45
|
-
<div style="max-height: 320px; overflow-y: auto;">
|
|
46
|
-
<%= pb_rails("advanced_table", props: { id: "sticky_header_table", table_data: table_data, column_definitions: column_definitions, responsive: "none", table_props: { sticky: true }}) %>
|
|
47
|
-
</div>
|
|
33
|
+
<%= pb_rails("advanced_table", props: { id: "sticky_header_table", table_data: @table_data, column_definitions: column_definitions, responsive: "none", table_props: { sticky: true }}) %>
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
The `table_props` prop can also be used to render a sticky header for the Advanced Table.
|
|
2
2
|
|
|
3
|
-
This doc example uses a scroll container with flat rows so sticky behavior is visible in the docs without expanding subrows. Scroll inside the preview to see the header stick.
|
|
4
|
-
|
|
5
|
-
This example builds flat table data inline for the docs preview. For typical `table_data` setup, see [Default (Required Props)](/kits/advanced_table/default/rails#advanced_table_beta).
|
|
6
|
-
|
|
7
3
|
This doc example showcases how to set a sticky header for a nonresponsive table (see the `responsive` prop set to "none"). To achieve sticky header AND responsive functionality, see the "[Sticky Header for Responsive Table](https://playbook.powerapp.cloud/kits/advanced_table/react#sticky-header-for-responsive-table)" doc example below.
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.html.erb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
{
|
|
3
3
|
accessor: "year",
|
|
4
4
|
label: "Year",
|
|
5
|
+
cellAccessors: ["quarter", "month", "day"],
|
|
5
6
|
},
|
|
6
7
|
{
|
|
7
8
|
accessor: "newEnrollments",
|
|
@@ -29,19 +30,4 @@
|
|
|
29
30
|
}
|
|
30
31
|
] %>
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
{
|
|
34
|
-
year: (2020 + index).to_s,
|
|
35
|
-
id: (2020 + index).to_s,
|
|
36
|
-
newEnrollments: (20 + index).to_s,
|
|
37
|
-
scheduledMeetings: (10 + index).to_s,
|
|
38
|
-
attendanceRate: "#{50 + index}%",
|
|
39
|
-
completedClasses: (3 + index).to_s,
|
|
40
|
-
classCompletionRate: "#{30 + index}%",
|
|
41
|
-
graduatedStudents: (19 + index).to_s,
|
|
42
|
-
}
|
|
43
|
-
end %>
|
|
44
|
-
|
|
45
|
-
<div style="max-height: 320px; overflow-y: auto;">
|
|
46
|
-
<%= pb_rails("advanced_table", props: { id: "table_props_sticky_table", table_data: table_data, column_definitions: column_definitions, table_props: { sticky: true }}) %>
|
|
47
|
-
</div>
|
|
33
|
+
<%= pb_rails("advanced_table", props: { id: "table_props_sticky_table", table_data: @table_data, column_definitions: column_definitions, max_height: "xs", table_props: { sticky: true }}) %>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.jsx
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import AdvancedTable from '../../pb_advanced_table/_advanced_table'
|
|
3
|
-
|
|
4
|
-
const tableData = Array.from({ length: 15 }, (_, index) => ({
|
|
5
|
-
year: String(2020 + index),
|
|
6
|
-
newEnrollments: String(20 + index),
|
|
7
|
-
scheduledMeetings: String(10 + index),
|
|
8
|
-
attendanceRate: `${50 + index}%`,
|
|
9
|
-
completedClasses: String(3 + index),
|
|
10
|
-
classCompletionRate: `${30 + index}%`,
|
|
11
|
-
graduatedStudents: String(19 + index),
|
|
12
|
-
}))
|
|
3
|
+
import MOCK_DATA from "./advanced_table_mock_data.json"
|
|
13
4
|
|
|
14
5
|
const AdvancedTableTablePropsStickyHeader = (props) => {
|
|
15
6
|
const columnDefinitions = [
|
|
16
7
|
{
|
|
17
8
|
accessor: "year",
|
|
18
9
|
label: "Year",
|
|
10
|
+
cellAccessors: ["quarter", "month", "day"],
|
|
19
11
|
},
|
|
20
12
|
{
|
|
21
13
|
accessor: "newEnrollments",
|
|
@@ -48,10 +40,11 @@ const AdvancedTableTablePropsStickyHeader = (props) => {
|
|
|
48
40
|
}
|
|
49
41
|
|
|
50
42
|
return (
|
|
51
|
-
<div
|
|
43
|
+
<div>
|
|
52
44
|
<AdvancedTable
|
|
53
45
|
columnDefinitions={columnDefinitions}
|
|
54
|
-
|
|
46
|
+
maxHeight="xs"
|
|
47
|
+
tableData={MOCK_DATA}
|
|
55
48
|
tableProps={tableProps}
|
|
56
49
|
{...props}
|
|
57
50
|
/>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md
CHANGED
|
@@ -2,10 +2,6 @@ Create a sticky header that works for responsive Advanced Tables by setting `sti
|
|
|
2
2
|
|
|
3
3
|
**NOTE**: This behavior requires a `max_height` to work. The header is sticky within the table container, allowing for it to work along with the first column stickiness of a responsive table on smaller screen sizes.
|
|
4
4
|
|
|
5
|
-
Scroll inside the table preview to see the header stick.
|
|
6
|
-
|
|
7
|
-
This example builds flat table data inline for the docs preview. For typical `table_data` setup, see [Default (Required Props)](/kits/advanced_table/default/rails#advanced_table_beta).
|
|
8
|
-
|
|
9
5
|
Expand the table above to see this in action.
|
|
10
6
|
|
|
11
7
|
A sticky header on a nonresponsive table is demonstrated in the ["Sticky Header"](https://playbook.powerapp.cloud/kits/advanced_table#sticky-header) doc example above.
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `tableProps` and
|
|
1
|
+
Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `tableProps` and giving the AdvancedTable a `maxHeight` using our [Max Height](https://playbook.powerapp.cloud/global_props/max_height) global prop.
|
|
2
2
|
|
|
3
|
-
**NOTE**: The header is sticky within the table
|
|
3
|
+
**NOTE**: This behavior requires a `maxHeight` to work. The header is sticky within the table container, allowing for it to work along with the first column stickiness of a responsive table on smaller screen sizes.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Expand the table above to see responsive behavior in action.
|
|
5
|
+
Expand the table above to see this in action.
|
|
8
6
|
|
|
9
7
|
A sticky header on a nonresponsive table is demonstrated in the ["Sticky Header"](https://playbook.powerapp.cloud/kits/advanced_table/react#sticky-header) doc example above.
|
|
@@ -313,7 +313,7 @@
|
|
|
313
313
|
},
|
|
314
314
|
"column_styling_info": {
|
|
315
315
|
"presetName": "Column Styling",
|
|
316
|
-
"message": "This sample uses columnStyling on column definitions.
|
|
316
|
+
"message": "This sample uses columnStyling on column definitions. You can style headers and cells for the whole table or per column.",
|
|
317
317
|
"type": "info"
|
|
318
318
|
}
|
|
319
319
|
},
|
|
@@ -2628,10 +2628,7 @@
|
|
|
2628
2628
|
"quarter",
|
|
2629
2629
|
"month",
|
|
2630
2630
|
"day"
|
|
2631
|
-
]
|
|
2632
|
-
"columnStyling": {
|
|
2633
|
-
"width": 124
|
|
2634
|
-
}
|
|
2631
|
+
]
|
|
2635
2632
|
},
|
|
2636
2633
|
{
|
|
2637
2634
|
"accessor": "newEnrollments",
|
|
@@ -371,7 +371,7 @@
|
|
|
371
371
|
},
|
|
372
372
|
"column_styling_info": {
|
|
373
373
|
"presetName": "Column Styling",
|
|
374
|
-
"message": "This sample uses columnStyling on column definitions.
|
|
374
|
+
"message": "This sample uses columnStyling on column definitions. You can style headers and cells for the whole table or per column.",
|
|
375
375
|
"type": "info"
|
|
376
376
|
}
|
|
377
377
|
}
|
|
@@ -3,7 +3,6 @@ examples:
|
|
|
3
3
|
- advanced_table_beta: Default (Required Props)
|
|
4
4
|
- advanced_table_loading: Loading State
|
|
5
5
|
- advanced_table_beta_subrow_headers: SubRow Headers
|
|
6
|
-
- advanced_table_enable_toggle_expansion_rails: Enable Toggle Expansion
|
|
7
6
|
- advanced_table_collapsible_trail_rails: Collapsible Trail
|
|
8
7
|
- advanced_table_table_props: Table Props
|
|
9
8
|
- advanced_table_sticky_header_rails: Sticky Header
|
|
@@ -53,7 +52,6 @@ examples:
|
|
|
53
52
|
- advanced_table_table_props_sticky_header: Sticky Header for Responsive Table
|
|
54
53
|
- advanced_table_sticky_columns: Sticky Columns
|
|
55
54
|
- advanced_table_sticky_columns_and_header: Sticky Columns with Sticky Header
|
|
56
|
-
- advanced_table_sticky_scroll_limitation: Sticky Header and Column Scroll Limitation
|
|
57
55
|
- advanced_table_responsive: Responsive Tables
|
|
58
56
|
- advanced_table_custom_cell: Custom Components for Cells
|
|
59
57
|
- advanced_table_with_custom_header: Custom Header Cell
|
|
@@ -82,7 +80,6 @@ examples:
|
|
|
82
80
|
- advanced_table_row_styling: Row Styling
|
|
83
81
|
- advanced_table_padding_control_per_row: Padding Control using Row Styling
|
|
84
82
|
- advanced_table_column_styling: Column Styling
|
|
85
|
-
- advanced_table_column_styling_width: Column Styling Width
|
|
86
83
|
- advanced_table_column_styling_column_headers: Column Styling with Multiple Headers
|
|
87
84
|
- advanced_table_column_styling_background: Column Styling Background Color
|
|
88
85
|
- advanced_table_column_styling_background_custom: Column Styling Background Color (Custom)
|
|
@@ -27,7 +27,6 @@ export { default as AdvancedTableFullscreen } from './_advanced_table_fullscreen
|
|
|
27
27
|
export { default as AdvancedTableStickyColumns } from './_advanced_table_sticky_columns.jsx'
|
|
28
28
|
export { default as AdvancedTableStickyHeader } from './_advanced_table_sticky_header.jsx'
|
|
29
29
|
export { default as AdvancedTableStickyColumnsAndHeader } from './_advanced_table_sticky_columns_and_header.jsx'
|
|
30
|
-
export { default as AdvancedTableStickyScrollLimitation } from './_advanced_table_sticky_scroll_limitation.jsx'
|
|
31
30
|
export { default as AdvancedTableExpandByDepth } from './_advanced_table_expand_by_depth.jsx'
|
|
32
31
|
export { default as AdvancedTableColumnBorderColor} from './_advanced_table_column_border_color.jsx'
|
|
33
32
|
export { default as AdvancedTableColumnVisibility } from './_advanced_table_column_visibility.jsx'
|
|
@@ -38,7 +37,6 @@ export { default as AdvancedTablePinnedRows } from './_advanced_table_pinned_row
|
|
|
38
37
|
export { default as AdvancedTableScrollbarNone} from './_advanced_table_scrollbar_none.jsx'
|
|
39
38
|
export { default as AdvancedTableRowStyling } from './_advanced_table_row_styling.jsx'
|
|
40
39
|
export { default as AdvancedTableColumnStyling } from './_advanced_table_column_styling.jsx'
|
|
41
|
-
export { default as AdvancedTableColumnStylingWidth } from './_advanced_table_column_styling_width.jsx'
|
|
42
40
|
export { default as AdvancedTableColumnStylingColumnHeaders } from './_advanced_table_column_styling_column_headers.jsx'
|
|
43
41
|
export { default as AdvancedTableInfiniteScroll} from './_advanced_table_infinite_scroll.jsx'
|
|
44
42
|
export {default as AdvancedTableWithCustomHeader} from './_advanced_table_with_custom_header.jsx'
|
|
@@ -162,7 +162,7 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
|
162
162
|
{
|
|
163
163
|
dragHandle ? (
|
|
164
164
|
<Flex>
|
|
165
|
-
<span className="card_draggable_handle
|
|
165
|
+
<span className="card_draggable_handle">
|
|
166
166
|
<Icon
|
|
167
167
|
icon="grip-dots-vertical"
|
|
168
168
|
paddingRight="xs"
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<% if object.draggable_item %>
|
|
5
5
|
<%= pb_rails("flex", props: { align: "center" }) do %>
|
|
6
6
|
<% if object.drag_handle %>
|
|
7
|
-
<span
|
|
7
|
+
<span classname="card_draggable_handle">
|
|
8
8
|
<%= pb_rails("icon", props: { icon: "grip-dots-vertical", padding_right: "xs" }) %>
|
|
9
9
|
</span>
|
|
10
10
|
<% end %>
|
|
@@ -59,13 +59,12 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
|
|
|
59
59
|
commaSeparator = false,
|
|
60
60
|
} = props
|
|
61
61
|
|
|
62
|
-
const isAmountEmpty = (value: string | number): boolean => (
|
|
63
|
-
value === '' || value == null || (typeof value === 'string' && value.trim() === '')
|
|
64
|
-
)
|
|
65
|
-
|
|
66
62
|
// Convert numeric input to string format
|
|
67
63
|
const convertAmount = (input: string | number): string => {
|
|
68
64
|
if (typeof input === 'number') {
|
|
65
|
+
if (input === 0 && !nullDisplay) {
|
|
66
|
+
return ""
|
|
67
|
+
}
|
|
69
68
|
return input.toFixed(2)
|
|
70
69
|
}
|
|
71
70
|
return input
|
|
@@ -82,9 +81,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
|
|
|
82
81
|
variantClass = '_bold'
|
|
83
82
|
}
|
|
84
83
|
|
|
85
|
-
const [
|
|
86
|
-
const decimal = (decimalPart || '00').padEnd(2, '0').slice(0, 2)
|
|
87
|
-
const whole = currencyAmount === '' ? '' : (wholePart === '' ? '0' : wholePart)
|
|
84
|
+
const [whole, decimal = '00'] = currencyAmount.split('.')
|
|
88
85
|
const ariaProps = buildAriaProps(aria)
|
|
89
86
|
const dataProps = buildDataProps(data)
|
|
90
87
|
const htmlProps = buildHtmlProps(htmlOptions)
|
|
@@ -138,7 +135,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
|
|
|
138
135
|
<Caption dark={dark}>{label}</Caption>
|
|
139
136
|
<div className={`pb_currency_wrapper${variantClass || emphasizedClass}`}>
|
|
140
137
|
{unstyled ? (
|
|
141
|
-
nullDisplay &&
|
|
138
|
+
nullDisplay && !amount ? (
|
|
142
139
|
<div>{nullDisplay}</div>
|
|
143
140
|
) : (
|
|
144
141
|
<>
|
|
@@ -151,7 +148,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
|
|
|
151
148
|
</>
|
|
152
149
|
)
|
|
153
150
|
) : (
|
|
154
|
-
nullDisplay &&
|
|
151
|
+
nullDisplay && !amount ? (
|
|
155
152
|
<Title
|
|
156
153
|
className="pb_currency_value"
|
|
157
154
|
dark={dark}
|