@hywax/cms 2.0.2 → 2.1.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,8 +1,8 @@
1
1
  export default {
2
2
  "slots": {
3
3
  "root": "",
4
- "title": "text-base text-pretty font-semibold text-highlighted mb-2",
5
- "description": "text-[15px] text-pretty text-muted mt-1",
4
+ "title": "text-base text-pretty font-semibold text-highlighted",
5
+ "description": "text-[15px] text-pretty text-muted mb-2",
6
6
  "body": "relative rounded-lg bg-elevated/50 ring ring-default grid gap-x-8 gap-y-4 p-4 sm:p-6"
7
7
  }
8
8
  }
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hywax/cms",
3
- "version": "2.0.2",
3
+ "version": "2.1.0",
4
4
  "configKey": "cms",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
package/dist/module.mjs CHANGED
@@ -7,7 +7,7 @@ import { defu } from 'defu';
7
7
  import { globSync } from 'tinyglobby';
8
8
 
9
9
  const name = "@hywax/cms";
10
- const version = "2.0.2";
10
+ const version = "2.1.0";
11
11
 
12
12
  function createContext(options, nuxt) {
13
13
  const { resolve } = createResolver(import.meta.url);
@@ -431,8 +431,8 @@ const formPanelAsideSection = {
431
431
  const formPanelSection = {
432
432
  slots: {
433
433
  root: "",
434
- title: "text-base text-pretty font-semibold text-highlighted mb-2",
435
- description: "text-[15px] text-pretty text-muted mt-1",
434
+ title: "text-base text-pretty font-semibold text-highlighted",
435
+ description: "text-[15px] text-pretty text-muted mb-2",
436
436
  body: "relative rounded-lg bg-elevated/50 ring ring-default grid gap-x-8 gap-y-4 p-4 sm:p-6"
437
437
  }
438
438
  };
@@ -27,4 +27,7 @@ declare const __VLS_export: import("vue").DefineComponent<InputSlugProps & {
27
27
  }> & Readonly<{
28
28
  "onUpdate:title"?: ((value: string | undefined) => any) | undefined;
29
29
  "onUpdate:slug"?: ((value: string | undefined) => any) | undefined;
30
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
+ }>, {
31
+ titleKey: string;
32
+ slugKey: string;
33
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -50,8 +50,8 @@ import { slugify } from "../utils/slugify";
50
50
  const props = defineProps({
51
51
  regenerate: { type: Boolean, required: false },
52
52
  label: { type: String, required: false },
53
- titleKey: { type: String, required: false },
54
- slugKey: { type: String, required: false },
53
+ titleKey: { type: String, required: false, default: "title" },
54
+ slugKey: { type: String, required: false, default: "slug" },
55
55
  inputProps: { type: Object, required: false },
56
56
  as: { type: null, required: false },
57
57
  class: { type: null, required: false },
@@ -27,4 +27,7 @@ declare const __VLS_export: import("vue").DefineComponent<InputSlugProps & {
27
27
  }> & Readonly<{
28
28
  "onUpdate:title"?: ((value: string | undefined) => any) | undefined;
29
29
  "onUpdate:slug"?: ((value: string | undefined) => any) | undefined;
30
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
+ }>, {
31
+ titleKey: string;
32
+ slugKey: string;
33
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -0,0 +1,13 @@
1
+ import type { ButtonProps } from '@nuxt/ui';
2
+ import type { RouteLocationRaw } from 'vue-router';
3
+ import type { UploraImageProps } from './UploraImage.vue';
4
+ export interface TablePreviewLinkProps {
5
+ to?: RouteLocationRaw;
6
+ target?: ButtonProps['target'];
7
+ label: string;
8
+ description?: string;
9
+ image?: Pick<UploraImageProps, 'image' | 'alt' | 'color' | 'lqip'>;
10
+ }
11
+ declare const __VLS_export: import("vue").DefineComponent<TablePreviewLinkProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TablePreviewLinkProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,39 @@
1
+ <template>
2
+ <div class="relative flex items-center gap-2">
3
+ <div class="overflow-hidden rounded-lg">
4
+ <UploraImage
5
+ v-if="image"
6
+ v-bind="image"
7
+ :sizes="[{ width: 32, height: 32, descriptor: '1x' }]"
8
+ :ui="{ picture: 'aspect-square' }"
9
+ />
10
+ </div>
11
+ <div>
12
+ <ULink
13
+ v-if="to"
14
+ :to="to"
15
+ :target="target"
16
+ class="text-primary font-medium"
17
+ >
18
+ {{ label }}
19
+ </ULink>
20
+ <p v-else class="font-medium text-highlighted text-sm">
21
+ {{ label }}
22
+ </p>
23
+ <p v-if="description" class="text-muted text-xs">
24
+ {{ description }}
25
+ </p>
26
+ </div>
27
+ </div>
28
+ </template>
29
+
30
+ <script setup>
31
+ import UploraImage from "./UploraImage.vue";
32
+ defineProps({
33
+ to: { type: null, required: false },
34
+ target: { type: [String, Object, null], required: false },
35
+ label: { type: String, required: true },
36
+ description: { type: String, required: false },
37
+ image: { type: Object, required: false }
38
+ });
39
+ </script>
@@ -0,0 +1,13 @@
1
+ import type { ButtonProps } from '@nuxt/ui';
2
+ import type { RouteLocationRaw } from 'vue-router';
3
+ import type { UploraImageProps } from './UploraImage.vue';
4
+ export interface TablePreviewLinkProps {
5
+ to?: RouteLocationRaw;
6
+ target?: ButtonProps['target'];
7
+ label: string;
8
+ description?: string;
9
+ image?: Pick<UploraImageProps, 'image' | 'alt' | 'color' | 'lqip'>;
10
+ }
11
+ declare const __VLS_export: import("vue").DefineComponent<TablePreviewLinkProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TablePreviewLinkProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -1,6 +1,7 @@
1
1
  import type { ButtonProps, FormSchema, TableColumn, TableData, TableRow } from '@nuxt/ui';
2
2
  import type { RowData } from '@tanstack/table-core';
3
3
  import type { RouteLocationRaw } from 'vue-router';
4
+ import type { TablePreviewLinkProps } from '../components/TablePreviewLink.vue';
4
5
  import type { FiltersField } from '../types';
5
6
  declare module '@tanstack/table-core' {
6
7
  interface ColumnMeta<TData extends RowData, TValue> {
@@ -18,8 +19,8 @@ export type TableColumnCustom<T extends TableData, D = unknown> = TableColumn<T,
18
19
  to?: ((row: TableRow<T>) => RouteLocationRaw | string | undefined) | RouteLocationRaw | string | undefined;
19
20
  target?: ButtonProps['target'];
20
21
  emptyValue?: string;
21
- image?: string;
22
- description?: string;
22
+ image?: ((row: TableRow<T>) => TablePreviewLinkProps['image'] | undefined) | TablePreviewLinkProps['image'] | undefined;
23
+ description?: ((row: TableRow<T>) => string | undefined) | string | undefined;
23
24
  };
24
25
  export declare function useTableColumns<I extends Record<string, any>, T extends readonly TableColumnCustom<I>[] = readonly TableColumnCustom<I>[]>(columns: T): {
25
26
  columns: {
@@ -1,5 +1,5 @@
1
- import { UUser } from "#components";
2
1
  import { h } from "vue";
2
+ import TablePreviewLink from "../components/TablePreviewLink.vue";
3
3
  import { formatDate, formatDateTime, formatNumber } from "../utils/index.js";
4
4
  export function useTableFiltersFields(_schema, fields) {
5
5
  return { filtersFields: fields };
@@ -28,17 +28,16 @@ function transformColumn(column) {
28
28
  return void 0;
29
29
  }
30
30
  if (column.to) {
31
- return h(UUser, {
32
- to: typeof column.to === "function" ? column.to(row) : column.to,
33
- target: column.target,
34
- name: value.toString(),
35
- class: "inline-flex",
36
- ui: {
37
- name: "text-primary",
38
- avatar: "group-hover/user:scale-100"
39
- },
40
- avatar: column.image ? { src: column.image, size: "sm", alt: value.toString() } : void 0,
41
- description: column.description
31
+ const to = typeof column.to === "function" ? column.to(row) : column.to;
32
+ const target = column.target;
33
+ const description = typeof column.description === "function" ? column.description(row) : column.description;
34
+ const image = typeof column.image === "function" ? column.image(row) : column.image;
35
+ return h(TablePreviewLink, {
36
+ to,
37
+ target,
38
+ description,
39
+ label: value.toString(),
40
+ image
42
41
  });
43
42
  }
44
43
  return value;
@@ -0,0 +1,4 @@
1
+ export declare function createEnumItems<T extends Record<any, string>>(labels: T): Array<{
2
+ value: keyof T;
3
+ label: string;
4
+ }>;
@@ -0,0 +1,6 @@
1
+ export function createEnumItems(labels) {
2
+ return Object.entries(labels).map(([value, label]) => ({
3
+ value,
4
+ label
5
+ }));
6
+ }
@@ -1,6 +1,7 @@
1
1
  export * from './auth';
2
2
  export * from './avatar';
3
3
  export * from './date';
4
+ export * from './enums';
4
5
  export * from './formatters';
5
6
  export * from './logger';
6
7
  export * from './slugify';
@@ -1,6 +1,7 @@
1
1
  export * from "./auth.js";
2
2
  export * from "./avatar.js";
3
3
  export * from "./date.js";
4
+ export * from "./enums.js";
4
5
  export * from "./formatters.js";
5
6
  export * from "./logger.js";
6
7
  export * from "./slugify.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hywax/cms",
3
3
  "type": "module",
4
- "version": "2.0.2",
4
+ "version": "2.1.0",
5
5
  "description": "Hywax CMS. ⚠️ This package is intended for internal use only.",
6
6
  "imports": {
7
7
  "#build/cms/*": "./.nuxt/cms/*.ts",
@@ -79,16 +79,16 @@
79
79
  "scule": "^1.3.0",
80
80
  "sortablejs": "^1.15.6",
81
81
  "tinyglobby": "^0.2.15",
82
- "zod": "^4.3.4"
82
+ "zod": "^4.3.5"
83
83
  },
84
84
  "devDependencies": {
85
- "@antfu/eslint-config": "^5.4.1",
85
+ "@antfu/eslint-config": "^6.7.3",
86
86
  "@commitlint/cli": "^20.3.0",
87
87
  "@commitlint/config-conventional": "^20.3.0",
88
88
  "@nuxt/devtools": "^3.1.1",
89
89
  "@nuxt/module-builder": "^1.0.2",
90
90
  "@nuxt/schema": "^4.2.2",
91
- "@nuxt/test-utils": "^3.21.0",
91
+ "@nuxt/test-utils": "^3.22.0",
92
92
  "@types/sortablejs": "^1.15.9",
93
93
  "@vue/test-utils": "^2.4.6",
94
94
  "changelogen-monorepo": "^0.5.0",