pixel-react 1.15.34 → 1.15.36

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 (41) hide show
  1. package/lib/_virtual/index10.js +2 -2
  2. package/lib/_virtual/index11.js +2 -2
  3. package/lib/components/Charts/LineChart/LineChart.js +1 -2
  4. package/lib/components/Charts/LineChart/LineChart.js.map +1 -1
  5. package/lib/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.js +64 -60
  6. package/lib/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.js.map +1 -1
  7. package/lib/components/Excel/ExcelFile/ExcelFileComponents/EditableCell.js +26 -12
  8. package/lib/components/Excel/ExcelFile/ExcelFileComponents/EditableCell.js.map +1 -1
  9. package/lib/components/FileDropzone/FileDropzone.js +4 -2
  10. package/lib/components/FileDropzone/FileDropzone.js.map +1 -1
  11. package/lib/components/FileDropzone/types.d.ts +2 -0
  12. package/lib/components/MediaViewerModal/MediaViewerModal.js +1 -1
  13. package/lib/components/MediaViewerModal/MediaViewerModal.js.map +1 -1
  14. package/lib/components/MultiSelect/MultiSelect.js +4 -1
  15. package/lib/components/MultiSelect/MultiSelect.js.map +1 -1
  16. package/lib/components/StepsLandingTable/Components/StepGroupAccordions.js +37 -10
  17. package/lib/components/StepsLandingTable/Components/StepGroupAccordions.js.map +1 -1
  18. package/lib/components/StepsLandingTable/Components/StepInnerTable.js +85 -68
  19. package/lib/components/StepsLandingTable/Components/StepInnerTable.js.map +1 -1
  20. package/lib/components/StepsLandingTable/Components/StepTableMainRow.d.ts +3 -2
  21. package/lib/components/StepsLandingTable/Components/StepTableMainRow.js +10 -10
  22. package/lib/components/StepsLandingTable/Components/StepTableMainRow.js.map +1 -1
  23. package/lib/components/StepsLandingTable/Components/handleStepCheckBox.js +14 -4
  24. package/lib/components/StepsLandingTable/Components/handleStepCheckBox.js.map +1 -1
  25. package/lib/components/StepsLandingTable/StepLandingTable.d.ts +2 -2
  26. package/lib/components/StepsLandingTable/StepLandingTable.js +31 -29
  27. package/lib/components/StepsLandingTable/StepLandingTable.js.map +1 -1
  28. package/lib/hooks/useFileDropzone.js +16 -2
  29. package/lib/hooks/useFileDropzone.js.map +1 -1
  30. package/lib/index.cjs +280 -187
  31. package/lib/index.cjs.map +1 -1
  32. package/lib/index.d.ts +3 -1
  33. package/lib/node_modules/@dnd-kit/core/dist/core.esm.js +2 -2
  34. package/lib/node_modules/@dnd-kit/sortable/dist/sortable.esm.js +3 -3
  35. package/lib/node_modules/js-beautify/js/src/css/beautifier.js +1 -1
  36. package/lib/node_modules/js-beautify/js/src/css/index.js +1 -1
  37. package/lib/node_modules/js-beautify/js/src/html/index.js +1 -1
  38. package/lib/node_modules/js-beautify/js/src/javascript/beautifier.js +1 -1
  39. package/lib/styles.css +1 -1
  40. package/lib/styles.css.map +1 -1
  41. package/package.json +1 -1
package/lib/index.cjs CHANGED
@@ -4329,6 +4329,7 @@ const MultiSelect = ({
4329
4329
  };
4330
4330
  }, []);
4331
4331
  const hideSearchField = displayAllSelectedAsText && selectedOptions?.length === allOptions?.length;
4332
+ const isAllSelectedData = selectedOptions?.length === allOptions?.length;
4332
4333
  return jsxRuntime.jsxs("div", {
4333
4334
  className: `ff-multiselect-container-with-icon ${className}`,
4334
4335
  children: [jsxRuntime.jsxs("div", {
@@ -4355,7 +4356,9 @@ const MultiSelect = ({
4355
4356
  required: required,
4356
4357
  children: label
4357
4358
  }), jsxRuntime.jsxs("div", {
4358
- className: "ff-multiselect-chip-container",
4359
+ className: classNames('ff-multiselect-chip-container', {
4360
+ ['ff-multiselect-chip-container__all_label']: isAllSelectedData
4361
+ }),
4359
4362
  children: [!withSelectButton && (displayAllSelectedAsText && selectedOptions?.length === allOptions?.length && !checkEmpty(allOptions) && labelAccessor !== 'name' ? jsxRuntime.jsx(ChipElement, {
4360
4363
  zIndex: zIndex,
4361
4364
  label: "All",
@@ -13929,7 +13932,8 @@ const useFileDropzone = options => {
13929
13932
  selectedFile,
13930
13933
  setSelectedFile,
13931
13934
  handleReplaceFile = () => {},
13932
- showRejectedFileDetails
13935
+ showRejectedFileDetails,
13936
+ disabledDragAndDrop
13933
13937
  } = options;
13934
13938
  const file = !selectedFile ? [] : [selectedFile];
13935
13939
  const [files, setFiles] = React.useState({
@@ -14054,6 +14058,11 @@ const useFileDropzone = options => {
14054
14058
  removeFile(file);
14055
14059
  }, [removeFile]);
14056
14060
  const handleDrop = React.useCallback(event => {
14061
+ if (disabledDragAndDrop && 'dataTransfer' in event) {
14062
+ event.preventDefault();
14063
+ event.stopPropagation();
14064
+ return;
14065
+ }
14057
14066
  event.preventDefault();
14058
14067
  event.stopPropagation();
14059
14068
  setIsDragActive(false);
@@ -14093,10 +14102,18 @@ const useFileDropzone = options => {
14093
14102
  if (onDrop) onDrop(accepted, rejected, event);
14094
14103
  }, [maxFiles, validateFile, onMaxFilesError, onDrop, files.accepted]);
14095
14104
  const handleDragOver = React.useCallback(event => {
14105
+ if (disabledDragAndDrop) {
14106
+ event.preventDefault();
14107
+ return;
14108
+ }
14096
14109
  event.preventDefault();
14097
14110
  setIsDragActive(true);
14098
14111
  }, []);
14099
- const handleDragLeave = React.useCallback(() => {
14112
+ const handleDragLeave = React.useCallback(event => {
14113
+ if (disabledDragAndDrop) {
14114
+ event.preventDefault();
14115
+ return;
14116
+ }
14100
14117
  setIsDragActive(false);
14101
14118
  }, []);
14102
14119
  const getRootProps = React.useCallback(() => ({
@@ -14564,7 +14581,8 @@ const FileDropzone = ({
14564
14581
  handleReplaceFile,
14565
14582
  isRemoveDisabled,
14566
14583
  isReplaceDisabled,
14567
- showRejectedFileDetails = true
14584
+ showRejectedFileDetails = true,
14585
+ disabledDragAndDrop = false
14568
14586
  }) => {
14569
14587
  const {
14570
14588
  getRootProps,
@@ -14587,7 +14605,8 @@ const FileDropzone = ({
14587
14605
  selectedFile,
14588
14606
  setSelectedFile,
14589
14607
  handleReplaceFile,
14590
- showRejectedFileDetails
14608
+ showRejectedFileDetails,
14609
+ disabledDragAndDrop
14591
14610
  // onDrop: (accepted, rejected, event) => {}, //onDrop function to handle dropped or selected files explicitly.
14592
14611
  });
14593
14612
  React.useEffect(() => {
@@ -43738,7 +43757,18 @@ const EditableCell = /*#__PURE__*/React.forwardRef(({
43738
43757
  outline: 'none',
43739
43758
  transition: 'border 0.2s',
43740
43759
  whiteSpace: 'pre-wrap',
43741
- wordBreak: 'break-word'
43760
+ wordBreak: 'break-word',
43761
+ fontFamily: 'inherit',
43762
+ fontSize: 'inherit',
43763
+ lineHeight: 'normal',
43764
+ minHeight: '32px',
43765
+ verticalAlign: 'middle',
43766
+ caretColor: 'black',
43767
+ height: 'inherit',
43768
+ maxHeight: 'inherit',
43769
+ display: 'block',
43770
+ position: 'relative',
43771
+ paddingBottom: '2px'
43742
43772
  };
43743
43773
  const handleKeyDown = e => {
43744
43774
  if (e.key === 'Enter') {
@@ -43777,17 +43807,20 @@ const EditableCell = /*#__PURE__*/React.forwardRef(({
43777
43807
  handleInput();
43778
43808
  };
43779
43809
  return jsxRuntime.jsx("div", {
43780
- ref: cellRef,
43781
- className: `editable-cell ${className}`,
43782
- contentEditable: true,
43783
- suppressContentEditableWarning: true,
43784
- onKeyDown: handleKeyDown,
43785
- onInput: handleInput,
43786
- onPaste: handlePaste,
43787
- style: {
43788
- ...defaultStyle,
43789
- ...style
43790
- }
43810
+ style: style,
43811
+ children: jsxRuntime.jsx("div", {
43812
+ ref: cellRef,
43813
+ className: `editable-cell ${className}`,
43814
+ contentEditable: true,
43815
+ suppressContentEditableWarning: true,
43816
+ onKeyDown: handleKeyDown,
43817
+ onInput: handleInput,
43818
+ onPaste: handlePaste,
43819
+ spellCheck: false,
43820
+ autoCorrect: "off",
43821
+ autoCapitalize: "off",
43822
+ style: defaultStyle
43823
+ })
43791
43824
  });
43792
43825
  });
43793
43826
 
@@ -44251,6 +44284,7 @@ const ActiveCell = props => {
44251
44284
  justifyContent: cell?.style?.textAlign
44252
44285
  } : {}),
44253
44286
  ...(mode === 'edit' && active ? {
44287
+ padding: '2px 4px 0px 4px',
44254
44288
  minWidth: Math.min(dimensions?.width, props.maxWidth),
44255
44289
  minHeight: Math.min(dimensions?.height, props.maxHeight),
44256
44290
  height: 'auto',
@@ -44263,66 +44297,69 @@ const ActiveCell = props => {
44263
44297
  onContextMenu: contextClick,
44264
44298
  onClick: mode === 'view' && !readOnly ? edit : undefined,
44265
44299
  tabIndex: 0,
44266
- children: [cell?.inputType?.type === 'dropDown' ? jsxRuntime.jsx(Select$1, {
44267
- ...cell?.inputType?.inputProps,
44268
- dropDownRef: selectRef,
44269
- showOptions: {
44270
- open: mode === 'edit' && active ? true : false,
44271
- toggle: selectOption
44272
- },
44273
- selectedOption: dropDownValue,
44274
- optionsList: allOption || [],
44275
- height: 26,
44276
- showLabel: false,
44277
- showBorder: false,
44278
- optionZIndex: 5000,
44279
- onChange: value => {
44280
- setDropDownValue({
44281
- value: value.value,
44282
- name: value.label
44283
- });
44284
- handleChange({
44285
- ...cell,
44286
- value: value.value,
44287
- style: cell?.style,
44288
- inputType: cell?.inputType
44289
- });
44290
- }
44291
- }) : cell?.inputType?.type === 'file' ? jsxRuntime.jsx(AttachmentButton, {
44292
- ...cell?.inputType?.inputProps,
44293
- label: "",
44294
- onFileListClick: handleClick,
44295
- selectedFiles: selectedFiles,
44296
- onFilesChange: handleFilesChange,
44297
- disabled: false,
44298
- maxFiles: 5,
44299
- buttonLabel: "+ Attachments",
44300
- buttonVariant: "tertiary",
44301
- deleteButton: true,
44302
- selectedFileMessage: "Duplicate attachments not allowed within the same row",
44303
- addAttachmentButton: true,
44304
- isInfoIconRequired: false,
44305
- truncateMaxLimit: dimensions?.width ?? 0 - 60
44306
- }) : mode === 'edit' && active ? jsxRuntime.jsx(DataEditor, {
44307
- row: active.row,
44308
- column: active.column,
44309
- cell: cell,
44310
- onChange: handleChange,
44311
- exitEditMode: view
44312
- }) : jsxRuntime.jsx(EditableCell, {
44313
- initialValue: cell?.value,
44314
- onChange: () => {},
44315
- className: "ff-spreadsheet-cell-textarea",
44316
- style: {
44317
- ...cell?.style,
44318
- textDecoration: cell?.style?.textDecoration === 'underline' ? 'underline' : 'none',
44319
- backgroundColor: isDragged ? '#1e161f00' : cell?.style?.backgroundColor,
44320
- pointerEvents: 'none',
44321
- borderTop: '',
44322
- borderBottom: '',
44323
- borderLeft: '',
44324
- borderRight: ''
44325
- }
44300
+ children: [jsxRuntime.jsx("div", {
44301
+ className: "active-cell-main",
44302
+ children: cell?.inputType?.type === 'dropDown' ? jsxRuntime.jsx(Select$1, {
44303
+ ...cell?.inputType?.inputProps,
44304
+ dropDownRef: selectRef,
44305
+ showOptions: {
44306
+ open: mode === 'edit' && active ? true : false,
44307
+ toggle: selectOption
44308
+ },
44309
+ selectedOption: dropDownValue,
44310
+ optionsList: allOption || [],
44311
+ height: 26,
44312
+ showLabel: false,
44313
+ showBorder: false,
44314
+ optionZIndex: 5000,
44315
+ onChange: value => {
44316
+ setDropDownValue({
44317
+ value: value.value,
44318
+ name: value.label
44319
+ });
44320
+ handleChange({
44321
+ ...cell,
44322
+ value: value.value,
44323
+ style: cell?.style,
44324
+ inputType: cell?.inputType
44325
+ });
44326
+ }
44327
+ }) : cell?.inputType?.type === 'file' ? jsxRuntime.jsx(AttachmentButton, {
44328
+ ...cell?.inputType?.inputProps,
44329
+ label: "",
44330
+ onFileListClick: handleClick,
44331
+ selectedFiles: selectedFiles,
44332
+ onFilesChange: handleFilesChange,
44333
+ disabled: false,
44334
+ maxFiles: 5,
44335
+ buttonLabel: "+ Attachments",
44336
+ buttonVariant: "tertiary",
44337
+ deleteButton: true,
44338
+ selectedFileMessage: "Duplicate attachments not allowed within the same row",
44339
+ addAttachmentButton: true,
44340
+ isInfoIconRequired: false,
44341
+ truncateMaxLimit: (dimensions?.width ?? 0) - 60
44342
+ }) : mode === 'edit' && active ? jsxRuntime.jsx(DataEditor, {
44343
+ row: active.row,
44344
+ column: active.column,
44345
+ cell: cell,
44346
+ onChange: handleChange,
44347
+ exitEditMode: view
44348
+ }) : jsxRuntime.jsx(EditableCell, {
44349
+ initialValue: cell?.value,
44350
+ onChange: () => {},
44351
+ className: "ff-spreadsheet-cell-textarea",
44352
+ style: {
44353
+ ...cell?.style,
44354
+ textDecoration: cell?.style?.textDecoration === 'underline' ? 'underline' : 'none',
44355
+ backgroundColor: isDragged ? '#1e161f00' : cell?.style?.backgroundColor,
44356
+ pointerEvents: 'none',
44357
+ borderTop: '',
44358
+ borderBottom: '',
44359
+ borderLeft: '',
44360
+ borderRight: ''
44361
+ }
44362
+ })
44326
44363
  }), !['file'].includes(cell?.inputType?.type ?? '') && (mode === 'edit' || active && jsxRuntime.jsx("div", {
44327
44364
  onMouseDown: handleMouseDown,
44328
44365
  className: "select_dot"
@@ -50187,7 +50224,7 @@ const LineChart = ({
50187
50224
  children: point[xKey] != null ? String(point[xKey]) : ''
50188
50225
  }, String(point[xKey])));
50189
50226
  } else {
50190
- const tickSpacing = xMax / (numberOfXTicks - 1);
50227
+ const tickSpacing = (width - margin * 2 - numberOfXTicks * 9.2) / (numberOfXTicks - 1);
50191
50228
  return Array.from({
50192
50229
  length: numberOfXTicks
50193
50230
  }).map((_, i) => {
@@ -50196,7 +50233,6 @@ const LineChart = ({
50196
50233
  return jsxRuntime.jsx("text", {
50197
50234
  x: i * tickSpacing,
50198
50235
  y: yMax + 15,
50199
- textAnchor: i === 0 ? 'start' : i === numberOfXTicks - 1 ? 'end' : 'middle',
50200
50236
  fill: yAxisColor,
50201
50237
  className: "ff--line-chart-x-line-data",
50202
50238
  style: {
@@ -52989,7 +53025,7 @@ const MediaViewerModal = ({
52989
53025
  })]
52990
53026
  }),
52991
53027
  icons: jsxRuntime.jsx(Tooltip, {
52992
- title: "close",
53028
+ title: "Close",
52993
53029
  children: jsxRuntime.jsx(Icon, {
52994
53030
  name: "close",
52995
53031
  onClick: onClose
@@ -77974,18 +78010,46 @@ const StepGroupAccordions = /*#__PURE__*/React.memo(({
77974
78010
  const typeSet = new Set(['Group', 'PRE', 'POST', 'Script']);
77975
78011
  const getPadding = type => typeSet.has(type) ? '6px 8px' : '7px 8px';
77976
78012
  const indent = level + 8;
77977
- // Measure and report height when expanded
78013
+ const prepareData = (dataObj, columnObj, index, tableType) => {
78014
+ const cellData = dataObj[columnObj.accessor];
78015
+ if (columnObj.cell) {
78016
+ const refId = dataObj._id || dataObj.id;
78017
+ return columnObj.cell({
78018
+ value: cellData,
78019
+ row: dataObj,
78020
+ column: columnObj.accessor,
78021
+ index: index,
78022
+ tableType: tableType,
78023
+ ...(refId && {
78024
+ refId
78025
+ })
78026
+ });
78027
+ } else if (columnObj.accessor) {
78028
+ return cellData;
78029
+ } else if (cellData && typeof cellData !== 'object') {
78030
+ return cellData;
78031
+ } else {
78032
+ return '--';
78033
+ }
78034
+ };
78035
+ // Measure and report height with ResizeObserver
77978
78036
  React.useEffect(() => {
77979
78037
  if (!updateRowHeight) return;
77980
- let totalHeight = 0;
77981
- rowRefs.current.forEach(ref => {
77982
- if (ref) {
77983
- totalHeight += ref.getBoundingClientRect().height;
78038
+ const resizeObserver = new ResizeObserver(() => {
78039
+ let totalHeight = 0;
78040
+ rowRefs.current.forEach(ref => {
78041
+ if (ref) {
78042
+ totalHeight += ref.getBoundingClientRect().height;
78043
+ }
78044
+ });
78045
+ if (totalHeight > 0) {
78046
+ updateRowHeight(parentIndex ?? 0, totalHeight);
77984
78047
  }
77985
78048
  });
77986
- if (totalHeight > 0) {
77987
- updateRowHeight(parentIndex ?? 0, totalHeight);
77988
- }
78049
+ rowRefs.current.forEach(ref => {
78050
+ if (ref) resizeObserver.observe(ref);
78051
+ });
78052
+ return () => resizeObserver.disconnect();
77989
78053
  }, [data, updateRowHeight, parentIndex, isStepGroupExpanded]);
77990
78054
  return jsxRuntime.jsx(jsxRuntime.Fragment, {
77991
78055
  children: data?.map((item, itemIndex) => {
@@ -78071,7 +78135,7 @@ const StepGroupAccordions = /*#__PURE__*/React.memo(({
78071
78135
  });
78072
78136
  StepGroupAccordions.displayName = 'StepGroupAccordions';
78073
78137
 
78074
- const StepTableMainRow = ({
78138
+ const StepTableMainRow = /*#__PURE__*/React.memo(({
78075
78139
  row,
78076
78140
  columns,
78077
78141
  tableBodyRowClass,
@@ -78097,7 +78161,7 @@ const StepTableMainRow = ({
78097
78161
  }) => {
78098
78162
  const rowRef = React.useRef(null);
78099
78163
  const isDisabled = React.useMemo(() => row?.isDisabled || (dataLength ?? 0) <= 1 || row.isSpecialNlp, [row, dataLength]);
78100
- let serialNumber = (indexNumber + 1).toString();
78164
+ const serialNumber = (indexNumber + 1).toString();
78101
78165
  const {
78102
78166
  attributes,
78103
78167
  listeners,
@@ -78223,8 +78287,8 @@ const StepTableMainRow = ({
78223
78287
  updateRowHeight: updateRowHeight
78224
78288
  })]
78225
78289
  });
78226
- };
78227
- var StepTableMainRow$1 = /*#__PURE__*/React.memo(StepTableMainRow);
78290
+ });
78291
+ StepTableMainRow.displayName = 'StepTableMainRow';
78228
78292
 
78229
78293
  const StepInnerTable = ({
78230
78294
  data = [],
@@ -78326,11 +78390,13 @@ const StepInnerTable = ({
78326
78390
  }
78327
78391
  return undefined;
78328
78392
  }, [focusRowId, rowHeights, highlightKey, onHighlightComplete]);
78329
- // Handle scroll
78330
- const handleScroll = e => {
78331
- setScrollTop(e.currentTarget.scrollTop);
78332
- };
78333
- // Update row height callback
78393
+ // Handle scroll with debouncing to reduce frequent updates
78394
+ const handleScroll = React.useCallback(e => {
78395
+ const scrollTopValue = e.currentTarget.scrollTop;
78396
+ // Simple debounce: update only if scrollTop changes significantly or use a timer
78397
+ setScrollTop(scrollTopValue);
78398
+ }, []);
78399
+ // Update row height callback with batching to reduce re-renders
78334
78400
  const updateRowHeight = React.useCallback((index, height) => {
78335
78401
  setRowHeights(prev => {
78336
78402
  const newHeights = [...prev];
@@ -78340,69 +78406,84 @@ const StepInnerTable = ({
78340
78406
  }
78341
78407
  return prev;
78342
78408
  });
78343
- }, []);
78344
- // Calculate visible rows
78345
- const fullData = appendNewRow(data, AddNlp ?? {});
78409
+ }, []); // Note: Could be optimized further with useReducer for batching multiple updates
78410
+ // Memoize fullData to avoid recalculating
78411
+ const fullData = React.useMemo(() => appendNewRow(data, AddNlp ?? {}), [data, AddNlp]);
78346
78412
  const totalRows = fullData.length;
78347
- let startIndex = 0;
78348
- let endIndex = totalRows - 1;
78349
- let paddingTop = 0;
78350
- let paddingBottom = 0;
78351
- if (rowHeights.length === totalRows && containerHeight > 0) {
78352
- let cumulativeHeight = 0;
78353
- // Find start index
78354
- for (let i = 0; i < totalRows; i++) {
78355
- if (cumulativeHeight <= scrollTop) {
78356
- startIndex = i;
78357
- }
78358
- cumulativeHeight += rowHeights[i] ?? 0;
78359
- }
78360
- // Find end index
78361
- cumulativeHeight = 0;
78362
- for (let i = 0; i < totalRows; i++) {
78363
- cumulativeHeight += rowHeights[i] ?? 0;
78364
- if (cumulativeHeight >= scrollTop + containerHeight && endIndex === totalRows - 1) {
78365
- endIndex = i;
78366
- break;
78413
+ // Memoize virtualization calculations to avoid expensive loops on every render
78414
+ const {
78415
+ startIndex,
78416
+ paddingTop,
78417
+ paddingBottom,
78418
+ visibleRows
78419
+ } = React.useMemo(() => {
78420
+ let startIndex = 0;
78421
+ let endIndex = totalRows - 1;
78422
+ let paddingTop = 0;
78423
+ let paddingBottom = 0;
78424
+ if (rowHeights.length === totalRows && containerHeight > 0) {
78425
+ let cumulativeHeight = 0;
78426
+ // Find start index
78427
+ for (let i = 0; i < totalRows; i++) {
78428
+ if (cumulativeHeight <= scrollTop) {
78429
+ startIndex = i;
78430
+ }
78431
+ cumulativeHeight += rowHeights[i] ?? 0;
78367
78432
  }
78368
- }
78369
- // Apply buffer
78370
- startIndex = Math.max(0, startIndex - buffer);
78371
- endIndex = Math.min(totalRows - 1, endIndex + buffer);
78372
- // Expand range to include focus row if needed
78373
- if (focusRowId) {
78374
- const focusIndex = fullData.findIndex(row => row.stepId === focusRowId || row.isNew && focusRowId === 'new-row');
78375
- if (focusIndex >= 0) {
78376
- if (focusIndex < startIndex) {
78377
- startIndex = focusIndex;
78378
- } else if (focusIndex > endIndex) {
78379
- endIndex = focusIndex;
78433
+ // Find end index
78434
+ cumulativeHeight = 0;
78435
+ for (let i = 0; i < totalRows; i++) {
78436
+ cumulativeHeight += rowHeights[i] ?? 0;
78437
+ if (cumulativeHeight >= scrollTop + containerHeight && endIndex === totalRows - 1) {
78438
+ endIndex = i;
78439
+ break;
78380
78440
  }
78381
78441
  }
78382
- }
78383
- // Calculate padding
78384
- paddingTop = rowHeights.slice(0, startIndex).reduce((sum, height) => sum + height, 0);
78385
- paddingBottom = rowHeights.slice(endIndex + 1).reduce((sum, height) => sum + height, 0);
78386
- } else {
78387
- // Fallback to estimated virtualization
78388
- startIndex = Math.max(0, Math.floor(scrollTop / estimatedRowHeight) - buffer);
78389
- endIndex = Math.min(totalRows - 1, startIndex + Math.ceil(containerHeight / estimatedRowHeight) + buffer);
78390
- // Expand range to include focus row if needed
78391
- if (focusRowId) {
78392
- const focusIndex = fullData.findIndex(row => row.stepId === focusRowId || row.isNew && focusRowId === 'new-row');
78393
- if (focusIndex >= 0) {
78394
- if (focusIndex < startIndex) {
78395
- startIndex = focusIndex;
78396
- } else if (focusIndex > endIndex) {
78397
- endIndex = focusIndex;
78442
+ // Apply buffer
78443
+ startIndex = Math.max(0, startIndex - buffer);
78444
+ endIndex = Math.min(totalRows - 1, endIndex + buffer);
78445
+ // Expand range to include focus row if needed
78446
+ if (focusRowId) {
78447
+ const focusIndex = fullData.findIndex(row => row.stepId === focusRowId || row.isNew && focusRowId === 'new-row');
78448
+ if (focusIndex >= 0) {
78449
+ if (focusIndex < startIndex) {
78450
+ startIndex = focusIndex;
78451
+ } else if (focusIndex > endIndex) {
78452
+ endIndex = focusIndex;
78453
+ }
78454
+ }
78455
+ }
78456
+ // Calculate padding
78457
+ paddingTop = rowHeights.slice(0, startIndex).reduce((sum, height) => sum + height, 0);
78458
+ paddingBottom = rowHeights.slice(endIndex + 1).reduce((sum, height) => sum + height, 0);
78459
+ } else {
78460
+ // Fallback to estimated virtualization
78461
+ startIndex = Math.max(0, Math.floor(scrollTop / estimatedRowHeight) - buffer);
78462
+ endIndex = Math.min(totalRows - 1, startIndex + Math.ceil(containerHeight / estimatedRowHeight) + buffer);
78463
+ // Expand range to include focus row if needed
78464
+ if (focusRowId) {
78465
+ const focusIndex = fullData.findIndex(row => row.stepId === focusRowId || row.isNew && focusRowId === 'new-row');
78466
+ if (focusIndex >= 0) {
78467
+ if (focusIndex < startIndex) {
78468
+ startIndex = focusIndex;
78469
+ } else if (focusIndex > endIndex) {
78470
+ endIndex = focusIndex;
78471
+ }
78398
78472
  }
78399
78473
  }
78474
+ paddingTop = startIndex * estimatedRowHeight;
78475
+ paddingBottom = (totalRows - endIndex - 1) * estimatedRowHeight;
78400
78476
  }
78401
- paddingTop = startIndex * estimatedRowHeight;
78402
- paddingBottom = (totalRows - endIndex - 1) * estimatedRowHeight;
78403
- }
78404
- const visibleRows = fullData.slice(startIndex, endIndex + 1);
78405
- // Infinite scroll observer
78477
+ const visibleRows = fullData.slice(startIndex, endIndex + 1);
78478
+ return {
78479
+ startIndex,
78480
+ endIndex,
78481
+ paddingTop,
78482
+ paddingBottom,
78483
+ visibleRows
78484
+ };
78485
+ }, [fullData, totalRows, rowHeights, containerHeight, scrollTop, buffer, focusRowId, estimatedRowHeight]);
78486
+ // Infinite scroll observer - optimized dependencies
78406
78487
  React.useEffect(() => {
78407
78488
  const scrollContainer = containerRef.current;
78408
78489
  const firstNode = document.getElementById('ff-table-first-node');
@@ -78427,9 +78508,9 @@ const StepInnerTable = ({
78427
78508
  return () => {
78428
78509
  observerRef.current?.disconnect();
78429
78510
  };
78430
- }, [data, loadMore]);
78511
+ }, [data?.length, loadMore]); // Optimized: use data.length instead of data to avoid unnecessary re-runs
78431
78512
  const handleOnclick = (column, row, index) => {
78432
- let {
78513
+ const {
78433
78514
  onClick,
78434
78515
  accessor
78435
78516
  } = column;
@@ -78526,7 +78607,7 @@ const StepInnerTable = ({
78526
78607
  })
78527
78608
  })]
78528
78609
  }, row.stepId || absoluteIndex);
78529
- const renderSortableRow = () => jsxRuntime.jsx(StepTableMainRow$1, {
78610
+ const renderSortableRow = () => jsxRuntime.jsx(StepTableMainRow, {
78530
78611
  rowId: row.stepId,
78531
78612
  row: row,
78532
78613
  indexNumber: absoluteIndex,
@@ -78572,7 +78653,7 @@ const StepInnerTable = ({
78572
78653
  height: `calc(${height} - 50px)`
78573
78654
  },
78574
78655
  children: noDataContent
78575
- }, height)]
78656
+ })]
78576
78657
  })
78577
78658
  })
78578
78659
  });
@@ -78595,8 +78676,15 @@ const getStepsTableData = (tableData, sectionTitle = 'Steps') => {
78595
78676
  const section = tableData.find(item => item?.title === sectionTitle);
78596
78677
  return section?.data ?? [];
78597
78678
  };
78679
+ // Memoized block map to avoid recomputation
78680
+ let cachedBlockMap = null;
78681
+ let cachedTableData = null;
78598
78682
  const getBlockMap = tableData => {
78599
- let getStepData = getStepsTableData(tableData);
78683
+ // Check if tableData has changed
78684
+ if (cachedTableData === tableData && cachedBlockMap) {
78685
+ return cachedBlockMap;
78686
+ }
78687
+ const getStepData = getStepsTableData(tableData);
78600
78688
  const blockMap = new Map();
78601
78689
  // Returns a key for grouping steps.
78602
78690
  const getBlockKey = step => step.specialNlpId ?? step.conditionSearchKey ?? null;
@@ -78642,6 +78730,9 @@ const getBlockMap = tableData => {
78642
78730
  }
78643
78731
  blockMap.set(key, blockEntry);
78644
78732
  });
78733
+ // Cache the result
78734
+ cachedBlockMap = blockMap;
78735
+ cachedTableData = tableData;
78645
78736
  return blockMap;
78646
78737
  };
78647
78738
  const getParentConditionKey = key => key.includes('/') ? key.split('/').slice(0, -1).join('/') : key;
@@ -78733,8 +78824,8 @@ const updateCheckboxStatus = (tableData, row, isChecked, selectedRows, stepParti
78733
78824
  }
78734
78825
  if (parentData?.start?.conditionSearchKey) {
78735
78826
  const parentKey = getParentConditionKey(parentData?.start?.conditionSearchKey);
78736
- let conditionSearchKey = parentData?.start?.conditionSearchKey;
78737
- let conditionId = parentData?.start?.conditionId;
78827
+ const conditionSearchKey = parentData?.start?.conditionSearchKey;
78828
+ const conditionId = parentData?.start?.conditionId;
78738
78829
  if (conditionSearchKey === conditionId && visited) {
78739
78830
  visited = false;
78740
78831
  const grandParent = blockMap.get(parentKey);
@@ -78829,7 +78920,7 @@ const hasSelectedIds = rows => {
78829
78920
  return false;
78830
78921
  };
78831
78922
  const gettingBlockMap = (tableData, selectedRows, stepPartialSelect) => {
78832
- let dynamicUpdate = getBlockMap(tableData);
78923
+ const dynamicUpdate = getBlockMap(tableData);
78833
78924
  const updatedSelectedRows = new Set(selectedRows.Steps);
78834
78925
  const updateStepPartialSelect = new Set(stepPartialSelect);
78835
78926
  dynamicUpdate?.forEach(blockEntry => {
@@ -79130,7 +79221,7 @@ const StepsTitle = ({
79130
79221
  });
79131
79222
  };
79132
79223
 
79133
- const StepLandingTable = /*#__PURE__*/React.forwardRef(({
79224
+ const StepLandingTable = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef(({
79134
79225
  tableMeta = [],
79135
79226
  tableData = [],
79136
79227
  noDataContent,
@@ -79160,7 +79251,7 @@ const StepLandingTable = /*#__PURE__*/React.forwardRef(({
79160
79251
  const [expandedRows, setExpandedRows] = React.useState({});
79161
79252
  const [expandStepGroup, setExpandStepGroup] = React.useState(new Map());
79162
79253
  const [isBulkEnable, setBulkEnable] = React.useState(false);
79163
- const onAccordionClick = (title, action) => {
79254
+ const onAccordionClick = React.useCallback((title, action) => {
79164
79255
  const row = tableData.find(row => row.title === title);
79165
79256
  if (!row || !row.data || row.data.length === 0) {
79166
79257
  return;
@@ -79169,12 +79260,12 @@ const StepLandingTable = /*#__PURE__*/React.forwardRef(({
79169
79260
  ...prev,
79170
79261
  [title]: action === 'open' ? true : !prev[title]
79171
79262
  }));
79172
- };
79263
+ }, [tableData]);
79173
79264
  const isExpanded = React.useMemo(() => title => expandedRows[title] ?? false, [expandedRows]);
79174
- const toggleViewRow = row => {
79265
+ const toggleViewRow = React.useCallback(row => {
79175
79266
  setViewModeId(prev => prev === row?.stepId ? null : row?.stepId);
79176
- };
79177
- const handleClick = item => {
79267
+ }, []);
79268
+ const handleClick = React.useCallback(item => {
79178
79269
  toggleViewRow(item);
79179
79270
  const Component = handleViewComponent?.(item, toggleViewRow);
79180
79271
  if (Component) {
@@ -79182,7 +79273,7 @@ const StepLandingTable = /*#__PURE__*/React.forwardRef(({
79182
79273
  } else {
79183
79274
  toggleViewRow(null);
79184
79275
  }
79185
- };
79276
+ }, [handleViewComponent, toggleViewRow]);
79186
79277
  const [selectedRows, setSelectedRows] = React.useState(Object.fromEntries(tableData.map(section => [section.title, new Set()])));
79187
79278
  const [stepPartialSelect, setStepPartialSelect] = React.useState(new Set());
79188
79279
  React.useEffect(() => {
@@ -79190,7 +79281,7 @@ const StepLandingTable = /*#__PURE__*/React.forwardRef(({
79190
79281
  setStepPartialSelect(prevPartialSelect => getUpdatedPartialSelect(tableData, prevPartialSelect));
79191
79282
  setExpandedRows(prev => getUpdatedExpandedRows(tableData, prev, defaultExpanded));
79192
79283
  if (selectedRows && !hasSelectedIds(selectedRows)) return;
79193
- let {
79284
+ const {
79194
79285
  updateSelectRow,
79195
79286
  updateStepPartialSelect
79196
79287
  } = gettingBlockMap(tableData, selectedRows, stepPartialSelect);
@@ -79208,7 +79299,7 @@ const StepLandingTable = /*#__PURE__*/React.forwardRef(({
79208
79299
  onSelectClick?.(selectedRows);
79209
79300
  }
79210
79301
  }, [selectedRows]);
79211
- const handleMainCheckbox = (sectionTitle, checked) => {
79302
+ const handleMainCheckbox = React.useCallback((sectionTitle, checked) => {
79212
79303
  const allRowIds = tableData.find(section => section.title === sectionTitle)?.data.map(row => row.stepId);
79213
79304
  if (allRowIds) {
79214
79305
  setSelectedRows(prev => ({
@@ -79217,31 +79308,31 @@ const StepLandingTable = /*#__PURE__*/React.forwardRef(({
79217
79308
  }));
79218
79309
  if (!checked) setStepPartialSelect(new Set());
79219
79310
  }
79220
- };
79221
- const handleUpdateCheckboxState = (tableData, rowData, isChecked, sectionTitle) => {
79311
+ }, [tableData]);
79312
+ const handleUpdateCheckboxState = React.useCallback((tableData, rowData, isChecked, sectionTitle) => {
79222
79313
  const {
79223
79314
  updateSelectRow,
79224
79315
  updateStepPartialSelect
79225
79316
  } = updateCheckboxStatus(tableData, rowData, isChecked, selectedRows, stepPartialSelect, sectionTitle);
79226
79317
  if (updateStepPartialSelect) setStepPartialSelect(updateStepPartialSelect);
79227
79318
  if (updateSelectRow) setSelectedRows(updateSelectRow);
79228
- };
79229
- const handleRowCheckbox = (sectionTitle, row, isChecked) => {
79319
+ }, [selectedRows, stepPartialSelect]);
79320
+ const handleRowCheckbox = React.useCallback((sectionTitle, row, isChecked) => {
79230
79321
  handleUpdateCheckboxState(tableData, row, isChecked, sectionTitle);
79231
- };
79232
- const isAllSelected = (sectionTitle, totalRows) => {
79322
+ }, [tableData, handleUpdateCheckboxState]);
79323
+ const isAllSelected = React.useCallback((sectionTitle, totalRows) => {
79233
79324
  const isSelected = totalRows > 0 && selectedRows[sectionTitle]?.size === totalRows;
79234
79325
  if (sectionTitle.includes('Script')) {
79235
79326
  setBulkEnable(isSelected);
79236
79327
  }
79237
79328
  return isSelected;
79238
- };
79239
- const isPartialSelected = (sectionTitle, totalRows) => {
79329
+ }, [selectedRows]);
79330
+ const isPartialSelected = React.useCallback((sectionTitle, totalRows) => {
79240
79331
  const selectedCount = selectedRows[sectionTitle]?.size || 0;
79241
79332
  return selectedCount > 0 && selectedCount < totalRows;
79242
- };
79243
- const isStepGroupExpanded = stepId => expandStepGroup.has(stepId);
79244
- const handleStepGroupExpand = rowData => {
79333
+ }, [selectedRows]);
79334
+ const isStepGroupExpanded = React.useCallback(stepId => expandStepGroup.has(stepId), [expandStepGroup]);
79335
+ const handleStepGroupExpand = React.useCallback(rowData => {
79245
79336
  if (!isStepGroupExpanded(rowData?.stepId)) {
79246
79337
  if (viewModeId) toggleViewRow(null);
79247
79338
  handleAccordion?.(rowData);
@@ -79257,8 +79348,8 @@ const StepLandingTable = /*#__PURE__*/React.forwardRef(({
79257
79348
  return newMap;
79258
79349
  });
79259
79350
  }
79260
- };
79261
- const getAccordionTableContent = rows => {
79351
+ }, [isStepGroupExpanded, viewModeId, toggleViewRow, handleAccordion, loading]);
79352
+ const getAccordionTableContent = React.useCallback(rows => {
79262
79353
  if (rows.title === 'Steps' && !isViewPrivilegeMode) {
79263
79354
  return jsxRuntime.jsx(StepInnerTable, {
79264
79355
  onHighlightComplete: onHighlightComplete,
@@ -79311,11 +79402,11 @@ const StepLandingTable = /*#__PURE__*/React.forwardRef(({
79311
79402
  handleStepGroupExpand: handleStepGroupExpand,
79312
79403
  isStepGroupExpanded: isStepGroupExpanded,
79313
79404
  isViewPrivilegeMode: isViewPrivilegeMode,
79314
- height: height,
79405
+ height: tableData.length === 1 ? height : '',
79315
79406
  isClientSide: isClientSide
79316
79407
  });
79317
79408
  }
79318
- };
79409
+ }, [isViewPrivilegeMode, onHighlightComplete, highlightKey, isDraggable, tableMeta, onDragEnd, headerType, editMode, editComponent, noDataContent, NlpComponent, AddNlp, expandStepGroup, handleDragStart, handleRowCheckbox, selectedRows, viewModeId, ViewComponent, handleClick, handleStepGroupExpand, isStepGroupExpanded, stepPartialSelect, tableData.length, height, isClientSide]);
79319
79410
  React.useImperativeHandle(ref, () => ({
79320
79411
  resetSelection: () => {
79321
79412
  setSelectedRows(Object.fromEntries(tableData.map(section => [section.title, new Set()])));
@@ -79336,7 +79427,7 @@ const StepLandingTable = /*#__PURE__*/React.forwardRef(({
79336
79427
  resetStepGroupAccordion: () => {
79337
79428
  setExpandStepGroup(new Map());
79338
79429
  }
79339
- }));
79430
+ }), [tableData, handleUpdateCheckboxState]);
79340
79431
  React.useEffect(() => {
79341
79432
  if (!checkEmpty(AddNlp)) {
79342
79433
  setViewComponent(() => null);
@@ -79347,6 +79438,7 @@ const StepLandingTable = /*#__PURE__*/React.forwardRef(({
79347
79438
  }
79348
79439
  }, [AddNlp]);
79349
79440
  return jsxRuntime.jsxs("div", {
79441
+ // style={{ height, overflowY: 'auto' }}
79350
79442
  className: classNames('ff-accordion-table-container-steps', {
79351
79443
  'ff-accordion-fixed-header-table': withFixedHeader
79352
79444
  }),
@@ -79411,7 +79503,8 @@ const StepLandingTable = /*#__PURE__*/React.forwardRef(({
79411
79503
  })
79412
79504
  })]
79413
79505
  });
79414
- });
79506
+ }));
79507
+ StepLandingTable.displayName = 'StepLandingTable';
79415
79508
 
79416
79509
  var immutable$1 = {exports: {}};
79417
79510