@mantine-vue/table 2.2.2 → 2.3.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.
package/esm/index.mjs CHANGED
@@ -4,7 +4,7 @@ import { ActionIcon, Alert, Autocomplete, Badge, Box, Button, Checkbox, Collapse
4
4
  import clsx from "clsx";
5
5
  import { compareItems, rankItem, rankings } from "@tanstack/match-sorter-utils";
6
6
  import { IconArrowAutofitContent, IconArrowsSort, IconBaselineDensityLarge, IconBaselineDensityMedium, IconBaselineDensitySmall, IconBoxMultiple, IconChevronDown, IconChevronLeft, IconChevronLeftPipe, IconChevronRight, IconChevronRightPipe, IconChevronsDown, IconCircleX, IconClearAll, IconColumns, IconDeviceFloppy, IconDots, IconDotsVertical, IconEdit, IconEyeOff, IconFilter, IconFilterCog, IconFilterOff, IconGripHorizontal, IconMaximize, IconMinimize, IconPinned, IconPinnedOff, IconSearch, IconSearchOff, IconSortAscending, IconSortDescending, IconX } from "@tabler/icons-vue";
7
- import { useDebouncedValue } from "@mantine-vue/hooks";
7
+ import { useDebouncedValue, useMediaQuery } from "@mantine-vue/hooks";
8
8
  import { defaultRangeExtractor, useVirtualizer } from "@tanstack/vue-virtual";
9
9
  import { DateInput } from "@mantine-vue/dates";
10
10
  //#region src/utils/column.utils.ts
@@ -2008,13 +2008,7 @@ var MVT_BottomToolbar = defineComponent({
2008
2008
  required: true
2009
2009
  } },
2010
2010
  setup(props, { attrs }) {
2011
- const isMobile = ref(false);
2012
- onMounted(() => {
2013
- if (typeof window === "undefined" || !window.matchMedia) return;
2014
- const mql = window.matchMedia("(max-width: 720px)");
2015
- isMobile.value = mql.matches;
2016
- mql.addEventListener("change", (e) => isMobile.value = e.matches);
2017
- });
2011
+ const isMobile = useMediaQuery("(max-width: 720px)");
2018
2012
  return () => {
2019
2013
  const { table } = props;
2020
2014
  const { getState, options: { enablePagination, mantineBottomToolbarProps, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderBottomToolbarCustomActions }, refs: { bottomToolbarRef } } = table;
@@ -2718,16 +2712,6 @@ var MVT_TopToolbar_module_default = {
2718
2712
  };
2719
2713
  //#endregion
2720
2714
  //#region src/components/toolbar/MVT_TopToolbar.ts
2721
- var useMedia = (query) => {
2722
- const matches = ref(false);
2723
- onMounted(() => {
2724
- if (typeof window === "undefined" || !window.matchMedia) return;
2725
- const mql = window.matchMedia(query);
2726
- matches.value = mql.matches;
2727
- mql.addEventListener("change", (e) => matches.value = e.matches);
2728
- });
2729
- return matches;
2730
- };
2731
2715
  var MVT_TopToolbar = defineComponent({
2732
2716
  name: "MVTTopToolbar",
2733
2717
  inheritAttrs: false,
@@ -2736,8 +2720,8 @@ var MVT_TopToolbar = defineComponent({
2736
2720
  required: true
2737
2721
  } },
2738
2722
  setup(props, { attrs }) {
2739
- const isMobile = useMedia("(max-width: 720px)");
2740
- const isTablet = useMedia("(max-width: 1024px)");
2723
+ const isMobile = useMediaQuery("(max-width: 720px)");
2724
+ const isTablet = useMediaQuery("(max-width: 1024px)");
2741
2725
  return () => {
2742
2726
  const { table } = props;
2743
2727
  const { getState, options: { enableGlobalFilter, enablePagination, enableToolbarInternalActions, mantineTopToolbarProps, positionGlobalFilter, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderTopToolbarCustomActions }, refs: { topToolbarRef } } = table;
@@ -2747,7 +2731,10 @@ var MVT_TopToolbar = defineComponent({
2747
2731
  ...attrs
2748
2732
  };
2749
2733
  const stackAlertBanner = isMobile.value || !!renderTopToolbarCustomActions || showGlobalFilter && isTablet.value;
2750
- const globalFilterProps = { table };
2734
+ const globalFilterProps = {
2735
+ style: !isTablet.value ? { zIndex: 3 } : void 0,
2736
+ table
2737
+ };
2751
2738
  return h(Box, {
2752
2739
  ...toolbarProps,
2753
2740
  class: clsx(common_styles_module_default["common-toolbar-styles"], MVT_TopToolbar_module_default["root"], isFullScreen && MVT_TopToolbar_module_default["root-fullscreen"], toolbarProps?.class),
@@ -2764,7 +2751,7 @@ var MVT_TopToolbar = defineComponent({
2764
2751
  table
2765
2752
  }),
2766
2753
  ["both", "top"].includes(positionToolbarDropZone ?? "") && h(MVT_ToolbarDropZone, { table }),
2767
- h(Flex, { class: clsx(MVT_TopToolbar_module_default["actions-container"], stackAlertBanner && MVT_TopToolbar_module_default["actions-container-stack-alert"]) }, () => [
2754
+ h(Flex, { class: [MVT_TopToolbar_module_default["actions-container"], stackAlertBanner ? MVT_TopToolbar_module_default["actions-container-stack-alert"] : void 0] }, () => [
2768
2755
  enableGlobalFilter && positionGlobalFilter === "left" && h(MVT_GlobalFilterTextInput, globalFilterProps),
2769
2756
  parseFromValuesOrFunc(renderTopToolbarCustomActions, { table }) ?? h("span"),
2770
2757
  enableToolbarInternalActions ? h(Flex, {
@@ -2801,6 +2788,7 @@ var MVT_EditRowModal = defineComponent({
2801
2788
  },
2802
2789
  emits: { close: () => true },
2803
2790
  setup(props, { attrs, emit, slots }) {
2791
+ const mvtSlots = useMVT_Slots();
2804
2792
  return () => {
2805
2793
  const { table } = props;
2806
2794
  const state = table.getState();
@@ -2838,7 +2826,7 @@ var MVT_EditRowModal = defineComponent({
2838
2826
  modalProps.onClose?.();
2839
2827
  emit("close");
2840
2828
  };
2841
- const custom = (state.creatingRow ? slots.create ?? slots.default : slots.edit ?? slots.default)?.({
2829
+ const custom = (state.creatingRow ? slots.create ?? mvtSlots.createRowModalContent ?? slots.default : slots.edit ?? mvtSlots.editRowModalContent ?? slots.default)?.({
2842
2830
  internalEditComponents,
2843
2831
  row,
2844
2832
  table