v-nuxt-ui 0.1.30 → 0.1.31

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.30",
10
+ "version": "0.1.31",
11
11
  "builder": {
12
12
  "@nuxt/module-builder": "1.0.2",
13
13
  "unbuild": "3.6.1"
@@ -1,11 +1,11 @@
1
- import type { Component } from 'vue';
1
+ import { type Component as VueComponent } from 'vue';
2
2
  import type { VFormFieldAsyncSelectProps } from '#v/types';
3
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<{
4
4
  props: import("vue").PublicProps & __VLS_PrettifyLocal<(VFormFieldAsyncSelectProps<T> & {
5
5
  icon?: string;
6
6
  disabled?: boolean;
7
7
  canCreate?: boolean;
8
- createModalComponent?: Component;
8
+ createModalComponent?: VueComponent;
9
9
  createModalOpenProps?: Record<string, any>;
10
10
  } & {
11
11
  modelValue: string[] | number[] | number | string | null | undefined;
@@ -1,9 +1,10 @@
1
1
  <script setup>
2
- import { ref, computed } from "vue";
3
- import { useFetching } from "#v/composables/useBoolean";
2
+ import { computed, ref } from "vue";
3
+ import { defu } from "defu";
4
+ import { useFetching } from "#v/composables";
4
5
  import { isEmptyString } from "#v/utils";
6
+ import { useOverlay } from "@nuxt/ui/runtime/composables/useOverlay.js";
5
7
  import { useDebounceFn } from "@vueuse/core";
6
- import { defu } from "defu";
7
8
  import { useApp } from "#v/composables/useApp";
8
9
  const props = defineProps({
9
10
  listApi: { type: Function, required: true },
@@ -103,6 +104,26 @@ const onFetchItems = async () => {
103
104
  }
104
105
  };
105
106
  const onDebounceFetchItems = useDebounceFn(onFetchItems, 512);
107
+ const onCreateNew = async () => {
108
+ if (!props.createModalComponent) return;
109
+ open.value = false;
110
+ const modal = useOverlay().create(props.createModalComponent);
111
+ modal.open({
112
+ model: { id: 0 },
113
+ ...props.createModalOpenProps,
114
+ onSave: (newModel) => {
115
+ searchedData.value.push(newModel);
116
+ const newValue = newModel[props.valueField];
117
+ if (props.multiple) {
118
+ const currentValues = Array.isArray(modelValue.value) ? [...modelValue.value] : [];
119
+ currentValues.push(newValue);
120
+ onSelect(currentValues);
121
+ } else {
122
+ onSelect(newValue);
123
+ }
124
+ }
125
+ });
126
+ };
106
127
  </script>
107
128
 
108
129
  <template>
@@ -111,6 +132,10 @@ const onDebounceFetchItems = useDebounceFn(onFetchItems, 512);
111
132
  :model-value="modelValue"
112
133
  :search-term="searchTerm"
113
134
  :items="items"
135
+ :create-item="canCreate && createModalComponent && {
136
+ position: 'top',
137
+ when: 'always'
138
+ }"
114
139
  value-key="value"
115
140
  ignore-filter
116
141
  :multiple="multiple"
@@ -139,5 +164,6 @@ const onDebounceFetchItems = useDebounceFn(onFetchItems, 512);
139
164
  onDebounceFetchItems();
140
165
  }"
141
166
  @update:model-value="onSelect"
167
+ @create="onCreateNew"
142
168
  />
143
169
  </template>
@@ -1,11 +1,11 @@
1
- import type { Component } from 'vue';
1
+ import { type Component as VueComponent } from 'vue';
2
2
  import type { VFormFieldAsyncSelectProps } from '#v/types';
3
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<{
4
4
  props: import("vue").PublicProps & __VLS_PrettifyLocal<(VFormFieldAsyncSelectProps<T> & {
5
5
  icon?: string;
6
6
  disabled?: boolean;
7
7
  canCreate?: boolean;
8
- createModalComponent?: Component;
8
+ createModalComponent?: VueComponent;
9
9
  createModalOpenProps?: Record<string, any>;
10
10
  } & {
11
11
  modelValue: string[] | number[] | number | string | null | undefined;
@@ -98,7 +98,12 @@ const columns = [
98
98
  header: "\u662F\u5426\u9700\u8981\u586B\u5199\u5DE5\u65F6",
99
99
  filterOption: {
100
100
  type: "select",
101
- items: booleanOptions
101
+ items: booleanOptions,
102
+ empty: {
103
+ label: "\u5426",
104
+ variant: "outline",
105
+ color: "neutral"
106
+ }
102
107
  }
103
108
  },
104
109
  {
@@ -106,7 +111,12 @@ const columns = [
106
111
  header: "\u6027\u522B",
107
112
  filterOption: {
108
113
  type: "select",
109
- items: genderOptions
114
+ items: genderOptions,
115
+ empty: {
116
+ label: "\u672A\u77E5",
117
+ variant: "outline",
118
+ color: "neutral"
119
+ }
110
120
  },
111
121
  meta: {
112
122
  class: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "v-nuxt-ui",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
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",