@mouseless/baked 0.19.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.
Files changed (176) hide show
  1. package/README.md +11 -0
  2. package/dist/module.d.mts +45 -0
  3. package/dist/module.json +9 -0
  4. package/dist/module.mjs +110 -0
  5. package/dist/runtime/assets/overrides.css +1 -0
  6. package/dist/runtime/assets/tailwind.css +1 -0
  7. package/dist/runtime/components/AuthorizedContent.d.vue.ts +10 -0
  8. package/dist/runtime/components/AuthorizedContent.vue +14 -0
  9. package/dist/runtime/components/AuthorizedContent.vue.d.ts +10 -0
  10. package/dist/runtime/components/Bake.d.vue.ts +20 -0
  11. package/dist/runtime/components/Bake.vue +50 -0
  12. package/dist/runtime/components/Bake.vue.d.ts +20 -0
  13. package/dist/runtime/components/BasePersistentPopover.d.vue.ts +178 -0
  14. package/dist/runtime/components/BasePersistentPopover.vue +41 -0
  15. package/dist/runtime/components/BasePersistentPopover.vue.d.ts +178 -0
  16. package/dist/runtime/components/CardLink.d.vue.ts +11 -0
  17. package/dist/runtime/components/CardLink.vue +57 -0
  18. package/dist/runtime/components/CardLink.vue.d.ts +11 -0
  19. package/dist/runtime/components/DataPanel.d.vue.ts +20 -0
  20. package/dist/runtime/components/DataPanel.vue +138 -0
  21. package/dist/runtime/components/DataPanel.vue.d.ts +20 -0
  22. package/dist/runtime/components/DataTable.d.vue.ts +11 -0
  23. package/dist/runtime/components/DataTable.vue +213 -0
  24. package/dist/runtime/components/DataTable.vue.d.ts +11 -0
  25. package/dist/runtime/components/DefaultLayout.d.vue.ts +18 -0
  26. package/dist/runtime/components/DefaultLayout.vue +44 -0
  27. package/dist/runtime/components/DefaultLayout.vue.d.ts +18 -0
  28. package/dist/runtime/components/DeferredTabContent.d.vue.ts +16 -0
  29. package/dist/runtime/components/DeferredTabContent.vue +23 -0
  30. package/dist/runtime/components/DeferredTabContent.vue.d.ts +16 -0
  31. package/dist/runtime/components/Error.d.vue.ts +3 -0
  32. package/dist/runtime/components/Error.vue +13 -0
  33. package/dist/runtime/components/Error.vue.d.ts +3 -0
  34. package/dist/runtime/components/ErrorPage.d.vue.ts +11 -0
  35. package/dist/runtime/components/ErrorPage.vue +65 -0
  36. package/dist/runtime/components/ErrorPage.vue.d.ts +11 -0
  37. package/dist/runtime/components/Filter.d.vue.ts +11 -0
  38. package/dist/runtime/components/Filter.vue +23 -0
  39. package/dist/runtime/components/Filter.vue.d.ts +11 -0
  40. package/dist/runtime/components/Header.d.vue.ts +11 -0
  41. package/dist/runtime/components/Header.vue +78 -0
  42. package/dist/runtime/components/Header.vue.d.ts +11 -0
  43. package/dist/runtime/components/Icon.d.vue.ts +11 -0
  44. package/dist/runtime/components/Icon.vue +14 -0
  45. package/dist/runtime/components/Icon.vue.d.ts +11 -0
  46. package/dist/runtime/components/LanguageSwitcher.d.vue.ts +11 -0
  47. package/dist/runtime/components/LanguageSwitcher.vue +57 -0
  48. package/dist/runtime/components/LanguageSwitcher.vue.d.ts +11 -0
  49. package/dist/runtime/components/Layout.d.vue.ts +10 -0
  50. package/dist/runtime/components/Layout.vue +38 -0
  51. package/dist/runtime/components/Layout.vue.d.ts +10 -0
  52. package/dist/runtime/components/Logo.d.vue.ts +9 -0
  53. package/dist/runtime/components/Logo.vue +18 -0
  54. package/dist/runtime/components/Logo.vue.d.ts +9 -0
  55. package/dist/runtime/components/MenuPage.d.vue.ts +11 -0
  56. package/dist/runtime/components/MenuPage.vue +93 -0
  57. package/dist/runtime/components/MenuPage.vue.d.ts +11 -0
  58. package/dist/runtime/components/Message.d.vue.ts +11 -0
  59. package/dist/runtime/components/Message.vue +33 -0
  60. package/dist/runtime/components/Message.vue.d.ts +11 -0
  61. package/dist/runtime/components/ModalLayout.d.vue.ts +18 -0
  62. package/dist/runtime/components/ModalLayout.vue +14 -0
  63. package/dist/runtime/components/ModalLayout.vue.d.ts +18 -0
  64. package/dist/runtime/components/Money.d.vue.ts +11 -0
  65. package/dist/runtime/components/Money.vue +27 -0
  66. package/dist/runtime/components/Money.vue.d.ts +11 -0
  67. package/dist/runtime/components/NavLink.d.vue.ts +11 -0
  68. package/dist/runtime/components/NavLink.vue +30 -0
  69. package/dist/runtime/components/NavLink.vue.d.ts +11 -0
  70. package/dist/runtime/components/None.d.vue.ts +11 -0
  71. package/dist/runtime/components/None.vue +25 -0
  72. package/dist/runtime/components/None.vue.d.ts +11 -0
  73. package/dist/runtime/components/Number.d.vue.ts +11 -0
  74. package/dist/runtime/components/Number.vue +27 -0
  75. package/dist/runtime/components/Number.vue.d.ts +11 -0
  76. package/dist/runtime/components/Page.d.vue.ts +3 -0
  77. package/dist/runtime/components/Page.vue +24 -0
  78. package/dist/runtime/components/Page.vue.d.ts +3 -0
  79. package/dist/runtime/components/PageTitle.d.vue.ts +22 -0
  80. package/dist/runtime/components/PageTitle.vue +171 -0
  81. package/dist/runtime/components/PageTitle.vue.d.ts +22 -0
  82. package/dist/runtime/components/Parameters.d.vue.ts +11 -0
  83. package/dist/runtime/components/Parameters.vue +60 -0
  84. package/dist/runtime/components/Parameters.vue.d.ts +11 -0
  85. package/dist/runtime/components/PersistentPopover.d.vue.ts +46 -0
  86. package/dist/runtime/components/PersistentPopover.vue +335 -0
  87. package/dist/runtime/components/PersistentPopover.vue.d.ts +46 -0
  88. package/dist/runtime/components/QueryParameters.d.vue.ts +11 -0
  89. package/dist/runtime/components/QueryParameters.vue +103 -0
  90. package/dist/runtime/components/QueryParameters.vue.d.ts +11 -0
  91. package/dist/runtime/components/Rate.d.vue.ts +11 -0
  92. package/dist/runtime/components/Rate.vue +22 -0
  93. package/dist/runtime/components/Rate.vue.d.ts +11 -0
  94. package/dist/runtime/components/ReportPage.d.vue.ts +11 -0
  95. package/dist/runtime/components/ReportPage.vue +147 -0
  96. package/dist/runtime/components/ReportPage.vue.d.ts +11 -0
  97. package/dist/runtime/components/Select.d.vue.ts +11 -0
  98. package/dist/runtime/components/Select.vue +120 -0
  99. package/dist/runtime/components/Select.vue.d.ts +11 -0
  100. package/dist/runtime/components/SelectButton.d.vue.ts +11 -0
  101. package/dist/runtime/components/SelectButton.vue +94 -0
  102. package/dist/runtime/components/SelectButton.vue.d.ts +11 -0
  103. package/dist/runtime/components/SideMenu.d.vue.ts +20 -0
  104. package/dist/runtime/components/SideMenu.vue +121 -0
  105. package/dist/runtime/components/SideMenu.vue.d.ts +20 -0
  106. package/dist/runtime/components/SideMenuItem.d.vue.ts +11 -0
  107. package/dist/runtime/components/SideMenuItem.vue +33 -0
  108. package/dist/runtime/components/SideMenuItem.vue.d.ts +11 -0
  109. package/dist/runtime/components/Text.d.vue.ts +11 -0
  110. package/dist/runtime/components/Text.vue +36 -0
  111. package/dist/runtime/components/Text.vue.d.ts +11 -0
  112. package/dist/runtime/composables/useBreakpoints.d.ts +1 -0
  113. package/dist/runtime/composables/useBreakpoints.js +48 -0
  114. package/dist/runtime/composables/useCache.d.ts +13 -0
  115. package/dist/runtime/composables/useCache.js +60 -0
  116. package/dist/runtime/composables/useComponentResolver.d.ts +3 -0
  117. package/dist/runtime/composables/useComponentResolver.js +13 -0
  118. package/dist/runtime/composables/useComposableResolver.d.ts +3 -0
  119. package/dist/runtime/composables/useComposableResolver.js +15 -0
  120. package/dist/runtime/composables/useConditional.d.ts +3 -0
  121. package/dist/runtime/composables/useConditional.js +15 -0
  122. package/dist/runtime/composables/useContext.d.ts +15 -0
  123. package/dist/runtime/composables/useContext.js +60 -0
  124. package/dist/runtime/composables/useDataFetcher.d.ts +15 -0
  125. package/dist/runtime/composables/useDataFetcher.js +203 -0
  126. package/dist/runtime/composables/useFormat.d.ts +16 -0
  127. package/dist/runtime/composables/useFormat.js +116 -0
  128. package/dist/runtime/composables/useLayouts.d.ts +3 -0
  129. package/dist/runtime/composables/useLayouts.js +21 -0
  130. package/dist/runtime/composables/useLocalization.d.ts +6 -0
  131. package/dist/runtime/composables/useLocalization.js +34 -0
  132. package/dist/runtime/composables/useLoginRedirect.d.ts +3 -0
  133. package/dist/runtime/composables/useLoginRedirect.js +15 -0
  134. package/dist/runtime/composables/useMutex.d.ts +3 -0
  135. package/dist/runtime/composables/useMutex.js +26 -0
  136. package/dist/runtime/composables/useNuxtError.d.ts +3 -0
  137. package/dist/runtime/composables/useNuxtError.js +13 -0
  138. package/dist/runtime/composables/useNuxtRoute.d.ts +3 -0
  139. package/dist/runtime/composables/useNuxtRoute.js +13 -0
  140. package/dist/runtime/composables/usePages.d.ts +5 -0
  141. package/dist/runtime/composables/usePages.js +27 -0
  142. package/dist/runtime/composables/useQuery.d.ts +3 -0
  143. package/dist/runtime/composables/useQuery.js +13 -0
  144. package/dist/runtime/composables/useToast.d.ts +1 -0
  145. package/dist/runtime/composables/useToast.js +5 -0
  146. package/dist/runtime/composables/useToken.d.ts +11 -0
  147. package/dist/runtime/composables/useToken.js +99 -0
  148. package/dist/runtime/composables/useUiStates.d.ts +9 -0
  149. package/dist/runtime/composables/useUiStates.js +9 -0
  150. package/dist/runtime/composables/useUnref.d.ts +3 -0
  151. package/dist/runtime/composables/useUnref.js +109 -0
  152. package/dist/runtime/plugins/auth.d.ts +2 -0
  153. package/dist/runtime/plugins/auth.js +81 -0
  154. package/dist/runtime/plugins/baked.d.ts +10 -0
  155. package/dist/runtime/plugins/baked.js +50 -0
  156. package/dist/runtime/plugins/cacheApplication.d.ts +2 -0
  157. package/dist/runtime/plugins/cacheApplication.js +27 -0
  158. package/dist/runtime/plugins/cacheUser.d.ts +2 -0
  159. package/dist/runtime/plugins/cacheUser.js +37 -0
  160. package/dist/runtime/plugins/errorHandling.d.ts +14 -0
  161. package/dist/runtime/plugins/errorHandling.js +96 -0
  162. package/dist/runtime/plugins/fetch.d.ts +2 -0
  163. package/dist/runtime/plugins/fetch.js +80 -0
  164. package/dist/runtime/plugins/localization.d.ts +2 -0
  165. package/dist/runtime/plugins/localization.js +18 -0
  166. package/dist/runtime/plugins/mutex.d.ts +7 -0
  167. package/dist/runtime/plugins/mutex.js +15 -0
  168. package/dist/runtime/plugins/primeVue.d.ts +2 -0
  169. package/dist/runtime/plugins/primeVue.js +75 -0
  170. package/dist/runtime/plugins/toast.d.ts +6 -0
  171. package/dist/runtime/plugins/toast.js +18 -0
  172. package/dist/runtime/plugins/trailingSlash.d.ts +2 -0
  173. package/dist/runtime/plugins/trailingSlash.js +18 -0
  174. package/dist/runtime/server/tsconfig.json +3 -0
  175. package/dist/types.d.mts +3 -0
  176. package/package.json +74 -0
@@ -0,0 +1,22 @@
1
+ <template>
2
+ <Skeleton
3
+ v-if="loading"
4
+ height="1.5rem"
5
+ />
6
+ <span v-else-if="data">{{ display }}</span>
7
+ <span v-else>-</span>
8
+ </template>
9
+
10
+ <script setup>
11
+ import { computed } from "vue";
12
+ import { Skeleton } from "primevue";
13
+ import { useContext, useFormat } from "#imports";
14
+ const context = useContext();
15
+ const { asPercentage } = useFormat();
16
+ const { data } = defineProps({
17
+ schema: { type: null, required: true },
18
+ data: { type: null, required: true }
19
+ });
20
+ const loading = context.injectLoading();
21
+ const display = computed(() => asPercentage(data));
22
+ </script>
@@ -0,0 +1,11 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<{}, {
4
+ $props: Partial<typeof __VLS_props>;
5
+ schema: any;
6
+ data: any;
7
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const __VLS_props: {
9
+ readonly schema: any;
10
+ readonly data: any;
11
+ };
@@ -0,0 +1,11 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<{}, {
4
+ $props: Partial<typeof __VLS_props>;
5
+ schema: any;
6
+ data: any;
7
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const __VLS_props: {
9
+ readonly schema: any;
10
+ readonly data: any;
11
+ };
@@ -0,0 +1,147 @@
1
+ <template>
2
+ <div class="space-y-4">
3
+ <PageTitle :schema="title">
4
+ <template
5
+ v-if="queryParameters?.length > 0"
6
+ #actions
7
+ >
8
+ <QueryParameters
9
+ :parameters="queryParameters"
10
+ @ready="onReady"
11
+ @changed="onChanged"
12
+ />
13
+ </template>
14
+ <template #extra>
15
+ <Tabs
16
+ v-if="ready && tabs.length > 1"
17
+ v-model:value="currentTab"
18
+ class="!-mb-4 overflow-x-auto overflow-y-hidden"
19
+ >
20
+ <TabList :pt="{ root: '!bg-transparent' }">
21
+ <Tab
22
+ v-for="tab in shownTabs"
23
+ :key="tab.id"
24
+ :value="tab.id"
25
+ class="space-x-2"
26
+ >
27
+ <Bake
28
+ v-if="tab.icon"
29
+ :name="`tabs/${tab.id}/icon`"
30
+ :descriptor="tab.icon"
31
+ />
32
+ <span v-if="tab.title">{{ l(tab.title) }}</span>
33
+ </Tab>
34
+ </TabList>
35
+ </Tabs>
36
+ </template>
37
+ </PageTitle>
38
+ <Message
39
+ v-if="showRequiredMessage"
40
+ severity="info"
41
+ >
42
+ <i class="pi pi-info-circle" />
43
+ <span class="ml-3">{{ lc("Select required values to view this report") }}</span>
44
+ </Message>
45
+ <div
46
+ v-if="ready"
47
+ class="pt-4 flex flex-col gap-4 items-center"
48
+ >
49
+ <DeferredTabContent
50
+ v-for="tab in shownTabs"
51
+ :key="`${uniqueKey}-${tab.id}`"
52
+ v-model="currentTab"
53
+ :when="tab.id"
54
+ :class="{ 'max-w-screen-xl 3xl:max-w-screen-2xl': !tab.fullScreen }"
55
+ class="w-full"
56
+ >
57
+ <template v-if="tab.fullScreen">
58
+ <template
59
+ v-for="content in tab.contents"
60
+ :key="`content-${content.key}`"
61
+ >
62
+ <Bake
63
+ v-if="content.showWhen ? page[content.showWhen] : true"
64
+ :name="`tabs/${tab.id}/contents/${content.key}`"
65
+ :descriptor="content.component"
66
+ />
67
+ </template>
68
+ </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
+ </DeferredTabContent>
89
+ </div>
90
+ </div>
91
+ </template>
92
+
93
+ <script setup>
94
+ import { computed, onMounted, ref, watch } from "vue";
95
+ import { Message, Tab, TabList, Tabs } from "primevue";
96
+ import { useContext, useLocalization } from "#imports";
97
+ import { Bake, DeferredTabContent, PageTitle, QueryParameters } from "#components";
98
+ const context = useContext();
99
+ const { localize: l } = useLocalization();
100
+ const { localize: lc } = useLocalization({ group: "ReportPage" });
101
+ const { schema } = defineProps({
102
+ schema: { type: null, required: true },
103
+ data: { type: null, default: null }
104
+ });
105
+ const { title, queryParameters, tabs } = schema;
106
+ const page = context.injectPage();
107
+ const ready = ref(queryParameters.length === 0);
108
+ const uniqueKey = ref();
109
+ const currentTab = ref(tabs.length > 0 ? tabs[0].id : "");
110
+ const shownTabs = computed(() => tabs.filter((tab) => tab.showWhen ? page[tab.showWhen] : true));
111
+ const lastTab = ref();
112
+ const showRequiredMessage = ref(false);
113
+ onMounted(() => {
114
+ showRequiredMessage.value = !ready.value;
115
+ });
116
+ for (const tab of tabs) {
117
+ if (!tab.showWhen) {
118
+ continue;
119
+ }
120
+ watch(
121
+ () => page[tab.showWhen],
122
+ (show, previousShow) => {
123
+ if (show === previousShow) {
124
+ return;
125
+ }
126
+ if (currentTab.value === tab.id && !show) {
127
+ lastTab.value = currentTab.value;
128
+ const firstAvailableTab = shownTabs.value[0];
129
+ if (firstAvailableTab) {
130
+ currentTab.value = firstAvailableTab.id;
131
+ }
132
+ } else if (lastTab.value === tab.id && show) {
133
+ currentTab.value = lastTab.value;
134
+ lastTab.value = null;
135
+ }
136
+ },
137
+ { immediate: true }
138
+ );
139
+ }
140
+ function onReady(value) {
141
+ ready.value = value;
142
+ showRequiredMessage.value = !value;
143
+ }
144
+ function onChanged(value) {
145
+ uniqueKey.value = value;
146
+ }
147
+ </script>
@@ -0,0 +1,11 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<{}, {
4
+ $props: Partial<typeof __VLS_props>;
5
+ schema: any;
6
+ data: any;
7
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const __VLS_props: {
9
+ readonly schema: any;
10
+ readonly data: any;
11
+ };
@@ -0,0 +1,11 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<{}, {
4
+ $props: Partial<typeof __VLS_props>;
5
+ schema: any;
6
+ data: any;
7
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const __VLS_props: {
9
+ readonly schema: any;
10
+ readonly data: any;
11
+ };
@@ -0,0 +1,120 @@
1
+ <template>
2
+ <div
3
+ v-if="loading"
4
+ class="min-w-40"
5
+ >
6
+ <Skeleton class="min-h-10" />
7
+ </div>
8
+ <FloatLabel
9
+ v-else-if="data"
10
+ variant="on"
11
+ >
12
+ <Select
13
+ v-model="selected"
14
+ v-bind="$attrs"
15
+ :input-id="path"
16
+ :options="data"
17
+ :placeholder="label"
18
+ :show-clear
19
+ class="hide-placeholder"
20
+ >
21
+ <template #value="slotProps">
22
+ <span>
23
+ {{ getValueLabel(slotProps) }}
24
+ </span>
25
+ </template>
26
+ <template #option="slotProps">
27
+ <span>{{ getOptionLabel(slotProps) }}</span>
28
+ </template>
29
+ </Select>
30
+ <label for="period">{{ l(label) }}</label>
31
+ </FloatLabel>
32
+ </template>
33
+
34
+ <script setup>
35
+ import { ref, watch } from "vue";
36
+ import { FloatLabel, Select, Skeleton } from "primevue";
37
+ import { useContext, useUiStates, useLocalization } from "#imports";
38
+ const context = useContext();
39
+ const { localize: l } = useLocalization();
40
+ const { value: { selectStates } } = useUiStates();
41
+ const { schema, data } = defineProps({
42
+ schema: { type: null, required: true },
43
+ data: { type: null, required: true }
44
+ });
45
+ const model = defineModel({ type: null, required: true });
46
+ const { label, localizeLabel, optionLabel, optionValue, showClear, selectionPageContextKey, stateful } = schema;
47
+ const loading = context.injectLoading();
48
+ const path = context.injectPath();
49
+ const page = context.injectPage();
50
+ const selected = ref();
51
+ watch(
52
+ [() => data, () => model.value],
53
+ ([_data, _model]) => {
54
+ if (!_data) {
55
+ return;
56
+ }
57
+ const value = stateful ? selectStates[path] ?? _model : _model;
58
+ setSelected(value);
59
+ },
60
+ { immediate: true }
61
+ );
62
+ watch(selected, (newSelected) => setModel(newSelected));
63
+ function getOptionLabel(slotProps) {
64
+ const result = slotProps.option[optionLabel] ?? slotProps.option;
65
+ return localizeLabel ? l(result) : result;
66
+ }
67
+ function getValueLabel(slotProps) {
68
+ const result = slotProps.value?.[optionLabel] ?? slotProps.value ?? label;
69
+ return localizeLabel ? l(result) : result;
70
+ }
71
+ function setModel(selected2) {
72
+ const selectedValue = optionValue ? selected2?.[optionValue] : selected2;
73
+ model.value = selectedValue;
74
+ if (stateful) {
75
+ selectStates[path] = selectedValue;
76
+ }
77
+ }
78
+ function getValueOf(option) {
79
+ return optionValue ? option?.[optionValue] : option;
80
+ }
81
+ function setSelected(value) {
82
+ if (!data) {
83
+ return;
84
+ }
85
+ selected.value = optionValue ? data.filter((o) => o[optionValue] === value)[0] : value;
86
+ if (selectionPageContextKey) {
87
+ for (const currentValue of data.map(getValueOf)) {
88
+ setPageContext(currentValue, false);
89
+ }
90
+ const selectedValue = getValueOf(selected.value);
91
+ if (selectedValue !== void 0) {
92
+ setPageContext(selectedValue, true);
93
+ }
94
+ }
95
+ if (stateful) {
96
+ const selectedValue = optionValue ? selected.value?.[optionValue] : selected.value;
97
+ if (model.value !== selectedValue) {
98
+ setModel(selected.value);
99
+ }
100
+ }
101
+ }
102
+ function setPageContext(key, value) {
103
+ page[`${selectionPageContextKey}:${key}`] = value;
104
+ page[`!${selectionPageContextKey}:${key}`] = !value;
105
+ }
106
+ </script>
107
+
108
+ <style>
109
+ /*
110
+ placeholder gives select the initial width, but it overlaps with label so it is
111
+ hidden
112
+ */
113
+ .hide-placeholder .p-placeholder {
114
+ visibility: hidden;
115
+ }
116
+
117
+ .p-select-label {
118
+ font-size: inherit;
119
+ }
120
+ </style>
@@ -0,0 +1,11 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<{}, {
4
+ $props: Partial<typeof __VLS_props>;
5
+ schema: any;
6
+ data: any;
7
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const __VLS_props: {
9
+ readonly schema: any;
10
+ readonly data: any;
11
+ };
@@ -0,0 +1,11 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<{}, {
4
+ $props: Partial<typeof __VLS_props>;
5
+ schema: any;
6
+ data: any;
7
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const __VLS_props: {
9
+ readonly schema: any;
10
+ readonly data: any;
11
+ };
@@ -0,0 +1,94 @@
1
+ <template>
2
+ <div
3
+ v-if="loading"
4
+ class="min-w-60"
5
+ >
6
+ <Skeleton class="min-h-10" />
7
+ </div>
8
+ <SelectButton
9
+ v-else-if="data"
10
+ v-model="selected"
11
+ :options="data"
12
+ :allow-empty
13
+ :data-key="optionValue"
14
+ :pt="{ pcToggleButton: { root: { class: 'text-[length:inherit]' } } }"
15
+ >
16
+ <template #option="slotProps">
17
+ <span>{{ getOptionLabel(slotProps) }}</span>
18
+ </template>
19
+ </SelectButton>
20
+ </template>
21
+
22
+ <script setup>
23
+ import { ref, watch } from "vue";
24
+ import { SelectButton, Skeleton } from "primevue";
25
+ import { useContext, useLocalization, useUiStates } from "#imports";
26
+ const context = useContext();
27
+ const { localize: l } = useLocalization();
28
+ const { value: { selectButtonStates } } = useUiStates();
29
+ const { schema, data } = defineProps({
30
+ schema: { type: null, required: true },
31
+ data: { type: null, required: true }
32
+ });
33
+ const model = defineModel({ type: null, required: true });
34
+ const { allowEmpty = false, localizeLabel, optionLabel, optionValue, stateful, selectionPageContextKey } = schema;
35
+ const loading = context.injectLoading();
36
+ const path = context.injectPath();
37
+ const page = context.injectPage();
38
+ const selected = ref();
39
+ watch(
40
+ [() => data, () => model.value],
41
+ ([_data, _model]) => {
42
+ if (!_data) {
43
+ return;
44
+ }
45
+ const value = stateful ? selectButtonStates[path] ?? _model : _model;
46
+ setSelected(value);
47
+ },
48
+ { immediate: true }
49
+ );
50
+ watch(selected, (newSelected) => setModel(newSelected));
51
+ function getOptionLabel(slotProps) {
52
+ const result = slotProps.option[optionLabel] ?? slotProps.option;
53
+ return localizeLabel ? l(result) : result;
54
+ }
55
+ function setModel(selected2) {
56
+ const selectedValue = optionValue ? selected2?.[optionValue] : selected2;
57
+ model.value = selectedValue;
58
+ if (stateful) {
59
+ selectButtonStates[path] = selectedValue;
60
+ }
61
+ }
62
+ function getValueOf(option) {
63
+ return optionValue ? option?.[optionValue] : option;
64
+ }
65
+ function setSelected(value) {
66
+ if (!data) {
67
+ return;
68
+ }
69
+ selected.value = optionValue ? data.filter((o) => o[optionValue] === value)[0] : value;
70
+ if (selectionPageContextKey) {
71
+ for (const currentValue of data.map(getValueOf)) {
72
+ setPageContext(currentValue, false);
73
+ }
74
+ const selectedValue = getValueOf(selected.value);
75
+ if (selectedValue !== void 0) {
76
+ setPageContext(selectedValue, true);
77
+ }
78
+ }
79
+ if (stateful) {
80
+ const selectedValue = optionValue ? selected.value?.[optionValue] : selected.value;
81
+ if (model.value !== selectedValue) {
82
+ setModel(selected.value);
83
+ }
84
+ }
85
+ }
86
+ function setPageContext(key, value) {
87
+ page[`${selectionPageContextKey}:${key}`] = value;
88
+ page[`!${selectionPageContextKey}:${key}`] = !value;
89
+ }
90
+ </script>
91
+
92
+ <style>
93
+ .p-popover-content .p-selectbutton{@apply max-sm:flex-col}.p-popover-content .p-selectbutton .p-togglebutton:first-child{@apply max-sm:rounded-t-lg max-sm:rounded-es-none}.p-popover-content .p-selectbutton .p-togglebutton:last-child{@apply max-sm:rounded-b-lg max-sm:rounded-se-none}
94
+ </style>
@@ -0,0 +1,11 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<{}, {
4
+ $props: Partial<typeof __VLS_props>;
5
+ schema: any;
6
+ data: any;
7
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const __VLS_props: {
9
+ readonly schema: any;
10
+ readonly data: any;
11
+ };
@@ -0,0 +1,20 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
4
+ type __VLS_WithSlots<T, S> = T & (new () => {
5
+ $slots: S;
6
+ });
7
+ declare const __VLS_base: import("vue").DefineComponent<{}, {
8
+ $props: Partial<typeof __VLS_props>;
9
+ schema: any;
10
+ data: any;
11
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
12
+ type __VLS_Slots = {
13
+ footer?: ((props: {}) => any) | undefined;
14
+ } & {
15
+ footer?: ((props: {}) => any) | undefined;
16
+ };
17
+ declare const __VLS_props: {
18
+ readonly schema: any;
19
+ readonly data: any;
20
+ };
@@ -0,0 +1,121 @@
1
+ <template>
2
+ <div
3
+ class="
4
+ b-component--SideMenu--placeholder
5
+ min-w-[5.25rem]
6
+ max-md:min-h-16 max-md:mt-1 max-md:w-full
7
+ 2xl:min-w-64
8
+ "
9
+ />
10
+ <nav
11
+ v-bind="$attrs"
12
+ class="
13
+ fixed z-10
14
+ p-4 bg-slate-100 dark:bg-zinc-900
15
+ flex flex-col justify-start gap-2
16
+ md:top-0 md:left-0 md:h-screen
17
+ max-md:bottom-0 max-md:w-full max-md:p-2
18
+ max-md:flex-row max-md:justify-between max-md:items-center
19
+ max-md:border-t max-md:border-slate-300 max-md:dark:border-zinc-800
20
+ max-md:drop-shadow-[0_-2px_2px_rgba(0,0,0,0.1)]
21
+ 2xl:min-w-64
22
+ "
23
+ >
24
+ <RouterLink
25
+ to="/"
26
+ class="
27
+ flex mt-4 mb-8 w-full min-w-[3.25rem]
28
+ max-2xs:hidden
29
+ max-md:my-0 max-md:w-10
30
+ "
31
+ >
32
+ <Logo
33
+ :src="logo"
34
+ class="2xl:hidden"
35
+ />
36
+ <Logo
37
+ :src="largeLogo"
38
+ class="hidden 2xl:block"
39
+ />
40
+ </RouterLink>
41
+ <div
42
+ class="
43
+ flex flex-col gap-2 h-full
44
+ max-md:h-fit max-md:flex-row
45
+ max-md:overflow-x-auto max-md:snap-x
46
+ "
47
+ >
48
+ <template v-if="loading">
49
+ <Skeleton class="py-6 min-w-[3.25rem] max-md:snap-start" />
50
+ <Skeleton class="py-6 min-w-[3.25rem] max-md:snap-start" />
51
+ </template>
52
+ <template v-else-if="data">
53
+ <SideMenuItem
54
+ v-for="item in menu"
55
+ :key="item.title"
56
+ :item="item"
57
+ :path="data.path"
58
+ class="max-md:snap-start"
59
+ />
60
+ </template>
61
+ </div>
62
+ <div v-if="$slots.footer || footer">
63
+ <div v-if="isMd">
64
+ <Bake
65
+ v-if="footer"
66
+ name="footer"
67
+ :descriptor="footer"
68
+ />
69
+ <slot
70
+ v-else
71
+ name="footer"
72
+ />
73
+ </div>
74
+ <template v-else>
75
+ <Button
76
+ severity="secondary"
77
+ icon="pi pi-cog"
78
+ class="w-[3.25rem] h-[3.25rem]"
79
+ variant="text"
80
+ rounded
81
+ @click="togglePopover"
82
+ />
83
+ <PersistentPopover
84
+ ref="popover"
85
+ fixed
86
+ class="w-1/2 min-w-fit !z-[1002]"
87
+ >
88
+ <Bake
89
+ v-if="footer"
90
+ name="footer"
91
+ :descriptor="footer"
92
+ />
93
+ <slot
94
+ v-else
95
+ name="footer"
96
+ />
97
+ </PersistentPopover>
98
+ </template>
99
+ </div>
100
+ </nav>
101
+ </template>
102
+
103
+ <script setup>
104
+ import { ref } from "vue";
105
+ import { RouterLink } from "vue-router";
106
+ import { Button, Skeleton } from "primevue";
107
+ import { Bake, Logo, PersistentPopover, SideMenuItem } from "#components";
108
+ import { useBreakpoints, useContext } from "#imports";
109
+ const { isMd } = useBreakpoints();
110
+ const context = useContext();
111
+ const { schema, data } = defineProps({
112
+ schema: { type: null, required: true },
113
+ data: { type: null, required: true }
114
+ });
115
+ const { logo, largeLogo, menu, footer } = schema;
116
+ const loading = context.injectLoading();
117
+ const popover = ref();
118
+ function togglePopover(event) {
119
+ popover.value.toggle(event);
120
+ }
121
+ </script>
@@ -0,0 +1,20 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
4
+ type __VLS_WithSlots<T, S> = T & (new () => {
5
+ $slots: S;
6
+ });
7
+ declare const __VLS_base: import("vue").DefineComponent<{}, {
8
+ $props: Partial<typeof __VLS_props>;
9
+ schema: any;
10
+ data: any;
11
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
12
+ type __VLS_Slots = {
13
+ footer?: ((props: {}) => any) | undefined;
14
+ } & {
15
+ footer?: ((props: {}) => any) | undefined;
16
+ };
17
+ declare const __VLS_props: {
18
+ readonly schema: any;
19
+ readonly data: any;
20
+ };
@@ -0,0 +1,11 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<{}, {
4
+ $props: Partial<typeof __VLS_props>;
5
+ item: Record<string, any>;
6
+ path: string;
7
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const __VLS_props: {
9
+ readonly item: Record<string, any>;
10
+ readonly path: string;
11
+ };
@@ -0,0 +1,33 @@
1
+ <template>
2
+ <RouterLink :to="item.route">
3
+ <Button
4
+ v-tooltip="{ value: l(item.title), showDelay: 300, class: '2xl:!hidden max-md:!hidden' }"
5
+ :text="!selected"
6
+ :pt="{
7
+ label: { class: 'max-2xl:hidden leading-none' }
8
+ }"
9
+ :icon="item.icon"
10
+ :severity="selected ? 'primary':'secondary'"
11
+ size="large"
12
+ class="
13
+ px-4 py-3.5 w-full
14
+ 2xl:justify-start 2xl:gap-4
15
+ "
16
+ :label="l(item.title)"
17
+ :disabled="item.disabled"
18
+ />
19
+ </RouterLink>
20
+ </template>
21
+
22
+ <script setup>
23
+ import { computed } from "vue";
24
+ import { RouterLink } from "vue-router";
25
+ import { Button } from "primevue";
26
+ import { useLocalization } from "#imports";
27
+ const { localize: l } = useLocalization();
28
+ const { item, path } = defineProps({
29
+ item: { type: Object, required: true },
30
+ path: { type: String, required: true }
31
+ });
32
+ const selected = computed(() => item.route === path || item.route !== "/" && path.startsWith(item.route));
33
+ </script>