@v-c/table 1.0.2 → 1.0.3-beta.1

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.
@@ -115,7 +115,7 @@ var Cell_default = /* @__PURE__ */ defineComponent({
115
115
  }
116
116
  const mergedColSpan = legacyCellProps?.colSpan ?? additionalProps.colSpan ?? colSpan ?? 1;
117
117
  const mergedRowSpan = legacyCellProps?.rowSpan ?? additionalProps.rowSpan ?? rowSpan ?? 1;
118
- const [hovering, onHover] = useHoverState(index, mergedRowSpan);
118
+ const [hovering, onHover] = useHoverState(index, mergedRowSpan, tableContext);
119
119
  const onMouseEnter = (event) => {
120
120
  if (record) onHover(index, index + mergedRowSpan - 1);
121
121
  (additionalProps.onMouseEnter || additionalProps.onMouseenter)?.(event);
@@ -1,3 +1,4 @@
1
1
  import { ComputedRef } from 'vue';
2
2
  import { OnHover } from '../hooks/useHover';
3
- export default function useHoverState(rowIndex: number, rowSpan: number): [hovering: ComputedRef<boolean>, onHover: OnHover];
3
+ import { TableContextProps } from '../context/TableContext';
4
+ export default function useHoverState(rowIndex: number, rowSpan: number, context: TableContextProps): [hovering: ComputedRef<boolean>, onHover: OnHover];
@@ -1,11 +1,9 @@
1
- import { useInjectTableContext } from "../context/TableContext.js";
2
1
  import { computed } from "vue";
3
2
  function inHoverRange(cellStartRow, cellRowSpan, startRow, endRow) {
4
3
  const cellEndRow = cellStartRow + cellRowSpan - 1;
5
4
  return cellStartRow <= endRow && cellEndRow >= startRow;
6
5
  }
7
- function useHoverState(rowIndex, rowSpan) {
8
- const context = useInjectTableContext();
6
+ function useHoverState(rowIndex, rowSpan, context) {
9
7
  return [computed(() => {
10
8
  return inHoverRange(rowIndex, rowSpan || 1, context.hoverStartRow, context.hoverEndRow);
11
9
  }), context.onHover];
package/dist/Table.js CHANGED
@@ -250,7 +250,7 @@ var ImmutableTable = /* @__PURE__ */ defineComponent((props, { attrs, slots, exp
250
250
  });
251
251
  const scrollbarSize = ref(0);
252
252
  onMounted(() => {
253
- if (!props.tailor || !useInternalHooks.value) if (scrollBodyRef.value instanceof Element) scrollbarSize.value = getTargetScrollBarSize(scrollBodyRef.value).width;
253
+ if (!props.tailor || !useInternalHooks.value) if (scrollBodyRef.value?.nodeType === 1) scrollbarSize.value = getTargetScrollBarSize(scrollBodyRef.value).width;
254
254
  else scrollbarSize.value = getTargetScrollBarSize(scrollBodyContainerRef.value).width;
255
255
  });
256
256
  watchEffect(() => {
@@ -404,7 +404,7 @@ var ImmutableTable = /* @__PURE__ */ defineComponent((props, { attrs, slots, exp
404
404
  "ref": scrollSummaryRef,
405
405
  "colGroup": bodyColGroupNode
406
406
  }), { default: renderFixedFooterTable }),
407
- stickyConfig.value.isSticky && scrollBodyRef.value instanceof Element && createVNode(stickyScrollBar_default, {
407
+ stickyConfig.value.isSticky && scrollBodyRef.value?.nodeType === 1 && createVNode(stickyScrollBar_default, {
408
408
  "ref": stickyRef,
409
409
  "offsetScroll": stickyConfig.value.offsetScroll,
410
410
  "scrollBodyRef": scrollBodyRef,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@v-c/table",
3
3
  "type": "module",
4
- "version": "1.0.2",
4
+ "version": "1.0.3-beta.1",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -20,9 +20,9 @@
20
20
  "vue": "^3.0.0"
21
21
  },
22
22
  "dependencies": {
23
+ "@v-c/resize-observer": "^1.0.8",
23
24
  "@v-c/virtual-list": "^1.0.6",
24
- "@v-c/util": "^1.0.17",
25
- "@v-c/resize-observer": "^1.0.8"
25
+ "@v-c/util": "^1.0.18"
26
26
  },
27
27
  "publishConfig": {
28
28
  "access": "public"