@kizmann/nano-ui 1.0.14 → 1.1.0
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/dist/nano-ui.css +1 -1
- package/dist/nano-ui.js +1 -1
- package/dist/nano-ui.js.map +1 -1
- package/dist/themes/dark.css +1 -1
- package/dist/themes/glossy.dark.css +1 -0
- package/dist/themes/glossy.light.css +1 -0
- package/dist/themes/light.css +1 -1
- package/package.json +1 -1
- package/src/button/src/button/button.jsx +12 -0
- package/src/button/src/button/button.scss +4 -1
- package/src/collapse/src/collapse-item/collapse-item.jsx +1 -1
- package/src/draggable/src/draglist/draglist.jsx +1 -1
- package/src/draggable/src/draglist-item/draglist-item.jsx +5 -2
- package/src/drawer/src/drawer/drawer.jsx +9 -3
- package/src/form/src/form/form.jsx +9 -4
- package/src/form/src/form-frame/form-frame.jsx +53 -21
- package/src/form/src/form-frame/form-frame.scss +7 -0
- package/src/form/src/form-group/form-group.jsx +31 -11
- package/src/form/src/form-item/form-item.jsx +9 -5
- package/src/info/src/info/info.jsx +1 -1
- package/src/modal/src/modal/modal.jsx +1 -1
- package/src/modal/src/modal/modal.scss +2 -2
- package/src/paginator/src/paginator/paginator.jsx +24 -29
- package/src/preview/index.js +2 -0
- package/src/preview/index.scss +1 -0
- package/src/preview/src/_tools/preview-handler.js +193 -0
- package/src/preview/src/_tools/preview-helper.js +142 -0
- package/src/preview/src/preview/preview.jsx +48 -115
- package/src/preview/src/preview/preview.scss +2 -1
- package/src/preview/src/preview-modal/preview-modal.jsx +156 -0
- package/src/preview/src/preview-modal/preview-modal.scss +56 -0
- package/src/preview/src/preview-video/preview-video.jsx +4 -60
- package/src/resizer/index.js +3 -1
- package/src/resizer/src/resizer/resizer-next.jsx +536 -0
- package/src/resizer/src/resizer/resizer.jsx +17 -11
- package/src/scrollbar/index.js +3 -1
- package/src/scrollbar/index.scss +1 -0
- package/src/scrollbar/src/scrollbar/scrollbar.scss +14 -8
- package/src/scrollbar/src/scrollbar-next/scrollbar-next.jsx +640 -0
- package/src/scrollbar/src/scrollbar-next/scrollbar-next.scss +148 -0
- package/src/select/src/select/select.jsx +12 -16
- package/src/select/src/select/select.scss +1 -1
- package/src/table/src/table/table.jsx +4 -7
- package/src/table/src/table/table.scss +15 -14
- package/src/table/src/table-cell/types/table-cell-image.jsx +9 -3
- package/src/table/src/table-column/table-column.jsx +11 -27
- package/src/table/src/table-filter/types/table-filter-datetime.jsx +1 -1
- package/src/tabs/src/tabs-item/tabs-item.jsx +1 -1
- package/src/tags/src/tags-item/tags-item.jsx +1 -2
- package/src/timepicker/src/timepicker-panel/timepicker-panel.jsx +15 -3
- package/src/timepicker/src/timepicker-panel/timepicker-panel.scss +2 -1
- package/src/virtualscroller/src/virtualscroller/virtualscroller.jsx +63 -30
- package/src/virtualscroller/src/virtualscroller/virtualscroller.scss +1 -0
- package/themes/glossy/button/index.scss +2 -0
- package/themes/glossy/button/src/button/button.scss +116 -0
- package/themes/glossy/button/src/button-group/button-group.scss +1 -0
- package/themes/glossy/index-dark.scss +3 -0
- package/themes/glossy/index-light.scss +3 -0
- package/themes/glossy/index.scss +43 -0
- package/themes/glossy/root/image/empty-default.svg +30 -0
- package/themes/glossy/root/image/empty-space.svg +34 -0
- package/themes/glossy/root/image/star-default.svg +10 -0
- package/themes/glossy/root/image/test.svg +1 -0
- package/themes/glossy/root/vars-dark.scss +234 -0
- package/themes/glossy/root/vars-light.scss +234 -0
- package/themes/glossy/root/vars.scss +233 -0
- package/themes/macos/button/src/button/button.scss +46 -8
- package/themes/macos/form/src/form-frame/form-frame.scss +2 -2
- package/themes/macos/index.scss +1 -0
- package/themes/macos/preview/index.scss +1 -0
- package/themes/macos/preview/src/preview-modal/preview-modal.scss +28 -0
- package/themes/macos/scrollbar/src/scrollbar/scrollbar.scss +1 -0
- package/themes/macos/table/src/table/table.scss +5 -0
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
import { UUID, Arr, Obj, Dom, Any, Str, Locale, Event, Num } from "@kizmann/pico-js";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
|
|
5
|
+
name: 'NResizer',
|
|
6
|
+
|
|
7
|
+
inject: {
|
|
8
|
+
|
|
9
|
+
NScrollbar: {
|
|
10
|
+
default: undefined
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
props: {
|
|
16
|
+
|
|
17
|
+
modelValue: {
|
|
18
|
+
default()
|
|
19
|
+
{
|
|
20
|
+
return 0;
|
|
21
|
+
},
|
|
22
|
+
type: [Number]
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
width: {
|
|
26
|
+
default()
|
|
27
|
+
{
|
|
28
|
+
return '';
|
|
29
|
+
},
|
|
30
|
+
type: [String]
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
flex: {
|
|
34
|
+
default()
|
|
35
|
+
{
|
|
36
|
+
return '';
|
|
37
|
+
},
|
|
38
|
+
type: [String]
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
minWidth: {
|
|
42
|
+
default()
|
|
43
|
+
{
|
|
44
|
+
return 60;
|
|
45
|
+
},
|
|
46
|
+
type: [Number]
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
maxWidth: {
|
|
50
|
+
default()
|
|
51
|
+
{
|
|
52
|
+
return 0;
|
|
53
|
+
},
|
|
54
|
+
type: [Number]
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
group: {
|
|
58
|
+
default()
|
|
59
|
+
{
|
|
60
|
+
return [];
|
|
61
|
+
},
|
|
62
|
+
type: [Array]
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
disabled: {
|
|
66
|
+
default()
|
|
67
|
+
{
|
|
68
|
+
return false;
|
|
69
|
+
},
|
|
70
|
+
type: [Boolean]
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
position: {
|
|
74
|
+
default()
|
|
75
|
+
{
|
|
76
|
+
return 'right';
|
|
77
|
+
},
|
|
78
|
+
type: [String]
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
resizerWidth: {
|
|
82
|
+
default()
|
|
83
|
+
{
|
|
84
|
+
return 6;
|
|
85
|
+
},
|
|
86
|
+
type: [Number]
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
computed: {
|
|
92
|
+
|
|
93
|
+
touch()
|
|
94
|
+
{
|
|
95
|
+
return !!('ontouchstart' in window ||
|
|
96
|
+
navigator.msMaxTouchPoints);
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
mousedown()
|
|
100
|
+
{
|
|
101
|
+
return this.touch ? 'touchstart' :
|
|
102
|
+
'mousedown';
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
mousemove()
|
|
106
|
+
{
|
|
107
|
+
return this.touch ? 'touchmove' :
|
|
108
|
+
'mousemove';
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
mouseup()
|
|
112
|
+
{
|
|
113
|
+
return this.touch ? 'touchend' :
|
|
114
|
+
'mouseup';
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
data()
|
|
120
|
+
{
|
|
121
|
+
return {
|
|
122
|
+
sizeFixed: false, tempValue: this.modelValue,
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
watch: {
|
|
127
|
+
|
|
128
|
+
modelValue(value)
|
|
129
|
+
{
|
|
130
|
+
if ( value !== this.tempValue ) {
|
|
131
|
+
this.tempValue = value;
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
mounted()
|
|
138
|
+
{
|
|
139
|
+
this.observer = new ResizeObserver(() => {
|
|
140
|
+
this.getWidthDebounced();
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
this.observer.observe(this.$el);
|
|
144
|
+
|
|
145
|
+
if ( !this.modelValue ) {
|
|
146
|
+
this.getWidthDebounced();
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
Event.bind('NResizer:move', (...args) => {
|
|
150
|
+
this.forceWidth(...args)
|
|
151
|
+
}, this._.uid);
|
|
152
|
+
|
|
153
|
+
this.updateHandle();
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
updated()
|
|
157
|
+
{
|
|
158
|
+
this.getWidthDebounced();
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
unmounted()
|
|
162
|
+
{
|
|
163
|
+
this.observer.disconnect();
|
|
164
|
+
|
|
165
|
+
Event.unbind('NResizer:move',
|
|
166
|
+
this._.uid);
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
methods: {
|
|
170
|
+
|
|
171
|
+
getWidthDebounced()
|
|
172
|
+
{
|
|
173
|
+
let now = this.$el.getBoundingClientRect();
|
|
174
|
+
|
|
175
|
+
if ( Any.isEqual(this.last || {}, now) ) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
this.last = now;
|
|
180
|
+
|
|
181
|
+
clearInterval(this.interval);
|
|
182
|
+
|
|
183
|
+
this.interval = setTimeout(() => {
|
|
184
|
+
this.updateWidth();
|
|
185
|
+
}, 5);
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
forceWidth(group)
|
|
189
|
+
{
|
|
190
|
+
if ( !Arr.has(group, this.group) ) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if ( !this.tempValue || !this.group.length ) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
this.sizeFixed = true;
|
|
199
|
+
|
|
200
|
+
let style = {
|
|
201
|
+
width: this.tempValue + 'px', flex: '0 0 auto'
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
Dom.find(this.$el).css(style);
|
|
205
|
+
},
|
|
206
|
+
|
|
207
|
+
updateWidth()
|
|
208
|
+
{
|
|
209
|
+
let width = Dom.find(this.$el).width();
|
|
210
|
+
|
|
211
|
+
if ( width === this.tempValue ) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
this.$emit('updateWidth', this.tempValue = width);
|
|
216
|
+
|
|
217
|
+
Event.fire('NResizer:changed');
|
|
218
|
+
|
|
219
|
+
this.updateHandle();
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
updateHandle()
|
|
223
|
+
{
|
|
224
|
+
let style = {};
|
|
225
|
+
|
|
226
|
+
if ( this.position === 'left' ) {
|
|
227
|
+
style.transform = `translateX(-${this.tempValue - this.resizerWidth}px)`
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if ( this.position === 'right' ) {
|
|
231
|
+
style.transform = `translateX(${this.tempValue - this.resizerWidth}px)`
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
Dom.find(this.$refs.handle).css(style);
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
getTouchEvent(event)
|
|
238
|
+
{
|
|
239
|
+
if ( !this.touch ) {
|
|
240
|
+
return event;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
return event.touches[0] || event.changedTouches[0];
|
|
244
|
+
},
|
|
245
|
+
|
|
246
|
+
onLeftMousedown(event)
|
|
247
|
+
{
|
|
248
|
+
if ( !Arr.has([0, 1], event.which) ) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
event.preventDefault();
|
|
253
|
+
event.stopPropagation();
|
|
254
|
+
|
|
255
|
+
if ( this.group.length ) {
|
|
256
|
+
Event.fire('NResizer:move', this.group);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
Dom.find(this.$el).addClass('n-move');
|
|
260
|
+
Dom.find(document.body).addClass('n-move');
|
|
261
|
+
|
|
262
|
+
Dom.find(document).on(this.mouseup,
|
|
263
|
+
Any.framerate(this.onLeftMouseup, 60), this._.uid);
|
|
264
|
+
|
|
265
|
+
Dom.find(document).on(this.mousemove,
|
|
266
|
+
Any.framerate(this.onLeftMousemove, 60), this._.uid);
|
|
267
|
+
},
|
|
268
|
+
|
|
269
|
+
onLeftMousemove(event)
|
|
270
|
+
{
|
|
271
|
+
this.clientX = (window.innerWidth -
|
|
272
|
+
this.getTouchEvent(event).clientX);
|
|
273
|
+
|
|
274
|
+
let offsetX = Dom.find(this.$el)
|
|
275
|
+
.offset('right');
|
|
276
|
+
|
|
277
|
+
let scrollX = Dom.find(this.$el)
|
|
278
|
+
.scroll('right');
|
|
279
|
+
|
|
280
|
+
let targetWidth = (this.clientX + scrollX - offsetX) -
|
|
281
|
+
(this.resizerWidth * 2);
|
|
282
|
+
|
|
283
|
+
if ( this.minWidth ) {
|
|
284
|
+
targetWidth = Math.max(targetWidth,
|
|
285
|
+
this.minWidth - this.resizerWidth);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if ( this.maxWidth ) {
|
|
289
|
+
targetWidth = Math.min(targetWidth,
|
|
290
|
+
this.maxWidth - this.resizerWidth);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
let style = {
|
|
294
|
+
transform: `translateX(-${targetWidth - this.resizerWidth}px)`
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
Dom.find(this.$refs.handle).css(style);
|
|
298
|
+
},
|
|
299
|
+
|
|
300
|
+
onLeftMouseup(event)
|
|
301
|
+
{
|
|
302
|
+
event.preventDefault();
|
|
303
|
+
event.stopPropagation();
|
|
304
|
+
|
|
305
|
+
Dom.find(document).off(this.mouseup, null, this._.uid);
|
|
306
|
+
Dom.find(document).off(this.mousemove, null, this._.uid);
|
|
307
|
+
|
|
308
|
+
if ( !this.clientX ) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
let offsetX = Dom.find(this.$el)
|
|
313
|
+
.offset('right');
|
|
314
|
+
|
|
315
|
+
let scrollX = Dom.find(this.$el)
|
|
316
|
+
.scroll('right');
|
|
317
|
+
|
|
318
|
+
let targetWidth = this.clientX + scrollX - offsetX -
|
|
319
|
+
(this.resizerWidth * 2);
|
|
320
|
+
|
|
321
|
+
if ( this.minWidth ) {
|
|
322
|
+
targetWidth = Math.max(targetWidth, this.minWidth);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if ( this.maxWidth ) {
|
|
326
|
+
targetWidth = Math.min(targetWidth, this.maxWidth);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
this.tempValue = Math.round(targetWidth);
|
|
330
|
+
|
|
331
|
+
Dom.find(this.$el).removeClass('n-move');
|
|
332
|
+
|
|
333
|
+
let style = {
|
|
334
|
+
transform: `translateX(-${targetWidth - this.resizerWidth}px)`
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
Dom.find(this.$refs.handle).css(style);
|
|
338
|
+
|
|
339
|
+
let frameStyle = {
|
|
340
|
+
width: this.tempValue + 'px', flex: '0 0 auto'
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
Dom.find(this.$el).css(frameStyle);
|
|
344
|
+
|
|
345
|
+
delete this.clientX;
|
|
346
|
+
|
|
347
|
+
if ( this.group.length ) {
|
|
348
|
+
Event.fire('NResizer:moved', this.group);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
this.sizeFixed = true;
|
|
352
|
+
|
|
353
|
+
this.$emit('update:modelValue', this.tempValue);
|
|
354
|
+
},
|
|
355
|
+
|
|
356
|
+
onRightMousedown(event)
|
|
357
|
+
{
|
|
358
|
+
if ( !Arr.has([0, 1], event.which) ) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
event.preventDefault();
|
|
363
|
+
event.stopPropagation();
|
|
364
|
+
|
|
365
|
+
if ( this.group.length ) {
|
|
366
|
+
Event.fire('NResizer:move', this.group);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
Dom.find(this.$el).addClass('n-move');
|
|
370
|
+
Dom.find(document.body).addClass('n-move');
|
|
371
|
+
|
|
372
|
+
Dom.find(document).on(this.mouseup,
|
|
373
|
+
Any.framerate(this.onRightMouseup, 60), this._.uid);
|
|
374
|
+
|
|
375
|
+
Dom.find(document).on(this.mousemove,
|
|
376
|
+
Any.framerate(this.onRightMousemove, 60), this._.uid);
|
|
377
|
+
},
|
|
378
|
+
|
|
379
|
+
onRightMousemove(event)
|
|
380
|
+
{
|
|
381
|
+
this.clientX = this.getTouchEvent(event).clientX;
|
|
382
|
+
|
|
383
|
+
let offsetX = Dom.find(this.$el)
|
|
384
|
+
.offset('left');
|
|
385
|
+
|
|
386
|
+
let scrollX = Dom.find(this.$el)
|
|
387
|
+
.scroll('left');
|
|
388
|
+
|
|
389
|
+
let targetWidth = (this.clientX + scrollX - offsetX) +
|
|
390
|
+
(this.resizerWidth * 0.5);
|
|
391
|
+
|
|
392
|
+
if ( this.minWidth ) {
|
|
393
|
+
targetWidth = Math.max(targetWidth,
|
|
394
|
+
this.minWidth - this.resizerWidth);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
if ( this.maxWidth ) {
|
|
398
|
+
targetWidth = Math.min(targetWidth,
|
|
399
|
+
this.maxWidth - this.resizerWidth);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
let style = {
|
|
403
|
+
transform: `translateX(${targetWidth - this.resizerWidth}px)`
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
Dom.find(this.$refs.handle).css(style);
|
|
407
|
+
},
|
|
408
|
+
|
|
409
|
+
onRightMouseup(event)
|
|
410
|
+
{
|
|
411
|
+
event.preventDefault();
|
|
412
|
+
event.stopPropagation();
|
|
413
|
+
|
|
414
|
+
Dom.find(document).off(this.mousemove, null, this._.uid);
|
|
415
|
+
Dom.find(document).off(this.mouseup, null, this._.uid);
|
|
416
|
+
|
|
417
|
+
if ( !this.clientX ) {
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
let offsetX = Dom.find(this.$el)
|
|
422
|
+
.offset('left');
|
|
423
|
+
|
|
424
|
+
let scrollX = Dom.find(this.$el)
|
|
425
|
+
.scroll('left');
|
|
426
|
+
|
|
427
|
+
let targetWidth = (this.clientX + scrollX - offsetX) +
|
|
428
|
+
(this.resizerWidth * 0.5);
|
|
429
|
+
|
|
430
|
+
if ( this.minWidth ) {
|
|
431
|
+
targetWidth = Math.max(targetWidth, this.minWidth);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
if ( this.maxWidth ) {
|
|
435
|
+
targetWidth = Math.min(targetWidth, this.maxWidth);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
this.tempValue = Math.round(targetWidth);
|
|
439
|
+
|
|
440
|
+
Dom.find(this.$el).removeClass('n-move');
|
|
441
|
+
|
|
442
|
+
let style = {
|
|
443
|
+
transform: `translateX(${targetWidth - this.resizerWidth}px)`
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
Dom.find(this.$refs.handle).css(style);
|
|
447
|
+
|
|
448
|
+
let frameStyle = {
|
|
449
|
+
width: this.tempValue + 'px', flex: '0 0 auto'
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
Dom.find(this.$el).css(frameStyle);
|
|
453
|
+
|
|
454
|
+
delete this.clientX;
|
|
455
|
+
|
|
456
|
+
if ( this.group.length ) {
|
|
457
|
+
Event.fire('NResizer:moved', this.group);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
this.sizeFixed = true;
|
|
461
|
+
|
|
462
|
+
this.$emit('update:modelValue', this.tempValue);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
},
|
|
466
|
+
|
|
467
|
+
renderHandle()
|
|
468
|
+
{
|
|
469
|
+
if ( this.disabled ) {
|
|
470
|
+
return null;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
let classList = [
|
|
474
|
+
'n-resizer__handle',
|
|
475
|
+
];
|
|
476
|
+
|
|
477
|
+
let props = {};
|
|
478
|
+
|
|
479
|
+
if ( this.position === 'right' ) {
|
|
480
|
+
props['on' + Str.ucfirst(this.mousedown)] = this.onRightMousedown;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
if ( this.position === 'left' ) {
|
|
484
|
+
props['on' + Str.ucfirst(this.mousedown)] = this.onLeftMousedown;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
if ( this.resizerWidth ) {
|
|
488
|
+
props.width = this.resizerWidth + 'px';
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
return (
|
|
492
|
+
<div ref="handle" class={classList} {...props} />
|
|
493
|
+
);
|
|
494
|
+
},
|
|
495
|
+
|
|
496
|
+
render()
|
|
497
|
+
{
|
|
498
|
+
let classList = [
|
|
499
|
+
'n-resizer',
|
|
500
|
+
'n-resizer--' + this.position,
|
|
501
|
+
];
|
|
502
|
+
|
|
503
|
+
let style = {};
|
|
504
|
+
|
|
505
|
+
if ( !Any.isEmpty(this.flex) ) {
|
|
506
|
+
style['flex'] = this.flex;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
if ( !Any.isEmpty(this.width) ) {
|
|
510
|
+
style['width'] = this.width;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
if ( this.sizeFixed && this.tempValue ) {
|
|
514
|
+
style['flex'] = `0 0 ${this.tempValue}px`;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
if ( this.sizeFixed && this.tempValue ) {
|
|
518
|
+
style['width'] = `${this.tempValue}px`;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
if ( this.minWidth ) {
|
|
522
|
+
style['min-width'] = `${this.minWidth}px`;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
if ( this.maxWidth ) {
|
|
526
|
+
style['max-width'] = `${this.maxWidth}px`;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
return (
|
|
530
|
+
<div class={classList} style={style}>
|
|
531
|
+
{[this.$slots.default && this.$slots.default(), this.ctor('renderHandle')()]}
|
|
532
|
+
</div>
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
}
|
|
@@ -83,7 +83,7 @@ export default {
|
|
|
83
83
|
computed: {
|
|
84
84
|
|
|
85
85
|
touch() {
|
|
86
|
-
return !! ('ontouchstart' in window ||
|
|
86
|
+
return !! ('ontouchstart' in window ||
|
|
87
87
|
navigator.msMaxTouchPoints);
|
|
88
88
|
},
|
|
89
89
|
|
|
@@ -140,6 +140,8 @@ export default {
|
|
|
140
140
|
Dom.find(window).on('resize', Any.debounce((...args) => {
|
|
141
141
|
this.onResize(...args)
|
|
142
142
|
}, 500), this._.uid);
|
|
143
|
+
|
|
144
|
+
this.updateHandle();
|
|
143
145
|
},
|
|
144
146
|
|
|
145
147
|
updated()
|
|
@@ -153,10 +155,10 @@ export default {
|
|
|
153
155
|
this.unbindSizechange();
|
|
154
156
|
}
|
|
155
157
|
|
|
156
|
-
Event.unbind('NResizer:move',
|
|
158
|
+
Event.unbind('NResizer:move',
|
|
157
159
|
this._.uid);
|
|
158
|
-
|
|
159
|
-
Dom.find(window).off('resize',
|
|
160
|
+
|
|
161
|
+
Dom.find(window).off('resize',
|
|
160
162
|
null, this._.uid);
|
|
161
163
|
},
|
|
162
164
|
|
|
@@ -167,7 +169,7 @@ export default {
|
|
|
167
169
|
if ( ! Arr.has(group, this.group) ) {
|
|
168
170
|
return;
|
|
169
171
|
}
|
|
170
|
-
|
|
172
|
+
|
|
171
173
|
if ( ! this.tempValue || ! this.group.length ) {
|
|
172
174
|
return;
|
|
173
175
|
}
|
|
@@ -190,9 +192,9 @@ export default {
|
|
|
190
192
|
return;
|
|
191
193
|
}
|
|
192
194
|
|
|
193
|
-
this.$emit('update:modelValue',
|
|
195
|
+
this.$emit('update:modelValue',
|
|
194
196
|
this.tempValue = width);
|
|
195
|
-
|
|
197
|
+
|
|
196
198
|
this.updateHandle();
|
|
197
199
|
},
|
|
198
200
|
|
|
@@ -203,7 +205,7 @@ export default {
|
|
|
203
205
|
if ( this.position === 'left' ) {
|
|
204
206
|
style.transform =`translateX(-${this.tempValue - this.resizerWidth}px)`
|
|
205
207
|
}
|
|
206
|
-
|
|
208
|
+
|
|
207
209
|
if ( this.position === 'right' ) {
|
|
208
210
|
style.transform = `translateX(${this.tempValue - this.resizerWidth}px)`
|
|
209
211
|
}
|
|
@@ -213,7 +215,7 @@ export default {
|
|
|
213
215
|
|
|
214
216
|
bindSizechange()
|
|
215
217
|
{
|
|
216
|
-
Dom.find(this.NScrollbar.$el).on('resized',
|
|
218
|
+
Dom.find(this.NScrollbar.$el).on('resized',
|
|
217
219
|
Any.debounce(this.updateWidth, 50), this._.uid);
|
|
218
220
|
},
|
|
219
221
|
|
|
@@ -267,7 +269,7 @@ export default {
|
|
|
267
269
|
|
|
268
270
|
onLeftMousemove(event)
|
|
269
271
|
{
|
|
270
|
-
this.clientX = (window.innerWidth -
|
|
272
|
+
this.clientX = (window.innerWidth -
|
|
271
273
|
this.getTouchEvent(event).clientX);
|
|
272
274
|
|
|
273
275
|
let offsetX = Dom.find(this.$el)
|
|
@@ -462,7 +464,7 @@ export default {
|
|
|
462
464
|
if ( this.disabled ) {
|
|
463
465
|
return null;
|
|
464
466
|
}
|
|
465
|
-
|
|
467
|
+
|
|
466
468
|
let classList = [
|
|
467
469
|
'n-resizer__handle',
|
|
468
470
|
];
|
|
@@ -503,6 +505,10 @@ export default {
|
|
|
503
505
|
style['flex-basis'] = this.width + 'px';
|
|
504
506
|
}
|
|
505
507
|
|
|
508
|
+
if ( this.modelValue == this.tempValue ) {
|
|
509
|
+
style['flex-basis'] = this.modelValue + 'px';
|
|
510
|
+
}
|
|
511
|
+
|
|
506
512
|
if ( this.minWidth ) {
|
|
507
513
|
style['min-width'] = this.minWidth + 'px';
|
|
508
514
|
}
|
package/src/scrollbar/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import Scrollbar from "./src/scrollbar/scrollbar.jsx";
|
|
2
|
+
import ScrollbarNext from "./src/scrollbar-next/scrollbar-next.jsx";
|
|
2
3
|
|
|
3
4
|
export default function (App) {
|
|
4
|
-
App.component(Scrollbar.name, Scrollbar);
|
|
5
|
+
// App.component(Scrollbar.name, Scrollbar);
|
|
6
|
+
App.component(ScrollbarNext.name, ScrollbarNext);
|
|
5
7
|
}
|
package/src/scrollbar/index.scss
CHANGED
|
@@ -71,14 +71,14 @@
|
|
|
71
71
|
.n-scrollbar-v {
|
|
72
72
|
top: 0;
|
|
73
73
|
right: 0;
|
|
74
|
-
width:
|
|
75
|
-
}
|
|
74
|
+
width: 14px;
|
|
76
75
|
|
|
76
|
+
}
|
|
77
77
|
|
|
78
78
|
.n-scrollbar-h {
|
|
79
79
|
left: 0;
|
|
80
80
|
bottom: 0;
|
|
81
|
-
height:
|
|
81
|
+
height: 14px;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
.n-scrollbar--native:not(.n-scrollbar--forced) > .n-scrollbar-v,
|
|
@@ -92,16 +92,22 @@
|
|
|
92
92
|
.n-scrollbar-h:before {
|
|
93
93
|
content: '\00a0';
|
|
94
94
|
position: absolute;
|
|
95
|
-
top: 2px;
|
|
96
|
-
bottom: 2px;
|
|
97
|
-
left: 2px;
|
|
98
|
-
right: 2px;
|
|
99
95
|
display: block;
|
|
100
96
|
border-radius: 500px;
|
|
101
97
|
opacity: 0;
|
|
102
|
-
transition: opacity 0.15s;
|
|
98
|
+
transition: opacity 0.15s, transform 0.15s;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.n-scrollbar-v:before,
|
|
102
|
+
.n-scrollbar-h:before {
|
|
103
|
+
top: 4px;
|
|
104
|
+
bottom: 4px;
|
|
105
|
+
left: 4px;
|
|
106
|
+
right: 4px;
|
|
103
107
|
}
|
|
104
108
|
|
|
109
|
+
.n-scrollbar.has-vtrack > .n-scrollbar-v.is-active:before,
|
|
110
|
+
.n-scrollbar.has-htrack > .n-scrollbar-h.is-active:before,
|
|
105
111
|
.n-scrollbar.has-vtrack:hover > .n-scrollbar-v:before,
|
|
106
112
|
.n-scrollbar.has-htrack:hover > .n-scrollbar-h:before {
|
|
107
113
|
opacity: 1;
|