@hywax/cms-console 1.0.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/.nuxt/cms-console/button-copy-text.ts +19 -0
- package/.nuxt/cms-console/button-delete-confirm.ts +5 -0
- package/.nuxt/cms-console/editor/index.ts +0 -0
- package/.nuxt/cms-console/form-panel-aside-section.ts +9 -0
- package/.nuxt/cms-console/form-panel-section.ts +8 -0
- package/.nuxt/cms-console/form-panel.ts +15 -0
- package/.nuxt/cms-console/index.ts +11 -0
- package/.nuxt/cms-console/input-seo.ts +5 -0
- package/.nuxt/cms-console/input-slug.ts +5 -0
- package/.nuxt/cms-console/input-uplora-image.ts +27 -0
- package/.nuxt/cms-console/modal-confirm.ts +5 -0
- package/.nuxt/cms-console/table-panel.ts +8 -0
- package/.nuxt/cms-console/table-search-input.ts +6 -0
- package/.nuxt/cms-console.css +31 -0
- package/dist/module.d.mts +11 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +387 -0
- package/dist/runtime/components/AutocompleteSelect.d.vue.ts +56 -0
- package/dist/runtime/components/AutocompleteSelect.vue +225 -0
- package/dist/runtime/components/AutocompleteSelect.vue.d.ts +56 -0
- package/dist/runtime/components/ButtonCopyText.d.vue.ts +28 -0
- package/dist/runtime/components/ButtonCopyText.vue +70 -0
- package/dist/runtime/components/ButtonCopyText.vue.d.ts +28 -0
- package/dist/runtime/components/ButtonDeleteConfirm.d.vue.ts +38 -0
- package/dist/runtime/components/ButtonDeleteConfirm.vue +62 -0
- package/dist/runtime/components/ButtonDeleteConfirm.vue.d.ts +38 -0
- package/dist/runtime/components/DatePicker.d.vue.ts +43 -0
- package/dist/runtime/components/DatePicker.vue +232 -0
- package/dist/runtime/components/DatePicker.vue.d.ts +43 -0
- package/dist/runtime/components/EditorFull.d.vue.ts +13 -0
- package/dist/runtime/components/EditorFull.vue +139 -0
- package/dist/runtime/components/EditorFull.vue.d.ts +13 -0
- package/dist/runtime/components/EditorLinkPopover.d.vue.ts +8 -0
- package/dist/runtime/components/EditorLinkPopover.vue +137 -0
- package/dist/runtime/components/EditorLinkPopover.vue.d.ts +8 -0
- package/dist/runtime/components/FormPanel.d.vue.ts +47 -0
- package/dist/runtime/components/FormPanel.vue +73 -0
- package/dist/runtime/components/FormPanel.vue.d.ts +47 -0
- package/dist/runtime/components/FormPanelAsideSection.d.vue.ts +24 -0
- package/dist/runtime/components/FormPanelAsideSection.vue +41 -0
- package/dist/runtime/components/FormPanelAsideSection.vue.d.ts +24 -0
- package/dist/runtime/components/FormPanelSection.d.vue.ts +21 -0
- package/dist/runtime/components/FormPanelSection.vue +31 -0
- package/dist/runtime/components/FormPanelSection.vue.d.ts +21 -0
- package/dist/runtime/components/InputSeo.d.vue.ts +21 -0
- package/dist/runtime/components/InputSeo.vue +73 -0
- package/dist/runtime/components/InputSeo.vue.d.ts +21 -0
- package/dist/runtime/components/InputSlug.d.vue.ts +30 -0
- package/dist/runtime/components/InputSlug.vue +70 -0
- package/dist/runtime/components/InputSlug.vue.d.ts +30 -0
- package/dist/runtime/components/InputUploraImage.d.vue.ts +39 -0
- package/dist/runtime/components/InputUploraImage.vue +163 -0
- package/dist/runtime/components/InputUploraImage.vue.d.ts +39 -0
- package/dist/runtime/components/Layout.d.vue.ts +30 -0
- package/dist/runtime/components/Layout.vue +82 -0
- package/dist/runtime/components/Layout.vue.d.ts +30 -0
- package/dist/runtime/components/ModalConfirm.d.vue.ts +33 -0
- package/dist/runtime/components/ModalConfirm.vue +97 -0
- package/dist/runtime/components/ModalConfirm.vue.d.ts +33 -0
- package/dist/runtime/components/TableColumnSorting.d.vue.ts +17 -0
- package/dist/runtime/components/TableColumnSorting.vue +81 -0
- package/dist/runtime/components/TableColumnSorting.vue.d.ts +17 -0
- package/dist/runtime/components/TableColumnVisibility.d.vue.ts +24 -0
- package/dist/runtime/components/TableColumnVisibility.vue +110 -0
- package/dist/runtime/components/TableColumnVisibility.vue.d.ts +24 -0
- package/dist/runtime/components/TableFilters.d.vue.ts +90 -0
- package/dist/runtime/components/TableFilters.vue +199 -0
- package/dist/runtime/components/TableFilters.vue.d.ts +90 -0
- package/dist/runtime/components/TablePanel.d.vue.ts +95 -0
- package/dist/runtime/components/TablePanel.vue +297 -0
- package/dist/runtime/components/TablePanel.vue.d.ts +95 -0
- package/dist/runtime/components/TableSearchInput.d.vue.ts +33 -0
- package/dist/runtime/components/TableSearchInput.vue +97 -0
- package/dist/runtime/components/TableSearchInput.vue.d.ts +33 -0
- package/dist/runtime/composables/useAdmin.d.ts +6 -0
- package/dist/runtime/composables/useAdmin.js +14 -0
- package/dist/runtime/composables/useEditorDragHandle.d.ts +17 -0
- package/dist/runtime/composables/useEditorDragHandle.js +95 -0
- package/dist/runtime/composables/useEditorSuggestions.d.ts +74 -0
- package/dist/runtime/composables/useEditorSuggestions.js +25 -0
- package/dist/runtime/composables/useEditorToolbar.d.ts +121 -0
- package/dist/runtime/composables/useEditorToolbar.js +87 -0
- package/dist/runtime/composables/useQueryState.d.ts +28 -0
- package/dist/runtime/composables/useQueryState.js +105 -0
- package/dist/runtime/composables/useRouteQuery.d.ts +37 -0
- package/dist/runtime/composables/useRouteQuery.js +81 -0
- package/dist/runtime/composables/useSeoStats.d.ts +12 -0
- package/dist/runtime/composables/useSeoStats.js +44 -0
- package/dist/runtime/composables/useTable.d.ts +25 -0
- package/dist/runtime/composables/useTable.js +84 -0
- package/dist/runtime/composables/useTableColumns.d.ts +28 -0
- package/dist/runtime/composables/useTableColumns.js +54 -0
- package/dist/runtime/editor/uplora-image/EditorUploraImage.d.ts +18 -0
- package/dist/runtime/editor/uplora-image/EditorUploraImage.js +42 -0
- package/dist/runtime/editor/uplora-image/EditorUploraImageNode.d.vue.ts +4 -0
- package/dist/runtime/editor/uplora-image/EditorUploraImageNode.vue +23 -0
- package/dist/runtime/editor/uplora-image/EditorUploraImageNode.vue.d.ts +4 -0
- package/dist/runtime/index.css +1 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/tv.d.ts +1 -0
- package/dist/runtime/tv.js +4 -0
- package/dist/runtime/types/app.config.d.ts +6 -0
- package/dist/runtime/types/date.d.ts +5 -0
- package/dist/runtime/types/date.js +0 -0
- package/dist/runtime/types/dictionaries.d.ts +1 -0
- package/dist/runtime/types/dictionaries.js +0 -0
- package/dist/runtime/types/index.d.ts +30 -0
- package/dist/runtime/types/index.js +30 -0
- package/dist/runtime/types/seo.d.ts +4 -0
- package/dist/runtime/types/seo.js +0 -0
- package/dist/runtime/utils/auth.d.ts +2 -0
- package/dist/runtime/utils/auth.js +5 -0
- package/dist/runtime/utils/date.d.ts +5 -0
- package/dist/runtime/utils/date.js +15 -0
- package/dist/runtime/utils/formatters.d.ts +5 -0
- package/dist/runtime/utils/formatters.js +24 -0
- package/dist/runtime/utils/index.d.ts +4 -0
- package/dist/runtime/utils/index.js +4 -0
- package/dist/runtime/utils/slugify.d.ts +1 -0
- package/dist/runtime/utils/slugify.js +11 -0
- package/dist/types.d.mts +11 -0
- package/package.json +89 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Primitive :as="as" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
|
3
|
+
<template v-if="modelValue.image">
|
|
4
|
+
<UPopover
|
|
5
|
+
:content="{ align: 'center', side: 'top', sideOffset: 8 }"
|
|
6
|
+
:ui="{ content: 'p-1' }"
|
|
7
|
+
>
|
|
8
|
+
<CUploraImage
|
|
9
|
+
:image="modelValue.image"
|
|
10
|
+
:alt="modelValue.alt"
|
|
11
|
+
:lqip="modelValue.lqip"
|
|
12
|
+
:class="ui.image({ class: [props.ui?.image] })"
|
|
13
|
+
/>
|
|
14
|
+
|
|
15
|
+
<div v-if="!modelValue.alt" :class="ui.imageActionsWarning({ class: [props.ui?.imageActionsWarning] })">
|
|
16
|
+
<UIcon :name="appConfig.ui.icons.warning" class="size-4" />
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<template #content>
|
|
20
|
+
<div class="flex items-center gap-0.5">
|
|
21
|
+
<UPopover :ui="{ content: 'p-1' }" @update:open="syncState">
|
|
22
|
+
<UButton
|
|
23
|
+
color="neutral"
|
|
24
|
+
size="sm"
|
|
25
|
+
variant="ghost"
|
|
26
|
+
:icon="appConfig.ui.icons.editLine"
|
|
27
|
+
/>
|
|
28
|
+
<template #content>
|
|
29
|
+
<UTextarea
|
|
30
|
+
v-model="state.alt"
|
|
31
|
+
placeholder="Введите описание..."
|
|
32
|
+
autoresize
|
|
33
|
+
variant="none"
|
|
34
|
+
size="xs"
|
|
35
|
+
/>
|
|
36
|
+
</template>
|
|
37
|
+
</UPopover>
|
|
38
|
+
|
|
39
|
+
<ButtonDeleteConfirm
|
|
40
|
+
color="error"
|
|
41
|
+
size="sm"
|
|
42
|
+
variant="ghost"
|
|
43
|
+
label=""
|
|
44
|
+
:icon="appConfig.ui.icons.trash"
|
|
45
|
+
@confirm="deleteExecute(modelValue.image)"
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
49
|
+
</UPopover>
|
|
50
|
+
</template>
|
|
51
|
+
<div v-else :id="id" :class="ui.uploader({ class: [props.ui?.uploader] })">
|
|
52
|
+
<template v-if="uploadStatus === 'pending'">
|
|
53
|
+
<UIcon :name="appConfig.ui.icons.loading" :class="ui.uploaderPendingIcon({ class: [props.ui?.uploaderPendingIcon] })" />
|
|
54
|
+
</template>
|
|
55
|
+
<template v-else-if="uploadStatus === 'idle'">
|
|
56
|
+
<button
|
|
57
|
+
type="button"
|
|
58
|
+
:class="ui.uploaderIdleButton({ class: [props.ui?.uploaderIdleButton] })"
|
|
59
|
+
:disabled="disabled"
|
|
60
|
+
v-bind="ariaAttrs"
|
|
61
|
+
@click="open"
|
|
62
|
+
>
|
|
63
|
+
<UAvatar :icon="appConfig.ui.icons.image" size="lg" />
|
|
64
|
+
|
|
65
|
+
<p :class="ui.uploaderIdleText({ class: [props.ui?.uploaderIdleText] })">
|
|
66
|
+
Загрузить изображение
|
|
67
|
+
</p>
|
|
68
|
+
<p :class="ui.uploaderIdleExtensions({ class: [props.ui?.uploaderIdleExtensions] })">
|
|
69
|
+
{{ extensions }}
|
|
70
|
+
</p>
|
|
71
|
+
</button>
|
|
72
|
+
</template>
|
|
73
|
+
<template v-else-if="uploadStatus === 'error'">
|
|
74
|
+
<p :class="ui.uploaderErrorText({ class: [props.ui?.uploaderErrorText] })">
|
|
75
|
+
Произошла ошибка при загрузке изображения
|
|
76
|
+
</p>
|
|
77
|
+
<div :class="ui.uploaderErrorActions({ class: [props.ui?.uploaderErrorActions] })">
|
|
78
|
+
<UButton
|
|
79
|
+
label="Отменить"
|
|
80
|
+
variant="ghost"
|
|
81
|
+
color="neutral"
|
|
82
|
+
@click="resetUpload"
|
|
83
|
+
/>
|
|
84
|
+
<UButton
|
|
85
|
+
label="Повторить"
|
|
86
|
+
variant="soft"
|
|
87
|
+
color="neutral"
|
|
88
|
+
@click="uploadExecute"
|
|
89
|
+
/>
|
|
90
|
+
</div>
|
|
91
|
+
</template>
|
|
92
|
+
</div>
|
|
93
|
+
</Primitive>
|
|
94
|
+
</template>
|
|
95
|
+
|
|
96
|
+
<script>
|
|
97
|
+
import theme from "#build/cms-console/input-uplora-image";
|
|
98
|
+
import { computed, reactive, useAppConfig, useFormField, useId, useUploraDelete, useUploraUpload } from "#imports";
|
|
99
|
+
import { imagesExtensions } from "@uplora/formats";
|
|
100
|
+
import { Primitive } from "reka-ui";
|
|
101
|
+
import { tv } from "../tv";
|
|
102
|
+
import ButtonDeleteConfirm from "./ButtonDeleteConfirm.vue";
|
|
103
|
+
</script>
|
|
104
|
+
|
|
105
|
+
<script setup>
|
|
106
|
+
const props = defineProps({
|
|
107
|
+
showExtensions: { type: Boolean, required: false, default: true },
|
|
108
|
+
id: { type: String, required: false },
|
|
109
|
+
name: { type: String, required: false },
|
|
110
|
+
disabled: { type: Boolean, required: false },
|
|
111
|
+
as: { type: null, required: false },
|
|
112
|
+
class: { type: null, required: false },
|
|
113
|
+
ui: { type: null, required: false }
|
|
114
|
+
});
|
|
115
|
+
const emit = defineEmits(["upload", "delete"]);
|
|
116
|
+
const modelValue = defineModel({ type: Object, ...{
|
|
117
|
+
default: () => ({
|
|
118
|
+
image: "",
|
|
119
|
+
alt: ""
|
|
120
|
+
})
|
|
121
|
+
} });
|
|
122
|
+
const appConfig = useAppConfig();
|
|
123
|
+
const extensions = computed(() => imagesExtensions.filter((extension) => extension !== "jpeg").join(", "));
|
|
124
|
+
const state = reactive({
|
|
125
|
+
alt: modelValue.value.alt
|
|
126
|
+
});
|
|
127
|
+
const { id: _id, disabled, emitFormChange, emitFormInput, ariaAttrs } = useFormField(props);
|
|
128
|
+
const id = _id.value ?? useId();
|
|
129
|
+
const { open, execute: uploadExecute, status: uploadStatus, reset: resetUpload, onUploaded } = useUploraUpload({
|
|
130
|
+
accept: "image/*"
|
|
131
|
+
});
|
|
132
|
+
const { execute: deleteExecute, onDeleted } = useUploraDelete();
|
|
133
|
+
onUploaded((file) => {
|
|
134
|
+
modelValue.value = {
|
|
135
|
+
...modelValue.value,
|
|
136
|
+
image: file.id,
|
|
137
|
+
lqip: file.lqip
|
|
138
|
+
};
|
|
139
|
+
emit("upload", modelValue.value);
|
|
140
|
+
emitFormChange();
|
|
141
|
+
emitFormInput();
|
|
142
|
+
});
|
|
143
|
+
onDeleted(() => {
|
|
144
|
+
resetUpload();
|
|
145
|
+
modelValue.value = {
|
|
146
|
+
image: "",
|
|
147
|
+
alt: ""
|
|
148
|
+
};
|
|
149
|
+
emit("delete");
|
|
150
|
+
emitFormChange();
|
|
151
|
+
emitFormInput();
|
|
152
|
+
});
|
|
153
|
+
function syncState() {
|
|
154
|
+
modelValue.value = {
|
|
155
|
+
...modelValue.value,
|
|
156
|
+
alt: state.alt
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.cms?.inputUploraImage || {} })({
|
|
160
|
+
disabled: disabled.value,
|
|
161
|
+
uploaded: modelValue.value.image !== ""
|
|
162
|
+
}));
|
|
163
|
+
</script>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ComponentConfig } from '@hywax/cms-runtime';
|
|
2
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
3
|
+
import theme from '#build/cms-console/input-uplora-image';
|
|
4
|
+
type InputUploraImage = ComponentConfig<typeof theme, AppConfig, 'inputUploraImage'>;
|
|
5
|
+
export interface InputUploraImageProps {
|
|
6
|
+
showExtensions?: boolean;
|
|
7
|
+
id?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
as?: any;
|
|
11
|
+
class?: any;
|
|
12
|
+
ui?: InputUploraImage['slots'];
|
|
13
|
+
}
|
|
14
|
+
export interface InputUploraImageEmits {
|
|
15
|
+
upload: [InputUploraImageModelValue];
|
|
16
|
+
delete: [];
|
|
17
|
+
}
|
|
18
|
+
export interface InputUploraImageModelValue {
|
|
19
|
+
image: string;
|
|
20
|
+
alt: string;
|
|
21
|
+
lqip?: string;
|
|
22
|
+
}
|
|
23
|
+
declare const _default: typeof __VLS_export;
|
|
24
|
+
export default _default;
|
|
25
|
+
declare const __VLS_export: import("vue").DefineComponent<InputUploraImageProps & {
|
|
26
|
+
modelValue?: InputUploraImageModelValue;
|
|
27
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
28
|
+
delete: () => any;
|
|
29
|
+
"update:modelValue": (value: InputUploraImageModelValue) => any;
|
|
30
|
+
upload: (args_0: InputUploraImageModelValue) => any;
|
|
31
|
+
}, string, import("vue").PublicProps, Readonly<InputUploraImageProps & {
|
|
32
|
+
modelValue?: InputUploraImageModelValue;
|
|
33
|
+
}> & Readonly<{
|
|
34
|
+
onDelete?: (() => any) | undefined;
|
|
35
|
+
"onUpdate:modelValue"?: ((value: InputUploraImageModelValue) => any) | undefined;
|
|
36
|
+
onUpload?: ((args_0: InputUploraImageModelValue) => any) | undefined;
|
|
37
|
+
}>, {
|
|
38
|
+
showExtensions: boolean;
|
|
39
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { NavigationMenuItem } from '@nuxt/ui';
|
|
2
|
+
import type { RouteLocationRaw } from 'vue-router';
|
|
3
|
+
interface LayoutProps {
|
|
4
|
+
navigation: NavigationMenuItem[];
|
|
5
|
+
links?: NavigationMenuItem[];
|
|
6
|
+
version?: string;
|
|
7
|
+
logotype?: string;
|
|
8
|
+
logotypeIcon?: string;
|
|
9
|
+
logotypeShortIcon?: string;
|
|
10
|
+
homeLink?: RouteLocationRaw;
|
|
11
|
+
}
|
|
12
|
+
interface DashboardLayoutSlots {
|
|
13
|
+
default: () => any;
|
|
14
|
+
logotype: (props: {
|
|
15
|
+
collapsed: boolean | undefined;
|
|
16
|
+
}) => any;
|
|
17
|
+
footer: (props: {
|
|
18
|
+
collapsed: boolean | undefined;
|
|
19
|
+
}) => any;
|
|
20
|
+
}
|
|
21
|
+
type __VLS_Slots = DashboardLayoutSlots;
|
|
22
|
+
declare const __VLS_base: import("vue").DefineComponent<LayoutProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<LayoutProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
24
|
+
declare const _default: typeof __VLS_export;
|
|
25
|
+
export default _default;
|
|
26
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
27
|
+
new (): {
|
|
28
|
+
$slots: S;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<UDashboardGroup unit="rem">
|
|
3
|
+
<UDashboardSidebar
|
|
4
|
+
v-model:open="isSidebarOpen"
|
|
5
|
+
v-model:collapsed="isSidebarCollapsed"
|
|
6
|
+
:ui="{ root: 'bg-elevated/25', footer: 'lg:border-t lg:border-default' }"
|
|
7
|
+
collapsible
|
|
8
|
+
>
|
|
9
|
+
<template #header="{ collapsed }">
|
|
10
|
+
<slot name="logotype" :collapsed="collapsed">
|
|
11
|
+
<NuxtLink :to="homeLink" class="flex items-center gap-2.5" :class="collapsed && 'mx-auto'">
|
|
12
|
+
<UIcon v-if="logotypeIcon && logotypeShortIcon" :name="collapsed ? logotypeShortIcon : logotypeIcon" />
|
|
13
|
+
|
|
14
|
+
<template v-if="version">
|
|
15
|
+
<UBadge
|
|
16
|
+
v-show="!collapsed"
|
|
17
|
+
color="primary"
|
|
18
|
+
variant="soft"
|
|
19
|
+
size="sm"
|
|
20
|
+
:label="version"
|
|
21
|
+
/>
|
|
22
|
+
</template>
|
|
23
|
+
</NuxtLink>
|
|
24
|
+
</slot>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<template #default="{ collapsed }">
|
|
28
|
+
<UNavigationMenu
|
|
29
|
+
:collapsed="collapsed"
|
|
30
|
+
:items="navigation"
|
|
31
|
+
orientation="vertical"
|
|
32
|
+
tooltip
|
|
33
|
+
popover
|
|
34
|
+
/>
|
|
35
|
+
|
|
36
|
+
<UNavigationMenu
|
|
37
|
+
:collapsed="collapsed"
|
|
38
|
+
:items="links"
|
|
39
|
+
orientation="vertical"
|
|
40
|
+
tooltip
|
|
41
|
+
class="mt-auto"
|
|
42
|
+
/>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<template v-if="$slots.footer" #footer="{ collapsed }">
|
|
46
|
+
<div class="my-1 w-full">
|
|
47
|
+
<slot name="footer" :collapsed="collapsed" />
|
|
48
|
+
</div>
|
|
49
|
+
</template>
|
|
50
|
+
</UDashboardSidebar>
|
|
51
|
+
|
|
52
|
+
<slot />
|
|
53
|
+
</UDashboardGroup>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<script setup>
|
|
57
|
+
import { useAppConfig } from "#imports";
|
|
58
|
+
import { computed } from "vue";
|
|
59
|
+
import { useAdmin } from "../composables/useAdmin";
|
|
60
|
+
const props = defineProps({
|
|
61
|
+
navigation: { type: Array, required: true },
|
|
62
|
+
links: { type: Array, required: false },
|
|
63
|
+
version: { type: String, required: false },
|
|
64
|
+
logotype: { type: String, required: false },
|
|
65
|
+
logotypeIcon: { type: String, required: false },
|
|
66
|
+
logotypeShortIcon: { type: String, required: false },
|
|
67
|
+
homeLink: { type: null, required: false }
|
|
68
|
+
});
|
|
69
|
+
defineSlots();
|
|
70
|
+
const appConfig = useAppConfig();
|
|
71
|
+
const { isSidebarOpen, isSidebarCollapsed } = useAdmin();
|
|
72
|
+
const links = computed(() => [
|
|
73
|
+
...props.links || [],
|
|
74
|
+
{
|
|
75
|
+
label: isSidebarCollapsed.value ? "\u0420\u0430\u0437\u0432\u0435\u0440\u043D\u0443\u0442\u044C \u043C\u0435\u043D\u044E" : "\u0421\u0432\u0435\u0440\u043D\u0443\u0442\u044C \u043C\u0435\u043D\u044E",
|
|
76
|
+
icon: isSidebarCollapsed.value ? appConfig.ui.icons.panelClose : appConfig.ui.icons.panelOpen,
|
|
77
|
+
onSelect: () => {
|
|
78
|
+
isSidebarCollapsed.value = !isSidebarCollapsed.value;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
]);
|
|
82
|
+
</script>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { NavigationMenuItem } from '@nuxt/ui';
|
|
2
|
+
import type { RouteLocationRaw } from 'vue-router';
|
|
3
|
+
interface LayoutProps {
|
|
4
|
+
navigation: NavigationMenuItem[];
|
|
5
|
+
links?: NavigationMenuItem[];
|
|
6
|
+
version?: string;
|
|
7
|
+
logotype?: string;
|
|
8
|
+
logotypeIcon?: string;
|
|
9
|
+
logotypeShortIcon?: string;
|
|
10
|
+
homeLink?: RouteLocationRaw;
|
|
11
|
+
}
|
|
12
|
+
interface DashboardLayoutSlots {
|
|
13
|
+
default: () => any;
|
|
14
|
+
logotype: (props: {
|
|
15
|
+
collapsed: boolean | undefined;
|
|
16
|
+
}) => any;
|
|
17
|
+
footer: (props: {
|
|
18
|
+
collapsed: boolean | undefined;
|
|
19
|
+
}) => any;
|
|
20
|
+
}
|
|
21
|
+
type __VLS_Slots = DashboardLayoutSlots;
|
|
22
|
+
declare const __VLS_base: import("vue").DefineComponent<LayoutProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<LayoutProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
24
|
+
declare const _default: typeof __VLS_export;
|
|
25
|
+
export default _default;
|
|
26
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
27
|
+
new (): {
|
|
28
|
+
$slots: S;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ComponentConfig } from '@hywax/cms-runtime';
|
|
2
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
3
|
+
import type { ButtonProps } from '@nuxt/ui';
|
|
4
|
+
import theme from '#build/cms-console/modal-confirm';
|
|
5
|
+
type ModalConfirm = ComponentConfig<typeof theme, AppConfig, 'modalConfirm'>;
|
|
6
|
+
export interface ModalConfirmProps {
|
|
7
|
+
title?: string;
|
|
8
|
+
message: string;
|
|
9
|
+
confirmText?: string;
|
|
10
|
+
confirmLabel?: string;
|
|
11
|
+
color?: ButtonProps['color'];
|
|
12
|
+
variant?: ButtonProps['variant'];
|
|
13
|
+
size?: ButtonProps['size'];
|
|
14
|
+
onConfirm?: () => Promise<any> | any;
|
|
15
|
+
class?: any;
|
|
16
|
+
ui?: ModalConfirm['slots'];
|
|
17
|
+
}
|
|
18
|
+
export interface ModalConfirmEmits {
|
|
19
|
+
confirm: [];
|
|
20
|
+
close: [];
|
|
21
|
+
}
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
24
|
+
declare const __VLS_export: import("vue").DefineComponent<ModalConfirmProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
25
|
+
close: () => any;
|
|
26
|
+
confirm: () => any;
|
|
27
|
+
}, string, import("vue").PublicProps, Readonly<ModalConfirmProps> & Readonly<{
|
|
28
|
+
onClose?: (() => any) | undefined;
|
|
29
|
+
onConfirm?: (() => any) | undefined;
|
|
30
|
+
}>, {
|
|
31
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
32
|
+
confirmLabel: string;
|
|
33
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<UModal
|
|
3
|
+
:title="title"
|
|
4
|
+
:ui="{
|
|
5
|
+
content: 'divide-y-0',
|
|
6
|
+
body: 'py-0! text-sm',
|
|
7
|
+
description: 'hidden',
|
|
8
|
+
footer: 'justify-end'
|
|
9
|
+
}"
|
|
10
|
+
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
11
|
+
>
|
|
12
|
+
<template #description />
|
|
13
|
+
<template #body>
|
|
14
|
+
{{ message }}
|
|
15
|
+
|
|
16
|
+
<UForm
|
|
17
|
+
v-if="confirmText"
|
|
18
|
+
id="confirm-form"
|
|
19
|
+
ref="form"
|
|
20
|
+
class="pt-3"
|
|
21
|
+
:state="state"
|
|
22
|
+
@submit="handleConfirmClick()"
|
|
23
|
+
>
|
|
24
|
+
<UFormField name="confirmTextValue">
|
|
25
|
+
<template #label>
|
|
26
|
+
Введите <strong class="text-highlighted">{{ confirmText }}</strong> для подтверждения
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<UInput v-model="state.confirmTextValue" class="w-full" />
|
|
30
|
+
</UFormField>
|
|
31
|
+
</UForm>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<template #footer>
|
|
35
|
+
<UButton
|
|
36
|
+
color="neutral"
|
|
37
|
+
label="Закрыть"
|
|
38
|
+
variant="ghost"
|
|
39
|
+
:size="size"
|
|
40
|
+
@click="emit('close')"
|
|
41
|
+
/>
|
|
42
|
+
|
|
43
|
+
<UButton
|
|
44
|
+
v-if="confirmText"
|
|
45
|
+
form="confirm-form"
|
|
46
|
+
type="submit"
|
|
47
|
+
:label="confirmLabel"
|
|
48
|
+
:disabled="state.confirmTextValue !== confirmText"
|
|
49
|
+
:loading="form?.loading"
|
|
50
|
+
:color="color"
|
|
51
|
+
:variant="variant"
|
|
52
|
+
:size="size"
|
|
53
|
+
/>
|
|
54
|
+
<UButton
|
|
55
|
+
v-else
|
|
56
|
+
label="Подтвердить"
|
|
57
|
+
loading-auto
|
|
58
|
+
:color="color"
|
|
59
|
+
:variant="variant"
|
|
60
|
+
:size="size"
|
|
61
|
+
@click="handleConfirmClick()"
|
|
62
|
+
/>
|
|
63
|
+
</template>
|
|
64
|
+
</UModal>
|
|
65
|
+
</template>
|
|
66
|
+
|
|
67
|
+
<script>
|
|
68
|
+
import theme from "#build/cms-console/modal-confirm";
|
|
69
|
+
import { computed, reactive, useAppConfig, useTemplateRef } from "#imports";
|
|
70
|
+
import { tv } from "../tv";
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<script setup>
|
|
74
|
+
const props = defineProps({
|
|
75
|
+
title: { type: String, required: false },
|
|
76
|
+
message: { type: String, required: true },
|
|
77
|
+
confirmText: { type: String, required: false },
|
|
78
|
+
confirmLabel: { type: String, required: false, default: "\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C" },
|
|
79
|
+
color: { type: null, required: false },
|
|
80
|
+
variant: { type: null, required: false },
|
|
81
|
+
size: { type: null, required: false, default: "lg" },
|
|
82
|
+
onConfirm: { type: Function, required: false },
|
|
83
|
+
class: { type: null, required: false },
|
|
84
|
+
ui: { type: null, required: false }
|
|
85
|
+
});
|
|
86
|
+
const emit = defineEmits(["confirm", "close"]);
|
|
87
|
+
const appConfig = useAppConfig();
|
|
88
|
+
const form = useTemplateRef("form");
|
|
89
|
+
const state = reactive({
|
|
90
|
+
confirmTextValue: ""
|
|
91
|
+
});
|
|
92
|
+
async function handleConfirmClick() {
|
|
93
|
+
await props.onConfirm?.();
|
|
94
|
+
emit("close");
|
|
95
|
+
}
|
|
96
|
+
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.cms?.modalConfirm || {} })());
|
|
97
|
+
</script>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ComponentConfig } from '@hywax/cms-runtime';
|
|
2
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
3
|
+
import type { ButtonProps } from '@nuxt/ui';
|
|
4
|
+
import theme from '#build/cms-console/modal-confirm';
|
|
5
|
+
type ModalConfirm = ComponentConfig<typeof theme, AppConfig, 'modalConfirm'>;
|
|
6
|
+
export interface ModalConfirmProps {
|
|
7
|
+
title?: string;
|
|
8
|
+
message: string;
|
|
9
|
+
confirmText?: string;
|
|
10
|
+
confirmLabel?: string;
|
|
11
|
+
color?: ButtonProps['color'];
|
|
12
|
+
variant?: ButtonProps['variant'];
|
|
13
|
+
size?: ButtonProps['size'];
|
|
14
|
+
onConfirm?: () => Promise<any> | any;
|
|
15
|
+
class?: any;
|
|
16
|
+
ui?: ModalConfirm['slots'];
|
|
17
|
+
}
|
|
18
|
+
export interface ModalConfirmEmits {
|
|
19
|
+
confirm: [];
|
|
20
|
+
close: [];
|
|
21
|
+
}
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
24
|
+
declare const __VLS_export: import("vue").DefineComponent<ModalConfirmProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
25
|
+
close: () => any;
|
|
26
|
+
confirm: () => any;
|
|
27
|
+
}, string, import("vue").PublicProps, Readonly<ModalConfirmProps> & Readonly<{
|
|
28
|
+
onClose?: (() => any) | undefined;
|
|
29
|
+
onConfirm?: (() => any) | undefined;
|
|
30
|
+
}>, {
|
|
31
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
32
|
+
confirmLabel: string;
|
|
33
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SortingState, Table } from '@tanstack/vue-table';
|
|
2
|
+
export interface TableColumnSortingProps {
|
|
3
|
+
table?: Table<any>;
|
|
4
|
+
}
|
|
5
|
+
export type TableColumnSortingModel = SortingState;
|
|
6
|
+
type __VLS_Props = TableColumnSortingProps;
|
|
7
|
+
type __VLS_ModelProps = {
|
|
8
|
+
modelValue?: TableColumnSortingModel;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
"update:modelValue": (value: SortingState) => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
14
|
+
"onUpdate:modelValue"?: ((value: SortingState) => any) | undefined;
|
|
15
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<UPopover v-if="sortingColumns.length > 0" v-model:open="isOpen">
|
|
3
|
+
<UChip :ui="{ base: 'z-1 size-3' }" :show="model.length > 0" size="xl">
|
|
4
|
+
<UButton
|
|
5
|
+
variant="subtle"
|
|
6
|
+
color="neutral"
|
|
7
|
+
label="Сортировка"
|
|
8
|
+
:icon="appConfig.ui.icons.sort"
|
|
9
|
+
/>
|
|
10
|
+
</UChip>
|
|
11
|
+
|
|
12
|
+
<template #content>
|
|
13
|
+
<div class="flex flex-col gap-2 p-3">
|
|
14
|
+
<URadioGroup
|
|
15
|
+
:model-value="model[0]?.id ?? noSortColumn.value"
|
|
16
|
+
:items="sortingColumns"
|
|
17
|
+
@update:model-value="updateModel({ id: $event, desc: model[0]?.desc ?? false })"
|
|
18
|
+
/>
|
|
19
|
+
|
|
20
|
+
<USeparator />
|
|
21
|
+
|
|
22
|
+
<div class="flex gap-2">
|
|
23
|
+
<UButton
|
|
24
|
+
v-for="item in sortOrder"
|
|
25
|
+
:key="item.icon"
|
|
26
|
+
:icon="item.icon"
|
|
27
|
+
:label="item.label"
|
|
28
|
+
:disabled="!model[0]"
|
|
29
|
+
:variant="item.desc === (model[0]?.desc ?? false) ? 'soft' : 'ghost'"
|
|
30
|
+
size="sm"
|
|
31
|
+
color="neutral"
|
|
32
|
+
class="flex-1"
|
|
33
|
+
@click="updateModel({ id: model[0]?.id ?? '', desc: item.desc })"
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
</UPopover>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script setup>
|
|
42
|
+
import { useAppConfig } from "#imports";
|
|
43
|
+
import { computed, ref } from "vue";
|
|
44
|
+
const props = defineProps({
|
|
45
|
+
table: { type: Object, required: false }
|
|
46
|
+
});
|
|
47
|
+
const model = defineModel({ type: Array, ...{ default: [] } });
|
|
48
|
+
const appConfig = useAppConfig();
|
|
49
|
+
const noSortColumn = { label: "\u0411\u0435\u0437 \u0441\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0438", value: "null" };
|
|
50
|
+
const sortingColumns = computed(() => {
|
|
51
|
+
if (!props.table) {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
const items = props.table.getAllColumns().filter((column) => column.columnDef.enableSorting).map((column) => {
|
|
55
|
+
const label = column.columnDef.meta?.headerLabel ?? (typeof column.columnDef.header === "string" ? column.columnDef.header : column.columnDef.id);
|
|
56
|
+
return {
|
|
57
|
+
label,
|
|
58
|
+
value: column.id
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
items.length > 0 && items.unshift(noSortColumn);
|
|
62
|
+
return items;
|
|
63
|
+
});
|
|
64
|
+
const sortOrder = [
|
|
65
|
+
{ icon: appConfig.ui.icons.sortAsc, label: "\u0410-\u042F", desc: false },
|
|
66
|
+
{ icon: appConfig.ui.icons.sortDesc, label: "\u042F-\u0410", desc: true }
|
|
67
|
+
];
|
|
68
|
+
function updateModel(value) {
|
|
69
|
+
const currentSort = model.value[0];
|
|
70
|
+
const shouldUpdate = currentSort?.id !== value.id || currentSort?.desc !== value.desc || value.id === noSortColumn.value && model.value.length > 0;
|
|
71
|
+
if (!shouldUpdate) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (value.id === noSortColumn.value) {
|
|
75
|
+
model.value = [];
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
model.value = [value];
|
|
79
|
+
}
|
|
80
|
+
const isOpen = ref(false);
|
|
81
|
+
</script>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SortingState, Table } from '@tanstack/vue-table';
|
|
2
|
+
export interface TableColumnSortingProps {
|
|
3
|
+
table?: Table<any>;
|
|
4
|
+
}
|
|
5
|
+
export type TableColumnSortingModel = SortingState;
|
|
6
|
+
type __VLS_Props = TableColumnSortingProps;
|
|
7
|
+
type __VLS_ModelProps = {
|
|
8
|
+
modelValue?: TableColumnSortingModel;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
"update:modelValue": (value: SortingState) => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
14
|
+
"onUpdate:modelValue"?: ((value: SortingState) => any) | undefined;
|
|
15
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ColumnOrderState, Table, VisibilityState } from '@tanstack/vue-table';
|
|
2
|
+
export interface TableColumnVisibilityProps {
|
|
3
|
+
storageKey?: string;
|
|
4
|
+
table?: Table<any>;
|
|
5
|
+
}
|
|
6
|
+
export type TableColumnVisibilityModel = VisibilityState;
|
|
7
|
+
export type TableColumnVisibilityOrderModel = ColumnOrderState;
|
|
8
|
+
type __VLS_Props = TableColumnVisibilityProps;
|
|
9
|
+
type __VLS_ModelProps = {
|
|
10
|
+
'visibility'?: TableColumnVisibilityModel;
|
|
11
|
+
'order'?: TableColumnVisibilityOrderModel;
|
|
12
|
+
};
|
|
13
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
|
+
"update:visibility": (value: VisibilityState) => any;
|
|
16
|
+
"update:order": (value: ColumnOrderState) => any;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
18
|
+
"onUpdate:visibility"?: ((value: VisibilityState) => any) | undefined;
|
|
19
|
+
"onUpdate:order"?: ((value: ColumnOrderState) => any) | undefined;
|
|
20
|
+
}>, {
|
|
21
|
+
storageKey: string;
|
|
22
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const _default: typeof __VLS_export;
|
|
24
|
+
export default _default;
|