playbook_ui 14.20.0.pre.alpha.play2212tablekitstickycolumnswithresponsivenone7979 → 14.20.0.pre.alpha.play2224scrollbarfix7989

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4e9f81a39e99264f7447b0889451c36c4676c33f5f8c836d785432d0e9b4496
4
- data.tar.gz: c870628692d424816911bdaa0c05517e26c05731a5d01e12e1de2b5a80720a87
3
+ metadata.gz: 33a695bdcaa56f2aa2add5d46bdef8bc05f7bd6869178e33994c90f5d6ca0b73
4
+ data.tar.gz: 4db2ad8dac0ef13c10ac73ea527ee18d4b98a9a82788348d13d446bbddf852cc
5
5
  SHA512:
6
- metadata.gz: 827b59f32cbf03452c6fe62dd227dced2681eaf6d38fe7c1832b338b6909886f613ca5e7d7743c43073474642bdf7c6ed7a688ec0dbe679358f330f646c9c037
7
- data.tar.gz: fed471e895d0f88a489c629f74b6fd49b318ca7e063e200522264433aac2b3b4628265cde7884b75549bfd462498aa058f00af42fa32eaaab7ad15d02924da03
6
+ metadata.gz: 3fc6e4134fc59a88572e33512a280aa05e69e8543c1195e25a9fe6b8d874798a1a0fbe6c55074009474c9d3c12cf44eaacccb57b7221fdb4421eeafd3bc7164a
7
+ data.tar.gz: 9b6ccfe03db48187461be8870738818ecfcc7dc2723d6215a1f3bfed1a2afc0dc7e9386d3ecc1c4a4b2dd3a2015903420c8191a5fbac64a579dd5551fba81e91
@@ -87,6 +87,16 @@
87
87
  }
88
88
  }
89
89
 
90
+ &.advanced-table-hide-scrollbar {
91
+ &::-webkit-scrollbar {
92
+ display: none !important;
93
+ }
94
+
95
+ -ms-overflow-style: none !important;
96
+ scrollbar-width: none !important;
97
+ }
98
+
99
+
90
100
  .row-selection-actions-card {
91
101
  border-bottom-right-radius: 0px !important;
92
102
  border-bottom-left-radius: 0px !important;
@@ -368,6 +378,10 @@
368
378
  box-shadow: 1px 0px 0px 0px var(--column-border-color) !important;
369
379
  }
370
380
 
381
+ .pb_table_td:nth-child(2) {
382
+ box-shadow: inset 1px 0px 0px 0px var(--column-border-color) !important;
383
+ }
384
+
371
385
  // Color for collapsible trail
372
386
  .collapsible-trail {
373
387
  background-color: $border_light !important;
@@ -564,6 +578,10 @@
564
578
  box-shadow: $shadow_deep !important;
565
579
  }
566
580
 
581
+ .pb_table_td:nth-child(2) {
582
+ box-shadow: 0 0 0 0 !important;
583
+ }
584
+
567
585
  .pb_advanced_table_header,
568
586
  .pb_advanced_table_body {
569
587
  th.sticky-left,
@@ -53,6 +53,7 @@ type AdvancedTableProps = {
53
53
  pagination?: boolean,
54
54
  paginationProps?: GenericObject
55
55
  responsive?: "scroll" | "none",
56
+ scrollBarNone?: boolean,
56
57
  selectableRows?: boolean,
57
58
  showActionsBar?: boolean,
58
59
  sortControl?: GenericObject
@@ -92,6 +93,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
92
93
  pagination = false,
93
94
  paginationProps,
94
95
  responsive = "scroll",
96
+ scrollBarNone= false,
95
97
  showActionsBar = true,
96
98
  selectableRows,
97
99
  sortControl,
@@ -245,6 +247,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
245
247
  },
246
248
  {'advanced-table-sticky-left-columns': stickyLeftColumn && stickyLeftColumn.length > 0},
247
249
  columnGroupBorderColor ? `column-group-border-${columnGroupBorderColor}` : '',
250
+ scrollBarNone ? 'advanced-table-hide-scrollbar' : '',
248
251
  globalProps(props),
249
252
  className
250
253
  );
@@ -39,9 +39,13 @@ const AdvancedTableDefault = (props) => {
39
39
  <div>
40
40
  <AdvancedTable
41
41
  columnDefinitions={columnDefinitions}
42
+ maxHeight="xs"
43
+ overflow="auto"
44
+ responsive="scroll"
45
+ scrollBarNone
42
46
  tableData={MOCK_DATA}
43
47
  {...props}
44
- />
48
+ />
45
49
  </div>
46
50
  )
47
51
  }
@@ -30,4 +30,4 @@
30
30
  }
31
31
  ] %>
32
32
 
33
- <%= pb_rails("advanced_table", props: { id: "table_props_table", table_data: @table_data, column_definitions: column_definitions, table_props: { vertical_border: true, container: false }}) %>
33
+ <%= pb_rails("advanced_table", props: { id: "table_props_table", table_data: @table_data, column_definitions: column_definitions responsive }) %>
@@ -1,16 +1,12 @@
1
- <%= pb_content_tag(:label) do %>
1
+ <%= pb_content_tag(:label, data: {
2
+ pb_checkbox_indeterminate_main: object.indeterminate_main,
3
+ pb_checkbox_indeterminate_parent: object.indeterminate_parent,
4
+ }) do %>
2
5
  <%= content.presence || object.input %>
3
- <% if object.indeterminate %>
4
- <span data-pb-checkbox-icon-span="true" class="pb_checkbox_indeterminate">
5
- <%= pb_rails("icon", props: { icon: "minus", classname: "indeterminate_icon", fixed_width: true}) %>
6
- <%= pb_rails("icon", props: { icon: "check", classname: "check_icon hidden", fixed_width: true}) %>
7
- </span>
8
- <% else %>
9
- <span data-pb-checkbox-icon-span="true" class="pb_checkbox_checkmark">
10
- <%= pb_rails("icon", props: { icon: "check", classname: "check_icon", fixed_width: true}) %>
11
- <%= pb_rails("icon", props: { icon: "minus", classname: "indeterminate_icon hidden", fixed_width: true}) %>
12
- </span>
13
- <% end %>
6
+ <span data-pb-checkbox-icon-span="true" class="pb_checkbox_checkmark">
7
+ <%= pb_rails("icon", props: { icon: "check", classname: "check_icon", fixed_width: true}) %>
8
+ <%= pb_rails("icon", props: { icon: "minus", classname: "indeterminate_icon hidden", fixed_width: true}) %>
9
+ </span>
14
10
  <span class="pb_checkbox_label">
15
11
  <%= pb_rails("body", props: { status: object.checkbox_label_status, text: object.text, dark: object.dark, margin_right: object.form_spacing ? "xs" : "" }) %>
16
12
  </span>
@@ -5,7 +5,8 @@ module Playbook
5
5
  class Checkbox < Playbook::KitBase
6
6
  prop :error, type: Playbook::Props::Boolean, default: false
7
7
  prop :checked, type: Playbook::Props::Boolean, default: false
8
- prop :indeterminate, type: Playbook::Props::Boolean, default: false
8
+ prop :indeterminate_main, type: Playbook::Props::Boolean, default: false
9
+ prop :indeterminate_parent
9
10
  prop :text
10
11
  prop :value
11
12
  prop :name
@@ -19,7 +20,7 @@ module Playbook
19
20
  default: false
20
21
 
21
22
  def classname
22
- generate_classname("pb_checkbox_kit", checked_class) + indeterminate_class + error_class
23
+ generate_classname("pb_checkbox_kit", checked_class) + error_class
23
24
  end
24
25
 
25
26
  def input
@@ -39,10 +40,6 @@ module Playbook
39
40
  def checked_class
40
41
  checked ? "on" : "off"
41
42
  end
42
-
43
- def indeterminate_class
44
- indeterminate ? " indeterminate" : ""
45
- end
46
43
  end
47
44
  end
48
45
  end
@@ -9,11 +9,10 @@
9
9
  <tr>
10
10
  <th>
11
11
  <%= pb_rails("checkbox", props: {
12
- checked: true,
13
12
  text: "Uncheck All",
14
13
  value: "checkbox-value",
15
14
  name: "main-checkbox",
16
- indeterminate: true,
15
+ indeterminate_main: true,
17
16
  id: "indeterminate-checkbox"
18
17
  }) %>
19
18
  </th>
@@ -30,55 +29,10 @@
30
29
  value: checkbox[:id],
31
30
  name: "#{checkbox[:id]}-indeterminate-checkbox",
32
31
  id: "#{checkbox[:id]}-indeterminate-checkbox",
32
+ indeterminate_parent: "indeterminate-checkbox",
33
33
  }) %>
34
34
  </td>
35
35
  </tr>
36
36
  <% end %>
37
37
  </tbody>
38
38
  <% end %>
39
-
40
- <script>
41
- document.addEventListener('DOMContentLoaded', function() {
42
- const mainCheckboxWrapper = document.getElementById('indeterminate-checkbox');
43
- const mainCheckbox = document.getElementsByName("main-checkbox")[0];
44
- const childCheckboxes = document.querySelectorAll('input[type="checkbox"][id$="indeterminate-checkbox"]');
45
-
46
- const updateMainCheckbox = () => {
47
- // Count the number of checked child checkboxes
48
- const checkedCount = Array.from(childCheckboxes).filter(cb => cb.checked).length;
49
- // Determine if the main checkbox should be in an indeterminate state
50
- const indeterminate = checkedCount > 0 && checkedCount < childCheckboxes.length;
51
-
52
- // Set the main checkbox states
53
- mainCheckbox.indeterminate = indeterminate;
54
- mainCheckbox.checked = checkedCount > 0;
55
-
56
- // Determine the main checkbox label based on the number of checked checkboxes
57
- const text = checkedCount === 0 ? 'Check All' : 'Uncheck All';
58
-
59
- // Determine the icon class to add and remove based on the number of checked checkboxes
60
- const iconClassToAdd = checkedCount === 0 ? 'pb_checkbox_checkmark' : 'pb_checkbox_indeterminate';
61
- const iconClassToRemove = checkedCount === 0 ? 'pb_checkbox_indeterminate' : 'pb_checkbox_checkmark';
62
-
63
- // Update main checkbox label
64
- mainCheckboxWrapper.getElementsByClassName('pb_body_kit')[0].textContent = text;
65
-
66
- // Add and remove the icon class to the main checkbox wrapper
67
- mainCheckboxWrapper.querySelector('[data-pb-checkbox-icon-span]').classList.add(iconClassToAdd);
68
- mainCheckboxWrapper.querySelector('[data-pb-checkbox-icon-span]').classList.remove(iconClassToRemove);
69
-
70
- // Toggle the visibility of the checkbox icon based on the indeterminate state
71
- mainCheckboxWrapper.getElementsByClassName("indeterminate_icon")[0].classList.toggle('hidden', !indeterminate);
72
- mainCheckboxWrapper.getElementsByClassName("check_icon")[0].classList.toggle('hidden', indeterminate);
73
- };
74
-
75
- mainCheckbox.addEventListener('change', function() {
76
- childCheckboxes.forEach(cb => cb.checked = this.checked);
77
- updateMainCheckbox();
78
- });
79
-
80
- childCheckboxes.forEach(cb => {
81
- cb.addEventListener('change', updateMainCheckbox);
82
- });
83
- });
84
- </script>
@@ -0,0 +1 @@
1
+ If you want to use indeterminate, "check/uncheck all" checkboxes, add `indeterminate_main: true` and an `id` to the main checkbox. Then, add an `indeterminate_parent` prop with the main checkbox's `id` to the children checkboxes.
@@ -0,0 +1,56 @@
1
+ import PbEnhancedElement from "../pb_enhanced_element"
2
+
3
+ const INDETERMINATE_MAIN_CHECKBOX_SELECTOR = "[data-pb-checkbox-indeterminate-main='true']"
4
+
5
+ export default class PbCheckbox extends PbEnhancedElement {
6
+ static get selector() {
7
+ return INDETERMINATE_MAIN_CHECKBOX_SELECTOR
8
+ }
9
+
10
+ connect() {
11
+ const mainCheckboxWrapper = this.element;
12
+ const mainCheckbox = mainCheckboxWrapper.querySelector('input')
13
+ const childCheckboxes = document.querySelectorAll(`[data-pb-checkbox-indeterminate-parent="${this.element.id}"] input[type="checkbox"]`);
14
+
15
+ const updateMainCheckbox = () => {
16
+ // Count the number of checked child checkboxes
17
+ const checkedCount = Array.from(childCheckboxes).filter(cb => cb.checked).length;
18
+ // Determine if the main checkbox should be in an indeterminate state
19
+ const indeterminate = checkedCount > 0 && checkedCount < childCheckboxes.length;
20
+
21
+ // Set the main checkbox states
22
+ mainCheckbox.indeterminate = indeterminate;
23
+ mainCheckbox.checked = checkedCount > 0;
24
+
25
+ // Determine the main checkbox label based on the number of checked checkboxes
26
+ const text = checkedCount === 0 ? 'Check All' : 'Uncheck All';
27
+
28
+ // Determine the icon class to add and remove based on the number of checked checkboxes
29
+ const iconClassToAdd = checkedCount === 0 ? 'pb_checkbox_checkmark' : 'pb_checkbox_indeterminate';
30
+ const iconClassToRemove = checkedCount === 0 ? 'pb_checkbox_indeterminate' : 'pb_checkbox_checkmark';
31
+
32
+ // Update main checkbox label
33
+ mainCheckboxWrapper.getElementsByClassName('pb_body_kit')[0].textContent = text;
34
+
35
+ // Add and remove the icon class to the main checkbox wrapper
36
+ mainCheckboxWrapper.querySelector('[data-pb-checkbox-icon-span]').classList.add(iconClassToAdd);
37
+ mainCheckboxWrapper.querySelector('[data-pb-checkbox-icon-span]').classList.remove(iconClassToRemove);
38
+
39
+ // Toggle the visibility of the checkbox icon based on the indeterminate state
40
+ mainCheckboxWrapper.getElementsByClassName("indeterminate_icon")[0].classList.toggle('hidden', !indeterminate);
41
+ mainCheckboxWrapper.getElementsByClassName("check_icon")[0].classList.toggle('hidden', indeterminate);
42
+ };
43
+
44
+ // Set indeterminate icon on main checkbox if initial children checkboxes are checked
45
+ updateMainCheckbox();
46
+
47
+ this.element.querySelector('input').addEventListener('change', function() {
48
+ childCheckboxes.forEach(cb => cb.checked = this.checked);
49
+ updateMainCheckbox();
50
+ });
51
+
52
+ childCheckboxes.forEach(cb => {
53
+ cb.addEventListener('change', updateMainCheckbox);
54
+ });
55
+ }
56
+ }
@@ -115,6 +115,7 @@ export default class PbDropdown extends PbEnhancedElement {
115
115
 
116
116
  handleSearch(term = "") {
117
117
  const lcTerm = term.toLowerCase();
118
+ let hasMatch = false
118
119
  this.element.querySelectorAll(OPTION_SELECTOR).forEach((opt) => {
119
120
  //make it so that if the option is selected, it will not show up in the search results
120
121
  if (this.isMultiSelect && this.selectedOptions.has(opt.dataset.dropdownOptionLabel)) {
@@ -128,9 +129,32 @@ export default class PbDropdown extends PbEnhancedElement {
128
129
  // hide or show option
129
130
  const match = label.includes(lcTerm);
130
131
  opt.style.display = match ? "" : "none";
132
+ if (match) hasMatch = true
131
133
  });
132
134
 
133
135
  this.adjustDropdownHeight();
136
+
137
+ this.removeNoOptionsMessage()
138
+ if (!hasMatch) {
139
+ this.showNoOptionsMessage()
140
+ }
141
+ }
142
+
143
+ showNoOptionsMessage() {
144
+ if (this.element.querySelector(".dropdown_no_options")) return;
145
+
146
+ const noOptionElement = document.createElement("div");
147
+ noOptionElement.className = "pb_body_kit_light dropdown_no_options pb_item_kit p_xs display_flex justify_content_center";
148
+ noOptionElement.textContent = "no option";
149
+
150
+ this.target.appendChild(noOptionElement);
151
+ }
152
+
153
+ removeNoOptionsMessage() {
154
+ const existing = this.element.querySelector(".dropdown_no_options");
155
+ if (existing) {
156
+ existing.remove();
157
+ }
134
158
  }
135
159
 
136
160
  handleOptionClick(event) {
@@ -3,7 +3,7 @@
3
3
  @import "../../pb_caption/caption_mixin";
4
4
 
5
5
  @media only screen and (max-width: $screen-xs-max) {
6
- [class^=pb_table]:not(.table-responsive-scroll) {
6
+ [class^=pb_table] {
7
7
  &.table-sm.table-collapse-sm,
8
8
  &.table-md.table-collapse-sm,
9
9
  &.table-lg.table-collapse-sm {