@katlux/block-ecommerce 0.1.1-alpha.94 → 0.1.1-alpha.95
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/runtime/components/KProductList/KProductList.d.vue.ts +15 -3
- package/dist/runtime/components/KProductList/KProductList.logic.d.ts +29 -1
- package/dist/runtime/components/KProductList/KProductList.logic.js +50 -4
- package/dist/runtime/components/KProductList/KProductList.vue +13 -3
- package/dist/runtime/components/KProductList/KProductList.vue.d.ts +15 -3
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -8,6 +8,8 @@ type __VLS_Props = {
|
|
|
8
8
|
gap?: string;
|
|
9
9
|
locale?: string;
|
|
10
10
|
emptyText?: string;
|
|
11
|
+
currentPage?: number;
|
|
12
|
+
pageSize?: number;
|
|
11
13
|
};
|
|
12
14
|
declare var __VLS_1: {
|
|
13
15
|
loading: true;
|
|
@@ -24,12 +26,22 @@ type __VLS_Slots = {} & {
|
|
|
24
26
|
} & {
|
|
25
27
|
default?: (props: typeof __VLS_5) => any;
|
|
26
28
|
};
|
|
27
|
-
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
30
|
+
"update:currentPage": (page: number) => any;
|
|
31
|
+
"update:pageSize": (size: number) => any;
|
|
32
|
+
"page-change": (page: number) => any;
|
|
33
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
34
|
+
"onUpdate:currentPage"?: ((page: number) => any) | undefined;
|
|
35
|
+
"onUpdate:pageSize"?: ((size: number) => any) | undefined;
|
|
36
|
+
"onPage-change"?: ((page: number) => any) | undefined;
|
|
37
|
+
}>, {
|
|
38
|
+
currentPage: number;
|
|
39
|
+
pageSize: number;
|
|
30
40
|
layout: "grid" | "list";
|
|
41
|
+
rowActions: KProductRowAction[];
|
|
31
42
|
gridColumns: number | string;
|
|
32
43
|
gap: string;
|
|
44
|
+
locale: string;
|
|
33
45
|
emptyText: string;
|
|
34
46
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
35
47
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -7,7 +7,15 @@ export interface KProductListProps {
|
|
|
7
7
|
gridColumns?: number | string;
|
|
8
8
|
gap?: string;
|
|
9
9
|
locale?: string;
|
|
10
|
+
emptyText?: string;
|
|
11
|
+
currentPage?: number;
|
|
12
|
+
pageSize?: number;
|
|
10
13
|
}
|
|
14
|
+
export type KProductListEmits = {
|
|
15
|
+
(e: 'update:currentPage', page: number): void;
|
|
16
|
+
(e: 'update:pageSize', size: number): void;
|
|
17
|
+
(e: 'page-change', page: number): void;
|
|
18
|
+
};
|
|
11
19
|
export declare const KProductListDefaultProps: {
|
|
12
20
|
dataProvider: {
|
|
13
21
|
type: PropType<ADataProvider>;
|
|
@@ -29,11 +37,31 @@ export declare const KProductListDefaultProps: {
|
|
|
29
37
|
type: StringConstructor;
|
|
30
38
|
default: string;
|
|
31
39
|
};
|
|
40
|
+
locale: {
|
|
41
|
+
type: StringConstructor;
|
|
42
|
+
default: undefined;
|
|
43
|
+
};
|
|
44
|
+
emptyText: {
|
|
45
|
+
type: StringConstructor;
|
|
46
|
+
default: undefined;
|
|
47
|
+
};
|
|
48
|
+
currentPage: {
|
|
49
|
+
type: NumberConstructor;
|
|
50
|
+
default: undefined;
|
|
51
|
+
};
|
|
52
|
+
pageSize: {
|
|
53
|
+
type: NumberConstructor;
|
|
54
|
+
default: undefined;
|
|
55
|
+
};
|
|
32
56
|
};
|
|
33
|
-
export declare function useKProductListLogic(props: KProductListProps): {
|
|
57
|
+
export declare function useKProductListLogic(props: KProductListProps, emit?: KProductListEmits): {
|
|
34
58
|
isGrid: import("vue").ComputedRef<boolean>;
|
|
35
59
|
pageRows: import("vue").ComputedRef<KProductItemData[]>;
|
|
36
60
|
loading: import("vue").Ref<boolean, boolean>;
|
|
37
61
|
initialLoad: import("vue").Ref<boolean, boolean>;
|
|
38
62
|
rowCount: import("vue").Ref<number, number>;
|
|
63
|
+
currentPage: import("vue").Ref<number, number>;
|
|
64
|
+
pageSize: import("vue").Ref<number, number>;
|
|
65
|
+
setCurrentPage: (page: number) => void;
|
|
66
|
+
setPageSize: (size: number) => void;
|
|
39
67
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed } from "vue";
|
|
1
|
+
import { computed, watch } from "vue";
|
|
2
2
|
import { useDataProvider } from "#toolkit/composables/useDataProvider";
|
|
3
3
|
export const KProductListDefaultProps = {
|
|
4
4
|
dataProvider: {
|
|
@@ -20,17 +20,63 @@ export const KProductListDefaultProps = {
|
|
|
20
20
|
gap: {
|
|
21
21
|
type: String,
|
|
22
22
|
default: "1rem"
|
|
23
|
+
},
|
|
24
|
+
locale: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: void 0
|
|
27
|
+
},
|
|
28
|
+
emptyText: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: void 0
|
|
31
|
+
},
|
|
32
|
+
currentPage: {
|
|
33
|
+
type: Number,
|
|
34
|
+
default: void 0
|
|
35
|
+
},
|
|
36
|
+
pageSize: {
|
|
37
|
+
type: Number,
|
|
38
|
+
default: void 0
|
|
23
39
|
}
|
|
24
40
|
};
|
|
25
|
-
export function useKProductListLogic(props) {
|
|
41
|
+
export function useKProductListLogic(props, emit) {
|
|
26
42
|
const isGrid = computed(() => props.layout !== "list");
|
|
27
|
-
const {
|
|
43
|
+
const {
|
|
44
|
+
pageData,
|
|
45
|
+
loading,
|
|
46
|
+
initialLoad,
|
|
47
|
+
rowCount,
|
|
48
|
+
currentPage: dpCurrentPage,
|
|
49
|
+
pageSize: dpPageSize,
|
|
50
|
+
setCurrentPage,
|
|
51
|
+
setPageSize
|
|
52
|
+
} = useDataProvider(() => props.dataProvider);
|
|
53
|
+
watch(() => props.currentPage, (val) => {
|
|
54
|
+
if (val !== void 0 && val !== dpCurrentPage.value) {
|
|
55
|
+
setCurrentPage(val);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
watch(() => props.pageSize, (val) => {
|
|
59
|
+
if (val !== void 0 && val !== dpPageSize.value) {
|
|
60
|
+
setPageSize(val);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
watch(dpCurrentPage, (val) => {
|
|
64
|
+
emit?.("update:currentPage", val);
|
|
65
|
+
emit?.("page-change", val);
|
|
66
|
+
});
|
|
67
|
+
watch(dpPageSize, (val) => {
|
|
68
|
+
emit?.("update:pageSize", val);
|
|
69
|
+
});
|
|
28
70
|
const pageRows = computed(() => pageData.value || []);
|
|
29
71
|
return {
|
|
30
72
|
isGrid,
|
|
31
73
|
pageRows,
|
|
32
74
|
loading,
|
|
33
75
|
initialLoad,
|
|
34
|
-
rowCount
|
|
76
|
+
rowCount,
|
|
77
|
+
currentPage: dpCurrentPage,
|
|
78
|
+
pageSize: dpPageSize,
|
|
79
|
+
setCurrentPage,
|
|
80
|
+
setPageSize
|
|
35
81
|
};
|
|
36
82
|
}
|
|
@@ -49,7 +49,14 @@
|
|
|
49
49
|
</template>
|
|
50
50
|
|
|
51
51
|
<div class="footer" v-if="!loading && pageRows.length > 0">
|
|
52
|
-
<KPagination
|
|
52
|
+
<KPagination
|
|
53
|
+
class="pagination"
|
|
54
|
+
:dataProvider="props.dataProvider"
|
|
55
|
+
:currentPage="props.currentPage"
|
|
56
|
+
:pageSize="props.pageSize"
|
|
57
|
+
@update:currentPage="emit('update:currentPage', $event)"
|
|
58
|
+
@update:pageSize="emit('update:pageSize', $event)"
|
|
59
|
+
/>
|
|
53
60
|
</div>
|
|
54
61
|
</div>
|
|
55
62
|
</template>
|
|
@@ -60,6 +67,7 @@ import { ADataProvider } from "@katlux/providers";
|
|
|
60
67
|
import { useKatluxI18n } from "#toolkit/composables/useKatluxI18n";
|
|
61
68
|
import { useKProductListLogic } from "./KProductList.logic";
|
|
62
69
|
const { t } = useKatluxI18n();
|
|
70
|
+
const emit = defineEmits(["update:currentPage", "update:pageSize", "page-change"]);
|
|
63
71
|
const props = defineProps({
|
|
64
72
|
dataProvider: { type: Object, required: true },
|
|
65
73
|
layout: { type: String, required: false, default: "grid" },
|
|
@@ -67,9 +75,11 @@ const props = defineProps({
|
|
|
67
75
|
gridColumns: { type: [Number, String], required: false, default: 4 },
|
|
68
76
|
gap: { type: String, required: false, default: "1rem" },
|
|
69
77
|
locale: { type: String, required: false, default: void 0 },
|
|
70
|
-
emptyText: { type: String, required: false, default: void 0 }
|
|
78
|
+
emptyText: { type: String, required: false, default: void 0 },
|
|
79
|
+
currentPage: { type: Number, required: false, default: void 0 },
|
|
80
|
+
pageSize: { type: Number, required: false, default: void 0 }
|
|
71
81
|
});
|
|
72
|
-
const { isGrid, pageRows, loading } = useKProductListLogic(props);
|
|
82
|
+
const { isGrid, pageRows, loading } = useKProductListLogic(props, emit);
|
|
73
83
|
const skeletonCount = computed(() => Number(props.gridColumns) || 4);
|
|
74
84
|
const containerVars = computed(() => ({
|
|
75
85
|
"--k-product-grid-cols": String(props.gridColumns),
|
|
@@ -8,6 +8,8 @@ type __VLS_Props = {
|
|
|
8
8
|
gap?: string;
|
|
9
9
|
locale?: string;
|
|
10
10
|
emptyText?: string;
|
|
11
|
+
currentPage?: number;
|
|
12
|
+
pageSize?: number;
|
|
11
13
|
};
|
|
12
14
|
declare var __VLS_1: {
|
|
13
15
|
loading: true;
|
|
@@ -24,12 +26,22 @@ type __VLS_Slots = {} & {
|
|
|
24
26
|
} & {
|
|
25
27
|
default?: (props: typeof __VLS_5) => any;
|
|
26
28
|
};
|
|
27
|
-
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
30
|
+
"update:currentPage": (page: number) => any;
|
|
31
|
+
"update:pageSize": (size: number) => any;
|
|
32
|
+
"page-change": (page: number) => any;
|
|
33
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
34
|
+
"onUpdate:currentPage"?: ((page: number) => any) | undefined;
|
|
35
|
+
"onUpdate:pageSize"?: ((size: number) => any) | undefined;
|
|
36
|
+
"onPage-change"?: ((page: number) => any) | undefined;
|
|
37
|
+
}>, {
|
|
38
|
+
currentPage: number;
|
|
39
|
+
pageSize: number;
|
|
30
40
|
layout: "grid" | "list";
|
|
41
|
+
rowActions: KProductRowAction[];
|
|
31
42
|
gridColumns: number | string;
|
|
32
43
|
gap: string;
|
|
44
|
+
locale: string;
|
|
33
45
|
emptyText: string;
|
|
34
46
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
35
47
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|