@mouseless/baked 1.0.3 → 1.1.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.d.mts +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +5 -4
- package/dist/runtime/components/AwaitLoading.d.ts +14 -0
- package/dist/runtime/components/AwaitLoading.js +27 -0
- package/dist/runtime/components/Bake.d.vue.ts +25 -11
- package/dist/runtime/components/Bake.vue +87 -16
- package/dist/runtime/components/Bake.vue.d.ts +25 -11
- package/dist/runtime/components/Button.d.vue.ts +27 -0
- package/dist/runtime/components/Button.vue +26 -0
- package/dist/runtime/components/Button.vue.d.ts +27 -0
- package/dist/runtime/components/CardLink.d.vue.ts +11 -9
- package/dist/runtime/components/CardLink.vue +1 -2
- package/dist/runtime/components/CardLink.vue.d.ts +11 -9
- package/dist/runtime/components/Composite.d.vue.ts +13 -0
- package/dist/runtime/components/Composite.vue +17 -0
- package/dist/runtime/components/Composite.vue.d.ts +13 -0
- package/dist/runtime/components/Conditional.d.vue.ts +23 -0
- package/dist/runtime/components/Conditional.vue +31 -0
- package/dist/runtime/components/Conditional.vue.d.ts +23 -0
- package/dist/runtime/components/Contents.d.vue.ts +40 -0
- package/dist/runtime/components/Contents.vue +25 -0
- package/dist/runtime/components/Contents.vue.d.ts +40 -0
- package/dist/runtime/components/DataPanel.d.vue.ts +13 -11
- package/dist/runtime/components/DataPanel.vue +35 -36
- package/dist/runtime/components/DataPanel.vue.d.ts +13 -11
- package/dist/runtime/components/DataTable.d.vue.ts +19 -9
- package/dist/runtime/components/DataTable.vue +69 -55
- package/dist/runtime/components/DataTable.vue.d.ts +19 -9
- package/dist/runtime/components/DefaultLayout.d.vue.ts +11 -9
- package/dist/runtime/components/DefaultLayout.vue +1 -2
- package/dist/runtime/components/DefaultLayout.vue.d.ts +11 -9
- package/dist/runtime/components/DeferredTabContent.d.vue.ts +26 -8
- package/dist/runtime/components/DeferredTabContent.vue +4 -3
- package/dist/runtime/components/DeferredTabContent.vue.d.ts +26 -8
- package/dist/runtime/components/Dialog.d.vue.ts +17 -0
- package/dist/runtime/components/Dialog.vue +57 -0
- package/dist/runtime/components/Dialog.vue.d.ts +17 -0
- package/dist/runtime/components/Error.vue +6 -0
- package/dist/runtime/components/ErrorPage.d.vue.ts +20 -8
- package/dist/runtime/components/ErrorPage.vue.d.ts +20 -8
- package/dist/runtime/components/Fieldset.d.vue.ts +21 -0
- package/dist/runtime/components/Fieldset.vue +38 -0
- package/dist/runtime/components/Fieldset.vue.d.ts +21 -0
- package/dist/runtime/components/Filter.d.vue.ts +23 -9
- package/dist/runtime/components/Filter.vue +5 -7
- package/dist/runtime/components/Filter.vue.d.ts +23 -9
- package/dist/runtime/components/FormPage.d.vue.ts +17 -0
- package/dist/runtime/components/FormPage.vue +48 -0
- package/dist/runtime/components/FormPage.vue.d.ts +17 -0
- package/dist/runtime/components/Header.d.vue.ts +19 -9
- package/dist/runtime/components/Header.vue +27 -29
- package/dist/runtime/components/Header.vue.d.ts +19 -9
- package/dist/runtime/components/Icon.d.vue.ts +11 -9
- package/dist/runtime/components/Icon.vue +1 -2
- package/dist/runtime/components/Icon.vue.d.ts +11 -9
- package/dist/runtime/components/Input.d.vue.ts +25 -0
- package/dist/runtime/components/Input.vue +78 -0
- package/dist/runtime/components/Input.vue.d.ts +25 -0
- package/dist/runtime/components/InputNumber.d.vue.ts +25 -0
- package/dist/runtime/components/InputNumber.vue +35 -0
- package/dist/runtime/components/InputNumber.vue.d.ts +25 -0
- package/dist/runtime/components/InputText.d.vue.ts +25 -0
- package/dist/runtime/components/InputText.vue +31 -0
- package/dist/runtime/components/InputText.vue.d.ts +25 -0
- package/dist/runtime/components/Inputs.d.vue.ts +29 -0
- package/dist/runtime/components/Inputs.vue +50 -0
- package/dist/runtime/components/Inputs.vue.d.ts +29 -0
- package/dist/runtime/components/LanguageSwitcher.d.vue.ts +1 -9
- package/dist/runtime/components/LanguageSwitcher.vue +0 -4
- package/dist/runtime/components/LanguageSwitcher.vue.d.ts +1 -9
- package/dist/runtime/components/Layout.vue +9 -5
- package/dist/runtime/components/Logo.d.vue.ts +11 -7
- package/dist/runtime/components/Logo.vue.d.ts +11 -7
- package/dist/runtime/components/MenuPage.d.vue.ts +11 -9
- package/dist/runtime/components/MenuPage.vue +28 -29
- package/dist/runtime/components/MenuPage.vue.d.ts +11 -9
- package/dist/runtime/components/Message.d.vue.ts +19 -9
- package/dist/runtime/components/Message.vue +10 -14
- package/dist/runtime/components/Message.vue.d.ts +19 -9
- package/dist/runtime/components/MissingComponent.d.vue.ts +21 -0
- package/dist/runtime/components/MissingComponent.vue +174 -0
- package/dist/runtime/components/MissingComponent.vue.d.ts +21 -0
- package/dist/runtime/components/ModalLayout.d.vue.ts +10 -15
- package/dist/runtime/components/ModalLayout.vue +0 -7
- package/dist/runtime/components/ModalLayout.vue.d.ts +10 -15
- package/dist/runtime/components/Money.d.vue.ts +11 -9
- package/dist/runtime/components/Money.vue +10 -15
- package/dist/runtime/components/Money.vue.d.ts +11 -9
- package/dist/runtime/components/NavLink.d.vue.ts +19 -9
- package/dist/runtime/components/NavLink.vue +34 -20
- package/dist/runtime/components/NavLink.vue.d.ts +19 -9
- package/dist/runtime/components/Number.d.vue.ts +11 -9
- package/dist/runtime/components/Number.vue +10 -15
- package/dist/runtime/components/Number.vue.d.ts +11 -9
- package/dist/runtime/components/Page.vue +7 -4
- package/dist/runtime/components/PageTitle.d.vue.ts +15 -9
- package/dist/runtime/components/PageTitle.vue +39 -8
- package/dist/runtime/components/PageTitle.vue.d.ts +15 -9
- package/dist/runtime/components/PersistentPopover.vue +1 -1
- package/dist/runtime/components/ProvideParentContext.d.vue.ts +28 -0
- package/dist/runtime/components/ProvideParentContext.vue +14 -0
- package/dist/runtime/components/ProvideParentContext.vue.d.ts +28 -0
- package/dist/runtime/components/Rate.d.vue.ts +11 -9
- package/dist/runtime/components/Rate.vue +6 -11
- package/dist/runtime/components/Rate.vue.d.ts +11 -9
- package/dist/runtime/components/Select.d.vue.ts +31 -9
- package/dist/runtime/components/Select.vue +30 -49
- package/dist/runtime/components/Select.vue.d.ts +31 -9
- package/dist/runtime/components/SelectButton.d.vue.ts +31 -9
- package/dist/runtime/components/SelectButton.vue +21 -36
- package/dist/runtime/components/SelectButton.vue.d.ts +31 -9
- package/dist/runtime/components/SideMenu.d.vue.ts +19 -9
- package/dist/runtime/components/SideMenu.vue.d.ts +19 -9
- package/dist/runtime/components/SideMenuItem.d.vue.ts +19 -9
- package/dist/runtime/components/SideMenuItem.vue.d.ts +19 -9
- package/dist/runtime/components/SimpleForm.d.vue.ts +17 -0
- package/dist/runtime/components/SimpleForm.vue +108 -0
- package/dist/runtime/components/SimpleForm.vue.d.ts +17 -0
- package/dist/runtime/components/SimplePage.d.vue.ts +13 -0
- package/dist/runtime/components/SimplePage.vue +19 -0
- package/dist/runtime/components/SimplePage.vue.d.ts +13 -0
- package/dist/runtime/components/TabbedPage.d.vue.ts +13 -0
- package/dist/runtime/components/{ReportPage.vue → TabbedPage.vue} +47 -65
- package/dist/runtime/components/TabbedPage.vue.d.ts +13 -0
- package/dist/runtime/components/Text.d.vue.ts +19 -9
- package/dist/runtime/components/Text.vue +9 -13
- package/dist/runtime/components/Text.vue.d.ts +19 -9
- package/dist/runtime/composables/useActionExecuter.d.ts +7 -0
- package/dist/runtime/composables/useActionExecuter.js +108 -0
- package/dist/runtime/composables/useConstraintEvaluator.d.ts +7 -0
- package/dist/runtime/composables/useConstraintEvaluator.js +58 -0
- package/dist/runtime/composables/useContext.d.ts +13 -8
- package/dist/runtime/composables/useContext.js +42 -18
- package/dist/runtime/composables/useDataFetcher.d.ts +6 -6
- package/dist/runtime/composables/useDataFetcher.js +66 -40
- package/dist/runtime/composables/useEvents.d.ts +7 -0
- package/dist/runtime/composables/useEvents.js +33 -0
- package/dist/runtime/composables/useFormat.d.ts +0 -1
- package/dist/runtime/composables/useFormat.js +0 -13
- 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 +3 -3
- package/dist/runtime/composables/usePathBuilder.d.ts +3 -0
- package/dist/runtime/composables/usePathBuilder.js +18 -0
- package/dist/runtime/composables/useReactionHandler.d.ts +6 -0
- package/dist/runtime/composables/useReactionHandler.js +104 -0
- package/dist/runtime/composables/useRedirect.d.ts +3 -0
- package/dist/runtime/composables/useRedirect.js +17 -0
- package/dist/runtime/composables/useToken.js +2 -2
- package/dist/runtime/plugins/auth.js +16 -3
- package/dist/runtime/plugins/baked.js +23 -0
- package/dist/runtime/plugins/fetch.js +2 -2
- package/package.json +18 -18
- package/dist/runtime/components/None.d.vue.ts +0 -11
- package/dist/runtime/components/None.vue +0 -25
- package/dist/runtime/components/None.vue.d.ts +0 -11
- package/dist/runtime/components/Parameters.d.vue.ts +0 -11
- package/dist/runtime/components/Parameters.vue +0 -61
- package/dist/runtime/components/Parameters.vue.d.ts +0 -11
- package/dist/runtime/components/QueryParameters.d.vue.ts +0 -11
- package/dist/runtime/components/QueryParameters.vue +0 -109
- package/dist/runtime/components/QueryParameters.vue.d.ts +0 -11
- package/dist/runtime/components/ReportPage.d.vue.ts +0 -11
- package/dist/runtime/components/ReportPage.vue.d.ts +0 -11
- package/dist/runtime/composables/useConditional.d.ts +0 -3
- package/dist/runtime/composables/useConditional.js +0 -15
- package/dist/runtime/composables/useQuery.d.ts +0 -3
- package/dist/runtime/composables/useQuery.js +0 -13
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="
|
|
2
|
+
<div class="flex flex-col gap-4">
|
|
3
3
|
<PageTitle :schema="title">
|
|
4
4
|
<template
|
|
5
|
-
v-if="
|
|
6
|
-
#
|
|
5
|
+
v-if="inputs?.length > 0"
|
|
6
|
+
#inputs
|
|
7
7
|
>
|
|
8
|
-
<
|
|
9
|
-
:
|
|
8
|
+
<Inputs
|
|
9
|
+
:inputs
|
|
10
10
|
@ready="onReady"
|
|
11
11
|
@changed="onChanged"
|
|
12
12
|
/>
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
severity="info"
|
|
41
41
|
>
|
|
42
42
|
<i class="pi pi-info-circle" />
|
|
43
|
-
<span class="ml-3">{{ lc("Select required values to view this
|
|
43
|
+
<span class="ml-3">{{ lc("Select required values to view this page") }}</span>
|
|
44
44
|
</Message>
|
|
45
45
|
<div
|
|
46
46
|
v-if="ready"
|
|
@@ -51,97 +51,79 @@
|
|
|
51
51
|
:key="`${uniqueKey}-${tab.id}`"
|
|
52
52
|
v-model="currentTab"
|
|
53
53
|
:when="tab.id"
|
|
54
|
-
:class="{ 'max-w-screen-xl 3xl:max-w-screen-2xl': !tab.fullScreen }"
|
|
55
|
-
class="w-full"
|
|
56
54
|
>
|
|
57
|
-
<template
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
:name="`tabs/${tab.id}/contents/${content.key}`"
|
|
65
|
-
:descriptor="content.component"
|
|
66
|
-
/>
|
|
67
|
-
</template>
|
|
55
|
+
<template #default="{ hidden }">
|
|
56
|
+
<Contents
|
|
57
|
+
:contents="tab.contents"
|
|
58
|
+
:name-prefix="`tabs/${tab.id}`"
|
|
59
|
+
:full-screen="tab.fullScreen"
|
|
60
|
+
:class="{ hidden }"
|
|
61
|
+
/>
|
|
68
62
|
</template>
|
|
69
|
-
<div
|
|
70
|
-
v-else
|
|
71
|
-
class="b-ReportPage--grid grid grid-cols-1 lg:grid-cols-2 gap-4"
|
|
72
|
-
>
|
|
73
|
-
<template
|
|
74
|
-
v-for="content in tab.contents"
|
|
75
|
-
:key="`content-${content.key}`"
|
|
76
|
-
>
|
|
77
|
-
<div
|
|
78
|
-
v-if="content.showWhen ? page[content.showWhen] : true"
|
|
79
|
-
:class="{ 'lg:col-span-2': !content.narrow }"
|
|
80
|
-
>
|
|
81
|
-
<Bake
|
|
82
|
-
:name="`tabs/${tab.id}/contents/${content.key}`"
|
|
83
|
-
:descriptor="content.component"
|
|
84
|
-
/>
|
|
85
|
-
</div>
|
|
86
|
-
</template>
|
|
87
|
-
</div>
|
|
88
63
|
</DeferredTabContent>
|
|
89
64
|
</div>
|
|
90
65
|
</div>
|
|
91
66
|
</template>
|
|
92
67
|
|
|
93
68
|
<script setup>
|
|
94
|
-
import { computed, onMounted,
|
|
69
|
+
import { computed, onBeforeUnmount, onMounted, reactive, ref } from "vue";
|
|
95
70
|
import { Message, Tab, TabList, Tabs } from "primevue";
|
|
96
|
-
import { useContext, useLocalization } from "#imports";
|
|
97
|
-
import { Bake, DeferredTabContent,
|
|
71
|
+
import { useContext, useLocalization, useReactionHandler } from "#imports";
|
|
72
|
+
import { Bake, Contents, DeferredTabContent, Inputs, PageTitle } from "#components";
|
|
98
73
|
const context = useContext();
|
|
99
74
|
const { localize: l } = useLocalization();
|
|
100
|
-
const { localize: lc } = useLocalization({ group: "
|
|
75
|
+
const { localize: lc } = useLocalization({ group: "TabbedPage" });
|
|
76
|
+
const reactionHandler = useReactionHandler();
|
|
101
77
|
const { schema } = defineProps({
|
|
102
|
-
schema: { type: null, required: true }
|
|
103
|
-
data: { type: null, default: null }
|
|
78
|
+
schema: { type: null, required: true }
|
|
104
79
|
});
|
|
105
|
-
const { title,
|
|
106
|
-
const
|
|
107
|
-
const ready = ref(
|
|
80
|
+
const { title, inputs, tabs } = schema;
|
|
81
|
+
const path = context.injectPath();
|
|
82
|
+
const ready = ref(inputs.length === 0);
|
|
108
83
|
const uniqueKey = ref();
|
|
109
84
|
const currentTab = ref(tabs.length > 0 ? tabs[0].id : "");
|
|
110
|
-
const
|
|
85
|
+
const tabVisible = reactive(tabs.reduce((prev, cur) => ({ ...prev, [cur.id]: true }), {}));
|
|
86
|
+
const shownTabs = computed(() => tabs.filter((tab) => tabVisible[tab.id]));
|
|
111
87
|
const lastTab = ref();
|
|
88
|
+
const tabReactions = [];
|
|
112
89
|
const showRequiredMessage = ref(false);
|
|
113
|
-
onMounted(() => {
|
|
114
|
-
showRequiredMessage.value = !ready.value;
|
|
115
|
-
});
|
|
116
90
|
for (const tab of tabs) {
|
|
117
|
-
if (!tab.
|
|
91
|
+
if (!tab.reactions) {
|
|
118
92
|
continue;
|
|
119
93
|
}
|
|
120
|
-
|
|
121
|
-
()
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (currentTab.value === tab.id && !show) {
|
|
94
|
+
const tabReaction = reactionHandler.create(`${path}/tabs/${tab.id}`, {
|
|
95
|
+
reload() {
|
|
96
|
+
},
|
|
97
|
+
show(visible) {
|
|
98
|
+
tabVisible[tab.id] = visible;
|
|
99
|
+
if (currentTab.value === tab.id && !visible) {
|
|
127
100
|
lastTab.value = currentTab.value;
|
|
128
101
|
const firstAvailableTab = shownTabs.value[0];
|
|
129
102
|
if (firstAvailableTab) {
|
|
130
103
|
currentTab.value = firstAvailableTab.id;
|
|
131
104
|
}
|
|
132
|
-
} else if (lastTab.value === tab.id &&
|
|
105
|
+
} else if (lastTab.value === tab.id && visible) {
|
|
133
106
|
currentTab.value = lastTab.value;
|
|
134
107
|
lastTab.value = null;
|
|
135
108
|
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
tabReaction.bind(tab.reactions);
|
|
112
|
+
tabReactions.push(tabReaction);
|
|
139
113
|
}
|
|
114
|
+
onMounted(() => {
|
|
115
|
+
showRequiredMessage.value = !ready.value;
|
|
116
|
+
});
|
|
117
|
+
onBeforeUnmount(() => {
|
|
118
|
+
for (const tabReaction of tabReactions) {
|
|
119
|
+
tabReaction.unbind();
|
|
120
|
+
}
|
|
121
|
+
});
|
|
140
122
|
function onReady(value) {
|
|
141
123
|
ready.value = value;
|
|
142
124
|
showRequiredMessage.value = !value;
|
|
143
125
|
}
|
|
144
|
-
function onChanged(
|
|
145
|
-
uniqueKey.value =
|
|
126
|
+
function onChanged(event) {
|
|
127
|
+
uniqueKey.value = event.uniqueKey;
|
|
146
128
|
}
|
|
147
129
|
</script>
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
9
|
+
schema: {
|
|
10
|
+
type: null;
|
|
11
|
+
required: true;
|
|
12
|
+
};
|
|
13
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
declare const _default: typeof __VLS_export;
|
|
2
2
|
export default _default;
|
|
3
|
-
declare const __VLS_export: import("vue").DefineComponent<{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
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>;
|
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
v-else
|
|
8
|
-
|
|
9
|
-
>{{ text }}</span>
|
|
10
|
-
<span v-else>-</span>
|
|
2
|
+
<AwaitLoading :skeleton="{ height: '1.5rem' }">
|
|
3
|
+
<span
|
|
4
|
+
v-if="data"
|
|
5
|
+
v-tooltip.bottom="tooltip"
|
|
6
|
+
>{{ text }}</span>
|
|
7
|
+
<span v-else>-</span>
|
|
8
|
+
</AwaitLoading>
|
|
11
9
|
</template>
|
|
12
10
|
|
|
13
11
|
<script setup>
|
|
14
12
|
import { computed } from "vue";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
const context = useContext();
|
|
13
|
+
import { useFormat } from "#imports";
|
|
14
|
+
import { AwaitLoading } from "#components";
|
|
18
15
|
const { truncate } = useFormat();
|
|
19
16
|
const { schema, data } = defineProps({
|
|
20
17
|
schema: { type: null, required: true },
|
|
21
18
|
data: { type: null, required: true }
|
|
22
19
|
});
|
|
23
20
|
const { maxLength } = schema;
|
|
24
|
-
const loading = context.injectLoading();
|
|
25
21
|
const lengthIsExceeded = computed(() => maxLength && data.length > maxLength);
|
|
26
22
|
const text = computed(() => lengthIsExceeded.value ? truncate(data, maxLength) : data);
|
|
27
23
|
const tooltip = computed(() => ({
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
declare const _default: typeof __VLS_export;
|
|
2
2
|
export default _default;
|
|
3
|
-
declare const __VLS_export: import("vue").DefineComponent<{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
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,108 @@
|
|
|
1
|
+
import { useRuntimeConfig } from "#app";
|
|
2
|
+
import { useComposableResolver, useDataFetcher, usePathBuilder, useUnref } from "#imports";
|
|
3
|
+
|
|
4
|
+
export default function() {
|
|
5
|
+
const actions = {
|
|
6
|
+
"Composite": Composite({ actionExecuter: { execute } }),
|
|
7
|
+
"Local": Local(),
|
|
8
|
+
"Publish": Publish(),
|
|
9
|
+
"Remote": Remote({ actionExecuter: { execute } })
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
async function execute({ action, contextData, events }) {
|
|
13
|
+
const executer = actions[action?.type];
|
|
14
|
+
|
|
15
|
+
await executer.execute({ action, contextData, events });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
execute
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function Composite({ actionExecuter }) {
|
|
24
|
+
async function execute({ action, contextData, events }) {
|
|
25
|
+
for(const part of action.parts) {
|
|
26
|
+
await actionExecuter.execute({ action: part, contextData, events });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
execute
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function Local() {
|
|
36
|
+
const composableResolver = useComposableResolver();
|
|
37
|
+
const dataFetcher = useDataFetcher();
|
|
38
|
+
|
|
39
|
+
async function execute({ action, contextData }) {
|
|
40
|
+
const composable = (await composableResolver.resolve(action.composable)).default();
|
|
41
|
+
|
|
42
|
+
if(composable.run) {
|
|
43
|
+
const options = action.options ? await dataFetcher.fetch({ data: action.options, contextData }) : { };
|
|
44
|
+
|
|
45
|
+
return await composable.run(options);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
throw new Error("Action composable should have async `run`");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
execute
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function Publish() {
|
|
57
|
+
const dataFetcher = useDataFetcher();
|
|
58
|
+
|
|
59
|
+
async function execute({ action, contextData, events }) {
|
|
60
|
+
const data = action.data ? await dataFetcher.fetch({ data: action.data, contextData }) : undefined;
|
|
61
|
+
|
|
62
|
+
if(action.event) {
|
|
63
|
+
await events.publish(action.event, data);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if(action.pageContextKey) {
|
|
67
|
+
contextData.page[action.pageContextKey] = data;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
execute
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function Remote({ actionExecuter }) {
|
|
77
|
+
const dataFetcher = useDataFetcher();
|
|
78
|
+
const pathBuilder = usePathBuilder();
|
|
79
|
+
const { public: { apiBaseURL } } = useRuntimeConfig();
|
|
80
|
+
const unref = useUnref();
|
|
81
|
+
|
|
82
|
+
async function execute({ action, contextData, events }) {
|
|
83
|
+
const headers = action.headers ? unref.deepUnref(await dataFetcher.fetch({ data: action.headers, contextData })) : { };
|
|
84
|
+
const query = action.query ? unref.deepUnref(await dataFetcher.fetch({ data: action.query, contextData })) : null;
|
|
85
|
+
const params = action.params ? unref.deepUnref(await dataFetcher.fetch({ data: action.params, contextData })) : { };
|
|
86
|
+
const body = action.method === "GET"
|
|
87
|
+
? null
|
|
88
|
+
: (action.body ? unref.deepUnref(await dataFetcher.fetch({ data: action.body, contextData })) : { });
|
|
89
|
+
|
|
90
|
+
const response = await $fetch(pathBuilder.build(action.path, params), {
|
|
91
|
+
baseURL: apiBaseURL,
|
|
92
|
+
method: action.method,
|
|
93
|
+
headers: headers,
|
|
94
|
+
query: query,
|
|
95
|
+
body: body
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
await actionExecuter.execute({
|
|
99
|
+
action: action.postAction,
|
|
100
|
+
contextData: { ...contextData, response },
|
|
101
|
+
events
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
execute
|
|
107
|
+
};
|
|
108
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useComposableResolver, useDataFetcher } from "#imports";
|
|
2
|
+
|
|
3
|
+
export default function() {
|
|
4
|
+
const constraints = {
|
|
5
|
+
"Composable": Composable(),
|
|
6
|
+
"Is": Is(),
|
|
7
|
+
"IsNot": IsNot()
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
async function evaluate({ constraint, value, contextData }) {
|
|
11
|
+
if(!constraint) { return true; }
|
|
12
|
+
|
|
13
|
+
const evaluator = constraints[constraint.type];
|
|
14
|
+
|
|
15
|
+
return await evaluator.evaluate({ constraint, contextData, value });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
evaluate
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function Composable() {
|
|
24
|
+
const composableResolver = useComposableResolver();
|
|
25
|
+
const dataFetcher = useDataFetcher();
|
|
26
|
+
|
|
27
|
+
async function evaluate({ constraint, value, contextData }) {
|
|
28
|
+
const options = constraint.options ? await dataFetcher.fetch({ data: constraint.options, contextData }) : { };
|
|
29
|
+
const composable = (await composableResolver.resolve(constraint.composable)).default(options);
|
|
30
|
+
if(!composable.validate) { throw new Error("Constraint composable should have `validate`"); }
|
|
31
|
+
|
|
32
|
+
return composable.validate(value);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
evaluate
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function Is() {
|
|
41
|
+
async function evaluate({ constraint, value }) {
|
|
42
|
+
return constraint.is === value;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
evaluate
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function IsNot() {
|
|
51
|
+
async function evaluate({ constraint, value }) {
|
|
52
|
+
return constraint.isNot !== value;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
evaluate
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
export default function _default(): {
|
|
2
2
|
injectPath: () => string;
|
|
3
|
-
providePath: (
|
|
3
|
+
providePath: (value: any) => void;
|
|
4
|
+
injectContextData: () => {
|
|
5
|
+
page: any;
|
|
6
|
+
parent: null;
|
|
7
|
+
};
|
|
4
8
|
injectDataDescriptor: () => null;
|
|
5
9
|
provideDataDescriptor: (value: any) => void;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
provideData: (value: any, key: any) => void;
|
|
10
|
+
injectEvents: () => any;
|
|
11
|
+
provideEvents: (value: any) => void;
|
|
12
|
+
injectExecuting: () => import("vue").Ref<boolean, boolean>;
|
|
13
|
+
provideExecuting: (value: any) => void;
|
|
11
14
|
injectLoading: () => import("vue").Ref<boolean, boolean>;
|
|
12
15
|
provideLoading: (value: any) => void;
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
injectPageContext: () => any;
|
|
17
|
+
providePageContext: (value: any) => void;
|
|
18
|
+
injectParentContext: () => null;
|
|
19
|
+
provideParentContext: (value: any) => void;
|
|
15
20
|
};
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { inject, provide, ref } from "vue";
|
|
2
2
|
|
|
3
3
|
export default function() {
|
|
4
|
-
function providePath(
|
|
5
|
-
|
|
6
|
-
provide("__bake_path", path ? `${path}/${name}` : name);
|
|
4
|
+
function providePath(value) {
|
|
5
|
+
provide("__bake_path", value);
|
|
7
6
|
}
|
|
8
7
|
|
|
9
8
|
function injectPath() {
|
|
10
9
|
return inject("__bake_path", "");
|
|
11
10
|
}
|
|
12
11
|
|
|
12
|
+
function injectContextData() {
|
|
13
|
+
return {
|
|
14
|
+
page: injectPageContext(),
|
|
15
|
+
parent: injectParentContext()
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
13
19
|
function injectDataDescriptor() {
|
|
14
20
|
return inject("__bake_data_descriptor", null);
|
|
15
21
|
}
|
|
@@ -18,15 +24,20 @@ export default function() {
|
|
|
18
24
|
return provide("__bake_data_descriptor", value);
|
|
19
25
|
}
|
|
20
26
|
|
|
21
|
-
function
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
function injectEvents() {
|
|
28
|
+
return inject("__bake_events");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function provideEvents(value) {
|
|
32
|
+
provide("__bake_events", value);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function injectExecuting() {
|
|
36
|
+
return inject("__bake_executing", ref(false));
|
|
26
37
|
}
|
|
27
38
|
|
|
28
|
-
function
|
|
29
|
-
provide(
|
|
39
|
+
function provideExecuting(value) {
|
|
40
|
+
return provide("__bake_executing", value);
|
|
30
41
|
}
|
|
31
42
|
|
|
32
43
|
function injectLoading() {
|
|
@@ -37,24 +48,37 @@ export default function() {
|
|
|
37
48
|
provide("__bake_loading", value);
|
|
38
49
|
}
|
|
39
50
|
|
|
40
|
-
function
|
|
41
|
-
return inject("
|
|
51
|
+
function injectPageContext() {
|
|
52
|
+
return inject("__bake_page_context");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function providePageContext(value) {
|
|
56
|
+
provide("__bake_page_context", value);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function injectParentContext() {
|
|
60
|
+
return inject("__bake_parent_context", null);
|
|
42
61
|
}
|
|
43
62
|
|
|
44
|
-
function
|
|
45
|
-
provide("
|
|
63
|
+
function provideParentContext(value) {
|
|
64
|
+
provide("__bake_parent_context", value);
|
|
46
65
|
}
|
|
47
66
|
|
|
48
67
|
return {
|
|
49
68
|
injectPath,
|
|
50
69
|
providePath,
|
|
70
|
+
injectContextData,
|
|
51
71
|
injectDataDescriptor,
|
|
52
72
|
provideDataDescriptor,
|
|
53
|
-
|
|
54
|
-
|
|
73
|
+
injectEvents,
|
|
74
|
+
provideEvents,
|
|
75
|
+
injectExecuting,
|
|
76
|
+
provideExecuting,
|
|
55
77
|
injectLoading,
|
|
56
78
|
provideLoading,
|
|
57
|
-
|
|
58
|
-
|
|
79
|
+
injectPageContext,
|
|
80
|
+
providePageContext,
|
|
81
|
+
injectParentContext,
|
|
82
|
+
provideParentContext
|
|
59
83
|
};
|
|
60
84
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export default function _default(): {
|
|
2
2
|
shouldLoad: (dataType: any) => boolean;
|
|
3
|
-
get: ({ data,
|
|
3
|
+
get: ({ data, contextData }: {
|
|
4
4
|
data: any;
|
|
5
|
-
|
|
5
|
+
contextData: any;
|
|
6
6
|
}) => any;
|
|
7
|
-
fetch: ({ data,
|
|
7
|
+
fetch: ({ data, contextData }: {
|
|
8
8
|
data: any;
|
|
9
|
-
|
|
9
|
+
contextData: any;
|
|
10
10
|
}) => Promise<any>;
|
|
11
|
-
fetchParameters: ({ data,
|
|
11
|
+
fetchParameters: ({ data, contextData }: {
|
|
12
12
|
data: any;
|
|
13
|
-
|
|
13
|
+
contextData: any;
|
|
14
14
|
}) => Promise<any>;
|
|
15
15
|
};
|