@mouseless/baked 1.1.4 → 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.
Files changed (40) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +1 -1
  3. package/dist/runtime/components/Bake.d.vue.ts +8 -2
  4. package/dist/runtime/components/Bake.vue +1 -1
  5. package/dist/runtime/components/Bake.vue.d.ts +8 -2
  6. package/dist/runtime/components/DataPanel.vue +4 -10
  7. package/dist/runtime/components/DataTable.vue +24 -6
  8. package/dist/runtime/components/Dialog.vue +1 -1
  9. package/dist/runtime/components/Error.vue +1 -1
  10. package/dist/runtime/components/ErrorPage.vue +6 -1
  11. package/dist/runtime/components/Fieldset.vue +1 -1
  12. package/dist/runtime/components/Filter.vue +11 -1
  13. package/dist/runtime/components/Input.vue +9 -14
  14. package/dist/runtime/components/Layout.vue +1 -1
  15. package/dist/runtime/components/MenuPage.vue +1 -1
  16. package/dist/runtime/components/Message.vue +1 -1
  17. package/dist/runtime/components/NavLink.vue +5 -17
  18. package/dist/runtime/components/Page.vue +1 -1
  19. package/dist/runtime/components/PageTitle.vue +1 -1
  20. package/dist/runtime/components/ServerPaginator.d.vue.ts +21 -0
  21. package/dist/runtime/components/ServerPaginator.vue +73 -0
  22. package/dist/runtime/components/ServerPaginator.vue.d.ts +21 -0
  23. package/dist/runtime/components/SideMenu.vue +7 -2
  24. package/dist/runtime/composables/useActionExecuter.js +1 -1
  25. package/dist/runtime/composables/useComposableResolver.js +1 -1
  26. package/dist/runtime/composables/useConstraintEvaluator.js +1 -1
  27. package/dist/runtime/composables/useDataFetcher.d.ts +1 -1
  28. package/dist/runtime/composables/useDataFetcher.js +41 -17
  29. package/dist/runtime/composables/useDataMounter.d.ts +5 -0
  30. package/dist/runtime/composables/useDataMounter.js +58 -0
  31. package/dist/runtime/composables/useEvents.d.ts +3 -5
  32. package/dist/runtime/composables/useEvents.js +14 -20
  33. package/dist/runtime/composables/useLoginRedirect.d.ts +1 -1
  34. package/dist/runtime/composables/useLoginRedirect.js +2 -2
  35. package/dist/runtime/composables/useNuxtError.d.ts +1 -1
  36. package/dist/runtime/composables/useNuxtError.js +2 -2
  37. package/dist/runtime/composables/useNuxtRoute.d.ts +1 -1
  38. package/dist/runtime/composables/useNuxtRoute.js +2 -2
  39. package/dist/runtime/plugins/baked.js +2 -2
  40. package/package.json +17 -17
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mouseless/baked",
3
3
  "configKey": "baked",
4
- "version": "1.1.4",
4
+ "version": "1.2.1",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -11,7 +11,7 @@ const module$1 = defineNuxtModule({
11
11
  defaults: {},
12
12
  moduleDependencies: {
13
13
  "@nuxtjs/i18n": {
14
- version: "10.2.1",
14
+ version: "10.2.3",
15
15
  defaults: {
16
16
  strategy: "no_prefix",
17
17
  detectBrowserLanguage: {
@@ -16,7 +16,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
16
16
  modelValue: {
17
17
  type: import("vue").PropType<any>;
18
18
  };
19
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
+ loaded: (...args: any[]) => void;
21
+ "update:modelValue": (value: any) => void;
22
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
20
23
  name: {
21
24
  type: StringConstructor;
22
25
  required: true;
@@ -28,7 +31,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
28
31
  modelValue: {
29
32
  type: import("vue").PropType<any>;
30
33
  };
31
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
34
+ }>> & Readonly<{
35
+ onLoaded?: ((...args: any[]) => any) | undefined;
36
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
37
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
32
38
  type __VLS_Slots = {
33
39
  default?: ((props: {}) => any) | undefined;
34
40
  };
@@ -31,7 +31,7 @@ const contextData = context.injectContextData();
31
31
  const component = componentResolver.resolve(descriptor.type, "MissingComponent");
32
32
  const componentProps = buildComponentProps();
33
33
  const data = ref(dataFetcher.get({ data: descriptor.data, contextData }));
34
- const shouldLoad = dataFetcher.shouldLoad(descriptor.data?.type);
34
+ const shouldLoad = dataFetcher.shouldLoad(descriptor.data);
35
35
  const loading = ref(shouldLoad);
36
36
  const executing = ref(false);
37
37
  const visible = ref(true);
@@ -16,7 +16,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
16
16
  modelValue: {
17
17
  type: import("vue").PropType<any>;
18
18
  };
19
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
+ loaded: (...args: any[]) => void;
21
+ "update:modelValue": (value: any) => void;
22
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
20
23
  name: {
21
24
  type: StringConstructor;
22
25
  required: true;
@@ -28,7 +31,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
28
31
  modelValue: {
29
32
  type: import("vue").PropType<any>;
30
33
  };
31
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
34
+ }>> & Readonly<{
35
+ onLoaded?: ((...args: any[]) => any) | undefined;
36
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
37
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
32
38
  type __VLS_Slots = {
33
39
  default?: ((props: {}) => any) | undefined;
34
40
  };
@@ -81,14 +81,14 @@
81
81
  </template>
82
82
 
83
83
  <script setup>
84
- import { computed, onMounted, ref, useTemplateRef } from "vue";
84
+ import { computed, ref, useTemplateRef } from "vue";
85
85
  import { Message, Panel, Button } from "primevue";
86
+ import { useBreakpoints, useContext, useDataMounter, useUiStates, useLocalization } from "#imports";
86
87
  import { Bake, Inputs, PersistentPopover } from "#components";
87
- import { useBreakpoints, useContext, useDataFetcher, useUiStates, useLocalization } from "#imports";
88
88
  const { value: { panelStates } } = useUiStates();
89
89
  const { isMd } = useBreakpoints();
90
90
  const context = useContext();
91
- const dataFetcher = useDataFetcher();
91
+ const { mount: mountData } = useDataMounter();
92
92
  const { localize: l } = useLocalization();
93
93
  const { localize: lc } = useLocalization({ group: "DataPanel" });
94
94
  const panel = useTemplateRef("panel");
@@ -107,13 +107,7 @@ const values = ref({});
107
107
  if (inputs.length > 0) {
108
108
  contextData.parent["parameters"] = values;
109
109
  }
110
- const title = ref(dataFetcher.get({ data: titleData, contextData }));
111
- const shouldLoadTitle = dataFetcher.shouldLoad(titleData.type);
112
- onMounted(async () => {
113
- if (shouldLoadTitle) {
114
- title.value = await dataFetcher.fetch({ data: titleData, contextData });
115
- }
116
- });
110
+ const title = mountData(titleData);
117
111
  function togglePopover(event) {
118
112
  popover.value.toggle(event);
119
113
  }
@@ -22,8 +22,17 @@
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
- v-for="column in columns"
35
+ v-for="column in columns.filter(c => !c.hidden)"
27
36
  :key="column.key"
28
37
  :header="l(column.title)"
29
38
  :field="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,7 +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, exportOptions, footerTemplate, itemsProp, paginator, rows, rowsWhenLoading, scrollHeight, virtualScrollerOptions } = schema;
171
+ const { actions, columns, dataKey, footerTemplate, itemsProp, paginator, rows, rowsWhenLoading, scrollHeight, serverPaginatorOptions } = schema;
172
+ const exportOptions = schema.exportOptions && {
173
+ buttonIcon: "pi pi-download",
174
+ ...schema.exportOptions
175
+ };
176
+ const virtualScrollerOptions = schema.virtualScrollerOptions && {
177
+ appendOnly: true,
178
+ numToleratedItems: 10,
179
+ ...schema.exportOptions
180
+ };
163
181
  const contextData = context.injectContextData();
164
182
  const dataDescriptor = context.injectDataDescriptor();
165
183
  const dataTable = ref();
@@ -196,11 +214,11 @@ onMounted(async () => {
196
214
  parameterFormatter: parameterFormatterName
197
215
  } = exportOptions;
198
216
  if (formatterName) {
199
- formatter = (await composableResolver.resolve(formatterName)).default();
217
+ formatter = composableResolver.resolve(formatterName).default();
200
218
  }
201
219
  let parameterFormatter = null;
202
220
  if (parameterFormatterName) {
203
- parameterFormatter = (await composableResolver.resolve(parameterFormatterName)).default();
221
+ parameterFormatter = composableResolver.resolve(parameterFormatterName).default();
204
222
  }
205
223
  if (appendParameters && dataDescriptor) {
206
224
  let parameters = await dataFetcher.fetchParameters({ data: dataDescriptor, contextData });
@@ -223,5 +241,5 @@ function exportFunction({ data: data2, field }) {
223
241
  </script>
224
242
 
225
243
  <style>
226
- .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}
227
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 }
@@ -14,6 +14,6 @@ import { Bake } from "#components";
14
14
  const context = useContext();
15
15
  const events = useEvents();
16
16
  const { public: { error } } = useRuntimeConfig();
17
- context.provideEvents(events.create());
17
+ context.provideEvents(events);
18
18
  context.providePageContext(reactive({}));
19
19
  </script>
@@ -56,7 +56,12 @@ const { schema, data } = defineProps({
56
56
  schema: { type: null, required: true },
57
57
  data: { type: null, default: null }
58
58
  });
59
- const { errorInfos, footerInfo, safeLinks, safeLinksMessage } = schema;
59
+ const {
60
+ errorInfos,
61
+ footerInfo = "If you cannot reach the page you want please contact the system administrator",
62
+ safeLinks,
63
+ safeLinksMessage = "Try the links from the menu below to view the page you want to access:"
64
+ } = schema;
60
65
  const statusCode = computed(() => {
61
66
  const code = data.value?.data?.status ?? data.value?.statusCode ?? 999;
62
67
  return code === 999 ? "APP" : code;
@@ -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 },
@@ -10,6 +10,7 @@
10
10
  </template>
11
11
 
12
12
  <script setup>
13
+ import { watch } from "vue";
13
14
  import { IconField, InputIcon, InputText } from "primevue";
14
15
  import { useLocalization } from "#imports";
15
16
  const { localize: l } = useLocalization();
@@ -17,5 +18,14 @@ const { schema } = defineProps({
17
18
  schema: { type: null, required: true }
18
19
  });
19
20
  const model = defineModel({ type: null, required: true });
20
- const { placeholder } = schema;
21
+ const { placeholder, whiteSpaceSensitive } = schema;
22
+ watch(model, (newValue, oldValue) => {
23
+ if (newValue === oldValue) {
24
+ return;
25
+ }
26
+ if (whiteSpaceSensitive) {
27
+ return;
28
+ }
29
+ model.value = newValue.trim();
30
+ });
21
31
  </script>
@@ -7,37 +7,32 @@
7
7
  </template>
8
8
 
9
9
  <script setup>
10
- import { computed, onMounted, watch } from "vue";
10
+ import { computed, watch } from "vue";
11
11
  import { useRoute, useRouter } from "#app";
12
- import { useContext, useDataFetcher } from "#imports";
12
+ import { useDataMounter } from "#imports";
13
13
  import { Bake } from "#components";
14
- const context = useContext();
15
- const dataFetcher = useDataFetcher();
14
+ const { mount: mountData, onAfterMount: onAfterMountData } = useDataMounter();
16
15
  const route = useRoute();
17
16
  const router = useRouter();
18
17
  const { schema } = defineProps({
19
18
  schema: { type: Object, required: true }
20
19
  });
21
20
  const model = defineModel({ type: null, required: true });
22
- const contextData = context.injectContextData();
23
- let defaultValue = schema.default ? dataFetcher.get({ data: schema.default, contextData }) : void 0;
21
+ const defaultValue = mountData(schema.default);
24
22
  const query = schema.queryBound ? computed(() => route.query[schema.name]) : void 0;
25
- onMounted(async () => {
26
- if (schema.default && dataFetcher.shouldLoad(schema.default.type)) {
27
- defaultValue = await dataFetcher.fetch({ data: schema.default, contextData });
28
- }
23
+ onAfterMountData(async () => {
29
24
  if (!checkValue(model.value)) {
30
25
  if (schema.queryBound && checkValue(query.value)) {
31
26
  model.value = query.value;
32
27
  } else {
33
- await set(defaultValue);
28
+ await set(defaultValue.value);
34
29
  }
35
30
  }
36
31
  if (schema.queryBound) {
37
32
  watch(() => route.query, async (newQuery) => {
38
33
  const newValue = newQuery[schema.name];
39
- if (!checkValue(newValue) && schema.required && defaultValue) {
40
- await set(defaultValue);
34
+ if (!checkValue(newValue) && schema.required && defaultValue.value) {
35
+ await set(defaultValue.value);
41
36
  return;
42
37
  }
43
38
  model.value = newValue;
@@ -45,7 +40,7 @@ onMounted(async () => {
45
40
  }
46
41
  watch(model, async (newValue) => {
47
42
  if (!checkValue(newValue)) {
48
- newValue = schema.required ? defaultValue : void 0;
43
+ newValue = schema.required ? defaultValue.value : void 0;
49
44
  }
50
45
  await set(newValue);
51
46
  });
@@ -23,7 +23,7 @@ const events = useEvents();
23
23
  const layouts = useLayouts();
24
24
  const pages = usePages();
25
25
  const route = useRoute();
26
- context.provideEvents(events.create());
26
+ context.provideEvents(events);
27
27
  context.providePageContext(reactive({}));
28
28
  const descriptor = ref(await findLayout(route.matched[0].name));
29
29
  watch(
@@ -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" });
@@ -25,5 +25,5 @@ const { schema, data } = defineProps({
25
25
  schema: { type: null, required: true },
26
26
  data: { type: null, required: true }
27
27
  });
28
- const { icon, severity, localizeMessage } = schema;
28
+ const { icon, severity = "info", localizeMessage } = schema;
29
29
  </script>
@@ -12,33 +12,21 @@
12
12
  </template>
13
13
 
14
14
  <script setup>
15
- import { computed, onMounted, ref } from "vue";
15
+ import { computed } from "vue";
16
16
  import { Button } from "primevue";
17
- import { useContext, useDataFetcher, usePathBuilder } from "#imports";
17
+ import { useDataMounter, usePathBuilder } from "#imports";
18
18
  import { AwaitLoading } from "#components";
19
- const context = useContext();
20
- const dataFetcher = useDataFetcher();
19
+ const { mount: mountData } = useDataMounter();
21
20
  const pathBuilder = usePathBuilder();
22
21
  const { schema, data } = defineProps({
23
22
  schema: { type: null, required: true },
24
23
  data: { type: null, required: true }
25
24
  });
26
25
  const { icon, path, query: queryData, params: paramsData } = schema;
27
- const contextData = context.injectContextData();
28
- const query = ref(queryData ? dataFetcher.get({ data: queryData, contextData }) : null);
29
- const shouldLoadQuery = queryData ? dataFetcher.shouldLoad(queryData.type) : false;
30
- const params = ref(paramsData ? dataFetcher.get({ data: paramsData, contextData }) : null);
31
- const shouldLoadParams = paramsData ? dataFetcher.shouldLoad(paramsData.type) : false;
26
+ const query = mountData(queryData);
27
+ const params = mountData(paramsData);
32
28
  const to = computed(() => ({
33
29
  path: params.value ? pathBuilder.build(path, params.value, { forRoute: true }) : path,
34
30
  query: query.value
35
31
  }));
36
- onMounted(async () => {
37
- if (shouldLoadQuery) {
38
- query.value = await dataFetcher.fetch({ data: queryData, contextData });
39
- }
40
- if (shouldLoadParams) {
41
- params.value = await dataFetcher.fetch({ data: paramsData, contextData });
42
- }
43
- });
44
32
  </script>
@@ -18,7 +18,7 @@ const pages = usePages();
18
18
  const route = useRoute();
19
19
  const { public: { components } } = useRuntimeConfig();
20
20
  useHead({ title: components?.Page?.title });
21
- context.provideEvents(events.create());
21
+ context.provideEvents(events);
22
22
  context.providePageContext(reactive({}));
23
23
  const name = route.matched[0].name;
24
24
  const className = name.replace("[", "").replace("]", "");
@@ -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,15 +104,20 @@
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({
112
112
  schema: { type: null, required: true },
113
113
  data: { type: null, required: true }
114
114
  });
115
- const { logo, largeLogo, menu, footer } = schema;
115
+ const {
116
+ logo = "logo.svg",
117
+ largeLogo = "logo-full.svg",
118
+ menu,
119
+ footer
120
+ } = schema;
116
121
  const loading = context.injectLoading();
117
122
  const popover = ref();
118
123
  function togglePopover(event) {
@@ -37,7 +37,7 @@ function Local() {
37
37
  const dataFetcher = useDataFetcher();
38
38
 
39
39
  async function execute({ action, contextData }) {
40
- const composable = (await composableResolver.resolve(action.composable)).default();
40
+ const composable = composableResolver.resolve(action.composable).default();
41
41
 
42
42
  if(composable.run) {
43
43
  const options = action.options ? await dataFetcher.fetch({ data: action.options, contextData }) : { };
@@ -6,7 +6,7 @@ export default function() {
6
6
  function resolve(name) {
7
7
  if(!$composables[name]) { throw new Error(`Cannot resolve composable '${name}'`); }
8
8
 
9
- return $composables[name]();
9
+ return $composables[name];
10
10
  }
11
11
 
12
12
  return {
@@ -26,7 +26,7 @@ function Composable() {
26
26
 
27
27
  async function evaluate({ constraint, value, contextData }) {
28
28
  const options = constraint.options ? await dataFetcher.fetch({ data: constraint.options, contextData }) : { };
29
- const composable = (await composableResolver.resolve(constraint.composable)).default(options);
29
+ const composable = composableResolver.resolve(constraint.composable).default(options);
30
30
  if(!composable.validate) { throw new Error("Constraint composable should have `validate`"); }
31
31
 
32
32
  return composable.validate(value);
@@ -1,5 +1,5 @@
1
1
  export default function _default(): {
2
- shouldLoad: (dataType: any) => boolean;
2
+ shouldLoad: (data: any) => any;
3
3
  get: ({ data, contextData }: {
4
4
  data: any;
5
5
  contextData: any;
@@ -3,15 +3,19 @@ import { useComposableResolver, usePathBuilder, useUnref } from "#imports";
3
3
 
4
4
  export default function() {
5
5
  const datas = {
6
- "Composite": Composite({ parentFetch: fetch, parentFetchParameters: fetchParameters }),
7
- "Computed": Computed({ parentFetch: fetch }),
6
+ "Composite": Composite({ parentGet: get, parentFetch: fetch, parentFetchParameters: fetchParameters }),
7
+ "Computed": Computed({ parentGet: get, parentFetch: fetch }),
8
8
  "Context": Context(),
9
9
  "Inline": Inline(),
10
10
  "Remote": Remote({ parentFetch: fetch })
11
11
  };
12
12
 
13
- function shouldLoad(dataType) {
14
- return datas[dataType]?.fetch !== undefined;
13
+ function shouldLoad(data) {
14
+ if(!data) { return false; }
15
+
16
+ return data.isAsync === undefined
17
+ ? !!datas[data.type]?.isAsync
18
+ : data.isAsync;
15
19
  }
16
20
 
17
21
  function get({ data, contextData }) {
@@ -19,6 +23,7 @@ export default function() {
19
23
  if(!type) { return null; }
20
24
  if(!datas[type]) { return null; }
21
25
  if(!datas[type].get) { return null; }
26
+ if(shouldLoad(data)) { return null; }
22
27
 
23
28
  return datas[type].get({ data, contextData });
24
29
  }
@@ -27,7 +32,7 @@ export default function() {
27
32
  const fetcher = datas[data?.type];
28
33
  if(!fetcher) { throw new Error(`${data?.type} is not a valid data type`); }
29
34
 
30
- return fetcher.get
35
+ return fetcher.get && !shouldLoad(data)
31
36
  ? fetcher.get({ data, contextData })
32
37
  : await fetcher.fetch({ data, contextData });
33
38
  }
@@ -48,9 +53,22 @@ export default function() {
48
53
  };
49
54
  }
50
55
 
51
- function Composite({ parentFetch, parentFetchParameters }) {
56
+ function Composite({ parentGet, parentFetch, parentFetchParameters }) {
52
57
  const unref = useUnref();
53
58
 
59
+ function get({ data, contextData }) {
60
+ const result = {};
61
+
62
+ for(const part of data.parts) {
63
+ Object.assign(
64
+ result,
65
+ unref.deepUnref(parentGet({ data: part, contextData }))
66
+ );
67
+ }
68
+
69
+ return result;
70
+ }
71
+
54
72
  async function fetch({ data, contextData }) {
55
73
  const result = {};
56
74
 
@@ -77,28 +95,29 @@ function Composite({ parentFetch, parentFetchParameters }) {
77
95
  }
78
96
 
79
97
  return {
98
+ isAsync: false,
99
+ get,
80
100
  fetch,
81
101
  fetchParameters
82
102
  };
83
103
  }
84
104
 
85
- function Computed({ parentFetch }) {
105
+ function Computed({ parentGet, parentFetch }) {
86
106
  const composableResolver = useComposableResolver();
87
107
  const unref = useUnref();
88
108
 
89
- async function fetch({ data, contextData }) {
90
- const composable = (await composableResolver.resolve(data.composable)).default();
91
- const options = data.options ? unref.deepUnref(await parentFetch({ data: data.options, contextData })) : { };
109
+ function get({ data, contextData }) {
110
+ const composable = composableResolver.resolve(data.composable).default();
111
+ const options = data.options ? unref.deepUnref(parentGet({ data: data.options, contextData })) : { };
92
112
 
93
- if(composable.computeSync) {
94
- return composable.computeSync(options);
95
- }
113
+ return composable.compute(options);
114
+ }
96
115
 
97
- if(composable.compute) {
98
- return await composable.compute(options);
99
- }
116
+ async function fetch({ data, contextData }) {
117
+ const composable = composableResolver.resolve(data.composable).default();
118
+ const options = data.options ? unref.deepUnref(await parentFetch({ data: data.options, contextData })) : { };
100
119
 
101
- throw new Error("Data composable should have either `computeSync` or `compute`");
120
+ return await composable.compute(options);
102
121
  }
103
122
 
104
123
  async function fetchParameters({ data }) {
@@ -106,6 +125,8 @@ function Computed({ parentFetch }) {
106
125
  }
107
126
 
108
127
  return {
128
+ isAsync: false,
129
+ get,
109
130
  fetch,
110
131
  fetchParameters
111
132
  };
@@ -136,6 +157,7 @@ function Context() {
136
157
  }
137
158
 
138
159
  return {
160
+ isAsync: false,
139
161
  get
140
162
  };
141
163
  }
@@ -146,6 +168,7 @@ function Inline() {
146
168
  }
147
169
 
148
170
  return {
171
+ isAsync: false,
149
172
  get
150
173
  };
151
174
  }
@@ -223,6 +246,7 @@ function Remote({ parentFetch }) {
223
246
  }
224
247
 
225
248
  return {
249
+ isAsync: true,
226
250
  fetch,
227
251
  fetchParameters
228
252
  };
@@ -0,0 +1,5 @@
1
+ export default function _default(): {
2
+ mount: (schema: any) => import("vue").Ref<null, null>;
3
+ onAfterMount: (callback: any) => void;
4
+ onBeforeMount: (callback: any) => void;
5
+ };
@@ -0,0 +1,58 @@
1
+ import { onMounted, ref } from "vue";
2
+ import { useContext, useDataFetcher } from "#imports";
3
+
4
+ export default function() {
5
+ const context = useContext();
6
+ const dataFetcher = useDataFetcher();
7
+ const contextData = context.injectContextData();
8
+ const mounts = [];
9
+ let onAfterMountCallback = null;
10
+ let onBeforeMountCallback = null;
11
+
12
+ onMounted(async() => {
13
+ if(onBeforeMountCallback) {
14
+ await onBeforeMountCallback();
15
+ }
16
+
17
+ await Promise.all(
18
+ mounts.map(async({ value, schema }) => {
19
+ value.value = await dataFetcher.fetch({ data: schema, contextData });
20
+ })
21
+ );
22
+
23
+ if(onAfterMountCallback) {
24
+ await onAfterMountCallback();
25
+ }
26
+ });
27
+
28
+ function mount(schema) {
29
+ const value = ref(null);
30
+
31
+ if(!schema) {
32
+ return value;
33
+ }
34
+
35
+ value.value = dataFetcher.get({ data: schema, contextData });
36
+
37
+ const shouldLoad = dataFetcher.shouldLoad(schema);
38
+ if(shouldLoad) {
39
+ mounts.push({ value, schema });
40
+ }
41
+
42
+ return value;
43
+ }
44
+
45
+ function onAfterMount(callback) {
46
+ onAfterMountCallback = callback;
47
+ }
48
+
49
+ function onBeforeMount(callback) {
50
+ onBeforeMountCallback = callback;
51
+ }
52
+
53
+ return {
54
+ mount,
55
+ onAfterMount,
56
+ onBeforeMount
57
+ };
58
+ }
@@ -1,7 +1,5 @@
1
1
  export default function _default(): {
2
- create: () => {
3
- on: (name: any, id: any, callback: any) => void;
4
- off: (name: any, id: any) => void;
5
- publish: (name: any, value: any) => Promise<void>;
6
- };
2
+ on: (name: any, id: any, callback: any) => void;
3
+ off: (name: any, id: any) => void;
4
+ publish: (name: any, value: any) => Promise<void>;
7
5
  };
@@ -1,33 +1,27 @@
1
1
  export default function() {
2
2
  const listeners = {};
3
3
 
4
- function create() {
5
- function on(name, id, callback) {
6
- listeners[name] ||= {};
4
+ function on(name, id, callback) {
5
+ listeners[name] ||= {};
7
6
 
8
- listeners[name][id] = callback;
9
- }
7
+ listeners[name][id] = callback;
8
+ }
10
9
 
11
- function off(name, id) {
12
- delete listeners[name][id];
13
- }
10
+ function off(name, id) {
11
+ delete listeners[name][id];
12
+ }
14
13
 
15
- async function publish(name, value) {
16
- if(!listeners[name]) { return; }
14
+ async function publish(name, value) {
15
+ if(!listeners[name]) { return; }
17
16
 
18
- for(const id in listeners[name]) {
19
- listeners[name][id](value);
20
- }
17
+ for(const id in listeners[name]) {
18
+ listeners[name][id](value);
21
19
  }
22
-
23
- return {
24
- on,
25
- off,
26
- publish
27
- };
28
20
  }
29
21
 
30
22
  return {
31
- create
23
+ on,
24
+ off,
25
+ publish
32
26
  };
33
27
  }
@@ -1,3 +1,3 @@
1
1
  export default function _default(): {
2
- computeSync: () => string;
2
+ compute: () => string;
3
3
  };
@@ -3,13 +3,13 @@ import { useRoute, useRuntimeConfig } from "#app";
3
3
  export default function() {
4
4
  const { public: { auth } } = useRuntimeConfig();
5
5
 
6
- function computeSync() {
6
+ function compute() {
7
7
  const route = useRoute();
8
8
 
9
9
  return `/${auth.loginPageRoute}?redirect=${route.fullPath}`;
10
10
  }
11
11
 
12
12
  return {
13
- computeSync
13
+ compute
14
14
  };
15
15
  }
@@ -1,3 +1,3 @@
1
1
  export default function _default(): {
2
- computeSync: () => import("vue").Ref<import("#app").NuxtError<unknown> | undefined, import("#app").NuxtError<unknown> | undefined>;
2
+ compute: () => import("vue").Ref<import("#app").NuxtError<unknown> | undefined, import("#app").NuxtError<unknown> | undefined>;
3
3
  };
@@ -3,11 +3,11 @@ import { useError } from "#app";
3
3
  export default function() {
4
4
  const error = useError();
5
5
 
6
- function computeSync() {
6
+ function compute() {
7
7
  return error;
8
8
  }
9
9
 
10
10
  return {
11
- computeSync
11
+ compute
12
12
  };
13
13
  }
@@ -1,3 +1,3 @@
1
1
  export default function _default(): {
2
- computeSync: ({ property }?: {}) => any;
2
+ compute: ({ property }?: {}) => any;
3
3
  };
@@ -3,11 +3,11 @@ import { useRoute } from "#app";
3
3
  export default function() {
4
4
  const route = useRoute();
5
5
 
6
- function computeSync({ property } = {}) {
6
+ function compute({ property } = {}) {
7
7
  return property ? route[property] : route;
8
8
  }
9
9
 
10
10
  return {
11
- computeSync
11
+ compute
12
12
  };
13
13
  }
@@ -3,8 +3,8 @@ import { defineNuxtPlugin } from "#app";
3
3
  export default defineNuxtPlugin({
4
4
  name: "baked",
5
5
  setup() {
6
- const bakedComposables = import.meta.glob("../composables/*");
7
- const projectComposables = import.meta.glob("@/composables/*");
6
+ const bakedComposables = import.meta.glob("../composables/*", { eager: true });
7
+ const projectComposables = import.meta.glob("@/composables/*", { eager: true });
8
8
 
9
9
  const pages = import.meta.glob("@@/.baked/**/*.page.json");
10
10
  const layouts = import.meta.glob("@@/.baked/**/*.layout.json");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mouseless/baked",
3
- "version": "1.1.4",
3
+ "version": "1.2.1",
4
4
  "description": "Baked is an opinionated framework for .NET and Vue. This is the UI package of Baked project.",
5
5
  "keywords": [
6
6
  "baked",
@@ -43,32 +43,32 @@
43
43
  "lint": "eslint ."
44
44
  },
45
45
  "dependencies": {
46
- "@nuxtjs/i18n": "10.2.1",
46
+ "@nuxtjs/i18n": "10.2.3",
47
47
  "@nuxtjs/tailwindcss": "6.14.0",
48
- "@primeuix/themes": "2.0.2",
48
+ "@primeuix/themes": "2.0.3",
49
49
  "async-mutex": "0.5.0",
50
50
  "primeicons": "7.0.0",
51
51
  "primevue": "4.5.4"
52
52
  },
53
53
  "devDependencies": {
54
- "@nuxt/eslint": "1.12.1",
54
+ "@nuxt/eslint": "1.15.1",
55
55
  "@nuxt/module-builder": "1.0.2",
56
- "@nuxt/test-utils": "3.21.0",
57
- "@playwright/test": "1.57.0",
58
- "@types/node": "25.0.3",
56
+ "@nuxt/test-utils": "4.0.0",
57
+ "@playwright/test": "1.58.2",
58
+ "@types/node": "25.2.3",
59
59
  "changelogen": "0.6.2",
60
- "nuxt": "4.2.2",
61
- "sass": "1.97.1",
60
+ "nuxt": "4.3.1",
61
+ "sass": "1.97.3",
62
62
  "typescript": "5.9.3",
63
- "vitest": "3.2.4",
64
- "vue-tsc": "3.2.1"
63
+ "vitest": "4.0.18",
64
+ "vue-tsc": "3.2.4"
65
65
  },
66
66
  "optionalDependencies": {
67
- "@oxc-parser/binding-darwin-arm64": "0.106.0",
68
- "@oxc-parser/binding-linux-arm64-gnu": "0.106.0",
69
- "@oxc-parser/binding-linux-arm64-musl": "0.106.0",
70
- "@oxc-parser/binding-linux-x64-gnu": "0.106.0",
71
- "@oxc-parser/binding-linux-x64-musl": "0.106.0",
72
- "@oxc-parser/binding-win32-x64-msvc": "0.106.0"
67
+ "@oxc-parser/binding-darwin-arm64": "0.114.0",
68
+ "@oxc-parser/binding-linux-arm64-gnu": "0.114.0",
69
+ "@oxc-parser/binding-linux-arm64-musl": "0.114.0",
70
+ "@oxc-parser/binding-linux-x64-gnu": "0.114.0",
71
+ "@oxc-parser/binding-linux-x64-musl": "0.114.0",
72
+ "@oxc-parser/binding-win32-x64-msvc": "0.114.0"
73
73
  }
74
74
  }