@mouseless/baked 1.2.0 → 1.2.1
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/DataPanel.vue +1 -1
- package/dist/runtime/components/DataTable.vue +17 -3
- package/dist/runtime/components/Dialog.vue +1 -1
- package/dist/runtime/components/Fieldset.vue +1 -1
- package/dist/runtime/components/MenuPage.vue +1 -1
- package/dist/runtime/components/PageTitle.vue +1 -1
- package/dist/runtime/components/ServerPaginator.d.vue.ts +21 -0
- package/dist/runtime/components/ServerPaginator.vue +73 -0
- package/dist/runtime/components/ServerPaginator.vue.d.ts +21 -0
- package/dist/runtime/components/SideMenu.vue +1 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
<script setup>
|
|
84
84
|
import { computed, ref, useTemplateRef } from "vue";
|
|
85
85
|
import { Message, Panel, Button } from "primevue";
|
|
86
|
-
import { Bake, Inputs, PersistentPopover } from "#components";
|
|
87
86
|
import { useBreakpoints, useContext, useDataMounter, useUiStates, useLocalization } from "#imports";
|
|
87
|
+
import { Bake, Inputs, PersistentPopover } from "#components";
|
|
88
88
|
const { value: { panelStates } } = useUiStates();
|
|
89
89
|
const { isMd } = useBreakpoints();
|
|
90
90
|
const context = useContext();
|
|
@@ -22,6 +22,15 @@
|
|
|
22
22
|
<template #empty>
|
|
23
23
|
{{ lc("No records found") }}
|
|
24
24
|
</template>
|
|
25
|
+
<div
|
|
26
|
+
v-if="!paginator && serverPaginatorOptions"
|
|
27
|
+
class="flex w-full justify-end items-end"
|
|
28
|
+
>
|
|
29
|
+
<ServerPaginator
|
|
30
|
+
:schema="serverPaginatorOptions"
|
|
31
|
+
:data="data"
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
25
34
|
<Column
|
|
26
35
|
v-for="column in columns.filter(c => !c.hidden)"
|
|
27
36
|
:key="column.key"
|
|
@@ -147,8 +156,8 @@ import { computed, onMounted, ref } from "vue";
|
|
|
147
156
|
import Column from "primevue/column";
|
|
148
157
|
import { Button, ColumnGroup, DataTable, Menu, Row } from "primevue";
|
|
149
158
|
import { useRuntimeConfig } from "#app";
|
|
150
|
-
import { AwaitLoading, Bake, ProvideParentContext } from "#components";
|
|
151
159
|
import { useComposableResolver, useContext, useDataFetcher, useLocalization } from "#imports";
|
|
160
|
+
import { AwaitLoading, Bake, ProvideParentContext, ServerPaginator } from "#components";
|
|
152
161
|
const context = useContext();
|
|
153
162
|
const composableResolver = useComposableResolver();
|
|
154
163
|
const dataFetcher = useDataFetcher();
|
|
@@ -159,11 +168,16 @@ const { schema, data } = defineProps({
|
|
|
159
168
|
schema: { type: null, required: true },
|
|
160
169
|
data: { type: null, required: true }
|
|
161
170
|
});
|
|
162
|
-
const { actions, columns, dataKey, footerTemplate, itemsProp, paginator, rows, rowsWhenLoading, scrollHeight,
|
|
171
|
+
const { actions, columns, dataKey, footerTemplate, itemsProp, paginator, rows, rowsWhenLoading, scrollHeight, serverPaginatorOptions } = schema;
|
|
163
172
|
const exportOptions = schema.exportOptions && {
|
|
164
173
|
buttonIcon: "pi pi-download",
|
|
165
174
|
...schema.exportOptions
|
|
166
175
|
};
|
|
176
|
+
const virtualScrollerOptions = schema.virtualScrollerOptions && {
|
|
177
|
+
appendOnly: true,
|
|
178
|
+
numToleratedItems: 10,
|
|
179
|
+
...schema.exportOptions
|
|
180
|
+
};
|
|
167
181
|
const contextData = context.injectContextData();
|
|
168
182
|
const dataDescriptor = context.injectDataDescriptor();
|
|
169
183
|
const dataTable = ref();
|
|
@@ -227,5 +241,5 @@ function exportFunction({ data: data2, field }) {
|
|
|
227
241
|
</script>
|
|
228
242
|
|
|
229
243
|
<style>
|
|
230
|
-
.b-component--DataTable a{@apply text-sm}.b-component--DataTable .p-button{@apply -my-2}
|
|
244
|
+
.b-component--DataTable a{@apply text-sm}.b-component--DataTable .p-button{@apply -my-2}.b-component--DataTable .p-datatable-tbody td.p-datatable-frozen-column{z-index:1}
|
|
231
245
|
</style>
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
<script setup>
|
|
35
35
|
import { ref } from "vue";
|
|
36
36
|
import { Dialog } from "primevue";
|
|
37
|
-
import { Bake, Button } from "#components";
|
|
38
37
|
import { useLocalization } from "#imports";
|
|
38
|
+
import { Bake, Button } from "#components";
|
|
39
39
|
const { localize: l } = useLocalization();
|
|
40
40
|
const { schema } = defineProps({
|
|
41
41
|
schema: { type: Object, required: true }
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
|
|
28
28
|
<script setup>
|
|
29
29
|
import { Fieldset } from "primevue";
|
|
30
|
-
import { AwaitLoading, Bake } from "#components";
|
|
31
30
|
import { useLocalization } from "#imports";
|
|
31
|
+
import { AwaitLoading, Bake } from "#components";
|
|
32
32
|
const { localize: l } = useLocalization();
|
|
33
33
|
const { schema, data } = defineProps({
|
|
34
34
|
schema: { type: Object, required: true },
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
import { onBeforeUnmount, ref } from "vue";
|
|
53
53
|
import { Divider } from "primevue";
|
|
54
54
|
import { useRuntimeConfig } from "#app";
|
|
55
|
-
import { Bake } from "#components";
|
|
56
55
|
import { useContext, useLocalization } from "#imports";
|
|
56
|
+
import { Bake } from "#components";
|
|
57
57
|
const context = useContext();
|
|
58
58
|
const { localize: l } = useLocalization();
|
|
59
59
|
const { localize: lc } = useLocalization({ group: "MenuPage" });
|
|
@@ -138,8 +138,8 @@
|
|
|
138
138
|
import { onMounted, ref } from "vue";
|
|
139
139
|
import { Button } from "primevue";
|
|
140
140
|
import { useRuntimeConfig } from "#app";
|
|
141
|
-
import { Bake, PersistentPopover } from "#components";
|
|
142
141
|
import { useBreakpoints, useHead, useLocalization } from "#imports";
|
|
142
|
+
import { Bake, PersistentPopover } from "#components";
|
|
143
143
|
const { isMd } = useBreakpoints();
|
|
144
144
|
const { localize: l } = useLocalization();
|
|
145
145
|
const { public: { components } } = useRuntimeConfig();
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
schema: {
|
|
5
|
+
type: null;
|
|
6
|
+
required: true;
|
|
7
|
+
};
|
|
8
|
+
data: {
|
|
9
|
+
type: null;
|
|
10
|
+
required: true;
|
|
11
|
+
};
|
|
12
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
|
+
schema: {
|
|
14
|
+
type: null;
|
|
15
|
+
required: true;
|
|
16
|
+
};
|
|
17
|
+
data: {
|
|
18
|
+
type: null;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex items-center gap-1 justify-center">
|
|
3
|
+
<span class="text-sm mr-2 max-xs:hidden">{{ lc("Page {page}", { page }) }}</span>
|
|
4
|
+
<Button
|
|
5
|
+
rounded
|
|
6
|
+
variant="text"
|
|
7
|
+
icon="pi pi-chevron-left"
|
|
8
|
+
:disabled="page <= 1"
|
|
9
|
+
severity="secondary"
|
|
10
|
+
size="small"
|
|
11
|
+
@click="page--"
|
|
12
|
+
/>
|
|
13
|
+
<Button
|
|
14
|
+
rounded
|
|
15
|
+
variant="text"
|
|
16
|
+
icon="pi pi-chevron-right"
|
|
17
|
+
severity="secondary"
|
|
18
|
+
size="small"
|
|
19
|
+
:disabled="!allowNext"
|
|
20
|
+
@click="page++"
|
|
21
|
+
/>
|
|
22
|
+
<Bake
|
|
23
|
+
v-if="takeComponent && isXs"
|
|
24
|
+
v-model="take"
|
|
25
|
+
name="take"
|
|
26
|
+
:descriptor="takeComponent"
|
|
27
|
+
/>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script setup>
|
|
32
|
+
import { computed, ref, watch } from "vue";
|
|
33
|
+
import { Button } from "primevue";
|
|
34
|
+
import { useRoute, useRouter } from "#app";
|
|
35
|
+
import { useBreakpoints, useContext, useLocalization } from "#imports";
|
|
36
|
+
import { Bake } from "#components";
|
|
37
|
+
const route = useRoute();
|
|
38
|
+
const router = useRouter();
|
|
39
|
+
const { isXs } = useBreakpoints();
|
|
40
|
+
const context = useContext();
|
|
41
|
+
const { localize: lc } = useLocalization({ group: "ServerPaginator" });
|
|
42
|
+
const { schema, data } = defineProps({
|
|
43
|
+
schema: { type: null, required: true },
|
|
44
|
+
data: { type: null, required: true }
|
|
45
|
+
});
|
|
46
|
+
const { take: takeComponent, takeParameterName = "take", skipParameterName = "skip", pageChangeEventName = "page-changed" } = schema;
|
|
47
|
+
const events = context.injectEvents();
|
|
48
|
+
context.provideLoading(false);
|
|
49
|
+
const take = ref(Number(route.query[takeParameterName]) || 10);
|
|
50
|
+
const allowNext = computed(() => data?.length >= take.value);
|
|
51
|
+
const skip = computed(() => Number(route.query[skipParameterName]) || 0);
|
|
52
|
+
const page = computed({
|
|
53
|
+
get: () => skip.value / take.value + 1 || 1,
|
|
54
|
+
set: (value) => {
|
|
55
|
+
router.push({
|
|
56
|
+
query: {
|
|
57
|
+
...route.query,
|
|
58
|
+
[skipParameterName]: (value - 1) * take.value,
|
|
59
|
+
[takeParameterName]: take.value
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
watch(take, (newTake, oldTake) => {
|
|
65
|
+
if (oldTake === newTake) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
page.value = 1;
|
|
69
|
+
});
|
|
70
|
+
watch([() => route.query[skipParameterName], () => route.query[takeParameterName]], () => {
|
|
71
|
+
events.publish(pageChangeEventName, page.value);
|
|
72
|
+
});
|
|
73
|
+
</script>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
schema: {
|
|
5
|
+
type: null;
|
|
6
|
+
required: true;
|
|
7
|
+
};
|
|
8
|
+
data: {
|
|
9
|
+
type: null;
|
|
10
|
+
required: true;
|
|
11
|
+
};
|
|
12
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
|
+
schema: {
|
|
14
|
+
type: null;
|
|
15
|
+
required: true;
|
|
16
|
+
};
|
|
17
|
+
data: {
|
|
18
|
+
type: null;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -104,8 +104,8 @@
|
|
|
104
104
|
import { ref } from "vue";
|
|
105
105
|
import { RouterLink } from "vue-router";
|
|
106
106
|
import { Button, Skeleton } from "primevue";
|
|
107
|
-
import { Bake, Logo, PersistentPopover, SideMenuItem } from "#components";
|
|
108
107
|
import { useBreakpoints, useContext } from "#imports";
|
|
108
|
+
import { Bake, Logo, PersistentPopover, SideMenuItem } from "#components";
|
|
109
109
|
const { isMd } = useBreakpoints();
|
|
110
110
|
const context = useContext();
|
|
111
111
|
const { schema, data } = defineProps({
|