bfg-common 1.0.76 → 1.0.77
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/components/atoms/table/dataGrid/DataGrid.vue +180 -80
- package/components/atoms/table/dataGrid/DataGridPagination.vue +89 -83
- package/components/atoms/table/dataGrid/utils/constructDataTable.ts +19 -20
- package/components/common/diagramMain/modals/viewSettings/Info.vue +3 -1
- package/package.json +1 -1
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="relative">
|
|
3
|
-
<div
|
|
2
|
+
<div class="relative" style="display: flex">
|
|
3
|
+
<div
|
|
4
|
+
:id="outerWrapper"
|
|
5
|
+
:class="[
|
|
6
|
+
'datagrid-outer-wrapper',
|
|
7
|
+
{
|
|
8
|
+
'datagrid-outer-wrapper-opened-info': isShowHiddenInfo,
|
|
9
|
+
},
|
|
10
|
+
]"
|
|
11
|
+
>
|
|
4
12
|
<div class="datagrid-inner-wrapper">
|
|
5
|
-
<div
|
|
13
|
+
<div
|
|
14
|
+
:class="[
|
|
15
|
+
'datagrid',
|
|
16
|
+
{
|
|
17
|
+
'datagrid-opened-info': isShowHiddenInfo,
|
|
18
|
+
},
|
|
19
|
+
]"
|
|
20
|
+
>
|
|
6
21
|
<div :id="tableWrapperId" class="datagrid-table-wrapper">
|
|
7
22
|
<div class="datagrid-table">
|
|
8
23
|
<div class="datagrid-header">
|
|
@@ -117,7 +132,10 @@
|
|
|
117
132
|
</atoms-popup-simple-popup>
|
|
118
133
|
</div>
|
|
119
134
|
<div
|
|
120
|
-
v-show="
|
|
135
|
+
v-show="
|
|
136
|
+
!isShowHiddenInfo ||
|
|
137
|
+
(isShowHiddenInfo && key === 0)
|
|
138
|
+
"
|
|
121
139
|
class="datagrid-column-separator"
|
|
122
140
|
@mousedown="setGrab(key, $event)"
|
|
123
141
|
>
|
|
@@ -160,7 +178,14 @@
|
|
|
160
178
|
>
|
|
161
179
|
<div
|
|
162
180
|
:id="expandableCaret"
|
|
163
|
-
class="
|
|
181
|
+
:class="[
|
|
182
|
+
'datagrid-expandable-caret flex-justify-center datagrid-cell',
|
|
183
|
+
{
|
|
184
|
+
'datagrid-fixed-column': !props.withInfo,
|
|
185
|
+
'datagrid-fixed-column-without-separator':
|
|
186
|
+
props.withInfo,
|
|
187
|
+
},
|
|
188
|
+
]"
|
|
164
189
|
>
|
|
165
190
|
<slot name="type" :key="key" :item="item">
|
|
166
191
|
<div
|
|
@@ -217,13 +242,16 @@
|
|
|
217
242
|
width: columnsWidth[key2][0],
|
|
218
243
|
minWidth: columnsWidth[key2][1],
|
|
219
244
|
}"
|
|
220
|
-
class="
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
245
|
+
:class="[
|
|
246
|
+
'datagrid-cell datagrid-fixed-width',
|
|
247
|
+
`hidden-text-triangle-${item2.id}`,
|
|
248
|
+
{
|
|
249
|
+
'hidden-text-triangle':
|
|
250
|
+
isShowHiddenInfo &&
|
|
251
|
+
item2.key === 'col1' &&
|
|
252
|
+
item2.data?.iconClassName === 'info',
|
|
253
|
+
},
|
|
254
|
+
]"
|
|
227
255
|
>
|
|
228
256
|
<div
|
|
229
257
|
:class="[
|
|
@@ -252,55 +280,17 @@
|
|
|
252
280
|
isShowHiddenInfo &&
|
|
253
281
|
item2.id === selectedRow,
|
|
254
282
|
}"
|
|
255
|
-
@click="doubleArrowClick"
|
|
283
|
+
@click="doubleArrowClick(item2, item)"
|
|
256
284
|
/>
|
|
257
285
|
</div>
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
286
|
+
<span
|
|
287
|
+
v-if="item2.text && item2.data?.iconClassName"
|
|
288
|
+
class="vertical-divider"
|
|
289
|
+
/>
|
|
262
290
|
<slot :name="item2.key" :item="item2">
|
|
263
|
-
<span
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
>{{ item2.text }}</span
|
|
267
|
-
>
|
|
268
|
-
|
|
269
|
-
<Teleport
|
|
270
|
-
v-if="
|
|
271
|
-
item2.id === selectedRow &&
|
|
272
|
-
!item2.data?.text &&
|
|
273
|
-
isShowHiddenInfo
|
|
274
|
-
"
|
|
275
|
-
:to="`#${tableWrapperId}`"
|
|
276
|
-
@click.stop
|
|
277
|
-
>
|
|
278
|
-
<div
|
|
279
|
-
id="hidden-features"
|
|
280
|
-
class="hidden-features"
|
|
281
|
-
:class="{
|
|
282
|
-
'show-hidden-info': isShowHiddenInfo,
|
|
283
|
-
}"
|
|
284
|
-
>
|
|
285
|
-
<div class="header">
|
|
286
|
-
<slot
|
|
287
|
-
name="hiddenInfoHeader"
|
|
288
|
-
:item="item"
|
|
289
|
-
/>
|
|
290
|
-
<button
|
|
291
|
-
:id="`${props.testId}-hidden-info-toggle-icon-${key}-${key2}`"
|
|
292
|
-
class="signpost-action close"
|
|
293
|
-
@click="isShowHiddenInfo = false"
|
|
294
|
-
>
|
|
295
|
-
<atoms-the-icon
|
|
296
|
-
class="close-icon"
|
|
297
|
-
name="close"
|
|
298
|
-
/>
|
|
299
|
-
</button>
|
|
300
|
-
</div>
|
|
301
|
-
<slot name="hiddenInfoBody" />
|
|
302
|
-
</div>
|
|
303
|
-
</Teleport>
|
|
291
|
+
<span class="text-ellipsis" :title="item2.text"
|
|
292
|
+
>{{ item2.text }}
|
|
293
|
+
</span>
|
|
304
294
|
</slot>
|
|
305
295
|
</div>
|
|
306
296
|
</div>
|
|
@@ -329,7 +319,15 @@
|
|
|
329
319
|
</div>
|
|
330
320
|
</div>
|
|
331
321
|
|
|
332
|
-
<div
|
|
322
|
+
<div
|
|
323
|
+
v-if="!hideFooter"
|
|
324
|
+
:class="[
|
|
325
|
+
'datagrid-footer',
|
|
326
|
+
{
|
|
327
|
+
'datagrid-footer-opened-info': isShowHiddenInfo,
|
|
328
|
+
},
|
|
329
|
+
]"
|
|
330
|
+
>
|
|
333
331
|
<div
|
|
334
332
|
v-if="props.type === 'checkbox' && props.selectedRow?.length"
|
|
335
333
|
class="clr-form-control-disabled"
|
|
@@ -369,6 +367,7 @@
|
|
|
369
367
|
:hide-page-size="props.hidePageSize"
|
|
370
368
|
:show-page-info="props.showPageInfo"
|
|
371
369
|
:page-items-count="props.bodyItems.length"
|
|
370
|
+
:is-show-hidden-info="isShowHiddenInfo"
|
|
372
371
|
@change-page-size="changePageSize"
|
|
373
372
|
@change-page="changePage"
|
|
374
373
|
/>
|
|
@@ -377,6 +376,37 @@
|
|
|
377
376
|
<atoms-loader v-show="props.loading" class="datagrid-spinner" />
|
|
378
377
|
</div>
|
|
379
378
|
</div>
|
|
379
|
+
<!-- {{ showedInfoRow }}-->
|
|
380
|
+
<!-- {{ selectedRow }}-->
|
|
381
|
+
<!-- {{ isShowHiddenInfo }}-->
|
|
382
|
+
<!-- {{-->
|
|
383
|
+
<!-- isShowHiddenInfo &&-->
|
|
384
|
+
<!-- showedInfoRow &&-->
|
|
385
|
+
<!-- showedInfoRow.id === selectedRow &&-->
|
|
386
|
+
<!-- !showedInfoRow.data?.text-->
|
|
387
|
+
<!-- }}-->
|
|
388
|
+
<div
|
|
389
|
+
v-if="isShowInfo"
|
|
390
|
+
id="hidden-features"
|
|
391
|
+
:class="[
|
|
392
|
+
'hidden-features',
|
|
393
|
+
{
|
|
394
|
+
'show-hidden-info': isShowHiddenInfo,
|
|
395
|
+
},
|
|
396
|
+
]"
|
|
397
|
+
>
|
|
398
|
+
<div class="header">
|
|
399
|
+
<slot name="hiddenInfoHeader" :item="showedInfoCol" />
|
|
400
|
+
<button
|
|
401
|
+
:id="`${props.testId}-hidden-info-toggle-icon-${showedInfoRow?.key}-${showedInfoRow?.data.name}`"
|
|
402
|
+
class="signpost-action close"
|
|
403
|
+
@click="isShowHiddenInfo = false"
|
|
404
|
+
>
|
|
405
|
+
<atoms-the-icon class="close-icon" name="close" />
|
|
406
|
+
</button>
|
|
407
|
+
</div>
|
|
408
|
+
<slot name="hiddenInfoBody" />
|
|
409
|
+
</div>
|
|
380
410
|
</div>
|
|
381
411
|
</template>
|
|
382
412
|
|
|
@@ -416,6 +446,7 @@ const props = withDefaults(
|
|
|
416
446
|
hideFooter?: boolean
|
|
417
447
|
hidePagination?: boolean
|
|
418
448
|
testId?: string
|
|
449
|
+
withInfo?: boolean
|
|
419
450
|
}>(),
|
|
420
451
|
{
|
|
421
452
|
columnKeys: undefined,
|
|
@@ -424,6 +455,7 @@ const props = withDefaults(
|
|
|
424
455
|
itemsPerPage: undefined,
|
|
425
456
|
fillWidth: true,
|
|
426
457
|
testId: 'ui-data-grid',
|
|
458
|
+
withInfo: false,
|
|
427
459
|
}
|
|
428
460
|
)
|
|
429
461
|
|
|
@@ -467,14 +499,32 @@ const selectedRowLocal = ref<UI_T_SelectedRow>([])
|
|
|
467
499
|
const isShowHiddenInfo = ref<boolean>(false)
|
|
468
500
|
const tableWrapperId = `table-wrapper-${useUniqueId()}`
|
|
469
501
|
let memoryWidth = '0'
|
|
470
|
-
|
|
502
|
+
|
|
503
|
+
const showedInfoRow = ref<UI_I_BodyItem | null>(null)
|
|
504
|
+
const showedInfoCol = ref<UI_I_BodyItem[] | null>(null)
|
|
505
|
+
|
|
506
|
+
const isShowInfo = computed(
|
|
507
|
+
() =>
|
|
508
|
+
showedInfoRow.value &&
|
|
509
|
+
showedInfoRow.value.id === props.selectedRow &&
|
|
510
|
+
!showedInfoRow.value.data?.text &&
|
|
511
|
+
isShowHiddenInfo.value
|
|
512
|
+
)
|
|
513
|
+
const doubleArrowClick = (item: UI_I_BodyItem, items: UI_I_BodyItem[]) => {
|
|
514
|
+
// if (!isShowHiddenInfo.value) {
|
|
515
|
+
// memoryWidth = columnsWidth.value[1][0]
|
|
516
|
+
// // columnsWidth.value[1][0] = 'calc(100% - 48px)'
|
|
517
|
+
// // min width of 1st column
|
|
518
|
+
// // columnsWidth.value[1][1]
|
|
519
|
+
// } else {
|
|
520
|
+
// columnsWidth.value[1][0] = memoryWidth
|
|
521
|
+
// }
|
|
471
522
|
if (!isShowHiddenInfo.value) {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
// min width of 1st column
|
|
475
|
-
// columnsWidth.value[1][1]
|
|
523
|
+
showedInfoRow.value = item
|
|
524
|
+
showedInfoCol.value = items
|
|
476
525
|
} else {
|
|
477
|
-
|
|
526
|
+
showedInfoRow.value = null
|
|
527
|
+
showedInfoCol.value = null
|
|
478
528
|
}
|
|
479
529
|
isShowHiddenInfo.value = !isShowHiddenInfo.value
|
|
480
530
|
}
|
|
@@ -651,6 +701,7 @@ const bodyItemsPresent = computed<UI_I_BodyItem[][]>(() => {
|
|
|
651
701
|
hasItem = arr.some(
|
|
652
702
|
(bodyItem) =>
|
|
653
703
|
bodyItem.key === item.key &&
|
|
704
|
+
typeof bodyItem.text === 'string' &&
|
|
654
705
|
bodyItem.text.toLowerCase().includes(term)
|
|
655
706
|
)
|
|
656
707
|
})
|
|
@@ -740,9 +791,11 @@ watch(
|
|
|
740
791
|
const grabColumn = ref<number>(-1)
|
|
741
792
|
const grabStartX = ref<number>(0)
|
|
742
793
|
const setGrab = (key: number, e: MouseEvent): void => {
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
794
|
+
if (!isShowHiddenInfo.value) {
|
|
795
|
+
grabColumn.value = key
|
|
796
|
+
const currentWidth = parseInt(columnsWidth.value[grabColumn.value][0])
|
|
797
|
+
grabStartX.value = e.clientX - currentWidth
|
|
798
|
+
}
|
|
746
799
|
}
|
|
747
800
|
|
|
748
801
|
const isDrag = ref<boolean>(false)
|
|
@@ -782,10 +835,38 @@ const setResizeObserve = (): void => {
|
|
|
782
835
|
resizeObserve = new ResizeObserver(setColumnWidth)
|
|
783
836
|
resizeObserve.observe(el)
|
|
784
837
|
}
|
|
838
|
+
|
|
839
|
+
let resizeObserveWithInfo: ResizeObserver
|
|
840
|
+
|
|
841
|
+
const setColumnWidthWithInfo = (ent: ResizeObserverEntry[]): void => {
|
|
842
|
+
if (isShowHiddenInfo.value) {
|
|
843
|
+
memoryWidth = columnsWidth.value[1][0]
|
|
844
|
+
columnsWidth.value[1][0] = `${ent[0].contentBoxSize[0].inlineSize - 86}px`
|
|
845
|
+
} else {
|
|
846
|
+
columnsWidth.value[1][0] = memoryWidth
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
const setResizeObserveWithInfo = (): void => {
|
|
851
|
+
const el = document.querySelector('.datagrid')
|
|
852
|
+
|
|
853
|
+
if (!el) {
|
|
854
|
+
setTimeout(setResizeObserveWithInfo, 0)
|
|
855
|
+
return
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
resizeObserveWithInfo = new ResizeObserver(setColumnWidthWithInfo)
|
|
859
|
+
resizeObserveWithInfo.observe(el)
|
|
860
|
+
}
|
|
861
|
+
|
|
785
862
|
onMounted(() => {
|
|
786
863
|
window.addEventListener('mousemove', mousemove)
|
|
787
864
|
window.addEventListener('mouseup', mouseup)
|
|
788
865
|
|
|
866
|
+
if (props.withInfo) {
|
|
867
|
+
setResizeObserveWithInfo()
|
|
868
|
+
}
|
|
869
|
+
|
|
789
870
|
setResizeObserve()
|
|
790
871
|
})
|
|
791
872
|
onUnmounted(() => {
|
|
@@ -802,6 +883,11 @@ onUnmounted(() => {
|
|
|
802
883
|
flex-grow: 1;
|
|
803
884
|
overflow: auto;
|
|
804
885
|
|
|
886
|
+
&.datagrid-outer-wrapper-opened-info {
|
|
887
|
+
width: 35%;
|
|
888
|
+
min-width: 195px;
|
|
889
|
+
}
|
|
890
|
+
|
|
805
891
|
& * {
|
|
806
892
|
box-sizing: border-box;
|
|
807
893
|
}
|
|
@@ -822,6 +908,11 @@ onUnmounted(() => {
|
|
|
822
908
|
background-color: var(--block-view-bg-color);
|
|
823
909
|
border-color: var(--global-border-color);
|
|
824
910
|
|
|
911
|
+
&.datagrid-opened-info {
|
|
912
|
+
border-radius: 0.125rem 0 0 0;
|
|
913
|
+
overflow-x: hidden;
|
|
914
|
+
}
|
|
915
|
+
|
|
825
916
|
.datagrid-table-wrapper {
|
|
826
917
|
display: flex;
|
|
827
918
|
flex: 1 1 auto;
|
|
@@ -905,6 +996,8 @@ onUnmounted(() => {
|
|
|
905
996
|
.title-column {
|
|
906
997
|
font-weight: bold;
|
|
907
998
|
font-size: 11px;
|
|
999
|
+
text-overflow: ellipsis;
|
|
1000
|
+
white-space: nowrap;
|
|
908
1001
|
}
|
|
909
1002
|
|
|
910
1003
|
.sort-arrow-wrap {
|
|
@@ -967,25 +1060,23 @@ onUnmounted(() => {
|
|
|
967
1060
|
|
|
968
1061
|
&.hidden-text-triangle::after {
|
|
969
1062
|
content: '';
|
|
970
|
-
margin-right: -5%;
|
|
971
1063
|
position: absolute;
|
|
972
1064
|
transform: rotate(225deg);
|
|
973
1065
|
border-bottom: 15px solid transparent;
|
|
974
1066
|
border-right: 15px solid var(--global-bg-color);
|
|
975
1067
|
bottom: 26%;
|
|
976
|
-
right:
|
|
977
|
-
z-index:
|
|
1068
|
+
right: -10px;
|
|
1069
|
+
z-index: 1000;
|
|
978
1070
|
}
|
|
979
1071
|
&.hidden-text-triangle::before {
|
|
980
1072
|
content: '';
|
|
981
|
-
margin-right: -5%;
|
|
982
1073
|
transform: rotate(-135deg);
|
|
983
1074
|
position: absolute;
|
|
984
1075
|
border-bottom: 16px solid transparent;
|
|
985
1076
|
border-right: 16px solid var(--global-border-color);
|
|
986
1077
|
bottom: 23%;
|
|
987
|
-
right:
|
|
988
|
-
z-index:
|
|
1078
|
+
right: -10px;
|
|
1079
|
+
z-index: 999;
|
|
989
1080
|
}
|
|
990
1081
|
}
|
|
991
1082
|
|
|
@@ -1083,6 +1174,14 @@ onUnmounted(() => {
|
|
|
1083
1174
|
}
|
|
1084
1175
|
}
|
|
1085
1176
|
|
|
1177
|
+
.datagrid-fixed-column-without-separator {
|
|
1178
|
+
background-color: var(--block-view-bg-color);
|
|
1179
|
+
|
|
1180
|
+
&::after {
|
|
1181
|
+
background-color: transparent;
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1086
1185
|
.datagrid-fixed-column {
|
|
1087
1186
|
background-color: var(--block-view-bg-color);
|
|
1088
1187
|
|
|
@@ -1144,6 +1243,11 @@ onUnmounted(() => {
|
|
|
1144
1243
|
padding: 0 0.6rem;
|
|
1145
1244
|
height: 28px;
|
|
1146
1245
|
|
|
1246
|
+
&.datagrid-footer-opened-info {
|
|
1247
|
+
border-radius: 0 0 0 0.15rem;
|
|
1248
|
+
flex-direction: row-reverse;
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1147
1251
|
.clr-form-control-disabled {
|
|
1148
1252
|
opacity: 1;
|
|
1149
1253
|
|
|
@@ -1216,17 +1320,13 @@ onUnmounted(() => {
|
|
|
1216
1320
|
|
|
1217
1321
|
.hidden-features {
|
|
1218
1322
|
padding: 9px 14px;
|
|
1219
|
-
position: absolute;
|
|
1220
|
-
top: 8.5%;
|
|
1221
|
-
right: 0%;
|
|
1222
|
-
left: 25.35%;
|
|
1223
|
-
bottom: 0%;
|
|
1224
|
-
z-index: 1000001;
|
|
1225
1323
|
background-color: var(--global-bg-color);
|
|
1226
1324
|
color: var(--global-font-color2);
|
|
1227
1325
|
border: 1px solid var(--global-border-color);
|
|
1326
|
+
border-left: none;
|
|
1228
1327
|
overflow-y: auto;
|
|
1229
1328
|
overflow-x: hidden;
|
|
1329
|
+
width: 65%;
|
|
1230
1330
|
|
|
1231
1331
|
.header {
|
|
1232
1332
|
display: flex;
|
|
@@ -1,83 +1,89 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="pagination">
|
|
3
|
-
<div v-if="!props.hidePagination" class="pagination-size">
|
|
4
|
-
<atoms-per-page
|
|
5
|
-
v-if="!props.hidePageSize"
|
|
6
|
-
:test-id="props.testId"
|
|
7
|
-
:page-size="props.pageSize"
|
|
8
|
-
:options="props.options"
|
|
9
|
-
@change="changePageSize"
|
|
10
|
-
/>
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
<div
|
|
14
|
-
{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
:
|
|
22
|
-
:
|
|
23
|
-
:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="pagination">
|
|
3
|
+
<div v-if="!props.hidePagination" class="pagination-size">
|
|
4
|
+
<atoms-per-page
|
|
5
|
+
v-if="!props.hidePageSize"
|
|
6
|
+
:test-id="props.testId"
|
|
7
|
+
:page-size="props.pageSize"
|
|
8
|
+
:options="props.options"
|
|
9
|
+
@change="changePageSize"
|
|
10
|
+
/>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
:class="['pagination-description', { 'ml-1': !props.isShowHiddenInfo }]"
|
|
15
|
+
>
|
|
16
|
+
{{ totalItemCount }}
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<atoms-table-data-grid-page
|
|
20
|
+
v-if="!props.hidePagination"
|
|
21
|
+
:test-id="props.testId"
|
|
22
|
+
:page="props.page"
|
|
23
|
+
:total-items="props.totalItems"
|
|
24
|
+
:total-pages="props.totalPages"
|
|
25
|
+
:page-size="props.pageSize"
|
|
26
|
+
@change="changePage"
|
|
27
|
+
/>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script setup lang="ts">
|
|
32
|
+
import { UI_I_Localization } from '~/models/interfaces'
|
|
33
|
+
import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
|
|
34
|
+
|
|
35
|
+
const props = withDefaults(
|
|
36
|
+
defineProps<{
|
|
37
|
+
options: UI_I_OptionItem[]
|
|
38
|
+
pageSize: number
|
|
39
|
+
page: number
|
|
40
|
+
totalItems: number
|
|
41
|
+
totalPages: number
|
|
42
|
+
pageItemsCount: number
|
|
43
|
+
hidePagination?: boolean
|
|
44
|
+
hidePageSize?: boolean
|
|
45
|
+
showPageInfo?: boolean
|
|
46
|
+
testId?: string
|
|
47
|
+
isShowHiddenInfo?: boolean
|
|
48
|
+
}>(),
|
|
49
|
+
{
|
|
50
|
+
testId: 'ui-data-grid-pagination',
|
|
51
|
+
isShowHiddenInfo: false,
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
const emits = defineEmits<{
|
|
55
|
+
(event: 'change-page-size', value: number): void
|
|
56
|
+
(event: 'change-page', value: number): void
|
|
57
|
+
}>()
|
|
58
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
59
|
+
const totalItemCount = computed<string>(() => {
|
|
60
|
+
const start = (props.page - 1) * props.pageSize + 1
|
|
61
|
+
// const end = Math.min(props.totalItems, props.page * props.pageSize)
|
|
62
|
+
|
|
63
|
+
const paginationInfo = props.showPageInfo
|
|
64
|
+
? `${start} - ${props.pageItemsCount} ${localization.value.of}`
|
|
65
|
+
: ''
|
|
66
|
+
// props.totalPages > 1 ? `${start} - ${end} ${localization.of}` : ''
|
|
67
|
+
|
|
68
|
+
return `${paginationInfo} ${
|
|
69
|
+
props.totalItems
|
|
70
|
+
} ${localization.value.items.toLowerCase()}`
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
const changePageSize = (pageSize: number): void => {
|
|
74
|
+
const newTotalPages = Math.ceil(props.totalItems / pageSize)
|
|
75
|
+
if (newTotalPages < props.page) changePage(newTotalPages)
|
|
76
|
+
emits('change-page-size', pageSize)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const changePage = (page: number): void => {
|
|
80
|
+
emits('change-page', page)
|
|
81
|
+
}
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<style scoped lang="scss">
|
|
85
|
+
.pagination {
|
|
86
|
+
display: inline-flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
}
|
|
89
|
+
</style>
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
UI_I_ColumnKey,
|
|
3
|
+
UI_I_HeadItem,
|
|
4
|
+
} from '~/components/atoms/table/dataGrid/models/interfaces'
|
|
2
5
|
|
|
3
6
|
export const constructColumnKey = (
|
|
4
7
|
key: string,
|
|
5
8
|
text: string,
|
|
6
9
|
show: boolean
|
|
7
|
-
): UI_I_ColumnKey => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
}
|
|
10
|
+
): UI_I_ColumnKey => ({
|
|
11
|
+
key,
|
|
12
|
+
text,
|
|
13
|
+
show,
|
|
14
|
+
})
|
|
14
15
|
|
|
15
16
|
export const constructHeadItem = (
|
|
16
17
|
key: string,
|
|
@@ -19,15 +20,13 @@ export const constructHeadItem = (
|
|
|
19
20
|
hasFilter: boolean,
|
|
20
21
|
width: string,
|
|
21
22
|
iconName?: string
|
|
22
|
-
): UI_I_HeadItem => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
}
|
|
23
|
+
): UI_I_HeadItem => ({
|
|
24
|
+
key,
|
|
25
|
+
text,
|
|
26
|
+
sortColumn,
|
|
27
|
+
showFilter: false,
|
|
28
|
+
hasFilter,
|
|
29
|
+
filter: '',
|
|
30
|
+
width,
|
|
31
|
+
iconName,
|
|
32
|
+
})
|
|
@@ -61,16 +61,18 @@ const props = withDefaults(
|
|
|
61
61
|
fullMode?: boolean
|
|
62
62
|
height?: string
|
|
63
63
|
withCollapse?: boolean
|
|
64
|
+
selectedTab?: number
|
|
64
65
|
}>(),
|
|
65
66
|
{
|
|
66
67
|
modalTabs: undefined,
|
|
67
68
|
height: undefined,
|
|
68
69
|
viewName: '',
|
|
70
|
+
selectedTab: 0,
|
|
69
71
|
}
|
|
70
72
|
)
|
|
71
73
|
|
|
72
74
|
// Selected tab id on the view settings modal
|
|
73
|
-
const selectedTabViewSettings = ref<number>(
|
|
75
|
+
const selectedTabViewSettings = ref<number>(props.selectedTab)
|
|
74
76
|
|
|
75
77
|
// Filtering the selected tab content
|
|
76
78
|
const viewSettingsTabContent = (tab: number): UI_I_ViewSettingsFields[] =>
|