@usssa/component-library 1.0.0-alpha.237 → 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/README.md
CHANGED
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
|
|
@@ -203,6 +223,8 @@ const filterMethod = (rows, terms, cols, getCellValue) => {
|
|
|
203
223
|
const getActionItemColor = (action, row) => {
|
|
204
224
|
if (action.destructive) {
|
|
205
225
|
return 'accent'
|
|
226
|
+
} else if (action.positive) {
|
|
227
|
+
return 'positive'
|
|
206
228
|
} else {
|
|
207
229
|
return typeof action.color === 'function'
|
|
208
230
|
? action.color(row)
|
|
@@ -253,6 +275,13 @@ const getMenuInlineActions = (col, option) => {
|
|
|
253
275
|
})
|
|
254
276
|
}
|
|
255
277
|
|
|
278
|
+
const handleCellOverflowResize = () => {
|
|
279
|
+
Object.keys(cellOverflowStates.value).forEach(key => {
|
|
280
|
+
const selector = `#long-content-${key}`
|
|
281
|
+
checkCellOverflow(selector, key)
|
|
282
|
+
})
|
|
283
|
+
}
|
|
284
|
+
|
|
256
285
|
const handleItemClick = (action, row) => {
|
|
257
286
|
moreActionsDialogs.value[row.id][0].open = false
|
|
258
287
|
setTimeout(() => {
|
|
@@ -267,10 +296,9 @@ const handleMenuHide = () => {
|
|
|
267
296
|
}
|
|
268
297
|
|
|
269
298
|
const handleMenuShow = (id) => {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
299
|
+
activeMenuId.value = id
|
|
300
|
+
checkMenuPosition(id)
|
|
301
|
+
window.addEventListener('scroll', onScroll, true)
|
|
274
302
|
}
|
|
275
303
|
|
|
276
304
|
const handleOpenMobileMoreActions = (id) => {
|
|
@@ -321,22 +349,26 @@ const handleScroll = async () => {
|
|
|
321
349
|
}
|
|
322
350
|
}
|
|
323
351
|
|
|
324
|
-
// checking for tooltip is content is visible
|
|
325
|
-
const isContentVisible = (field, id, type) => {
|
|
326
|
-
return document.getElementById(`long-${type}-${field}-${id}`)
|
|
327
|
-
}
|
|
328
|
-
|
|
329
352
|
const isGridLastRow = (row) => {
|
|
330
353
|
const lastIndex = parseInt(pagination.value.rowsPerPage) - 1
|
|
331
354
|
return row.rowIndex === lastIndex
|
|
332
355
|
}
|
|
333
356
|
|
|
334
357
|
const onScroll = () => {
|
|
335
|
-
if(activeMenuId.value !== null) {
|
|
358
|
+
if (activeMenuId.value !== null) {
|
|
336
359
|
checkMenuPosition(activeMenuId.value)
|
|
337
360
|
}
|
|
338
361
|
}
|
|
339
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
|
+
|
|
340
372
|
onMounted(() => {
|
|
341
373
|
infiniteNoMoreShow.value = false
|
|
342
374
|
nextTick(() => {
|
|
@@ -344,10 +376,14 @@ onMounted(() => {
|
|
|
344
376
|
attachScroll()
|
|
345
377
|
}
|
|
346
378
|
})
|
|
379
|
+
updateHeaderMaxWidth()
|
|
380
|
+
window.addEventListener('resize', updateHeaderMaxWidth)
|
|
347
381
|
})
|
|
348
382
|
|
|
349
383
|
onBeforeUnmount(() => {
|
|
350
384
|
detachScroll()
|
|
385
|
+
window.removeEventListener('resize', updateHeaderMaxWidth)
|
|
386
|
+
window.removeEventListener('resize', handleCellOverflowResize)
|
|
351
387
|
})
|
|
352
388
|
|
|
353
389
|
// Watch for changes in infiniteScroll or tableContainer
|
|
@@ -419,6 +455,9 @@ watch(
|
|
|
419
455
|
},
|
|
420
456
|
{ immediate: true }
|
|
421
457
|
)
|
|
458
|
+
|
|
459
|
+
// Re-check on window resize
|
|
460
|
+
window.addEventListener('resize', handleCellOverflowResize)
|
|
422
461
|
</script>
|
|
423
462
|
|
|
424
463
|
<template>
|
|
@@ -480,6 +519,10 @@ watch(
|
|
|
480
519
|
:style="props.selected ? 'transform: scale(0.95);' : ''"
|
|
481
520
|
>
|
|
482
521
|
<q-card bordered flat>
|
|
522
|
+
<div
|
|
523
|
+
class="table-card-wrapper"
|
|
524
|
+
ref="tableCardWrapperRef"
|
|
525
|
+
>
|
|
483
526
|
<q-list
|
|
484
527
|
dense
|
|
485
528
|
:style="{
|
|
@@ -663,11 +706,21 @@ watch(
|
|
|
663
706
|
<q-item-label v-if="col.type !== 'icon'" caption>
|
|
664
707
|
<span
|
|
665
708
|
:class="[
|
|
666
|
-
col.value
|
|
709
|
+
col.value && col.value.length > minOverflowLength && !col.header
|
|
710
|
+
? 'long-text-content'
|
|
711
|
+
: 'card-header-table',
|
|
712
|
+
|
|
667
713
|
col.noEllipsis ? 'no-ellipsis-content' : '',
|
|
714
|
+
isTablet && col.header
|
|
715
|
+
? 'tablet-header-table'
|
|
716
|
+
: '',
|
|
717
|
+
isMobile && col.header
|
|
718
|
+
? 'mobile-header-table'
|
|
719
|
+
: '',
|
|
668
720
|
col.doubleSpan && col.noEllipsis
|
|
669
721
|
? 'full-width-text-content'
|
|
670
722
|
: '',
|
|
723
|
+
col.classes,
|
|
671
724
|
!isResponsiveTablet &&
|
|
672
725
|
isTablet &&
|
|
673
726
|
col.classes &&
|
|
@@ -681,6 +734,8 @@ watch(
|
|
|
681
734
|
: '',
|
|
682
735
|
]"
|
|
683
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 }"
|
|
684
739
|
>
|
|
685
740
|
{{ col.value }}
|
|
686
741
|
</span>
|
|
@@ -710,15 +765,12 @@ watch(
|
|
|
710
765
|
</div>
|
|
711
766
|
</template>
|
|
712
767
|
</template>
|
|
768
|
+
|
|
713
769
|
<UTooltip
|
|
714
770
|
v-if="
|
|
715
771
|
col.value &&
|
|
716
|
-
col.value.length >
|
|
717
|
-
|
|
718
|
-
col.field,
|
|
719
|
-
props.row.id,
|
|
720
|
-
'content'
|
|
721
|
-
)
|
|
772
|
+
col.value.length > minOverflowLength &&
|
|
773
|
+
cellOverflowStates[`${col.field}-${props.row.id}`]
|
|
722
774
|
"
|
|
723
775
|
anchor="bottom middle"
|
|
724
776
|
:description="col.value"
|
|
@@ -734,6 +786,8 @@ watch(
|
|
|
734
786
|
"
|
|
735
787
|
class="td-caption mobile-primary-caption text-body-sm"
|
|
736
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%' }"
|
|
737
791
|
>
|
|
738
792
|
<template v-if="col.captionKeyTitle">
|
|
739
793
|
{{ col.captionKeyTitle }}:
|
|
@@ -743,12 +797,8 @@ watch(
|
|
|
743
797
|
<UTooltip
|
|
744
798
|
v-if="
|
|
745
799
|
props.row[col.captionKey] &&
|
|
746
|
-
props.row[col.captionKey].length >
|
|
747
|
-
|
|
748
|
-
col.field,
|
|
749
|
-
props.row.id,
|
|
750
|
-
'caption'
|
|
751
|
-
)
|
|
800
|
+
props.row[col.captionKey].length > minOverflowLength &&
|
|
801
|
+
cellOverflowStates[`caption-${col.field}-${props.row.id}`]
|
|
752
802
|
"
|
|
753
803
|
anchor="bottom middle"
|
|
754
804
|
:description="props.row[col.captionKey]"
|
|
@@ -1292,6 +1342,7 @@ watch(
|
|
|
1292
1342
|
</q-item>
|
|
1293
1343
|
</template>
|
|
1294
1344
|
</q-list>
|
|
1345
|
+
</div>
|
|
1295
1346
|
</q-card>
|
|
1296
1347
|
</div>
|
|
1297
1348
|
<UExpansionStd
|
|
@@ -1501,11 +1552,19 @@ watch(
|
|
|
1501
1552
|
/>
|
|
1502
1553
|
<span
|
|
1503
1554
|
:class="[
|
|
1504
|
-
col.value
|
|
1555
|
+
col.value && col.value.length > minOverflowLength && !col.header
|
|
1556
|
+
? 'long-text-content'
|
|
1557
|
+
: 'card-header-table',
|
|
1505
1558
|
col.noEllipsis ? 'no-ellipsis-content' : '',
|
|
1506
1559
|
col.doubleSpan && col.noEllipsis
|
|
1507
1560
|
? 'full-width-text-content'
|
|
1508
1561
|
: '',
|
|
1562
|
+
isTablet && col.header
|
|
1563
|
+
? 'tablet-header-table'
|
|
1564
|
+
: '',
|
|
1565
|
+
isMobile && col.header
|
|
1566
|
+
? 'mobile-header-table'
|
|
1567
|
+
: '',
|
|
1509
1568
|
!isResponsiveTablet &&
|
|
1510
1569
|
isTablet &&
|
|
1511
1570
|
col.classes &&
|
|
@@ -1519,6 +1578,8 @@ watch(
|
|
|
1519
1578
|
: '',
|
|
1520
1579
|
]"
|
|
1521
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 }"
|
|
1522
1583
|
>
|
|
1523
1584
|
{{ col.value }}
|
|
1524
1585
|
<template
|
|
@@ -1551,12 +1612,8 @@ watch(
|
|
|
1551
1612
|
<UTooltip
|
|
1552
1613
|
v-if="
|
|
1553
1614
|
col.value &&
|
|
1554
|
-
col.value.length >
|
|
1555
|
-
|
|
1556
|
-
col.field,
|
|
1557
|
-
props.row.id,
|
|
1558
|
-
'content'
|
|
1559
|
-
)
|
|
1615
|
+
col.value.length > minOverflowLength &&
|
|
1616
|
+
cellOverflowStates[`${col.field}-${props.row.id}`]
|
|
1560
1617
|
"
|
|
1561
1618
|
anchor="bottom middle"
|
|
1562
1619
|
:description="col.value"
|
|
@@ -1976,7 +2033,9 @@ watch(
|
|
|
1976
2033
|
moreActionDialogData.secondaryAction.disable
|
|
1977
2034
|
"
|
|
1978
2035
|
:flat="moreActionDialogData.secondaryAction.flat"
|
|
1979
|
-
:label="
|
|
2036
|
+
:label="
|
|
2037
|
+
moreActionDialogData.secondaryAction.label
|
|
2038
|
+
"
|
|
1980
2039
|
:loading="
|
|
1981
2040
|
moreActionDialogData.secondaryAction.loading
|
|
1982
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>
|