v-nuxt-ui 0.1.28 → 0.1.29

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.28",
10
+ "version": "0.1.29",
11
11
  "builder": {
12
12
  "@nuxt/module-builder": "1.0.2",
13
13
  "unbuild": "3.6.1"
@@ -15,7 +15,10 @@ const props = defineProps({
15
15
  disableOprSelector: { type: Boolean, required: false },
16
16
  multiple: { type: Boolean, required: false },
17
17
  placeholder: { type: String, required: false },
18
- size: { type: null, required: false }
18
+ size: { type: null, required: false },
19
+ canCreate: { type: Boolean, required: false },
20
+ createModalComponent: { type: null, required: false },
21
+ createModalOpenProps: { type: Object, required: false }
19
22
  });
20
23
  const modelValue = defineModel("modelValue", { type: null, ...{ required: true } });
21
24
  const initModelValue = ref(modelValue.value);
@@ -1,8 +1,12 @@
1
+ import type { Component } from 'vue';
1
2
  import type { VFormFieldAsyncSelectProps } from '#v/types';
2
3
  declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
4
  props: import("vue").PublicProps & __VLS_PrettifyLocal<(VFormFieldAsyncSelectProps<T> & {
4
5
  icon?: string;
5
6
  disabled?: boolean;
7
+ canCreate?: boolean;
8
+ createModalComponent?: Component;
9
+ createModalOpenProps?: Record<string, any>;
6
10
  } & {
7
11
  modelValue: string[] | number[] | number | string | null | undefined;
8
12
  }) & {
@@ -25,6 +25,9 @@ const props = defineProps({
25
25
  multiple: { type: Boolean, required: false },
26
26
  placeholder: { type: String, required: false },
27
27
  size: { type: null, required: false },
28
+ canCreate: { type: Boolean, required: false },
29
+ createModalComponent: { type: void 0, required: false },
30
+ createModalOpenProps: { type: Object, required: false },
28
31
  icon: { type: String, required: false },
29
32
  disabled: { type: Boolean, required: false }
30
33
  });
@@ -1,8 +1,12 @@
1
+ import type { Component } from 'vue';
1
2
  import type { VFormFieldAsyncSelectProps } from '#v/types';
2
3
  declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
4
  props: import("vue").PublicProps & __VLS_PrettifyLocal<(VFormFieldAsyncSelectProps<T> & {
4
5
  icon?: string;
5
6
  disabled?: boolean;
7
+ canCreate?: boolean;
8
+ createModalComponent?: Component;
9
+ createModalOpenProps?: Record<string, any>;
6
10
  } & {
7
11
  modelValue: string[] | number[] | number | string | null | undefined;
8
12
  }) & {
@@ -23,6 +23,9 @@ const props = defineProps({
23
23
  multiple: { type: Boolean, required: false },
24
24
  placeholder: { type: String, required: false },
25
25
  size: { type: null, required: false },
26
+ canCreate: { type: Boolean, required: false },
27
+ createModalComponent: { type: null, required: false },
28
+ createModalOpenProps: { type: Object, required: false },
26
29
  icon: { type: String, required: false },
27
30
  disabled: { type: Boolean, required: false }
28
31
  });
@@ -147,6 +147,9 @@ const fieldModelValue = computed({
147
147
  :disabled="field.disabled"
148
148
  :enable-empty-option="field.enableEmptyOption"
149
149
  :extra-search-field-fn="field.extraSearchFieldFn"
150
+ :can-create="field.canCreate"
151
+ :create-modal-component="field.createModalComponent"
152
+ :create-modal-open-props="field.createModalOpenProps"
150
153
  @update-init-model-values="field.onUpdateInitModelValues"
151
154
  />
152
155
  <FormFieldAsyncObjectSelect
@@ -22,7 +22,10 @@ const props = defineProps({
22
22
  disableOprSelector: { type: Boolean, required: false },
23
23
  multiple: { type: Boolean, required: false },
24
24
  placeholder: { type: String, required: false },
25
- size: { type: null, required: false, default: "sm" }
25
+ size: { type: null, required: false, default: "sm" },
26
+ canCreate: { type: Boolean, required: false },
27
+ createModalComponent: { type: null, required: false },
28
+ createModalOpenProps: { type: Object, required: false }
26
29
  });
27
30
  const whereQueryItem = defineModel("whereQueryItem", { type: Object, ...{ required: true } });
28
31
  const { fetching, startFetching, endFetching } = useFetching();
@@ -47,35 +47,47 @@ export function useTableRowActions(props) {
47
47
  }
48
48
  });
49
49
  }
50
- extraRowActions?.forEach((action) => {
51
- actionItems.push({
50
+ const buildActionItem = (action) => {
51
+ const item = {
52
52
  label: action.label,
53
53
  icon: action.icon,
54
54
  type: action.type,
55
- color: action.color,
56
- onClick: async () => {
57
- if (action.fn) {
55
+ color: action.color
56
+ };
57
+ if (action.children && action.children.length > 0) {
58
+ item.children = action.children.map(buildActionItem);
59
+ return item;
60
+ }
61
+ item.onClick = async () => {
62
+ if (action.fn) {
63
+ try {
58
64
  action.fn(row.original);
59
- if (action.refetchAfterFn) {
60
- await fetchList();
61
- }
65
+ } catch (e) {
66
+ console.error("Error in row action fn:", e);
62
67
  }
63
- if (action.asyncFn) {
64
- actionLoadingRowIdxSet.value.add(row.index);
65
- try {
66
- await action.asyncFn(row.original);
67
- } finally {
68
- actionLoadingRowIdxSet.value.delete(row.index);
69
- }
68
+ if (action.refetchAfterFn) {
69
+ await fetchList();
70
70
  }
71
- if (action.fnWithModal) {
72
- const result = await action.fnWithModal(row.original);
73
- if (result) {
74
- await fetchList();
75
- }
71
+ }
72
+ if (action.asyncFn) {
73
+ actionLoadingRowIdxSet.value.add(row.index);
74
+ try {
75
+ await action.asyncFn(row.original);
76
+ } finally {
77
+ actionLoadingRowIdxSet.value.delete(row.index);
76
78
  }
77
79
  }
78
- });
80
+ if (action.fnWithModal) {
81
+ const result = await action.fnWithModal(row.original);
82
+ if (result) {
83
+ await fetchList();
84
+ }
85
+ }
86
+ };
87
+ return item;
88
+ };
89
+ extraRowActions?.forEach((action) => {
90
+ actionItems.push(buildActionItem(action));
79
91
  });
80
92
  if (!disableRowDeletion) {
81
93
  if (actionItems.length > 0) {
@@ -1,4 +1,4 @@
1
- import type { VNode, Ref } from 'vue';
1
+ import type { VNode, Ref, Component } from 'vue';
2
2
  import type { ButtonProps, FormFieldProps, InputProps, RadioGroupProps, SelectMenuItem, SelectProps, TreeItem } from '@nuxt/ui';
3
3
  import type { ZodType } from 'zod';
4
4
  import type { PageResult, RequestResult } from '../../request.js';
@@ -20,6 +20,9 @@ export type VFormFieldAsyncSelectProps<T> = {
20
20
  multiple?: boolean;
21
21
  placeholder?: string;
22
22
  size?: SelectProps['size'];
23
+ canCreate?: boolean;
24
+ createModalComponent?: Component;
25
+ createModalOpenProps?: Record<string, any>;
23
26
  };
24
27
  export type VFormFieldAsyncTreeSelectProps<T> = {
25
28
  fetchAll?: boolean;
@@ -54,6 +54,7 @@ export type RowActionProps<T> = {
54
54
  refetchAfterFn?: boolean;
55
55
  fnWithModal?: (model: T) => Promise<boolean>;
56
56
  asyncFn?: (model: T) => Promise<void>;
57
+ children?: RowActionProps<T>[];
57
58
  };
58
59
  export type VTableExportExcelProps<T> = {
59
60
  filename: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "v-nuxt-ui",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
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",