@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
|
@@ -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
|
|
|
@@ -2,28 +2,41 @@
|
|
|
2
2
|
import {Grouped} from '../../enums/Grouped.enum';
|
|
3
3
|
import {Size} from '../../enums/Size.enum';
|
|
4
4
|
import AntActionButton from './AntActionButton.vue';
|
|
5
|
+
import {Position} from '../../enums';
|
|
5
6
|
|
|
6
7
|
defineEmits(['click', 'blur']);
|
|
7
|
-
defineProps<{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
withDefaults(defineProps<{
|
|
9
|
+
size?: Size;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
grouped?: Grouped;
|
|
12
|
+
skeleton?: boolean;
|
|
13
|
+
expanded?: boolean;
|
|
14
|
+
canCreate?: boolean;
|
|
15
|
+
invalidPermissionTooltipPosition?: Position;
|
|
16
|
+
}>(), {
|
|
17
|
+
canCreate: true
|
|
18
|
+
});
|
|
14
19
|
</script>
|
|
15
20
|
|
|
16
21
|
<template>
|
|
17
22
|
<AntActionButton
|
|
23
|
+
:filled="false"
|
|
18
24
|
:size="size"
|
|
19
25
|
:disabled="disabled"
|
|
20
26
|
:grouped="grouped"
|
|
21
27
|
:skeleton="skeleton"
|
|
22
28
|
:expanded="expanded"
|
|
29
|
+
:has-permission="canCreate"
|
|
30
|
+
:invalid-permission-tooltip-position="invalidPermissionTooltipPosition"
|
|
23
31
|
data-e2e="create-button"
|
|
24
32
|
@click="$emit('click')"
|
|
25
33
|
@blur="$emit('blur')"
|
|
26
34
|
>
|
|
27
|
-
Create
|
|
35
|
+
<template #default>Create</template>
|
|
36
|
+
|
|
37
|
+
<template #invalidPermissionTooltipContent>
|
|
38
|
+
You have no permission to create new entries.<br>
|
|
39
|
+
Please contact your administrator.
|
|
40
|
+
</template>
|
|
28
41
|
</AntActionButton>
|
|
29
42
|
</template>
|
|
@@ -3,29 +3,51 @@ import {Grouped} from '../../enums/Grouped.enum';
|
|
|
3
3
|
import {Size} from '../../enums/Size.enum';
|
|
4
4
|
import {ColorType} from '../../enums/ColorType.enum';
|
|
5
5
|
import AntActionButton from './AntActionButton.vue';
|
|
6
|
+
import {Position} from '../../enums';
|
|
7
|
+
import {faTrash} from '@fortawesome/free-solid-svg-icons';
|
|
6
8
|
|
|
7
9
|
defineEmits(['click', 'blur']);
|
|
8
|
-
defineProps<{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
withDefaults(defineProps<{
|
|
11
|
+
iconVariant?: boolean;
|
|
12
|
+
size?: Size;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
grouped?: Grouped;
|
|
15
|
+
skeleton?: boolean;
|
|
16
|
+
expanded?: boolean;
|
|
17
|
+
canDelete?: boolean;
|
|
18
|
+
invalidPermissionTooltipPosition?: Position;
|
|
19
|
+
}>(), {
|
|
20
|
+
iconVariant: false,
|
|
21
|
+
canDelete: true
|
|
22
|
+
})
|
|
15
23
|
</script>
|
|
16
24
|
|
|
17
25
|
<template>
|
|
18
26
|
<AntActionButton
|
|
27
|
+
:icon-left="iconVariant ? faTrash : undefined"
|
|
28
|
+
:filled="false"
|
|
19
29
|
:size="size"
|
|
20
30
|
:disabled="disabled"
|
|
21
31
|
:grouped="grouped"
|
|
22
32
|
:skeleton="skeleton"
|
|
23
33
|
:expanded="expanded"
|
|
24
34
|
:color-type="ColorType.danger"
|
|
35
|
+
:has-permission="canDelete"
|
|
36
|
+
:invalid-permission-tooltip-position="invalidPermissionTooltipPosition"
|
|
25
37
|
data-e2e="delete-button"
|
|
26
38
|
@click="$emit('click')"
|
|
27
39
|
@blur="$emit('blur')"
|
|
28
40
|
>
|
|
29
|
-
|
|
41
|
+
<template
|
|
42
|
+
v-if="!iconVariant"
|
|
43
|
+
#default
|
|
44
|
+
>
|
|
45
|
+
Delete
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<template #invalidPermissionTooltipContent>
|
|
49
|
+
You have no permission to delete this entry.<br>
|
|
50
|
+
Please contact your administrator.
|
|
51
|
+
</template>
|
|
30
52
|
</AntActionButton>
|
|
31
53
|
</template>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import {Grouped} from '../../enums/Grouped.enum';
|
|
3
|
+
import {Size} from '../../enums/Size.enum';
|
|
4
|
+
import AntActionButton from './AntActionButton.vue';
|
|
5
|
+
import {ColorType, Position} from '../../enums';
|
|
6
|
+
import {faCopy} from '@fortawesome/free-solid-svg-icons';
|
|
7
|
+
|
|
8
|
+
defineEmits(['click', 'blur']);
|
|
9
|
+
withDefaults(defineProps<{
|
|
10
|
+
size?: Size;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
grouped?: Grouped;
|
|
13
|
+
skeleton?: boolean;
|
|
14
|
+
expanded?: boolean;
|
|
15
|
+
canDuplicate?: boolean;
|
|
16
|
+
invalidPermissionTooltipPosition?: Position;
|
|
17
|
+
}>(), {
|
|
18
|
+
canDuplicate: true
|
|
19
|
+
});
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<AntActionButton
|
|
24
|
+
:icon-left="faCopy"
|
|
25
|
+
:color-type="ColorType.base"
|
|
26
|
+
:size="size"
|
|
27
|
+
:disabled="disabled"
|
|
28
|
+
:grouped="grouped"
|
|
29
|
+
:skeleton="skeleton"
|
|
30
|
+
:expanded="expanded"
|
|
31
|
+
:has-permission="canDuplicate"
|
|
32
|
+
:invalid-permission-tooltip-position="invalidPermissionTooltipPosition"
|
|
33
|
+
data-e2e="create-button"
|
|
34
|
+
@click="$emit('click')"
|
|
35
|
+
@blur="$emit('blur')"
|
|
36
|
+
>
|
|
37
|
+
<template #invalidPermissionTooltipContent>
|
|
38
|
+
You have no permission to duplicate entries.<br>
|
|
39
|
+
Please contact your administrator.
|
|
40
|
+
</template>
|
|
41
|
+
</AntActionButton>
|
|
42
|
+
</template>
|
|
@@ -2,15 +2,20 @@
|
|
|
2
2
|
import {Grouped} from '../../enums/Grouped.enum';
|
|
3
3
|
import {Size} from '../../enums/Size.enum';
|
|
4
4
|
import AntActionButton from './AntActionButton.vue';
|
|
5
|
+
import {Position} from '../../enums';
|
|
5
6
|
|
|
6
7
|
defineEmits(['click', 'blur']);
|
|
7
|
-
defineProps<{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
withDefaults(defineProps<{
|
|
9
|
+
size?: Size;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
grouped?: Grouped;
|
|
12
|
+
skeleton?: boolean;
|
|
13
|
+
expanded?: boolean;
|
|
14
|
+
canSave?: boolean;
|
|
15
|
+
invalidPermissionTooltipPosition?: Position;
|
|
16
|
+
}>(), {
|
|
17
|
+
canSave: true
|
|
18
|
+
});
|
|
14
19
|
</script>
|
|
15
20
|
|
|
16
21
|
<template>
|
|
@@ -20,10 +25,18 @@ defineProps<{
|
|
|
20
25
|
:grouped="grouped"
|
|
21
26
|
:skeleton="skeleton"
|
|
22
27
|
:expanded="expanded"
|
|
28
|
+
:filled="false"
|
|
29
|
+
:has-permission="canSave"
|
|
30
|
+
:invalid-permission-tooltip-position="invalidPermissionTooltipPosition"
|
|
23
31
|
data-e2e="save-and-new-button"
|
|
24
32
|
@click="$emit('click')"
|
|
25
33
|
@blur="$emit('blur')"
|
|
26
34
|
>
|
|
27
|
-
Save and new
|
|
35
|
+
<template #default>Save and new</template>
|
|
36
|
+
|
|
37
|
+
<template #invalidPermissionTooltipContent>
|
|
38
|
+
You have no permission to save this entry.<br>
|
|
39
|
+
Please contact your administrator.
|
|
40
|
+
</template>
|
|
28
41
|
</AntActionButton>
|
|
29
42
|
</template>
|
|
@@ -3,15 +3,20 @@ import {Grouped} from '../../enums/Grouped.enum';
|
|
|
3
3
|
import {Size} from '../../enums/Size.enum';
|
|
4
4
|
import {ColorType} from '../../enums/ColorType.enum';
|
|
5
5
|
import AntActionButton from './AntActionButton.vue';
|
|
6
|
+
import {Position} from '../../enums';
|
|
6
7
|
|
|
7
8
|
defineEmits(['click', 'blur']);
|
|
8
|
-
defineProps<{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
withDefaults(defineProps<{
|
|
10
|
+
size?: Size;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
grouped?: Grouped;
|
|
13
|
+
skeleton?: boolean;
|
|
14
|
+
expanded?: boolean;
|
|
15
|
+
canSave?: boolean;
|
|
16
|
+
invalidPermissionTooltipPosition?: Position;
|
|
17
|
+
}>(), {
|
|
18
|
+
canSave: true
|
|
19
|
+
});
|
|
15
20
|
</script>
|
|
16
21
|
|
|
17
22
|
<template>
|
|
@@ -23,9 +28,16 @@ defineProps<{
|
|
|
23
28
|
:expanded="expanded"
|
|
24
29
|
:color-type="ColorType.primary"
|
|
25
30
|
data-e2e="save-button"
|
|
31
|
+
:has-permission="canSave"
|
|
32
|
+
:invalid-permission-tooltip-position="invalidPermissionTooltipPosition"
|
|
26
33
|
@click="$emit('click')"
|
|
27
34
|
@blur="$emit('blur')"
|
|
28
35
|
>
|
|
29
|
-
Save
|
|
36
|
+
<template #default>Save</template>
|
|
37
|
+
|
|
38
|
+
<template #invalidPermissionTooltipContent>
|
|
39
|
+
You have no permission to save this entry.<br>
|
|
40
|
+
Please contact your administrator.
|
|
41
|
+
</template>
|
|
30
42
|
</AntActionButton>
|
|
31
43
|
</template>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import AntActionButton from "../AntActionButton.vue";
|
|
2
2
|
import { Size } from "../../../enums/Size.enum.mjs";
|
|
3
3
|
import { Grouped as _Grouped } from "../../../enums/Grouped.enum.mjs";
|
|
4
|
+
import { Position } from "../../../enums/Position.enum.mjs";
|
|
4
5
|
const meta = {
|
|
5
6
|
title: "Components/Buttons/Action Button",
|
|
6
7
|
component: AntActionButton,
|
|
@@ -13,6 +14,10 @@ const meta = {
|
|
|
13
14
|
grouped: {
|
|
14
15
|
control: { type: "select" },
|
|
15
16
|
options: Object.values(_Grouped)
|
|
17
|
+
},
|
|
18
|
+
invalidPermissionTooltipPosition: {
|
|
19
|
+
control: { type: "select" },
|
|
20
|
+
options: Object.values(Position)
|
|
16
21
|
}
|
|
17
22
|
}
|
|
18
23
|
};
|
|
@@ -25,7 +30,9 @@ export const Docs = {
|
|
|
25
30
|
},
|
|
26
31
|
template: '<AntActionButton v-bind="args">Action Button</AntActionButton>'
|
|
27
32
|
}),
|
|
28
|
-
args: {
|
|
33
|
+
args: {
|
|
34
|
+
invalidPermissionTooltipPosition: Position.right
|
|
35
|
+
}
|
|
29
36
|
};
|
|
30
37
|
export const Disabled = {
|
|
31
38
|
render: Docs.render,
|
|
@@ -55,3 +62,20 @@ export const Expanded = {
|
|
|
55
62
|
expanded: true
|
|
56
63
|
}
|
|
57
64
|
};
|
|
65
|
+
export const WithPermissionTooltip = {
|
|
66
|
+
render: (args) => ({
|
|
67
|
+
components: { AntActionButton },
|
|
68
|
+
setup() {
|
|
69
|
+
return { args };
|
|
70
|
+
},
|
|
71
|
+
template: `<AntActionButton v-bind="args">
|
|
72
|
+
Action Button
|
|
73
|
+
|
|
74
|
+
<template #invalidPermissionTooltipContent>You have no permission to do this</template>
|
|
75
|
+
</AntActionButton>`
|
|
76
|
+
}),
|
|
77
|
+
args: {
|
|
78
|
+
...Docs.args,
|
|
79
|
+
hasPermission: false
|
|
80
|
+
}
|
|
81
|
+
};
|