@antify/ui-module 1.3.0 → 1.5.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/module.mjs +2 -1
- package/dist/runtime/components/AntAccordionItem.vue +17 -14
- package/dist/runtime/components/AntDropdown.vue +6 -6
- package/dist/runtime/components/AntListGroupItem.vue +16 -10
- package/dist/runtime/components/AntModal.vue +10 -9
- package/dist/runtime/components/AntPopover.vue +10 -8
- package/dist/runtime/components/AntTooltip.vue +69 -63
- package/dist/runtime/components/__stories/AntTooltip.stories.d.ts +5 -0
- package/dist/runtime/components/__stories/AntTooltip.stories.mjs +33 -11
- package/dist/runtime/components/buttons/AntActionButton.vue +40 -13
- package/dist/runtime/components/buttons/AntButton.vue +126 -126
- package/dist/runtime/components/buttons/AntCreateButton.vue +21 -8
- package/dist/runtime/components/buttons/AntDeleteButton.vue +30 -8
- package/dist/runtime/components/buttons/AntDuplicateButton.vue +42 -0
- package/dist/runtime/components/buttons/AntSaveAndNewButton.vue +21 -8
- package/dist/runtime/components/buttons/AntSaveButton.vue +20 -8
- package/dist/runtime/components/buttons/__stories/AntActionButton.stories.d.ts +1 -0
- package/dist/runtime/components/buttons/__stories/AntActionButton.stories.mjs +25 -1
- package/dist/runtime/components/buttons/__stories/AntButton.stories.mjs +130 -130
- package/dist/runtime/components/buttons/__stories/AntCreateButton.stories.d.ts +1 -0
- package/dist/runtime/components/buttons/__stories/AntCreateButton.stories.mjs +11 -1
- package/dist/runtime/components/buttons/__stories/AntDeleteButton.stories.d.ts +2 -0
- package/dist/runtime/components/buttons/__stories/AntDeleteButton.stories.mjs +18 -1
- package/dist/runtime/components/buttons/__stories/AntDuplicateButton.stories.d.ts +11 -0
- package/dist/runtime/components/buttons/__stories/AntDuplicateButton.stories.mjs +67 -0
- package/dist/runtime/components/buttons/__stories/AntSaveAndNewButton.stories.d.ts +1 -0
- package/dist/runtime/components/buttons/__stories/AntSaveAndNewButton.stories.mjs +11 -1
- package/dist/runtime/components/buttons/__stories/AntSaveButton.stories.d.ts +1 -0
- package/dist/runtime/components/buttons/__stories/AntSaveButton.stories.mjs +11 -1
- package/dist/runtime/components/crud/AntCrud.vue +13 -10
- package/dist/runtime/components/crud/AntCrudDetail.vue +1 -1
- package/dist/runtime/components/crud/AntCrudDetailActions.vue +10 -3
- package/dist/runtime/components/crud/AntCrudDetailNav.vue +21 -15
- package/dist/runtime/components/crud/AntCrudTableFilter.vue +36 -34
- package/dist/runtime/components/crud/AntCrudTableNav.vue +15 -4
- package/dist/runtime/components/dialogs/AntDialog.vue +7 -7
- package/dist/runtime/components/form/AntCheckboxWidget/AntCheckbox.vue +1 -2
- package/dist/runtime/components/form/AntSelect.vue +57 -53
- package/dist/runtime/components/form/AntSwitch.vue +13 -10
- package/dist/runtime/components/form/AntSwitcher.vue +4 -4
- package/dist/runtime/components/form/AntTextarea.vue +6 -3
- package/dist/runtime/components/form/Elements/AntBaseInput.vue +45 -41
- package/dist/runtime/components/form/Elements/AntDropDown.vue +1 -1
- package/dist/runtime/components/layouts/AntNavLeftLayout.vue +4 -4
- package/dist/runtime/components/table/AntTable.vue +95 -73
- package/dist/runtime/components/table/AntTableSortButton.vue +16 -4
- package/dist/runtime/components/tabs/AntTabItem.vue +7 -4
- package/dist/runtime/tailwind.config.mjs +1 -1
- package/dist/runtime/utils.d.ts +6 -0
- package/dist/runtime/utils.mjs +21 -0
- package/package.json +1 -1
- package/src/runtime/components/AntAccordionItem.vue +17 -14
- package/src/runtime/components/AntDropdown.vue +6 -6
- package/src/runtime/components/AntListGroupItem.vue +16 -10
- package/src/runtime/components/AntModal.vue +10 -9
- package/src/runtime/components/AntPopover.vue +10 -8
- package/src/runtime/components/AntTooltip.vue +69 -63
- package/src/runtime/components/buttons/AntActionButton.vue +40 -13
- package/src/runtime/components/buttons/AntButton.vue +126 -126
- package/src/runtime/components/buttons/AntCreateButton.vue +21 -8
- package/src/runtime/components/buttons/AntDeleteButton.vue +30 -8
- package/src/runtime/components/buttons/AntDuplicateButton.vue +42 -0
- package/src/runtime/components/buttons/AntSaveAndNewButton.vue +21 -8
- package/src/runtime/components/buttons/AntSaveButton.vue +20 -8
- package/src/runtime/components/crud/AntCrud.vue +13 -10
- package/src/runtime/components/crud/AntCrudDetail.vue +1 -1
- package/src/runtime/components/crud/AntCrudDetailActions.vue +10 -3
- package/src/runtime/components/crud/AntCrudDetailNav.vue +21 -15
- package/src/runtime/components/crud/AntCrudTableFilter.vue +36 -34
- package/src/runtime/components/crud/AntCrudTableNav.vue +15 -4
- package/src/runtime/components/dialogs/AntDialog.vue +7 -7
- package/src/runtime/components/form/AntCheckboxWidget/AntCheckbox.vue +1 -2
- package/src/runtime/components/form/AntSelect.vue +57 -53
- package/src/runtime/components/form/AntSwitch.vue +13 -10
- package/src/runtime/components/form/AntSwitcher.vue +4 -4
- package/src/runtime/components/form/AntTextarea.vue +6 -3
- package/src/runtime/components/form/Elements/AntBaseInput.vue +45 -41
- package/src/runtime/components/form/Elements/AntDropDown.vue +1 -1
- package/src/runtime/components/layouts/AntNavLeftLayout.vue +4 -4
- package/src/runtime/components/table/AntTable.vue +95 -73
- package/src/runtime/components/table/AntTableSortButton.vue +16 -4
- package/src/runtime/components/tabs/AntTabItem.vue +7 -4
|
@@ -39,21 +39,22 @@ function closeModal() {
|
|
|
39
39
|
</script>
|
|
40
40
|
|
|
41
41
|
<template>
|
|
42
|
-
<
|
|
42
|
+
<Transition name="fade">
|
|
43
43
|
<div
|
|
44
44
|
v-if="openBackground"
|
|
45
45
|
class="absolute inset-0 flex items-center justify-center z-50 cursor-pointer overflow-hidden"
|
|
46
46
|
:class="{'bg-black/50 backdrop-blur-sm': !fullscreen}"
|
|
47
47
|
@click.self="closeModal"
|
|
48
48
|
>
|
|
49
|
-
<
|
|
49
|
+
<Transition :name="!fullscreen ? 'bounce' : 'bounce-slow'">
|
|
50
50
|
<div
|
|
51
51
|
v-if="openModal"
|
|
52
52
|
class="flex flex-col gap-px bg-neutral-300 overflow-hidden cursor-auto"
|
|
53
53
|
:class="{'w-full h-full': fullscreen, 'border border-neutral-300 rounded-md shadow-md': !fullscreen}"
|
|
54
54
|
>
|
|
55
55
|
<div
|
|
56
|
-
class="bg-
|
|
56
|
+
class="bg-white p-2.5 flex items-center justify-between text-for-white-bg-font text-lg font-medium"
|
|
57
|
+
>
|
|
57
58
|
<slot name="title">
|
|
58
59
|
{{ title }}
|
|
59
60
|
</slot>
|
|
@@ -66,20 +67,20 @@ function closeModal() {
|
|
|
66
67
|
/>
|
|
67
68
|
</div>
|
|
68
69
|
|
|
69
|
-
<div class="bg-
|
|
70
|
-
<slot/>
|
|
70
|
+
<div class="bg-white p-2.5 grow overflow-y-auto">
|
|
71
|
+
<slot />
|
|
71
72
|
</div>
|
|
72
73
|
|
|
73
74
|
<div
|
|
74
75
|
v-if="useSlots()['footer'] || false"
|
|
75
|
-
class="bg-
|
|
76
|
+
class="bg-white p-2.5 text-for-white-bg-font"
|
|
76
77
|
>
|
|
77
|
-
<slot name="footer"/>
|
|
78
|
+
<slot name="footer" />
|
|
78
79
|
</div>
|
|
79
80
|
</div>
|
|
80
|
-
</
|
|
81
|
+
</Transition>
|
|
81
82
|
</div>
|
|
82
|
-
</
|
|
83
|
+
</Transition>
|
|
83
84
|
</template>
|
|
84
85
|
|
|
85
86
|
<style scoped>
|
|
@@ -44,9 +44,9 @@ onMounted(() => {
|
|
|
44
44
|
|
|
45
45
|
<template>
|
|
46
46
|
<div class="relative inline-flex justify-center items-end">
|
|
47
|
-
<slot/>
|
|
47
|
+
<slot />
|
|
48
48
|
|
|
49
|
-
<
|
|
49
|
+
<Transition name="bounce">
|
|
50
50
|
<template v-if="showPopover">
|
|
51
51
|
<div :class="_popoverClasses">
|
|
52
52
|
<div class="shadow-lg border-neutral-300 rounded-md text-sm relative inline-flex flex-col relative">
|
|
@@ -66,12 +66,12 @@ onMounted(() => {
|
|
|
66
66
|
>
|
|
67
67
|
<path
|
|
68
68
|
d="M20.3284 1.82843L23.1569 4.65685C24.6571 6.15715 26.692 7 28.8137 7L6.18629 7C8.30802 7 10.3429 6.15715 11.8431 4.65686L14.6716 1.82843C16.2337 0.266331 18.7663 0.266328 20.3284 1.82843Z"
|
|
69
|
-
:class="{'fill-neutral-100': position === Position.bottom, 'fill-
|
|
69
|
+
:class="{'fill-neutral-100': position === Position.bottom, 'fill-white': position === Position.top || position === Position.right || position === Position.left}"
|
|
70
70
|
/>
|
|
71
71
|
|
|
72
72
|
<path
|
|
73
73
|
d="M34.5 7L28.8137 7C26.692 7 24.6571 6.15715 23.1569 4.65685L20.3284 1.82843C18.7663 0.266328 16.2337 0.266331 14.6716 1.82843L11.8431 4.65686C10.3429 6.15715 8.30802 7 6.18629 7L0.5 7L34.5 7Z"
|
|
74
|
-
:class="{'stroke-neutral-100': position === Position.bottom, 'stroke-
|
|
74
|
+
:class="{'stroke-neutral-100': position === Position.bottom, 'stroke-white': position === Position.top || position === Position.right || position === Position.left}"
|
|
75
75
|
/>
|
|
76
76
|
</svg>
|
|
77
77
|
|
|
@@ -92,18 +92,20 @@ onMounted(() => {
|
|
|
92
92
|
</div>
|
|
93
93
|
|
|
94
94
|
<div
|
|
95
|
-
class="border-neutral-300 border-b p-2.5 bg-neutral-100 rounded-t-md border-t border-l border-r text-neutral-100-font font-semibold"
|
|
95
|
+
class="border-neutral-300 border-b p-2.5 bg-neutral-100 rounded-t-md border-t border-l border-r text-neutral-100-font font-semibold"
|
|
96
|
+
>
|
|
96
97
|
{{ title }}
|
|
97
98
|
</div>
|
|
98
99
|
|
|
99
100
|
<div
|
|
100
|
-
class="p-2.5 rounded-b-md text-
|
|
101
|
-
|
|
101
|
+
class="p-2.5 rounded-b-md text-for-white-bg-font border-neutral-300 border-l border-b border-r bg-white"
|
|
102
|
+
>
|
|
103
|
+
<slot name="content" />
|
|
102
104
|
</div>
|
|
103
105
|
</div>
|
|
104
106
|
</div>
|
|
105
107
|
</template>
|
|
106
|
-
</
|
|
108
|
+
</Transition>
|
|
107
109
|
</div>
|
|
108
110
|
</template>
|
|
109
111
|
|
|
@@ -3,78 +3,80 @@ import {computed, onMounted, ref} from 'vue';
|
|
|
3
3
|
import {handleEnumValidation} from '../handler';
|
|
4
4
|
import {InputColorType, Position} from '../enums';
|
|
5
5
|
import {classesToObjectSyntax} from '../utils';
|
|
6
|
+
import {hasSlotContent} from '../utils';
|
|
6
7
|
|
|
7
8
|
const props = withDefaults(defineProps<{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
position?: Position
|
|
10
|
+
tooltipClasses?: string | Record<string, boolean>
|
|
11
|
+
colorType?: InputColorType
|
|
12
|
+
expanded?: boolean
|
|
12
13
|
}>(), {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
position: Position.left,
|
|
15
|
+
tooltipClasses: '',
|
|
16
|
+
colorType: InputColorType.base,
|
|
17
|
+
expanded: false
|
|
16
18
|
});
|
|
17
19
|
const visible = ref(false);
|
|
18
20
|
const _tooltipClasses = computed(() => ({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
'absolute w-max inline-flex': true,
|
|
22
|
+
// Position
|
|
23
|
+
'bottom-full pb-3.5': props.position === Position.top,
|
|
24
|
+
'top-full pt-3.5': props.position === Position.bottom,
|
|
25
|
+
'right-full pr-3.5': props.position === Position.left,
|
|
26
|
+
'left-full pl-3.5': props.position === Position.right,
|
|
27
|
+
...classesToObjectSyntax(props.tooltipClasses)
|
|
26
28
|
}));
|
|
27
29
|
const classes = computed(() => ({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
'z-10 absolute flex': true,
|
|
31
|
+
'top-0 left-0 right-0 -m-[2px] justify-center': props.position === Position.bottom,
|
|
32
|
+
'bottom-0 left-0 right-0 -m-[2px] justify-center': props.position === Position.top,
|
|
33
|
+
'top-0 left-0 bottom-0 -ml-[2.2px] items-center': props.position === Position.right,
|
|
34
|
+
'top-0 right-0 bottom-0 -mr-[2.2px] items-center': props.position === Position.left,
|
|
33
35
|
}));
|
|
34
36
|
const itemContainerClasses = computed(() => ({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
'relative flex items-center': true,
|
|
38
|
+
'justify-center': props.position === Position.bottom,
|
|
39
|
+
'justify-center rotate-180': props.position === Position.top,
|
|
40
|
+
'justify-center -rotate-90': props.position === Position.right,
|
|
41
|
+
'justify-center rotate-90': props.position === Position.left,
|
|
40
42
|
}));
|
|
41
43
|
const contentClasses = computed(() => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
const variants: Record<InputColorType, string> = {
|
|
45
|
+
[InputColorType.base]: 'text-for-white-bg-font bg-white border-neutral-300',
|
|
46
|
+
[InputColorType.danger]: 'text-danger-500-font bg-danger-500 border-danger-500',
|
|
47
|
+
[InputColorType.info]: 'text-info-500-font bg-info-500 border-info-500',
|
|
48
|
+
[InputColorType.success]: 'text-success-500-font bg-success-500 border-success-500',
|
|
49
|
+
[InputColorType.warning]: 'text-warning-500-font bg-warning-500 border-warning-500',
|
|
50
|
+
};
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
return {[variants[props.colorType]]: true};
|
|
51
53
|
});
|
|
52
54
|
const svgPathClasses = computed(() => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
const variants: Record<InputColorType, string> = {
|
|
56
|
+
[InputColorType.base]: 'fill-white stroke-white',
|
|
57
|
+
[InputColorType.danger]: 'fill-danger-500 stroke-danger-500',
|
|
58
|
+
[InputColorType.info]: 'fill-info-500 stroke-info-500',
|
|
59
|
+
[InputColorType.success]: 'fill-success-500 stroke-success-500',
|
|
60
|
+
[InputColorType.warning]: 'fill-warning-500 stroke-warning-500',
|
|
61
|
+
};
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
return {[variants[props.colorType]]: true};
|
|
62
64
|
});
|
|
63
65
|
const arrowSvgPathClasses = computed(() => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
const variants: Record<InputColorType, string> = {
|
|
67
|
+
[InputColorType.base]: 'stroke-neutral-300',
|
|
68
|
+
[InputColorType.danger]: 'stroke-danger-500',
|
|
69
|
+
[InputColorType.info]: 'stroke-info-500',
|
|
70
|
+
[InputColorType.success]: 'stroke-success-500',
|
|
71
|
+
[InputColorType.warning]: 'stroke-warning-500',
|
|
72
|
+
};
|
|
71
73
|
|
|
72
|
-
|
|
74
|
+
return {[variants[props.colorType]]: true};
|
|
73
75
|
});
|
|
74
76
|
|
|
75
77
|
onMounted(() => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
handleEnumValidation(props.position, Position, 'Position')
|
|
79
|
+
handleEnumValidation(props.colorType, InputColorType, 'colorType')
|
|
78
80
|
});
|
|
79
81
|
|
|
80
82
|
/**
|
|
@@ -84,33 +86,37 @@ onMounted(() => {
|
|
|
84
86
|
const delayVisible = ref(visible.value);
|
|
85
87
|
|
|
86
88
|
function onMouseOver() {
|
|
87
|
-
|
|
89
|
+
delayVisible.value = true;
|
|
88
90
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
setTimeout(() => {
|
|
92
|
+
if (delayVisible.value) {
|
|
93
|
+
visible.value = true
|
|
94
|
+
}
|
|
95
|
+
}, 300)
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
function onMouseLeave() {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
delayVisible.value = false
|
|
100
|
+
visible.value = false
|
|
99
101
|
}
|
|
100
102
|
</script>
|
|
101
103
|
|
|
102
104
|
<template>
|
|
103
105
|
<div
|
|
104
|
-
class="relative
|
|
106
|
+
class="relative justify-center items-center"
|
|
107
|
+
:class="{'flex w-full': props.expanded, 'inline-flex': !props.expanded}"
|
|
105
108
|
data-e2e="tooltip"
|
|
106
109
|
@mouseover="onMouseOver"
|
|
107
110
|
@mouseleave="onMouseLeave"
|
|
108
111
|
>
|
|
109
|
-
<slot/>
|
|
112
|
+
<slot />
|
|
110
113
|
|
|
111
|
-
<div
|
|
114
|
+
<div
|
|
115
|
+
v-if="visible && hasSlotContent($slots.content)"
|
|
116
|
+
:class="_tooltipClasses"
|
|
117
|
+
>
|
|
112
118
|
<div
|
|
113
|
-
class="shadow-lg text-sm relative
|
|
119
|
+
class="shadow-lg text-sm relative"
|
|
114
120
|
>
|
|
115
121
|
<div
|
|
116
122
|
:class="classes"
|
|
@@ -157,7 +163,7 @@ function onMouseLeave() {
|
|
|
157
163
|
class="p-2.5 rounded-md border"
|
|
158
164
|
:class="contentClasses"
|
|
159
165
|
>
|
|
160
|
-
<slot name="content"/>
|
|
166
|
+
<slot name="content" />
|
|
161
167
|
</div>
|
|
162
168
|
</div>
|
|
163
169
|
</div>
|
|
@@ -5,37 +5,64 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import {Grouped} from '../../enums/Grouped.enum';
|
|
7
7
|
import {Size} from '../../enums/Size.enum';
|
|
8
|
-
import {ColorType} from '../../enums/ColorType.enum';
|
|
8
|
+
import {ColorType, InputColorType} from '../../enums/ColorType.enum';
|
|
9
|
+
import {Position} from '../../enums/Position.enum';
|
|
9
10
|
import AntButton from './AntButton.vue';
|
|
11
|
+
import AntTooltip from '../AntTooltip.vue';
|
|
12
|
+
import type {IconDefinition} from '@fortawesome/free-solid-svg-icons';
|
|
10
13
|
|
|
11
14
|
defineEmits(['click', 'blur']);
|
|
12
15
|
withDefaults(
|
|
13
16
|
defineProps<{
|
|
17
|
+
iconLeft?: IconDefinition;
|
|
18
|
+
iconRight?: IconDefinition;
|
|
14
19
|
size?: Size;
|
|
15
20
|
disabled?: boolean;
|
|
16
21
|
grouped?: Grouped;
|
|
17
22
|
colorType?: ColorType;
|
|
18
23
|
skeleton?: boolean;
|
|
19
24
|
expanded?: boolean;
|
|
25
|
+
filled?: boolean;
|
|
26
|
+
hasPermission?: boolean;
|
|
27
|
+
invalidPermissionTooltipPosition?: Position;
|
|
20
28
|
}>(), {
|
|
21
29
|
colorType: ColorType.primary,
|
|
30
|
+
hasPermission: true,
|
|
31
|
+
filled: true
|
|
22
32
|
}
|
|
23
33
|
)
|
|
24
34
|
</script>
|
|
25
35
|
|
|
26
36
|
<template>
|
|
27
|
-
<
|
|
28
|
-
:size="size"
|
|
29
|
-
:disabled="disabled"
|
|
30
|
-
:grouped="grouped"
|
|
31
|
-
:skeleton="skeleton"
|
|
37
|
+
<AntTooltip
|
|
32
38
|
:expanded="expanded"
|
|
33
|
-
:
|
|
34
|
-
|
|
35
|
-
data-e2e="action-button"
|
|
36
|
-
@click="$emit('click')"
|
|
37
|
-
@blur="$emit('blur')"
|
|
39
|
+
:position="invalidPermissionTooltipPosition"
|
|
40
|
+
:color-type="InputColorType.info"
|
|
38
41
|
>
|
|
39
|
-
<slot
|
|
40
|
-
|
|
42
|
+
<slot name="button">
|
|
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>
|
|
60
|
+
|
|
61
|
+
<template
|
|
62
|
+
v-if="!hasPermission && !skeleton"
|
|
63
|
+
#content
|
|
64
|
+
>
|
|
65
|
+
<slot name="invalidPermissionTooltipContent" />
|
|
66
|
+
</template>
|
|
67
|
+
</AntTooltip>
|
|
41
68
|
</template>
|
|
@@ -15,152 +15,152 @@ import {IconSize} from '../__types/AntIcon.types';
|
|
|
15
15
|
defineEmits(['click', 'blur']);
|
|
16
16
|
|
|
17
17
|
const props = withDefaults(defineProps<{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
filled?: boolean;
|
|
19
|
+
size?: Size;
|
|
20
|
+
colorType?: ColorType;
|
|
21
|
+
iconLeft?: IconDefinition;
|
|
22
|
+
iconRight?: IconDefinition;
|
|
23
|
+
to?: RouteLocationRaw;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
grouped?: Grouped;
|
|
26
|
+
skeleton?: boolean;
|
|
27
|
+
spinner?: boolean;
|
|
28
|
+
readonly?: boolean;
|
|
29
|
+
expanded?: boolean;
|
|
30
|
+
submit?: boolean;
|
|
31
|
+
outlined?: boolean;
|
|
32
|
+
noFocus?: boolean;
|
|
33
33
|
}>(), {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
34
|
+
colorType: ColorType.base,
|
|
35
|
+
disabled: false,
|
|
36
|
+
filled: false,
|
|
37
|
+
skeleton: false,
|
|
38
|
+
spinner: false,
|
|
39
|
+
size: Size.md,
|
|
40
|
+
grouped: Grouped.none,
|
|
41
|
+
readonly: false,
|
|
42
|
+
expanded: false,
|
|
43
|
+
submit: false,
|
|
44
|
+
outlined: true,
|
|
45
|
+
noFocus: false,
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
const hasAction = computed(() => (props.skeleton || props.readonly || props.disabled))
|
|
49
49
|
const groupedClassList = computed(() => ({
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
'rounded-tl-md rounded-bl-md rounded-tr-none rounded-br-none -mr-px': props.grouped === Grouped.left,
|
|
51
|
+
'rounded-none -mx-px': props.grouped === Grouped.center,
|
|
52
|
+
'rounded-tl-none rounded-bl-none rounded-tr-md rounded-br-md -ml-px': props.grouped === Grouped.right,
|
|
53
|
+
'rounded-md': props.grouped === Grouped.none,
|
|
54
54
|
}));
|
|
55
55
|
const classes = computed(() => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
56
|
+
const variants = {
|
|
57
|
+
[ColorType.base]: 'ring-primary-200 outline-neutral-300',
|
|
58
|
+
[ColorType.danger]: 'ring-danger-200 outline-danger-500',
|
|
59
|
+
[ColorType.info]: 'ring-info-200 outline-info-500',
|
|
60
|
+
[ColorType.primary]: 'ring-primary-200 outline-primary-500',
|
|
61
|
+
[ColorType.secondary]: 'ring-secondary-200 outline-secondary-500',
|
|
62
|
+
[ColorType.success]: 'ring-success-200 outline-success-500',
|
|
63
|
+
[ColorType.warning]: 'ring-warning-200 outline-warning-500',
|
|
64
|
+
};
|
|
65
|
+
const notFilledVariants = {
|
|
66
|
+
[ColorType.base]: 'bg-white text-for-white-bg-font',
|
|
67
|
+
[ColorType.danger]: 'bg-white text-danger-500',
|
|
68
|
+
[ColorType.info]: 'bg-white text-info-500',
|
|
69
|
+
[ColorType.primary]: 'bg-white text-primary-500',
|
|
70
|
+
[ColorType.secondary]: 'bg-white text-secondary-500',
|
|
71
|
+
[ColorType.success]: 'bg-white text-success-500',
|
|
72
|
+
[ColorType.warning]: 'bg-white text-warning-500',
|
|
73
|
+
};
|
|
74
|
+
const notFilledHoverVariants = {
|
|
75
|
+
[ColorType.base]: 'hover:bg-neutral-100',
|
|
76
|
+
[ColorType.danger]: 'hover:bg-danger-100',
|
|
77
|
+
[ColorType.info]: 'hover:bg-info-100',
|
|
78
|
+
[ColorType.primary]: 'hover:bg-primary-100',
|
|
79
|
+
[ColorType.secondary]: 'hover:bg-secondary-100',
|
|
80
|
+
[ColorType.success]: 'hover:bg-success-100',
|
|
81
|
+
[ColorType.warning]: 'hover:bg-warning-100',
|
|
82
|
+
};
|
|
83
|
+
const filledVariants = {
|
|
84
|
+
[ColorType.base]: 'bg-neutral-50 text-neutral-50-font',
|
|
85
|
+
[ColorType.danger]: 'bg-danger-500 text-danger-500-font',
|
|
86
|
+
[ColorType.info]: 'bg-info-500 text-info-500-font',
|
|
87
|
+
[ColorType.primary]: 'bg-primary-500 text-primary-500-font',
|
|
88
|
+
[ColorType.secondary]: 'bg-secondary-500 text-secondary-500-font',
|
|
89
|
+
[ColorType.success]: 'bg-success-500 text-success-500-font',
|
|
90
|
+
[ColorType.warning]: 'bg-warning-500 text-warning-500-font',
|
|
91
|
+
};
|
|
92
|
+
const filledHoverVariants = {
|
|
93
|
+
[ColorType.base]: 'hover:bg-neutral-200',
|
|
94
|
+
[ColorType.danger]: 'hover:bg-danger-600',
|
|
95
|
+
[ColorType.info]: 'hover:bg-info-600',
|
|
96
|
+
[ColorType.primary]: 'hover:bg-primary-600',
|
|
97
|
+
[ColorType.secondary]: 'hover:bg-secondary-600',
|
|
98
|
+
[ColorType.success]: 'hover:bg-success-600',
|
|
99
|
+
[ColorType.warning]: 'hover:bg-warning-600',
|
|
100
|
+
};
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
102
|
+
return {
|
|
103
|
+
'transition-all inline-flex items-center justify-center relative font-medium': true,
|
|
104
|
+
'focus:z-10': true,
|
|
105
|
+
'active:shadow-[inset_0_4px_4px_rgba(0,0,0,0.25)]': !hasAction.value,
|
|
106
|
+
'py-1.5 px-2.5 text-xs gap-1': props.size === Size.sm,
|
|
107
|
+
'py-2.5 px-3.5 text-sm gap-2.5': props.size === Size.md,
|
|
108
|
+
'disabled:opacity-50 disabled:cursor-not-allowed': true,
|
|
109
|
+
'cursor-default': props.readonly,
|
|
110
|
+
'focus:ring-2': !props.readonly && props.size === Size.sm,
|
|
111
|
+
'focus:ring-4': !props.readonly && props.size === Size.md,
|
|
112
|
+
'w-full': props.expanded,
|
|
113
|
+
'invisible': props.skeleton,
|
|
114
|
+
'outline outline-1 outline-offset-[-1px]': props.outlined,
|
|
115
|
+
...groupedClassList.value,
|
|
116
|
+
[variants[props.colorType]]: true,
|
|
117
|
+
[notFilledVariants[props.colorType]]: !props.filled,
|
|
118
|
+
[notFilledHoverVariants[props.colorType]]: !props.filled && !hasAction.value,
|
|
119
|
+
[filledVariants[props.colorType]]: props.filled,
|
|
120
|
+
[filledHoverVariants[props.colorType]]: props.filled && !hasAction.value,
|
|
121
|
+
};
|
|
122
122
|
});
|
|
123
123
|
const iconColor = computed(() => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
124
|
+
const notFilledVariants = {
|
|
125
|
+
[ColorType.base]: 'text-for-white-bg-font',
|
|
126
|
+
[ColorType.danger]: 'text-danger-500',
|
|
127
|
+
[ColorType.info]: 'text-info-500',
|
|
128
|
+
[ColorType.primary]: 'text-primary-500',
|
|
129
|
+
[ColorType.secondary]: 'text-secondary-500',
|
|
130
|
+
[ColorType.success]: 'text-success-500',
|
|
131
|
+
[ColorType.warning]: 'text-warning-500',
|
|
132
|
+
};
|
|
133
|
+
const filledVariants = {
|
|
134
|
+
[ColorType.base]: 'text-for-white-bg-font',
|
|
135
|
+
[ColorType.danger]: 'text-danger-500-font',
|
|
136
|
+
[ColorType.info]: 'text-info-500-font',
|
|
137
|
+
[ColorType.primary]: 'text-primary-500-font',
|
|
138
|
+
[ColorType.secondary]: 'text-secondary-500-font',
|
|
139
|
+
[ColorType.success]: 'text-success-500-font',
|
|
140
|
+
[ColorType.warning]: 'text-warning-500-font',
|
|
141
|
+
};
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
return props.filled ? filledVariants[props.colorType] : notFilledVariants[props.colorType];
|
|
144
144
|
});
|
|
145
145
|
const type = computed(() => {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
if (props.to !== undefined) {
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
return props.submit ? ButtonType.submit : ButtonType.button;
|
|
151
151
|
});
|
|
152
152
|
const is = computed(() => {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
if (props.readonly) {
|
|
154
|
+
return 'div';
|
|
155
|
+
}
|
|
156
156
|
|
|
157
|
-
|
|
157
|
+
return props.to !== undefined ? 'router-link' : 'button'
|
|
158
158
|
})
|
|
159
159
|
|
|
160
160
|
onMounted(() => {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
handleEnumValidation(props.size, Size, 'size');
|
|
162
|
+
handleEnumValidation(props.colorType, ColorType, 'colorType');
|
|
163
|
+
handleEnumValidation(props.grouped, Grouped, 'grouped');
|
|
164
164
|
});
|
|
165
165
|
</script>
|
|
166
166
|
|