playbook_ui 14.20.0.pre.alpha.PLAY2178advancedtablerowpinning7978 → 14.20.0.pre.alpha.PLAY2178advancedtablerowpinning7983

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: c8e79a2664649f32a2195a4e9199e868f6c1ebac20764479066f12c2dbbd7e9c
4
- data.tar.gz: da415e2485131587cc6a32a03c8145152df934616500a008ef06b4e49c6c049a
3
+ metadata.gz: 5e193bba835e739b1f100fc8f6dd9a6a350d05d107f30920aa4cab96511f8101
4
+ data.tar.gz: 4bad0ac7db2f0fff41ffe99e0863bce698b55dbf135e69d72da8698d74e3f5ba
5
5
  SHA512:
6
- metadata.gz: fd7c9331ca4274f9e6e95d186ada4456ddfa8240d1cc48249dd0b899931bf3db83576abfbfed0ebd4105e2159d57cc9efb75a3a16e2d33cc6a37262dede08746
7
- data.tar.gz: 9072a56af0c016514dd3a3f3d5b0e20fbdbaea20ca5b25d258f3c31c859fc0d4edc855c58ed297089453525b67df0789c6ff216b9dd500eaa5115664a4bba396
6
+ metadata.gz: 718a64fef8b65a401ee28133274da854894174d054fcc2afb408d1f9ee01653b11d786225489e0250e041fad112dde64afaadd6fd48c9e7dc70e8e8ec6ad64fc
7
+ data.tar.gz: 61315558b9260c2e4a407cd06ae21690ff4d9902242b5081238731550f135bf340b20e8f6859f12a7bd7926bf4ce53fd79b99b2badc2e79e97bc206fa9f307a2
@@ -19,6 +19,71 @@ type RegularTableViewProps = {
19
19
  subRowHeaders?: string[]
20
20
  }
21
21
 
22
+ // Helper function for Table Rendering
23
+ const TableCellRenderer = ({
24
+ row,
25
+ collapsibleTrail = true,
26
+ loading = false,
27
+ stickyLeftColumn,
28
+ columnPinning
29
+ }: {
30
+ row: Row<GenericObject>
31
+ collapsibleTrail?: boolean
32
+ loading?: boolean | string
33
+ stickyLeftColumn?: string[]
34
+ columnPinning: { left: string[] }
35
+ }) => {
36
+ return (
37
+ <>
38
+ {row.getVisibleCells().map((cell: Cell<GenericObject, unknown>, i: number) => {
39
+ const isPinnedLeft = columnPinning.left.includes(cell.column.id);
40
+ const isLastCell = (() => {
41
+ const parent = cell.column.parent;
42
+ if (!parent) {
43
+ const last = row.getVisibleCells().at(-1);
44
+ return last?.column.id === cell.column.id;
45
+ }
46
+
47
+ const visibleSiblings = parent.columns.filter(col => col.getIsVisible());
48
+ return visibleSiblings.at(-1)?.id === cell.column.id;
49
+ })();
50
+
51
+ const { column } = cell;
52
+
53
+ return (
54
+ <td
55
+ align="right"
56
+ className={classnames(
57
+ `${cell.id}-cell position_relative`,
58
+ isChrome() ? "chrome-styles" : "",
59
+ isPinnedLeft && 'pinned-left',
60
+ stickyLeftColumn && stickyLeftColumn.length > 0 && isPinnedLeft && 'sticky-left',
61
+ isLastCell && 'last-cell',
62
+ )}
63
+ key={`${cell.id}-data`}
64
+ style={{
65
+ left: isPinnedLeft
66
+ ? i === 1 // Accounting for set min-width for first column
67
+ ? '180px'
68
+ : `${column.getStart("left")}px`
69
+ : undefined,
70
+ }}
71
+ >
72
+ {collapsibleTrail && i === 0 && row.depth > 0 && renderCollapsibleTrail(row.depth)}
73
+ <span id={`${cell.id}-span`}>
74
+ {loading ? (
75
+ <LoadingCell />
76
+ ) : (
77
+ flexRender(cell.column.columnDef.cell, cell.getContext())
78
+ )}
79
+ </span>
80
+ </td>
81
+ );
82
+ })}
83
+ </>
84
+ )
85
+ }
86
+
22
87
  export const RegularTableView = ({
23
88
  collapsibleTrail = true,
24
89
  subRowHeaders,
@@ -70,50 +135,13 @@ export const RegularTableView = ({
70
135
  zIndex: '3'
71
136
  }}
72
137
  >
73
- {row.getVisibleCells().map((cell: Cell<GenericObject, unknown>, i: number) => {
74
- const isPinnedLeft = columnPinning.left.includes(cell.column.id);
75
- const isLastCell = (() => {
76
- const parent = cell.column.parent;
77
- if (!parent) {
78
- const last = row.getVisibleCells().at(-1);
79
- return last?.column.id === cell.column.id;
80
- }
81
-
82
- const visibleSiblings = parent.columns.filter(col => col.getIsVisible());
83
- return visibleSiblings.at(-1)?.id === cell.column.id;
84
- })();
85
-
86
- const { column } = cell;
87
- return (
88
- <td
89
- align="right"
90
- className={classnames(
91
- `${cell.id}-cell position_relative`,
92
- isChrome() ? "chrome-styles" : "",
93
- isPinnedLeft && 'pinned-left',
94
- stickyLeftColumn && stickyLeftColumn.length > 0 && isPinnedLeft && 'sticky-left',
95
- isLastCell && 'last-cell',
96
- )}
97
- key={`${cell.id}-data`}
98
- style={{
99
- left: isPinnedLeft
100
- ? i === 1 //Accounting for set min-width for first column
101
- ? '180px'
102
- : `${column.getStart("left")}px`
103
- : undefined,
104
- }}
105
- >
106
- {collapsibleTrail && i === 0 && row.depth > 0 && renderCollapsibleTrail(row.depth)}
107
- <span id={`${cell.id}-span`}>
108
- {loading ? (
109
- <LoadingCell />
110
- ) : (
111
- flexRender(cell.column.columnDef.cell, cell.getContext())
112
- )}
113
- </span>
114
- </td>
115
- );
116
- })}
138
+ <TableCellRenderer
139
+ collapsibleTrail={collapsibleTrail}
140
+ columnPinning={columnPinning}
141
+ loading={loading}
142
+ row={row}
143
+ stickyLeftColumn={stickyLeftColumn}
144
+ />
117
145
  </tr>
118
146
  )
119
147
  }
@@ -167,51 +195,13 @@ export const RegularTableView = ({
167
195
  />
168
196
  </td>
169
197
  )}
170
-
171
- {row.getVisibleCells().map((cell: Cell<GenericObject, unknown>, i: number) => {
172
- const isPinnedLeft = columnPinning.left.includes(cell.column.id);
173
- const isLastCell = (() => {
174
- const parent = cell.column.parent;
175
- if (!parent) {
176
- const last = row.getVisibleCells().at(-1);
177
- return last?.column.id === cell.column.id;
178
- }
179
-
180
- const visibleSiblings = parent.columns.filter(col => col.getIsVisible());
181
- return visibleSiblings.at(-1)?.id === cell.column.id;
182
- })();
183
-
184
- const { column } = cell;
185
- return (
186
- <td
187
- align="right"
188
- className={classnames(
189
- `${cell.id}-cell position_relative`,
190
- isChrome() ? "chrome-styles" : "",
191
- isPinnedLeft && 'pinned-left',
192
- stickyLeftColumn && stickyLeftColumn.length > 0 && isPinnedLeft && 'sticky-left',
193
- isLastCell && 'last-cell',
194
- )}
195
- key={`${cell.id}-data`}
196
- style={{
197
- left: isPinnedLeft
198
- ? i === 1 //Accounting for set min-width for first column
199
- ? '180px'
200
- : `${column.getStart("left")}px`
201
- : undefined,
202
- }}
203
- >
204
- {collapsibleTrail && i === 0 && row.depth > 0 && renderCollapsibleTrail(row.depth)}
205
- <span id={`${cell.id}-span`}>
206
- {loading ? (
207
- <LoadingCell />
208
- ) : (
209
- flexRender(cell.column.columnDef.cell, cell.getContext())
210
- )}
211
- </span>
212
- </td>
213
- );
214
- })}
198
+ <TableCellRenderer
199
+ collapsibleTrail={collapsibleTrail}
200
+ columnPinning={columnPinning}
201
+ loading={loading}
202
+ row={row}
203
+ stickyLeftColumn={stickyLeftColumn}
204
+ />
215
205
  </tr>
216
206
 
217
207
  {/* Display LoadingInline if Row Data is querying and there are no children already */}
@@ -24,7 +24,10 @@ interface UseTableStateProps {
24
24
  loading?: boolean | string;
25
25
  pagination?: boolean;
26
26
  paginationProps?: GenericObject;
27
- pinnedRows?: any;
27
+ pinnedRows?: {
28
+ value?: RowPinningState;
29
+ onChange?: (value: RowPinningState) => void;
30
+ };
28
31
  virtualizedRows?: boolean;
29
32
  tableOptions?: GenericObject;
30
33
  onRowSelectionChange?: (arg: RowSelectionState) => void;
@@ -368,6 +368,10 @@
368
368
  box-shadow: 1px 0px 0px 0px var(--column-border-color) !important;
369
369
  }
370
370
 
371
+ .pb_table_td:nth-child(2) {
372
+ box-shadow: inset 1px 0px 0px 0px var(--column-border-color) !important;
373
+ }
374
+
371
375
  // Color for collapsible trail
372
376
  .collapsible-trail {
373
377
  background-color: $border_light !important;
@@ -564,6 +568,10 @@
564
568
  box-shadow: $shadow_deep !important;
565
569
  }
566
570
 
571
+ .pb_table_td:nth-child(2) {
572
+ box-shadow: 0 0 0 0 !important;
573
+ }
574
+
567
575
  .pb_advanced_table_header,
568
576
  .pb_advanced_table_body {
569
577
  th.sticky-left,
@@ -2,7 +2,7 @@ import React, { useRef, useEffect, useState, useCallback } from "react";
2
2
  import classnames from "classnames";
3
3
 
4
4
  import { GenericObject } from "../types";
5
- import { Row, RowSelectionState } from "@tanstack/react-table";
5
+ import { Row, RowSelectionState, RowPinningState } from "@tanstack/react-table";
6
6
 
7
7
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
8
8
  import { globalProps, GlobalProps } from "../utilities/globalProps";
@@ -52,7 +52,10 @@ type AdvancedTableProps = {
52
52
  onToggleExpansionClick?: (arg: Row<GenericObject>) => void
53
53
  pagination?: boolean,
54
54
  paginationProps?: GenericObject,
55
- pinnedRows?: any,
55
+ pinnedRows?: {
56
+ value?: RowPinningState;
57
+ onChange?: (value: RowPinningState) => void;
58
+ };
56
59
  responsive?: "scroll" | "none",
57
60
  selectableRows?: boolean,
58
61
  showActionsBar?: boolean,
@@ -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) {