@economic/taco 2.12.0 → 2.13.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.
Files changed (43) hide show
  1. package/dist/components/Provider/Localization.d.ts +1 -0
  2. package/dist/components/Select2/components/Option.d.ts +7 -5
  3. package/dist/components/Table3/Table3.d.ts +9 -1
  4. package/dist/components/Table3/components/columns/header/Group.d.ts +15 -0
  5. package/dist/components/Table3/components/columns/header/Header.d.ts +5 -0
  6. package/dist/components/Table3/components/columns/internal/EditingActions.d.ts +1 -1
  7. package/dist/components/Table3/hooks/features/useHeaderOffsetStyle.d.ts +3 -0
  8. package/dist/components/Table3/types.d.ts +7 -0
  9. package/dist/esm/index.css +24 -6
  10. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +1 -1
  11. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
  12. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +4 -1
  13. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
  14. package/dist/esm/packages/taco/src/components/Provider/Localization.js +1 -0
  15. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  16. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +13 -6
  17. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  18. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +7 -6
  19. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  20. package/dist/esm/packages/taco/src/components/Table3/Table3.js +25 -8
  21. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  22. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js +70 -0
  23. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js.map +1 -0
  24. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js +26 -8
  25. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js.map +1 -1
  26. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js +13 -9
  27. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js.map +1 -1
  28. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +8 -5
  29. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js +14 -2
  31. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js.map +1 -1
  32. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useHeaderOffsetStyle.js +24 -0
  33. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useHeaderOffsetStyle.js.map +1 -0
  34. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js +30 -7
  35. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js.map +1 -1
  36. package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
  37. package/dist/index.css +24 -6
  38. package/dist/taco.cjs.development.js +221 -54
  39. package/dist/taco.cjs.development.js.map +1 -1
  40. package/dist/taco.cjs.production.min.js +1 -1
  41. package/dist/taco.cjs.production.min.js.map +1 -1
  42. package/package.json +2 -2
  43. package/types.json +7274 -6482
@@ -4426,6 +4426,7 @@ const defaultLocalisationTexts = {
4426
4426
  condition: 'Condition',
4427
4427
  value: 'Value'
4428
4428
  },
4429
+ hiddenColumn: 'Hidden column',
4429
4430
  tooltip: 'Apply filters',
4430
4431
  total: 'Viewing [CURRENT] of [TOTAL]'
4431
4432
  },
@@ -5558,7 +5559,7 @@ const useCombobox = ({
5558
5559
  // event handlers
5559
5560
  const handleInputBlur = event => {
5560
5561
  event.persist();
5561
- if (event.relatedTarget === listRef.current) {
5562
+ if (listRef.current && event.relatedTarget === listRef.current) {
5562
5563
  event.preventDefault();
5563
5564
  return;
5564
5565
  }
@@ -6740,7 +6741,10 @@ const DrawerContent = /*#__PURE__*/React__default.forwardRef(function Content(pr
6740
6741
  }, dragHandleProps, {
6741
6742
  "data-testid": "resize-handler",
6742
6743
  ref: dragHandlerRef
6743
- })), showCloseButton ? /*#__PURE__*/React__default.createElement(Close$3, null, /*#__PURE__*/React__default.createElement(IconButton, {
6744
+ }), dragging ? /*#__PURE__*/React__default.createElement("div", {
6745
+ "data-testid": "resize-hit-area",
6746
+ className: "fixed bottom-0 left-0 right-0 top-0"
6747
+ }) : null), showCloseButton ? /*#__PURE__*/React__default.createElement(Close$3, null, /*#__PURE__*/React__default.createElement(IconButton, {
6744
6748
  appearance: "discrete",
6745
6749
  "aria-label": texts.drawer.close,
6746
6750
  className: "absolute right-0 top-0 mr-2 mt-4",
@@ -9851,7 +9855,8 @@ const Option$1 = /*#__PURE__*/React__default.forwardRef(function Select2Option(p
9851
9855
  children,
9852
9856
  color,
9853
9857
  description,
9854
- icon,
9858
+ prefix,
9859
+ postfix,
9855
9860
  className: cName,
9856
9861
  ...otherProps
9857
9862
  } = props;
@@ -9905,14 +9910,20 @@ const Option$1 = /*#__PURE__*/React__default.forwardRef(function Select2Option(p
9905
9910
  }) : null, isTag ? /*#__PURE__*/React__default.createElement(Tag$1, {
9906
9911
  className: "pointer-events-none my-1",
9907
9912
  color: color,
9908
- icon: icon
9909
- }, children) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, icon ? typeof icon === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
9910
- name: icon
9911
- }) : icon : null, /*#__PURE__*/React__default.createElement("span", {
9913
+ icon: prefix
9914
+ }, children) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, prefix ? typeof prefix === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
9915
+ name: prefix
9916
+ }) : prefix : null, /*#__PURE__*/React__default.createElement("span", {
9917
+ className: "flex w-full justify-between"
9918
+ }, /*#__PURE__*/React__default.createElement("span", {
9912
9919
  className: "flex flex-col"
9913
9920
  }, /*#__PURE__*/React__default.createElement("span", null, children), description ? /*#__PURE__*/React__default.createElement("span", {
9914
9921
  className: "text-grey-700 -mt-1.5 mb-1.5 text-xs"
9915
- }, description) : null)), popover ? /*#__PURE__*/React__default.createElement(IconButton, {
9922
+ }, description) : null), /*#__PURE__*/React__default.createElement("span", {
9923
+ className: "mt-1 flex flex-col"
9924
+ }, postfix ? typeof postfix === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
9925
+ name: postfix
9926
+ }) : postfix : null))), popover ? /*#__PURE__*/React__default.createElement(IconButton, {
9916
9927
  icon: "ellipsis-vertical",
9917
9928
  appearance: "discrete",
9918
9929
  className: cn('group-aria-current:visible invisible -mr-1 ml-auto !h-5 min-h-[theme(spacing.6)] !w-5 min-w-[theme(spacing.6)] hover:!bg-black/[.08] focus:!shadow-none group-hover:visible', {
@@ -10062,13 +10073,14 @@ const Single = /*#__PURE__*/React__default.forwardRef(function Select2TriggerSin
10062
10073
  className: "truncate",
10063
10074
  color: currentValue.props.color,
10064
10075
  disabled: disabled,
10065
- icon: currentValue.props.icon,
10076
+ icon: currentValue.props.prefix,
10066
10077
  readOnly: readOnly
10067
10078
  }, currentValue.props.children);
10068
10079
  } else {
10069
- output = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, currentValue.props.icon ? typeof currentValue.props.icon === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
10070
- name: currentValue.props.icon
10071
- }) : currentValue.props.icon : null, currentValue.props.children);
10080
+ output = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, currentValue.props.prefix ? typeof currentValue.props.prefix === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
10081
+ name: currentValue.props.prefix,
10082
+ className: "mr-1 !h-5 !w-5"
10083
+ }) : currentValue.props.prefix : null, currentValue.props.children);
10072
10084
  }
10073
10085
  }
10074
10086
  return /*#__PURE__*/React__default.createElement(Button$2, Object.assign({}, buttonProps, {
@@ -10115,7 +10127,7 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
10115
10127
  className: "truncate",
10116
10128
  color: tags ? child.props.color : undefined,
10117
10129
  disabled: disabled,
10118
- icon: child.props.icon,
10130
+ icon: child.props.prefix,
10119
10131
  onDelete: event => {
10120
10132
  event === null || event === void 0 ? void 0 : event.stopPropagation();
10121
10133
  event === null || event === void 0 ? void 0 : event.preventDefault();
@@ -10183,7 +10195,7 @@ const MultipleValue = ({
10183
10195
  }),
10184
10196
  color: tags ? child.props.color : undefined,
10185
10197
  disabled: disabled,
10186
- icon: child.props.icon,
10198
+ icon: child.props.prefix,
10187
10199
  onDelete: open ? createClickHandler(child.props.value) : undefined,
10188
10200
  readOnly: readOnly
10189
10201
  }, child.props.children);
@@ -16194,6 +16206,7 @@ function Header$2(props) {
16194
16206
  children,
16195
16207
  column,
16196
16208
  header,
16209
+ hasSeparator,
16197
16210
  scrollToIndex,
16198
16211
  table
16199
16212
  } = props;
@@ -16229,10 +16242,13 @@ function Header$2(props) {
16229
16242
  canResize: column.getCanResize(),
16230
16243
  canSort,
16231
16244
  children: children !== null && children !== void 0 ? children : columnMeta.header,
16245
+ colSpan: header.colSpan,
16232
16246
  hasMenu: isMenuAvailable(table, header),
16247
+ hasSeparator,
16233
16248
  id: header.id,
16234
16249
  index: header.index,
16235
16250
  isFrozen: isFrozenColumn(header, table),
16251
+ isPlaceholder: header.isPlaceholder,
16236
16252
  isPrinting: tableMeta.isPrinting,
16237
16253
  isResizing: column.getIsResizing(),
16238
16254
  length: table.getRowModel().rows.length,
@@ -16257,10 +16273,13 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
16257
16273
  canHide,
16258
16274
  canResize,
16259
16275
  canSort,
16276
+ colSpan,
16260
16277
  hasMenu,
16278
+ hasSeparator,
16261
16279
  id,
16262
16280
  index,
16263
16281
  isFrozen,
16282
+ isPlaceholder,
16264
16283
  isPrinting,
16265
16284
  isResizing,
16266
16285
  length,
@@ -16274,19 +16293,22 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
16274
16293
  sortDirection,
16275
16294
  table
16276
16295
  } = props;
16277
- const className = cn('sticky top-0 border-b-2 font-bold box-content group/column relative', '[[role="table"][data-resizing="true"]_&]:pointer-events-none', 'px-[var(--table3-cell-padding-x)]', {
16296
+ const className = cn('sticky font-bold border-b-2 box-content group/column relative', '[[role="table"][data-resizing="true"]_&]:pointer-events-none', 'px-[var(--table3-cell-padding-x)]', {
16297
+ '!border-white': isPlaceholder,
16278
16298
  'h-10 items-center': !isPrinting,
16279
16299
  'pb-2': isPrinting,
16280
16300
  'cursor-pointer select-none': canSort,
16281
- 'hover:bg-grey-100': canSort || canResize || hasMenu,
16301
+ 'hover:bg-grey-100': !isPlaceholder && (canSort || canResize || hasMenu),
16282
16302
  'focus-within:bg-grey-100': hasMenu,
16283
- '!pointer-events-all !bg-grey-100': isResizing,
16303
+ '!pointer-events-all !bg-grey-100': !isPlaceholder && isResizing,
16284
16304
  // z-indexes
16285
16305
  'z-10 hover:z-20': !isFrozen && !isResizing,
16286
16306
  'z-20': !isFrozen && isResizing,
16287
- '!z-30': isFrozen,
16307
+ // when column is frozen, we need to increase it's z-index when it's hovered,
16308
+ // so that resize handler appears on top of next frozen cell, and didn't get cut by it.
16309
+ '!z-30 hover:!z-40': isFrozen,
16288
16310
  '!z-40': isFrozen && isResizing
16289
- }, meta.headerClassName);
16311
+ }, colSpan > 1 ? `col-span-${colSpan}` : '', meta.headerClassName);
16290
16312
  const [internalRef, setInternalRef] = React__default.useState(null);
16291
16313
  React__default.useLayoutEffect(() => {
16292
16314
  if (internalRef && length) {
@@ -16309,7 +16331,7 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
16309
16331
  "data-column-index": index,
16310
16332
  role: "columnheader",
16311
16333
  ref: setInternalRef
16312
- }), isInternalColumn$1(id) ? children : /*#__PURE__*/React__default.createElement(Tooltip, {
16334
+ }), isPlaceholder ? null : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isInternalColumn$1(id) ? children : /*#__PURE__*/React__default.createElement(Tooltip, {
16313
16335
  title: String((_meta$tooltip = meta === null || meta === void 0 ? void 0 : meta.tooltip) !== null && _meta$tooltip !== void 0 ? _meta$tooltip : children),
16314
16336
  placement: "top"
16315
16337
  }, /*#__PURE__*/React__default.createElement("span", {
@@ -16334,11 +16356,19 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
16334
16356
  scrollToIndex: scrollToIndex,
16335
16357
  sortDirection: sortDirection,
16336
16358
  table: table
16337
- }) : null, canResize ? /*#__PURE__*/React__default.createElement(Resizer, {
16359
+ }) : null), hasSeparator ? /*#__PURE__*/React__default.createElement(HeaderSeparator, null) : null, !isPlaceholder && canResize ? /*#__PURE__*/React__default.createElement(Resizer, {
16338
16360
  isResizing: isResizing,
16339
16361
  onResize: handleResize
16340
16362
  }) : null);
16341
16363
  });
16364
+ function HeaderSeparator() {
16365
+ return /*#__PURE__*/React__default.createElement("div", {
16366
+ "data-taco": "header-separator",
16367
+ className: cn('invisible absolute right-[0.5px] top-0 flex h-full w-2 touch-none select-none justify-center py-2 group-hover/header:visible')
16368
+ }, /*#__PURE__*/React__default.createElement("div", {
16369
+ className: cn('bg-grey-300 h-full w-[1px]')
16370
+ }));
16371
+ }
16342
16372
 
16343
16373
  const RowContext$1 = /*#__PURE__*/React__default.createContext({
16344
16374
  isHovered: false,
@@ -17552,6 +17582,7 @@ const savingIndicatorHideDelay = 3000;
17552
17582
  const COLUMN_ID$1 = '__editing_actions';
17553
17583
  const MemoedCell$1 = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
17554
17584
  const {
17585
+ hasChanges,
17555
17586
  isCurrentRow,
17556
17587
  isEditing,
17557
17588
  row,
@@ -17560,8 +17591,6 @@ const MemoedCell$1 = /*#__PURE__*/React__default.memo(function MemoedCell(props)
17560
17591
  const tableMeta = table.options.meta;
17561
17592
  const savingState = tableMeta.editing.savingStates && tableMeta.editing.savingStates[row.id];
17562
17593
  const [isSavedIndicatorVisible, setIsSavingIndicatorVisible] = React__default.useState(false);
17563
- const changeset = tableMeta.editing.changes ? Object.keys(tableMeta.editing.changes) : [];
17564
- const isRowInEditingState = changeset.indexOf(row.id) >= 0;
17565
17594
  const {
17566
17595
  texts
17567
17596
  } = useLocalization();
@@ -17583,14 +17612,14 @@ const MemoedCell$1 = /*#__PURE__*/React__default.memo(function MemoedCell(props)
17583
17612
  title: texts.table3.editing.saving.progress
17584
17613
  }, /*#__PURE__*/React__default.createElement(Spinner, {
17585
17614
  delay: 0,
17586
- className: "!text-grey-700 mr-1.5 !h-5 !w-5"
17615
+ className: "!text-grey-700 mr-1 !h-5 !w-5"
17587
17616
  }));
17588
17617
  } else if (isSavedIndicatorVisible) {
17589
17618
  content = /*#__PURE__*/React__default.createElement(Tooltip, {
17590
17619
  title: texts.table3.editing.saving.complete
17591
17620
  }, /*#__PURE__*/React__default.createElement(Icon, {
17592
17621
  name: "tick",
17593
- className: "!text-grey-700 mr-1"
17622
+ className: "!text-grey-700 mr-1 !h-5 !w-5"
17594
17623
  }));
17595
17624
  }
17596
17625
  }
@@ -17601,11 +17630,11 @@ const MemoedCell$1 = /*#__PURE__*/React__default.memo(function MemoedCell(props)
17601
17630
  icon: "more",
17602
17631
  menu: menuProps => /*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, null, /*#__PURE__*/React__default.createElement(Menu$1.Item, {
17603
17632
  icon: "tick",
17604
- disabled: !isRowInEditingState,
17633
+ disabled: !hasChanges,
17605
17634
  onClick: () => tableMeta.editing.saveChangesIfNeeded()
17606
17635
  }, texts.table3.editing.actions.save), /*#__PURE__*/React__default.createElement(Menu$1.Item, {
17607
17636
  icon: "close",
17608
- disabled: !isRowInEditingState,
17637
+ disabled: !hasChanges,
17609
17638
  onClick: () => tableMeta.editing.resetChange(row.id)
17610
17639
  }, texts.table3.editing.actions.clear), /*#__PURE__*/React__default.createElement(Menu$1.Item, {
17611
17640
  icon: "undo",
@@ -17614,12 +17643,15 @@ const MemoedCell$1 = /*#__PURE__*/React__default.memo(function MemoedCell(props)
17614
17643
  tabIndex: isCurrentRow ? 0 : -1
17615
17644
  }));
17616
17645
  }
17646
+ const contentClassName = cn('flex items-center justify-end text-right', {
17647
+ '-mb-2 -mt-2': isCurrentRow
17648
+ });
17617
17649
  return /*#__PURE__*/React__default.createElement(DisplayCell, Object.assign({}, props, {
17618
17650
  className: cn({
17619
17651
  '!sticky': !!content
17620
17652
  })
17621
17653
  }), content ? /*#__PURE__*/React__default.createElement("span", {
17622
- className: "-mb-2 -mt-2 flex items-center justify-end text-right"
17654
+ className: contentClassName
17623
17655
  }, content) : undefined);
17624
17656
  });
17625
17657
  function Cell$2(props) {
@@ -17627,12 +17659,14 @@ function Cell$2(props) {
17627
17659
  rowIndex
17628
17660
  } = React__default.useContext(RowContext$1);
17629
17661
  const tableMeta = props.table.options.meta;
17662
+ const changeset = tableMeta.editing.changes ? Object.keys(tableMeta.editing.changes) : [];
17630
17663
  return /*#__PURE__*/React__default.createElement(MemoedCell$1, Object.assign({}, props, {
17664
+ hasChanges: changeset.indexOf(props.row.id) >= 0,
17631
17665
  isCurrentRow: tableMeta.currentRow.currentRowIndex === rowIndex,
17632
17666
  isEditing: tableMeta.editing.isEditing
17633
17667
  }));
17634
17668
  }
17635
- const EDITING_ACTIONS_WIDTH = 45;
17669
+ const EDITING_ACTIONS_WIDTH = 60;
17636
17670
  function createRowEditingActionsColumn() {
17637
17671
  return {
17638
17672
  id: COLUMN_ID$1,
@@ -17641,7 +17675,7 @@ function createRowEditingActionsColumn() {
17641
17675
  footer: Footer$4,
17642
17676
  meta: {
17643
17677
  align: 'right',
17644
- className: cn('items-center print:opacity-0 [[role="table"][data-editing="true"]_&]:group-[[data-current="true"]]/row:sticky right-0 !pl-0 !pr-1', '[[role="table"][data-editing="true"]_&]:group-[[data-current="true"]]/row:shadow-[-6px_0px_6px] [[role="table"][data-pause-hover="false"][data-editing="true"]_&]:group-hover/row:shadow-[-6px_0px_6px]', 'group-[[data-current="true"][data-selected="false"]]/row:text-grey-200', 'group-[[data-selected="true"]]/row:text-blue-100', 'group-[[data-selected="false"]:hover]/row:text-grey-100'),
17678
+ className: cn('items-center print:opacity-0 [[role="table"][data-editing="true"]_&]:group-[[data-current="true"]]/row:sticky right-0 !pl-0 !pr-1', '[[role="table"][data-editing="true"]_&]:group-[[data-current="true"]]/row:shadow-[-6px_0px_6px_var(--table3-row-actions-shadow)]', 'group-[[data-current="true"][data-selected="false"]]/row:text-grey-200', 'group-[[data-selected="true"]]/row:text-blue-100', 'group-[[data-selected="false"]:hover]/row:text-grey-100'),
17645
17679
  enableOrdering: false,
17646
17680
  enableSearch: false,
17647
17681
  enableTruncate: false,
@@ -18575,6 +18609,69 @@ function createRowDragColumn(onRowDrag) {
18575
18609
  };
18576
18610
  }
18577
18611
 
18612
+ function Group$3(props) {
18613
+ const {
18614
+ children,
18615
+ column,
18616
+ header,
18617
+ table,
18618
+ hasSeparator
18619
+ } = props;
18620
+ const columnMeta = React__default.useMemo(() => column.columnDef.meta, []);
18621
+ const tableMeta = table.options.meta;
18622
+ const memoedProps = {
18623
+ align: 'center',
18624
+ children: children !== null && children !== void 0 ? children : columnMeta.header,
18625
+ colSpan: header.colSpan,
18626
+ hasSeparator,
18627
+ id: header.id,
18628
+ index: header.index,
18629
+ isPrinting: tableMeta.isPrinting,
18630
+ length: table.getRowModel().rows.length,
18631
+ meta: columnMeta,
18632
+ table
18633
+ };
18634
+ return /*#__PURE__*/React__default.createElement(MemoedGroup, Object.assign({}, memoedProps));
18635
+ }
18636
+ const MemoedGroup = /*#__PURE__*/React__default.memo(function MemoedGroup(props) {
18637
+ var _meta$tooltip;
18638
+ const {
18639
+ align,
18640
+ children,
18641
+ colSpan,
18642
+ hasSeparator,
18643
+ id,
18644
+ isPrinting,
18645
+ meta,
18646
+ table
18647
+ } = props;
18648
+ const containerClassName = cn('sticky px-2 mb-[2px]', {
18649
+ 'h-10': !isPrinting
18650
+ }, colSpan > 1 ? `col-span-${colSpan}` : '');
18651
+ const innerClassName = cn('font-bold box-content group/column relative', 'px-[var(--table3-cell-padding-x)]', {
18652
+ 'h-full items-center': !isPrinting,
18653
+ 'pb-2': isPrinting,
18654
+ 'border-b-2': !!children
18655
+ }, meta.headerClassName);
18656
+ if (table.options.debugAll) {
18657
+ console.log('header group render', id);
18658
+ }
18659
+ return /*#__PURE__*/React__default.createElement("div", {
18660
+ className: containerClassName,
18661
+ "data-taco": "table3-column-group",
18662
+ "data-align": align
18663
+ }, /*#__PURE__*/React__default.createElement("div", {
18664
+ className: innerClassName
18665
+ }, /*#__PURE__*/React__default.createElement(Tooltip, {
18666
+ title: String((_meta$tooltip = meta === null || meta === void 0 ? void 0 : meta.tooltip) !== null && _meta$tooltip !== void 0 ? _meta$tooltip : children),
18667
+ placement: "top"
18668
+ }, /*#__PURE__*/React__default.createElement("span", {
18669
+ className: cn({
18670
+ truncate: !isPrinting
18671
+ })
18672
+ }, children)), hasSeparator ? /*#__PURE__*/React__default.createElement(HeaderSeparator, null) : null));
18673
+ });
18674
+
18578
18675
  function getSortingFn$1(dataType, customFnOrBuiltIn) {
18579
18676
  if (typeof customFnOrBuiltIn === 'function') {
18580
18677
  return (rowA, rowB, columnId) => customFnOrBuiltIn(rowA.original, rowB.original, columnId);
@@ -18596,13 +18693,12 @@ function useConvertChildrenToColumns(props, options, editing) {
18596
18693
  return React__default.useMemo(() => {
18597
18694
  var _props$actionsForRow;
18598
18695
  const columnHelper = reactTable$1.createColumnHelper();
18599
- const columns = [];
18600
18696
  const defaultColumnSizing = {};
18601
18697
  const defaultColumnVisibility = {};
18602
18698
  const defaultSorting = [];
18603
- React__default.Children.toArray(props.children).filter(child => !!child) // remove falsey children
18604
- .forEach(child => {
18605
- if ( /*#__PURE__*/React__default.isValidElement(child) && child.props.accessor) {
18699
+ function processChild(child) {
18700
+ var _child$type, _child$type2;
18701
+ if ( /*#__PURE__*/React__default.isValidElement(child) && ((_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName) === 'Table3Column' && child.props.accessor) {
18606
18702
  var _child$props$enableRe, _child$props$enableFi, _child$props$enableSo, _child$props$enableHi, _child$props$enableOr, _child$props$enablePr, _child$props$enableSe, _child$props$enableTr;
18607
18703
  if (child.props.defaultWidth) {
18608
18704
  defaultColumnSizing[child.props.accessor] = child.props.defaultWidth === 'grow' ? '1fr' : child.props.defaultWidth;
@@ -18616,7 +18712,8 @@ function useConvertChildrenToColumns(props, options, editing) {
18616
18712
  desc: child.props.sort === 'desc'
18617
18713
  });
18618
18714
  }
18619
- columns.push({
18715
+ // return regular column definition
18716
+ return {
18620
18717
  accessorKey: child.props.accessor,
18621
18718
  id: child.props.accessor,
18622
18719
  header: Header$2,
@@ -18653,9 +18750,31 @@ function useConvertChildrenToColumns(props, options, editing) {
18653
18750
  renderer: child.props.renderer,
18654
18751
  tooltip: child.props.tooltip
18655
18752
  }
18753
+ };
18754
+ } else if ( /*#__PURE__*/React__default.isValidElement(child) && ((_child$type2 = child.type) === null || _child$type2 === void 0 ? void 0 : _child$type2.displayName) === 'Table3Group' && child.props.children) {
18755
+ // return column group definition
18756
+ return columnHelper.group({
18757
+ id: child.props.id,
18758
+ header: Group$3,
18759
+ columns: processChildren(child.props.children),
18760
+ meta: {
18761
+ align: 'center',
18762
+ enableOrdering: false,
18763
+ enableSearch: false,
18764
+ enableTruncate: false,
18765
+ header: child.props.header
18766
+ }
18656
18767
  });
18657
18768
  }
18658
- });
18769
+ return;
18770
+ }
18771
+ function processChildren(children) {
18772
+ return React__default.Children.toArray(children).map(processChild)
18773
+ // compiler cannot get filtering out undefined items, so using the type casting here
18774
+ .filter(child => !!child); // need to remove undefined array items after processing the children
18775
+ }
18776
+
18777
+ const columns = processChildren(props.children);
18659
18778
  if (options.enableRowExpansion && props.expandedRowRenderer) {
18660
18779
  columns.unshift(columnHelper.display(createRowExpansionColumn$1(props.expandedRowRenderer)));
18661
18780
  }
@@ -18677,7 +18796,7 @@ function useConvertChildrenToColumns(props, options, editing) {
18677
18796
  defaultColumnVisibility,
18678
18797
  defaultSorting
18679
18798
  };
18680
- }, []);
18799
+ }, [editing.isEditing]);
18681
18800
  }
18682
18801
 
18683
18802
  function usePrinting(isEnabled, loadAll, showWarningWhenPrintingLargeDataset = true) {
@@ -19700,18 +19819,27 @@ function FilterColumn(props) {
19700
19819
  value = null,
19701
19820
  ...attributes
19702
19821
  } = props;
19822
+ const {
19823
+ texts
19824
+ } = useLocalization();
19703
19825
  return /*#__PURE__*/React__default.createElement(Select2, Object.assign({}, attributes, {
19704
19826
  className: "!w-32 flex-shrink-0",
19705
19827
  emptyValue: null,
19706
19828
  onChange: handleChange,
19707
19829
  value: value
19708
19830
  }), allColumns.map(column => {
19709
- var _column$columnDef$met;
19831
+ var _column$columnDef$met, _column$parent, _column$parent$column;
19710
19832
  return /*#__PURE__*/React__default.createElement(Select2.Option, {
19711
19833
  key: column.id,
19712
19834
  value: column.id,
19835
+ postfix: !column.getIsVisible() ? /*#__PURE__*/React__default.createElement(Tooltip, {
19836
+ title: texts.table3.filters.hiddenColumn
19837
+ }, /*#__PURE__*/React__default.createElement(Icon, {
19838
+ name: "eye-off",
19839
+ className: "text-grey-500"
19840
+ })) : undefined,
19713
19841
  disabled: column.id !== value && (!column.getCanFilter() || !!filters.find(f => f.id === column.id))
19714
- }, (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.header);
19842
+ }, ((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.header) + (column.parent ? ` (${(_column$parent = column.parent) === null || _column$parent === void 0 ? void 0 : (_column$parent$column = _column$parent.columnDef.meta) === null || _column$parent$column === void 0 ? void 0 : _column$parent$column.header})` : ''));
19715
19843
  }));
19716
19844
  }
19717
19845
 
@@ -20715,7 +20843,7 @@ function RowHeight(props) {
20715
20843
  }
20716
20844
 
20717
20845
  const Column$4 = /*#__PURE__*/React__default.forwardRef(function Column(props, ref) {
20718
- var _column$columnDef$met;
20846
+ var _column$parent, _column$parent$column, _column$columnDef$met;
20719
20847
  const {
20720
20848
  column,
20721
20849
  draggable = false,
@@ -20729,6 +20857,7 @@ const Column$4 = /*#__PURE__*/React__default.forwardRef(function Column(props, r
20729
20857
  });
20730
20858
  const attributes = draggable ? dragAttributes : undefined;
20731
20859
  const isVisible = column.getIsVisible();
20860
+ const parentText = column.parent ? (_column$parent = column.parent) === null || _column$parent === void 0 ? void 0 : (_column$parent$column = _column$parent.columnDef.meta) === null || _column$parent$column === void 0 ? void 0 : _column$parent$column.header : null;
20732
20861
  return /*#__PURE__*/React__default.createElement("div", Object.assign({}, attributes, {
20733
20862
  key: column.id,
20734
20863
  className: className,
@@ -20739,7 +20868,9 @@ const Column$4 = /*#__PURE__*/React__default.forwardRef(function Column(props, r
20739
20868
  className: "text-grey-500 group-hover/column:text-grey-700 -mx-2 !h-5"
20740
20869
  }) : null, /*#__PURE__*/React__default.createElement("span", {
20741
20870
  className: "flex-grow truncate"
20742
- }, (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.header), canHide ? /*#__PURE__*/React__default.createElement(Checkbox, {
20871
+ }, (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.header, parentText ? /*#__PURE__*/React__default.createElement("span", {
20872
+ className: "italic"
20873
+ }, " (", parentText, ")") : null), canHide ? /*#__PURE__*/React__default.createElement(Checkbox, {
20743
20874
  checked: isVisible,
20744
20875
  onChange: () => column.toggleVisibility(!isVisible)
20745
20876
  }) : null);
@@ -20757,8 +20888,8 @@ function ColumnSettingsPopover(props) {
20757
20888
  const allColumns = table.getAllLeafColumns();
20758
20889
  const tableMeta = table.options.meta;
20759
20890
  const columns = React__default.useMemo(() => allColumns.filter(column => !isInternalColumn$1(column.id)).filter(column => {
20760
- var _column$columnDef$met2;
20761
- return query !== null && query !== void 0 && query.length ? (_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.header.toLowerCase().includes(query.toLowerCase()) : true;
20891
+ var _column$columnDef$met2, _column$parent2, _column$parent2$colum;
20892
+ return query !== null && query !== void 0 && query.length ? ((_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.header.toLowerCase().includes(query.toLowerCase())) || ((_column$parent2 = column.parent) === null || _column$parent2 === void 0 ? void 0 : (_column$parent2$colum = _column$parent2.columnDef.meta) === null || _column$parent2$colum === void 0 ? void 0 : _column$parent2$colum.header.toLowerCase().includes(query.toLowerCase())) : true;
20762
20893
  }), [allColumns, query]);
20763
20894
  const listClassName = 'flex max-h-64 flex-col gap-y-px overflow-auto';
20764
20895
  const handleReorder = (activeId, overId) => {
@@ -20773,7 +20904,7 @@ function ColumnSettingsPopover(props) {
20773
20904
  return /*#__PURE__*/React__default.createElement(Popover, Object.assign({}, popoverProps, {
20774
20905
  anchor: trigger
20775
20906
  }), /*#__PURE__*/React__default.createElement(Popover.Content, null, /*#__PURE__*/React__default.createElement("div", {
20776
- className: "flex w-60 flex-col gap-2"
20907
+ className: "flex max-w-sm flex-col gap-2"
20777
20908
  }, table.options.enableHiding ? /*#__PURE__*/React__default.createElement(Input, {
20778
20909
  onChange: event => setQuery(event.target.value),
20779
20910
  placeholder: texts.table3.columnSettings.search,
@@ -21052,6 +21183,26 @@ const useCssVars = (height, fontSize) => {
21052
21183
  };
21053
21184
  };
21054
21185
 
21186
+ // header height: 40px, border bottom height: 2px;
21187
+ const HEADER_COLUMN_HEIGHT = 42;
21188
+ function getHeaderTopOffset(depth) {
21189
+ return HEADER_COLUMN_HEIGHT * (depth - 1);
21190
+ }
21191
+ function useHeaderOffsetStyle(tableId, table) {
21192
+ const headers = table.getFlatHeaders();
21193
+ const style = React__default.useMemo(() => {
21194
+ // 'new Set' will remove all duplicates and leave only unique values,
21195
+ // in the end we should get only one depht value per array item, example: [1, 2, 3], which we will iterate through later.
21196
+ const headerDepths = [...new Set(headers.map(header => header.depth))];
21197
+ return headerDepths.map(depth => {
21198
+ return `#${tableId} [data-taco="table2-header"] [role="row"]:nth-child(${depth}) [role="columnheader"],
21199
+ #${tableId} [data-taco="table2-header"] [role="row"]:nth-child(${depth}) [data-taco="table3-column-group"]
21200
+ { top: ${getHeaderTopOffset(depth)}px }`;
21201
+ }).join('\r\n');
21202
+ }, [headers, tableId]);
21203
+ return style;
21204
+ }
21205
+
21055
21206
  function useTable3DataLoader(fetch, fetchAll, options = {
21056
21207
  pageSize: 100
21057
21208
  }) {
@@ -21180,6 +21331,11 @@ function useTable3DataLoader(fetch, fetchAll, options = {
21180
21331
  function Column$5(_) {
21181
21332
  return null;
21182
21333
  }
21334
+ Column$5.displayName = 'Table3Column';
21335
+ function Group$4(_) {
21336
+ return null;
21337
+ }
21338
+ Group$4.displayName = 'Table3Group';
21183
21339
  // Cast the old forwardRef to the new one
21184
21340
  const fixedForwardRef = React__default.forwardRef;
21185
21341
  const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
@@ -21272,10 +21428,13 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
21272
21428
  opacity: 0.999
21273
21429
  };
21274
21430
  const columnFreezingStyle = useColumnFreezingStyle(props.id, table);
21431
+ const headerOffsetStyle = useHeaderOffsetStyle(props.id, table);
21275
21432
  const isServerLoadingAndNotReady = tableMeta.isUsingServer && props.length === undefined;
21276
21433
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, columnFreezingStyle ? /*#__PURE__*/React__default.createElement("style", {
21277
21434
  "data-taco": "table3-column-freezing-styles"
21278
- }, columnFreezingStyle) : null, /*#__PURE__*/React__default.createElement(Toolbar, {
21435
+ }, columnFreezingStyle) : null, headerOffsetStyle ? /*#__PURE__*/React__default.createElement("style", {
21436
+ "data-taco": "table3-column-header-offset-styles"
21437
+ }, headerOffsetStyle) : null, /*#__PURE__*/React__default.createElement(Toolbar, {
21279
21438
  table: table,
21280
21439
  tableProps: props,
21281
21440
  total: length,
@@ -21294,7 +21453,6 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
21294
21453
  "data-taco": "table2",
21295
21454
  onBlur: handleBlur,
21296
21455
  onFocus: handleFocus,
21297
- onMouseDownCapture: handleMouseCapture,
21298
21456
  onScroll: handleScroll,
21299
21457
  ref: internalRef,
21300
21458
  role: "table",
@@ -21308,14 +21466,22 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
21308
21466
  className: "contents",
21309
21467
  key: headerGroup.id,
21310
21468
  role: "row"
21311
- }, headerGroup.headers.map(header => /*#__PURE__*/React__default.createElement(React__default.Fragment, {
21312
- key: header.id
21313
- }, reactTable$1.flexRender(header.column.columnDef.header, {
21314
- ...header.getContext(),
21315
- scrollToIndex
21316
- })))))), table.getRowModel().rows.length ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(focus.FocusScope, {
21469
+ }, headerGroup.headers.map((header, index) => {
21470
+ var _headerGroup$headers;
21471
+ // We need to render separator if column is not the last in array, if index is not equal to freeze column index,
21472
+ // if next element is not placeholder and if column itself is not placeholder.
21473
+ const hasSeparator = index !== tableMeta.columnFreezing.frozenColumnIndex && index !== headerGroup.headers.length - 1 && (!((_headerGroup$headers = headerGroup.headers[index + 1]) !== null && _headerGroup$headers !== void 0 && _headerGroup$headers.isPlaceholder) || !header.isPlaceholder);
21474
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, {
21475
+ key: header.id
21476
+ }, reactTable$1.flexRender(header.column.columnDef.header, {
21477
+ ...header.getContext(),
21478
+ scrollToIndex,
21479
+ hasSeparator
21480
+ }));
21481
+ })))), table.getRowModel().rows.length ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(focus.FocusScope, {
21317
21482
  autoFocus: tableMeta.editing.isEditing
21318
21483
  }, /*#__PURE__*/React__default.createElement("div", {
21484
+ onMouseDownCapture: handleMouseCapture,
21319
21485
  className: "group/body contents",
21320
21486
  "data-taco": "table2-body",
21321
21487
  role: "rowgroup",
@@ -21351,6 +21517,7 @@ const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
21351
21517
  }));
21352
21518
  });
21353
21519
  Table3.Column = Column$5;
21520
+ Table3.Group = Group$4;
21354
21521
 
21355
21522
  const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(props, ref) {
21356
21523
  const {
@@ -22108,7 +22275,7 @@ Layout$1.Page = Page;
22108
22275
  Layout$1.Sidebar = Sidebar;
22109
22276
  Layout$1.Content = Content$9;
22110
22277
 
22111
- const Group$3 = /*#__PURE__*/React__default.forwardRef(function Group(props, ref) {
22278
+ const Group$5 = /*#__PURE__*/React__default.forwardRef(function Group(props, ref) {
22112
22279
  const {
22113
22280
  children,
22114
22281
  defaultExpanded = false,
@@ -22267,7 +22434,7 @@ const Navigation2 = /*#__PURE__*/React__default.forwardRef(function Navigation2(
22267
22434
  }
22268
22435
  }), children);
22269
22436
  });
22270
- Navigation2.Group = Group$3;
22437
+ Navigation2.Group = Group$5;
22271
22438
  Navigation2.Link = Link$2;
22272
22439
  Navigation2.Section = Section;
22273
22440
  Navigation2.Content = Content$a;