v-nuxt-ui 0.1.0 → 0.1.1

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/dist/module.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "dependencies": [
8
8
  "@nuxt/ui"
9
9
  ],
10
- "version": "0.1.0",
10
+ "version": "0.1.1",
11
11
  "builder": {
12
12
  "@nuxt/module-builder": "1.0.2",
13
13
  "unbuild": "unknown"
@@ -1,6 +1,5 @@
1
1
  <script setup>
2
- import { ref, computed, useTemplateRef, watch } from "vue";
3
- import { useColorMode } from "#imports";
2
+ import { ref, useTemplateRef, watch } from "vue";
4
3
  import { useTheme } from "#v/composables/useTheme";
5
4
  import { useApp } from "#v/composables/useApp";
6
5
  import { useEChart } from "#v/composables/useEChart";
@@ -15,6 +14,7 @@ import {
15
14
  ToolboxComponent
16
15
  } from "echarts/components";
17
16
  import VChart from "vue-echarts";
17
+ import { useColorMode } from "@vueuse/core";
18
18
  const props = defineProps({
19
19
  option: { type: null, required: true },
20
20
  useBar: { type: Boolean, required: false, default: false },
@@ -1,7 +1,7 @@
1
1
  <script setup>
2
2
  import { onMounted, watch, onUnmounted } from "vue";
3
- import { useColorMode } from "#imports";
4
3
  import { format } from "sql-formatter";
4
+ import { useColorMode } from "@vueuse/core";
5
5
  const value = defineModel("modelValue", { type: null, ...{ required: true } });
6
6
  const props = defineProps({
7
7
  tables: { type: Array, required: false, default: () => [] },
@@ -4,10 +4,10 @@ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
4
4
  __VLS_PROPS_FALLBACK: infer P;
5
5
  } ? P : {});
6
6
  expose: (exposed: import("vue").ShallowUnwrapRef<{
7
- createRow: (model: T) => number;
8
- updateRow: (model: T) => void;
9
- deleteRow: (model: T) => void;
10
- refresh: (fromStart?: boolean) => Promise<void>;
7
+ createRow: (row: T) => void;
8
+ updateRow: (row: T) => void;
9
+ deleteRow: (row: T) => void;
10
+ refresh: () => Promise<void>;
11
11
  stats: import("vue").Ref<import("#v/types").StatsItem[][], import("#v/types").StatsItem[][]>;
12
12
  data: import("vue").Ref<T[], T[]>;
13
13
  }>) => void;
@@ -4,10 +4,10 @@ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
4
4
  __VLS_PROPS_FALLBACK: infer P;
5
5
  } ? P : {});
6
6
  expose: (exposed: import("vue").ShallowUnwrapRef<{
7
- createRow: (model: T) => number;
8
- updateRow: (model: T) => void;
9
- deleteRow: (model: T) => void;
10
- refresh: (fromStart?: boolean) => Promise<void>;
7
+ createRow: (row: T) => void;
8
+ updateRow: (row: T) => void;
9
+ deleteRow: (row: T) => void;
10
+ refresh: () => Promise<void>;
11
11
  stats: import("vue").Ref<import("#v/types").StatsItem[][], import("#v/types").StatsItem[][]>;
12
12
  data: import("vue").Ref<T[], T[]>;
13
13
  }>) => void;
@@ -4,10 +4,10 @@ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
4
4
  __VLS_PROPS_FALLBACK: infer P;
5
5
  } ? P : {});
6
6
  expose: (exposed: import("vue").ShallowUnwrapRef<{
7
- createRow: (model: T) => number;
8
- updateRow: (model: T) => void;
9
- deleteRow: (model: T) => void;
10
- refresh: (fromStart?: boolean) => Promise<void>;
7
+ createRow: (row: T) => void;
8
+ updateRow: (row: T) => void;
9
+ deleteRow: (row: T) => void;
10
+ refresh: () => Promise<void>;
11
11
  stats: import("vue").Ref<import("#v/types").StatsItem[][], import("#v/types").StatsItem[][]>;
12
12
  data: import("vue").Ref<T[], T[]>;
13
13
  }>) => void;
@@ -4,10 +4,10 @@ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
4
4
  __VLS_PROPS_FALLBACK: infer P;
5
5
  } ? P : {});
6
6
  expose: (exposed: import("vue").ShallowUnwrapRef<{
7
- createRow: (model: T) => number;
8
- updateRow: (model: T) => void;
9
- deleteRow: (model: T) => void;
10
- refresh: (fromStart?: boolean) => Promise<void>;
7
+ createRow: (row: T) => void;
8
+ updateRow: (row: T) => void;
9
+ deleteRow: (row: T) => void;
10
+ refresh: () => Promise<void>;
11
11
  stats: import("vue").Ref<import("#v/types").StatsItem[][], import("#v/types").StatsItem[][]>;
12
12
  data: import("vue").Ref<T[], T[]>;
13
13
  }>) => void;
@@ -0,0 +1,12 @@
1
+ import type { Ref } from 'vue';
2
+ import type { RequestResult } from '#v/types';
3
+ type AuthApi = {
4
+ refreshToken: (cmd: Cmd.RefreshTokensPayload) => Promise<{
5
+ data: Ref<RequestResult<Cmd.LoginResult>>;
6
+ }>;
7
+ getUserByAccessToken: () => Promise<{
8
+ data: Ref<RequestResult<Model.User>>;
9
+ }>;
10
+ };
11
+ export declare const useAuthApi: () => AuthApi;
12
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { ApiGroup } from '#v/types';
2
+ export declare const useDepartmentApi: () => ApiGroup<Model.Department>;
@@ -0,0 +1,12 @@
1
+ import type { Ref } from 'vue';
2
+ import type { RequestResult } from '#v/types';
3
+ type LoginApi = {
4
+ loginByUsernameAndPassword: (cmd: Cmd.UsernamePasswordLoginPayload) => Promise<{
5
+ data: Ref<RequestResult<Cmd.LoginResult>>;
6
+ }>;
7
+ changeUserPassword: (cmd: Cmd.ChangeUserPwdCmd) => Promise<{
8
+ data: Ref<RequestResult<unknown>>;
9
+ }>;
10
+ };
11
+ export declare const useLoginApi: () => LoginApi;
12
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { ApiGroup } from '#v/types';
2
+ export declare const useMenuApi: () => ApiGroup<Model.Menu>;
@@ -15,7 +15,7 @@ export const useMenuApi = createSharedComposable(() => ({
15
15
  parentId: model.parentId,
16
16
  parent: model.parent,
17
17
  i18nKey: model.i18nKey,
18
- staticRouteKey: model.staticRouteKeys,
18
+ staticRouteKeys: model.staticRouteKeys,
19
19
  permission: model.permission,
20
20
  order: String(Number(model.order) + 1),
21
21
  disabled: model.disabled
@@ -27,6 +27,6 @@ export const useMenuApi = createSharedComposable(() => ({
27
27
  parent: model,
28
28
  type: MenuType.MENU,
29
29
  order: "1",
30
- staticRouteKey: model.staticRouteKeys
30
+ staticRouteKeys: model.staticRouteKeys
31
31
  })
32
32
  }));
@@ -0,0 +1,2 @@
1
+ import type { ApiGroup } from '#v/types';
2
+ export declare const useRoleApi: () => ApiGroup<Model.Role>;
@@ -0,0 +1,10 @@
1
+ import type { ApiGroup, PageResult, RequestResult } from '#v/types';
2
+ import type { UseFetchOptions } from 'nuxt/app';
3
+ import type { Ref } from 'vue';
4
+ type RowRecordApiGroup = ApiGroup<Model.RowRecord> & {
5
+ getByTableNameAndRowId: (payload: Cmd.RowRecordPayload, customOptions?: UseFetchOptions<PageResult<Model.RowRecord>>) => Promise<{
6
+ data: Ref<RequestResult<PageResult<Model.RowRecord>>>;
7
+ }>;
8
+ };
9
+ export declare const useRowRecordApi: () => RowRecordApiGroup;
10
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { UseFetchOptions } from 'nuxt/app';
2
+ import type { ApiGroup, RequestResult } from '#v/types';
3
+ import type { Ref } from 'vue';
4
+ type UserApiGroup = ApiGroup<Model.User> & {
5
+ changePwd: (payload: Cmd.User.ChangePwdPayload, customOptions?: UseFetchOptions<unknown>) => Promise<{
6
+ data: Ref<RequestResult<unknown>>;
7
+ }>;
8
+ resetPwd: (userId: number, customOptions?: UseFetchOptions<unknown>) => Promise<{
9
+ data: Ref<RequestResult<unknown>>;
10
+ }>;
11
+ };
12
+ export declare const useUserApi: () => UserApiGroup;
13
+ export {};
@@ -0,0 +1,25 @@
1
+ import type { Ref } from 'vue';
2
+ import type { ApiGroup, BatchOprCommand, BatchSaveCommand, CountApi, ListApi, RequestResult, QueryTemplate } from '#v/types';
3
+ import { type UseFetchOptions } from 'nuxt/app';
4
+ type FetchResult<T> = Promise<{
5
+ data: Ref<RequestResult<T>>;
6
+ }>;
7
+ export declare function useApiFetch<T>(url: string | (() => string), options?: UseFetchOptions<T>): FetchResult<T>;
8
+ export declare function usePostFetch<T>(url: string, data?: any, customOptions?: UseFetchOptions<T>): FetchResult<T>;
9
+ export declare function usePutFetch<T>(url: string, data?: any, customOptions?: UseFetchOptions<T>): FetchResult<T>;
10
+ export declare function useGetFetch<T>(url: string, customOptions?: UseFetchOptions<T>): FetchResult<T>;
11
+ export declare function useDeleteFetch<T>(url: string, customOptions?: UseFetchOptions<T>): FetchResult<T>;
12
+ export declare function useApiCreate<M>(basePath: string): (model: M, customOptions?: UseFetchOptions<M>) => FetchResult<M>;
13
+ export declare function useApiBatchCreate<M>(basePath: string): (cmd: BatchSaveCommand<M>, customOptions?: UseFetchOptions<M[]>) => FetchResult<M[]>;
14
+ export declare function useApiUpdate<M>(basePath: string): (model: M, customOptions?: UseFetchOptions<M>) => FetchResult<M>;
15
+ export declare function useApiBatchUpdate<M>(basePath: string): (cmd: BatchSaveCommand<M>, customOptions?: UseFetchOptions<M[]>) => FetchResult<M[]>;
16
+ export declare function useApiGetById<M>(basePath: string): (id: number, customOptions?: UseFetchOptions<M>) => FetchResult<M>;
17
+ export declare function useApiGetByString<M>(basePath: string): (param: string, customOptions?: UseFetchOptions<M>) => FetchResult<M>;
18
+ export declare function useApiDeleteById(basePath: string): (id: number, customOptions?: UseFetchOptions<void>) => FetchResult<void>;
19
+ export declare function useApiBatchDelete(basePath: string): (delReq: BatchOprCommand, customOptions?: UseFetchOptions<void>) => FetchResult<void>;
20
+ export declare function useApiCount<M>(basePath: string): CountApi<M>;
21
+ export declare function useApiList<M>(basePath: string): ListApi<M>;
22
+ export declare function useApiCountAndList<M>(basePath: string): ListApi<M>;
23
+ export declare function pruneQueryTemplate<M>(payload: QueryTemplate<M>): QueryTemplate<M>;
24
+ export declare const useApi: <M>(basePath: string) => ApiGroup<M>;
25
+ export {};
@@ -0,0 +1,46 @@
1
+ import { type Node } from '@vue-flow/core';
2
+ import type { Ref } from 'vue';
3
+ export interface UseFlowOptions {
4
+ flow?: Ref<Model.Flow | undefined>;
5
+ onUpdateModel?: Ref<((model: Model.Flow) => void) | undefined>;
6
+ }
7
+ export interface UseFlowReturn {
8
+ nodes: Ref<any[]>;
9
+ edges: Ref<any[]>;
10
+ GRID_SIZE: number;
11
+ syncNodes: (nodeHandlers?: (nodeId: string) => any) => void;
12
+ syncEdges: (styleOptions?: {
13
+ strokeWidth?: number;
14
+ markerStart?: boolean;
15
+ markerEnd?: boolean;
16
+ }) => void;
17
+ applyEdgeStyles: (styleOptions: {
18
+ strokeWidth: number;
19
+ markerStart: boolean;
20
+ markerEnd: boolean;
21
+ }) => void;
22
+ transformNode: (node: Model.FlowNode, handlers?: any) => Node;
23
+ refreshFlow: () => Promise<void>;
24
+ updateNode: (updatedNode: Model.FlowNode) => Promise<void>;
25
+ updateNodePosition: (nodeId: string, x: number, y: number) => Promise<void>;
26
+ updateNodeDimensions: (nodeId: string, dimensions: {
27
+ width: number;
28
+ height: number;
29
+ positionX: number;
30
+ positionY: number;
31
+ }) => Promise<void>;
32
+ createNode: () => Promise<void>;
33
+ deleteNode: (nodeId: string) => Promise<void>;
34
+ deleteEdge: (edgeId: string) => Promise<void>;
35
+ createEdge: (params: {
36
+ source: string;
37
+ target: string;
38
+ sourceHandle?: string | null;
39
+ targetHandle?: string | null;
40
+ }) => Promise<void>;
41
+ }
42
+ /**
43
+ * Flow 业务逻辑 Composable
44
+ * 处理节点和边的 CRUD 操作、数据转换等
45
+ */
46
+ export declare function useFlow(options: UseFlowOptions): UseFlowReturn;
@@ -0,0 +1,25 @@
1
+ import type { ComputedRef, Ref } from 'vue';
2
+ import type { TableHeaderProps, TablePaginationProps, VColumn, VTableProps, WhereQueryProps, StatsItem } from '#v/types';
3
+ import type { ContextMenuItem, TableProps } from '@nuxt/ui';
4
+ export interface UseTableReturn<T> {
5
+ data: Ref<T[]>;
6
+ createRow: (row: T) => void;
7
+ updateRow: (row: T) => void;
8
+ deleteRow: (row: T) => void;
9
+ stats: Ref<StatsItem[][]>;
10
+ rowSelection: Ref<Record<number, boolean> | undefined>;
11
+ onUpdateRowSelection: (newRowSelection: Record<number, boolean> | undefined) => void;
12
+ selectedIds: Ref<number[]>;
13
+ fetching: Ref<boolean>;
14
+ fetchList: () => Promise<void>;
15
+ debouncedFetchList: () => void;
16
+ whereQueryOpen: boolean;
17
+ onUpdateWhereQueryOpen: (open: boolean) => void;
18
+ columns: ComputedRef<VColumn<T>[]>;
19
+ tblProps: ComputedRef<TableProps<T>>;
20
+ tblWhereQueryProps: ComputedRef<WhereQueryProps<T>>;
21
+ tblHeaderProps: ComputedRef<TableHeaderProps<T>>;
22
+ tblPaginationProps: ComputedRef<TablePaginationProps<T>>;
23
+ tblContextMenuItems: Ref<ContextMenuItem[]>;
24
+ }
25
+ export declare function useTable<T>(props: VTableProps<T>): UseTableReturn<T>;
@@ -0,0 +1,27 @@
1
+ import type { Ref, ComputedRef } from 'vue';
2
+ import type { VTableProps, TableHeaderProps, TablePaginationProps, WhereQueryProps, StatsItem } from '#v/types';
3
+ import type { TableProps, ContextMenuItem } from '@nuxt/ui';
4
+ export interface UseProTableViewReturn<T> {
5
+ data: Ref<T[]>;
6
+ createRow: (row: T) => void;
7
+ updateRow: (row: T) => void;
8
+ deleteRow: (row: T) => void;
9
+ stats: Ref<StatsItem[][]>;
10
+ fetchList: () => Promise<void>;
11
+ rowSelection: Ref<Record<number, boolean> | undefined>;
12
+ onUpdateRowSelection: (newRowSelection: Record<number, boolean> | undefined) => void;
13
+ tblProps: ComputedRef<TableProps<T>>;
14
+ tblWhereQueryProps: ComputedRef<WhereQueryProps<T>>;
15
+ tblHeaderProps: ComputedRef<TableHeaderProps<T>>;
16
+ tblPaginationProps: ComputedRef<TablePaginationProps<T>>;
17
+ tblContextMenuItems: Ref<ContextMenuItem[]>;
18
+ tableWidth: Ref<number>;
19
+ updateTableWidth: () => void;
20
+ tblClasses: ComputedRef<(string | boolean | (string | boolean)[])[]>;
21
+ tblUi: ComputedRef<{
22
+ root: string;
23
+ th: string;
24
+ td: string;
25
+ }>;
26
+ }
27
+ export declare function useProTableView<T>(props: VTableProps<T>): UseProTableViewReturn<T>;
@@ -0,0 +1,9 @@
1
+ import { type Ref } from 'vue';
2
+ import type { ApiGroup } from '#v/types';
3
+ export declare const useFormValues: <T>(raw: Ref<T>, defaultValues?: Partial<T>) => {
4
+ oldValues: Ref<T>;
5
+ newValues: Ref<T>;
6
+ };
7
+ export declare const useFormSubmission: <T extends Model.BaseModel>(oldValues: Ref<T>, newValues: Ref<T>, close: (ok: boolean) => void, save: (model: T) => void, apiGroup: () => ApiGroup<T>, arrayTypeFieldKeys?: (keyof T)[], rowKey?: keyof T, versionKey?: keyof T) => {
8
+ onSubmit: () => Promise<void>;
9
+ };
@@ -34,7 +34,8 @@ export const _useSidebarMenus = () => {
34
34
  sidebarMenuPathSet.value.clear();
35
35
  menusFromUser.value = [...newMenusFromUser, ...newRolesFromUser.map((role) => role.menus ?? []).flat()];
36
36
  menusFromUser.value.forEach((menu) => menu.staticRouteKeys?.forEach((key) => sidebarMenuPathSet.value.add(key)));
37
- sidebarMenus.value = menuMode.value === "static" ? bizMenus.value : hideNoPermissionMenus(bizMenus.value, sidebarMenuPathSet.value);
37
+ const menuItems = bizMenus.value;
38
+ sidebarMenus.value = menuMode.value === "static" ? menuItems : hideNoPermissionMenus(menuItems, sidebarMenuPathSet.value);
38
39
  };
39
40
  watch([loginUserRoles, loginUserMenus, bizMenus], ([newRoles, newMenus]) => {
40
41
  setUserDynamicMenus(newRoles, newMenus);
@@ -43,6 +43,7 @@ export type ApiGroup<T> = {
43
43
  countAndList: ListApi<T>;
44
44
  prune: (model: T) => T;
45
45
  copy?: (model: T) => T;
46
+ copyAsParent?: (model: T) => T;
46
47
  };
47
48
  export type RowActionProps<T> = {
48
49
  label?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "v-nuxt-ui",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Veken UI Component Library - Reusable Nuxt UI components, composables, and utilities for enterprise applications",
5
5
  "type": "module",
6
6
  "style": "./dist/runtime/index.css",
@@ -26,22 +26,10 @@
26
26
  "typecheck": "nuxi typecheck playground"
27
27
  },
28
28
  "dependencies": {
29
- "@nuxt/content": "^3.12.0",
30
29
  "@nuxt/kit": "^4.3.1",
31
- "@nuxtjs/mdc": "^0.20.2",
32
- "@tanstack/table-core": "^8.21.3",
33
- "@vueuse/core": "^14.2.1",
34
- "better-sqlite3": "^12.8.0",
35
30
  "dayjs": "^1.11.19",
36
31
  "defu": "^6.1.4",
37
- "fflate": "^0.8.2",
38
- "json5": "^2.2.3",
39
32
  "maska": "^3.2.0",
40
- "monaco-editor": "^0.55.1",
41
- "ohash": "^2.0.11",
42
- "reka-ui": "^2.9.2",
43
- "scule": "^1.3.0",
44
- "sql-formatter": "^15.7.2",
45
33
  "vue-router": "^5.0.4"
46
34
  },
47
35
  "peerDependencies": {
@@ -61,26 +49,38 @@
61
49
  "cronstrue": "^3.12.0",
62
50
  "echarts": "^6.0.0",
63
51
  "exceljs": "^4.4.0",
52
+ "monaco-editor": "^0.55.1",
53
+ "shiki": "^3.23.0",
54
+ "sql-formatter": "^15.7.2",
64
55
  "vue-draggable-plus": "^0.6.1",
65
56
  "vue-echarts": "^8.0.1"
66
57
  },
67
58
  "devDependencies": {
68
59
  "@iconify-json/lucide": "^1.2.94",
69
60
  "@internationalized/date": "^3.12.0",
61
+ "@nuxt/content": "^3.12.0",
70
62
  "@nuxt/eslint": "^1.15.2",
71
63
  "@nuxt/eslint-config": "^1.15.2",
72
64
  "@nuxt/fonts": "^0.12.1",
73
65
  "@nuxt/module-builder": "^1.0.2",
74
66
  "@nuxt/ui": "^4.6.0",
75
67
  "@nuxtjs/i18n": "^10.2.4",
68
+ "@nuxtjs/mdc": "^0.20.2",
69
+ "@tanstack/table-core": "^8.21.3",
70
+ "@types/better-sqlite3": "^7.6.13",
76
71
  "@types/sortablejs": "^1.15.9",
72
+ "@vueuse/core": "^14.2.1",
77
73
  "@vueuse/nuxt": "^14.2.1",
74
+ "better-sqlite3": "^12.8.0",
78
75
  "cronstrue": "^3.12.0",
79
76
  "echarts": "^6.0.0",
80
77
  "eslint": "^9.39.3",
81
78
  "exceljs": "^4.4.0",
79
+ "monaco-editor": "^0.55.1",
82
80
  "nuxt": "^4.3.1",
81
+ "reka-ui": "^2.9.2",
83
82
  "shiki": "^3.23.0",
83
+ "sql-formatter": "^15.7.2",
84
84
  "sortablejs": "^1.15.7",
85
85
  "tailwindcss": "^4.2.2",
86
86
  "typescript": "^5.9.3",