@kizmann/nano-ui 0.7.11 → 0.7.14
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -78,13 +78,13 @@ export default {
|
|
78
78
|
{
|
79
79
|
let $input = Dom.find(this.$el).find('input');
|
80
80
|
|
81
|
-
if (
|
81
|
+
if ( !$input.empty() ) {
|
82
82
|
return $input.get(0).focus();
|
83
83
|
}
|
84
84
|
|
85
85
|
$input = Dom.find(this.$refs.input).childs();
|
86
86
|
|
87
|
-
if (
|
87
|
+
if ( !$input.empty() ) {
|
88
88
|
return $input.get(0).click();
|
89
89
|
}
|
90
90
|
|
@@ -99,7 +99,7 @@ export default {
|
|
99
99
|
return;
|
100
100
|
}
|
101
101
|
|
102
|
-
if ( !
|
102
|
+
if ( !this.NTabs || !this.NTabsItem ) {
|
103
103
|
return;
|
104
104
|
}
|
105
105
|
|
@@ -123,23 +123,28 @@ export default {
|
|
123
123
|
|
124
124
|
beforeMount()
|
125
125
|
{
|
126
|
-
this.NForm
|
126
|
+
if ( this.NForm ) {
|
127
|
+
this.NForm.addItem(this);
|
128
|
+
}
|
127
129
|
},
|
128
130
|
|
129
131
|
mounted()
|
130
132
|
{
|
131
|
-
this.NForm
|
132
|
-
{ deep: true });
|
133
|
+
if ( this.NForm ) {
|
134
|
+
this.NForm.$watch('errors', this.gotoInput, { deep: true });
|
135
|
+
}
|
133
136
|
},
|
134
137
|
|
135
138
|
beforeUnmount()
|
136
139
|
{
|
137
|
-
this.NForm
|
140
|
+
if ( this.NForm ) {
|
141
|
+
this.NForm.removeItem(this);
|
142
|
+
}
|
138
143
|
},
|
139
144
|
|
140
145
|
renderTooltip()
|
141
146
|
{
|
142
|
-
if ( !
|
147
|
+
if ( !this.tooltip && !this.$slots.tooltip ) {
|
143
148
|
return null;
|
144
149
|
}
|
145
150
|
|
@@ -150,21 +155,21 @@ export default {
|
|
150
155
|
|
151
156
|
return (
|
152
157
|
<NPopover type="tooltip" {...props}>
|
153
|
-
{
|
158
|
+
{this.$slots.tooltip && this.$slots.tooltip() || this.tooltip}
|
154
159
|
</NPopover>
|
155
160
|
);
|
156
161
|
},
|
157
162
|
|
158
163
|
renderLabel()
|
159
164
|
{
|
160
|
-
if ( !
|
165
|
+
if ( !this.label && !this.$slots.label ) {
|
161
166
|
return null;
|
162
167
|
}
|
163
168
|
|
164
169
|
let labelHtml = (
|
165
170
|
<div class="n-form-item__label">
|
166
171
|
<label onClick={this.focusInput}>
|
167
|
-
{
|
172
|
+
{this.$slots.label && this.$slots.label() || this.label}
|
168
173
|
</label>
|
169
174
|
</div>
|
170
175
|
);
|
@@ -176,13 +181,13 @@ export default {
|
|
176
181
|
|
177
182
|
renderError()
|
178
183
|
{
|
179
|
-
if ( ! Obj.has(this.NForm.errors, this.prop) ) {
|
184
|
+
if ( !this.NForm || !Obj.has(this.NForm.errors, this.prop) ) {
|
180
185
|
return null;
|
181
186
|
}
|
182
187
|
|
183
188
|
return (
|
184
189
|
<div class="n-form-item__error">
|
185
|
-
{
|
190
|
+
{Obj.get(this.NForm.errors, this.prop)}
|
186
191
|
</div>
|
187
192
|
);
|
188
193
|
},
|
@@ -191,14 +196,15 @@ export default {
|
|
191
196
|
{
|
192
197
|
return (
|
193
198
|
<div ref="input" class="n-form-item__input">
|
194
|
-
{
|
199
|
+
{this.$slots.default && this.$slots.default()}
|
195
200
|
</div>
|
196
201
|
);
|
197
202
|
},
|
198
203
|
|
199
204
|
render()
|
200
205
|
{
|
201
|
-
let size = this.size || this.NForm
|
206
|
+
let size = this.size || Obj.get(this.NForm, 'size', 'md');
|
207
|
+
|
202
208
|
|
203
209
|
let classList = [
|
204
210
|
'n-form-item',
|
@@ -206,9 +212,9 @@ export default {
|
|
206
212
|
]
|
207
213
|
|
208
214
|
return <div class={classList}>
|
209
|
-
{
|
210
|
-
{
|
211
|
-
{
|
215
|
+
{this.ctor('renderLabel')()}
|
216
|
+
{this.ctor('renderInput')()}
|
217
|
+
{this.ctor('renderError')()}
|
212
218
|
</div>;
|
213
219
|
}
|
214
220
|
}
|