@economic/taco 2.14.2 → 2.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. package/dist/components/Drawer/Drawer.d.ts +5 -1
  2. package/dist/components/Icon/components/AiChatSolid.d.ts +3 -0
  3. package/dist/components/Icon/components/AiStars.d.ts +3 -0
  4. package/dist/components/Icon/components/EnvelopeSolid.d.ts +3 -0
  5. package/dist/components/Icon/components/PhoneSolid.d.ts +3 -0
  6. package/dist/components/Icon/components/QuestionMarkBold.d.ts +3 -0
  7. package/dist/components/Icon/components/index.d.ts +1 -1
  8. package/dist/components/Input/Input.d.ts +1 -1
  9. package/dist/components/Menu/components/Item.d.ts +1 -1
  10. package/dist/components/Menu/components/Link.d.ts +1 -1
  11. package/dist/components/Navigation2/components/Link.d.ts +1 -1
  12. package/dist/components/Provider/Localization.d.ts +19 -0
  13. package/dist/components/SearchInput2/SearchInput2.d.ts +1 -0
  14. package/dist/components/Select2/components/Option.d.ts +2 -2
  15. package/dist/components/Select2/components/Search.d.ts +1 -1
  16. package/dist/components/Table3/components/alert/ErrorAlert.d.ts +10 -0
  17. package/dist/components/Table3/components/columns/cell/DisplayCell.d.ts +5 -2
  18. package/dist/components/Table3/components/columns/cell/EditingCell.d.ts +3 -0
  19. package/dist/components/Table3/components/columns/cell/Highlight.d.ts +2 -0
  20. package/dist/components/Table3/components/columns/internal/EditingActions.d.ts +1 -1
  21. package/dist/components/Table3/components/rows/Row.d.ts +2 -0
  22. package/dist/components/Table3/components/rows/RowContext.d.ts +1 -0
  23. package/dist/components/Table3/hooks/features/useEditing.d.ts +12 -11
  24. package/dist/components/Table3/hooks/features/usePauseShortcuts.d.ts +5 -0
  25. package/dist/components/Table3/hooks/features/useSearch.d.ts +2 -0
  26. package/dist/components/Table3/hooks/features/useValidation.d.ts +13 -0
  27. package/dist/components/Table3/hooks/useTable.d.ts +4 -0
  28. package/dist/components/Table3/types.d.ts +26 -1
  29. package/dist/components/Table3/util/editing.d.ts +6 -0
  30. package/dist/components/Tag/Tag.d.ts +1 -1
  31. package/dist/components/Tooltip/Tooltip.d.ts +4 -0
  32. package/dist/esm/index.css +112 -33
  33. package/dist/esm/packages/taco/src/components/Drawer/Drawer.js +7 -2
  34. package/dist/esm/packages/taco/src/components/Drawer/Drawer.js.map +1 -1
  35. package/dist/esm/packages/taco/src/components/Field/Field.js +19 -3
  36. package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
  37. package/dist/esm/packages/taco/src/components/Icon/components/AiChatSolid.js +19 -0
  38. package/dist/esm/packages/taco/src/components/Icon/components/AiChatSolid.js.map +1 -0
  39. package/dist/esm/packages/taco/src/components/Icon/components/AiStars.js +30 -0
  40. package/dist/esm/packages/taco/src/components/Icon/components/AiStars.js.map +1 -0
  41. package/dist/esm/packages/taco/src/components/Icon/components/EnvelopeSolid.js +19 -0
  42. package/dist/esm/packages/taco/src/components/Icon/components/EnvelopeSolid.js.map +1 -0
  43. package/dist/esm/packages/taco/src/components/Icon/components/PhoneSolid.js +17 -0
  44. package/dist/esm/packages/taco/src/components/Icon/components/PhoneSolid.js.map +1 -0
  45. package/dist/esm/packages/taco/src/components/Icon/components/QuestionMarkBold.js +17 -0
  46. package/dist/esm/packages/taco/src/components/Icon/components/QuestionMarkBold.js.map +1 -0
  47. package/dist/esm/packages/taco/src/components/Icon/components/index.js +10 -0
  48. package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
  49. package/dist/esm/packages/taco/src/components/Provider/Localization.js +19 -0
  50. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  51. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +4 -0
  52. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
  53. package/dist/esm/packages/taco/src/components/Table3/Table3.js +28 -4
  54. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  55. package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js +154 -0
  56. package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js.map +1 -0
  57. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js +51 -6
  58. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js.map +1 -1
  59. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +7 -55
  60. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
  61. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +69 -37
  62. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
  63. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +17 -17
  64. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
  65. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js +41 -0
  66. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js.map +1 -0
  67. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +21 -12
  68. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
  69. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js +1 -1
  70. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js.map +1 -1
  71. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js +6 -5
  72. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js.map +1 -1
  73. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js +2 -2
  74. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js.map +1 -1
  75. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js +57 -17
  76. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js.map +1 -1
  77. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +42 -32
  78. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
  79. package/dist/esm/packages/taco/src/components/Table3/components/rows/RowContext.js +2 -1
  80. package/dist/esm/packages/taco/src/components/Table3/components/rows/RowContext.js.map +1 -1
  81. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +8 -1
  82. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
  83. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/hooks/useParentStylesheets.js +2 -1
  84. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/hooks/useParentStylesheets.js.map +1 -1
  85. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js +48 -1
  86. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js.map +1 -1
  87. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js +2 -2
  88. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js.map +1 -1
  89. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Toolbar.js +1 -1
  90. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Toolbar.js.map +1 -1
  91. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js +185 -101
  92. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js.map +1 -1
  93. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseShortcuts.js +12 -0
  94. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseShortcuts.js.map +1 -0
  95. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSearch.js +4 -1
  96. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSearch.js.map +1 -1
  97. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useValidation.js +178 -0
  98. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useValidation.js.map +1 -0
  99. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js +1 -1
  100. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js.map +1 -1
  101. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +8 -2
  102. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  103. package/dist/esm/packages/taco/src/components/Table3/strategies/virtualised.js +1 -1
  104. package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
  105. package/dist/esm/packages/taco/src/components/Table3/util/editing.js +21 -1
  106. package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
  107. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js +4 -0
  108. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js.map +1 -1
  109. package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js +20 -0
  110. package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js.map +1 -0
  111. package/dist/index.css +112 -33
  112. package/dist/taco.cjs.development.js +1735 -957
  113. package/dist/taco.cjs.development.js.map +1 -1
  114. package/dist/taco.cjs.production.min.js +1 -1
  115. package/dist/taco.cjs.production.min.js.map +1 -1
  116. package/package.json +2 -2
  117. package/types.json +23852 -10957
@@ -23,6 +23,7 @@ const EditingControl = /*#__PURE__*/React__default.forwardRef(function Control(p
23
23
  tableRef,
24
24
  value,
25
25
  cell,
26
+ error,
26
27
  isCurrentRow,
27
28
  ...attributes
28
29
  } = props;
@@ -32,6 +33,8 @@ const EditingControl = /*#__PURE__*/React__default.forwardRef(function Control(p
32
33
  const columnMeta = column.columnDef.meta;
33
34
  const controlRenderer = columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.control;
34
35
  const isCellInDetailMode = tableMeta.editing.detailModeEditing && (ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.contains(document.activeElement));
36
+ const originalRow = cell.row.original;
37
+ // Revert to initial value if escape was pressed
35
38
  const handleKeyDown = event => {
36
39
  // For some reason keydown event handler is not propogated to the table when input or other control element is
37
40
  // in focus so we need to check for shortcut that toggles the editing.
@@ -91,7 +94,7 @@ const EditingControl = /*#__PURE__*/React__default.forwardRef(function Control(p
91
94
  return;
92
95
  }
93
96
  };
94
- const isNumber = typeof value === 'number';
97
+ const isNumber = (columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.dataType) === 'number';
95
98
  const handleInputKeyDown = event => {
96
99
  handleKeyDown(event);
97
100
  // Switching to editing mode, when key pressed any alphabetical character or number
@@ -99,19 +102,11 @@ const EditingControl = /*#__PURE__*/React__default.forwardRef(function Control(p
99
102
  tableMeta.editing.setDetailModeEditing(true);
100
103
  }
101
104
  };
102
- const handleDatepickerChange = event => {
103
- // When datepicker looses focus, it triggers change event, even if date wasn't changed,
104
- // so adding additional check here to prevent adding change to the edititng state.
105
- const originalDate = cell.row.original[cell.column.id];
106
- const changedDate = event.detail;
107
- if (hasChanged(originalDate, changedDate)) {
108
- handleChange(changedDate);
109
- }
110
- };
111
105
  if (typeof controlRenderer === 'function') {
112
106
  return controlRenderer({
113
107
  ...attributes,
114
- ref: ref,
108
+ ref: refCallback,
109
+ invalid: !!error,
115
110
  setValue: nextValue => {
116
111
  if (nextValue !== value) {
117
112
  handleChange(nextValue);
@@ -120,19 +115,22 @@ const EditingControl = /*#__PURE__*/React__default.forwardRef(function Control(p
120
115
  value
121
116
  }, data);
122
117
  } else if (controlRenderer === 'datepicker') {
123
- const handleDatepickerKeyDown = event => {
124
- handleKeyDown(event);
125
- if (/^[a-z0-9]$/i.test(event.key)) {
126
- tableMeta.editing.setDetailModeEditing(true);
127
- return;
118
+ const handleDatepickerChange = event => {
119
+ // When datepicker looses focus, it triggers change event, even if date wasn't changed,
120
+ // so adding additional check here to prevent adding change to the edititng state.
121
+ const originalDate = originalRow[cell.column.id];
122
+ const changedDate = event.detail;
123
+ if (hasChanged(originalDate, changedDate)) {
124
+ handleChange(changedDate);
128
125
  }
129
126
  };
130
127
  return /*#__PURE__*/React__default.createElement(Datepicker, Object.assign({}, attributes, {
128
+ invalid: !!error,
131
129
  className: cn({
132
130
  '[&_input]:!yt-focus-dark': isCellInDetailMode
133
131
  }),
134
132
  onChange: handleDatepickerChange,
135
- onKeyDown: handleDatepickerKeyDown,
133
+ onKeyDown: handleInputKeyDown,
136
134
  ref: refCallback,
137
135
  value: value
138
136
  }));
@@ -144,6 +142,7 @@ const EditingControl = /*#__PURE__*/React__default.forwardRef(function Control(p
144
142
  }));
145
143
  } else if (controlRenderer === 'textarea') {
146
144
  return /*#__PURE__*/React__default.createElement(TextareaControl, Object.assign({}, props, {
145
+ invalid: !!error,
147
146
  isCellInDetailMode: isCellInDetailMode,
148
147
  onKeyDown: handleInputKeyDown,
149
148
  ref: refCallback,
@@ -151,6 +150,7 @@ const EditingControl = /*#__PURE__*/React__default.forwardRef(function Control(p
151
150
  }));
152
151
  }
153
152
  return /*#__PURE__*/React__default.createElement(Input, Object.assign({}, attributes, {
153
+ invalid: !!error,
154
154
  className: cn(getInputAppearanceClassnames(), getCellAlignmentClasses(align), {
155
155
  '!yt-focus-dark': isCellInDetailMode
156
156
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"EditingControl.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/cell/EditingControl.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Cell as RTCell, Column as RTColumn, Table as RTTable, TableMeta } from '@tanstack/react-table';\nimport _ from 'lodash';\n\nimport { deselectInputValue } from '../../../../../utils/input';\nimport { hasChanged } from '../../../util/editing';\nimport { Datepicker } from '../../../../Datepicker/Datepicker';\nimport { Switch } from '../../../../Switch/Switch';\nimport { Input } from '../../../../Input/Input';\nimport { getCellAlignmentClasses, getInputAppearanceClassnames } from '../styles';\nimport { mergeRefs } from '../../../../../utils/mergeRefs';\nimport { Table3ColumnAlignment } from '../../../types';\nimport { TextareaControl } from './controls/TextareaControl';\nimport { shouldTriggerShortcut } from '../../../../../utils/keyboard';\n\nexport type EditingControlProps<TType = unknown> = {\n align?: Table3ColumnAlignment;\n column: RTColumn<TType, unknown>;\n data: TType;\n initialValue: any;\n value: any;\n onBlur: (event: React.FocusEvent) => void;\n onFocus: (event: React.FocusEvent) => void;\n onChange: (value: any) => void;\n ref: React.Ref<HTMLElement>;\n table: RTTable<TType>;\n tableRef: React.RefObject<HTMLDivElement>;\n cell: RTCell<TType, unknown>;\n error?: string;\n tabIndex?: number;\n isCurrentRow?: boolean;\n};\n\nexport const EditingControl = React.forwardRef<HTMLElement, any>(function Control<TType = unknown>(\n props: EditingControlProps<TType>,\n externalRef: React.Ref<HTMLElement>\n) {\n const {\n align,\n column,\n data,\n initialValue,\n onChange: handleChange,\n table,\n tableRef,\n value,\n cell,\n isCurrentRow,\n ...attributes\n } = props;\n\n const tableMeta = table.options.meta as TableMeta<unknown>;\n\n const ref = React.useRef<HTMLElement>();\n const refCallback = mergeRefs([ref, externalRef]);\n\n const columnMeta = column.columnDef.meta;\n const controlRenderer = columnMeta?.control;\n\n const isCellInDetailMode =\n tableMeta.editing.detailModeEditing && (ref as React.RefObject<HTMLElement>)?.current?.contains(document.activeElement);\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n // For some reason keydown event handler is not propogated to the table when input or other control element is\n // in focus so we need to check for shortcut that toggles the editing.\n if (shouldTriggerShortcut(event, { key: 'e', meta: true, shift: false })) {\n tableMeta.editing.toggleEditing(false);\n return;\n }\n\n const target = event.target as HTMLInputElement;\n\n if (target.readOnly) {\n return;\n }\n\n // Prevent row arrow shortcuts triggering when in detail mode\n if (tableMeta.editing.detailModeEditing && (event.key === 'ArrowUp' || event.key === 'ArrowDown')) {\n event.stopPropagation();\n }\n\n // Revert to initial value if escape was pressed\n if (event.key === 'Escape') {\n event.preventDefault();\n\n if (tableMeta.editing.detailModeEditing) {\n tableMeta.editing.setDetailModeEditing(false);\n\n if (value !== initialValue) {\n // Before reseting to initial value, we need to check if edited row with cell initial value is the same as original row,\n // and in this case we need to completely remove row from editing state to avoid saving the same data as original.\n const changedRow: any = tableMeta.editing.changes ? tableMeta.editing.changes[cell.row.id] : {};\n const rowEdtitingDataWithInitialValue = { ...changedRow, [cell.column.id]: initialValue };\n if (_.isEqual(cell.row.original, rowEdtitingDataWithInitialValue)) {\n tableMeta.editing.resetChange(cell.row.id);\n } else {\n handleChange(initialValue);\n }\n }\n } else {\n tableMeta.editing.toggleEditing(false);\n tableRef.current?.focus();\n }\n\n return;\n }\n\n // Should enable/disable editing mode if Enter was clicked\n if (event.key === 'Enter') {\n event.preventDefault();\n\n if (!tableMeta.editing.detailModeEditing) {\n deselectInputValue(target);\n } else {\n target?.select?.();\n }\n\n // Ketydown \"Enter\" should toggle edititng mode\n tableMeta.editing.setDetailModeEditing(!tableMeta.editing.detailModeEditing);\n\n return;\n }\n };\n\n const isNumber = typeof value === 'number';\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n handleKeyDown(event);\n\n // Switching to editing mode, when key pressed any alphabetical character or number\n if (/^[a-z0-9]$/i.test(event.key)) {\n tableMeta.editing.setDetailModeEditing(true);\n }\n };\n\n const handleDatepickerChange = event => {\n // When datepicker looses focus, it triggers change event, even if date wasn't changed,\n // so adding additional check here to prevent adding change to the edititng state.\n const originalDate = cell.row.original[cell.column.id];\n const changedDate = (event as any).detail;\n if (hasChanged(originalDate, changedDate)) {\n handleChange(changedDate);\n }\n };\n\n if (typeof controlRenderer === 'function') {\n return controlRenderer(\n {\n ...attributes,\n ref: ref as React.RefObject<HTMLElement>,\n setValue: nextValue => {\n if (nextValue !== value) {\n handleChange(nextValue);\n }\n },\n value,\n },\n data\n );\n } else if (controlRenderer === 'datepicker') {\n const handleDatepickerKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n handleKeyDown(event);\n\n if (/^[a-z0-9]$/i.test(event.key)) {\n tableMeta.editing.setDetailModeEditing(true);\n return;\n }\n };\n\n return (\n <Datepicker\n {...attributes}\n className={cn({\n '[&_input]:!yt-focus-dark': isCellInDetailMode,\n })}\n onChange={handleDatepickerChange}\n onKeyDown={handleDatepickerKeyDown}\n ref={refCallback}\n value={value as Date}\n />\n );\n } else if (controlRenderer === 'switch') {\n return <Switch {...attributes} checked={Boolean(value)} onChange={handleChange} ref={refCallback} />;\n } else if (controlRenderer === 'textarea') {\n return (\n <TextareaControl\n {...props}\n isCellInDetailMode={isCellInDetailMode}\n onKeyDown={handleInputKeyDown}\n ref={refCallback}\n fontSize={tableMeta.fontSize.size}\n />\n );\n }\n\n return (\n <Input\n {...attributes}\n className={cn(getInputAppearanceClassnames(), getCellAlignmentClasses(align), {\n '!yt-focus-dark': isCellInDetailMode,\n })}\n onChange={event => {\n handleChange(event.target.value);\n }}\n onKeyDown={handleInputKeyDown}\n ref={refCallback}\n type={isNumber ? 'number' : undefined}\n value={isNumber ? value : String(value ?? '')}\n />\n );\n});\n"],"names":["EditingControl","React","forwardRef","Control","props","externalRef","align","column","data","initialValue","onChange","handleChange","table","tableRef","value","cell","isCurrentRow","attributes","tableMeta","options","meta","ref","useRef","refCallback","mergeRefs","columnMeta","columnDef","controlRenderer","control","isCellInDetailMode","editing","detailModeEditing","_ref$current","current","contains","document","activeElement","handleKeyDown","event","shouldTriggerShortcut","key","shift","toggleEditing","target","readOnly","stopPropagation","preventDefault","setDetailModeEditing","changedRow","changes","row","id","rowEdtitingDataWithInitialValue","_","isEqual","original","resetChange","_tableRef$current","focus","deselectInputValue","_target$select","select","call","isNumber","handleInputKeyDown","test","handleDatepickerChange","originalDate","changedDate","detail","hasChanged","setValue","nextValue","handleDatepickerKeyDown","Datepicker","className","cn","onKeyDown","Switch","checked","Boolean","TextareaControl","fontSize","size","Input","getInputAppearanceClassnames","getCellAlignmentClasses","type","undefined","String"],"mappings":";;;;;;;;;;;;;MAkCaA,cAAc,gBAAGC,cAAK,CAACC,UAAU,CAAmB,SAASC,OAAOA,CAC7EC,KAAiC,EACjCC,WAAmC;;EAEnC,MAAM;IACFC,KAAK;IACLC,MAAM;IACNC,IAAI;IACJC,YAAY;IACZC,QAAQ,EAAEC,YAAY;IACtBC,KAAK;IACLC,QAAQ;IACRC,K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AsB;MAChCW,SAAS,EAAEJ,uBAAuB;MAClCpD,GAAG,EAAEE,WAAW;MAChBT,KAAK,EAAEA;OACT;GAET,MAAM,IAAIa,eAAe,KAAK,QAAQ,EAAE;IACrC,oBAAO1B,6BAAC6E,MAAM,oBAAK7D,UAAU;MAAE8D,OAAO,EAAEC,OAAO,CAAClE,KAAK,CAAC;MAAEJ,QAAQ,EAAEC,YAAY;MAAEU,GAAG,EAAEE;OAAe;GACvG,MAAM,IAAII,eAAe,KAAK,UAAU,EAAE;IACvC,oBACI1B,6BAACgF,eAAe,oBACR7E,KAAK;MACTyB,kBAAkB,EAAEA,kBAAkB;MACtCgD,SAAS,EAAEb,kBAAkB;MAC7B3C,GAAG,EAAEE,WAAW;MAChB2D,QAAQ,EAAEhE,SAAS,CAACgE,QAAQ,CAACC;OAC/B;;EAIV,oBACIlF,6BAACmF,KAAK,oBACEnE,UAAU;IACd0D,SAAS,EAAEC,EAAE,CAACS,4BAA4B,EAAE,EAAEC,uBAAuB,CAAChF,KAAK,CAAC,EAAE;MAC1E,gBAAgB,EAAEuB;KACrB,CAAC;IACFnB,QAAQ,EAAE4B,KAAK;MACX3B,YAAY,CAAC2B,KAAK,CAACK,MAAM,CAAC7B,KAAK,CAAC;KACnC;IACD+D,SAAS,EAAEb,kBAAkB;IAC7B3C,GAAG,EAAEE,WAAW;IAChBgE,IAAI,EAAExB,QAAQ,GAAG,QAAQ,GAAGyB,SAAS;IACrC1E,KAAK,EAAEiD,QAAQ,GAAGjD,KAAK,GAAG2E,MAAM,CAAC3E,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE;KAC9C;AAEV,CAAC;;;;"}
1
+ {"version":3,"file":"EditingControl.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/cell/EditingControl.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Cell as RTCell, Column as RTColumn, Table as RTTable, TableMeta } from '@tanstack/react-table';\nimport _ from 'lodash';\n\nimport { deselectInputValue } from '../../../../../utils/input';\nimport { hasChanged } from '../../../util/editing';\nimport { Datepicker } from '../../../../Datepicker/Datepicker';\nimport { Switch } from '../../../../Switch/Switch';\nimport { Input } from '../../../../Input/Input';\nimport { getCellAlignmentClasses, getInputAppearanceClassnames } from '../styles';\nimport { mergeRefs } from '../../../../../utils/mergeRefs';\nimport { Table3ColumnAlignment, Table3ColumnDataType } from '../../../types';\nimport { TextareaControl } from './controls/TextareaControl';\nimport { shouldTriggerShortcut } from '../../../../../utils/keyboard';\n\nexport type EditingControlProps<TType = unknown> = {\n align?: Table3ColumnAlignment;\n column: RTColumn<TType, unknown>;\n data: TType;\n initialValue: any;\n value: any;\n onBlur: (event: React.FocusEvent) => void;\n onFocus: (event: React.FocusEvent) => void;\n onChange: (value: any) => void;\n ref: React.Ref<HTMLElement>;\n table: RTTable<TType>;\n tableRef: React.RefObject<HTMLDivElement>;\n cell: RTCell<TType, unknown>;\n error?: string;\n tabIndex?: number;\n isCurrentRow?: boolean;\n};\n\nexport const EditingControl = React.forwardRef<HTMLElement, any>(function Control<TType = unknown>(\n props: EditingControlProps<TType>,\n externalRef: React.Ref<HTMLElement>\n) {\n const {\n align,\n column,\n data,\n initialValue,\n onChange: handleChange,\n table,\n tableRef,\n value,\n cell,\n error,\n isCurrentRow,\n ...attributes\n } = props;\n\n const tableMeta = table.options.meta as TableMeta<unknown>;\n const ref = React.useRef<HTMLElement>();\n const refCallback = mergeRefs([ref, externalRef]);\n\n const columnMeta = column.columnDef.meta;\n const controlRenderer = columnMeta?.control;\n\n const isCellInDetailMode =\n tableMeta.editing.detailModeEditing && (ref as React.RefObject<HTMLElement>)?.current?.contains(document.activeElement);\n\n const originalRow = cell.row.original as TType;\n\n // Revert to initial value if escape was pressed\n const handleKeyDown = (event: React.KeyboardEvent) => {\n // For some reason keydown event handler is not propogated to the table when input or other control element is\n // in focus so we need to check for shortcut that toggles the editing.\n if (shouldTriggerShortcut(event, { key: 'e', meta: true, shift: false })) {\n tableMeta.editing.toggleEditing(false);\n return;\n }\n\n const target = event.target as HTMLInputElement;\n\n if (target.readOnly) {\n return;\n }\n\n // Prevent row arrow shortcuts triggering when in detail mode\n if (tableMeta.editing.detailModeEditing && (event.key === 'ArrowUp' || event.key === 'ArrowDown')) {\n event.stopPropagation();\n }\n\n // Revert to initial value if escape was pressed\n if (event.key === 'Escape') {\n event.preventDefault();\n\n if (tableMeta.editing.detailModeEditing) {\n tableMeta.editing.setDetailModeEditing(false);\n\n if (value !== initialValue) {\n // Before reseting to initial value, we need to check if edited row with cell initial value is the same as original row,\n // and in this case we need to completely remove row from editing state to avoid saving the same data as original.\n const changedRow: any = tableMeta.editing.changes ? tableMeta.editing.changes[cell.row.id] : {};\n const rowEdtitingDataWithInitialValue = { ...changedRow, [cell.column.id]: initialValue };\n if (_.isEqual(cell.row.original, rowEdtitingDataWithInitialValue)) {\n tableMeta.editing.resetChange(cell.row.id);\n } else {\n handleChange(initialValue);\n }\n }\n } else {\n tableMeta.editing.toggleEditing(false);\n tableRef.current?.focus();\n }\n\n return;\n }\n\n // Should enable/disable editing mode if Enter was clicked\n if (event.key === 'Enter') {\n event.preventDefault();\n\n if (!tableMeta.editing.detailModeEditing) {\n deselectInputValue(target);\n } else {\n target?.select?.();\n }\n\n // Ketydown \"Enter\" should toggle edititng mode\n tableMeta.editing.setDetailModeEditing(!tableMeta.editing.detailModeEditing);\n\n return;\n }\n };\n\n const isNumber = columnMeta?.dataType === ('number' as Table3ColumnDataType);\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n handleKeyDown(event);\n\n // Switching to editing mode, when key pressed any alphabetical character or number\n if (/^[a-z0-9]$/i.test(event.key)) {\n tableMeta.editing.setDetailModeEditing(true);\n }\n };\n\n if (typeof controlRenderer === 'function') {\n return controlRenderer(\n {\n ...attributes,\n ref: refCallback,\n invalid: !!error,\n setValue: nextValue => {\n if (nextValue !== value) {\n handleChange(nextValue);\n }\n },\n value,\n },\n data\n );\n } else if (controlRenderer === 'datepicker') {\n const handleDatepickerChange = event => {\n // When datepicker looses focus, it triggers change event, even if date wasn't changed,\n // so adding additional check here to prevent adding change to the edititng state.\n const originalDate = originalRow[cell.column.id];\n const changedDate = (event as any).detail;\n if (hasChanged(originalDate, changedDate)) {\n handleChange(changedDate);\n }\n };\n\n return (\n <Datepicker\n {...attributes}\n invalid={!!error}\n className={cn({\n '[&_input]:!yt-focus-dark': isCellInDetailMode,\n })}\n onChange={handleDatepickerChange}\n onKeyDown={handleInputKeyDown}\n ref={refCallback}\n value={value as Date}\n />\n );\n } else if (controlRenderer === 'switch') {\n return <Switch {...attributes} checked={Boolean(value)} onChange={handleChange} ref={refCallback} />;\n } else if (controlRenderer === 'textarea') {\n return (\n <TextareaControl\n {...props}\n invalid={!!error}\n isCellInDetailMode={isCellInDetailMode}\n onKeyDown={handleInputKeyDown}\n ref={refCallback}\n fontSize={tableMeta.fontSize.size}\n />\n );\n }\n\n return (\n <Input\n {...attributes}\n invalid={!!error}\n className={cn(getInputAppearanceClassnames(), getCellAlignmentClasses(align), {\n '!yt-focus-dark': isCellInDetailMode,\n })}\n onChange={event => {\n handleChange(event.target.value);\n }}\n onKeyDown={handleInputKeyDown}\n ref={refCallback}\n type={isNumber ? 'number' : undefined}\n value={isNumber ? value : String(value ?? '')}\n />\n );\n});\n"],"names":["EditingControl","React","forwardRef","Control","props","externalRef","align","column","data","initialValue","onChange","handleChange","table","tableRef","value","cell","error","isCurrentRow","attributes","tableMeta","options","meta","ref","useRef","refCallback","mergeRefs","columnMeta","columnDef","controlRenderer","control","isCellInDetailMode","editing","detailModeEditing","_ref$current","current","contains","document","activeElement","originalRow","row","original","handleKeyDown","event","shouldTriggerShortcut","key","shift","toggleEditing","target","readOnly","stopPropagation","preventDefault","setDetailModeEditing","changedRow","changes","id","rowEdtitingDataWithInitialValue","_","isEqual","resetChange","_tableRef$current","focus","deselectInputValue","_target$select","select","call","isNumber","dataType","handleInputKeyDown","test","invalid","setValue","nextValue","handleDatepickerChange","originalDate","changedDate","detail","hasChanged","Datepicker","className","cn","onKeyDown","Switch","checked","Boolean","TextareaControl","fontSize","size","Input","getInputAppearanceClassnames","getCellAlignmentClasses","type","undefined","String"],"mappings":";;;;;;;;;;;;;MAkCaA,cAAc,gBAAGC,cAAK,CAACC,UAAU,CAAmB,SAASC,OAAOA,CAC7EC,KAAiC,EACjCC,WAAmC;;EAEnC,MAAM;IACFC,KAAK;IACLC,MAAM;IACNC,IAAI;IACJC,YAAY;IACZC,QAAQ,EAAEC,YAAY;IACtBC,KAAK;IACLC,QAAQ;IACRC,KAAK;IACLC,IAAI;IACJC,KAAK;IACLC,YAAY;IACZ,GAAGC;GACN,GAAGd,KAAK;EAET,MAAMe,SAAS,GAAGP,KAAK,CAACQ,OAAO,CAACC,IAA0B;EAC1D,MAAMC,GAAG,GAAGrB,cAAK,CAACsB,MAAM,EAAe;EACvC,MAAMC,WAAW,GAAGC,SAAS,CAAC,CAACH,GAAG,EAAEjB,WAAW,CAAC,CAAC;EAEjD,MAAMqB,UAAU,GAAGnB,MAAM,CAACoB,SAAS,CAACN,IAAI;EACxC,MAAMO,eAAe,GAAGF,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEG,OAAO;EAE3C,MAAMC,kBAAkB,GACpBX,SAAS,CAACY,OAAO,CAACC,iBAAiB,KAAKV,GAAoC,aAApCA,GAAoC,wBAAAW,YAAA,GAApCX,GAAoC,CAAEY,OAAO,cAAAD,YAAA,uBAA7CA,YAAA,CAA+CE,QAAQ,CAACC,QAAQ,CAACC,aAAa,CAAC;EAE3H,MAAMC,WAAW,GAAGvB,IAAI,CAACwB,GAAG,CAACC,QAAiB;;EAG9C,MAAMC,aAAa,GAAIC,KAA0B;;;IAG7C,IAAIC,qBAAqB,CAACD,KAAK,EAAE;MAAEE,GAAG,EAAE,GAAG;MAAEvB,IAAI,EAAE,IAAI;MAAEwB,KAAK,EAAE;KAAO,CAAC,EAAE;MACtE1B,SAAS,CAACY,OAAO,CAACe,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IAAI,EAAEzB,QAAQ,GAAG,QAAQ,GAAG0B,SAAS;IACrC7E,KAAK,EAAEmD,QAAQ,GAAGnD,KAAK,GAAG8E,MAAM,CAAC9E,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE;KAC9C;AAEV,CAAC;;;;"}
@@ -0,0 +1,41 @@
1
+ import React__default from 'react';
2
+ import cn from 'classnames';
3
+ import { useRowContext } from '../../rows/RowContext.js';
4
+ import { scrollColumnIntoView } from '../../../util/columns.js';
5
+
6
+ const Highlight = props => {
7
+ const {
8
+ current,
9
+ frozenColumnIndex,
10
+ index,
11
+ tableRef,
12
+ ...attributes
13
+ } = props;
14
+ const {
15
+ hasError: rowHasError
16
+ } = useRowContext();
17
+ const ref = React__default.useRef(null);
18
+ const className = cn('h-full flex [justify-content:inherit] [text-align:inherit]', props.className, {
19
+ // normal row
20
+ 'bg-blue-200/25': !current && !rowHasError,
21
+ // current row
22
+ 'bg-blue-200/75': current && !rowHasError,
23
+ // normal row with error
24
+ 'bg-[#eaeaf5]': !current && rowHasError,
25
+ // current with error
26
+ 'bg-[#dadaf5]': current && rowHasError
27
+ });
28
+ React__default.useEffect(() => {
29
+ if (ref.current && current) {
30
+ scrollColumnIntoView(index, frozenColumnIndex, ref.current, tableRef.current);
31
+ }
32
+ }, [current]);
33
+ return /*#__PURE__*/React__default.createElement("div", Object.assign({}, attributes, {
34
+ "data-taco": 'highlight',
35
+ className: className,
36
+ ref: ref
37
+ }));
38
+ };
39
+
40
+ export { Highlight };
41
+ //# sourceMappingURL=Highlight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Highlight.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/cell/Highlight.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { scrollColumnIntoView } from '../../../util/columns';\nimport { useRowContext } from '../../rows/RowContext';\n\nexport const Highlight = props => {\n const { current, frozenColumnIndex, index, tableRef, ...attributes } = props;\n const { hasError: rowHasError } = useRowContext();\n\n const ref = React.useRef<HTMLDivElement | null>(null);\n const className = cn('h-full flex [justify-content:inherit] [text-align:inherit]', props.className, {\n // normal row\n 'bg-blue-200/25': !current && !rowHasError,\n // current row\n 'bg-blue-200/75': current && !rowHasError,\n // normal row with error\n 'bg-[#eaeaf5]': !current && rowHasError,\n // current with error\n 'bg-[#dadaf5]': current && rowHasError,\n });\n\n React.useEffect(() => {\n if (ref.current && current) {\n scrollColumnIntoView(index, frozenColumnIndex, ref.current, tableRef.current);\n }\n }, [current]);\n\n return <div {...attributes} data-taco='highlight' className={className} ref={ref} />;\n};\n"],"names":["Highlight","props","current","frozenColumnIndex","index","tableRef","attributes","hasError","rowHasError","useRowContext","ref","React","useRef","className","cn","useEffect","scrollColumnIntoView"],"mappings":";;;;;MAKaA,SAAS,GAAGC,KAAK;EAC1B,MAAM;IAAEC,OAAO;IAAEC,iBAAiB;IAAEC,KAAK;IAAEC,QAAQ;IAAE,GAAGC;GAAY,GAAGL,KAAK;EAC5E,MAAM;IAAEM,QAAQ,EAAEC;GAAa,GAAGC,aAAa,EAAE;EAEjD,MAAMC,GAAG,GAAGC,cAAK,CAACC,MAAM,CAAwB,IAAI,CAAC;EACrD,MAAMC,SAAS,GAAGC,EAAE,CAAC,4DAA4D,EAAEb,KAAK,CAACY,SAAS,EAAE;;IAEhG,gBAAgB,EAAE,CAACX,OAAO,IAAI,CAACM,WAAW;;IAE1C,gBAAgB,EAAEN,OAAO,IAAI,CAACM,WAAW;;IAEzC,cAAc,EAAE,CAACN,OAAO,IAAIM,WAAW;;IAEvC,cAAc,EAAEN,OAAO,IAAIM;GAC9B,CAAC;EAEFG,cAAK,CAACI,SAAS,CAAC;IACZ,IAAIL,GAAG,CAACR,OAAO,IAAIA,OAAO,EAAE;MACxBc,oBAAoB,CAACZ,KAAK,EAAED,iBAAiB,EAAEO,GAAG,CAACR,OAAO,EAAEG,QAAQ,CAACH,OAAO,CAAC;;GAEpF,EAAE,CAACA,OAAO,CAAC,CAAC;EAEb,oBAAOS,sDAASL,UAAU;iBAAY,WAAW;IAACO,SAAS,EAAEA,SAAS;IAAEH,GAAG,EAAEA;KAAO;AACxF;;;;"}
@@ -12,7 +12,7 @@ const heights = {
12
12
  max: 86
13
13
  },
14
14
  medium: {
15
- min: 34,
15
+ min: 32,
16
16
  max: 100
17
17
  },
18
18
  large: {
@@ -24,6 +24,7 @@ const TextareaControl = /*#__PURE__*/React__default.forwardRef(function Textarea
24
24
  const {
25
25
  onKeyDown: handleKeyDown,
26
26
  onChange: handleChange,
27
+ onBlur,
27
28
  column,
28
29
  isCellInDetailMode,
29
30
  align,
@@ -79,7 +80,7 @@ const TextareaControl = /*#__PURE__*/React__default.forwardRef(function Textarea
79
80
  resizeTextArea(e.target);
80
81
  };
81
82
  const textareaContainerClassName = cn('w-full', {
82
- 'focus-within:absolute focus-within:left-0 focus-within:top-0 focus-within:z-20 focus-within:px-[var(--table3-cell-padding-x)] focus-within:pt-[var(--table3-cell-padding-y)]': columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.enableTruncate
83
+ 'focus-within:absolute focus-within:left-0 focus-within:top-0 focus-within:z-[9]': columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.enableTruncate
83
84
  });
84
85
  const handleTextareaKeyDown = event => {
85
86
  // By default Shift + Enter in textarea makes a new line, we want to keep this behaviour
@@ -89,9 +90,23 @@ const TextareaControl = /*#__PURE__*/React__default.forwardRef(function Textarea
89
90
  handleKeyDown(event);
90
91
  }
91
92
  };
93
+ const handleBlur = event => {
94
+ // If truncation is enabled, then textarea should shring back to min height, when loosing focus.
95
+ if (columnMeta !== null && columnMeta !== void 0 && columnMeta.enableTruncate) {
96
+ const textareaElement = event.currentTarget;
97
+ textareaElement.style.height = `${minMaxHeight.min}px`;
98
+ }
99
+ onBlur(event);
100
+ };
92
101
  return /*#__PURE__*/React__default.createElement("div", {
93
- className: textareaContainerClassName,
94
102
  "data-taco": "input-container"
103
+ }, /*#__PURE__*/React__default.createElement("div", {
104
+ style: {
105
+ minHeight: `${minMaxHeight.min}px`
106
+ },
107
+ className: "relative"
108
+ }, /*#__PURE__*/React__default.createElement("div", {
109
+ className: textareaContainerClassName
95
110
  }, /*#__PURE__*/React__default.createElement(Textarea, Object.assign({}, attributes, {
96
111
  onChange: event => {
97
112
  handleChange(event.target.value);
@@ -101,14 +116,8 @@ const TextareaControl = /*#__PURE__*/React__default.forwardRef(function Textarea
101
116
  onKeyDown: e => {
102
117
  handleTextareaKeyDown(e);
103
118
  },
104
- onBlur: event => {
105
- // If truncation is enabled, then textarea should shring back to min height, when loosing focus.
106
- if (columnMeta !== null && columnMeta !== void 0 && columnMeta.enableTruncate) {
107
- const textareaElement = event.currentTarget;
108
- textareaElement.style.height = `${minMaxHeight.min}px`;
109
- }
110
- },
111
- className: cn(getCellAlignmentClasses(align), `z-20 h-fit resize-none`, {
119
+ onBlur: handleBlur,
120
+ className: cn(getCellAlignmentClasses(align), `h-fit resize-none`, {
112
121
  [`!min-h-[${minMaxHeight.min}px]`]: columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.enableTruncate,
113
122
  '!yt-focus-dark': isCellInDetailMode,
114
123
  [`h-[${minMaxHeight.min}px]`]: !isCellInDetailMode && (columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.enableTruncate),
@@ -117,7 +126,7 @@ const TextareaControl = /*#__PURE__*/React__default.forwardRef(function Textarea
117
126
  }),
118
127
  ref: ref,
119
128
  value: String(value !== null && value !== void 0 ? value : '')
120
- })));
129
+ })))));
121
130
  });
122
131
 
123
132
  export { TextareaControl };
@@ -1 +1 @@
1
- {"version":3,"file":"TextareaControl.js","sources":["../../../../../../../../../../../src/components/Table3/components/columns/cell/controls/TextareaControl.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Textarea } from '../../../../../Textarea/Textarea';\nimport { EditingControlProps } from '../EditingControl';\nimport { getCellAlignmentClasses } from '../../styles';\nimport { useMergedRef } from '../../../../../../hooks/useMergedRef';\nimport { Table3FontSize } from '../../../../types';\n\ntype TextareaHeight = {\n min: number;\n max: number;\n};\n// By UX design, textarea should fold to min size when blured and extend to max 5 lines height when edited in enableTruncate mode,\n// for this reason we need to set min/max height limits for each font size value.\nconst heights: Record<Table3FontSize, TextareaHeight> = {\n small: {\n min: 24,\n max: 86,\n },\n medium: {\n min: 34,\n max: 100,\n },\n large: {\n min: 40,\n max: 140,\n },\n};\n\ntype TextareaControlProps<TType = unknown> = EditingControlProps<TType> & {\n onKeyDown: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void;\n fontSize: Table3FontSize;\n isCellInDetailMode?: boolean;\n};\n\nexport const TextareaControl = React.forwardRef<HTMLElement, any>(function TextareaControl<TType = unknown>(\n props: TextareaControlProps<TType>,\n externalRef: React.Ref<HTMLElement>\n) {\n const {\n onKeyDown: handleKeyDown,\n onChange: handleChange,\n column,\n isCellInDetailMode,\n align,\n isCurrentRow,\n value,\n fontSize,\n ...attributes\n } = props;\n\n const minMaxHeight = heights[fontSize];\n\n const columnMeta = column.columnDef.meta;\n\n const ref = useMergedRef<HTMLTextAreaElement>(externalRef);\n\n React.useEffect(() => {\n if (ref?.current) {\n // Need to reset textarea to min height when font size got changed and if column in enable truncate mode.\n if (columnMeta?.enableTruncate) {\n const textareaElement = ref?.current as HTMLTextAreaElement;\n textareaElement.style.height = `${minMaxHeight.min}px`;\n\n // If truncation is not enabled, then textarea should re-calculate it's height to fit with it's own content, when initialized or fonsSize got changed.\n } else {\n const textareaElement = ref?.current as HTMLTextAreaElement;\n resizeTextArea(textareaElement);\n }\n }\n }, [fontSize]);\n\n React.useEffect(() => {\n // If truncation is enabled, then textarea should only adjust to it's own content, when in detail mode.\n // Otherwise it should collapse to minimal height.\n if (ref?.current && columnMeta?.enableTruncate) {\n const textareaElement = ref?.current as HTMLTextAreaElement;\n\n if (isCellInDetailMode) {\n resizeTextArea(textareaElement);\n } else {\n textareaElement.style.height = `${minMaxHeight.min}px`;\n }\n }\n }, [isCellInDetailMode]);\n\n const resizeTextArea = (textareaElement: HTMLTextAreaElement) => {\n // Need to set inherit before calculating height, so that browser sets the scrollHeight properly,\n // depending on text inside.\n const textareaRect = textareaElement.getBoundingClientRect();\n const prevHeight = textareaRect.height;\n if (columnMeta?.enableTruncate) {\n if (prevHeight < minMaxHeight.max) {\n textareaElement.style.height = 'inherit';\n textareaElement.style.height = `${Math.min(textareaElement.scrollHeight, minMaxHeight.max)}px`;\n }\n } else {\n textareaElement.style.height = 'inherit';\n textareaElement.style.height = `${textareaElement.scrollHeight}px`;\n }\n };\n\n const handleTextareaChange = e => {\n resizeTextArea(e.target);\n };\n\n const textareaContainerClassName = cn('w-full', {\n 'focus-within:absolute focus-within:left-0 focus-within:top-0 focus-within:z-20 focus-within:px-[var(--table3-cell-padding-x)] focus-within:pt-[var(--table3-cell-padding-y)]':\n columnMeta?.enableTruncate,\n });\n const handleTextareaKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n // By default Shift + Enter in textarea makes a new line, we want to keep this behaviour\n if (event.shiftKey && event.key === 'Enter') {\n return;\n } else {\n handleKeyDown(event);\n }\n };\n\n return (\n <div className={textareaContainerClassName} data-taco=\"input-container\">\n <Textarea\n {...attributes}\n onChange={event => {\n handleChange(event.target.value);\n handleTextareaChange(event);\n }}\n rows={1}\n onKeyDown={e => {\n handleTextareaKeyDown(e);\n }}\n onBlur={event => {\n // If truncation is enabled, then textarea should shring back to min height, when loosing focus.\n if (columnMeta?.enableTruncate) {\n const textareaElement = event.currentTarget;\n textareaElement.style.height = `${minMaxHeight.min}px`;\n }\n }}\n className={cn(getCellAlignmentClasses(align), `z-20 h-fit resize-none`, {\n [`!min-h-[${minMaxHeight.min}px]`]: columnMeta?.enableTruncate,\n '!yt-focus-dark': isCellInDetailMode,\n [`h-[${minMaxHeight.min}px]`]: !isCellInDetailMode && columnMeta?.enableTruncate,\n // Only allow resizing when focused and truncation enabled\n 'focus:resize-y': isCurrentRow && columnMeta?.enableTruncate,\n })}\n ref={ref}\n value={String(value ?? '')}\n />\n </div>\n );\n});\n"],"names":["heights","small","min","max","medium","large","TextareaControl","React","forwardRef","props","externalRef","onKeyDown","handleKeyDown","onChange","handleChange","column","isCellInDetailMode","align","isCurrentRow","value","fontSize","attributes","minMaxHeight","columnMeta","columnDef","meta","ref","useMergedRef","useEffect","current","enableTruncate","textareaElement","style","height","resizeTextArea","textareaRect","getBoundingClientRect","prevHeight","Math","scrollHeight","handleTextareaChange","e","target","textareaContainerClassName","cn","handleTextareaKeyDown","event","shiftKey","key","className","Textarea","rows","onBlur","currentTarget","getCellAlignmentClasses","String"],"mappings":";;;;;;AAYA;AACA;AACA,MAAMA,OAAO,GAA2C;EACpDC,KAAK,EAAE;IACHC,GAAG,EAAE,EAAE;IACPC,GAAG,EAAE;GACR;EACDC,MAAM,EAAE;IACJF,GAAG,EAAE,EAAE;IACPC,GAAG,EAAE;GACR;EACDE,KAAK,EAAE;IACHH,GAAG,EAAE,EAAE;IACPC,GAAG,EAAE;;CAEZ;MAQYG,eAAe,gBAAGC,cAAK,CAACC,UAAU,CAAmB,SAASF,eAAeA,CACtFG,KAAkC,EAClCC,WAAmC;EAEnC,MAAM;IACFC,SAAS,EAAEC,aAAa;IACxBC,QAAQ,EAAEC,YAAY;IACtBC,MAAM;IACNC,kBAAkB;IAClBC,KAAK;IACLC,YAAY;IACZC,KAAK;IACLC,QAAQ;IACR,GAAGC;GACN,GAAGZ,KAAK;EAET,MAAMa,YAAY,GAAGtB,OAAO,CAACoB,QAAQ,CAAC;EAEtC,MAAMG,UAAU,GAAGR,MAAM,CAACS,SAAS,CAACC,IAAI;EAExC,MAAMC,GAAG,GAAGC,YAAY,CAAsBjB,WAAW,CAAC;EAE1DH,cAAK,CAACqB,SAAS,CAAC;IACZ,IAAIF,GAAG,aAAHA,GAAG,eAAHA,GAAG,CAAEG,OAAO,EAAE;;MAEd,IAAIN,UAAU,aAAVA,UAAU,eAAVA,UAAU,CAAEO,cAAc,EAAE;QAC5B,MAAMC,eAAe,GAAG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cAAc;;MAEhF,gBAAgB,EAAEZ,YAAY,KAAIK,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEO,cAAc;KAC/D,CAAC;IACFJ,GAAG,EAAEA,GAAG;IACRP,KAAK,EAAEoC,MAAM,CAACpC,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE;KAC3B,CACA;AAEd,CAAC;;;;"}
1
+ {"version":3,"file":"TextareaControl.js","sources":["../../../../../../../../../../../src/components/Table3/components/columns/cell/controls/TextareaControl.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Textarea } from '../../../../../Textarea/Textarea';\nimport { EditingControlProps } from '../EditingControl';\nimport { getCellAlignmentClasses } from '../../styles';\nimport { useMergedRef } from '../../../../../../hooks/useMergedRef';\nimport { Table3FontSize } from '../../../../types';\n\ntype TextareaHeight = {\n min: number;\n max: number;\n};\n// By UX design, textarea should fold to min size when blured and extend to max 5 lines height when edited in enableTruncate mode,\n// for this reason we need to set min/max height limits for each font size value.\nconst heights: Record<Table3FontSize, TextareaHeight> = {\n small: {\n min: 24,\n max: 86,\n },\n medium: {\n min: 32,\n max: 100,\n },\n large: {\n min: 40,\n max: 140,\n },\n};\n\ntype TextareaControlProps<TType = unknown> = EditingControlProps<TType> & {\n onKeyDown: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void;\n fontSize: Table3FontSize;\n invalid: boolean;\n isCellInDetailMode?: boolean;\n};\n\nexport const TextareaControl = React.forwardRef<HTMLElement, any>(function TextareaControl<TType = unknown>(\n props: TextareaControlProps<TType>,\n externalRef: React.Ref<HTMLElement>\n) {\n const {\n onKeyDown: handleKeyDown,\n onChange: handleChange,\n onBlur,\n column,\n isCellInDetailMode,\n align,\n isCurrentRow,\n value,\n fontSize,\n ...attributes\n } = props;\n\n const minMaxHeight = heights[fontSize];\n\n const columnMeta = column.columnDef.meta;\n\n const ref = useMergedRef<HTMLTextAreaElement>(externalRef);\n\n React.useEffect(() => {\n if (ref?.current) {\n // Need to reset textarea to min height when font size got changed and if column in enable truncate mode.\n if (columnMeta?.enableTruncate) {\n const textareaElement = ref?.current as HTMLTextAreaElement;\n textareaElement.style.height = `${minMaxHeight.min}px`;\n\n // If truncation is not enabled, then textarea should re-calculate it's height to fit with it's own content, when initialized or fonsSize got changed.\n } else {\n const textareaElement = ref?.current as HTMLTextAreaElement;\n resizeTextArea(textareaElement);\n }\n }\n }, [fontSize]);\n\n React.useEffect(() => {\n // If truncation is enabled, then textarea should only adjust to it's own content, when in detail mode.\n // Otherwise it should collapse to minimal height.\n if (ref?.current && columnMeta?.enableTruncate) {\n const textareaElement = ref?.current as HTMLTextAreaElement;\n\n if (isCellInDetailMode) {\n resizeTextArea(textareaElement);\n } else {\n textareaElement.style.height = `${minMaxHeight.min}px`;\n }\n }\n }, [isCellInDetailMode]);\n\n const resizeTextArea = (textareaElement: HTMLTextAreaElement) => {\n // Need to set inherit before calculating height, so that browser sets the scrollHeight properly,\n // depending on text inside.\n const textareaRect = textareaElement.getBoundingClientRect();\n const prevHeight = textareaRect.height;\n if (columnMeta?.enableTruncate) {\n if (prevHeight < minMaxHeight.max) {\n textareaElement.style.height = 'inherit';\n textareaElement.style.height = `${Math.min(textareaElement.scrollHeight, minMaxHeight.max)}px`;\n }\n } else {\n textareaElement.style.height = 'inherit';\n textareaElement.style.height = `${textareaElement.scrollHeight}px`;\n }\n };\n\n const handleTextareaChange = e => {\n resizeTextArea(e.target);\n };\n\n const textareaContainerClassName = cn('w-full', {\n 'focus-within:absolute focus-within:left-0 focus-within:top-0 focus-within:z-[9]':\n columnMeta?.enableTruncate,\n });\n const handleTextareaKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n // By default Shift + Enter in textarea makes a new line, we want to keep this behaviour\n if (event.shiftKey && event.key === 'Enter') {\n return;\n } else {\n handleKeyDown(event);\n }\n };\n\n const handleBlur = event => {\n // If truncation is enabled, then textarea should shring back to min height, when loosing focus.\n if (columnMeta?.enableTruncate) {\n const textareaElement = event.currentTarget;\n textareaElement.style.height = `${minMaxHeight.min}px`;\n }\n onBlur(event);\n };\n\n return (\n <div data-taco=\"input-container\">\n {/**\n * Textarea should have min height placeholder, because it becomes absolute positioned when focused,\n * which leads to overlapping of validation message rendered bellow.\n * Somehow tailwind cannot dynamically assign min height when arbitary value has been used(in this particular case),\n * so assigning it through style prop here\n **/}\n <div style={{ minHeight: `${minMaxHeight.min}px` }} className=\"relative\">\n <div className={textareaContainerClassName}>\n <Textarea\n {...attributes}\n onChange={event => {\n handleChange(event.target.value);\n handleTextareaChange(event);\n }}\n rows={1}\n onKeyDown={e => {\n handleTextareaKeyDown(e);\n }}\n onBlur={handleBlur}\n className={cn(getCellAlignmentClasses(align), `h-fit resize-none`, {\n [`!min-h-[${minMaxHeight.min}px]`]: columnMeta?.enableTruncate,\n '!yt-focus-dark': isCellInDetailMode,\n [`h-[${minMaxHeight.min}px]`]: !isCellInDetailMode && columnMeta?.enableTruncate,\n // Only allow resizing when focused and truncation enabled\n 'focus:resize-y': isCurrentRow && columnMeta?.enableTruncate,\n })}\n ref={ref}\n value={String(value ?? '')}\n />\n </div>\n </div>\n </div>\n );\n});\n"],"names":["heights","small","min","max","medium","large","TextareaControl","React","forwardRef","props","externalRef","onKeyDown","handleKeyDown","onChange","handleChange","onBlur","column","isCellInDetailMode","align","isCurrentRow","value","fontSize","attributes","minMaxHeight","columnMeta","columnDef","meta","ref","useMergedRef","useEffect","current","enableTruncate","textareaElement","style","height","resizeTextArea","textareaRect","getBoundingClientRect","prevHeight","Math","scrollHeight","handleTextareaChange","e","target","textareaContainerClassName","cn","handleTextareaKeyDown","event","shiftKey","key","handleBlur","currentTarget","minHeight","className","Textarea","rows","getCellAlignmentClasses","String"],"mappings":";;;;;;AAYA;AACA;AACA,MAAMA,OAAO,GAA2C;EACpDC,KAAK,EAAE;IACHC,GAAG,EAAE,EAAE;IACPC,GAAG,EAAE;GACR;EACDC,MAAM,EAAE;IACJF,GAAG,EAAE,EAAE;IACPC,GAAG,E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eAAe,GAAGe,KAAK,CAACI,aAAa;MAC3CnB,eAAe,CAACC,KAAK,CAACC,MAAM,MAAMX,YAAY,CAACrB,OAAO;;IAE1Da,MAAM,CAACgC,KAAK,CAAC;GAChB;EAED,oBACIxC;iBAAe;kBAOXA;IAAK0B,KAAK,EAAE;MAAEmB,SAAS,KAAK7B,YAAY,CAACrB;KAAS;IAAEmD,SAAS,EAAC;kBAC1D9C;IAAK8C,SAAS,EAAET;kBACZrC,6BAAC+C,QAAQ,oBACDhC,UAAU;IACdT,QAAQ,EAAEkC,KAAK;MACXjC,YAAY,CAACiC,KAAK,CAACJ,MAAM,CAACvB,KAAK,CAAC;MAChCqB,oBAAoB,CAACM,KAAK,CAAC;KAC9B;IACDQ,IAAI,EAAE,CAAC;IACP5C,SAAS,EAAE+B,CAAC;MACRI,qBAAqB,CAACJ,CAAC,CAAC;KAC3B;IACD3B,MAAM,EAAEmC,UAAU;IAClBG,SAAS,EAAER,EAAE,CAACW,uBAAuB,CAACtC,KAAK,CAAC,qBAAqB,EAAE;MAC/D,YAAYK,YAAY,CAACrB,QAAQ,GAAGsB,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEO,cAAc;MAC9D,gBAAgB,EAAEd,kBAAkB;MACpC,OAAOM,YAAY,CAACrB,QAAQ,GAAG,CAACe,kBAAkB,KAAIO,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEO,cAAc;;MAEhF,gBAAgB,EAAEZ,YAAY,KAAIK,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEO,cAAc;KAC/D,CAAC;IACFJ,GAAG,EAAEA,GAAG;IACRP,KAAK,EAAEqC,MAAM,CAACrC,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE;KAC3B,CACA,CACJ,CACJ;AAEd,CAAC;;;;"}
@@ -30,7 +30,7 @@ const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(prop
30
30
  meta,
31
31
  table
32
32
  } = props;
33
- const className = cn('sticky bottom-0 border-t-2 font-bold h-10 box-content items-center group/column relative', {
33
+ const className = cn('sticky bottom-0 border-t-2 font-bold h-10 box-content items-center group/column relative z-10', {
34
34
  'z-30': isFrozen
35
35
  });
36
36
  if (table.options.debugAll) {
@@ -1 +1 @@
1
- {"version":3,"file":"Footer.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/footer/Footer.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { ColumnMeta, HeaderContext } from '@tanstack/react-table';\nimport { isFrozenColumn } from '../../../util/columns';\nimport { Table3ColumnAlignment, Table3ColumnFooterRenderer } from '../../../types';\n\nexport type FooterProps<TType = unknown> = HeaderContext<TType, unknown> & {\n renderer?: Table3ColumnFooterRenderer<TType>;\n};\n\nexport function Footer<TType = unknown>(props: FooterProps<TType>) {\n const { column, header, table } = props;\n const meta = React.useMemo(() => column.columnDef.meta, []) as ColumnMeta<TType, unknown>;\n\n // Footers are heavily memoized because performance in our table is critical\n // be careful and selective about props that you pass to the Footer\n const memoedProps = {\n align: meta.align,\n id: header.id,\n index: header.index,\n isFrozen: isFrozenColumn(header, table),\n meta,\n table,\n };\n\n return <MemoedFooter<TType> {...memoedProps} />;\n}\n\n// Memoization\nexport type MemoedFooterProps<TType = unknown> = Omit<FooterProps<TType>, 'header' | 'column' | 'scrollToIndex'> & {\n align?: Table3ColumnAlignment;\n id: string;\n index: number;\n isFrozen: boolean;\n meta: ColumnMeta<TType, unknown>;\n};\n\nconst MemoedFooter = React.memo(function MemoedFooter<TType = unknown>(props: MemoedFooterProps<TType>) {\n const { align, id, index, isFrozen, meta, table } = props;\n\n const className = cn('sticky bottom-0 border-t-2 font-bold h-10 box-content items-center group/column relative', {\n 'z-30': isFrozen,\n });\n\n if (table.options.debugAll) {\n console.log('footer render', id);\n }\n\n return (\n <div className={className} data-align={align} data-column-index={index} role=\"columnheader\">\n {typeof meta.footer === 'function' ? (\n <span className=\"flex-grow truncate\">{meta.footer(table.getRowModel().rows.map(row => row.original[id]))}</span>\n ) : null}\n </div>\n );\n}) as <TType = unknown>(props: MemoedFooterProps<TType>) => JSX.Element;\n"],"names":["Footer","props","column","header","table","meta","React","useMemo","columnDef","memoedProps","align","id","index","isFrozen","isFrozenColumn","MemoedFooter","memo","className","cn","options","debugAll","console","log","role","footer","getRowModel","rows","map","row","original"],"mappings":";;;;SAUgBA,MAAMA,CAAkBC,KAAyB;EAC7D,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC;GAAO,GAAGH,KAAK;EACvC,MAAMI,IAAI,GAAGC,cAAK,CAACC,OAAO,CAAC,MAAML,MAAM,CAACM,SAAS,CAACH,IAAI,EAAE,EAAE,CAA+B;;;EAIzF,MAAMI,WAAW,GAAG;IAChBC,KAAK,EAAEL,IAAI,CAACK,KAAK;IACjBC,EAAE,EAAER,MAAM,CAACQ,EAAE;IACbC,KAAK,EAAET,MAAM,CAACS,KAAK;IACnBC,QAAQ,EAAEC,cAAc,CAACX,MAAM,EAAEC,KAAK,CAAC;IACvCC,IAAI;IACJD;GACH;EAED,oBAAOE,6BAACS,YAAY,oBAAYN,WAAW,EAAI;AACnD;AAWA,MAAMM,YAAY,gBAAGT,cAAK,CAACU,IAAI,CAAC,SAASD,YAAYA,CAAkBd,KAA+B;EAClG,MAAM;IAAES,KAAK;IAAEC,EAAE;IAAEC,KAAK;IAAEC,QAAQ;IAAER,IAAI;IAAED;GAAO,GAAGH,KAAK;EAEzD,MAAMgB,SAAS,GAAGC,EAAE,CAAC,0FAA0F,EAAE;IAC7G,MAAM,EAAEL;GACX,CAAC;EAEF,IAAIT,KAAK,CAACe,OAAO,CAACC,QAAQ,EAAE;IACxBC,OAAO,CAACC,GAAG,CAAC,eAAe,EAAEX,EAAE,CAAC;;EAGpC,oBACIL;IAAKW,SAAS,EAAEA,SAAS;kBAAcP,KAAK;yBAAqBE,KAAK;IAAEW,IAAI,EAAC;KACxE,OAAOlB,IAAI,CAACmB,MAAM,KAAK,UAAU,gBAC9BlB;IAAMW,SAAS,EAAC;KAAsBZ,IAAI,CAACmB,MAAM,CAACpB,KAAK,CAACqB,WAAW,EAAE,CAACC,IAAI,CAACC,GAAG,CAACC,GAAG,IAAIA,GAAG,CAACC,QAAQ,CAAClB,EAAE,CAAC,CAAC,CAAC,CAAQ,GAChH,IAAI,CACN;AAEd,CAAC,CAAsE;;;;"}
1
+ {"version":3,"file":"Footer.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/footer/Footer.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { ColumnMeta, HeaderContext } from '@tanstack/react-table';\nimport { isFrozenColumn } from '../../../util/columns';\nimport { Table3ColumnAlignment, Table3ColumnFooterRenderer } from '../../../types';\n\nexport type FooterProps<TType = unknown> = HeaderContext<TType, unknown> & {\n renderer?: Table3ColumnFooterRenderer<TType>;\n};\n\nexport function Footer<TType = unknown>(props: FooterProps<TType>) {\n const { column, header, table } = props;\n const meta = React.useMemo(() => column.columnDef.meta, []) as ColumnMeta<TType, unknown>;\n\n // Footers are heavily memoized because performance in our table is critical\n // be careful and selective about props that you pass to the Footer\n const memoedProps = {\n align: meta.align,\n id: header.id,\n index: header.index,\n isFrozen: isFrozenColumn(header, table),\n meta,\n table,\n };\n\n return <MemoedFooter<TType> {...memoedProps} />;\n}\n\n// Memoization\nexport type MemoedFooterProps<TType = unknown> = Omit<FooterProps<TType>, 'header' | 'column' | 'scrollToIndex'> & {\n align?: Table3ColumnAlignment;\n id: string;\n index: number;\n isFrozen: boolean;\n meta: ColumnMeta<TType, unknown>;\n};\n\nconst MemoedFooter = React.memo(function MemoedFooter<TType = unknown>(props: MemoedFooterProps<TType>) {\n const { align, id, index, isFrozen, meta, table } = props;\n\n const className = cn('sticky bottom-0 border-t-2 font-bold h-10 box-content items-center group/column relative z-10', {\n 'z-30': isFrozen,\n });\n\n if (table.options.debugAll) {\n console.log('footer render', id);\n }\n\n return (\n <div className={className} data-align={align} data-column-index={index} role=\"columnheader\">\n {typeof meta.footer === 'function' ? (\n <span className=\"flex-grow truncate\">{meta.footer(table.getRowModel().rows.map(row => row.original[id]))}</span>\n ) : null}\n </div>\n );\n}) as <TType = unknown>(props: MemoedFooterProps<TType>) => JSX.Element;\n"],"names":["Footer","props","column","header","table","meta","React","useMemo","columnDef","memoedProps","align","id","index","isFrozen","isFrozenColumn","MemoedFooter","memo","className","cn","options","debugAll","console","log","role","footer","getRowModel","rows","map","row","original"],"mappings":";;;;SAUgBA,MAAMA,CAAkBC,KAAyB;EAC7D,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC;GAAO,GAAGH,KAAK;EACvC,MAAMI,IAAI,GAAGC,cAAK,CAACC,OAAO,CAAC,MAAML,MAAM,CAACM,SAAS,CAACH,IAAI,EAAE,EAAE,CAA+B;;;EAIzF,MAAMI,WAAW,GAAG;IAChBC,KAAK,EAAEL,IAAI,CAACK,KAAK;IACjBC,EAAE,EAAER,MAAM,CAACQ,EAAE;IACbC,KAAK,EAAET,MAAM,CAACS,KAAK;IACnBC,QAAQ,EAAEC,cAAc,CAACX,MAAM,EAAEC,KAAK,CAAC;IACvCC,IAAI;IACJD;GACH;EAED,oBAAOE,6BAACS,YAAY,oBAAYN,WAAW,EAAI;AACnD;AAWA,MAAMM,YAAY,gBAAGT,cAAK,CAACU,IAAI,CAAC,SAASD,YAAYA,CAAkBd,KAA+B;EAClG,MAAM;IAAES,KAAK;IAAEC,EAAE;IAAEC,KAAK;IAAEC,QAAQ;IAAER,IAAI;IAAED;GAAO,GAAGH,KAAK;EAEzD,MAAMgB,SAAS,GAAGC,EAAE,CAAC,+FAA+F,EAAE;IAClH,MAAM,EAAEL;GACX,CAAC;EAEF,IAAIT,KAAK,CAACe,OAAO,CAACC,QAAQ,EAAE;IACxBC,OAAO,CAACC,GAAG,CAAC,eAAe,EAAEX,EAAE,CAAC;;EAGpC,oBACIL;IAAKW,SAAS,EAAEA,SAAS;kBAAcP,KAAK;yBAAqBE,KAAK;IAAEW,IAAI,EAAC;KACxE,OAAOlB,IAAI,CAACmB,MAAM,KAAK,UAAU,gBAC9BlB;IAAMW,SAAS,EAAC;KAAsBZ,IAAI,CAACmB,MAAM,CAACpB,KAAK,CAACqB,WAAW,EAAE,CAACC,IAAI,CAACC,GAAG,CAACC,GAAG,IAAIA,GAAG,CAACC,QAAQ,CAAClB,EAAE,CAAC,CAAC,CAAC,CAAQ,GAChH,IAAI,CACN;AAEd,CAAC,CAAsE;;;;"}
@@ -39,11 +39,11 @@ const MemoedGroup = /*#__PURE__*/React__default.memo(function MemoedGroup(props)
39
39
  meta,
40
40
  table
41
41
  } = props;
42
- const containerClassName = cn('sticky px-2 mb-[2px]', {
43
- 'h-10': !isPrinting
44
- }, colSpan > 1 ? `col-span-${colSpan}` : '');
42
+ const containerClassName = cn('px-2 z-10 hover:z-20', colSpan > 1 ? `col-span-${colSpan}` : '', {
43
+ sticky: !isPrinting
44
+ });
45
45
  const innerClassName = cn('font-bold box-content group/column relative', 'px-[var(--table3-cell-padding-x)]', {
46
- 'h-full items-center': !isPrinting,
46
+ 'h-10 items-center': !isPrinting,
47
47
  'pb-2': isPrinting,
48
48
  'border-b-2': !!children
49
49
  }, meta.headerClassName);
@@ -53,7 +53,8 @@ const MemoedGroup = /*#__PURE__*/React__default.memo(function MemoedGroup(props)
53
53
  return /*#__PURE__*/React__default.createElement("div", {
54
54
  className: containerClassName,
55
55
  "data-taco": "table3-column-group",
56
- "data-align": align
56
+ "data-align": align,
57
+ role: "columnheader"
57
58
  }, /*#__PURE__*/React__default.createElement("div", {
58
59
  className: innerClassName
59
60
  }, /*#__PURE__*/React__default.createElement(Tooltip, {
@@ -1 +1 @@
1
- {"version":3,"file":"Group.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/header/Group.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\n\nimport { HeaderProps, HeaderSeparator } from './Header';\nimport { ColumnMeta, TableMeta } from '@tanstack/react-table';\nimport { Table3ColumnAlignment } from '../../../types';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\n\nexport function Group<TType = unknown>(props: HeaderProps<TType>) {\n const { children, column, header, table, hasSeparator } = props;\n const columnMeta = React.useMemo(() => column.columnDef.meta, []) as ColumnMeta<TType, unknown>;\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const memoedProps = {\n align: 'center' as Table3ColumnAlignment,\n children: children ?? columnMeta.header,\n colSpan: header.colSpan,\n hasSeparator,\n id: header.id,\n index: header.index,\n isPrinting: tableMeta.isPrinting,\n length: table.getRowModel().rows.length,\n meta: columnMeta,\n table,\n };\n\n return <MemoedGroup<TType> {...memoedProps} />;\n}\n\n// Memoization\nexport type MemoedGroupProps<TType = unknown> = Omit<HeaderProps<TType>, 'column' | 'header' | 'scrollToIndex'> & {\n align?: Table3ColumnAlignment;\n colSpan: number;\n hasSeparator?: boolean;\n id: string;\n index: number;\n isPrinting: boolean;\n length: number;\n meta: ColumnMeta<TType, unknown>;\n};\n\nconst MemoedGroup = React.memo(function MemoedGroup<TType = unknown>(props: MemoedGroupProps<TType>) {\n const { align, children, colSpan, hasSeparator, id, isPrinting, meta, table } = props;\n\n const containerClassName = cn(\n 'sticky px-2 mb-[2px]',\n {\n 'h-10': !isPrinting,\n },\n colSpan > 1 ? `col-span-${colSpan}` : ''\n );\n\n const innerClassName = cn(\n 'font-bold box-content group/column relative',\n 'px-[var(--table3-cell-padding-x)]',\n {\n 'h-full items-center': !isPrinting,\n 'pb-2': isPrinting,\n 'border-b-2': !!children,\n },\n meta.headerClassName\n );\n\n if (table.options.debugAll) {\n console.log('header group render', id);\n }\n\n return (\n <div className={containerClassName} data-taco=\"table3-column-group\" data-align={align}>\n <div className={innerClassName}>\n <Tooltip title={String(meta?.tooltip ?? children)} placement=\"top\">\n <span className={cn({ truncate: !isPrinting })}>{children}</span>\n </Tooltip>\n {hasSeparator ? <HeaderSeparator /> : null}\n </div>\n </div>\n );\n}) as <TType = unknown>(props: MemoedGroupProps<TType>) => JSX.Element;\n"],"names":["Group","props","children","column","header","table","hasSeparator","columnMeta","React","useMemo","columnDef","meta","tableMeta","options","memoedProps","align","colSpan","id","index","isPrinting","length","getRowModel","rows","MemoedGroup","memo","containerClassName","cn","innerClassName","headerClassName","debugAll","console","log","className","Tooltip","title","String","_meta$tooltip","tooltip","placement","truncate","HeaderSeparator"],"mappings":";;;;;SAQgBA,KAAKA,CAAkBC,KAAyB;EAC5D,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,MAAM;IAAEC,KAAK;IAAEC;GAAc,GAAGL,KAAK;EAC/D,MAAMM,UAAU,GAAGC,cAAK,CAACC,OAAO,CAAC,MAAMN,MAAM,CAACO,SAAS,CAACC,IAAI,EAAE,EAAE,CAA+B;EAC/F,MAAMC,SAAS,GAAGP,KAAK,CAACQ,OAAO,CAACF,IAAwB;EAExD,MAAMG,WAAW,GAAG;IAChBC,KAAK,EAAE,QAAiC;IACxCb,QAAQ,EAAEA,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAIK,UAAU,CAACH,MAAM;IACvCY,OAAO,EAAEZ,MAAM,CAACY,OAAO;IACvBV,YAAY;IACZW,EAAE,EAAEb,MAAM,CAACa,EAAE;IACbC,KAAK,EAAEd,MAAM,CAACc,KAAK;IACnBC,UAAU,EAAEP,SAAS,CAACO,UAAU;IAChCC,MAAM,EAAEf,KAAK,CAACgB,WAAW,EAAE,CAACC,IAAI,CAACF,MAAM;IACvCT,IAAI,EAAEJ,UAAU;IAChBF;GACH;EAED,oBAAOG,6BAACe,WAAW,oBAAYT,WAAW,EAAI;AAClD;AAcA,MAAMS,WAAW,gBAAGf,cAAK,CAACgB,IAAI,CAAC,SAASD,WAAWA,CAAkBtB,KAA8B;;EAC/F,MAAM;IAAEc,KAAK;IAAEb,QAAQ;IAAEc,OAAO;IAAEV,YAAY;IAAEW,EAAE;IAAEE,UAAU;IAAER,IAAI;IAAEN;GAAO,GAAGJ,KAAK;EAErF,MAAMwB,kBAAkB,GAAGC,EAAE,CACzB,sBAAsB,EACtB;IACI,MAAM,EAAE,CAACP;GACZ,EACDH,OAAO,GAAG,CAAC,eAAeA,SAAS,GAAG,EAAE,CAC3C;EAED,MAAMW,cAAc,GAAGD,EAAE,CACrB,6CAA6C,EAC7C,mCAAmC,EACnC;IACI,qBAAqB,EAAE,CAACP,UAAU;IAClC,MAAM,EAAEA,UAAU;IAClB,YAAY,EAAE,CAAC,CAACjB;GACnB,EACDS,IAAI,CAACiB,eAAe,CACvB;EAED,IAAIvB,KAAK,CAACQ,OAAO,CAACgB,QAAQ,EAAE;IACxBC,OAAO,CAACC,GAAG,CAAC,qBAAqB,EAAEd,EAAE,CAAC;;EAG1C,oBACIT;IAAKwB,SAAS,EAAEP,kBAAkB;iBAAY,qBAAqB;kBAAaV;kBAC5EP;IAAKwB,SAAS,EAAEL;kBACZnB,6BAACyB,OAAO;IAACC,KAAK,EAAEC,MAAM,EAAAC,aAAA,GAACzB,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAE0B,OAAO,cAAAD,aAAA,cAAAA,aAAA,GAAIlC,QAAQ,CAAC;IAAEoC,SAAS,EAAC;kBACzD9B;IAAMwB,SAAS,EAAEN,EAAE,CAAC;MAAEa,QAAQ,EAAE,CAACpB;KAAY;KAAIjB,QAAQ,CAAQ,CAC3D,EACTI,YAAY,gBAAGE,6BAACgC,eAAe,OAAG,GAAG,IAAI,CACxC,CACJ;AAEd,CAAC,CAAqE;;;;"}
1
+ {"version":3,"file":"Group.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/header/Group.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\n\nimport { HeaderProps, HeaderSeparator } from './Header';\nimport { ColumnMeta, TableMeta } from '@tanstack/react-table';\nimport { Table3ColumnAlignment } from '../../../types';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\n\nexport function Group<TType = unknown>(props: HeaderProps<TType>) {\n const { children, column, header, table, hasSeparator } = props;\n const columnMeta = React.useMemo(() => column.columnDef.meta, []) as ColumnMeta<TType, unknown>;\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const memoedProps = {\n align: 'center' as Table3ColumnAlignment,\n children: children ?? columnMeta.header,\n colSpan: header.colSpan,\n hasSeparator,\n id: header.id,\n index: header.index,\n isPrinting: tableMeta.isPrinting,\n length: table.getRowModel().rows.length,\n meta: columnMeta,\n table,\n };\n\n return <MemoedGroup<TType> {...memoedProps} />;\n}\n\n// Memoization\nexport type MemoedGroupProps<TType = unknown> = Omit<HeaderProps<TType>, 'column' | 'header' | 'scrollToIndex'> & {\n align?: Table3ColumnAlignment;\n colSpan: number;\n hasSeparator?: boolean;\n id: string;\n index: number;\n isPrinting: boolean;\n length: number;\n meta: ColumnMeta<TType, unknown>;\n};\n\nconst MemoedGroup = React.memo(function MemoedGroup<TType = unknown>(props: MemoedGroupProps<TType>) {\n const { align, children, colSpan, hasSeparator, id, isPrinting, meta, table } = props;\n\n const containerClassName = cn('px-2 z-10 hover:z-20', colSpan > 1 ? `col-span-${colSpan}` : '', { sticky: !isPrinting });\n\n const innerClassName = cn(\n 'font-bold box-content group/column relative',\n 'px-[var(--table3-cell-padding-x)]',\n {\n 'h-10 items-center': !isPrinting,\n 'pb-2': isPrinting,\n 'border-b-2': !!children,\n },\n meta.headerClassName\n );\n\n if (table.options.debugAll) {\n console.log('header group render', id);\n }\n\n return (\n <div className={containerClassName} data-taco=\"table3-column-group\" data-align={align} role=\"columnheader\">\n <div className={innerClassName}>\n <Tooltip title={String(meta?.tooltip ?? children)} placement=\"top\">\n <span className={cn({ truncate: !isPrinting })}>{children}</span>\n </Tooltip>\n {hasSeparator ? <HeaderSeparator /> : null}\n </div>\n </div>\n );\n}) as <TType = unknown>(props: MemoedGroupProps<TType>) => JSX.Element;\n"],"names":["Group","props","children","column","header","table","hasSeparator","columnMeta","React","useMemo","columnDef","meta","tableMeta","options","memoedProps","align","colSpan","id","index","isPrinting","length","getRowModel","rows","MemoedGroup","memo","containerClassName","cn","sticky","innerClassName","headerClassName","debugAll","console","log","className","role","Tooltip","title","String","_meta$tooltip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AAmB,EAAE,CAACP,UAAU;IAChC,MAAM,EAAEA,UAAU;IAClB,YAAY,EAAE,CAAC,CAACjB;GACnB,EACDS,IAAI,CAACkB,eAAe,CACvB;EAED,IAAIxB,KAAK,CAACQ,OAAO,CAACiB,QAAQ,EAAE;IACxBC,OAAO,CAACC,GAAG,CAAC,qBAAqB,EAAEf,EAAE,CAAC;;EAG1C,oBACIT;IAAKyB,SAAS,EAAER,kBAAkB;iBAAY,qBAAqB;kBAAaV,KAAK;IAAEmB,IAAI,EAAC;kBACxF1B;IAAKyB,SAAS,EAAEL;kBACZpB,6BAAC2B,OAAO;IAACC,KAAK,EAAEC,MAAM,EAAAC,aAAA,GAAC3B,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAE4B,OAAO,cAAAD,aAAA,cAAAA,aAAA,GAAIpC,QAAQ,CAAC;IAAEsC,SAAS,EAAC;kBACzDhC;IAAMyB,SAAS,EAAEP,EAAE,CAAC;MAAEe,QAAQ,EAAE,CAACtB;KAAY;KAAIjB,QAAQ,CAAQ,CAC3D,EACTI,YAAY,gBAAGE,6BAACkC,eAAe,OAAG,GAAG,IAAI,CACxC,CACJ;AAEd,CAAC,CAAqE;;;;"}
@@ -102,9 +102,9 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
102
102
  sortDirection,
103
103
  table
104
104
  } = props;
105
- 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)]', {
105
+ const className = cn('font-bold border-b-2 box-content group/column relative', '[[role="table"][data-resizing="true"]_&]:pointer-events-none', 'px-[var(--table3-cell-padding-x)]', {
106
106
  '!border-white': isPlaceholder,
107
- 'h-10 items-center': !isPrinting,
107
+ 'h-10 items-center sticky': !isPrinting,
108
108
  'pb-2': isPrinting,
109
109
  'cursor-pointer select-none': canSort,
110
110
  'hover:bg-grey-100': !isPlaceholder && (canSort || canResize || hasMenu),
@@ -1 +1 @@
1
- {"version":3,"file":"Header.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/header/Header.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { ColumnMeta, HeaderContext, TableMeta } from '@tanstack/react-table';\nimport { Menu, isMenuAvailable, isGotoAvailable } from './Menu';\nimport { Resizer } from './Resizer';\nimport { Table3ColumnAlignment, Table3SortDirection, TableStrategy } from '../../../types';\nimport { getSortAttributes, SortIndicator } from './SortIndicator';\nimport { isFrozenColumn, isInternalColumn } from '../../../util/columns';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\n\nexport const SORT_DIRECTION: Record<string, Table3SortDirection> = {\n ASC: 'asc',\n DESC: 'desc',\n};\n\nexport type HeaderSortDirection = Table3SortDirection | false;\nexport type SortToggleHandler = (sortDirection: HeaderSortDirection) => void;\n\nexport type HeaderProps<TType = unknown> = HeaderContext<TType, unknown> & {\n children?: string | JSX.Element;\n hasSeparator?: boolean;\n};\n\nexport function Header<TType = unknown>(props: HeaderProps<TType>) {\n const { children, column, header, hasSeparator, scrollToIndex, table } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n const columnMeta = React.useMemo(() => column.columnDef.meta, []) as ColumnMeta<TType, unknown>;\n const canSort = column.getCanSort();\n const hasGoto = isGotoAvailable(table, header);\n\n // passing header or column results in re-renders on scroll, so anything from those objects as memoed props\n const handleHide = React.useMemo(() => header.column.getToggleVisibilityHandler(), []);\n const handleResize = React.useMemo(() => header.getResizeHandler(), []);\n const handleSort = React.useMemo(() => header.column.getToggleSortingHandler(), []);\n const handleSortToggle = React.useCallback((sortDirection: HeaderSortDirection) => {\n // When sorting is not applied, sortDirection is false.\n if (sortDirection === false) {\n header.column.clearSorting();\n } else {\n header.column.toggleSorting(sortDirection === SORT_DIRECTION.DESC);\n }\n }, []);\n\n const sorting = table.getState().sorting;\n const filters = table.getState().columnFilters;\n const search = table.getState().globalFilter;\n\n const handleGoto = React.useMemo(() => {\n if (hasGoto) {\n return ((query: string) => tableMeta.rowGoto.handleGoto(header.id, query, sorting, filters, search)) as (\n query: string\n ) => Promise<number>;\n }\n\n return undefined;\n }, [hasGoto, JSON.stringify(sorting), JSON.stringify(filters), search]);\n\n const memoedProps = {\n align: columnMeta.align,\n canFreeze: tableMeta.columnFreezing.isEnabled,\n canHide: column.getCanHide(),\n canResize: column.getCanResize(),\n canSort,\n children: children ?? columnMeta.header,\n colSpan: header.colSpan,\n hasMenu: isMenuAvailable<TType>(table, header),\n hasSeparator,\n id: header.id,\n index: header.index,\n isFrozen: isFrozenColumn(header, table),\n isPlaceholder: header.isPlaceholder,\n isPrinting: tableMeta.isPrinting,\n isResizing: column.getIsResizing(),\n length: table.getRowModel().rows.length,\n meta: columnMeta,\n onGoto: handleGoto,\n onHide: handleHide,\n onResize: handleResize,\n onSort: handleSort as (event: unknown) => void,\n onSortToggle: handleSortToggle,\n scrollToIndex,\n sortDirection: column.getIsSorted(),\n table,\n };\n\n return <MemoedHeader<TType> {...memoedProps} />;\n}\n\n// Memoization\nexport type MemoedHeaderProps<TType = unknown> = Omit<HeaderProps<TType>, 'column' | 'header'> & {\n align?: Table3ColumnAlignment;\n canFreeze: boolean;\n canHide: boolean;\n canResize: boolean;\n canSort: boolean;\n colSpan: number;\n hasMenu: boolean;\n hasSeparator?: boolean;\n id: string;\n index: number;\n isFrozen: boolean;\n isPlaceholder: boolean;\n isPrinting: boolean;\n isResizing: boolean;\n length: number;\n meta: ColumnMeta<TType, unknown>;\n onGoto?: (query: string) => Promise<number>;\n onHide: (event: unknown) => void;\n onResize: (event: unknown) => void;\n onSort: (event: unknown) => void;\n onSortToggle: SortToggleHandler;\n scrollToIndex: TableStrategy['scrollToIndex'];\n sortDirection: HeaderSortDirection;\n};\n\nconst MemoedHeader = React.memo(function MemoedHeader<TType = unknown>(props: MemoedHeaderProps<TType>) {\n const {\n align,\n children,\n canFreeze,\n canHide,\n canResize,\n canSort,\n colSpan,\n hasMenu,\n hasSeparator,\n id,\n index,\n isFrozen,\n isPlaceholder,\n isPrinting,\n isResizing,\n length,\n meta,\n onGoto: handleGoto,\n onHide: handleHide,\n onResize: handleResize,\n onSort: handleSort,\n onSortToggle: handleSortToggle,\n scrollToIndex,\n sortDirection,\n table,\n } = props;\n\n const className = cn(\n 'sticky font-bold border-b-2 box-content group/column relative',\n '[[role=\"table\"][data-resizing=\"true\"]_&]:pointer-events-none',\n 'px-[var(--table3-cell-padding-x)]',\n {\n '!border-white': isPlaceholder,\n 'h-10 items-center': !isPrinting,\n 'pb-2': isPrinting,\n 'cursor-pointer select-none': canSort,\n 'hover:bg-grey-100': !isPlaceholder && (canSort || canResize || hasMenu),\n 'focus-within:bg-grey-100': hasMenu,\n '!pointer-events-all !bg-grey-100': !isPlaceholder && isResizing,\n // z-indexes\n 'z-10 hover:z-20': !isFrozen && !isResizing,\n 'z-20': !isFrozen && isResizing,\n // when column is frozen, we need to increase it's z-index when it's hovered,\n // so that resize handler appears on top of next frozen cell, and didn't get cut by it.\n '!z-30 hover:!z-40': isFrozen,\n '!z-40': isFrozen && isResizing,\n },\n colSpan > 1 ? `col-span-${colSpan}` : '',\n meta.headerClassName\n );\n\n const [internalRef, setInternalRef] = React.useState<HTMLDivElement | null>(null);\n\n React.useLayoutEffect(() => {\n if (internalRef && length) {\n // the actions column size gets set by the column itself\n if (isInternalColumn(id)) {\n return;\n }\n\n table.setColumnSizing(sizes => ({\n ...sizes,\n [id]: internalRef.getBoundingClientRect().width,\n }));\n }\n }, [internalRef, length]);\n\n if (table.options.debugAll) {\n console.log('header render', id);\n }\n return (\n <div\n {...(canSort ? getSortAttributes(handleSort, sortDirection) : undefined)}\n className={className}\n data-align={align}\n data-column-index={index}\n role=\"columnheader\"\n ref={setInternalRef}>\n {isPlaceholder ? null : (\n <>\n {isInternalColumn(id) ? (\n children\n ) : (\n <Tooltip title={String(meta?.tooltip ?? children)} placement=\"top\">\n <span className={cn({ truncate: !isPrinting })}>{children}</span>\n </Tooltip>\n )}\n {canSort ? <SortIndicator direction={sortDirection} /> : null}\n {hasMenu ? (\n <Menu\n canFreeze={canFreeze}\n canHide={canHide}\n canSort={canSort}\n className={cn({\n 'ml-auto': align !== 'right',\n 'ml-2': align === 'right',\n })}\n index={index}\n menu={meta.menu}\n onGoto={handleGoto}\n onHide={handleHide}\n onSortToggle={handleSortToggle}\n scrollToIndex={scrollToIndex}\n sortDirection={sortDirection}\n table={table}\n />\n ) : null}\n </>\n )}\n {/* Header separator need to go before Resizer to prevent it's overlapping */}\n {hasSeparator ? <HeaderSeparator /> : null}\n {!isPlaceholder && canResize ? <Resizer isResizing={isResizing} onResize={handleResize} /> : null}\n </div>\n );\n}) as <TType = unknown>(props: MemoedHeaderProps<TType>) => JSX.Element;\n\nexport function HeaderSeparator() {\n return (\n <div\n data-taco=\"header-separator\"\n className={cn(\n 'invisible absolute right-[0.5px] top-0 flex h-full w-2 touch-none select-none justify-center py-2 group-hover/header:visible'\n )}>\n <div className={cn('bg-grey-300 h-full w-[1px]')} />\n </div>\n );\n}\n"],"names":["SORT_DIRECTION","ASC","DESC","Header","props","children","column","header","hasSeparator","scrollToIndex","table","tableMeta","options","meta","columnMeta","React","useMemo","columnDef","canSort","getCanSort","hasGoto","isGotoAvailable","handleHide","getToggleVisibilityHandler","handleResize","getResizeHandler","handleSort","getToggleSortingHandler","handleSortToggle","useCallback","sortDirection","clearSorting","toggleSorting","sorting","getState","filters","columnFilters","search","globalFilter","handleGoto","query","rowGoto","id","undefined","JSON","stringify","memoedProps","align","canFreeze","columnFreezing","isEnabled","canHide","getCanHide","canResize","getCanResize","colSpan","hasMenu","isMenuAvailable","index","isFrozen","isFrozenColumn","isPlaceholder","isPrinting","isResizing","getIsResizing","length","getRowModel","rows","onGoto","onHide","onResize","onSort","onSortToggle","getIsSorted","MemoedHeader","memo","className","cn","headerClassName","internalRef","setInternalRef","useState","useLayoutEffect","isInternalColumn","setColumnSizing","sizes","getBoundingClientRect","width","debugAll","console","log","getSortAttributes","role","ref","Tooltip","title","String","_meta$tooltip","tooltip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C;IAAE8F,SAAS,EAAC;kBACzDpF;IAAM6D,SAAS,EAAEC,EAAE,CAAC;MAAEuB,QAAQ,EAAE,CAACtC;KAAY;KAAIzD,QAAQ,CAAQ,CAExE,EACAa,OAAO,gBAAGH,6BAACsF,aAAa;IAACC,SAAS,EAAExE;IAAiB,GAAG,IAAI,EAC5D0B,OAAO,gBACJzC,6BAACwF,IAAI;IACDvD,SAAS,EAAEA,SAAS;IACpBG,OAAO,EAAEA,OAAO;IAChBjC,OAAO,EAAEA,OAAO;IAChB0D,SAAS,EAAEC,EAAE,CAAC;MACV,SAAS,EAAE9B,KAAK,KAAK,OAAO;MAC5B,MAAM,EAAEA,KAAK,KAAK;KACrB,CAAC;IACFW,KAAK,EAAEA,KAAK;IACZ8C,IAAI,EAAE3F,IAAI,CAAC2F,IAAI;IACfpC,MAAM,EAAE7B,UAAU;IAClB8B,MAAM,EAAE/C,UAAU;IAClBkD,YAAY,EAAE5C,gBAAgB;IAC9BnB,aAAa,EAAEA,aAAa;IAC5BqB,aAAa,EAAEA,aAAa;IAC5BpB,KAAK,EAAEA;IACT,GACF,IAAI,CAEf,EAEAF,YAAY,gBAAGO,6BAAC0F,eAAe,OAAG,GAAG,IAAI,EACzC,CAAC5C,aAAa,IAAIR,SAAS,gBAAGtC,6BAAC2F,OAAO;IAAC3C,UAAU,EAAEA,UAAU;IAAEO,QAAQ,EAAE9C;IAAgB,GAAG,IAAI,CAC/F;AAEd,CAAC,CAAsE;SAEvDiF,eAAeA;EAC3B,oBACI1F;iBACc,kBAAkB;IAC5B6D,SAAS,EAAEC,EAAE,CACT,8HAA8H;kBAElI9D;IAAK6D,SAAS,EAAEC,EAAE,CAAC,4BAA4B;IAAK,CAClD;AAEd;;;;"}
1
+ {"version":3,"file":"Header.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/header/Header.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { ColumnMeta, HeaderContext, TableMeta } from '@tanstack/react-table';\nimport { Menu, isMenuAvailable, isGotoAvailable } from './Menu';\nimport { Resizer } from './Resizer';\nimport { Table3ColumnAlignment, Table3SortDirection, TableStrategy } from '../../../types';\nimport { getSortAttributes, SortIndicator } from './SortIndicator';\nimport { isFrozenColumn, isInternalColumn } from '../../../util/columns';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\n\nexport const SORT_DIRECTION: Record<string, Table3SortDirection> = {\n ASC: 'asc',\n DESC: 'desc',\n};\n\nexport type HeaderSortDirection = Table3SortDirection | false;\nexport type SortToggleHandler = (sortDirection: HeaderSortDirection) => void;\n\nexport type HeaderProps<TType = unknown> = HeaderContext<TType, unknown> & {\n children?: string | JSX.Element;\n hasSeparator?: boolean;\n};\n\nexport function Header<TType = unknown>(props: HeaderProps<TType>) {\n const { children, column, header, hasSeparator, scrollToIndex, table } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n const columnMeta = React.useMemo(() => column.columnDef.meta, []) as ColumnMeta<TType, unknown>;\n const canSort = column.getCanSort();\n const hasGoto = isGotoAvailable(table, header);\n\n // passing header or column results in re-renders on scroll, so anything from those objects as memoed props\n const handleHide = React.useMemo(() => header.column.getToggleVisibilityHandler(), []);\n const handleResize = React.useMemo(() => header.getResizeHandler(), []);\n const handleSort = React.useMemo(() => header.column.getToggleSortingHandler(), []);\n const handleSortToggle = React.useCallback((sortDirection: HeaderSortDirection) => {\n // When sorting is not applied, sortDirection is false.\n if (sortDirection === false) {\n header.column.clearSorting();\n } else {\n header.column.toggleSorting(sortDirection === SORT_DIRECTION.DESC);\n }\n }, []);\n\n const sorting = table.getState().sorting;\n const filters = table.getState().columnFilters;\n const search = table.getState().globalFilter;\n\n const handleGoto = React.useMemo(() => {\n if (hasGoto) {\n return ((query: string) => tableMeta.rowGoto.handleGoto(header.id, query, sorting, filters, search)) as (\n query: string\n ) => Promise<number>;\n }\n\n return undefined;\n }, [hasGoto, JSON.stringify(sorting), JSON.stringify(filters), search]);\n\n const memoedProps = {\n align: columnMeta.align,\n canFreeze: tableMeta.columnFreezing.isEnabled,\n canHide: column.getCanHide(),\n canResize: column.getCanResize(),\n canSort,\n children: children ?? columnMeta.header,\n colSpan: header.colSpan,\n hasMenu: isMenuAvailable<TType>(table, header),\n hasSeparator,\n id: header.id,\n index: header.index,\n isFrozen: isFrozenColumn(header, table),\n isPlaceholder: header.isPlaceholder,\n isPrinting: tableMeta.isPrinting,\n isResizing: column.getIsResizing(),\n length: table.getRowModel().rows.length,\n meta: columnMeta,\n onGoto: handleGoto,\n onHide: handleHide,\n onResize: handleResize,\n onSort: handleSort as (event: unknown) => void,\n onSortToggle: handleSortToggle,\n scrollToIndex,\n sortDirection: column.getIsSorted(),\n table,\n };\n\n return <MemoedHeader<TType> {...memoedProps} />;\n}\n\n// Memoization\nexport type MemoedHeaderProps<TType = unknown> = Omit<HeaderProps<TType>, 'column' | 'header'> & {\n align?: Table3ColumnAlignment;\n canFreeze: boolean;\n canHide: boolean;\n canResize: boolean;\n canSort: boolean;\n colSpan: number;\n hasMenu: boolean;\n hasSeparator?: boolean;\n id: string;\n index: number;\n isFrozen: boolean;\n isPlaceholder: boolean;\n isPrinting: boolean;\n isResizing: boolean;\n length: number;\n meta: ColumnMeta<TType, unknown>;\n onGoto?: (query: string) => Promise<number>;\n onHide: (event: unknown) => void;\n onResize: (event: unknown) => void;\n onSort: (event: unknown) => void;\n onSortToggle: SortToggleHandler;\n scrollToIndex: TableStrategy['scrollToIndex'];\n sortDirection: HeaderSortDirection;\n};\n\nconst MemoedHeader = React.memo(function MemoedHeader<TType = unknown>(props: MemoedHeaderProps<TType>) {\n const {\n align,\n children,\n canFreeze,\n canHide,\n canResize,\n canSort,\n colSpan,\n hasMenu,\n hasSeparator,\n id,\n index,\n isFrozen,\n isPlaceholder,\n isPrinting,\n isResizing,\n length,\n meta,\n onGoto: handleGoto,\n onHide: handleHide,\n onResize: handleResize,\n onSort: handleSort,\n onSortToggle: handleSortToggle,\n scrollToIndex,\n sortDirection,\n table,\n } = props;\n\n const className = cn(\n 'font-bold border-b-2 box-content group/column relative',\n '[[role=\"table\"][data-resizing=\"true\"]_&]:pointer-events-none',\n 'px-[var(--table3-cell-padding-x)]',\n {\n '!border-white': isPlaceholder,\n 'h-10 items-center sticky': !isPrinting,\n 'pb-2': isPrinting,\n 'cursor-pointer select-none': canSort,\n 'hover:bg-grey-100': !isPlaceholder && (canSort || canResize || hasMenu),\n 'focus-within:bg-grey-100': hasMenu,\n '!pointer-events-all !bg-grey-100': !isPlaceholder && isResizing,\n // z-indexes\n 'z-10 hover:z-20': !isFrozen && !isResizing,\n 'z-20': !isFrozen && isResizing,\n // when column is frozen, we need to increase it's z-index when it's hovered,\n // so that resize handler appears on top of next frozen cell, and didn't get cut by it.\n '!z-30 hover:!z-40': isFrozen,\n '!z-40': isFrozen && isResizing,\n },\n colSpan > 1 ? `col-span-${colSpan}` : '',\n meta.headerClassName\n );\n\n const [internalRef, setInternalRef] = React.useState<HTMLDivElement | null>(null);\n\n React.useLayoutEffect(() => {\n if (internalRef && length) {\n // the actions column size gets set by the column itself\n if (isInternalColumn(id)) {\n return;\n }\n\n table.setColumnSizing(sizes => ({\n ...sizes,\n [id]: internalRef.getBoundingClientRect().width,\n }));\n }\n }, [internalRef, length]);\n\n if (table.options.debugAll) {\n console.log('header render', id);\n }\n return (\n <div\n {...(canSort ? getSortAttributes(handleSort, sortDirection) : undefined)}\n className={className}\n data-align={align}\n data-column-index={index}\n role=\"columnheader\"\n ref={setInternalRef}>\n {isPlaceholder ? null : (\n <>\n {isInternalColumn(id) ? (\n children\n ) : (\n <Tooltip title={String(meta?.tooltip ?? children)} placement=\"top\">\n <span className={cn({ truncate: !isPrinting })}>{children}</span>\n </Tooltip>\n )}\n {canSort ? <SortIndicator direction={sortDirection} /> : null}\n {hasMenu ? (\n <Menu\n canFreeze={canFreeze}\n canHide={canHide}\n canSort={canSort}\n className={cn({\n 'ml-auto': align !== 'right',\n 'ml-2': align === 'right',\n })}\n index={index}\n menu={meta.menu}\n onGoto={handleGoto}\n onHide={handleHide}\n onSortToggle={handleSortToggle}\n scrollToIndex={scrollToIndex}\n sortDirection={sortDirection}\n table={table}\n />\n ) : null}\n </>\n )}\n {/* Header separator need to go before Resizer to prevent it's overlapping */}\n {hasSeparator ? <HeaderSeparator /> : null}\n {!isPlaceholder && canResize ? <Resizer isResizing={isResizing} onResize={handleResize} /> : null}\n </div>\n );\n}) as <TType = unknown>(props: MemoedHeaderProps<TType>) => JSX.Element;\n\nexport function HeaderSeparator() {\n return (\n <div\n data-taco=\"header-separator\"\n className={cn(\n 'invisible absolute right-[0.5px] top-0 flex h-full w-2 touch-none select-none justify-center py-2 group-hover/header:visible'\n )}>\n <div className={cn('bg-grey-300 h-full w-[1px]')} />\n </div>\n );\n}\n"],"names":["SORT_DIRECTION","ASC","DESC","Header","props","children","column","header","hasSeparator","scrollToIndex","table","tableMeta","options","meta","columnMeta","React","useMemo","columnDef","canSort","getCanSort","hasGoto","isGotoAvailable","handleHide","getToggleVisibilityHandler","handleResize","getResizeHandler","handleSort","getToggleSortingHandler","handleSortToggle","useCallback","sortDirection","clearSorting","toggleSorting","sorting","getState","filters","columnFilters","search","globalFilter","handleGoto","query","rowGoto","id","undefined","JSON","stringify","memoedProps","align","canFreeze","columnFreezing","isEnabled","canHide","getCanHide","canResize","getCanResize","colSpan","hasMenu","isMenuAvailable","index","isFrozen","isFrozenColumn","isPlaceholder","isPrinting","isResizing","getIsResizing","length","getRowModel","rows","onGoto","onHide","onResize","onSort","onSortToggle","getIsSorted","MemoedHeader","memo","className","cn","headerClassName","internalRef","setInternalRef","useState","useLayoutEffect","isInternalColumn","setColumnSizing","sizes","getBoundingClientRect","width","debugAll","console","log","getSortAttributes","role","ref","Tooltip","title","String","_meta$tooltip","tooltip","placement","truncate","SortIndicator","direction","Menu","menu","HeaderSeparator","Resizer"],"mappings":";;;;;;;;MAUaA,cAAc,GAAwC;EAC/DC,GAAG,EAAE,KAAK;EACVC,IAAI,EAAE;;SAWMC,MAAMA,CAAkBC,KAAy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