@antify/ui-module 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +32 -20
- 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 +40 -32
- package/dist/runtime/components/buttons/AntButton.vue +188 -168
- package/dist/runtime/components/buttons/AntCreateButton.vue +19 -6
- package/dist/runtime/components/buttons/AntDeleteButton.vue +21 -10
- package/dist/runtime/components/buttons/AntDuplicateButton.vue +54 -0
- 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 +22 -19
- package/dist/runtime/components/buttons/__stories/AntButton.stories.d.ts +1 -0
- package/dist/runtime/components/buttons/__stories/AntButton.stories.mjs +166 -131
- package/dist/runtime/components/buttons/__stories/AntCreateButton.stories.d.ts +1 -0
- package/dist/runtime/components/buttons/__stories/AntCreateButton.stories.mjs +16 -6
- package/dist/runtime/components/buttons/__stories/AntDeleteButton.stories.d.ts +1 -0
- package/dist/runtime/components/buttons/__stories/AntDeleteButton.stories.mjs +16 -6
- package/dist/runtime/components/buttons/__stories/AntDuplicateButton.stories.d.ts +12 -0
- package/dist/runtime/components/buttons/__stories/AntDuplicateButton.stories.mjs +76 -0
- 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 +16 -6
- package/dist/runtime/components/buttons/__stories/AntSaveButton.stories.d.ts +1 -0
- package/dist/runtime/components/buttons/__stories/AntSaveButton.stories.mjs +16 -6
- 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 +1 -1
- package/dist/runtime/components/crud/AntCrudDetailNav.vue +1 -1
- package/dist/runtime/components/crud/AntCrudTableFilter.vue +1 -1
- 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/AntFormGroup.vue +22 -7
- 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/package.json +11 -11
- 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 +32 -20
- package/src/runtime/components/buttons/AntActionButton.vue +40 -32
- package/src/runtime/components/buttons/AntButton.vue +188 -168
- package/src/runtime/components/buttons/AntCreateButton.vue +19 -6
- package/src/runtime/components/buttons/AntDeleteButton.vue +21 -10
- package/src/runtime/components/buttons/AntDuplicateButton.vue +54 -0
- 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/AntCrud.vue +13 -10
- package/src/runtime/components/crud/AntCrudDetail.vue +1 -1
- package/src/runtime/components/crud/AntCrudDetailActions.vue +1 -1
- package/src/runtime/components/crud/AntCrudDetailNav.vue +1 -1
- package/src/runtime/components/crud/AntCrudTableFilter.vue +1 -1
- 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/AntFormGroup.vue +22 -7
- 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
|
@@ -3,16 +3,17 @@
|
|
|
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
|
|
8
|
+
import type {IconDefinition} from '@fortawesome/free-solid-svg-icons';
|
|
9
|
+
import {computed, useSlots} from 'vue';
|
|
10
|
+
import {hasSlotContent} from '../../utils';
|
|
12
11
|
|
|
13
12
|
defineEmits(['click', 'blur']);
|
|
14
|
-
withDefaults(
|
|
13
|
+
const props = withDefaults(
|
|
15
14
|
defineProps<{
|
|
15
|
+
iconLeft?: IconDefinition;
|
|
16
|
+
iconRight?: IconDefinition;
|
|
16
17
|
size?: Size;
|
|
17
18
|
disabled?: boolean;
|
|
18
19
|
grouped?: Grouped;
|
|
@@ -21,43 +22,50 @@ withDefaults(
|
|
|
21
22
|
expanded?: boolean;
|
|
22
23
|
filled?: boolean;
|
|
23
24
|
hasPermission?: boolean;
|
|
24
|
-
|
|
25
|
+
tooltipPosition?: Position;
|
|
26
|
+
tooltipColorType?: InputColorType;
|
|
27
|
+
tooltipDelay?: number;
|
|
25
28
|
}>(), {
|
|
26
29
|
colorType: ColorType.primary,
|
|
27
30
|
hasPermission: true,
|
|
28
31
|
filled: true
|
|
29
32
|
}
|
|
30
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']));
|
|
31
37
|
</script>
|
|
32
38
|
|
|
33
39
|
<template>
|
|
34
|
-
<
|
|
40
|
+
<AntButton
|
|
41
|
+
:icon-left="iconLeft"
|
|
42
|
+
:icon-right="iconRight"
|
|
43
|
+
:size="size"
|
|
44
|
+
:disabled="disabled || !hasPermission"
|
|
45
|
+
:grouped="grouped"
|
|
46
|
+
:skeleton="skeleton"
|
|
35
47
|
:expanded="expanded"
|
|
36
|
-
:
|
|
37
|
-
:
|
|
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')"
|
|
38
56
|
>
|
|
39
|
-
<slot
|
|
40
|
-
<AntButton
|
|
41
|
-
:size="size"
|
|
42
|
-
:disabled="disabled || !hasPermission"
|
|
43
|
-
:grouped="grouped"
|
|
44
|
-
:skeleton="skeleton"
|
|
45
|
-
:expanded="expanded"
|
|
46
|
-
:color-type="colorType"
|
|
47
|
-
:filled="filled"
|
|
48
|
-
data-e2e="action-button"
|
|
49
|
-
@click="$emit('click')"
|
|
50
|
-
@blur="$emit('blur')"
|
|
51
|
-
>
|
|
52
|
-
<slot />
|
|
53
|
-
</AntButton>
|
|
54
|
-
</slot>
|
|
57
|
+
<slot />
|
|
55
58
|
|
|
56
|
-
<template
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
+
/>
|
|
61
69
|
</template>
|
|
62
|
-
</
|
|
70
|
+
</AntButton>
|
|
63
71
|
</template>
|
|
@@ -7,160 +7,167 @@ 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']);
|
|
16
17
|
|
|
17
18
|
const props = withDefaults(defineProps<{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
filled?: boolean;
|
|
20
|
+
size?: Size;
|
|
21
|
+
colorType?: ColorType;
|
|
22
|
+
iconLeft?: IconDefinition;
|
|
23
|
+
iconRight?: IconDefinition;
|
|
24
|
+
to?: RouteLocationRaw;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
grouped?: Grouped;
|
|
27
|
+
skeleton?: boolean;
|
|
28
|
+
spinner?: boolean;
|
|
29
|
+
readonly?: boolean;
|
|
30
|
+
expanded?: boolean;
|
|
31
|
+
submit?: boolean;
|
|
32
|
+
outlined?: boolean;
|
|
33
|
+
noFocus?: boolean;
|
|
34
|
+
tooltipPosition?: Position;
|
|
35
|
+
tooltipColorType?: InputColorType;
|
|
36
|
+
tooltipDelay?: number;
|
|
33
37
|
}>(), {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
colorType: ColorType.base,
|
|
39
|
+
disabled: false,
|
|
40
|
+
filled: false,
|
|
41
|
+
skeleton: false,
|
|
42
|
+
spinner: false,
|
|
43
|
+
size: Size.md,
|
|
44
|
+
grouped: Grouped.none,
|
|
45
|
+
readonly: false,
|
|
46
|
+
expanded: false,
|
|
47
|
+
submit: false,
|
|
48
|
+
outlined: true,
|
|
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))
|
|
49
56
|
const groupedClassList = computed(() => ({
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
'rounded-tl-md rounded-bl-md rounded-tr-none rounded-br-none -mr-px': props.grouped === Grouped.left,
|
|
58
|
+
'rounded-none -mx-px': props.grouped === Grouped.center,
|
|
59
|
+
'rounded-tl-none rounded-bl-none rounded-tr-md rounded-br-md -ml-px': props.grouped === Grouped.right,
|
|
60
|
+
'rounded-md': props.grouped === Grouped.none,
|
|
54
61
|
}));
|
|
55
62
|
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
|
-
|
|
63
|
+
const variants = {
|
|
64
|
+
[ColorType.base]: 'ring-primary-200 outline-neutral-300',
|
|
65
|
+
[ColorType.danger]: 'ring-danger-200 outline-danger-500',
|
|
66
|
+
[ColorType.info]: 'ring-info-200 outline-info-500',
|
|
67
|
+
[ColorType.primary]: 'ring-primary-200 outline-primary-500',
|
|
68
|
+
[ColorType.secondary]: 'ring-secondary-200 outline-secondary-500',
|
|
69
|
+
[ColorType.success]: 'ring-success-200 outline-success-500',
|
|
70
|
+
[ColorType.warning]: 'ring-warning-200 outline-warning-500',
|
|
71
|
+
};
|
|
72
|
+
const notFilledVariants = {
|
|
73
|
+
[ColorType.base]: 'bg-white text-for-white-bg-font',
|
|
74
|
+
[ColorType.danger]: 'bg-white text-danger-500',
|
|
75
|
+
[ColorType.info]: 'bg-white text-info-500',
|
|
76
|
+
[ColorType.primary]: 'bg-white text-primary-500',
|
|
77
|
+
[ColorType.secondary]: 'bg-white text-secondary-500',
|
|
78
|
+
[ColorType.success]: 'bg-white text-success-500',
|
|
79
|
+
[ColorType.warning]: 'bg-white text-warning-500',
|
|
80
|
+
};
|
|
81
|
+
const notFilledHoverVariants = {
|
|
82
|
+
[ColorType.base]: 'hover:bg-neutral-100',
|
|
83
|
+
[ColorType.danger]: 'hover:bg-danger-100',
|
|
84
|
+
[ColorType.info]: 'hover:bg-info-100',
|
|
85
|
+
[ColorType.primary]: 'hover:bg-primary-100',
|
|
86
|
+
[ColorType.secondary]: 'hover:bg-secondary-100',
|
|
87
|
+
[ColorType.success]: 'hover:bg-success-100',
|
|
88
|
+
[ColorType.warning]: 'hover:bg-warning-100',
|
|
89
|
+
};
|
|
90
|
+
const filledVariants = {
|
|
91
|
+
[ColorType.base]: 'bg-neutral-50 text-neutral-50-font',
|
|
92
|
+
[ColorType.danger]: 'bg-danger-500 text-danger-500-font',
|
|
93
|
+
[ColorType.info]: 'bg-info-500 text-info-500-font',
|
|
94
|
+
[ColorType.primary]: 'bg-primary-500 text-primary-500-font',
|
|
95
|
+
[ColorType.secondary]: 'bg-secondary-500 text-secondary-500-font',
|
|
96
|
+
[ColorType.success]: 'bg-success-500 text-success-500-font',
|
|
97
|
+
[ColorType.warning]: 'bg-warning-500 text-warning-500-font',
|
|
98
|
+
};
|
|
99
|
+
const filledHoverVariants = {
|
|
100
|
+
[ColorType.base]: 'hover:bg-neutral-200',
|
|
101
|
+
[ColorType.danger]: 'hover:bg-danger-600',
|
|
102
|
+
[ColorType.info]: 'hover:bg-info-600',
|
|
103
|
+
[ColorType.primary]: 'hover:bg-primary-600',
|
|
104
|
+
[ColorType.secondary]: 'hover:bg-secondary-600',
|
|
105
|
+
[ColorType.success]: 'hover:bg-success-600',
|
|
106
|
+
[ColorType.warning]: 'hover:bg-warning-600',
|
|
107
|
+
};
|
|
101
108
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
109
|
+
return {
|
|
110
|
+
'transition-all inline-flex items-center justify-center relative font-medium': true,
|
|
111
|
+
'focus:z-10': true,
|
|
112
|
+
'active:shadow-[inset_0_4px_4px_rgba(0,0,0,0.25)]': !hasAction.value,
|
|
113
|
+
'py-1.5 px-2.5 text-xs gap-1': props.size === Size.sm,
|
|
114
|
+
'py-2.5 px-3.5 text-sm gap-2.5': props.size === Size.md,
|
|
115
|
+
'disabled:opacity-50 disabled:cursor-not-allowed': true,
|
|
116
|
+
'cursor-default': props.readonly,
|
|
117
|
+
'focus:ring-2': !props.readonly && props.size === Size.sm,
|
|
118
|
+
'focus:ring-4': !props.readonly && props.size === Size.md,
|
|
119
|
+
'w-full': props.expanded,
|
|
120
|
+
'invisible': props.skeleton,
|
|
121
|
+
'outline outline-1 outline-offset-[-1px]': props.outlined,
|
|
122
|
+
...groupedClassList.value,
|
|
123
|
+
[variants[props.colorType]]: true,
|
|
124
|
+
[notFilledVariants[props.colorType]]: !props.filled,
|
|
125
|
+
[notFilledHoverVariants[props.colorType]]: !props.filled && !hasAction.value,
|
|
126
|
+
[filledVariants[props.colorType]]: props.filled,
|
|
127
|
+
[filledHoverVariants[props.colorType]]: props.filled && !hasAction.value,
|
|
128
|
+
};
|
|
122
129
|
});
|
|
123
130
|
const iconColor = computed(() => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
131
|
+
const notFilledVariants = {
|
|
132
|
+
[ColorType.base]: 'text-for-white-bg-font',
|
|
133
|
+
[ColorType.danger]: 'text-danger-500',
|
|
134
|
+
[ColorType.info]: 'text-info-500',
|
|
135
|
+
[ColorType.primary]: 'text-primary-500',
|
|
136
|
+
[ColorType.secondary]: 'text-secondary-500',
|
|
137
|
+
[ColorType.success]: 'text-success-500',
|
|
138
|
+
[ColorType.warning]: 'text-warning-500',
|
|
139
|
+
};
|
|
140
|
+
const filledVariants = {
|
|
141
|
+
[ColorType.base]: 'text-for-white-bg-font',
|
|
142
|
+
[ColorType.danger]: 'text-danger-500-font',
|
|
143
|
+
[ColorType.info]: 'text-info-500-font',
|
|
144
|
+
[ColorType.primary]: 'text-primary-500-font',
|
|
145
|
+
[ColorType.secondary]: 'text-secondary-500-font',
|
|
146
|
+
[ColorType.success]: 'text-success-500-font',
|
|
147
|
+
[ColorType.warning]: 'text-warning-500-font',
|
|
148
|
+
};
|
|
142
149
|
|
|
143
|
-
|
|
150
|
+
return props.filled ? filledVariants[props.colorType] : notFilledVariants[props.colorType];
|
|
144
151
|
});
|
|
145
152
|
const type = computed(() => {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
153
|
+
if (props.to !== undefined) {
|
|
154
|
+
return undefined;
|
|
155
|
+
}
|
|
149
156
|
|
|
150
|
-
|
|
157
|
+
return props.submit ? ButtonType.submit : ButtonType.button;
|
|
151
158
|
});
|
|
152
159
|
const is = computed(() => {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
160
|
+
if (props.readonly) {
|
|
161
|
+
return 'div';
|
|
162
|
+
}
|
|
156
163
|
|
|
157
|
-
|
|
164
|
+
return props.to !== undefined ? 'router-link' : 'button'
|
|
158
165
|
})
|
|
159
166
|
|
|
160
167
|
onMounted(() => {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
168
|
+
handleEnumValidation(props.size, Size, 'size');
|
|
169
|
+
handleEnumValidation(props.colorType, ColorType, 'colorType');
|
|
170
|
+
handleEnumValidation(props.grouped, Grouped, 'grouped');
|
|
164
171
|
});
|
|
165
172
|
</script>
|
|
166
173
|
|
|
@@ -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,41 +1,54 @@
|
|
|
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>
|
|
20
21
|
|
|
21
22
|
<template>
|
|
22
23
|
<AntActionButton
|
|
24
|
+
:filled="false"
|
|
25
|
+
:color-type="ColorType.primary"
|
|
23
26
|
:size="size"
|
|
24
27
|
:disabled="disabled"
|
|
28
|
+
:icon-left="iconVariant ? faPlus : undefined"
|
|
25
29
|
:grouped="grouped"
|
|
26
30
|
:skeleton="skeleton"
|
|
27
31
|
:expanded="expanded"
|
|
28
32
|
:has-permission="canCreate"
|
|
29
|
-
:
|
|
33
|
+
:tooltip-position="tooltipPosition"
|
|
30
34
|
data-e2e="create-button"
|
|
31
35
|
@click="$emit('click')"
|
|
32
36
|
@blur="$emit('blur')"
|
|
33
37
|
>
|
|
34
|
-
<template
|
|
38
|
+
<template
|
|
39
|
+
v-if="!iconVariant"
|
|
40
|
+
#default
|
|
41
|
+
>
|
|
42
|
+
Create
|
|
43
|
+
</template>
|
|
35
44
|
|
|
36
45
|
<template #invalidPermissionTooltipContent>
|
|
37
46
|
You have no permission to create new entries.<br>
|
|
38
47
|
Please contact your administrator.
|
|
39
48
|
</template>
|
|
49
|
+
|
|
50
|
+
<template #tooltipContent>
|
|
51
|
+
Create new entry
|
|
52
|
+
</template>
|
|
40
53
|
</AntActionButton>
|
|
41
54
|
</template>
|
|
@@ -1,43 +1,54 @@
|
|
|
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';
|
|
4
|
+
import {faTrash} from '@fortawesome/free-solid-svg-icons';
|
|
7
5
|
|
|
8
6
|
defineEmits(['click', 'blur']);
|
|
9
7
|
withDefaults(defineProps<{
|
|
8
|
+
iconVariant?: boolean;
|
|
10
9
|
size?: Size;
|
|
11
10
|
disabled?: boolean;
|
|
12
11
|
grouped?: Grouped;
|
|
13
12
|
skeleton?: boolean;
|
|
14
13
|
expanded?: boolean;
|
|
15
14
|
canDelete?: boolean;
|
|
16
|
-
|
|
15
|
+
tooltipPosition?: Position;
|
|
17
16
|
}>(), {
|
|
17
|
+
iconVariant: false,
|
|
18
18
|
canDelete: true
|
|
19
|
-
})
|
|
19
|
+
});
|
|
20
20
|
</script>
|
|
21
21
|
|
|
22
22
|
<template>
|
|
23
23
|
<AntActionButton
|
|
24
|
+
:filled="false"
|
|
25
|
+
:color-type="ColorType.danger"
|
|
24
26
|
:size="size"
|
|
25
27
|
:disabled="disabled"
|
|
28
|
+
:icon-left="iconVariant ? faTrash : undefined"
|
|
26
29
|
:grouped="grouped"
|
|
27
30
|
:skeleton="skeleton"
|
|
28
31
|
:expanded="expanded"
|
|
29
|
-
:color-type="ColorType.danger"
|
|
30
32
|
:has-permission="canDelete"
|
|
31
|
-
:
|
|
33
|
+
:tooltip-position="tooltipPosition"
|
|
32
34
|
data-e2e="delete-button"
|
|
33
35
|
@click="$emit('click')"
|
|
34
36
|
@blur="$emit('blur')"
|
|
35
37
|
>
|
|
36
|
-
<template
|
|
38
|
+
<template
|
|
39
|
+
v-if="!iconVariant"
|
|
40
|
+
#default
|
|
41
|
+
>
|
|
42
|
+
Delete
|
|
43
|
+
</template>
|
|
37
44
|
|
|
38
45
|
<template #invalidPermissionTooltipContent>
|
|
39
|
-
You have no permission to delete
|
|
46
|
+
You have no permission to delete entries.<br>
|
|
40
47
|
Please contact your administrator.
|
|
41
48
|
</template>
|
|
49
|
+
|
|
50
|
+
<template #tooltipContent>
|
|
51
|
+
Delete entry
|
|
52
|
+
</template>
|
|
42
53
|
</AntActionButton>
|
|
43
54
|
</template>
|