@hywax/cms 0.0.23 → 1.1.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/.nuxt/cms/editor/index.ts +0 -2
- package/.nuxt/cms/form-panel-section.ts +2 -2
- package/.nuxt/cms/index.ts +8 -21
- package/.nuxt/cms/table-search-input.ts +6 -0
- package/dist/module.json +3 -3
- package/dist/module.mjs +85 -204
- package/dist/runtime/components/AutocompleteSelect.d.vue.ts +56 -0
- package/dist/runtime/components/AutocompleteSelect.vue +131 -77
- package/dist/runtime/components/AutocompleteSelect.vue.d.ts +43 -29
- package/dist/runtime/components/{ButtonDelete.vue.d.ts → ButtonDeleteConfirm.d.vue.ts} +4 -3
- package/dist/runtime/components/{ButtonDelete.vue → ButtonDeleteConfirm.vue} +1 -1
- package/dist/runtime/components/ButtonDeleteConfirm.vue.d.ts +36 -0
- package/dist/runtime/components/DatePicker.d.vue.ts +43 -0
- package/dist/runtime/components/DatePicker.vue +232 -0
- package/dist/runtime/components/DatePicker.vue.d.ts +43 -0
- package/dist/runtime/components/EditorFull.d.vue.ts +13 -0
- package/dist/runtime/components/EditorFull.vue +127 -0
- package/dist/runtime/components/EditorFull.vue.d.ts +13 -0
- package/dist/runtime/components/EditorLinkPopover.d.vue.ts +8 -0
- package/dist/runtime/components/EditorLinkPopover.vue +137 -0
- package/dist/runtime/components/EditorLinkPopover.vue.d.ts +8 -0
- package/dist/runtime/components/FormPanel.d.vue.ts +47 -0
- package/dist/runtime/components/FormPanel.vue +10 -7
- package/dist/runtime/components/FormPanel.vue.d.ts +21 -15
- package/dist/runtime/components/FormPanelAsideSection.d.vue.ts +24 -0
- package/dist/runtime/components/FormPanelAsideSection.vue.d.ts +2 -1
- package/dist/runtime/components/FormPanelSection.d.vue.ts +21 -0
- package/dist/runtime/components/FormPanelSection.vue +2 -2
- package/dist/runtime/components/FormPanelSection.vue.d.ts +3 -2
- package/dist/runtime/components/Layout.d.vue.ts +29 -0
- package/dist/runtime/components/Layout.vue +81 -0
- package/dist/runtime/components/Layout.vue.d.ts +29 -0
- package/dist/runtime/components/ModalConfirm.d.vue.ts +33 -0
- package/dist/runtime/components/ModalConfirm.vue.d.ts +3 -2
- package/dist/runtime/components/TableColumnSorting.d.vue.ts +17 -0
- package/dist/runtime/components/{TablePanelColumnSorting.vue → TableColumnSorting.vue} +27 -18
- package/dist/runtime/components/TableColumnSorting.vue.d.ts +17 -0
- package/dist/runtime/components/TableColumnVisibility.d.vue.ts +24 -0
- package/dist/runtime/components/TableColumnVisibility.vue +111 -0
- package/dist/runtime/components/TableColumnVisibility.vue.d.ts +24 -0
- package/dist/runtime/components/TableFilters.d.vue.ts +90 -0
- package/dist/runtime/components/TableFilters.vue +198 -0
- package/dist/runtime/components/TableFilters.vue.d.ts +90 -0
- package/dist/runtime/components/TablePanel.d.vue.ts +95 -0
- package/dist/runtime/components/TablePanel.vue +207 -66
- package/dist/runtime/components/TablePanel.vue.d.ts +76 -31
- package/dist/runtime/components/TableSearchInput.d.vue.ts +33 -0
- package/dist/runtime/components/TableSearchInput.vue +96 -0
- package/dist/runtime/components/TableSearchInput.vue.d.ts +33 -0
- package/dist/runtime/components/UploraImage.d.vue.ts +35 -0
- package/dist/runtime/components/UploraImage.vue.d.ts +3 -2
- package/dist/runtime/components/prose/UploraImage.d.vue.ts +14 -0
- package/dist/runtime/components/prose/UploraImage.vue.d.ts +2 -1
- package/dist/runtime/composables/useAdmin.d.ts +1 -1
- package/dist/runtime/composables/useAdmin.js +2 -1
- package/dist/runtime/composables/useApi.d.ts +1 -1
- package/dist/runtime/composables/useAsyncHandler.d.ts +1 -1
- package/dist/runtime/composables/useAsyncHandler.js +1 -1
- package/dist/runtime/composables/useEditorDragHandle.d.ts +16 -0
- package/dist/runtime/composables/useEditorDragHandle.js +95 -0
- package/dist/runtime/composables/useEditorSuggestions.d.ts +68 -0
- package/dist/runtime/composables/useEditorSuggestions.js +24 -0
- package/dist/runtime/composables/useEditorToolbar.d.ts +120 -0
- package/dist/runtime/composables/useEditorToolbar.js +87 -0
- package/dist/runtime/composables/useFormState.d.ts +12 -0
- package/dist/runtime/composables/useFormState.js +33 -0
- package/dist/runtime/composables/useLogout.d.ts +1 -1
- package/dist/runtime/composables/useLogout.js +3 -1
- package/dist/runtime/composables/useNotification.d.ts +12 -0
- package/dist/runtime/composables/useNotification.js +46 -0
- package/dist/runtime/composables/useQueryState.d.ts +28 -0
- package/dist/runtime/composables/useQueryState.js +105 -0
- package/dist/runtime/composables/useRouteQuery.d.ts +37 -0
- package/dist/runtime/composables/useRouteQuery.js +81 -0
- package/dist/runtime/composables/useRowSelection.d.ts +8 -0
- package/dist/runtime/composables/useRowSelection.js +46 -0
- package/dist/runtime/composables/useTable.d.ts +17 -11
- package/dist/runtime/composables/useTable.js +47 -53
- package/dist/runtime/composables/useUplora.d.ts +1 -1
- package/dist/runtime/composables/useUplora.js +2 -1
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/plugins/zod.d.ts +2 -0
- package/dist/runtime/plugins/zod.js +26 -0
- package/dist/runtime/server/api/uplora/[id].delete.d.ts +1 -5
- package/dist/runtime/tv.d.ts +1 -1
- package/dist/runtime/types/date.d.ts +5 -0
- package/dist/runtime/types/index.d.ts +3 -21
- package/dist/runtime/types/index.js +1 -21
- package/dist/runtime/types/utils.d.ts +7 -0
- package/dist/runtime/utils/date.d.ts +9 -0
- package/dist/runtime/utils/date.js +28 -0
- package/dist/runtime/utils/formatters.d.ts +2 -0
- package/dist/runtime/utils/formatters.js +8 -0
- package/dist/runtime/utils/index.d.ts +5 -2
- package/dist/runtime/utils/index.js +5 -2
- package/dist/runtime/utils/storage.d.ts +2 -0
- package/dist/runtime/utils/storage.js +10 -0
- package/dist/runtime/utils/table.d.ts +23 -0
- package/dist/runtime/utils/table.js +51 -0
- package/package.json +26 -25
- package/.nuxt/cms/button-clear.ts +0 -5
- package/.nuxt/cms/button-copy.ts +0 -5
- package/.nuxt/cms/button-delete.ts +0 -5
- package/.nuxt/cms/editor/callout.ts +0 -21
- package/.nuxt/cms/editor/uplora-image.ts +0 -5
- package/.nuxt/cms/editor-content-full.ts +0 -13
- package/.nuxt/cms/editor-content-light.ts +0 -13
- package/.nuxt/cms/input-seo.ts +0 -5
- package/.nuxt/cms/input-slug.ts +0 -5
- package/.nuxt/cms/input-uplora-image.ts +0 -22
- package/.nuxt/cms/table-cell-preview.ts +0 -9
- package/.nuxt/cms/table-cell-seo.ts +0 -5
- package/.nuxt/cms/table-cell-user.ts +0 -9
- package/.nuxt/cms/table-panel-column-sorting.ts +0 -5
- package/.nuxt/cms/table-panel-column-visibility.ts +0 -5
- package/.nuxt/cms/table-panel-filters.ts +0 -5
- package/dist/runtime/components/ButtonClear.vue +0 -35
- package/dist/runtime/components/ButtonClear.vue.d.ts +0 -35
- package/dist/runtime/components/ButtonCopy.vue +0 -40
- package/dist/runtime/components/ButtonCopy.vue.d.ts +0 -23
- package/dist/runtime/components/EditorContentFull.vue +0 -67
- package/dist/runtime/components/EditorContentFull.vue.d.ts +0 -23
- package/dist/runtime/components/EditorContentLight.vue +0 -60
- package/dist/runtime/components/EditorContentLight.vue.d.ts +0 -23
- package/dist/runtime/components/InputSeo.vue +0 -73
- package/dist/runtime/components/InputSeo.vue.d.ts +0 -19
- package/dist/runtime/components/InputSlug.vue +0 -70
- package/dist/runtime/components/InputSlug.vue.d.ts +0 -29
- package/dist/runtime/components/InputUploraImage.vue +0 -156
- package/dist/runtime/components/InputUploraImage.vue.d.ts +0 -38
- package/dist/runtime/components/TableCellPreview.vue +0 -41
- package/dist/runtime/components/TableCellPreview.vue.d.ts +0 -18
- package/dist/runtime/components/TableCellSeo.vue +0 -34
- package/dist/runtime/components/TableCellSeo.vue.d.ts +0 -13
- package/dist/runtime/components/TableCellUser.vue +0 -40
- package/dist/runtime/components/TableCellUser.vue.d.ts +0 -18
- package/dist/runtime/components/TablePanelColumnSorting.vue.d.ts +0 -20
- package/dist/runtime/components/TablePanelColumnVisibility.vue +0 -49
- package/dist/runtime/components/TablePanelColumnVisibility.vue.d.ts +0 -20
- package/dist/runtime/components/TablePanelFilters.vue +0 -79
- package/dist/runtime/components/TablePanelFilters.vue.d.ts +0 -34
- package/dist/runtime/composables/useDeleteConfirm.d.ts +0 -15
- package/dist/runtime/composables/useDeleteConfirm.js +0 -27
- package/dist/runtime/composables/useSeoStats.d.ts +0 -12
- package/dist/runtime/composables/useSeoStats.js +0 -44
- package/dist/runtime/editor/components/BlockMenu.vue +0 -43
- package/dist/runtime/editor/components/BlockMenu.vue.d.ts +0 -2
- package/dist/runtime/editor/components/SlashCommand.vue +0 -92
- package/dist/runtime/editor/components/SlashCommand.vue.d.ts +0 -7
- package/dist/runtime/editor/components/TooltipLink.vue +0 -81
- package/dist/runtime/editor/components/TooltipLink.vue.d.ts +0 -9
- package/dist/runtime/editor/components/TooltipMenu.vue +0 -75
- package/dist/runtime/editor/components/TooltipMenu.vue.d.ts +0 -9
- package/dist/runtime/editor/extensions/callout/CalloutView.vue +0 -85
- package/dist/runtime/editor/extensions/callout/CalloutView.vue.d.ts +0 -7
- package/dist/runtime/editor/extensions/callout/extension.d.ts +0 -13
- package/dist/runtime/editor/extensions/callout/extension.js +0 -48
- package/dist/runtime/editor/extensions/callout/index.d.ts +0 -2
- package/dist/runtime/editor/extensions/callout/index.js +0 -2
- package/dist/runtime/editor/extensions/callout/types.d.ts +0 -3
- package/dist/runtime/editor/extensions/index.d.ts +0 -26
- package/dist/runtime/editor/extensions/index.js +0 -85
- package/dist/runtime/editor/extensions/uplora-image/UploraImageView.vue +0 -29
- package/dist/runtime/editor/extensions/uplora-image/UploraImageView.vue.d.ts +0 -7
- package/dist/runtime/editor/extensions/uplora-image/extension.d.ts +0 -13
- package/dist/runtime/editor/extensions/uplora-image/extension.js +0 -60
- package/dist/runtime/editor/extensions/uplora-image/index.d.ts +0 -2
- package/dist/runtime/editor/extensions/uplora-image/index.js +0 -2
- package/dist/runtime/editor/extensions/uplora-image/types.d.ts +0 -5
- package/dist/runtime/editor/extensions/uplora-image/types.js +0 -0
- package/dist/runtime/editor/markdown/index.d.ts +0 -3
- package/dist/runtime/editor/markdown/index.js +0 -47
- package/dist/runtime/editor/markdown/nodes/callout.d.ts +0 -2
- package/dist/runtime/editor/markdown/nodes/callout.js +0 -21
- package/dist/runtime/editor/markdown/nodes/uploraImage.d.ts +0 -2
- package/dist/runtime/editor/markdown/nodes/uploraImage.js +0 -31
- package/dist/runtime/utils/dictionaries.d.ts +0 -4
- package/dist/runtime/utils/dictionaries.js +0 -6
- /package/.nuxt/cms/{autocomplete-select.ts → button-delete-confirm.ts} +0 -0
- /package/dist/runtime/{editor/extensions/callout/types.js → types/date.js} +0 -0
- /package/dist/runtime/utils/{image.d.ts → uplora.d.ts} +0 -0
- /package/dist/runtime/utils/{image.js → uplora.js} +0 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<UPopover v-model:open="isOpen">
|
|
3
|
+
<UChip
|
|
4
|
+
:ui="{ base: 'z-1 size-3' }"
|
|
5
|
+
:show="hiddenColumnsCount > 0"
|
|
6
|
+
:text="hiddenColumnsCount"
|
|
7
|
+
size="xl"
|
|
8
|
+
>
|
|
9
|
+
<UButton
|
|
10
|
+
variant="soft"
|
|
11
|
+
color="neutral"
|
|
12
|
+
label="Колонки"
|
|
13
|
+
:icon="appConfig.ui.icons.columns"
|
|
14
|
+
/>
|
|
15
|
+
</UChip>
|
|
16
|
+
|
|
17
|
+
<template #content>
|
|
18
|
+
<div class="p-3 min-w-64">
|
|
19
|
+
<h3 class="text-sm mb-2 text-muted">
|
|
20
|
+
Настройка колонок:
|
|
21
|
+
</h3>
|
|
22
|
+
|
|
23
|
+
<div ref="container">
|
|
24
|
+
<div
|
|
25
|
+
v-for="column in sortedItems"
|
|
26
|
+
v-show="column.label"
|
|
27
|
+
:key="column.id"
|
|
28
|
+
class="flex items-center gap-2 rounded hover:bg-elevated"
|
|
29
|
+
>
|
|
30
|
+
<UIcon
|
|
31
|
+
:name="appConfig.ui.icons.drag"
|
|
32
|
+
class="w-4 h-7 text-dimmed cursor-move shrink-0 handle"
|
|
33
|
+
/>
|
|
34
|
+
|
|
35
|
+
<UCheckbox
|
|
36
|
+
class="flex-1 py-1"
|
|
37
|
+
:model-value="column.visible"
|
|
38
|
+
:label="column.label"
|
|
39
|
+
:disabled="!column.canHide"
|
|
40
|
+
@update:model-value="toggleColumnVisibility(column.id, $event)"
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
</UPopover>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script setup>
|
|
50
|
+
import { useAppConfig, useRoute } from "#imports";
|
|
51
|
+
import { syncRef, useLocalStorage } from "@vueuse/core";
|
|
52
|
+
import { useSortable } from "@vueuse/integrations/useSortable";
|
|
53
|
+
import { computed, ref, useTemplateRef, watch } from "vue";
|
|
54
|
+
import { getCmsStorageKey } from "../utils";
|
|
55
|
+
const props = defineProps({
|
|
56
|
+
storageKey: { type: String, required: false, default: () => useRoute().name },
|
|
57
|
+
table: { type: Object, required: false }
|
|
58
|
+
});
|
|
59
|
+
const visibility = defineModel("visibility", { type: Object, ...{ default: {} } });
|
|
60
|
+
const storedVisibility = useLocalStorage(getCmsStorageKey(`column-visibility:${props.storageKey}`), visibility.value);
|
|
61
|
+
syncRef(storedVisibility, visibility, {
|
|
62
|
+
transform: { ltr: (value) => value }
|
|
63
|
+
});
|
|
64
|
+
const order = defineModel("order", { type: Array, ...{ default: [] } });
|
|
65
|
+
const storedOrder = useLocalStorage(getCmsStorageKey(`column-order:${props.storageKey}`), order.value);
|
|
66
|
+
syncRef(storedOrder, order, {
|
|
67
|
+
transform: { ltr: (value) => value }
|
|
68
|
+
});
|
|
69
|
+
const appConfig = useAppConfig();
|
|
70
|
+
const isOpen = ref(false);
|
|
71
|
+
const columns = computed(() => {
|
|
72
|
+
if (!props.table) {
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
return props.table.getAllColumns().map((column) => {
|
|
76
|
+
const label = column.columnDef.meta?.headerLabel ?? (typeof column.columnDef.header === "string" ? column.columnDef.header : void 0);
|
|
77
|
+
return {
|
|
78
|
+
id: column.id,
|
|
79
|
+
label,
|
|
80
|
+
visible: column.getIsVisible(),
|
|
81
|
+
canHide: column.getCanHide(),
|
|
82
|
+
onUpdateChecked: (checked) => toggleColumnVisibility(column.id, checked)
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
const sortedItems = computed(() => {
|
|
87
|
+
const sortOrder = Object.fromEntries(order.value.map((id, index) => [id, index]));
|
|
88
|
+
return columns.value.toSorted((a, b) => sortOrder[a.id] - sortOrder[b.id]);
|
|
89
|
+
});
|
|
90
|
+
const hiddenColumnsCount = computed(() => {
|
|
91
|
+
return columns.value.filter((column) => !column.visible).length;
|
|
92
|
+
});
|
|
93
|
+
function toggleColumnVisibility(columnId, visible) {
|
|
94
|
+
visibility.value = { ...visibility.value, [columnId]: !!visible };
|
|
95
|
+
}
|
|
96
|
+
const containerRef = useTemplateRef("container");
|
|
97
|
+
const { start: startSortable, stop: stopSortable } = useSortable(containerRef, order, {
|
|
98
|
+
handle: ".handle",
|
|
99
|
+
animation: 150,
|
|
100
|
+
onUpdate: (e) => {
|
|
101
|
+
const newColumnOrder = order.value.length !== sortedItems.value.length ? sortedItems.value.map((column) => column.id) : [...order.value];
|
|
102
|
+
newColumnOrder.splice(
|
|
103
|
+
e.newIndex,
|
|
104
|
+
0,
|
|
105
|
+
newColumnOrder.splice(e.oldIndex, 1)[0]
|
|
106
|
+
);
|
|
107
|
+
order.value = newColumnOrder;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
watch(containerRef, (value) => value ? startSortable() : stopSortable());
|
|
111
|
+
</script>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ColumnOrderState, Table, VisibilityState } from '@tanstack/vue-table';
|
|
2
|
+
export interface TableColumnVisibilityProps {
|
|
3
|
+
storageKey?: string;
|
|
4
|
+
table?: Table<any>;
|
|
5
|
+
}
|
|
6
|
+
export type TableColumnVisibilityModel = VisibilityState;
|
|
7
|
+
export type TableColumnVisibilityOrderModel = ColumnOrderState;
|
|
8
|
+
type __VLS_Props = TableColumnVisibilityProps;
|
|
9
|
+
type __VLS_ModelProps = {
|
|
10
|
+
'visibility'?: TableColumnVisibilityModel;
|
|
11
|
+
'order'?: TableColumnVisibilityOrderModel;
|
|
12
|
+
};
|
|
13
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
|
+
"update:visibility": (value: VisibilityState) => any;
|
|
16
|
+
"update:order": (value: ColumnOrderState) => any;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
18
|
+
"onUpdate:visibility"?: ((value: VisibilityState) => any) | undefined;
|
|
19
|
+
"onUpdate:order"?: ((value: ColumnOrderState) => any) | undefined;
|
|
20
|
+
}>, {
|
|
21
|
+
storageKey: string;
|
|
22
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const _default: typeof __VLS_export;
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { FormData, FormFieldProps, FormProps, FormSchema, SelectItem, SelectProps, SelectValue } from '@nuxt/ui';
|
|
2
|
+
import type { MaybeRef, VNode } from 'vue';
|
|
3
|
+
import type { KeysMatching } from '../types';
|
|
4
|
+
import type { Props as DatePickerProps } from './DatePicker.vue';
|
|
5
|
+
type EnumSelectItem = SelectValue | Required<Pick<Extract<SelectItem, object>, 'value' | 'label'>>;
|
|
6
|
+
interface Presets {
|
|
7
|
+
Input: {
|
|
8
|
+
modelValue: string | undefined;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
};
|
|
11
|
+
InputNumber: {
|
|
12
|
+
modelValue: number | undefined;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
};
|
|
15
|
+
Date: {
|
|
16
|
+
modelValue: DatePickerProps<false>['modelValue'];
|
|
17
|
+
withTime?: DatePickerProps<false>['withTime'];
|
|
18
|
+
};
|
|
19
|
+
DateRange: {
|
|
20
|
+
modelValue: DatePickerProps<true>['modelValue'];
|
|
21
|
+
withTime?: DatePickerProps<true>['withTime'];
|
|
22
|
+
};
|
|
23
|
+
Select: Pick<SelectProps<EnumSelectItem[]>, 'modelValue' | 'items' | 'placeholder'>;
|
|
24
|
+
MultiSelect: Pick<SelectProps<EnumSelectItem[], 'value', true>, 'modelValue' | 'items' | 'placeholder'>;
|
|
25
|
+
Checkbox: {
|
|
26
|
+
modelValue: boolean | undefined;
|
|
27
|
+
};
|
|
28
|
+
Switch: {
|
|
29
|
+
modelValue: boolean | undefined;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
type GetPresetProps<K extends Presets[keyof Presets]> = {
|
|
33
|
+
[P in keyof Omit<K, 'modelValue'>]: MaybeRef<K[P]>;
|
|
34
|
+
};
|
|
35
|
+
type PresetField<S extends FormSchema = FormSchema> = {
|
|
36
|
+
[P in keyof Presets]: {
|
|
37
|
+
name: KeysMatching<FormData<S>, Presets[P]['modelValue']>;
|
|
38
|
+
render?: P;
|
|
39
|
+
} & GetPresetProps<Presets[P]>;
|
|
40
|
+
}[keyof Presets];
|
|
41
|
+
interface BaseField<S extends FormSchema = FormSchema> {
|
|
42
|
+
name: keyof FormData<S> & string;
|
|
43
|
+
render?: (state: FormData<S>, field: FiltersField<S>) => VNode;
|
|
44
|
+
}
|
|
45
|
+
export type FiltersField<S extends FormSchema = FormSchema> = Omit<FormFieldProps, 'name'> & (BaseField<S> | PresetField<S>);
|
|
46
|
+
export type TableFiltersModel<S extends FormSchema> = FormData<S>;
|
|
47
|
+
export interface TableFiltersProps<S extends FormSchema, F extends FiltersField<S>[] = FiltersField<S>[]> extends Omit<FormProps<S>, 'transform' | 'onSubmit' | 'id' | 'state' | 'nested' | 'name'> {
|
|
48
|
+
source: FormData<S>;
|
|
49
|
+
fields?: F;
|
|
50
|
+
}
|
|
51
|
+
export type TableFiltersSlots<S extends FormSchema> = {
|
|
52
|
+
[K in Extract<keyof FormData<S>, string>]: (props: {
|
|
53
|
+
model: FormData<S>[K];
|
|
54
|
+
state: FormData<S>;
|
|
55
|
+
updateModel: (value: FormData<S>[K]) => any;
|
|
56
|
+
}) => any;
|
|
57
|
+
};
|
|
58
|
+
export interface TableFiltersEmits<S extends FormSchema> {
|
|
59
|
+
submit: [TableFiltersModel<S>];
|
|
60
|
+
reset: [TableFiltersModel<S>];
|
|
61
|
+
}
|
|
62
|
+
declare const _default: typeof __VLS_export;
|
|
63
|
+
export default _default;
|
|
64
|
+
declare const __VLS_export: <S extends FormSchema, F extends FiltersField<S>[] = FiltersField<S>[]>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
65
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(TableFiltersProps<S, F> & {
|
|
66
|
+
modelValue?: TableFiltersModel<S>;
|
|
67
|
+
}) & {
|
|
68
|
+
onReset?: ((args_0: import("@nuxt/ui").InferOutput<S>) => any) | undefined;
|
|
69
|
+
onSubmit?: ((args_0: import("@nuxt/ui").InferOutput<S>) => any) | undefined;
|
|
70
|
+
"onUpdate:modelValue"?: ((value: import("@nuxt/ui").InferOutput<S> | undefined) => any) | undefined;
|
|
71
|
+
}> & (typeof globalThis extends {
|
|
72
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
73
|
+
} ? P : {});
|
|
74
|
+
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
75
|
+
appliedFields: import("vue").ComputedRef<FiltersField<S>[]>;
|
|
76
|
+
clearField: (field: FiltersField<S>) => void;
|
|
77
|
+
reset: () => void;
|
|
78
|
+
submit: (data: TableFiltersModel<S>) => void;
|
|
79
|
+
}>) => void;
|
|
80
|
+
attrs: any;
|
|
81
|
+
slots: TableFiltersSlots<S>;
|
|
82
|
+
emit: (((evt: "reset", args_0: import("@nuxt/ui").InferOutput<S>) => void) & ((evt: "submit", args_0: import("@nuxt/ui").InferOutput<S>) => void)) & ((evt: "update:modelValue", value: import("@nuxt/ui").InferOutput<S> | undefined) => void);
|
|
83
|
+
}>) => import("vue").VNode & {
|
|
84
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
85
|
+
};
|
|
86
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
87
|
+
[K in keyof T]: T[K];
|
|
88
|
+
} : {
|
|
89
|
+
[K in keyof T as K]: T[K];
|
|
90
|
+
}) & {};
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<UPopover v-model:open="isOpen">
|
|
3
|
+
<UChip
|
|
4
|
+
:ui="{ base: 'z-1 size-3' }"
|
|
5
|
+
:show="appliedFields.length > 0"
|
|
6
|
+
:text="appliedFields.length"
|
|
7
|
+
size="xl"
|
|
8
|
+
>
|
|
9
|
+
<UButton
|
|
10
|
+
variant="soft"
|
|
11
|
+
color="neutral"
|
|
12
|
+
label="Фильтры"
|
|
13
|
+
:icon="appConfig.ui.icons.filter"
|
|
14
|
+
/>
|
|
15
|
+
</UChip>
|
|
16
|
+
|
|
17
|
+
<template #content>
|
|
18
|
+
<UForm
|
|
19
|
+
:id="formId"
|
|
20
|
+
ref="filters-form"
|
|
21
|
+
class="p-4 w-xs max-h-[60vh] overflow-y-auto"
|
|
22
|
+
:state="models"
|
|
23
|
+
:schema="schema"
|
|
24
|
+
@submit="submit($event.data)"
|
|
25
|
+
>
|
|
26
|
+
<UFormField
|
|
27
|
+
v-for="field of fields"
|
|
28
|
+
:key="field.name"
|
|
29
|
+
v-bind="field"
|
|
30
|
+
>
|
|
31
|
+
<slot
|
|
32
|
+
:name="field.name"
|
|
33
|
+
:model="models[field.name]"
|
|
34
|
+
:state="models"
|
|
35
|
+
:update-model="(value) => models[field.name] = value"
|
|
36
|
+
>
|
|
37
|
+
<component
|
|
38
|
+
:is="presets[field.render]?.(models, field)"
|
|
39
|
+
v-if="typeof field.render === 'string'"
|
|
40
|
+
/>
|
|
41
|
+
|
|
42
|
+
<component
|
|
43
|
+
:is="field.render(models, field)"
|
|
44
|
+
v-else-if="field.render"
|
|
45
|
+
/>
|
|
46
|
+
</slot>
|
|
47
|
+
</UFormField>
|
|
48
|
+
</UForm>
|
|
49
|
+
|
|
50
|
+
<USeparator class="mt-0" orientation="horizontal" />
|
|
51
|
+
|
|
52
|
+
<div class="flex justify-end space-x-2 p-4">
|
|
53
|
+
<UButton
|
|
54
|
+
color="neutral"
|
|
55
|
+
label="Сбросить"
|
|
56
|
+
variant="outline"
|
|
57
|
+
@click="reset"
|
|
58
|
+
/>
|
|
59
|
+
|
|
60
|
+
<UButton
|
|
61
|
+
type="submit"
|
|
62
|
+
label="Подтвердить"
|
|
63
|
+
:color="formRef && formRef.errors.length > 0 ? 'error' : 'primary'"
|
|
64
|
+
:form="formId"
|
|
65
|
+
/>
|
|
66
|
+
</div>
|
|
67
|
+
</template>
|
|
68
|
+
</UPopover>
|
|
69
|
+
</template>
|
|
70
|
+
|
|
71
|
+
<script>
|
|
72
|
+
import { LazyCDatePicker, LazyUCheckbox, LazyUInput, LazyUSelect, LazyUSwitch, UForm } from "#components";
|
|
73
|
+
import { useAppConfig } from "#imports";
|
|
74
|
+
import { useCloned } from "@vueuse/core";
|
|
75
|
+
import copy from "fast-copy";
|
|
76
|
+
import { deepEqual } from "fast-equals";
|
|
77
|
+
import { computed, h, nextTick, ref, toValue, unref, useId, useTemplateRef, watch } from "vue";
|
|
78
|
+
const presets = {
|
|
79
|
+
Date: (state, field) => h(LazyCDatePicker, {
|
|
80
|
+
"modelValue": state[field.name],
|
|
81
|
+
"withTime": toValue(field.withTime),
|
|
82
|
+
"onUpdate:modelValue": (value) => state[field.name] = value
|
|
83
|
+
}),
|
|
84
|
+
DateRange: (state, field) => h(LazyCDatePicker, {
|
|
85
|
+
"modelValue": state[field.name],
|
|
86
|
+
"range": true,
|
|
87
|
+
"withTime": unref(field.withTime),
|
|
88
|
+
"onUpdate:modelValue": (value) => state[field.name] = value
|
|
89
|
+
}),
|
|
90
|
+
Input: (state, field) => h(LazyUInput, {
|
|
91
|
+
"modelValue": state[field.name],
|
|
92
|
+
"modelModifiers": { trim: true, optional: true },
|
|
93
|
+
"placeholder": unref(field.placeholder) ?? `\u0412\u0432\u0435\u0434\u0438\u0442\u0435 ${field.label?.toLowerCase() ?? "\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"}`,
|
|
94
|
+
"onUpdate:modelValue": (value) => state[field.name] = value
|
|
95
|
+
}, {}),
|
|
96
|
+
InputNumber: (state, field) => h(LazyUInput, {
|
|
97
|
+
"modelValue": state[field.name],
|
|
98
|
+
"modelModifiers": { number: true, optional: true },
|
|
99
|
+
"placeholder": unref(field.placeholder) ?? `\u0412\u0432\u0435\u0434\u0438\u0442\u0435 ${field.label?.toLowerCase() ?? "\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"}`,
|
|
100
|
+
"onUpdate:modelValue": (value) => state[field.name] = value
|
|
101
|
+
}, {}),
|
|
102
|
+
Select: (state, field) => h(LazyUSelect, {
|
|
103
|
+
"modelValue": state[field.name],
|
|
104
|
+
"items": unref(field.items),
|
|
105
|
+
"placeholder": unref(field.placeholder) ?? `\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 ${field.label?.toLowerCase() ?? "\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"}`,
|
|
106
|
+
"onUpdate:modelValue": (value) => state[field.name] = value
|
|
107
|
+
}, {}),
|
|
108
|
+
MultiSelect: (state, field) => h(LazyUSelect, {
|
|
109
|
+
"modelValue": state[field.name],
|
|
110
|
+
"items": unref(field.items),
|
|
111
|
+
"placeholder": unref(field.placeholder) ?? `\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 ${field.label?.toLowerCase() ?? "\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"}`,
|
|
112
|
+
"multiple": true,
|
|
113
|
+
"onUpdate:modelValue": (value) => state[field.name] = value
|
|
114
|
+
}, {}),
|
|
115
|
+
Checkbox: (state, field) => h(LazyUCheckbox, {
|
|
116
|
+
"modelValue": state[field.name],
|
|
117
|
+
"label": unref(field.label),
|
|
118
|
+
"onUpdate:modelValue": (value) => state[field.name] = Boolean(value) || void 0
|
|
119
|
+
}),
|
|
120
|
+
Switch: (state, field) => h(LazyUSwitch, {
|
|
121
|
+
"modelValue": state[field.name],
|
|
122
|
+
"label": unref(field.label),
|
|
123
|
+
"onUpdate:modelValue": (value) => state[field.name] = value || void 0
|
|
124
|
+
})
|
|
125
|
+
};
|
|
126
|
+
</script>
|
|
127
|
+
|
|
128
|
+
<script setup>
|
|
129
|
+
const props = defineProps({
|
|
130
|
+
source: { type: null, required: true },
|
|
131
|
+
fields: { type: null, required: false },
|
|
132
|
+
schema: { type: null, required: false },
|
|
133
|
+
validate: { type: Function, required: false },
|
|
134
|
+
validateOn: { type: Array, required: false },
|
|
135
|
+
disabled: { type: Boolean, required: false },
|
|
136
|
+
validateOnInputDelay: { type: Number, required: false },
|
|
137
|
+
loadingAuto: { type: Boolean, required: false },
|
|
138
|
+
class: { type: null, required: false }
|
|
139
|
+
});
|
|
140
|
+
const emit = defineEmits(["submit", "reset"]);
|
|
141
|
+
defineSlots();
|
|
142
|
+
const appConfig = useAppConfig();
|
|
143
|
+
const filters = defineModel({ type: null });
|
|
144
|
+
const formId = `form-${useId()}`;
|
|
145
|
+
const formRef = useTemplateRef("filters-form");
|
|
146
|
+
const { cloned: models, sync: resetModels } = useCloned(() => props.source, {
|
|
147
|
+
clone: copy
|
|
148
|
+
});
|
|
149
|
+
const appliedFields = computed(() => {
|
|
150
|
+
return props.fields?.filter((field) => {
|
|
151
|
+
let value = filters.value?.[field.name];
|
|
152
|
+
let sourceValue = props.source?.[field.name];
|
|
153
|
+
if (value === "" || value === null || value === void 0 || Array.isArray(value) && value.length === 0) {
|
|
154
|
+
value = null;
|
|
155
|
+
}
|
|
156
|
+
if (sourceValue === "" || sourceValue === null || sourceValue === void 0 || Array.isArray(sourceValue) && sourceValue.length === 0) {
|
|
157
|
+
sourceValue = null;
|
|
158
|
+
}
|
|
159
|
+
return value !== sourceValue && !deepEqual(value, sourceValue);
|
|
160
|
+
}) ?? [];
|
|
161
|
+
});
|
|
162
|
+
let _isInternalUpdate = false;
|
|
163
|
+
watch(filters, (value) => {
|
|
164
|
+
if (!value) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (_isInternalUpdate) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
models.value = copy(value);
|
|
171
|
+
}, { immediate: true, deep: true });
|
|
172
|
+
const isOpen = ref(false);
|
|
173
|
+
function submit(data) {
|
|
174
|
+
filters.value = copy(data);
|
|
175
|
+
emit("submit", filters.value);
|
|
176
|
+
isOpen.value = false;
|
|
177
|
+
_isInternalUpdate = true;
|
|
178
|
+
nextTick(() => _isInternalUpdate = false);
|
|
179
|
+
}
|
|
180
|
+
function reset() {
|
|
181
|
+
resetModels();
|
|
182
|
+
filters.value = copy(models.value);
|
|
183
|
+
emit("reset", filters.value);
|
|
184
|
+
isOpen.value = false;
|
|
185
|
+
_isInternalUpdate = true;
|
|
186
|
+
nextTick(() => _isInternalUpdate = false);
|
|
187
|
+
}
|
|
188
|
+
function clearField(field) {
|
|
189
|
+
models.value = copy({ ...models.value, [field.name]: props.source[field.name] });
|
|
190
|
+
submit(models.value);
|
|
191
|
+
}
|
|
192
|
+
defineExpose({
|
|
193
|
+
appliedFields,
|
|
194
|
+
clearField,
|
|
195
|
+
reset,
|
|
196
|
+
submit
|
|
197
|
+
});
|
|
198
|
+
</script>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { FormData, FormFieldProps, FormProps, FormSchema, SelectItem, SelectProps, SelectValue } from '@nuxt/ui';
|
|
2
|
+
import type { MaybeRef, VNode } from 'vue';
|
|
3
|
+
import type { KeysMatching } from '../types';
|
|
4
|
+
import type { Props as DatePickerProps } from './DatePicker.vue';
|
|
5
|
+
type EnumSelectItem = SelectValue | Required<Pick<Extract<SelectItem, object>, 'value' | 'label'>>;
|
|
6
|
+
interface Presets {
|
|
7
|
+
Input: {
|
|
8
|
+
modelValue: string | undefined;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
};
|
|
11
|
+
InputNumber: {
|
|
12
|
+
modelValue: number | undefined;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
};
|
|
15
|
+
Date: {
|
|
16
|
+
modelValue: DatePickerProps<false>['modelValue'];
|
|
17
|
+
withTime?: DatePickerProps<false>['withTime'];
|
|
18
|
+
};
|
|
19
|
+
DateRange: {
|
|
20
|
+
modelValue: DatePickerProps<true>['modelValue'];
|
|
21
|
+
withTime?: DatePickerProps<true>['withTime'];
|
|
22
|
+
};
|
|
23
|
+
Select: Pick<SelectProps<EnumSelectItem[]>, 'modelValue' | 'items' | 'placeholder'>;
|
|
24
|
+
MultiSelect: Pick<SelectProps<EnumSelectItem[], 'value', true>, 'modelValue' | 'items' | 'placeholder'>;
|
|
25
|
+
Checkbox: {
|
|
26
|
+
modelValue: boolean | undefined;
|
|
27
|
+
};
|
|
28
|
+
Switch: {
|
|
29
|
+
modelValue: boolean | undefined;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
type GetPresetProps<K extends Presets[keyof Presets]> = {
|
|
33
|
+
[P in keyof Omit<K, 'modelValue'>]: MaybeRef<K[P]>;
|
|
34
|
+
};
|
|
35
|
+
type PresetField<S extends FormSchema = FormSchema> = {
|
|
36
|
+
[P in keyof Presets]: {
|
|
37
|
+
name: KeysMatching<FormData<S>, Presets[P]['modelValue']>;
|
|
38
|
+
render?: P;
|
|
39
|
+
} & GetPresetProps<Presets[P]>;
|
|
40
|
+
}[keyof Presets];
|
|
41
|
+
interface BaseField<S extends FormSchema = FormSchema> {
|
|
42
|
+
name: keyof FormData<S> & string;
|
|
43
|
+
render?: (state: FormData<S>, field: FiltersField<S>) => VNode;
|
|
44
|
+
}
|
|
45
|
+
export type FiltersField<S extends FormSchema = FormSchema> = Omit<FormFieldProps, 'name'> & (BaseField<S> | PresetField<S>);
|
|
46
|
+
export type TableFiltersModel<S extends FormSchema> = FormData<S>;
|
|
47
|
+
export interface TableFiltersProps<S extends FormSchema, F extends FiltersField<S>[] = FiltersField<S>[]> extends Omit<FormProps<S>, 'transform' | 'onSubmit' | 'id' | 'state' | 'nested' | 'name'> {
|
|
48
|
+
source: FormData<S>;
|
|
49
|
+
fields?: F;
|
|
50
|
+
}
|
|
51
|
+
export type TableFiltersSlots<S extends FormSchema> = {
|
|
52
|
+
[K in Extract<keyof FormData<S>, string>]: (props: {
|
|
53
|
+
model: FormData<S>[K];
|
|
54
|
+
state: FormData<S>;
|
|
55
|
+
updateModel: (value: FormData<S>[K]) => any;
|
|
56
|
+
}) => any;
|
|
57
|
+
};
|
|
58
|
+
export interface TableFiltersEmits<S extends FormSchema> {
|
|
59
|
+
submit: [TableFiltersModel<S>];
|
|
60
|
+
reset: [TableFiltersModel<S>];
|
|
61
|
+
}
|
|
62
|
+
declare const _default: typeof __VLS_export;
|
|
63
|
+
export default _default;
|
|
64
|
+
declare const __VLS_export: <S extends FormSchema, F extends FiltersField<S>[] = FiltersField<S>[]>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
65
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(TableFiltersProps<S, F> & {
|
|
66
|
+
modelValue?: TableFiltersModel<S>;
|
|
67
|
+
}) & {
|
|
68
|
+
onReset?: ((args_0: import("@nuxt/ui").InferOutput<S>) => any) | undefined;
|
|
69
|
+
onSubmit?: ((args_0: import("@nuxt/ui").InferOutput<S>) => any) | undefined;
|
|
70
|
+
"onUpdate:modelValue"?: ((value: import("@nuxt/ui").InferOutput<S> | undefined) => any) | undefined;
|
|
71
|
+
}> & (typeof globalThis extends {
|
|
72
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
73
|
+
} ? P : {});
|
|
74
|
+
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
75
|
+
appliedFields: import("vue").ComputedRef<FiltersField<S>[]>;
|
|
76
|
+
clearField: (field: FiltersField<S>) => void;
|
|
77
|
+
reset: () => void;
|
|
78
|
+
submit: (data: TableFiltersModel<S>) => void;
|
|
79
|
+
}>) => void;
|
|
80
|
+
attrs: any;
|
|
81
|
+
slots: TableFiltersSlots<S>;
|
|
82
|
+
emit: (((evt: "reset", args_0: import("@nuxt/ui").InferOutput<S>) => void) & ((evt: "submit", args_0: import("@nuxt/ui").InferOutput<S>) => void)) & ((evt: "update:modelValue", value: import("@nuxt/ui").InferOutput<S> | undefined) => void);
|
|
83
|
+
}>) => import("vue").VNode & {
|
|
84
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
85
|
+
};
|
|
86
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
87
|
+
[K in keyof T]: T[K];
|
|
88
|
+
} : {
|
|
89
|
+
[K in keyof T as K]: T[K];
|
|
90
|
+
}) & {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { AsyncDataRequestStatus } from '#app';
|
|
2
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
3
|
+
import type { DropdownMenuItem, FormSchema, PaginationEmits, PaginationProps, TableData, TableProps, TableRow, TableSlots } from '@nuxt/ui';
|
|
4
|
+
import type { ColumnPinningState, GroupingState, RowSelectionState } from '@tanstack/vue-table';
|
|
5
|
+
import type { ComponentConfig, OptionalKeys } from '../types';
|
|
6
|
+
import type { ModalConfirmProps } from './ModalConfirm.vue';
|
|
7
|
+
import type { TableColumnSortingModel } from './TableColumnSorting.vue';
|
|
8
|
+
import type { TableColumnVisibilityProps } from './TableColumnVisibility.vue';
|
|
9
|
+
import type { TableFiltersEmits, TableFiltersModel, TableFiltersProps, TableFiltersSlots } from './TableFilters.vue';
|
|
10
|
+
import theme from '#build/cms/table-panel';
|
|
11
|
+
type TablePanel = ComponentConfig<typeof theme, AppConfig, 'tablePanel'>;
|
|
12
|
+
export interface ActionMenuItem extends DropdownMenuItem {
|
|
13
|
+
confirm?: ModalConfirmProps;
|
|
14
|
+
delete?: OptionalKeys<ModalConfirmProps, 'message'>;
|
|
15
|
+
visibility?: () => boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface TablePanelProps<Data extends TableData, Schema extends FormSchema> {
|
|
18
|
+
title?: string;
|
|
19
|
+
status?: AsyncDataRequestStatus;
|
|
20
|
+
page?: PaginationProps['page'];
|
|
21
|
+
itemsPerPage?: PaginationProps['itemsPerPage'];
|
|
22
|
+
total?: PaginationProps['total'];
|
|
23
|
+
storageKey?: TableColumnVisibilityProps['storageKey'];
|
|
24
|
+
/** @default true */
|
|
25
|
+
columnVisibility?: boolean;
|
|
26
|
+
defaultHiddenColumns?: string[];
|
|
27
|
+
sorting?: TableColumnSortingModel;
|
|
28
|
+
columns?: TableProps<Data>['columns'];
|
|
29
|
+
data?: TableProps<Data>['data'];
|
|
30
|
+
/** @default true */
|
|
31
|
+
sticky?: TableProps<Data>['sticky'];
|
|
32
|
+
columnPinning?: ColumnPinningState;
|
|
33
|
+
getRowId?: TableProps<Data>['getRowId'];
|
|
34
|
+
rowSelection?: RowSelectionState;
|
|
35
|
+
rowSelectionOptions?: TableProps<Data>['rowSelectionOptions'];
|
|
36
|
+
/** @default true */
|
|
37
|
+
resetRowSelection?: boolean;
|
|
38
|
+
grouping?: GroupingState;
|
|
39
|
+
/** @default { getGroupedRowModel: getGroupedRowModel(), groupedColumnMode: false } */
|
|
40
|
+
groupingOptions?: TableProps<Data>['groupingOptions'];
|
|
41
|
+
hideSelectedFilters?: true;
|
|
42
|
+
filters?: TableFiltersModel<Schema>;
|
|
43
|
+
filtersSchema?: Schema;
|
|
44
|
+
filtersSource?: TableFiltersProps<Schema>['source'];
|
|
45
|
+
filtersFields?: TableFiltersProps<Schema>['fields'];
|
|
46
|
+
empty?: TableProps<Data>['empty'];
|
|
47
|
+
actions?: ((row: TableRow<Data>) => ActionMenuItem[] | undefined);
|
|
48
|
+
onSelect?: TableProps<Data>['onSelect'];
|
|
49
|
+
class?: any;
|
|
50
|
+
ui?: TablePanel['slots'];
|
|
51
|
+
}
|
|
52
|
+
export interface TablePanelEmits<Schema extends FormSchema> {
|
|
53
|
+
'update:page': PaginationEmits['update:page'];
|
|
54
|
+
'update:items-per-page': [value: number];
|
|
55
|
+
'update:sorting': [value: TableColumnSortingModel];
|
|
56
|
+
'update:row-selection': [value?: RowSelectionState];
|
|
57
|
+
'update:filters': [value: TableFiltersModel<Schema>];
|
|
58
|
+
'update:grouping': [value?: GroupingState];
|
|
59
|
+
'filtersReset': TableFiltersEmits<Schema>['reset'];
|
|
60
|
+
'filtersSubmit': TableFiltersEmits<Schema>['submit'];
|
|
61
|
+
}
|
|
62
|
+
export type TablePanelSlots<Data extends TableData, Schema extends FormSchema> = TableSlots<Data> & {
|
|
63
|
+
'toolbar-left'?: () => any;
|
|
64
|
+
'navbar-right'?: () => any;
|
|
65
|
+
'toolbar-right'?: () => any;
|
|
66
|
+
} & {
|
|
67
|
+
[P in keyof TableFiltersSlots<Schema> as `filter-${P}`]: TableFiltersSlots<Schema>[P];
|
|
68
|
+
};
|
|
69
|
+
declare const _default: typeof __VLS_export;
|
|
70
|
+
export default _default;
|
|
71
|
+
declare const __VLS_export: <Data extends TableData, Schema extends FormSchema>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
72
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<TablePanelProps<Data, Schema> & {
|
|
73
|
+
"onUpdate:page"?: ((value: number) => any) | undefined;
|
|
74
|
+
"onUpdate:items-per-page"?: ((value: number) => any) | undefined;
|
|
75
|
+
"onUpdate:sorting"?: ((value: import("@tanstack/table-core").SortingState) => any) | undefined;
|
|
76
|
+
"onUpdate:row-selection"?: ((value?: RowSelectionState | undefined) => any) | undefined;
|
|
77
|
+
"onUpdate:filters"?: ((value: import("@nuxt/ui").InferOutput<Schema>) => any) | undefined;
|
|
78
|
+
"onUpdate:grouping"?: ((value?: GroupingState | undefined) => any) | undefined;
|
|
79
|
+
onFiltersReset?: ((args_0: import("@nuxt/ui").InferOutput<Schema>) => any) | undefined;
|
|
80
|
+
onFiltersSubmit?: ((args_0: import("@nuxt/ui").InferOutput<Schema>) => any) | undefined;
|
|
81
|
+
}> & (typeof globalThis extends {
|
|
82
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
83
|
+
} ? P : {});
|
|
84
|
+
expose: (exposed: {}) => void;
|
|
85
|
+
attrs: any;
|
|
86
|
+
slots: TablePanelSlots<Data, Schema>;
|
|
87
|
+
emit: ((evt: "update:page", value: number) => void) & ((evt: "update:items-per-page", value: number) => void) & ((evt: "update:sorting", value: import("@tanstack/table-core").SortingState) => void) & ((evt: "update:row-selection", value?: RowSelectionState | undefined) => void) & ((evt: "update:filters", value: import("@nuxt/ui").InferOutput<Schema>) => void) & ((evt: "update:grouping", value?: GroupingState | undefined) => void) & ((evt: "filtersReset", args_0: import("@nuxt/ui").InferOutput<Schema>) => void) & ((evt: "filtersSubmit", args_0: import("@nuxt/ui").InferOutput<Schema>) => void);
|
|
88
|
+
}>) => import("vue").VNode & {
|
|
89
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
90
|
+
};
|
|
91
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
92
|
+
[K in keyof T]: T[K];
|
|
93
|
+
} : {
|
|
94
|
+
[K in keyof T as K]: T[K];
|
|
95
|
+
}) & {};
|