@topconsultnpm/sdkui-react 6.20.0-dev1.10 → 6.20.0-dev1.101
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/lib/assets/Toppy-help-center.png +0 -0
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.d.ts +4 -0
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +441 -0
- package/lib/components/NewComponents/ContextMenu/hooks.d.ts +18 -0
- package/lib/components/NewComponents/ContextMenu/hooks.js +120 -0
- package/lib/components/NewComponents/ContextMenu/index.d.ts +5 -0
- package/lib/components/NewComponents/ContextMenu/index.js +3 -0
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +35 -0
- package/lib/components/NewComponents/ContextMenu/styles.js +428 -0
- package/lib/components/NewComponents/ContextMenu/types.d.ts +39 -0
- package/lib/components/NewComponents/ContextMenu/types.js +1 -0
- package/lib/components/NewComponents/ContextMenu/useLongPress.d.ts +21 -0
- package/lib/components/NewComponents/ContextMenu/useLongPress.js +112 -0
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.d.ts +4 -0
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +821 -0
- package/lib/components/NewComponents/FloatingMenuBar/index.d.ts +2 -0
- package/lib/components/NewComponents/FloatingMenuBar/index.js +2 -0
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +54 -0
- package/lib/components/NewComponents/FloatingMenuBar/styles.js +419 -0
- package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +36 -0
- package/lib/components/NewComponents/FloatingMenuBar/types.js +1 -0
- package/lib/components/base/TMAccordionNew.js +35 -14
- package/lib/components/base/TMCustomButton.js +61 -17
- package/lib/components/base/TMDataGrid.d.ts +7 -4
- package/lib/components/base/TMDataGrid.js +153 -11
- package/lib/components/base/TMDropDownMenu.js +19 -18
- package/lib/components/base/TMFileManager.d.ts +4 -3
- package/lib/components/base/TMFileManager.js +32 -24
- package/lib/components/base/TMFileManagerDataGridView.d.ts +3 -2
- package/lib/components/base/TMFileManagerDataGridView.js +1 -11
- package/lib/components/base/TMFileManagerThumbnailItems.d.ts +7 -1
- package/lib/components/base/TMFileManagerThumbnailItems.js +5 -2
- package/lib/components/base/TMFileManagerThumbnailsView.d.ts +17 -4
- package/lib/components/base/TMFileManagerThumbnailsView.js +18 -6
- package/lib/components/base/TMFileManagerUtils.d.ts +0 -12
- package/lib/components/base/TMListView.js +33 -15
- package/lib/components/base/TMPanel.d.ts +1 -1
- package/lib/components/base/TMPanel.js +1 -1
- package/lib/components/choosers/TMDistinctValues.js +1 -1
- package/lib/components/choosers/TMInvoiceRetrieveFormats.js +1 -1
- package/lib/components/choosers/TMMetadataChooser.js +8 -1
- package/lib/components/choosers/TMOrderRetrieveFormats.js +1 -1
- package/lib/components/choosers/TMUserChooser.d.ts +0 -5
- package/lib/components/choosers/TMUserChooser.js +25 -45
- package/lib/components/editors/TMDateBox.js +18 -9
- package/lib/components/editors/TMMetadataValues.js +23 -5
- package/lib/components/editors/TMTextArea.js +18 -30
- package/lib/components/editors/TMTextBox.js +6 -3
- package/lib/components/features/archive/TMArchive.js +2 -2
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.d.ts +15 -0
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.js +460 -0
- package/lib/components/features/assistant/TMToppySpeechBubble.d.ts +11 -0
- package/lib/components/features/assistant/TMToppySpeechBubble.js +126 -0
- package/lib/components/features/documents/TMDcmtForm.d.ts +14 -2
- package/lib/components/features/documents/TMDcmtForm.js +457 -206
- package/lib/components/features/documents/TMDcmtPreview.js +45 -108
- package/lib/components/features/documents/TMDcmtTasks.js +9 -9
- package/lib/components/features/documents/TMMasterDetailDcmts.js +38 -53
- package/lib/components/features/documents/TMRelationViewer.d.ts +1 -1
- package/lib/components/features/documents/TMRelationViewer.js +2 -2
- package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +8 -0
- package/lib/components/features/search/{TMSearchResultCheckoutInfoForm.js → TMDcmtCheckoutInfoForm.js} +2 -2
- package/lib/components/features/search/TMSavedQuerySelector.js +72 -67
- package/lib/components/features/search/TMSearch.d.ts +3 -0
- package/lib/components/features/search/TMSearch.js +50 -11
- package/lib/components/features/search/TMSearchQueryPanel.d.ts +1 -0
- package/lib/components/features/search/TMSearchQueryPanel.js +29 -21
- package/lib/components/features/search/TMSearchResult.d.ts +3 -0
- package/lib/components/features/search/TMSearchResult.js +208 -250
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +3 -3
- package/lib/components/features/search/TMSearchResultsMenuItems.js +205 -169
- package/lib/components/features/search/TMSignSettingsForm.js +1 -1
- package/lib/components/features/search/TMSignatureInfoContent.d.ts +6 -0
- package/lib/components/features/search/TMSignatureInfoContent.js +140 -0
- package/lib/components/features/search/TMViewHistoryDcmt.js +2 -2
- package/lib/components/features/tasks/TMTaskForm.js +20 -1
- package/lib/components/features/tasks/TMTasksAgenda.d.ts +3 -1
- package/lib/components/features/tasks/TMTasksAgenda.js +48 -9
- package/lib/components/features/tasks/TMTasksCalendar.d.ts +2 -0
- package/lib/components/features/tasks/TMTasksCalendar.js +19 -7
- package/lib/components/features/tasks/TMTasksUtils.d.ts +2 -2
- package/lib/components/features/tasks/TMTasksUtils.js +43 -36
- package/lib/components/features/tasks/TMTasksView.js +28 -19
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +33 -2
- package/lib/components/features/workflow/TMWorkflowPopup.js +139 -34
- package/lib/components/features/workflow/diagram/DiagramItemComponent.d.ts +2 -0
- package/lib/components/features/workflow/diagram/DiagramItemComponent.js +12 -7
- package/lib/components/features/workflow/diagram/RecipientList.js +3 -2
- package/lib/components/features/workflow/diagram/WFDiagram.d.ts +4 -0
- package/lib/components/features/workflow/diagram/WFDiagram.js +164 -13
- package/lib/components/forms/Login/LoginValidatorService.d.ts +2 -0
- package/lib/components/forms/Login/LoginValidatorService.js +7 -2
- package/lib/components/forms/Login/TMLoginForm.js +34 -6
- package/lib/components/forms/TMChooserForm.js +1 -1
- package/lib/components/grids/TMBlogsPost.js +56 -31
- package/lib/components/grids/TMRecentsManager.js +20 -10
- package/lib/components/index.d.ts +5 -3
- package/lib/components/index.js +5 -3
- package/lib/components/query/TMQueryEditor.d.ts +2 -1
- package/lib/components/query/TMQueryEditor.js +92 -92
- package/lib/components/settings/SettingsAppearance.d.ts +2 -1
- package/lib/components/settings/SettingsAppearance.js +99 -30
- package/lib/components/viewers/TMDataListItemViewer.d.ts +2 -1
- package/lib/components/viewers/TMDataListItemViewer.js +35 -71
- package/lib/components/viewers/TMDataUserIdItemViewer.d.ts +8 -0
- package/lib/components/viewers/TMDataUserIdItemViewer.js +39 -0
- package/lib/css/tm-sdkui.css +1 -1
- package/lib/helper/SDKUI_Globals.d.ts +22 -0
- package/lib/helper/SDKUI_Globals.js +10 -1
- package/lib/helper/SDKUI_Localizator.d.ts +17 -1
- package/lib/helper/SDKUI_Localizator.js +167 -1
- package/lib/helper/TMCommandsContextMenu.d.ts +4 -2
- package/lib/helper/TMCommandsContextMenu.js +15 -4
- package/lib/helper/TMIcons.d.ts +4 -0
- package/lib/helper/TMIcons.js +13 -3
- package/lib/helper/TMPdfViewer.d.ts +8 -0
- package/lib/helper/TMPdfViewer.js +373 -0
- package/lib/helper/checkinCheckoutManager.d.ts +31 -1
- package/lib/helper/checkinCheckoutManager.js +112 -30
- package/lib/helper/devextremeCustomMessages.d.ts +30 -0
- package/lib/helper/devextremeCustomMessages.js +30 -0
- package/lib/helper/helpers.d.ts +3 -1
- package/lib/helper/helpers.js +25 -3
- package/lib/helper/index.d.ts +2 -0
- package/lib/helper/index.js +2 -0
- package/lib/helper/queryHelper.d.ts +1 -1
- package/lib/helper/queryHelper.js +33 -3
- package/lib/helper/workItemsHelper.d.ts +6 -0
- package/lib/helper/workItemsHelper.js +230 -0
- package/lib/hooks/useCheckInOutOperations.d.ts +28 -0
- package/lib/hooks/useCheckInOutOperations.js +223 -0
- package/lib/hooks/useDataListItem.d.ts +12 -0
- package/lib/hooks/useDataListItem.js +132 -0
- package/lib/hooks/useDataUserIdItem.d.ts +10 -0
- package/lib/hooks/useDataUserIdItem.js +96 -0
- package/lib/hooks/useSettingsFeedback.d.ts +11 -0
- package/lib/hooks/useSettingsFeedback.js +38 -0
- package/lib/hooks/useWorkflowApprove.d.ts +4 -0
- package/lib/hooks/useWorkflowApprove.js +14 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -2
- package/lib/services/platform_services.d.ts +3 -3
- package/lib/ts/types.d.ts +61 -1
- package/lib/utils/theme.d.ts +1 -1
- package/lib/utils/theme.js +1 -1
- package/package.json +7 -4
- package/lib/components/base/TMContextMenu.d.ts +0 -25
- package/lib/components/base/TMContextMenu.js +0 -109
- package/lib/components/base/TMContextMenuOLD.d.ts +0 -26
- package/lib/components/base/TMContextMenuOLD.js +0 -56
- package/lib/components/base/TMFloatingToolbar.d.ts +0 -9
- package/lib/components/base/TMFloatingToolbar.js +0 -101
- package/lib/components/features/assistant/ToppyDraggableHelpCenter.d.ts +0 -30
- package/lib/components/features/assistant/ToppyDraggableHelpCenter.js +0 -482
- package/lib/components/features/assistant/ToppySpeechBubble.d.ts +0 -9
- package/lib/components/features/assistant/ToppySpeechBubble.js +0 -117
- package/lib/components/features/search/TMSearchResultCheckoutInfoForm.d.ts +0 -8
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
import styled, { keyframes } from 'styled-components';
|
|
2
|
+
const fadeIn = keyframes `
|
|
3
|
+
from {
|
|
4
|
+
opacity: 0;
|
|
5
|
+
transform: scale(0.95);
|
|
6
|
+
}
|
|
7
|
+
to {
|
|
8
|
+
opacity: 1;
|
|
9
|
+
transform: scale(1);
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
const slideIn = keyframes `
|
|
13
|
+
from {
|
|
14
|
+
opacity: 0;
|
|
15
|
+
transform: translateX(-10px);
|
|
16
|
+
}
|
|
17
|
+
to {
|
|
18
|
+
opacity: 1;
|
|
19
|
+
transform: translateX(0);
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
export const MenuContainer = styled.div `
|
|
23
|
+
position: fixed;
|
|
24
|
+
left: ${props => props.$openLeft ? 'auto' : `${props.$x}px`};
|
|
25
|
+
right: ${props => props.$openLeft ? `${window.innerWidth - props.$x}px` : 'auto'};
|
|
26
|
+
top: ${props => props.$openUp ? 'auto' : `${props.$y}px`};
|
|
27
|
+
bottom: ${props => props.$openUp ? `${window.innerHeight - props.$y}px` : 'auto'};
|
|
28
|
+
z-index: 10100;
|
|
29
|
+
background: #ffffff;
|
|
30
|
+
border-radius: 12px;
|
|
31
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12),
|
|
32
|
+
0 2px 8px rgba(0, 0, 0, 0.08);
|
|
33
|
+
min-width: max-content;
|
|
34
|
+
width: max-content;
|
|
35
|
+
padding: 4px 0;
|
|
36
|
+
animation: ${fadeIn} 0.15s ease-out;
|
|
37
|
+
backdrop-filter: blur(10px);
|
|
38
|
+
border: 1px solid rgba(0, 0, 0, 0.06);
|
|
39
|
+
opacity: ${props => props.$isPositioned ? 1 : 0};
|
|
40
|
+
transition: opacity 0.05s ease-in;
|
|
41
|
+
|
|
42
|
+
/* Add scrolling when menu is too tall to fit in either direction */
|
|
43
|
+
${props => props.$needsScroll && props.$maxHeight && `
|
|
44
|
+
max-height: ${props.$maxHeight}px;
|
|
45
|
+
overflow-y: auto;
|
|
46
|
+
overflow-x: hidden;
|
|
47
|
+
|
|
48
|
+
/* Smooth scrolling */
|
|
49
|
+
scroll-behavior: smooth;
|
|
50
|
+
|
|
51
|
+
/* Custom scrollbar styling */
|
|
52
|
+
&::-webkit-scrollbar {
|
|
53
|
+
width: 8px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&::-webkit-scrollbar-track {
|
|
57
|
+
background: rgba(0, 0, 0, 0.05);
|
|
58
|
+
border-radius: 4px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&::-webkit-scrollbar-thumb {
|
|
62
|
+
background: rgba(0, 0, 0, 0.2);
|
|
63
|
+
border-radius: 4px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&::-webkit-scrollbar-thumb:hover {
|
|
67
|
+
background: rgba(0, 0, 0, 0.3);
|
|
68
|
+
}
|
|
69
|
+
`}
|
|
70
|
+
|
|
71
|
+
/* Reset color inheritance from parent with !important to override panel header styles */
|
|
72
|
+
& *:not(svg):not(.right-icon-btn):not(.right-icon-btn *) {
|
|
73
|
+
color: #1a1a1a !important;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
[data-theme='dark'] & {
|
|
77
|
+
background: #2a2a2a;
|
|
78
|
+
border-color: rgba(255, 255, 255, 0.1);
|
|
79
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
|
|
80
|
+
0 2px 8px rgba(0, 0, 0, 0.3);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
[data-theme='dark'] & *:not(svg):not(.right-icon-btn):not(.right-icon-btn *) {
|
|
84
|
+
color: #e0e0e0 !important;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
${props => props.$externalControl && `
|
|
88
|
+
@media (max-width: 768px) {
|
|
89
|
+
left: 75px !important;
|
|
90
|
+
right: 75px !important;
|
|
91
|
+
max-width: calc(100vw - 150px);
|
|
92
|
+
width: auto;
|
|
93
|
+
min-width: auto;
|
|
94
|
+
}
|
|
95
|
+
`}
|
|
96
|
+
`;
|
|
97
|
+
export const MenuItem = styled.div `
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
justify-content: space-between;
|
|
101
|
+
padding: 4px 12px;
|
|
102
|
+
cursor: ${props => props.$disabled ? 'default' : 'pointer'};
|
|
103
|
+
transition: all 0.15s ease;
|
|
104
|
+
position: relative;
|
|
105
|
+
user-select: none;
|
|
106
|
+
font-size: var(--base-font-size, 13px);
|
|
107
|
+
color: ${props => props.$disabled ? '#999' : '#1a1a1a'};
|
|
108
|
+
font-weight: 500;
|
|
109
|
+
${props => props.$beginGroup && `
|
|
110
|
+
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
|
111
|
+
margin-top: 4px;
|
|
112
|
+
padding-top: 8px;
|
|
113
|
+
`}
|
|
114
|
+
|
|
115
|
+
/* Apply opacity only to direct children except right-icon-btn */
|
|
116
|
+
& > *:not(.right-icon-btn) {
|
|
117
|
+
opacity: ${props => props.$disabled ? 0.4 : 1};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* Right icon button hidden by default, shown on hover */
|
|
121
|
+
& .right-icon-btn {
|
|
122
|
+
cursor: pointer !important;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&:hover {
|
|
126
|
+
${props => !props.$disabled && `
|
|
127
|
+
background: linear-gradient(90deg, #f0f7ff 0%, #e6f2ff 100%);
|
|
128
|
+
color: #0066cc;
|
|
129
|
+
`}
|
|
130
|
+
|
|
131
|
+
/* Show right icon on hover */
|
|
132
|
+
& .right-icon-btn {
|
|
133
|
+
opacity: 1 !important;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&:active {
|
|
138
|
+
${props => !props.$disabled && `
|
|
139
|
+
background: linear-gradient(90deg, #e6f2ff 0%, #d9ebff 100%);
|
|
140
|
+
transform: scale(0.98);
|
|
141
|
+
`}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
[data-theme='dark'] & {
|
|
145
|
+
color: ${props => props.$disabled ? '#666' : '#e0e0e0'};
|
|
146
|
+
${props => props.$beginGroup && `
|
|
147
|
+
border-top-color: rgba(255, 255, 255, 0.1);
|
|
148
|
+
`}
|
|
149
|
+
|
|
150
|
+
&:hover {
|
|
151
|
+
${props => !props.$disabled && `
|
|
152
|
+
background: linear-gradient(90deg, #1a3a52 0%, #1e4159 100%);
|
|
153
|
+
color: #4db8ff;
|
|
154
|
+
`}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&:active {
|
|
158
|
+
${props => !props.$disabled && `
|
|
159
|
+
background: linear-gradient(90deg, #1e4159 0%, #234a66 100%);
|
|
160
|
+
`}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
@media (max-width: 768px) {
|
|
165
|
+
padding: 4px 10px;
|
|
166
|
+
font-size: calc(var(--base-font-size, 13px) * 0.92);
|
|
167
|
+
}
|
|
168
|
+
`;
|
|
169
|
+
export const MenuItemContent = styled.div `
|
|
170
|
+
display: flex;
|
|
171
|
+
align-items: center;
|
|
172
|
+
gap: 10px;
|
|
173
|
+
flex: 1;
|
|
174
|
+
`;
|
|
175
|
+
export const IconWrapper = styled.span `
|
|
176
|
+
display: flex;
|
|
177
|
+
align-items: center;
|
|
178
|
+
justify-content: center;
|
|
179
|
+
font-size: calc(var(--base-font-size, 13px) * 1.08);
|
|
180
|
+
width: 18px;
|
|
181
|
+
height: 18px;
|
|
182
|
+
`;
|
|
183
|
+
export const MenuItemName = styled.span `
|
|
184
|
+
flex: 1;
|
|
185
|
+
white-space: normal;
|
|
186
|
+
word-wrap: break-word;
|
|
187
|
+
overflow-wrap: break-word;
|
|
188
|
+
line-height: 1.4;
|
|
189
|
+
`;
|
|
190
|
+
export const RightIconButton = styled.button.attrs({
|
|
191
|
+
className: 'right-icon-btn'
|
|
192
|
+
}) `
|
|
193
|
+
display: flex;
|
|
194
|
+
align-items: center;
|
|
195
|
+
justify-content: center;
|
|
196
|
+
background: transparent;
|
|
197
|
+
border: none;
|
|
198
|
+
cursor: pointer !important;
|
|
199
|
+
padding: 4px 8px;
|
|
200
|
+
margin-left: 8px;
|
|
201
|
+
border-radius: 6px;
|
|
202
|
+
font-size: calc(var(--base-font-size, 13px) * 1.08);
|
|
203
|
+
opacity: 0 !important;
|
|
204
|
+
transition: opacity 0.15s ease, background 0.15s ease, transform 0.15s ease;
|
|
205
|
+
|
|
206
|
+
&:hover {
|
|
207
|
+
background: rgba(0, 0, 0, 0.05);
|
|
208
|
+
transform: scale(1.1);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
&:active {
|
|
212
|
+
transform: scale(0.95);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
[data-theme='dark'] & {
|
|
216
|
+
&:hover {
|
|
217
|
+
background: rgba(255, 255, 255, 0.1);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
`;
|
|
221
|
+
export const SubmenuIndicator = styled.span `
|
|
222
|
+
display: flex;
|
|
223
|
+
align-items: center;
|
|
224
|
+
font-size: calc(var(--base-font-size, 13px) * 0.92);
|
|
225
|
+
margin-left: 8px;
|
|
226
|
+
opacity: 0.6;
|
|
227
|
+
transition: transform 0.15s ease;
|
|
228
|
+
|
|
229
|
+
${MenuItem}:hover:not([data-disabled="true"]) & {
|
|
230
|
+
${props => !props.$isMobile && `
|
|
231
|
+
transform: translateX(2px);
|
|
232
|
+
opacity: 1;
|
|
233
|
+
`}
|
|
234
|
+
}
|
|
235
|
+
`;
|
|
236
|
+
export const Submenu = styled.div `
|
|
237
|
+
position: fixed;
|
|
238
|
+
left: ${props => {
|
|
239
|
+
const spaceOnRight = globalThis.innerWidth - props.$parentRect.right;
|
|
240
|
+
return spaceOnRight > 240 ? `${props.$parentRect.right - 8}px` : 'auto';
|
|
241
|
+
}};
|
|
242
|
+
right: ${props => {
|
|
243
|
+
const spaceOnRight = globalThis.innerWidth - props.$parentRect.right;
|
|
244
|
+
return spaceOnRight > 240 ? 'auto' : `${globalThis.innerWidth - props.$parentRect.left + 8}px`;
|
|
245
|
+
}};
|
|
246
|
+
/* Vertical positioning: Each submenu independently decides direction based on its own space */
|
|
247
|
+
top: ${props => {
|
|
248
|
+
// If openUp is true, don't anchor to top
|
|
249
|
+
return props.$openUp ? 'auto' : `${props.$parentRect.top - 8}px`;
|
|
250
|
+
}};
|
|
251
|
+
bottom: ${props => {
|
|
252
|
+
// If openUp is true, anchor to bottom and grow upward
|
|
253
|
+
return props.$openUp ? `${globalThis.innerHeight - props.$parentRect.bottom - 8}px` : 'auto';
|
|
254
|
+
}};
|
|
255
|
+
z-index: 10101;
|
|
256
|
+
background: #ffffff;
|
|
257
|
+
border-radius: 12px;
|
|
258
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12),
|
|
259
|
+
0 2px 8px rgba(0, 0, 0, 0.08);
|
|
260
|
+
min-width: max-content;
|
|
261
|
+
width: max-content;
|
|
262
|
+
padding: 4px 0;
|
|
263
|
+
animation: ${slideIn} 0.15s ease-out;
|
|
264
|
+
backdrop-filter: blur(10px);
|
|
265
|
+
border: 1px solid rgba(0, 0, 0, 0.06);
|
|
266
|
+
|
|
267
|
+
/* Add invisible padding to bridge the gap - works for both sides */
|
|
268
|
+
&::before {
|
|
269
|
+
content: '';
|
|
270
|
+
position: absolute;
|
|
271
|
+
right: 100%;
|
|
272
|
+
top: 0;
|
|
273
|
+
bottom: 0;
|
|
274
|
+
width: 15px;
|
|
275
|
+
background: transparent;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/* Bridge on the right side for nested submenus */
|
|
279
|
+
&::after {
|
|
280
|
+
content: '';
|
|
281
|
+
position: absolute;
|
|
282
|
+
left: 100%;
|
|
283
|
+
top: 0;
|
|
284
|
+
bottom: 0;
|
|
285
|
+
width: 15px;
|
|
286
|
+
background: transparent;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/* Reset color inheritance from parent with !important to override panel header styles */
|
|
290
|
+
& *:not(svg):not(.right-icon-btn):not(.right-icon-btn *) {
|
|
291
|
+
color: #1a1a1a !important;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
[data-theme='dark'] & {
|
|
295
|
+
background: #2a2a2a;
|
|
296
|
+
border-color: rgba(255, 255, 255, 0.1);
|
|
297
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
|
|
298
|
+
0 2px 8px rgba(0, 0, 0, 0.3);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
[data-theme='dark'] & *:not(svg):not(.right-icon-btn):not(.right-icon-btn *) {
|
|
302
|
+
color: #e0e0e0 !important;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/* Dynamic scroll handling when submenu is too tall */
|
|
306
|
+
${props => props.$needsScroll && props.$maxHeight ? `
|
|
307
|
+
max-height: ${props.$maxHeight}px;
|
|
308
|
+
overflow-y: auto;
|
|
309
|
+
overflow-x: hidden;
|
|
310
|
+
|
|
311
|
+
/* Custom scrollbar styling for submenus */
|
|
312
|
+
&::-webkit-scrollbar {
|
|
313
|
+
width: 8px;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
&::-webkit-scrollbar-track {
|
|
317
|
+
background: rgba(0, 0, 0, 0.05);
|
|
318
|
+
border-radius: 4px;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
&::-webkit-scrollbar-thumb {
|
|
322
|
+
background: rgba(0, 0, 0, 0.2);
|
|
323
|
+
border-radius: 4px;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
&::-webkit-scrollbar-thumb:hover {
|
|
327
|
+
background: rgba(0, 0, 0, 0.3);
|
|
328
|
+
}
|
|
329
|
+
` : `
|
|
330
|
+
/* Fallback max-height for submenus that fit */
|
|
331
|
+
max-height: calc(100vh - 40px);
|
|
332
|
+
overflow-y: auto;
|
|
333
|
+
overflow-x: hidden;
|
|
334
|
+
|
|
335
|
+
&::-webkit-scrollbar {
|
|
336
|
+
width: 8px;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
&::-webkit-scrollbar-track {
|
|
340
|
+
background: rgba(0, 0, 0, 0.05);
|
|
341
|
+
border-radius: 4px;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
&::-webkit-scrollbar-thumb {
|
|
345
|
+
background: rgba(0, 0, 0, 0.2);
|
|
346
|
+
border-radius: 4px;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
&::-webkit-scrollbar-thumb:hover {
|
|
350
|
+
background: rgba(0, 0, 0, 0.3);
|
|
351
|
+
}
|
|
352
|
+
`}
|
|
353
|
+
|
|
354
|
+
[data-theme='dark'] & {
|
|
355
|
+
&::-webkit-scrollbar-track {
|
|
356
|
+
background: rgba(255, 255, 255, 0.05);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
&::-webkit-scrollbar-thumb {
|
|
360
|
+
background: rgba(255, 255, 255, 0.2);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
&::-webkit-scrollbar-thumb:hover {
|
|
364
|
+
background: rgba(255, 255, 255, 0.3);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
`;
|
|
368
|
+
export const MobileMenuHeader = styled.div `
|
|
369
|
+
display: flex;
|
|
370
|
+
align-items: center;
|
|
371
|
+
padding: 4px 8px;
|
|
372
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.08);
|
|
373
|
+
margin-bottom: 8px;
|
|
374
|
+
gap: 12px;
|
|
375
|
+
background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
|
|
376
|
+
border-radius: 12px 12px 0 0;
|
|
377
|
+
|
|
378
|
+
[data-theme='dark'] & {
|
|
379
|
+
background: linear-gradient(180deg, #1a1a1a 0%, #2a2a2a 100%);
|
|
380
|
+
border-bottom-color: rgba(255, 255, 255, 0.1);
|
|
381
|
+
}
|
|
382
|
+
`;
|
|
383
|
+
export const BackButton = styled.button `
|
|
384
|
+
display: flex;
|
|
385
|
+
align-items: center;
|
|
386
|
+
justify-content: center;
|
|
387
|
+
border: none;
|
|
388
|
+
border-radius: 8px;
|
|
389
|
+
width: 32px;
|
|
390
|
+
height: 32px;
|
|
391
|
+
cursor: pointer;
|
|
392
|
+
transition: all 0.15s ease;
|
|
393
|
+
font-size: 16px;
|
|
394
|
+
transform: translateY(-2px);
|
|
395
|
+
|
|
396
|
+
&:active {
|
|
397
|
+
transform: scale(0.95);
|
|
398
|
+
}
|
|
399
|
+
`;
|
|
400
|
+
export const HeaderTitle = styled.h3 `
|
|
401
|
+
margin: 0;
|
|
402
|
+
font-size: calc(var(--base-font-size, 13px) * 1.23);
|
|
403
|
+
font-weight: 600;
|
|
404
|
+
color: #1a1a1a;
|
|
405
|
+
flex: 1;
|
|
406
|
+
|
|
407
|
+
[data-theme='dark'] & {
|
|
408
|
+
color: #e0e0e0;
|
|
409
|
+
}
|
|
410
|
+
`;
|
|
411
|
+
export const MenuDivider = styled.div `
|
|
412
|
+
height: 1px;
|
|
413
|
+
background: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.1) 50%, transparent 100%);
|
|
414
|
+
margin: 8px 0;
|
|
415
|
+
|
|
416
|
+
[data-theme='dark'] & {
|
|
417
|
+
background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.1) 50%, transparent 100%);
|
|
418
|
+
}
|
|
419
|
+
`;
|
|
420
|
+
export const Overlay = styled.div `
|
|
421
|
+
position: fixed;
|
|
422
|
+
top: 0;
|
|
423
|
+
left: 0;
|
|
424
|
+
right: 0;
|
|
425
|
+
bottom: 0;
|
|
426
|
+
z-index: 9999;
|
|
427
|
+
background: transparent;
|
|
428
|
+
`;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface TMContextMenuItemProps {
|
|
2
|
+
id?: string;
|
|
3
|
+
name: string;
|
|
4
|
+
icon?: React.ReactNode;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
onClick?: (data?: any) => void;
|
|
7
|
+
submenu?: TMContextMenuItemProps[];
|
|
8
|
+
visible?: boolean;
|
|
9
|
+
rightIcon?: React.ReactNode;
|
|
10
|
+
onRightIconClick?: () => void;
|
|
11
|
+
beginGroup?: boolean;
|
|
12
|
+
tooltip?: string;
|
|
13
|
+
operationType?: 'singleRow' | 'multiRow';
|
|
14
|
+
}
|
|
15
|
+
export interface TMContextMenuProps {
|
|
16
|
+
items: TMContextMenuItemProps[];
|
|
17
|
+
trigger?: 'right' | 'left';
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
target?: string;
|
|
20
|
+
externalControl?: {
|
|
21
|
+
visible: boolean;
|
|
22
|
+
position: {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
};
|
|
26
|
+
onClose: () => void;
|
|
27
|
+
};
|
|
28
|
+
keepOpenOnClick?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface Position {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
}
|
|
34
|
+
export interface MenuState {
|
|
35
|
+
visible: boolean;
|
|
36
|
+
position: Position;
|
|
37
|
+
submenuStack: TMContextMenuItemProps[][];
|
|
38
|
+
parentNames: string[];
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface UseLongPressOptions {
|
|
2
|
+
containerRef: React.RefObject<HTMLElement>;
|
|
3
|
+
targetSelector: string | string[];
|
|
4
|
+
onLongPress: (event: {
|
|
5
|
+
clientX: number;
|
|
6
|
+
clientY: number;
|
|
7
|
+
target: HTMLElement;
|
|
8
|
+
}) => void;
|
|
9
|
+
onTouchStart?: (event: {
|
|
10
|
+
clientX: number;
|
|
11
|
+
clientY: number;
|
|
12
|
+
target: HTMLElement;
|
|
13
|
+
rowElement: HTMLElement;
|
|
14
|
+
}) => void;
|
|
15
|
+
duration?: number;
|
|
16
|
+
moveThreshold?: number;
|
|
17
|
+
hapticFeedback?: boolean;
|
|
18
|
+
enabled?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare function useLongPress({ containerRef, targetSelector, onLongPress, onTouchStart, duration, moveThreshold, hapticFeedback, enabled, }: UseLongPressOptions): void;
|
|
21
|
+
export declare function triggerContextMenuEvent(target: HTMLElement, clientX: number, clientY: number): void;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { useIsIOS } from './hooks';
|
|
3
|
+
export function useLongPress({ containerRef, targetSelector, onLongPress, onTouchStart, duration = 500, moveThreshold = 10, hapticFeedback = true, enabled = true, }) {
|
|
4
|
+
const isIOS = useIsIOS();
|
|
5
|
+
const longPressTriggeredRef = useRef(false);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (!isIOS || !enabled || !containerRef.current)
|
|
8
|
+
return;
|
|
9
|
+
const container = containerRef.current;
|
|
10
|
+
let longPressTimeout = null;
|
|
11
|
+
let touchStartPos = null;
|
|
12
|
+
let longPressTarget = null;
|
|
13
|
+
const matchesSelector = (element) => {
|
|
14
|
+
const selectors = Array.isArray(targetSelector) ? targetSelector : [targetSelector];
|
|
15
|
+
for (const selector of selectors) {
|
|
16
|
+
const match = element.closest(selector);
|
|
17
|
+
if (match)
|
|
18
|
+
return match;
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
};
|
|
22
|
+
const handleTouchStart = (e) => {
|
|
23
|
+
const touch = e.touches[0];
|
|
24
|
+
const target = touch.target;
|
|
25
|
+
// Check if target matches any of the specified selectors
|
|
26
|
+
const matchedElement = matchesSelector(target);
|
|
27
|
+
if (!matchedElement)
|
|
28
|
+
return;
|
|
29
|
+
touchStartPos = { x: touch.clientX, y: touch.clientY };
|
|
30
|
+
longPressTriggeredRef.current = false;
|
|
31
|
+
longPressTarget = target;
|
|
32
|
+
// Call optional onTouchStart callback
|
|
33
|
+
if (onTouchStart) {
|
|
34
|
+
onTouchStart({
|
|
35
|
+
clientX: touch.clientX,
|
|
36
|
+
clientY: touch.clientY,
|
|
37
|
+
target,
|
|
38
|
+
rowElement: matchedElement,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (longPressTimeout)
|
|
42
|
+
clearTimeout(longPressTimeout);
|
|
43
|
+
longPressTimeout = setTimeout(() => {
|
|
44
|
+
longPressTriggeredRef.current = true;
|
|
45
|
+
// Haptic feedback
|
|
46
|
+
if (hapticFeedback && 'vibrate' in navigator) {
|
|
47
|
+
navigator.vibrate(50);
|
|
48
|
+
}
|
|
49
|
+
// Call onLongPress callback
|
|
50
|
+
onLongPress({
|
|
51
|
+
clientX: touch.clientX,
|
|
52
|
+
clientY: touch.clientY,
|
|
53
|
+
target: longPressTarget,
|
|
54
|
+
});
|
|
55
|
+
longPressTimeout = null;
|
|
56
|
+
}, duration);
|
|
57
|
+
};
|
|
58
|
+
const handleTouchMove = (e) => {
|
|
59
|
+
if (!touchStartPos || !longPressTimeout)
|
|
60
|
+
return;
|
|
61
|
+
const touch = e.touches[0];
|
|
62
|
+
const dx = Math.abs(touch.clientX - touchStartPos.x);
|
|
63
|
+
const dy = Math.abs(touch.clientY - touchStartPos.y);
|
|
64
|
+
// Cancel long-press if finger moved too much
|
|
65
|
+
if (dx > moveThreshold || dy > moveThreshold) {
|
|
66
|
+
clearTimeout(longPressTimeout);
|
|
67
|
+
longPressTimeout = null;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const handleTouchEnd = () => {
|
|
71
|
+
if (longPressTimeout) {
|
|
72
|
+
clearTimeout(longPressTimeout);
|
|
73
|
+
longPressTimeout = null;
|
|
74
|
+
}
|
|
75
|
+
touchStartPos = null;
|
|
76
|
+
longPressTarget = null;
|
|
77
|
+
};
|
|
78
|
+
// Prevent click after long-press to avoid unintended actions
|
|
79
|
+
const handleClick = (e) => {
|
|
80
|
+
if (longPressTriggeredRef.current) {
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
e.stopPropagation();
|
|
83
|
+
e.stopImmediatePropagation();
|
|
84
|
+
longPressTriggeredRef.current = false;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
container.addEventListener('touchstart', handleTouchStart, { passive: true });
|
|
88
|
+
container.addEventListener('touchmove', handleTouchMove, { passive: true });
|
|
89
|
+
container.addEventListener('touchend', handleTouchEnd);
|
|
90
|
+
container.addEventListener('touchcancel', handleTouchEnd);
|
|
91
|
+
container.addEventListener('click', handleClick, { capture: true });
|
|
92
|
+
return () => {
|
|
93
|
+
if (longPressTimeout)
|
|
94
|
+
clearTimeout(longPressTimeout);
|
|
95
|
+
container.removeEventListener('touchstart', handleTouchStart);
|
|
96
|
+
container.removeEventListener('touchmove', handleTouchMove);
|
|
97
|
+
container.removeEventListener('touchend', handleTouchEnd);
|
|
98
|
+
container.removeEventListener('touchcancel', handleTouchEnd);
|
|
99
|
+
container.removeEventListener('click', handleClick, { capture: true });
|
|
100
|
+
};
|
|
101
|
+
}, [isIOS, enabled, containerRef, targetSelector, onLongPress, onTouchStart, duration, moveThreshold, hapticFeedback]);
|
|
102
|
+
}
|
|
103
|
+
export function triggerContextMenuEvent(target, clientX, clientY) {
|
|
104
|
+
const contextMenuEvent = new MouseEvent('contextmenu', {
|
|
105
|
+
bubbles: true,
|
|
106
|
+
cancelable: true,
|
|
107
|
+
clientX,
|
|
108
|
+
clientY,
|
|
109
|
+
button: 2,
|
|
110
|
+
});
|
|
111
|
+
target.dispatchEvent(contextMenuEvent);
|
|
112
|
+
}
|