@kizmann/nano-ui 3.0.0 → 3.0.1
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.esm.js +1 -1
- package/dist/nano-ui.esm.js.map +1 -1
- package/dist/themes/default.css +1 -1
- package/package.json +3 -3
- package/src/button/js/button/NButtonView.ts +1 -1
- package/src/cascader/css/cascader-panel.scss +1 -1
- package/src/cascader/js/cascader/NCascaderController.ts +32 -16
- package/src/cascader/js/cascader/NCascaderView.ts +1 -1
- package/src/cascader/js/cascader-panel/NCascaderPanelController.ts +55 -24
- package/src/cascader/js/cascader-panel/NCascaderPanelView.ts +10 -9
- package/src/cascader/js/helper/NCascaderHelper.ts +3 -7
- package/src/checkbox/css/checkbox-group.scss +0 -8
- package/src/checkbox/css/checkbox.scss +6 -0
- package/src/checkbox/js/checkbox/NCheckbox.ts +7 -0
- package/src/checkbox/js/checkbox/NCheckboxData.ts +8 -1
- package/src/checkbox/js/checkbox-group/NCheckboxGroup.ts +7 -0
- package/src/checkbox/js/checkbox-group/NCheckboxGroupData.ts +5 -0
- package/src/collapse/css/collapse-item.scss +1 -1
- package/src/collapse/js/collapse-item/NCollapseItem.ts +5 -0
- package/src/collapse/js/collapse-item/NCollapseItemView.ts +6 -3
- package/src/config/js/config/NConfig.ts +5 -0
- package/src/config/js/config/NConfigController.ts +2 -2
- package/src/config/js/config/NConfigView.ts +5 -1
- package/src/draggable/css/draghandler.scss +11 -8
- package/src/draggable/js/drag/NDragIndicator.ts +4 -0
- package/src/draggable/js/drag/NDragReciever.ts +2 -2
- package/src/draggable/js/draglist/NDraglist.ts +6 -0
- package/src/draggable/js/draglist/NDraglistController.ts +157 -24
- package/src/draggable/js/draglist/NDraglistView.ts +43 -12
- package/src/draggable/js/dropzone/NDropzone.ts +14 -0
- package/src/draggable/js/dropzone/NDropzoneController.ts +27 -1
- package/src/draggable/js/dropzone/NDropzoneData.ts +10 -0
- package/src/draggable/js/dropzone/NDropzoneView.ts +3 -7
- package/src/empty/js/empty-icon/NEmptyIcon.ts +1 -1
- package/src/form/js/form/NForm.ts +1 -1
- package/src/form/js/form/NFormController.ts +20 -1
- package/src/form/js/form-bag/NFormBagController.ts +4 -0
- package/src/form/js/form-bag/NFormBagView.ts +2 -1
- package/src/form/js/form-item/NFormItemView.ts +1 -1
- package/src/form/js/form-rules/module/NFormRuleRequiredIf.ts +4 -0
- package/src/form/js/form-rules/module/NFormRuleRequiredUnless.ts +4 -0
- package/src/index.scss +1 -1
- package/src/info/css/info-field.scss +4 -4
- package/src/info/js/info/NInfoView.ts +1 -4
- package/src/info/js/info-column/NInfoColumnView.ts +6 -2
- package/src/input/css/input-number.scss +5 -0
- package/src/input/js/input-number/NInputNumberController.ts +4 -4
- package/src/input/js/textarea/NTextareaView.ts +3 -3
- package/src/modal/css/modal.scss +4 -0
- package/src/modal/js/drawer/NDrawerController.ts +16 -3
- package/src/modal/js/handler/NModalElement.ts +14 -0
- package/src/modal/js/handler/NModalHandler.ts +13 -0
- package/src/modal/js/modal/NModal.ts +7 -0
- package/src/modal/js/modal/NModalController.ts +20 -2
- package/src/modal/js/modal/NModalData.ts +18 -2
- package/src/modal/js/modal/NModalView.ts +7 -9
- package/src/popover/css/popover.scss +5 -10
- package/src/popover/js/handler/NPopoverElement.ts +4 -0
- package/src/popover/js/popover/NPopover.ts +7 -0
- package/src/popover/js/popover/NPopoverController.ts +10 -2
- package/src/popover/js/popover/NPopoverData.ts +5 -0
- package/src/popover/js/popover/NPopoverView.ts +22 -3
- package/src/popover/js/popover-panel/NPopoverPanelController.ts +3 -1
- package/src/preview/css/preview.scss +0 -6
- package/src/preview/js/handler/NPreviewHandler.ts +3 -3
- package/src/preview/js/preview/NPreview.ts +2 -2
- package/src/preview/js/preview/NPreviewController.ts +7 -8
- package/src/preview/js/preview/NPreviewData.ts +8 -1
- package/src/preview/js/preview/NPreviewView.ts +15 -12
- package/src/preview/js/preview-module/NPreviewFileModule.ts +1 -1
- package/src/radio/css/radio-group.scss +0 -8
- package/src/radio/css/radio.scss +6 -0
- package/src/radio/js/radio/NRadio.ts +9 -2
- package/src/radio/js/radio/NRadioData.ts +8 -1
- package/src/radio/js/radio-group/NRadioGroup.ts +9 -2
- package/src/radio/js/radio-group/NRadioGroupData.ts +5 -0
- package/src/resizer/css/resizer.scss +4 -0
- package/src/resizer/js/resizer/NResizerController.ts +5 -1
- package/src/resizer/js/resizer/NResizerData.ts +0 -35
- package/src/resizer/js/resizer/NResizerView.ts +4 -0
- package/src/root/css/helpers.scss +20 -0
- package/src/root/css/tooltip.scss +39 -49
- package/src/root/js/controller/GroupController.ts +1 -1
- package/src/root/js/data/DragData.ts +8 -0
- package/src/root/js/module/Pointer.ts +18 -0
- package/src/root/js/module/Styler.ts +4 -0
- package/src/root/js/prop/BaseProps.ts +33 -0
- package/src/root/js/prop/DragProps.ts +7 -0
- package/src/root/js/proto/ProtoView.ts +5 -2
- package/src/scrollbar/css/scrollbar.scss +6 -1
- package/src/scrollbar/js/handler/NScrollbarElement.ts +4 -0
- package/src/scrollbar/js/virtualbar/NVirtualbar.ts +3 -0
- package/src/scrollbar/js/virtualbar/NVirtualbarController.ts +1 -1
- package/src/scrollbar/js/virtualbar/NVirtualbarView.ts +53 -51
- package/src/select/js/select/NSelectController.ts +3 -1
- package/src/signal/js/alert/NAlertElement.ts +4 -2
- package/src/signal/js/confirm/NConfirmElement.ts +4 -4
- package/src/signal/js/notify/NNotifyElement.ts +1 -1
- package/src/switch/js/switch/NSwitchController.ts +20 -4
- package/src/table/css/table.scss +39 -6
- package/src/table/js/table/NTable.ts +3 -0
- package/src/table/js/table/NTableController.ts +6 -4
- package/src/table/js/table/NTableView.ts +62 -14
- package/src/table/js/table-cell/NTableCellImage.ts +1 -1
- package/src/table/js/table-cell/NTableCellOption.ts +1 -1
- package/src/table/js/table-column/NTableColumn.ts +7 -0
- package/src/table/js/table-column/NTableColumnData.ts +5 -0
- package/src/table/js/table-filter/NTableFilterOption.ts +5 -7
- package/src/table/js/table-filter/NTableFilterString.ts +1 -1
- package/src/tabs/js/tabs/NTabsController.ts +5 -1
- package/src/tabs/js/tabs/NTabsView.ts +4 -0
- package/src/tabs/js/tabs-item/NTabsItemController.ts +17 -3
- package/src/tabs/js/tabs-item/NTabsItemView.ts +12 -9
- package/src/transfer/js/transfer/NTransferController.ts +14 -10
- package/src/transfer/js/transfer/NTransferView.ts +2 -2
- package/src/visuals/css/message.scss +99 -0
- package/src/visuals/css/progress.scss +39 -0
- package/src/visuals/index.scss +2 -0
- package/src/visuals/index.ts +4 -0
- package/src/visuals/js/message/NMessage.ts +65 -0
- package/src/visuals/js/message/NMessageController.ts +96 -0
- package/src/visuals/js/message/NMessageData.ts +43 -0
- package/src/visuals/js/message/NMessageView.ts +101 -0
- package/src/visuals/js/progress/NProgress.ts +63 -0
- package/src/visuals/js/progress/NProgressController.ts +48 -0
- package/src/visuals/js/progress/NProgressData.ts +75 -0
- package/src/visuals/js/progress/NProgressView.ts +48 -0
- package/themes/default/checkbox/src/checkbox/checkbox.scss +13 -0
- package/themes/default/input-number/src/input-number/input-number.scss +6 -13
- package/themes/default/preview/src/preview/preview.scss +11 -2
- package/themes/default/radio/src/radio/radio.scss +13 -0
- package/themes/default/root/vars/colors-dark-bluish.scss +1 -0
- package/themes/default/root/vars/colors-dark.scss +1 -0
- package/themes/default/root/vars/colors-light-bluish.scss +2 -1
- package/themes/default/root/vars/colors-light.scss +2 -1
- package/themes/default/scrollbar/src/scrollbar/scrollbar.scss +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { onMounted, SetupContext } from "vue";
|
|
1
|
+
import { onMounted, provide, SetupContext } from "vue";
|
|
2
2
|
import { Arr, Mix, Num, Obj, Run } from "@kizmann/pico-js";
|
|
3
3
|
import { ProtoController, Pointer } from "../../../root/index.ts";
|
|
4
4
|
import { NDragHandler } from "../drag/NDragHandler.ts";
|
|
@@ -30,11 +30,6 @@ export class NDraglistController extends ProtoController
|
|
|
30
30
|
*/
|
|
31
31
|
drag : NDragReciever;
|
|
32
32
|
|
|
33
|
-
/**
|
|
34
|
-
* @type {string}
|
|
35
|
-
*/
|
|
36
|
-
selectbuffer : string;
|
|
37
|
-
|
|
38
33
|
constructor(props : any, context : SetupContext)
|
|
39
34
|
{
|
|
40
35
|
super(props, context);
|
|
@@ -45,7 +40,9 @@ export class NDraglistController extends ProtoController
|
|
|
45
40
|
new NDraglistData(this),
|
|
46
41
|
];
|
|
47
42
|
|
|
48
|
-
this.
|
|
43
|
+
if ( this.constructor.name === 'NDraglistController' ) {
|
|
44
|
+
this.setup();
|
|
45
|
+
}
|
|
49
46
|
}
|
|
50
47
|
|
|
51
48
|
setup()
|
|
@@ -58,6 +55,7 @@ export class NDraglistController extends ProtoController
|
|
|
58
55
|
.cloneProp('current')
|
|
59
56
|
.cloneProp('selected')
|
|
60
57
|
.cloneProp('expanded')
|
|
58
|
+
.cloneProp('cascade')
|
|
61
59
|
.cloneProp('group');
|
|
62
60
|
|
|
63
61
|
this.makeRef('virtualbar');
|
|
@@ -106,6 +104,10 @@ export class NDraglistController extends ProtoController
|
|
|
106
104
|
this.set('index', this.buildIndex());
|
|
107
105
|
});
|
|
108
106
|
|
|
107
|
+
if ( this.data.cascade?.length ) {
|
|
108
|
+
this.buildCurrent();
|
|
109
|
+
}
|
|
110
|
+
|
|
109
111
|
if ( this.data.group == null ) {
|
|
110
112
|
this.set('group', [this.uid]);
|
|
111
113
|
}
|
|
@@ -114,6 +116,8 @@ export class NDraglistController extends ProtoController
|
|
|
114
116
|
this.set('allowGroups', this.data.group);
|
|
115
117
|
}
|
|
116
118
|
|
|
119
|
+
provide('NDraglist', this.instance);
|
|
120
|
+
|
|
117
121
|
return this;
|
|
118
122
|
}
|
|
119
123
|
|
|
@@ -198,6 +202,48 @@ export class NDraglistController extends ProtoController
|
|
|
198
202
|
]);
|
|
199
203
|
}
|
|
200
204
|
|
|
205
|
+
getItemById(id : string, fallback : any = null)
|
|
206
|
+
{
|
|
207
|
+
const { data } = this;
|
|
208
|
+
|
|
209
|
+
if ( id == null ) {
|
|
210
|
+
return fallback;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const value = this.getValue({
|
|
214
|
+
[data.uniqueProp]: id
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
if ( value == null ) {
|
|
218
|
+
return fallback;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return Obj.get(...[
|
|
222
|
+
data, value.route, fallback
|
|
223
|
+
]);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
getParentById(id : string, fallback : any = null)
|
|
227
|
+
{
|
|
228
|
+
const { data } = this;
|
|
229
|
+
|
|
230
|
+
if ( id == null ) {
|
|
231
|
+
return fallback;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const value = this.getValue({
|
|
235
|
+
[data.uniqueProp]: id
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
if ( value == null || value.depth === 0 ) {
|
|
239
|
+
return fallback;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return Obj.get(...[
|
|
243
|
+
data, Arr.slice(value.route, 0, -2), fallback
|
|
244
|
+
]);
|
|
245
|
+
}
|
|
246
|
+
|
|
201
247
|
buildIndex()
|
|
202
248
|
{
|
|
203
249
|
const { data } = this;
|
|
@@ -228,13 +274,47 @@ export class NDraglistController extends ProtoController
|
|
|
228
274
|
return Object.freeze({ depth: -1, ...relation });
|
|
229
275
|
}
|
|
230
276
|
|
|
277
|
+
buildCurrent()
|
|
278
|
+
{
|
|
279
|
+
const { data } = this;
|
|
280
|
+
|
|
281
|
+
const items = Arr.cascadeFind(data.items, data.childProp, (item : any) => {
|
|
282
|
+
return Arr.last(data.cascade) === item[data.uniqueProp];
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
if ( !Mix.isEmpty(items) ) {
|
|
286
|
+
this.update('current', items[0]);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
onStopclick()
|
|
291
|
+
{
|
|
292
|
+
Run.frame(() => Pointer.stop());
|
|
293
|
+
}
|
|
294
|
+
|
|
231
295
|
onCurrentclick(e : any, item : any)
|
|
232
296
|
{
|
|
233
|
-
|
|
234
|
-
|
|
297
|
+
let depth = this.data.relation?.depth;
|
|
298
|
+
|
|
299
|
+
if ( depth === -1 ) {
|
|
300
|
+
depth = item.depth;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if ( e && e.metaKey && depth === item.depth ) {
|
|
304
|
+
this.onStopclick(), this.onSelectclick(e, item);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const rainbow = [
|
|
308
|
+
item.cascade.join(','), this.data.cascade.join(',')
|
|
309
|
+
];
|
|
310
|
+
|
|
311
|
+
if ( Arr.unique(rainbow).length == 2 ) {
|
|
312
|
+
Pointer.wait(() => this.update('cascade', item.cascade));
|
|
235
313
|
}
|
|
236
314
|
|
|
237
|
-
this.update('current',
|
|
315
|
+
this.update('current', ...[
|
|
316
|
+
this.getItem(item)
|
|
317
|
+
]);
|
|
238
318
|
}
|
|
239
319
|
|
|
240
320
|
onSelectclick(e : any, item : any)
|
|
@@ -249,12 +329,12 @@ export class NDraglistController extends ProtoController
|
|
|
249
329
|
return Arr.has(data.selected, node.uid);
|
|
250
330
|
});
|
|
251
331
|
|
|
252
|
-
if ( !
|
|
332
|
+
if ( !e.shiftKey || !first || item.depth ) {
|
|
253
333
|
return this.update('selected', selected);
|
|
254
334
|
}
|
|
255
335
|
|
|
256
336
|
const items = Arr.filter(data.visibles, (node : any) => {
|
|
257
|
-
return !
|
|
337
|
+
return !node.depth;
|
|
258
338
|
});
|
|
259
339
|
|
|
260
340
|
let last = item;
|
|
@@ -308,11 +388,13 @@ export class NDraglistController extends ProtoController
|
|
|
308
388
|
|
|
309
389
|
onDragdrop(e : any, result : any, config : any)
|
|
310
390
|
{
|
|
391
|
+
const { data } = this;
|
|
392
|
+
|
|
311
393
|
let clone = {
|
|
312
|
-
items: Arr.clone(
|
|
394
|
+
items: Arr.clone(data.items),
|
|
313
395
|
};
|
|
314
396
|
|
|
315
|
-
let transformDrop =
|
|
397
|
+
let transformDrop = data.transformDrop;
|
|
316
398
|
|
|
317
399
|
if ( typeof transformDrop !== 'function' ) {
|
|
318
400
|
transformDrop = (value : any) => value;
|
|
@@ -346,8 +428,37 @@ export class NDraglistController extends ProtoController
|
|
|
346
428
|
clone = NDragHelper.afterNodes(...args);
|
|
347
429
|
}
|
|
348
430
|
|
|
431
|
+
const valid = [
|
|
432
|
+
'inside', 'before', 'after', 'append'
|
|
433
|
+
];
|
|
434
|
+
|
|
435
|
+
if ( !Arr.has(valid, result.mode) ) {
|
|
436
|
+
return result;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
const ids = Arr.extract(...[
|
|
440
|
+
config.items, 'value.uid'
|
|
441
|
+
]);
|
|
442
|
+
|
|
443
|
+
if ( result.mode !== 'append' ) {
|
|
444
|
+
config.uid = result.uids.item;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
const options = {
|
|
448
|
+
...result, group: config.group, items: config.items
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
if ( config.uid && result.mode === 'inside' ) {
|
|
452
|
+
options.item = this.getItemById(config.uid);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
if ( config.uid && result.mode !== 'inside' ) {
|
|
456
|
+
options.item = this.getParentById(config.uid);
|
|
457
|
+
}
|
|
458
|
+
|
|
349
459
|
this.emit('update:items', clone.items);
|
|
350
|
-
this.
|
|
460
|
+
this.emit('move', config.uid, ids, options);
|
|
461
|
+
this.set('current', null);
|
|
351
462
|
this.update('selected', []);
|
|
352
463
|
|
|
353
464
|
return result;
|
|
@@ -359,6 +470,10 @@ export class NDraglistController extends ProtoController
|
|
|
359
470
|
return result;
|
|
360
471
|
}
|
|
361
472
|
|
|
473
|
+
if ( Arr.has(['deny', 'ignore'], result.mode) ) {
|
|
474
|
+
return result;
|
|
475
|
+
}
|
|
476
|
+
|
|
362
477
|
let clone = {
|
|
363
478
|
items: Arr.clone(this.data.items),
|
|
364
479
|
};
|
|
@@ -374,7 +489,7 @@ export class NDraglistController extends ProtoController
|
|
|
374
489
|
NDragHelper.removeNodes(...args);
|
|
375
490
|
|
|
376
491
|
this.emit('update:items', clone.items);
|
|
377
|
-
this.
|
|
492
|
+
this.set('current', null);
|
|
378
493
|
this.update('selected', []);
|
|
379
494
|
|
|
380
495
|
return result;
|
|
@@ -405,6 +520,8 @@ export class NDraglistController extends ProtoController
|
|
|
405
520
|
Run.frame(() => {
|
|
406
521
|
this.update('selected', selected);
|
|
407
522
|
});
|
|
523
|
+
|
|
524
|
+
this.onStopclick();
|
|
408
525
|
}
|
|
409
526
|
|
|
410
527
|
nodeDragmove(e : any, result : any, config : any, els : any)
|
|
@@ -428,7 +545,7 @@ export class NDraglistController extends ProtoController
|
|
|
428
545
|
});
|
|
429
546
|
|
|
430
547
|
const node = {
|
|
431
|
-
item,
|
|
548
|
+
value: item, item: Obj.get(data, item.route)
|
|
432
549
|
};
|
|
433
550
|
|
|
434
551
|
let rainbow = Arr.each(config.items ?? [], (el : any) => {
|
|
@@ -439,12 +556,16 @@ export class NDraglistController extends ProtoController
|
|
|
439
556
|
return { ...result, mode: 'self' };
|
|
440
557
|
}
|
|
441
558
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
559
|
+
const args : [any, any, any] = [
|
|
560
|
+
els.item, data.safezone, [{ node, result, config }]
|
|
561
|
+
];
|
|
445
562
|
|
|
446
563
|
if ( !result.mode ) {
|
|
447
|
-
result.mode = this.drag.getMode(e,
|
|
564
|
+
result.mode = this.drag.getMode(e, ...args);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
if ( !this.nodeAllowDrop(node, result, config) ) {
|
|
568
|
+
result.mode = 'deny';
|
|
448
569
|
}
|
|
449
570
|
|
|
450
571
|
return result;
|
|
@@ -455,7 +576,7 @@ export class NDraglistController extends ProtoController
|
|
|
455
576
|
let allowDrop = this.data.allowDrop;
|
|
456
577
|
|
|
457
578
|
if ( typeof allowDrop !== 'function' ) {
|
|
458
|
-
allowDrop = () => allowDrop;
|
|
579
|
+
allowDrop = () => this.data.allowDrop;
|
|
459
580
|
}
|
|
460
581
|
|
|
461
582
|
let rainbow = Arr.each(config.items, (node : any) => {
|
|
@@ -488,7 +609,7 @@ export class NDraglistController extends ProtoController
|
|
|
488
609
|
});
|
|
489
610
|
}
|
|
490
611
|
|
|
491
|
-
setTotalCurrent(total: number)
|
|
612
|
+
setTotalCurrent(total : number)
|
|
492
613
|
{
|
|
493
614
|
const { data } = this;
|
|
494
615
|
|
|
@@ -498,6 +619,10 @@ export class NDraglistController extends ProtoController
|
|
|
498
619
|
|
|
499
620
|
this.ncx('virtualbar')?.scrollTo(index);
|
|
500
621
|
|
|
622
|
+
this.update('cascade', [
|
|
623
|
+
...data.visibles[index]['cascade']
|
|
624
|
+
]);
|
|
625
|
+
|
|
501
626
|
this.update('current', ...[
|
|
502
627
|
this.getItem(data.visibles[index])
|
|
503
628
|
]);
|
|
@@ -513,6 +638,10 @@ export class NDraglistController extends ProtoController
|
|
|
513
638
|
|
|
514
639
|
this.ncx('virtualbar')?.scrollTo(index);
|
|
515
640
|
|
|
641
|
+
this.update('cascade', [
|
|
642
|
+
...data.visibles[index]['cascade']
|
|
643
|
+
]);
|
|
644
|
+
|
|
516
645
|
this.update('current', ...[
|
|
517
646
|
this.getItem(data.visibles[index])
|
|
518
647
|
]);
|
|
@@ -528,6 +657,10 @@ export class NDraglistController extends ProtoController
|
|
|
528
657
|
|
|
529
658
|
this.ncx('virtualbar')?.scrollTo(index);
|
|
530
659
|
|
|
660
|
+
this.update('cascade', [
|
|
661
|
+
...data.visibles[index]['cascade']
|
|
662
|
+
]);
|
|
663
|
+
|
|
531
664
|
this.update('current', ...[
|
|
532
665
|
this.getItem(data.visibles[index])
|
|
533
666
|
]);
|
|
@@ -548,7 +681,7 @@ export class NDraglistController extends ProtoController
|
|
|
548
681
|
this.update('selected', ids);
|
|
549
682
|
}
|
|
550
683
|
|
|
551
|
-
selectState(): number
|
|
684
|
+
selectState() : number
|
|
552
685
|
{
|
|
553
686
|
const { items, selected } = this.data;
|
|
554
687
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h } from "vue";
|
|
2
|
-
import { ProtoView, Styler } from "../../../root/index.ts";
|
|
2
|
+
import { Pointer, ProtoView, Styler } from "../../../root/index.ts";
|
|
3
3
|
import { NDraglistController } from "./NDraglistController.ts";
|
|
4
|
-
import { Arr, Obj } from "@kizmann/pico-js";
|
|
4
|
+
import { Arr, Mix, Obj } from "@kizmann/pico-js";
|
|
5
5
|
|
|
6
6
|
export class NDraglistView extends ProtoView
|
|
7
7
|
{
|
|
@@ -40,6 +40,8 @@ export class NDraglistView extends ProtoView
|
|
|
40
40
|
itemHeight: data.itemHeight,
|
|
41
41
|
itemWidth: data.itemWidth,
|
|
42
42
|
scrollPortal: data.scrollPortal,
|
|
43
|
+
emptyText: scope.get('emptyText'),
|
|
44
|
+
emptyProps: scope.get('emptyProps'),
|
|
43
45
|
prevent: 'keydown:[37,38,39,40]',
|
|
44
46
|
dropzone: scope.uid,
|
|
45
47
|
};
|
|
@@ -148,11 +150,21 @@ export class NDraglistView extends ProtoView
|
|
|
148
150
|
let { scope, data } = this.scope;
|
|
149
151
|
|
|
150
152
|
props = {
|
|
151
|
-
dropitem: value.uid
|
|
153
|
+
class: [], dropitem: value.uid
|
|
152
154
|
};
|
|
153
155
|
|
|
156
|
+
let allowDrag : any = data.allowDrag;
|
|
157
|
+
|
|
158
|
+
if ( Mix.isFunc(allowDrag) ) {
|
|
159
|
+
allowDrag = allowDrag({ value });
|
|
160
|
+
}
|
|
161
|
+
|
|
154
162
|
if ( !data.renderHandle ) {
|
|
155
|
-
props.draggable =
|
|
163
|
+
props.draggable = allowDrag;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if ( Arr.has(data.selected, value.uid) ) {
|
|
167
|
+
Arr.append(props.class, 'n-selected');
|
|
156
168
|
}
|
|
157
169
|
|
|
158
170
|
if ( value.childs ) {
|
|
@@ -171,13 +183,16 @@ export class NDraglistView extends ProtoView
|
|
|
171
183
|
|
|
172
184
|
Arr.append(props.class, scope.view.iem);
|
|
173
185
|
|
|
174
|
-
props.
|
|
186
|
+
props.onClick = (e : any) => {
|
|
175
187
|
scope.onCurrentclick(e, value);
|
|
176
|
-
scope.emit('row-click', data.current);
|
|
188
|
+
scope.emit('row-click', data.current, e);
|
|
189
|
+
scope.emit('node-click', { value, item: data.current }, e);
|
|
177
190
|
};
|
|
178
191
|
|
|
179
|
-
props.onDblclick = () => {
|
|
180
|
-
scope.
|
|
192
|
+
props.onDblclick = (e : any) => {
|
|
193
|
+
scope.onStopclick();
|
|
194
|
+
scope.emit('row-dblclick', data.current, e);
|
|
195
|
+
scope.emit('node-dblclick', { value, item: data.current }, e);
|
|
181
196
|
};
|
|
182
197
|
|
|
183
198
|
props.onDragstart = (e : any) => {
|
|
@@ -220,19 +235,32 @@ export class NDraglistView extends ProtoView
|
|
|
220
235
|
return null;
|
|
221
236
|
}
|
|
222
237
|
|
|
223
|
-
const parent = {
|
|
238
|
+
const parent : any = {
|
|
224
239
|
class: `${this.iem}__handle`,
|
|
225
|
-
draggable: true,
|
|
226
240
|
};
|
|
227
241
|
|
|
242
|
+
let allowDrag : any = data.allowDrag;
|
|
243
|
+
|
|
244
|
+
if ( Mix.isFunc(allowDrag) ) {
|
|
245
|
+
allowDrag = allowDrag({ value });
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
if ( allowDrag ) {
|
|
249
|
+
parent.draggable = true;
|
|
250
|
+
}
|
|
251
|
+
|
|
228
252
|
const props : any = {
|
|
229
253
|
class: `${this.iem}__ellipsis`
|
|
230
254
|
};
|
|
231
255
|
|
|
232
|
-
props.onDragstart = (e) => {
|
|
256
|
+
props.onDragstart = (e : any) => {
|
|
233
257
|
scope.nodeDragstart(e, value);
|
|
234
258
|
};
|
|
235
259
|
|
|
260
|
+
props.onClick = (e : any) => {
|
|
261
|
+
e.stopPropagation();
|
|
262
|
+
};
|
|
263
|
+
|
|
236
264
|
return h('div', parent, [
|
|
237
265
|
h('div', props, [
|
|
238
266
|
h('i', { class: 'fa fa-ellipsis-v' })
|
|
@@ -257,10 +285,13 @@ export class NDraglistView extends ProtoView
|
|
|
257
285
|
};
|
|
258
286
|
|
|
259
287
|
props.onPointerdown = (e : any) => {
|
|
260
|
-
e.preventDefault();
|
|
261
288
|
scope.onExpandclick(e, value);
|
|
262
289
|
};
|
|
263
290
|
|
|
291
|
+
props.onClick = (e : any) => {
|
|
292
|
+
e.stopPropagation();
|
|
293
|
+
};
|
|
294
|
+
|
|
264
295
|
return h('div', parent, [
|
|
265
296
|
h('div', props, [
|
|
266
297
|
h('i', { class: 'fa fa-angle-right' })
|
|
@@ -21,6 +21,20 @@ export const NDropzone = {
|
|
|
21
21
|
type: [Array], default: null
|
|
22
22
|
},
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* @type {PropType<boolean|function>}
|
|
26
|
+
*/
|
|
27
|
+
allowDrop: {
|
|
28
|
+
type: [Boolean, Function], default: true
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @type {PropType<object>}
|
|
33
|
+
*/
|
|
34
|
+
mode: {
|
|
35
|
+
type: [String], default: null
|
|
36
|
+
}
|
|
37
|
+
|
|
24
38
|
};
|
|
25
39
|
|
|
26
40
|
export default defineComponent({
|
|
@@ -92,9 +92,13 @@ export class NDropzoneController extends ProtoController
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
result = {
|
|
95
|
-
...result, target: els.zone, mode: '
|
|
95
|
+
...result, target: els.zone, mode: 'append'
|
|
96
96
|
};
|
|
97
97
|
|
|
98
|
+
if ( !this.nodeAllowDrop(null, result, config) ) {
|
|
99
|
+
result.mode = 'deny';
|
|
100
|
+
}
|
|
101
|
+
|
|
98
102
|
return result;
|
|
99
103
|
}
|
|
100
104
|
|
|
@@ -104,15 +108,37 @@ export class NDropzoneController extends ProtoController
|
|
|
104
108
|
|
|
105
109
|
this.update('item', node.item);
|
|
106
110
|
|
|
111
|
+
if ( this.data.mode ) {
|
|
112
|
+
result.mode = this.data.mode;
|
|
113
|
+
}
|
|
114
|
+
|
|
107
115
|
return result;
|
|
108
116
|
}
|
|
109
117
|
|
|
110
118
|
onDragend(e : any, result : any, config : any)
|
|
111
119
|
{
|
|
120
|
+
if ( this.data.mode ) {
|
|
121
|
+
result.mode = this.data.mode;
|
|
122
|
+
}
|
|
112
123
|
|
|
113
124
|
return result;
|
|
114
125
|
}
|
|
115
126
|
|
|
127
|
+
nodeAllowDrop(target : any, result : any, config : any)
|
|
128
|
+
{
|
|
129
|
+
let allowDrop = this.data.allowDrop;
|
|
130
|
+
|
|
131
|
+
if ( typeof allowDrop !== 'function' ) {
|
|
132
|
+
allowDrop = () => this.data.allowDrop;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
let rainbow = Arr.each(config.items, (node : any) => {
|
|
136
|
+
return !!allowDrop(node, target, result.mode);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
return !Arr.has(rainbow, false);
|
|
140
|
+
}
|
|
141
|
+
|
|
116
142
|
}
|
|
117
143
|
|
|
118
144
|
export default NDropzoneController;
|
|
@@ -18,11 +18,21 @@ export class NDropzoneData extends ProtoData
|
|
|
18
18
|
return this.scope.get('item');
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
get mode() : string
|
|
22
|
+
{
|
|
23
|
+
return this.scope.get('mode');
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
get allowGroups() : string[]
|
|
22
27
|
{
|
|
23
28
|
return this.scope.get('allowGroups');
|
|
24
29
|
}
|
|
25
30
|
|
|
31
|
+
get allowDrop() : any
|
|
32
|
+
{
|
|
33
|
+
return this.scope.get('allowDrop');
|
|
34
|
+
}
|
|
35
|
+
|
|
26
36
|
}
|
|
27
37
|
|
|
28
38
|
export default NDropzoneData;
|
|
@@ -29,13 +29,9 @@ export class NDropzoneView extends ProtoView
|
|
|
29
29
|
|
|
30
30
|
body() : any
|
|
31
31
|
{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return context.slots.default(data.item);
|
|
32
|
+
return this.scope.context.slots?.default(...[
|
|
33
|
+
this.scope.data.item
|
|
34
|
+
]);
|
|
39
35
|
}
|
|
40
36
|
|
|
41
37
|
}
|
|
@@ -2,7 +2,7 @@ import { provide, ref, SetupContext, watch } from "vue";
|
|
|
2
2
|
import { GroupController } from "../../../root/index.ts";
|
|
3
3
|
import { NFormView } from "./NFormView.ts";
|
|
4
4
|
import { NFormData } from "./NFormData.ts";
|
|
5
|
-
import { Arr, Hash, Obj } from "@kizmann/pico-js";
|
|
5
|
+
import { Arr, Hash, Mix, Obj } from "@kizmann/pico-js";
|
|
6
6
|
import NFormRuleHandler from "../form-rules/NFormRuleHandler.ts";
|
|
7
7
|
|
|
8
8
|
|
|
@@ -120,6 +120,25 @@ export class NFormController extends GroupController
|
|
|
120
120
|
return messages;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
gotoFirstError()
|
|
124
|
+
{
|
|
125
|
+
const messages = this.getMessages();
|
|
126
|
+
|
|
127
|
+
if ( Mix.isEmpty(messages) ) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const first = Arr.first(...[
|
|
132
|
+
Mix.keys(messages)
|
|
133
|
+
]);
|
|
134
|
+
|
|
135
|
+
let child = Arr.find(this.childs, (child : any) => {
|
|
136
|
+
return child.data.prop == first;
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
child?.superView();
|
|
140
|
+
}
|
|
141
|
+
|
|
123
142
|
}
|
|
124
143
|
|
|
125
144
|
export default NFormController;
|
|
@@ -48,7 +48,7 @@ export class NFormBagView extends ProtoView
|
|
|
48
48
|
return null;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
const { data } = this.scope;
|
|
51
|
+
const { scope, data } = this.scope;
|
|
52
52
|
|
|
53
53
|
let props : any = {
|
|
54
54
|
name: 'item'
|
|
@@ -56,6 +56,7 @@ export class NFormBagView extends ProtoView
|
|
|
56
56
|
|
|
57
57
|
props.onPointerdown = () => {
|
|
58
58
|
field.superView();
|
|
59
|
+
scope.ncx('popover')?.superClose();
|
|
59
60
|
};
|
|
60
61
|
|
|
61
62
|
const items = Arr.each(errors[prop], (err : string) => {
|