@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
|
@@ -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>
|
|
@@ -7,33 +7,36 @@ withDefaults(defineProps<{
|
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
<template>
|
|
10
|
-
<div
|
|
10
|
+
<div
|
|
11
|
+
class="flex w-full h-full"
|
|
12
|
+
data-e2e="crud"
|
|
13
|
+
>
|
|
11
14
|
<div
|
|
12
15
|
class="left-content h-full flex flex-col bg-neutral-300 gap-px overflow-hidden"
|
|
13
16
|
:class="{'w-[40rem]': showDetail, 'w-full': !showDetail}"
|
|
14
17
|
>
|
|
15
|
-
<div class="bg-
|
|
16
|
-
<slot name="search-section"/>
|
|
18
|
+
<div class="bg-white">
|
|
19
|
+
<slot name="search-section" />
|
|
17
20
|
</div>
|
|
18
21
|
|
|
19
|
-
<div class="bg-
|
|
20
|
-
<slot name="table-section"/>
|
|
22
|
+
<div class="bg-white flex-grow h-full overflow-hidden">
|
|
23
|
+
<slot name="table-section" />
|
|
21
24
|
</div>
|
|
22
25
|
|
|
23
|
-
<div class="bg-
|
|
24
|
-
<slot name="table-nav-section"/>
|
|
26
|
+
<div class="bg-white">
|
|
27
|
+
<slot name="table-nav-section" />
|
|
25
28
|
</div>
|
|
26
29
|
</div>
|
|
27
30
|
|
|
28
|
-
<
|
|
31
|
+
<Transition name="right-content">
|
|
29
32
|
<div
|
|
30
33
|
v-if="showDetail"
|
|
31
34
|
class="flex flex-col gap-px border-l border-neutral-300 overflow-hidden"
|
|
32
35
|
:class="{'w-full': showDetail}"
|
|
33
36
|
>
|
|
34
|
-
<slot/>
|
|
37
|
+
<slot />
|
|
35
38
|
</div>
|
|
36
|
-
</
|
|
39
|
+
</Transition>
|
|
37
40
|
</div>
|
|
38
41
|
</template>
|
|
39
42
|
|
|
@@ -8,14 +8,19 @@ defineEmits(['back', 'save', 'save-and-new']);
|
|
|
8
8
|
withDefaults(defineProps<{
|
|
9
9
|
disabled?: boolean
|
|
10
10
|
skeleton?: boolean
|
|
11
|
+
canSave?: boolean
|
|
11
12
|
}>(), {
|
|
12
13
|
disabled: false,
|
|
13
14
|
skeleton: false,
|
|
15
|
+
canSave: true
|
|
14
16
|
});
|
|
15
17
|
</script>
|
|
16
18
|
|
|
17
19
|
<template>
|
|
18
|
-
<div
|
|
20
|
+
<div
|
|
21
|
+
class="flex justify-between p-2.5 gap-2.5 bg-white"
|
|
22
|
+
data-e2e="crud-detail-actions"
|
|
23
|
+
>
|
|
19
24
|
<div class="flex gap-2.5">
|
|
20
25
|
<slot name="buttons-left">
|
|
21
26
|
<AntButton
|
|
@@ -31,21 +36,23 @@ withDefaults(defineProps<{
|
|
|
31
36
|
</div>
|
|
32
37
|
|
|
33
38
|
<div class="flex gap-2.5">
|
|
34
|
-
<slot name="before-buttons-right"/>
|
|
39
|
+
<slot name="before-buttons-right" />
|
|
35
40
|
<slot name="buttons-right">
|
|
36
41
|
<AntSaveAndNewButton
|
|
37
42
|
:skeleton="skeleton"
|
|
38
43
|
:disabled="disabled"
|
|
44
|
+
:can-save="canSave"
|
|
39
45
|
@click="$emit('save-and-new')"
|
|
40
46
|
/>
|
|
41
47
|
|
|
42
48
|
<AntSaveButton
|
|
43
49
|
:skeleton="skeleton"
|
|
44
50
|
:disabled="disabled"
|
|
51
|
+
:can-save="canSave"
|
|
45
52
|
@click="$emit('save')"
|
|
46
53
|
/>
|
|
47
54
|
</slot>
|
|
48
|
-
<slot name="after-buttons-right"/>
|
|
55
|
+
<slot name="after-buttons-right" />
|
|
49
56
|
</div>
|
|
50
57
|
</div>
|
|
51
58
|
</template>
|
|
@@ -5,40 +5,46 @@ import AntTabs from '../tabs/AntTabs.vue';
|
|
|
5
5
|
import AntDeleteButton from '../buttons/AntDeleteButton.vue';
|
|
6
6
|
import AntDeleteDialog from '../dialogs/AntDeleteDialog.vue';
|
|
7
7
|
import {ref} from 'vue';
|
|
8
|
+
import {Position} from '../../enums';
|
|
8
9
|
|
|
9
10
|
defineEmits(['delete']);
|
|
10
11
|
withDefaults(defineProps<{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
tabItems?: TabItem[]
|
|
13
|
+
deleteButtonDisabled?: boolean
|
|
14
|
+
getEntityName: () => string
|
|
15
|
+
canDelete?: boolean
|
|
14
16
|
}>(), {
|
|
15
|
-
|
|
17
|
+
deleteButtonDisabled: false,
|
|
18
|
+
canDelete: true
|
|
16
19
|
});
|
|
17
20
|
|
|
18
21
|
const dialogOpen = ref(false);
|
|
19
22
|
</script>
|
|
20
23
|
|
|
21
24
|
<template>
|
|
22
|
-
<div
|
|
25
|
+
<div
|
|
26
|
+
class="flex justify-between items-stretch gap-2.5 bg-white"
|
|
27
|
+
data-e2e="crud-detail-nav"
|
|
28
|
+
>
|
|
23
29
|
<slot name="tabs">
|
|
24
30
|
<AntTabs
|
|
25
|
-
:
|
|
31
|
+
:tab-items="tabItems"
|
|
26
32
|
/>
|
|
27
33
|
</slot>
|
|
28
34
|
|
|
29
35
|
<div class="flex gap-2.5 pr-2.5 py-2.5">
|
|
30
36
|
<slot name="buttons">
|
|
31
|
-
<slot name="before-delete-button"/>
|
|
37
|
+
<slot name="before-delete-button" />
|
|
32
38
|
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
<AntDeleteButton
|
|
40
|
+
:disabled="deleteButtonDisabled || !canDelete"
|
|
41
|
+
filled
|
|
42
|
+
:can-delete="canDelete"
|
|
43
|
+
:invalid-permission-tooltip-position="Position.left"
|
|
44
|
+
@click="() => dialogOpen = true"
|
|
45
|
+
/>
|
|
40
46
|
|
|
41
|
-
<slot name="after-delete-button"/>
|
|
47
|
+
<slot name="after-delete-button" />
|
|
42
48
|
</slot>
|
|
43
49
|
</div>
|
|
44
50
|
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
// TODO:: This component works only with vue-router. Make it work in storybook.
|
|
3
|
-
// TODO:: add skeleton
|
|
4
3
|
import AntSearch from '../form/AntSearch.vue';
|
|
5
4
|
import AntCreateButton from '../buttons/AntCreateButton.vue';
|
|
6
5
|
import AntDropdown from '../AntDropdown.vue';
|
|
7
|
-
import AntIcon from '../AntIcon.vue';
|
|
8
6
|
import {computed, ref, watch} from 'vue';
|
|
9
7
|
import AntButton from '../buttons/AntButton.vue';
|
|
10
8
|
import {faFilter, faMultiply} from '@fortawesome/free-solid-svg-icons';
|
|
@@ -12,17 +10,19 @@ import {ColorType, Grouped, Position} from '../../enums';
|
|
|
12
10
|
import {useRoute, useRouter} from 'vue-router';
|
|
13
11
|
|
|
14
12
|
const props = withDefaults(defineProps<{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
fullWidth?: boolean,
|
|
14
|
+
showFilter?: boolean,
|
|
15
|
+
searchQuery?: string,
|
|
16
|
+
hasFilter?: boolean,
|
|
17
|
+
canCreate?: boolean,
|
|
18
|
+
skeleton?: boolean,
|
|
20
19
|
}>(), {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
fullWidth: true,
|
|
21
|
+
showFilter: true,
|
|
22
|
+
searchQuery: 'search',
|
|
23
|
+
hasFilter: false,
|
|
24
|
+
canCreate: true,
|
|
25
|
+
skeleton: false,
|
|
26
26
|
});
|
|
27
27
|
const emit = defineEmits(['search', 'create', 'removeFilter']);
|
|
28
28
|
const router = useRouter();
|
|
@@ -31,38 +31,38 @@ const route = useRoute();
|
|
|
31
31
|
const showDropdown = ref(false);
|
|
32
32
|
const _fullWidth = ref(props.fullWidth)
|
|
33
33
|
const search = computed({
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
get: () => route.query[props.searchQuery] as string || '',
|
|
35
|
+
set: (value) => {
|
|
36
|
+
const query = {
|
|
37
|
+
...route.query,
|
|
38
|
+
[props.searchQuery]: value
|
|
39
|
+
}
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
if (!value) {
|
|
42
|
+
delete query[props.searchQuery];
|
|
43
|
+
}
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
(async () => {
|
|
46
|
+
await router.replace({
|
|
47
|
+
...route,
|
|
48
|
+
query
|
|
49
|
+
})
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
emit('search', value)
|
|
52
|
+
})()
|
|
53
|
+
}
|
|
54
54
|
})
|
|
55
55
|
|
|
56
56
|
watch(() => props.fullWidth, (val) => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
setTimeout(() => {
|
|
58
|
+
_fullWidth.value = val
|
|
59
|
+
}, val ? 250 : 300)
|
|
60
60
|
})
|
|
61
61
|
</script>
|
|
62
62
|
|
|
63
63
|
<template>
|
|
64
64
|
<div
|
|
65
|
-
class="flex h-full items-center p-2.5 gap-2.5 bg-
|
|
65
|
+
class="flex h-full items-center p-2.5 gap-2.5 bg-white"
|
|
66
66
|
data-e2e="crud-table-filter"
|
|
67
67
|
>
|
|
68
68
|
<div
|
|
@@ -102,7 +102,7 @@ watch(() => props.fullWidth, (val) => {
|
|
|
102
102
|
</div>
|
|
103
103
|
|
|
104
104
|
<template #content>
|
|
105
|
-
<slot name="dropdownContent"/>
|
|
105
|
+
<slot name="dropdownContent" />
|
|
106
106
|
</template>
|
|
107
107
|
</AntDropdown>
|
|
108
108
|
</div>
|
|
@@ -112,6 +112,8 @@ watch(() => props.fullWidth, (val) => {
|
|
|
112
112
|
<AntCreateButton
|
|
113
113
|
filled
|
|
114
114
|
:skeleton="skeleton"
|
|
115
|
+
:can-create="canCreate"
|
|
116
|
+
:invalid-permission-tooltip-position="Position.left"
|
|
115
117
|
@click="() => emit('create')"
|
|
116
118
|
/>
|
|
117
119
|
</slot>
|
|
@@ -90,11 +90,15 @@ watch(() => props.fullWidth, (val) => {
|
|
|
90
90
|
>
|
|
91
91
|
<div
|
|
92
92
|
v-if="_fullWidth"
|
|
93
|
-
class="flex gap-2 items-center text-
|
|
93
|
+
class="flex gap-2 items-center text-for-white-bg-font text-sm"
|
|
94
94
|
data-e2e="items-per-page"
|
|
95
95
|
>
|
|
96
96
|
<span class="relative">
|
|
97
|
-
<AntSkeleton
|
|
97
|
+
<AntSkeleton
|
|
98
|
+
v-if="skeleton"
|
|
99
|
+
rounded
|
|
100
|
+
absolute
|
|
101
|
+
/>
|
|
98
102
|
Items per page
|
|
99
103
|
</span>
|
|
100
104
|
|
|
@@ -105,8 +109,15 @@ watch(() => props.fullWidth, (val) => {
|
|
|
105
109
|
:expanded="false"
|
|
106
110
|
/>
|
|
107
111
|
|
|
108
|
-
<div
|
|
109
|
-
|
|
112
|
+
<div
|
|
113
|
+
v-if="count !== null"
|
|
114
|
+
class="flex gap-1 relative"
|
|
115
|
+
>
|
|
116
|
+
<AntSkeleton
|
|
117
|
+
v-if="skeleton"
|
|
118
|
+
rounded
|
|
119
|
+
absolute
|
|
120
|
+
/>
|
|
110
121
|
|
|
111
122
|
<span class="font-medium">{{ fromItems }} - {{ itemsPerPage * page }}</span>
|
|
112
123
|
<span>of</span>
|
|
@@ -80,14 +80,14 @@ function confirmDialog() {
|
|
|
80
80
|
</script>
|
|
81
81
|
|
|
82
82
|
<template>
|
|
83
|
-
<
|
|
83
|
+
<Transition name="fade">
|
|
84
84
|
<div
|
|
85
85
|
v-if="openBackground"
|
|
86
86
|
class="absolute inset-0 flex items-center justify-center z-50 cursor-pointer overflow-hidden bg-black/50 backdrop-blur-sm"
|
|
87
87
|
data-e2e="dialog"
|
|
88
88
|
@click.self="closeDialog"
|
|
89
89
|
>
|
|
90
|
-
<
|
|
90
|
+
<Transition :name="'bounce'">
|
|
91
91
|
<div
|
|
92
92
|
v-if="openDialog"
|
|
93
93
|
class="flex flex-col gap-px bg-neutral-300 overflow-hidden cursor-auto w-96 border border-neutral-300 rounded-md shadow-md"
|
|
@@ -101,7 +101,7 @@ function confirmDialog() {
|
|
|
101
101
|
</slot>
|
|
102
102
|
</div>
|
|
103
103
|
|
|
104
|
-
<div class="bg-
|
|
104
|
+
<div class="bg-white p-2.5 grow flex items-center gap-2.5 text-sm">
|
|
105
105
|
<slot name="icon">
|
|
106
106
|
<AntIcon
|
|
107
107
|
v-if="icons[colorType]"
|
|
@@ -112,11 +112,11 @@ function confirmDialog() {
|
|
|
112
112
|
/>
|
|
113
113
|
</slot>
|
|
114
114
|
|
|
115
|
-
<slot/>
|
|
115
|
+
<slot />
|
|
116
116
|
</div>
|
|
117
117
|
|
|
118
118
|
<div
|
|
119
|
-
class="bg-neutral-100 p-2.5 gap-2.5 text-
|
|
119
|
+
class="bg-neutral-100 p-2.5 gap-2.5 text-for-white-bg-font flex w-full justify-end"
|
|
120
120
|
>
|
|
121
121
|
<slot name="footer">
|
|
122
122
|
<AntButton
|
|
@@ -137,9 +137,9 @@ function confirmDialog() {
|
|
|
137
137
|
</slot>
|
|
138
138
|
</div>
|
|
139
139
|
</div>
|
|
140
|
-
</
|
|
140
|
+
</Transition>
|
|
141
141
|
</div>
|
|
142
|
-
</
|
|
142
|
+
</Transition>
|
|
143
143
|
</template>
|
|
144
144
|
|
|
145
145
|
<style scoped>
|
|
@@ -113,7 +113,7 @@ onMounted(() => {
|
|
|
113
113
|
<AntIcon
|
|
114
114
|
v-if="_value"
|
|
115
115
|
:icon="faCheck"
|
|
116
|
-
class="absolute !text-
|
|
116
|
+
class="absolute !text-white pointer-events-none"
|
|
117
117
|
:size="size as unknown as IconSize"
|
|
118
118
|
/>
|
|
119
119
|
|
|
@@ -137,7 +137,6 @@ onMounted(() => {
|
|
|
137
137
|
</div>
|
|
138
138
|
</div>
|
|
139
139
|
</AntField>
|
|
140
|
-
|
|
141
140
|
</template>
|
|
142
141
|
|
|
143
142
|
<style scoped>
|