playbook_ui 15.2.0.pre.alpha.play257911600 → 15.2.0.pre.alpha.testingquickpick11606
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/Hooks/useTableActions.ts +3 -18
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +14 -56
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +3 -9
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_quick_pick_styles.scss +11 -30
- data/dist/chunks/{_weekday_stacked-B3YOt9GF.js → _weekday_stacked-Bz13QeMW.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 071e859887ee48afce502eac1a48c4f29b0a0fb690ed3b155901e1b49fe61c1f
|
|
4
|
+
data.tar.gz: cea7576059a91fcde56648fa33efc682bce4b07295a289ae491d85b8259f0913
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '08c3fb4475d4bd060d52cf11dc402a73da972e7c0d718ddeed24a645f484d2789db10c69824da15bd33418c1c7fa96e3f545e8b2e247c1860fd0c5040641f78e'
|
|
7
|
+
data.tar.gz: 4e753ada93e3b1b41ae279c21aeaee58f5f5c8c750135c23156512bda499d4befd2187e91fb7beb62170e71fa4bd92cf33998759bbf421877ac734eae6e06177
|
|
@@ -9,9 +9,6 @@ interface UseTableActionsProps {
|
|
|
9
9
|
setExpanded: (expanded: GenericObject) => void;
|
|
10
10
|
onToggleExpansionClick?: (arg: Row<GenericObject>) => void;
|
|
11
11
|
onRowSelectionChange?: (rowSelection: any) => void;
|
|
12
|
-
inlineRowLoading?: boolean;
|
|
13
|
-
localPagination?: { pageIndex: number; pageSize: number };
|
|
14
|
-
setLocalPagination?: (pagination: { pageIndex: number; pageSize: number }) => void;
|
|
15
12
|
}
|
|
16
13
|
|
|
17
14
|
export function useTableActions({
|
|
@@ -19,10 +16,7 @@ export function useTableActions({
|
|
|
19
16
|
expanded,
|
|
20
17
|
setExpanded,
|
|
21
18
|
onToggleExpansionClick,
|
|
22
|
-
onRowSelectionChange
|
|
23
|
-
inlineRowLoading = false,
|
|
24
|
-
localPagination,
|
|
25
|
-
setLocalPagination
|
|
19
|
+
onRowSelectionChange
|
|
26
20
|
}: UseTableActionsProps) {
|
|
27
21
|
|
|
28
22
|
// State to achieve 1 second delay before fetching more rows
|
|
@@ -44,17 +38,8 @@ export function useTableActions({
|
|
|
44
38
|
|
|
45
39
|
// Handle pagination
|
|
46
40
|
const onPageChange = useCallback((page: number) => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
setLocalPagination({
|
|
50
|
-
...localPagination,
|
|
51
|
-
pageIndex: page - 1
|
|
52
|
-
});
|
|
53
|
-
} else {
|
|
54
|
-
// Use tanstack's built-in pagination
|
|
55
|
-
table.setPageIndex(page - 1);
|
|
56
|
-
}
|
|
57
|
-
}, [table, inlineRowLoading, setLocalPagination, localPagination]);
|
|
41
|
+
table.setPageIndex(page - 1);
|
|
42
|
+
}, [table]);
|
|
58
43
|
|
|
59
44
|
// Handle scroll detection for infinite scroll/virtualization
|
|
60
45
|
const fetchMoreOnBottomReached = useCallback((
|
|
@@ -35,7 +35,6 @@ interface UseTableStateProps {
|
|
|
35
35
|
onRowSelectionChange?: (arg: RowSelectionState) => void;
|
|
36
36
|
columnVisibilityControl?: GenericObject;
|
|
37
37
|
rowStyling?: GenericObject;
|
|
38
|
-
inlineRowLoading?: boolean;
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
export function useTableState({
|
|
@@ -54,8 +53,7 @@ export function useTableState({
|
|
|
54
53
|
tableOptions,
|
|
55
54
|
columnVisibilityControl,
|
|
56
55
|
pinnedRows,
|
|
57
|
-
rowStyling
|
|
58
|
-
inlineRowLoading = false
|
|
56
|
+
rowStyling
|
|
59
57
|
}: UseTableStateProps) {
|
|
60
58
|
|
|
61
59
|
// Create a local state for expanded and setExpanded if expandedControl not used
|
|
@@ -66,12 +64,6 @@ export function useTableState({
|
|
|
66
64
|
const [localRowPinning, setLocalRowPinning] = useState<RowPinningState>({
|
|
67
65
|
top: [],
|
|
68
66
|
});
|
|
69
|
-
// Manage local state to preserve current page index when inlineRowLoading is enabled so it does not boot table to page 1
|
|
70
|
-
// We can extend this for more usecases, but for now scoping it only for inlineRowLoading
|
|
71
|
-
const [localPagination, setLocalPagination] = useState({
|
|
72
|
-
pageIndex: paginationProps?.pageIndex ?? 0,
|
|
73
|
-
pageSize: paginationProps?.pageSize ?? 20,
|
|
74
|
-
});
|
|
75
67
|
// Determine whether to use the prop or the local state
|
|
76
68
|
const expanded = expandedControl ? expandedControl.value : localExpanded;
|
|
77
69
|
const setExpanded = expandedControl ? expandedControl.onChange : setLocalExpanded;
|
|
@@ -141,7 +133,6 @@ export function useTableState({
|
|
|
141
133
|
...(selectableRows && { rowSelection }),
|
|
142
134
|
...(columnVisibility && { columnVisibility }),
|
|
143
135
|
...(pinnedRows && { rowPinning }),
|
|
144
|
-
...(inlineRowLoading && { pagination: localPagination }),
|
|
145
136
|
},
|
|
146
137
|
}), [
|
|
147
138
|
expanded,
|
|
@@ -151,36 +142,23 @@ export function useTableState({
|
|
|
151
142
|
rowSelection,
|
|
152
143
|
columnVisibility,
|
|
153
144
|
rowPinning,
|
|
154
|
-
inlineRowLoading,
|
|
155
|
-
localPagination
|
|
156
145
|
]);
|
|
157
146
|
|
|
158
147
|
// Pagination configuration
|
|
159
148
|
const paginationInitializer = useMemo(() => {
|
|
160
149
|
if (!pagination) return {};
|
|
161
150
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
};
|
|
170
|
-
} else {
|
|
171
|
-
// Use normal pagination initialization for non- inlineRowLoading usecases
|
|
172
|
-
return {
|
|
173
|
-
getPaginationRowModel: getPaginationRowModel(),
|
|
174
|
-
paginateExpandedRows: false,
|
|
175
|
-
initialState: {
|
|
176
|
-
pagination: {
|
|
177
|
-
pageIndex: paginationProps?.pageIndex ?? 0,
|
|
178
|
-
pageSize: paginationProps?.pageSize ?? 20,
|
|
179
|
-
},
|
|
151
|
+
return {
|
|
152
|
+
getPaginationRowModel: getPaginationRowModel(),
|
|
153
|
+
paginateExpandedRows: false,
|
|
154
|
+
initialState: {
|
|
155
|
+
pagination: {
|
|
156
|
+
pageIndex: paginationProps?.pageIndex ?? 0,
|
|
157
|
+
pageSize: paginationProps?.pageSize ?? 20,
|
|
180
158
|
},
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}, [pagination, paginationProps
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
}, [pagination, paginationProps]);
|
|
184
162
|
|
|
185
163
|
// Initialize the table
|
|
186
164
|
const table = useReactTable({
|
|
@@ -228,27 +206,9 @@ export function useTableState({
|
|
|
228
206
|
// Set pagination state when pagination is enabled
|
|
229
207
|
useEffect(() => {
|
|
230
208
|
if (pagination && paginationProps?.pageSize) {
|
|
231
|
-
|
|
232
|
-
// Update local pagination state for inlineRowLoading
|
|
233
|
-
setLocalPagination(prev => ({
|
|
234
|
-
...prev,
|
|
235
|
-
pageSize: paginationProps.pageSize
|
|
236
|
-
}));
|
|
237
|
-
} else {
|
|
238
|
-
table.setPageSize(paginationProps.pageSize);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}, [pagination, paginationProps?.pageSize, table, inlineRowLoading]);
|
|
242
|
-
|
|
243
|
-
// Update local pagination when paginationProps change and inlineRowLoading is enabled
|
|
244
|
-
useEffect(() => {
|
|
245
|
-
if (pagination && inlineRowLoading && paginationProps) {
|
|
246
|
-
setLocalPagination({
|
|
247
|
-
pageIndex: paginationProps.pageIndex ?? localPagination.pageIndex,
|
|
248
|
-
pageSize: paginationProps.pageSize ?? localPagination.pageSize,
|
|
249
|
-
});
|
|
209
|
+
table.setPageSize(paginationProps.pageSize);
|
|
250
210
|
}
|
|
251
|
-
}, [pagination,
|
|
211
|
+
}, [pagination, paginationProps?.pageSize, table]);
|
|
252
212
|
|
|
253
213
|
// Check if table has any sub-rows
|
|
254
214
|
const hasAnySubRows = table.getRowModel().rows.some(row => row.subRows && row.subRows.length > 0);
|
|
@@ -287,8 +247,6 @@ export function useTableState({
|
|
|
287
247
|
rowSelection,
|
|
288
248
|
fullData,
|
|
289
249
|
totalFetched,
|
|
290
|
-
isFetching
|
|
291
|
-
localPagination,
|
|
292
|
-
setLocalPagination
|
|
250
|
+
isFetching
|
|
293
251
|
};
|
|
294
252
|
}
|
|
@@ -134,9 +134,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
134
134
|
updateLoadingStateRowCount,
|
|
135
135
|
fullData,
|
|
136
136
|
totalFetched,
|
|
137
|
-
isFetching
|
|
138
|
-
localPagination,
|
|
139
|
-
setLocalPagination
|
|
137
|
+
isFetching
|
|
140
138
|
} = useTableState({
|
|
141
139
|
tableData,
|
|
142
140
|
columnDefinitions,
|
|
@@ -154,8 +152,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
154
152
|
onRowSelectionChange,
|
|
155
153
|
columnVisibilityControl,
|
|
156
154
|
pinnedRows,
|
|
157
|
-
rowStyling
|
|
158
|
-
inlineRowLoading
|
|
155
|
+
rowStyling
|
|
159
156
|
});
|
|
160
157
|
|
|
161
158
|
// Initialize table actions
|
|
@@ -168,10 +165,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
168
165
|
expanded,
|
|
169
166
|
setExpanded,
|
|
170
167
|
onToggleExpansionClick,
|
|
171
|
-
onRowSelectionChange
|
|
172
|
-
inlineRowLoading,
|
|
173
|
-
localPagination,
|
|
174
|
-
setLocalPagination
|
|
168
|
+
onRowSelectionChange
|
|
175
169
|
});
|
|
176
170
|
|
|
177
171
|
// Set table row count for loading state
|
|
@@ -9,29 +9,20 @@ $pb_card_border_radius: $border_rad_heavier;
|
|
|
9
9
|
|
|
10
10
|
// used to display dropdown on the left of the calender
|
|
11
11
|
.quick-pick-drop-down {
|
|
12
|
-
width:
|
|
13
|
-
display: grid;
|
|
12
|
+
width: 100%;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
.quick-pick-ul {
|
|
17
|
-
padding: $space_xs 0px;
|
|
18
16
|
margin: 0;
|
|
19
17
|
list-style: none;
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
.nav-item {
|
|
23
21
|
list-style: none;
|
|
24
|
-
border-radius: 6px;
|
|
25
|
-
border-bottom: 0;
|
|
26
|
-
margin: $space_xs $space_sm;
|
|
27
22
|
}
|
|
28
23
|
|
|
29
24
|
.nav-item-link {
|
|
30
25
|
text-decoration: none;
|
|
31
|
-
border-width: $pb_card_border_width;
|
|
32
|
-
border-style: solid;
|
|
33
|
-
border-color: $border_light;
|
|
34
|
-
border-radius: $pb_card_border_radius;
|
|
35
26
|
padding: $space_xs 14px;
|
|
36
27
|
transition-property: color, background-color;
|
|
37
28
|
transition-duration: 0.15s;
|
|
@@ -40,15 +31,21 @@ $pb_card_border_radius: $border_rad_heavier;
|
|
|
40
31
|
color: $charcoal;
|
|
41
32
|
font-size: $font_default;
|
|
42
33
|
font-weight: $regular;
|
|
34
|
+
text-align: left;
|
|
35
|
+
border-bottom: 1px solid $border_light;
|
|
43
36
|
&.active {
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
color: $white;
|
|
38
|
+
background-color: $primary;
|
|
39
|
+
&:hover {
|
|
40
|
+
background-color: $product_1_background;
|
|
41
|
+
color: $white;
|
|
42
|
+
}
|
|
46
43
|
}
|
|
47
44
|
@media (hover:hover) {
|
|
48
45
|
&:hover {
|
|
49
46
|
cursor: pointer;
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
background-color: $bg_light;
|
|
48
|
+
color: $primary;
|
|
52
49
|
}
|
|
53
50
|
}
|
|
54
51
|
}
|
|
@@ -57,19 +54,3 @@ $pb_card_border_radius: $border_rad_heavier;
|
|
|
57
54
|
.quick-pick-drop-down > .flatpickr-months, .quick-pick-drop-down > .flatpickr-innerContainer {
|
|
58
55
|
display: none;
|
|
59
56
|
}
|
|
60
|
-
|
|
61
|
-
@media only screen and (max-width: 767px) {
|
|
62
|
-
.quick-pick-ul {
|
|
63
|
-
padding: $space_xs $space_xs;
|
|
64
|
-
display: grid;
|
|
65
|
-
grid-template-columns: 1fr 1fr;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.nav-item {
|
|
69
|
-
margin: $space_xxs $space_xs;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.nav-item-link {
|
|
73
|
-
padding: $space_xs $space_xxs;
|
|
74
|
-
}
|
|
75
|
-
}
|