@kizmann/nano-ui 0.7.28 → 0.7.29

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kizmann/nano-ui",
3
- "version": "0.7.28",
3
+ "version": "0.7.29",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "author": "Eduard Kizmann <kizmann@protonmail.ch>",
@@ -1,4 +1,5 @@
1
1
  import { UUID, Num, Arr, Obj, Any, Dom, Locale } from "@kizmann/pico-js";
2
+ import { h } from "vue";
2
3
 
3
4
  export default {
4
5
 
@@ -12,6 +13,14 @@ export default {
12
13
 
13
14
  props: {
14
15
 
16
+ dom: {
17
+ default()
18
+ {
19
+ return 'div';
20
+ },
21
+ type: [String]
22
+ },
23
+
15
24
  form: {
16
25
  default()
17
26
  {
@@ -70,15 +79,31 @@ export default {
70
79
 
71
80
  },
72
81
 
82
+ computed: {
83
+
84
+ classList()
85
+ {
86
+ if ( ! this.$attrs.class ) {
87
+ return [];
88
+ }
89
+
90
+ return Any.isArray(this.$attrs) ? this.$attrs.class :
91
+ [this.$attrs.class];
92
+ }
93
+
94
+ },
95
+
73
96
  methods: {
74
97
 
75
98
  onSubmit(event)
76
99
  {
77
- if ( this.prevent ) {
78
- event.stopPropagation();
79
- }
100
+ console.log('hmm', event.which);
101
+ event.preventDefault();
102
+ event.stopPropagation();
80
103
 
81
- this.$emit('submit', event);
104
+ if ( Dom.find(event.target).is('input') ) {
105
+ this.$emit('submit', event);
106
+ }
82
107
 
83
108
  return this.prevent;
84
109
  },
@@ -136,15 +161,17 @@ export default {
136
161
  'n-form--' + this.align,
137
162
  ];
138
163
 
139
- let attrs = Obj.except(this.$attrs, [
140
- 'onChange', 'onSubmit'
141
- ]);
164
+ let attrs = Obj.except(this.$attrs, ['class', 'onChange', 'onSubmit'], {
165
+ class: this.cmer(classList)
166
+ });
142
167
 
168
+ attrs['onSubmit'] = (e) => {
169
+ return false;
170
+ }
143
171
 
144
- return (
145
- <form class={classList} onSubmit={this.onSubmit} {...attrs}>
146
- { this.$slots.default && this.$slots.default() }
147
- </form>
148
- );
172
+ return h(this.dom, { ...attrs }, [
173
+ this.$slots.default && this.$slots.default()
174
+ ]);
149
175
  }
176
+
150
177
  }