@antify/template-module 0.0.2

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.
Files changed (64) hide show
  1. package/README.md +163 -0
  2. package/dist/module.d.mts +10 -0
  3. package/dist/module.d.ts +10 -0
  4. package/dist/module.json +9 -0
  5. package/dist/module.mjs +101 -0
  6. package/dist/runtime/assets/antify.css +1 -0
  7. package/dist/runtime/components/Main.mdx +6 -0
  8. package/dist/runtime/components/buttons/ActionButton.d.vue.ts +52 -0
  9. package/dist/runtime/components/buttons/ActionButton.vue +74 -0
  10. package/dist/runtime/components/buttons/ActionButton.vue.d.ts +52 -0
  11. package/dist/runtime/components/buttons/CreateButton.d.vue.ts +25 -0
  12. package/dist/runtime/components/buttons/CreateButton.vue +67 -0
  13. package/dist/runtime/components/buttons/CreateButton.vue.d.ts +25 -0
  14. package/dist/runtime/components/buttons/DeleteButton.d.vue.ts +25 -0
  15. package/dist/runtime/components/buttons/DeleteButton.vue +67 -0
  16. package/dist/runtime/components/buttons/DeleteButton.vue.d.ts +25 -0
  17. package/dist/runtime/components/buttons/DuplicateButton.d.vue.ts +25 -0
  18. package/dist/runtime/components/buttons/DuplicateButton.vue +67 -0
  19. package/dist/runtime/components/buttons/DuplicateButton.vue.d.ts +25 -0
  20. package/dist/runtime/components/buttons/EditButton.d.vue.ts +25 -0
  21. package/dist/runtime/components/buttons/EditButton.vue +67 -0
  22. package/dist/runtime/components/buttons/EditButton.vue.d.ts +25 -0
  23. package/dist/runtime/components/buttons/SaveAndNewButton.d.vue.ts +25 -0
  24. package/dist/runtime/components/buttons/SaveAndNewButton.vue +70 -0
  25. package/dist/runtime/components/buttons/SaveAndNewButton.vue.d.ts +25 -0
  26. package/dist/runtime/components/buttons/SaveButton.d.vue.ts +25 -0
  27. package/dist/runtime/components/buttons/SaveButton.vue +68 -0
  28. package/dist/runtime/components/buttons/SaveButton.vue.d.ts +25 -0
  29. package/dist/runtime/components/crud/Crud.d.vue.ts +24 -0
  30. package/dist/runtime/components/crud/Crud.vue +43 -0
  31. package/dist/runtime/components/crud/Crud.vue.d.ts +24 -0
  32. package/dist/runtime/components/crud/CrudDetail.d.vue.ts +17 -0
  33. package/dist/runtime/components/crud/CrudDetail.vue +14 -0
  34. package/dist/runtime/components/crud/CrudDetail.vue.d.ts +17 -0
  35. package/dist/runtime/components/crud/CrudDetailActions.d.vue.ts +40 -0
  36. package/dist/runtime/components/crud/CrudDetailActions.vue +72 -0
  37. package/dist/runtime/components/crud/CrudDetailActions.vue.d.ts +40 -0
  38. package/dist/runtime/components/crud/CrudDetailNav.d.vue.ts +40 -0
  39. package/dist/runtime/components/crud/CrudDetailNav.vue +65 -0
  40. package/dist/runtime/components/crud/CrudDetailNav.vue.d.ts +40 -0
  41. package/dist/runtime/components/crud/CrudTableFilter.d.vue.ts +48 -0
  42. package/dist/runtime/components/crud/CrudTableFilter.vue +153 -0
  43. package/dist/runtime/components/crud/CrudTableFilter.vue.d.ts +48 -0
  44. package/dist/runtime/components/crud/CrudTableNav.d.vue.ts +23 -0
  45. package/dist/runtime/components/crud/CrudTableNav.vue +121 -0
  46. package/dist/runtime/components/crud/CrudTableNav.vue.d.ts +23 -0
  47. package/dist/runtime/components/dialogs/DeleteDialog.d.vue.ts +15 -0
  48. package/dist/runtime/components/dialogs/DeleteDialog.vue +64 -0
  49. package/dist/runtime/components/dialogs/DeleteDialog.vue.d.ts +15 -0
  50. package/dist/runtime/components/index.d.ts +15 -0
  51. package/dist/runtime/components/index.js +30 -0
  52. package/dist/runtime/composables/useUiClient.d.ts +90 -0
  53. package/dist/runtime/composables/useUiClient.js +151 -0
  54. package/dist/runtime/index.css +1 -0
  55. package/dist/runtime/index.d.ts +2 -0
  56. package/dist/runtime/index.js +2 -0
  57. package/dist/runtime/plugins/template-module.d.ts +48 -0
  58. package/dist/runtime/plugins/template-module.js +14 -0
  59. package/dist/runtime/types.d.ts +1 -0
  60. package/dist/runtime/types.js +0 -0
  61. package/dist/runtime/utils.d.ts +15 -0
  62. package/dist/runtime/utils.js +22 -0
  63. package/dist/types.d.mts +9 -0
  64. package/package.json +60 -0
@@ -0,0 +1,17 @@
1
+ declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {};
2
+ type __VLS_Slots = {} & {
3
+ header?: (props: typeof __VLS_1) => any;
4
+ } & {
5
+ default?: (props: typeof __VLS_3) => any;
6
+ } & {
7
+ footer?: (props: typeof __VLS_5) => any;
8
+ };
9
+ declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
10
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
11
+ declare const _default: typeof __VLS_export;
12
+ export default _default;
13
+ type __VLS_WithSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -0,0 +1,14 @@
1
+ <template>
2
+ <div
3
+ class="flex flex-col bg-base-300 gap-px h-full"
4
+ data-e2e="crud-detail"
5
+ >
6
+ <slot name="header" />
7
+
8
+ <div class="grow h-px overflow-y-auto bg-base-100">
9
+ <slot />
10
+ </div>
11
+
12
+ <slot name="footer" />
13
+ </div>
14
+ </template>
@@ -0,0 +1,17 @@
1
+ declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {};
2
+ type __VLS_Slots = {} & {
3
+ header?: (props: typeof __VLS_1) => any;
4
+ } & {
5
+ default?: (props: typeof __VLS_3) => any;
6
+ } & {
7
+ footer?: (props: typeof __VLS_5) => any;
8
+ };
9
+ declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
10
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
11
+ declare const _default: typeof __VLS_export;
12
+ export default _default;
13
+ type __VLS_WithSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -0,0 +1,40 @@
1
+ import { InputState } from '@antify/ui';
2
+ type __VLS_Props = {
3
+ disabled?: boolean;
4
+ skeleton?: boolean;
5
+ canSave?: boolean;
6
+ tooltipState?: InputState;
7
+ saveTooltipMessage?: string;
8
+ saveAndNewTooltipMessage?: string;
9
+ };
10
+ declare var __VLS_1: {}, __VLS_11: {}, __VLS_13: {}, __VLS_29: {};
11
+ type __VLS_Slots = {} & {
12
+ 'buttons-left'?: (props: typeof __VLS_1) => any;
13
+ } & {
14
+ 'before-buttons-right'?: (props: typeof __VLS_11) => any;
15
+ } & {
16
+ 'buttons-right'?: (props: typeof __VLS_13) => any;
17
+ } & {
18
+ 'after-buttons-right'?: (props: typeof __VLS_29) => any;
19
+ };
20
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
21
+ save: (...args: any[]) => void;
22
+ back: (...args: any[]) => void;
23
+ "save-and-new": (...args: any[]) => void;
24
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
25
+ onSave?: ((...args: any[]) => any) | undefined;
26
+ onBack?: ((...args: any[]) => any) | undefined;
27
+ "onSave-and-new"?: ((...args: any[]) => any) | undefined;
28
+ }>, {
29
+ skeleton: boolean;
30
+ disabled: boolean;
31
+ canSave: boolean;
32
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
34
+ declare const _default: typeof __VLS_export;
35
+ export default _default;
36
+ type __VLS_WithSlots<T, S> = T & {
37
+ new (): {
38
+ $slots: S;
39
+ };
40
+ };
@@ -0,0 +1,72 @@
1
+ <script setup>
2
+ import {
3
+ AntButton
4
+ } from "@antify/ui";
5
+ import {
6
+ faAngleLeft
7
+ } from "@fortawesome/free-solid-svg-icons";
8
+ import SaveAndNewButton from "../buttons/SaveAndNewButton.vue";
9
+ import SaveButton from "../buttons/SaveButton.vue";
10
+ import {
11
+ InputState
12
+ } from "@antify/ui";
13
+ defineEmits([
14
+ "back",
15
+ "save",
16
+ "save-and-new"
17
+ ]);
18
+ defineProps({
19
+ disabled: { type: Boolean, required: false, default: false },
20
+ skeleton: { type: Boolean, required: false, default: false },
21
+ canSave: { type: Boolean, required: false, default: true },
22
+ tooltipState: { type: String, required: false },
23
+ saveTooltipMessage: { type: String, required: false },
24
+ saveAndNewTooltipMessage: { type: String, required: false }
25
+ });
26
+ </script>
27
+
28
+ <template>
29
+ <div
30
+ class="flex justify-between p-2 gap-2 bg-white"
31
+ data-e2e="crud-detail-actions"
32
+ >
33
+ <div class="flex gap-2.5">
34
+ <slot name="buttons-left">
35
+ <AntButton
36
+ :outlined="false"
37
+ :filled="false"
38
+ :icon-left="faAngleLeft"
39
+ :disabled="disabled"
40
+ :skeleton="skeleton"
41
+ @click="$emit('back')"
42
+ >
43
+ Zurück
44
+ </AntButton>
45
+ </slot>
46
+ </div>
47
+
48
+ <div class="flex gap-2.5">
49
+ <slot name="before-buttons-right" />
50
+ <slot name="buttons-right">
51
+ <SaveAndNewButton
52
+ :skeleton="skeleton"
53
+ :disabled="disabled"
54
+ :can-save="canSave"
55
+ :save-tooltip-message="saveTooltipMessage"
56
+ :tooltip-state="tooltipState"
57
+ @click="$emit('save-and-new')"
58
+ />
59
+
60
+ <SaveButton
61
+ :skeleton="skeleton"
62
+ :disabled="disabled"
63
+ :can-save="canSave"
64
+ :save-tooltip-message="saveAndNewTooltipMessage"
65
+ :tooltip-state="tooltipState"
66
+ @click="$emit('save')"
67
+ />
68
+ </slot>
69
+ <slot name="after-buttons-right" />
70
+ </div>
71
+ </div>
72
+ </template>
@@ -0,0 +1,40 @@
1
+ import { InputState } from '@antify/ui';
2
+ type __VLS_Props = {
3
+ disabled?: boolean;
4
+ skeleton?: boolean;
5
+ canSave?: boolean;
6
+ tooltipState?: InputState;
7
+ saveTooltipMessage?: string;
8
+ saveAndNewTooltipMessage?: string;
9
+ };
10
+ declare var __VLS_1: {}, __VLS_11: {}, __VLS_13: {}, __VLS_29: {};
11
+ type __VLS_Slots = {} & {
12
+ 'buttons-left'?: (props: typeof __VLS_1) => any;
13
+ } & {
14
+ 'before-buttons-right'?: (props: typeof __VLS_11) => any;
15
+ } & {
16
+ 'buttons-right'?: (props: typeof __VLS_13) => any;
17
+ } & {
18
+ 'after-buttons-right'?: (props: typeof __VLS_29) => any;
19
+ };
20
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
21
+ save: (...args: any[]) => void;
22
+ back: (...args: any[]) => void;
23
+ "save-and-new": (...args: any[]) => void;
24
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
25
+ onSave?: ((...args: any[]) => any) | undefined;
26
+ onBack?: ((...args: any[]) => any) | undefined;
27
+ "onSave-and-new"?: ((...args: any[]) => any) | undefined;
28
+ }>, {
29
+ skeleton: boolean;
30
+ disabled: boolean;
31
+ canSave: boolean;
32
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
34
+ declare const _default: typeof __VLS_export;
35
+ export default _default;
36
+ type __VLS_WithSlots<T, S> = T & {
37
+ new (): {
38
+ $slots: S;
39
+ };
40
+ };
@@ -0,0 +1,40 @@
1
+ import { type TabItem, InputState } from '@antify/ui';
2
+ type __VLS_Props = {
3
+ tabItems?: TabItem[];
4
+ deleteButtonDisabled?: boolean;
5
+ getEntityName: () => string;
6
+ canDelete?: boolean;
7
+ showDeleteButton?: boolean;
8
+ skeleton?: boolean;
9
+ deleteTooltipMessage?: string;
10
+ tooltipState?: InputState;
11
+ };
12
+ declare var __VLS_1: {}, __VLS_8: {}, __VLS_10: {}, __VLS_19: {};
13
+ type __VLS_Slots = {} & {
14
+ tabs?: (props: typeof __VLS_1) => any;
15
+ } & {
16
+ buttons?: (props: typeof __VLS_8) => any;
17
+ } & {
18
+ 'before-delete-button'?: (props: typeof __VLS_10) => any;
19
+ } & {
20
+ 'after-delete-button'?: (props: typeof __VLS_19) => any;
21
+ };
22
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
23
+ delete: (...args: any[]) => void;
24
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
25
+ onDelete?: ((...args: any[]) => any) | undefined;
26
+ }>, {
27
+ skeleton: boolean;
28
+ tabItems: TabItem[];
29
+ canDelete: boolean;
30
+ deleteButtonDisabled: boolean;
31
+ showDeleteButton: boolean;
32
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
34
+ declare const _default: typeof __VLS_export;
35
+ export default _default;
36
+ type __VLS_WithSlots<T, S> = T & {
37
+ new (): {
38
+ $slots: S;
39
+ };
40
+ };
@@ -0,0 +1,65 @@
1
+ <script setup>
2
+ import {
3
+ ref
4
+ } from "vue";
5
+ import {
6
+ AntTabs,
7
+ Position,
8
+ InputState
9
+ } from "@antify/ui";
10
+ import DeleteDialog from "../dialogs/DeleteDialog.vue";
11
+ import DeleteButton from "../buttons/DeleteButton.vue";
12
+ defineEmits([
13
+ "delete"
14
+ ]);
15
+ defineProps({
16
+ tabItems: { type: Array, required: false, default: () => [] },
17
+ deleteButtonDisabled: { type: Boolean, required: false, default: false },
18
+ getEntityName: { type: Function, required: true },
19
+ canDelete: { type: Boolean, required: false, default: true },
20
+ showDeleteButton: { type: Boolean, required: false, default: true },
21
+ skeleton: { type: Boolean, required: false, default: false },
22
+ deleteTooltipMessage: { type: String, required: false },
23
+ tooltipState: { type: String, required: false }
24
+ });
25
+ const dialogOpen = ref(false);
26
+ </script>
27
+
28
+ <template>
29
+ <div
30
+ class="flex justify-between items-stretch gap-2 bg-white h-[52px]"
31
+ data-e2e="crud-detail-nav"
32
+ >
33
+ <slot name="tabs">
34
+ <AntTabs
35
+ :tab-items="tabItems"
36
+ :skeleton="skeleton"
37
+ />
38
+ </slot>
39
+
40
+ <div class="flex gap-2 pr-2 py-2">
41
+ <slot name="buttons">
42
+ <slot name="before-delete-button" />
43
+
44
+ <DeleteButton
45
+ v-if="showDeleteButton"
46
+ :disabled="deleteButtonDisabled || !canDelete"
47
+ :skeleton="skeleton"
48
+ :can-delete="canDelete"
49
+ :delete-tooltip-message="deleteTooltipMessage"
50
+ :invalid-permission-tooltip-position="Position.left"
51
+ :tooltip-state="tooltipState"
52
+ @click="() => dialogOpen = true"
53
+ />
54
+
55
+ <slot name="after-delete-button" />
56
+ </slot>
57
+ </div>
58
+
59
+ <DeleteDialog
60
+ v-model:open="dialogOpen"
61
+ :entity="getEntityName()"
62
+ @confirm="$emit('delete')"
63
+ />
64
+ </div>
65
+ </template>
@@ -0,0 +1,40 @@
1
+ import { type TabItem, InputState } from '@antify/ui';
2
+ type __VLS_Props = {
3
+ tabItems?: TabItem[];
4
+ deleteButtonDisabled?: boolean;
5
+ getEntityName: () => string;
6
+ canDelete?: boolean;
7
+ showDeleteButton?: boolean;
8
+ skeleton?: boolean;
9
+ deleteTooltipMessage?: string;
10
+ tooltipState?: InputState;
11
+ };
12
+ declare var __VLS_1: {}, __VLS_8: {}, __VLS_10: {}, __VLS_19: {};
13
+ type __VLS_Slots = {} & {
14
+ tabs?: (props: typeof __VLS_1) => any;
15
+ } & {
16
+ buttons?: (props: typeof __VLS_8) => any;
17
+ } & {
18
+ 'before-delete-button'?: (props: typeof __VLS_10) => any;
19
+ } & {
20
+ 'after-delete-button'?: (props: typeof __VLS_19) => any;
21
+ };
22
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
23
+ delete: (...args: any[]) => void;
24
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
25
+ onDelete?: ((...args: any[]) => any) | undefined;
26
+ }>, {
27
+ skeleton: boolean;
28
+ tabItems: TabItem[];
29
+ canDelete: boolean;
30
+ deleteButtonDisabled: boolean;
31
+ showDeleteButton: boolean;
32
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
34
+ declare const _default: typeof __VLS_export;
35
+ export default _default;
36
+ type __VLS_WithSlots<T, S> = T & {
37
+ new (): {
38
+ $slots: S;
39
+ };
40
+ };
@@ -0,0 +1,48 @@
1
+ import { InputState } from '@antify/ui';
2
+ type __VLS_Props = {
3
+ fullWidth?: boolean;
4
+ showFilter?: boolean;
5
+ showSearch?: boolean;
6
+ searchQuery?: string;
7
+ searchAutoFocus?: boolean;
8
+ hasFilter?: boolean;
9
+ canCreate?: boolean;
10
+ skeleton?: boolean;
11
+ searchPlaceholderText?: string;
12
+ createTooltipMessage?: string;
13
+ tooltipState?: InputState;
14
+ };
15
+ declare var __VLS_1: {}, __VLS_29: {}, __VLS_31: {};
16
+ type __VLS_Slots = {} & {
17
+ filter?: (props: typeof __VLS_1) => any;
18
+ } & {
19
+ dropdownContent?: (props: typeof __VLS_29) => any;
20
+ } & {
21
+ buttons?: (props: typeof __VLS_31) => any;
22
+ };
23
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
24
+ search: (...args: any[]) => void;
25
+ create: (...args: any[]) => void;
26
+ removeFilter: (...args: any[]) => void;
27
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
28
+ onSearch?: ((...args: any[]) => any) | undefined;
29
+ onCreate?: ((...args: any[]) => any) | undefined;
30
+ onRemoveFilter?: ((...args: any[]) => any) | undefined;
31
+ }>, {
32
+ skeleton: boolean;
33
+ canCreate: boolean;
34
+ fullWidth: boolean;
35
+ showFilter: boolean;
36
+ showSearch: boolean;
37
+ searchQuery: string;
38
+ searchAutoFocus: boolean;
39
+ hasFilter: boolean;
40
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
41
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
42
+ declare const _default: typeof __VLS_export;
43
+ export default _default;
44
+ type __VLS_WithSlots<T, S> = T & {
45
+ new (): {
46
+ $slots: S;
47
+ };
48
+ };
@@ -0,0 +1,153 @@
1
+ <script setup>
2
+ import CreateButton from "../buttons/CreateButton.vue";
3
+ import {
4
+ computed,
5
+ ref,
6
+ watch
7
+ } from "vue";
8
+ import {
9
+ faFilter,
10
+ faMultiply
11
+ } from "@fortawesome/free-solid-svg-icons";
12
+ import {
13
+ useRoute,
14
+ useRouter
15
+ } from "vue-router";
16
+ import {
17
+ AntDropdown,
18
+ AntButton,
19
+ AntSearch,
20
+ State,
21
+ Grouped,
22
+ Position,
23
+ InputState
24
+ } from "@antify/ui";
25
+ const props = defineProps({
26
+ fullWidth: { type: Boolean, required: false, default: true },
27
+ showFilter: { type: Boolean, required: false, default: true },
28
+ showSearch: { type: Boolean, required: false, default: true },
29
+ searchQuery: { type: String, required: false, default: "search" },
30
+ searchAutoFocus: { type: Boolean, required: false, default: true },
31
+ hasFilter: { type: Boolean, required: false, default: false },
32
+ canCreate: { type: Boolean, required: false, default: true },
33
+ skeleton: { type: Boolean, required: false, default: false },
34
+ searchPlaceholderText: { type: String, required: false },
35
+ createTooltipMessage: { type: String, required: false },
36
+ tooltipState: { type: String, required: false }
37
+ });
38
+ const emit = defineEmits([
39
+ "search",
40
+ "create",
41
+ "removeFilter"
42
+ ]);
43
+ const router = useRouter();
44
+ const route = useRoute();
45
+ const showDropdown = ref(false);
46
+ const _fullWidth = ref(props.fullWidth);
47
+ const search = computed({
48
+ get: () => decodeURIComponent(route.query[props.searchQuery] || ""),
49
+ set: (value) => {
50
+ const query = {
51
+ ...route.query,
52
+ [props.searchQuery]: encodeURIComponent(value)
53
+ };
54
+ if (!value) {
55
+ delete query[props.searchQuery];
56
+ }
57
+ (async () => {
58
+ await router.replace({
59
+ ...route,
60
+ query
61
+ });
62
+ emit("search", value);
63
+ })();
64
+ }
65
+ });
66
+ const searchInputRef = ref(null);
67
+ watch(() => props.fullWidth, (val) => {
68
+ setTimeout(() => {
69
+ _fullWidth.value = val;
70
+ }, val ? 250 : 300);
71
+ });
72
+ watch(searchInputRef, (val) => {
73
+ if (!val || !props.searchAutoFocus) {
74
+ return;
75
+ }
76
+ val.focus();
77
+ });
78
+ </script>
79
+
80
+ <template>
81
+ <div
82
+ class="flex h-full items-center p-2 gap-2 bg-white"
83
+ data-e2e="crud-table-filter"
84
+ >
85
+ <div
86
+ class="flex gap-2.5 grow"
87
+ :class="{ 'grow': !_fullWidth }"
88
+ >
89
+ <div :class="{ 'w-80': _fullWidth, 'w-full': !_fullWidth }">
90
+ <slot name="filter">
91
+ <AntSearch
92
+ v-if="showSearch"
93
+ v-model="search"
94
+ v-model:input-ref="searchInputRef"
95
+ :skeleton="skeleton"
96
+ :placeholder="searchPlaceholderText || 'Suche'"
97
+ />
98
+ </slot>
99
+ </div>
100
+
101
+ <AntDropdown
102
+ v-if="showFilter"
103
+ v-model:show-dropdown="showDropdown"
104
+ :position="Position.left"
105
+ :close-on-click-outside="!showDropdown"
106
+ >
107
+ <div class="flex">
108
+ <AntButton
109
+ :state="hasFilter ? State.info : State.base"
110
+ :grouped="hasFilter ? Grouped.left : Grouped.none"
111
+ :skeleton="skeleton"
112
+ :icon-left="faFilter"
113
+ @click="() => showDropdown = !showDropdown"
114
+ />
115
+
116
+ <AntButton
117
+ v-if="hasFilter"
118
+ :state="State.info"
119
+ :grouped="Grouped.right"
120
+ :skeleton="skeleton"
121
+ :icon-left="faMultiply"
122
+ filled
123
+ @click="$emit('removeFilter')"
124
+ />
125
+ </div>
126
+
127
+ <template #content>
128
+ <slot name="dropdownContent" />
129
+ </template>
130
+ </AntDropdown>
131
+
132
+ <!-- Temporary solution: Use backlayer instead of on click outside to solve the problem with popover over other popover -->
133
+ <div
134
+ v-if="showDropdown"
135
+ class="inset-0 absolute w-full h-full z-20"
136
+ @click="showDropdown = false"
137
+ />
138
+ </div>
139
+
140
+ <div>
141
+ <slot name="buttons">
142
+ <CreateButton
143
+ :skeleton="skeleton"
144
+ :can-create="canCreate"
145
+ :invalid-permission-tooltip-position="Position.left"
146
+ :create-tooltip-message="createTooltipMessage"
147
+ :tooltip-state="tooltipState"
148
+ @click="() => emit('create')"
149
+ />
150
+ </slot>
151
+ </div>
152
+ </div>
153
+ </template>
@@ -0,0 +1,48 @@
1
+ import { InputState } from '@antify/ui';
2
+ type __VLS_Props = {
3
+ fullWidth?: boolean;
4
+ showFilter?: boolean;
5
+ showSearch?: boolean;
6
+ searchQuery?: string;
7
+ searchAutoFocus?: boolean;
8
+ hasFilter?: boolean;
9
+ canCreate?: boolean;
10
+ skeleton?: boolean;
11
+ searchPlaceholderText?: string;
12
+ createTooltipMessage?: string;
13
+ tooltipState?: InputState;
14
+ };
15
+ declare var __VLS_1: {}, __VLS_29: {}, __VLS_31: {};
16
+ type __VLS_Slots = {} & {
17
+ filter?: (props: typeof __VLS_1) => any;
18
+ } & {
19
+ dropdownContent?: (props: typeof __VLS_29) => any;
20
+ } & {
21
+ buttons?: (props: typeof __VLS_31) => any;
22
+ };
23
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
24
+ search: (...args: any[]) => void;
25
+ create: (...args: any[]) => void;
26
+ removeFilter: (...args: any[]) => void;
27
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
28
+ onSearch?: ((...args: any[]) => any) | undefined;
29
+ onCreate?: ((...args: any[]) => any) | undefined;
30
+ onRemoveFilter?: ((...args: any[]) => any) | undefined;
31
+ }>, {
32
+ skeleton: boolean;
33
+ canCreate: boolean;
34
+ fullWidth: boolean;
35
+ showFilter: boolean;
36
+ showSearch: boolean;
37
+ searchQuery: string;
38
+ searchAutoFocus: boolean;
39
+ hasFilter: boolean;
40
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
41
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
42
+ declare const _default: typeof __VLS_export;
43
+ export default _default;
44
+ type __VLS_WithSlots<T, S> = T & {
45
+ new (): {
46
+ $slots: S;
47
+ };
48
+ };
@@ -0,0 +1,23 @@
1
+ type __VLS_Props = {
2
+ count: number | null;
3
+ pageQuery?: string;
4
+ itemsPerPageQuery?: string;
5
+ fullWidth?: boolean;
6
+ validItemsPerPage?: number[];
7
+ skeleton?: boolean;
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ changeItemsPerPage: (...args: any[]) => void;
11
+ changePage: (...args: any[]) => void;
12
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
13
+ onChangeItemsPerPage?: ((...args: any[]) => any) | undefined;
14
+ onChangePage?: ((...args: any[]) => any) | undefined;
15
+ }>, {
16
+ skeleton: boolean;
17
+ fullWidth: boolean;
18
+ pageQuery: string;
19
+ itemsPerPageQuery: string;
20
+ validItemsPerPage: number[];
21
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
+ declare const _default: typeof __VLS_export;
23
+ export default _default;