pixel-sharan 1.13.72 → 1.13.75

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 (33) hide show
  1. package/lib/StyleGuide/ColorPalette/colorPaletteList.js +10 -0
  2. package/lib/StyleGuide/ColorPalette/colorPaletteList.js.map +1 -1
  3. package/lib/_virtual/index10.js +2 -2
  4. package/lib/_virtual/index9.js +2 -2
  5. package/lib/components/Charts/DashboardDonutChart/DashboardDonutChart.js +28 -3
  6. package/lib/components/Charts/DashboardDonutChart/DashboardDonutChart.js.map +1 -1
  7. package/lib/components/Drawer/Drawer.js +1 -1
  8. package/lib/components/Drawer/Drawer.js.map +1 -1
  9. package/lib/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.js +141 -82
  10. package/lib/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.js.map +1 -1
  11. package/lib/components/Excel/ExcelFile/ExcelFileComponents/reducer.js.map +1 -1
  12. package/lib/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.js +25 -13
  13. package/lib/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.js.map +1 -1
  14. package/lib/components/Input/Input.js +5 -2
  15. package/lib/components/Input/Input.js.map +1 -1
  16. package/lib/components/Input/types.d.ts +4 -0
  17. package/lib/components/MachineInputField/MachineInputField.js +1 -1
  18. package/lib/components/MachineInputField/MachineInputField.js.map +1 -1
  19. package/lib/components/MachineInputField/types.d.ts +1 -1
  20. package/lib/components/SequentialConnectingBranch/components/Branches/Branches.js +2 -2
  21. package/lib/components/SequentialConnectingBranch/components/Branches/Branches.js.map +1 -1
  22. package/lib/index.cjs +203 -104
  23. package/lib/index.cjs.map +1 -1
  24. package/lib/index.d.ts +5 -1
  25. package/lib/node_modules/js-beautify/js/src/css/beautifier.js +1 -1
  26. package/lib/node_modules/js-beautify/js/src/css/index.js +1 -1
  27. package/lib/node_modules/js-beautify/js/src/css/options.js +1 -1
  28. package/lib/node_modules/js-beautify/js/src/javascript/beautifier.js +1 -1
  29. package/lib/node_modules/js-beautify/js/src/javascript/index.js +1 -1
  30. package/lib/node_modules/js-beautify/js/src/javascript/options.js +1 -1
  31. package/lib/styles.css +1 -1
  32. package/lib/styles.css.map +1 -1
  33. package/package.json +1 -1
package/lib/index.cjs CHANGED
@@ -1988,7 +1988,7 @@ const Drawer = ({
1988
1988
  const handleKeyDown = e => {
1989
1989
  if (e.key === 'Enter' && isOpen && primaryButtonProps?.onClick && !primaryButtonProps.disabled) {
1990
1990
  const activeElement = document.activeElement;
1991
- if (activeElement && activeElement.tagName === 'INPUT') {
1991
+ if (activeElement && activeElement.tagName === 'INPUT' && ['ff-add-module-input', 'ff-search-input'].includes(activeElement.className)) {
1992
1992
  return;
1993
1993
  }
1994
1994
  primaryButtonProps.onClick();
@@ -3559,6 +3559,7 @@ const Input$1 = /*#__PURE__*/React.forwardRef(({
3559
3559
  placeholder = 'Enter input',
3560
3560
  value = type === 'number' ? 0 : '',
3561
3561
  helperText = '',
3562
+ isHelperTextRequired = false,
3562
3563
  error,
3563
3564
  noBorder,
3564
3565
  className = '',
@@ -3804,11 +3805,13 @@ const Input$1 = /*#__PURE__*/React.forwardRef(({
3804
3805
  }), reserveHelperTextSpace && jsxRuntime.jsx("span", {
3805
3806
  className: classNames('ff-input-message', {
3806
3807
  'ff-input-message--space': !!reserveHelperTextSpace,
3808
+ 'ff-input-message--showHelperText': !!isHelperTextRequired,
3807
3809
  'ff-input-message--danger': (displayErrorImmediately || touched) && !!error
3808
3810
  }),
3809
- children: (displayErrorImmediately || touched) && error ? helperText : ''
3810
- }), !reserveHelperTextSpace && (displayErrorImmediately || touched) && helperText && error && jsxRuntime.jsx("span", {
3811
+ children: (displayErrorImmediately || touched) && (error || isHelperTextRequired) ? helperText : ''
3812
+ }), !reserveHelperTextSpace && (displayErrorImmediately || touched) && helperText && (error || isHelperTextRequired) && jsxRuntime.jsx("span", {
3811
3813
  className: classNames('ff-input-message', {
3814
+ 'ff-input-message--showHelperText': !!isHelperTextRequired,
3812
3815
  'ff-input-message--danger': !!error
3813
3816
  }),
3814
3817
  children: helperText
@@ -31421,6 +31424,31 @@ const DashboardDonutChart = ({
31421
31424
  document.body.removeChild(svgContainer);
31422
31425
  return `${truncatedText}...`;
31423
31426
  };
31427
+ const getCenterText = () => {
31428
+ if (legendType === 'tableLegend' && hoveredItemIndex !== null) {
31429
+ const hoveredItem = chartValues.find(item => item.originalIndex === hoveredItemIndex);
31430
+ return total === 0 ? '0%' : `${Math.round((hoveredItem?.value || 0) / total * 100)}%`;
31431
+ }
31432
+ if (legendType === 'memoryLegend') {
31433
+ return `${totalMemory}`;
31434
+ }
31435
+ if (isOnClick && hoveredItemIndex !== null) {
31436
+ const hoveredItem = chartValues.find(item => item.originalIndex === hoveredItemIndex);
31437
+ return `${hoveredItem?.value}`;
31438
+ }
31439
+ return `${legendType === 'tableLegend' ? `${chartValues.length}` : Number.isInteger(total) ? total : total?.toFixed(2)} ${showUnit && unit ? unit.toUpperCase() : ''}`;
31440
+ };
31441
+ const getSubLabelText = () => {
31442
+ if (legendType === 'tableLegend' && hoveredItemIndex !== null) {
31443
+ const hoveredItem = chartValues.find(item => item.originalIndex === hoveredItemIndex);
31444
+ return truncateChartText(hoveredItem?.key || '');
31445
+ }
31446
+ if (isOnClick && hoveredItemIndex !== null) {
31447
+ const hoveredItem = chartValues.find(item => item.originalIndex === hoveredItemIndex);
31448
+ return truncateChartText(hoveredItem?.key || '');
31449
+ }
31450
+ return truncateChartText(legendDetailsType);
31451
+ };
31424
31452
  return jsxRuntime.jsxs("div", {
31425
31453
  className: classNames('ff-dashboard-donut-chart-section', {
31426
31454
  'ff-dashboard-donut-chart-section-table-legend': legendType === 'tableLegend',
@@ -31472,7 +31500,7 @@ const DashboardDonutChart = ({
31472
31500
  style: {
31473
31501
  fontSize: `${labelFontSize}px`
31474
31502
  },
31475
- children: wrapText(legendType === 'tableLegend' && hoveredItemIndex !== null && chartValues.find(item => item.originalIndex === hoveredItemIndex) ? total === 0 ? '0%' : `${Math.round((chartValues.find(item => item.originalIndex === hoveredItemIndex)?.value || 0) / total * 100)}%` : legendType === 'memoryLegend' ? `${totalMemory}` : isOnClick && hoveredItemIndex !== null && chartValues.find(item => item.originalIndex === hoveredItemIndex)?.value ? `${chartValues.find(item => item.originalIndex === hoveredItemIndex)?.value}` : `${legendType === 'tableLegend' ? `${chartValues.length}` : Number.isInteger(total) ? total : total?.toFixed(2)} ${showUnit && unit ? unit.toUpperCase() : ''}`, LABEL_MAX_WIDTH, labelFontSize).map((line, index) => jsxRuntime.jsx("tspan", {
31503
+ children: wrapText(getCenterText(), LABEL_MAX_WIDTH, labelFontSize).map((line, index) => jsxRuntime.jsx("tspan", {
31476
31504
  x: "0",
31477
31505
  dy: index === 0 ? 0 : labelFontSize,
31478
31506
  children: selectedItemIndex !== null && chartValues.find(item => item.originalIndex === selectedItemIndex) ? index === 0 ? chartValues.find(item => item.originalIndex === selectedItemIndex)?.value : null : apiDataLabel ? apiDataLabel : line
@@ -31485,11 +31513,11 @@ const DashboardDonutChart = ({
31485
31513
  style: {
31486
31514
  fontSize: `${subLabelFontSize}px`
31487
31515
  },
31488
- children: wrapText(legendType === 'tableLegend' && hoveredItemIndex !== null && chartValues.find(item => item.originalIndex === hoveredItemIndex) ? chartValues.find(item => item.originalIndex === hoveredItemIndex)?.key || '' : isOnClick && hoveredItemIndex !== null && chartValues.find(item => item.originalIndex === hoveredItemIndex)?.key ? `${chartValues.find(item => item.originalIndex === hoveredItemIndex)?.key}` : legendDetailsType, LABEL_MAX_WIDTH, subLabelFontSize).map((line, index) => jsxRuntime.jsx("tspan", {
31516
+ children: wrapText(getSubLabelText(), LABEL_MAX_WIDTH, subLabelFontSize).map((line, index) => jsxRuntime.jsx("tspan", {
31489
31517
  x: "0",
31490
31518
  dy: index === 0 ? 0 : subLabelFontSize,
31491
31519
  fill: selectedItemIndex !== null && chartValues.find(item => item.originalIndex === selectedItemIndex)?.color || hoveredItemIndex !== null && isOnClick && chartValues.find(item => item.originalIndex === hoveredItemIndex)?.color || '',
31492
- children: selectedItemIndex !== null && chartValues.find(item => item.originalIndex === selectedItemIndex) ? index === 0 ? truncateChartText(chartValues.find(item => item.originalIndex === selectedItemIndex)?.key || '') : null : truncateChartText(line)
31520
+ children: line
31493
31521
  }, index))
31494
31522
  })]
31495
31523
  })]
@@ -34411,7 +34439,7 @@ const IconRadioGroup = ({
34411
34439
  };
34412
34440
 
34413
34441
  const MachineInputField = ({
34414
- width = '',
34442
+ width = '100%',
34415
34443
  options = [],
34416
34444
  runCount = 0,
34417
34445
  className = '',
@@ -34569,9 +34597,9 @@ const Branches = ({
34569
34597
  const showMiddleArrow = index => machineInstances.length - 1 !== index && machineColumnCount > 1;
34570
34598
  const getGridTemplateColumnStyle = () => {
34571
34599
  if (machineColumnCount === 1) {
34572
- return `24px ${machineColumnWidth}px 24px`;
34600
+ return `24px auto 24px`;
34573
34601
  }
34574
- return `24px ${machineColumnWidth}px repeat(${machineColumnCount - 1}, 40px ${machineColumnWidth}px) 24px`;
34602
+ return `24px minmax(180px, auto) repeat(${machineColumnCount - 1}, 40px minmax(180px, auto)) 24px`;
34575
34603
  };
34576
34604
  const getMachineLabelOptionList = (type = '', machineInstance) => {
34577
34605
  const {
@@ -37663,6 +37691,16 @@ const clearCell = cell => {
37663
37691
  style: cell?.style
37664
37692
  };
37665
37693
  };
37694
+ const clearEditCell = cell => {
37695
+ if (!canClearCell(cell) || cell?.inputType?.type === 'file') {
37696
+ return cell;
37697
+ }
37698
+ return {
37699
+ ...cell,
37700
+ value: typeof cell?.value === 'string' ? cell.value.slice(0, -1) : cell?.value,
37701
+ style: cell?.style
37702
+ };
37703
+ };
37666
37704
  const nextLine = cell => {
37667
37705
  if (!cell) return undefined;
37668
37706
  return {
@@ -37697,24 +37735,26 @@ function clearEditMode(state) {
37697
37735
  if (!state.active) {
37698
37736
  return state;
37699
37737
  }
37700
- const selectedRange = state.selected.toRange(state.model.data);
37701
- const changes = [];
37702
- let newData = state.model.data;
37703
- for (const point of selectedRange || []) {
37704
- const cell = get$1(point, state.model.data);
37705
- const clearedCell = clearCell(cell);
37738
+ if (state.mode === 'view') {
37739
+ const resultState = clear(state);
37740
+ return resultState;
37741
+ } else {
37742
+ const changes = [];
37743
+ let newData = state.model.data;
37744
+ const cell = get$1(state.active, state.model.data);
37745
+ const clearedCell = clearEditCell(cell);
37706
37746
  changes.push({
37707
37747
  prevCell: cell || null,
37708
37748
  nextCell: clearedCell || null
37709
37749
  });
37710
- newData = set$1(point, clearedCell, newData);
37750
+ newData = set$1(state.active, clearedCell, newData);
37751
+ return {
37752
+ ...state,
37753
+ mode: 'edit',
37754
+ model: new Model(createFormulaParser, newData),
37755
+ ...commit(changes)
37756
+ };
37711
37757
  }
37712
- return {
37713
- ...state,
37714
- mode: 'edit',
37715
- model: new Model(createFormulaParser, newData),
37716
- ...commit(changes)
37717
- };
37718
37758
  }
37719
37759
  function enterFunctionality(state) {
37720
37760
  if (!state.active) {
@@ -40604,99 +40644,158 @@ const ActiveCell = props => {
40604
40644
  const [allOption, setAllOption] = React__namespace.useState();
40605
40645
  const [selectedFiles, setSelectedFiles] = React__namespace.useState([]);
40606
40646
  const handleFilesChange = async (newFiles, selected, actionType) => {
40607
- if (newFiles.length > 5) {
40608
- toast.info('Cannot upload more than 5 files.');
40609
- return;
40610
- }
40611
- if (props.attachmentAction?.addAttachment && selected && actionType === 'ADD' && cell?.inputType?.type === 'file') {
40612
- try {
40613
- const parsedFiles = !checkEmpty(cell.value) ? JSON.parse(cell.value) : [];
40614
- let successCount = 0;
40615
- let failureCount = 0;
40616
- let duplicateCount = 0;
40617
- // Filter out duplicate files
40618
- const nonDuplicateFiles = selected.filter(file => {
40619
- const isDuplicate = parsedFiles.some(existing => existing?.name.split('*')[0] === file?.name);
40620
- if (isDuplicate) {
40621
- duplicateCount++;
40622
- }
40623
- return !isDuplicate;
40624
- });
40625
- if (nonDuplicateFiles.length === 0) {
40626
- if (duplicateCount > 0) {
40627
- toast.warning(`Duplicate attachments not allowed within the same row`);
40628
- }
40629
- return;
40630
- }
40631
- // Upload files with better error handling
40632
- const uploadPromises = nonDuplicateFiles.map(async file => {
40633
- try {
40634
- const response = await props?.attachmentAction?.addAttachment(file);
40635
- // Check if response is falsy or empty
40636
- if (!response || typeof response === 'string' && response.trim().length === 0) {
40637
- return null;
40647
+ if (actionType === 'ADD' && cell?.inputType?.type === 'file') {
40648
+ const parsedFiles = !checkEmpty(cell.value) ? JSON.parse(cell.value) : [];
40649
+ // Combine selected and newFiles, ensuring selected is an array
40650
+ const allFiles = [...(selected || []), ...newFiles];
40651
+ // Check total file count (existing + all files)
40652
+ const totalFiles = parsedFiles.length + allFiles.length;
40653
+ if (totalFiles > 5) {
40654
+ toast.info('Cannot upload more than 5 files.');
40655
+ return;
40656
+ }
40657
+ if (props.attachmentAction?.addAttachment) {
40658
+ try {
40659
+ let successCount = 0;
40660
+ let failureCount = 0;
40661
+ let duplicateCount = 0;
40662
+ // Filter out duplicate files (check against parsedFiles and within allFiles)
40663
+ const uniqueFiles = allFiles.filter((file, index, self) => {
40664
+ // Check against existing parsedFiles
40665
+ const isDuplicateInParsed = parsedFiles.some(existing => existing?.name.split('*')[0] === file?.name);
40666
+ // Check for duplicates within allFiles (keep first occurrence)
40667
+ const isDuplicateInSelf = self.findIndex(f => f.name === file.name) !== index;
40668
+ if (isDuplicateInParsed || isDuplicateInSelf) {
40669
+ duplicateCount++;
40670
+ return false;
40638
40671
  }
40639
- // Handle string responses
40640
- if (typeof response === 'string') {
40641
- try {
40642
- const parsedResponse = JSON.parse(response);
40643
- // Validate parsed response structure
40644
- if (parsedResponse && parsedResponse.id && parsedResponse.name) {
40645
- return parsedResponse;
40672
+ return true;
40673
+ });
40674
+ if (uniqueFiles.length === 0) {
40675
+ if (duplicateCount > 0) {
40676
+ toast.warning(`Duplicate attachments not allowed within the same row`);
40677
+ }
40678
+ return;
40679
+ }
40680
+ // Upload files with error handling
40681
+ const uploadPromises = uniqueFiles.map(async file => {
40682
+ try {
40683
+ const response = await props?.attachmentAction?.addAttachment(file);
40684
+ // Check for invalid response
40685
+ if (!response || typeof response === 'string' && response.trim().length === 0) {
40686
+ return {
40687
+ file,
40688
+ status: 'failed',
40689
+ reason: 'no response'
40690
+ };
40691
+ }
40692
+ // Handle string responses
40693
+ if (typeof response === 'string') {
40694
+ try {
40695
+ const parsedResponse = JSON.parse(response);
40696
+ // Check for response code 400
40697
+ if (parsedResponse.responseCode === 400) {
40698
+ return {
40699
+ file,
40700
+ status: 'failed',
40701
+ reason: 'invalid file'
40702
+ };
40703
+ }
40704
+ // Validate parsed response structure
40705
+ if (parsedResponse && parsedResponse.id && parsedResponse.name) {
40706
+ return {
40707
+ file,
40708
+ status: 'success',
40709
+ data: parsedResponse
40710
+ };
40711
+ } else {
40712
+ return {
40713
+ file,
40714
+ status: 'failed',
40715
+ reason: 'invalid response'
40716
+ };
40717
+ }
40718
+ } catch (parseError) {
40719
+ return {
40720
+ file,
40721
+ status: 'failed',
40722
+ reason: 'parse error'
40723
+ };
40724
+ }
40725
+ }
40726
+ // Handle object responses
40727
+ if (typeof response === 'object' && response !== null) {
40728
+ const typedResponse = response;
40729
+ if (typedResponse?.id && typedResponse?.name) {
40730
+ return {
40731
+ file,
40732
+ status: 'success',
40733
+ data: typedResponse
40734
+ };
40646
40735
  } else {
40647
- return null;
40736
+ return {
40737
+ file,
40738
+ status: 'failed',
40739
+ reason: 'invalid response'
40740
+ };
40648
40741
  }
40649
- } catch (parseError) {
40650
- return null;
40651
40742
  }
40743
+ return {
40744
+ file,
40745
+ status: 'failed',
40746
+ reason: 'unknown'
40747
+ };
40748
+ } catch (error) {
40749
+ console.error(`Upload failed for ${file.name}:`, error);
40750
+ return {
40751
+ file,
40752
+ status: 'failed',
40753
+ reason: 'upload error'
40754
+ };
40652
40755
  }
40653
- // Handle object responses
40654
- if (typeof response === 'object' && response !== null) {
40655
- const typedResponse = response;
40656
- if (typedResponse?.id && typedResponse?.name) {
40657
- return typedResponse;
40756
+ });
40757
+ const results = await Promise.allSettled(uploadPromises);
40758
+ results.forEach(result => {
40759
+ if (result.status === 'fulfilled' && result.value) {
40760
+ const {
40761
+ status,
40762
+ data
40763
+ } = result.value;
40764
+ if (status === 'success' && data) {
40765
+ parsedFiles.push(data);
40766
+ successCount++;
40767
+ } else if (result.value.reason === 'invalid file') {
40768
+ failureCount++;
40658
40769
  } else {
40659
- return null;
40770
+ failureCount++;
40660
40771
  }
40772
+ } else {
40773
+ failureCount++;
40661
40774
  }
40662
- return null;
40663
- } catch (error) {
40664
- console.error(`Upload failed for ${file.name}:`, error);
40665
- return null;
40775
+ });
40776
+ // Update cell value
40777
+ const newValue = parsedFiles.length > 0 ? JSON.stringify(parsedFiles) : '';
40778
+ handleChange({
40779
+ ...cell,
40780
+ value: newValue,
40781
+ style: cell?.style,
40782
+ inputType: cell?.inputType
40783
+ });
40784
+ setSelectedFiles(parsedFiles.map(file => new File([new Blob()], file.name)));
40785
+ // Show toast messages
40786
+ if (duplicateCount > 0) {
40787
+ toast.warning(`Duplicate attachments not allowed within the same row`);
40666
40788
  }
40667
- });
40668
- const results = await Promise.allSettled(uploadPromises);
40669
- results.forEach(result => {
40670
- if (result.status === 'fulfilled' && result.value && result.value.id && result.value.name) {
40671
- parsedFiles.push(result.value);
40672
- successCount++;
40673
- } else {
40674
- failureCount++;
40789
+ if (successCount > 0) {
40790
+ toast.success(`${successCount} file${successCount > 1 ? 's' : ''} uploaded successfully.`);
40675
40791
  }
40676
- });
40677
- // Update cell value
40678
- const newValue = parsedFiles.length > 0 ? JSON.stringify(parsedFiles) : '';
40679
- handleChange({
40680
- ...cell,
40681
- value: newValue,
40682
- style: cell?.style,
40683
- inputType: cell?.inputType
40684
- });
40685
- setSelectedFiles(parsedFiles.map(file => new File([new Blob()], file.name)));
40686
- // Show appropriate toast messages
40687
- if (duplicateCount > 0) {
40688
- toast.warning(`Duplicate attachments not allowed within the same row`);
40689
- }
40690
- if (successCount > 0 && failureCount === 0) {
40691
- toast.success(`${successCount} file${successCount > 1 ? 's' : ''} uploaded successfully.`);
40692
- } else if (successCount > 0 && failureCount > 0) {
40693
- toast.info(`${successCount} file${successCount > 1 ? 's' : ''} uploaded successfully. ${failureCount} file${failureCount > 1 ? 's' : ''} failed.`);
40694
- } else if (failureCount > 0) {
40695
- toast.error(`${failureCount} unsupported ${failureCount > 1 ? 'files' : 'file'}. Please check the file formats.`);
40792
+ if (failureCount > 0) {
40793
+ toast.info(`${failureCount} unsupported ${failureCount > 1 ? 'files' : 'file'}. Please check the file formats.`);
40794
+ }
40795
+ } catch (error) {
40796
+ console.error('Attachment operation failed:', error);
40797
+ toast.error('Attachment operation failed');
40696
40798
  }
40697
- } catch (error) {
40698
- console.error('Attachment operation failed:', error);
40699
- toast.error('Attachment operation failed');
40700
40799
  }
40701
40800
  } else if (actionType === 'DELETE' && cell?.inputType?.type === 'file') {
40702
40801
  try {