@kizmann/nano-ui 0.7.9 → 0.7.12

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": "@kizmann/nano-ui",
3
- "version": "0.7.9",
3
+ "version": "0.7.12",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "author": "Eduard Kizmann <kizmann@protonmail.ch>",
@@ -78,13 +78,13 @@ export default {
78
78
  {
79
79
  let $input = Dom.find(this.$el).find('input');
80
80
 
81
- if ( ! $input.empty() ) {
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 ( ! $input.empty() ) {
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 ( ! this.NTabs || ! this.NTabsItem ) {
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.addItem(this);
126
+ if ( this.NForm ) {
127
+ this.NForm.addItem(this);
128
+ }
127
129
  },
128
130
 
129
131
  mounted()
130
132
  {
131
- this.NForm.$watch('errors', this.gotoInput,
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.removeItem(this);
140
+ if ( this.NForm ) {
141
+ this.NForm.removeItem(this);
142
+ }
138
143
  },
139
144
 
140
145
  renderTooltip()
141
146
  {
142
- if ( ! this.tooltip && ! this.$slots.tooltip ) {
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
- { this.$slots.tooltip && this.$slots.tooltip() || this.tooltip }
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 ( ! this.label && ! this.$slots.label ) {
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
- { this.$slots.label && this.$slots.label() || this.label }
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
- { Obj.get(this.NForm.errors, this.prop) }
190
+ {Obj.get(this.NForm.errors, this.prop)}
186
191
  </div>
187
192
  );
188
193
  },
@@ -191,7 +196,7 @@ export default {
191
196
  {
192
197
  return (
193
198
  <div ref="input" class="n-form-item__input">
194
- { this.$slots.default && this.$slots.default() }
199
+ {this.$slots.default && this.$slots.default()}
195
200
  </div>
196
201
  );
197
202
  },
@@ -206,9 +211,9 @@ export default {
206
211
  ]
207
212
 
208
213
  return <div class={classList}>
209
- { this.ctor('renderLabel')() }
210
- { this.ctor('renderInput')() }
211
- { this.ctor('renderError')() }
214
+ {this.ctor('renderLabel')()}
215
+ {this.ctor('renderInput')()}
216
+ {this.ctor('renderError')()}
212
217
  </div>;
213
218
  }
214
219
  }
@@ -64,7 +64,7 @@ export default {
64
64
  uid: UUID(),
65
65
  elements: [],
66
66
  options: [],
67
- tempValue: this.item,
67
+ tempValue: this.item,
68
68
  };
69
69
  },
70
70
 
@@ -89,11 +89,16 @@ export default {
89
89
  this.unbindSyncEvent();
90
90
  },
91
91
 
92
+ updated()
93
+ {
94
+ Any.delay(() => this.$refs.scrollbar.adaptHeight(), 500);
95
+ },
96
+
92
97
  methods: {
93
98
 
94
99
  bindSyncEvent()
95
100
  {
96
- if ( ! this.syncEvent ) {
101
+ if ( !this.syncEvent ) {
97
102
  return;
98
103
  }
99
104
 
@@ -109,7 +114,7 @@ export default {
109
114
  }
110
115
  };
111
116
 
112
- Event.bind(this.options[0], syncFunction,
117
+ Event.bind(this.options[0], syncFunction,
113
118
  this.uid);
114
119
  },
115
120
 
@@ -120,19 +125,19 @@ export default {
120
125
 
121
126
  setValue(value)
122
127
  {
123
- this.$emit('update:modelValue',
128
+ this.$emit('update:modelValue',
124
129
  this.tempValue = value);
125
130
  },
126
131
 
127
132
  addColumn(column)
128
133
  {
129
- Arr.add(this.elements,
134
+ Arr.add(this.elements,
130
135
  column, { uid: column.uid });
131
136
  },
132
137
 
133
138
  removeColumn(column)
134
139
  {
135
- Arr.remove(this.elements,
140
+ Arr.remove(this.elements,
136
141
  { uid: column.uid });
137
142
  },
138
143
 
@@ -148,8 +153,8 @@ export default {
148
153
  renderEmpty()
149
154
  {
150
155
  return (
151
- <NEmptyIcon disabled={! this.showEmptyIcon} class="n-info__empty">
152
- { this.$slots.empty && this.$slots.empty() || this.trans('No entry') }
156
+ <NEmptyIcon disabled={!this.showEmptyIcon} class="n-info__empty">
157
+ {this.$slots.empty && this.$slots.empty() || this.trans('No entry')}
153
158
  </NEmptyIcon>
154
159
  );
155
160
  },
@@ -163,16 +168,16 @@ export default {
163
168
  let elements = Obj.each(this.elements, (column) => {
164
169
  return (
165
170
  <div class="n-info__column">
166
- { column.ctor('renderLabel')({ item: this.tempValue }) }
167
- { column.ctor('renderBody')({ item: this.tempValue }) }
171
+ {column.ctor('renderLabel')({ item: this.tempValue })}
172
+ {column.ctor('renderBody')({ item: this.tempValue })}
168
173
  </div>
169
174
  );
170
175
  });
171
176
 
172
177
  return (
173
- <div class="n-info__body">
174
- { Any.vals(elements)}
175
- </div>
178
+ <div class="n-info__body">
179
+ {Any.vals(elements)}
180
+ </div>
176
181
  );
177
182
  },
178
183
 
@@ -184,12 +189,15 @@ export default {
184
189
  'n-info--' + this.size,
185
190
  ];
186
191
 
192
+ let infoHtml = (
193
+ <NScrollbar ref="scrollbar" relative={this.relative}>
194
+ {this.ctor('renderBody')()}
195
+ </NScrollbar>
196
+ );
197
+
187
198
  return (
188
199
  <div class={classList}>
189
- <NScrollbar relative={this.relative}>
190
- { this.ctor('renderBody')() }
191
- </NScrollbar>
192
- { this.$slots.default() }
200
+ {[infoHtml, this.$slots.default()]}
193
201
  </div>
194
202
  );
195
203
  }
@@ -80,7 +80,7 @@ export default {
80
80
  framerate: {
81
81
  default()
82
82
  {
83
- return 30;
83
+ return 24;
84
84
  },
85
85
  type: [Number]
86
86
  },
@@ -310,7 +310,7 @@ export default {
310
310
  // Dom.find(this.$el).addClass('has-native-hbar');
311
311
  // }
312
312
 
313
- let hasVtrack = outerHeight && outerHeight < innerHeight + 1;
313
+ let hasVtrack = outerHeight && outerHeight < innerHeight;
314
314
 
315
315
  if ( hasVtrack ) {
316
316
  Dom.find(this.$el).addClass('has-vtrack');
@@ -388,7 +388,7 @@ export default {
388
388
  // Dom.find(this.$el).addClass('has-native-vbar');
389
389
  // }
390
390
 
391
- let hasHtrack = outerWidth && outerWidth < innerWidth + 1;
391
+ let hasHtrack = outerWidth && outerWidth < innerWidth;
392
392
 
393
393
  if ( hasHtrack ) {
394
394
  Dom.find(this.$el).addClass('has-htrack');
@@ -446,16 +446,26 @@ export default {
446
446
 
447
447
  adaptHeight()
448
448
  {
449
- let height = Dom.find(this.$refs.content)
450
- .child().height();
449
+ if ( ! this.cacheChildEl ) {
450
+ this.cacheChildEl = Dom.find(this.$refs.content).child();
451
+ }
451
452
 
452
- let window = Dom.find(this.$el)
453
+ let height = this.cacheChildEl
454
+ .height();
455
+
456
+ if ( ! this.cacheWindwoEl ) {
457
+ this.cacheWindwoEl = Dom.find(this.$el);
458
+ }
459
+
460
+ let window = this.cacheWindwoEl
453
461
  .innerHeight();
454
462
 
455
- if ( height === this.passedHeight ) {
463
+ if ( height === this.passedHeight && window === this.windowCache ) {
456
464
  return;
457
465
  }
458
466
 
467
+ this.windowCache = window;
468
+
459
469
  if ( this.overflowY ) {
460
470
  this.adaptScrollHeight();
461
471
  }