@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.
Files changed (88) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +2 -1
  3. package/dist/runtime/components/AntAccordionItem.vue +17 -14
  4. package/dist/runtime/components/AntDropdown.vue +6 -6
  5. package/dist/runtime/components/AntListGroupItem.vue +16 -10
  6. package/dist/runtime/components/AntModal.vue +10 -9
  7. package/dist/runtime/components/AntPopover.vue +10 -8
  8. package/dist/runtime/components/AntTooltip.vue +32 -20
  9. package/dist/runtime/components/__stories/AntTooltip.stories.d.ts +1 -1
  10. package/dist/runtime/components/__stories/AntTooltip.stories.mjs +164 -12
  11. package/dist/runtime/components/buttons/AntActionButton.vue +40 -32
  12. package/dist/runtime/components/buttons/AntButton.vue +188 -168
  13. package/dist/runtime/components/buttons/AntCreateButton.vue +19 -6
  14. package/dist/runtime/components/buttons/AntDeleteButton.vue +21 -10
  15. package/dist/runtime/components/buttons/AntDuplicateButton.vue +54 -0
  16. package/dist/runtime/components/buttons/AntEditButton.vue +54 -0
  17. package/dist/runtime/components/buttons/AntSaveAndNewButton.vue +21 -8
  18. package/dist/runtime/components/buttons/AntSaveButton.vue +21 -10
  19. package/dist/runtime/components/buttons/__stories/AntActionButton.stories.d.ts +1 -1
  20. package/dist/runtime/components/buttons/__stories/AntActionButton.stories.mjs +22 -19
  21. package/dist/runtime/components/buttons/__stories/AntButton.stories.d.ts +1 -0
  22. package/dist/runtime/components/buttons/__stories/AntButton.stories.mjs +166 -131
  23. package/dist/runtime/components/buttons/__stories/AntCreateButton.stories.d.ts +1 -0
  24. package/dist/runtime/components/buttons/__stories/AntCreateButton.stories.mjs +16 -6
  25. package/dist/runtime/components/buttons/__stories/AntDeleteButton.stories.d.ts +1 -0
  26. package/dist/runtime/components/buttons/__stories/AntDeleteButton.stories.mjs +16 -6
  27. package/dist/runtime/components/buttons/__stories/AntDuplicateButton.stories.d.ts +12 -0
  28. package/dist/runtime/components/buttons/__stories/AntDuplicateButton.stories.mjs +76 -0
  29. package/dist/runtime/components/buttons/__stories/AntEditButton.stories.d.ts +12 -0
  30. package/dist/runtime/components/buttons/__stories/AntEditButton.stories.mjs +76 -0
  31. package/dist/runtime/components/buttons/__stories/AntSaveAndNewButton.stories.d.ts +1 -0
  32. package/dist/runtime/components/buttons/__stories/AntSaveAndNewButton.stories.mjs +16 -6
  33. package/dist/runtime/components/buttons/__stories/AntSaveButton.stories.d.ts +1 -0
  34. package/dist/runtime/components/buttons/__stories/AntSaveButton.stories.mjs +16 -6
  35. package/dist/runtime/components/crud/AntCrud.vue +13 -10
  36. package/dist/runtime/components/crud/AntCrudDetail.vue +1 -1
  37. package/dist/runtime/components/crud/AntCrudDetailActions.vue +1 -1
  38. package/dist/runtime/components/crud/AntCrudDetailNav.vue +1 -1
  39. package/dist/runtime/components/crud/AntCrudTableFilter.vue +1 -1
  40. package/dist/runtime/components/crud/AntCrudTableNav.vue +15 -4
  41. package/dist/runtime/components/dialogs/AntDialog.vue +7 -7
  42. package/dist/runtime/components/form/AntCheckboxWidget/AntCheckbox.vue +1 -2
  43. package/dist/runtime/components/form/AntFormGroup.vue +22 -7
  44. package/dist/runtime/components/form/AntSelect.vue +57 -53
  45. package/dist/runtime/components/form/AntSwitch.vue +13 -10
  46. package/dist/runtime/components/form/AntSwitcher.vue +4 -4
  47. package/dist/runtime/components/form/AntTextarea.vue +6 -3
  48. package/dist/runtime/components/form/Elements/AntBaseInput.vue +45 -41
  49. package/dist/runtime/components/form/Elements/AntDropDown.vue +1 -1
  50. package/dist/runtime/components/layouts/AntNavLeftLayout.vue +4 -4
  51. package/dist/runtime/components/table/AntTable.vue +95 -73
  52. package/dist/runtime/components/table/AntTableSortButton.vue +16 -4
  53. package/dist/runtime/components/tabs/AntTabItem.vue +7 -4
  54. package/dist/runtime/tailwind.config.mjs +1 -1
  55. package/package.json +11 -11
  56. package/src/runtime/components/AntAccordionItem.vue +17 -14
  57. package/src/runtime/components/AntDropdown.vue +6 -6
  58. package/src/runtime/components/AntListGroupItem.vue +16 -10
  59. package/src/runtime/components/AntModal.vue +10 -9
  60. package/src/runtime/components/AntPopover.vue +10 -8
  61. package/src/runtime/components/AntTooltip.vue +32 -20
  62. package/src/runtime/components/buttons/AntActionButton.vue +40 -32
  63. package/src/runtime/components/buttons/AntButton.vue +188 -168
  64. package/src/runtime/components/buttons/AntCreateButton.vue +19 -6
  65. package/src/runtime/components/buttons/AntDeleteButton.vue +21 -10
  66. package/src/runtime/components/buttons/AntDuplicateButton.vue +54 -0
  67. package/src/runtime/components/buttons/AntEditButton.vue +54 -0
  68. package/src/runtime/components/buttons/AntSaveAndNewButton.vue +21 -8
  69. package/src/runtime/components/buttons/AntSaveButton.vue +21 -10
  70. package/src/runtime/components/crud/AntCrud.vue +13 -10
  71. package/src/runtime/components/crud/AntCrudDetail.vue +1 -1
  72. package/src/runtime/components/crud/AntCrudDetailActions.vue +1 -1
  73. package/src/runtime/components/crud/AntCrudDetailNav.vue +1 -1
  74. package/src/runtime/components/crud/AntCrudTableFilter.vue +1 -1
  75. package/src/runtime/components/crud/AntCrudTableNav.vue +15 -4
  76. package/src/runtime/components/dialogs/AntDialog.vue +7 -7
  77. package/src/runtime/components/form/AntCheckboxWidget/AntCheckbox.vue +1 -2
  78. package/src/runtime/components/form/AntFormGroup.vue +22 -7
  79. package/src/runtime/components/form/AntSelect.vue +57 -53
  80. package/src/runtime/components/form/AntSwitch.vue +13 -10
  81. package/src/runtime/components/form/AntSwitcher.vue +4 -4
  82. package/src/runtime/components/form/AntTextarea.vue +6 -3
  83. package/src/runtime/components/form/Elements/AntBaseInput.vue +45 -41
  84. package/src/runtime/components/form/Elements/AntDropDown.vue +1 -1
  85. package/src/runtime/components/layouts/AntNavLeftLayout.vue +4 -4
  86. package/src/runtime/components/table/AntTable.vue +95 -73
  87. package/src/runtime/components/table/AntTableSortButton.vue +16 -4
  88. 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/Grouped.enum';
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';
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
- invalidPermissionTooltipPosition?: Position;
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
- <AntTooltip
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
- :position="invalidPermissionTooltipPosition"
37
- :color-type="InputColorType.info"
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 name="button">
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
- v-if="!hasPermission && !skeleton"
58
- #content
59
- >
60
- <slot name="invalidPermissionTooltipContent" />
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
- </AntTooltip>
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
- 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;
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
- 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,
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
- '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,
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
- 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-neutral-50-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
- };
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
- 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
- };
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
- const notFilledVariants = {
125
- [ColorType.base]: 'text-neutral-50-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-neutral-50-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
- };
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
- return props.filled ? filledVariants[props.colorType] : notFilledVariants[props.colorType];
150
+ return props.filled ? filledVariants[props.colorType] : notFilledVariants[props.colorType];
144
151
  });
145
152
  const type = computed(() => {
146
- if (props.to !== undefined) {
147
- return undefined;
148
- }
153
+ if (props.to !== undefined) {
154
+ return undefined;
155
+ }
149
156
 
150
- return props.submit ? ButtonType.submit : ButtonType.button;
157
+ return props.submit ? ButtonType.submit : ButtonType.button;
151
158
  });
152
159
  const is = computed(() => {
153
- if (props.readonly) {
154
- return 'div';
155
- }
160
+ if (props.readonly) {
161
+ return 'div';
162
+ }
156
163
 
157
- return props.to !== undefined ? 'router-link' : 'button'
164
+ return props.to !== undefined ? 'router-link' : 'button'
158
165
  })
159
166
 
160
167
  onMounted(() => {
161
- handleEnumValidation(props.size, Size, 'size');
162
- handleEnumValidation(props.colorType, ColorType, 'colorType');
163
- handleEnumValidation(props.grouped, Grouped, 'grouped');
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
- <component
182
- :is="is"
183
- :class="classes"
184
- :type="type"
185
- :to="to"
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
- <AntSpinner
192
- v-if="spinner"
193
- :size="size"
194
- :color-type="colorType"
195
- :inverted="!filled"
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
- <slot
199
- v-if="!spinner"
200
- name="icon-left"
201
- >
202
- <AntIcon
203
- v-if="iconLeft"
204
- :icon="iconLeft"
205
- :size="size as unknown as IconSize"
206
- :color="iconColor"
207
- />
208
- </slot>
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
- <slot
211
- v-if="!spinner"
212
- />
224
+ <slot
225
+ v-if="!spinner"
226
+ />
213
227
 
214
- <slot
215
- v-if="!spinner"
216
- name="icon-right"
217
- >
218
- <AntIcon
219
- v-if="iconRight"
220
- :icon="iconRight"
221
- :size="size as unknown as IconSize"
222
- :color="iconColor"
223
- />
224
- </slot>
225
- </component>
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
- invalidPermissionTooltipPosition?: Position;
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
- :invalid-permission-tooltip-position="invalidPermissionTooltipPosition"
33
+ :tooltip-position="tooltipPosition"
30
34
  data-e2e="create-button"
31
35
  @click="$emit('click')"
32
36
  @blur="$emit('blur')"
33
37
  >
34
- <template #default>Create</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
- invalidPermissionTooltipPosition?: Position;
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
- :invalid-permission-tooltip-position="invalidPermissionTooltipPosition"
33
+ :tooltip-position="tooltipPosition"
32
34
  data-e2e="delete-button"
33
35
  @click="$emit('click')"
34
36
  @blur="$emit('blur')"
35
37
  >
36
- <template #default>Delete</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 this entry.<br>
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>