@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.
@@ -1,5 +1,8 @@
1
1
  const cmsConfig = {
2
- "name": "cms"
2
+ "name": "cms",
3
+ "formats": {
4
+ "serverDateTime": "YYYY-MM-DD HH:mm:ss"
5
+ }
3
6
  } as const
4
7
 
5
8
  export const getCmsConfig = () => cmsConfig
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hywax/cms",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "configKey": "cms",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
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.5.0";
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
- input: {
166
+ button: {
164
167
  slots: {
165
- root: "w-full"
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
- // Переменные есть в runtimeConfig
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
  },
@@ -2,6 +2,7 @@ import type { NavigationMenuItem } from '@nuxt/ui';
2
2
  import type { RouteLocationRaw } from 'vue-router';
3
3
  interface LayoutProps {
4
4
  navigation: NavigationMenuItem[];
5
+ links?: NavigationMenuItem[];
5
6
  version?: string;
6
7
  logotype?: string;
7
8
  logotypeIcon?: string;
@@ -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,
@@ -2,6 +2,7 @@ import type { NavigationMenuItem } from '@nuxt/ui';
2
2
  import type { RouteLocationRaw } from 'vue-router';
3
3
  interface LayoutProps {
4
4
  navigation: NavigationMenuItem[];
5
+ links?: NavigationMenuItem[];
5
6
  version?: string;
6
7
  logotype?: string;
7
8
  logotypeIcon?: string;
@@ -2,7 +2,7 @@
2
2
  <UPopover v-if="sortingColumns.length > 0" v-model:open="isOpen">
3
3
  <UChip :ui="{ base: 'z-1 size-3' }" :show="model.length > 0" size="xl">
4
4
  <UButton
5
- variant="soft"
5
+ variant="subtle"
6
6
  color="neutral"
7
7
  label="Сортировка"
8
8
  :icon="appConfig.ui.icons.sort"
@@ -7,7 +7,7 @@
7
7
  size="xl"
8
8
  >
9
9
  <UButton
10
- variant="soft"
10
+ variant="subtle"
11
11
  color="neutral"
12
12
  label="Колонки"
13
13
  :icon="appConfig.ui.icons.columns"
@@ -7,7 +7,7 @@
7
7
  size="xl"
8
8
  >
9
9
  <UButton
10
- variant="soft"
10
+ variant="subtle"
11
11
  color="neutral"
12
12
  label="Фильтры"
13
13
  :icon="appConfig.ui.icons.filter"
@@ -100,7 +100,7 @@
100
100
  :model-value="itemsPerPage"
101
101
  :items="itemsPerPageItems"
102
102
  :ui="{ base: 'text-muted' }"
103
- variant="soft"
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="soft"
118
+ variant="subtle"
119
119
  :sibling-count="isTotalUnknown ? 3 : 1"
120
120
  :show-edges="!isTotalUnknown"
121
121
  @update:page="emit('update:page', $event)"
@@ -2,6 +2,7 @@
2
2
  <UInput
3
3
  :class="ui.input({ class: props.ui?.input })"
4
4
  :leading-icon="appConfig.ui.icons.search"
5
+ variant="subtle"
5
6
  v-bind="{
6
7
  ...forward,
7
8
  'modelValue': inputValue,
@@ -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 { UButton } from "#components";
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(UButton, {
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
- label: value.toString(),
37
- variant: "link",
38
- class: "px-0"
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
- return format(normalizeDate(date), "YYYY-MM-DD HH:mm:ss");
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.5.0",
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",