@orbe-agro/client-core 5.6.130 → 5.6.132
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/dist/@ecme/assets/styles/app.css +3 -15
- package/dist/@ecme/assets/styles/tailwind/index.css +3 -15
- package/dist/@ecme/components/index.js +8 -6
- package/dist/@ecme/components/index.js.map +1 -1
- package/dist/@ecme/components/template/VerticalMenuContent/VerticalMenuContent.stories.js +10 -241
- package/dist/@ecme/components/template/VerticalMenuContent/VerticalMenuContent.stories.js.map +1 -1
- package/dist/@ecme/components/template/VerticalMenuContent/VerticalSingleMenuItem.js +3 -17
- package/dist/@ecme/components/template/VerticalMenuContent/VerticalSingleMenuItem.js.map +1 -1
- package/dist/@ecme/components/ui/UploadCustom/UploadCustom.js +134 -0
- package/dist/@ecme/components/ui/UploadCustom/UploadCustom.js.map +1 -0
- package/dist/@ecme/components/ui/UploadCustom/index.js +6 -0
- package/dist/@ecme/components/ui/UploadCustom/index.js.map +1 -0
- package/dist/@ecme/components/ui/index.js +5 -2
- package/dist/@ecme/components/ui/index.js.map +1 -1
- package/dist/@ecme/index.js +76 -74
- package/dist/@ecme/index.js.map +1 -1
- package/dist/@types/@ecme/components/template/VerticalMenuContent/VerticalMenuContent.stories.d.ts +0 -8
- package/dist/@types/@ecme/components/template/VerticalMenuContent/VerticalMenuContent.stories.d.ts.map +1 -1
- package/dist/@types/@ecme/components/template/VerticalMenuContent/VerticalSingleMenuItem.d.ts.map +1 -1
- package/dist/@types/@ecme/components/ui/UploadCustom/UploadCustom.d.ts +15 -0
- package/dist/@types/@ecme/components/ui/UploadCustom/UploadCustom.d.ts.map +1 -0
- package/dist/@types/@ecme/components/ui/UploadCustom/index.d.ts +5 -0
- package/dist/@types/@ecme/components/ui/UploadCustom/index.d.ts.map +1 -0
- package/dist/@types/@ecme/components/ui/index.d.ts +2 -0
- package/dist/@types/@ecme/components/ui/index.d.ts.map +1 -1
- package/dist/@types/base/@types/models/ativos/anexoComponente.d.ts +1 -0
- package/dist/@types/base/@types/models/ativos/anexoComponente.d.ts.map +1 -1
- package/dist/@types/base/@types/models/ativos/sistemaOperacional.d.ts +3 -3
- package/dist/@types/base/@types/models/ativos/sistemaOperacional.d.ts.map +1 -1
- package/dist/@types/base/@types/models/ativos/software.d.ts +7 -7
- package/dist/@types/base/@types/models/ativos/software.d.ts.map +1 -1
- package/dist/@types/base/@types/models/ativos/versaoMSOffice.d.ts +4 -4
- package/dist/@types/base/@types/models/ativos/versaoMSOffice.d.ts.map +1 -1
- package/dist/base/assets/styles/init.css +3 -15
- package/lib/@ecme/components/template/VerticalMenuContent/VerticalMenuContent.stories.tsx +13 -252
- package/lib/@ecme/components/template/VerticalMenuContent/VerticalSingleMenuItem.tsx +3 -25
- package/lib/@ecme/components/ui/UploadCustom/UploadCustom.tsx +169 -0
- package/lib/@ecme/components/ui/UploadCustom/index.tsx +6 -0
- package/lib/@ecme/components/ui/index.ts +2 -0
- package/lib/base/@types/models/ativos/anexoComponente.ts +1 -0
- package/lib/base/@types/models/ativos/sistemaOperacional.ts +3 -3
- package/lib/base/@types/models/ativos/software.ts +7 -7
- package/lib/base/@types/models/ativos/versaoMSOffice.ts +4 -4
- package/package.json +1 -1
|
@@ -2,12 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react'
|
|
|
2
2
|
import { BrowserRouter } from 'react-router-dom'
|
|
3
3
|
import VerticalMenuContent from './VerticalMenuContent'
|
|
4
4
|
import type { NavigationTree } from '@/@types/navigation'
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
NAV_ITEM_TYPE_COLLAPSE,
|
|
8
|
-
NAV_ITEM_TYPE_ITEM,
|
|
9
|
-
NAV_ITEM_TYPE_TITLE,
|
|
10
|
-
} from '@/constants/navigation.constant'
|
|
5
|
+
import modulesNavigationConfig from '@base/configs/navigation.config/modules.navigation'
|
|
11
6
|
|
|
12
7
|
const collectAuthorityPaths = (navTree: NavigationTree[]): string[] => {
|
|
13
8
|
return navTree.reduce((acc: string[], node) => {
|
|
@@ -23,151 +18,10 @@ const collectAuthorityPaths = (navTree: NavigationTree[]): string[] => {
|
|
|
23
18
|
}, [])
|
|
24
19
|
}
|
|
25
20
|
|
|
26
|
-
const
|
|
27
|
-
new Set(collectAuthorityPaths(
|
|
21
|
+
const allAuthority = Array.from(
|
|
22
|
+
new Set(collectAuthorityPaths(modulesNavigationConfig)),
|
|
28
23
|
)
|
|
29
24
|
|
|
30
|
-
const ticketSubmenuAllExpanded: NavigationTree[] = ticketNavigationConfig.map(
|
|
31
|
-
(menu) => {
|
|
32
|
-
if (menu.key !== 'ticket') {
|
|
33
|
-
return menu
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
...menu,
|
|
38
|
-
subMenu: menu.subMenu.map((subMenu) => {
|
|
39
|
-
if (
|
|
40
|
-
subMenu.key === 'ticket.relatorios' ||
|
|
41
|
-
subMenu.key === 'ticket.cadastros'
|
|
42
|
-
) {
|
|
43
|
-
return {
|
|
44
|
-
...subMenu,
|
|
45
|
-
type: NAV_ITEM_TYPE_TITLE,
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return subMenu
|
|
50
|
-
}),
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
const mockNavigationTree: NavigationTree[] = [
|
|
56
|
-
{
|
|
57
|
-
key: 'inicio',
|
|
58
|
-
path: '/inicio',
|
|
59
|
-
title: 'Início',
|
|
60
|
-
translateKey: 'nav.inicio',
|
|
61
|
-
icon: '',
|
|
62
|
-
type: NAV_ITEM_TYPE_ITEM,
|
|
63
|
-
authority: ['/inicio'],
|
|
64
|
-
subMenu: [],
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
key: 'cadastros',
|
|
68
|
-
path: '',
|
|
69
|
-
title: 'Cadastros',
|
|
70
|
-
translateKey: 'nav.cadastros',
|
|
71
|
-
icon: '',
|
|
72
|
-
type: NAV_ITEM_TYPE_COLLAPSE,
|
|
73
|
-
authority: ['/cadastros'],
|
|
74
|
-
subMenu: [
|
|
75
|
-
{
|
|
76
|
-
key: 'clientes',
|
|
77
|
-
path: '/cadastros/clientes',
|
|
78
|
-
title: 'Clientes',
|
|
79
|
-
translateKey: 'nav.clientes',
|
|
80
|
-
icon: '',
|
|
81
|
-
type: NAV_ITEM_TYPE_ITEM,
|
|
82
|
-
authority: ['/cadastros/clientes'],
|
|
83
|
-
subMenu: [],
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
key: 'fornecedores',
|
|
87
|
-
path: '/cadastros/fornecedores',
|
|
88
|
-
title: 'Fornecedores',
|
|
89
|
-
translateKey: 'nav.fornecedores',
|
|
90
|
-
icon: '',
|
|
91
|
-
type: NAV_ITEM_TYPE_ITEM,
|
|
92
|
-
authority: ['/cadastros/fornecedores'],
|
|
93
|
-
subMenu: [],
|
|
94
|
-
},
|
|
95
|
-
],
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
key: 'relatorios',
|
|
99
|
-
path: '/relatorios',
|
|
100
|
-
title: 'Relatórios',
|
|
101
|
-
translateKey: 'nav.relatorios',
|
|
102
|
-
icon: 'ChartBarIcon',
|
|
103
|
-
type: NAV_ITEM_TYPE_ITEM,
|
|
104
|
-
authority: ['/relatorios'],
|
|
105
|
-
subMenu: [],
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
key: 'configuracoes',
|
|
109
|
-
path: '',
|
|
110
|
-
title: 'Configurações',
|
|
111
|
-
translateKey: 'nav.configuracoes',
|
|
112
|
-
icon: '',
|
|
113
|
-
type: NAV_ITEM_TYPE_COLLAPSE,
|
|
114
|
-
authority: ['/configuracoes'],
|
|
115
|
-
subMenu: [
|
|
116
|
-
{
|
|
117
|
-
key: 'perfil',
|
|
118
|
-
path: '/configuracoes/perfil',
|
|
119
|
-
title: 'Perfil',
|
|
120
|
-
translateKey: 'nav.perfil',
|
|
121
|
-
icon: '',
|
|
122
|
-
type: NAV_ITEM_TYPE_ITEM,
|
|
123
|
-
authority: ['/configuracoes/perfil'],
|
|
124
|
-
subMenu: [],
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
key: 'integracoes',
|
|
128
|
-
path: '',
|
|
129
|
-
title: 'Integrações',
|
|
130
|
-
translateKey: 'nav.integracoes',
|
|
131
|
-
icon: '',
|
|
132
|
-
type: NAV_ITEM_TYPE_COLLAPSE,
|
|
133
|
-
authority: ['/configuracoes/integracoes'],
|
|
134
|
-
subMenu: [
|
|
135
|
-
{
|
|
136
|
-
key: 'webhooks',
|
|
137
|
-
path: '/configuracoes/integracoes/webhooks',
|
|
138
|
-
title: 'Webhooks',
|
|
139
|
-
translateKey: 'nav.webhooks',
|
|
140
|
-
icon: 'WebhookIcon',
|
|
141
|
-
type: NAV_ITEM_TYPE_ITEM,
|
|
142
|
-
authority: ['/configuracoes/integracoes/webhooks'],
|
|
143
|
-
subMenu: [],
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
key: 'lorem.ipsum',
|
|
147
|
-
path: '/configuracoes/integracoes/lorem-ipsum',
|
|
148
|
-
title: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
|
149
|
-
translateKey: 'nav.loremIpsum',
|
|
150
|
-
icon: 'LoremIpsumIcon',
|
|
151
|
-
type: NAV_ITEM_TYPE_ITEM,
|
|
152
|
-
authority: ['/configuracoes/integracoes/lorem-ipsum'],
|
|
153
|
-
subMenu: [],
|
|
154
|
-
},
|
|
155
|
-
],
|
|
156
|
-
},
|
|
157
|
-
],
|
|
158
|
-
},
|
|
159
|
-
]
|
|
160
|
-
|
|
161
|
-
const allUserAuthority = [
|
|
162
|
-
'/inicio',
|
|
163
|
-
'/cadastros/clientes',
|
|
164
|
-
'/cadastros/fornecedores',
|
|
165
|
-
'/relatorios',
|
|
166
|
-
'/configuracoes/perfil',
|
|
167
|
-
'/configuracoes/integracoes/webhooks',
|
|
168
|
-
'/configuracoes/integracoes/lorem-ipsum',
|
|
169
|
-
]
|
|
170
|
-
|
|
171
25
|
const meta: Meta<typeof VerticalMenuContent> = {
|
|
172
26
|
title: '@ecme/Template/VerticalMenuContent',
|
|
173
27
|
component: VerticalMenuContent,
|
|
@@ -202,110 +56,17 @@ type TStory = StoryObj<typeof VerticalMenuContent>
|
|
|
202
56
|
export const Default: TStory = {
|
|
203
57
|
args: {
|
|
204
58
|
collapsed: false,
|
|
205
|
-
routeKey: '
|
|
206
|
-
navigationTree:
|
|
207
|
-
userAuthority:
|
|
208
|
-
direction: 'ltr',
|
|
209
|
-
translationSetup: true,
|
|
210
|
-
},
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
export const Collapsed: TStory = {
|
|
214
|
-
args: {
|
|
215
|
-
collapsed: true,
|
|
216
|
-
routeKey: '/cadastros/clientes',
|
|
217
|
-
navigationTree: mockNavigationTree,
|
|
218
|
-
userAuthority: allUserAuthority,
|
|
219
|
-
direction: 'ltr',
|
|
220
|
-
translationSetup: true,
|
|
221
|
-
},
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
export const WithExpandedMenu: TStory = {
|
|
225
|
-
args: {
|
|
226
|
-
collapsed: false,
|
|
227
|
-
routeKey: '/configuracoes/integracoes/webhooks',
|
|
228
|
-
navigationTree: mockNavigationTree,
|
|
229
|
-
userAuthority: allUserAuthority,
|
|
230
|
-
direction: 'ltr',
|
|
231
|
-
translationSetup: true,
|
|
232
|
-
},
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
export const LimitedAuthority: TStory = {
|
|
236
|
-
args: {
|
|
237
|
-
collapsed: false,
|
|
238
|
-
routeKey: '/inicio',
|
|
239
|
-
navigationTree: mockNavigationTree,
|
|
240
|
-
userAuthority: ['/inicio', '/relatorios'],
|
|
241
|
-
direction: 'ltr',
|
|
242
|
-
translationSetup: true,
|
|
243
|
-
},
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
export const RTLDirection: TStory = {
|
|
247
|
-
args: {
|
|
248
|
-
collapsed: false,
|
|
249
|
-
routeKey: '/inicio',
|
|
250
|
-
navigationTree: mockNavigationTree,
|
|
251
|
-
userAuthority: allUserAuthority,
|
|
252
|
-
direction: 'rtl',
|
|
253
|
-
translationSetup: true,
|
|
254
|
-
},
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
export const MinimalNavigation: TStory = {
|
|
258
|
-
args: {
|
|
259
|
-
collapsed: false,
|
|
260
|
-
routeKey: '/inicio',
|
|
261
|
-
navigationTree: [
|
|
262
|
-
{
|
|
263
|
-
key: 'inicio',
|
|
264
|
-
path: '/inicio',
|
|
265
|
-
title: 'Início',
|
|
266
|
-
translateKey: 'nav.inicio',
|
|
267
|
-
icon: '',
|
|
268
|
-
type: NAV_ITEM_TYPE_ITEM,
|
|
269
|
-
authority: ['/inicio'],
|
|
270
|
-
subMenu: [],
|
|
271
|
-
},
|
|
272
|
-
],
|
|
273
|
-
userAuthority: ['/inicio'],
|
|
274
|
-
direction: 'ltr',
|
|
275
|
-
translationSetup: true,
|
|
276
|
-
},
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
export const WithMenuClick: TStory = {
|
|
280
|
-
args: {
|
|
281
|
-
collapsed: false,
|
|
282
|
-
routeKey: '/inicio',
|
|
283
|
-
navigationTree: mockNavigationTree,
|
|
284
|
-
userAuthority: allUserAuthority,
|
|
285
|
-
direction: 'ltr',
|
|
286
|
-
translationSetup: true,
|
|
287
|
-
onMenuItemClick: () => alert('Menu item clicked!'),
|
|
288
|
-
},
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
export const TicketSubmenu: TStory = {
|
|
292
|
-
args: {
|
|
293
|
-
collapsed: false,
|
|
294
|
-
routeKey: 'ticket',
|
|
295
|
-
navigationTree: ticketNavigationConfig,
|
|
296
|
-
userAuthority: ticketAuthority,
|
|
297
|
-
direction: 'ltr',
|
|
298
|
-
translationSetup: true,
|
|
299
|
-
},
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
export const TicketSubmenuSortOrderStable: TStory = {
|
|
303
|
-
args: {
|
|
304
|
-
collapsed: false,
|
|
305
|
-
routeKey: 'ticket',
|
|
306
|
-
navigationTree: ticketSubmenuAllExpanded,
|
|
307
|
-
userAuthority: ticketAuthority,
|
|
59
|
+
routeKey: 'modules',
|
|
60
|
+
navigationTree: modulesNavigationConfig,
|
|
61
|
+
userAuthority: allAuthority,
|
|
308
62
|
direction: 'ltr',
|
|
309
63
|
translationSetup: true,
|
|
310
64
|
},
|
|
65
|
+
decorators: [
|
|
66
|
+
(Story) => (
|
|
67
|
+
<div style={{ maxWidth: '25vw' }}>
|
|
68
|
+
<Story />
|
|
69
|
+
</div>
|
|
70
|
+
),
|
|
71
|
+
],
|
|
311
72
|
}
|
|
@@ -57,37 +57,15 @@ const DefaultItem = (props: DefaultItemProps) => {
|
|
|
57
57
|
linkRenderer,
|
|
58
58
|
} = props
|
|
59
59
|
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
const renderItemContent = (titleClassName?: string) => (
|
|
60
|
+
const linkContent = (
|
|
63
61
|
<>
|
|
64
62
|
{showIcon && <VerticalMenuIcon icon={nav.icon} />}
|
|
65
63
|
{showTitle && (
|
|
66
|
-
<span className=
|
|
64
|
+
<span className="whitespace-normal">{t(nav.translateKey, nav.title)}</span>
|
|
67
65
|
)}
|
|
68
66
|
</>
|
|
69
67
|
)
|
|
70
68
|
|
|
71
|
-
const linkContent = (
|
|
72
|
-
<span className="relative flex min-w-0 flex-1 items-center gap-2">
|
|
73
|
-
<span className="flex min-w-0 flex-1 items-center gap-2 overflow-hidden">
|
|
74
|
-
{renderItemContent('truncate')}
|
|
75
|
-
</span>
|
|
76
|
-
{showTitle && (
|
|
77
|
-
<div className="w-100 absolute -left-3 top-1/2 z-20 hidden min-w-[calc(100%+1.5rem)] -translate-y-1/2 group-hover/item:block group-focus-visible/item:block">
|
|
78
|
-
<ScrollBar
|
|
79
|
-
autoHide
|
|
80
|
-
className="max-h-16 rounded-lg bg-gray-100 text-gray-900 dark:bg-gray-700 dark:text-gray-100"
|
|
81
|
-
>
|
|
82
|
-
<div className="flex h-full w-max min-w-full items-center gap-2 whitespace-nowrap rounded-lg px-3 font-semibold">
|
|
83
|
-
{renderItemContent()}
|
|
84
|
-
</div>
|
|
85
|
-
</ScrollBar>
|
|
86
|
-
</div>
|
|
87
|
-
)}
|
|
88
|
-
</span>
|
|
89
|
-
)
|
|
90
|
-
|
|
91
69
|
const renderLink = () => {
|
|
92
70
|
if (linkRenderer) {
|
|
93
71
|
return linkRenderer(nav, linkContent)
|
|
@@ -96,7 +74,7 @@ const DefaultItem = (props: DefaultItemProps) => {
|
|
|
96
74
|
return (
|
|
97
75
|
<Link
|
|
98
76
|
to={nav.path}
|
|
99
|
-
className="
|
|
77
|
+
className="flex h-full w-full items-center gap-2"
|
|
100
78
|
target={nav.isExternalLink ? '_blank' : ''}
|
|
101
79
|
onClick={() =>
|
|
102
80
|
onLinkClick?.({
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { useRef, useState, useCallback } from 'react'
|
|
3
|
+
import classNames from '../utils/classNames'
|
|
4
|
+
import Button from '../Button/Button'
|
|
5
|
+
import Notification from '../Notification/Notification'
|
|
6
|
+
import toast from '../toast/toast'
|
|
7
|
+
import type { CommonProps } from '../@types/common'
|
|
8
|
+
import type { ReactNode, ChangeEvent, MouseEvent, Ref } from 'react'
|
|
9
|
+
|
|
10
|
+
export interface UploadCustomProps extends CommonProps {
|
|
11
|
+
accept?: string
|
|
12
|
+
beforeUpload?: (file: FileList | null) => boolean | string
|
|
13
|
+
disabled?: boolean
|
|
14
|
+
draggable?: boolean
|
|
15
|
+
multiple?: boolean
|
|
16
|
+
onChange?: (files: File[]) => void
|
|
17
|
+
ref?: Ref<HTMLDivElement>
|
|
18
|
+
tip?: string | ReactNode
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const UploadCustom = (props: UploadCustomProps) => {
|
|
22
|
+
const {
|
|
23
|
+
accept,
|
|
24
|
+
beforeUpload,
|
|
25
|
+
disabled = false,
|
|
26
|
+
draggable = false,
|
|
27
|
+
multiple,
|
|
28
|
+
onChange,
|
|
29
|
+
ref,
|
|
30
|
+
tip,
|
|
31
|
+
children,
|
|
32
|
+
className,
|
|
33
|
+
...rest
|
|
34
|
+
} = props
|
|
35
|
+
|
|
36
|
+
const fileInputField = useRef<HTMLInputElement>(null)
|
|
37
|
+
const [dragOver, setDragOver] = useState(false)
|
|
38
|
+
|
|
39
|
+
const triggerMessage = (msg: string | ReactNode = '') => {
|
|
40
|
+
toast.push(
|
|
41
|
+
<Notification type="danger" duration={2000}>
|
|
42
|
+
{msg || 'Upload Failed!'}
|
|
43
|
+
</Notification>,
|
|
44
|
+
{
|
|
45
|
+
placement: 'top-center',
|
|
46
|
+
},
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const onNewFileUpload = (e: ChangeEvent<HTMLInputElement>) => {
|
|
51
|
+
const { files: newFiles } = e.target
|
|
52
|
+
let result: boolean | string = true
|
|
53
|
+
|
|
54
|
+
if (beforeUpload) {
|
|
55
|
+
result = beforeUpload(newFiles)
|
|
56
|
+
|
|
57
|
+
if (result === false) {
|
|
58
|
+
triggerMessage()
|
|
59
|
+
return
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (typeof result === 'string' && result.length > 0) {
|
|
63
|
+
triggerMessage(result)
|
|
64
|
+
return
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (result && newFiles) {
|
|
69
|
+
// Converte FileList para Array e passa apenas os novos arquivos
|
|
70
|
+
const filesArray = Array.from(newFiles)
|
|
71
|
+
onChange?.(filesArray)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Limpa o input para permitir selecionar o mesmo arquivo novamente
|
|
75
|
+
if (fileInputField.current) {
|
|
76
|
+
fileInputField.current.value = ''
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const triggerUpload = (e: MouseEvent<HTMLDivElement>) => {
|
|
81
|
+
if (!disabled) {
|
|
82
|
+
fileInputField.current?.click()
|
|
83
|
+
}
|
|
84
|
+
e.stopPropagation()
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const renderChildren = () => {
|
|
88
|
+
if (!draggable && !children) {
|
|
89
|
+
return (
|
|
90
|
+
<Button disabled={disabled} onClick={(e) => e.preventDefault()}>
|
|
91
|
+
Upload
|
|
92
|
+
</Button>
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (draggable && !children) {
|
|
97
|
+
return <span>Choose a file or drag and drop here</span>
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return children
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const handleDragLeave = useCallback(() => {
|
|
104
|
+
if (draggable) {
|
|
105
|
+
setDragOver(false)
|
|
106
|
+
}
|
|
107
|
+
}, [draggable])
|
|
108
|
+
|
|
109
|
+
const handleDragOver = useCallback(() => {
|
|
110
|
+
if (draggable && !disabled) {
|
|
111
|
+
setDragOver(true)
|
|
112
|
+
}
|
|
113
|
+
}, [draggable, disabled])
|
|
114
|
+
|
|
115
|
+
const handleDrop = useCallback(() => {
|
|
116
|
+
if (draggable) {
|
|
117
|
+
setDragOver(false)
|
|
118
|
+
}
|
|
119
|
+
}, [draggable])
|
|
120
|
+
|
|
121
|
+
const draggableProp = {
|
|
122
|
+
onDragLeave: handleDragLeave,
|
|
123
|
+
onDragOver: handleDragOver,
|
|
124
|
+
onDrop: handleDrop,
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const draggableEventFeedbackClass = `border-primary`
|
|
128
|
+
|
|
129
|
+
const uploadClass = classNames(
|
|
130
|
+
'upload',
|
|
131
|
+
draggable && `upload-draggable`,
|
|
132
|
+
draggable && !disabled && `hover:${draggableEventFeedbackClass}`,
|
|
133
|
+
draggable && disabled && 'disabled',
|
|
134
|
+
dragOver && draggableEventFeedbackClass,
|
|
135
|
+
className,
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
const uploadInputClass = classNames(
|
|
139
|
+
'upload-input',
|
|
140
|
+
draggable && `draggable`,
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
return (
|
|
144
|
+
<>
|
|
145
|
+
<div
|
|
146
|
+
ref={ref}
|
|
147
|
+
className={uploadClass}
|
|
148
|
+
{...(draggable ? draggableProp : { onClick: triggerUpload })}
|
|
149
|
+
{...(rest as any)}
|
|
150
|
+
>
|
|
151
|
+
<input
|
|
152
|
+
ref={fileInputField}
|
|
153
|
+
className={uploadInputClass}
|
|
154
|
+
type="file"
|
|
155
|
+
disabled={disabled}
|
|
156
|
+
multiple={multiple}
|
|
157
|
+
accept={accept}
|
|
158
|
+
title=""
|
|
159
|
+
value=""
|
|
160
|
+
onChange={onNewFileUpload}
|
|
161
|
+
></input>
|
|
162
|
+
{renderChildren()}
|
|
163
|
+
</div>
|
|
164
|
+
{tip}
|
|
165
|
+
</>
|
|
166
|
+
)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export default UploadCustom
|
|
@@ -38,6 +38,7 @@ export { default as Timeline } from './Timeline'
|
|
|
38
38
|
export { default as toast } from './toast'
|
|
39
39
|
export { default as Tooltip } from './Tooltip'
|
|
40
40
|
export { default as Upload } from './Upload'
|
|
41
|
+
export { default as UploadCustom } from './UploadCustom'
|
|
41
42
|
|
|
42
43
|
export type { AlertProps } from './Alert'
|
|
43
44
|
export type { AvatarProps, AvatarGroupProps } from './Avatar'
|
|
@@ -109,3 +110,4 @@ export type { TimelineProps, TimeLineItemProps } from './Timeline'
|
|
|
109
110
|
export type { ToastProps } from './toast'
|
|
110
111
|
export type { TooltipProps } from './Tooltip'
|
|
111
112
|
export type { UploadProps } from './Upload'
|
|
113
|
+
export type { UploadCustomProps } from './UploadCustom'
|
|
@@ -12,9 +12,9 @@ export type TSistemaOperacionalColumnDef = {
|
|
|
12
12
|
export type TSistemaOperacional = {
|
|
13
13
|
id?: number
|
|
14
14
|
sistemaOperacional: string
|
|
15
|
-
pago?: boolean
|
|
16
|
-
valorPago?: number
|
|
17
|
-
formaPagamento?: string
|
|
15
|
+
pago?: boolean | null
|
|
16
|
+
valorPago?: number | null
|
|
17
|
+
formaPagamento?: string | null
|
|
18
18
|
anexosContrato?: TAnexoComponente[]
|
|
19
19
|
anexosNotaFiscal?: TAnexoComponente[]
|
|
20
20
|
}
|
|
@@ -12,13 +12,13 @@ export type TSoftwareColumnDef = {
|
|
|
12
12
|
export type TSoftware = {
|
|
13
13
|
id?: number
|
|
14
14
|
software: string
|
|
15
|
-
licenciado?: boolean
|
|
16
|
-
quantidadeLicenca?: number
|
|
17
|
-
valorLicenca?: number
|
|
18
|
-
metricaLicenca?: string
|
|
19
|
-
formaPagamento?: string
|
|
20
|
-
dataInicio?: string
|
|
21
|
-
dataFinal?: string
|
|
15
|
+
licenciado?: boolean | null
|
|
16
|
+
quantidadeLicenca?: number | null
|
|
17
|
+
valorLicenca?: number | null
|
|
18
|
+
metricaLicenca?: string | null
|
|
19
|
+
formaPagamento?: string | null
|
|
20
|
+
dataInicio?: string | null
|
|
21
|
+
dataFinal?: string | null
|
|
22
22
|
anexosContrato?: TAnexoComponente[]
|
|
23
23
|
anexosNotaFiscal?: TAnexoComponente[]
|
|
24
24
|
}
|
|
@@ -12,10 +12,10 @@ export type TVersaoMSOfficeColumnDef = {
|
|
|
12
12
|
export type TVersaoMSOffice = {
|
|
13
13
|
id?: number
|
|
14
14
|
versaoMsOffice: string
|
|
15
|
-
contrato?: boolean
|
|
16
|
-
quantidadeLicenca?: number
|
|
17
|
-
valorLicenca?: number
|
|
18
|
-
formaPagamento?: string
|
|
15
|
+
contrato?: boolean | null
|
|
16
|
+
quantidadeLicenca?: number | null
|
|
17
|
+
valorLicenca?: number | null
|
|
18
|
+
formaPagamento?: string | null
|
|
19
19
|
anexosContrato?: TAnexoComponente[]
|
|
20
20
|
anexosNotaFiscal?: TAnexoComponente[]
|
|
21
21
|
}
|
package/package.json
CHANGED