@neatui/nuxt 1.5.2 → 1.5.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neatui/nuxt",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "NeatUI component library for Nuxt 3",
5
5
  "main": "./src/index.ts",
6
6
  "license": "MIT",
@@ -22,7 +22,7 @@
22
22
  "@nuxt/schema": "^3.0.0",
23
23
  "@rollup/plugin-typescript": "^11.1.6",
24
24
  "@types/sortablejs": "^1.15.8",
25
- "nuxt": "^3.0.0",
25
+ "nuxt": ">=3.0.0",
26
26
  "postcss-scss": "^4.0.9",
27
27
  "rollup-plugin-scss": "^4.0.0",
28
28
  "rollup-plugin-terser": "^7.0.2",
@@ -1,7 +1,7 @@
1
1
  <template>
2
- <template v-for="(item, index) in $nodes" :key="item.paths">
3
- <div class="fekit-node-loader" :data-level="level" :data-index="index" :data-paths="item.paths" v-bind="item.attrs" v-on="item.$events" v-html="item.value"></div>
4
- <NodeLoader v-if="item.child" :nodes="item.child" :level="$level" :index="index" :paths="item.paths" />
2
+ <template v-for="(item, index) in $nodes" :key="index">
3
+ <div :data-index="index" v-bind="item.attrs" v-on="item.$events" v-html="item.value"></div>
4
+ <NodeLoader v-if="item.child" :nodes="item.child" />
5
5
  </template>
6
6
  </template>
7
7
  <script setup lang="ts">
@@ -9,34 +9,24 @@
9
9
  import NodeLoader from './NodeLoader.vue';
10
10
 
11
11
  interface NodeProps {
12
- label?: string | ((data: any) => string);
13
- field?: string | ((data: any) => string);
14
- model?: string | ((data: any) => string);
15
12
  attrs?: Record<string, any> | ((data: any) => Record<string, any>);
16
- clear?: boolean | ((data: any) => boolean);
17
- media?: string | ((data: any) => string);
18
13
  value?: any | ((data: any) => any);
14
+ model?: string;
19
15
  event?: Record<string, any> | ((data: any) => Record<string, any>);
20
16
  child?: NodeProps[];
21
17
  }
22
18
 
23
19
  interface Props {
24
- nodes: NodeProps[];
25
- level?: number;
26
- index?: number;
27
- paths?: string;
20
+ nodes: NodeProps | NodeProps[];
28
21
  }
29
22
  const props = withDefaults(defineProps<Props>(), {
30
23
  nodes: () => [],
31
- level: 0,
32
- index: 0,
33
- paths: '',
34
24
  });
35
25
 
36
26
  const $nodes = computed(() => {
37
- return props.nodes.map((item, index) => {
38
- const paths = props.paths ? `${props.paths}-${index}` : `${index}`;
39
- const context = { node: item, level: props.level, index, paths } as const;
27
+ const nodeList = Array.isArray(props.nodes) ? props.nodes : [props.nodes];
28
+ return nodeList.map((item, index) => {
29
+ const context = { node: item, index } as const;
40
30
 
41
31
  let attrs: any = item.attrs;
42
32
  if (typeof attrs === 'function') {
@@ -75,11 +65,7 @@
75
65
  }
76
66
  }
77
67
 
78
- return { ...item, index, paths, attrs, value, $events } as any;
68
+ return { ...item, index, attrs, value, $events } as any;
79
69
  });
80
70
  });
81
-
82
- const $level = computed(() => {
83
- return props.level + 1;
84
- });
85
71
  </script>