playbook_ui 16.8.0.pre.alpha.PLAY2965datepickerconsoleerrors16591 → 16.8.0.pre.alpha.PLAY2966draggablemobile16518
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 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -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/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 +1 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_react.md +1 -1
- 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_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/dist/chunks/vendor.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +5 -5
- 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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6ce05c1f63f5d67ded893b9cf4d8986264aeb095c29b00513d2d338c7d5252e2
|
|
4
|
+
data.tar.gz: e6b1628c4d294c560b9c7f2d88c13b82933323510b9eb1071be08fac93716412
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 93b22b8d43325f07d577dba4cce7e4af974844925c882a00d7e4749d842f0c51cc914e107f416d55ed0add9bfab27604759bc9e9620eb3d0dfcd34c2fa601dfc
|
|
7
|
+
data.tar.gz: 36213315af933db5f537794383c4430df58d1cc563a450e93e05160199ded6adf355f1c37d40853e6c2467ed08dddbf46cfaa3615b3b59c5bb5d055c8bc17fdb
|
|
@@ -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
|
}
|
|
@@ -80,7 +80,6 @@ examples:
|
|
|
80
80
|
- advanced_table_row_styling: Row Styling
|
|
81
81
|
- advanced_table_padding_control_per_row: Padding Control using Row Styling
|
|
82
82
|
- advanced_table_column_styling: Column Styling
|
|
83
|
-
- advanced_table_column_styling_width: Column Styling Width
|
|
84
83
|
- advanced_table_column_styling_column_headers: Column Styling with Multiple Headers
|
|
85
84
|
- advanced_table_column_styling_background: Column Styling Background Color
|
|
86
85
|
- advanced_table_column_styling_background_custom: Column Styling Background Color (Custom)
|
|
@@ -37,7 +37,6 @@ export { default as AdvancedTablePinnedRows } from './_advanced_table_pinned_row
|
|
|
37
37
|
export { default as AdvancedTableScrollbarNone} from './_advanced_table_scrollbar_none.jsx'
|
|
38
38
|
export { default as AdvancedTableRowStyling } from './_advanced_table_row_styling.jsx'
|
|
39
39
|
export { default as AdvancedTableColumnStyling } from './_advanced_table_column_styling.jsx'
|
|
40
|
-
export { default as AdvancedTableColumnStylingWidth } from './_advanced_table_column_styling_width.jsx'
|
|
41
40
|
export { default as AdvancedTableColumnStylingColumnHeaders } from './_advanced_table_column_styling_column_headers.jsx'
|
|
42
41
|
export { default as AdvancedTableInfiniteScroll} from './_advanced_table_infinite_scroll.jsx'
|
|
43
42
|
export {default as AdvancedTableWithCustomHeader} from './_advanced_table_with_custom_header.jsx'
|
|
@@ -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>
|
|
@@ -5,5 +5,3 @@ Use the `draggable` kit and manage state as shown.
|
|
|
5
5
|
`draggable/draggable_container` kit creates the container within which the cards can be dragged and dropped.
|
|
6
6
|
|
|
7
7
|
The Card kit is optimized to work with the draggable kit. To enable drag, use the `draggable_item` and `drag_id` props on the Card kit as shown. An additional optional boolean prop (set to true by default) of `drag_handle` is also available to show the drag handle icon.
|
|
8
|
-
|
|
9
|
-
On touch devices, drag from the grip handle (no long press). Swiping the card body scrolls as usual. Keep `drag_handle` enabled on mobile. Desktop mouse drag is unchanged.
|
|
@@ -6,5 +6,4 @@ Use `DraggableProvider` and manage state as shown.
|
|
|
6
6
|
|
|
7
7
|
The Card kit is optimized to work with the draggable kit. To enable drag, use the `draggableItem` and `dragId` props on the Card kit as shown. An additional optional boolean prop (set to true by default) of `dragHandle` is also available to show the drag handle icon.
|
|
8
8
|
|
|
9
|
-
On touch devices, drag from the grip handle (no long press). Swiping the card body scrolls as usual. Keep `dragHandle` enabled on mobile. Desktop mouse drag is unchanged.
|
|
10
9
|
|
|
@@ -4,4 +4,4 @@ The List kit is optimized to work with the draggable kit. To enable drag, use th
|
|
|
4
4
|
|
|
5
5
|
An additional optional boolean prop (set to true by default) of `drag_handle` is also available on ListItem kit to show the drag handle icon.
|
|
6
6
|
|
|
7
|
-
On touch devices,
|
|
7
|
+
On touch devices (phones and tablets), reordering is started from the grip handle only. Touch the grip and move slightly to drag; you do not need a long press. Touching and swiping the rest of the list row scrolls the page as usual. Keep `drag_handle` enabled on mobile so users have a clear drag target separate from scroll. Desktop mouse drag is unchanged.
|
|
@@ -4,4 +4,4 @@ Use `DraggableProvider` and manage state as shown.
|
|
|
4
4
|
|
|
5
5
|
The List kit is optimized to work with the draggable kit. To enable drag, use the `enableDrag` prop on List kit AND `dragId` prop on ListItem. An additional optional boolean prop (set to true by default) of `dragHandle` is also available on ListItem to show the drag handle icon.
|
|
6
6
|
|
|
7
|
-
On touch devices,
|
|
7
|
+
On touch devices (phones and tablets), reordering is started from the grip handle only. Touch the grip and move slightly to drag; you do not need a long press. Touching and swiping the rest of the list row scrolls the page as usual. Keep `dragHandle` enabled on mobile so users have a clear drag target separate from scroll. Desktop mouse drag is unchanged.
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
For a simplified version of the Draggable API for the SelectableList kit, you can do the following:
|
|
2
2
|
|
|
3
|
-
The SelectableList kit is optimized to work with the draggable kit. To enable drag, use the `enable_drag` prop on SelectableList kit AND `drag_id` prop within the SelectableList kit prop. An additional optional boolean prop (set to true by default) of `drag_handle` is also available on SelectableList kit to show the drag handle icon.
|
|
4
|
-
|
|
5
|
-
On touch devices, drag from the grip handle (no long press). Swiping the rest of the row scrolls as usual. Keep `drag_handle` enabled on mobile. Desktop mouse drag is unchanged.
|
|
3
|
+
The SelectableList kit is optimized to work with the draggable kit. To enable drag, use the `enable_drag` prop on SelectableList kit AND `drag_id` prop within the SelectableList kit prop. An additional optional boolean prop (set to true by default) of `drag_handle` is also available on SelectableList kit to show the drag handle icon.
|
|
@@ -2,6 +2,4 @@ For a simplified version of the Draggable API for the SelectableList kit, you ca
|
|
|
2
2
|
|
|
3
3
|
Use `DraggableProvider` and manage state as shown.
|
|
4
4
|
|
|
5
|
-
The SelectableList kit is optimized to work with the draggable kit. To enable drag, use the `enableDrag` prop on SelectableList kit AND `dragId` prop on SelectableList.Item. An additional optional boolean prop (set to true by default) of `dragHandle` is also available on SelectableList kit to show the drag handle icon.
|
|
6
|
-
|
|
7
|
-
On touch devices, drag from the grip handle (no long press). Swiping the rest of the row scrolls as usual. Keep `dragHandle` enabled on mobile. Desktop mouse drag is unchanged.
|
|
5
|
+
The SelectableList kit is optimized to work with the draggable kit. To enable drag, use the `enableDrag` prop on SelectableList kit AND `dragId` prop on SelectableList.Item. An additional optional boolean prop (set to true by default) of `dragHandle` is also available on SelectableList kit to show the drag handle icon.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= pb_rails("icon", props: { icon: "powergon", font_style: "fak", fixed_width: true, size: "5x" }) %>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import Icon from '../_icon'
|
|
4
|
+
|
|
5
|
+
import '../../../../../../playbook-website/app/javascript/scripts/custom-icons'
|
|
6
|
+
|
|
7
|
+
const IconFaKit = (props) => {
|
|
8
|
+
return (
|
|
9
|
+
<div>
|
|
10
|
+
<Icon
|
|
11
|
+
{...props}
|
|
12
|
+
fixedWidth
|
|
13
|
+
fontStyle="fak"
|
|
14
|
+
icon="powergon"
|
|
15
|
+
size="5x"
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default IconFaKit
|