@hywax/cms 1.4.0 → 1.6.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,7 +1,8 @@
1
1
  const cmsConfig = {
2
2
  "name": "cms",
3
- "uploraUrl": "http://uplora.ru",
4
- "fluxorUrl": "https://fluxor.uplora.ru"
3
+ "formats": {
4
+ "serverDateTime": "YYYY-MM-DD HH:mm:ss"
5
+ }
5
6
  } as const
6
7
 
7
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.4.0",
3
+ "version": "1.6.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.4.0";
9
+ const version = "1.6.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"
@@ -184,6 +204,10 @@ function prepareMergeConfigs({ nuxt, options }) {
184
204
  }
185
205
  },
186
206
  table: {
207
+ slots: {
208
+ tr: "group/row",
209
+ td: 'group-data-expanded/row:empty:after:content-["\u2014"] group-data-expanded/row:empty:after:text-dimmed'
210
+ },
187
211
  variants: {
188
212
  pinned: {
189
213
  true: {
@@ -448,10 +472,8 @@ export {}
448
472
  write: true,
449
473
  getContents: () => {
450
474
  const config = {
451
- name: options.name
452
- // Переменные есть в runtimeConfig
453
- // uploraUrl: options.uploraUrl,
454
- // fluxorUrl: options.fluxorUrl,
475
+ name: options.name,
476
+ formats: options.formats
455
477
  };
456
478
  return `const cmsConfig = ${JSON.stringify(config, null, 2)} as const
457
479
 
@@ -14,7 +14,9 @@ export interface Props extends Pick<ButtonProps, 'target' | 'external' | 'label'
14
14
  }
15
15
  declare const _default: typeof __VLS_export;
16
16
  export default _default;
17
- declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
17
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
18
+ showAction: boolean;
19
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
18
20
  default?: (props: {}) => any;
19
21
  } & {
20
22
  default?: (props: {}) => any;
@@ -24,7 +24,7 @@
24
24
  >
25
25
  <UButton
26
26
  :class="ui.button({ class: props.ui?.button })"
27
- :icon="copied ? 'check' : 'copy'"
27
+ :icon="copied ? appConfig.ui.icons.check : appConfig.ui.icons.copy"
28
28
  variant="link"
29
29
  size="sm"
30
30
  :color="copied ? 'success' : 'neutral'"
@@ -45,7 +45,7 @@ import { tv } from "../tv";
45
45
  <script setup>
46
46
  const props = defineProps({
47
47
  text: { type: [String, Number, null], required: false },
48
- showAction: { type: Boolean, required: false },
48
+ showAction: { type: Boolean, required: false, default: true },
49
49
  alwaysShowTooltip: { type: Boolean, required: false },
50
50
  to: { type: null, required: false },
51
51
  class: { type: null, required: false },
@@ -14,7 +14,9 @@ export interface Props extends Pick<ButtonProps, 'target' | 'external' | 'label'
14
14
  }
15
15
  declare const _default: typeof __VLS_export;
16
16
  export default _default;
17
- declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
17
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
18
+ showAction: boolean;
19
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
18
20
  default?: (props: {}) => any;
19
21
  } & {
20
22
  default?: (props: {}) => any;
@@ -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;
@@ -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;
@@ -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
+ }
@@ -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.4.0",
4
+ "version": "1.6.0",
5
5
  "description": "Hywax CMS. ⚠️ This package is intended for internal use only.",
6
6
  "repository": {
7
7
  "type": "git",