@jirawatpyk/aura-react 4.8.0 → 4.10.0

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.
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import * as React from "react";
3
- import { useStrings } from "./locale.js";
3
+ import { useStrings, useLinkComponent } from "./locale.js";
4
4
  import { cx, useMaybeControlled, compare, useIsoLayoutEffect, useMergedRef } from "./internal.js";
5
5
  import { Icon } from "./Icon.js";
6
6
  import { IconButton } from "./IconButton.js";
@@ -25,7 +25,11 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
25
25
  });
26
26
  const rows = props.rows || [];
27
27
  const rowKey = props.rowKey || columns[0].key;
28
- const loading = !!props.loading;
28
+ const manual = !!props.manual;
29
+ const Link = useLinkComponent(props.linkComponent);
30
+ const busy = !!props.loading;
31
+ const refreshing = busy && manual && rows.length > 0;
32
+ const loading = busy && !refreshing;
29
33
  const selectable = !!props.selectable;
30
34
  const reorderable = props.reorderable !== false && !!props.columnControls;
31
35
  const controls = !!props.columnControls;
@@ -157,7 +161,7 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
157
161
  }
158
162
  const view = React.useMemo(
159
163
  function() {
160
- if (!sort || !sort.key || !byKey[sort.key]) return rows;
164
+ if (manual || !sort || !sort.key || !byKey[sort.key]) return rows;
161
165
  const col = byKey[sort.key];
162
166
  const val = col.sortValue || (col.pill ? function(r) {
163
167
  return TONE_ORDER[col.tones && col.tones[r[col.key]] || toneFor(r[col.key])];
@@ -173,7 +177,7 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
173
177
  return p[0];
174
178
  });
175
179
  },
176
- [rows, sort && sort.key, sort && sort.dir]
180
+ [rows, manual, sort && sort.key, sort && sort.dir]
177
181
  );
178
182
  function nextSort(key) {
179
183
  if (!sort || sort.key !== key) return { key, dir: "asc" };
@@ -181,18 +185,51 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
181
185
  return null;
182
186
  }
183
187
  const pageSize = props.pageSize || 0;
184
- const pageCount = pageSize ? Math.max(1, Math.ceil(view.length / pageSize)) : 1;
188
+ const total = manual ? props.totalRows != null ? props.totalRows : (Math.max(1, pageState[0] || 1) - 1) * pageSize + rows.length + (pageSize && rows.length >= pageSize ? 1 : 0) : view.length;
189
+ const pageCount = pageSize ? Math.max(1, Math.ceil(total / pageSize)) : 1;
185
190
  const page = Math.min(Math.max(1, pageState[0] || 1), pageCount);
186
191
  const first = pageSize ? (page - 1) * pageSize : 0;
187
- const pageRows = pageSize ? view.slice(first, first + pageSize) : view;
192
+ const pageRows = pageSize && !manual ? view.slice(first, first + pageSize) : view;
193
+ const canSortAny = !busy && (manual ? total > 1 : rows.length > 1);
194
+ const shownTotal = manual && props.totalRows == null ? first + rows.length : total;
195
+ const linkPaging = !!props.getPageHref && !props.onPageChange;
196
+ const prevLink = React.useRef(null), nextLink = React.useRef(null);
188
197
  function goPage(p, focus) {
189
198
  const next = Math.min(Math.max(1, p), pageCount);
190
199
  if (next === page) return false;
200
+ if (linkPaging) {
201
+ const a = next === page - 1 ? prevLink.current : next === page + 1 ? nextLink.current : null;
202
+ if (a) a.click();
203
+ return false;
204
+ }
191
205
  if (focus) pending.current = focus;
192
206
  pageState[1](next);
193
207
  if (scrollRef.current) scrollRef.current.scrollTop = 0;
194
208
  return true;
195
209
  }
210
+ function sortBy(key) {
211
+ setSort(nextSort(key));
212
+ if (!(manual && linkPaging)) goPage(1);
213
+ }
214
+ const rowHref = props.getRowHref;
215
+ function followRow(el, e) {
216
+ const a = el && el.querySelector(".aura-table__row-link");
217
+ if (!a) return;
218
+ a.dispatchEvent(
219
+ new MouseEvent("click", {
220
+ bubbles: true,
221
+ cancelable: true,
222
+ view: window,
223
+ ctrlKey: !!(e && e.ctrlKey),
224
+ metaKey: !!(e && e.metaKey),
225
+ shiftKey: !!(e && e.shiftKey),
226
+ altKey: !!(e && e.altKey)
227
+ })
228
+ );
229
+ }
230
+ function rowLinkWrap(r, content) {
231
+ return rowHref ? /* @__PURE__ */ React.createElement(Link, { href: rowHref(r), className: "aura-table__row-link" }, content) : content;
232
+ }
196
233
  const height = props.height || 0;
197
234
  const virtual = !!height && !loading && pageRows.length > 0;
198
235
  const bodyH = Math.max(ROW_H, height - ROW_H);
@@ -511,10 +548,10 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
511
548
  else handled = false;
512
549
  } else if (k === " " || k === "Enter") {
513
550
  if (r === 0 && !col && selectable && nRows) toggleAll();
514
- else if (r === 0 && col && col.sortable && nRows > 1) {
515
- setSort(nextSort(col.key));
516
- goPage(1);
517
- } else if (r > 0 && k === " " && selectable) toggle(row[rowKey], !selSet[row[rowKey]]);
551
+ else if (r === 0 && col && col.sortable && canSortAny) sortBy(col.key);
552
+ else if (r > 0 && k === " " && selectable) toggle(row[rowKey], !selSet[row[rowKey]]);
553
+ else if (r > 0 && k === "Enter" && rowHref && !target.querySelector("button, a[href]:not(.aura-table__row-link), input, select, textarea"))
554
+ followRow(target.closest('[role="row"]'), e);
518
555
  else if (r > 0 && k === "Enter" && target.querySelector("button, a[href], input, select, textarea"))
519
556
  target.querySelector("button, a[href], input, select, textarea").focus();
520
557
  else if (r > 0 && k === "Enter" && props.onRowActivate) props.onRowActivate(row);
@@ -557,7 +594,7 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
557
594
  vis.forEach(function(c, i) {
558
595
  const ci = i + (selectable ? 1 : 0);
559
596
  const isSorted = sort && sort.key === c.key;
560
- const canSort = c.sortable && rows.length > 1 && !loading;
597
+ const canSort = c.sortable && canSortAny;
561
598
  const ariaSort = isSorted && canSort ? sort.dir === "desc" ? "descending" : "ascending" : canSort ? "none" : void 0;
562
599
  const pin = isPinned(c), edge = pin && i === nPinned - 1;
563
600
  head.push(
@@ -573,12 +610,13 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
573
610
  "data-rc": "0:" + ci,
574
611
  className: cx(
575
612
  "aura-table__th",
613
+ c.align === "end" && "is-end",
576
614
  pin && "is-pinned",
577
615
  edge && "is-pin-edge",
578
616
  drag && drag.over === c.key && (drag.after ? "is-drop-after" : "is-drop-before"),
579
617
  drag && drag.key === c.key && "is-dragging"
580
618
  ),
581
- draggable: reorderable && !loading ? true : void 0,
619
+ draggable: reorderable && !busy ? true : void 0,
582
620
  onFocus: function(e) {
583
621
  if (e.target === e.currentTarget) activeState[1]({ r: 0, c: ci });
584
622
  },
@@ -616,8 +654,7 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
616
654
  tabIndex: -1,
617
655
  className: cx("aura-table__sort", isSorted && "is-active"),
618
656
  onClick: function() {
619
- setSort(nextSort(c.key));
620
- goPage(1);
657
+ sortBy(c.key);
621
658
  activeState[1]({ r: 0, c: ci });
622
659
  }
623
660
  },
@@ -670,6 +707,10 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
670
707
  }
671
708
  )
672
709
  );
710
+ function cellContent(c, r) {
711
+ const v = r[c.key];
712
+ return c.render ? c.render(r) : c.pill ? /* @__PURE__ */ React.createElement(StatusPill, { ...{ tone: c.tones && c.tones[v] } }, v) : v;
713
+ }
673
714
  function rowCells(r, i, k, isSel) {
674
715
  const ri = i + 1;
675
716
  const cells = [/* @__PURE__ */ React.createElement("span", { key: "__gl", className: "aura-table__gutter", "aria-hidden": true })];
@@ -716,6 +757,7 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
716
757
  className: cx(
717
758
  "aura-table__td",
718
759
  c.mono && "aura-table__mono",
760
+ c.align === "end" && "is-end",
719
761
  pin && "is-pinned",
720
762
  pin && j === nPinned - 1 && "is-pin-edge"
721
763
  ),
@@ -724,7 +766,7 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
724
766
  if (activeState[0].r !== ri || activeState[0].c !== ci) activeState[1]({ r: ri, c: ci });
725
767
  }
726
768
  },
727
- c.render ? c.render(r) : c.pill ? /* @__PURE__ */ React.createElement(StatusPill, { ...{ tone: c.tones && c.tones[v] } }, v) : v
769
+ j === 0 ? rowLinkWrap(r, cellContent(c, r)) : cellContent(c, r)
728
770
  )
729
771
  );
730
772
  });
@@ -753,13 +795,21 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
753
795
  );
754
796
  vis.forEach(function(c, j) {
755
797
  sk.push(
756
- /* @__PURE__ */ React.createElement("span", { key: c.key, className: cx("aura-table__td", isPinned(c) && "is-pinned"), style: cellStyle(c, j) }, /* @__PURE__ */ React.createElement(
798
+ /* @__PURE__ */ React.createElement(
757
799
  "span",
758
800
  {
759
- className: cx("aura-skel", c.pill && "aura-skel--pill"),
760
- style: c.pill ? void 0 : { width: SKELETON_WIDTHS[(i + j) % SKELETON_WIDTHS.length] }
761
- }
762
- ))
801
+ key: c.key,
802
+ className: cx("aura-table__td", c.align === "end" && "is-end", isPinned(c) && "is-pinned"),
803
+ style: cellStyle(c, j)
804
+ },
805
+ /* @__PURE__ */ React.createElement(
806
+ "span",
807
+ {
808
+ className: cx("aura-skel", c.pill && "aura-skel--pill"),
809
+ style: c.pill ? void 0 : { width: SKELETON_WIDTHS[(i + j) % SKELETON_WIDTHS.length] }
810
+ }
811
+ )
812
+ )
763
813
  );
764
814
  });
765
815
  sk.push(
@@ -787,12 +837,17 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
787
837
  role: "row",
788
838
  "aria-rowindex": first + i + 2,
789
839
  "aria-selected": selectable ? isSel : void 0,
790
- className: cx("aura-table__row", isSel && "is-selected", props.onRowActivate && "is-actionable"),
840
+ className: cx(
841
+ "aura-table__row",
842
+ isSel && "is-selected",
843
+ (props.onRowActivate || rowHref) && "is-actionable"
844
+ ),
791
845
  style: rowStyle,
792
846
  onClick: function(e) {
793
847
  const el = e.target;
794
848
  if (el.closest && el.closest(".aura-check, button, a, input")) return;
795
- if (props.onRowActivate) props.onRowActivate(r);
849
+ if (rowHref) followRow(e.currentTarget, e);
850
+ else if (props.onRowActivate) props.onRowActivate(r);
796
851
  }
797
852
  },
798
853
  rowCells(r, i, k, isSel)
@@ -804,31 +859,42 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
804
859
  bodyRows.push(/* @__PURE__ */ React.createElement("div", { key: "__bot", style: { height: (pageRows.length - end) * ROW_H + "px" }, "aria-hidden": true }));
805
860
  }
806
861
  let foot = null;
807
- if (pageSize && (rows.length || loading)) {
808
- const from = rows.length ? first + 1 : 0, to = Math.min(first + pageSize, view.length);
809
- foot = /* @__PURE__ */ React.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React.createElement("span", { "aria-live": "polite" }, loading ? t.loading : t.range(from, to, view.length)), /* @__PURE__ */ React.createElement("span", { className: "aura-table__pager" }, /* @__PURE__ */ React.createElement("span", null, t.page(page, pageCount)), /* @__PURE__ */ React.createElement(
810
- IconButton,
811
- {
812
- icon: "chevron-left",
813
- label: t.prevPage,
814
- disabled: loading || page <= 1,
815
- onClick: function() {
816
- goPage(page - 1);
817
- }
818
- }
819
- ), /* @__PURE__ */ React.createElement(
862
+ function pagerButton(dir) {
863
+ const p = page + dir, off = busy || (dir < 0 ? page <= 1 : page >= pageCount), label = dir < 0 ? t.prevPage : t.nextPage, icon = dir < 0 ? "chevron-left" : "chevron-right";
864
+ if (props.getPageHref && !off)
865
+ return /* @__PURE__ */ React.createElement(
866
+ Link,
867
+ {
868
+ ref: dir < 0 ? prevLink : nextLink,
869
+ href: props.getPageHref(p),
870
+ className: "aura-icon-btn",
871
+ "aria-label": label,
872
+ onClick: function(e) {
873
+ if (props.onPageChange) {
874
+ e.preventDefault();
875
+ pageState[1](p);
876
+ }
877
+ }
878
+ },
879
+ /* @__PURE__ */ React.createElement(Icon, { name: icon })
880
+ );
881
+ return /* @__PURE__ */ React.createElement(
820
882
  IconButton,
821
883
  {
822
- icon: "chevron-right",
823
- label: t.nextPage,
824
- disabled: loading || page >= pageCount,
884
+ icon,
885
+ label,
886
+ disabled: off,
825
887
  onClick: function() {
826
- goPage(page + 1);
888
+ goPage(p);
827
889
  }
828
890
  }
829
- )));
891
+ );
892
+ }
893
+ if (pageSize && (rows.length || busy)) {
894
+ const from = rows.length ? first + 1 : 0, to = manual ? first + rows.length : Math.min(first + pageSize, view.length);
895
+ foot = /* @__PURE__ */ React.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React.createElement("span", { "aria-live": "polite" }, busy ? t.loading : t.range(from, to, shownTotal)), /* @__PURE__ */ React.createElement("span", { className: "aura-table__pager" }, /* @__PURE__ */ React.createElement("span", null, t.page(page, pageCount)), pagerButton(-1), pagerButton(1)));
830
896
  } else if (height && rows.length && !loading) {
831
- foot = /* @__PURE__ */ React.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React.createElement("span", null, t.rowCount(view.length)), selectable && selected.length ? /* @__PURE__ */ React.createElement("span", null, t.selectedCount(selected.length)) : /* @__PURE__ */ React.createElement("span", null));
897
+ foot = /* @__PURE__ */ React.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React.createElement("span", null, t.rowCount(shownTotal)), selectable && selected.length ? /* @__PURE__ */ React.createElement("span", null, t.selectedCount(selected.length)) : /* @__PURE__ */ React.createElement("span", null));
832
898
  }
833
899
  if (stacked) {
834
900
  const titleCol = vis[0], pillCol = vis.filter(function(c) {
@@ -849,25 +915,28 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
849
915
  const em2 = props.empty || {};
850
916
  cardBody = /* @__PURE__ */ React.createElement("div", { className: "aura-table__empty" }, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("span", { className: "aura-table__empty-icon" }, /* @__PURE__ */ React.createElement(Icon, { name: em2.icon || "inbox", size: "lg" })), /* @__PURE__ */ React.createElement("p", { className: "aura-table__empty-title" }, em2.title || t.empty), em2.description ? /* @__PURE__ */ React.createElement("p", { className: "aura-table__empty-text" }, em2.description) : null, em2.action ? /* @__PURE__ */ React.createElement("div", { className: "aura-table__empty-action" }, em2.action) : null));
851
917
  } else {
852
- const cellVal = function(c, r) {
853
- const v = r[c.key];
854
- return c.render ? c.render(r) : c.pill ? /* @__PURE__ */ React.createElement(StatusPill, { ...{ tone: c.tones && c.tones[v] } }, v) : v;
855
- };
918
+ const cellVal = cellContent;
856
919
  cardBody = /* @__PURE__ */ React.createElement("ul", { className: "aura-table__cards", "aria-label": props.label }, pageRows.map(function(r) {
857
920
  const k = r[rowKey], isSel = !!selSet[k];
858
921
  return /* @__PURE__ */ React.createElement(
859
922
  "li",
860
923
  {
861
924
  key: k,
862
- className: cx("aura-table__card", isSel && "is-selected", props.onRowActivate && "is-actionable"),
863
- tabIndex: props.onRowActivate ? 0 : void 0,
925
+ className: cx(
926
+ "aura-table__card",
927
+ isSel && "is-selected",
928
+ (props.onRowActivate || rowHref) && "is-actionable"
929
+ ),
930
+ tabIndex: props.onRowActivate && !rowHref ? 0 : void 0,
864
931
  onClick: function(e) {
865
932
  const el = e.target;
866
933
  if (el.closest && el.closest(".aura-check, button, a, input")) return;
867
- if (props.onRowActivate) props.onRowActivate(r);
934
+ if (rowHref) followRow(e.currentTarget, e);
935
+ else if (props.onRowActivate) props.onRowActivate(r);
868
936
  },
869
937
  onKeyDown: function(e) {
870
- if (e.target === e.currentTarget && e.key === "Enter" && props.onRowActivate) props.onRowActivate(r);
938
+ if (e.target === e.currentTarget && e.key === "Enter" && props.onRowActivate && !rowHref)
939
+ props.onRowActivate(r);
871
940
  }
872
941
  },
873
942
  /* @__PURE__ */ React.createElement("div", { className: "aura-table__card-head" }, selectable ? /* @__PURE__ */ React.createElement(
@@ -879,7 +948,7 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
879
948
  toggle(k, on);
880
949
  }
881
950
  }
882
- ) : null, /* @__PURE__ */ React.createElement("span", { className: cx("aura-table__card-title", titleCol.mono && "aura-table__mono") }, cellVal(titleCol, r)), pillCol ? cellVal(pillCol, r) : null, actionCols.map(function(c) {
951
+ ) : null, /* @__PURE__ */ React.createElement("span", { className: cx("aura-table__card-title", titleCol.mono && "aura-table__mono") }, rowLinkWrap(r, cellVal(titleCol, r))), pillCol ? cellVal(pillCol, r) : null, actionCols.map(function(c) {
883
952
  return /* @__PURE__ */ React.createElement("span", { key: c.key, className: "aura-table__card-actions" }, cellVal(c, r));
884
953
  })),
885
954
  rest.length ? /* @__PURE__ */ React.createElement("dl", { className: "aura-table__card-fields" }, rest.map(function(c) {
@@ -892,12 +961,13 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
892
961
  "div",
893
962
  {
894
963
  ref: wrapMerged,
895
- className: cx("aura-table aura-table--stacked", props.className),
964
+ className: cx("aura-table aura-table--stacked", refreshing && "is-refreshing", props.className),
896
965
  role: "region",
897
966
  "aria-label": props.label,
898
- "aria-busy": loading || void 0
967
+ "aria-busy": busy || void 0
899
968
  },
900
- selectable && pageRows.length && !loading ? /* @__PURE__ */ React.createElement("div", { className: "aura-table__stack-bar" }, /* @__PURE__ */ React.createElement(
969
+ refreshing ? /* @__PURE__ */ React.createElement("span", { className: "aura-table__busy-bar", "aria-hidden": true }) : null,
970
+ selectable && pageRows.length && !busy ? /* @__PURE__ */ React.createElement("div", { className: "aura-table__stack-bar" }, /* @__PURE__ */ React.createElement(
901
971
  Checkbox,
902
972
  {
903
973
  checked: all,
@@ -915,52 +985,64 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
915
985
  scrollPaddingTop: ROW_H + "px"
916
986
  };
917
987
  if (height) scrollStyle.height = height + "px";
918
- return /* @__PURE__ */ React.createElement("div", { ref: wrapMerged, className: cx("aura-table", scrolledX[0] && "is-scrolled-x", props.className) }, /* @__PURE__ */ React.createElement(
988
+ return /* @__PURE__ */ React.createElement(
919
989
  "div",
920
990
  {
921
- ref: function(el) {
922
- scrollRef.current = el;
923
- gridRef.current = el;
991
+ ref: wrapMerged,
992
+ className: cx("aura-table", scrolledX[0] && "is-scrolled-x", refreshing && "is-refreshing", props.className)
993
+ },
994
+ refreshing ? /* @__PURE__ */ React.createElement("span", { className: "aura-table__busy-bar", "aria-hidden": true }) : null,
995
+ /* @__PURE__ */ React.createElement(
996
+ "div",
997
+ {
998
+ ref: function(el) {
999
+ scrollRef.current = el;
1000
+ gridRef.current = el;
1001
+ },
1002
+ className: "aura-table__scroll",
1003
+ style: scrollStyle,
1004
+ role: "grid",
1005
+ "aria-label": props.label,
1006
+ "aria-busy": busy || void 0,
1007
+ "aria-rowcount": loading ? -1 : shownTotal + 1,
1008
+ "aria-colcount": nCols,
1009
+ "aria-multiselectable": selectable || void 0,
1010
+ onKeyDown: onGridKey,
1011
+ onScroll: function(e) {
1012
+ const t2 = e.currentTarget;
1013
+ if (virtual && Math.abs(t2.scrollTop - scrollTop) >= ROW_H / 2) setScrollTop(t2.scrollTop);
1014
+ else if (virtual && (t2.scrollTop === 0 || t2.scrollTop + t2.clientHeight >= t2.scrollHeight - 1))
1015
+ setScrollTop(t2.scrollTop);
1016
+ const sx = t2.scrollLeft > 0;
1017
+ if (sx !== scrolledX[0]) scrolledX[1](sx);
1018
+ }
924
1019
  },
925
- className: "aura-table__scroll",
926
- style: scrollStyle,
927
- role: "grid",
928
- "aria-label": props.label,
929
- "aria-busy": loading || void 0,
930
- "aria-rowcount": loading ? -1 : view.length + 1,
931
- "aria-colcount": nCols,
932
- "aria-multiselectable": selectable || void 0,
933
- onKeyDown: onGridKey,
934
- onScroll: function(e) {
935
- const t2 = e.currentTarget;
936
- if (virtual && Math.abs(t2.scrollTop - scrollTop) >= ROW_H / 2) setScrollTop(t2.scrollTop);
937
- else if (virtual && (t2.scrollTop === 0 || t2.scrollTop + t2.clientHeight >= t2.scrollHeight - 1))
938
- setScrollTop(t2.scrollTop);
939
- const sx = t2.scrollLeft > 0;
940
- if (sx !== scrolledX[0]) scrolledX[1](sx);
1020
+ /* @__PURE__ */ React.createElement("div", { className: "aura-table__head", role: "row", "aria-rowindex": 1, style: rowStyle }, head),
1021
+ body
1022
+ ),
1023
+ busy ? /* @__PURE__ */ React.createElement("span", { className: "aura-sr-only", role: "status" }, t.loadingRows) : null,
1024
+ controls ? /* @__PURE__ */ React.createElement("div", { className: "aura-table__picker" }, /* @__PURE__ */ React.createElement(
1025
+ IconButton,
1026
+ {
1027
+ icon: "columns-3",
1028
+ label: t.showHideColumns,
1029
+ "aria-haspopup": "menu",
1030
+ onClick: function(e) {
1031
+ openMenu("picker", null, e.currentTarget);
1032
+ }
941
1033
  }
942
- },
943
- /* @__PURE__ */ React.createElement("div", { className: "aura-table__head", role: "row", "aria-rowindex": 1, style: rowStyle }, head),
944
- body
945
- ), loading ? /* @__PURE__ */ React.createElement("span", { className: "aura-sr-only", role: "status" }, t.loadingRows) : null, controls ? /* @__PURE__ */ React.createElement("div", { className: "aura-table__picker" }, /* @__PURE__ */ React.createElement(
946
- IconButton,
947
- {
948
- icon: "columns-3",
949
- label: t.showHideColumns,
950
- "aria-haspopup": "menu",
951
- onClick: function(e) {
952
- openMenu("picker", null, e.currentTarget);
1034
+ )) : null,
1035
+ foot,
1036
+ menu ? /* @__PURE__ */ React.createElement(
1037
+ Menu,
1038
+ {
1039
+ anchor: menu.anchor,
1040
+ onClose: closeMenu,
1041
+ label: menu.kind === "picker" ? t.columns : t.column(byKey[menu.key] && byKey[menu.key].label),
1042
+ items: menu.kind === "picker" ? pickerItems() : byKey[menu.key] ? columnMenuItems(byKey[menu.key]) : []
953
1043
  }
954
- }
955
- )) : null, foot, menu ? /* @__PURE__ */ React.createElement(
956
- Menu,
957
- {
958
- anchor: menu.anchor,
959
- onClose: closeMenu,
960
- label: menu.kind === "picker" ? t.columns : t.column(byKey[menu.key] && byKey[menu.key].label),
961
- items: menu.kind === "picker" ? pickerItems() : byKey[menu.key] ? columnMenuItems(byKey[menu.key]) : []
962
- }
963
- ) : null);
1044
+ ) : null
1045
+ );
964
1046
  });
965
1047
  export {
966
1048
  DataTable