@mouseless/baked 1.1.3 → 1.2.0
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/module.mjs +1 -1
- package/dist/runtime/components/Bake.d.vue.ts +8 -2
- package/dist/runtime/components/Bake.vue +1 -1
- package/dist/runtime/components/Bake.vue.d.ts +8 -2
- package/dist/runtime/components/DataPanel.vue +6 -12
- package/dist/runtime/components/DataTable.vue +8 -4
- package/dist/runtime/components/Dialog.vue +1 -1
- package/dist/runtime/components/Error.vue +1 -1
- package/dist/runtime/components/ErrorPage.vue +6 -1
- package/dist/runtime/components/Filter.vue +11 -1
- package/dist/runtime/components/Input.vue +9 -14
- package/dist/runtime/components/Layout.vue +1 -1
- package/dist/runtime/components/Message.vue +1 -1
- package/dist/runtime/components/NavLink.vue +5 -17
- package/dist/runtime/components/Page.vue +1 -1
- package/dist/runtime/components/SideMenu.vue +6 -1
- package/dist/runtime/composables/useActionExecuter.js +1 -1
- package/dist/runtime/composables/useComposableResolver.js +1 -1
- package/dist/runtime/composables/useConstraintEvaluator.js +1 -1
- package/dist/runtime/composables/useDataFetcher.d.ts +1 -1
- package/dist/runtime/composables/useDataFetcher.js +41 -17
- package/dist/runtime/composables/useDataMounter.d.ts +5 -0
- package/dist/runtime/composables/useDataMounter.js +58 -0
- package/dist/runtime/composables/useEvents.d.ts +3 -5
- package/dist/runtime/composables/useEvents.js +14 -20
- package/dist/runtime/composables/useLoginRedirect.d.ts +1 -1
- package/dist/runtime/composables/useLoginRedirect.js +2 -2
- package/dist/runtime/composables/useNuxtError.d.ts +1 -1
- package/dist/runtime/composables/useNuxtError.js +2 -2
- package/dist/runtime/composables/useNuxtRoute.d.ts +1 -1
- package/dist/runtime/composables/useNuxtRoute.js +2 -2
- package/dist/runtime/plugins/baked.js +2 -2
- package/package.json +17 -17
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -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, {
|
|
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<{
|
|
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
|
|
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, {
|
|
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<{
|
|
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
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
ref="panel"
|
|
4
4
|
:header="localizeTitle ? l(title) : title"
|
|
5
5
|
:collapsed="collapsedState"
|
|
6
|
-
toggleable
|
|
6
|
+
:toggleable="toggleable ?? true"
|
|
7
7
|
:pt="
|
|
8
8
|
{
|
|
9
9
|
headerActions: 'flex gap-2 items-center',
|
|
@@ -81,21 +81,21 @@
|
|
|
81
81
|
</template>
|
|
82
82
|
|
|
83
83
|
<script setup>
|
|
84
|
-
import { computed,
|
|
84
|
+
import { computed, ref, useTemplateRef } from "vue";
|
|
85
85
|
import { Message, Panel, Button } from "primevue";
|
|
86
86
|
import { Bake, Inputs, PersistentPopover } from "#components";
|
|
87
|
-
import { useBreakpoints, useContext,
|
|
87
|
+
import { useBreakpoints, useContext, useDataMounter, useUiStates, useLocalization } from "#imports";
|
|
88
88
|
const { value: { panelStates } } = useUiStates();
|
|
89
89
|
const { isMd } = useBreakpoints();
|
|
90
90
|
const context = useContext();
|
|
91
|
-
const
|
|
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");
|
|
95
95
|
const { schema } = defineProps({
|
|
96
96
|
schema: { type: null, required: true }
|
|
97
97
|
});
|
|
98
|
-
const { collapsed, content, inputs, localizeTitle, title: titleData } = schema;
|
|
98
|
+
const { collapsed, content, inputs, localizeTitle, title: titleData, toggleable } = schema;
|
|
99
99
|
const contextData = context.injectContextData();
|
|
100
100
|
const path = context.injectPath();
|
|
101
101
|
const collapsedState = computed(() => panelStates[path] ?? collapsed);
|
|
@@ -107,13 +107,7 @@ const values = ref({});
|
|
|
107
107
|
if (inputs.length > 0) {
|
|
108
108
|
contextData.parent["parameters"] = values;
|
|
109
109
|
}
|
|
110
|
-
const title =
|
|
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
|
}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
{{ lc("No records found") }}
|
|
24
24
|
</template>
|
|
25
25
|
<Column
|
|
26
|
-
v-for="column in columns"
|
|
26
|
+
v-for="column in columns.filter(c => !c.hidden)"
|
|
27
27
|
:key="column.key"
|
|
28
28
|
:header="l(column.title)"
|
|
29
29
|
:field="column.key"
|
|
@@ -159,7 +159,11 @@ const { schema, data } = defineProps({
|
|
|
159
159
|
schema: { type: null, required: true },
|
|
160
160
|
data: { type: null, required: true }
|
|
161
161
|
});
|
|
162
|
-
const { actions, columns, dataKey,
|
|
162
|
+
const { actions, columns, dataKey, footerTemplate, itemsProp, paginator, rows, rowsWhenLoading, scrollHeight, virtualScrollerOptions } = schema;
|
|
163
|
+
const exportOptions = schema.exportOptions && {
|
|
164
|
+
buttonIcon: "pi pi-download",
|
|
165
|
+
...schema.exportOptions
|
|
166
|
+
};
|
|
163
167
|
const contextData = context.injectContextData();
|
|
164
168
|
const dataDescriptor = context.injectDataDescriptor();
|
|
165
169
|
const dataTable = ref();
|
|
@@ -196,11 +200,11 @@ onMounted(async () => {
|
|
|
196
200
|
parameterFormatter: parameterFormatterName
|
|
197
201
|
} = exportOptions;
|
|
198
202
|
if (formatterName) {
|
|
199
|
-
formatter =
|
|
203
|
+
formatter = composableResolver.resolve(formatterName).default();
|
|
200
204
|
}
|
|
201
205
|
let parameterFormatter = null;
|
|
202
206
|
if (parameterFormatterName) {
|
|
203
|
-
parameterFormatter =
|
|
207
|
+
parameterFormatter = composableResolver.resolve(parameterFormatterName).default();
|
|
204
208
|
}
|
|
205
209
|
if (appendParameters && dataDescriptor) {
|
|
206
210
|
let parameters = await dataFetcher.fetchParameters({ data: dataDescriptor, contextData });
|
|
@@ -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
|
|
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 {
|
|
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;
|
|
@@ -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,
|
|
10
|
+
import { computed, watch } from "vue";
|
|
11
11
|
import { useRoute, useRouter } from "#app";
|
|
12
|
-
import {
|
|
12
|
+
import { useDataMounter } from "#imports";
|
|
13
13
|
import { Bake } from "#components";
|
|
14
|
-
const
|
|
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
|
|
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
|
-
|
|
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
|
|
26
|
+
context.provideEvents(events);
|
|
27
27
|
context.providePageContext(reactive({}));
|
|
28
28
|
const descriptor = ref(await findLayout(route.matched[0].name));
|
|
29
29
|
watch(
|
|
@@ -12,33 +12,21 @@
|
|
|
12
12
|
</template>
|
|
13
13
|
|
|
14
14
|
<script setup>
|
|
15
|
-
import { computed
|
|
15
|
+
import { computed } from "vue";
|
|
16
16
|
import { Button } from "primevue";
|
|
17
|
-
import {
|
|
17
|
+
import { useDataMounter, usePathBuilder } from "#imports";
|
|
18
18
|
import { AwaitLoading } from "#components";
|
|
19
|
-
const
|
|
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
|
|
28
|
-
const
|
|
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
|
|
21
|
+
context.provideEvents(events);
|
|
22
22
|
context.providePageContext(reactive({}));
|
|
23
23
|
const name = route.matched[0].name;
|
|
24
24
|
const className = name.replace("[", "").replace("]", "");
|
|
@@ -112,7 +112,12 @@ const { schema, data } = defineProps({
|
|
|
112
112
|
schema: { type: null, required: true },
|
|
113
113
|
data: { type: null, required: true }
|
|
114
114
|
});
|
|
115
|
-
const {
|
|
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 =
|
|
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 }) : { };
|
|
@@ -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 =
|
|
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);
|
|
@@ -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(
|
|
14
|
-
|
|
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
|
-
|
|
90
|
-
const composable =
|
|
91
|
-
const options = data.options ? unref.deepUnref(
|
|
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
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
113
|
+
return composable.compute(options);
|
|
114
|
+
}
|
|
96
115
|
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
|
|
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,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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
|
5
|
-
|
|
6
|
-
listeners[name] ||= {};
|
|
4
|
+
function on(name, id, callback) {
|
|
5
|
+
listeners[name] ||= {};
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
listeners[name][id] = callback;
|
|
8
|
+
}
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
function off(name, id) {
|
|
11
|
+
delete listeners[name][id];
|
|
12
|
+
}
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
async function publish(name, value) {
|
|
15
|
+
if(!listeners[name]) { return; }
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
23
|
+
on,
|
|
24
|
+
off,
|
|
25
|
+
publish
|
|
32
26
|
};
|
|
33
27
|
}
|
|
@@ -3,13 +3,13 @@ import { useRoute, useRuntimeConfig } from "#app";
|
|
|
3
3
|
export default function() {
|
|
4
4
|
const { public: { auth } } = useRuntimeConfig();
|
|
5
5
|
|
|
6
|
-
function
|
|
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
|
-
|
|
13
|
+
compute
|
|
14
14
|
};
|
|
15
15
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export default function _default(): {
|
|
2
|
-
|
|
2
|
+
compute: () => import("vue").Ref<import("#app").NuxtError<unknown> | undefined, import("#app").NuxtError<unknown> | undefined>;
|
|
3
3
|
};
|
|
@@ -3,11 +3,11 @@ import { useRoute } from "#app";
|
|
|
3
3
|
export default function() {
|
|
4
4
|
const route = useRoute();
|
|
5
5
|
|
|
6
|
-
function
|
|
6
|
+
function compute({ property } = {}) {
|
|
7
7
|
return property ? route[property] : route;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
return {
|
|
11
|
-
|
|
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.
|
|
3
|
+
"version": "1.2.0",
|
|
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.
|
|
46
|
+
"@nuxtjs/i18n": "10.2.3",
|
|
47
47
|
"@nuxtjs/tailwindcss": "6.14.0",
|
|
48
|
-
"@primeuix/themes": "2.0.
|
|
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.
|
|
54
|
+
"@nuxt/eslint": "1.15.1",
|
|
55
55
|
"@nuxt/module-builder": "1.0.2",
|
|
56
|
-
"@nuxt/test-utils": "
|
|
57
|
-
"@playwright/test": "1.
|
|
58
|
-
"@types/node": "25.
|
|
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.
|
|
61
|
-
"sass": "1.97.
|
|
60
|
+
"nuxt": "4.3.1",
|
|
61
|
+
"sass": "1.97.3",
|
|
62
62
|
"typescript": "5.9.3",
|
|
63
|
-
"vitest": "
|
|
64
|
-
"vue-tsc": "3.2.
|
|
63
|
+
"vitest": "4.0.18",
|
|
64
|
+
"vue-tsc": "3.2.4"
|
|
65
65
|
},
|
|
66
66
|
"optionalDependencies": {
|
|
67
|
-
"@oxc-parser/binding-darwin-arm64": "0.
|
|
68
|
-
"@oxc-parser/binding-linux-arm64-gnu": "0.
|
|
69
|
-
"@oxc-parser/binding-linux-arm64-musl": "0.
|
|
70
|
-
"@oxc-parser/binding-linux-x64-gnu": "0.
|
|
71
|
-
"@oxc-parser/binding-linux-x64-musl": "0.
|
|
72
|
-
"@oxc-parser/binding-win32-x64-msvc": "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
|
}
|