playbook_ui 16.4.0.pre.alpha.PLAY2880selectablecardinputvariantstyle15361 → 16.4.0.pre.alpha.displaybreakpoints15091
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/_advanced_table.scss +1 -65
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +0 -3
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +0 -9
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/index.js +0 -82
- data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +2 -6
- data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +4 -21
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +9 -115
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +1 -3
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +1 -12
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +1 -4
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +1 -9
- data/app/pb_kits/playbook/pb_button/docs/_button_full_width.md +1 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.scss +0 -5
- data/app/pb_kits/playbook/pb_icon/icon.rb +1 -7
- data/app/pb_kits/playbook/pb_list/_list_mixin.scss +4 -4
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +1 -3
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +0 -3
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.test.jsx +0 -27
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +0 -39
- data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.scss +1 -19
- data/app/pb_kits/playbook/pb_table/docs/_sections.yml +0 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.md +1 -2
- data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_table/table.html.erb +2 -5
- data/app/pb_kits/playbook/pb_table/table.rb +0 -4
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +8 -20
- data/app/pb_kits/playbook/utilities/_display.scss +1 -0
- data/app/pb_kits/playbook/utilities/_hover.scss +3 -6
- data/dist/chunks/_typeahead-Bh0RF1X-.js +1 -0
- data/dist/chunks/vendor.js +2 -2
- 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 +4 -13
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_rails.html.erb +0 -57
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_rails.md +0 -7
- data/app/pb_kits/playbook/pb_button/docs/_button_full_width_rails.md +0 -19
- data/app/pb_kits/playbook/pb_button/docs/_button_full_width_react.md +0 -23
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_placeholder.html.erb +0 -109
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_placeholder.jsx +0 -127
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_placeholder.md +0 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_external_filter_rails.html.erb +0 -45
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_external_filter_rails.md +0 -39
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.md +0 -3
- data/dist/chunks/_typeahead-BNp_YiTh.js +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f4f468cd871371ba03a7e9cf2c14be1fbc8288c82d602c002d236c999249ae3e
|
|
4
|
+
data.tar.gz: 71dcca837b8732f4bab69f44d0ecbcc057ceaf2e711c249bcd88134e3cef6f0b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d8d9241711a074c871ecdb5a42e34c9135b8203a2e4b99f39b00fc0b5cee6363a49508b0c3775db90158f28d266dabc2c65d6b70a9487b01917eda4b9813a089
|
|
7
|
+
data.tar.gz: c11eefcc856323279d5ad899ca305c3ba2eb28cd9c1ee575f4952c57e247a8de6e78eb9aec8323502010b35e51bff170551051580658364774ba3250a553f30c
|
|
@@ -63,51 +63,6 @@
|
|
|
63
63
|
width: 100%;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
// Override pb_table endcap: first and last column use same padding as rest of row
|
|
67
|
-
// First column
|
|
68
|
-
.pb_table.table-sm tbody tr td:first-child,
|
|
69
|
-
.pb_table.table-sm tbody tr .pb_table_td:first-child,
|
|
70
|
-
.pb_table.table-sm tbody .pb_table_tr td:first-child,
|
|
71
|
-
.pb_table.table-sm tbody .pb_table_tr .pb_table_td:first-child,
|
|
72
|
-
.pb_table.table-sm .pb_table_tbody tr td:first-child,
|
|
73
|
-
.pb_table.table-sm .pb_table_tbody tr .pb_table_td:first-child,
|
|
74
|
-
.pb_table.table-sm .pb_table_tbody .pb_table_tr td:first-child,
|
|
75
|
-
.pb_table.table-sm .pb_table_tbody .pb_table_tr .pb_table_td:first-child {
|
|
76
|
-
padding-left: $space-xs;
|
|
77
|
-
}
|
|
78
|
-
.pb_table.table-md tbody tr td:first-child,
|
|
79
|
-
.pb_table.table-md tbody tr .pb_table_td:first-child,
|
|
80
|
-
.pb_table.table-md tbody .pb_table_tr td:first-child,
|
|
81
|
-
.pb_table.table-md tbody .pb_table_tr .pb_table_td:first-child,
|
|
82
|
-
.pb_table.table-md .pb_table_tbody tr td:first-child,
|
|
83
|
-
.pb_table.table-md .pb_table_tbody tr .pb_table_td:first-child,
|
|
84
|
-
.pb_table.table-md .pb_table_tbody .pb_table_tr td:first-child,
|
|
85
|
-
.pb_table.table-md .pb_table_tbody .pb_table_tr .pb_table_td:first-child {
|
|
86
|
-
padding-left: $space-sm;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Last column
|
|
90
|
-
.pb_table.table-sm tbody tr td:last-child,
|
|
91
|
-
.pb_table.table-sm tbody tr .pb_table_td:last-child,
|
|
92
|
-
.pb_table.table-sm tbody .pb_table_tr td:last-child,
|
|
93
|
-
.pb_table.table-sm tbody .pb_table_tr .pb_table_td:last-child,
|
|
94
|
-
.pb_table.table-sm .pb_table_tbody tr td:last-child,
|
|
95
|
-
.pb_table.table-sm .pb_table_tbody tr .pb_table_td:last-child,
|
|
96
|
-
.pb_table.table-sm .pb_table_tbody .pb_table_tr td:last-child,
|
|
97
|
-
.pb_table.table-sm .pb_table_tbody .pb_table_tr .pb_table_td:last-child {
|
|
98
|
-
padding-right: $space-xs;
|
|
99
|
-
}
|
|
100
|
-
.pb_table.table-md tbody tr td:last-child,
|
|
101
|
-
.pb_table.table-md tbody tr .pb_table_td:last-child,
|
|
102
|
-
.pb_table.table-md tbody .pb_table_tr td:last-child,
|
|
103
|
-
.pb_table.table-md tbody .pb_table_tr .pb_table_td:last-child,
|
|
104
|
-
.pb_table.table-md .pb_table_tbody tr td:last-child,
|
|
105
|
-
.pb_table.table-md .pb_table_tbody tr .pb_table_td:last-child,
|
|
106
|
-
.pb_table.table-md .pb_table_tbody .pb_table_tr td:last-child,
|
|
107
|
-
.pb_table.table-md .pb_table_tbody .pb_table_tr .pb_table_td:last-child {
|
|
108
|
-
padding-right: $space-sm;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
66
|
// Virtualized Table and Rows for Infinite Scroll
|
|
112
67
|
scrollbar-gutter: stable right-edges;
|
|
113
68
|
.virtualized-header-row-header {
|
|
@@ -674,18 +629,12 @@
|
|
|
674
629
|
@each $color_name, $color_value in $border_color_options {
|
|
675
630
|
&.column-group-border-#{$color_name} {
|
|
676
631
|
@if $theme == "light" {
|
|
677
|
-
&:not(.advanced-table-no-table-container) {
|
|
678
|
-
@include advanced-table-sticky-wrapper-frame($color_value);
|
|
679
|
-
}
|
|
680
632
|
@include advanced-table-sticky-mixin(
|
|
681
633
|
$color_value,
|
|
682
634
|
$white,
|
|
683
635
|
lighten($silver, $opacity_7)
|
|
684
636
|
);
|
|
685
637
|
} @else if $theme == "dark" {
|
|
686
|
-
&:not(.advanced-table-no-table-container) {
|
|
687
|
-
@include advanced-table-sticky-wrapper-frame($color_value);
|
|
688
|
-
}
|
|
689
638
|
@include advanced-table-sticky-mixin(
|
|
690
639
|
$color_value,
|
|
691
640
|
$bg_dark_card,
|
|
@@ -721,10 +670,6 @@
|
|
|
721
670
|
width: 100%;
|
|
722
671
|
@include scrollbar-styling;
|
|
723
672
|
|
|
724
|
-
&:not(.advanced-table-no-table-container) {
|
|
725
|
-
@include advanced-table-sticky-wrapper-frame($border_light);
|
|
726
|
-
}
|
|
727
|
-
|
|
728
673
|
// These are the responsive borders that should NOT inherit the custom color
|
|
729
674
|
@include advanced-table-sticky-mixin(
|
|
730
675
|
$border_light,
|
|
@@ -775,7 +720,7 @@
|
|
|
775
720
|
}
|
|
776
721
|
}
|
|
777
722
|
|
|
778
|
-
// Row Pinning -
|
|
723
|
+
// Row Pinning - additional inline styles in RegularTableView.tsx
|
|
779
724
|
.pinned-row {
|
|
780
725
|
box-shadow: 0 4px 10px 0 rgba($shadow, 0.16) !important;
|
|
781
726
|
}
|
|
@@ -1018,11 +963,6 @@
|
|
|
1018
963
|
.sticky-left {
|
|
1019
964
|
background-color: $bg_dark;
|
|
1020
965
|
}
|
|
1021
|
-
|
|
1022
|
-
&:not(.advanced-table-no-table-container) {
|
|
1023
|
-
@include advanced-table-sticky-wrapper-frame($border_dark);
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
966
|
@include advanced-table-sticky-mixin(
|
|
1027
967
|
$border_dark,
|
|
1028
968
|
$bg_dark_card,
|
|
@@ -1041,10 +981,6 @@
|
|
|
1041
981
|
}
|
|
1042
982
|
}
|
|
1043
983
|
|
|
1044
|
-
&:not(.advanced-table-no-table-container) {
|
|
1045
|
-
@include advanced-table-sticky-wrapper-frame($border_dark);
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
984
|
// These are the responsive borders that should NOT inherit the custom color
|
|
1049
985
|
@include advanced-table-sticky-mixin(
|
|
1050
986
|
$border_dark,
|
|
@@ -127,8 +127,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
127
127
|
fullScreenControl,
|
|
128
128
|
} = props;
|
|
129
129
|
|
|
130
|
-
const noTableCardContainer = tableProps?.container === false;
|
|
131
|
-
|
|
132
130
|
// Component refs
|
|
133
131
|
const tableWrapperRef = useRef<HTMLDivElement>(null);
|
|
134
132
|
|
|
@@ -283,7 +281,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
|
283
281
|
'hidden-action-bar': (selectableRows || columnVisibilityControl) && !isActionBarVisible,
|
|
284
282
|
},
|
|
285
283
|
{'advanced-table-sticky-left-columns': stickyLeftColumn && stickyLeftColumn.length > 0},
|
|
286
|
-
{ 'advanced-table-no-table-container': noTableCardContainer },
|
|
287
284
|
columnGroupBorderColor ? `column-group-border-${columnGroupBorderColor}` : '',
|
|
288
285
|
scrollBarNone ? 'advanced-table-hide-scrollbar' : '',
|
|
289
286
|
globalProps(props),
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
}) %>
|
|
8
8
|
<% end %>
|
|
9
9
|
|
|
10
|
-
<%= pb_rails("table", props: { size: "sm", data_table: true, number_spacing:"tabular", responsive:"none", dark: dark, classname: object.loading ? "content-loading" : "" }.merge(object.table_props
|
|
10
|
+
<%= pb_rails("table", props: { size: "sm", data_table: true, number_spacing:"tabular", responsive:"none", dark: dark, classname: object.loading ? "content-loading" : "" }.merge(object.table_props)) do %>
|
|
11
11
|
<% if content.present? %>
|
|
12
12
|
<% content.presence %>
|
|
13
13
|
<% else %>
|
|
14
14
|
<%= pb_rails("advanced_table/table_header", props: { table_id: object.id, column_definitions: object.column_definitions, enable_toggle_expansion: object.enable_toggle_expansion, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, show_actions_bar: object.show_actions_bar, inline_row_loading: object.inline_row_loading, persist_toggle_expansion_button: object.persist_toggle_expansion_button, table_data: object.table_data }) %>
|
|
15
|
-
<%= pb_rails("advanced_table/table_body", props: { table_id: object.id, table_data: object.table_data, column_definitions: object.column_definitions, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, enable_toggle_expansion: object.enable_toggle_expansion, row_styling: object.row_styling, inline_row_loading: object.inline_row_loading
|
|
15
|
+
<%= pb_rails("advanced_table/table_body", props: { table_id: object.id, table_data: object.table_data, column_definitions: object.column_definitions, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, enable_toggle_expansion: object.enable_toggle_expansion, row_styling: object.row_styling, inline_row_loading: object.inline_row_loading }) %>
|
|
16
16
|
<% end %>
|
|
17
17
|
<% end %>
|
|
18
18
|
<% end %>
|
|
@@ -37,8 +37,6 @@ module Playbook
|
|
|
37
37
|
default: false
|
|
38
38
|
prop :persist_toggle_expansion_button, type: Playbook::Props::Boolean,
|
|
39
39
|
default: false
|
|
40
|
-
prop :pinned_rows, type: Playbook::Props::HashProp,
|
|
41
|
-
default: {}
|
|
42
40
|
|
|
43
41
|
def classname
|
|
44
42
|
additional_classes = [
|
|
@@ -48,16 +46,9 @@ module Playbook
|
|
|
48
46
|
hidden_action_bar_class,
|
|
49
47
|
]
|
|
50
48
|
additional_classes << "column-group-border-#{column_group_border_color}" if column_group_border_color != "none"
|
|
51
|
-
additional_classes << "advanced-table-no-table-container" if no_table_card_container?
|
|
52
49
|
generate_classname("pb_advanced_table", *additional_classes, separator: " ")
|
|
53
50
|
end
|
|
54
51
|
|
|
55
|
-
def no_table_card_container?
|
|
56
|
-
return false unless table_props.is_a?(Hash)
|
|
57
|
-
|
|
58
|
-
table_props[:container] == false || table_props["container"] == false
|
|
59
|
-
end
|
|
60
|
-
|
|
61
52
|
def responsive_classname
|
|
62
53
|
responsive == "scroll" ? "advanced-table-responsive-scroll" : "advanced-table-responsive-none"
|
|
63
54
|
end
|
|
@@ -7,7 +7,6 @@ examples:
|
|
|
7
7
|
- advanced_table_table_props: Table Props
|
|
8
8
|
- advanced_table_sticky_header_rails: Sticky Header
|
|
9
9
|
- advanced_table_table_props_sticky_header: Sticky Header for Responsive Table
|
|
10
|
-
- advanced_table_pinned_rows_rails: Pinned Rows
|
|
11
10
|
- advanced_table_beta_sort: Enable Sorting
|
|
12
11
|
- advanced_table_responsive: Responsive Tables
|
|
13
12
|
- advanced_table_custom_cell_rails: Custom Components for Cells
|
|
@@ -196,17 +196,6 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
|
196
196
|
if (table.dataset.pbAdvancedTableInitialized) return;
|
|
197
197
|
table.dataset.pbAdvancedTableInitialized = "true";
|
|
198
198
|
|
|
199
|
-
// Measure header height so pinned rows don't overlap when header wraps (e.g. mobile)
|
|
200
|
-
if (mainTable) {
|
|
201
|
-
PbAdvancedTable.updateStickyHeaderRowHeights(mainTable);
|
|
202
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
203
|
-
PbAdvancedTable.updateStickyHeaderRowHeights(mainTable);
|
|
204
|
-
PbAdvancedTable.updatePinnedRowsStickyTops(mainTable);
|
|
205
|
-
});
|
|
206
|
-
resizeObserver.observe(table);
|
|
207
|
-
mainTable._advancedTableHeaderResizeObserver = resizeObserver;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
199
|
// Delegate checkbox changes
|
|
211
200
|
table.addEventListener("change", (event) => {
|
|
212
201
|
const checkbox = event.target.closest('input[type="checkbox"]');
|
|
@@ -326,64 +315,9 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
|
326
315
|
lastVisibleRow.classList.add("last-visible-row");
|
|
327
316
|
lastVisibleRow.classList.add("last-row-cell");
|
|
328
317
|
}
|
|
329
|
-
|
|
330
|
-
PbAdvancedTable.updateStickyHeaderRowHeights(parentElement);
|
|
331
|
-
PbAdvancedTable.updatePinnedRowsStickyTops(table);
|
|
332
318
|
}
|
|
333
319
|
}
|
|
334
320
|
|
|
335
|
-
/**
|
|
336
|
-
* Measure thead height and set --advanced-table-header-height so pinned rows and
|
|
337
|
-
* multi-row sticky headers use the correct offset. Re-run when header wraps (e.g. mobile).
|
|
338
|
-
*/
|
|
339
|
-
static updateStickyHeaderRowHeights(advancedTableWrapper) {
|
|
340
|
-
if (!advancedTableWrapper) return;
|
|
341
|
-
const table = advancedTableWrapper.querySelector("table.pb_table");
|
|
342
|
-
const thead = table?.querySelector("thead");
|
|
343
|
-
if (!thead) return;
|
|
344
|
-
|
|
345
|
-
const rows = Array.from(thead.querySelectorAll("tr"));
|
|
346
|
-
let totalHeight = 0;
|
|
347
|
-
rows.forEach((tr, index) => {
|
|
348
|
-
const h = tr.offsetHeight;
|
|
349
|
-
if (index === 0) {
|
|
350
|
-
advancedTableWrapper.style.setProperty(
|
|
351
|
-
"--advanced-table-header-row-0-height",
|
|
352
|
-
`${h}px`
|
|
353
|
-
);
|
|
354
|
-
} else if (index === 1) {
|
|
355
|
-
advancedTableWrapper.style.setProperty(
|
|
356
|
-
"--advanced-table-header-row-1-height",
|
|
357
|
-
`${h}px`
|
|
358
|
-
);
|
|
359
|
-
}
|
|
360
|
-
totalHeight += h;
|
|
361
|
-
});
|
|
362
|
-
advancedTableWrapper.style.setProperty(
|
|
363
|
-
"--advanced-table-header-height",
|
|
364
|
-
`${totalHeight}px`
|
|
365
|
-
);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* Recompute sticky top for visible pinned rows so collapsed rows don't leave a gap.
|
|
370
|
-
* Call after expand/collapse and on load.
|
|
371
|
-
*/
|
|
372
|
-
static updatePinnedRowsStickyTops(advancedTableWrapper) {
|
|
373
|
-
const pinnedTbody = advancedTableWrapper?.querySelector("tbody.pinned-rows-tbody");
|
|
374
|
-
if (!pinnedTbody) return;
|
|
375
|
-
|
|
376
|
-
const pinnedRows = Array.from(pinnedTbody.querySelectorAll("tr.pinned-row"));
|
|
377
|
-
const visibleRows = pinnedRows.filter(
|
|
378
|
-
(tr) => tr.style.display !== "none" && tr.offsetParent !== null
|
|
379
|
-
);
|
|
380
|
-
|
|
381
|
-
const headerOffset = "var(--advanced-table-header-height, 44px)";
|
|
382
|
-
visibleRows.forEach((tr, index) => {
|
|
383
|
-
tr.style.top = `calc(${headerOffset} + 2.5em * ${index})`;
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
|
|
387
321
|
hideCloseIcon() {
|
|
388
322
|
const closeIcon = this.element.querySelector(UP_ARROW_SELECTOR);
|
|
389
323
|
closeIcon.style.display = "none";
|
|
@@ -585,19 +519,3 @@ window.expandAllRows = (element) => {
|
|
|
585
519
|
window.expandAllSubRows = (element, rowDepth) => {
|
|
586
520
|
PbAdvancedTable.handleToggleAllSubRows(element, rowDepth);
|
|
587
521
|
};
|
|
588
|
-
|
|
589
|
-
// Fix header height and pinned row sticky tops on load (header wrap + collapsed rows)
|
|
590
|
-
function updateAllAdvancedTableStickyHeights() {
|
|
591
|
-
document.querySelectorAll(".pb_advanced_table").forEach((wrapper) => {
|
|
592
|
-
PbAdvancedTable.updateStickyHeaderRowHeights(wrapper);
|
|
593
|
-
PbAdvancedTable.updatePinnedRowsStickyTops(wrapper);
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
if (typeof document !== "undefined") {
|
|
598
|
-
if (document.readyState === "loading") {
|
|
599
|
-
document.addEventListener("DOMContentLoaded", updateAllAdvancedTableStickyHeights);
|
|
600
|
-
} else {
|
|
601
|
-
updateAllAdvancedTableStickyHeights();
|
|
602
|
-
}
|
|
603
|
-
}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
// Acts as outer “card frame” on the advanced-table wrapper (table-card from Table) is included from `_advanced_table.scss` only when `:not(.advanced-table-no-table-container)`/container: false is not present.
|
|
2
|
-
@mixin advanced-table-sticky-wrapper-frame($border-color) {
|
|
3
|
-
border-radius: 4px;
|
|
4
|
-
box-shadow: 1px 0 0 0px $border-color, -1px 0 0 0px $border-color;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
1
|
@mixin advanced-table-sticky-mixin(
|
|
8
2
|
$border-color,
|
|
9
3
|
$bg-main,
|
|
@@ -11,6 +5,8 @@
|
|
|
11
5
|
$highlight: #E5EEFA,
|
|
12
6
|
$highlight-dark: #202850,
|
|
13
7
|
) {
|
|
8
|
+
border-radius: 4px;
|
|
9
|
+
box-shadow: 1px 0 0 0px $border-color, -1px 0 0 0px $border-color;
|
|
14
10
|
display: block;
|
|
15
11
|
[class^="pb_table"].table-sm.table-card thead tr th:first-child,
|
|
16
12
|
[class^="pb_table"].table-sm:not(.no-hover).table-card
|
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
<%
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<% object.pinned_root_rows.each do |root_info| %>
|
|
6
|
-
<% row_output, next_index = object.render_row_and_children(root_info[:row], object.column_definitions, root_info[:depth], root_info[:depth] > 0, root_info[:ancestor_ids] || [], root_info[:ancestor_ids]&.first, immediate_parent_row_id: object.row_id_for(root_info[:parent_row]), is_pinned_row: true, pinned_index: next_index, initial_table_data_attributes: root_info[:depth].to_i > 0 ? object.pinned_root_initial_data_attributes(root_info) : nil) %>
|
|
7
|
-
<%= row_output %>
|
|
8
|
-
<% end %>
|
|
9
|
-
<% end %>
|
|
10
|
-
<%= pb_content_tag(:tbody) do %>
|
|
11
|
-
<% table_data.each do |row| %>
|
|
12
|
-
<% result = object.render_row_and_children(row, object.column_definitions, 0, false, skip_pinned_ids: object.pinned_ids_set) %>
|
|
13
|
-
<%= result.is_a?(Array) ? result[0] : result %>
|
|
14
|
-
<% end %>
|
|
15
|
-
<% end %>
|
|
16
|
-
<% else %>
|
|
17
|
-
<%= pb_content_tag(:tbody) do %>
|
|
18
|
-
<% table_data.each do |row| %>
|
|
19
|
-
<%= object.render_row_and_children(row, object.column_definitions, 0, false) %>
|
|
20
|
-
<% end %>
|
|
21
|
-
<% end %>
|
|
1
|
+
<%= pb_content_tag(:tbody) do %>
|
|
2
|
+
<% object.table_data.each do |row| %>
|
|
3
|
+
<%= render_row_and_children(row, object.column_definitions, 0, false) %>
|
|
4
|
+
<% end %>
|
|
22
5
|
<% end %>
|
|
@@ -27,8 +27,6 @@ module Playbook
|
|
|
27
27
|
default: []
|
|
28
28
|
prop :inline_row_loading, type: Playbook::Props::Boolean,
|
|
29
29
|
default: false
|
|
30
|
-
prop :pinned_rows, type: Playbook::Props::HashProp,
|
|
31
|
-
default: {}
|
|
32
30
|
|
|
33
31
|
def flatten_columns(columns)
|
|
34
32
|
columns.flat_map do |col|
|
|
@@ -44,21 +42,14 @@ module Playbook
|
|
|
44
42
|
end.compact
|
|
45
43
|
end
|
|
46
44
|
|
|
47
|
-
def render_row_and_children(row, column_definitions, current_depth, first_parent_child, ancestor_ids = [], top_parent_id = nil, additional_classes: "", table_data_attributes: {}, immediate_parent_row_id: nil
|
|
48
|
-
if skip_pinned_ids && row_id_for(row) && skip_pinned_ids.include?(row_id_for(row).to_s)
|
|
49
|
-
return is_pinned_row ? [ActiveSupport::SafeBuffer.new, pinned_index] : ActiveSupport::SafeBuffer.new
|
|
50
|
-
end
|
|
51
|
-
|
|
45
|
+
def render_row_and_children(row, column_definitions, current_depth, first_parent_child, ancestor_ids = [], top_parent_id = nil, additional_classes: "", table_data_attributes: {}, immediate_parent_row_id: nil)
|
|
52
46
|
top_parent_id ||= row.object_id
|
|
53
47
|
new_ancestor_ids = ancestor_ids + [row.object_id]
|
|
54
|
-
leaf_columns = flatten_columns(column_definitions
|
|
48
|
+
leaf_columns = flatten_columns(column_definitions)
|
|
55
49
|
|
|
56
50
|
output = ActiveSupport::SafeBuffer.new
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
last_row = subrow_headers_arr.length == current_depth
|
|
60
|
-
|
|
61
|
-
next_pinned_index = pinned_index
|
|
51
|
+
is_first_child_of_subrow = current_depth.positive? && first_parent_child && subrow_headers[current_depth - 1].present?
|
|
52
|
+
last_row = subrow_headers.length == current_depth
|
|
62
53
|
|
|
63
54
|
subrow_ancestor_ids = ancestor_ids + ["#{row.object_id}sr"]
|
|
64
55
|
subrow_data_attributes = {
|
|
@@ -67,16 +58,7 @@ module Playbook
|
|
|
67
58
|
row_parent: "#{table_id}_#{ancestor_ids.last}",
|
|
68
59
|
}
|
|
69
60
|
# Subrow header if applicable
|
|
70
|
-
if is_first_child_of_subrow && enable_toggle_expansion == "all"
|
|
71
|
-
subrow_props = { row: row, column_definitions: leaf_columns, depth: current_depth, subrow_header: subrow_headers_arr[current_depth - 1], collapsible_trail: collapsible_trail, classname: "toggle-content", responsive: responsive, subrow_data_attributes: subrow_data_attributes, last_row: last_row, immediate_parent_row_id: immediate_parent_row_id }
|
|
72
|
-
if is_pinned_row && next_pinned_index
|
|
73
|
-
subrow_props[:is_pinned_row] = true
|
|
74
|
-
subrow_props[:pinned_index] = next_pinned_index
|
|
75
|
-
subrow_props[:html_options] = { style: build_pinned_row_style(next_pinned_index, background: "var(--pb_table_sticky_bg, #f5f5f5)") }
|
|
76
|
-
next_pinned_index += 1
|
|
77
|
-
end
|
|
78
|
-
output << pb_rails("advanced_table/table_subrow_header", props: subrow_props)
|
|
79
|
-
end
|
|
61
|
+
output << pb_rails("advanced_table/table_subrow_header", props: { row: row, column_definitions: leaf_columns, depth: current_depth, subrow_header: subrow_headers[current_depth - 1], collapsible_trail: collapsible_trail, classname: "toggle-content", responsive: responsive, subrow_data_attributes: subrow_data_attributes, last_row: last_row, immediate_parent_row_id: immediate_parent_row_id }) if is_first_child_of_subrow && enable_toggle_expansion == "all"
|
|
80
62
|
|
|
81
63
|
current_data_attributes = if current_depth.zero?
|
|
82
64
|
{
|
|
@@ -85,19 +67,11 @@ module Playbook
|
|
|
85
67
|
row_parent: nil,
|
|
86
68
|
}
|
|
87
69
|
else
|
|
88
|
-
|
|
70
|
+
table_data_attributes
|
|
89
71
|
end
|
|
90
72
|
|
|
91
73
|
# Additional class and data attributes needed for toggle logic
|
|
92
|
-
|
|
93
|
-
if is_pinned_row && next_pinned_index
|
|
94
|
-
row_props[:is_pinned_row] = true
|
|
95
|
-
row_props[:pinned_index] = next_pinned_index
|
|
96
|
-
row_bg = (row_styling || []).find { |s| s[:row_id].to_s == row_id_for(row).to_s }&.[](:background_color) || "white"
|
|
97
|
-
row_props[:html_options] = { style: build_pinned_row_style(next_pinned_index, background: row_bg) }
|
|
98
|
-
next_pinned_index += 1
|
|
99
|
-
end
|
|
100
|
-
output << pb_rails("advanced_table/table_row", props: row_props)
|
|
74
|
+
output << pb_rails("advanced_table/table_row", props: { table_id: table_id, row: row, column_definitions: leaf_columns, depth: current_depth, collapsible_trail: collapsible_trail, classname: additional_classes, table_data_attributes: current_data_attributes, responsive: responsive, loading: loading, selectable_rows: selectable_rows, row_id: row[:id], enable_toggle_expansion: enable_toggle_expansion, row_styling: row_styling, last_row: last_row, immediate_parent_row_id: immediate_parent_row_id, inline_row_loading: inline_row_loading })
|
|
101
75
|
|
|
102
76
|
# Render inline loading row when inline_row_loading is enabled and row has empty children
|
|
103
77
|
if inline_row_loading
|
|
@@ -129,21 +103,11 @@ module Playbook
|
|
|
129
103
|
advanced_table_content: data_content,
|
|
130
104
|
}
|
|
131
105
|
|
|
132
|
-
|
|
133
|
-
child_opts[:is_pinned_row] = is_pinned_row
|
|
134
|
-
child_opts[:pinned_index] = next_pinned_index if is_pinned_row
|
|
135
|
-
child_opts[:skip_pinned_ids] = skip_pinned_ids if skip_pinned_ids
|
|
136
|
-
|
|
137
|
-
child_output, next_pinned_index = render_row_and_children(child_row, column_definitions, current_depth + 1, is_first_child, new_ancestor_ids, top_parent_id, **child_opts)
|
|
138
|
-
output << child_output
|
|
106
|
+
output << render_row_and_children(child_row, column_definitions, current_depth + 1, is_first_child, new_ancestor_ids, top_parent_id, additional_classes: "toggle-content", table_data_attributes: child_data_attributes, immediate_parent_row_id: row[:id])
|
|
139
107
|
end
|
|
140
108
|
end
|
|
141
109
|
|
|
142
|
-
|
|
143
|
-
[output, next_pinned_index]
|
|
144
|
-
else
|
|
145
|
-
output
|
|
146
|
-
end
|
|
110
|
+
output
|
|
147
111
|
end
|
|
148
112
|
|
|
149
113
|
def classname
|
|
@@ -178,76 +142,6 @@ module Playbook
|
|
|
178
142
|
end
|
|
179
143
|
end
|
|
180
144
|
|
|
181
|
-
def row_id_for(row)
|
|
182
|
-
return nil if row.nil?
|
|
183
|
-
|
|
184
|
-
row[:id] || row["id"]
|
|
185
|
-
end
|
|
186
|
-
|
|
187
|
-
def pinned_top_ids
|
|
188
|
-
return [] if pinned_rows.nil? || !pinned_rows.respond_to?(:[])
|
|
189
|
-
|
|
190
|
-
top = pinned_rows["top"] || pinned_rows[:top]
|
|
191
|
-
Array(top).map(&:to_s)
|
|
192
|
-
end
|
|
193
|
-
|
|
194
|
-
def pinned_ids_set
|
|
195
|
-
return Set.new if pinned_top_ids.blank?
|
|
196
|
-
|
|
197
|
-
set = Set.new
|
|
198
|
-
pinned_root_rows.each do |root|
|
|
199
|
-
collect_row_and_descendant_ids(root[:row], set)
|
|
200
|
-
end
|
|
201
|
-
set
|
|
202
|
-
end
|
|
203
|
-
|
|
204
|
-
def collect_row_and_descendant_ids(row, set)
|
|
205
|
-
id = row_id_for(row)
|
|
206
|
-
set.add(id.to_s) if id
|
|
207
|
-
row_children_for(row)&.each { |child| collect_row_and_descendant_ids(child, set) }
|
|
208
|
-
end
|
|
209
|
-
|
|
210
|
-
def find_row_by_id(data, id, depth: 0, ancestor_ids: [], parent_row: nil)
|
|
211
|
-
id_str = id.to_s
|
|
212
|
-
Array(data).each do |row|
|
|
213
|
-
return { row: row, depth: depth, ancestor_ids: ancestor_ids, parent_row: parent_row } if row_id_for(row).to_s == id_str
|
|
214
|
-
|
|
215
|
-
found = find_row_by_id(row_children_for(row), id_str, depth: depth + 1, ancestor_ids: ancestor_ids + [row.object_id], parent_row: row)
|
|
216
|
-
return found if found
|
|
217
|
-
end
|
|
218
|
-
nil
|
|
219
|
-
end
|
|
220
|
-
|
|
221
|
-
def pinned_root_rows
|
|
222
|
-
return [] if pinned_top_ids.blank?
|
|
223
|
-
|
|
224
|
-
pinned_top_ids.filter_map { |id| find_row_by_id(table_data, id) }
|
|
225
|
-
end
|
|
226
|
-
|
|
227
|
-
def has_pinned_rows?
|
|
228
|
-
pinned_root_rows.any?
|
|
229
|
-
end
|
|
230
|
-
|
|
231
|
-
# Build inline style for sticky pinned row (matches React). Pass via html_options so the tr gets the attribute.
|
|
232
|
-
def build_pinned_row_style(pinned_index, background: "white")
|
|
233
|
-
header_offset = "var(--advanced-table-header-height, 44px)"
|
|
234
|
-
row_offset = "calc(2.5em * #{pinned_index})"
|
|
235
|
-
"position: sticky; top: calc(#{header_offset} + #{row_offset}); z-index: 3; background: #{background};"
|
|
236
|
-
end
|
|
237
|
-
|
|
238
|
-
def pinned_root_initial_data_attributes(root_info)
|
|
239
|
-
return {} if root_info[:depth].to_i.zero?
|
|
240
|
-
|
|
241
|
-
anc = root_info[:ancestor_ids] || []
|
|
242
|
-
content = (anc + [root_info[:row].object_id]).join("-")
|
|
243
|
-
{
|
|
244
|
-
top_parent: "#{table_id}_#{anc.first}",
|
|
245
|
-
row_depth: root_info[:depth],
|
|
246
|
-
row_parent: "#{table_id}_#{anc.last}",
|
|
247
|
-
advanced_table_content: content,
|
|
248
|
-
}
|
|
249
|
-
end
|
|
250
|
-
|
|
251
145
|
def cell_accessors_length(col_defs)
|
|
252
146
|
first_col = col_defs.first
|
|
253
147
|
return 0 unless first_col
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
button_color = row_style&.[](:expand_button_color)
|
|
4
4
|
bg_color = row_style&.[](:background_color)
|
|
5
5
|
font_color = row_style&.[](:font_color)
|
|
6
|
-
tr_options = (object.html_options || {}).stringify_keys
|
|
7
|
-
tr_options["class"] = [tr_options["class"], object.classname].reject(&:blank?).join(" ")
|
|
8
6
|
%>
|
|
9
7
|
|
|
10
|
-
<%= pb_content_tag(:tr
|
|
8
|
+
<%= pb_content_tag(:tr) do %>
|
|
11
9
|
<% has_separate_checkbox = object.selectable_rows && object.enable_toggle_expansion == "none" %>
|
|
12
10
|
<% if has_separate_checkbox %>
|
|
13
11
|
<%= object.render_checkbox_cell %>
|
|
@@ -35,24 +35,13 @@ module Playbook
|
|
|
35
35
|
default: ""
|
|
36
36
|
prop :inline_row_loading, type: Playbook::Props::Boolean,
|
|
37
37
|
default: false
|
|
38
|
-
prop :is_pinned_row, type: Playbook::Props::Boolean,
|
|
39
|
-
default: false
|
|
40
|
-
prop :pinned_index, type: Playbook::Props::Numeric,
|
|
41
|
-
default: nil
|
|
42
|
-
prop :html_options, type: Playbook::Props::HashProp,
|
|
43
|
-
default: {}
|
|
44
|
-
prop :classname, type: Playbook::Props::String,
|
|
45
|
-
default: ""
|
|
46
38
|
|
|
47
39
|
def data
|
|
48
40
|
Hash(prop(:data)).merge(table_data_attributes)
|
|
49
41
|
end
|
|
50
42
|
|
|
51
43
|
def classname
|
|
52
|
-
|
|
53
|
-
classes << "pinned-row" if is_pinned_row
|
|
54
|
-
classes.reject!(&:blank?)
|
|
55
|
-
generate_classname(*classes, separator: " ")
|
|
44
|
+
generate_classname("pb_table_tr", "pb-bg-row-white", subrow_depth_classname, separator: " ")
|
|
56
45
|
end
|
|
57
46
|
|
|
58
47
|
def td_classname(column, index)
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
<% tr_options["class"] = [tr_options["class"], object.classname].reject(&:blank?).join(" ") %>
|
|
3
|
-
|
|
4
|
-
<%= pb_content_tag(:tr, tr_options) do %>
|
|
1
|
+
<%= pb_content_tag(:tr) do %>
|
|
5
2
|
<% object.column_definitions.each_with_index do |column, index| %>
|
|
6
3
|
<%= pb_rails("table/table_cell", props: { classname: object.td_classname(index) }) do %>
|
|
7
4
|
<%= pb_rails("flex", props:{ align: "center", justify: "start" }) do %>
|
|
@@ -19,21 +19,13 @@ module Playbook
|
|
|
19
19
|
prop :responsive, type: Playbook::Props::Enum,
|
|
20
20
|
values: %w[none scroll],
|
|
21
21
|
default: "scroll"
|
|
22
|
-
prop :is_pinned_row, type: Playbook::Props::Boolean,
|
|
23
|
-
default: false
|
|
24
|
-
prop :pinned_index, type: Playbook::Props::Numeric,
|
|
25
|
-
default: nil
|
|
26
|
-
prop :html_options, type: Playbook::Props::HashProp,
|
|
27
|
-
default: {}
|
|
28
22
|
|
|
29
23
|
def data
|
|
30
24
|
Hash(prop(:data)).merge(subrow_data_attributes)
|
|
31
25
|
end
|
|
32
26
|
|
|
33
27
|
def classname
|
|
34
|
-
|
|
35
|
-
classes << "pinned-row" if is_pinned_row
|
|
36
|
-
generate_classname(*classes, separator: " ")
|
|
28
|
+
generate_classname("pb_table_tr", "bg-silver", "pb_subrow_header", subrow_depth_classname, separator: " ")
|
|
37
29
|
end
|
|
38
30
|
|
|
39
31
|
def td_classname(index)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This button is used many times for mobile or other things like cards and sidebars.
|
|
@@ -112,13 +112,7 @@ module Playbook
|
|
|
112
112
|
end
|
|
113
113
|
|
|
114
114
|
def render_svg
|
|
115
|
-
|
|
116
|
-
content = if source.to_s.include?("://")
|
|
117
|
-
URI.open(source, "User-Agent" => "Playbook-Icon-Kit/1.0 (https://github.com/powerhome/playbook)", &:read) # rubocop:disable Security/Open
|
|
118
|
-
else
|
|
119
|
-
URI.open(source, &:read) # rubocop:disable Security/Open
|
|
120
|
-
end
|
|
121
|
-
doc = Nokogiri::XML(content)
|
|
115
|
+
doc = Nokogiri::XML(URI.open(asset_path || icon || custom_icon)) # rubocop:disable Security/Open
|
|
122
116
|
svg = doc.at_css("svg")
|
|
123
117
|
return "" unless svg
|
|
124
118
|
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
width: 20px;
|
|
22
22
|
flex: 0 0 20px;
|
|
23
23
|
text-align: left;
|
|
24
|
-
color: $
|
|
24
|
+
color: $text_lighter;
|
|
25
25
|
font-weight: $bold;
|
|
26
26
|
margin-right: $space-sm;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
li {
|
|
31
|
-
border-bottom: 1px solid $
|
|
31
|
+
border-bottom: 1px solid $input_border_default;
|
|
32
32
|
padding: $space-sm 0;
|
|
33
33
|
display: flex;
|
|
34
34
|
align-items: left;
|
|
@@ -69,14 +69,14 @@
|
|
|
69
69
|
}
|
|
70
70
|
@mixin pb_list_dark {
|
|
71
71
|
color: $white;
|
|
72
|
-
border-bottom: 1px solid $
|
|
72
|
+
border-bottom: 1px solid $input_border_default_dark;
|
|
73
73
|
|
|
74
74
|
&:last-child {
|
|
75
75
|
border-bottom: 0;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
&:before {
|
|
79
|
-
color: $
|
|
79
|
+
color: $text_lighter_dark;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
@mixin pb_list_large {
|