norma-library 0.5.813 → 0.5.814
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/esm/components/Table/components/header/index.js +3 -3
- package/dist/esm/components/Table/components/header/index.js.map +1 -1
- package/dist/esm/components/Table/components/header/styles.d.ts +1 -0
- package/dist/esm/components/Table/components/header/styles.js +5 -4
- package/dist/esm/components/Table/components/header/styles.js.map +1 -1
- package/dist/esm/components/Table/components/pagination/index.js +4 -4
- package/dist/esm/components/Table/components/pagination/index.js.map +1 -1
- package/dist/esm/components/Table/components/pagination/styles.js +1 -1
- package/dist/esm/components/Table/components/pagination/styles.js.map +1 -1
- package/dist/esm/components/Table/index.js +111 -110
- package/dist/esm/components/Table/index.js.map +1 -1
- package/dist/esm/components/Table/styles.d.ts +2 -1
- package/dist/esm/components/Table/styles.js +11 -10
- package/dist/esm/components/Table/styles.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Table/components/header/index.tsx +10 -8
- package/src/components/Table/components/header/styles.tsx +5 -0
- package/src/components/Table/components/pagination/index.tsx +6 -6
- package/src/components/Table/components/pagination/styles.tsx +12 -0
- package/src/components/Table/index.tsx +164 -162
- package/src/components/Table/styles.tsx +6 -1
- package/src/stories/Table.stories.tsx +105 -105
- package/dist/Button/index.d.ts +0 -9
- package/dist/Button/types.d.ts +0 -18
- package/dist/Card/Card.d.ts +0 -3
- package/dist/Card/CardHeader.d.ts +0 -3
- package/dist/Card/index.d.ts +0 -4
- package/dist/Card/styles.d.ts +0 -546
- package/dist/Card/types.d.ts +0 -8
- package/dist/index.d.ts +0 -2
- package/dist/index.es.js +0 -6992
- package/dist/index.es.js.map +0 -1
- package/dist/index.umd.js +0 -266
- package/dist/index.umd.js.map +0 -1
- package/dist/vite.svg +0 -1
|
@@ -8,20 +8,20 @@ const Pagination:React.FC<any> = ({ table }) => {
|
|
|
8
8
|
<button
|
|
9
9
|
className='button'
|
|
10
10
|
onClick={() => table.previousPage()}
|
|
11
|
-
disabled={
|
|
11
|
+
disabled={1 === table.getState().pagination.pageIndex + 1}
|
|
12
12
|
>
|
|
13
13
|
{'<'}
|
|
14
14
|
</button>
|
|
15
15
|
{
|
|
16
16
|
table.getPageCount()
|
|
17
|
-
? new Array(table.getPageCount()).fill(0).map((item, index) => {
|
|
17
|
+
? new Array(Math.ceil(table.getPageCount() / 10)).fill(0).map((item, index) => {
|
|
18
18
|
return (
|
|
19
19
|
<button
|
|
20
20
|
key={item}
|
|
21
|
-
className='button'
|
|
22
|
-
onClick={() => table.
|
|
21
|
+
className={ table.getState().pagination.pageIndex == index ? 'button-active' : 'button'}
|
|
22
|
+
onClick={() => table.setPageIndex(index)}
|
|
23
23
|
>
|
|
24
|
-
{index}
|
|
24
|
+
{index + 1}
|
|
25
25
|
</button>
|
|
26
26
|
)
|
|
27
27
|
})
|
|
@@ -30,7 +30,7 @@ const Pagination:React.FC<any> = ({ table }) => {
|
|
|
30
30
|
<button
|
|
31
31
|
className='button'
|
|
32
32
|
onClick={() => table.nextPage()}
|
|
33
|
-
disabled={
|
|
33
|
+
disabled={Math.ceil(table.getPageCount() / 10) === table.getState().pagination.pageIndex + 1}
|
|
34
34
|
>
|
|
35
35
|
{'>'}
|
|
36
36
|
</button>
|
|
@@ -14,6 +14,18 @@ export const Pagination = styled.div`
|
|
|
14
14
|
padding: 12px 16px;
|
|
15
15
|
border-radius: 4px;
|
|
16
16
|
color: #4D4F5C;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
&:disabled {
|
|
19
|
+
opacity: 0.4;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
.button-active {
|
|
23
|
+
border: 1px solid #FFDB9F;
|
|
24
|
+
background: #FFDB9F;
|
|
25
|
+
color: #B74616;
|
|
26
|
+
padding: 12px 16px;
|
|
27
|
+
border-radius: 4px;
|
|
28
|
+
cursor: pointer;
|
|
17
29
|
}
|
|
18
30
|
}
|
|
19
31
|
`
|
|
@@ -122,170 +122,172 @@ const Table:React.FC<TablePropos> = ({ data, columns }) => {
|
|
|
122
122
|
setOrderSmallest={setOrderSmallest}
|
|
123
123
|
/>
|
|
124
124
|
<S.Content>
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
{headerGroup.
|
|
129
|
-
|
|
130
|
-
<
|
|
131
|
-
<
|
|
132
|
-
<S.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
<
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
filterInputSelected === '
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
<
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
setValue(event.target.value)
|
|
207
|
-
}}
|
|
208
|
-
/>
|
|
209
|
-
<Button
|
|
210
|
-
color="primary"
|
|
211
|
-
type={"submit"}
|
|
212
|
-
disableElevation
|
|
213
|
-
style={{
|
|
214
|
-
marginTop: 8,
|
|
215
|
-
width: '100%'
|
|
216
|
-
}}
|
|
217
|
-
variant="contained"
|
|
218
|
-
onClick={() => {
|
|
219
|
-
setGlobalFilters((current: any) => [...current,
|
|
220
|
-
{
|
|
221
|
-
acessor: header.column.columnDef.accessorKey,
|
|
222
|
-
type: filterInputSelected,
|
|
223
|
-
value: value
|
|
125
|
+
<S.Table>
|
|
126
|
+
<thead>
|
|
127
|
+
{table.getHeaderGroups().map((headerGroup: any) => (
|
|
128
|
+
<tr key={headerGroup.id}>
|
|
129
|
+
{headerGroup.headers.map((header: any) => (
|
|
130
|
+
<th key={header.id}>
|
|
131
|
+
<div>
|
|
132
|
+
<S.ColumnContent>
|
|
133
|
+
<S.TextColumn>
|
|
134
|
+
{header.isPlaceholder
|
|
135
|
+
? null
|
|
136
|
+
: flexRender(
|
|
137
|
+
header.column.columnDef.header,
|
|
138
|
+
header.getContext()
|
|
139
|
+
)}
|
|
140
|
+
</S.TextColumn>
|
|
141
|
+
<S.IconFilterDialog onClick={() => {
|
|
142
|
+
setOpenFilterDialog(header.column.columnDef.accessorKey)
|
|
143
|
+
}}>
|
|
144
|
+
<svg fill='#666' focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="ArrowDropDownIcon"><path d="m7 10 5 5 5-5z"></path></svg>
|
|
145
|
+
</S.IconFilterDialog>
|
|
146
|
+
</S.ColumnContent>
|
|
147
|
+
{ openFilterDialog === header.column.columnDef.accessorKey
|
|
148
|
+
? (
|
|
149
|
+
<>
|
|
150
|
+
<S.backgroundDialog onClick={() => {
|
|
151
|
+
setOpenFilterDialog('')
|
|
152
|
+
setOpenFilterOptions(false)
|
|
153
|
+
}}></S.backgroundDialog>
|
|
154
|
+
<S.FilterDialog>
|
|
155
|
+
{
|
|
156
|
+
openFilterOptions
|
|
157
|
+
? (
|
|
158
|
+
<S.ListFilterDialog>
|
|
159
|
+
<p className='label'>Selecione um filtro</p>
|
|
160
|
+
<select className='select' value={filterInputSelected} onChange={(event) => {
|
|
161
|
+
setFilterInputSelected(event.target.value)
|
|
162
|
+
}}>
|
|
163
|
+
<option>Selecione...</option>
|
|
164
|
+
{ header?.headerGroup?.headers[header.index].column.columnDef.type === 'text' ? <option>Igual a</option> : null }
|
|
165
|
+
{ header?.headerGroup?.headers[header.index].column.columnDef.type === 'text' ? <option>Não é igual a</option> : null }
|
|
166
|
+
{ header?.headerGroup?.headers[header.index].column.columnDef.type === 'text' ? <option>Contém</option> : null }
|
|
167
|
+
{ header?.headerGroup?.headers[header.index].column.columnDef.type === 'number' ? <option>Maior que</option> : null }
|
|
168
|
+
{ header?.headerGroup?.headers[header.index].column.columnDef.type === 'number' ? <option>Menor que</option> : null }
|
|
169
|
+
{ header?.headerGroup?.headers[header.index].column.columnDef.type === 'number' ? <option>Igual a</option> : null }
|
|
170
|
+
{ header?.headerGroup?.headers[header.index]. column.columnDef.type === 'date' ? <option>Data Igual a</option> : null }
|
|
171
|
+
{ header?.headerGroup?.headers[header.index]. column.columnDef.type === 'date' ? <option>Data maior que</option> : null }
|
|
172
|
+
{ header?.headerGroup?.headers[header.index]. column.columnDef.type === 'date' ? <option>Data menor que</option> : null }
|
|
173
|
+
{ header?.headerGroup?.headers[header.index]. column.columnDef.type === 'time' ? <option>Horario Igual a</option> : null }
|
|
174
|
+
{ header?.headerGroup?.headers[header.index]. column.columnDef.type === 'time' ? <option>Horario maior que</option> : null }
|
|
175
|
+
{ header?.headerGroup?.headers[header.index]. column.columnDef.type === 'time' ? <option>Horario menor que</option> : null }
|
|
176
|
+
</select>
|
|
177
|
+
<div>
|
|
178
|
+
{ header.column.getCanFilter()
|
|
179
|
+
? filterInputSelected === 'Igual a' ||
|
|
180
|
+
filterInputSelected === 'Não é igual a' ||
|
|
181
|
+
filterInputSelected === 'Contém' ||
|
|
182
|
+
filterInputSelected === 'Maior que' ||
|
|
183
|
+
filterInputSelected === 'Menor que' ||
|
|
184
|
+
filterInputSelected === 'Data Igual a' ||
|
|
185
|
+
filterInputSelected === 'Data maior que' ||
|
|
186
|
+
filterInputSelected === 'Data menor que' ||
|
|
187
|
+
filterInputSelected === 'Horario Igual a' ||
|
|
188
|
+
filterInputSelected === 'Horario maior que' ||
|
|
189
|
+
filterInputSelected === 'Horario menor que'
|
|
190
|
+
? (
|
|
191
|
+
<div>
|
|
192
|
+
<p className='label' style={{ marginTop: '10px' }}>Valor</p>
|
|
193
|
+
<input
|
|
194
|
+
type={header?.headerGroup?.headers[header.index].column.columnDef.type}
|
|
195
|
+
className='select'
|
|
196
|
+
style={{ width: '100%' }}
|
|
197
|
+
value={value as any}
|
|
198
|
+
onChange={event => {
|
|
199
|
+
if (header?.headerGroup?.headers[header.index].column.columnDef.type === 'number') {
|
|
200
|
+
setValue(Number(event.target.value))
|
|
201
|
+
return
|
|
202
|
+
}
|
|
203
|
+
if (header?.headerGroup?.headers[header.index].column.columnDef.type === 'date') {
|
|
204
|
+
setValue(event.target.value)
|
|
205
|
+
return
|
|
224
206
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}}>
|
|
260
|
-
<div className='icon rotate'>
|
|
261
|
-
<svg fill="#666" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="20" height="20"><path strokeLinecap="round" strokeLinejoin="round" d="M12 4.5v15m0 0l6.75-6.75M12 19.5l-6.75-6.75"></path></svg>
|
|
262
|
-
</div>
|
|
263
|
-
<p onClick={() => {
|
|
264
|
-
header.column.toggleSorting()
|
|
265
|
-
setOrderLargest(true)
|
|
266
|
-
setOrderSmallest(false)
|
|
267
|
-
}}>Maior primeiro</p>
|
|
268
|
-
</S.OptionFilterDialog>
|
|
269
|
-
<S.OptionFilterDialog>
|
|
270
|
-
<div className='icon'>
|
|
271
|
-
<svg fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="16" height="16"><path strokeLinecap="round" strokeLinejoin="round" d="M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z"></path></svg>
|
|
207
|
+
setValue(event.target.value)
|
|
208
|
+
}}
|
|
209
|
+
/>
|
|
210
|
+
<Button
|
|
211
|
+
color="primary"
|
|
212
|
+
type={"submit"}
|
|
213
|
+
disableElevation
|
|
214
|
+
style={{
|
|
215
|
+
marginTop: 8,
|
|
216
|
+
width: '100%'
|
|
217
|
+
}}
|
|
218
|
+
variant="contained"
|
|
219
|
+
onClick={() => {
|
|
220
|
+
setGlobalFilters((current: any) => [...current,
|
|
221
|
+
{
|
|
222
|
+
acessor: header.column.columnDef.accessorKey,
|
|
223
|
+
type: filterInputSelected,
|
|
224
|
+
value: value
|
|
225
|
+
}
|
|
226
|
+
])
|
|
227
|
+
header.column.setFilterValue(value)
|
|
228
|
+
setOpenFilterOptions(false)
|
|
229
|
+
setOpenFilterDialog('')
|
|
230
|
+
setFilterInputSelected(false)
|
|
231
|
+
setValue(null)
|
|
232
|
+
}}
|
|
233
|
+
>
|
|
234
|
+
Buscar
|
|
235
|
+
</Button>
|
|
236
|
+
</div>
|
|
237
|
+
)
|
|
238
|
+
: null
|
|
239
|
+
: null
|
|
240
|
+
}
|
|
272
241
|
</div>
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
242
|
+
</S.ListFilterDialog>
|
|
243
|
+
)
|
|
244
|
+
: (
|
|
245
|
+
<S.ListFilterDialog>
|
|
246
|
+
<S.OptionFilterDialog style={{
|
|
247
|
+
background: orderSmallest ? 'rgba(0, 0, 0, 0.04)' : ''
|
|
248
|
+
}}>
|
|
249
|
+
<div className='icon'>
|
|
250
|
+
<svg fill="#666" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="20" height="20"><path strokeLinecap="round" strokeLinejoin="round" d="M12 4.5v15m0 0l6.75-6.75M12 19.5l-6.75-6.75"></path></svg>
|
|
251
|
+
</div>
|
|
252
|
+
<p onClick={() => {
|
|
253
|
+
header.column.toggleSorting()
|
|
254
|
+
setOrderSmallest(true)
|
|
255
|
+
setOrderLargest(false)
|
|
256
|
+
}}>Menor primeiro</p>
|
|
257
|
+
</S.OptionFilterDialog>
|
|
258
|
+
<S.OptionFilterDialog style={{
|
|
259
|
+
background: orderLargest ? 'rgba(0, 0, 0, 0.04)' : ''
|
|
260
|
+
}}>
|
|
261
|
+
<div className='icon rotate'>
|
|
262
|
+
<svg fill="#666" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="20" height="20"><path strokeLinecap="round" strokeLinejoin="round" d="M12 4.5v15m0 0l6.75-6.75M12 19.5l-6.75-6.75"></path></svg>
|
|
263
|
+
</div>
|
|
264
|
+
<p onClick={() => {
|
|
265
|
+
header.column.toggleSorting()
|
|
266
|
+
setOrderLargest(true)
|
|
267
|
+
setOrderSmallest(false)
|
|
268
|
+
}}>Maior primeiro</p>
|
|
269
|
+
</S.OptionFilterDialog>
|
|
270
|
+
<S.OptionFilterDialog>
|
|
271
|
+
<div className='icon'>
|
|
272
|
+
<svg fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="16" height="16"><path strokeLinecap="round" strokeLinejoin="round" d="M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z"></path></svg>
|
|
273
|
+
</div>
|
|
274
|
+
<p onClick={() => setOpenFilterOptions(true)}>Filtrar por</p>
|
|
275
|
+
</S.OptionFilterDialog>
|
|
276
|
+
</S.ListFilterDialog>
|
|
277
|
+
)
|
|
278
|
+
}
|
|
279
|
+
</S.FilterDialog>
|
|
280
|
+
</>
|
|
281
|
+
) : null
|
|
282
|
+
}
|
|
283
|
+
</div>
|
|
284
|
+
</th>
|
|
285
|
+
))}
|
|
286
|
+
</tr>
|
|
287
|
+
))}
|
|
288
|
+
</thead>
|
|
289
|
+
<TBody table={table} />
|
|
290
|
+
</S.Table>
|
|
289
291
|
</S.Content>
|
|
290
292
|
<Pagination table={table} />
|
|
291
293
|
</S.Container>
|
|
@@ -4,9 +4,14 @@ export const Container = styled.div`
|
|
|
4
4
|
width: 100%;
|
|
5
5
|
background: #fff;
|
|
6
6
|
box-shadow: 0px 2px 6px #0000000A;
|
|
7
|
+
padding: 24px 0;
|
|
7
8
|
`
|
|
8
9
|
|
|
9
|
-
export const Content = styled.
|
|
10
|
+
export const Content = styled.div`
|
|
11
|
+
min-height: 535px;
|
|
12
|
+
`
|
|
13
|
+
|
|
14
|
+
export const Table = styled.table`
|
|
10
15
|
border-collapse: collapse;
|
|
11
16
|
width: 100%;
|
|
12
17
|
thead {
|