@zeedhi/common 1.42.0 → 1.45.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.
Files changed (62) hide show
  1. package/dist/zd-common.esm.js +696 -83
  2. package/dist/zd-common.umd.js +695 -82
  3. package/package.json +2 -2
  4. package/types/components/zd-apex-chart/apex-chart.d.ts +152 -1
  5. package/types/components/zd-apex-chart/interfaces.d.ts +35 -3
  6. package/types/components/zd-button-group/button-group.d.ts +1 -1
  7. package/types/components/zd-carousel/carousel.d.ts +12 -2
  8. package/types/components/zd-carousel/interfaces.d.ts +3 -1
  9. package/types/components/zd-code-editor/code-editor.d.ts +5 -1
  10. package/types/components/zd-code-editor/interfaces.d.ts +2 -1
  11. package/types/components/zd-collapse-card/collapse-card.d.ts +1 -1
  12. package/types/components/zd-component/component.d.ts +5 -4
  13. package/types/components/zd-container/container.d.ts +12 -0
  14. package/types/components/zd-container/interfaces.d.ts +3 -0
  15. package/types/components/zd-dashboard/dashboard.d.ts +1 -1
  16. package/types/components/zd-date/date-range.d.ts +4 -4
  17. package/types/components/zd-date/date.d.ts +5 -5
  18. package/types/components/zd-dialog/dialog.d.ts +11 -0
  19. package/types/components/zd-dialog/interfaces.d.ts +2 -0
  20. package/types/components/zd-dropdown/dropdown.d.ts +4 -0
  21. package/types/components/zd-dropdown/interfaces.d.ts +1 -0
  22. package/types/components/zd-file-input/file-input.d.ts +3 -3
  23. package/types/components/zd-form/form.d.ts +6 -2
  24. package/types/components/zd-form/interfaces.d.ts +1 -0
  25. package/types/components/zd-frame/frame.d.ts +4 -1
  26. package/types/components/zd-frame/interfaces.d.ts +3 -0
  27. package/types/components/zd-grid/grid-editable.d.ts +16 -6
  28. package/types/components/zd-grid/grid.d.ts +5 -5
  29. package/types/components/zd-increment/increment.d.ts +2 -2
  30. package/types/components/zd-input/input.d.ts +6 -6
  31. package/types/components/zd-iterable/column.d.ts +2 -0
  32. package/types/components/zd-iterable/interfaces.d.ts +1 -0
  33. package/types/components/zd-iterable/iterable-page-component.d.ts +1 -1
  34. package/types/components/zd-iterable/iterable-page-size.d.ts +2 -2
  35. package/types/components/zd-iterable/iterable.d.ts +1 -1
  36. package/types/components/zd-list/interfaces.d.ts +3 -0
  37. package/types/components/zd-list/list.d.ts +12 -0
  38. package/types/components/zd-login/login-button.d.ts +1 -1
  39. package/types/components/zd-master-detail/master-detail.d.ts +1 -1
  40. package/types/components/zd-menu/menu-group.d.ts +8 -0
  41. package/types/components/zd-menu/menu-link.d.ts +5 -1
  42. package/types/components/zd-menu/menu.d.ts +3 -1
  43. package/types/components/zd-modal/interfaces.d.ts +2 -0
  44. package/types/components/zd-modal/modal.d.ts +8 -0
  45. package/types/components/zd-select/select.d.ts +5 -5
  46. package/types/components/zd-select-multiple/select-multiple.d.ts +2 -2
  47. package/types/components/zd-select-tree/select-tree.d.ts +6 -6
  48. package/types/components/zd-select-tree-multiple/interfaces.d.ts +1 -0
  49. package/types/components/zd-select-tree-multiple/select-tree-multiple.d.ts +6 -2
  50. package/types/components/zd-selectable-list/selectable-list.d.ts +1 -1
  51. package/types/components/zd-svg-map/svg-map.d.ts +1 -1
  52. package/types/components/zd-tabs/interfaces.d.ts +1 -0
  53. package/types/components/zd-tabs/tabs.d.ts +6 -2
  54. package/types/components/zd-text-input/text-input.d.ts +4 -4
  55. package/types/components/zd-time/time.d.ts +1 -1
  56. package/types/components/zd-tree/interfaces.d.ts +4 -0
  57. package/types/components/zd-tree/tree.d.ts +39 -11
  58. package/types/components/zd-tree-grid/tree-grid-editable.d.ts +8 -5
  59. package/types/components/zd-tree-grid/tree-grid.d.ts +2 -2
  60. package/types/services/zd-loading/loading-service.d.ts +7 -1
  61. package/types/utils/report/report-type/interfaces.d.ts +1 -0
  62. package/types/utils/themes/themes.d.ts +12 -2
@@ -199,6 +199,7 @@
199
199
  * @param element Element mounted reference
200
200
  */
201
201
  onMounted(element) {
202
+ this.element = element;
202
203
  if (Object.keys(this.keyMap).length) {
203
204
  core.KeyMap.bind(this.keyMap, this, element);
204
205
  }
@@ -226,7 +227,11 @@
226
227
  * @param element Element clicked
227
228
  */
228
229
  click(event, element) {
229
- this.callEvent('click', { event, element, component: this });
230
+ this.callEvent('click', {
231
+ event: (event || new MouseEvent('click')),
232
+ element: (element || this.element),
233
+ component: this,
234
+ });
230
235
  }
231
236
  /**
232
237
  * Triggered when the component is focused.
@@ -444,6 +449,26 @@
444
449
  reset: 'zoomReset',
445
450
  },
446
451
  },
452
+ events: {
453
+ animationEnd: this.animationEndEvent.bind(this),
454
+ beforeMount: this.beforeMountEvent.bind(this),
455
+ mounted: this.mountedEvent.bind(this),
456
+ updated: this.updatedEvent.bind(this),
457
+ click: this.clickEvent.bind(this),
458
+ mouseMove: this.mouseMoveEvent.bind(this),
459
+ mouseLeave: this.mouseLeaveEvent.bind(this),
460
+ legendClick: this.legendClickEvent.bind(this),
461
+ markerClick: this.markerClickEvent.bind(this),
462
+ selection: this.selectionEvent.bind(this),
463
+ dataPointSelection: this.dataPointSelectionEvent.bind(this),
464
+ dataPointMouseEnter: this.dataPointMouseEnterEvent.bind(this),
465
+ dataPointMouseLeave: this.dataPointMouseLeaveEvent.bind(this),
466
+ beforeZoom: this.beforeZoomEvent.bind(this),
467
+ beforeResetZoom: this.beforeResetZoomEvent.bind(this),
468
+ zoomed: this.zoomedEvent.bind(this),
469
+ scrolled: this.scrolledEvent.bind(this),
470
+ brushScrolled: this.brushScrolledEvent.bind(this),
471
+ },
447
472
  },
448
473
  };
449
474
  this.chartType = this.getInitValue('chartType', props.chartType, this.chartType);
@@ -486,6 +511,226 @@
486
511
  }
487
512
  return Promise.resolve();
488
513
  }
514
+ /**
515
+ * Fires when the chart’s initial animation is finished
516
+ * @param chartContext
517
+ * @param config
518
+ * @param element DOM Element
519
+ */
520
+ animationEndEvent(chartContext, options) {
521
+ this.callEvent('chartAnimationEnd', { component: this, chartContext, options });
522
+ }
523
+ /**
524
+ * Fires before the chart has been drawn on screen
525
+ * @param chartContext
526
+ * @param config
527
+ * @param element DOM Element
528
+ */
529
+ beforeMountEvent(chartContext, config) {
530
+ this.callEvent('chartBeforeMount', {
531
+ component: this, chartContext, config,
532
+ });
533
+ }
534
+ /**
535
+ * Fires after the chart has been drawn on screen
536
+ * @param chartContext
537
+ * @param config
538
+ * @param element DOM Element
539
+ */
540
+ mountedEvent(chartContext, config) {
541
+ this.callEvent('chartMounted', {
542
+ component: this, chartContext, config,
543
+ });
544
+ }
545
+ /**
546
+ * Fires when the chart has been dynamically updated either with
547
+ * updateOptions() or updateSeries() functions
548
+ * @param chartContext
549
+ * @param config
550
+ * @param element DOM Element
551
+ */
552
+ updatedEvent(chartContext, config) {
553
+ this.callEvent('chartUpdated', {
554
+ component: this, chartContext, config,
555
+ });
556
+ }
557
+ /**
558
+ * Fires when the chart has been dynamically updated either with
559
+ * updateOptions() or updateSeries() functions
560
+ * @param event Event that triggered the click event
561
+ * @param chartContext
562
+ * @param config
563
+ * @param element DOM Element
564
+ */
565
+ clickEvent(event, chartContext, config) {
566
+ this.callEvent('chartClick', {
567
+ event: (event || new MouseEvent('click')),
568
+ component: this,
569
+ chartContext,
570
+ config,
571
+ });
572
+ }
573
+ /**
574
+ * Fires when user moves mouse on any area of the chart.
575
+ * @param event Event that triggered the click event
576
+ * @param chartContext
577
+ * @param config
578
+ * @param element DOM Element
579
+ */
580
+ mouseMoveEvent(event, chartContext, config) {
581
+ this.callEvent('chartMouseMove', {
582
+ event, component: this, chartContext, config,
583
+ });
584
+ }
585
+ /**
586
+ * Fires when user moves mouse on any area of the chart.
587
+ * @param event Event that triggered the mouse leave
588
+ * @param chartContext
589
+ * @param config New config
590
+ * @param element DOM Element
591
+ */
592
+ mouseLeaveEvent(event, chartContext, config) {
593
+ this.callEvent('chartMouseLeave', {
594
+ event, component: this, chartContext, config,
595
+ });
596
+ }
597
+ /**
598
+ * Fires when user moves mouse on any area of the chart.
599
+ * @param chartContext
600
+ * @param seriesIndex
601
+ * @param config
602
+ * @param element DOM Element
603
+ */
604
+ legendClickEvent(chartContext, seriesIndex, config) {
605
+ this.callEvent('chartLegendClick', {
606
+ component: this, chartContext, seriesIndex, config,
607
+ });
608
+ }
609
+ /**
610
+ * Fires when user moves mouse on any area of the chart.
611
+ * @param event Event that triggered the marker click
612
+ * @param chartContext
613
+ * @param option New config
614
+ * @param element DOM Element
615
+ */
616
+ markerClickEvent(event, chartContext, config) {
617
+ this.callEvent('chartMarkerClick', {
618
+ event, component: this, chartContext, config,
619
+ });
620
+ }
621
+ /**
622
+ * Fires when user selects rect using the selection tool.
623
+ * The second argument
624
+ * @param chartContext
625
+ * @param config contains the yaxis and xaxis coordinates where user made the selection
626
+ * @param element DOM Element
627
+ */
628
+ selectionEvent(chartContext, config) {
629
+ this.callEvent('chartSelection', {
630
+ component: this, chartContext, config,
631
+ });
632
+ }
633
+ /**
634
+ * Fires when user clicks on a datapoint (bar/column/marker/bubble/donut-slice).
635
+ * @param event Event that triggered when user clicks on a datapoint
636
+ * @param chartContext
637
+ * @param config The config object, also includes additional information like
638
+ * which dataPointIndex was selected of which series.
639
+ * @param element DOM Element
640
+ */
641
+ dataPointSelectionEvent(event, chartContext, config) {
642
+ this.callEvent('chartDataPointSelection', {
643
+ event, component: this, chartContext, config,
644
+ });
645
+ }
646
+ /**
647
+ * Fires when user clicks on a datapoint (bar/column/marker/bubble/donut-slice).
648
+ * @param event Event that triggered when user’s mouse enter on a datapoint
649
+ * @param chartContext
650
+ * @param config The config object, also includes additional information like
651
+ * which dataPointIndex was hovered of particular series.
652
+ * @param element DOM Element
653
+ */
654
+ dataPointMouseEnterEvent(event, chartContext, config) {
655
+ this.callEvent('chartDataPointMouseEnter', {
656
+ event, component: this, chartContext, config,
657
+ });
658
+ }
659
+ /**
660
+ * MouseLeave event for a datapoint (bar/column/marker/bubble/donut-slice).
661
+ * @param event Event that triggered the beforeSlide event
662
+ * @param chartContext
663
+ * @param config
664
+ * @param element DOM Element
665
+ */
666
+ dataPointMouseLeaveEvent(event, chartContext, config) {
667
+ this.callEvent('chartDataPointMouseLeave', {
668
+ event, component: this, chartContext, config,
669
+ });
670
+ }
671
+ /**
672
+ * This function, if defined, runs just before zooming in/out of the chart
673
+ * allowing you to set a custom range for zooming in/out.
674
+ * @param chartContext
675
+ * @param config { min: timestamp, max: timestamp }
676
+ * @param element DOM Element
677
+ */
678
+ beforeZoomEvent(chartContext, config) {
679
+ this.callEvent('chartBeforeZoom', {
680
+ component: this, chartContext, config,
681
+ });
682
+ }
683
+ /**
684
+ * This function, if defined, runs just before the user hits the HOME button
685
+ * on the toolbar to reset the chart to it’s original state. The function
686
+ * allows you to set a custom axes range for the initial view of the chart.
687
+ * @param chartContext
688
+ * @param config { min: timestamp, max: timestamp }
689
+ * @param element DOM Element
690
+ */
691
+ beforeResetZoomEvent(chartContext, config) {
692
+ this.callEvent('chartBeforeResetZoom', {
693
+ component: this, chartContext, config,
694
+ });
695
+ }
696
+ /**
697
+ * Fires when user zooms in/out the chart using either the selection zooming
698
+ * tool or zoom in/out buttons.
699
+ * The 2nd argument includes information of the new xaxis/yaxis generated after zooming.
700
+ * @param chartContext
701
+ * @param config { min: timestamp, max: timestamp }
702
+ * @param element DOM Element
703
+ */
704
+ zoomedEvent(chartContext, config) {
705
+ this.callEvent('chartZoomed', {
706
+ component: this, chartContext, config,
707
+ });
708
+ }
709
+ /**
710
+ * Fires when user scrolls using the pan tool.
711
+ * The 2nd argument includes information of the new xaxis generated after scrolling.
712
+ * @param chartContext
713
+ * @param config { xaxis: any }
714
+ * @param element DOM Element
715
+ */
716
+ scrolledEvent(chartContext, config) {
717
+ this.callEvent('chartScrolled', {
718
+ component: this, chartContext, config,
719
+ });
720
+ }
721
+ /**
722
+ * Fires when user drags the brush in a brush chart.
723
+ * The 2nd argument includes information of the new axes generated after
724
+ * scrolling the brush.
725
+ * @param chartContext
726
+ * @param config { xaxis: any, yaxis: any }
727
+ * @param element DOM Element
728
+ */
729
+ brushScrolledEvent(chartContext, config) {
730
+ this.callEvent('chartBrushScrolled', {
731
+ component: this, chartContext, config,
732
+ });
733
+ }
489
734
  updateToolbarIcons() {
490
735
  var _a, _b, _c;
491
736
  if (!this.viewGetIconHTML)
@@ -870,6 +1115,16 @@
870
1115
  * '30em', '400', 400. Values without measurement unit will be notated in pixels by default
871
1116
  */
872
1117
  this.height = 'auto';
1118
+ /**
1119
+ * Sets the carousel max height. Example values: 'auto', '100%', '400px',
1120
+ * '30em', '400', 400. Values without measurement unit will be notated in pixels by default
1121
+ */
1122
+ this.maxHeight = 'none';
1123
+ /**
1124
+ * Sets the carousel min height. Example values: 'auto', '100%', '400px',
1125
+ * '30em', '400', 400. Values without measurement unit will be notated in pixels by default
1126
+ */
1127
+ this.minHeight = 'none';
873
1128
  /**
874
1129
  * Configures the carousel as infinite (the slide after the last one is the first slide, and vice-versa)
875
1130
  */
@@ -961,6 +1216,8 @@
961
1216
  this.buttonsOutside = this.getInitValue('buttonsOutside', props.buttonsOutside, this.buttonsOutside);
962
1217
  this.center = this.getInitValue('center', props.center, this.center);
963
1218
  this.height = this.getInitValue('height', props.height, this.height);
1219
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
1220
+ this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
964
1221
  this.infiniteScroll = this.getInitValue('infiniteScroll', props.infiniteScroll, this.infiniteScroll);
965
1222
  this.initialSlide = this.getInitValue('initialSlide', props.initialSlide, this.initialSlide);
966
1223
  this.currentSlide = this.getInitValue('currentSlide', props.currentSlide, this.initialSlide);
@@ -1196,6 +1453,7 @@
1196
1453
  this.internalValue = {};
1197
1454
  this.align = this.getInitValue('align', props.align, this.align);
1198
1455
  this.justify = this.getInitValue('justify', props.justify, this.justify);
1456
+ this.height = this.getInitValue('height', props.height, this.height);
1199
1457
  this.internalValue = this.getInitValue('value', props.value, this.value);
1200
1458
  this.createAccessors();
1201
1459
  }
@@ -1399,9 +1657,9 @@
1399
1657
  */
1400
1658
  this.storePath = '';
1401
1659
  /**
1402
- * Input value.
1403
- */
1404
- this.value = undefined;
1660
+ * Internal input value.
1661
+ */
1662
+ this.value = null;
1405
1663
  /**
1406
1664
  * Input validations.
1407
1665
  */
@@ -1549,6 +1807,8 @@
1549
1807
  * @param element Element clicked
1550
1808
  */
1551
1809
  change(event, element) {
1810
+ if (this.value === '')
1811
+ this.value = null;
1552
1812
  if (this.events.change && typeof this.events.change === 'function') {
1553
1813
  this.events.change({ event, element, component: this });
1554
1814
  }
@@ -1785,6 +2045,10 @@
1785
2045
  * Max height in pixels. 'none' means no limit.
1786
2046
  */
1787
2047
  this.maxHeight = 'none';
2048
+ /**
2049
+ * Max height in pixels. 'none' means no limit.
2050
+ */
2051
+ this.height = 'auto';
1788
2052
  /**
1789
2053
  * Language code to be used for highlight (js|javascript, css, html, json, ts|typescript, bash|shell)
1790
2054
  * Other languages must be imported above
@@ -1804,6 +2068,7 @@
1804
2068
  this.staticCode = this.getInitValue('staticCode', props.staticCode, this.staticCodeValue);
1805
2069
  this.copyIcon = this.getInitValue('copyIcon', props.copyIcon, this.copyIcon);
1806
2070
  this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
2071
+ this.height = this.getInitValue('height', props.height, this.height);
1807
2072
  this.language = this.getInitValue('language', props.language, this.language);
1808
2073
  this.showLineNumbers = this.getInitValue('showLineNumbers', props.showLineNumbers, this.showLineNumbers);
1809
2074
  this.createAccessors();
@@ -2010,12 +2275,27 @@
2010
2275
  * Adds height 100% to container.
2011
2276
  */
2012
2277
  this.fillHeight = false;
2278
+ /**
2279
+ * Sets the height for the component.
2280
+ */
2281
+ this.height = 'auto';
2282
+ /**
2283
+ * Sets the maximum height for the component.
2284
+ */
2285
+ this.maxHeight = 'none';
2286
+ /**
2287
+ * Sets the minimum height for the component.
2288
+ */
2289
+ this.minHeight = 'none';
2013
2290
  /**
2014
2291
  * Removes viewport maximum-width size breakpoints.
2015
2292
  */
2016
2293
  this.fluid = true;
2017
2294
  this.fluid = this.getInitValue('fluid', props.fluid, this.fluid);
2018
2295
  this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
2296
+ this.height = this.getInitValue('height', props.height, this.height);
2297
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
2298
+ this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
2019
2299
  this.createAccessors();
2020
2300
  }
2021
2301
  }
@@ -2353,6 +2633,14 @@
2353
2633
  * Dialog type (normal, success, error, warning, info)
2354
2634
  */
2355
2635
  this.type = 'normal';
2636
+ /**
2637
+ * Confirm button component name
2638
+ */
2639
+ this.confirmButton = 'dialogButton';
2640
+ /**
2641
+ * Deny button component name
2642
+ */
2643
+ this.denyButton = undefined;
2356
2644
  /**
2357
2645
  * Default dialog buttons
2358
2646
  * @private
@@ -2364,6 +2652,8 @@
2364
2652
  events: { click: () => this.hide() },
2365
2653
  }];
2366
2654
  this.defaultValues = {
2655
+ confirmButton: this.confirmButton,
2656
+ denyButton: this.denyButton,
2367
2657
  name: this.name,
2368
2658
  maxWidth: this.maxWidth,
2369
2659
  persistent: this.persistent,
@@ -2371,6 +2661,38 @@
2371
2661
  title: this.title,
2372
2662
  text: this.text,
2373
2663
  };
2664
+ this.clickDefaultButtonKeyMapping = {
2665
+ enter: {
2666
+ event: () => {
2667
+ if (this.confirmButton) {
2668
+ const confirmButton = core.Metadata.getInstance(this.confirmButton);
2669
+ if (confirmButton
2670
+ && confirmButton.events
2671
+ && confirmButton.events.click
2672
+ && typeof confirmButton.events.click === 'function') {
2673
+ confirmButton.events.click({ component: new Button(confirmButton) });
2674
+ }
2675
+ }
2676
+ },
2677
+ stop: true,
2678
+ },
2679
+ esc: {
2680
+ event: () => {
2681
+ if (this.denyButton) {
2682
+ const denyButton = core.Metadata.getInstance(this.denyButton);
2683
+ if (denyButton
2684
+ && denyButton.events
2685
+ && denyButton.events.click
2686
+ && typeof denyButton.events.click === 'function')
2687
+ denyButton.events.click({ component: new Button(denyButton) });
2688
+ }
2689
+ else {
2690
+ this.hide();
2691
+ }
2692
+ },
2693
+ stop: true,
2694
+ },
2695
+ };
2374
2696
  this.assignDialogProperties(props);
2375
2697
  this.createAccessors();
2376
2698
  }
@@ -2380,6 +2702,8 @@
2380
2702
  */
2381
2703
  assignDialogProperties(dialog) {
2382
2704
  this.buttons = dialog.buttons && dialog.buttons.length ? dialog.buttons : this.defaultButtons;
2705
+ this.confirmButton = this.getInitValue('confirmButton', dialog.confirmButton, this.defaultValues.confirmButton);
2706
+ this.denyButton = this.getInitValue('denyButton', dialog.denyButton, this.defaultValues.denyButton);
2383
2707
  this.name = this.getInitValue('name', dialog.name, this.defaultValues.name);
2384
2708
  this.maxWidth = this.getInitValue('maxWidth', dialog.maxWidth, this.defaultValues.maxWidth);
2385
2709
  this.persistent = this.getInitValue('persistent', dialog.persistent, this.defaultValues.persistent);
@@ -2392,6 +2716,7 @@
2392
2716
  * Displays dialog
2393
2717
  */
2394
2718
  show() {
2719
+ core.KeyMap.bind(this.clickDefaultButtonKeyMapping, this);
2395
2720
  this.isVisible = true;
2396
2721
  }
2397
2722
  /**
@@ -2399,6 +2724,7 @@
2399
2724
  */
2400
2725
  hide() {
2401
2726
  this.isVisible = false;
2727
+ core.KeyMap.unbind(this.clickDefaultButtonKeyMapping, this);
2402
2728
  }
2403
2729
  }
2404
2730
 
@@ -2495,61 +2821,34 @@
2495
2821
  */
2496
2822
  ModalService.modals = [];
2497
2823
 
2498
- class Loading extends Component {
2499
- /*
2500
- * Creates a new Loading Overlay
2501
- * @param props Modal structure
2502
- */
2503
- constructor(props) {
2504
- super(props);
2505
- /**
2506
- * text to show in Loader Overlay
2507
- */
2508
- this.text = 'Loading';
2509
- this.isVisible = false;
2510
- this.zIndex = 999;
2511
- this.text = this.getInitValue('text', props.text, this.text);
2512
- this.zIndex = this.getInitValue('zIndex', props.zIndex, this.zIndex);
2513
- this.defaultText = this.text;
2514
- }
2515
- /**
2516
- * Displays overlay
2517
- */
2518
- show(text) {
2519
- if (text)
2520
- this.text = text;
2521
- else
2522
- this.text = this.defaultText;
2523
- this.isVisible = true;
2524
- }
2525
- /**
2526
- * Close overlay
2527
- */
2528
- hide() {
2529
- this.isVisible = false;
2530
- }
2531
- }
2532
-
2533
2824
  /**
2534
2825
  * Loading Service Class
2535
2826
  */
2536
2827
  class LoadingService {
2828
+ /**
2829
+ * Creates a new loading instance
2830
+ * @param loading loading structure
2831
+ */
2832
+ static create(CreateLoading, props) {
2833
+ const instance = new CreateLoading(props);
2834
+ this.loading = instance;
2835
+ return instance;
2836
+ }
2537
2837
  /**
2538
2838
  * Displays a Loading.
2539
2839
  * If has an opened Loading it will be closed.
2540
2840
  * @param Loading loading structure
2541
2841
  */
2542
2842
  static show(text) {
2543
- this.instance.show(text);
2843
+ this.loading.show(text);
2544
2844
  }
2545
2845
  /**
2546
2846
  * Hides current Loading
2547
2847
  */
2548
2848
  static hide() {
2549
- this.instance.hide();
2849
+ this.loading.hide();
2550
2850
  }
2551
- }
2552
- LoadingService.instance = new Loading({ name: 'loading-instance' });
2851
+ }
2553
2852
 
2554
2853
  /**
2555
2854
  * Base class for Dashboard component.
@@ -3156,8 +3455,9 @@
3156
3455
  return !this.dateError || core.I18n.translate('VALIDATION_INVALID_DATE');
3157
3456
  }
3158
3457
  click(event, element) {
3159
- super.click(event, element);
3160
- if (!event.defaultPrevented) {
3458
+ const clickEvent = event || new MouseEvent('click');
3459
+ super.click(clickEvent, element);
3460
+ if (!clickEvent.defaultPrevented) {
3161
3461
  this.showDatePicker = !this.showDatePicker;
3162
3462
  }
3163
3463
  }
@@ -3470,7 +3770,7 @@
3470
3770
  const lastValue = this.value;
3471
3771
  this.dateError = false;
3472
3772
  this.value = this.parseISODateRangeValue(newValue);
3473
- if (!core.isEqual(lastValue, this.value))
3773
+ if (!core.Utils.isEqual(lastValue, this.value))
3474
3774
  this.change(this.value);
3475
3775
  }
3476
3776
  formatISODateRangeValue(dates) {
@@ -3505,8 +3805,9 @@
3505
3805
  return !this.dateError || core.I18n.translate('VALIDATION_INVALID_DATE');
3506
3806
  }
3507
3807
  click(event, element) {
3508
- super.click(event, element);
3509
- if (!event.defaultPrevented) {
3808
+ const clickEvent = event || new MouseEvent('click');
3809
+ super.click(clickEvent, element);
3810
+ if (!clickEvent.defaultPrevented) {
3510
3811
  this.showDatePicker = !this.showDatePicker;
3511
3812
  }
3512
3813
  }
@@ -3728,6 +4029,10 @@
3728
4029
  * Applies position fixed to the dropdown.
3729
4030
  */
3730
4031
  this.fixed = false;
4032
+ /**
4033
+ * Sets the height for the dropdown.
4034
+ */
4035
+ this.height = 'auto';
3731
4036
  /**
3732
4037
  * Offset the menu on the x-axis.
3733
4038
  */
@@ -3753,6 +4058,7 @@
3753
4058
  this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
3754
4059
  this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
3755
4060
  this.hover = this.getInitValue('hover', props.hover, this.hover);
4061
+ this.height = this.getInitValue('height', props.height, this.height);
3756
4062
  this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
3757
4063
  this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
3758
4064
  this.maxWidth = this.getInitValue('maxWidth', props.maxWidth, this.maxWidth);
@@ -3874,7 +4180,7 @@
3874
4180
  * Triggered when a removable chip is clicked
3875
4181
  * @param event DOM event
3876
4182
  * @param index Chip index
3877
- * @param element HTMLElement
4183
+ * @param element any
3878
4184
  */
3879
4185
  chipClick(event, index, element) {
3880
4186
  event.stopImmediatePropagation();
@@ -4014,12 +4320,18 @@
4014
4320
  this.override = {};
4015
4321
  this.cache = false;
4016
4322
  this.cacheDuration = 2 * 60 * 60 * 1000;
4323
+ this.height = 'auto';
4324
+ this.maxHeight = 'none';
4325
+ this.minHeight = 'none';
4017
4326
  this.headerName = 'sw-fetched-on';
4018
4327
  this.path = props.path;
4019
4328
  this.local = props.local === true;
4020
4329
  this.override = props.override || this.override;
4021
4330
  this.cache = props.cache || this.cache;
4022
4331
  this.cacheDuration = this.getInitValue('cacheDuration', props.cacheDuration, this.cacheDuration);
4332
+ this.height = this.getInitValue('height', props.height, this.height);
4333
+ this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
4334
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
4023
4335
  this.createAccessors();
4024
4336
  this.getMetadata();
4025
4337
  }
@@ -4156,6 +4468,8 @@
4156
4468
  this.componentProps = {};
4157
4469
  /** column style property */
4158
4470
  this.style = {};
4471
+ /** Type of XLS */
4472
+ this.xlsType = '';
4159
4473
  /* Stores lookup data to prevent unnecessary requests */
4160
4474
  this.lookupData = {};
4161
4475
  /* Stores lookup data count (only to be reactive and force column update) */
@@ -4198,6 +4512,7 @@
4198
4512
  this.loading = this.getInitValue('loading', props.loading, this.loading);
4199
4513
  this.style = this.getInitValue('style', props.style, this.style);
4200
4514
  this.componentProps = this.getInitValue('componentProps', props.componentProps, this.componentProps);
4515
+ this.xlsType = this.getInitValue('xlsType', props.xlsType, this.xlsType);
4201
4516
  this.conditions = this.getInitValue('conditions', props.conditions, this.conditions);
4202
4517
  this.createConditions();
4203
4518
  this.createActionConditions();
@@ -4536,7 +4851,7 @@
4536
4851
  if (this.componentProps.dataValueOut && ((_a = component.datasource) === null || _a === void 0 ? void 0 : _a.currentRow)) {
4537
4852
  this.componentProps.dataValueOut.forEach((columns) => {
4538
4853
  const { column, columnOnGrid } = columns;
4539
- if (!core.isEqual(newRow.originalRow[columnOnGrid], component.datasource.currentRow[column])) {
4854
+ if (!core.Utils.isEqual(newRow.originalRow[columnOnGrid], component.datasource.currentRow[column])) {
4540
4855
  newRow[`${columnOnGrid}_original`] = newRow.originalRow[columnOnGrid];
4541
4856
  newRow[columnOnGrid] = component.datasource.currentRow[column];
4542
4857
  }
@@ -4550,7 +4865,7 @@
4550
4865
  }
4551
4866
  }
4552
4867
  core.FormatterParserProvider.registerFormatter('column_ZdSelect', ({ column, value, row, componentProps, }) => {
4553
- if (!value)
4868
+ if (value === null || value === undefined)
4554
4869
  return '';
4555
4870
  const { dataText, formatterDataText, dataTextSeparator, dataValue, } = componentProps;
4556
4871
  let currentRow = row;
@@ -4598,7 +4913,7 @@
4598
4913
  });
4599
4914
  return dataTextNames.reduce((result, columnName, index) => {
4600
4915
  const rowCell = currentRow[columnName];
4601
- if (rowCell) {
4916
+ if (rowCell !== undefined && rowCell !== null) {
4602
4917
  const separator = index > 0 ? (dataTextSeparator || ' | ') : '';
4603
4918
  const mask = masks[index];
4604
4919
  const maskValue = typeof mask === 'function' ? mask(rowCell) : mask;
@@ -5017,15 +5332,36 @@
5017
5332
  * @private
5018
5333
  */
5019
5334
  this.editedRows = {};
5335
+ /**
5336
+ * Rows with newRowIdentifier
5337
+ * @private
5338
+ */
5339
+ this.addedRows = {};
5020
5340
  /**
5021
5341
  * Invalid inline components
5022
5342
  * @private
5023
5343
  */
5024
5344
  this.invalidComponents = {};
5345
+ this.cancelEditedRowsKeyMapping = {
5346
+ esc: {
5347
+ event: this.cancelEditedRows.bind(this),
5348
+ stop: true,
5349
+ input: true,
5350
+ active: true,
5351
+ },
5352
+ };
5025
5353
  this.newRowIdentifier = '__added_row';
5026
5354
  this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
5027
5355
  this.createAccessors();
5028
5356
  }
5357
+ onMounted(element) {
5358
+ super.onMounted(element);
5359
+ core.KeyMap.bind(this.cancelEditedRowsKeyMapping, this, element);
5360
+ }
5361
+ onBeforeDestroy() {
5362
+ super.onBeforeDestroy();
5363
+ core.KeyMap.unbind(this.cancelEditedRowsKeyMapping, this);
5364
+ }
5029
5365
  /**
5030
5366
  * Get Grid columns objects
5031
5367
  * @param columns Grid columns parameter
@@ -5195,7 +5531,7 @@
5195
5531
  changeEditableComponent(column, row, value, component) {
5196
5532
  const key = row[this.datasource.uniqueKey];
5197
5533
  const columnName = column.name;
5198
- if (!core.isEqual(value, row[columnName])) {
5534
+ if (!core.Utils.isEqual(value, row[columnName])) {
5199
5535
  const newRow = {};
5200
5536
  newRow[key] = Object.assign({}, this.editedRows[key]);
5201
5537
  newRow[key].originalRow = Object.assign({}, row);
@@ -5241,6 +5577,14 @@
5241
5577
  * Cancels all edited rows and enable grid components
5242
5578
  */
5243
5579
  cancelEditedRows() {
5580
+ return __awaiter(this, void 0, void 0, function* () {
5581
+ yield this.removeAddedRows();
5582
+ this.editing = false;
5583
+ this.editedRows = {};
5584
+ this.invalidComponents = {};
5585
+ });
5586
+ }
5587
+ removeAddedRows() {
5244
5588
  return __awaiter(this, void 0, void 0, function* () {
5245
5589
  const { data } = this.datasource;
5246
5590
  data.forEach((row, index) => {
@@ -5249,21 +5593,26 @@
5249
5593
  }
5250
5594
  });
5251
5595
  yield this.datasource.updateData(data);
5252
- this.editing = false;
5253
- this.editedRows = {};
5254
- this.invalidComponents = {};
5255
5596
  });
5256
5597
  }
5598
+ addDataRow(row) {
5599
+ if (this.addedRows[row[this.datasource.uniqueKey]])
5600
+ this.datasource.post(row);
5601
+ else
5602
+ this.datasource.put(row);
5603
+ }
5257
5604
  /**
5258
5605
  * Saves all edited rows if they are valid
5259
5606
  * @throws Will throw when it finds an invalid row
5260
5607
  */
5261
5608
  saveEditedRows() {
5262
5609
  return __awaiter(this, void 0, void 0, function* () {
5263
- const response = yield Promise.all(this.getEditedRows().map((row) => this.datasource.put(row)));
5610
+ yield this.removeAddedRows();
5611
+ const response = yield Promise.all(this.getEditedRows().map((row) => this.addDataRow(row)));
5264
5612
  this.editing = false;
5265
5613
  this.editedRows = {};
5266
5614
  this.invalidComponents = {};
5615
+ this.addedRows = {};
5267
5616
  yield this.datasource.get();
5268
5617
  return response;
5269
5618
  });
@@ -5275,8 +5624,11 @@
5275
5624
  getEditedRows() {
5276
5625
  const editedRows = [];
5277
5626
  Object.keys(this.editedRows).forEach((key) => {
5627
+ this.addedRows = {};
5278
5628
  const row = Object.assign(Object.assign({}, this.editedRows[key].originalRow), this.editedRows[key]);
5279
5629
  delete row.originalRow;
5630
+ if (row[this.newRowIdentifier])
5631
+ this.addedRows[key] = row;
5280
5632
  delete row[this.newRowIdentifier];
5281
5633
  Object.keys(row).forEach((attr) => {
5282
5634
  if (Object.prototype.hasOwnProperty.call(row, `${attr}_original`)) {
@@ -6315,10 +6667,10 @@
6315
6667
  }
6316
6668
  }
6317
6669
  core.FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTextSeparator = ' | ', }) => {
6318
- if (!value && value !== 0) {
6670
+ if (value === null || value === undefined) {
6319
6671
  return null;
6320
6672
  }
6321
- if (typeof value === 'string' || typeof value === 'number') {
6673
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
6322
6674
  return value;
6323
6675
  }
6324
6676
  const dataTextArr = Array.isArray(dataText) ? dataText : [dataText];
@@ -6341,7 +6693,7 @@
6341
6693
  }
6342
6694
  });
6343
6695
  return dataTextNames.reduce((result, column, index) => {
6344
- if (value[column]) {
6696
+ if (value[column] !== null && value[column] !== undefined) {
6345
6697
  const separator = index > 0 ? dataTextSeparator : '';
6346
6698
  let masked = value[column];
6347
6699
  if (masks[index]) {
@@ -6560,6 +6912,18 @@
6560
6912
  * Will only collapse when explicitly closed.
6561
6913
  */
6562
6914
  this.expand = false;
6915
+ /**
6916
+ * Sets the height for the component.
6917
+ */
6918
+ this.height = 'auto';
6919
+ /**
6920
+ * Sets the maxHeight for the component.
6921
+ */
6922
+ this.maxHeight = 'none';
6923
+ /**
6924
+ * Sets the minHeight for the component.
6925
+ */
6926
+ this.minHeight = 'none';
6563
6927
  this.dark = this.getInitValue('dark', props.dark, this.dark);
6564
6928
  this.dense = this.getInitValue('dense', props.dense, this.dense);
6565
6929
  this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
@@ -6571,6 +6935,9 @@
6571
6935
  this.color = this.getInitValue('color', props.color, this.color);
6572
6936
  this.elevation = this.getInitValue('elevation', props.elevation, this.elevation);
6573
6937
  this.expand = this.getInitValue('expand', props.expand, this.expand);
6938
+ this.height = this.getInitValue('height', props.height, this.height);
6939
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
6940
+ this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
6574
6941
  this.createAccessors();
6575
6942
  }
6576
6943
  /**
@@ -6664,6 +7031,41 @@
6664
7031
  }
6665
7032
  }
6666
7033
 
7034
+ class Loading extends Component {
7035
+ /*
7036
+ * Creates a new Loading Overlay
7037
+ * @param props Modal structure
7038
+ */
7039
+ constructor(props) {
7040
+ super(props);
7041
+ /**
7042
+ * text to show in Loader Overlay
7043
+ */
7044
+ this.text = 'Loading';
7045
+ this.isVisible = false;
7046
+ this.zIndex = 999;
7047
+ this.text = this.getInitValue('text', props.text, this.text);
7048
+ this.zIndex = this.getInitValue('zIndex', props.zIndex, this.zIndex);
7049
+ this.defaultText = this.text;
7050
+ }
7051
+ /**
7052
+ * Displays overlay
7053
+ */
7054
+ show(text) {
7055
+ if (text)
7056
+ this.text = text;
7057
+ else
7058
+ this.text = this.defaultText;
7059
+ this.isVisible = true;
7060
+ }
7061
+ /**
7062
+ * Close overlay
7063
+ */
7064
+ hide() {
7065
+ this.isVisible = false;
7066
+ }
7067
+ }
7068
+
6667
7069
  /**
6668
7070
  * Base class for Login component.
6669
7071
  */
@@ -7020,6 +7422,8 @@
7020
7422
  this.filteredMenuItems = [];
7021
7423
  /** Search value */
7022
7424
  this.searchValue = '';
7425
+ /** Store the current item focused */
7426
+ this.currentItem = null;
7023
7427
  this.app = this.getInitValue('app', props.app, this.app);
7024
7428
  this.clipped = this.getInitValue('clipped', props.clipped, this.clipped);
7025
7429
  this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
@@ -7252,7 +7656,7 @@
7252
7656
  if (item.component === 'ZdMenuGroup') {
7253
7657
  this.searchItems(item.items);
7254
7658
  }
7255
- else if (core.normalize(core.I18n.translate(item.label)).indexOf(core.normalize(this.searchValue)) !== -1) {
7659
+ else if (core.Utils.normalize(core.I18n.translate(item.label)).indexOf(core.Utils.normalize(this.searchValue)) !== -1) {
7256
7660
  this.filteredMenuItems.push(item);
7257
7661
  }
7258
7662
  }
@@ -7295,9 +7699,21 @@
7295
7699
  */
7296
7700
  click(event) {
7297
7701
  let preventDefault = false;
7298
- preventDefault = this.callEvent('click', { event, component: this });
7702
+ preventDefault = this.callEvent('click', {
7703
+ event: (event || new MouseEvent('click')),
7704
+ component: this,
7705
+ });
7299
7706
  if (preventDefault) {
7300
- event.preventDefault();
7707
+ event === null || event === void 0 ? void 0 : event.preventDefault();
7708
+ }
7709
+ this.setFocus();
7710
+ }
7711
+ /**
7712
+ * Event triggered when this item is focus
7713
+ */
7714
+ focus() {
7715
+ if (this.parentMenu) {
7716
+ this.parentMenu.currentItem = this;
7301
7717
  }
7302
7718
  }
7303
7719
  /**
@@ -7366,6 +7782,29 @@
7366
7782
  close() {
7367
7783
  this.opened = false;
7368
7784
  }
7785
+ /**
7786
+ * Event triggered when this item is clicked
7787
+ */
7788
+ click(event) {
7789
+ let preventDefault = false;
7790
+ preventDefault = this.callEvent('click', {
7791
+ event: (event || new MouseEvent('click')),
7792
+ component: this,
7793
+ });
7794
+ if (preventDefault) {
7795
+ event === null || event === void 0 ? void 0 : event.preventDefault();
7796
+ }
7797
+ this.setFocus();
7798
+ }
7799
+ /**
7800
+ * Event triggered when this item is focus
7801
+ */
7802
+ focus(event) {
7803
+ this.callEvent('focus', { event, component: this });
7804
+ if (this.parentMenu) {
7805
+ this.parentMenu.currentItem = this;
7806
+ }
7807
+ }
7369
7808
  }
7370
7809
 
7371
7810
  /**
@@ -7443,10 +7882,20 @@
7443
7882
  * If true the modal won't close when overlay is clicked
7444
7883
  */
7445
7884
  this.persistent = false;
7885
+ /**
7886
+ * Allows modal to be dragged around in the screen
7887
+ */
7888
+ this.draggable = false;
7889
+ /**
7890
+ * Css selector of the drag handle
7891
+ */
7892
+ this.dragHandle = '';
7446
7893
  this.title = this.getInitValue('title', props.title, this.title);
7447
7894
  this.fullscreen = this.getInitValue('fullscreen', props.fullscreen, this.fullscreen);
7448
7895
  this.grid = this.getInitValue('grid', props.grid, this.grid);
7449
7896
  this.persistent = this.getInitValue('persistent', props.persistent, this.persistent);
7897
+ this.draggable = this.getInitValue('draggable', props.draggable, this.draggable);
7898
+ this.dragHandle = this.getInitValue('dragHandle', props.dragHandle, this.dragHandle);
7450
7899
  this.isVisible = false;
7451
7900
  this.createAccessors();
7452
7901
  }
@@ -8888,8 +9337,13 @@
8888
9337
  */
8889
9338
  this.selectedNodes = [];
8890
9339
  this.selectValue = [];
9340
+ /**
9341
+ * Changes the behavior of checked nodes that will be displayed in the array of values
9342
+ */
9343
+ this.valueConsistsOf = 'LEAF_PRIORITY';
8891
9344
  this.flat = this.getInitValue('flat', props.flat, this.flat);
8892
9345
  this.limit = this.getInitValue('limit', props.limit, this.limit);
9346
+ this.valueConsistsOf = this.getInitValue('valueConsistsOf', props.valueConsistsOf, this.valueConsistsOf);
8893
9347
  this.createAccessors();
8894
9348
  }
8895
9349
  /**
@@ -9313,6 +9767,7 @@
9313
9767
  this.tabs = [];
9314
9768
  this.tabs = this.getTabs(props.tabs || []);
9315
9769
  this.activeTab = this.getInitValue('activeTab', props.activeTab, this.activeTab);
9770
+ this.height = this.getInitValue('height', props.height, this.height);
9316
9771
  this.createAccessors();
9317
9772
  }
9318
9773
  getTabs(tabs) {
@@ -9708,8 +10163,11 @@
9708
10163
  || core.I18n.translate('VALIDATION_TIME_NOT_ALLOWED');
9709
10164
  }
9710
10165
  click(event) {
9711
- this.callEvent('click', { event, component: this });
9712
- if (!event.defaultPrevented) {
10166
+ this.callEvent('click', {
10167
+ event: (event || new MouseEvent('click')),
10168
+ component: this,
10169
+ });
10170
+ if (!(event === null || event === void 0 ? void 0 : event.defaultPrevented)) {
9713
10171
  this.showTimePicker = !this.showTimePicker;
9714
10172
  }
9715
10173
  }
@@ -9835,6 +10293,10 @@
9835
10293
  * Components that will be rendered on toolbar slot
9836
10294
  */
9837
10295
  this.toolbarSlot = [];
10296
+ /**
10297
+ * Components that will be rendered on title slot
10298
+ */
10299
+ this.titleSlot = [];
9838
10300
  /** Datasource parent field */
9839
10301
  this.parentField = '';
9840
10302
  /** Datasource title field */
@@ -9845,11 +10307,21 @@
9845
10307
  * Defines if the tree will be opened or not (true/false) or if it should open only until a specific level
9846
10308
  */
9847
10309
  this.openLevelOnLoad = false;
10310
+ /**
10311
+ * Allow row check
10312
+ */
10313
+ this.checkbox = false;
9848
10314
  /**
9849
10315
  * Defines if should wait and not execute GET method when Datasource is created
9850
10316
  */
9851
10317
  this.lazyLoad = true;
9852
- this.nodes = props.nodes || this.nodes;
10318
+ /**
10319
+ * Dictionary of nodePath ponting to Dictionary of path pointing to the condition (applied) return value
10320
+ */
10321
+ this.appliedConditions = {};
10322
+ /* Conditions of tree */
10323
+ this.factoredConditions = {};
10324
+ this.nodes = this.initNodes(props.nodes || this.nodes);
9853
10325
  this.itemIconName = this.getInitValue('itemIconName', props.itemIconName, this.itemIconName);
9854
10326
  this.groupIconName = this.getInitValue('groupIconName', props.groupIconName, this.groupIconName);
9855
10327
  this.openedIconName = this.getInitValue('openedIconName', props.openedIconName, this.openedIconName);
@@ -9860,8 +10332,16 @@
9860
10332
  this.titleField = this.getInitValue('titleField', props.titleField, this.titleField);
9861
10333
  this.dataField = this.getInitValue('dataField', props.dataField, this.dataField);
9862
10334
  this.openLevelOnLoad = this.getInitValue('openLevelOnLoad', props.openLevelOnLoad, this.openLevelOnLoad);
10335
+ this.checkbox = this.getInitValue('checkbox', props.checkbox, this.checkbox);
9863
10336
  this.afterTitleSlot = props.afterTitleSlot || this.afterTitleSlot;
9864
10337
  this.toolbarSlot = props.toolbarSlot || this.toolbarSlot;
10338
+ this.titleSlot = props.titleSlot || this.titleSlot;
10339
+ if (props.afterTitleSlot) {
10340
+ this.createConditions([props.afterTitleSlot]);
10341
+ }
10342
+ if (props.titleSlot) {
10343
+ this.createConditions(props.titleSlot);
10344
+ }
9865
10345
  if (props.datasource && Object.keys(props.datasource).length) {
9866
10346
  this.lazyLoad = props.datasource.lazyLoad !== false;
9867
10347
  this.datasource = core.DatasourceFactory.factory(Object.assign(Object.assign({}, props.datasource), { searchIn: props.datasource.searchIn || [this.titleField, this.dataField].filter(Boolean), lazyLoad: true, loadAll: true }));
@@ -9869,6 +10349,12 @@
9869
10349
  }
9870
10350
  this.createAccessors();
9871
10351
  }
10352
+ /**
10353
+ * Initialize all the properties of the declared nodes (reactivity)
10354
+ */
10355
+ initNodes(nodes) {
10356
+ return nodes.map((node) => (Object.assign(Object.assign({ isLeaf: false, isExpanded: true, isSelected: false, isDraggable: true, isSelectable: true, isChecked: false }, node), { children: this.initNodes(node.children || []) })));
10357
+ }
9872
10358
  /** Nodes */
9873
10359
  get nodes() {
9874
10360
  return this.nodesValue;
@@ -9879,6 +10365,16 @@
9879
10365
  }
9880
10366
  this.nodesValue = value;
9881
10367
  }
10368
+ getCheckedNodes() {
10369
+ const selectedNodes = [];
10370
+ this.tree.traverse((node) => {
10371
+ const instanceNode = this.getNode(node.path || []);
10372
+ if (instanceNode === null || instanceNode === void 0 ? void 0 : instanceNode.isChecked) {
10373
+ selectedNodes.push(instanceNode);
10374
+ }
10375
+ });
10376
+ return selectedNodes;
10377
+ }
9882
10378
  /** Returns the selected nodes */
9883
10379
  get selectedNodes() {
9884
10380
  var _a;
@@ -9977,16 +10473,87 @@
9977
10473
  setTree(tree) {
9978
10474
  this.tree = tree;
9979
10475
  }
9980
- /** Get the conditions function to be applied to each column depending on the node */
9981
- getConditions(conditions) {
9982
- const cond = core.Event.factory(conditions);
9983
- return (node) => {
9984
- const appliedConditions = {};
9985
- Object.keys(conditions).forEach((condition) => {
9986
- appliedConditions[condition] = cond[condition](node);
9987
- });
9988
- return appliedConditions;
9989
- };
10476
+ /**
10477
+ * Return plain conditions object
10478
+ * @param conditions Conditions object
10479
+ * @param parentPath Path to parent property
10480
+ */
10481
+ getPlainConditions(conditions, parentPath = '') {
10482
+ let plainData = {};
10483
+ Object.keys(conditions).forEach((key) => {
10484
+ const fullKey = parentPath ? [parentPath, key].join('.') : key;
10485
+ if (typeof conditions[key] === 'object') {
10486
+ plainData = Object.assign(Object.assign({}, plainData), this.getPlainConditions(conditions[key], fullKey));
10487
+ }
10488
+ else {
10489
+ plainData[fullKey] = conditions[key];
10490
+ }
10491
+ });
10492
+ return plainData;
10493
+ }
10494
+ createConditions(children, parentPath = '') {
10495
+ children.forEach((child) => {
10496
+ const path = parentPath ? `${parentPath}.${child.name}` : child.name;
10497
+ if (child.conditions) {
10498
+ const plainConditions = this.getPlainConditions(child.conditions);
10499
+ this.factoredConditions[path] = core.Event.factory(plainConditions);
10500
+ }
10501
+ if (child.children) {
10502
+ this.createConditions(child.children, path);
10503
+ }
10504
+ });
10505
+ }
10506
+ applyCondition(node, factoredConditions) {
10507
+ const appliedConditions = {};
10508
+ Object.keys(factoredConditions).forEach((condition) => {
10509
+ const conditionFunction = factoredConditions[condition];
10510
+ set__default["default"](appliedConditions, condition, conditionFunction(node));
10511
+ });
10512
+ return appliedConditions;
10513
+ }
10514
+ applyChildCondition(node, factoredConditions = this.factoredConditions) {
10515
+ const appliedConditions = {};
10516
+ Object.keys(factoredConditions).forEach((comp) => {
10517
+ const conditions = this.factoredConditions[comp];
10518
+ appliedConditions[comp] = Object.assign({}, this.applyCondition(node, conditions));
10519
+ });
10520
+ return appliedConditions;
10521
+ }
10522
+ reapplyConditions(node) {
10523
+ const nodePath = node.pathStr;
10524
+ if (!nodePath)
10525
+ return {};
10526
+ const appliedConditions = Object.assign({}, this.appliedConditions);
10527
+ appliedConditions[nodePath] = this.applyChildCondition(node);
10528
+ this.appliedConditions = appliedConditions;
10529
+ return this.appliedConditions[nodePath];
10530
+ }
10531
+ getSlotComponent(slot, node, parentPath = '') {
10532
+ const slotArr = Array.isArray(slot) ? slot : [slot];
10533
+ const newComponents = [];
10534
+ slotArr.forEach((component) => {
10535
+ var _a;
10536
+ if (!component)
10537
+ return;
10538
+ const nodePath = node.pathStr;
10539
+ if (!nodePath)
10540
+ return;
10541
+ const compName = component.name;
10542
+ const instanceName = `${compName}_${nodePath}`;
10543
+ const path = parentPath ? `${parentPath}.${compName}` : compName;
10544
+ const newComponent = merge__default["default"]({}, component, (_a = this.appliedConditions[nodePath]) === null || _a === void 0 ? void 0 : _a[path]);
10545
+ const newChildren = this.getSlotComponent(newComponent.children || [], node, path);
10546
+ newComponent.name = instanceName;
10547
+ newComponent.children = newChildren;
10548
+ try {
10549
+ core.Metadata.updateInstance(instanceName, newComponent);
10550
+ }
10551
+ catch (e) {
10552
+ // do nothing
10553
+ }
10554
+ newComponents.push(newComponent);
10555
+ });
10556
+ return newComponents;
9990
10557
  }
9991
10558
  /** Triggers when dragging nodes have been dropped */
9992
10559
  nodeDrop(nodes, position, event, element) {
@@ -10014,6 +10581,12 @@
10014
10581
  event, element, component: this, node,
10015
10582
  });
10016
10583
  }
10584
+ /** Triggers when a node has been checked/unchecked */
10585
+ nodeCheck(node, event, element) {
10586
+ this.callEvent('onNodeCheck', {
10587
+ event, element, component: this, node,
10588
+ });
10589
+ }
10017
10590
  clearSelection(nodes) {
10018
10591
  const nodesArray = nodes || this.nodes;
10019
10592
  nodesArray.forEach((node) => {
@@ -10023,6 +10596,19 @@
10023
10596
  }
10024
10597
  });
10025
10598
  }
10599
+ getNode(path) {
10600
+ return this.searchPath(this.nodes, path);
10601
+ }
10602
+ getParentNode(node) {
10603
+ var _a;
10604
+ return this.getNode(((_a = node.path) === null || _a === void 0 ? void 0 : _a.slice(0, -1)) || []);
10605
+ }
10606
+ searchPath(nodes, path) {
10607
+ const currentNode = (path[0] > -1 && path[0] < nodes.length) ? nodes[path[0]] : undefined;
10608
+ if (currentNode && path.length > 1)
10609
+ return this.searchPath(currentNode.children || [], path.slice(1));
10610
+ return currentNode;
10611
+ }
10026
10612
  }
10027
10613
 
10028
10614
  /**
@@ -10201,9 +10787,25 @@
10201
10787
  * Enter edit mode on double click
10202
10788
  */
10203
10789
  this.doubleClickEdit = false;
10790
+ this.cancelEditedRowsKeyMapping = {
10791
+ esc: {
10792
+ event: this.cancelEditedRows.bind(this),
10793
+ stop: true,
10794
+ input: true,
10795
+ active: true,
10796
+ },
10797
+ };
10204
10798
  this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
10205
10799
  this.createAccessors();
10206
10800
  }
10801
+ onMounted(element) {
10802
+ super.onMounted(element);
10803
+ core.KeyMap.bind(this.cancelEditedRowsKeyMapping, this, element);
10804
+ }
10805
+ onBeforeDestroy() {
10806
+ super.onBeforeDestroy();
10807
+ core.KeyMap.unbind(this.cancelEditedRowsKeyMapping, this);
10808
+ }
10207
10809
  /**
10208
10810
  * Get Grid columns objects
10209
10811
  * @param columns Grid columns parameter
@@ -10372,7 +10974,7 @@
10372
10974
  changeEditableComponent(column, row, value, component) {
10373
10975
  const key = row[this.datasource.uniqueKey];
10374
10976
  const columnName = column.name;
10375
- if (!core.isEqual(value, row[columnName])) {
10977
+ if (!core.Utils.isEqual(value, row[columnName])) {
10376
10978
  const newRow = {};
10377
10979
  newRow[key] = Object.assign({}, this.editedRows[key]);
10378
10980
  newRow[key].originalRow = Object.assign({}, row);
@@ -10646,7 +11248,7 @@
10646
11248
  tableColumns: 'mdi-table-headers-eye',
10647
11249
  unfold: 'mdi-unfold-more-horizontal',
10648
11250
  warning: 'mdi-exclamation',
10649
- zoom: 'mdi-magnify-scan',
11251
+ zoom: 'mdi-magnify',
10650
11252
  zoomIn: 'mdi-plus-circle-outline',
10651
11253
  zoomPanning: 'mdi-hand-back-right-outline',
10652
11254
  zoomOut: 'mdi-minus-circle-outline',
@@ -10744,11 +11346,23 @@
10744
11346
  zeedhi: {
10745
11347
  light: {
10746
11348
  'font-color': 'var(--v-grey-darken2)',
10747
- 'background-base': '#F6F6F6',
11349
+ 'background-base': '#FDFDFD',
11350
+ 'background-base-2': '#F6F6F6',
11351
+ 'background-base-3': '#EEE',
11352
+ 'scrollbar-track': 'var(--v-grey-lighten5)',
11353
+ 'scrollbar-thumb': 'var(--v-grey-lighten4)',
11354
+ 'badge-background-color': '#f44336',
11355
+ 'badge-text-color': '#fff',
10748
11356
  },
10749
11357
  dark: {
10750
11358
  'font-color': 'var(--v-grey-lighten3)',
10751
- 'background-base': '#121212',
11359
+ 'background-base': '#1E1E1E',
11360
+ 'background-base-2': 'var(--v-grey-darken2)',
11361
+ 'background-base-3': 'var(--v-grey-darken4)',
11362
+ 'scrollbar-track': 'var(--v-grey-darken3)',
11363
+ 'scrollbar-thumb': 'var(--v-grey-base)',
11364
+ 'badge-background-color': '#f44336',
11365
+ 'badge-text-color': '#fff',
10752
11366
  },
10753
11367
  variables: {
10754
11368
  'default-padding': '16px',
@@ -10766,8 +11380,6 @@
10766
11380
  'font-body4-weight': '500',
10767
11381
  'font-caption-size': '11px',
10768
11382
  'font-caption-weight': '400',
10769
- 'badge-background-color': '#f44336',
10770
- 'badge-text-color': '#fff',
10771
11383
  },
10772
11384
  },
10773
11385
  };
@@ -11022,6 +11634,7 @@
11022
11634
  sequence: index,
11023
11635
  format: this.getFormatOfColumn(col),
11024
11636
  size: `${size}%`,
11637
+ xlsType: col.xlsType,
11025
11638
  };
11026
11639
  return Object.assign(Object.assign({}, result), { [col.name]: row });
11027
11640
  }, {});