@kizmann/nano-ui 2.0.0 → 2.0.2
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.esm.js +1 -1
- package/dist/nano-ui.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/draggable/src/draghandler/draghandler.js +19 -38
- package/src/draggable/src/draglist-item/draglist-item.jsx +39 -38
- package/src/popover/src/popover/popover-element.mjs +2 -4
- package/src/preview/src/preview/preview-handler.mjs +2 -2
- package/src/select/src/select/select.jsx +1 -1
- package/src/slider/src/slider/slider.jsx +4 -0
- package/src/table/src/table/table.jsx +2 -2
- package/src/tabs/src/tabs-item/tabs-item.jsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kizmann/nano-ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -56,6 +56,6 @@
|
|
|
56
56
|
"webpack-dev-server": "^5.2.3"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@kizmann/pico-js": "^2.0.
|
|
59
|
+
"@kizmann/pico-js": "^2.0.6"
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -164,27 +164,27 @@ class NDraghandler
|
|
|
164
164
|
|
|
165
165
|
Dom.find(this.rootNode.$el).on('dragenter', Run.framebuffer((event) => {
|
|
166
166
|
this.onDragenterRoot(event);
|
|
167
|
-
}, key + 'dragenter',
|
|
167
|
+
}, key + 'dragenter', 100));
|
|
168
168
|
|
|
169
169
|
Dom.find(this.rootNode.$el).on('dragover', Run.framebuffer((event) => {
|
|
170
170
|
this.onDragoverRoot(event);
|
|
171
|
-
}, key + 'dragover',
|
|
171
|
+
}, key + 'dragover', 200));
|
|
172
172
|
|
|
173
173
|
Dom.find(this.rootNode.$el).on('dragleave', Run.framebuffer((event) => {
|
|
174
174
|
this.onDragleaveRoot(event);
|
|
175
|
-
}, key + 'dragleave',
|
|
175
|
+
}, key + 'dragleave', 300));
|
|
176
176
|
|
|
177
177
|
Dom.find(this.rootNode.$el).on('dragend', Run.framebuffer((event) => {
|
|
178
178
|
this.onDragendRoot(event);
|
|
179
|
-
}, key + 'dragend',
|
|
179
|
+
}, key + 'dragend', 400));
|
|
180
180
|
|
|
181
181
|
Dom.find(this.rootNode.$el).on('drop', Run.framebuffer((event) => {
|
|
182
182
|
this.onDragdropRoot(event);
|
|
183
|
-
}, key + 'drop',
|
|
183
|
+
}, key + 'drop', 500));
|
|
184
184
|
|
|
185
185
|
Dom.find(this.rootNode.$el).on('dragdrop', Run.framebuffer((event) => {
|
|
186
186
|
this.onDragdropRoot(event);
|
|
187
|
-
}, key + 'dragdrop',
|
|
187
|
+
}, key + 'dragdrop', 600));
|
|
188
188
|
|
|
189
189
|
Event.bind('NDrag:start', this.bindDragstart.bind(this),
|
|
190
190
|
this.rootNode.uid);
|
|
@@ -510,65 +510,46 @@ class NDraghandler
|
|
|
510
510
|
$handle = $handle.find('[draggable]');
|
|
511
511
|
}
|
|
512
512
|
|
|
513
|
-
let $el =
|
|
513
|
+
let [$el, id] = [
|
|
514
|
+
Dom.find(node.$el), node.uid
|
|
515
|
+
];
|
|
514
516
|
|
|
515
517
|
$handle.on('dragstart', (event) => {
|
|
516
518
|
this.onDragstartNode(event, node);
|
|
517
|
-
});
|
|
518
|
-
|
|
519
|
-
let key = this.rootNode._.uid + '-dnode-';
|
|
519
|
+
}, { id });
|
|
520
520
|
|
|
521
521
|
$el.on('dragenter', Run.framebuffer((event) => {
|
|
522
522
|
this.onDragenterNode(event, node);
|
|
523
|
-
},
|
|
523
|
+
}, `${id}-dnode-dragenter`, 150), { id });
|
|
524
524
|
|
|
525
525
|
$el.on('dragover', Run.framebuffer((event) => {
|
|
526
526
|
this.onDragoverNode(event, node);
|
|
527
|
-
},
|
|
527
|
+
}, `${id}-dnode-dragover`, 250), { id });
|
|
528
528
|
|
|
529
529
|
$el.on('dragleave', Run.framebuffer((event) => {
|
|
530
530
|
this.onDragleaveNode(event, node);
|
|
531
|
-
},
|
|
531
|
+
}, `${id}-dnode-dragleave`, 350), { id });
|
|
532
532
|
|
|
533
533
|
$el.on('dragend', Run.framebuffer((event) => {
|
|
534
534
|
this.onDragendNode(event, node);
|
|
535
|
-
},
|
|
535
|
+
}, `${id}-dnode-dragend`, 450), { id });
|
|
536
536
|
|
|
537
537
|
$el.on('drop', Run.framebuffer((event) => {
|
|
538
538
|
this.onDragdropNode(event, node);
|
|
539
|
-
},
|
|
539
|
+
}, `${id}-dnode-drop`, 550), { id });
|
|
540
540
|
|
|
541
541
|
$el.on('dragdrop', Run.framebuffer((event) => {
|
|
542
542
|
this.onDragdropNode(event, node);
|
|
543
|
-
},
|
|
543
|
+
}, `${id}-dnode-dragdrop`, 550), { id });
|
|
544
544
|
|
|
545
545
|
this.childNodes[node.uid] = node;
|
|
546
546
|
}
|
|
547
547
|
|
|
548
548
|
unbindNode(node)
|
|
549
549
|
{
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
$handle = $handle.find('[draggable]');
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
$handle.off('dragstart');
|
|
557
|
-
|
|
558
|
-
let $el = Dom.find(node.$el);
|
|
559
|
-
|
|
560
|
-
$el.off([
|
|
561
|
-
'dragenter',
|
|
562
|
-
'dragover',
|
|
563
|
-
'dragleave',
|
|
564
|
-
'dragend',
|
|
565
|
-
'drop',
|
|
566
|
-
'dragdrop',
|
|
567
|
-
]);
|
|
568
|
-
|
|
569
|
-
$el.remClass(['n-dragover', 'n-nodrop']);
|
|
570
|
-
|
|
571
|
-
this.DragIndicator.hide();
|
|
550
|
+
Dom.find().optoff({
|
|
551
|
+
id: node.uid
|
|
552
|
+
});
|
|
572
553
|
|
|
573
554
|
delete this.childNodes[node.uid];
|
|
574
555
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Str, Obj, Arr, Dom } from "@kizmann/pico-js";
|
|
1
|
+
import { Str, Obj, Arr, Dom, Run } from "@kizmann/pico-js";
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ export default {
|
|
|
9
9
|
NDraggable: {
|
|
10
10
|
default: undefined
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
},
|
|
14
14
|
|
|
15
15
|
inheritAttrs: false,
|
|
@@ -45,22 +45,26 @@ export default {
|
|
|
45
45
|
return Obj.get(this.NDraggable, this.value.route);
|
|
46
46
|
},
|
|
47
47
|
|
|
48
|
-
touch()
|
|
49
|
-
|
|
48
|
+
touch()
|
|
49
|
+
{
|
|
50
|
+
return !!('ontouchstart' in window ||
|
|
50
51
|
navigator.msMaxTouchPoints);
|
|
51
52
|
},
|
|
52
53
|
|
|
53
|
-
mousedown()
|
|
54
|
+
mousedown()
|
|
55
|
+
{
|
|
54
56
|
return this.touch ? 'touchstart' :
|
|
55
57
|
'mousedown';
|
|
56
58
|
},
|
|
57
59
|
|
|
58
|
-
mousemove()
|
|
60
|
+
mousemove()
|
|
61
|
+
{
|
|
59
62
|
return this.touch ? 'touchmove' :
|
|
60
63
|
'mousemove';
|
|
61
64
|
},
|
|
62
65
|
|
|
63
|
-
mouseup()
|
|
66
|
+
mouseup()
|
|
67
|
+
{
|
|
64
68
|
return this.touch ? 'touchend' :
|
|
65
69
|
'mouseup';
|
|
66
70
|
}
|
|
@@ -70,29 +74,26 @@ export default {
|
|
|
70
74
|
data()
|
|
71
75
|
{
|
|
72
76
|
return {
|
|
73
|
-
init: !
|
|
77
|
+
init: !this.NDraggable.lazyload
|
|
74
78
|
};
|
|
75
79
|
},
|
|
76
80
|
|
|
77
81
|
mounted()
|
|
78
82
|
{
|
|
79
|
-
this.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
this.timer = setTimeout(() => {
|
|
83
|
-
this.NDraggable.drag.bindNode(this);
|
|
84
|
-
}, 10);
|
|
85
|
-
}
|
|
83
|
+
if ( this.NDraggable.lazyload ) {
|
|
84
|
+
Run.frame(() => this.init = true);
|
|
85
|
+
}
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
if ( this.NDraggable.draggable ) {
|
|
88
|
+
this.NDraggable.drag.bindNode(this);
|
|
89
|
+
}
|
|
89
90
|
},
|
|
90
91
|
|
|
91
|
-
|
|
92
|
+
unmounted()
|
|
92
93
|
{
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
if ( this.NDraggable.draggable ) {
|
|
95
|
+
this.NDraggable.drag.unbindNode(this);
|
|
96
|
+
}
|
|
96
97
|
},
|
|
97
98
|
|
|
98
99
|
methods: {
|
|
@@ -185,7 +186,7 @@ export default {
|
|
|
185
186
|
'n-draglist-item__element'
|
|
186
187
|
];
|
|
187
188
|
|
|
188
|
-
if ( !
|
|
189
|
+
if ( !this.init ) {
|
|
189
190
|
return (<div class={classList} />);
|
|
190
191
|
}
|
|
191
192
|
|
|
@@ -204,17 +205,17 @@ export default {
|
|
|
204
205
|
|
|
205
206
|
return (
|
|
206
207
|
<div class={classList}>
|
|
207
|
-
{
|
|
208
|
+
{renderFunction(props)}
|
|
208
209
|
</div>
|
|
209
210
|
);
|
|
210
211
|
},
|
|
211
212
|
|
|
212
213
|
renderSpacer()
|
|
213
214
|
{
|
|
214
|
-
let width = this.value.depth *
|
|
215
|
+
let width = this.value.depth *
|
|
215
216
|
this.NDraggable.itemOffset;
|
|
216
217
|
|
|
217
|
-
if ( !
|
|
218
|
+
if ( !width ) {
|
|
218
219
|
return null;
|
|
219
220
|
}
|
|
220
221
|
|
|
@@ -224,14 +225,14 @@ export default {
|
|
|
224
225
|
|
|
225
226
|
return (
|
|
226
227
|
<div class="n-draglist-item__spacer" style={style}>
|
|
227
|
-
{ /* SPACER */
|
|
228
|
+
{ /* SPACER */}
|
|
228
229
|
</div>
|
|
229
230
|
);
|
|
230
231
|
},
|
|
231
232
|
|
|
232
233
|
renderHandle()
|
|
233
234
|
{
|
|
234
|
-
if ( !
|
|
235
|
+
if ( !this.NDraggable.renderHandle ) {
|
|
235
236
|
return null;
|
|
236
237
|
}
|
|
237
238
|
|
|
@@ -244,7 +245,7 @@ export default {
|
|
|
244
245
|
return (
|
|
245
246
|
<div class="n-draglist-item__handle" {...props}>
|
|
246
247
|
<div class="n-draglist-item__ellipsis">
|
|
247
|
-
<i class={
|
|
248
|
+
<i class={nano.Icons.handle}></i>
|
|
248
249
|
</div>
|
|
249
250
|
</div>
|
|
250
251
|
);
|
|
@@ -252,7 +253,7 @@ export default {
|
|
|
252
253
|
|
|
253
254
|
renderExpand()
|
|
254
255
|
{
|
|
255
|
-
if ( !
|
|
256
|
+
if ( !this.NDraggable.renderExpand ) {
|
|
256
257
|
return null;
|
|
257
258
|
}
|
|
258
259
|
|
|
@@ -263,7 +264,7 @@ export default {
|
|
|
263
264
|
return (
|
|
264
265
|
<div class="n-draglist-item__expand" {...props}>
|
|
265
266
|
<div class="n-draglist-item__angle">
|
|
266
|
-
<i class={
|
|
267
|
+
<i class={nano.Icons.angleRight}></i>
|
|
267
268
|
</div>
|
|
268
269
|
</div>
|
|
269
270
|
);
|
|
@@ -271,7 +272,7 @@ export default {
|
|
|
271
272
|
|
|
272
273
|
renderSelect()
|
|
273
274
|
{
|
|
274
|
-
if ( !
|
|
275
|
+
if ( !this.NDraggable.renderSelect ) {
|
|
275
276
|
return null;
|
|
276
277
|
}
|
|
277
278
|
|
|
@@ -282,7 +283,7 @@ export default {
|
|
|
282
283
|
return (
|
|
283
284
|
<div class="n-draglist-item__select" {...props}>
|
|
284
285
|
<div class="n-draglist-item__checkbox">
|
|
285
|
-
<i class={
|
|
286
|
+
<i class={nano.Icons.checked}></i>
|
|
286
287
|
</div>
|
|
287
288
|
</div>
|
|
288
289
|
);
|
|
@@ -322,7 +323,7 @@ export default {
|
|
|
322
323
|
onClick: this.onClick, onDblclick: this.onDblclick,
|
|
323
324
|
};
|
|
324
325
|
|
|
325
|
-
if ( this.NDraggable.draggable && !
|
|
326
|
+
if ( this.NDraggable.draggable && !this.NDraggable.handle && this.isDraggable() ) {
|
|
326
327
|
props.draggable = true;
|
|
327
328
|
}
|
|
328
329
|
|
|
@@ -330,11 +331,11 @@ export default {
|
|
|
330
331
|
|
|
331
332
|
return (
|
|
332
333
|
<div class={classList} {...props}>
|
|
333
|
-
{
|
|
334
|
-
{
|
|
335
|
-
{
|
|
336
|
-
{
|
|
337
|
-
{
|
|
334
|
+
{this.ctor('renderHandle')()}
|
|
335
|
+
{this.ctor('renderSpacer')()}
|
|
336
|
+
{this.ctor('renderExpand')()}
|
|
337
|
+
{this.ctor('renderSelect')()}
|
|
338
|
+
{this.ctor('renderElement')()}
|
|
338
339
|
</div>
|
|
339
340
|
);
|
|
340
341
|
}
|
|
@@ -139,11 +139,9 @@ export class PopoverElement
|
|
|
139
139
|
this.events['open'].apply({}, [event]);
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
|
|
143
|
-
this.updatePosition();
|
|
144
|
-
});
|
|
142
|
+
this.updatePosition();
|
|
145
143
|
|
|
146
|
-
|
|
144
|
+
requestIdleCallback(() => {
|
|
147
145
|
this.bindResizeObserver();
|
|
148
146
|
});
|
|
149
147
|
|
|
@@ -75,7 +75,7 @@ export class PreviewHandler
|
|
|
75
75
|
|
|
76
76
|
static create()
|
|
77
77
|
{
|
|
78
|
-
el = Dom.find('.n-preview-modal');
|
|
78
|
+
let el = Dom.find('.n-preview-modal');
|
|
79
79
|
|
|
80
80
|
if ( el.length() ) {
|
|
81
81
|
return el;
|
|
@@ -88,7 +88,7 @@ export class PreviewHandler
|
|
|
88
88
|
'n-theme--dark'
|
|
89
89
|
];
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
el = Dom.make('div', {
|
|
92
92
|
classList: classList.join(' ')
|
|
93
93
|
});
|
|
94
94
|
|
|
@@ -608,13 +608,13 @@ export default {
|
|
|
608
608
|
this.ctor('renderContext')()
|
|
609
609
|
];
|
|
610
610
|
|
|
611
|
-
let columns =
|
|
611
|
+
let columns = Arr.each(this.elements, (column) => {
|
|
612
612
|
return column.disabled ? null : column.ctor('renderHead')();
|
|
613
613
|
});
|
|
614
614
|
|
|
615
615
|
return (
|
|
616
616
|
<div class="n-table__header">
|
|
617
|
-
{defaultRender} {
|
|
617
|
+
{defaultRender} {columns}
|
|
618
618
|
</div>
|
|
619
619
|
);
|
|
620
620
|
},
|