@indielayer/ui 1.15.3 → 1.16.0
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/docs/pages/component/table/usage.vue +13 -0
- package/lib/components/table/Table.vue.d.ts +9 -0
- package/lib/components/table/Table.vue.js +189 -159
- package/lib/components/tooltip/Tooltip.vue.js +64 -52
- package/lib/index.js +1 -1
- package/lib/index.umd.js +4 -4
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/components/table/Table.vue +22 -1
- package/src/components/tooltip/Tooltip.vue +25 -5
- package/src/version.ts +1 -1
package/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "1.
|
|
1
|
+
declare const _default: "1.16.0";
|
|
2
2
|
export default _default;
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -76,7 +76,7 @@ export default { name: 'XTable' }
|
|
|
76
76
|
</script>
|
|
77
77
|
|
|
78
78
|
<script setup lang="ts" generic="T">
|
|
79
|
-
import { ref, type ExtractPublicPropTypes, type PropType, watch, computed } from 'vue'
|
|
79
|
+
import { ref, type ExtractPublicPropTypes, type PropType, watch, computed, useSlots } from 'vue'
|
|
80
80
|
import { useTheme, type ThemeComponent } from '../../composables/useTheme'
|
|
81
81
|
import { useVirtualList } from '../../composables/useVirtualList'
|
|
82
82
|
|
|
@@ -375,6 +375,10 @@ watch(items, (newValue: T[]) => {
|
|
|
375
375
|
}
|
|
376
376
|
}, { immediate: true })
|
|
377
377
|
|
|
378
|
+
const slots = useSlots()
|
|
379
|
+
|
|
380
|
+
const hasFooter = computed(() => Object.keys(slots).some((key) => key.startsWith('footer-')))
|
|
381
|
+
|
|
378
382
|
const { styles, classes, className } = useTheme('Table', {}, props)
|
|
379
383
|
</script>
|
|
380
384
|
|
|
@@ -531,6 +535,23 @@ const { styles, classes, className } = useTheme('Table', {}, props)
|
|
|
531
535
|
</tr>
|
|
532
536
|
</template>
|
|
533
537
|
</x-table-body>
|
|
538
|
+
<slot name="footer">
|
|
539
|
+
<tfoot v-if="hasFooter && !loading">
|
|
540
|
+
<x-table-row>
|
|
541
|
+
<x-table-cell v-if="props.selectable && !props.singleSelect" width="40" class="!pl-3.5 !pr-0.5" />
|
|
542
|
+
<x-table-cell v-if="expandable" width="48" class="!p-0" />
|
|
543
|
+
<x-table-cell
|
|
544
|
+
v-for="(header, index) in headers"
|
|
545
|
+
:key="index"
|
|
546
|
+
:text-align="header.align"
|
|
547
|
+
:width="header.width"
|
|
548
|
+
:dense="dense"
|
|
549
|
+
>
|
|
550
|
+
<slot :name="`footer-${header.value}`" :header="header"></slot>
|
|
551
|
+
</x-table-cell>
|
|
552
|
+
</x-table-row>
|
|
553
|
+
</tfoot>
|
|
554
|
+
</slot>
|
|
534
555
|
</table>
|
|
535
556
|
<div
|
|
536
557
|
v-if="loading"
|
|
@@ -44,10 +44,10 @@ const arrowPositionClasses = computed(() => {
|
|
|
44
44
|
if (computedDisabled.value) return ''
|
|
45
45
|
|
|
46
46
|
const placements = {
|
|
47
|
-
top: '-bottom-2.5
|
|
48
|
-
bottom: '-top-2.5
|
|
49
|
-
left: '-right-2.5
|
|
50
|
-
right: '-left-2.5
|
|
47
|
+
top: '-bottom-2.5 w-3.5',
|
|
48
|
+
bottom: '-top-2.5 w-3.5',
|
|
49
|
+
left: '-right-2.5 h-3.5',
|
|
50
|
+
right: '-left-2.5 h-3.5',
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
return placements[actualPosition.value]
|
|
@@ -148,10 +148,27 @@ const calculatePosition = () => {
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
+
// Calculate arrow offset relative to trigger element center
|
|
152
|
+
const arrowOffset: Record<string, string> = {}
|
|
153
|
+
|
|
154
|
+
if (position === 'top' || position === 'bottom') {
|
|
155
|
+
const triggerCenter = triggerRect.left + triggerRect.width / 2
|
|
156
|
+
const offsetFromTooltipLeft = triggerCenter - left
|
|
157
|
+
|
|
158
|
+
arrowOffset.left = `${offsetFromTooltipLeft}px`
|
|
159
|
+
} else if (position === 'left' || position === 'right') {
|
|
160
|
+
const triggerCenter = triggerRect.top + triggerRect.height / 2
|
|
161
|
+
const offsetFromTooltipTop = triggerCenter - top
|
|
162
|
+
|
|
163
|
+
arrowOffset.top = `${offsetFromTooltipTop}px`
|
|
164
|
+
}
|
|
165
|
+
|
|
151
166
|
actualPosition.value = position
|
|
152
167
|
tooltipStyle.value = {
|
|
153
168
|
top: `${top}px`,
|
|
154
169
|
left: `${left}px`,
|
|
170
|
+
'--arrow-offset-x': arrowOffset.left || '0px',
|
|
171
|
+
'--arrow-offset-y': arrowOffset.top || '0px',
|
|
155
172
|
}
|
|
156
173
|
}
|
|
157
174
|
|
|
@@ -203,7 +220,10 @@ const { classes, className } = useTheme('Tooltip', {}, props)
|
|
|
203
220
|
]"
|
|
204
221
|
>
|
|
205
222
|
<slot name="tooltip">{{ tooltip }}</slot>
|
|
206
|
-
<div
|
|
223
|
+
<div
|
|
224
|
+
:class="['absolute overflow-hidden shadow-lg z-10', arrowPositionClasses]"
|
|
225
|
+
:style="actualPosition === 'top' || actualPosition === 'bottom' ? { left: 'var(--arrow-offset-x)', transform: 'translateX(-50%)' } : { top: 'var(--arrow-offset-y)', transform: 'translateY(-50%)' }"
|
|
226
|
+
>
|
|
207
227
|
<div :class="['h-2.5 w-2.5 bg-secondary-700 transform border border-secondary-800', arrowRotationClasses]"></div>
|
|
208
228
|
</div>
|
|
209
229
|
</div>
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '1.
|
|
1
|
+
export default '1.16.0'
|