@hywax/cms 1.5.0 → 1.7.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/config.ts +4 -1
- package/dist/module.d.mts +6 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +27 -8
- package/dist/runtime/components/Layout.d.vue.ts +1 -0
- package/dist/runtime/components/Layout.vue +4 -2
- package/dist/runtime/components/Layout.vue.d.ts +1 -0
- package/dist/runtime/components/TableColumnSorting.vue +1 -1
- package/dist/runtime/components/TableColumnVisibility.vue +1 -1
- package/dist/runtime/components/TableFilters.vue +1 -1
- package/dist/runtime/components/TablePanel.vue +2 -2
- package/dist/runtime/components/TableSearchInput.vue +1 -0
- package/dist/runtime/composables/useModal.d.ts +7 -0
- package/dist/runtime/composables/useModal.js +10 -0
- package/dist/runtime/composables/useTableColumns.d.ts +2 -1
- package/dist/runtime/composables/useTableColumns.js +10 -6
- package/dist/runtime/utils/date.js +3 -1
- package/package.json +3 -1
package/.nuxt/cms/config.ts
CHANGED
package/dist/module.d.mts
CHANGED
|
@@ -29,7 +29,6 @@ interface CMSOptions {
|
|
|
29
29
|
envPrefix?: string;
|
|
30
30
|
/**
|
|
31
31
|
* HTTP codes
|
|
32
|
-
* @defaultValue {}
|
|
33
32
|
*/
|
|
34
33
|
httpCodes?: Record<string, string>;
|
|
35
34
|
/**
|
|
@@ -37,6 +36,12 @@ interface CMSOptions {
|
|
|
37
36
|
* @defaultValue {}
|
|
38
37
|
*/
|
|
39
38
|
features?: Record<string, boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* Formats
|
|
41
|
+
*/
|
|
42
|
+
formats?: {
|
|
43
|
+
serverDateTime?: string;
|
|
44
|
+
};
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
declare module '@nuxt/schema' {
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { snakeCase, kebabCase } from 'scule';
|
|
|
6
6
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
7
7
|
|
|
8
8
|
const name = "@hywax/cms";
|
|
9
|
-
const version = "1.
|
|
9
|
+
const version = "1.7.0";
|
|
10
10
|
|
|
11
11
|
function createContext(options, nuxt) {
|
|
12
12
|
const { resolve } = createResolver(import.meta.url);
|
|
@@ -42,7 +42,10 @@ const defaultModuleOptions = {
|
|
|
42
42
|
badGateway: "502: \u041E\u0448\u0438\u0431\u043A\u0430 \u0448\u043B\u044E\u0437\u0430",
|
|
43
43
|
serviceUnavailable: "503: \u0421\u0435\u0440\u0432\u0438\u0441 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D"
|
|
44
44
|
},
|
|
45
|
-
features: {}
|
|
45
|
+
features: {},
|
|
46
|
+
formats: {
|
|
47
|
+
serverDateTime: "YYYY-MM-DD HH:mm:ss"
|
|
48
|
+
}
|
|
46
49
|
};
|
|
47
50
|
|
|
48
51
|
function transformHttpCodes(httpCodes) {
|
|
@@ -160,14 +163,31 @@ function prepareMergeConfigs({ nuxt, options }) {
|
|
|
160
163
|
nuxt.options.runtimeConfig.nitro.envPrefix = options.envPrefix;
|
|
161
164
|
nuxt.options.appConfig.ui = defu(nuxt.options.appConfig.ui || {}, {
|
|
162
165
|
icons,
|
|
163
|
-
|
|
166
|
+
button: {
|
|
164
167
|
slots: {
|
|
165
|
-
|
|
168
|
+
base: "cursor-pointer"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
modal: {
|
|
172
|
+
slots: {
|
|
173
|
+
content: "divide-y-0",
|
|
174
|
+
body: "py-0! text-sm",
|
|
175
|
+
footer: "justify-end"
|
|
166
176
|
}
|
|
167
177
|
},
|
|
168
178
|
form: {
|
|
169
179
|
base: "flex flex-col gap-4"
|
|
170
180
|
},
|
|
181
|
+
input: {
|
|
182
|
+
slots: {
|
|
183
|
+
root: "w-full"
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
inputNumber: {
|
|
187
|
+
slots: {
|
|
188
|
+
root: "w-full"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
171
191
|
select: {
|
|
172
192
|
slots: {
|
|
173
193
|
base: "overflow-hidden w-full"
|
|
@@ -452,10 +472,8 @@ export {}
|
|
|
452
472
|
write: true,
|
|
453
473
|
getContents: () => {
|
|
454
474
|
const config = {
|
|
455
|
-
name: options.name
|
|
456
|
-
|
|
457
|
-
// uploraUrl: options.uploraUrl,
|
|
458
|
-
// fluxorUrl: options.fluxorUrl,
|
|
475
|
+
name: options.name,
|
|
476
|
+
formats: options.formats
|
|
459
477
|
};
|
|
460
478
|
return `const cmsConfig = ${JSON.stringify(config, null, 2)} as const
|
|
461
479
|
|
|
@@ -496,6 +514,7 @@ const module$1 = defineNuxtModule({
|
|
|
496
514
|
moduleDependencies: {
|
|
497
515
|
"@nuxt/ui": {},
|
|
498
516
|
"@nuxtjs/mdc": {},
|
|
517
|
+
"@nuxtjs/seo": {},
|
|
499
518
|
"@vueuse/nuxt": {},
|
|
500
519
|
"nuxt-auth-utils": {}
|
|
501
520
|
},
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<UDashboardSidebar
|
|
4
4
|
v-model:open="isSidebarOpen"
|
|
5
5
|
v-model:collapsed="isSidebarCollapsed"
|
|
6
|
-
:ui="{ footer: 'lg:border-t lg:border-default' }"
|
|
6
|
+
:ui="{ root: 'bg-elevated/25', footer: 'lg:border-t lg:border-default' }"
|
|
7
7
|
collapsible
|
|
8
8
|
>
|
|
9
9
|
<template #header="{ collapsed }">
|
|
@@ -57,8 +57,9 @@
|
|
|
57
57
|
import { useAppConfig } from "#imports";
|
|
58
58
|
import { computed } from "vue";
|
|
59
59
|
import { useAdmin } from "../composables/useAdmin";
|
|
60
|
-
defineProps({
|
|
60
|
+
const props = defineProps({
|
|
61
61
|
navigation: { type: Array, required: true },
|
|
62
|
+
links: { type: Array, required: false },
|
|
62
63
|
version: { type: String, required: false },
|
|
63
64
|
logotype: { type: String, required: false },
|
|
64
65
|
logotypeIcon: { type: String, required: false },
|
|
@@ -69,6 +70,7 @@ defineSlots();
|
|
|
69
70
|
const appConfig = useAppConfig();
|
|
70
71
|
const { isSidebarOpen, isSidebarCollapsed } = useAdmin();
|
|
71
72
|
const links = computed(() => [
|
|
73
|
+
...props.links || [],
|
|
72
74
|
{
|
|
73
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",
|
|
74
76
|
icon: isSidebarCollapsed.value ? appConfig.ui.icons.panelClose : appConfig.ui.icons.panelOpen,
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
:model-value="itemsPerPage"
|
|
101
101
|
:items="itemsPerPageItems"
|
|
102
102
|
:ui="{ base: 'text-muted' }"
|
|
103
|
-
variant="
|
|
103
|
+
variant="subtle"
|
|
104
104
|
@update:model-value="emit('update:items-per-page', $event)"
|
|
105
105
|
>
|
|
106
106
|
<template #default="{ modelValue }">
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
<UPagination
|
|
116
116
|
v-bind="paginationProps"
|
|
117
117
|
:ui="isTotalUnknown ? { first: 'hidden', last: 'hidden' } : void 0"
|
|
118
|
-
variant="
|
|
118
|
+
variant="subtle"
|
|
119
119
|
:sibling-count="isTotalUnknown ? 3 : 1"
|
|
120
120
|
:show-edges="!isTotalUnknown"
|
|
121
121
|
@update:page="emit('update:page', $event)"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Component, MaybeRefOrGetter } from 'vue';
|
|
2
|
+
import type { ComponentProps } from 'vue-component-type-helpers';
|
|
3
|
+
export interface UseModalResult<T extends Component> {
|
|
4
|
+
open: (props?: ComponentProps<T>) => Promise<any>;
|
|
5
|
+
close: (value?: any) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function useModal<T extends Component>(component: T, defaultProps?: MaybeRefOrGetter<ComponentProps<T>>): UseModalResult<T>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useOverlay } from "@nuxt/ui/composables/useOverlay";
|
|
2
|
+
import { toValue } from "vue";
|
|
3
|
+
export function useModal(component, defaultProps) {
|
|
4
|
+
const { open: _open, close } = useOverlay().create(component);
|
|
5
|
+
const open = (props) => _open({
|
|
6
|
+
...defaultProps ? toValue(defaultProps) : {},
|
|
7
|
+
...props || {}
|
|
8
|
+
});
|
|
9
|
+
return { open, close };
|
|
10
|
+
}
|
|
@@ -17,8 +17,9 @@ export type TableColumnCustom<T extends TableData, D = unknown> = TableColumn<T,
|
|
|
17
17
|
format?: TableColumnFormat;
|
|
18
18
|
to?: ((row: TableRow<T>) => RouteLocationRaw | string | undefined) | RouteLocationRaw | string | undefined;
|
|
19
19
|
target?: ButtonProps['target'];
|
|
20
|
-
external?: boolean;
|
|
21
20
|
emptyValue?: string;
|
|
21
|
+
image?: string;
|
|
22
|
+
description?: string;
|
|
22
23
|
};
|
|
23
24
|
export declare function useTableColumns<I extends Record<string, any>, T extends readonly TableColumnCustom<I>[] = readonly TableColumnCustom<I>[]>(columns: T): {
|
|
24
25
|
columns: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UUser } from "#components";
|
|
2
2
|
import { h } from "vue";
|
|
3
3
|
import { formatDate, formatDateTime } from "../utils/date.js";
|
|
4
4
|
import { formatNumber } from "../utils/formatters.js";
|
|
@@ -29,13 +29,17 @@ function transformColumn(column) {
|
|
|
29
29
|
return void 0;
|
|
30
30
|
}
|
|
31
31
|
if (column.to) {
|
|
32
|
-
return h(
|
|
32
|
+
return h(UUser, {
|
|
33
33
|
to: typeof column.to === "function" ? column.to(row) : column.to,
|
|
34
|
-
external: column.external,
|
|
35
34
|
target: column.target,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
name: value.toString(),
|
|
36
|
+
class: "inline-flex",
|
|
37
|
+
ui: {
|
|
38
|
+
name: "text-primary",
|
|
39
|
+
avatar: "group-hover/user:scale-100"
|
|
40
|
+
},
|
|
41
|
+
avatar: column.image ? { src: column.image, size: "sm", alt: value.toString() } : void 0,
|
|
42
|
+
description: column.description
|
|
39
43
|
});
|
|
40
44
|
}
|
|
41
45
|
return value;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getCmsConfig } from "#imports";
|
|
1
2
|
import { formatDate as format, normalizeDate } from "@vueuse/core";
|
|
2
3
|
export function getPeriod(beforeDays, afterDays = 0, fixTime = true) {
|
|
3
4
|
const start = /* @__PURE__ */ new Date();
|
|
@@ -24,5 +25,6 @@ export function formatTime(date) {
|
|
|
24
25
|
return normalizeDate(date).toLocaleTimeString("ru-RU");
|
|
25
26
|
}
|
|
26
27
|
export function formatServerDateTime(date) {
|
|
27
|
-
|
|
28
|
+
const { formats } = getCmsConfig();
|
|
29
|
+
return format(normalizeDate(date), formats.serverDateTime);
|
|
28
30
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hywax/cms",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.7.0",
|
|
5
5
|
"description": "Hywax CMS. ⚠️ This package is intended for internal use only.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"@nuxt/kit": "^4.2.2",
|
|
62
62
|
"@nuxt/ui": "^4.3.0",
|
|
63
63
|
"@nuxtjs/mdc": "^0.19.2",
|
|
64
|
+
"@nuxtjs/seo": "^3.3.0",
|
|
64
65
|
"@sindresorhus/slugify": "^3.0.0",
|
|
65
66
|
"@uplora/formats": "^0.1.0",
|
|
66
67
|
"@uplora/serializer": "^0.1.3",
|
|
@@ -70,6 +71,7 @@
|
|
|
70
71
|
"fast-copy": "^3.0.2",
|
|
71
72
|
"fast-equals": "^5.4.0",
|
|
72
73
|
"nuxt-auth-utils": "^0.5.26",
|
|
74
|
+
"object-to-formdata": "^4.5.1",
|
|
73
75
|
"pathe": "^2.0.3",
|
|
74
76
|
"scule": "^1.3.0",
|
|
75
77
|
"sortablejs": "^1.15.6",
|