impact-ui 3.7.25 → 4.0.0-alpha.10
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.
- package/MIGRATION_GUIDE.md +328 -0
- package/README.md +154 -15
- package/bin/migrate-image-paths.cjs +127 -0
- package/bin/migrate.js +293 -0
- package/codemods/component-map.js +153 -0
- package/codemods/image-paths-transform.js +69 -0
- package/codemods/transform.js +136 -0
- package/dist/components/Accordion/index.js +2 -1
- package/dist/components/AccordionModern/index.js +2 -1
- package/dist/components/Alert/index.js +2 -1
- package/dist/components/Avatar/index.js +2 -1
- package/dist/components/Badge/filled/filledIconLabelBadges/index.js +2 -1
- package/dist/components/Badge/filled/filledOnlyIconBadges/index.js +2 -1
- package/dist/components/Badge/filled/filledOnlyLabelBadges/index.js +2 -1
- package/dist/components/Badge/index.js +3 -2
- package/dist/components/Badge/stroke/strokeIconLabelBadges/index.js +2 -1
- package/dist/components/Badge/stroke/strokeOnlyIconBadges/index.js +2 -1
- package/dist/components/Badge/stroke/strokeOnlyLabelBadges/index.js +2 -1
- package/dist/components/Badge/subtle/subtleIOnlyIconBadges/index.js +2 -1
- package/dist/components/Badge/subtle/subtleIconLabelBadges/index.js +2 -1
- package/dist/components/Badge/subtle/subtleOnlyLabelBadges/index.js +2 -1
- package/dist/components/BottomSheet/index.js +2 -1
- package/dist/components/Breadcrumbs/index.js +2 -1
- package/dist/components/Button/index.js +2 -1
- package/dist/components/ButtonGroup/index.js +2 -1
- package/dist/components/Card/index.js +2 -1
- package/dist/components/Chart/index.js +2 -1
- package/dist/components/Chatbot/index.js +2 -1
- package/dist/components/Checkbox/index.js +2 -1
- package/dist/components/Chips/index.js +2 -1
- package/dist/components/CreateItemFlow/index.js +2 -1
- package/dist/components/DatePicker/datePickerDropdown.js +2 -1
- package/dist/components/DatePicker/index.js +3 -2
- package/dist/components/DateRangePicker/dateRangePickerDropdown.js +2 -1
- package/dist/components/DateRangePicker/index.js +3 -2
- package/dist/components/DynamicLayout/index.js +2 -1
- package/dist/components/EmptyState/EmptyStateImage.d.ts.map +1 -1
- package/dist/components/EmptyState/EmptyStateImage.js +3 -2
- package/dist/components/EmptyState/index.js +2 -1
- package/dist/components/FileUpload/index.js +2 -1
- package/dist/components/FilterPanel/index.js +2 -1
- package/dist/components/FiltersStrip/index.js +2 -1
- package/dist/components/Header/index.js +2 -1
- package/dist/components/HomePage/index.js +2 -1
- package/dist/components/Input/index.js +2 -1
- package/dist/components/Loader/index.js +2 -1
- package/dist/components/Menu/IconMenuItem.js +2 -1
- package/dist/components/Menu/MenuHeaderInfo.js +2 -1
- package/dist/components/Menu/NestedMenuItem.js +2 -1
- package/dist/components/Menu/index.js +2 -1
- package/dist/components/Menu/nestedMenuItemsFromObject.js +2 -1
- package/dist/components/Modal/index.js +2 -1
- package/dist/components/Notification/NotificationBody/NotificationList/NotificationList.js +2 -1
- package/dist/components/Notification/index.js +2 -1
- package/dist/components/Panel/index.js +2 -1
- package/dist/components/Popover/index.js +2 -1
- package/dist/components/ProgressBar/index.js +2 -1
- package/dist/components/Prompt/index.js +2 -1
- package/dist/components/RadioButtonGroup/index.js +2 -1
- package/dist/components/Select/index.js +2 -1
- package/dist/components/Sidebar/index.js +2 -1
- package/dist/components/Slider/index.js +2 -1
- package/dist/components/Stepper/index.js +2 -1
- package/dist/components/Switch/index.js +2 -1
- package/dist/components/Table/TableImpl.js +4 -3
- package/dist/components/TableChat/EmptyContainer.js +2 -1
- package/dist/components/TableChat/TableChatSidePanel.js +2 -1
- package/dist/components/TableChat/components/ChatMessageSkeleton/ChatFooterSkeleton.js +2 -1
- package/dist/components/TableChat/components/ChatMessageSkeleton/ChatHeaderSkeleton.js +2 -1
- package/dist/components/TableChat/components/ChatMessageSkeleton/ChatMessageListSkeleton.js +2 -1
- package/dist/components/TableChat/components/ChatMessageSkeleton/ChatSkeleton.js +2 -1
- package/dist/components/TableChat/components/TableChatLeftSection/AddChatContainer/AddChatContainer.js +2 -1
- package/dist/components/TableChat/components/TableChatLeftSection/TableChatChannelHeader.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/AvatarGroup/AvatarGroup.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatDefaultMessageType/ChatDefaultMessageType.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatDeleteMessageType/ChatDeletedMessageType.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatHeader/ChatHeader.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatInput/ChatInput.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatMessageAvatar/ChatMessageAvatar.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatMessages/ChatMessage.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatNotificationSettings/ChatNotificationSettings.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/DateSeparator/DateSeparator.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/PinedChatPanel/PinedChatPanel.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/TableChatRightSection.js +2 -1
- package/dist/components/TableChat/components/TextEditor/EditorToolbar.js +2 -1
- package/dist/components/TableChat/components/TextEditor/Mention.js +2 -1
- package/dist/components/TableChat/components/TextEditor/MentionList.js +2 -1
- package/dist/components/Tabs/index.js +2 -1
- package/dist/components/Tag/index.js +2 -1
- package/dist/components/TagGroup/index.js +2 -1
- package/dist/components/TextArea/index.js +2 -1
- package/dist/components/Toast/index.js +2 -1
- package/dist/components/Tooltip/index.js +2 -1
- package/dist/components/common/HelperText/index.js +2 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +0 -1
- package/dist/mcp-component-registry.json +1 -1
- package/dist/styles/entry.d.ts +2 -0
- package/dist/styles/entry.d.ts.map +1 -0
- package/dist/styles/entry.js +1 -0
- package/dist/styles/style.css +1 -1
- package/eslint-plugin/index.js +91 -0
- package/eslint-plugin/rules/no-barrel-import.js +224 -0
- package/package.json +153 -89
- package/dist/0db32db10ae1525f.svg +0 -9
- package/dist/2bc76319b1fa572e.svg +0 -9
- package/dist/39d49e4daed1a992.svg +0 -9
- package/dist/44beedf64dc29d19.svg +0 -9
- package/dist/49a4f914058314f1.svg +0 -9
- package/dist/6fc8a59d621a04a1.svg +0 -13
- package/dist/78f845dcfc981491.svg +0 -9
- package/dist/b31c0c2a19c1c19a.svg +0 -9
- package/dist/index.js +0 -308
- package/dist/index.js.map +0 -1
- package/src/components/Accordion/Accordion.styles.scss +0 -118
- package/src/components/Accordion/index.js +0 -104
- package/src/components/AccordionModern/AccordionModern.styles.scss +0 -121
- package/src/components/AccordionModern/SortableAccordionComp.js +0 -156
- package/src/components/AccordionModern/index.js +0 -103
- package/src/components/Alert/Alert.styles.scss +0 -131
- package/src/components/Alert/index.js +0 -71
- package/src/components/Avatar/Avatar.styles.scss +0 -25
- package/src/components/Avatar/index.js +0 -58
- package/src/components/Badge/Badges.style.scss +0 -55
- package/src/components/Badge/filled/filledIconLabelBadges/filledIconLabelBadges.styles.scss +0 -32
- package/src/components/Badge/filled/filledIconLabelBadges/index.js +0 -38
- package/src/components/Badge/filled/filledOnlyIconBadges/filledOnlyIconBadges.styles.scss +0 -26
- package/src/components/Badge/filled/filledOnlyIconBadges/index.js +0 -31
- package/src/components/Badge/filled/filledOnlyLabelBadges/filledOnlyLabelBadges.styles.scss +0 -66
- package/src/components/Badge/filled/filledOnlyLabelBadges/index.js +0 -31
- package/src/components/Badge/filled/index.js +0 -30
- package/src/components/Badge/index.js +0 -53
- package/src/components/Badge/stroke/index.js +0 -43
- package/src/components/Badge/stroke/strokeIconLabelBadges/index.js +0 -38
- package/src/components/Badge/stroke/strokeIconLabelBadges/strokeIconLabelBadges.styles.scss +0 -33
- package/src/components/Badge/stroke/strokeOnlyIconBadges/index.js +0 -31
- package/src/components/Badge/stroke/strokeOnlyIconBadges/strokeOnlyIconBadges.styles.scss +0 -27
- package/src/components/Badge/stroke/strokeOnlyLabelBadges/index.js +0 -31
- package/src/components/Badge/stroke/strokeOnlyLabelBadges/strokeOnlyLabelBadges.styles.scss +0 -89
- package/src/components/Badge/styles.css +0 -52
- package/src/components/Badge/subtle/index.js +0 -41
- package/src/components/Badge/subtle/subtleIOnlyIconBadges/index.js +0 -31
- package/src/components/Badge/subtle/subtleIOnlyIconBadges/subtleIOnlyIconBadges.scss +0 -26
- package/src/components/Badge/subtle/subtleIconLabelBadges/index.js +0 -38
- package/src/components/Badge/subtle/subtleIconLabelBadges/subtleIconLabelBadges.scss +0 -56
- package/src/components/Badge/subtle/subtleOnlyLabelBadges/index.js +0 -31
- package/src/components/Badge/subtle/subtleOnlyLabelBadges/subtleOnlyLabelBadges.scss +0 -70
- package/src/components/BottomSheet/BottomSheet.styles.scss +0 -46
- package/src/components/BottomSheet/index.js +0 -60
- package/src/components/Breadcrumbs/Breadcrumbs.styles.scss +0 -65
- package/src/components/Breadcrumbs/index.js +0 -121
- package/src/components/Button/Button.styles.scss +0 -345
- package/src/components/Button/index.js +0 -171
- package/src/components/ButtonGroup/ButtonGroup.styles.scss +0 -125
- package/src/components/ButtonGroup/index.js +0 -84
- package/src/components/Card/Card.styles.scss +0 -33
- package/src/components/Card/index.js +0 -21
- package/src/components/Chart/Chart.style.scss +0 -142
- package/src/components/Chart/index.js +0 -752
- package/src/components/ChatBot/bookMarkPanel.js +0 -74
- package/src/components/ChatBot/chatBot.style.scss +0 -1295
- package/src/components/ChatBot/chatBotFooter.js +0 -14
- package/src/components/ChatBot/chatBotLandingScreen.js +0 -26
- package/src/components/ChatBot/chatInput.js +0 -206
- package/src/components/ChatBot/chatbotModuleMenu.js +0 -278
- package/src/components/ChatBot/constant.js +0 -32
- package/src/components/ChatBot/conversationScreen.js +0 -281
- package/src/components/ChatBot/customScreen.js +0 -69
- package/src/components/ChatBot/historyPanel.js +0 -579
- package/src/components/ChatBot/index.js +0 -473
- package/src/components/ChatBot/newChatComponent.js +0 -105
- package/src/components/ChatBot/utils.js +0 -27
- package/src/components/Checkbox/Checkbox.styles.scss +0 -232
- package/src/components/Checkbox/dashed/index.js +0 -34
- package/src/components/Checkbox/default/index.js +0 -70
- package/src/components/Checkbox/index.js +0 -50
- package/src/components/Checkbox/withDropDown/index.js +0 -96
- package/src/components/Checkbox/withoutFormLabel/index.js +0 -46
- package/src/components/Chips/Chip.style.scss +0 -134
- package/src/components/Chips/index.js +0 -34
- package/src/components/CreateItemFlow/CreateItemFlow.styles.scss +0 -37
- package/src/components/CreateItemFlow/index.js +0 -145
- package/src/components/DatePicker/DatePicker.styles.scss +0 -519
- package/src/components/DatePicker/datePickerDropdown.js +0 -282
- package/src/components/DatePicker/datePickerFooter.js +0 -76
- package/src/components/DatePicker/datePickerInput.js +0 -333
- package/src/components/DatePicker/index.js +0 -288
- package/src/components/DatePicker/showMonthYearSelect.js +0 -119
- package/src/components/DateRangePicker/DateRangePicker.styles.scss +0 -635
- package/src/components/DateRangePicker/dateRangePickerCustom.js +0 -22
- package/src/components/DateRangePicker/dateRangePickerDropdown.js +0 -320
- package/src/components/DateRangePicker/dateRangePickerFooter.js +0 -50
- package/src/components/DateRangePicker/dateRangePickerInput.js +0 -544
- package/src/components/DateRangePicker/index.js +0 -393
- package/src/components/DateRangePicker/showMonthYearSelect.js +0 -103
- package/src/components/DateRangePicker/utils.js +0 -71
- package/src/components/DynamicLayout/DynamicLayout.styles.scss +0 -153
- package/src/components/DynamicLayout/index.js +0 -73
- package/src/components/EmptyState/EmptyState.styles.scss +0 -88
- package/src/components/EmptyState/EmptyStateImageComponent.jsx +0 -36
- package/src/components/EmptyState/index.js +0 -54
- package/src/components/FileUpload/FileUpload.styles.scss +0 -449
- package/src/components/FileUpload/index.js +0 -641
- package/src/components/FilterPanel/FilterPanel.styles.scss +0 -241
- package/src/components/FilterPanel/FilterPanelHeader.js +0 -15
- package/src/components/FilterPanel/PanelFooter.js +0 -65
- package/src/components/FilterPanel/PanelSidebar.js +0 -85
- package/src/components/FilterPanel/index.js +0 -147
- package/src/components/FiltersStrip/FiltersStrip.styles.scss +0 -343
- package/src/components/FiltersStrip/Slider/FilterSlider.styles.scss +0 -85
- package/src/components/FiltersStrip/Slider/Portal.js +0 -59
- package/src/components/FiltersStrip/Slider/index.js +0 -233
- package/src/components/FiltersStrip/appliedFilter.js +0 -180
- package/src/components/FiltersStrip/filterDropDown.js +0 -96
- package/src/components/FiltersStrip/index.js +0 -127
- package/src/components/FiltersStrip/mockData.js +0 -227
- package/src/components/Header/Header.styles.scss +0 -223
- package/src/components/Header/index.js +0 -156
- package/src/components/HomePage/HomePage.styles.scss +0 -1638
- package/src/components/HomePage/constant.js +0 -331
- package/src/components/HomePage/index.js +0 -675
- package/src/components/Input/Input.styles.scss +0 -318
- package/src/components/Input/helperText.js +0 -19
- package/src/components/Input/index.js +0 -60
- package/src/components/Input/inputWithIcon.js +0 -134
- package/src/components/Input/vanilaInput.js +0 -68
- package/src/components/Loader/Loader.styles.scss +0 -90
- package/src/components/Loader/index.js +0 -69
- package/src/components/Menu/IconMenuItem.js +0 -100
- package/src/components/Menu/Menu.styles.scss +0 -190
- package/src/components/Menu/MenuHeader.jsx +0 -84
- package/src/components/Menu/MenuHeaderInfo.jsx +0 -319
- package/src/components/Menu/MenuHeaderInfo.styles.scss +0 -123
- package/src/components/Menu/NestedMenuItem.js +0 -189
- package/src/components/Menu/index.js +0 -254
- package/src/components/Menu/nestedMenuItemsFromObject.js +0 -100
- package/src/components/Modal/Modal.styles.scss +0 -129
- package/src/components/Modal/index.js +0 -141
- package/src/components/MonthPicker/MonthPicker.styles.scss +0 -255
- package/src/components/MonthPicker/constant.js +0 -1
- package/src/components/MonthPicker/index.js +0 -373
- package/src/components/MonthRangePicker/MonthRangePicker.styles.scss +0 -383
- package/src/components/MonthRangePicker/constant.js +0 -1
- package/src/components/MonthRangePicker/index.js +0 -574
- package/src/components/Notification/Notification.styles.scss +0 -594
- package/src/components/Notification/NotificationBody/NotificationInfoList/chipsLists.js +0 -144
- package/src/components/Notification/NotificationBody/NotificationInfoList/index.js +0 -128
- package/src/components/Notification/NotificationBody/NotificationInfoList/notificationList.js +0 -165
- package/src/components/Notification/NotificationBody/NotificationPanels/chipsLists.js +0 -85
- package/src/components/Notification/NotificationBody/NotificationPanels/index.js +0 -259
- package/src/components/Notification/NotificationBody/NotificationPanels/notificationList.js +0 -637
- package/src/components/Notification/NotificationBody/index.js +0 -117
- package/src/components/Notification/index.js +0 -128
- package/src/components/Notification/mockData.js +0 -389
- package/src/components/Notification/notificationFooter.js +0 -31
- package/src/components/Notification/notificationHeader.js +0 -28
- package/src/components/Panel/Panel.styles.scss +0 -71
- package/src/components/Panel/index.js +0 -144
- package/src/components/Popover/Popover.styles.scss +0 -52
- package/src/components/Popover/index.js +0 -71
- package/src/components/Portal/index.js +0 -31
- package/src/components/ProgressBar/ProgressBar.styles.scss +0 -62
- package/src/components/ProgressBar/index.js +0 -40
- package/src/components/Prompt/Prompt.styles.scss +0 -107
- package/src/components/Prompt/index.js +0 -107
- package/src/components/RadioButtonGroup/RadioButtonGroup.styles.scss +0 -136
- package/src/components/RadioButtonGroup/index.js +0 -107
- package/src/components/Select/SearchFilter.js +0 -72
- package/src/components/Select/Select.styles.scss +0 -748
- package/src/components/Select/customGroupHeading.js +0 -24
- package/src/components/Select/dropdown.js +0 -65
- package/src/components/Select/hooks/index.js +0 -2
- package/src/components/Select/hooks/useClickOutside.js +0 -61
- package/src/components/Select/hooks/useMenuPosition.js +0 -288
- package/src/components/Select/index.js +0 -1307
- package/src/components/Select/menuList.js +0 -119
- package/src/components/Select/optionList.js +0 -215
- package/src/components/Select/selected-option-tags.js +0 -99
- package/src/components/Select/utils.js +0 -232
- package/src/components/Sidebar/Menus/childMenu.js +0 -88
- package/src/components/Sidebar/Menus/index.js +0 -130
- package/src/components/Sidebar/Menus/parentMenu.js +0 -173
- package/src/components/Sidebar/Sidebar.styles.scss +0 -411
- package/src/components/Sidebar/actions.js +0 -31
- package/src/components/Sidebar/index.js +0 -84
- package/src/components/Sidebar/mock.js +0 -202
- package/src/components/Slider/Sliders.styles.scss +0 -260
- package/src/components/Slider/index.js +0 -314
- package/src/components/Stepper/Stepper.styles.scss +0 -355
- package/src/components/Stepper/index.js +0 -101
- package/src/components/Switch/Switch.styles.scss +0 -96
- package/src/components/Switch/index.js +0 -59
- package/src/components/Table/AdvanceSearchModalItem.js +0 -392
- package/src/components/Table/AdvanceSortModal.js +0 -332
- package/src/components/Table/AgGridHeader.js +0 -1009
- package/src/components/Table/CommentsPortal.js +0 -428
- package/src/components/Table/NewAdvanceSearchModal/NewAdvanceSearchModal.js +0 -323
- package/src/components/Table/NewAdvanceSearchModal/NewAdvanceSearchModalItem.js +0 -476
- package/src/components/Table/NoComments.js +0 -295
- package/src/components/Table/Table.styles.scss +0 -3859
- package/src/components/Table/actionBar.js +0 -43
- package/src/components/Table/advanceSearchModal.js +0 -797
- package/src/components/Table/commentPanel.js +0 -421
- package/src/components/Table/filterUtils.js +0 -850
- package/src/components/Table/index.js +0 -2175
- package/src/components/Table/mockData.js +0 -1344
- package/src/components/Table/tableFunctions.js +0 -1676
- package/src/components/Table/tableHeader.js +0 -476
- package/src/components/Table/tableIcons.js +0 -61
- package/src/components/Table/tableMoreOptions.js +0 -293
- package/src/components/Table/tablePagination.js +0 -63
- package/src/components/Table/tableSettings.js +0 -287
- package/src/components/Table/withCommentIcon.js +0 -107
- package/src/components/TableChat/EmptyContainer.jsx +0 -13
- package/src/components/TableChat/README.md +0 -588
- package/src/components/TableChat/TableChatSidePanel.jsx +0 -832
- package/src/components/TableChat/TableChatSidePanel.styles.scss +0 -57
- package/src/components/TableChat/components/ChatMessageSkeleton/ChatFooterSkeleton.jsx +0 -43
- package/src/components/TableChat/components/ChatMessageSkeleton/ChatHeaderSkeleton.jsx +0 -55
- package/src/components/TableChat/components/ChatMessageSkeleton/ChatMessageListSkeleton.jsx +0 -94
- package/src/components/TableChat/components/ChatMessageSkeleton/ChatSkeleton.jsx +0 -22
- package/src/components/TableChat/components/ChatMessageSkeleton/ChatSkeleton.scss +0 -179
- package/src/components/TableChat/components/SkeletonList.jsx +0 -12
- package/src/components/TableChat/components/TableChatLeftSection/AddChatContainer/AddChatContainer.jsx +0 -171
- package/src/components/TableChat/components/TableChatLeftSection/AddChatContainer/AddChatContainer.styles.scss +0 -37
- package/src/components/TableChat/components/TableChatLeftSection/ChannelCheckbox/ChannelCheckbox.jsx +0 -28
- package/src/components/TableChat/components/TableChatLeftSection/ChatChannelItem.jsx +0 -116
- package/src/components/TableChat/components/TableChatLeftSection/ChatChannelList.jsx +0 -89
- package/src/components/TableChat/components/TableChatLeftSection/ChatHeaderButton/ChatHeaderButton.jsx +0 -27
- package/src/components/TableChat/components/TableChatLeftSection/ChatHeaderNavigation.jsx +0 -191
- package/src/components/TableChat/components/TableChatLeftSection/ChatIconButton/ChatIconButton.jsx +0 -23
- package/src/components/TableChat/components/TableChatLeftSection/TableChatChannelHeader.jsx +0 -117
- package/src/components/TableChat/components/TableChatLeftSection/TableChatChannelHeader.styles.scss +0 -469
- package/src/components/TableChat/components/TableChatLeftSection/UnreadBadge/UnreadBadge.jsx +0 -16
- package/src/components/TableChat/components/TableChatRightSection/AvatarGroup/AvatarGroup.jsx +0 -119
- package/src/components/TableChat/components/TableChatRightSection/AvatarGroup/AvatarGroup.styles.scss +0 -87
- package/src/components/TableChat/components/TableChatRightSection/ChatDefaultMessageType/ChatDefaultMessageType.jsx +0 -216
- package/src/components/TableChat/components/TableChatRightSection/ChatDefaultMessageType/ChatDefaultMessageType.styles.scss +0 -291
- package/src/components/TableChat/components/TableChatRightSection/ChatDeleteMessageType/ChatDeletedMessageType.jsx +0 -19
- package/src/components/TableChat/components/TableChatRightSection/ChatDeleteMessageType/DeletedMessage.styles.scss +0 -55
- package/src/components/TableChat/components/TableChatRightSection/ChatEditedMessageType/ChatEditedMessageType.jsx +0 -61
- package/src/components/TableChat/components/TableChatRightSection/ChatEditedMessageType/ChatEditedMessageType.styles.scss +0 -13
- package/src/components/TableChat/components/TableChatRightSection/ChatHeader/ChatHeader.jsx +0 -432
- package/src/components/TableChat/components/TableChatRightSection/ChatHeader/ChatHeaderAction.jsx +0 -365
- package/src/components/TableChat/components/TableChatRightSection/ChatHeader/ChatHeaderInfo.jsx +0 -42
- package/src/components/TableChat/components/TableChatRightSection/ChatHeader/chatHeader.styles.scss +0 -323
- package/src/components/TableChat/components/TableChatRightSection/ChatInput/ChatInput.jsx +0 -793
- package/src/components/TableChat/components/TableChatRightSection/ChatInput/ChatInput.styles.scss +0 -394
- package/src/components/TableChat/components/TableChatRightSection/ChatMessageActions/ChatMessageActions.jsx +0 -61
- package/src/components/TableChat/components/TableChatRightSection/ChatMessageActions/ChatMessageActions.styles.scss +0 -28
- package/src/components/TableChat/components/TableChatRightSection/ChatMessageAvatar/ChatMessageAvatar.jsx +0 -11
- package/src/components/TableChat/components/TableChatRightSection/ChatMessageAvatar/ChatMessageAvatar.styles.scss +0 -3
- package/src/components/TableChat/components/TableChatRightSection/ChatMessages/ChatMessage.jsx +0 -220
- package/src/components/TableChat/components/TableChatRightSection/ChatMessages/ChatMessage.styles.scss +0 -128
- package/src/components/TableChat/components/TableChatRightSection/ChatNotificationSettings/ChatNotificationSettings.jsx +0 -246
- package/src/components/TableChat/components/TableChatRightSection/ChatNotificationSettings/ChatNotificationSettings.styles.scss +0 -210
- package/src/components/TableChat/components/TableChatRightSection/DateSeparator/DateSeparator.jsx +0 -52
- package/src/components/TableChat/components/TableChatRightSection/DateSeparator/DateSeparator.styles.scss +0 -34
- package/src/components/TableChat/components/TableChatRightSection/EmojiPicker/EmojiPicker.jsx +0 -31
- package/src/components/TableChat/components/TableChatRightSection/FileUploader/FileUploader.jsx +0 -170
- package/src/components/TableChat/components/TableChatRightSection/ImageUploader/ImageUploader.jsx +0 -165
- package/src/components/TableChat/components/TableChatRightSection/PinedChatPanel/PinedChat.styles.scss +0 -587
- package/src/components/TableChat/components/TableChatRightSection/PinedChatPanel/PinedChatPanel.jsx +0 -244
- package/src/components/TableChat/components/TableChatRightSection/ReplyBadge/ReplyBadge.jsx +0 -29
- package/src/components/TableChat/components/TableChatRightSection/ReplyBadge/ReplyBadge.styles.scss +0 -47
- package/src/components/TableChat/components/TableChatRightSection/TableChatRightSection.jsx +0 -1340
- package/src/components/TableChat/components/TableChatRightSection/TableChatRightSection.styles.scss +0 -147
- package/src/components/TableChat/components/TextEditor/EditorToolbar.jsx +0 -209
- package/src/components/TableChat/components/TextEditor/EditorToolbar.styles.scss +0 -61
- package/src/components/TableChat/components/TextEditor/Mention.jsx +0 -234
- package/src/components/TableChat/components/TextEditor/MentionList.jsx +0 -118
- package/src/components/TableChat/components/TextEditor/MentionList.scss +0 -146
- package/src/components/TableChat/components/TextEditor/styles.scss +0 -278
- package/src/components/TableChat/components/TextEditor/suggestion.js +0 -124
- package/src/components/TableChat/components/chatConfig.js +0 -64
- package/src/components/TableChat/hooks/useInfiniteScroll.js +0 -256
- package/src/components/TableOld/AgGridHeader.js +0 -545
- package/src/components/TableOld/Table.styles.scss +0 -2192
- package/src/components/TableOld/actionBar.js +0 -43
- package/src/components/TableOld/index.js +0 -598
- package/src/components/TableOld/mockData.js +0 -1344
- package/src/components/TableOld/tableFunctions.js +0 -1734
- package/src/components/TableOld/tableHeader.js +0 -251
- package/src/components/TableOld/tableIcons.js +0 -61
- package/src/components/TableOld/tablePagination.js +0 -64
- package/src/components/TableOld/tableSettings.js +0 -166
- package/src/components/Tabs/Tabs.styles.scss +0 -120
- package/src/components/Tabs/index.js +0 -91
- package/src/components/Tabs/tabPanel.js +0 -38
- package/src/components/Tag/Tags.styles.scss +0 -71
- package/src/components/Tag/filled.js +0 -48
- package/src/components/Tag/index.js +0 -54
- package/src/components/Tag/solid.js +0 -47
- package/src/components/Tag/stroke.js +0 -47
- package/src/components/Tag/utils.js +0 -12
- package/src/components/TagGroup/TagGroup.styles.scss +0 -7
- package/src/components/TagGroup/index.js +0 -6
- package/src/components/TextArea/TextArea.styles.scss +0 -158
- package/src/components/TextArea/index.js +0 -121
- package/src/components/Toast/Toast.styles.scss +0 -66
- package/src/components/Toast/index.js +0 -35
- package/src/components/Tooltip/Tooltips.styles.scss +0 -111
- package/src/components/Tooltip/index.js +0 -68
- package/src/components/common/HelperText/HelperText.styles.scss +0 -18
- package/src/components/common/HelperText/index.js +0 -44
- package/src/components/common/MentionEditor/MentionEditor.styles.scss +0 -301
- package/src/components/common/MentionEditor/MentionList/MentionList.styles.scss +0 -146
- package/src/components/common/MentionEditor/MentionList/index.js +0 -130
- package/src/components/common/MentionEditor/index.js +0 -246
- package/src/components/common/MentionEditor/suggestion.js +0 -124
- package/src/components/index.js +0 -53
- package/src/stories/Accordion.stories.js +0 -151
- package/src/stories/AccordionModern.stories.js +0 -263
- package/src/stories/Alert.stories.js +0 -103
- package/src/stories/Avatar.stories.js +0 -79
- package/src/stories/Badge.stories.js +0 -112
- package/src/stories/BottomSheet.stories.js +0 -224
- package/src/stories/Breadcrumbs.stories.js +0 -143
- package/src/stories/Button.stories.js +0 -190
- package/src/stories/ButtonGroup.stories.js +0 -123
- package/src/stories/Card.stories.js +0 -73
- package/src/stories/Changelog.mdx +0 -1006
- package/src/stories/Chart.stories.js +0 -2017
- package/src/stories/ChatBot.stories.js +0 -668
- package/src/stories/Checkbox.stories.js +0 -209
- package/src/stories/Chips.stories.js +0 -106
- package/src/stories/CreateItemFlow.stories.js +0 -255
- package/src/stories/DatePicker.stories.js +0 -311
- package/src/stories/DateRangePicker.stories.js +0 -364
- package/src/stories/EmptyState.stories.js +0 -110
- package/src/stories/FileUpload.stories.js +0 -169
- package/src/stories/FilterPanel.stories.js +0 -309
- package/src/stories/FiltersStrip.stories.js +0 -244
- package/src/stories/GettingStarted.mdx +0 -153
- package/src/stories/Header.stories.js +0 -185
- package/src/stories/HomePage.stories.js +0 -201
- package/src/stories/Input.stories.js +0 -165
- package/src/stories/Loader.stories.js +0 -33
- package/src/stories/Menu.stories.js +0 -309
- package/src/stories/Modal.stories.js +0 -185
- package/src/stories/MonthPicker.stories.js +0 -313
- package/src/stories/MonthRangePicker.stories.js +0 -255
- package/src/stories/Notification.stories.js +0 -500
- package/src/stories/Panel.stories.js +0 -179
- package/src/stories/Popover.stories.js +0 -125
- package/src/stories/ProgressBar.stories.js +0 -93
- package/src/stories/Prompt.stories.js +0 -120
- package/src/stories/RadioButtonGroup.stories.js +0 -83
- package/src/stories/Select.stories.js +0 -753
- package/src/stories/Sidebar.stories.js +0 -177
- package/src/stories/Slider.stories.js +0 -226
- package/src/stories/Stepper.stories.js +0 -158
- package/src/stories/Switch.stories.js +0 -72
- package/src/stories/Table.stories.js +0 -4323
- package/src/stories/TableChat.mdx +0 -992
- package/src/stories/TableChat.stories.js +0 -1712
- package/src/stories/TableOld.stories.js +0 -954
- package/src/stories/Tabs.stories.js +0 -253
- package/src/stories/Tag.stories.js +0 -92
- package/src/stories/TagGroup.stories.js +0 -39
- package/src/stories/TextArea.stories.js +0 -148
- package/src/stories/Toast.stories.js +0 -113
- package/src/stories/Tooltip.stories.js +0 -86
- package/src/stories/storybookLinks.mdx +0 -20
|
@@ -1,2175 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
forwardRef,
|
|
3
|
-
Fragment,
|
|
4
|
-
useEffect,
|
|
5
|
-
useMemo,
|
|
6
|
-
useRef,
|
|
7
|
-
useState,
|
|
8
|
-
useCallback,
|
|
9
|
-
} from "react";
|
|
10
|
-
import { LicenseManager } from "ag-grid-enterprise";
|
|
11
|
-
import { AgGridReact } from "ag-grid-react"; // React Data Grid Component
|
|
12
|
-
import { useForm } from "react-hook-form";
|
|
13
|
-
import "ag-grid-community/styles/ag-grid.css"; // Mandatory CSS required by the Data Grid
|
|
14
|
-
import "ag-grid-community/styles/ag-theme-alpine.css"; // Optional Theme applied to the Data Grid
|
|
15
|
-
import "./Table.styles.scss";
|
|
16
|
-
|
|
17
|
-
import TableHeader from "./tableHeader";
|
|
18
|
-
import AgGridHeader from "./AgGridHeader";
|
|
19
|
-
import TablePagination from "./tablePagination";
|
|
20
|
-
import {
|
|
21
|
-
getMainMenuItems,
|
|
22
|
-
Columns,
|
|
23
|
-
updateFontSizeOnToolPanel,
|
|
24
|
-
} from "./tableFunctions";
|
|
25
|
-
import TableAdvanceSearchModal from "./advanceSearchModal";
|
|
26
|
-
import { convertToOptions } from "../../utils/helper";
|
|
27
|
-
import { withCommentIcon } from "./withCommentIcon";
|
|
28
|
-
import CommentsPortal from "./CommentsPortal";
|
|
29
|
-
import { Menu } from "../Menu";
|
|
30
|
-
import { Prompt } from "../Prompt";
|
|
31
|
-
import { ReactComponent as EditIcon } from "../../assets/edit-black.svg";
|
|
32
|
-
import { ReactComponent as DeleteIcon } from "../../assets/delete-black.svg";
|
|
33
|
-
import { ReactComponent as UnreadIcon } from "../../assets/Comment.svg";
|
|
34
|
-
import { ReactComponent as ReadIcon } from "../../assets/CheckTickAll.svg";
|
|
35
|
-
import CommentPanel from "./commentPanel";
|
|
36
|
-
import NewAdvanceSearchModal from "./NewAdvanceSearchModal/NewAdvanceSearchModal";
|
|
37
|
-
import { buildAdvanceSearchFilterModel } from "./filterUtils";
|
|
38
|
-
import BulkActionBar from "./actionBar";
|
|
39
|
-
import AdvanceSortModal from "./AdvanceSortModal";
|
|
40
|
-
|
|
41
|
-
export const Table = forwardRef(
|
|
42
|
-
(
|
|
43
|
-
{
|
|
44
|
-
defaultColDef: defColDef,
|
|
45
|
-
columnDefs: colDefs,
|
|
46
|
-
tableHeader = "",
|
|
47
|
-
rowHeight: rowHei,
|
|
48
|
-
height,
|
|
49
|
-
topRightOptions,
|
|
50
|
-
topLeftOptions,
|
|
51
|
-
onGlobalSearchClick,
|
|
52
|
-
paginationPageSizeSelector = [10, 20, 50, 100],
|
|
53
|
-
defaultPageSize,
|
|
54
|
-
onNumberFormatChange = () => {},
|
|
55
|
-
onColumnSearchClick,
|
|
56
|
-
tableActionOptions,
|
|
57
|
-
bottomLeftOptions,
|
|
58
|
-
cardContainer = true,
|
|
59
|
-
hideRowHeightOptionMenu = false,
|
|
60
|
-
onPaginationChanged = () => {},
|
|
61
|
-
showDownloadButton = false,
|
|
62
|
-
onDownloadButtonClick = () => {},
|
|
63
|
-
nestedTable = false,
|
|
64
|
-
nestedTableComponent = null,
|
|
65
|
-
closeButton = false,
|
|
66
|
-
handleCloseButtonClick,
|
|
67
|
-
additionalButtons,
|
|
68
|
-
applySort,
|
|
69
|
-
onFilterChanged,
|
|
70
|
-
sortModel,
|
|
71
|
-
onSearchApplyClick,
|
|
72
|
-
gridId,
|
|
73
|
-
showHideEditableCells = false,
|
|
74
|
-
handleShowHideEditableCells = () => {},
|
|
75
|
-
topCenterOptions,
|
|
76
|
-
bottomCenterOptions,
|
|
77
|
-
toShowDuplicateColumnInAdvanceSearch = false,
|
|
78
|
-
savedAdvanceSearchConfig,
|
|
79
|
-
handleInlineSearch,
|
|
80
|
-
showContentualFilter = false,
|
|
81
|
-
showContentualFilterBadge = false,
|
|
82
|
-
onContentualFilterClick = () => {},
|
|
83
|
-
contentualFilterProps,
|
|
84
|
-
contentualFilterComponent,
|
|
85
|
-
onAdvanceSearchClick,
|
|
86
|
-
tableActions,
|
|
87
|
-
customGetMainMenuItems,
|
|
88
|
-
hidePaginationPageSizeSelector = false,
|
|
89
|
-
onTableActionsTabClick,
|
|
90
|
-
hideTableFormat = false,
|
|
91
|
-
hideTableActions = false,
|
|
92
|
-
handleClearSearchInline,
|
|
93
|
-
aboveTableComponent: belowHeaderComponent,
|
|
94
|
-
hideTableSetting = false,
|
|
95
|
-
explicitlyCloseTableSetting = false,
|
|
96
|
-
handleCloseInputField,
|
|
97
|
-
customHeaderComponent,
|
|
98
|
-
debounceTime = 1500,
|
|
99
|
-
hideMarginBottom = false,
|
|
100
|
-
customSystemButton,
|
|
101
|
-
isChatEnabled = false,
|
|
102
|
-
handleChatClick = () => {},
|
|
103
|
-
isChatOpen = false,
|
|
104
|
-
handleChatClose = () => {},
|
|
105
|
-
chatConfiguration,
|
|
106
|
-
savedViewsOptions,
|
|
107
|
-
handleSaveAndApply = () => {},
|
|
108
|
-
maxSavedViews = 50,
|
|
109
|
-
handleSavedViewClick = () => {},
|
|
110
|
-
handleEditSaveView = () => {},
|
|
111
|
-
isSaveViewEnabled = false,
|
|
112
|
-
isSaveViewLoading = false,
|
|
113
|
-
handleDeleteViewClick = () => {},
|
|
114
|
-
isDeleteViewLoading = false,
|
|
115
|
-
handleSetDefaultView = () => {},
|
|
116
|
-
isCommentFeatureEnabled = false,
|
|
117
|
-
commentProps,
|
|
118
|
-
hideFontSize = false,
|
|
119
|
-
hideNumericFormat = false,
|
|
120
|
-
onContentDensityChange,
|
|
121
|
-
handleCommentNotification,
|
|
122
|
-
customTabInTableSettings = null,
|
|
123
|
-
closeTableSettingOnOutsideClick = false,
|
|
124
|
-
saveViewCustomFilter = {
|
|
125
|
-
options: [
|
|
126
|
-
{ label: "Global", value: "global" },
|
|
127
|
-
{ label: "Personal", value: "personal" },
|
|
128
|
-
],
|
|
129
|
-
selectedOption: "global",
|
|
130
|
-
},
|
|
131
|
-
customRenderSaveViewContent = null,
|
|
132
|
-
hideTableBody = false,
|
|
133
|
-
onTableSettingClick = () => {},
|
|
134
|
-
deleteViewPromptText,
|
|
135
|
-
contentualFilterOpenByDefault = false,
|
|
136
|
-
tableSettingsTitle,
|
|
137
|
-
enableHeaderTextWrap = true,
|
|
138
|
-
numericFormatDefault = "full_no",
|
|
139
|
-
defaultFontSize = "medium",
|
|
140
|
-
viewPoint = "",
|
|
141
|
-
disableContextualFilter = false,
|
|
142
|
-
disableTableSettings = false,
|
|
143
|
-
showBulkActionBar = false,
|
|
144
|
-
bulkActionBarProps = {
|
|
145
|
-
actionBarLabel: "",
|
|
146
|
-
enableSelectAll: true,
|
|
147
|
-
totalRowCount: 0,
|
|
148
|
-
},
|
|
149
|
-
onSelectAllRows = () => {},
|
|
150
|
-
onClearSelection = () => {},
|
|
151
|
-
onSortChanged = () => {},
|
|
152
|
-
advanceSortEnabled = false,
|
|
153
|
-
...args
|
|
154
|
-
},
|
|
155
|
-
ref
|
|
156
|
-
) => {
|
|
157
|
-
LicenseManager.setLicenseKey(
|
|
158
|
-
"Using_this_{AG_Grid}_Enterprise_key_{AG-072820}_in_excess_of_the_licence_granted_is_not_permitted___Please_report_misuse_to_legal@ag-grid.com___For_help_with_changing_this_key_please_contact_info@ag-grid.com___{Impact_Analytics}_is_granted_a_{Multiple_Applications}_Developer_License_for_{1}_Front-End_JavaScript_developer___All_Front-End_JavaScript_developers_need_to_be_licensed_in_addition_to_the_ones_working_with_{AG_Grid}_Enterprise___This_key_has_not_been_granted_a_Deployment_License_Add-on___This_key_works_with_{AG_Grid}_Enterprise_versions_released_before_{31_December_2025}____[v3]_[01]_MTc2NzEzOTIwMDAwMA==acb63fc998feb69e3a3ca9ad323b2577"
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
const tempRef = useRef();
|
|
162
|
-
const actualRef = ref || tempRef;
|
|
163
|
-
const [localPageSize, setLocalPageSize] = useState(
|
|
164
|
-
defaultPageSize || paginationPageSizeSelector[0]
|
|
165
|
-
);
|
|
166
|
-
const [initialFilters, setInitialFilters] = useState([]);
|
|
167
|
-
const [tableSettingOpen, setTableSettingOpen] = useState(false);
|
|
168
|
-
|
|
169
|
-
const [rowHeight, setRowHeight] = useState(
|
|
170
|
-
rowHei === "comfort" ? 52 : rowHei === "compact" ? 30 : 46
|
|
171
|
-
);
|
|
172
|
-
|
|
173
|
-
useEffect(() => {
|
|
174
|
-
let newRowHeight;
|
|
175
|
-
if (typeof rowHei === "number") {
|
|
176
|
-
newRowHeight = rowHei;
|
|
177
|
-
} else if (rowHei === "comfort") {
|
|
178
|
-
newRowHeight = 52;
|
|
179
|
-
} else if (rowHei === "compact") {
|
|
180
|
-
newRowHeight = 30;
|
|
181
|
-
} else {
|
|
182
|
-
newRowHeight = 46;
|
|
183
|
-
}
|
|
184
|
-
setRowHeight(newRowHeight);
|
|
185
|
-
if (actualRef?.current?.api) {
|
|
186
|
-
setTimeout(() => {
|
|
187
|
-
actualRef.current.api.resetRowHeights();
|
|
188
|
-
}, 0);
|
|
189
|
-
}
|
|
190
|
-
}, [rowHei, actualRef]);
|
|
191
|
-
|
|
192
|
-
const [tableFontSize, setTableFontSize] = useState(
|
|
193
|
-
defaultFontSize || "medium"
|
|
194
|
-
);
|
|
195
|
-
const buttonRef = useRef(null);
|
|
196
|
-
const nestedTableRef = useRef(null);
|
|
197
|
-
const [isAdvanceSearch, setAdvanceSearch] = useState(false);
|
|
198
|
-
const [isAdvanceSortOpen, setIsAdvanceSortOpen] = useState(false);
|
|
199
|
-
const [advanceSortState, setAdvanceSortState] = useState([]);
|
|
200
|
-
const [currentColumnId, setCurrentColumnId] = useState(null);
|
|
201
|
-
const [draftFilter, setDraftFilter] = useState([]);
|
|
202
|
-
const [showCommentPanel, setShowCommentPanel] = useState(false);
|
|
203
|
-
const [
|
|
204
|
-
selectedThirdOptionDropdownValue,
|
|
205
|
-
setSelectedThirdOptionDropdownValue,
|
|
206
|
-
] = useState(null);
|
|
207
|
-
const filteredColumnsInitialOptions = useMemo(
|
|
208
|
-
() => convertToOptions(colDefs || []),
|
|
209
|
-
[colDefs]
|
|
210
|
-
);
|
|
211
|
-
const formMethods = useForm({
|
|
212
|
-
defaultValues: { filters: initialFilters },
|
|
213
|
-
});
|
|
214
|
-
const { getValues, setValue, reset } = formMethods;
|
|
215
|
-
|
|
216
|
-
const toggleAdvanceSearch = (colId, searchTxt) => {
|
|
217
|
-
setAdvanceSearch((prev) => !prev);
|
|
218
|
-
|
|
219
|
-
if (savedAdvanceSearchConfig?.length > 0) {
|
|
220
|
-
setInitialFilters(savedAdvanceSearchConfig);
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
if (Array.isArray(colId)) {
|
|
225
|
-
// Handle multiple fields
|
|
226
|
-
setCurrentColumnId(colId[0] || null); // You can pick the first one for UI reference
|
|
227
|
-
|
|
228
|
-
setInitialFilters((prev) => {
|
|
229
|
-
const newFilters = [...prev];
|
|
230
|
-
|
|
231
|
-
colId.forEach((id) => {
|
|
232
|
-
const isColumnHave = newFilters.find(
|
|
233
|
-
(filter) =>
|
|
234
|
-
filter?.column?.value === id && filter?.column !== null
|
|
235
|
-
);
|
|
236
|
-
|
|
237
|
-
if (!isColumnHave) {
|
|
238
|
-
const columnOption = filteredColumnsInitialOptions?.find(
|
|
239
|
-
(opt) => opt?.value === id
|
|
240
|
-
);
|
|
241
|
-
|
|
242
|
-
if (columnOption) {
|
|
243
|
-
newFilters.push({
|
|
244
|
-
column: columnOption,
|
|
245
|
-
operation: null,
|
|
246
|
-
value: "",
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
return newFilters;
|
|
253
|
-
});
|
|
254
|
-
} else if (typeof colId === "string" || typeof colId === "number") {
|
|
255
|
-
// Handle single field
|
|
256
|
-
setCurrentColumnId(colId || null);
|
|
257
|
-
|
|
258
|
-
setInitialFilters((prev) => {
|
|
259
|
-
const cleaned = prev.filter((f) => f.column !== null); // 🧹 clean up leftover blank fields
|
|
260
|
-
|
|
261
|
-
const isColumnHave = cleaned.find(
|
|
262
|
-
(filter) => filter?.column?.value === colId
|
|
263
|
-
);
|
|
264
|
-
|
|
265
|
-
if (isColumnHave) return cleaned;
|
|
266
|
-
|
|
267
|
-
const columnOption = filteredColumnsInitialOptions?.find(
|
|
268
|
-
(opt) => opt?.value === colId
|
|
269
|
-
);
|
|
270
|
-
return [
|
|
271
|
-
...cleaned,
|
|
272
|
-
columnOption
|
|
273
|
-
? {
|
|
274
|
-
column: columnOption,
|
|
275
|
-
operation:
|
|
276
|
-
searchTxt?.length > 0
|
|
277
|
-
? { label: "Contains", value: "contains" }
|
|
278
|
-
: "",
|
|
279
|
-
value: searchTxt,
|
|
280
|
-
}
|
|
281
|
-
: {},
|
|
282
|
-
];
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
const toggleNewAdvanceSearch = (colId, searchTxt) => {
|
|
288
|
-
setAdvanceSearch((prev) => !prev);
|
|
289
|
-
|
|
290
|
-
if (savedAdvanceSearchConfig?.length > 0) {
|
|
291
|
-
setInitialFilters(savedAdvanceSearchConfig);
|
|
292
|
-
return;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
if (Array.isArray(colId)) {
|
|
296
|
-
// Handle multiple fields
|
|
297
|
-
setCurrentColumnId(colId[0] || null); // You can pick the first one for UI reference
|
|
298
|
-
|
|
299
|
-
setInitialFilters((prev) => {
|
|
300
|
-
const newFilters = [...prev];
|
|
301
|
-
|
|
302
|
-
colId.forEach((id) => {
|
|
303
|
-
const isColumnHave = newFilters.find(
|
|
304
|
-
(filter) =>
|
|
305
|
-
filter?.column?.value === id && filter?.column !== null
|
|
306
|
-
);
|
|
307
|
-
|
|
308
|
-
if (!isColumnHave) {
|
|
309
|
-
const columnOption = filteredColumnsInitialOptions?.find(
|
|
310
|
-
(opt) => opt?.value === id
|
|
311
|
-
);
|
|
312
|
-
|
|
313
|
-
if (columnOption) {
|
|
314
|
-
newFilters.push({
|
|
315
|
-
column: columnOption,
|
|
316
|
-
operation: null,
|
|
317
|
-
value: "",
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
return newFilters;
|
|
324
|
-
});
|
|
325
|
-
} else if (typeof colId === "string" || typeof colId === "number") {
|
|
326
|
-
setCurrentColumnId(colId || null);
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
useEffect(() => {
|
|
331
|
-
if (defaultFontSize) setTableFontSize(defaultFontSize);
|
|
332
|
-
}, [defaultFontSize]);
|
|
333
|
-
|
|
334
|
-
const updateExpandState = useCallback(
|
|
335
|
-
(params) => {
|
|
336
|
-
let allExpanded = true;
|
|
337
|
-
let hasGroups = false;
|
|
338
|
-
|
|
339
|
-
params.api.forEachNode((node) => {
|
|
340
|
-
if (node.group) {
|
|
341
|
-
hasGroups = true;
|
|
342
|
-
if (!node.expanded) {
|
|
343
|
-
allExpanded = false;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
if (hasGroups) {
|
|
349
|
-
actualRef.current.api.getModel().isExpand = allExpanded;
|
|
350
|
-
}
|
|
351
|
-
},
|
|
352
|
-
[actualRef]
|
|
353
|
-
);
|
|
354
|
-
|
|
355
|
-
const selectColumn = useCallback(
|
|
356
|
-
(cols) => {
|
|
357
|
-
actualRef?.current.api.clearRangeSelection();
|
|
358
|
-
actualRef?.current.api.addCellRange({ columns: cols });
|
|
359
|
-
},
|
|
360
|
-
[actualRef]
|
|
361
|
-
);
|
|
362
|
-
|
|
363
|
-
const AgGridHeaderWrapper = useCallback(
|
|
364
|
-
(props) => {
|
|
365
|
-
const {
|
|
366
|
-
selectColumn,
|
|
367
|
-
onColumnSearchClick,
|
|
368
|
-
applySort,
|
|
369
|
-
onFilterChanged,
|
|
370
|
-
sortModel,
|
|
371
|
-
toggleAdvanceSearch,
|
|
372
|
-
onAdvanceSearchClick,
|
|
373
|
-
handleInlineSearch,
|
|
374
|
-
handleClearSearchInline,
|
|
375
|
-
handleCloseInputField,
|
|
376
|
-
debounceTime,
|
|
377
|
-
headerComponent,
|
|
378
|
-
...rest
|
|
379
|
-
} = props;
|
|
380
|
-
return (
|
|
381
|
-
<AgGridHeader
|
|
382
|
-
{...rest}
|
|
383
|
-
sortModel={sortModel}
|
|
384
|
-
onClick={() => selectColumn?.([rest?.column?.colId])}
|
|
385
|
-
onColumnSearchClick={onColumnSearchClick}
|
|
386
|
-
applySort={applySort}
|
|
387
|
-
onFilterChanged={onFilterChanged}
|
|
388
|
-
toggleAdvanceSearch={toggleAdvanceSearch}
|
|
389
|
-
onAdvanceSearchClick={onAdvanceSearchClick}
|
|
390
|
-
handleInlineSearch={handleInlineSearch}
|
|
391
|
-
handleClearSearchInline={handleClearSearchInline}
|
|
392
|
-
handleCloseInputField={handleCloseInputField}
|
|
393
|
-
debounceTime={debounceTime}
|
|
394
|
-
getValues={getValues}
|
|
395
|
-
setValue={setValue}
|
|
396
|
-
initialFilters={initialFilters}
|
|
397
|
-
setInitialFilters={setInitialFilters}
|
|
398
|
-
colDefs={colDefs}
|
|
399
|
-
enableHeaderTextWrap={enableHeaderTextWrap}
|
|
400
|
-
>
|
|
401
|
-
{headerComponent ? headerComponent(props) : rest?.displayName}
|
|
402
|
-
</AgGridHeader>
|
|
403
|
-
);
|
|
404
|
-
},
|
|
405
|
-
[
|
|
406
|
-
getValues,
|
|
407
|
-
setValue,
|
|
408
|
-
initialFilters,
|
|
409
|
-
setInitialFilters,
|
|
410
|
-
colDefs,
|
|
411
|
-
onColumnSearchClick,
|
|
412
|
-
applySort,
|
|
413
|
-
onFilterChanged,
|
|
414
|
-
toggleAdvanceSearch,
|
|
415
|
-
onAdvanceSearchClick,
|
|
416
|
-
handleInlineSearch,
|
|
417
|
-
handleClearSearchInline,
|
|
418
|
-
handleCloseInputField,
|
|
419
|
-
debounceTime,
|
|
420
|
-
selectColumn,
|
|
421
|
-
enableHeaderTextWrap,
|
|
422
|
-
]
|
|
423
|
-
);
|
|
424
|
-
|
|
425
|
-
const defaultColDef = useMemo(() => {
|
|
426
|
-
return {
|
|
427
|
-
...defColDef,
|
|
428
|
-
filter: true,
|
|
429
|
-
resizable: true,
|
|
430
|
-
cellClassRules: {
|
|
431
|
-
"editable-ag-cell": (params) => params.colDef.editable,
|
|
432
|
-
"number-cell": (params) => params.colDef.type === "number",
|
|
433
|
-
"default-cell": () => rowHeight === 46,
|
|
434
|
-
"compact-cell": () => rowHeight === 30,
|
|
435
|
-
"comfort-cell": () => rowHeight !== 46 && rowHeight !== 30,
|
|
436
|
-
},
|
|
437
|
-
};
|
|
438
|
-
}, [defColDef, rowHeight]);
|
|
439
|
-
|
|
440
|
-
const addSpecialAttributes = useCallback(
|
|
441
|
-
(children) => {
|
|
442
|
-
return children.map((child) => {
|
|
443
|
-
const obj = {
|
|
444
|
-
...child,
|
|
445
|
-
headerClass:
|
|
446
|
-
(child.headerClass || "") +
|
|
447
|
-
(child.type === "number" ? " number-cell" : ""),
|
|
448
|
-
width:
|
|
449
|
-
child.checkboxSelection || child.headerCheckboxSelection
|
|
450
|
-
? viewPoint === "list"
|
|
451
|
-
? "48px"
|
|
452
|
-
: "40px"
|
|
453
|
-
: child.width || undefined,
|
|
454
|
-
headerComponentParams: {
|
|
455
|
-
...child?.headerComponentParams,
|
|
456
|
-
viewPoint,
|
|
457
|
-
selectColumn,
|
|
458
|
-
onColumnSearchClick,
|
|
459
|
-
applySort,
|
|
460
|
-
onFilterChanged,
|
|
461
|
-
sortModel,
|
|
462
|
-
toggleAdvanceSearch,
|
|
463
|
-
onAdvanceSearchClick,
|
|
464
|
-
handleInlineSearch,
|
|
465
|
-
handleClearSearchInline,
|
|
466
|
-
handleCloseInputField,
|
|
467
|
-
debounceTime,
|
|
468
|
-
getValues,
|
|
469
|
-
setValue,
|
|
470
|
-
initialFilters,
|
|
471
|
-
setInitialFilters,
|
|
472
|
-
colDefs,
|
|
473
|
-
headerComponent: child?.headerComponent,
|
|
474
|
-
},
|
|
475
|
-
headerComponent: customHeaderComponent
|
|
476
|
-
? customHeaderComponent
|
|
477
|
-
: AgGridHeaderWrapper,
|
|
478
|
-
};
|
|
479
|
-
// Automatically add filterParams comparator for date columns if not already present
|
|
480
|
-
if (
|
|
481
|
-
child.filter === "agDateColumnFilter" &&
|
|
482
|
-
!child.filterParams?.comparator
|
|
483
|
-
) {
|
|
484
|
-
obj.filterParams = {
|
|
485
|
-
...child.filterParams,
|
|
486
|
-
// Enable all filter buttons/operators
|
|
487
|
-
buttons: ["apply", "clear", "reset"],
|
|
488
|
-
// Explicitly enable all date filter options
|
|
489
|
-
filterOptions: [
|
|
490
|
-
"equals",
|
|
491
|
-
"notEqual",
|
|
492
|
-
"lessThan",
|
|
493
|
-
"lessThanOrEqual",
|
|
494
|
-
"greaterThan",
|
|
495
|
-
"greaterThanOrEqual",
|
|
496
|
-
"inRange",
|
|
497
|
-
],
|
|
498
|
-
// Suppress the filter options UI (we're using advance search)
|
|
499
|
-
suppressAndOrCondition: true,
|
|
500
|
-
// Add comparator for date comparison
|
|
501
|
-
comparator: (filterLocalDateAtMidnight, cellValue) => {
|
|
502
|
-
if (!cellValue) return -1;
|
|
503
|
-
const cellDate = new Date(cellValue);
|
|
504
|
-
cellDate.setHours(0, 0, 0, 0);
|
|
505
|
-
if (cellDate < filterLocalDateAtMidnight) return -1;
|
|
506
|
-
if (cellDate > filterLocalDateAtMidnight) return 1;
|
|
507
|
-
return 0;
|
|
508
|
-
},
|
|
509
|
-
};
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
if (child.children) {
|
|
513
|
-
obj.children = addSpecialAttributes(child.children);
|
|
514
|
-
}
|
|
515
|
-
return obj;
|
|
516
|
-
});
|
|
517
|
-
},
|
|
518
|
-
[rowHeight]
|
|
519
|
-
);
|
|
520
|
-
|
|
521
|
-
const [commentMode, setCommentMode] = useState(false);
|
|
522
|
-
|
|
523
|
-
// Function to wrap components in the components prop with withCommentIcon
|
|
524
|
-
const wrapComponentsWithCommentIcon = (components) => {
|
|
525
|
-
// Defensive check to ensure components is a valid object
|
|
526
|
-
if (!components || typeof components !== "object") {
|
|
527
|
-
return components;
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
const wrappedComponents = {};
|
|
531
|
-
Object.keys(components).forEach((key) => {
|
|
532
|
-
const Component = components[key];
|
|
533
|
-
if (typeof Component === "function") {
|
|
534
|
-
wrappedComponents[key] = withCommentIcon(Component);
|
|
535
|
-
} else {
|
|
536
|
-
wrappedComponents[key] = Component;
|
|
537
|
-
}
|
|
538
|
-
});
|
|
539
|
-
|
|
540
|
-
return wrappedComponents;
|
|
541
|
-
};
|
|
542
|
-
|
|
543
|
-
// Recursive function to apply withCommentIcon to all columns, including nested ones
|
|
544
|
-
const applyCommentIconToColumns = (colDefs) => {
|
|
545
|
-
// Only apply comment icon wrapping if the comment feature is enabled
|
|
546
|
-
if (!isCommentFeatureEnabled) {
|
|
547
|
-
return colDefs;
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
return colDefs?.map((col) => {
|
|
551
|
-
if (col.children) {
|
|
552
|
-
// If it has children, recursively apply to nested columns
|
|
553
|
-
return {
|
|
554
|
-
...col,
|
|
555
|
-
children: applyCommentIconToColumns(col.children),
|
|
556
|
-
};
|
|
557
|
-
} else {
|
|
558
|
-
// If it's a leaf node, apply withCommentIcon wrapper to ALL cells
|
|
559
|
-
// Handle different cellRenderer scenarios:
|
|
560
|
-
// 1. No cellRenderer (normal cells) → wrap with withCommentIcon(undefined)
|
|
561
|
-
// 2. Function/object cellRenderer → wrap with withCommentIcon(cellRenderer)
|
|
562
|
-
// 3. String cellRenderer → leave untouched (handled by components prop)
|
|
563
|
-
|
|
564
|
-
const isStringRenderer = typeof col.cellRenderer === "string";
|
|
565
|
-
|
|
566
|
-
return {
|
|
567
|
-
...col,
|
|
568
|
-
cellRenderer: isStringRenderer
|
|
569
|
-
? col.cellRenderer // Leave string references untouched for AG Grid to resolve
|
|
570
|
-
: withCommentIcon(col.cellRenderer), // Wrap all others (including undefined/null)
|
|
571
|
-
};
|
|
572
|
-
}
|
|
573
|
-
});
|
|
574
|
-
};
|
|
575
|
-
|
|
576
|
-
const columnDefs = useMemo(() => {
|
|
577
|
-
// Removed imperative setGridOption here as it conflicts with standard React flow
|
|
578
|
-
// and defaultColDef now handles the context injection.
|
|
579
|
-
return addSpecialAttributes(colDefs);
|
|
580
|
-
}, [colDefs, addSpecialAttributes]);
|
|
581
|
-
|
|
582
|
-
// Compute final column definitions once, based on props and local settings
|
|
583
|
-
const finalColumnDefs = useMemo(() => {
|
|
584
|
-
if (!columnDefs || columnDefs.length === 0) {
|
|
585
|
-
return null;
|
|
586
|
-
}
|
|
587
|
-
const applyStyleRecursively = (columns) =>
|
|
588
|
-
columns?.map((column) => {
|
|
589
|
-
if (Array.isArray(column.children)) {
|
|
590
|
-
return {
|
|
591
|
-
...column,
|
|
592
|
-
children: applyStyleRecursively(column.children),
|
|
593
|
-
};
|
|
594
|
-
}
|
|
595
|
-
if (column?.field === "Selection") {
|
|
596
|
-
return column;
|
|
597
|
-
}
|
|
598
|
-
const originalCellStyle = column.cellStyle;
|
|
599
|
-
return {
|
|
600
|
-
...column,
|
|
601
|
-
cellStyle: (params) => {
|
|
602
|
-
const baseStyle =
|
|
603
|
-
typeof originalCellStyle === "function"
|
|
604
|
-
? originalCellStyle(params)
|
|
605
|
-
: originalCellStyle || {};
|
|
606
|
-
return {
|
|
607
|
-
...baseStyle,
|
|
608
|
-
fontSize: updateFontSizeOnToolPanel(tableFontSize),
|
|
609
|
-
};
|
|
610
|
-
},
|
|
611
|
-
};
|
|
612
|
-
});
|
|
613
|
-
let computed = actualRef?.current?.api?.getColumnDefs() || columnDefs;
|
|
614
|
-
if (tableFontSize) {
|
|
615
|
-
computed = applyStyleRecursively(columnDefs);
|
|
616
|
-
const existingAutoGroup =
|
|
617
|
-
actualRef?.current?.api?.getGridOption?.("autoGroupColumnDef") || {};
|
|
618
|
-
const existingCellStyle = existingAutoGroup?.cellStyle;
|
|
619
|
-
actualRef?.current?.api?.setGridOption("autoGroupColumnDef", {
|
|
620
|
-
...existingAutoGroup,
|
|
621
|
-
cellStyle: (params) => {
|
|
622
|
-
const baseStyle =
|
|
623
|
-
typeof existingCellStyle === "function"
|
|
624
|
-
? existingCellStyle(params)
|
|
625
|
-
: existingCellStyle || {};
|
|
626
|
-
return {
|
|
627
|
-
...baseStyle,
|
|
628
|
-
fontSize: updateFontSizeOnToolPanel(tableFontSize),
|
|
629
|
-
};
|
|
630
|
-
},
|
|
631
|
-
});
|
|
632
|
-
}
|
|
633
|
-
computed = applyCommentIconToColumns(computed);
|
|
634
|
-
if (actualRef?.current?.api)
|
|
635
|
-
actualRef.current.api.getModel().appliedFontSize = tableFontSize;
|
|
636
|
-
return computed;
|
|
637
|
-
}, [columnDefs, tableFontSize]);
|
|
638
|
-
|
|
639
|
-
const onFirstDataRendered = (params) => {
|
|
640
|
-
if (params?.api) params.api.getModel().appliedFontSize = tableFontSize;
|
|
641
|
-
args?.onFirstDataRendered?.(params);
|
|
642
|
-
};
|
|
643
|
-
|
|
644
|
-
// Memoize wrapped components to avoid unnecessary re-renders
|
|
645
|
-
const wrappedComponents = useMemo(() => {
|
|
646
|
-
// Only process components if comment feature is enabled
|
|
647
|
-
if (!isCommentFeatureEnabled || !args?.components) {
|
|
648
|
-
return args?.components;
|
|
649
|
-
}
|
|
650
|
-
return wrapComponentsWithCommentIcon(args?.components);
|
|
651
|
-
}, [args?.components, isCommentFeatureEnabled]);
|
|
652
|
-
|
|
653
|
-
const setDynmaicStyleToButtonComponent = useCallback(() => {
|
|
654
|
-
const span1 = document.querySelector(".ag-paging-row-summary-panel");
|
|
655
|
-
const span2 = document.querySelector(".ag-paging-page-summary-panel");
|
|
656
|
-
if (span1 || span2) {
|
|
657
|
-
let actualWidth =
|
|
658
|
-
(span1?.offsetWidth || 0) + (span2?.offsetWidth || 0) + 20;
|
|
659
|
-
if (buttonRef?.current) {
|
|
660
|
-
buttonRef.current.style.right = `${actualWidth}px`;
|
|
661
|
-
if (tableSettingOpen) {
|
|
662
|
-
buttonRef.current.style.right = `${actualWidth + 375}px`;
|
|
663
|
-
} else {
|
|
664
|
-
buttonRef.current.style.right = `${actualWidth}px`;
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
}, [buttonRef, tableSettingOpen]);
|
|
669
|
-
|
|
670
|
-
const paginationChanged = useCallback(
|
|
671
|
-
(params) => {
|
|
672
|
-
setDynmaicStyleToButtonComponent();
|
|
673
|
-
onPaginationChanged(params);
|
|
674
|
-
},
|
|
675
|
-
[setDynmaicStyleToButtonComponent, onPaginationChanged]
|
|
676
|
-
);
|
|
677
|
-
|
|
678
|
-
useEffect(() => {
|
|
679
|
-
setDynmaicStyleToButtonComponent();
|
|
680
|
-
const div = document.querySelector(".ag-root-wrapper-body");
|
|
681
|
-
if (div) {
|
|
682
|
-
let actualHeight = div.offsetHeight;
|
|
683
|
-
let tableContainer = document.querySelector(`#${gridId || "myGrid"}`);
|
|
684
|
-
if (tableSettingOpen || commentMode) {
|
|
685
|
-
if (actualHeight < 480) {
|
|
686
|
-
if (tableContainer) {
|
|
687
|
-
tableContainer.style.height = `551px`;
|
|
688
|
-
if (buttonRef && buttonRef.current)
|
|
689
|
-
buttonRef.current.style.bottom = `${480 - actualHeight - 37}px`;
|
|
690
|
-
}
|
|
691
|
-
} else {
|
|
692
|
-
const panelEl = document.querySelector(
|
|
693
|
-
tableSettingOpen
|
|
694
|
-
? ".display-table-setting"
|
|
695
|
-
: ".display-comment-panel"
|
|
696
|
-
);
|
|
697
|
-
if (panelEl) {
|
|
698
|
-
panelEl.style.height = `${actualHeight}px`;
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
} else {
|
|
702
|
-
if (tableContainer) tableContainer.style.height = `unset`;
|
|
703
|
-
if (buttonRef && buttonRef.current)
|
|
704
|
-
buttonRef.current.style.bottom = `13px`;
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
}, [tableSettingOpen, commentMode, cardContainer]);
|
|
708
|
-
|
|
709
|
-
useEffect(() => {
|
|
710
|
-
if (nestedTable && nestedTableRef.current) {
|
|
711
|
-
const rect = nestedTableRef.current.getBoundingClientRect();
|
|
712
|
-
setTimeout(() => {
|
|
713
|
-
window.scrollTo({
|
|
714
|
-
top: rect.top,
|
|
715
|
-
behavior: "smooth",
|
|
716
|
-
});
|
|
717
|
-
}, 100);
|
|
718
|
-
}
|
|
719
|
-
}, [nestedTable]);
|
|
720
|
-
|
|
721
|
-
const onSearchApplyClicks = (formValues) => {
|
|
722
|
-
// Guard against undefined formValues
|
|
723
|
-
if (!formValues || !Array.isArray(formValues)) {
|
|
724
|
-
console.warn(
|
|
725
|
-
"onSearchApplyClicks: formValues is undefined or not an array"
|
|
726
|
-
);
|
|
727
|
-
return;
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
// If formValues is empty (cleared all), set to empty filter format
|
|
731
|
-
// Otherwise, set to the actual filters
|
|
732
|
-
if (formValues?.length === 0) {
|
|
733
|
-
setInitialFilters([{ column: null, operation: null, value: "" }]);
|
|
734
|
-
} else {
|
|
735
|
-
setInitialFilters([...formValues]);
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
const rest = actualRef?.current;
|
|
739
|
-
if (!rest?.api) {
|
|
740
|
-
console.warn("onSearchApplyClicks: AG Grid API not available");
|
|
741
|
-
return;
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
// Build filter model using utility function
|
|
745
|
-
const filterModel = buildAdvanceSearchFilterModel(formValues, colDefs);
|
|
746
|
-
|
|
747
|
-
// Set filter model on AG Grid
|
|
748
|
-
rest.api.setFilterModel(filterModel);
|
|
749
|
-
|
|
750
|
-
// For server-side tables, trigger callback with formValues
|
|
751
|
-
if (onSearchApplyClick) {
|
|
752
|
-
onSearchApplyClick(formValues);
|
|
753
|
-
} else {
|
|
754
|
-
// For client-side tables, trigger filter changed event
|
|
755
|
-
rest.api.onFilterChanged();
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
// Handle empty state overlay after filters are applied
|
|
759
|
-
setTimeout(() => {
|
|
760
|
-
if (rest?.api) {
|
|
761
|
-
const displayedRowCount = rest.api.getDisplayedRowCount();
|
|
762
|
-
if (displayedRowCount === 0) {
|
|
763
|
-
rest.api.showNoRowsOverlay();
|
|
764
|
-
} else {
|
|
765
|
-
rest.api.hideOverlay();
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
}, 100); // Small delay to ensure filters are processed
|
|
769
|
-
|
|
770
|
-
toggleAdvanceSearch();
|
|
771
|
-
};
|
|
772
|
-
|
|
773
|
-
const handleAdvanceSortApply = useCallback(
|
|
774
|
-
(rows) => {
|
|
775
|
-
const state = rows.map((row, i) => ({
|
|
776
|
-
colId: row.colId,
|
|
777
|
-
sort: row.order,
|
|
778
|
-
sortIndex: i,
|
|
779
|
-
}));
|
|
780
|
-
setAdvanceSortState(state);
|
|
781
|
-
actualRef.current?.api?.applyColumnState({
|
|
782
|
-
state,
|
|
783
|
-
});
|
|
784
|
-
setIsAdvanceSortOpen(false);
|
|
785
|
-
},
|
|
786
|
-
[actualRef]
|
|
787
|
-
);
|
|
788
|
-
|
|
789
|
-
const onGridSortChanged = useCallback((params) => {
|
|
790
|
-
const colState = params?.api?.getColumnState() ?? [];
|
|
791
|
-
const sorted = colState
|
|
792
|
-
.filter((c) => c.sort != null)
|
|
793
|
-
.sort((a, b) => (a.sortIndex ?? 0) - (b.sortIndex ?? 0))
|
|
794
|
-
.map((c) => ({ colId: c.colId, sort: c.sort, sortIndex: c.sortIndex }));
|
|
795
|
-
setAdvanceSortState(sorted);
|
|
796
|
-
onSortChanged?.(params);
|
|
797
|
-
}, []);
|
|
798
|
-
|
|
799
|
-
const [comments, setComments] = useState(commentProps?.comments || {});
|
|
800
|
-
const [resolvedComments, setResolvedComments] = useState(
|
|
801
|
-
commentProps?.resolvedComments || []
|
|
802
|
-
);
|
|
803
|
-
const [isCommentResolvedAlertOpen, setIsCommentResolvedAlertOpen] =
|
|
804
|
-
useState(false);
|
|
805
|
-
// Store original comments and resolvedComments before switching to "Show resolved comments"
|
|
806
|
-
// so we can restore them when user switches to another sort option
|
|
807
|
-
const commentsBeforeResolvedViewRef = useRef(null);
|
|
808
|
-
const resolvedCommentsBeforeResolvedViewRef = useRef(null);
|
|
809
|
-
useEffect(() => {
|
|
810
|
-
if (commentProps?.comments) {
|
|
811
|
-
setComments(commentProps.comments);
|
|
812
|
-
}
|
|
813
|
-
if (commentProps?.resolvedComments) {
|
|
814
|
-
setResolvedComments(commentProps.resolvedComments);
|
|
815
|
-
}
|
|
816
|
-
}, [commentProps]);
|
|
817
|
-
|
|
818
|
-
// Create a memoized function to prevent infinite re-renders
|
|
819
|
-
const triggerCommentClick = useCallback(
|
|
820
|
-
(cellId, messageId = null) => {
|
|
821
|
-
handleCommentItemClick(cellId, comments[cellId], messageId);
|
|
822
|
-
},
|
|
823
|
-
[comments]
|
|
824
|
-
);
|
|
825
|
-
|
|
826
|
-
// Expose handleCommentItemClick to outside through handleCommentNotification prop
|
|
827
|
-
useEffect(() => {
|
|
828
|
-
if (
|
|
829
|
-
handleCommentNotification &&
|
|
830
|
-
typeof handleCommentNotification === "function"
|
|
831
|
-
) {
|
|
832
|
-
// Call the prop function and pass our memoized function
|
|
833
|
-
handleCommentNotification(triggerCommentClick);
|
|
834
|
-
}
|
|
835
|
-
}, [handleCommentNotification, triggerCommentClick]);
|
|
836
|
-
|
|
837
|
-
const [popup, setPopup] = useState(null);
|
|
838
|
-
|
|
839
|
-
useEffect(() => {
|
|
840
|
-
// Force AG Grid to refresh cell renderers when popup state changes
|
|
841
|
-
if (actualRef.current?.api) {
|
|
842
|
-
actualRef.current.api.refreshCells({
|
|
843
|
-
force: true,
|
|
844
|
-
suppressFlash: true,
|
|
845
|
-
});
|
|
846
|
-
}
|
|
847
|
-
}, [popup, resolvedComments]);
|
|
848
|
-
|
|
849
|
-
useEffect(() => {
|
|
850
|
-
const scrollableElement = document.querySelector(".ag-body-viewport");
|
|
851
|
-
const bodyElement = document.querySelector("body");
|
|
852
|
-
|
|
853
|
-
const preventScroll = (e) => {
|
|
854
|
-
// Allow scrolling inside specific scrollable areas but prevent scroll chaining
|
|
855
|
-
const portalElement = e.target.closest(".comments-portal");
|
|
856
|
-
const portalListElement = e.target.closest(".comments-portal-list");
|
|
857
|
-
const panelListElement = e.target.closest(".comment-panel-content");
|
|
858
|
-
const textareaElement = e.target.closest(".comments-textarea");
|
|
859
|
-
const tiptapEditor =
|
|
860
|
-
e.target.closest(".ProseMirror") ||
|
|
861
|
-
e.target.closest(".tiptap-editor");
|
|
862
|
-
|
|
863
|
-
// Choose the most relevant scrollable element (prioritize actual scrollable elements)
|
|
864
|
-
const scrollEl =
|
|
865
|
-
tiptapEditor ||
|
|
866
|
-
portalListElement ||
|
|
867
|
-
panelListElement ||
|
|
868
|
-
textareaElement ||
|
|
869
|
-
portalElement;
|
|
870
|
-
|
|
871
|
-
if (scrollEl) {
|
|
872
|
-
// Determine scroll direction
|
|
873
|
-
const deltaY = typeof e.deltaY === "number" ? e.deltaY : 0;
|
|
874
|
-
const scrollTop = scrollEl.scrollTop;
|
|
875
|
-
const maxScrollTop = scrollEl.scrollHeight - scrollEl.clientHeight;
|
|
876
|
-
const atTop = scrollTop <= 0;
|
|
877
|
-
const atBottom = scrollTop >= maxScrollTop - 1; // -1 as a tolerance
|
|
878
|
-
|
|
879
|
-
// If at the boundary and trying to scroll beyond, prevent default to stop bubbling to table/body
|
|
880
|
-
if ((deltaY < 0 && atTop) || (deltaY > 0 && atBottom)) {
|
|
881
|
-
e.preventDefault();
|
|
882
|
-
return;
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
// Otherwise, keep the scroll within the element and stop it from bubbling further
|
|
886
|
-
e.stopPropagation();
|
|
887
|
-
return;
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
// Outside designated areas: prevent body/table scrolling when popup is open
|
|
891
|
-
e.preventDefault();
|
|
892
|
-
};
|
|
893
|
-
|
|
894
|
-
if (popup && scrollableElement) {
|
|
895
|
-
// Disable scroll by preventing the wheel event
|
|
896
|
-
scrollableElement.addEventListener("wheel", preventScroll, {
|
|
897
|
-
passive: false,
|
|
898
|
-
});
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
if (popup && bodyElement) {
|
|
902
|
-
// Disable scroll by preventing the wheel event
|
|
903
|
-
bodyElement.addEventListener("wheel", preventScroll, {
|
|
904
|
-
passive: false,
|
|
905
|
-
});
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
// Cleanup function to re-enable scroll
|
|
909
|
-
return () => {
|
|
910
|
-
if (scrollableElement) {
|
|
911
|
-
scrollableElement.removeEventListener("wheel", preventScroll);
|
|
912
|
-
}
|
|
913
|
-
if (bodyElement) {
|
|
914
|
-
bodyElement.removeEventListener("wheel", preventScroll);
|
|
915
|
-
}
|
|
916
|
-
};
|
|
917
|
-
}, [popup]);
|
|
918
|
-
|
|
919
|
-
const calculatePopupPosition = useCallback(
|
|
920
|
-
(rect, comments = [], openedBy = "hover") => {
|
|
921
|
-
const gridEl = document.querySelector(".ag-root");
|
|
922
|
-
const popupWidth = 350; // Estimated width of the comments portal
|
|
923
|
-
const margin = 0; // No space between cell and popup as requested
|
|
924
|
-
const maxPopupHeight = 500; // Cap height for comments portal when estimating
|
|
925
|
-
|
|
926
|
-
// Use a different width when there are no comments (NoComments banner)
|
|
927
|
-
const effectivePopupWidth =
|
|
928
|
-
!comments || comments.length === 0 ? 200 : popupWidth;
|
|
929
|
-
if (!gridEl) {
|
|
930
|
-
// Fallback positioning if grid element isn't found
|
|
931
|
-
if (window.innerWidth - rect.right < effectivePopupWidth) {
|
|
932
|
-
return {
|
|
933
|
-
top: rect.top,
|
|
934
|
-
left: rect.left - effectivePopupWidth - margin,
|
|
935
|
-
side: "left",
|
|
936
|
-
};
|
|
937
|
-
}
|
|
938
|
-
return { top: rect.top, left: rect.right + margin, side: "right" };
|
|
939
|
-
}
|
|
940
|
-
|
|
941
|
-
const gridRect = gridEl.getBoundingClientRect();
|
|
942
|
-
|
|
943
|
-
// --- Vertical size estimation ---
|
|
944
|
-
// Calculate popup height based on three states
|
|
945
|
-
let popupHeight;
|
|
946
|
-
if (!comments || comments.length === 0) {
|
|
947
|
-
// Case 1: No comments - NoComments banner height (approximate from styles)
|
|
948
|
-
popupHeight = 20;
|
|
949
|
-
} else if (openedBy === "hover") {
|
|
950
|
-
// Case 2: Collapsed state (hover) - shows only first comment preview
|
|
951
|
-
const firstComment = comments[0];
|
|
952
|
-
const baseHeight = 30; // Minimum height for avatar, author, timestamp
|
|
953
|
-
const maxHeight = 150; // Maximum height cap for hover
|
|
954
|
-
if (firstComment && firstComment.text) {
|
|
955
|
-
// Estimate text height based on character count (~45 chars/line, ~20px per line)
|
|
956
|
-
const textLength = firstComment.text.length;
|
|
957
|
-
const estimatedLines = Math.ceil(textLength / 45);
|
|
958
|
-
const textHeight = estimatedLines * 20;
|
|
959
|
-
popupHeight = Math.min(baseHeight + textHeight, maxHeight);
|
|
960
|
-
} else {
|
|
961
|
-
popupHeight = baseHeight;
|
|
962
|
-
}
|
|
963
|
-
} else {
|
|
964
|
-
// Case 3: Expanded state (click) - shows all comments + header + input
|
|
965
|
-
const headerHeight = 50; // Header with title and buttons
|
|
966
|
-
const inputSectionHeight = 60; // Add comment input section
|
|
967
|
-
const commentHeight = 70; // Height per comment item
|
|
968
|
-
const estimatedHeight =
|
|
969
|
-
headerHeight + comments.length * commentHeight + inputSectionHeight;
|
|
970
|
-
popupHeight = Math.min(estimatedHeight, maxPopupHeight);
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
// Horizontal Positioning only with clamping to grid bounds
|
|
974
|
-
let left;
|
|
975
|
-
let side = "right"; // track which side we positioned the popup
|
|
976
|
-
const spaceRight = gridRect.right - rect.right - margin;
|
|
977
|
-
const spaceLeft = rect.left - gridRect.left - margin;
|
|
978
|
-
|
|
979
|
-
// Prefer right side, but if not enough space, go left
|
|
980
|
-
if (spaceRight >= effectivePopupWidth) {
|
|
981
|
-
left = rect.right + margin;
|
|
982
|
-
side = "right";
|
|
983
|
-
} else if (spaceLeft >= effectivePopupWidth) {
|
|
984
|
-
left = rect.left - effectivePopupWidth - margin;
|
|
985
|
-
side = "left";
|
|
986
|
-
} else {
|
|
987
|
-
// Not enough space on either side, clamp to grid bounds
|
|
988
|
-
left = Math.min(
|
|
989
|
-
rect.right + margin,
|
|
990
|
-
gridRect.right - effectivePopupWidth - margin
|
|
991
|
-
);
|
|
992
|
-
left = Math.max(left, gridRect.left + margin);
|
|
993
|
-
side = "clamped";
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
// Vertical positioning: keep within viewport for both comments and no-comments cases
|
|
997
|
-
let top = rect.top;
|
|
998
|
-
if (
|
|
999
|
-
!comments ||
|
|
1000
|
-
comments.length === 0 ||
|
|
1001
|
-
(comments && comments.length == 1)
|
|
1002
|
-
) {
|
|
1003
|
-
const viewportHeight =
|
|
1004
|
-
window.innerHeight || document.documentElement.clientHeight;
|
|
1005
|
-
const safePad = 8; // keep a small margin from viewport edges
|
|
1006
|
-
// Use a conservative clamp height and cap it to viewport height minus padding
|
|
1007
|
-
const rawClampHeight =
|
|
1008
|
-
!comments || comments.length === 0
|
|
1009
|
-
? popupHeight // no-comments banner
|
|
1010
|
-
: openedBy === "hover"
|
|
1011
|
-
? popupHeight // hover preview uses its smaller estimated height
|
|
1012
|
-
: maxPopupHeight; // expanded view can grow up to max
|
|
1013
|
-
const clampHeight = Math.max(
|
|
1014
|
-
0,
|
|
1015
|
-
Math.min(rawClampHeight, Math.max(0, viewportHeight - safePad))
|
|
1016
|
-
);
|
|
1017
|
-
const maxTop = Math.max(safePad, viewportHeight - clampHeight);
|
|
1018
|
-
top = Math.min(Math.max(safePad, rect.top), maxTop);
|
|
1019
|
-
return { top, left, side };
|
|
1020
|
-
}
|
|
1021
|
-
if (
|
|
1022
|
-
top + popupHeight > gridRect.bottom &&
|
|
1023
|
-
comments &&
|
|
1024
|
-
comments.length > 0
|
|
1025
|
-
) {
|
|
1026
|
-
// Try positioning above the cell first
|
|
1027
|
-
const topAboveCell = rect.top - popupHeight - margin;
|
|
1028
|
-
|
|
1029
|
-
if (topAboveCell >= gridRect.top) {
|
|
1030
|
-
// Enough space above the cell, position there
|
|
1031
|
-
top = topAboveCell;
|
|
1032
|
-
} else {
|
|
1033
|
-
// Not enough space above either, position at the top of grid
|
|
1034
|
-
// and let the portal handle scrolling internally
|
|
1035
|
-
top = gridRect.top + margin;
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
// Ensure we don't go above the grid
|
|
1040
|
-
top = Math.max(gridRect.top + margin, top);
|
|
1041
|
-
|
|
1042
|
-
return { top, left, side };
|
|
1043
|
-
},
|
|
1044
|
-
[]
|
|
1045
|
-
);
|
|
1046
|
-
const hoverTimeoutRef = useRef(null);
|
|
1047
|
-
const [inputValue, setInputValue] = useState("");
|
|
1048
|
-
const [menuAnchorEl, setMenuAnchorEl] = useState(null);
|
|
1049
|
-
const [editingComment, setEditingComment] = useState(null);
|
|
1050
|
-
const [selectedComment, setSelectedComment] = useState(null);
|
|
1051
|
-
const [showDeleteConfirmation, setShowDeleteConfirmation] = useState(false);
|
|
1052
|
-
const [commentToDelete, setCommentToDelete] = useState(null);
|
|
1053
|
-
const [threadToDelete, setThreadToDelete] = useState(null);
|
|
1054
|
-
const [isDeleteConfirmationLoading, setIsDeleteConfirmationLoading] =
|
|
1055
|
-
useState(false);
|
|
1056
|
-
const [isCommentLoading, setIsCommentLoading] = useState(false);
|
|
1057
|
-
const [commentError, setCommentError] = useState(null);
|
|
1058
|
-
const [currentMenuType, setCurrentMenuType] = useState("commentMenu");
|
|
1059
|
-
|
|
1060
|
-
const getMenuOptions = (menuType) => {
|
|
1061
|
-
const config = commentProps?.configuration || {};
|
|
1062
|
-
|
|
1063
|
-
if (menuType === "topMenu") {
|
|
1064
|
-
const isObj = selectedComment && typeof selectedComment === "object";
|
|
1065
|
-
const isRead = isObj ? selectedComment[0]?.read : selectedComment?.read;
|
|
1066
|
-
const author = isObj
|
|
1067
|
-
? selectedComment[0]?.author
|
|
1068
|
-
: selectedComment?.author;
|
|
1069
|
-
let options = [];
|
|
1070
|
-
|
|
1071
|
-
// Add Mark as Read/Unread option if not disabled
|
|
1072
|
-
if (!config.disableMarkAsRead) {
|
|
1073
|
-
options.push({
|
|
1074
|
-
label: isRead ? "Mark as Unread" : "Mark as Read",
|
|
1075
|
-
// icon: <DeleteIcon />,
|
|
1076
|
-
onClick: async () => {
|
|
1077
|
-
let response;
|
|
1078
|
-
if (selectedComment?.read) {
|
|
1079
|
-
response = await commentProps?.handleMarkAsUnread(
|
|
1080
|
-
selectedComment.id
|
|
1081
|
-
);
|
|
1082
|
-
} else {
|
|
1083
|
-
response = await commentProps?.handleMarkAsRead(
|
|
1084
|
-
selectedComment.id
|
|
1085
|
-
);
|
|
1086
|
-
}
|
|
1087
|
-
handleMenuClose();
|
|
1088
|
-
},
|
|
1089
|
-
value: "mark-as-unread",
|
|
1090
|
-
icon: isRead ? <UnreadIcon /> : <ReadIcon />,
|
|
1091
|
-
});
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
// Add Delete Thread option if not disabled and user is author
|
|
1095
|
-
if (!config.disableDeleteThread && author == commentProps?.author) {
|
|
1096
|
-
options.push({
|
|
1097
|
-
label: "Delete Thread",
|
|
1098
|
-
icon: <DeleteIcon />,
|
|
1099
|
-
onClick: handleThreadDeleteClick,
|
|
1100
|
-
value: "delete-thread",
|
|
1101
|
-
});
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
|
-
return options;
|
|
1105
|
-
} else {
|
|
1106
|
-
let options = [];
|
|
1107
|
-
|
|
1108
|
-
// Add Edit option if not disabled
|
|
1109
|
-
if (!config.disableEditComment) {
|
|
1110
|
-
options.push({
|
|
1111
|
-
label: "Edit",
|
|
1112
|
-
icon: <EditIcon />,
|
|
1113
|
-
onClick: () => {
|
|
1114
|
-
// Set the editing state only when Edit is actually clicked
|
|
1115
|
-
if (selectedComment) {
|
|
1116
|
-
setEditingComment(selectedComment);
|
|
1117
|
-
}
|
|
1118
|
-
handleMenuClose();
|
|
1119
|
-
},
|
|
1120
|
-
value: "edit",
|
|
1121
|
-
});
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
// Add Delete option if not disabled
|
|
1125
|
-
if (!config.disableDeleteComment) {
|
|
1126
|
-
options.push({
|
|
1127
|
-
label: "Delete",
|
|
1128
|
-
icon: <DeleteIcon />,
|
|
1129
|
-
onClick: handleDeleteClick,
|
|
1130
|
-
value: "delete",
|
|
1131
|
-
});
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
return options;
|
|
1135
|
-
}
|
|
1136
|
-
};
|
|
1137
|
-
|
|
1138
|
-
const handleMenuClick = useCallback(
|
|
1139
|
-
(event, comment = null, type = "commentMenu") => {
|
|
1140
|
-
setMenuAnchorEl(event.currentTarget);
|
|
1141
|
-
setCurrentMenuType(type);
|
|
1142
|
-
// Store the comment reference for potential editing (but don't set editing state yet)
|
|
1143
|
-
if (typeof comment === "string") {
|
|
1144
|
-
const val = comments[comment];
|
|
1145
|
-
setSelectedComment({ ...val, id: comment });
|
|
1146
|
-
} else {
|
|
1147
|
-
setSelectedComment(comment);
|
|
1148
|
-
}
|
|
1149
|
-
},
|
|
1150
|
-
[comments]
|
|
1151
|
-
);
|
|
1152
|
-
|
|
1153
|
-
const handleMenuClose = useCallback(() => {
|
|
1154
|
-
setMenuAnchorEl(null);
|
|
1155
|
-
// Only clear selected comment, preserve editing state if it was set
|
|
1156
|
-
setSelectedComment(null);
|
|
1157
|
-
}, []);
|
|
1158
|
-
|
|
1159
|
-
useMemo(() => {
|
|
1160
|
-
if (!popup) {
|
|
1161
|
-
setMenuAnchorEl(null);
|
|
1162
|
-
setEditingComment(null);
|
|
1163
|
-
setSelectedComment(null);
|
|
1164
|
-
}
|
|
1165
|
-
}, [popup]);
|
|
1166
|
-
|
|
1167
|
-
const toggleCommentMode = () => {
|
|
1168
|
-
setCommentMode((prev) => !prev);
|
|
1169
|
-
setPopup(null);
|
|
1170
|
-
setEditingComment(null);
|
|
1171
|
-
setSelectedComment(null);
|
|
1172
|
-
};
|
|
1173
|
-
|
|
1174
|
-
useEffect(() => {
|
|
1175
|
-
// This is the single source of truth for synchronization.
|
|
1176
|
-
// If the table settings are opened, it must turn off comment mode.
|
|
1177
|
-
if (tableSettingOpen && commentMode) {
|
|
1178
|
-
setCommentMode(false);
|
|
1179
|
-
}
|
|
1180
|
-
}, [tableSettingOpen]);
|
|
1181
|
-
|
|
1182
|
-
// Helper to compute effective cellId supporting multiple threads per cell
|
|
1183
|
-
const getEffectiveCellId = useCallback(
|
|
1184
|
-
(baseCellId) => {
|
|
1185
|
-
const isResolved = Array.isArray(resolvedComments)
|
|
1186
|
-
? resolvedComments.includes(baseCellId)
|
|
1187
|
-
: false;
|
|
1188
|
-
|
|
1189
|
-
if (!isResolved) return baseCellId;
|
|
1190
|
-
|
|
1191
|
-
const prefix = `${baseCellId}__t`;
|
|
1192
|
-
const allKeys = Object.keys(comments || {});
|
|
1193
|
-
const threadIndices = allKeys
|
|
1194
|
-
.filter((k) => k === baseCellId || k.startsWith(prefix))
|
|
1195
|
-
.map((k) => {
|
|
1196
|
-
const m = k.match(new RegExp(`^${baseCellId}__t(\\d+)$`));
|
|
1197
|
-
return m ? parseInt(m[1], 10) : 0;
|
|
1198
|
-
})
|
|
1199
|
-
.filter((n) => !Number.isNaN(n));
|
|
1200
|
-
const nextIndex = threadIndices.length
|
|
1201
|
-
? Math.max(...threadIndices) + 1
|
|
1202
|
-
: 1;
|
|
1203
|
-
return `${baseCellId}__t${nextIndex}`;
|
|
1204
|
-
},
|
|
1205
|
-
[comments, resolvedComments]
|
|
1206
|
-
);
|
|
1207
|
-
|
|
1208
|
-
// Helper to find the latest unresolved thread id for hover display
|
|
1209
|
-
const getLatestUnresolvedThreadId = useCallback(
|
|
1210
|
-
(baseCellId) => {
|
|
1211
|
-
const prefix = `${baseCellId}__t`;
|
|
1212
|
-
const allKeys = Object.keys(comments || {});
|
|
1213
|
-
// Collect all candidate thread ids for this cell
|
|
1214
|
-
const candidates = allKeys.filter(
|
|
1215
|
-
(k) => k === baseCellId || k.startsWith(prefix)
|
|
1216
|
-
);
|
|
1217
|
-
if (candidates.length === 0) return null;
|
|
1218
|
-
// Filter out resolved threads
|
|
1219
|
-
const unresolved = candidates.filter(
|
|
1220
|
-
(k) => !resolvedComments?.includes?.(k)
|
|
1221
|
-
);
|
|
1222
|
-
if (unresolved.length === 0) return null;
|
|
1223
|
-
// Sort by index so that the highest (latest) index is chosen; base has index 0
|
|
1224
|
-
const withIndex = unresolved.map((k) => {
|
|
1225
|
-
const m = k.match(new RegExp(`^${baseCellId}__t(\\d+)$`));
|
|
1226
|
-
return { id: k, idx: m ? parseInt(m[1], 10) : 0 };
|
|
1227
|
-
});
|
|
1228
|
-
withIndex.sort((a, b) => b.idx - a.idx);
|
|
1229
|
-
return withIndex[0].id;
|
|
1230
|
-
},
|
|
1231
|
-
[comments, resolvedComments]
|
|
1232
|
-
);
|
|
1233
|
-
|
|
1234
|
-
const onCellClicked = useCallback(
|
|
1235
|
-
(params) => {
|
|
1236
|
-
if (!commentMode) return;
|
|
1237
|
-
// TODO: support cellClick passed from props
|
|
1238
|
-
const cellEl = params.event.target?.closest(".ag-cell");
|
|
1239
|
-
if (cellEl) {
|
|
1240
|
-
// Do not show popup for group rows or group cells
|
|
1241
|
-
// const rowEl = cellEl.closest(".ag-row");
|
|
1242
|
-
// if (
|
|
1243
|
-
// rowEl?.classList?.contains("ag-row-group") ||
|
|
1244
|
-
// cellEl.classList?.contains("ag-group-cell")
|
|
1245
|
-
// ) {
|
|
1246
|
-
// return;
|
|
1247
|
-
// }
|
|
1248
|
-
// // Also ignore AG Grid auto column by colId
|
|
1249
|
-
// if (params?.column?.getColId?.() === "ag-Grid-AutoColumn") {
|
|
1250
|
-
// return;
|
|
1251
|
-
// }
|
|
1252
|
-
const rect = cellEl.getBoundingClientRect();
|
|
1253
|
-
// Use colIdentifierKey if provided, otherwise fallback to params.node.id
|
|
1254
|
-
const rowIdentifier = commentProps?.colIdentifierKey
|
|
1255
|
-
? params.data?.[commentProps.colIdentifierKey] || params.node.id
|
|
1256
|
-
: params.node.id;
|
|
1257
|
-
const baseCellId = `${rowIdentifier}__${params.column.getColId()}`;
|
|
1258
|
-
// If base is resolved, prefer latest unresolved thread; otherwise create a new thread
|
|
1259
|
-
let effectiveCellId = baseCellId;
|
|
1260
|
-
if (!commentProps?.configuration?.disableMultiCommentThread) {
|
|
1261
|
-
const baseResolved = Array.isArray(resolvedComments)
|
|
1262
|
-
? resolvedComments.includes(baseCellId)
|
|
1263
|
-
: false;
|
|
1264
|
-
if (baseResolved) {
|
|
1265
|
-
const latestUnresolved = getLatestUnresolvedThreadId(baseCellId);
|
|
1266
|
-
effectiveCellId =
|
|
1267
|
-
latestUnresolved || getEffectiveCellId(baseCellId);
|
|
1268
|
-
}
|
|
1269
|
-
}
|
|
1270
|
-
const commentForCell =
|
|
1271
|
-
params.data?.comment || comments[effectiveCellId];
|
|
1272
|
-
const position = calculatePopupPosition(
|
|
1273
|
-
rect,
|
|
1274
|
-
commentForCell,
|
|
1275
|
-
"click"
|
|
1276
|
-
);
|
|
1277
|
-
setPopup({
|
|
1278
|
-
position,
|
|
1279
|
-
rowId: rowIdentifier,
|
|
1280
|
-
colId: params.column.getColId(),
|
|
1281
|
-
cellId: effectiveCellId,
|
|
1282
|
-
comment: commentForCell,
|
|
1283
|
-
author: commentProps?.author || "Current User", // TODO: You can replace this with actual user info
|
|
1284
|
-
openedBy: "click",
|
|
1285
|
-
data: params.node?.data,
|
|
1286
|
-
});
|
|
1287
|
-
}
|
|
1288
|
-
},
|
|
1289
|
-
[
|
|
1290
|
-
commentMode,
|
|
1291
|
-
commentProps?.configuration?.disableMultiCommentThread,
|
|
1292
|
-
resolvedComments,
|
|
1293
|
-
getLatestUnresolvedThreadId,
|
|
1294
|
-
getEffectiveCellId,
|
|
1295
|
-
comments,
|
|
1296
|
-
calculatePopupPosition,
|
|
1297
|
-
]
|
|
1298
|
-
);
|
|
1299
|
-
|
|
1300
|
-
// Refresh cells when comments change to show/hide comment icons
|
|
1301
|
-
useEffect(() => {
|
|
1302
|
-
if (actualRef?.current?.api) {
|
|
1303
|
-
actualRef.current.api.refreshCells({
|
|
1304
|
-
force: true, // Force refresh even if data hasn't changed
|
|
1305
|
-
});
|
|
1306
|
-
}
|
|
1307
|
-
}, [comments]);
|
|
1308
|
-
|
|
1309
|
-
const handleCommentIconHover = useCallback(
|
|
1310
|
-
(params) => {
|
|
1311
|
-
if (params.eGridCell) {
|
|
1312
|
-
const rect = params.eGridCell.getBoundingClientRect();
|
|
1313
|
-
// Use colIdentifierKey if provided, otherwise fallback to params.node.id
|
|
1314
|
-
const rowIdentifier = commentProps?.colIdentifierKey
|
|
1315
|
-
? params.data?.[commentProps.colIdentifierKey] || params.node.id
|
|
1316
|
-
: params.node.id;
|
|
1317
|
-
const baseCellId = `${rowIdentifier}__${params.column.getColId()}`;
|
|
1318
|
-
// Hover should show latest unresolved thread if available
|
|
1319
|
-
const cellId = getLatestUnresolvedThreadId(baseCellId);
|
|
1320
|
-
if (!cellId) return; // No unresolved threads to show
|
|
1321
|
-
const position = calculatePopupPosition(
|
|
1322
|
-
rect,
|
|
1323
|
-
comments[cellId],
|
|
1324
|
-
"hover"
|
|
1325
|
-
);
|
|
1326
|
-
setPopup({
|
|
1327
|
-
position,
|
|
1328
|
-
// { top: rect.top, left: rect.right + 5 },
|
|
1329
|
-
rowId: rowIdentifier,
|
|
1330
|
-
colId: params.column.getColId(),
|
|
1331
|
-
cellId,
|
|
1332
|
-
comment: comments[cellId],
|
|
1333
|
-
author: commentProps?.author || "Current User",
|
|
1334
|
-
openedBy: "hover",
|
|
1335
|
-
data: params.node?.data,
|
|
1336
|
-
});
|
|
1337
|
-
}
|
|
1338
|
-
},
|
|
1339
|
-
[
|
|
1340
|
-
getLatestUnresolvedThreadId,
|
|
1341
|
-
calculatePopupPosition,
|
|
1342
|
-
comments,
|
|
1343
|
-
commentProps?.author,
|
|
1344
|
-
]
|
|
1345
|
-
);
|
|
1346
|
-
|
|
1347
|
-
const handleMouseLeave = useCallback(() => {
|
|
1348
|
-
if (popup?.openedBy === "hover") {
|
|
1349
|
-
hoverTimeoutRef.current = setTimeout(() => {
|
|
1350
|
-
if (!menuAnchorEl) {
|
|
1351
|
-
setPopup(null);
|
|
1352
|
-
setEditingComment(null);
|
|
1353
|
-
setSelectedComment(null);
|
|
1354
|
-
}
|
|
1355
|
-
}, 200);
|
|
1356
|
-
} else {
|
|
1357
|
-
setPopup(null);
|
|
1358
|
-
setEditingComment(null);
|
|
1359
|
-
setSelectedComment(null);
|
|
1360
|
-
}
|
|
1361
|
-
}, [popup, menuAnchorEl]);
|
|
1362
|
-
|
|
1363
|
-
const handleMouseEnter = useCallback(() => {
|
|
1364
|
-
if (popup?.openedBy === "hover") {
|
|
1365
|
-
clearTimeout(hoverTimeoutRef.current);
|
|
1366
|
-
}
|
|
1367
|
-
}, [popup]);
|
|
1368
|
-
|
|
1369
|
-
const handleRegisterTableSettingToggle = useCallback(
|
|
1370
|
-
(fn) => {
|
|
1371
|
-
const api = actualRef?.current?.api;
|
|
1372
|
-
if (api && typeof fn === "function") {
|
|
1373
|
-
api.showTableSetting = (tabName, options) =>
|
|
1374
|
-
fn(true, tabName, options);
|
|
1375
|
-
api.hideTableSetting = (options) => fn(false, undefined, options);
|
|
1376
|
-
api.toggleTableSetting = (open, tabName, options) =>
|
|
1377
|
-
fn(open, tabName, options);
|
|
1378
|
-
}
|
|
1379
|
-
},
|
|
1380
|
-
[actualRef]
|
|
1381
|
-
);
|
|
1382
|
-
|
|
1383
|
-
function getCellElementById(gridId, rowNode, colId) {
|
|
1384
|
-
const containerEl = document.querySelector(
|
|
1385
|
-
".impact-table-main-container"
|
|
1386
|
-
);
|
|
1387
|
-
if (!containerEl || !rowNode) return null;
|
|
1388
|
-
|
|
1389
|
-
// Try row-id first
|
|
1390
|
-
let cell = containerEl.querySelector(
|
|
1391
|
-
`[role="row"][row-id="${rowNode.id}"] [col-id="${colId}"]`
|
|
1392
|
-
);
|
|
1393
|
-
|
|
1394
|
-
// Fallback to row-index
|
|
1395
|
-
if (!cell) {
|
|
1396
|
-
const rowIndex = rowNode.rowIndex ?? rowNode.childIndex;
|
|
1397
|
-
if (rowIndex != null) {
|
|
1398
|
-
cell = containerEl.querySelector(
|
|
1399
|
-
`[role="row"][row-index="${rowIndex}"] [col-id="${colId}"]`
|
|
1400
|
-
);
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
return cell;
|
|
1405
|
-
}
|
|
1406
|
-
|
|
1407
|
-
const handleCommentItemClick = useCallback(
|
|
1408
|
-
(cellId, comments, messageId = null) => {
|
|
1409
|
-
const [rowId, colId, threadId] = cellId.split("__");
|
|
1410
|
-
const api = actualRef.current?.api;
|
|
1411
|
-
if (!api) {
|
|
1412
|
-
console.error("AG Grid API not available.");
|
|
1413
|
-
return;
|
|
1414
|
-
}
|
|
1415
|
-
|
|
1416
|
-
// Find row node by searching for the colIdentifierKey value or fallback to node ID
|
|
1417
|
-
let rowNode;
|
|
1418
|
-
if (commentProps?.colIdentifierKey) {
|
|
1419
|
-
// Search through all nodes to find the one with matching colIdentifierKey value.
|
|
1420
|
-
// Use String() so rowId from cellId (always string) matches data id when number (e.g. strategy_id: 47).
|
|
1421
|
-
api.forEachNode((node) => {
|
|
1422
|
-
const dataId = node.data?.[commentProps.colIdentifierKey];
|
|
1423
|
-
if (dataId != null && String(dataId) === String(rowId)) {
|
|
1424
|
-
rowNode = node;
|
|
1425
|
-
}
|
|
1426
|
-
});
|
|
1427
|
-
} else {
|
|
1428
|
-
// Fallback to original logic for backward compatibility
|
|
1429
|
-
rowNode = api.getRowNode(rowId);
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
|
-
if (!rowNode) {
|
|
1433
|
-
console.error("Could not find row node for rowId:", rowId);
|
|
1434
|
-
return;
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
// Make sure row + col are visible
|
|
1438
|
-
api.ensureColumnVisible(colId);
|
|
1439
|
-
api.ensureNodeVisible(rowNode, "middle");
|
|
1440
|
-
|
|
1441
|
-
// Wait for DOM rendering after scroll
|
|
1442
|
-
requestAnimationFrame(() => {
|
|
1443
|
-
requestAnimationFrame(() => {
|
|
1444
|
-
const cellElement = getCellElementById(
|
|
1445
|
-
gridId || "my-grid",
|
|
1446
|
-
rowNode,
|
|
1447
|
-
colId
|
|
1448
|
-
);
|
|
1449
|
-
|
|
1450
|
-
if (!cellElement) {
|
|
1451
|
-
console.error("Could not find cell element for:", cellId);
|
|
1452
|
-
return;
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
const rect = cellElement.getBoundingClientRect();
|
|
1456
|
-
const position = calculatePopupPosition(rect, comments, "click");
|
|
1457
|
-
setPopup({
|
|
1458
|
-
position,
|
|
1459
|
-
//{ top: rect.top + 11, left: rect.right - 12 },
|
|
1460
|
-
cellId,
|
|
1461
|
-
comment: comments,
|
|
1462
|
-
author: commentProps?.author,
|
|
1463
|
-
openedBy: "click",
|
|
1464
|
-
data: rowNode?.data || {},
|
|
1465
|
-
messageId: messageId,
|
|
1466
|
-
});
|
|
1467
|
-
});
|
|
1468
|
-
});
|
|
1469
|
-
},
|
|
1470
|
-
[actualRef, gridId, calculatePopupPosition, commentProps?.author]
|
|
1471
|
-
);
|
|
1472
|
-
|
|
1473
|
-
const handleUpdateComment = useCallback(
|
|
1474
|
-
async (commentId, newText) => {
|
|
1475
|
-
if (commentId === null) {
|
|
1476
|
-
// Cancel editing
|
|
1477
|
-
setEditingComment(null);
|
|
1478
|
-
return;
|
|
1479
|
-
}
|
|
1480
|
-
|
|
1481
|
-
if (!newText || !newText.trim()) return;
|
|
1482
|
-
|
|
1483
|
-
setIsCommentLoading(true);
|
|
1484
|
-
setCommentError(null);
|
|
1485
|
-
|
|
1486
|
-
try {
|
|
1487
|
-
const commentToUpdate = editingComment;
|
|
1488
|
-
if (!commentToUpdate) return;
|
|
1489
|
-
|
|
1490
|
-
let response;
|
|
1491
|
-
// Call handleCommentEdit for updating existing comments
|
|
1492
|
-
if (commentProps?.handleCommentEdit) {
|
|
1493
|
-
response = await commentProps?.handleCommentEdit(
|
|
1494
|
-
newText.trim(),
|
|
1495
|
-
commentToUpdate,
|
|
1496
|
-
commentId
|
|
1497
|
-
);
|
|
1498
|
-
}
|
|
1499
|
-
|
|
1500
|
-
// Update local state with backend response
|
|
1501
|
-
if (response) {
|
|
1502
|
-
setComments(response);
|
|
1503
|
-
}
|
|
1504
|
-
|
|
1505
|
-
// Clear editing state
|
|
1506
|
-
setEditingComment(null);
|
|
1507
|
-
} catch (error) {
|
|
1508
|
-
console.error("Error updating comment:", error);
|
|
1509
|
-
setCommentError("Failed to update comment. Please try again.");
|
|
1510
|
-
} finally {
|
|
1511
|
-
setIsCommentLoading(false);
|
|
1512
|
-
}
|
|
1513
|
-
},
|
|
1514
|
-
[editingComment, commentProps, popup?.cellId]
|
|
1515
|
-
);
|
|
1516
|
-
|
|
1517
|
-
const handleAddComment = useCallback(
|
|
1518
|
-
async (cellId, inputValue, taggedUsers) => {
|
|
1519
|
-
if (!inputValue?.trim()) {
|
|
1520
|
-
setCommentError("Comment cannot be empty");
|
|
1521
|
-
return;
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
|
-
const isEditing = editingComment !== null;
|
|
1525
|
-
|
|
1526
|
-
try {
|
|
1527
|
-
setIsCommentLoading(true);
|
|
1528
|
-
setCommentError(null);
|
|
1529
|
-
|
|
1530
|
-
let response;
|
|
1531
|
-
|
|
1532
|
-
if (isEditing) {
|
|
1533
|
-
// Call handleCommentEdit for updating existing comments
|
|
1534
|
-
response = await commentProps?.handleCommentEdit(
|
|
1535
|
-
inputValue.trim(),
|
|
1536
|
-
editingComment,
|
|
1537
|
-
editingComment?.id,
|
|
1538
|
-
taggedUsers
|
|
1539
|
-
);
|
|
1540
|
-
} else {
|
|
1541
|
-
// Call handleSaveComment for creating new comments
|
|
1542
|
-
response = await commentProps?.handleSaveComment(
|
|
1543
|
-
cellId,
|
|
1544
|
-
inputValue.trim(),
|
|
1545
|
-
popup?.data,
|
|
1546
|
-
taggedUsers
|
|
1547
|
-
);
|
|
1548
|
-
}
|
|
1549
|
-
|
|
1550
|
-
// Update local state with backend response
|
|
1551
|
-
if (response) {
|
|
1552
|
-
setComments(response);
|
|
1553
|
-
} else {
|
|
1554
|
-
// Fallback to local state update if no backend response
|
|
1555
|
-
if (isEditing) {
|
|
1556
|
-
// Update existing comment
|
|
1557
|
-
setComments((prev) => ({
|
|
1558
|
-
...prev,
|
|
1559
|
-
[cellId]:
|
|
1560
|
-
prev[cellId]?.map((comment) =>
|
|
1561
|
-
comment.id === editingComment.id
|
|
1562
|
-
? {
|
|
1563
|
-
...comment,
|
|
1564
|
-
text: inputValue.trim(),
|
|
1565
|
-
timestamp: new Date().toISOString(),
|
|
1566
|
-
isEdited: true,
|
|
1567
|
-
}
|
|
1568
|
-
: comment
|
|
1569
|
-
) || [],
|
|
1570
|
-
}));
|
|
1571
|
-
} else {
|
|
1572
|
-
// Add new comment
|
|
1573
|
-
const newComment = {
|
|
1574
|
-
id: Date.now(), // Simple ID generation
|
|
1575
|
-
text: inputValue.trim(),
|
|
1576
|
-
timestamp: new Date().toISOString(),
|
|
1577
|
-
author: commentProps?.author || "Current User",
|
|
1578
|
-
isEdited: false,
|
|
1579
|
-
};
|
|
1580
|
-
setComments((prev) => ({
|
|
1581
|
-
...prev,
|
|
1582
|
-
[cellId]: [...(prev[cellId] || []), newComment],
|
|
1583
|
-
}));
|
|
1584
|
-
}
|
|
1585
|
-
}
|
|
1586
|
-
|
|
1587
|
-
// Close popup and clear editing state only on success
|
|
1588
|
-
if (!comments[cellId]) setPopup(null);
|
|
1589
|
-
setEditingComment(null);
|
|
1590
|
-
setSelectedComment(null);
|
|
1591
|
-
} catch (error) {
|
|
1592
|
-
console.error("Error saving comment:", error);
|
|
1593
|
-
setCommentError(
|
|
1594
|
-
error?.message ||
|
|
1595
|
-
(isEditing
|
|
1596
|
-
? "Failed to update comment"
|
|
1597
|
-
: "Failed to save comment")
|
|
1598
|
-
);
|
|
1599
|
-
} finally {
|
|
1600
|
-
setIsCommentLoading(false);
|
|
1601
|
-
}
|
|
1602
|
-
},
|
|
1603
|
-
[
|
|
1604
|
-
popup?.data,
|
|
1605
|
-
editingComment,
|
|
1606
|
-
commentProps?.handleSaveComment,
|
|
1607
|
-
commentProps?.handleCommentEdit,
|
|
1608
|
-
commentProps?.author,
|
|
1609
|
-
]
|
|
1610
|
-
);
|
|
1611
|
-
|
|
1612
|
-
const handleMarkAsResolved = useCallback(
|
|
1613
|
-
async (cellId, comments) => {
|
|
1614
|
-
// Check if mark as resolved is disabled
|
|
1615
|
-
const config = commentProps?.configuration || {};
|
|
1616
|
-
if (config.disableMarkAsResolved) {
|
|
1617
|
-
return;
|
|
1618
|
-
}
|
|
1619
|
-
|
|
1620
|
-
let response;
|
|
1621
|
-
if (commentProps?.handleMarkAsResolved) {
|
|
1622
|
-
response = await commentProps?.handleMarkAsResolved(cellId, comments);
|
|
1623
|
-
}
|
|
1624
|
-
// Update local state with backend response
|
|
1625
|
-
if (response) {
|
|
1626
|
-
setResolvedComments(response);
|
|
1627
|
-
} else {
|
|
1628
|
-
// Fallback to local state update if no backend response
|
|
1629
|
-
setResolvedComments((prev) => [...prev, cellId]);
|
|
1630
|
-
}
|
|
1631
|
-
setIsCommentResolvedAlertOpen(true);
|
|
1632
|
-
setTimeout(() => {
|
|
1633
|
-
setIsCommentResolvedAlertOpen(false);
|
|
1634
|
-
}, 2000);
|
|
1635
|
-
// Close popup and clear editing state only on success
|
|
1636
|
-
setPopup(null);
|
|
1637
|
-
setEditingComment(null);
|
|
1638
|
-
setSelectedComment(null);
|
|
1639
|
-
},
|
|
1640
|
-
[commentProps?.handleMarkAsResolved, commentProps?.configuration]
|
|
1641
|
-
);
|
|
1642
|
-
|
|
1643
|
-
const handleThreadDeleteClick = () => {
|
|
1644
|
-
setThreadToDelete({
|
|
1645
|
-
cellId: selectedComment.id,
|
|
1646
|
-
data: selectedComment,
|
|
1647
|
-
});
|
|
1648
|
-
setShowDeleteConfirmation(true);
|
|
1649
|
-
handleMenuClose();
|
|
1650
|
-
};
|
|
1651
|
-
const handleDeleteClick = () => {
|
|
1652
|
-
setCommentToDelete({
|
|
1653
|
-
cellId: popup?.cellId,
|
|
1654
|
-
data: popup?.data,
|
|
1655
|
-
comment: selectedComment,
|
|
1656
|
-
});
|
|
1657
|
-
setShowDeleteConfirmation(true);
|
|
1658
|
-
handleMenuClose();
|
|
1659
|
-
};
|
|
1660
|
-
|
|
1661
|
-
const handleDeleteConfirm = async () => {
|
|
1662
|
-
if (commentToDelete) {
|
|
1663
|
-
try {
|
|
1664
|
-
setIsDeleteConfirmationLoading(true);
|
|
1665
|
-
const updatedComment = await commentProps?.handleCommentDelete?.(
|
|
1666
|
-
commentToDelete.comment?.id,
|
|
1667
|
-
commentToDelete.comment
|
|
1668
|
-
);
|
|
1669
|
-
if (updatedComment) {
|
|
1670
|
-
setComments(updatedComment);
|
|
1671
|
-
}
|
|
1672
|
-
} catch (error) {
|
|
1673
|
-
console.error("Error deleting comment:", error);
|
|
1674
|
-
} finally {
|
|
1675
|
-
setIsDeleteConfirmationLoading(false);
|
|
1676
|
-
}
|
|
1677
|
-
} else if (threadToDelete) {
|
|
1678
|
-
try {
|
|
1679
|
-
setIsDeleteConfirmationLoading(true);
|
|
1680
|
-
const updatedComment = await commentProps?.handleThreadDelete?.(
|
|
1681
|
-
threadToDelete.cellId,
|
|
1682
|
-
threadToDelete.data
|
|
1683
|
-
);
|
|
1684
|
-
if (updatedComment) {
|
|
1685
|
-
setComments(updatedComment);
|
|
1686
|
-
}
|
|
1687
|
-
} catch (error) {
|
|
1688
|
-
console.error("Error deleting thread:", error);
|
|
1689
|
-
} finally {
|
|
1690
|
-
setIsDeleteConfirmationLoading(false);
|
|
1691
|
-
}
|
|
1692
|
-
}
|
|
1693
|
-
setShowDeleteConfirmation(false);
|
|
1694
|
-
setCommentToDelete(null);
|
|
1695
|
-
};
|
|
1696
|
-
|
|
1697
|
-
const handleDeleteCancel = (e) => {
|
|
1698
|
-
e.stopPropagation();
|
|
1699
|
-
setShowDeleteConfirmation(false);
|
|
1700
|
-
setCommentToDelete(null);
|
|
1701
|
-
};
|
|
1702
|
-
|
|
1703
|
-
const clearCommentError = useCallback(() => {
|
|
1704
|
-
setCommentError(null);
|
|
1705
|
-
}, []);
|
|
1706
|
-
|
|
1707
|
-
const gridContext = useMemo(
|
|
1708
|
-
() => ({
|
|
1709
|
-
comments,
|
|
1710
|
-
popup,
|
|
1711
|
-
handleCommentIconHover,
|
|
1712
|
-
handleMouseEnter,
|
|
1713
|
-
handleMouseLeave,
|
|
1714
|
-
resolvedComments,
|
|
1715
|
-
getLatestUnresolvedThreadId,
|
|
1716
|
-
configuration: commentProps?.configuration,
|
|
1717
|
-
colIdentifierKey: commentProps?.colIdentifierKey,
|
|
1718
|
-
}),
|
|
1719
|
-
[
|
|
1720
|
-
comments,
|
|
1721
|
-
popup,
|
|
1722
|
-
handleCommentIconHover,
|
|
1723
|
-
handleMouseEnter,
|
|
1724
|
-
handleMouseLeave,
|
|
1725
|
-
resolvedComments,
|
|
1726
|
-
getLatestUnresolvedThreadId,
|
|
1727
|
-
commentProps?.configuration,
|
|
1728
|
-
commentProps?.colIdentifierKey,
|
|
1729
|
-
]
|
|
1730
|
-
);
|
|
1731
|
-
|
|
1732
|
-
// Calculate base heights for CSS variables
|
|
1733
|
-
const LIST_ROW_SPACING = 12;
|
|
1734
|
-
const BASE_HEIGHT_WITH_IMAGE = 72;
|
|
1735
|
-
const BASE_HEIGHT_WITHOUT_IMAGE = 48;
|
|
1736
|
-
|
|
1737
|
-
const getRowHeightWrapper = (params) => {
|
|
1738
|
-
if (viewPoint === "list") {
|
|
1739
|
-
const visibleColumns = columnDefs.filter(
|
|
1740
|
-
(col) =>
|
|
1741
|
-
col.field &&
|
|
1742
|
-
!col.hide &&
|
|
1743
|
-
(col.field === "image" ||
|
|
1744
|
-
(typeof col.cellRenderer === "string" &&
|
|
1745
|
-
col.cellRenderer.includes("Image")))
|
|
1746
|
-
);
|
|
1747
|
-
|
|
1748
|
-
const hasImage = visibleColumns.some((col) => {
|
|
1749
|
-
const value = params?.data?.[col.field];
|
|
1750
|
-
return (
|
|
1751
|
-
typeof value === "string" &&
|
|
1752
|
-
(value.startsWith("http") ||
|
|
1753
|
-
value.match(/\.(jpg|jpeg|png|gif|webp|svg)$/i))
|
|
1754
|
-
);
|
|
1755
|
-
});
|
|
1756
|
-
const baseHeight = hasImage
|
|
1757
|
-
? BASE_HEIGHT_WITH_IMAGE
|
|
1758
|
-
: BASE_HEIGHT_WITHOUT_IMAGE;
|
|
1759
|
-
return baseHeight + LIST_ROW_SPACING;
|
|
1760
|
-
}
|
|
1761
|
-
return args?.getRowHeight?.(params);
|
|
1762
|
-
};
|
|
1763
|
-
|
|
1764
|
-
const getRowClassWrapper = (params) => {
|
|
1765
|
-
if (viewPoint === "list") {
|
|
1766
|
-
const visibleColumns = columnDefs.filter(
|
|
1767
|
-
(col) =>
|
|
1768
|
-
col.field &&
|
|
1769
|
-
!col.hide &&
|
|
1770
|
-
(col.field === "image" ||
|
|
1771
|
-
(typeof col.cellRenderer === "string" &&
|
|
1772
|
-
col.cellRenderer.includes("Image")))
|
|
1773
|
-
);
|
|
1774
|
-
|
|
1775
|
-
const hasImage = visibleColumns.some((col) => {
|
|
1776
|
-
const value = params?.data?.[col.field];
|
|
1777
|
-
return (
|
|
1778
|
-
typeof value === "string" &&
|
|
1779
|
-
(value.startsWith("http") ||
|
|
1780
|
-
value.match(/\.(jpg|jpeg|png|gif|webp|svg)$/i))
|
|
1781
|
-
);
|
|
1782
|
-
});
|
|
1783
|
-
|
|
1784
|
-
const className = hasImage
|
|
1785
|
-
? "list-row-with-image"
|
|
1786
|
-
: "list-row-without-image";
|
|
1787
|
-
|
|
1788
|
-
// Combine with any existing row class
|
|
1789
|
-
const existingClass = args?.getRowClass?.(params) || "";
|
|
1790
|
-
return existingClass ? `${existingClass} ${className}` : className;
|
|
1791
|
-
}
|
|
1792
|
-
return args?.getRowClass?.(params) || "";
|
|
1793
|
-
};
|
|
1794
|
-
|
|
1795
|
-
return (
|
|
1796
|
-
<div
|
|
1797
|
-
className={`ag-theme-alpine ia-basic-table-layout table-v32 ${
|
|
1798
|
-
(height && !viewPoint === "list") ? "custom-height-override" : ""
|
|
1799
|
-
} ${enableHeaderTextWrap ? "header-wrap-enabled" : ""} ${
|
|
1800
|
-
viewPoint === "list" ? "list-view list-mode-enabled" : ""
|
|
1801
|
-
}`}
|
|
1802
|
-
style={{
|
|
1803
|
-
width: "100%",
|
|
1804
|
-
"--ag-grid-height": height || "500px",
|
|
1805
|
-
}}
|
|
1806
|
-
>
|
|
1807
|
-
<div
|
|
1808
|
-
className={`impact-table-main-container ${
|
|
1809
|
-
cardContainer ? "card-container" : ""
|
|
1810
|
-
} ${tableSettingOpen ? "table-setting-open" : ""} ${
|
|
1811
|
-
bottomLeftOptions || bottomCenterOptions
|
|
1812
|
-
? "footer-button-with-bottom-options"
|
|
1813
|
-
: ""
|
|
1814
|
-
} ${hideMarginBottom ? "hide-margin-bottom" : ""} ${
|
|
1815
|
-
commentMode ? "comment-mode" : ""
|
|
1816
|
-
}`}
|
|
1817
|
-
id={gridId || "myGrid"}
|
|
1818
|
-
>
|
|
1819
|
-
<TableHeader
|
|
1820
|
-
actualRef={actualRef}
|
|
1821
|
-
colDefs={colDefs}
|
|
1822
|
-
Columns={Columns}
|
|
1823
|
-
rowHeight={rowHeight}
|
|
1824
|
-
setRowHeight={setRowHeight}
|
|
1825
|
-
tableFontSize={tableFontSize}
|
|
1826
|
-
setTableFontSize={setTableFontSize}
|
|
1827
|
-
tableHeader={tableHeader}
|
|
1828
|
-
topRightOptions={topRightOptions}
|
|
1829
|
-
topLeftOptions={topLeftOptions}
|
|
1830
|
-
onGlobalSearchClick={onGlobalSearchClick}
|
|
1831
|
-
cardContainer={cardContainer}
|
|
1832
|
-
onNumberFormatChange={onNumberFormatChange}
|
|
1833
|
-
hideRowHeightOptionMenu={hideRowHeightOptionMenu}
|
|
1834
|
-
showDownloadButton={showDownloadButton}
|
|
1835
|
-
onDownloadButtonClick={onDownloadButtonClick}
|
|
1836
|
-
closeButton={closeButton}
|
|
1837
|
-
handleCloseButtonClick={handleCloseButtonClick}
|
|
1838
|
-
additionalButtons={additionalButtons}
|
|
1839
|
-
setTableSettingOpen={setTableSettingOpen}
|
|
1840
|
-
showHideEditableCells={showHideEditableCells}
|
|
1841
|
-
handleShowHideEditableCells={handleShowHideEditableCells}
|
|
1842
|
-
topCenterOptions={topCenterOptions}
|
|
1843
|
-
showContentualFilter={showContentualFilter}
|
|
1844
|
-
showContentualFilterBadge={showContentualFilterBadge}
|
|
1845
|
-
onContentualFilterClick={onContentualFilterClick}
|
|
1846
|
-
contentualFilterProps={contentualFilterProps}
|
|
1847
|
-
contentualFilterComponent={contentualFilterComponent}
|
|
1848
|
-
tableActions={tableActions}
|
|
1849
|
-
onTableActionsTabClick={onTableActionsTabClick}
|
|
1850
|
-
hideTableFormat={hideTableFormat}
|
|
1851
|
-
hideTableActions={hideTableActions}
|
|
1852
|
-
hideTableSetting={hideTableSetting}
|
|
1853
|
-
explicitlyCloseTableSetting={explicitlyCloseTableSetting}
|
|
1854
|
-
customSystemButton={customSystemButton}
|
|
1855
|
-
isChatEnabled={isChatEnabled}
|
|
1856
|
-
handleChatClick={handleChatClick}
|
|
1857
|
-
isChatOpen={isChatOpen}
|
|
1858
|
-
handleChatClose={handleChatClose}
|
|
1859
|
-
chatConfiguration={chatConfiguration}
|
|
1860
|
-
savedViewsOptions={savedViewsOptions}
|
|
1861
|
-
handleSaveAndApply={handleSaveAndApply}
|
|
1862
|
-
maxSavedViews={maxSavedViews}
|
|
1863
|
-
handleSavedViewClick={handleSavedViewClick}
|
|
1864
|
-
handleEditSaveView={handleEditSaveView}
|
|
1865
|
-
isSaveViewEnabled={isSaveViewEnabled}
|
|
1866
|
-
isSavingViewLoading={isSaveViewLoading}
|
|
1867
|
-
handleDeleteViewClick={handleDeleteViewClick}
|
|
1868
|
-
isDeleteViewLoading={isDeleteViewLoading}
|
|
1869
|
-
handleSetDefaultView={handleSetDefaultView}
|
|
1870
|
-
isCommentFeatureEnabled={isCommentFeatureEnabled}
|
|
1871
|
-
showCommentBadge={commentProps?.showCommentBadge}
|
|
1872
|
-
toggleCommentMode={toggleCommentMode}
|
|
1873
|
-
commentMode={commentMode}
|
|
1874
|
-
hideFontSize={hideFontSize}
|
|
1875
|
-
hideNumericFormat={hideNumericFormat}
|
|
1876
|
-
onContentDensityChange={onContentDensityChange}
|
|
1877
|
-
isCommentResolvedAlertOpen={isCommentResolvedAlertOpen}
|
|
1878
|
-
setIsCommentResolvedAlertOpen={setIsCommentResolvedAlertOpen}
|
|
1879
|
-
showCommentPanel={showCommentPanel}
|
|
1880
|
-
setShowCommentPanel={setShowCommentPanel}
|
|
1881
|
-
customTabInTableSettings={customTabInTableSettings}
|
|
1882
|
-
closeTableSettingOnOutsideClick={closeTableSettingOnOutsideClick}
|
|
1883
|
-
saveViewCustomFilter={saveViewCustomFilter}
|
|
1884
|
-
customRenderSaveViewContent={customRenderSaveViewContent}
|
|
1885
|
-
onTableSettingClick={onTableSettingClick}
|
|
1886
|
-
deleteViewPromptText={deleteViewPromptText}
|
|
1887
|
-
contentualFilterOpenByDefault={contentualFilterOpenByDefault}
|
|
1888
|
-
tableSettingsTitle={tableSettingsTitle}
|
|
1889
|
-
registerTableSettingToggle={handleRegisterTableSettingToggle}
|
|
1890
|
-
numericFormatDefault={numericFormatDefault}
|
|
1891
|
-
viewPoint={viewPoint}
|
|
1892
|
-
disableContextualFilter={disableContextualFilter}
|
|
1893
|
-
disableTableSettings={disableTableSettings}
|
|
1894
|
-
onAdvanceSortClick={() => setIsAdvanceSortOpen(true)}
|
|
1895
|
-
advanceSortEnabled={advanceSortEnabled}
|
|
1896
|
-
/>
|
|
1897
|
-
<BulkActionBar
|
|
1898
|
-
showBulkActionBar={showBulkActionBar}
|
|
1899
|
-
onSelectAllRows={onSelectAllRows}
|
|
1900
|
-
onClearSelection={onClearSelection}
|
|
1901
|
-
bulkActionBarProps={bulkActionBarProps}
|
|
1902
|
-
/>
|
|
1903
|
-
|
|
1904
|
-
{belowHeaderComponent && belowHeaderComponent}
|
|
1905
|
-
{!hideTableBody && finalColumnDefs?.length > 0 && (
|
|
1906
|
-
<div
|
|
1907
|
-
className={`impact-ag-grid-table ${
|
|
1908
|
-
viewPoint === "list" ? "list-view-wrapper" : ""
|
|
1909
|
-
}`}
|
|
1910
|
-
>
|
|
1911
|
-
<AgGridReact
|
|
1912
|
-
{...(({ components, ...rest }) => rest)(args)}
|
|
1913
|
-
components={wrappedComponents}
|
|
1914
|
-
ref={actualRef}
|
|
1915
|
-
suppressRowTransform={
|
|
1916
|
-
viewPoint === "list" ? false : args?.suppressRowTransform
|
|
1917
|
-
}
|
|
1918
|
-
suppressRowVirtualisation={
|
|
1919
|
-
viewPoint === "list" ? false : args?.suppressRowVirtualisation
|
|
1920
|
-
}
|
|
1921
|
-
domLayout={viewPoint === "list" ? "normal" : "autoHeight"}
|
|
1922
|
-
// domLayout="autoHeight"
|
|
1923
|
-
rowHeight={rowHeight}
|
|
1924
|
-
columnDefs={finalColumnDefs}
|
|
1925
|
-
headerHeight={40}
|
|
1926
|
-
defaultColDef={defaultColDef}
|
|
1927
|
-
enableRangeSelection
|
|
1928
|
-
suppressMenuHide
|
|
1929
|
-
getMainMenuItems={customGetMainMenuItems || getMainMenuItems}
|
|
1930
|
-
paginationPageSize={localPageSize}
|
|
1931
|
-
onPaginationChanged={paginationChanged}
|
|
1932
|
-
popupParent={document.body}
|
|
1933
|
-
onRowGroupOpened={updateExpandState}
|
|
1934
|
-
pagination={args.pagination}
|
|
1935
|
-
onCellClicked={onCellClicked}
|
|
1936
|
-
context={gridContext}
|
|
1937
|
-
onFirstDataRendered={onFirstDataRendered}
|
|
1938
|
-
animateRows={viewPoint === "list" ? true : args?.animateRows}
|
|
1939
|
-
ensureDomOrder={
|
|
1940
|
-
viewPoint === "list" ? false : args?.ensureDomOrder
|
|
1941
|
-
}
|
|
1942
|
-
enableCellTextSelection={
|
|
1943
|
-
viewPoint === "list" ? true : args?.enableCellTextSelection
|
|
1944
|
-
}
|
|
1945
|
-
getRowHeight={getRowHeightWrapper}
|
|
1946
|
-
getRowClass={getRowClassWrapper}
|
|
1947
|
-
onSortChanged={onGridSortChanged}
|
|
1948
|
-
/>
|
|
1949
|
-
<div
|
|
1950
|
-
className={`${
|
|
1951
|
-
showCommentPanel ? "show-comment-panel" : ""
|
|
1952
|
-
} comment-panel-wrapper`}
|
|
1953
|
-
>
|
|
1954
|
-
<CommentPanel
|
|
1955
|
-
showCommentPanel={showCommentPanel}
|
|
1956
|
-
setShowCommentPanel={setShowCommentPanel}
|
|
1957
|
-
comments={comments}
|
|
1958
|
-
onCommentItemClick={handleCommentItemClick}
|
|
1959
|
-
onMenuClick={handleMenuClick}
|
|
1960
|
-
onMarkAsReadClick={commentProps?.handleMarkAsRead}
|
|
1961
|
-
onMarkAsResolvedClick={handleMarkAsResolved}
|
|
1962
|
-
commentProps={commentProps}
|
|
1963
|
-
resolvedComments={resolvedComments}
|
|
1964
|
-
popup={popup}
|
|
1965
|
-
onShowResolvedCommentsRequest={
|
|
1966
|
-
commentProps?.handleFetchResolvedComments
|
|
1967
|
-
? async () => {
|
|
1968
|
-
// Save current state before replacing with resolved-only comments
|
|
1969
|
-
commentsBeforeResolvedViewRef.current = comments;
|
|
1970
|
-
resolvedCommentsBeforeResolvedViewRef.current =
|
|
1971
|
-
resolvedComments;
|
|
1972
|
-
const result =
|
|
1973
|
-
await commentProps.handleFetchResolvedComments();
|
|
1974
|
-
if (result) {
|
|
1975
|
-
if (result.comments !== undefined) {
|
|
1976
|
-
setComments(result.comments);
|
|
1977
|
-
}
|
|
1978
|
-
if (result.resolvedComments !== undefined) {
|
|
1979
|
-
setResolvedComments(result.resolvedComments);
|
|
1980
|
-
}
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1983
|
-
: undefined
|
|
1984
|
-
}
|
|
1985
|
-
onExitResolvedCommentsView={
|
|
1986
|
-
commentProps?.handleFetchResolvedComments
|
|
1987
|
-
? () => {
|
|
1988
|
-
// Restore original comments when user switches away from "Show resolved comments"
|
|
1989
|
-
if (
|
|
1990
|
-
commentsBeforeResolvedViewRef.current != null &&
|
|
1991
|
-
resolvedCommentsBeforeResolvedViewRef.current !=
|
|
1992
|
-
null
|
|
1993
|
-
) {
|
|
1994
|
-
setComments(commentsBeforeResolvedViewRef.current);
|
|
1995
|
-
setResolvedComments(
|
|
1996
|
-
resolvedCommentsBeforeResolvedViewRef.current
|
|
1997
|
-
);
|
|
1998
|
-
// Clear refs after restoring
|
|
1999
|
-
commentsBeforeResolvedViewRef.current = null;
|
|
2000
|
-
resolvedCommentsBeforeResolvedViewRef.current =
|
|
2001
|
-
null;
|
|
2002
|
-
}
|
|
2003
|
-
}
|
|
2004
|
-
: undefined
|
|
2005
|
-
}
|
|
2006
|
-
/>
|
|
2007
|
-
</div>
|
|
2008
|
-
</div>
|
|
2009
|
-
)}
|
|
2010
|
-
{(bottomLeftOptions || bottomCenterOptions || args.pagination) && (
|
|
2011
|
-
<div
|
|
2012
|
-
className={`table-footer-section ${
|
|
2013
|
-
!bottomLeftOptions && !bottomCenterOptions
|
|
2014
|
-
? "table-footer-section-with-only-pagination"
|
|
2015
|
-
: ""
|
|
2016
|
-
} ${
|
|
2017
|
-
!args.pagination
|
|
2018
|
-
? "table-footer-section-without-pagination"
|
|
2019
|
-
: ""
|
|
2020
|
-
}`}
|
|
2021
|
-
style={{
|
|
2022
|
-
width: hidePaginationPageSizeSelector && "60%",
|
|
2023
|
-
}}
|
|
2024
|
-
ref={buttonRef}
|
|
2025
|
-
>
|
|
2026
|
-
{bottomLeftOptions && (
|
|
2027
|
-
<div className="table-footer-left-section">
|
|
2028
|
-
{bottomLeftOptions}
|
|
2029
|
-
</div>
|
|
2030
|
-
)}
|
|
2031
|
-
{bottomCenterOptions && (
|
|
2032
|
-
<div className="table-footer-center-section">
|
|
2033
|
-
{bottomCenterOptions}
|
|
2034
|
-
</div>
|
|
2035
|
-
)}
|
|
2036
|
-
{!hidePaginationPageSizeSelector && args.pagination ? (
|
|
2037
|
-
<TablePagination
|
|
2038
|
-
actualRef={actualRef}
|
|
2039
|
-
localPageSize={localPageSize}
|
|
2040
|
-
setLocalPageSize={setLocalPageSize}
|
|
2041
|
-
paginationPageSizeSelector={
|
|
2042
|
-
paginationPageSizeSelector.length > 0
|
|
2043
|
-
? paginationPageSizeSelector
|
|
2044
|
-
: [10]
|
|
2045
|
-
}
|
|
2046
|
-
defaultPageSize={defaultPageSize}
|
|
2047
|
-
/>
|
|
2048
|
-
) : null}
|
|
2049
|
-
</div>
|
|
2050
|
-
)}
|
|
2051
|
-
{nestedTable && (
|
|
2052
|
-
<div className="nested-table-container" ref={nestedTableRef}>
|
|
2053
|
-
{nestedTableComponent}
|
|
2054
|
-
</div>
|
|
2055
|
-
)}
|
|
2056
|
-
{advanceSortEnabled && (
|
|
2057
|
-
<AdvanceSortModal
|
|
2058
|
-
open={isAdvanceSortOpen}
|
|
2059
|
-
onClose={() => setIsAdvanceSortOpen(false)}
|
|
2060
|
-
colDefs={actualRef.current?.api?.getColumnDefs() ?? colDefs}
|
|
2061
|
-
sortState={advanceSortState}
|
|
2062
|
-
onApply={handleAdvanceSortApply}
|
|
2063
|
-
/>
|
|
2064
|
-
)}
|
|
2065
|
-
{isAdvanceSearch && (
|
|
2066
|
-
<NewAdvanceSearchModal
|
|
2067
|
-
isAdvanceSearch={isAdvanceSearch}
|
|
2068
|
-
toggleAdvanceSearch={toggleNewAdvanceSearch}
|
|
2069
|
-
initialFilters={initialFilters}
|
|
2070
|
-
colDefs={colDefs}
|
|
2071
|
-
actualRef={actualRef}
|
|
2072
|
-
onSearchApplyClick={onSearchApplyClicks}
|
|
2073
|
-
setInitialFilters={setInitialFilters}
|
|
2074
|
-
currentColumnId={currentColumnId}
|
|
2075
|
-
/>
|
|
2076
|
-
)}
|
|
2077
|
-
{/* {isAdvanceSearch && (
|
|
2078
|
-
<TableAdvanceSearchModal
|
|
2079
|
-
isAdvanceSearch={isAdvanceSearch}
|
|
2080
|
-
draftFilter={draftFilter}
|
|
2081
|
-
setDraftFilter={setDraftFilter}
|
|
2082
|
-
toggleAdvanceSearch={toggleAdvanceSearch}
|
|
2083
|
-
colDefs={colDefs}
|
|
2084
|
-
actualRef={actualRef}
|
|
2085
|
-
onSearchApplyClick={onSearchApplyClicks}
|
|
2086
|
-
currentColumnId={currentColumnId}
|
|
2087
|
-
initialFilters={initialFilters}
|
|
2088
|
-
setInitialFilters={setInitialFilters}
|
|
2089
|
-
savedAdvanceSearchConfig={savedAdvanceSearchConfig}
|
|
2090
|
-
selectedThirdOptionDropdownValue={
|
|
2091
|
-
selectedThirdOptionDropdownValue
|
|
2092
|
-
}
|
|
2093
|
-
setSelectedThirdOptionDropdownValue={
|
|
2094
|
-
setSelectedThirdOptionDropdownValue
|
|
2095
|
-
}
|
|
2096
|
-
{...args}
|
|
2097
|
-
/>
|
|
2098
|
-
)} */}
|
|
2099
|
-
<CommentsPortal
|
|
2100
|
-
key={popup?.cellId || "comments-portal"}
|
|
2101
|
-
isOpen={!!popup}
|
|
2102
|
-
onClose={() => {
|
|
2103
|
-
setPopup(null);
|
|
2104
|
-
setEditingComment(null);
|
|
2105
|
-
setSelectedComment(null);
|
|
2106
|
-
setCommentError(null);
|
|
2107
|
-
}}
|
|
2108
|
-
comments={comments?.[popup?.cellId] ?? popup?.comment}
|
|
2109
|
-
cellId={popup?.cellId}
|
|
2110
|
-
onAddComment={handleAddComment}
|
|
2111
|
-
position={popup?.position}
|
|
2112
|
-
author={popup?.author}
|
|
2113
|
-
onMouseEnter={handleMouseEnter}
|
|
2114
|
-
onMouseLeave={handleMouseLeave}
|
|
2115
|
-
openedBy={popup?.openedBy}
|
|
2116
|
-
onMenuClick={handleMenuClick}
|
|
2117
|
-
onMarkAsReadClick={
|
|
2118
|
-
commentProps?.configuration?.disableMarkAsRead
|
|
2119
|
-
? null
|
|
2120
|
-
: commentProps?.handleMarkAsRead
|
|
2121
|
-
}
|
|
2122
|
-
onMarkAsResolvedClick={
|
|
2123
|
-
commentProps?.configuration?.disableMarkAsResolved
|
|
2124
|
-
? null
|
|
2125
|
-
: handleMarkAsResolved
|
|
2126
|
-
}
|
|
2127
|
-
editCommentText={editingComment?.text || ""}
|
|
2128
|
-
isLoading={isCommentLoading}
|
|
2129
|
-
error={commentError}
|
|
2130
|
-
onClearError={clearCommentError}
|
|
2131
|
-
currentAuthor={commentProps?.author}
|
|
2132
|
-
editingComment={editingComment}
|
|
2133
|
-
setEditingComment={setEditingComment}
|
|
2134
|
-
onUpdateComment={handleUpdateComment}
|
|
2135
|
-
loadParticipantsAvatar={commentProps?.loadParticipantsAvatar}
|
|
2136
|
-
resolvedComments={resolvedComments}
|
|
2137
|
-
messageId={popup?.messageId}
|
|
2138
|
-
configuration={commentProps?.configuration}
|
|
2139
|
-
/>
|
|
2140
|
-
<Menu
|
|
2141
|
-
anchorEl={menuAnchorEl}
|
|
2142
|
-
iconPlacement="left"
|
|
2143
|
-
onClose={handleMenuClose}
|
|
2144
|
-
open={Boolean(menuAnchorEl)}
|
|
2145
|
-
MenuProps={{
|
|
2146
|
-
sx: {
|
|
2147
|
-
zIndex: 9999,
|
|
2148
|
-
},
|
|
2149
|
-
}}
|
|
2150
|
-
options={getMenuOptions(currentMenuType)}
|
|
2151
|
-
/>
|
|
2152
|
-
<Prompt
|
|
2153
|
-
isOpen={showDeleteConfirmation}
|
|
2154
|
-
variant="error"
|
|
2155
|
-
title="Delete Comment"
|
|
2156
|
-
primaryButtonLabel={
|
|
2157
|
-
isDeleteConfirmationLoading ? "Deleting..." : "Delete"
|
|
2158
|
-
}
|
|
2159
|
-
secondaryButtonLabel="Cancel"
|
|
2160
|
-
onPrimaryButtonClick={handleDeleteConfirm}
|
|
2161
|
-
onSecondaryButtonClick={handleDeleteCancel}
|
|
2162
|
-
handleClose={handleDeleteCancel}
|
|
2163
|
-
primaryButtonProps={{
|
|
2164
|
-
type: "destructive",
|
|
2165
|
-
}}
|
|
2166
|
-
style={{ zIndex: 10000 }}
|
|
2167
|
-
>
|
|
2168
|
-
Are you sure you want to delete this comment? This action cannot be
|
|
2169
|
-
undone.
|
|
2170
|
-
</Prompt>
|
|
2171
|
-
</div>
|
|
2172
|
-
</div>
|
|
2173
|
-
);
|
|
2174
|
-
}
|
|
2175
|
-
);
|