@usssa/component-library 1.0.0-alpha.238 → 1.0.0-alpha.239
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/package.json
CHANGED
|
@@ -130,12 +130,18 @@ const props = defineProps({
|
|
|
130
130
|
const $q = useQuasar()
|
|
131
131
|
const $screen = useScreenType()
|
|
132
132
|
|
|
133
|
+
const minOverflowLength = 12
|
|
134
|
+
|
|
133
135
|
const activeMenuId = ref(null)
|
|
136
|
+
const captionMaxWidth = ref('100%')
|
|
137
|
+
const cellOverflowStates = ref({})
|
|
138
|
+
const headerMaxWidth = ref('100%')
|
|
139
|
+
const infiniteNoMoreShow = ref(false)
|
|
134
140
|
const infiniteScrollProp = ref(props.infiniteScrollProperty)
|
|
135
141
|
const isScrollActionActive = ref(false)
|
|
136
142
|
const mobileActionsDialog = ref({})
|
|
137
143
|
const moreActionsDialogs = ref({})
|
|
138
|
-
const
|
|
144
|
+
const tableCardWrapperRef = ref(null)
|
|
139
145
|
const tableContainer = ref(null)
|
|
140
146
|
const tableDataChip = ref(true) // this is required to show chip
|
|
141
147
|
const tailClass = ref(null)
|
|
@@ -158,6 +164,20 @@ const attachScroll = () => {
|
|
|
158
164
|
}
|
|
159
165
|
}
|
|
160
166
|
|
|
167
|
+
const checkCellOverflow = (selector, key) => {
|
|
168
|
+
nextTick(() => {
|
|
169
|
+
requestAnimationFrame(() => {
|
|
170
|
+
const element = document.querySelector(selector)
|
|
171
|
+
|
|
172
|
+
if (element) {
|
|
173
|
+
cellOverflowStates.value[key] = element.scrollWidth > element.clientWidth
|
|
174
|
+
} else {
|
|
175
|
+
cellOverflowStates.value[key] = false
|
|
176
|
+
}
|
|
177
|
+
})
|
|
178
|
+
})
|
|
179
|
+
}
|
|
180
|
+
|
|
161
181
|
// checking the menu position after show
|
|
162
182
|
const checkMenuPosition = (id) => {
|
|
163
183
|
const menuElement = document.getElementById(`actionPopupRef-${id}`) // Access the menu by ID
|
|
@@ -255,6 +275,13 @@ const getMenuInlineActions = (col, option) => {
|
|
|
255
275
|
})
|
|
256
276
|
}
|
|
257
277
|
|
|
278
|
+
const handleCellOverflowResize = () => {
|
|
279
|
+
Object.keys(cellOverflowStates.value).forEach(key => {
|
|
280
|
+
const selector = `#long-content-${key}`
|
|
281
|
+
checkCellOverflow(selector, key)
|
|
282
|
+
})
|
|
283
|
+
}
|
|
284
|
+
|
|
258
285
|
const handleItemClick = (action, row) => {
|
|
259
286
|
moreActionsDialogs.value[row.id][0].open = false
|
|
260
287
|
setTimeout(() => {
|
|
@@ -272,7 +299,6 @@ const handleMenuShow = (id) => {
|
|
|
272
299
|
activeMenuId.value = id
|
|
273
300
|
checkMenuPosition(id)
|
|
274
301
|
window.addEventListener('scroll', onScroll, true)
|
|
275
|
-
|
|
276
302
|
}
|
|
277
303
|
|
|
278
304
|
const handleOpenMobileMoreActions = (id) => {
|
|
@@ -323,11 +349,6 @@ const handleScroll = async () => {
|
|
|
323
349
|
}
|
|
324
350
|
}
|
|
325
351
|
|
|
326
|
-
// checking for tooltip is content is visible
|
|
327
|
-
const isContentVisible = (field, id, type) => {
|
|
328
|
-
return document.getElementById(`long-${type}-${field}-${id}`)
|
|
329
|
-
}
|
|
330
|
-
|
|
331
352
|
const isGridLastRow = (row) => {
|
|
332
353
|
const lastIndex = parseInt(pagination.value.rowsPerPage) - 1
|
|
333
354
|
return row.rowIndex === lastIndex
|
|
@@ -339,6 +360,15 @@ const onScroll = () => {
|
|
|
339
360
|
}
|
|
340
361
|
}
|
|
341
362
|
|
|
363
|
+
const updateHeaderMaxWidth = () => {
|
|
364
|
+
nextTick(() => {
|
|
365
|
+
if (tableCardWrapperRef.value) {
|
|
366
|
+
headerMaxWidth.value = tableCardWrapperRef.value.offsetWidth - 64 + 'px'
|
|
367
|
+
captionMaxWidth.value = headerMaxWidth.value
|
|
368
|
+
}
|
|
369
|
+
})
|
|
370
|
+
}
|
|
371
|
+
|
|
342
372
|
onMounted(() => {
|
|
343
373
|
infiniteNoMoreShow.value = false
|
|
344
374
|
nextTick(() => {
|
|
@@ -346,10 +376,14 @@ onMounted(() => {
|
|
|
346
376
|
attachScroll()
|
|
347
377
|
}
|
|
348
378
|
})
|
|
379
|
+
updateHeaderMaxWidth()
|
|
380
|
+
window.addEventListener('resize', updateHeaderMaxWidth)
|
|
349
381
|
})
|
|
350
382
|
|
|
351
383
|
onBeforeUnmount(() => {
|
|
352
384
|
detachScroll()
|
|
385
|
+
window.removeEventListener('resize', updateHeaderMaxWidth)
|
|
386
|
+
window.removeEventListener('resize', handleCellOverflowResize)
|
|
353
387
|
})
|
|
354
388
|
|
|
355
389
|
// Watch for changes in infiniteScroll or tableContainer
|
|
@@ -421,6 +455,9 @@ watch(
|
|
|
421
455
|
},
|
|
422
456
|
{ immediate: true }
|
|
423
457
|
)
|
|
458
|
+
|
|
459
|
+
// Re-check on window resize
|
|
460
|
+
window.addEventListener('resize', handleCellOverflowResize)
|
|
424
461
|
</script>
|
|
425
462
|
|
|
426
463
|
<template>
|
|
@@ -482,6 +519,10 @@ watch(
|
|
|
482
519
|
:style="props.selected ? 'transform: scale(0.95);' : ''"
|
|
483
520
|
>
|
|
484
521
|
<q-card bordered flat>
|
|
522
|
+
<div
|
|
523
|
+
class="table-card-wrapper"
|
|
524
|
+
ref="tableCardWrapperRef"
|
|
525
|
+
>
|
|
485
526
|
<q-list
|
|
486
527
|
dense
|
|
487
528
|
:style="{
|
|
@@ -665,11 +706,21 @@ watch(
|
|
|
665
706
|
<q-item-label v-if="col.type !== 'icon'" caption>
|
|
666
707
|
<span
|
|
667
708
|
:class="[
|
|
668
|
-
col.value
|
|
709
|
+
col.value && col.value.length > minOverflowLength && !col.header
|
|
710
|
+
? 'long-text-content'
|
|
711
|
+
: 'card-header-table',
|
|
712
|
+
|
|
669
713
|
col.noEllipsis ? 'no-ellipsis-content' : '',
|
|
714
|
+
isTablet && col.header
|
|
715
|
+
? 'tablet-header-table'
|
|
716
|
+
: '',
|
|
717
|
+
isMobile && col.header
|
|
718
|
+
? 'mobile-header-table'
|
|
719
|
+
: '',
|
|
670
720
|
col.doubleSpan && col.noEllipsis
|
|
671
721
|
? 'full-width-text-content'
|
|
672
722
|
: '',
|
|
723
|
+
col.classes,
|
|
673
724
|
!isResponsiveTablet &&
|
|
674
725
|
isTablet &&
|
|
675
726
|
col.classes &&
|
|
@@ -683,6 +734,8 @@ watch(
|
|
|
683
734
|
: '',
|
|
684
735
|
]"
|
|
685
736
|
:id="`long-content-${col.field}-${props.row.id}`"
|
|
737
|
+
:ref="el => checkCellOverflow(`#long-content-${col.field}-${props.row.id}`, `${col.field}-${props.row.id}`)"
|
|
738
|
+
:style="{ maxWidth: headerMaxWidth }"
|
|
686
739
|
>
|
|
687
740
|
{{ col.value }}
|
|
688
741
|
</span>
|
|
@@ -712,15 +765,12 @@ watch(
|
|
|
712
765
|
</div>
|
|
713
766
|
</template>
|
|
714
767
|
</template>
|
|
768
|
+
|
|
715
769
|
<UTooltip
|
|
716
770
|
v-if="
|
|
717
771
|
col.value &&
|
|
718
|
-
col.value.length >
|
|
719
|
-
|
|
720
|
-
col.field,
|
|
721
|
-
props.row.id,
|
|
722
|
-
'content'
|
|
723
|
-
)
|
|
772
|
+
col.value.length > minOverflowLength &&
|
|
773
|
+
cellOverflowStates[`${col.field}-${props.row.id}`]
|
|
724
774
|
"
|
|
725
775
|
anchor="bottom middle"
|
|
726
776
|
:description="col.value"
|
|
@@ -736,6 +786,8 @@ watch(
|
|
|
736
786
|
"
|
|
737
787
|
class="td-caption mobile-primary-caption text-body-sm"
|
|
738
788
|
:id="`long-caption-${col.field}-${props.row.id}`"
|
|
789
|
+
:ref="el => checkCellOverflow(`#long-caption-${col.field}-${props.row.id}`, `caption-${col.field}-${props.row.id}`)"
|
|
790
|
+
:style="{ maxWidth: captionMaxWidth, width: '100%' }"
|
|
739
791
|
>
|
|
740
792
|
<template v-if="col.captionKeyTitle">
|
|
741
793
|
{{ col.captionKeyTitle }}:
|
|
@@ -745,12 +797,8 @@ watch(
|
|
|
745
797
|
<UTooltip
|
|
746
798
|
v-if="
|
|
747
799
|
props.row[col.captionKey] &&
|
|
748
|
-
props.row[col.captionKey].length >
|
|
749
|
-
|
|
750
|
-
col.field,
|
|
751
|
-
props.row.id,
|
|
752
|
-
'caption'
|
|
753
|
-
)
|
|
800
|
+
props.row[col.captionKey].length > minOverflowLength &&
|
|
801
|
+
cellOverflowStates[`caption-${col.field}-${props.row.id}`]
|
|
754
802
|
"
|
|
755
803
|
anchor="bottom middle"
|
|
756
804
|
:description="props.row[col.captionKey]"
|
|
@@ -1294,6 +1342,7 @@ watch(
|
|
|
1294
1342
|
</q-item>
|
|
1295
1343
|
</template>
|
|
1296
1344
|
</q-list>
|
|
1345
|
+
</div>
|
|
1297
1346
|
</q-card>
|
|
1298
1347
|
</div>
|
|
1299
1348
|
<UExpansionStd
|
|
@@ -1503,11 +1552,19 @@ watch(
|
|
|
1503
1552
|
/>
|
|
1504
1553
|
<span
|
|
1505
1554
|
:class="[
|
|
1506
|
-
col.value
|
|
1555
|
+
col.value && col.value.length > minOverflowLength && !col.header
|
|
1556
|
+
? 'long-text-content'
|
|
1557
|
+
: 'card-header-table',
|
|
1507
1558
|
col.noEllipsis ? 'no-ellipsis-content' : '',
|
|
1508
1559
|
col.doubleSpan && col.noEllipsis
|
|
1509
1560
|
? 'full-width-text-content'
|
|
1510
1561
|
: '',
|
|
1562
|
+
isTablet && col.header
|
|
1563
|
+
? 'tablet-header-table'
|
|
1564
|
+
: '',
|
|
1565
|
+
isMobile && col.header
|
|
1566
|
+
? 'mobile-header-table'
|
|
1567
|
+
: '',
|
|
1511
1568
|
!isResponsiveTablet &&
|
|
1512
1569
|
isTablet &&
|
|
1513
1570
|
col.classes &&
|
|
@@ -1521,6 +1578,8 @@ watch(
|
|
|
1521
1578
|
: '',
|
|
1522
1579
|
]"
|
|
1523
1580
|
:id="`long-content-${col.field}-${props.row.id}`"
|
|
1581
|
+
:ref="el => checkCellOverflow(`#long-content-${col.field}-${props.row.id}`, `${col.field}-${props.row.id}`)"
|
|
1582
|
+
:style="{ maxWidth: headerMaxWidth }"
|
|
1524
1583
|
>
|
|
1525
1584
|
{{ col.value }}
|
|
1526
1585
|
<template
|
|
@@ -1553,12 +1612,8 @@ watch(
|
|
|
1553
1612
|
<UTooltip
|
|
1554
1613
|
v-if="
|
|
1555
1614
|
col.value &&
|
|
1556
|
-
col.value.length >
|
|
1557
|
-
|
|
1558
|
-
col.field,
|
|
1559
|
-
props.row.id,
|
|
1560
|
-
'content'
|
|
1561
|
-
)
|
|
1615
|
+
col.value.length > minOverflowLength &&
|
|
1616
|
+
cellOverflowStates[`${col.field}-${props.row.id}`]
|
|
1562
1617
|
"
|
|
1563
1618
|
anchor="bottom middle"
|
|
1564
1619
|
:description="col.value"
|
|
@@ -1978,7 +2033,9 @@ watch(
|
|
|
1978
2033
|
moreActionDialogData.secondaryAction.disable
|
|
1979
2034
|
"
|
|
1980
2035
|
:flat="moreActionDialogData.secondaryAction.flat"
|
|
1981
|
-
:label="
|
|
2036
|
+
:label="
|
|
2037
|
+
moreActionDialogData.secondaryAction.label
|
|
2038
|
+
"
|
|
1982
2039
|
:loading="
|
|
1983
2040
|
moreActionDialogData.secondaryAction.loading
|
|
1984
2041
|
"
|
|
@@ -1631,7 +1631,6 @@ watch(
|
|
|
1631
1631
|
width: 10.5rem
|
|
1632
1632
|
|
|
1633
1633
|
.mobile-primary-caption
|
|
1634
|
-
width: 11.5rem !important
|
|
1635
1634
|
white-space: nowrap
|
|
1636
1635
|
overflow: hidden
|
|
1637
1636
|
text-overflow: ellipsis
|
|
@@ -1682,4 +1681,11 @@ watch(
|
|
|
1682
1681
|
|
|
1683
1682
|
.mobile-expansion-item
|
|
1684
1683
|
flex: calc(50% - 8px)
|
|
1684
|
+
|
|
1685
|
+
.card-header-table
|
|
1686
|
+
text-overflow: ellipsis
|
|
1687
|
+
overflow: hidden
|
|
1688
|
+
white-space: nowrap
|
|
1689
|
+
display: block
|
|
1690
|
+
|
|
1685
1691
|
</style>
|