trotl-table 1.0.102 → 1.0.104

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.
package/README.md CHANGED
@@ -121,12 +121,16 @@ export default function Demo() {
121
121
  - `tableId`: unique string ID for the table
122
122
  - `columns`: array of `{ header, accessor }`
123
123
  - `data`: array of row objects
124
- - `styles`: optional table theme. Set to `"professional"` for a compact premium business grid: a graphite-navy header, fine horizontal separators, subtle row banding, outlined action icons, and blue selection/focus states. Other values retain the default appearance.
124
+ - `styles`: optional table theme. All supported themes use a compact premium grid with fine horizontal separators, subtle row banding, and outlined action icons:
125
+ - `"professional"`: graphite-navy header and slate-blue selection/focus states.
126
+ - `"power"`: bold charcoal header with warm amber selection/focus states and ivory row banding.
127
+ - `"lady"`: refined plum header with rose selection/focus states and soft blush row banding.
128
+ - Missing or unrecognized values retain the default appearance.
125
129
  - `isGrouped`: enable grouped mode (true/false)
126
130
  - `groupKey`: key to group rows by
127
131
  - `extraSearchTerm`: string to filter + highlight rows
128
- - `rowHeight`: row height in px (default `34`, or `30` with `styles="professional"`). Explicit values override the theme default.
129
- - `groupHeaderHeight`: group header height in px (default `36`, or `32` with `styles="professional"`). Explicit values override the theme default.
132
+ - `rowHeight`: row height in px (default `34`). Ignored with any supported theme, which always uses `30px` rows.
133
+ - `groupHeaderHeight`: group header height in px (default `36`). Ignored with any supported theme, which always uses `32px` group headers.
130
134
  - `mobileColumnCount`: number of data columns shown at viewport widths of 768px or less (1 or 2; default `2`). The full row details are shown in a modal when a mobile row is clicked.
131
135
  - `mobileRowClick`: optional callback `(row) => {}` invoked instead of opening the built-in details modal when a mobile row is clicked. Clicks on row controls and action buttons keep their existing behavior.
132
136
  - On mobile, when `enableMouseRightClick` actions are provided, double-tapping a row opens the same context menu as a right click (a single tap then opens details after a short ~280ms delay).
package/dist/Table.cjs.js CHANGED
@@ -9722,8 +9722,8 @@ function TableInner({
9722
9722
  routePath = null,
9723
9723
  extraSearchTerm = "",
9724
9724
  styles,
9725
- rowHeight = styles === "professional" ? 30 : 34,
9726
- groupHeaderHeight = styles === "professional" ? 32 : 36,
9725
+ rowHeight: requestedRowHeight = 34,
9726
+ groupHeaderHeight: requestedGroupHeaderHeight = 36,
9727
9727
  showKey = false,
9728
9728
  keyWidth = null,
9729
9729
  selectedRowsCallback = () => {},
@@ -9762,7 +9762,13 @@ function TableInner({
9762
9762
  timeoutLoading = 5,
9763
9763
  t
9764
9764
  }) {
9765
- const isProfessional = styles === "professional";
9765
+ const hasTheme = ["professional", "power", "lady"].includes(styles);
9766
+ const rowHeight = hasTheme ? 30 : requestedRowHeight;
9767
+ const groupHeaderHeight = hasTheme ? 32 : requestedGroupHeaderHeight;
9768
+ const virtualizedListRef = React.useRef(null);
9769
+ React.useEffect(() => {
9770
+ virtualizedListRef.current?.recomputeRowHeights();
9771
+ }, [rowHeight, groupHeaderHeight]);
9766
9772
  let translate;
9767
9773
  if (t) {
9768
9774
  translate = t;
@@ -11363,7 +11369,7 @@ function TableInner({
11363
11369
  role: "img",
11364
11370
  "aria-hidden": "false",
11365
11371
  title: translate("view")
11366
- }, isProfessional ? /*#__PURE__*/React.createElement(ActionIcon, {
11372
+ }, hasTheme ? /*#__PURE__*/React.createElement(ActionIcon, {
11367
11373
  name: "view"
11368
11374
  }) : "👁️") : translate("view")), showEdit && /*#__PURE__*/React.createElement("button", {
11369
11375
  className: "action-btn-table",
@@ -11374,7 +11380,7 @@ function TableInner({
11374
11380
  role: "img",
11375
11381
  "aria-hidden": "false",
11376
11382
  title: translate("edit")
11377
- }, isProfessional ? /*#__PURE__*/React.createElement(ActionIcon, {
11383
+ }, hasTheme ? /*#__PURE__*/React.createElement(ActionIcon, {
11378
11384
  name: "edit"
11379
11385
  }) : "✏️") : translate("edit")), showDuplicate && /*#__PURE__*/React.createElement("button", {
11380
11386
  className: "action-btn-table",
@@ -11382,13 +11388,13 @@ function TableInner({
11382
11388
  onDoubleClick: e => e.stopPropagation(),
11383
11389
  "aria-label": translate("duplicate")
11384
11390
  }, showIcons ? /*#__PURE__*/React.createElement("span", {
11385
- style: isProfessional ? undefined : {
11391
+ style: hasTheme ? undefined : {
11386
11392
  color: "black"
11387
11393
  },
11388
11394
  role: "img",
11389
11395
  "aria-hidden": "false",
11390
11396
  title: translate("duplicate")
11391
- }, isProfessional ? /*#__PURE__*/React.createElement(ActionIcon, {
11397
+ }, hasTheme ? /*#__PURE__*/React.createElement(ActionIcon, {
11392
11398
  name: "duplicate"
11393
11399
  }) : "🗐") : translate("duplicate")), showDelete && /*#__PURE__*/React.createElement("button", {
11394
11400
  className: "action-btn-table",
@@ -11400,7 +11406,7 @@ function TableInner({
11400
11406
  role: "img",
11401
11407
  "aria-hidden": "false",
11402
11408
  title: translate("delete")
11403
- }, isProfessional ? /*#__PURE__*/React.createElement(ActionIcon, {
11409
+ }, hasTheme ? /*#__PURE__*/React.createElement(ActionIcon, {
11404
11410
  name: "delete"
11405
11411
  }) : "🗑️") : translate("delete")), showUndelete && /*#__PURE__*/React.createElement("button", {
11406
11412
  className: "action-btn-table",
@@ -11411,7 +11417,7 @@ function TableInner({
11411
11417
  role: "img",
11412
11418
  "aria-hidden": "false",
11413
11419
  title: translate("undelete")
11414
- }, isProfessional ? /*#__PURE__*/React.createElement(ActionIcon, {
11420
+ }, hasTheme ? /*#__PURE__*/React.createElement(ActionIcon, {
11415
11421
  name: "undelete"
11416
11422
  }) : "♻️") : translate("undelete")), showShare && /*#__PURE__*/React.createElement("button", {
11417
11423
  className: "action-btn-table",
@@ -11422,7 +11428,7 @@ function TableInner({
11422
11428
  role: "img",
11423
11429
  "aria-hidden": "false",
11424
11430
  title: translate("share")
11425
- }, isProfessional ? /*#__PURE__*/React.createElement(ActionIcon, {
11431
+ }, hasTheme ? /*#__PURE__*/React.createElement(ActionIcon, {
11426
11432
  name: "share"
11427
11433
  }) : "🔗") : translate("share")), showDownload && /*#__PURE__*/React.createElement("button", {
11428
11434
  className: "action-btn-table",
@@ -11433,7 +11439,7 @@ function TableInner({
11433
11439
  role: "img",
11434
11440
  "aria-hidden": "false",
11435
11441
  title: translate("download") || "Download"
11436
- }, isProfessional ? /*#__PURE__*/React.createElement(ActionIcon, {
11442
+ }, hasTheme ? /*#__PURE__*/React.createElement(ActionIcon, {
11437
11443
  name: "download"
11438
11444
  }) : "📥") : translate("download") || "Download")));
11439
11445
  if (enableDragRow && item.type === "row") {
@@ -11448,7 +11454,7 @@ function TableInner({
11448
11454
  }, content);
11449
11455
  }
11450
11456
  return content;
11451
- }, [tableDataFlat, visibleColumns, selectedRows, toggleRowSelection, groupRowsById, renderCell, getCellStyle, showActions, showDelete, showEdit, showKey, showView, translate, enableDragRow, moveRow, enableMultiSelect, rowHeight, tableId, customColumns, isMobile, enableMouseRightClick, doubleClickEnable, keyWidth, actionColumnStyle, showDuplicate, showDownload, showIcons, isProfessional, showShare, getHighlightRowStyle, triggerCellCallback, getAccessorKey, getAccessorValue]);
11457
+ }, [tableDataFlat, visibleColumns, selectedRows, toggleRowSelection, groupRowsById, renderCell, getCellStyle, showActions, showDelete, showEdit, showKey, showView, translate, enableDragRow, moveRow, enableMultiSelect, rowHeight, tableId, customColumns, isMobile, enableMouseRightClick, doubleClickEnable, keyWidth, actionColumnStyle, showDuplicate, showDownload, showIcons, hasTheme, showShare, getHighlightRowStyle, triggerCellCallback, getAccessorKey, getAccessorValue]);
11452
11458
  const rightClickActions = Array.isArray(enableMouseRightClick) ? enableMouseRightClick : [];
11453
11459
  const [hoveredActionIndex, setHoveredActionIndex] = React.useState(null);
11454
11460
  const rowHeightGetter = ({
@@ -11480,7 +11486,7 @@ function TableInner({
11480
11486
  }, [useExternalDndContext, enableExternalRowDrop, externalDrop]);
11481
11487
  const tableMarkup = /*#__PURE__*/React.createElement("div", {
11482
11488
  className: "table-container",
11483
- "data-table-style": isProfessional ? styles : undefined,
11489
+ "data-table-style": hasTheme ? styles : undefined,
11484
11490
  ref: setTableRef,
11485
11491
  style: useExternalDndContext && enableExternalRowDrop ? {
11486
11492
  transition: "background 0.15s",
@@ -11544,7 +11550,7 @@ function TableInner({
11544
11550
  className: "table-cell action-cell",
11545
11551
  style: actionColumnStyle,
11546
11552
  title: translate("action")
11547
- }, showIcons && !isProfessional ? /*#__PURE__*/React.createElement("span", {
11553
+ }, showIcons && !hasTheme ? /*#__PURE__*/React.createElement("span", {
11548
11554
  title: translate("action")
11549
11555
  }, "\u2699\uFE0F") : translate("action")))), /*#__PURE__*/React.createElement("div", {
11550
11556
  className: "main-table",
@@ -11563,6 +11569,7 @@ function TableInner({
11563
11569
  height,
11564
11570
  width
11565
11571
  }) => /*#__PURE__*/React.createElement(List, {
11572
+ ref: virtualizedListRef,
11566
11573
  width: width,
11567
11574
  height: height,
11568
11575
  rowCount: tableDataFlat.length,