@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.
Files changed (122) hide show
  1. package/.nuxt/cms-console/button-copy-text.ts +19 -0
  2. package/.nuxt/cms-console/button-delete-confirm.ts +5 -0
  3. package/.nuxt/cms-console/editor/index.ts +0 -0
  4. package/.nuxt/cms-console/form-panel-aside-section.ts +9 -0
  5. package/.nuxt/cms-console/form-panel-section.ts +8 -0
  6. package/.nuxt/cms-console/form-panel.ts +15 -0
  7. package/.nuxt/cms-console/index.ts +11 -0
  8. package/.nuxt/cms-console/input-seo.ts +5 -0
  9. package/.nuxt/cms-console/input-slug.ts +5 -0
  10. package/.nuxt/cms-console/input-uplora-image.ts +27 -0
  11. package/.nuxt/cms-console/modal-confirm.ts +5 -0
  12. package/.nuxt/cms-console/table-panel.ts +8 -0
  13. package/.nuxt/cms-console/table-search-input.ts +6 -0
  14. package/.nuxt/cms-console.css +31 -0
  15. package/dist/module.d.mts +11 -0
  16. package/dist/module.json +9 -0
  17. package/dist/module.mjs +387 -0
  18. package/dist/runtime/components/AutocompleteSelect.d.vue.ts +56 -0
  19. package/dist/runtime/components/AutocompleteSelect.vue +225 -0
  20. package/dist/runtime/components/AutocompleteSelect.vue.d.ts +56 -0
  21. package/dist/runtime/components/ButtonCopyText.d.vue.ts +28 -0
  22. package/dist/runtime/components/ButtonCopyText.vue +70 -0
  23. package/dist/runtime/components/ButtonCopyText.vue.d.ts +28 -0
  24. package/dist/runtime/components/ButtonDeleteConfirm.d.vue.ts +38 -0
  25. package/dist/runtime/components/ButtonDeleteConfirm.vue +62 -0
  26. package/dist/runtime/components/ButtonDeleteConfirm.vue.d.ts +38 -0
  27. package/dist/runtime/components/DatePicker.d.vue.ts +43 -0
  28. package/dist/runtime/components/DatePicker.vue +232 -0
  29. package/dist/runtime/components/DatePicker.vue.d.ts +43 -0
  30. package/dist/runtime/components/EditorFull.d.vue.ts +13 -0
  31. package/dist/runtime/components/EditorFull.vue +139 -0
  32. package/dist/runtime/components/EditorFull.vue.d.ts +13 -0
  33. package/dist/runtime/components/EditorLinkPopover.d.vue.ts +8 -0
  34. package/dist/runtime/components/EditorLinkPopover.vue +137 -0
  35. package/dist/runtime/components/EditorLinkPopover.vue.d.ts +8 -0
  36. package/dist/runtime/components/FormPanel.d.vue.ts +47 -0
  37. package/dist/runtime/components/FormPanel.vue +73 -0
  38. package/dist/runtime/components/FormPanel.vue.d.ts +47 -0
  39. package/dist/runtime/components/FormPanelAsideSection.d.vue.ts +24 -0
  40. package/dist/runtime/components/FormPanelAsideSection.vue +41 -0
  41. package/dist/runtime/components/FormPanelAsideSection.vue.d.ts +24 -0
  42. package/dist/runtime/components/FormPanelSection.d.vue.ts +21 -0
  43. package/dist/runtime/components/FormPanelSection.vue +31 -0
  44. package/dist/runtime/components/FormPanelSection.vue.d.ts +21 -0
  45. package/dist/runtime/components/InputSeo.d.vue.ts +21 -0
  46. package/dist/runtime/components/InputSeo.vue +73 -0
  47. package/dist/runtime/components/InputSeo.vue.d.ts +21 -0
  48. package/dist/runtime/components/InputSlug.d.vue.ts +30 -0
  49. package/dist/runtime/components/InputSlug.vue +70 -0
  50. package/dist/runtime/components/InputSlug.vue.d.ts +30 -0
  51. package/dist/runtime/components/InputUploraImage.d.vue.ts +39 -0
  52. package/dist/runtime/components/InputUploraImage.vue +163 -0
  53. package/dist/runtime/components/InputUploraImage.vue.d.ts +39 -0
  54. package/dist/runtime/components/Layout.d.vue.ts +30 -0
  55. package/dist/runtime/components/Layout.vue +82 -0
  56. package/dist/runtime/components/Layout.vue.d.ts +30 -0
  57. package/dist/runtime/components/ModalConfirm.d.vue.ts +33 -0
  58. package/dist/runtime/components/ModalConfirm.vue +97 -0
  59. package/dist/runtime/components/ModalConfirm.vue.d.ts +33 -0
  60. package/dist/runtime/components/TableColumnSorting.d.vue.ts +17 -0
  61. package/dist/runtime/components/TableColumnSorting.vue +81 -0
  62. package/dist/runtime/components/TableColumnSorting.vue.d.ts +17 -0
  63. package/dist/runtime/components/TableColumnVisibility.d.vue.ts +24 -0
  64. package/dist/runtime/components/TableColumnVisibility.vue +110 -0
  65. package/dist/runtime/components/TableColumnVisibility.vue.d.ts +24 -0
  66. package/dist/runtime/components/TableFilters.d.vue.ts +90 -0
  67. package/dist/runtime/components/TableFilters.vue +199 -0
  68. package/dist/runtime/components/TableFilters.vue.d.ts +90 -0
  69. package/dist/runtime/components/TablePanel.d.vue.ts +95 -0
  70. package/dist/runtime/components/TablePanel.vue +297 -0
  71. package/dist/runtime/components/TablePanel.vue.d.ts +95 -0
  72. package/dist/runtime/components/TableSearchInput.d.vue.ts +33 -0
  73. package/dist/runtime/components/TableSearchInput.vue +97 -0
  74. package/dist/runtime/components/TableSearchInput.vue.d.ts +33 -0
  75. package/dist/runtime/composables/useAdmin.d.ts +6 -0
  76. package/dist/runtime/composables/useAdmin.js +14 -0
  77. package/dist/runtime/composables/useEditorDragHandle.d.ts +17 -0
  78. package/dist/runtime/composables/useEditorDragHandle.js +95 -0
  79. package/dist/runtime/composables/useEditorSuggestions.d.ts +74 -0
  80. package/dist/runtime/composables/useEditorSuggestions.js +25 -0
  81. package/dist/runtime/composables/useEditorToolbar.d.ts +121 -0
  82. package/dist/runtime/composables/useEditorToolbar.js +87 -0
  83. package/dist/runtime/composables/useQueryState.d.ts +28 -0
  84. package/dist/runtime/composables/useQueryState.js +105 -0
  85. package/dist/runtime/composables/useRouteQuery.d.ts +37 -0
  86. package/dist/runtime/composables/useRouteQuery.js +81 -0
  87. package/dist/runtime/composables/useSeoStats.d.ts +12 -0
  88. package/dist/runtime/composables/useSeoStats.js +44 -0
  89. package/dist/runtime/composables/useTable.d.ts +25 -0
  90. package/dist/runtime/composables/useTable.js +84 -0
  91. package/dist/runtime/composables/useTableColumns.d.ts +28 -0
  92. package/dist/runtime/composables/useTableColumns.js +54 -0
  93. package/dist/runtime/editor/uplora-image/EditorUploraImage.d.ts +18 -0
  94. package/dist/runtime/editor/uplora-image/EditorUploraImage.js +42 -0
  95. package/dist/runtime/editor/uplora-image/EditorUploraImageNode.d.vue.ts +4 -0
  96. package/dist/runtime/editor/uplora-image/EditorUploraImageNode.vue +23 -0
  97. package/dist/runtime/editor/uplora-image/EditorUploraImageNode.vue.d.ts +4 -0
  98. package/dist/runtime/index.css +1 -0
  99. package/dist/runtime/server/tsconfig.json +3 -0
  100. package/dist/runtime/tv.d.ts +1 -0
  101. package/dist/runtime/tv.js +4 -0
  102. package/dist/runtime/types/app.config.d.ts +6 -0
  103. package/dist/runtime/types/date.d.ts +5 -0
  104. package/dist/runtime/types/date.js +0 -0
  105. package/dist/runtime/types/dictionaries.d.ts +1 -0
  106. package/dist/runtime/types/dictionaries.js +0 -0
  107. package/dist/runtime/types/index.d.ts +30 -0
  108. package/dist/runtime/types/index.js +30 -0
  109. package/dist/runtime/types/seo.d.ts +4 -0
  110. package/dist/runtime/types/seo.js +0 -0
  111. package/dist/runtime/utils/auth.d.ts +2 -0
  112. package/dist/runtime/utils/auth.js +5 -0
  113. package/dist/runtime/utils/date.d.ts +5 -0
  114. package/dist/runtime/utils/date.js +15 -0
  115. package/dist/runtime/utils/formatters.d.ts +5 -0
  116. package/dist/runtime/utils/formatters.js +24 -0
  117. package/dist/runtime/utils/index.d.ts +4 -0
  118. package/dist/runtime/utils/index.js +4 -0
  119. package/dist/runtime/utils/slugify.d.ts +1 -0
  120. package/dist/runtime/utils/slugify.js +11 -0
  121. package/dist/types.d.mts +11 -0
  122. package/package.json +89 -0
@@ -0,0 +1,232 @@
1
+ <template>
2
+ <UPopover v-model:open="isOpen" @update:open="onUpdateOpen">
3
+ <UButton
4
+ :id="id"
5
+ class="w-full"
6
+ :ui="{ base: `hover:bg-[unset] active:bg-[unset] ${modelValue ? '' : ' text-dimmed'}` }"
7
+ :name="name"
8
+ :color="color"
9
+ :icon="appConfig.ui.icons.calendar"
10
+ variant="outline"
11
+ :disabled="disabled"
12
+ :size="size"
13
+ v-bind="ariaAttrs"
14
+ >
15
+ <span class="truncate">{{ textValue }} </span>
16
+ </UButton>
17
+
18
+ <template #content>
19
+ <UCalendar
20
+ v-bind="calendarProps"
21
+ :model-value="calendarValue"
22
+ :range="range"
23
+ :disabled="disabled"
24
+ :prevent-deselect="false"
25
+ :ui="{ root: 'p-2' }"
26
+ :max-value="calendarMaxValue"
27
+ :min-value="calendarMinValue"
28
+ @update:model-value="handleCalendarUpdate($event)"
29
+ />
30
+
31
+ <template v-if="withTime">
32
+ <USeparator
33
+ orientation="horizontal"
34
+ />
35
+
36
+ <div class="p-2 flex justify-between items-center gap-2">
37
+ <div class="text-sm">
38
+ Время
39
+ </div>
40
+
41
+ <UInputTime
42
+ v-if="!range"
43
+ :model-value="calendarValue"
44
+ :disabled="disabled"
45
+ size="sm"
46
+ @update:model-value="handleTimeUpdate($event)"
47
+ />
48
+ <div v-else class="flex gap-2">
49
+ <UInputTime
50
+ :model-value="calendarValue?.start"
51
+ :disabled="disabled || !calendarValue?.start"
52
+ size="sm"
53
+ @update:model-value="handleTimeUpdate($event, 'start')"
54
+ />
55
+
56
+ <span class="text-sm text-dimmed self-center">—</span>
57
+
58
+ <UInputTime
59
+ :model-value="calendarValue?.end"
60
+ :disabled="disabled || !calendarValue?.end"
61
+ size="sm"
62
+ @update:model-value="handleTimeUpdate($event, 'end')"
63
+ />
64
+ </div>
65
+ </div>
66
+ </template>
67
+ </template>
68
+ </UPopover>
69
+ </template>
70
+
71
+ <script>
72
+ import { useAppConfig } from "#imports";
73
+ import { CalendarDateTime, getLocalTimeZone } from "@internationalized/date";
74
+ import { useFormField } from "@nuxt/ui/composables/useFormField";
75
+ import { reactiveOmit } from "@vueuse/core";
76
+ import { useForwardProps } from "reka-ui";
77
+ import { computed, ref } from "vue";
78
+ import { formatDate, formatServerDateTime } from "../utils";
79
+ function createCalendarDate(value, withTime = true) {
80
+ const date = new Date(value);
81
+ if (withTime) {
82
+ return new CalendarDateTime(date.getFullYear(), date.getMonth() + 1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds());
83
+ }
84
+ return new CalendarDateTime(date.getFullYear(), date.getMonth() + 1, date.getDate());
85
+ }
86
+ </script>
87
+
88
+ <script setup>
89
+ const props = defineProps({
90
+ modelValue: { type: null, required: true },
91
+ id: { type: String, required: false },
92
+ name: { type: String, required: false },
93
+ withTime: { type: Boolean, required: false, default: true },
94
+ minValue: { type: String, required: false },
95
+ maxValue: { type: String, required: false },
96
+ as: { type: null, required: false },
97
+ nextYearIcon: { type: null, required: false },
98
+ nextYear: { type: Object, required: false },
99
+ nextMonthIcon: { type: null, required: false },
100
+ nextMonth: { type: Object, required: false },
101
+ prevYearIcon: { type: null, required: false },
102
+ prevYear: { type: Object, required: false },
103
+ prevMonthIcon: { type: null, required: false },
104
+ prevMonth: { type: Object, required: false },
105
+ color: { type: null, required: false, default: "neutral" },
106
+ variant: { type: null, required: false },
107
+ size: { type: null, required: false },
108
+ range: { type: Boolean, required: false },
109
+ monthControls: { type: Boolean, required: false },
110
+ yearControls: { type: Boolean, required: false },
111
+ defaultValue: { type: null, required: false },
112
+ class: { type: null, required: false },
113
+ ui: { type: null, required: false },
114
+ defaultPlaceholder: { type: null, required: false },
115
+ placeholder: { type: null, required: false },
116
+ allowNonContiguousRanges: { type: Boolean, required: false },
117
+ pagedNavigation: { type: Boolean, required: false },
118
+ preventDeselect: { type: Boolean, required: false },
119
+ maximumDays: { type: Number, required: false },
120
+ weekStartsOn: { type: Number, required: false },
121
+ weekdayFormat: { type: String, required: false },
122
+ fixedWeeks: { type: Boolean, required: false },
123
+ numberOfMonths: { type: Number, required: false },
124
+ disabled: { type: Boolean, required: false },
125
+ readonly: { type: Boolean, required: false },
126
+ initialFocus: { type: Boolean, required: false },
127
+ isDateDisabled: { type: Function, required: false },
128
+ isDateUnavailable: { type: Function, required: false },
129
+ isDateHighlightable: { type: Function, required: false },
130
+ nextPage: { type: Function, required: false },
131
+ prevPage: { type: Function, required: false },
132
+ disableDaysOutsideCurrentView: { type: Boolean, required: false },
133
+ fixedDate: { type: String, required: false }
134
+ });
135
+ const emit = defineEmits(["update:modelValue", "change", "blur", "focus"]);
136
+ const appConfig = useAppConfig();
137
+ const calendarProps = useForwardProps(reactiveOmit(props, "modelValue", "id", "name", "withTime", "minValue", "maxValue"));
138
+ const {
139
+ id,
140
+ name,
141
+ color,
142
+ disabled,
143
+ ariaAttrs,
144
+ size,
145
+ emitFormBlur,
146
+ emitFormChange,
147
+ emitFormFocus,
148
+ emitFormInput
149
+ } = useFormField(props);
150
+ const isOpen = ref(false);
151
+ function isRange() {
152
+ return !!props.range;
153
+ }
154
+ const textValue = computed(() => {
155
+ if (!props.modelValue) {
156
+ return "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0430\u0442\u0443";
157
+ }
158
+ if (!isRange(props.modelValue)) {
159
+ return formatDate(props.modelValue);
160
+ }
161
+ return `${formatDate(props.modelValue.start)} - ${formatDate(props.modelValue.end)}`;
162
+ });
163
+ const calendarValue = computed(() => {
164
+ if (!props.modelValue) {
165
+ return void 0;
166
+ }
167
+ if (!isRange(props.modelValue)) {
168
+ return createCalendarDate(props.modelValue);
169
+ }
170
+ return {
171
+ start: createCalendarDate(props.modelValue.start),
172
+ end: createCalendarDate(props.modelValue.end)
173
+ };
174
+ });
175
+ const calendarMinValue = computed(
176
+ () => props.minValue ? createCalendarDate(props.minValue, false) : void 0
177
+ );
178
+ const calendarMaxValue = computed(
179
+ () => props.maxValue ? createCalendarDate(props.maxValue, false) : void 0
180
+ );
181
+ function onUpdateOpen(value) {
182
+ if (!value) {
183
+ const event = new FocusEvent("blur");
184
+ emit("blur", event);
185
+ emitFormBlur();
186
+ } else {
187
+ const event = new FocusEvent("focus");
188
+ emit("focus", event);
189
+ emitFormFocus();
190
+ }
191
+ }
192
+ function onUpdate(value) {
193
+ emit("update:modelValue", value);
194
+ emit("change", new Event("change", { target: { value } }));
195
+ emitFormChange();
196
+ emitFormInput();
197
+ }
198
+ function handleCalendarUpdate(calendarValue2, setInitialTime = true) {
199
+ if (!calendarValue2) {
200
+ onUpdate(void 0);
201
+ return;
202
+ }
203
+ if (isRange(calendarValue2) && (!calendarValue2.start || !calendarValue2.end)) {
204
+ return;
205
+ }
206
+ if (isRange(calendarValue2)) {
207
+ const endDate = calendarValue2.end.toDate(getLocalTimeZone());
208
+ setInitialTime && endDate.setHours(23, 59, 59, 999);
209
+ const value = {
210
+ start: formatServerDateTime(calendarValue2.start.toDate(getLocalTimeZone())),
211
+ end: formatServerDateTime(endDate)
212
+ };
213
+ onUpdate(value);
214
+ } else {
215
+ onUpdate(formatServerDateTime(calendarValue2.toDate(getLocalTimeZone())));
216
+ }
217
+ }
218
+ function handleTimeUpdate(timeValue, type) {
219
+ if (!timeValue) {
220
+ return;
221
+ }
222
+ if (!type) {
223
+ return handleCalendarUpdate(timeValue);
224
+ }
225
+ const otherType = type === "start" ? "end" : "start";
226
+ const value = {
227
+ [type]: timeValue,
228
+ [otherType]: calendarValue.value?.[otherType]
229
+ };
230
+ handleCalendarUpdate(value, false);
231
+ }
232
+ </script>
@@ -0,0 +1,43 @@
1
+ import type { DateValue } from '@internationalized/date';
2
+ import type { CalendarProps } from '@nuxt/ui';
3
+ import type { DateRange as CalendarDateRange } from 'reka-ui';
4
+ import type { DateRange, DateType } from '../types';
5
+ export type CalendarValue = DateValue | CalendarDateRange;
6
+ export type ModelValue<R extends boolean> = (R extends true ? DateRange : DateType) | undefined;
7
+ export interface DatePickerProps<R extends boolean> extends Omit<CalendarProps<R, false>, 'modelValue' | 'multiple' | 'minValue' | 'maxValue'> {
8
+ modelValue: ModelValue<R>;
9
+ id?: string;
10
+ name?: string;
11
+ withTime?: boolean;
12
+ minValue?: DateType;
13
+ maxValue?: DateType;
14
+ }
15
+ export interface DatePickerEmits<R extends boolean> {
16
+ 'update:modelValue': [value: ModelValue<R>];
17
+ 'change': [event: Event];
18
+ 'blur': [event: FocusEvent];
19
+ 'focus': [event: FocusEvent];
20
+ }
21
+ declare const _default: typeof __VLS_export;
22
+ export default _default;
23
+ declare const __VLS_export: <R extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
24
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<DatePickerProps<R> & {
25
+ onBlur?: ((event: FocusEvent) => any) | undefined;
26
+ onChange?: ((event: Event) => any) | undefined;
27
+ onFocus?: ((event: FocusEvent) => any) | undefined;
28
+ "onUpdate:modelValue"?: ((value: ModelValue<R>) => any) | undefined;
29
+ }> & (typeof globalThis extends {
30
+ __VLS_PROPS_FALLBACK: infer P;
31
+ } ? P : {});
32
+ expose: (exposed: {}) => void;
33
+ attrs: any;
34
+ slots: {};
35
+ emit: ((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "focus", event: FocusEvent) => void) & ((evt: "update:modelValue", value: ModelValue<R>) => void);
36
+ }>) => import("vue").VNode & {
37
+ __ctx?: Awaited<typeof __VLS_setup>;
38
+ };
39
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
40
+ [K in keyof T]: T[K];
41
+ } : {
42
+ [K in keyof T as K]: T[K];
43
+ }) & {};
@@ -0,0 +1,13 @@
1
+ import type { EditorCustomHandlers, EditorEmits, EditorProps } from '@nuxt/ui';
2
+ export interface EditorFullProps extends Omit<EditorProps, 'autofocus' | 'contentType' | 'placeholder'> {
3
+ customHandlers?: EditorCustomHandlers;
4
+ }
5
+ export interface EditorFullEmits extends EditorEmits {
6
+ }
7
+ declare const __VLS_export: import("vue").DefineComponent<EditorFullProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ "update:modelValue": (value: import("@tiptap/core").Content) => any;
9
+ }, string, import("vue").PublicProps, Readonly<EditorFullProps> & Readonly<{
10
+ "onUpdate:modelValue"?: ((value: import("@tiptap/core").Content) => any) | undefined;
11
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,139 @@
1
+ <template>
2
+ <UEditor
3
+ v-slot="{ editor, handlers }"
4
+ v-bind="forwarded"
5
+ :extensions="extensions"
6
+ :handlers="customHandlers"
7
+ class="min-h-screen"
8
+ content-type="markdown"
9
+ placeholder="Введите '/' для выбора блока..."
10
+ autofocus
11
+ >
12
+ <UEditorDragHandle
13
+ v-slot="{ ui, onClick }"
14
+ :editor="editor"
15
+ @node-change="onNodeChange"
16
+ >
17
+ <UButton
18
+ :icon="appConfig.ui.icons.plus"
19
+ color="neutral"
20
+ variant="ghost"
21
+ size="sm"
22
+ :class="ui.handle()"
23
+ @click="(e) => {
24
+ e.stopPropagation();
25
+ const node = onClick();
26
+ handlers.suggestion?.execute(editor, { pos: node?.pos }).run();
27
+ }"
28
+ />
29
+
30
+ <UDropdownMenu
31
+ v-slot="{ open }"
32
+ :modal="false"
33
+ :items="getDragHandleItems(editor)"
34
+ :content="{ side: 'left' }"
35
+ :ui="{ content: 'w-48', label: 'text-xs' }"
36
+ @update:open="editor.chain().setMeta('lockDragHandle', $event).run()"
37
+ >
38
+ <UButton
39
+ color="neutral"
40
+ variant="ghost"
41
+ active-variant="soft"
42
+ size="sm"
43
+ :icon="appConfig.ui.icons.drag"
44
+ :active="open"
45
+ :class="ui.handle()"
46
+ />
47
+ </UDropdownMenu>
48
+ </UEditorDragHandle>
49
+
50
+ <UEditorToolbar
51
+ layout="bubble"
52
+ :editor="editor"
53
+ :items="bubbleToolbarItems"
54
+ :should-show="({ view, state }) => {
55
+ if (editor.isActive('uploraImage')) {
56
+ return false;
57
+ }
58
+ const { selection } = state;
59
+ return view.hasFocus() && !selection.empty;
60
+ }"
61
+ >
62
+ <template #link>
63
+ <EditorLinkPopover :editor="editor" />
64
+ </template>
65
+ </UEditorToolbar>
66
+
67
+ <UEditorSuggestionMenu
68
+ :editor="editor"
69
+ :items="suggestionItems"
70
+ :append-to-body="appendToBody"
71
+ />
72
+ </UEditor>
73
+ </template>
74
+
75
+ <script setup>
76
+ import { useAppConfig } from "#imports";
77
+ import { reactiveOmit } from "@vueuse/core";
78
+ import { useForwardPropsEmits } from "reka-ui";
79
+ import { computed } from "vue";
80
+ import { useEditorDragHandle } from "../composables/useEditorDragHandle";
81
+ import { useEditorSuggestions } from "../composables/useEditorSuggestions";
82
+ import { useEditorToolbar } from "../composables/useEditorToolbar";
83
+ import { UploraImage as UploraImageExtension, UploraImageHandlers } from "../editor/uplora-image/EditorUploraImage";
84
+ import EditorLinkPopover from "./EditorLinkPopover.vue";
85
+ const props = defineProps({
86
+ customHandlers: { type: Object, required: false },
87
+ as: { type: null, required: false },
88
+ modelValue: { type: null, required: false },
89
+ starterKit: { type: Object, required: false },
90
+ markdown: { type: Object, required: false },
91
+ image: { type: Object, required: false },
92
+ mention: { type: Object, required: false },
93
+ handlers: { type: null, required: false },
94
+ class: { type: null, required: false },
95
+ ui: { type: null, required: false },
96
+ extensions: { type: Array, required: false },
97
+ injectCSS: { type: Boolean, required: false },
98
+ injectNonce: { type: null, required: false },
99
+ editable: { type: Boolean, required: false },
100
+ textDirection: { type: String, required: false },
101
+ editorProps: { type: Object, required: false },
102
+ parseOptions: { type: Object, required: false },
103
+ coreExtensionOptions: { type: Object, required: false },
104
+ enableInputRules: { type: [Array, Boolean], required: false },
105
+ enablePasteRules: { type: [Array, Boolean], required: false },
106
+ enableCoreExtensions: { type: [Boolean, Object], required: false },
107
+ enableContentCheck: { type: Boolean, required: false },
108
+ emitContentError: { type: Boolean, required: false },
109
+ onBeforeCreate: { type: Function, required: false },
110
+ onCreate: { type: Function, required: false },
111
+ onMount: { type: Function, required: false },
112
+ onUnmount: { type: Function, required: false },
113
+ onContentError: { type: Function, required: false },
114
+ onUpdate: { type: Function, required: false },
115
+ onSelectionUpdate: { type: Function, required: false },
116
+ onTransaction: { type: Function, required: false },
117
+ onFocus: { type: Function, required: false },
118
+ onBlur: { type: Function, required: false },
119
+ onDestroy: { type: Function, required: false },
120
+ onPaste: { type: Function, required: false },
121
+ onDrop: { type: Function, required: false },
122
+ onDelete: { type: Function, required: false }
123
+ });
124
+ const emit = defineEmits(["update:modelValue"]);
125
+ const forwarded = useForwardPropsEmits(reactiveOmit(props, "extensions", "customHandlers", "handlers"), emit);
126
+ const appConfig = useAppConfig();
127
+ const extensions = computed(() => [
128
+ UploraImageExtension,
129
+ ...props.extensions || []
130
+ ]);
131
+ const customHandlers = computed(() => ({
132
+ ...props.customHandlers || {},
133
+ ...UploraImageHandlers
134
+ }));
135
+ const appendToBody = false ? () => document.body : void 0;
136
+ const { items: suggestionItems } = useEditorSuggestions(customHandlers);
137
+ const { getItems: getDragHandleItems, onNodeChange } = useEditorDragHandle(props.customHandlers);
138
+ const { bubbleToolbarItems } = useEditorToolbar(props.customHandlers);
139
+ </script>
@@ -0,0 +1,13 @@
1
+ import type { EditorCustomHandlers, EditorEmits, EditorProps } from '@nuxt/ui';
2
+ export interface EditorFullProps extends Omit<EditorProps, 'autofocus' | 'contentType' | 'placeholder'> {
3
+ customHandlers?: EditorCustomHandlers;
4
+ }
5
+ export interface EditorFullEmits extends EditorEmits {
6
+ }
7
+ declare const __VLS_export: import("vue").DefineComponent<EditorFullProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ "update:modelValue": (value: import("@tiptap/core").Content) => any;
9
+ }, string, import("vue").PublicProps, Readonly<EditorFullProps> & Readonly<{
10
+ "onUpdate:modelValue"?: ((value: import("@tiptap/core").Content) => any) | undefined;
11
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import type { Editor } from '@tiptap/vue-3';
2
+ type __VLS_Props = {
3
+ editor: Editor;
4
+ autoOpen?: boolean;
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
@@ -0,0 +1,137 @@
1
+ <template>
2
+ <UPopover
3
+ v-model:open="open"
4
+ :ui="{ content: 'p-0.5' }"
5
+ >
6
+ <UTooltip text="Ссылка">
7
+ <UButton
8
+ :icon="appConfig.ui.icons.link"
9
+ color="neutral"
10
+ active-color="primary"
11
+ variant="ghost"
12
+ active-variant="soft"
13
+ size="sm"
14
+ :active="active"
15
+ :disabled="disabled"
16
+ />
17
+ </UTooltip>
18
+
19
+ <template #content>
20
+ <UInput
21
+ v-model="url"
22
+ autofocus
23
+ name="url"
24
+ type="url"
25
+ variant="none"
26
+ placeholder="Выставить ссылку..."
27
+ @keydown="handleKeyDown"
28
+ >
29
+ <div class="flex items-center mr-0.5">
30
+ <UButton
31
+ :icon="appConfig.ui.icons.enter"
32
+ variant="ghost"
33
+ size="sm"
34
+ :disabled="!url && !active"
35
+ title="Выставить ссылку"
36
+ @click="setLink"
37
+ />
38
+
39
+ <USeparator
40
+ orientation="vertical"
41
+ class="h-6 mx-1"
42
+ />
43
+
44
+ <UButton
45
+ :icon="appConfig.ui.icons.external"
46
+ color="neutral"
47
+ variant="ghost"
48
+ size="sm"
49
+ :disabled="!url && !active"
50
+ title="Открыть в новом окне"
51
+ @click="openLink"
52
+ />
53
+
54
+ <UButton
55
+ :icon="appConfig.ui.icons.trash"
56
+ color="neutral"
57
+ variant="ghost"
58
+ size="sm"
59
+ :disabled="!url && !active"
60
+ title="Удалить ссылку"
61
+ @click="removeLink"
62
+ />
63
+ </div>
64
+ </UInput>
65
+ </template>
66
+ </UPopover>
67
+ </template>
68
+
69
+ <script setup>
70
+ import { useAppConfig } from "#imports";
71
+ import { computed, ref, watch } from "vue";
72
+ const props = defineProps({
73
+ editor: { type: Object, required: true },
74
+ autoOpen: { type: Boolean, required: false }
75
+ });
76
+ const appConfig = useAppConfig();
77
+ const open = ref(false);
78
+ const url = ref("");
79
+ const active = computed(() => props.editor.isActive("link"));
80
+ const disabled = computed(() => {
81
+ if (!props.editor.isEditable) {
82
+ return true;
83
+ }
84
+ const { selection } = props.editor.state;
85
+ return selection.empty && !props.editor.isActive("link");
86
+ });
87
+ watch(() => props.editor, (editor, _, onCleanup) => {
88
+ if (!editor) {
89
+ return;
90
+ }
91
+ const updateUrl = () => {
92
+ const { href } = editor.getAttributes("link");
93
+ url.value = href || "";
94
+ };
95
+ updateUrl();
96
+ editor.on("selectionUpdate", updateUrl);
97
+ onCleanup(() => {
98
+ editor.off("selectionUpdate", updateUrl);
99
+ });
100
+ }, { immediate: true });
101
+ watch(active, (isActive) => {
102
+ if (isActive && props.autoOpen) {
103
+ open.value = true;
104
+ }
105
+ });
106
+ function setLink() {
107
+ if (!url.value) {
108
+ return;
109
+ }
110
+ const { selection } = props.editor.state;
111
+ const isEmpty = selection.empty;
112
+ let chain = props.editor.chain().focus();
113
+ chain = chain.extendMarkRange("link").setLink({ href: url.value });
114
+ if (isEmpty) {
115
+ chain = chain.insertContent({ type: "text", text: url.value });
116
+ }
117
+ chain.run();
118
+ open.value = false;
119
+ }
120
+ function removeLink() {
121
+ props.editor.chain().focus().extendMarkRange("link").unsetLink().setMeta("preventAutolink", true).run();
122
+ url.value = "";
123
+ open.value = false;
124
+ }
125
+ function openLink() {
126
+ if (!url.value) {
127
+ return;
128
+ }
129
+ window.open(url.value, "_blank", "noopener,noreferrer");
130
+ }
131
+ function handleKeyDown(event) {
132
+ if (event.key === "Enter") {
133
+ event.preventDefault();
134
+ setLink();
135
+ }
136
+ }
137
+ </script>
@@ -0,0 +1,8 @@
1
+ import type { Editor } from '@tiptap/vue-3';
2
+ type __VLS_Props = {
3
+ editor: Editor;
4
+ autoOpen?: boolean;
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
@@ -0,0 +1,47 @@
1
+ import type { ComponentConfig } from '@hywax/cms-runtime';
2
+ import type { AppConfig } from '@nuxt/schema';
3
+ import type { FormData, FormSchema, FormSubmitEvent } from '@nuxt/ui';
4
+ import type { RouteLocationRaw } from 'vue-router';
5
+ import theme from '#build/cms-console/form-panel';
6
+ type FormPanel = ComponentConfig<typeof theme, AppConfig, 'formPanel'>;
7
+ export interface FormPanelProps<S extends FormSchema, T extends FormData<S> = FormData<S>> {
8
+ title?: string;
9
+ toBack?: RouteLocationRaw;
10
+ formId?: string;
11
+ schema: S;
12
+ state: Partial<T>;
13
+ loading?: boolean;
14
+ handler: (event: FormSubmitEvent<T>) => Promise<void>;
15
+ asideDivide?: boolean;
16
+ showReset?: boolean;
17
+ class?: any;
18
+ ui?: FormPanel['slots'];
19
+ }
20
+ export interface FormPanelEmits<S extends FormSchema, T extends FormData<S> = FormData<S>> {
21
+ 'update:state': [value: T];
22
+ }
23
+ export interface FormPanelSlots {
24
+ default?: () => any;
25
+ sidebar?: () => any;
26
+ actions?: () => any;
27
+ }
28
+ declare const _default: typeof __VLS_export;
29
+ export default _default;
30
+ declare const __VLS_export: <S extends FormSchema, T extends FormData<S> = FormData<S>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
31
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<FormPanelProps<S, T> & {
32
+ "onUpdate:state"?: ((value: T) => any) | undefined;
33
+ }> & (typeof globalThis extends {
34
+ __VLS_PROPS_FALLBACK: infer P;
35
+ } ? P : {});
36
+ expose: (exposed: {}) => void;
37
+ attrs: any;
38
+ slots: FormPanelSlots;
39
+ emit: (evt: "update:state", value: T) => void;
40
+ }>) => import("vue").VNode & {
41
+ __ctx?: Awaited<typeof __VLS_setup>;
42
+ };
43
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
44
+ [K in keyof T]: T[K];
45
+ } : {
46
+ [K in keyof T as K]: T[K];
47
+ }) & {};