@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.
- package/README.md +11 -0
- package/dist/module.d.mts +45 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +110 -0
- package/dist/runtime/assets/overrides.css +1 -0
- package/dist/runtime/assets/tailwind.css +1 -0
- package/dist/runtime/components/AuthorizedContent.d.vue.ts +10 -0
- package/dist/runtime/components/AuthorizedContent.vue +14 -0
- package/dist/runtime/components/AuthorizedContent.vue.d.ts +10 -0
- package/dist/runtime/components/Bake.d.vue.ts +20 -0
- package/dist/runtime/components/Bake.vue +50 -0
- package/dist/runtime/components/Bake.vue.d.ts +20 -0
- package/dist/runtime/components/BasePersistentPopover.d.vue.ts +178 -0
- package/dist/runtime/components/BasePersistentPopover.vue +41 -0
- package/dist/runtime/components/BasePersistentPopover.vue.d.ts +178 -0
- package/dist/runtime/components/CardLink.d.vue.ts +11 -0
- package/dist/runtime/components/CardLink.vue +57 -0
- package/dist/runtime/components/CardLink.vue.d.ts +11 -0
- package/dist/runtime/components/DataPanel.d.vue.ts +20 -0
- package/dist/runtime/components/DataPanel.vue +138 -0
- package/dist/runtime/components/DataPanel.vue.d.ts +20 -0
- package/dist/runtime/components/DataTable.d.vue.ts +11 -0
- package/dist/runtime/components/DataTable.vue +213 -0
- package/dist/runtime/components/DataTable.vue.d.ts +11 -0
- package/dist/runtime/components/DefaultLayout.d.vue.ts +18 -0
- package/dist/runtime/components/DefaultLayout.vue +44 -0
- package/dist/runtime/components/DefaultLayout.vue.d.ts +18 -0
- package/dist/runtime/components/DeferredTabContent.d.vue.ts +16 -0
- package/dist/runtime/components/DeferredTabContent.vue +23 -0
- package/dist/runtime/components/DeferredTabContent.vue.d.ts +16 -0
- package/dist/runtime/components/Error.d.vue.ts +3 -0
- package/dist/runtime/components/Error.vue +13 -0
- package/dist/runtime/components/Error.vue.d.ts +3 -0
- package/dist/runtime/components/ErrorPage.d.vue.ts +11 -0
- package/dist/runtime/components/ErrorPage.vue +65 -0
- package/dist/runtime/components/ErrorPage.vue.d.ts +11 -0
- package/dist/runtime/components/Filter.d.vue.ts +11 -0
- package/dist/runtime/components/Filter.vue +23 -0
- package/dist/runtime/components/Filter.vue.d.ts +11 -0
- package/dist/runtime/components/Header.d.vue.ts +11 -0
- package/dist/runtime/components/Header.vue +78 -0
- package/dist/runtime/components/Header.vue.d.ts +11 -0
- package/dist/runtime/components/Icon.d.vue.ts +11 -0
- package/dist/runtime/components/Icon.vue +14 -0
- package/dist/runtime/components/Icon.vue.d.ts +11 -0
- package/dist/runtime/components/LanguageSwitcher.d.vue.ts +11 -0
- package/dist/runtime/components/LanguageSwitcher.vue +57 -0
- package/dist/runtime/components/LanguageSwitcher.vue.d.ts +11 -0
- package/dist/runtime/components/Layout.d.vue.ts +10 -0
- package/dist/runtime/components/Layout.vue +38 -0
- package/dist/runtime/components/Layout.vue.d.ts +10 -0
- package/dist/runtime/components/Logo.d.vue.ts +9 -0
- package/dist/runtime/components/Logo.vue +18 -0
- package/dist/runtime/components/Logo.vue.d.ts +9 -0
- package/dist/runtime/components/MenuPage.d.vue.ts +11 -0
- package/dist/runtime/components/MenuPage.vue +93 -0
- package/dist/runtime/components/MenuPage.vue.d.ts +11 -0
- package/dist/runtime/components/Message.d.vue.ts +11 -0
- package/dist/runtime/components/Message.vue +33 -0
- package/dist/runtime/components/Message.vue.d.ts +11 -0
- package/dist/runtime/components/ModalLayout.d.vue.ts +18 -0
- package/dist/runtime/components/ModalLayout.vue +14 -0
- package/dist/runtime/components/ModalLayout.vue.d.ts +18 -0
- package/dist/runtime/components/Money.d.vue.ts +11 -0
- package/dist/runtime/components/Money.vue +27 -0
- package/dist/runtime/components/Money.vue.d.ts +11 -0
- package/dist/runtime/components/NavLink.d.vue.ts +11 -0
- package/dist/runtime/components/NavLink.vue +30 -0
- package/dist/runtime/components/NavLink.vue.d.ts +11 -0
- package/dist/runtime/components/None.d.vue.ts +11 -0
- package/dist/runtime/components/None.vue +25 -0
- package/dist/runtime/components/None.vue.d.ts +11 -0
- package/dist/runtime/components/Number.d.vue.ts +11 -0
- package/dist/runtime/components/Number.vue +27 -0
- package/dist/runtime/components/Number.vue.d.ts +11 -0
- package/dist/runtime/components/Page.d.vue.ts +3 -0
- package/dist/runtime/components/Page.vue +24 -0
- package/dist/runtime/components/Page.vue.d.ts +3 -0
- package/dist/runtime/components/PageTitle.d.vue.ts +22 -0
- package/dist/runtime/components/PageTitle.vue +171 -0
- package/dist/runtime/components/PageTitle.vue.d.ts +22 -0
- package/dist/runtime/components/Parameters.d.vue.ts +11 -0
- package/dist/runtime/components/Parameters.vue +60 -0
- package/dist/runtime/components/Parameters.vue.d.ts +11 -0
- package/dist/runtime/components/PersistentPopover.d.vue.ts +46 -0
- package/dist/runtime/components/PersistentPopover.vue +335 -0
- package/dist/runtime/components/PersistentPopover.vue.d.ts +46 -0
- package/dist/runtime/components/QueryParameters.d.vue.ts +11 -0
- package/dist/runtime/components/QueryParameters.vue +103 -0
- package/dist/runtime/components/QueryParameters.vue.d.ts +11 -0
- package/dist/runtime/components/Rate.d.vue.ts +11 -0
- package/dist/runtime/components/Rate.vue +22 -0
- package/dist/runtime/components/Rate.vue.d.ts +11 -0
- package/dist/runtime/components/ReportPage.d.vue.ts +11 -0
- package/dist/runtime/components/ReportPage.vue +147 -0
- package/dist/runtime/components/ReportPage.vue.d.ts +11 -0
- package/dist/runtime/components/Select.d.vue.ts +11 -0
- package/dist/runtime/components/Select.vue +120 -0
- package/dist/runtime/components/Select.vue.d.ts +11 -0
- package/dist/runtime/components/SelectButton.d.vue.ts +11 -0
- package/dist/runtime/components/SelectButton.vue +94 -0
- package/dist/runtime/components/SelectButton.vue.d.ts +11 -0
- package/dist/runtime/components/SideMenu.d.vue.ts +20 -0
- package/dist/runtime/components/SideMenu.vue +121 -0
- package/dist/runtime/components/SideMenu.vue.d.ts +20 -0
- package/dist/runtime/components/SideMenuItem.d.vue.ts +11 -0
- package/dist/runtime/components/SideMenuItem.vue +33 -0
- package/dist/runtime/components/SideMenuItem.vue.d.ts +11 -0
- package/dist/runtime/components/Text.d.vue.ts +11 -0
- package/dist/runtime/components/Text.vue +36 -0
- package/dist/runtime/components/Text.vue.d.ts +11 -0
- package/dist/runtime/composables/useBreakpoints.d.ts +1 -0
- package/dist/runtime/composables/useBreakpoints.js +48 -0
- package/dist/runtime/composables/useCache.d.ts +13 -0
- package/dist/runtime/composables/useCache.js +60 -0
- package/dist/runtime/composables/useComponentResolver.d.ts +3 -0
- package/dist/runtime/composables/useComponentResolver.js +13 -0
- package/dist/runtime/composables/useComposableResolver.d.ts +3 -0
- package/dist/runtime/composables/useComposableResolver.js +15 -0
- package/dist/runtime/composables/useConditional.d.ts +3 -0
- package/dist/runtime/composables/useConditional.js +15 -0
- package/dist/runtime/composables/useContext.d.ts +15 -0
- package/dist/runtime/composables/useContext.js +60 -0
- package/dist/runtime/composables/useDataFetcher.d.ts +15 -0
- package/dist/runtime/composables/useDataFetcher.js +203 -0
- package/dist/runtime/composables/useFormat.d.ts +16 -0
- package/dist/runtime/composables/useFormat.js +116 -0
- package/dist/runtime/composables/useLayouts.d.ts +3 -0
- package/dist/runtime/composables/useLayouts.js +21 -0
- package/dist/runtime/composables/useLocalization.d.ts +6 -0
- package/dist/runtime/composables/useLocalization.js +34 -0
- package/dist/runtime/composables/useLoginRedirect.d.ts +3 -0
- package/dist/runtime/composables/useLoginRedirect.js +15 -0
- package/dist/runtime/composables/useMutex.d.ts +3 -0
- package/dist/runtime/composables/useMutex.js +26 -0
- package/dist/runtime/composables/useNuxtError.d.ts +3 -0
- package/dist/runtime/composables/useNuxtError.js +13 -0
- package/dist/runtime/composables/useNuxtRoute.d.ts +3 -0
- package/dist/runtime/composables/useNuxtRoute.js +13 -0
- package/dist/runtime/composables/usePages.d.ts +5 -0
- package/dist/runtime/composables/usePages.js +27 -0
- package/dist/runtime/composables/useQuery.d.ts +3 -0
- package/dist/runtime/composables/useQuery.js +13 -0
- package/dist/runtime/composables/useToast.d.ts +1 -0
- package/dist/runtime/composables/useToast.js +5 -0
- package/dist/runtime/composables/useToken.d.ts +11 -0
- package/dist/runtime/composables/useToken.js +99 -0
- package/dist/runtime/composables/useUiStates.d.ts +9 -0
- package/dist/runtime/composables/useUiStates.js +9 -0
- package/dist/runtime/composables/useUnref.d.ts +3 -0
- package/dist/runtime/composables/useUnref.js +109 -0
- package/dist/runtime/plugins/auth.d.ts +2 -0
- package/dist/runtime/plugins/auth.js +81 -0
- package/dist/runtime/plugins/baked.d.ts +10 -0
- package/dist/runtime/plugins/baked.js +50 -0
- package/dist/runtime/plugins/cacheApplication.d.ts +2 -0
- package/dist/runtime/plugins/cacheApplication.js +27 -0
- package/dist/runtime/plugins/cacheUser.d.ts +2 -0
- package/dist/runtime/plugins/cacheUser.js +37 -0
- package/dist/runtime/plugins/errorHandling.d.ts +14 -0
- package/dist/runtime/plugins/errorHandling.js +96 -0
- package/dist/runtime/plugins/fetch.d.ts +2 -0
- package/dist/runtime/plugins/fetch.js +80 -0
- package/dist/runtime/plugins/localization.d.ts +2 -0
- package/dist/runtime/plugins/localization.js +18 -0
- package/dist/runtime/plugins/mutex.d.ts +7 -0
- package/dist/runtime/plugins/mutex.js +15 -0
- package/dist/runtime/plugins/primeVue.d.ts +2 -0
- package/dist/runtime/plugins/primeVue.js +75 -0
- package/dist/runtime/plugins/toast.d.ts +6 -0
- package/dist/runtime/plugins/toast.js +18 -0
- package/dist/runtime/plugins/trailingSlash.d.ts +2 -0
- package/dist/runtime/plugins/trailingSlash.js +18 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/types.d.mts +3 -0
- package/package.json +74 -0
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
actions?: ((props: {}) => any) | undefined;
|
|
14
|
+
} & {
|
|
15
|
+
actions?: ((props: {}) => any) | undefined;
|
|
16
|
+
} & {
|
|
17
|
+
extra?: ((props: {}) => any) | undefined;
|
|
18
|
+
};
|
|
19
|
+
declare const __VLS_props: {
|
|
20
|
+
readonly schema: any;
|
|
21
|
+
readonly data: any;
|
|
22
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {
|
|
4
|
+
$emit: typeof emit;
|
|
5
|
+
$props: Partial<typeof __VLS_props>;
|
|
6
|
+
parameters: unknown[];
|
|
7
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
8
|
+
declare const emit: (event: "ready" | "changed", ...args: any[]) => void;
|
|
9
|
+
declare const __VLS_props: {
|
|
10
|
+
readonly parameters: unknown[];
|
|
11
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!--
|
|
3
|
+
[!NOTE]
|
|
4
|
+
|
|
5
|
+
unlike the usual way to pass model, `.model` is not enough here in below.
|
|
6
|
+
for some reason vue rewraps the model which is already a ref, causing a
|
|
7
|
+
double ref. that's why `.model.value` is passed instead of `.model`
|
|
8
|
+
-->
|
|
9
|
+
<div class="flex gap-2 max-md:flex-col max-md:min-w-24">
|
|
10
|
+
<Bake
|
|
11
|
+
v-for="parameter in parameters"
|
|
12
|
+
:key="parameter.name"
|
|
13
|
+
v-model="values[parameter.name].value"
|
|
14
|
+
:name="`parameters/${parameter.name}`"
|
|
15
|
+
:descriptor="parameter.component"
|
|
16
|
+
class="max-md:w-full"
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup>
|
|
22
|
+
import { onMounted, ref, watch } from "vue";
|
|
23
|
+
import { Bake } from "#components";
|
|
24
|
+
import { useContext, useDataFetcher } from "#imports";
|
|
25
|
+
const dataFetcher = useDataFetcher();
|
|
26
|
+
const context = useContext();
|
|
27
|
+
const { parameters } = defineProps({
|
|
28
|
+
parameters: { type: Array, required: true }
|
|
29
|
+
});
|
|
30
|
+
const emit = defineEmits(["ready", "changed"]);
|
|
31
|
+
const injectedData = context.injectData();
|
|
32
|
+
const values = {};
|
|
33
|
+
for (const parameter of parameters) {
|
|
34
|
+
values[parameter.name] = ref(dataFetcher.get({ data: parameter.default, injectedData }));
|
|
35
|
+
}
|
|
36
|
+
onMounted(async () => {
|
|
37
|
+
for (const parameter of parameters) {
|
|
38
|
+
if (!dataFetcher.shouldLoad(parameter.default?.type)) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
values[parameter.name].value = await dataFetcher.fetch({ data: parameter.default, injectedData });
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
watch(Object.values(values), async () => {
|
|
45
|
+
emitChanged();
|
|
46
|
+
emitReady();
|
|
47
|
+
}, { immediate: true });
|
|
48
|
+
function emitReady() {
|
|
49
|
+
emit(
|
|
50
|
+
"ready",
|
|
51
|
+
parameters.filter((p) => p.required).reduce((result, p) => result && values[p.name].value?.length > 0, true)
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
function emitChanged() {
|
|
55
|
+
emit("changed", {
|
|
56
|
+
uniqueKey: Object.values(values).map((v) => v.value).filter((v) => v?.length > 0).join("-"),
|
|
57
|
+
values
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
</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
|
+
$emit: typeof emit;
|
|
5
|
+
$props: Partial<typeof __VLS_props>;
|
|
6
|
+
parameters: unknown[];
|
|
7
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
8
|
+
declare const emit: (event: "ready" | "changed", ...args: any[]) => void;
|
|
9
|
+
declare const __VLS_props: {
|
|
10
|
+
readonly parameters: unknown[];
|
|
11
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
fixed: BooleanConstructor;
|
|
5
|
+
}>, {}, {
|
|
6
|
+
visible: boolean;
|
|
7
|
+
}, {}, {
|
|
8
|
+
toggle(event: any, target: any): void;
|
|
9
|
+
show(event: any, target: any): void;
|
|
10
|
+
hide(): void;
|
|
11
|
+
onContentClick(): void;
|
|
12
|
+
onEnter(el: any): void;
|
|
13
|
+
onLeave(): void;
|
|
14
|
+
onAfterLeave(el: any): void;
|
|
15
|
+
alignOverlay(): void;
|
|
16
|
+
fixPopoverPosition(container: any, target: any): void;
|
|
17
|
+
onContentKeydown(event: any): void;
|
|
18
|
+
onButtonKeydown(event: any): void;
|
|
19
|
+
focus(): void;
|
|
20
|
+
onKeyDown(event: any): void;
|
|
21
|
+
bindDocumentKeyDownListener(): void;
|
|
22
|
+
unbindDocumentKeyDownListener(): void;
|
|
23
|
+
bindOutsideClickListener(): void;
|
|
24
|
+
unbindOutsideClickListener(): void;
|
|
25
|
+
bindScrollListener(): void;
|
|
26
|
+
unbindScrollListener(): void;
|
|
27
|
+
bindResizeListener(): void;
|
|
28
|
+
unbindResizeListener(): void;
|
|
29
|
+
isTargetClicked(event: any): any;
|
|
30
|
+
containerRef(el: any): void;
|
|
31
|
+
createStyle(): void;
|
|
32
|
+
destroyStyle(): void;
|
|
33
|
+
onOverlayClick(event: any): void;
|
|
34
|
+
}, import("vue").ComponentOptionsMixin, any, ("show" | "hide")[], "show" | "hide", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
35
|
+
fixed: BooleanConstructor;
|
|
36
|
+
}>> & Readonly<{
|
|
37
|
+
onShow?: ((...args: any[]) => any) | undefined;
|
|
38
|
+
onHide?: ((...args: any[]) => any) | undefined;
|
|
39
|
+
}>, {
|
|
40
|
+
fixed: boolean;
|
|
41
|
+
}, {}, {
|
|
42
|
+
Portal: import("@primevue/core").DefineComponent<import("primevue").PortalProps, import("primevue").PortalSlots, (e: string, ...args: any[]) => void>;
|
|
43
|
+
}, {
|
|
44
|
+
focustrap: import("vue").ObjectDirective<any, any, string, any>;
|
|
45
|
+
ripple: import("vue").ObjectDirective<any, any, string, any>;
|
|
46
|
+
}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Portal :append-to="appendTo">
|
|
3
|
+
<transition
|
|
4
|
+
name="p-popover"
|
|
5
|
+
v-bind="ptm('transition')"
|
|
6
|
+
@enter="onEnter"
|
|
7
|
+
@leave="onLeave"
|
|
8
|
+
@after-leave="onAfterLeave"
|
|
9
|
+
>
|
|
10
|
+
<div
|
|
11
|
+
v-show="visible"
|
|
12
|
+
:ref="containerRef"
|
|
13
|
+
v-focustrap
|
|
14
|
+
role="dialog"
|
|
15
|
+
:aria-modal="visible"
|
|
16
|
+
:class="cx('root')"
|
|
17
|
+
v-bind="ptmi('root')"
|
|
18
|
+
@click="onOverlayClick"
|
|
19
|
+
>
|
|
20
|
+
<slot
|
|
21
|
+
v-if="$slots.container"
|
|
22
|
+
name="container"
|
|
23
|
+
:close-callback="hide"
|
|
24
|
+
:keydown-callback="(event) => onButtonKeydown(event)"
|
|
25
|
+
/>
|
|
26
|
+
<template v-else>
|
|
27
|
+
<div
|
|
28
|
+
:class="cx('content')"
|
|
29
|
+
v-bind="ptm('content')"
|
|
30
|
+
@click="onContentClick"
|
|
31
|
+
@mousedown="onContentClick"
|
|
32
|
+
@keydown="onContentKeydown"
|
|
33
|
+
>
|
|
34
|
+
<slot />
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
</div>
|
|
38
|
+
</transition>
|
|
39
|
+
</Portal>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script>
|
|
43
|
+
import { $dt } from "@primeuix/styled";
|
|
44
|
+
import { absolutePosition, addClass, addStyle, focus, getOffset, isClient, isTouchDevice, setAttribute } from "@primeuix/utils/dom";
|
|
45
|
+
import { ZIndex } from "@primeuix/utils/zindex";
|
|
46
|
+
import { ConnectedOverlayScrollHandler } from "@primevue/core/utils";
|
|
47
|
+
import FocusTrap from "primevue/focustrap";
|
|
48
|
+
import OverlayEventBus from "primevue/overlayeventbus";
|
|
49
|
+
import Portal from "primevue/portal";
|
|
50
|
+
import Ripple from "primevue/ripple";
|
|
51
|
+
import { BasePersistentPopover } from "#components";
|
|
52
|
+
export default {
|
|
53
|
+
name: "PersistentPopover",
|
|
54
|
+
directives: {
|
|
55
|
+
focustrap: FocusTrap,
|
|
56
|
+
ripple: Ripple
|
|
57
|
+
},
|
|
58
|
+
components: {
|
|
59
|
+
Portal
|
|
60
|
+
},
|
|
61
|
+
extends: BasePersistentPopover,
|
|
62
|
+
inheritAttrs: false,
|
|
63
|
+
props: {
|
|
64
|
+
fixed: Boolean
|
|
65
|
+
},
|
|
66
|
+
emits: ["show", "hide"],
|
|
67
|
+
data() {
|
|
68
|
+
return {
|
|
69
|
+
visible: false
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
watch: {
|
|
73
|
+
dismissable: {
|
|
74
|
+
immediate: true,
|
|
75
|
+
handler(newValue) {
|
|
76
|
+
if (newValue) {
|
|
77
|
+
this.bindOutsideClickListener();
|
|
78
|
+
} else {
|
|
79
|
+
this.unbindOutsideClickListener();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
selfClick: false,
|
|
85
|
+
target: null,
|
|
86
|
+
eventTarget: null,
|
|
87
|
+
outsideClickListener: null,
|
|
88
|
+
scrollHandler: null,
|
|
89
|
+
resizeListener: null,
|
|
90
|
+
container: null,
|
|
91
|
+
styleElement: null,
|
|
92
|
+
overlayEventListener: null,
|
|
93
|
+
documentKeydownListener: null,
|
|
94
|
+
beforeUnmount() {
|
|
95
|
+
if (this.dismissable) {
|
|
96
|
+
this.unbindOutsideClickListener();
|
|
97
|
+
}
|
|
98
|
+
if (this.scrollHandler) {
|
|
99
|
+
this.scrollHandler.destroy();
|
|
100
|
+
this.scrollHandler = null;
|
|
101
|
+
}
|
|
102
|
+
this.destroyStyle();
|
|
103
|
+
this.unbindResizeListener();
|
|
104
|
+
this.target = null;
|
|
105
|
+
if (this.container && this.autoZIndex) {
|
|
106
|
+
ZIndex.clear(this.container);
|
|
107
|
+
}
|
|
108
|
+
if (this.overlayEventListener) {
|
|
109
|
+
OverlayEventBus.off("overlay-click", this.overlayEventListener);
|
|
110
|
+
this.overlayEventListener = null;
|
|
111
|
+
}
|
|
112
|
+
this.container = null;
|
|
113
|
+
},
|
|
114
|
+
mounted() {
|
|
115
|
+
if (this.breakpoints) {
|
|
116
|
+
this.createStyle();
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
methods: {
|
|
120
|
+
toggle(event, target) {
|
|
121
|
+
if (this.visible) this.hide();
|
|
122
|
+
else this.show(event, target);
|
|
123
|
+
},
|
|
124
|
+
show(event, target) {
|
|
125
|
+
this.visible = true;
|
|
126
|
+
this.eventTarget = event.currentTarget;
|
|
127
|
+
this.target = target || event.currentTarget;
|
|
128
|
+
},
|
|
129
|
+
hide() {
|
|
130
|
+
this.visible = false;
|
|
131
|
+
},
|
|
132
|
+
onContentClick() {
|
|
133
|
+
this.selfClick = true;
|
|
134
|
+
},
|
|
135
|
+
onEnter(el) {
|
|
136
|
+
addStyle(el, { position: "absolute", top: "0" });
|
|
137
|
+
this.alignOverlay();
|
|
138
|
+
if (this.dismissable) {
|
|
139
|
+
this.bindOutsideClickListener();
|
|
140
|
+
}
|
|
141
|
+
this.bindScrollListener();
|
|
142
|
+
this.bindResizeListener();
|
|
143
|
+
if (this.autoZIndex) {
|
|
144
|
+
ZIndex.set("overlay", el, this.baseZIndex + this.$primevue.config.zIndex.overlay);
|
|
145
|
+
}
|
|
146
|
+
this.overlayEventListener = (e) => {
|
|
147
|
+
if (this.container.contains(e.target)) {
|
|
148
|
+
this.selfClick = true;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
this.focus();
|
|
152
|
+
OverlayEventBus.on("overlay-click", this.overlayEventListener);
|
|
153
|
+
this.$emit("show");
|
|
154
|
+
if (this.closeOnEscape) {
|
|
155
|
+
this.bindDocumentKeyDownListener();
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
onLeave() {
|
|
159
|
+
this.unbindOutsideClickListener();
|
|
160
|
+
this.unbindScrollListener();
|
|
161
|
+
this.unbindResizeListener();
|
|
162
|
+
this.unbindDocumentKeyDownListener();
|
|
163
|
+
OverlayEventBus.off("overlay-click", this.overlayEventListener);
|
|
164
|
+
this.overlayEventListener = null;
|
|
165
|
+
this.$emit("hide");
|
|
166
|
+
},
|
|
167
|
+
onAfterLeave(el) {
|
|
168
|
+
if (this.autoZIndex) {
|
|
169
|
+
ZIndex.clear(el);
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
alignOverlay() {
|
|
173
|
+
absolutePosition(this.container, this.target, false);
|
|
174
|
+
if (this.fixed) {
|
|
175
|
+
this.fixPopoverPosition(this.container, this.target);
|
|
176
|
+
}
|
|
177
|
+
const containerOffset = getOffset(this.container);
|
|
178
|
+
const targetOffset = getOffset(this.target);
|
|
179
|
+
let arrowLeft = 0;
|
|
180
|
+
if (containerOffset.left < targetOffset.left) {
|
|
181
|
+
arrowLeft = targetOffset.left - containerOffset.left;
|
|
182
|
+
}
|
|
183
|
+
this.container.style.setProperty($dt("popover.arrow.left").name, `${arrowLeft}px`);
|
|
184
|
+
if (containerOffset.top < targetOffset.top) {
|
|
185
|
+
this.container.setAttribute("data-p-popover-flipped", "true");
|
|
186
|
+
!this.isUnstyled && addClass(this.container, "p-popover-flipped");
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
fixPopoverPosition(container, target) {
|
|
190
|
+
const rect = target.getBoundingClientRect();
|
|
191
|
+
const vw = window.innerWidth, vh = window.innerHeight;
|
|
192
|
+
const w = container.offsetWidth, h = container.offsetHeight;
|
|
193
|
+
let top = rect.bottom;
|
|
194
|
+
let left = rect.left;
|
|
195
|
+
if (rect.bottom + h > vh) {
|
|
196
|
+
top = Math.max(0, rect.top - h);
|
|
197
|
+
}
|
|
198
|
+
if (rect.left + w > vw) {
|
|
199
|
+
left = Math.max(0, rect.right - w);
|
|
200
|
+
}
|
|
201
|
+
Object.assign(container.style, {
|
|
202
|
+
position: "fixed",
|
|
203
|
+
top: `${top}px`,
|
|
204
|
+
left: `${left}px`
|
|
205
|
+
});
|
|
206
|
+
},
|
|
207
|
+
onContentKeydown(event) {
|
|
208
|
+
if (event.code === "Escape" && this.closeOnEscape) {
|
|
209
|
+
this.hide();
|
|
210
|
+
focus(this.target);
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
onButtonKeydown(event) {
|
|
214
|
+
switch (event.code) {
|
|
215
|
+
case "ArrowDown":
|
|
216
|
+
case "ArrowUp":
|
|
217
|
+
case "ArrowLeft":
|
|
218
|
+
case "ArrowRight":
|
|
219
|
+
event.preventDefault();
|
|
220
|
+
default:
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
focus() {
|
|
225
|
+
const focusTarget = this.container.querySelector("[autofocus]");
|
|
226
|
+
if (focusTarget) {
|
|
227
|
+
focusTarget.focus();
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
onKeyDown(event) {
|
|
231
|
+
if (event.code === "Escape" && this.closeOnEscape) {
|
|
232
|
+
this.visible = false;
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
bindDocumentKeyDownListener() {
|
|
236
|
+
if (!this.documentKeydownListener) {
|
|
237
|
+
this.documentKeydownListener = this.onKeyDown.bind(this);
|
|
238
|
+
window.document.addEventListener("keydown", this.documentKeydownListener);
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
unbindDocumentKeyDownListener() {
|
|
242
|
+
if (this.documentKeydownListener) {
|
|
243
|
+
window.document.removeEventListener("keydown", this.documentKeydownListener);
|
|
244
|
+
this.documentKeydownListener = null;
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
bindOutsideClickListener() {
|
|
248
|
+
if (!this.outsideClickListener && isClient()) {
|
|
249
|
+
this.outsideClickListener = (event) => {
|
|
250
|
+
if (this.visible && !this.selfClick && !this.isTargetClicked(event)) {
|
|
251
|
+
this.visible = false;
|
|
252
|
+
}
|
|
253
|
+
this.selfClick = false;
|
|
254
|
+
};
|
|
255
|
+
document.addEventListener("click", this.outsideClickListener);
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
unbindOutsideClickListener() {
|
|
259
|
+
if (this.outsideClickListener) {
|
|
260
|
+
document.removeEventListener("click", this.outsideClickListener);
|
|
261
|
+
this.outsideClickListener = null;
|
|
262
|
+
this.selfClick = false;
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
bindScrollListener() {
|
|
266
|
+
if (!this.scrollHandler) {
|
|
267
|
+
this.scrollHandler = new ConnectedOverlayScrollHandler(this.target, () => {
|
|
268
|
+
if (this.visible) {
|
|
269
|
+
this.visible = false;
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
this.scrollHandler.bindScrollListener();
|
|
274
|
+
},
|
|
275
|
+
unbindScrollListener() {
|
|
276
|
+
if (this.scrollHandler) {
|
|
277
|
+
this.scrollHandler.unbindScrollListener();
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
bindResizeListener() {
|
|
281
|
+
if (!this.resizeListener) {
|
|
282
|
+
this.resizeListener = () => {
|
|
283
|
+
if (this.visible && !isTouchDevice()) {
|
|
284
|
+
this.visible = false;
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
window.addEventListener("resize", this.resizeListener);
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
unbindResizeListener() {
|
|
291
|
+
if (this.resizeListener) {
|
|
292
|
+
window.removeEventListener("resize", this.resizeListener);
|
|
293
|
+
this.resizeListener = null;
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
isTargetClicked(event) {
|
|
297
|
+
return this.eventTarget && (this.eventTarget === event.target || this.eventTarget.contains(event.target));
|
|
298
|
+
},
|
|
299
|
+
containerRef(el) {
|
|
300
|
+
this.container = el;
|
|
301
|
+
},
|
|
302
|
+
createStyle() {
|
|
303
|
+
if (!this.styleElement && !this.isUnstyled) {
|
|
304
|
+
this.styleElement = document.createElement("style");
|
|
305
|
+
this.styleElement.type = "text/css";
|
|
306
|
+
setAttribute(this.styleElement, "nonce", this.$primevue?.config?.csp?.nonce);
|
|
307
|
+
document.head.appendChild(this.styleElement);
|
|
308
|
+
let innerHTML = "";
|
|
309
|
+
for (const breakpoint in this.breakpoints) {
|
|
310
|
+
innerHTML += `
|
|
311
|
+
@media screen and (max-width: ${breakpoint}) {
|
|
312
|
+
.p-popover[${this.$attrSelector}] {
|
|
313
|
+
width: ${this.breakpoints[breakpoint]} !important;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
`;
|
|
317
|
+
}
|
|
318
|
+
this.styleElement.innerHTML = innerHTML;
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
destroyStyle() {
|
|
322
|
+
if (this.styleElement) {
|
|
323
|
+
document.head.removeChild(this.styleElement);
|
|
324
|
+
this.styleElement = null;
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
onOverlayClick(event) {
|
|
328
|
+
OverlayEventBus.emit("overlay-click", {
|
|
329
|
+
originalEvent: event,
|
|
330
|
+
target: this.target
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
</script>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
fixed: BooleanConstructor;
|
|
5
|
+
}>, {}, {
|
|
6
|
+
visible: boolean;
|
|
7
|
+
}, {}, {
|
|
8
|
+
toggle(event: any, target: any): void;
|
|
9
|
+
show(event: any, target: any): void;
|
|
10
|
+
hide(): void;
|
|
11
|
+
onContentClick(): void;
|
|
12
|
+
onEnter(el: any): void;
|
|
13
|
+
onLeave(): void;
|
|
14
|
+
onAfterLeave(el: any): void;
|
|
15
|
+
alignOverlay(): void;
|
|
16
|
+
fixPopoverPosition(container: any, target: any): void;
|
|
17
|
+
onContentKeydown(event: any): void;
|
|
18
|
+
onButtonKeydown(event: any): void;
|
|
19
|
+
focus(): void;
|
|
20
|
+
onKeyDown(event: any): void;
|
|
21
|
+
bindDocumentKeyDownListener(): void;
|
|
22
|
+
unbindDocumentKeyDownListener(): void;
|
|
23
|
+
bindOutsideClickListener(): void;
|
|
24
|
+
unbindOutsideClickListener(): void;
|
|
25
|
+
bindScrollListener(): void;
|
|
26
|
+
unbindScrollListener(): void;
|
|
27
|
+
bindResizeListener(): void;
|
|
28
|
+
unbindResizeListener(): void;
|
|
29
|
+
isTargetClicked(event: any): any;
|
|
30
|
+
containerRef(el: any): void;
|
|
31
|
+
createStyle(): void;
|
|
32
|
+
destroyStyle(): void;
|
|
33
|
+
onOverlayClick(event: any): void;
|
|
34
|
+
}, import("vue").ComponentOptionsMixin, any, ("show" | "hide")[], "show" | "hide", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
35
|
+
fixed: BooleanConstructor;
|
|
36
|
+
}>> & Readonly<{
|
|
37
|
+
onShow?: ((...args: any[]) => any) | undefined;
|
|
38
|
+
onHide?: ((...args: any[]) => any) | undefined;
|
|
39
|
+
}>, {
|
|
40
|
+
fixed: boolean;
|
|
41
|
+
}, {}, {
|
|
42
|
+
Portal: import("@primevue/core").DefineComponent<import("primevue").PortalProps, import("primevue").PortalSlots, (e: string, ...args: any[]) => void>;
|
|
43
|
+
}, {
|
|
44
|
+
focustrap: import("vue").ObjectDirective<any, any, string, any>;
|
|
45
|
+
ripple: import("vue").ObjectDirective<any, any, string, any>;
|
|
46
|
+
}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {
|
|
4
|
+
$emit: typeof emit;
|
|
5
|
+
$props: Partial<typeof __VLS_props>;
|
|
6
|
+
parameters: unknown[];
|
|
7
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
8
|
+
declare const emit: (event: "ready" | "changed", ...args: any[]) => void;
|
|
9
|
+
declare const __VLS_props: {
|
|
10
|
+
readonly parameters: unknown[];
|
|
11
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!--
|
|
3
|
+
[!NOTE]
|
|
4
|
+
|
|
5
|
+
unlike usual model passing, `.model` is not enough here in below. for
|
|
6
|
+
some reason vue rewraps the model which is already a ref, causing a
|
|
7
|
+
double ref. that's why `.model.value` is passed instead of `.model`
|
|
8
|
+
-->
|
|
9
|
+
<Bake
|
|
10
|
+
v-for="parameter in parameters"
|
|
11
|
+
:key="parameter.name"
|
|
12
|
+
v-model="values[parameter.name].model.value"
|
|
13
|
+
:name="`query-parameters/${parameter.name}`"
|
|
14
|
+
:descriptor="parameter.component"
|
|
15
|
+
/>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup>
|
|
19
|
+
import { computed, ref, onMounted, watch, watchEffect } from "vue";
|
|
20
|
+
import { useRoute, useRouter } from "#app";
|
|
21
|
+
import { Bake } from "#components";
|
|
22
|
+
import { useContext, useDataFetcher } from "#imports";
|
|
23
|
+
const route = useRoute();
|
|
24
|
+
const router = useRouter();
|
|
25
|
+
const dataFetcher = useDataFetcher();
|
|
26
|
+
const context = useContext();
|
|
27
|
+
const { parameters } = defineProps({
|
|
28
|
+
parameters: { type: Array, required: true }
|
|
29
|
+
});
|
|
30
|
+
const emit = defineEmits(["ready", "changed"]);
|
|
31
|
+
const injectedData = context.injectData();
|
|
32
|
+
const values = {};
|
|
33
|
+
for (const parameter of parameters) {
|
|
34
|
+
const query = computed(() => route.query[parameter.name]);
|
|
35
|
+
const model = ref(query.value);
|
|
36
|
+
values[parameter.name] = { query, model };
|
|
37
|
+
}
|
|
38
|
+
onMounted(async () => await setDefaults());
|
|
39
|
+
watchEffect(() => {
|
|
40
|
+
const queryValues = Object.values(values).map((p) => p.query.value);
|
|
41
|
+
const isReady = parameters.filter((p) => p.required).every((p) => values[p.name].query.value?.length > 0);
|
|
42
|
+
const uniqueKey = queryValues.filter((v) => v?.length > 0).join("-");
|
|
43
|
+
emit("ready", isReady);
|
|
44
|
+
emit("changed", uniqueKey);
|
|
45
|
+
});
|
|
46
|
+
watch(
|
|
47
|
+
Object.values(values).map((p) => p.query),
|
|
48
|
+
async (newValues, oldValues) => {
|
|
49
|
+
if (JSON.stringify(newValues) === JSON.stringify(oldValues)) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
await setDefaults();
|
|
53
|
+
parameters.forEach((param, i) => {
|
|
54
|
+
if (!values[param.name]) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
values[param.name].model.value = newValues[i] || void 0;
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
{ deep: true }
|
|
61
|
+
);
|
|
62
|
+
watch(
|
|
63
|
+
Object.values(values).map((p) => p.model),
|
|
64
|
+
async (newValues, oldValues) => {
|
|
65
|
+
if (JSON.stringify(newValues) === JSON.stringify(oldValues)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const shouldReplace = parameters.filter((p) => p.required && (p.default || p.defaultSelfManaged)).some((p) => !values[p.name].query.value);
|
|
69
|
+
const query = parameters.reduce((result, param, i) => {
|
|
70
|
+
const value = newValues[i];
|
|
71
|
+
if (value) {
|
|
72
|
+
result[param.name] = value;
|
|
73
|
+
}
|
|
74
|
+
return result;
|
|
75
|
+
}, {});
|
|
76
|
+
await router[shouldReplace ? "replace" : "push"]({
|
|
77
|
+
path: route.path,
|
|
78
|
+
query
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
{ deep: true }
|
|
82
|
+
);
|
|
83
|
+
async function setDefaults() {
|
|
84
|
+
const query = {};
|
|
85
|
+
for (const p of parameters) {
|
|
86
|
+
const currentValue = values[p.name].query.value;
|
|
87
|
+
if (currentValue || p.default) {
|
|
88
|
+
if (!currentValue && p.default) {
|
|
89
|
+
query[p.name] = await dataFetcher.fetch({ data: p.default, injectedData });
|
|
90
|
+
} else {
|
|
91
|
+
query[p.name] = currentValue;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (query[p.name] === null || query[p.name] === "") {
|
|
95
|
+
query[p.name] = void 0;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
await router.replace({
|
|
99
|
+
path: route.path,
|
|
100
|
+
query
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
</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
|
+
$emit: typeof emit;
|
|
5
|
+
$props: Partial<typeof __VLS_props>;
|
|
6
|
+
parameters: unknown[];
|
|
7
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
8
|
+
declare const emit: (event: "ready" | "changed", ...args: any[]) => void;
|
|
9
|
+
declare const __VLS_props: {
|
|
10
|
+
readonly parameters: unknown[];
|
|
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
|
+
};
|