@antify/ui-module 1.5.0 → 1.6.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/dist/module.json +1 -1
- package/dist/runtime/components/AntAlert.vue +14 -5
- package/dist/runtime/components/AntContent.vue +16 -0
- package/dist/runtime/components/AntPagination.vue +8 -3
- package/dist/runtime/components/AntTooltip.vue +30 -18
- package/dist/runtime/components/__stories/AntAlert.stories.d.ts +1 -0
- package/dist/runtime/components/__stories/AntAlert.stories.mjs +15 -9
- package/dist/runtime/components/__stories/AntContent.stories.d.ts +6 -0
- package/dist/runtime/components/__stories/AntContent.stories.mjs +26 -0
- package/dist/runtime/components/__stories/AntTooltip.stories.d.ts +1 -1
- package/dist/runtime/components/__stories/AntTooltip.stories.mjs +164 -12
- package/dist/runtime/components/buttons/AntActionButton.vue +37 -34
- package/dist/runtime/components/buttons/AntButton.vue +62 -42
- package/dist/runtime/components/buttons/AntCreateButton.vue +18 -6
- package/dist/runtime/components/buttons/AntDeleteButton.vue +11 -10
- package/dist/runtime/components/buttons/AntDuplicateButton.vue +19 -7
- package/dist/runtime/components/buttons/AntEditButton.vue +54 -0
- package/dist/runtime/components/buttons/AntSaveAndNewButton.vue +21 -8
- package/dist/runtime/components/buttons/AntSaveButton.vue +21 -10
- package/dist/runtime/components/buttons/__stories/AntActionButton.stories.d.ts +1 -1
- package/dist/runtime/components/buttons/__stories/AntActionButton.stories.mjs +18 -17
- package/dist/runtime/components/buttons/__stories/AntButton.stories.d.ts +1 -0
- package/dist/runtime/components/buttons/__stories/AntButton.stories.mjs +38 -3
- package/dist/runtime/components/buttons/__stories/AntCreateButton.stories.d.ts +1 -0
- package/dist/runtime/components/buttons/__stories/AntCreateButton.stories.mjs +13 -4
- package/dist/runtime/components/buttons/__stories/AntDeleteButton.stories.d.ts +1 -1
- package/dist/runtime/components/buttons/__stories/AntDeleteButton.stories.mjs +13 -11
- package/dist/runtime/components/buttons/__stories/AntDuplicateButton.stories.d.ts +1 -0
- package/dist/runtime/components/buttons/__stories/AntDuplicateButton.stories.mjs +13 -4
- package/dist/runtime/components/buttons/__stories/AntEditButton.stories.d.ts +12 -0
- package/dist/runtime/components/buttons/__stories/AntEditButton.stories.mjs +76 -0
- package/dist/runtime/components/buttons/__stories/AntSaveAndNewButton.stories.d.ts +1 -0
- package/dist/runtime/components/buttons/__stories/AntSaveAndNewButton.stories.mjs +13 -4
- package/dist/runtime/components/buttons/__stories/AntSaveButton.stories.d.ts +1 -0
- package/dist/runtime/components/buttons/__stories/AntSaveButton.stories.mjs +13 -4
- package/dist/runtime/components/crud/AntCrudTableNav.vue +11 -2
- package/dist/runtime/components/crud/__stories/AntCrudTableNav.stories.mjs +1 -1
- package/dist/runtime/components/form/AntFormGroup.vue +22 -7
- package/dist/runtime/components/form/AntNumberInput.vue +6 -2
- package/dist/runtime/components/form/AntSelect.vue +3 -3
- package/dist/runtime/components/form/AntTagInput.vue +7 -7
- package/dist/runtime/components/form/Elements/AntField.vue +24 -21
- package/dist/runtime/components/form/Elements/AntInputDescription.vue +5 -5
- package/dist/runtime/components/form/__stories/AntNumberInput.stories.d.ts +1 -0
- package/dist/runtime/components/form/__stories/AntNumberInput.stories.mjs +7 -0
- package/dist/runtime/components/layouts/AntNavLeftLayout.vue +2 -2
- package/dist/runtime/components/layouts/__stories/AntNavLeftLayout.stories.mjs +1 -1
- package/package.json +11 -11
- package/src/runtime/components/AntAlert.vue +14 -5
- package/src/runtime/components/AntContent.vue +16 -0
- package/src/runtime/components/AntPagination.vue +8 -3
- package/src/runtime/components/AntTooltip.vue +30 -18
- package/src/runtime/components/buttons/AntActionButton.vue +37 -34
- package/src/runtime/components/buttons/AntButton.vue +62 -42
- package/src/runtime/components/buttons/AntCreateButton.vue +18 -6
- package/src/runtime/components/buttons/AntDeleteButton.vue +11 -10
- package/src/runtime/components/buttons/AntDuplicateButton.vue +19 -7
- package/src/runtime/components/buttons/AntEditButton.vue +54 -0
- package/src/runtime/components/buttons/AntSaveAndNewButton.vue +21 -8
- package/src/runtime/components/buttons/AntSaveButton.vue +21 -10
- package/src/runtime/components/crud/AntCrudTableNav.vue +11 -2
- package/src/runtime/components/form/AntFormGroup.vue +22 -7
- package/src/runtime/components/form/AntNumberInput.vue +6 -2
- package/src/runtime/components/form/AntSelect.vue +3 -3
- package/src/runtime/components/form/AntTagInput.vue +7 -7
- package/src/runtime/components/form/Elements/AntField.vue +24 -21
- package/src/runtime/components/form/Elements/AntInputDescription.vue +5 -5
- package/src/runtime/components/layouts/AntNavLeftLayout.vue +2 -2
|
@@ -13,7 +13,7 @@ const hasLogoImageSlot = computed(() => useSlots()['logo-image'] || false);
|
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
15
|
<template>
|
|
16
|
-
<div class="flex gap-px bg-neutral-300 h-screen overflow-hidden">
|
|
16
|
+
<div class="flex gap-px bg-neutral-300 h-screen min-w-full overflow-y-hidden">
|
|
17
17
|
<div class="flex flex-col gap-px bg-neutral-300 w-52 shrink-0">
|
|
18
18
|
<component
|
|
19
19
|
:is="logoRoute ? 'RouterLink' : 'div'"
|
|
@@ -29,7 +29,7 @@ const hasLogoImageSlot = computed(() => useSlots()['logo-image'] || false);
|
|
|
29
29
|
/>
|
|
30
30
|
</div>
|
|
31
31
|
|
|
32
|
-
<div class="flex-grow">
|
|
32
|
+
<div class="w-px flex-grow">
|
|
33
33
|
<slot />
|
|
34
34
|
</div>
|
|
35
35
|
</div>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antify/ui-module",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.6.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
"@faker-js/faker": "^8.3.1",
|
|
44
44
|
"@nuxt/eslint-config": "latest",
|
|
45
45
|
"@nuxt/module-builder": "latest",
|
|
46
|
-
"@storybook/addon-docs": "^8.0.0
|
|
47
|
-
"@storybook/addon-essentials": "^8.0.0
|
|
48
|
-
"@storybook/addon-interactions": "^8.0.0
|
|
49
|
-
"@storybook/addon-links": "^8.0.0
|
|
50
|
-
"@storybook/addon-mdx-gfm": "^8.0.0
|
|
51
|
-
"@storybook/blocks": "^8.0.0
|
|
52
|
-
"@storybook/test": "^8.0.0
|
|
53
|
-
"@storybook/vue3": "^8.0.0
|
|
54
|
-
"@storybook/vue3-vite": "^8.0.0
|
|
46
|
+
"@storybook/addon-docs": "^8.0.0",
|
|
47
|
+
"@storybook/addon-essentials": "^8.0.0",
|
|
48
|
+
"@storybook/addon-interactions": "^8.0.0",
|
|
49
|
+
"@storybook/addon-links": "^8.0.0",
|
|
50
|
+
"@storybook/addon-mdx-gfm": "^8.0.0",
|
|
51
|
+
"@storybook/blocks": "^8.0.0",
|
|
52
|
+
"@storybook/test": "^8.0.0",
|
|
53
|
+
"@storybook/vue3": "^8.0.0",
|
|
54
|
+
"@storybook/vue3-vite": "^8.0.0",
|
|
55
55
|
"@vitejs/plugin-vue": "^5.0.4",
|
|
56
56
|
"autoprefixer": "^10.4.16",
|
|
57
57
|
"chromatic": "^11.0.0",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"nuxt": "^3.9.3",
|
|
61
61
|
"ofetch": "^1.3.3",
|
|
62
62
|
"standard-version": "latest",
|
|
63
|
-
"storybook": "^8.0.0
|
|
63
|
+
"storybook": "^8.0.0",
|
|
64
64
|
"typescript": "^5.3.3",
|
|
65
65
|
"unbuild": "^2.0.0",
|
|
66
66
|
"vite": "^5.1.4",
|
|
@@ -18,17 +18,19 @@ import {IconSize} from './__types';
|
|
|
18
18
|
defineEmits(['close']);
|
|
19
19
|
|
|
20
20
|
const props = withDefaults(defineProps<{
|
|
21
|
-
title
|
|
21
|
+
title?: string | null,
|
|
22
22
|
colorType?: InputColorType,
|
|
23
23
|
icon?: boolean,
|
|
24
24
|
expanded?: boolean,
|
|
25
|
-
questionMarkText?: string,
|
|
25
|
+
questionMarkText?: string | null,
|
|
26
26
|
skeleton?: boolean,
|
|
27
27
|
dismissBtn?: boolean,
|
|
28
28
|
}>(), {
|
|
29
|
+
title: null,
|
|
29
30
|
colorType: InputColorType.base,
|
|
30
31
|
icon: true,
|
|
31
32
|
expanded: false,
|
|
33
|
+
questionMarkText: null,
|
|
32
34
|
skeleton: false,
|
|
33
35
|
dismissBtn: true,
|
|
34
36
|
});
|
|
@@ -81,9 +83,14 @@ onMounted(() => {
|
|
|
81
83
|
:class="classes"
|
|
82
84
|
data-e2e="alert"
|
|
83
85
|
>
|
|
84
|
-
<AntSkeleton
|
|
86
|
+
<AntSkeleton
|
|
87
|
+
v-if="skeleton"
|
|
88
|
+
absolute
|
|
89
|
+
rounded
|
|
90
|
+
/>
|
|
85
91
|
|
|
86
92
|
<div
|
|
93
|
+
v-if="icon || hasQuestionMark || dismissBtn || title"
|
|
87
94
|
class="inline-flex items-center justify-between w-content gap-2.5"
|
|
88
95
|
:class="{'invisible': skeleton}"
|
|
89
96
|
>
|
|
@@ -95,7 +102,9 @@ onMounted(() => {
|
|
|
95
102
|
:size="IconSize.sm"
|
|
96
103
|
/>
|
|
97
104
|
|
|
98
|
-
<div
|
|
105
|
+
<div
|
|
106
|
+
:class="{'font-semibold': hasDefaultSlot}"
|
|
107
|
+
>
|
|
99
108
|
<slot name="title">
|
|
100
109
|
{{ title }}
|
|
101
110
|
</slot>
|
|
@@ -131,7 +140,7 @@ onMounted(() => {
|
|
|
131
140
|
</div>
|
|
132
141
|
|
|
133
142
|
<div v-if="hasDefaultSlot">
|
|
134
|
-
<slot/>
|
|
143
|
+
<slot />
|
|
135
144
|
</div>
|
|
136
145
|
</div>
|
|
137
146
|
</template>
|
|
@@ -162,7 +162,11 @@ const pagination = computed(() => {
|
|
|
162
162
|
class="inline-flex relative"
|
|
163
163
|
data-e2e="pagination"
|
|
164
164
|
>
|
|
165
|
-
<AntSkeleton
|
|
165
|
+
<AntSkeleton
|
|
166
|
+
v-if="skeleton"
|
|
167
|
+
rounded
|
|
168
|
+
absolute
|
|
169
|
+
/>
|
|
166
170
|
|
|
167
171
|
<div
|
|
168
172
|
class="inline-flex gap-px"
|
|
@@ -177,14 +181,15 @@ const pagination = computed(() => {
|
|
|
177
181
|
/>
|
|
178
182
|
|
|
179
183
|
<AntButton
|
|
180
|
-
v-for="(pageObj
|
|
184
|
+
v-for="(pageObj) in pagination"
|
|
185
|
+
:key="`pagination-button-${pageObj}`"
|
|
181
186
|
:color-type="pageObj === page ? ColorType.primary : ColorType.base"
|
|
182
187
|
:class="{'text-primary-500 z-10': pageObj === page}"
|
|
183
188
|
:disabled="pageObj === '...'"
|
|
184
189
|
:grouped="Grouped.center"
|
|
185
190
|
:filled="pageObj !== page"
|
|
191
|
+
:readonly="pageObj === page"
|
|
186
192
|
@click="() => page = pageObj"
|
|
187
|
-
v-bind:key="`pagination-button-${index}`"
|
|
188
193
|
>
|
|
189
194
|
{{ pageObj }}
|
|
190
195
|
</AntButton>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import {computed, onMounted, ref} from 'vue';
|
|
2
|
+
import {computed, onMounted, ref, getCurrentInstance} from 'vue';
|
|
3
3
|
import {handleEnumValidation} from '../handler';
|
|
4
4
|
import {InputColorType, Position} from '../enums';
|
|
5
5
|
import {classesToObjectSyntax} from '../utils';
|
|
@@ -10,11 +10,13 @@ const props = withDefaults(defineProps<{
|
|
|
10
10
|
tooltipClasses?: string | Record<string, boolean>
|
|
11
11
|
colorType?: InputColorType
|
|
12
12
|
expanded?: boolean
|
|
13
|
+
delay?: number
|
|
13
14
|
}>(), {
|
|
14
15
|
position: Position.left,
|
|
15
16
|
tooltipClasses: '',
|
|
16
17
|
colorType: InputColorType.base,
|
|
17
|
-
expanded: false
|
|
18
|
+
expanded: false,
|
|
19
|
+
delay: 800
|
|
18
20
|
});
|
|
19
21
|
const visible = ref(false);
|
|
20
22
|
const _tooltipClasses = computed(() => ({
|
|
@@ -73,43 +75,53 @@ const arrowSvgPathClasses = computed(() => {
|
|
|
73
75
|
|
|
74
76
|
return {[variants[props.colorType]]: true};
|
|
75
77
|
});
|
|
78
|
+
const timeout = ref<number | undefined>();
|
|
79
|
+
const clickLock = ref(false);
|
|
80
|
+
const uuid = ref(getCurrentInstance()?.uid)
|
|
76
81
|
|
|
77
82
|
onMounted(() => {
|
|
78
83
|
handleEnumValidation(props.position, Position, 'Position')
|
|
79
84
|
handleEnumValidation(props.colorType, InputColorType, 'colorType')
|
|
80
85
|
});
|
|
81
86
|
|
|
82
|
-
/**
|
|
83
|
-
* To prevent a fliggering ux, add a delay on hover and leaving the hover target,
|
|
84
|
-
* before showing the tooltip content.
|
|
85
|
-
*/
|
|
86
|
-
const delayVisible = ref(visible.value);
|
|
87
|
-
|
|
88
87
|
function onMouseOver() {
|
|
89
|
-
|
|
88
|
+
if (visible.value || clickLock.value) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
90
91
|
|
|
91
|
-
setTimeout(() =>
|
|
92
|
-
if (delayVisible.value) {
|
|
93
|
-
visible.value = true
|
|
94
|
-
}
|
|
95
|
-
}, 300)
|
|
92
|
+
timeout.value = setTimeout(() => visible.value = true, props.delay) as unknown as number
|
|
96
93
|
}
|
|
97
94
|
|
|
98
95
|
function onMouseLeave() {
|
|
99
|
-
|
|
96
|
+
clearTimeout(timeout.value)
|
|
97
|
+
|
|
100
98
|
visible.value = false
|
|
99
|
+
clickLock.value = false
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function onClick() {
|
|
103
|
+
clearTimeout(timeout.value)
|
|
104
|
+
|
|
105
|
+
visible.value = false
|
|
106
|
+
clickLock.value = true
|
|
101
107
|
}
|
|
102
108
|
</script>
|
|
103
109
|
|
|
104
110
|
<template>
|
|
105
111
|
<div
|
|
112
|
+
:key="uuid"
|
|
106
113
|
class="relative justify-center items-center"
|
|
107
114
|
:class="{'flex w-full': props.expanded, 'inline-flex': !props.expanded}"
|
|
108
115
|
data-e2e="tooltip"
|
|
109
|
-
@mouseover="onMouseOver"
|
|
110
|
-
@mouseleave="onMouseLeave"
|
|
116
|
+
@mouseover="() => onMouseOver()"
|
|
117
|
+
@mouseleave="() => onMouseLeave()"
|
|
111
118
|
>
|
|
112
|
-
<
|
|
119
|
+
<div
|
|
120
|
+
class="w-full"
|
|
121
|
+
@click="() => onClick()"
|
|
122
|
+
>
|
|
123
|
+
<slot />
|
|
124
|
+
</div>
|
|
113
125
|
|
|
114
126
|
<div
|
|
115
127
|
v-if="visible && hasSlotContent($slots.content)"
|
|
@@ -3,16 +3,14 @@
|
|
|
3
3
|
* This button is used for everything what is the primary
|
|
4
4
|
* action like save, confirm, create, etc.
|
|
5
5
|
*/
|
|
6
|
-
import {Grouped} from '../../enums
|
|
7
|
-
import {Size} from '../../enums/Size.enum';
|
|
8
|
-
import {ColorType, InputColorType} from '../../enums/ColorType.enum';
|
|
9
|
-
import {Position} from '../../enums/Position.enum';
|
|
6
|
+
import {Position, ColorType, InputColorType, Size, Grouped} from '../../enums';
|
|
10
7
|
import AntButton from './AntButton.vue';
|
|
11
|
-
import AntTooltip from '../AntTooltip.vue';
|
|
12
8
|
import type {IconDefinition} from '@fortawesome/free-solid-svg-icons';
|
|
9
|
+
import {computed, useSlots} from 'vue';
|
|
10
|
+
import {hasSlotContent} from '../../utils';
|
|
13
11
|
|
|
14
12
|
defineEmits(['click', 'blur']);
|
|
15
|
-
withDefaults(
|
|
13
|
+
const props = withDefaults(
|
|
16
14
|
defineProps<{
|
|
17
15
|
iconLeft?: IconDefinition;
|
|
18
16
|
iconRight?: IconDefinition;
|
|
@@ -24,45 +22,50 @@ withDefaults(
|
|
|
24
22
|
expanded?: boolean;
|
|
25
23
|
filled?: boolean;
|
|
26
24
|
hasPermission?: boolean;
|
|
27
|
-
|
|
25
|
+
tooltipPosition?: Position;
|
|
26
|
+
tooltipColorType?: InputColorType;
|
|
27
|
+
tooltipDelay?: number;
|
|
28
28
|
}>(), {
|
|
29
29
|
colorType: ColorType.primary,
|
|
30
30
|
hasPermission: true,
|
|
31
31
|
filled: true
|
|
32
32
|
}
|
|
33
33
|
)
|
|
34
|
+
const slots = useSlots();
|
|
35
|
+
const hasTooltip = computed(() => !props.skeleton && !props.disabled && props.hasPermission && hasSlotContent(slots['tooltipContent']));
|
|
36
|
+
const hasPermissionTooltip = computed(() => !props.skeleton && !props.disabled && !props.hasPermission && hasSlotContent(slots['invalidPermissionTooltipContent']));
|
|
34
37
|
</script>
|
|
35
38
|
|
|
36
39
|
<template>
|
|
37
|
-
<
|
|
40
|
+
<AntButton
|
|
41
|
+
:icon-left="iconLeft"
|
|
42
|
+
:icon-right="iconRight"
|
|
43
|
+
:size="size"
|
|
44
|
+
:disabled="disabled || !hasPermission"
|
|
45
|
+
:grouped="grouped"
|
|
46
|
+
:skeleton="skeleton"
|
|
38
47
|
:expanded="expanded"
|
|
39
|
-
:
|
|
40
|
-
:
|
|
48
|
+
:color-type="colorType"
|
|
49
|
+
:filled="filled"
|
|
50
|
+
:tooltip-position="tooltipPosition"
|
|
51
|
+
:tooltip-color-type="hasPermissionTooltip ? InputColorType.info : tooltipColorType"
|
|
52
|
+
:tooltip-delay="hasPermissionTooltip ? 300 : tooltipDelay"
|
|
53
|
+
data-e2e="action-button"
|
|
54
|
+
@click="$emit('click')"
|
|
55
|
+
@blur="$emit('blur')"
|
|
41
56
|
>
|
|
42
|
-
<slot
|
|
43
|
-
<AntButton
|
|
44
|
-
:icon-left="iconLeft"
|
|
45
|
-
:icon-right="iconRight"
|
|
46
|
-
:size="size"
|
|
47
|
-
:disabled="disabled || !hasPermission"
|
|
48
|
-
:grouped="grouped"
|
|
49
|
-
:skeleton="skeleton"
|
|
50
|
-
:expanded="expanded"
|
|
51
|
-
:color-type="colorType"
|
|
52
|
-
:filled="filled"
|
|
53
|
-
data-e2e="action-button"
|
|
54
|
-
@click="$emit('click')"
|
|
55
|
-
@blur="$emit('blur')"
|
|
56
|
-
>
|
|
57
|
-
<slot />
|
|
58
|
-
</AntButton>
|
|
59
|
-
</slot>
|
|
57
|
+
<slot />
|
|
60
58
|
|
|
61
|
-
<template
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
<template #tooltip-content>
|
|
60
|
+
<slot
|
|
61
|
+
v-if="hasTooltip"
|
|
62
|
+
name="tooltipContent"
|
|
63
|
+
/>
|
|
64
|
+
|
|
65
|
+
<slot
|
|
66
|
+
v-if="hasPermissionTooltip"
|
|
67
|
+
name="invalidPermissionTooltipContent"
|
|
68
|
+
/>
|
|
66
69
|
</template>
|
|
67
|
-
</
|
|
70
|
+
</AntButton>
|
|
68
71
|
</template>
|
|
@@ -7,9 +7,10 @@ import AntSpinner from '../AntSpinner.vue';
|
|
|
7
7
|
import {Grouped} from '../../enums/Grouped.enum';
|
|
8
8
|
import {Size} from '../../enums/Size.enum';
|
|
9
9
|
import {handleEnumValidation} from '../../handler';
|
|
10
|
-
import {ColorType} from '../../enums';
|
|
10
|
+
import {ColorType, InputColorType, Position} from '../../enums';
|
|
11
11
|
import {ButtonType} from './__types';
|
|
12
12
|
import AntIcon from '../AntIcon.vue';
|
|
13
|
+
import AntTooltip from '../AntTooltip.vue';
|
|
13
14
|
import {IconSize} from '../__types/AntIcon.types';
|
|
14
15
|
|
|
15
16
|
defineEmits(['click', 'blur']);
|
|
@@ -30,6 +31,9 @@ const props = withDefaults(defineProps<{
|
|
|
30
31
|
submit?: boolean;
|
|
31
32
|
outlined?: boolean;
|
|
32
33
|
noFocus?: boolean;
|
|
34
|
+
tooltipPosition?: Position;
|
|
35
|
+
tooltipColorType?: InputColorType;
|
|
36
|
+
tooltipDelay?: number;
|
|
33
37
|
}>(), {
|
|
34
38
|
colorType: ColorType.base,
|
|
35
39
|
disabled: false,
|
|
@@ -43,6 +47,9 @@ const props = withDefaults(defineProps<{
|
|
|
43
47
|
submit: false,
|
|
44
48
|
outlined: true,
|
|
45
49
|
noFocus: false,
|
|
50
|
+
tooltipPosition: Position.bottom,
|
|
51
|
+
tooltipColorType: InputColorType.base,
|
|
52
|
+
tooltipDelay: 800
|
|
46
53
|
});
|
|
47
54
|
|
|
48
55
|
const hasAction = computed(() => (props.skeleton || props.readonly || props.disabled))
|
|
@@ -178,50 +185,63 @@ onMounted(() => {
|
|
|
178
185
|
absolute
|
|
179
186
|
/>
|
|
180
187
|
|
|
181
|
-
<
|
|
182
|
-
:
|
|
183
|
-
:
|
|
184
|
-
:type="
|
|
185
|
-
:
|
|
186
|
-
:disabled="disabled || undefined"
|
|
187
|
-
:tabindex="noFocus || hasAction ? '-1' : '0'"
|
|
188
|
-
@click="() => !props.readonly ? $emit('click') : null"
|
|
189
|
-
@blur="() => !props.readonly ? $emit('blur') : null"
|
|
188
|
+
<AntTooltip
|
|
189
|
+
:expanded="expanded"
|
|
190
|
+
:position="tooltipPosition"
|
|
191
|
+
:color-type="tooltipColorType"
|
|
192
|
+
:delay="tooltipDelay"
|
|
190
193
|
>
|
|
191
|
-
<
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
<template #default>
|
|
195
|
+
<component
|
|
196
|
+
:is="is"
|
|
197
|
+
:class="classes"
|
|
198
|
+
:type="type"
|
|
199
|
+
:to="to"
|
|
200
|
+
:disabled="disabled || undefined"
|
|
201
|
+
:tabindex="noFocus || hasAction ? '-1' : '0'"
|
|
202
|
+
@click="() => !props.readonly ? $emit('click') : null"
|
|
203
|
+
@blur="() => !props.readonly ? $emit('blur') : null"
|
|
204
|
+
>
|
|
205
|
+
<AntSpinner
|
|
206
|
+
v-if="spinner"
|
|
207
|
+
:size="size"
|
|
208
|
+
:color-type="colorType"
|
|
209
|
+
:inverted="!filled"
|
|
210
|
+
/>
|
|
197
211
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
212
|
+
<slot
|
|
213
|
+
v-if="!spinner"
|
|
214
|
+
name="icon-left"
|
|
215
|
+
>
|
|
216
|
+
<AntIcon
|
|
217
|
+
v-if="iconLeft"
|
|
218
|
+
:icon="iconLeft"
|
|
219
|
+
:size="size as unknown as IconSize"
|
|
220
|
+
:color="iconColor"
|
|
221
|
+
/>
|
|
222
|
+
</slot>
|
|
209
223
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
224
|
+
<slot
|
|
225
|
+
v-if="!spinner"
|
|
226
|
+
/>
|
|
213
227
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
228
|
+
<slot
|
|
229
|
+
v-if="!spinner"
|
|
230
|
+
name="icon-right"
|
|
231
|
+
>
|
|
232
|
+
<AntIcon
|
|
233
|
+
v-if="iconRight"
|
|
234
|
+
:icon="iconRight"
|
|
235
|
+
:size="size as unknown as IconSize"
|
|
236
|
+
:color="iconColor"
|
|
237
|
+
/>
|
|
238
|
+
</slot>
|
|
239
|
+
</component>
|
|
240
|
+
</template>
|
|
241
|
+
|
|
242
|
+
<template #content>
|
|
243
|
+
<slot name="tooltip-content" />
|
|
244
|
+
</template>
|
|
245
|
+
</AntTooltip>
|
|
226
246
|
</div>
|
|
227
247
|
</template>
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import {Grouped} from '../../enums/Grouped.enum';
|
|
3
|
-
import {Size} from '../../enums/Size.enum';
|
|
4
2
|
import AntActionButton from './AntActionButton.vue';
|
|
5
|
-
import {Position} from '../../enums';
|
|
3
|
+
import {Position, Size, Grouped, ColorType} from '../../enums';
|
|
4
|
+
import {faPlus} from '@fortawesome/free-solid-svg-icons';
|
|
6
5
|
|
|
7
6
|
defineEmits(['click', 'blur']);
|
|
8
7
|
withDefaults(defineProps<{
|
|
8
|
+
iconVariant?: boolean;
|
|
9
9
|
size?: Size;
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
grouped?: Grouped;
|
|
12
12
|
skeleton?: boolean;
|
|
13
13
|
expanded?: boolean;
|
|
14
14
|
canCreate?: boolean;
|
|
15
|
-
|
|
15
|
+
tooltipPosition?: Position;
|
|
16
16
|
}>(), {
|
|
17
|
+
iconVariant: false,
|
|
17
18
|
canCreate: true
|
|
18
19
|
});
|
|
19
20
|
</script>
|
|
@@ -21,22 +22,33 @@ withDefaults(defineProps<{
|
|
|
21
22
|
<template>
|
|
22
23
|
<AntActionButton
|
|
23
24
|
:filled="false"
|
|
25
|
+
:color-type="ColorType.primary"
|
|
24
26
|
:size="size"
|
|
25
27
|
:disabled="disabled"
|
|
28
|
+
:icon-left="iconVariant ? faPlus : undefined"
|
|
26
29
|
:grouped="grouped"
|
|
27
30
|
:skeleton="skeleton"
|
|
28
31
|
:expanded="expanded"
|
|
29
32
|
:has-permission="canCreate"
|
|
30
|
-
:
|
|
33
|
+
:tooltip-position="tooltipPosition"
|
|
31
34
|
data-e2e="create-button"
|
|
32
35
|
@click="$emit('click')"
|
|
33
36
|
@blur="$emit('blur')"
|
|
34
37
|
>
|
|
35
|
-
<template
|
|
38
|
+
<template
|
|
39
|
+
v-if="!iconVariant"
|
|
40
|
+
#default
|
|
41
|
+
>
|
|
42
|
+
Create
|
|
43
|
+
</template>
|
|
36
44
|
|
|
37
45
|
<template #invalidPermissionTooltipContent>
|
|
38
46
|
You have no permission to create new entries.<br>
|
|
39
47
|
Please contact your administrator.
|
|
40
48
|
</template>
|
|
49
|
+
|
|
50
|
+
<template #tooltipContent>
|
|
51
|
+
Create new entry
|
|
52
|
+
</template>
|
|
41
53
|
</AntActionButton>
|
|
42
54
|
</template>
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import {Grouped} from '../../enums/Grouped.enum';
|
|
3
|
-
import {Size} from '../../enums/Size.enum';
|
|
4
|
-
import {ColorType} from '../../enums/ColorType.enum';
|
|
5
2
|
import AntActionButton from './AntActionButton.vue';
|
|
6
|
-
import {Position} from '../../enums';
|
|
3
|
+
import {Position, Size, Grouped, ColorType} from '../../enums';
|
|
7
4
|
import {faTrash} from '@fortawesome/free-solid-svg-icons';
|
|
8
5
|
|
|
9
6
|
defineEmits(['click', 'blur']);
|
|
@@ -15,25 +12,25 @@ withDefaults(defineProps<{
|
|
|
15
12
|
skeleton?: boolean;
|
|
16
13
|
expanded?: boolean;
|
|
17
14
|
canDelete?: boolean;
|
|
18
|
-
|
|
15
|
+
tooltipPosition?: Position;
|
|
19
16
|
}>(), {
|
|
20
17
|
iconVariant: false,
|
|
21
18
|
canDelete: true
|
|
22
|
-
})
|
|
19
|
+
});
|
|
23
20
|
</script>
|
|
24
21
|
|
|
25
22
|
<template>
|
|
26
23
|
<AntActionButton
|
|
27
|
-
:icon-left="iconVariant ? faTrash : undefined"
|
|
28
24
|
:filled="false"
|
|
25
|
+
:color-type="ColorType.danger"
|
|
29
26
|
:size="size"
|
|
30
27
|
:disabled="disabled"
|
|
28
|
+
:icon-left="iconVariant ? faTrash : undefined"
|
|
31
29
|
:grouped="grouped"
|
|
32
30
|
:skeleton="skeleton"
|
|
33
31
|
:expanded="expanded"
|
|
34
|
-
:color-type="ColorType.danger"
|
|
35
32
|
:has-permission="canDelete"
|
|
36
|
-
:
|
|
33
|
+
:tooltip-position="tooltipPosition"
|
|
37
34
|
data-e2e="delete-button"
|
|
38
35
|
@click="$emit('click')"
|
|
39
36
|
@blur="$emit('blur')"
|
|
@@ -46,8 +43,12 @@ withDefaults(defineProps<{
|
|
|
46
43
|
</template>
|
|
47
44
|
|
|
48
45
|
<template #invalidPermissionTooltipContent>
|
|
49
|
-
You have no permission to delete
|
|
46
|
+
You have no permission to delete entries.<br>
|
|
50
47
|
Please contact your administrator.
|
|
51
48
|
</template>
|
|
49
|
+
|
|
50
|
+
<template #tooltipContent>
|
|
51
|
+
Delete entry
|
|
52
|
+
</template>
|
|
52
53
|
</AntActionButton>
|
|
53
54
|
</template>
|