File tree Expand file tree Collapse file tree 4 files changed +109
-4
lines changed
packages/components-vue/src Expand file tree Collapse file tree 4 files changed +109
-4
lines changed Original file line number Diff line number Diff line change 39
39
40
40
import type { iUseThemeProps } from " ../../types/props" ;
41
41
42
- type tDataPromise <Ti , Pi extends any []> = (... args : Pi ) => Promise <Ti >;
43
-
44
42
interface iLoaderContentFetchProps <Ti , Pi extends any []> extends iUseThemeProps {
45
43
/**
46
44
* Loader label
53
51
fallback? : Ti ;
54
52
unwrap? : boolean ;
55
53
url? : false | string ;
56
- promise? : false | tDataPromise < Ti , Pi > ;
57
- hydratablePromise? : false | ((hydrate : tHydrate <Ti >) => tDataPromise < Ti , Pi >);
54
+ promise? : false | (( ... args : Pi ) => Promise < Ti >) ;
55
+ hydratablePromise? : false | ((hydrate : tHydrate <Ti >) => ( ... args : Pi ) => Promise < Ti >);
58
56
payload? : Pi ;
59
57
/**
60
58
* Component or tag to render
Original file line number Diff line number Diff line change 42
42
43
43
<script setup lang="ts">
44
44
import { computed } from " vue" ;
45
+
45
46
import type { iInvalidInput } from " @open-xamu-co/ui-common-types" ;
46
47
import { FormInput , useForm , type iForm } from " @open-xamu-co/ui-common-helpers" ;
47
48
55
56
56
57
/**
57
58
* Modal with form stages
59
+ *
60
+ * @screen
58
61
*/
59
62
60
63
const stages = computed <iForm [][]>(() => {
Original file line number Diff line number Diff line change
1
+ import type { Meta , StoryObj } from "@storybook/vue3" ;
2
+
3
+ import PaginationContentWithTable from "./PaginationContentWithTable.vue" ;
4
+
5
+ const meta = {
6
+ title : "Screens/Pagination Content with Table" ,
7
+ component : PaginationContentWithTable as Record <
8
+ keyof typeof PaginationContentWithTable ,
9
+ unknown
10
+ > ,
11
+ args : { } ,
12
+ tags : [ "!autodocs" ] ,
13
+ } satisfies Meta < typeof PaginationContentWithTable > ;
14
+
15
+ type Story = StoryObj < typeof PaginationContentWithTable > ;
16
+
17
+ export const Sample : Story = {
18
+ args : { } ,
19
+ } ;
20
+
21
+ export default meta ;
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <PaginationContent
3
+ v-slot =" { content }"
4
+ :page =" page"
5
+ :transform =" getPageFromResponse"
6
+ with-route
7
+ class =" flx --flxColumn --flx-start-end --gap-5 --width"
8
+ >
9
+ <Table
10
+ :nodes =" content"
11
+ can-sort
12
+ :modal-props =" { theme: [eColors.LIGHT, eColors.SECONDARY], class: '--txtColor' }"
13
+ />
14
+ </PaginationContent >
15
+ </template >
16
+
17
+ <script setup lang="ts">
18
+ import type { iFormResponse , iPage , iPagination } from " @open-xamu-co/ui-common-types" ;
19
+ import { eColors } from " @open-xamu-co/ui-common-enums" ;
20
+
21
+ import PaginationContent from " ../components/pagination/Content.vue" ;
22
+ import Table from " ../components/table/Simple.vue" ;
23
+
24
+ export interface iSector {
25
+ id: number ;
26
+ categories: Record <string , any >[];
27
+ name: string ;
28
+ description: string ;
29
+ }
30
+
31
+ /**
32
+ * Pagination Content with Table
33
+ *
34
+ * @screen
35
+ */
36
+
37
+ const page = async (_params ? : iPagination ): Promise <iFormResponse <iPage <iSector , number >>> => {
38
+ const data = {
39
+ response: {
40
+ edges: [
41
+ {
42
+ cursor: 2 ,
43
+ node: {
44
+ id: 2 ,
45
+ name: " Agropecuario" ,
46
+ description: " Este es el sector agropecuario" ,
47
+ categories: [],
48
+ },
49
+ },
50
+ {
51
+ cursor: 1 ,
52
+ node: {
53
+ id: 1 ,
54
+ name: " Tecnológico" ,
55
+ description:
56
+ " Este sector incluye todo tipo de electrodomésticos y dispositivos." ,
57
+ categories: [],
58
+ },
59
+ },
60
+ ],
61
+ pageInfo: {
62
+ hasNextPage: false ,
63
+ hasPreviousPage: false ,
64
+ },
65
+ totalCount: 2 ,
66
+ },
67
+ invalidInputs: [],
68
+ withErrors: false ,
69
+ requestHadErrors: false ,
70
+ validationHadErrors: false ,
71
+ };
72
+
73
+ return new Promise ((resolve ) => {
74
+ setTimeout (() => {
75
+ resolve (data );
76
+ }, 3000 );
77
+ });
78
+ };
79
+
80
+ const getPageFromResponse = ({ response }: iFormResponse <iPage <iSector , number >>) => {
81
+ return response ;
82
+ };
83
+ </script >
You can’t perform that action at this time.
0 commit comments