@kizmann/nano-ui 0.7.28 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/nano-ui.js +1 -1
- package/dist/nano-ui.js.map +1 -1
- package/package.json +1 -1
- package/src/form/src/form/form.js +37 -9
- package/src/input/src/input/input.js +1 -1
package/package.json
CHANGED
@@ -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,32 @@ 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
100
|
if ( this.prevent ) {
|
101
|
+
event.preventDefault();
|
78
102
|
event.stopPropagation();
|
79
103
|
}
|
80
104
|
|
81
|
-
|
105
|
+
if ( Dom.find(event.target).is('input') ) {
|
106
|
+
this.$emit('submit', event);
|
107
|
+
}
|
82
108
|
|
83
109
|
return this.prevent;
|
84
110
|
},
|
@@ -136,15 +162,17 @@ export default {
|
|
136
162
|
'n-form--' + this.align,
|
137
163
|
];
|
138
164
|
|
139
|
-
let attrs = Obj.except(this.$attrs, [
|
140
|
-
|
141
|
-
|
165
|
+
let attrs = Obj.except(this.$attrs, ['class', 'onChange', 'onSubmit'], {
|
166
|
+
class: this.cmer(classList)
|
167
|
+
});
|
142
168
|
|
169
|
+
attrs['onSubmit'] = (e) => {
|
170
|
+
return false;
|
171
|
+
}
|
143
172
|
|
144
|
-
return (
|
145
|
-
|
146
|
-
|
147
|
-
</form>
|
148
|
-
);
|
173
|
+
return h(this.dom, { ...attrs }, [
|
174
|
+
this.$slots.default && this.$slots.default()
|
175
|
+
]);
|
149
176
|
}
|
177
|
+
|
150
178
|
}
|