playbook_ui 16.8.0.pre.alpha.PLAY2979dropdownmlsportaling16743 → 16.8.0.pre.alpha.PLAY2996textinputaddondisabled16519
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/_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 -2
- 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_dialog/_dialog.scss +1 -54
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +5 -21
- data/app/pb_kits/playbook/pb_dialog/_dialog_context.tsx +2 -8
- data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx +1 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +1 -5
- data/app/pb_kits/playbook/pb_dialog/dialog.test.jsx +0 -90
- 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_dropdown/_dropdown.scss +0 -8
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +31 -101
- data/app/pb_kits/playbook/pb_dropdown/index.js +25 -256
- data/app/pb_kits/playbook/pb_dropdown/keyboard_accessibility.js +10 -9
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownContainer.tsx +2 -39
- 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_multi_level_select/_multi_level_select.scss +7 -7
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +10 -125
- 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_popover/_popover.scss +0 -27
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +14 -46
- data/app/pb_kits/playbook/pb_popover/index.ts +3 -25
- data/app/pb_kits/playbook/pb_popover/popover.html.erb +2 -5
- data/app/pb_kits/playbook/pb_popover/popover.test.js +5 -99
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_external_filter_rails.md +1 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +3 -111
- data/app/pb_kits/playbook/pb_typeahead/kit.schema.json +0 -6
- data/dist/chunks/{_pb_line_graph-CuB9ChGS.js → _pb_line_graph-BgsTI0CL.js} +1 -1
- data/dist/chunks/_typeahead-D2TWdJTn.js +5 -0
- data/dist/chunks/{globalProps-BKWYvlnQ.js → globalProps-DOB47YGB.js} +1 -1
- data/dist/chunks/lib-BzglXly2.js +29 -0
- data/dist/chunks/vendor.js +5 -5
- data/dist/menu.yml +1 -1
- 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 -17
- 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_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
- data/app/pb_kits/playbook/utilities/floatingPortalHosts.ts +0 -268
- data/dist/chunks/_typeahead-DFJPOzgb.js +0 -5
- data/dist/chunks/lib-BN42Ya2Q.js +0 -29
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c348f59ab52ef69c3ef59bc403d2668fb7f7a5a66a583de3a683226ac6283908
|
|
4
|
+
data.tar.gz: ddafa48bb94bcc9f78987d5e2975583f56dd5b0b3f6f00064c6a66e4f619c14f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ac9a07a6a307138d16eaea199f4c0f30fc9e0f95eec7a4c62f1d17a9ec20b73dcc8fc82f8ec820bb2c73c808de9ede099ccd45896836552bb199ff701ba8d218
|
|
7
|
+
data.tar.gz: 8e8d11eca1654fe9f5b54e296d2650cca8340d9d6e1590560260cef62ba1b268161ed6acc86dce7fcb7beec30fe9c6528a1e9eb35cebbd8782410aca3f2cc13a
|
|
@@ -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.
|
|
@@ -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
|
}
|
|
@@ -52,7 +52,6 @@ examples:
|
|
|
52
52
|
- advanced_table_table_props_sticky_header: Sticky Header for Responsive Table
|
|
53
53
|
- advanced_table_sticky_columns: Sticky Columns
|
|
54
54
|
- advanced_table_sticky_columns_and_header: Sticky Columns with Sticky Header
|
|
55
|
-
- advanced_table_sticky_scroll_limitation: Sticky Header and Column Scroll Limitation
|
|
56
55
|
- advanced_table_responsive: Responsive Tables
|
|
57
56
|
- advanced_table_custom_cell: Custom Components for Cells
|
|
58
57
|
- advanced_table_with_custom_header: Custom Header Cell
|
|
@@ -81,7 +80,6 @@ examples:
|
|
|
81
80
|
- advanced_table_row_styling: Row Styling
|
|
82
81
|
- advanced_table_padding_control_per_row: Padding Control using Row Styling
|
|
83
82
|
- advanced_table_column_styling: Column Styling
|
|
84
|
-
- advanced_table_column_styling_width: Column Styling Width
|
|
85
83
|
- advanced_table_column_styling_column_headers: Column Styling with Multiple Headers
|
|
86
84
|
- advanced_table_column_styling_background: Column Styling Background Color
|
|
87
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}
|
|
@@ -68,7 +68,7 @@ module Playbook
|
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
def title_text
|
|
71
|
-
if null_display
|
|
71
|
+
if null_display
|
|
72
72
|
null_display
|
|
73
73
|
elsif swap_negative
|
|
74
74
|
absolute_amount(abbr_or_format_amount)
|
|
@@ -125,7 +125,14 @@ module Playbook
|
|
|
125
125
|
# Convert numeric input to string format
|
|
126
126
|
def convert_amount(input)
|
|
127
127
|
if input.is_a?(Numeric)
|
|
128
|
-
|
|
128
|
+
if input.zero? && null_display.nil?
|
|
129
|
+
""
|
|
130
|
+
else
|
|
131
|
+
format("%.2f", input)
|
|
132
|
+
end
|
|
133
|
+
# Handle string representations of zero
|
|
134
|
+
elsif input.to_s.strip.match?(/^-?0+(\.0+)?$/) && null_display.nil?
|
|
135
|
+
""
|
|
129
136
|
else
|
|
130
137
|
input.to_s
|
|
131
138
|
end
|
|
@@ -135,7 +142,6 @@ module Playbook
|
|
|
135
142
|
return "" if currency_amount.blank?
|
|
136
143
|
|
|
137
144
|
value = currency_amount.split(".").first
|
|
138
|
-
value = "0" if value.blank?
|
|
139
145
|
if comma_separator
|
|
140
146
|
number_with_delimiter(value.gsub(",", ""))
|
|
141
147
|
else
|
|
@@ -146,8 +152,7 @@ module Playbook
|
|
|
146
152
|
def decimal_value
|
|
147
153
|
return "00" if currency_amount.blank?
|
|
148
154
|
|
|
149
|
-
|
|
150
|
-
fraction.ljust(2, "0")[0, 2]
|
|
155
|
+
currency_amount.split(".")[1] || "00"
|
|
151
156
|
end
|
|
152
157
|
|
|
153
158
|
def units_element
|
|
@@ -178,48 +178,5 @@ test('handles numeric amounts correctly', () => {
|
|
|
178
178
|
expect(screen.getByTestId('test-numeric-no-symbol')).toHaveTextContent('400.50')
|
|
179
179
|
expect(screen.getByTestId('test-numeric-medium-size')).toHaveTextContent('$500.55')
|
|
180
180
|
expect(screen.getByTestId('test-numeric-negative')).toHaveTextContent('-$600.70')
|
|
181
|
-
expect(screen.getByTestId('test-numeric-null')).toHaveTextContent('
|
|
182
|
-
})
|
|
183
|
-
|
|
184
|
-
test('renders zero values with leading digit', () => {
|
|
185
|
-
render(
|
|
186
|
-
<>
|
|
187
|
-
<Currency
|
|
188
|
-
amount="0"
|
|
189
|
-
data={{ testid: 'test-string-zero' }}
|
|
190
|
-
/>
|
|
191
|
-
<Currency
|
|
192
|
-
amount={0}
|
|
193
|
-
data={{ testid: 'test-numeric-zero' }}
|
|
194
|
-
/>
|
|
195
|
-
</>
|
|
196
|
-
)
|
|
197
|
-
|
|
198
|
-
expect(screen.getByTestId('test-string-zero')).toHaveTextContent('$0.00')
|
|
199
|
-
expect(screen.getByTestId('test-numeric-zero')).toHaveTextContent('$0.00')
|
|
200
|
-
})
|
|
201
|
-
|
|
202
|
-
test('normalizes string zero with single decimal digit to .00', () => {
|
|
203
|
-
render(
|
|
204
|
-
<Currency
|
|
205
|
-
amount="0.0"
|
|
206
|
-
commaSeparator
|
|
207
|
-
data={{ testid: 'test-string-zero-single-decimal' }}
|
|
208
|
-
/>
|
|
209
|
-
)
|
|
210
|
-
|
|
211
|
-
expect(screen.getByTestId('test-string-zero-single-decimal')).toHaveTextContent('$0.00')
|
|
212
|
-
})
|
|
213
|
-
|
|
214
|
-
test('nullDisplay only applies when amount is empty', () => {
|
|
215
|
-
render(
|
|
216
|
-
<Currency
|
|
217
|
-
amount="-.53"
|
|
218
|
-
data={{ testid: 'test-null-display-negative' }}
|
|
219
|
-
nullDisplay="$0.00"
|
|
220
|
-
/>
|
|
221
|
-
)
|
|
222
|
-
|
|
223
|
-
expect(screen.getByTestId('test-null-display-negative')).toHaveTextContent('-$')
|
|
224
|
-
expect(screen.getByTestId('test-null-display-negative')).not.toHaveTextContent('$0.00')
|
|
181
|
+
expect(screen.getByTestId('test-numeric-null')).toHaveTextContent('$.00')
|
|
225
182
|
})
|
|
@@ -79,57 +79,42 @@
|
|
|
79
79
|
|
|
80
80
|
<%= javascript_tag do %>
|
|
81
81
|
(function() {
|
|
82
|
-
const initQuickPickChangeListener = (input) => {
|
|
83
|
-
if (!<%= object.selection_type == "quickpick" %>) return
|
|
84
|
-
if (input.dataset.quickpickInitialized) return
|
|
85
|
-
|
|
86
|
-
input.dataset.quickpickInitialized = "true"
|
|
87
|
-
input.addEventListener("change", ({ target }) => {
|
|
88
|
-
const startDate = document.getElementById("<%= object.start_date_id %>")
|
|
89
|
-
const endDate = document.getElementById("<%= object.end_date_id %>")
|
|
90
|
-
const splittedValue = target.value.split(" to ")
|
|
91
|
-
startDate.value = splittedValue[0]
|
|
92
|
-
endDate.value = splittedValue[1] ? splittedValue[1] : splittedValue[0]
|
|
93
|
-
})
|
|
94
|
-
}
|
|
95
|
-
|
|
96
82
|
const loadDatePicker = () => {
|
|
97
|
-
const input = document.getElementById("<%= object.picker_id %>")
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (typeof window.datePickerHelper !== "function") return false
|
|
101
|
-
|
|
102
|
-
window.datePickerHelper(<%= object.date_picker_config %>, "<%= object.scroll_container %>")
|
|
103
|
-
initQuickPickChangeListener(input)
|
|
104
|
-
|
|
105
|
-
return true
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
let attempts = 0
|
|
109
|
-
const retryLoad = () => {
|
|
110
|
-
if (loadDatePicker()) return
|
|
83
|
+
const input = document.getElementById("<%= object.picker_id %>");
|
|
84
|
+
if (input && !input._flatpickr) {
|
|
85
|
+
datePickerHelper(<%= object.date_picker_config %>, "<%= object.scroll_container %>")
|
|
111
86
|
|
|
112
|
-
|
|
113
|
-
|
|
87
|
+
if (<%= object.selection_type == "quickpick" %>) {
|
|
88
|
+
document.getElementById("<%= object.picker_id %>").addEventListener("change", ({ target }) => {
|
|
89
|
+
const startDate = document.getElementById("<%= object.start_date_id %>")
|
|
90
|
+
const endDate = document.getElementById("<%= object.end_date_id %>")
|
|
91
|
+
const splittedValue = target.value.split(" to ")
|
|
92
|
+
startDate.value = splittedValue[0]
|
|
93
|
+
endDate.value = splittedValue[1] ? splittedValue[1] : splittedValue[0]
|
|
94
|
+
})
|
|
95
|
+
}
|
|
114
96
|
}
|
|
115
97
|
}
|
|
116
98
|
|
|
99
|
+
// Try to initialize immediately if DOM is ready
|
|
117
100
|
if (document.readyState === "loading") {
|
|
118
|
-
window.addEventListener("DOMContentLoaded",
|
|
101
|
+
window.addEventListener("DOMContentLoaded", loadDatePicker)
|
|
119
102
|
} else {
|
|
120
|
-
|
|
103
|
+
loadDatePicker()
|
|
121
104
|
}
|
|
122
105
|
|
|
123
106
|
// For dynamically added content (modals, etc.), check again after a brief delay
|
|
124
107
|
setTimeout(() => {
|
|
125
|
-
const input = document.getElementById("<%= object.picker_id %>")
|
|
108
|
+
const input = document.getElementById("<%= object.picker_id %>");
|
|
126
109
|
if (input && !input._flatpickr) {
|
|
127
|
-
|
|
110
|
+
loadDatePicker();
|
|
128
111
|
}
|
|
129
|
-
}, 100)
|
|
112
|
+
}, 100);
|
|
130
113
|
|
|
131
114
|
if (<%= !object.custom_event_type.empty? %>) {
|
|
132
|
-
window.addEventListener("<%= object.custom_event_type %>",
|
|
115
|
+
window.addEventListener("<%= object.custom_event_type %>", () => {
|
|
116
|
+
loadDatePicker()
|
|
117
|
+
})
|
|
133
118
|
}
|
|
134
119
|
})()
|
|
135
120
|
<% end %>
|
|
@@ -36,10 +36,10 @@ const DatePickerDialogSubmission = () => {
|
|
|
36
36
|
<Dialog.Body>
|
|
37
37
|
<DatePicker
|
|
38
38
|
defaultDate={dateFixed || undefined}
|
|
39
|
-
key={
|
|
39
|
+
key={`fixed-${pickerInstance}`}
|
|
40
40
|
label="Date"
|
|
41
41
|
onChange={(dateStr) => setDateFixed(dateStr || "")}
|
|
42
|
-
pickerId={
|
|
42
|
+
pickerId={`datePickerFixed-${pickerInstance}`}
|
|
43
43
|
staticPosition={false}
|
|
44
44
|
/>
|
|
45
45
|
</Dialog.Body>
|