pixel-react 1.13.93 → 1.13.94

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 (51) hide show
  1. package/lib/_virtual/index4.js +3 -5
  2. package/lib/_virtual/index4.js.map +1 -1
  3. package/lib/_virtual/index5.js +5 -3
  4. package/lib/_virtual/index5.js.map +1 -1
  5. package/lib/components/AttachmentButton/AttachmentButton.js +1 -1
  6. package/lib/components/EditLabel/EditLabel.js +1 -1
  7. package/lib/components/EditLabel/EditLabel.js.map +1 -1
  8. package/lib/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.js +29 -20
  9. package/lib/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.js.map +1 -1
  10. package/lib/components/Excel/ExcelFile/ExcelFileComponents/Cell.d.ts +1 -1
  11. package/lib/components/Excel/ExcelFile/ExcelFileComponents/Cell.js +8 -9
  12. package/lib/components/Excel/ExcelFile/ExcelFileComponents/Cell.js.map +1 -1
  13. package/lib/components/Excel/ExcelFile/ExcelFileComponents/DataViewer.js +3 -3
  14. package/lib/components/Excel/ExcelFile/ExcelFileComponents/DataViewer.js.map +1 -1
  15. package/lib/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.js +3 -1
  16. package/lib/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.js.map +1 -1
  17. package/lib/components/MachineInputField/MachineInputField.js +2 -1
  18. package/lib/components/MachineInputField/MachineInputField.js.map +1 -1
  19. package/lib/components/Table/Table.d.ts +1 -1
  20. package/lib/components/Table/Table.js +88 -58
  21. package/lib/components/Table/Table.js.map +1 -1
  22. package/lib/components/Table/Types.d.ts +2 -4
  23. package/lib/components/TableTreeFn/Components/TableBody.js +4 -16
  24. package/lib/components/TableTreeFn/Components/TableBody.js.map +1 -1
  25. package/lib/components/TableTreeFn/TableTreeFn.js +140 -128
  26. package/lib/components/TableTreeFn/TableTreeFn.js.map +1 -1
  27. package/lib/components/TableTreeFn/types.d.ts +1 -0
  28. package/lib/index.cjs +278 -237
  29. package/lib/index.cjs.map +1 -1
  30. package/lib/index.d.ts +4 -2
  31. package/lib/node_modules/input-format/modules/react/Input.js +1 -1
  32. package/lib/node_modules/js-beautify/js/src/css/beautifier.js +1 -1
  33. package/lib/node_modules/js-beautify/js/src/css/options.js +1 -1
  34. package/lib/node_modules/js-beautify/js/src/html/beautifier.js +1 -1
  35. package/lib/node_modules/js-beautify/js/src/html/options.js +1 -1
  36. package/lib/node_modules/js-beautify/js/src/javascript/beautifier.js +1 -1
  37. package/lib/node_modules/js-beautify/js/src/javascript/options.js +1 -1
  38. package/lib/node_modules/react-google-recaptcha/lib/esm/recaptcha.js +1 -1
  39. package/lib/node_modules/react-phone-number-input/modules/CountryIcon.js +1 -1
  40. package/lib/node_modules/react-phone-number-input/modules/CountrySelect.js +1 -1
  41. package/lib/node_modules/react-phone-number-input/modules/Flag.js +1 -1
  42. package/lib/node_modules/react-phone-number-input/modules/InputBasic.js +1 -1
  43. package/lib/node_modules/react-phone-number-input/modules/InputSmart.js +1 -1
  44. package/lib/node_modules/react-phone-number-input/modules/InternationalIcon.js +1 -1
  45. package/lib/node_modules/react-phone-number-input/modules/PhoneInputWithCountry.js +1 -1
  46. package/lib/node_modules/react-phone-number-input/modules/PhoneInputWithCountryDefault.js +1 -1
  47. package/lib/node_modules/react-phone-number-input/modules/PropTypes.js +1 -1
  48. package/lib/node_modules/use-context-selector/dist/index.js +1 -1
  49. package/lib/styles.css +1 -1
  50. package/lib/styles.css.map +1 -1
  51. package/package.json +1 -1
package/lib/index.cjs CHANGED
@@ -9826,10 +9826,25 @@ var DNDSortable = /*#__PURE__*/Object.freeze({
9826
9826
  verticalListSortingStrategy: verticalListSortingStrategy
9827
9827
  });
9828
9828
 
9829
- const getColumnWidth = (index, column, columns) => {
9830
- if (index === 0) return `${index * (column?.width || 0)}px`;
9831
- if (index === 1) return `${columns?.[0]?.width || 0}px`;
9832
- return 'auto';
9829
+ const getColumnLeftPosition = (index, columns, freezeColumns) => {
9830
+ if (index === 0) return '0px';
9831
+ // Calculate cumulative width of all previous columns including padding
9832
+ let leftPosition = 0;
9833
+ const CELL_PADDING = 8; // Each cell has 8px padding
9834
+ for (let i = 0; i < index; i++) {
9835
+ const width = columns[i]?.width;
9836
+ // Add column width plus left padding only
9837
+ leftPosition += width ? parseInt(width.toString(), 10) : DEFAULT_COLUMN_WIDTH;
9838
+ // Add padding between frozen columns
9839
+ if (freezeColumns && i < freezeColumns - 1) {
9840
+ leftPosition += CELL_PADDING;
9841
+ }
9842
+ }
9843
+ return `${leftPosition}px`;
9844
+ };
9845
+ const DEFAULT_COLUMN_WIDTH = 400;
9846
+ const calculateFrozenWidth = (columnData, freezeColumns) => {
9847
+ return columnData.slice(0, freezeColumns).reduce((acc, col) => acc + parseInt(col.width?.toString() || `${DEFAULT_COLUMN_WIDTH}`, 10), 1) + 8 * (freezeColumns - 0.17);
9833
9848
  };
9834
9849
  const SortableRow = ({
9835
9850
  row,
@@ -9844,9 +9859,9 @@ const SortableRow = ({
9844
9859
  editMode,
9845
9860
  isAccordionOpen,
9846
9861
  accordionContent,
9847
- columnSticky,
9848
9862
  isRowCheckBoxDisable,
9849
- isRowDisabled = true
9863
+ isRowDisabled = true,
9864
+ freezeColumns
9850
9865
  }) => {
9851
9866
  const {
9852
9867
  attributes,
@@ -9872,15 +9887,19 @@ const SortableRow = ({
9872
9887
  }),
9873
9888
  id: key,
9874
9889
  children: columns.map((column, index) => {
9875
- const isSticky = columnSticky && (index === 0 || index === 1);
9890
+ const isFrozen = freezeColumns && index < freezeColumns;
9876
9891
  return jsxRuntime.jsx("td", {
9877
9892
  style: {
9878
- paddingLeft: index === 0 && draggable ? '0px' : '8px',
9879
- position: isSticky ? 'sticky' : 'static',
9880
- left: getColumnWidth(index, column, columns),
9881
- zIndex: isSticky ? 999 : 'auto',
9882
- backgroundColor: isSticky ? 'var(--input-label-bg-color)' : 'transparent'
9893
+ position: isFrozen ? 'sticky' : 'static',
9894
+ left: isFrozen ? getColumnLeftPosition(index, columns, freezeColumns) : 'auto',
9895
+ zIndex: isFrozen ? 999 : 'auto',
9896
+ backgroundColor: isFrozen ? 'var(--input-label-bg-color)' : 'transparent',
9897
+ width: column.width ? `${column.width}px` : 'auto',
9898
+ padding: '7px 8px',
9899
+ boxSizing: 'border-box',
9900
+ paddingRight: isFrozen ? 0 : '8px'
9883
9901
  },
9902
+ "data-frozen": isFrozen || undefined,
9884
9903
  onClick: () => handleOnclick(column, row),
9885
9904
  className: classNames(column.className, {
9886
9905
  'clickable-cell': column.onClick
@@ -9954,15 +9973,19 @@ const Table$1 = ({
9954
9973
  editComponent,
9955
9974
  getAccordionStatus = () => {},
9956
9975
  accordionContent,
9957
- columnSticky = false,
9958
9976
  tableRef = null,
9959
9977
  isRowCheckBoxDisable,
9960
9978
  isRowDisabled = true,
9961
- tableHeaderZindex = 99
9979
+ tableHeaderZindex = 99,
9980
+ freezeColumns
9962
9981
  }) => {
9963
9982
  const observerRef = React.useRef(null);
9983
+ let frozenWidth;
9984
+ if (freezeColumns) {
9985
+ frozenWidth = calculateFrozenWidth(columns, freezeColumns);
9986
+ }
9964
9987
  React.useEffect(() => {
9965
- const scrollContainer = document.getElementById('ff-table-scroll-container');
9988
+ const scrollContainer = document.getElementById('ff-sortable-table-scroll-container');
9966
9989
  const firstNode = document.getElementById('ff-table-first-node');
9967
9990
  const lastNode = document.getElementById('ff-table-last-node');
9968
9991
  // Exit early if data is empty or elements are missing
@@ -10023,12 +10046,10 @@ const Table$1 = ({
10023
10046
  children: jsxRuntime.jsxs("div", {
10024
10047
  style: {
10025
10048
  height: height,
10026
- position: 'relative',
10027
- overflowX: 'auto',
10028
- whiteSpace: 'nowrap',
10029
- scrollbarWidth: draggable ? 'none' : 'auto'
10049
+ scrollbarWidth: draggable ? 'none' : 'auto',
10050
+ '--frozen-column-width': freezeColumns ? `${frozenWidth}px` : '0px'
10030
10051
  },
10031
- id: "ff-table-scroll-container",
10052
+ id: "ff-sortable-table-scroll-container",
10032
10053
  className: classNames(className, {
10033
10054
  'ff-fixed-header-table': withFixedHeader,
10034
10055
  'border-borderRadius': borderWithRadius
@@ -10045,44 +10066,52 @@ const Table$1 = ({
10045
10066
  zIndex: tableHeaderZindex
10046
10067
  },
10047
10068
  children: jsxRuntime.jsx("tr", {
10048
- children: columns.map((column, index) => jsxRuntime.jsxs("th", {
10049
- className: classNames(`${headerType !== 'default' ? `${headerType}-bg` : ''}`, `${headerTextColor && `${headerTextColor}-color`}`, {
10050
- 'sticky-column': columnSticky && (index === 0 || index === 1)
10051
- }),
10052
- style: {
10053
- width: column?.width,
10054
- left: getColumnWidth(index, column, columns)
10055
- },
10056
- children: [jsxRuntime.jsx("div", {
10057
- className: "ff-table-icon",
10058
- children: jsxRuntime.jsx(Icon, {
10059
- height: 14,
10060
- width: 14,
10061
- name: headerIconName,
10062
- onClick: headerIconOnClick
10063
- })
10064
- }), jsxRuntime.jsxs(Typography, {
10065
- style: column?.width && {
10066
- width: column?.width
10069
+ children: columns.map((column, index) => {
10070
+ const isFrozen = freezeColumns && index < freezeColumns;
10071
+ return jsxRuntime.jsxs("th", {
10072
+ className: classNames(`${headerType !== 'default' ? `${headerType}-bg` : ''}`, `${headerTextColor && `${headerTextColor}-color`}`),
10073
+ style: {
10074
+ position: isFrozen ? 'sticky' : 'static',
10075
+ left: isFrozen ? getColumnLeftPosition(index, columns, freezeColumns) : 'auto',
10076
+ zIndex: isFrozen ? 999 : 'auto',
10077
+ backgroundColor: isFrozen ? 'var(--input-label-bg-color)' : 'transparent',
10078
+ width: column.width ? `${column.width}px` : 'auto',
10079
+ padding: '7px 8px',
10080
+ boxSizing: 'border-box',
10081
+ // Remove right padding from frozen columns to prevent overlap
10082
+ paddingRight: isFrozen ? 0 : '8px'
10067
10083
  },
10068
- as: "div",
10069
- fontWeight: "semi-bold",
10070
- className: "ff-label-checkbox-container",
10071
- children: [index === 0 && withCheckbox && jsxRuntime.jsx("span", {
10072
- className: "ff-table-checkbox",
10073
- children: jsxRuntime.jsx(Checkbox, {
10074
- onChange: e => {
10075
- onSelectClick(e, {
10076
- allSelected: e.target.checked
10077
- });
10078
- },
10079
- checked: allSelected !== undefined ? allSelected : false,
10080
- partial: !!partialSelected,
10081
- disabled: headerCheckboxDisabled
10084
+ children: [jsxRuntime.jsx("div", {
10085
+ className: "ff-table-icon",
10086
+ children: jsxRuntime.jsx(Icon, {
10087
+ height: 14,
10088
+ width: 14,
10089
+ name: headerIconName,
10090
+ onClick: headerIconOnClick
10082
10091
  })
10083
- }), column.header]
10084
- })]
10085
- }, column.header))
10092
+ }), jsxRuntime.jsxs(Typography, {
10093
+ style: column?.width && {
10094
+ width: column?.width
10095
+ },
10096
+ as: "div",
10097
+ fontWeight: "semi-bold",
10098
+ className: "ff-label-checkbox-container",
10099
+ children: [index === 0 && withCheckbox && jsxRuntime.jsx("span", {
10100
+ className: "ff-table-checkbox",
10101
+ children: jsxRuntime.jsx(Checkbox, {
10102
+ onChange: e => {
10103
+ onSelectClick(e, {
10104
+ allSelected: e.target.checked
10105
+ });
10106
+ },
10107
+ checked: allSelected !== undefined ? allSelected : false,
10108
+ partial: !!partialSelected,
10109
+ disabled: headerCheckboxDisabled
10110
+ })
10111
+ }), column.header]
10112
+ })]
10113
+ }, column.header);
10114
+ })
10086
10115
  })
10087
10116
  }), jsxRuntime.jsxs("tbody", {
10088
10117
  className: "ff-fixed-header-table",
@@ -10115,11 +10144,12 @@ const Table$1 = ({
10115
10144
  withCheckbox: withCheckbox,
10116
10145
  onSelectClick: onSelectClick,
10117
10146
  draggable: draggable,
10118
- columnSticky: columnSticky,
10119
10147
  isAccordionOpen: isOpen,
10120
10148
  accordionContent: accordionContent,
10121
10149
  isRowCheckBoxDisable: isRowCheckBoxDisable,
10122
- isRowDisabled: isRowDisabled
10150
+ isRowDisabled: isRowDisabled,
10151
+ freezeColumns: freezeColumns,
10152
+ frozenWidth: frozenWidth
10123
10153
  })
10124
10154
  });
10125
10155
  }), jsxRuntime.jsx("tr", {
@@ -16977,7 +17007,7 @@ const EditLabel = ({
16977
17007
  })]
16978
17008
  })]
16979
17009
  }) : jsxRuntime.jsx(Tooltip, {
16980
- title: getTooltipTitle(),
17010
+ title: isTextTruncated(text, truncatedTextCount, truncatedType) ? getTooltipTitle() : '',
16981
17011
  placement: tooltip?.tooltipPlacement ?? 'bottom',
16982
17012
  children: jsxRuntime.jsx("span", {
16983
17013
  className: 'ff-add-module-display-text',
@@ -35097,7 +35127,8 @@ const MachineInputField = ({
35097
35127
  edge: 'edge',
35098
35128
  firefox: 'fire_fox',
35099
35129
  chrome: 'chrome_icon',
35100
- explorer: 'internet_explorer'
35130
+ explorer: 'internet_explorer',
35131
+ ios: 'mac_icon'
35101
35132
  };
35102
35133
  const isManualScript = scriptType.toLowerCase() === 'manual';
35103
35134
  return jsxRuntime.jsxs("div", {
@@ -35769,7 +35800,7 @@ const AttachmentButton = ({
35769
35800
  if (fileInputRef.current?.files) {
35770
35801
  const files = Array.from(fileInputRef.current.files);
35771
35802
  if (files.length > 5) {
35772
- setFileError('Maximun file(s) can be uploaded: 5');
35803
+ setFileError('Maximum file(s) can be uploaded: 5');
35773
35804
  fileInputRef.current.value = '';
35774
35805
  return;
35775
35806
  }
@@ -41037,7 +41068,6 @@ const Cell = ({
41037
41068
  row,
41038
41069
  column,
41039
41070
  DataViewer,
41040
- selected,
41041
41071
  active,
41042
41072
  dragging,
41043
41073
  mode,
@@ -41071,13 +41101,15 @@ const Cell = ({
41071
41101
  }, [setCellDimensions, select, dragging, point]);
41072
41102
  React__namespace.useEffect(() => {
41073
41103
  const root = rootRef.current;
41074
- if (selected && root) {
41104
+ if (!root) return;
41105
+ const updateDimensions = () => {
41075
41106
  setCellDimensions(point, getOffsetRect(root));
41076
- }
41077
- if (root && active && mode === 'view') {
41078
- root.focus();
41079
- }
41080
- }, [setCellDimensions, selected, active, mode, point, data]);
41107
+ };
41108
+ updateDimensions();
41109
+ const observer = new ResizeObserver(updateDimensions);
41110
+ observer.observe(root);
41111
+ return () => observer.disconnect();
41112
+ }, [setCellDimensions, point]);
41081
41113
  if (data && data.DataViewer) {
41082
41114
  DataViewer = data.DataViewer;
41083
41115
  }
@@ -41120,12 +41152,10 @@ const enhance = CellComponent => {
41120
41152
  const mode = useSelector(state => active ? state.mode : 'view');
41121
41153
  const data = useSelector(state => get$1(point, state.model.data));
41122
41154
  const evaluatedData = useSelector(state => get$1(point, state.model.evaluatedData));
41123
- const selected = useSelector(state => state.selected.has(state.model.data, point));
41124
41155
  const dragging = useSelector(state => state.dragging);
41125
41156
  const copied = useSelector(state => state.copied?.has(point) || false);
41126
41157
  return jsxRuntime.jsx(CellComponent, {
41127
41158
  ...props,
41128
- selected: selected,
41129
41159
  active: active,
41130
41160
  copied: copied,
41131
41161
  dragging: dragging,
@@ -41154,10 +41184,10 @@ const DataViewer = ({
41154
41184
  return jsxRuntime.jsx(jsxRuntime.Fragment, {});
41155
41185
  }
41156
41186
  const fileList = JSON.parse(value);
41157
- return fileList.map((file, index) => {
41158
- return jsxRuntime.jsxs("div", {
41187
+ return fileList.map(file => {
41188
+ return jsxRuntime.jsx("div", {
41159
41189
  className: "ff-spreadsheet-data-viewer--fileType",
41160
- children: [index + 1, ". ", file.name]
41190
+ children: file.name.split('*')[0]
41161
41191
  }, file.name);
41162
41192
  });
41163
41193
  };
@@ -41315,9 +41345,6 @@ const ActiveCell = props => {
41315
41345
  const fileLength = selectedFiles?.length + uniqueFiles?.length;
41316
41346
  const extractHeight = fileLength > 0 ? fileLength * 25 : 1;
41317
41347
  const processedFiles = [...existingFiles];
41318
- if (duplicateCount > 0) {
41319
- toast.info('Duplicate attachments not allowed within the same row');
41320
- }
41321
41348
  const uploadPromises = uniqueFiles?.map(async file => {
41322
41349
  try {
41323
41350
  if (file.name.includes('*')) {
@@ -41439,7 +41466,7 @@ const ActiveCell = props => {
41439
41466
  inputType: cell?.inputType
41440
41467
  });
41441
41468
  dispatch(setRowHeight(active?.row || 0, extractHeight));
41442
- setSelectedFiles(processedFiles.map(file => new File([new Blob()], file.name)));
41469
+ setSelectedFiles(processedFiles.map(file => new File([new Blob()], file.name?.split('*')[0] ?? 'default')));
41443
41470
  }
41444
41471
  if (memoryFullCount > 0) {
41445
41472
  toast.info('No memory available to add the file');
@@ -41454,8 +41481,6 @@ const ActiveCell = props => {
41454
41481
  console.error('Upload operation failed:', error);
41455
41482
  toast.error('Operation failed');
41456
41483
  }
41457
- } else if (duplicateCount > 0) {
41458
- toast.info('Duplicate attachments not allowed within the same row');
41459
41484
  }
41460
41485
  } else if (actionType === 'DELETE' && cell?.inputType?.type === 'file') {
41461
41486
  try {
@@ -41497,7 +41522,7 @@ const ActiveCell = props => {
41497
41522
  style: cell?.style,
41498
41523
  inputType: cell?.inputType
41499
41524
  });
41500
- setSelectedFiles(updatedFileDetails?.map(file => new File([new Blob()], file.name)));
41525
+ setSelectedFiles(updatedFileDetails?.map(file => new File([new Blob()], file.name.split('*')[0])));
41501
41526
  toast.success(`${deletedCount} file${deletedCount > 1 ? 's' : ''} deleted successfully`);
41502
41527
  } else if (selected?.length) {
41503
41528
  const validFiles = updatedFileDetails?.filter(file => file.id && file.name);
@@ -41509,7 +41534,7 @@ const ActiveCell = props => {
41509
41534
  style: cell?.style,
41510
41535
  inputType: cell?.inputType
41511
41536
  });
41512
- setSelectedFiles(validFiles.map(file => new File([new Blob()], file.name)));
41537
+ setSelectedFiles(validFiles.map(file => new File([new Blob()], file.name.split('*')[0])));
41513
41538
  toast.error('Failed to delete file(s). Invalid file data detected.');
41514
41539
  } else {
41515
41540
  toast.error('Failed to delete file(s). No valid files removed.');
@@ -41526,13 +41551,24 @@ const ActiveCell = props => {
41526
41551
  }
41527
41552
  };
41528
41553
  const handleClick = e => {
41529
- const selectedList = e.target.innerText;
41530
- if (selectedList) {
41531
- JSON.parse(cell?.value).map(file => {
41532
- if (file.name === selectedList && props.attachmentAction?.viewAttachment) {
41533
- props.attachmentAction?.viewAttachment(file.id, file.name);
41534
- }
41535
- });
41554
+ const fileElement = e.target.closest('.ff-attachment-files');
41555
+ const isIconClick = e.target.closest('.ff-icon-container, .ff-icon-click, .ff-icon-danger');
41556
+ if (!fileElement || isIconClick || !cell?.value || !props.attachmentAction?.viewAttachment) {
41557
+ console.warn('Missing file element, icon click, cell value, or viewAttachment action');
41558
+ return;
41559
+ }
41560
+ try {
41561
+ const files = JSON.parse(cell.value);
41562
+ const fileElements = fileElement.parentElement?.querySelectorAll('.ff-attachment-files') || [];
41563
+ const fileIndex = Array.from(fileElements).indexOf(fileElement);
41564
+ if (fileIndex === -1 || !files[fileIndex]) {
41565
+ console.error('File index not found or invalid');
41566
+ return;
41567
+ }
41568
+ const file = files[fileIndex];
41569
+ props.attachmentAction.viewAttachment(file.id, file.name?.split('*')[0] ?? 'default');
41570
+ } catch (error) {
41571
+ console.error('Error parsing cell value:', error);
41536
41572
  }
41537
41573
  };
41538
41574
  React__namespace.useEffect(() => {
@@ -41540,11 +41576,13 @@ const ActiveCell = props => {
41540
41576
  if (!hidden && root) {
41541
41577
  root.focus();
41542
41578
  if (cell?.inputType?.type === 'file' && cell?.value) {
41543
- const parsedFiles = JSON.parse(cell.value).map(file => {
41544
- const blob = new Blob([]);
41545
- return new File([blob], file.name);
41546
- });
41547
- setSelectedFiles(parsedFiles);
41579
+ try {
41580
+ const parsedFiles = JSON.parse(cell.value).map(file => new File([new Blob()], file.name.split('*')[0] ?? 'default'));
41581
+ setSelectedFiles(parsedFiles);
41582
+ } catch (error) {
41583
+ console.error('Error parsing cell value for files:', error);
41584
+ setSelectedFiles([]);
41585
+ }
41548
41586
  } else {
41549
41587
  setSelectedFiles([]);
41550
41588
  }
@@ -41651,6 +41689,7 @@ const ActiveCell = props => {
41651
41689
  buttonLabel: "+ Attachments",
41652
41690
  buttonVariant: "tertiary",
41653
41691
  deleteButton: true,
41692
+ selectedFileMessage: 'Duplicate attachments not allowed within the same row',
41654
41693
  addAttachmentButton: true,
41655
41694
  isInfoIconRequired: false,
41656
41695
  truncateMaxLimit: dimensions.width - 60
@@ -42260,7 +42299,9 @@ const Spreadsheet = props => {
42260
42299
  clientHeight
42261
42300
  } = target;
42262
42301
  setMaxHeight(Math.min(rootRef.current.clientHeight, clientHeight));
42263
- showHider && setMaxWidth(Math.min(rootRef.current.clientWidth, clientWidth));
42302
+ if (showHider) {
42303
+ setMaxWidth(Math.min(rootRef.current.clientWidth, clientWidth));
42304
+ }
42264
42305
  }
42265
42306
  }
42266
42307
  });
@@ -47047,15 +47088,9 @@ const TableBody = ({
47047
47088
  // if (checkEmpty(flattenedTreeData)) {
47048
47089
  // return null;
47049
47090
  // }
47050
- return jsxRuntime.jsxs("tbody", {
47091
+ return jsxRuntime.jsx("tbody", {
47051
47092
  className: "ff-table-tree-body",
47052
- children: [jsxRuntime.jsx("div", {
47053
- style: {
47054
- position: 'sticky',
47055
- left: 0
47056
- },
47057
- id: "ff-table-tree-first-node"
47058
- }), addNewRow(flattenedTreeData, newNode ?? {}, rootNode)?.map((node, index) => !node?.hide ? jsxRuntime.jsx(TableRow, {
47093
+ children: addNewRow(flattenedTreeData, newNode ?? {}, rootNode)?.map((node, index) => !node?.hide ? jsxRuntime.jsx(TableRow, {
47059
47094
  node: node,
47060
47095
  columnsData: columnsData,
47061
47096
  selected: selected,
@@ -47074,13 +47109,7 @@ const TableBody = ({
47074
47109
  addModuleInputWidth: addModuleInputWidth,
47075
47110
  addModuleSelectWidth: addModuleSelectWidth,
47076
47111
  disableEditLabelConfirmIcon: disableEditLabelConfirmIcon
47077
- }, node.key) : null), jsxRuntime.jsx("div", {
47078
- style: {
47079
- position: 'sticky',
47080
- left: 0
47081
- },
47082
- id: "ff-table-tree-last-node"
47083
- })]
47112
+ }, node.key) : null)
47084
47113
  });
47085
47114
  };
47086
47115
 
@@ -47101,7 +47130,6 @@ const TableTreeFn = /*#__PURE__*/React.forwardRef(({
47101
47130
  handleEditFieldError,
47102
47131
  loading = false,
47103
47132
  rootNode,
47104
- getContentLength,
47105
47133
  pagination = true,
47106
47134
  selectedNode,
47107
47135
  tableHeaderBgColor = 'var(--border-color)',
@@ -47113,130 +47141,167 @@ const TableTreeFn = /*#__PURE__*/React.forwardRef(({
47113
47141
  onScroll,
47114
47142
  disableEditLabelConfirmIcon = false,
47115
47143
  transparentHeader = false,
47116
- navigateTreeNode = null
47144
+ navigateTreeNode = null,
47145
+ handleRemoveNavigateTreeNode = () => {}
47117
47146
  }, ref) => {
47118
47147
  const [expanding, setExpanding] = React.useState(null);
47119
- const [isLoading, setIsLoading] = React.useState(null);
47120
- const observerRef = React.useRef(null);
47121
- const containerRef = React.useRef(null); // Reference for scroll container
47148
+ const [scrollDirection, setScrollDirection] = React.useState(null); // this state will help to idenetify the direction during the pagination api call
47122
47149
  const [prevScrollTop, setPrevScrollTop] = React.useState(null);
47150
+ const [prevScrollHeight, setPrevScrollHeight] = React.useState(null);
47151
+ const [maintainScrollPosition, setMaintainScrollPosition] = React.useState(null);
47152
+ const containerRef = React.useRef(null);
47123
47153
  const previousTreeDataRef = React.useRef([]);
47124
- //new loadMoreAbove function
47125
- const loadMoreAbove = () => {
47126
- if (loading || isLoading === 'above') return;
47127
- console.log('calling above');
47128
- setIsLoading('above');
47154
+ const scrollPositionRef = React.useRef({
47155
+ lastScrollTop: 0,
47156
+ lastScrollTime: 0,
47157
+ direction: null
47158
+ });
47159
+ const scrollDebounceRef = React.useRef(null);
47160
+ // this is the Distance from edge to trigger the scroll below and above
47161
+ const scrollThreshold = 128;
47162
+ // this is loadMore functions which will the trigger the pagination apis in platform
47163
+ const loadMoreAbove = React.useCallback(() => {
47164
+ if (loading || scrollDirection === 'above') return;
47165
+ setScrollDirection('above');
47129
47166
  setPrevScrollTop(containerRef.current?.scrollTop ?? null);
47167
+ setPrevScrollHeight(containerRef.current?.scrollHeight ?? null);
47130
47168
  loadMore('above');
47131
- };
47132
- const loadMoreBelow = () => {
47133
- if (loading || isLoading === 'below') return;
47134
- console.log('calling below');
47135
- setIsLoading('below');
47136
- // Trigger the loadMore callback for data loading from below
47169
+ }, [loading, scrollDirection, loadMore]);
47170
+ const loadMoreBelow = React.useCallback(() => {
47171
+ if (loading || scrollDirection === 'below') return;
47172
+ setScrollDirection('below');
47137
47173
  loadMore('below');
47138
- };
47139
- //new handle Scroll function
47174
+ }, [loading, scrollDirection, loadMore]);
47175
+ // this is scroll handler
47140
47176
  const handleScroll = React.useCallback(() => {
47141
47177
  const container = containerRef.current;
47142
- const previousTreeData = previousTreeDataRef.current;
47143
- if (!loading && container && isLoading === 'above' && previousTreeData.length > 0 && prevScrollTop !== null) {
47144
- let addedRowsCount = 0;
47145
- if (getContentLength) {
47146
- addedRowsCount = getContentLength;
47147
- } else {
47148
- for (let i = 0; i < treeData.length; i++) {
47149
- if (previousTreeData[0] === treeData[i]) break;
47150
- addedRowsCount++;
47151
- }
47178
+ if (!container) return;
47179
+ const now = Date.now();
47180
+ const currentScrollTop = container.scrollTop;
47181
+ const scrollHeight = container.scrollHeight;
47182
+ const clientHeight = container.clientHeight;
47183
+ // Determine scroll direction
47184
+ const direction = currentScrollTop > scrollPositionRef.current.lastScrollTop ? 'down' : 'up';
47185
+ scrollPositionRef.current = {
47186
+ lastScrollTop: currentScrollTop,
47187
+ lastScrollTime: now,
47188
+ direction
47189
+ };
47190
+ // Clear any pending debounce
47191
+ if (scrollDebounceRef.current) {
47192
+ clearTimeout(scrollDebounceRef.current);
47193
+ }
47194
+ // Check if we're near the bottom (for loading more below)
47195
+ const nearBottom = scrollHeight - (currentScrollTop + clientHeight) < scrollThreshold;
47196
+ if (direction === 'down' && nearBottom && !loading && !scrollDirection && treeData[treeData.length - 1]?.lastResource !== true) {
47197
+ console.log('Loading more below');
47198
+ scrollDebounceRef.current = setTimeout(() => {
47199
+ loadMoreBelow();
47200
+ }, 150);
47201
+ }
47202
+ // Check if we're near the top (for loading more above)
47203
+ const nearTop = currentScrollTop < scrollThreshold;
47204
+ if (direction === 'up' && nearTop && !loading && !scrollDirection && treeData[0]?.lastResource !== true) {
47205
+ console.log('Loading more above');
47206
+ scrollDebounceRef.current = setTimeout(() => {
47207
+ loadMoreAbove();
47208
+ }, 150);
47209
+ }
47210
+ console.log('hanldeScroll called');
47211
+ // if (onScroll) {
47212
+ // onScroll();
47213
+ // }
47214
+ }, [loading, scrollDirection, treeData, loadMoreAbove, loadMoreBelow, onScroll]);
47215
+ // Attach scroll event listener for updated first node when we scroll
47216
+ React.useEffect(() => {
47217
+ const scrollDiv = containerRef.current;
47218
+ if (scrollDiv && onScroll) {
47219
+ scrollDiv.addEventListener('scroll', onScroll);
47220
+ }
47221
+ return () => {
47222
+ if (scrollDiv && onScroll) {
47223
+ scrollDiv.removeEventListener('scroll', onScroll);
47152
47224
  }
47153
- let retries = 0;
47154
- const maxRetries = 30;
47155
- const tryRestoreScroll = () => {
47156
- const allRows = Array.from(container.querySelectorAll('.ff-table-tree-row'));
47157
- // Total added height of new rows
47158
- let totalAddedHeight = 0;
47159
- for (let i = 0; i < addedRowsCount; i++) {
47160
- const height = allRows[i]?.getBoundingClientRect().height || 0;
47161
- totalAddedHeight += height;
47162
- }
47163
- const canScroll = container.scrollHeight > container.clientHeight;
47164
- const validHeights = totalAddedHeight > 0;
47165
- if (validHeights && canScroll) {
47166
- container.scrollTop = prevScrollTop + totalAddedHeight;
47167
- previousTreeDataRef.current = treeData;
47168
- } else if (retries < maxRetries) {
47169
- retries++;
47170
- requestAnimationFrame(tryRestoreScroll);
47171
- } else {
47172
- previousTreeDataRef.current = treeData;
47173
- console.warn('Failed to restore scroll position after max retries');
47174
- }
47175
- };
47176
- console.log(`Attempting to restore scroll position after loading more data. Added rows count: ${addedRowsCount}, retries: ${retries}`);
47177
- // Start scroll adjustment
47178
- requestAnimationFrame(tryRestoreScroll);
47225
+ };
47226
+ }, [onScroll]);
47227
+ React.useEffect(() => {
47228
+ return () => {
47229
+ if (scrollDebounceRef.current) {
47230
+ clearTimeout(scrollDebounceRef.current);
47231
+ }
47232
+ };
47233
+ }, []);
47234
+ // Handle scroll position restoration after loading
47235
+ React.useLayoutEffect(() => {
47236
+ if (!loading && scrollDirection === 'above' && prevScrollTop !== null && prevScrollHeight !== null) {
47237
+ const container = containerRef.current;
47238
+ if (!container) return;
47239
+ const scrollHeightDiff = container.scrollHeight - prevScrollHeight;
47240
+ if (scrollHeightDiff > 0) {
47241
+ container.scrollTop = prevScrollTop + scrollHeightDiff;
47242
+ }
47243
+ setScrollDirection(null);
47244
+ setPrevScrollTop(null);
47245
+ setPrevScrollHeight(null);
47246
+ } else if (!loading) {
47247
+ setScrollDirection(null);
47179
47248
  }
47180
- }, [loading, isLoading, treeData, getContentLength, prevScrollTop]);
47249
+ }, [loading, scrollDirection, prevScrollTop, prevScrollHeight]);
47250
+ // Handle navigation to specific nodes
47181
47251
  React.useEffect(() => {
47182
- const scrollContainer = document.getElementById('ff-table-tree-scroll-container');
47183
- const lastNode = document.getElementById('ff-table-tree-last-node');
47184
- const firstNode = document.getElementById('ff-table-tree-first-node');
47185
- if (!scrollContainer || !lastNode || !firstNode || !treeData?.length || !pagination) return;
47186
- const isLastResourceBelow = !!treeData[treeData.length - 1]?.lastResource;
47187
- const isLastResourceAbove = !!treeData[0]?.lastResource;
47188
- // Clean up old observer before creating a new one
47189
- observerRef.current?.disconnect();
47190
- const observerCallback = entries => {
47191
- entries.forEach(entry => {
47192
- const nodeId = entry.target.id;
47193
- const direction = nodeId === 'ff-table-tree-last-node' ? 'below' : 'above';
47194
- console.log('entries', entry);
47195
- if (entry.isIntersecting) {
47196
- if (direction === 'below' && !isLastResourceBelow) {
47197
- console.log('LoadMoreBelow from observer');
47198
- loadMoreBelow();
47199
- } else if (direction === 'above' && !isLastResourceAbove) {
47200
- console.log('LoadMoreAbove from observer');
47201
- loadMoreAbove();
47202
- }
47203
- }
47204
- });
47252
+ if (navigateTreeNode) {
47253
+ const node = document.getElementById(navigateTreeNode);
47254
+ const container = containerRef.current;
47255
+ if (node && container) {
47256
+ // Store current scroll position
47257
+ setMaintainScrollPosition(container.scrollTop);
47258
+ // Calculate scroll position
47259
+ const nodeRect = node.getBoundingClientRect();
47260
+ const containerRect = container.getBoundingClientRect();
47261
+ const scrollTop = container.scrollTop;
47262
+ const nodeTop = nodeRect.top - containerRect.top + scrollTop;
47263
+ const containerHeight = containerRect.height;
47264
+ // Scroll to center the node
47265
+ container.scrollTo({
47266
+ top: nodeTop - containerHeight / 2 + nodeRect.height / 2,
47267
+ behavior: 'smooth'
47268
+ });
47269
+ }
47270
+ }
47271
+ return () => {
47272
+ handleRemoveNavigateTreeNode();
47205
47273
  };
47206
- observerRef.current = new IntersectionObserver(observerCallback, {
47207
- root: scrollContainer,
47208
- rootMargin: '30px',
47209
- threshold: 1
47210
- });
47211
- if (!isLastResourceBelow) observerRef.current.observe(lastNode);
47212
- if (!isLastResourceAbove) observerRef.current.observe(firstNode);
47213
- if (previousTreeDataRef.current.length === 0) {
47214
- previousTreeDataRef.current = treeData;
47274
+ }, [navigateTreeNode, treeData]);
47275
+ // Restore scroll position after navigation
47276
+ React.useEffect(() => {
47277
+ if (maintainScrollPosition !== null && !loading && containerRef.current) {
47278
+ containerRef.current.scrollTop = maintainScrollPosition;
47279
+ setMaintainScrollPosition(null);
47215
47280
  }
47281
+ }, [maintainScrollPosition, loading]);
47282
+ // Setup scroll listener
47283
+ React.useEffect(() => {
47284
+ const container = containerRef.current;
47285
+ if (!container || !pagination) return;
47286
+ container.addEventListener('scroll', handleScroll);
47287
+ // Initial check in case we're already at the bottom/top
47288
+ handleScroll();
47216
47289
  return () => {
47217
- observerRef.current?.disconnect();
47290
+ container.removeEventListener('scroll', handleScroll);
47291
+ if (scrollDebounceRef.current) {
47292
+ clearTimeout(scrollDebounceRef.current);
47293
+ }
47218
47294
  };
47219
- }, [treeData, loadMore, isLoading]);
47220
- // new useLayoutEffect to handle loading state
47221
- React.useLayoutEffect(() => {
47222
- if (!loading && isLoading === 'above' && pagination) {
47223
- const raf = requestAnimationFrame(() => {
47224
- handleScroll();
47225
- setIsLoading(null);
47226
- });
47227
- return () => {
47228
- cancelAnimationFrame(raf);
47229
- };
47230
- } else if (!loading) {
47295
+ }, [handleScroll, pagination]);
47296
+ // Track previous tree data for scroll restoration
47297
+ React.useEffect(() => {
47298
+ if (treeData.length > 0) {
47231
47299
  previousTreeDataRef.current = treeData;
47232
- setIsLoading(null);
47233
47300
  }
47234
- return undefined;
47235
- }, [loading, onScroll]);
47301
+ }, [treeData]);
47236
47302
  React.useEffect(() => {
47237
47303
  if (!loading && expanding) {
47238
47304
  setExpanding(null);
47239
- previousTreeDataRef.current = treeData;
47240
47305
  }
47241
47306
  }, [loading]);
47242
47307
  const handleToggleExpand = React.useCallback(node => {
@@ -47244,17 +47309,6 @@ const TableTreeFn = /*#__PURE__*/React.forwardRef(({
47244
47309
  setExpanding(node.key);
47245
47310
  onExpand?.(node);
47246
47311
  }, [onExpand, expanding]);
47247
- React.useEffect(() => {
47248
- const scrollDiv = containerRef.current;
47249
- if (scrollDiv && onScroll) {
47250
- scrollDiv.addEventListener('scroll', onScroll);
47251
- }
47252
- return () => {
47253
- if (scrollDiv && onScroll) {
47254
- scrollDiv.removeEventListener('scroll', onScroll);
47255
- }
47256
- };
47257
- }, [onScroll]);
47258
47312
  const handleCheckBoxChange = React.useCallback((e, node) => {
47259
47313
  if (expanding) return;
47260
47314
  onChange?.(e, node);
@@ -47263,18 +47317,6 @@ const TableTreeFn = /*#__PURE__*/React.forwardRef(({
47263
47317
  if (expanding) return;
47264
47318
  onClick?.(e, node);
47265
47319
  }, [onClick, expanding]);
47266
- React.useEffect(() => {
47267
- console.log(`Navigating to tree nodeFromUseEffect: ${navigateTreeNode}`);
47268
- if (navigateTreeNode) {
47269
- const node = document.getElementById(navigateTreeNode);
47270
- if (node) {
47271
- node.scrollIntoView({
47272
- behavior: 'smooth',
47273
- block: 'nearest'
47274
- });
47275
- }
47276
- }
47277
- }, [navigateTreeNode]);
47278
47320
  const DEFAULT_COLUMN_WIDTH = 400;
47279
47321
  const calculateFrozenWidth = (columnData, freezeColumns) => {
47280
47322
  return columnData.slice(0, freezeColumns).reduce((acc, col) => acc + parseInt(col.width || `${DEFAULT_COLUMN_WIDTH}`, 10), 0);
@@ -47289,7 +47331,6 @@ const TableTreeFn = /*#__PURE__*/React.forwardRef(({
47289
47331
  children: jsxRuntime.jsx("div", {
47290
47332
  className: `table-scrollable ${treeData.length ? '' : 'table-empty'}`,
47291
47333
  ref: containerRef,
47292
- id: "ff-table-tree-scroll-container",
47293
47334
  style: {
47294
47335
  '--table-height': treeData.length ? height : 'auto',
47295
47336
  '--frozen-column-width': freezeColumns ? `${frozenWidth}px` : '0px',