@antify/ui 2.5.6 → 2.5.7
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/components/{buttons/AntButton.vue → AntButton.vue} +9 -9
- package/dist/components/{dialogs/AntDialog.vue → AntDialog.vue} +4 -4
- package/dist/components/AntModal.vue +1 -1
- package/dist/components/AntPagination.vue +1 -1
- package/dist/components/AntToast.vue +1 -1
- package/dist/components/{buttons/__stories → __stories}/AntButton.stories.js +6 -6
- package/dist/components/{buttons/__stories → __stories}/AntButton.stories.mjs +6 -6
- package/dist/components/{dialogs/__stories → __stories}/AntDialog.stories.js +3 -3
- package/dist/components/{dialogs/__stories → __stories}/AntDialog.stories.mjs +3 -3
- package/dist/components/__stories/AntDropdown.stories.js +1 -1
- package/dist/components/__stories/AntDropdown.stories.mjs +1 -1
- package/dist/components/__stories/AntModal.stories.js +1 -1
- package/dist/components/__stories/AntModal.stories.mjs +1 -1
- package/dist/components/__stories/AntPopover.stories.js +1 -1
- package/dist/components/__stories/AntPopover.stories.mjs +1 -1
- package/dist/components/__stories/AntProgress.stories.js +1 -1
- package/dist/components/__stories/AntProgress.stories.mjs +1 -1
- package/dist/components/__stories/AntToaster.stories.js +1 -1
- package/dist/components/__stories/AntToaster.stories.mjs +1 -1
- package/dist/components/__stories/AntTooltip.stories.js +1 -1
- package/dist/components/__stories/AntTooltip.stories.mjs +1 -1
- package/dist/components/__types/index.d.ts +1 -0
- package/dist/components/__types/index.js +11 -0
- package/dist/components/__types/index.mjs +1 -0
- package/dist/components/forms/__stories/AntFormGroup.stories.js +1 -1
- package/dist/components/forms/__stories/AntFormGroup.stories.mjs +1 -1
- package/dist/components/index.d.ts +3 -17
- package/dist/components/index.js +2 -100
- package/dist/components/index.mjs +2 -30
- package/dist/components/inputs/AntColorInput/AntColorInput.vue +1 -1
- package/dist/components/inputs/AntDateInput.vue +1 -1
- package/dist/components/inputs/AntImageInput.vue +1 -1
- package/dist/components/inputs/AntNumberInput.vue +1 -1
- package/dist/components/inputs/AntSelect.vue +1 -1
- package/dist/components/inputs/AntSwitcher.vue +1 -1
- package/dist/components/inputs/AntUnitInput.vue +1 -1
- package/dist/components/inputs/Elements/__stories/AntBaseInput.stories.js +1 -1
- package/dist/components/inputs/Elements/__stories/AntBaseInput.stories.mjs +1 -1
- package/dist/components/inputs/__stories/AntPasswordInput.stories.js +1 -1
- package/dist/components/inputs/__stories/AntPasswordInput.stories.mjs +1 -1
- package/dist/components/inputs/__stories/AntTextInput.stories.js +1 -1
- package/dist/components/inputs/__stories/AntTextInput.stories.mjs +1 -1
- package/dist/components/table/AntTable.vue +1 -1
- package/dist/components/table/AntTableSortButton.vue +1 -1
- package/dist/components/table/__stories/AntTable.stories.js +1 -1
- package/dist/components/table/__stories/AntTable.stories.mjs +1 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.js +5 -16
- package/dist/types.mjs +0 -1
- package/package.json +5 -1
- package/dist/components/buttons/AntActionButton.vue +0 -83
- package/dist/components/buttons/AntCreateButton.vue +0 -61
- package/dist/components/buttons/AntDeleteButton.vue +0 -61
- package/dist/components/buttons/AntDuplicateButton.vue +0 -61
- package/dist/components/buttons/AntEditButton.vue +0 -61
- package/dist/components/buttons/AntSaveAndNewButton.vue +0 -63
- package/dist/components/buttons/AntSaveButton.vue +0 -62
- package/dist/components/buttons/__stories/AntActionButton.stories.d.ts +0 -11
- package/dist/components/buttons/__stories/AntActionButton.stories.js +0 -111
- package/dist/components/buttons/__stories/AntActionButton.stories.mjs +0 -111
- package/dist/components/buttons/__stories/AntCreateButton.stories.d.ts +0 -12
- package/dist/components/buttons/__stories/AntCreateButton.stories.js +0 -97
- package/dist/components/buttons/__stories/AntCreateButton.stories.mjs +0 -94
- package/dist/components/buttons/__stories/AntDeleteButton.stories.d.ts +0 -12
- package/dist/components/buttons/__stories/AntDeleteButton.stories.js +0 -97
- package/dist/components/buttons/__stories/AntDeleteButton.stories.mjs +0 -94
- package/dist/components/buttons/__stories/AntDuplicateButton.stories.d.ts +0 -12
- package/dist/components/buttons/__stories/AntDuplicateButton.stories.js +0 -97
- package/dist/components/buttons/__stories/AntDuplicateButton.stories.mjs +0 -94
- package/dist/components/buttons/__stories/AntEditButton.stories.d.ts +0 -12
- package/dist/components/buttons/__stories/AntEditButton.stories.js +0 -97
- package/dist/components/buttons/__stories/AntEditButton.stories.mjs +0 -94
- package/dist/components/buttons/__stories/AntSaveAndNewButton.stories.d.ts +0 -12
- package/dist/components/buttons/__stories/AntSaveAndNewButton.stories.js +0 -97
- package/dist/components/buttons/__stories/AntSaveAndNewButton.stories.mjs +0 -94
- package/dist/components/buttons/__stories/AntSaveButton.stories.d.ts +0 -12
- package/dist/components/buttons/__stories/AntSaveButton.stories.js +0 -97
- package/dist/components/buttons/__stories/AntSaveButton.stories.mjs +0 -94
- package/dist/components/buttons/__types/index.d.ts +0 -1
- package/dist/components/buttons/__types/index.js +0 -16
- package/dist/components/buttons/__types/index.mjs +0 -1
- package/dist/components/crud/AntCrud.vue +0 -75
- package/dist/components/crud/AntCrudDetail.vue +0 -14
- package/dist/components/crud/AntCrudDetailActions.vue +0 -65
- package/dist/components/crud/AntCrudDetailNav.vue +0 -72
- package/dist/components/crud/AntCrudTableFilter.vue +0 -141
- package/dist/components/crud/AntCrudTableNav.vue +0 -163
- package/dist/components/crud/__stories/AntCrud.stories.d.ts +0 -6
- package/dist/components/crud/__stories/AntCrud.stories.js +0 -131
- package/dist/components/crud/__stories/AntCrud.stories.mjs +0 -142
- package/dist/components/crud/__stories/AntCrudDetail.stories.d.ts +0 -7
- package/dist/components/crud/__stories/AntCrudDetail.stories.js +0 -90
- package/dist/components/crud/__stories/AntCrudDetail.stories.mjs +0 -92
- package/dist/components/crud/__stories/AntCrudDetailActions.stories.d.ts +0 -6
- package/dist/components/crud/__stories/AntCrudDetailActions.stories.js +0 -38
- package/dist/components/crud/__stories/AntCrudDetailActions.stories.mjs +0 -33
- package/dist/components/crud/__stories/AntCrudDetailNav.stories.d.ts +0 -6
- package/dist/components/crud/__stories/AntCrudDetailNav.stories.js +0 -51
- package/dist/components/crud/__stories/AntCrudDetailNav.stories.mjs +0 -53
- package/dist/components/crud/__stories/AntCrudTableFilter.stories.d.ts +0 -6
- package/dist/components/crud/__stories/AntCrudTableFilter.stories.js +0 -42
- package/dist/components/crud/__stories/AntCrudTableFilter.stories.mjs +0 -39
- package/dist/components/crud/__stories/AntCrudTableNav.stories.d.ts +0 -8
- package/dist/components/crud/__stories/AntCrudTableNav.stories.js +0 -77
- package/dist/components/crud/__stories/AntCrudTableNav.stories.mjs +0 -74
- package/dist/components/dialogs/AntDeleteDialog.vue +0 -37
- package/dist/components/dialogs/__stories/AndDeleteDialog.stories.d.ts +0 -6
- package/dist/components/dialogs/__stories/AndDeleteDialog.stories.js +0 -48
- package/dist/components/dialogs/__stories/AndDeleteDialog.stories.mjs +0 -41
- /package/dist/components/{buttons/__stories → __stories}/AntButton.stories.d.ts +0 -0
- /package/dist/components/{dialogs/__stories → __stories}/AntDialog.stories.d.ts +0 -0
- /package/dist/components/{buttons/__types → __types}/AntButton.types.d.ts +0 -0
- /package/dist/components/{buttons/__types → __types}/AntButton.types.js +0 -0
- /package/dist/components/{buttons/__types → __types}/AntButton.types.mjs +0 -0
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import AntSaveButton from "../AntSaveButton.vue";
|
|
2
|
-
import {
|
|
3
|
-
Position,
|
|
4
|
-
Grouped as _Grouped,
|
|
5
|
-
Size
|
|
6
|
-
} from "../../../enums/index.mjs";
|
|
7
|
-
const meta = {
|
|
8
|
-
title: "Components/Buttons/Save Button",
|
|
9
|
-
component: AntSaveButton,
|
|
10
|
-
parameters: {
|
|
11
|
-
controls: {
|
|
12
|
-
sort: "requiredFirst"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
argTypes: {
|
|
16
|
-
size: {
|
|
17
|
-
control: {
|
|
18
|
-
type: "select"
|
|
19
|
-
},
|
|
20
|
-
options: Object.values(Size)
|
|
21
|
-
},
|
|
22
|
-
grouped: {
|
|
23
|
-
control: {
|
|
24
|
-
type: "select"
|
|
25
|
-
},
|
|
26
|
-
options: Object.values(_Grouped)
|
|
27
|
-
},
|
|
28
|
-
tooltipPosition: {
|
|
29
|
-
control: {
|
|
30
|
-
type: "select"
|
|
31
|
-
},
|
|
32
|
-
options: Object.values(Position)
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
export default meta;
|
|
37
|
-
export const Docs = {
|
|
38
|
-
render: (args) => ({
|
|
39
|
-
components: {
|
|
40
|
-
AntSaveButton
|
|
41
|
-
},
|
|
42
|
-
setup() {
|
|
43
|
-
return {
|
|
44
|
-
args
|
|
45
|
-
};
|
|
46
|
-
},
|
|
47
|
-
template: '<AntSaveButton v-bind="args"/>'
|
|
48
|
-
}),
|
|
49
|
-
args: {
|
|
50
|
-
tooltipPosition: Position.right
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
export const IconVariant = {
|
|
54
|
-
render: Docs.render,
|
|
55
|
-
args: {
|
|
56
|
-
...Docs.args,
|
|
57
|
-
iconVariant: true
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
export const Disabled = {
|
|
61
|
-
render: Docs.render,
|
|
62
|
-
args: {
|
|
63
|
-
...Docs.args,
|
|
64
|
-
disabled: true
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
export const Grouped = {
|
|
68
|
-
render: Docs.render,
|
|
69
|
-
args: {
|
|
70
|
-
...Docs.args,
|
|
71
|
-
grouped: _Grouped.left
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
export const Skeleton = {
|
|
75
|
-
render: Docs.render,
|
|
76
|
-
args: {
|
|
77
|
-
...Docs.args,
|
|
78
|
-
skeleton: true
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
export const Expanded = {
|
|
82
|
-
render: Docs.render,
|
|
83
|
-
args: {
|
|
84
|
-
...Docs.args,
|
|
85
|
-
expanded: true
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
export const InvalidPermission = {
|
|
89
|
-
render: Docs.render,
|
|
90
|
-
args: {
|
|
91
|
-
...Docs.args,
|
|
92
|
-
canSave: false
|
|
93
|
-
}
|
|
94
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './AntButton.types';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _AntButton = require("./AntButton.types");
|
|
7
|
-
Object.keys(_AntButton).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _AntButton[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _AntButton[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./AntButton.types.mjs";
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
withDefaults(defineProps<{
|
|
3
|
-
showDetail?: boolean;
|
|
4
|
-
}>(), {
|
|
5
|
-
showDetail: false,
|
|
6
|
-
});
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<template>
|
|
10
|
-
<div
|
|
11
|
-
class="flex w-full h-full"
|
|
12
|
-
data-e2e="crud"
|
|
13
|
-
>
|
|
14
|
-
<div
|
|
15
|
-
class="left-content h-full flex flex-col bg-base-300 gap-px overflow-hidden"
|
|
16
|
-
:class="{'w-[40rem]': showDetail, 'w-full': !showDetail}"
|
|
17
|
-
>
|
|
18
|
-
<div class="bg-white">
|
|
19
|
-
<slot name="search-section" />
|
|
20
|
-
</div>
|
|
21
|
-
|
|
22
|
-
<div class="bg-white grow h-px overflow-hidden">
|
|
23
|
-
<slot name="table-section" />
|
|
24
|
-
</div>
|
|
25
|
-
|
|
26
|
-
<div class="bg-white">
|
|
27
|
-
<slot name="table-nav-section" />
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
<Transition name="right-content">
|
|
32
|
-
<div
|
|
33
|
-
v-if="showDetail"
|
|
34
|
-
class="flex flex-col gap-px border-l border-base-300 overflow-hidden"
|
|
35
|
-
:class="{'w-full': showDetail}"
|
|
36
|
-
>
|
|
37
|
-
<slot />
|
|
38
|
-
</div>
|
|
39
|
-
</Transition>
|
|
40
|
-
</div>
|
|
41
|
-
</template>
|
|
42
|
-
|
|
43
|
-
<style scoped>
|
|
44
|
-
.left-content {
|
|
45
|
-
transition: width .5s ease-in-out, opacity .5s ease;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.right-content-enter-active {
|
|
49
|
-
transition: width .5s ease-in-out, opacity .5s ease .3s;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.right-content-enter-from {
|
|
53
|
-
width: 0;
|
|
54
|
-
opacity: 0;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.right-content-enter-to {
|
|
58
|
-
width: 100%;
|
|
59
|
-
opacity: 1;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.right-content-leave-active {
|
|
63
|
-
transition: width .5s ease-in-out, opacity .2s ease;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.right-content-leave-from {
|
|
67
|
-
width: 100%;
|
|
68
|
-
opacity: 1;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.right-content-leave-to {
|
|
72
|
-
width: 0;
|
|
73
|
-
opacity: 0;
|
|
74
|
-
}
|
|
75
|
-
</style>
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import AntButton from '../buttons/AntButton.vue';
|
|
3
|
-
import {
|
|
4
|
-
faAngleLeft,
|
|
5
|
-
} from '@fortawesome/free-solid-svg-icons';
|
|
6
|
-
import AntSaveAndNewButton from '../buttons/AntSaveAndNewButton.vue';
|
|
7
|
-
import AntSaveButton from '../buttons/AntSaveButton.vue';
|
|
8
|
-
|
|
9
|
-
defineEmits([
|
|
10
|
-
'back',
|
|
11
|
-
'save',
|
|
12
|
-
'save-and-new',
|
|
13
|
-
]);
|
|
14
|
-
withDefaults(defineProps<{
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
skeleton?: boolean;
|
|
17
|
-
canSave?: boolean;
|
|
18
|
-
}>(), {
|
|
19
|
-
disabled: false,
|
|
20
|
-
skeleton: false,
|
|
21
|
-
canSave: true,
|
|
22
|
-
});
|
|
23
|
-
</script>
|
|
24
|
-
|
|
25
|
-
<template>
|
|
26
|
-
<div
|
|
27
|
-
class="flex justify-between p-2 gap-2 bg-white"
|
|
28
|
-
data-e2e="crud-detail-actions"
|
|
29
|
-
>
|
|
30
|
-
<div class="flex gap-2.5">
|
|
31
|
-
<slot name="buttons-left">
|
|
32
|
-
<AntButton
|
|
33
|
-
:outlined="false"
|
|
34
|
-
:filled="false"
|
|
35
|
-
:icon-left="faAngleLeft"
|
|
36
|
-
:disabled="disabled"
|
|
37
|
-
:skeleton="skeleton"
|
|
38
|
-
@click="$emit('back')"
|
|
39
|
-
>
|
|
40
|
-
Back
|
|
41
|
-
</AntButton>
|
|
42
|
-
</slot>
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
<div class="flex gap-2.5">
|
|
46
|
-
<slot name="before-buttons-right" />
|
|
47
|
-
<slot name="buttons-right">
|
|
48
|
-
<AntSaveAndNewButton
|
|
49
|
-
:skeleton="skeleton"
|
|
50
|
-
:disabled="disabled"
|
|
51
|
-
:can-save="canSave"
|
|
52
|
-
@click="$emit('save-and-new')"
|
|
53
|
-
/>
|
|
54
|
-
|
|
55
|
-
<AntSaveButton
|
|
56
|
-
:skeleton="skeleton"
|
|
57
|
-
:disabled="disabled"
|
|
58
|
-
:can-save="canSave"
|
|
59
|
-
@click="$emit('save')"
|
|
60
|
-
/>
|
|
61
|
-
</slot>
|
|
62
|
-
<slot name="after-buttons-right" />
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
</template>
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
// TODO:: fix why tabs are not full height in story
|
|
3
|
-
import type {
|
|
4
|
-
TabItem,
|
|
5
|
-
} from '../tabs/__types/AntTabItem.types';
|
|
6
|
-
import AntTabs from '../tabs/AntTabs.vue';
|
|
7
|
-
import AntDeleteButton from '../buttons/AntDeleteButton.vue';
|
|
8
|
-
import AntDeleteDialog from '../dialogs/AntDeleteDialog.vue';
|
|
9
|
-
import {
|
|
10
|
-
ref,
|
|
11
|
-
} from 'vue';
|
|
12
|
-
import {
|
|
13
|
-
Position,
|
|
14
|
-
} from '../../enums';
|
|
15
|
-
|
|
16
|
-
defineEmits([
|
|
17
|
-
'delete',
|
|
18
|
-
]);
|
|
19
|
-
withDefaults(defineProps<{
|
|
20
|
-
tabItems?: TabItem[];
|
|
21
|
-
deleteButtonDisabled?: boolean;
|
|
22
|
-
getEntityName: () => string;
|
|
23
|
-
canDelete?: boolean;
|
|
24
|
-
showDeleteButton?: boolean;
|
|
25
|
-
skeleton?: boolean;
|
|
26
|
-
}>(), {
|
|
27
|
-
tabItems: () => [],
|
|
28
|
-
deleteButtonDisabled: false,
|
|
29
|
-
canDelete: true,
|
|
30
|
-
showDeleteButton: true,
|
|
31
|
-
skeleton: false,
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const dialogOpen = ref(false);
|
|
35
|
-
</script>
|
|
36
|
-
|
|
37
|
-
<template>
|
|
38
|
-
<div
|
|
39
|
-
class="flex justify-between items-stretch gap-2 bg-white h-[52px]"
|
|
40
|
-
data-e2e="crud-detail-nav"
|
|
41
|
-
>
|
|
42
|
-
<slot name="tabs">
|
|
43
|
-
<AntTabs
|
|
44
|
-
:tab-items="tabItems"
|
|
45
|
-
:skeleton="skeleton"
|
|
46
|
-
/>
|
|
47
|
-
</slot>
|
|
48
|
-
|
|
49
|
-
<div class="flex gap-2 pr-2 py-2">
|
|
50
|
-
<slot name="buttons">
|
|
51
|
-
<slot name="before-delete-button" />
|
|
52
|
-
|
|
53
|
-
<AntDeleteButton
|
|
54
|
-
v-if="showDeleteButton"
|
|
55
|
-
:disabled="deleteButtonDisabled || !canDelete"
|
|
56
|
-
:skeleton="skeleton"
|
|
57
|
-
:can-delete="canDelete"
|
|
58
|
-
:invalid-permission-tooltip-position="Position.left"
|
|
59
|
-
@click="() => dialogOpen = true"
|
|
60
|
-
/>
|
|
61
|
-
|
|
62
|
-
<slot name="after-delete-button" />
|
|
63
|
-
</slot>
|
|
64
|
-
</div>
|
|
65
|
-
|
|
66
|
-
<AntDeleteDialog
|
|
67
|
-
v-model:open="dialogOpen"
|
|
68
|
-
:entity="getEntityName()"
|
|
69
|
-
@confirm="$emit('delete')"
|
|
70
|
-
/>
|
|
71
|
-
</div>
|
|
72
|
-
</template>
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
// TODO:: This component works only with vue-router. Make it work in storybook.
|
|
3
|
-
import AntSearch from '../inputs/AntSearch.vue';
|
|
4
|
-
import AntCreateButton from '../buttons/AntCreateButton.vue';
|
|
5
|
-
import AntDropdown from '../AntDropdown.vue';
|
|
6
|
-
import {
|
|
7
|
-
computed, ref, watch,
|
|
8
|
-
} from 'vue';
|
|
9
|
-
import AntButton from '../buttons/AntButton.vue';
|
|
10
|
-
import {
|
|
11
|
-
faFilter, faMultiply,
|
|
12
|
-
} from '@fortawesome/free-solid-svg-icons';
|
|
13
|
-
import {
|
|
14
|
-
State, Grouped, Position,
|
|
15
|
-
} from '../../enums';
|
|
16
|
-
import {
|
|
17
|
-
useRoute, useRouter,
|
|
18
|
-
} from 'vue-router';
|
|
19
|
-
|
|
20
|
-
const props = withDefaults(defineProps<{
|
|
21
|
-
fullWidth?: boolean;
|
|
22
|
-
showFilter?: boolean;
|
|
23
|
-
showSearch?: boolean;
|
|
24
|
-
searchQuery?: string;
|
|
25
|
-
hasFilter?: boolean;
|
|
26
|
-
canCreate?: boolean;
|
|
27
|
-
skeleton?: boolean;
|
|
28
|
-
searchPlaceholderText?: string;
|
|
29
|
-
}>(), {
|
|
30
|
-
fullWidth: true,
|
|
31
|
-
showFilter: true,
|
|
32
|
-
showSearch: true,
|
|
33
|
-
searchQuery: 'search',
|
|
34
|
-
hasFilter: false,
|
|
35
|
-
canCreate: true,
|
|
36
|
-
skeleton: false,
|
|
37
|
-
searchPlaceholderText: 'Search',
|
|
38
|
-
});
|
|
39
|
-
const emit = defineEmits([
|
|
40
|
-
'search',
|
|
41
|
-
'create',
|
|
42
|
-
'removeFilter',
|
|
43
|
-
]);
|
|
44
|
-
const router = useRouter();
|
|
45
|
-
const route = useRoute();
|
|
46
|
-
|
|
47
|
-
const showDropdown = ref(false);
|
|
48
|
-
const _fullWidth = ref(props.fullWidth);
|
|
49
|
-
const search = computed({
|
|
50
|
-
get: () => route.query[props.searchQuery] as string || '',
|
|
51
|
-
set: (value) => {
|
|
52
|
-
const query = {
|
|
53
|
-
...route.query,
|
|
54
|
-
[props.searchQuery]: value,
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
if (!value) {
|
|
58
|
-
delete query[props.searchQuery];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
(async () => {
|
|
62
|
-
await router.replace({
|
|
63
|
-
...route,
|
|
64
|
-
query,
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
emit('search', value);
|
|
68
|
-
})();
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
watch(() => props.fullWidth, (val) => {
|
|
73
|
-
setTimeout(() => {
|
|
74
|
-
_fullWidth.value = val;
|
|
75
|
-
}, val ? 250 : 300);
|
|
76
|
-
});
|
|
77
|
-
</script>
|
|
78
|
-
|
|
79
|
-
<template>
|
|
80
|
-
<div
|
|
81
|
-
class="flex h-full items-center p-2 gap-2 bg-white"
|
|
82
|
-
data-e2e="crud-table-filter"
|
|
83
|
-
>
|
|
84
|
-
<div
|
|
85
|
-
class="flex gap-2.5 grow"
|
|
86
|
-
:class="{'grow': !_fullWidth}"
|
|
87
|
-
>
|
|
88
|
-
<div :class="{'w-80': _fullWidth, 'w-full': !_fullWidth}">
|
|
89
|
-
<slot name="filter">
|
|
90
|
-
<AntSearch
|
|
91
|
-
v-if="showSearch"
|
|
92
|
-
v-model="search"
|
|
93
|
-
:skeleton="skeleton"
|
|
94
|
-
:placeholder="searchPlaceholderText"
|
|
95
|
-
/>
|
|
96
|
-
</slot>
|
|
97
|
-
</div>
|
|
98
|
-
|
|
99
|
-
<AntDropdown
|
|
100
|
-
v-if="showFilter"
|
|
101
|
-
v-model:show-dropdown="showDropdown"
|
|
102
|
-
:position="Position.left"
|
|
103
|
-
>
|
|
104
|
-
<div class="flex">
|
|
105
|
-
<AntButton
|
|
106
|
-
:state="hasFilter ? State.info : State.base"
|
|
107
|
-
:grouped="hasFilter ? Grouped.left : Grouped.none"
|
|
108
|
-
:skeleton="skeleton"
|
|
109
|
-
:icon-left="faFilter"
|
|
110
|
-
@click="() => showDropdown = !showDropdown"
|
|
111
|
-
/>
|
|
112
|
-
|
|
113
|
-
<AntButton
|
|
114
|
-
v-if="hasFilter"
|
|
115
|
-
:state="State.info"
|
|
116
|
-
:grouped="Grouped.right"
|
|
117
|
-
:skeleton="skeleton"
|
|
118
|
-
:icon-left="faMultiply"
|
|
119
|
-
filled
|
|
120
|
-
@click="$emit('removeFilter')"
|
|
121
|
-
/>
|
|
122
|
-
</div>
|
|
123
|
-
|
|
124
|
-
<template #content>
|
|
125
|
-
<slot name="dropdownContent" />
|
|
126
|
-
</template>
|
|
127
|
-
</AntDropdown>
|
|
128
|
-
</div>
|
|
129
|
-
|
|
130
|
-
<div>
|
|
131
|
-
<slot name="buttons">
|
|
132
|
-
<AntCreateButton
|
|
133
|
-
:skeleton="skeleton"
|
|
134
|
-
:can-create="canCreate"
|
|
135
|
-
:invalid-permission-tooltip-position="Position.left"
|
|
136
|
-
@click="() => emit('create')"
|
|
137
|
-
/>
|
|
138
|
-
</slot>
|
|
139
|
-
</div>
|
|
140
|
-
</div>
|
|
141
|
-
</template>
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
/**
|
|
4
|
-
* TODO:: test me in storybook through vue router
|
|
5
|
-
* TODO:: fix ts errors
|
|
6
|
-
*/
|
|
7
|
-
import {
|
|
8
|
-
useRouter, useRoute,
|
|
9
|
-
} from 'vue-router';
|
|
10
|
-
import AntPagination from '../AntPagination.vue';
|
|
11
|
-
import {
|
|
12
|
-
computed, ref, watch,
|
|
13
|
-
} from 'vue';
|
|
14
|
-
import AntSelect from '../inputs/AntSelect.vue';
|
|
15
|
-
import AntSkeleton from '../AntSkeleton.vue';
|
|
16
|
-
import {
|
|
17
|
-
type SelectOption,
|
|
18
|
-
} from '../inputs/__types';
|
|
19
|
-
|
|
20
|
-
const emit = defineEmits([
|
|
21
|
-
'changeItemsPerPage',
|
|
22
|
-
'changePage',
|
|
23
|
-
]);
|
|
24
|
-
const props = withDefaults(
|
|
25
|
-
defineProps<{
|
|
26
|
-
count: number | null;
|
|
27
|
-
pageQuery?: string;
|
|
28
|
-
itemsPerPageQuery?: string;
|
|
29
|
-
fullWidth?: boolean;
|
|
30
|
-
validItemsPerPage?: number[];
|
|
31
|
-
skeleton?: boolean;
|
|
32
|
-
}>(),
|
|
33
|
-
{
|
|
34
|
-
pageQuery: 'p',
|
|
35
|
-
itemsPerPageQuery: 'ipp',
|
|
36
|
-
fullWidth: true,
|
|
37
|
-
validItemsPerPage: () => [
|
|
38
|
-
20,
|
|
39
|
-
50,
|
|
40
|
-
100,
|
|
41
|
-
200,
|
|
42
|
-
],
|
|
43
|
-
skeleton: false,
|
|
44
|
-
},
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
const route = useRoute();
|
|
48
|
-
const router = useRouter();
|
|
49
|
-
const itemsPerPageOptions = computed(() => props.validItemsPerPage.map(item => ({
|
|
50
|
-
label: `${item}`,
|
|
51
|
-
value: item,
|
|
52
|
-
}) as SelectOption));
|
|
53
|
-
const page = computed(() => {
|
|
54
|
-
const _page = route.query[props.pageQuery] >= 1 ? Number.parseInt(route.query[props.pageQuery]) : 1;
|
|
55
|
-
|
|
56
|
-
if (_page <= 0 || _page > pages.value) {
|
|
57
|
-
return 1;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return _page;
|
|
61
|
-
});
|
|
62
|
-
const itemsPerPage = computed({
|
|
63
|
-
get() {
|
|
64
|
-
return route.query[props.itemsPerPageQuery] ?
|
|
65
|
-
Number.parseInt(route.query[props.itemsPerPageQuery]) :
|
|
66
|
-
props.validItemsPerPage[0];
|
|
67
|
-
},
|
|
68
|
-
set(val) {
|
|
69
|
-
const query = {
|
|
70
|
-
...route.query,
|
|
71
|
-
};
|
|
72
|
-
query[props.itemsPerPageQuery] = `${val}`;
|
|
73
|
-
delete query[props.pageQuery];
|
|
74
|
-
|
|
75
|
-
(async () => {
|
|
76
|
-
await router.push({
|
|
77
|
-
...route,
|
|
78
|
-
query,
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
emit('changeItemsPerPage', val);
|
|
82
|
-
})();
|
|
83
|
-
},
|
|
84
|
-
});
|
|
85
|
-
const fromItems = computed(() => (itemsPerPage.value * (page.value - 1)) + 1);
|
|
86
|
-
const toItems = computed(() => {
|
|
87
|
-
const items = itemsPerPage.value * page.value;
|
|
88
|
-
|
|
89
|
-
if (page.value === pages.value && items > props.count) {
|
|
90
|
-
return props.count;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return itemsPerPage.value * page.value;
|
|
94
|
-
});
|
|
95
|
-
const pages = computed(() => Math.ceil(props.count / itemsPerPage.value));
|
|
96
|
-
const _fullWidth = ref(props.fullWidth);
|
|
97
|
-
|
|
98
|
-
watch(() => props.fullWidth, (val) => {
|
|
99
|
-
setTimeout(() => {
|
|
100
|
-
_fullWidth.value = val;
|
|
101
|
-
}, val ? 300 : 200);
|
|
102
|
-
});
|
|
103
|
-
</script>
|
|
104
|
-
|
|
105
|
-
<template>
|
|
106
|
-
<div
|
|
107
|
-
class="w-full"
|
|
108
|
-
data-e2e="crud-table-nav"
|
|
109
|
-
>
|
|
110
|
-
<div
|
|
111
|
-
class="flex w-full items-center p-2"
|
|
112
|
-
:class="{'justify-end': !_fullWidth, 'justify-between': _fullWidth}"
|
|
113
|
-
>
|
|
114
|
-
<div
|
|
115
|
-
v-if="_fullWidth"
|
|
116
|
-
class="flex gap-2 items-center text-for-white-bg-font text-sm"
|
|
117
|
-
data-e2e="items-per-page"
|
|
118
|
-
>
|
|
119
|
-
<span class="relative">
|
|
120
|
-
<AntSkeleton
|
|
121
|
-
v-if="skeleton"
|
|
122
|
-
rounded
|
|
123
|
-
absolute
|
|
124
|
-
/>
|
|
125
|
-
Items per page
|
|
126
|
-
</span>
|
|
127
|
-
|
|
128
|
-
<AntSelect
|
|
129
|
-
v-model="itemsPerPage"
|
|
130
|
-
:options="itemsPerPageOptions"
|
|
131
|
-
:skeleton="skeleton"
|
|
132
|
-
:expanded="false"
|
|
133
|
-
/>
|
|
134
|
-
|
|
135
|
-
<div
|
|
136
|
-
v-if="count !== null"
|
|
137
|
-
class="flex gap-1 relative"
|
|
138
|
-
>
|
|
139
|
-
<AntSkeleton
|
|
140
|
-
v-if="skeleton"
|
|
141
|
-
rounded
|
|
142
|
-
absolute
|
|
143
|
-
/>
|
|
144
|
-
|
|
145
|
-
<span class="font-medium">{{ fromItems }} - {{ toItems }}</span>
|
|
146
|
-
<span>of</span>
|
|
147
|
-
<span
|
|
148
|
-
class="font-medium"
|
|
149
|
-
data-e2e="total-items"
|
|
150
|
-
>{{ count }}</span>
|
|
151
|
-
</div>
|
|
152
|
-
</div>
|
|
153
|
-
|
|
154
|
-
<AntPagination
|
|
155
|
-
:pages="pages"
|
|
156
|
-
:page-query="pageQuery"
|
|
157
|
-
:skeleton="skeleton"
|
|
158
|
-
:light-version="!_fullWidth"
|
|
159
|
-
@input="(val) => emit('changePage', val)"
|
|
160
|
-
/>
|
|
161
|
-
</div>
|
|
162
|
-
</div>
|
|
163
|
-
</template>
|