@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
@@ -1,4 +1,4 @@
1
- import { AccessorManager, Event, KeyMap, Metadata, FormatterParserProvider, Validation, Accessor, DatasourceFactory, I18n, MethodNotAssignedError, Loader, Mask, Config, dayjs, isEqual, Router, InstanceNotFoundError, Http, Cookie, normalize, URL as URL$1 } from '@zeedhi/core';
1
+ import { AccessorManager, Event, KeyMap, Metadata, FormatterParserProvider, Validation, Accessor, DatasourceFactory, I18n, MethodNotAssignedError, Loader, Mask, Config, dayjs, Utils, Router, InstanceNotFoundError, Http, Cookie, URL as URL$1 } from '@zeedhi/core';
2
2
  import merge from 'lodash.merge';
3
3
  import debounce from 'lodash.debounce';
4
4
  import isUndefined from 'lodash.isundefined';
@@ -192,6 +192,7 @@ class Component {
192
192
  * @param element Element mounted reference
193
193
  */
194
194
  onMounted(element) {
195
+ this.element = element;
195
196
  if (Object.keys(this.keyMap).length) {
196
197
  KeyMap.bind(this.keyMap, this, element);
197
198
  }
@@ -219,7 +220,11 @@ class Component {
219
220
  * @param element Element clicked
220
221
  */
221
222
  click(event, element) {
222
- this.callEvent('click', { event, element, component: this });
223
+ this.callEvent('click', {
224
+ event: (event || new MouseEvent('click')),
225
+ element: (element || this.element),
226
+ component: this,
227
+ });
223
228
  }
224
229
  /**
225
230
  * Triggered when the component is focused.
@@ -437,6 +442,26 @@ class ApexChart extends ComponentRender {
437
442
  reset: 'zoomReset',
438
443
  },
439
444
  },
445
+ events: {
446
+ animationEnd: this.animationEndEvent.bind(this),
447
+ beforeMount: this.beforeMountEvent.bind(this),
448
+ mounted: this.mountedEvent.bind(this),
449
+ updated: this.updatedEvent.bind(this),
450
+ click: this.clickEvent.bind(this),
451
+ mouseMove: this.mouseMoveEvent.bind(this),
452
+ mouseLeave: this.mouseLeaveEvent.bind(this),
453
+ legendClick: this.legendClickEvent.bind(this),
454
+ markerClick: this.markerClickEvent.bind(this),
455
+ selection: this.selectionEvent.bind(this),
456
+ dataPointSelection: this.dataPointSelectionEvent.bind(this),
457
+ dataPointMouseEnter: this.dataPointMouseEnterEvent.bind(this),
458
+ dataPointMouseLeave: this.dataPointMouseLeaveEvent.bind(this),
459
+ beforeZoom: this.beforeZoomEvent.bind(this),
460
+ beforeResetZoom: this.beforeResetZoomEvent.bind(this),
461
+ zoomed: this.zoomedEvent.bind(this),
462
+ scrolled: this.scrolledEvent.bind(this),
463
+ brushScrolled: this.brushScrolledEvent.bind(this),
464
+ },
440
465
  },
441
466
  };
442
467
  this.chartType = this.getInitValue('chartType', props.chartType, this.chartType);
@@ -479,6 +504,226 @@ class ApexChart extends ComponentRender {
479
504
  }
480
505
  return Promise.resolve();
481
506
  }
507
+ /**
508
+ * Fires when the chart’s initial animation is finished
509
+ * @param chartContext
510
+ * @param config
511
+ * @param element DOM Element
512
+ */
513
+ animationEndEvent(chartContext, options) {
514
+ this.callEvent('chartAnimationEnd', { component: this, chartContext, options });
515
+ }
516
+ /**
517
+ * Fires before the chart has been drawn on screen
518
+ * @param chartContext
519
+ * @param config
520
+ * @param element DOM Element
521
+ */
522
+ beforeMountEvent(chartContext, config) {
523
+ this.callEvent('chartBeforeMount', {
524
+ component: this, chartContext, config,
525
+ });
526
+ }
527
+ /**
528
+ * Fires after the chart has been drawn on screen
529
+ * @param chartContext
530
+ * @param config
531
+ * @param element DOM Element
532
+ */
533
+ mountedEvent(chartContext, config) {
534
+ this.callEvent('chartMounted', {
535
+ component: this, chartContext, config,
536
+ });
537
+ }
538
+ /**
539
+ * Fires when the chart has been dynamically updated either with
540
+ * updateOptions() or updateSeries() functions
541
+ * @param chartContext
542
+ * @param config
543
+ * @param element DOM Element
544
+ */
545
+ updatedEvent(chartContext, config) {
546
+ this.callEvent('chartUpdated', {
547
+ component: this, chartContext, config,
548
+ });
549
+ }
550
+ /**
551
+ * Fires when the chart has been dynamically updated either with
552
+ * updateOptions() or updateSeries() functions
553
+ * @param event Event that triggered the click event
554
+ * @param chartContext
555
+ * @param config
556
+ * @param element DOM Element
557
+ */
558
+ clickEvent(event, chartContext, config) {
559
+ this.callEvent('chartClick', {
560
+ event: (event || new MouseEvent('click')),
561
+ component: this,
562
+ chartContext,
563
+ config,
564
+ });
565
+ }
566
+ /**
567
+ * Fires when user moves mouse on any area of the chart.
568
+ * @param event Event that triggered the click event
569
+ * @param chartContext
570
+ * @param config
571
+ * @param element DOM Element
572
+ */
573
+ mouseMoveEvent(event, chartContext, config) {
574
+ this.callEvent('chartMouseMove', {
575
+ event, component: this, chartContext, config,
576
+ });
577
+ }
578
+ /**
579
+ * Fires when user moves mouse on any area of the chart.
580
+ * @param event Event that triggered the mouse leave
581
+ * @param chartContext
582
+ * @param config New config
583
+ * @param element DOM Element
584
+ */
585
+ mouseLeaveEvent(event, chartContext, config) {
586
+ this.callEvent('chartMouseLeave', {
587
+ event, component: this, chartContext, config,
588
+ });
589
+ }
590
+ /**
591
+ * Fires when user moves mouse on any area of the chart.
592
+ * @param chartContext
593
+ * @param seriesIndex
594
+ * @param config
595
+ * @param element DOM Element
596
+ */
597
+ legendClickEvent(chartContext, seriesIndex, config) {
598
+ this.callEvent('chartLegendClick', {
599
+ component: this, chartContext, seriesIndex, config,
600
+ });
601
+ }
602
+ /**
603
+ * Fires when user moves mouse on any area of the chart.
604
+ * @param event Event that triggered the marker click
605
+ * @param chartContext
606
+ * @param option New config
607
+ * @param element DOM Element
608
+ */
609
+ markerClickEvent(event, chartContext, config) {
610
+ this.callEvent('chartMarkerClick', {
611
+ event, component: this, chartContext, config,
612
+ });
613
+ }
614
+ /**
615
+ * Fires when user selects rect using the selection tool.
616
+ * The second argument
617
+ * @param chartContext
618
+ * @param config contains the yaxis and xaxis coordinates where user made the selection
619
+ * @param element DOM Element
620
+ */
621
+ selectionEvent(chartContext, config) {
622
+ this.callEvent('chartSelection', {
623
+ component: this, chartContext, config,
624
+ });
625
+ }
626
+ /**
627
+ * Fires when user clicks on a datapoint (bar/column/marker/bubble/donut-slice).
628
+ * @param event Event that triggered when user clicks on a datapoint
629
+ * @param chartContext
630
+ * @param config The config object, also includes additional information like
631
+ * which dataPointIndex was selected of which series.
632
+ * @param element DOM Element
633
+ */
634
+ dataPointSelectionEvent(event, chartContext, config) {
635
+ this.callEvent('chartDataPointSelection', {
636
+ event, component: this, chartContext, config,
637
+ });
638
+ }
639
+ /**
640
+ * Fires when user clicks on a datapoint (bar/column/marker/bubble/donut-slice).
641
+ * @param event Event that triggered when user’s mouse enter on a datapoint
642
+ * @param chartContext
643
+ * @param config The config object, also includes additional information like
644
+ * which dataPointIndex was hovered of particular series.
645
+ * @param element DOM Element
646
+ */
647
+ dataPointMouseEnterEvent(event, chartContext, config) {
648
+ this.callEvent('chartDataPointMouseEnter', {
649
+ event, component: this, chartContext, config,
650
+ });
651
+ }
652
+ /**
653
+ * MouseLeave event for a datapoint (bar/column/marker/bubble/donut-slice).
654
+ * @param event Event that triggered the beforeSlide event
655
+ * @param chartContext
656
+ * @param config
657
+ * @param element DOM Element
658
+ */
659
+ dataPointMouseLeaveEvent(event, chartContext, config) {
660
+ this.callEvent('chartDataPointMouseLeave', {
661
+ event, component: this, chartContext, config,
662
+ });
663
+ }
664
+ /**
665
+ * This function, if defined, runs just before zooming in/out of the chart
666
+ * allowing you to set a custom range for zooming in/out.
667
+ * @param chartContext
668
+ * @param config { min: timestamp, max: timestamp }
669
+ * @param element DOM Element
670
+ */
671
+ beforeZoomEvent(chartContext, config) {
672
+ this.callEvent('chartBeforeZoom', {
673
+ component: this, chartContext, config,
674
+ });
675
+ }
676
+ /**
677
+ * This function, if defined, runs just before the user hits the HOME button
678
+ * on the toolbar to reset the chart to it’s original state. The function
679
+ * allows you to set a custom axes range for the initial view of the chart.
680
+ * @param chartContext
681
+ * @param config { min: timestamp, max: timestamp }
682
+ * @param element DOM Element
683
+ */
684
+ beforeResetZoomEvent(chartContext, config) {
685
+ this.callEvent('chartBeforeResetZoom', {
686
+ component: this, chartContext, config,
687
+ });
688
+ }
689
+ /**
690
+ * Fires when user zooms in/out the chart using either the selection zooming
691
+ * tool or zoom in/out buttons.
692
+ * The 2nd argument includes information of the new xaxis/yaxis generated after zooming.
693
+ * @param chartContext
694
+ * @param config { min: timestamp, max: timestamp }
695
+ * @param element DOM Element
696
+ */
697
+ zoomedEvent(chartContext, config) {
698
+ this.callEvent('chartZoomed', {
699
+ component: this, chartContext, config,
700
+ });
701
+ }
702
+ /**
703
+ * Fires when user scrolls using the pan tool.
704
+ * The 2nd argument includes information of the new xaxis generated after scrolling.
705
+ * @param chartContext
706
+ * @param config { xaxis: any }
707
+ * @param element DOM Element
708
+ */
709
+ scrolledEvent(chartContext, config) {
710
+ this.callEvent('chartScrolled', {
711
+ component: this, chartContext, config,
712
+ });
713
+ }
714
+ /**
715
+ * Fires when user drags the brush in a brush chart.
716
+ * The 2nd argument includes information of the new axes generated after
717
+ * scrolling the brush.
718
+ * @param chartContext
719
+ * @param config { xaxis: any, yaxis: any }
720
+ * @param element DOM Element
721
+ */
722
+ brushScrolledEvent(chartContext, config) {
723
+ this.callEvent('chartBrushScrolled', {
724
+ component: this, chartContext, config,
725
+ });
726
+ }
482
727
  updateToolbarIcons() {
483
728
  var _a, _b, _c;
484
729
  if (!this.viewGetIconHTML)
@@ -863,6 +1108,16 @@ class Carousel extends ComponentRender {
863
1108
  * '30em', '400', 400. Values without measurement unit will be notated in pixels by default
864
1109
  */
865
1110
  this.height = 'auto';
1111
+ /**
1112
+ * Sets the carousel max height. Example values: 'auto', '100%', '400px',
1113
+ * '30em', '400', 400. Values without measurement unit will be notated in pixels by default
1114
+ */
1115
+ this.maxHeight = 'none';
1116
+ /**
1117
+ * Sets the carousel min height. Example values: 'auto', '100%', '400px',
1118
+ * '30em', '400', 400. Values without measurement unit will be notated in pixels by default
1119
+ */
1120
+ this.minHeight = 'none';
866
1121
  /**
867
1122
  * Configures the carousel as infinite (the slide after the last one is the first slide, and vice-versa)
868
1123
  */
@@ -954,6 +1209,8 @@ class Carousel extends ComponentRender {
954
1209
  this.buttonsOutside = this.getInitValue('buttonsOutside', props.buttonsOutside, this.buttonsOutside);
955
1210
  this.center = this.getInitValue('center', props.center, this.center);
956
1211
  this.height = this.getInitValue('height', props.height, this.height);
1212
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
1213
+ this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
957
1214
  this.infiniteScroll = this.getInitValue('infiniteScroll', props.infiniteScroll, this.infiniteScroll);
958
1215
  this.initialSlide = this.getInitValue('initialSlide', props.initialSlide, this.initialSlide);
959
1216
  this.currentSlide = this.getInitValue('currentSlide', props.currentSlide, this.initialSlide);
@@ -1189,6 +1446,7 @@ class Form extends ComponentRender {
1189
1446
  this.internalValue = {};
1190
1447
  this.align = this.getInitValue('align', props.align, this.align);
1191
1448
  this.justify = this.getInitValue('justify', props.justify, this.justify);
1449
+ this.height = this.getInitValue('height', props.height, this.height);
1192
1450
  this.internalValue = this.getInitValue('value', props.value, this.value);
1193
1451
  this.createAccessors();
1194
1452
  }
@@ -1392,9 +1650,9 @@ class Input extends ComponentRender {
1392
1650
  */
1393
1651
  this.storePath = '';
1394
1652
  /**
1395
- * Input value.
1396
- */
1397
- this.value = undefined;
1653
+ * Internal input value.
1654
+ */
1655
+ this.value = null;
1398
1656
  /**
1399
1657
  * Input validations.
1400
1658
  */
@@ -1542,6 +1800,8 @@ class Input extends ComponentRender {
1542
1800
  * @param element Element clicked
1543
1801
  */
1544
1802
  change(event, element) {
1803
+ if (this.value === '')
1804
+ this.value = null;
1545
1805
  if (this.events.change && typeof this.events.change === 'function') {
1546
1806
  this.events.change({ event, element, component: this });
1547
1807
  }
@@ -1778,6 +2038,10 @@ class CodeEditor extends ComponentRender {
1778
2038
  * Max height in pixels. 'none' means no limit.
1779
2039
  */
1780
2040
  this.maxHeight = 'none';
2041
+ /**
2042
+ * Max height in pixels. 'none' means no limit.
2043
+ */
2044
+ this.height = 'auto';
1781
2045
  /**
1782
2046
  * Language code to be used for highlight (js|javascript, css, html, json, ts|typescript, bash|shell)
1783
2047
  * Other languages must be imported above
@@ -1797,6 +2061,7 @@ class CodeEditor extends ComponentRender {
1797
2061
  this.staticCode = this.getInitValue('staticCode', props.staticCode, this.staticCodeValue);
1798
2062
  this.copyIcon = this.getInitValue('copyIcon', props.copyIcon, this.copyIcon);
1799
2063
  this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
2064
+ this.height = this.getInitValue('height', props.height, this.height);
1800
2065
  this.language = this.getInitValue('language', props.language, this.language);
1801
2066
  this.showLineNumbers = this.getInitValue('showLineNumbers', props.showLineNumbers, this.showLineNumbers);
1802
2067
  this.createAccessors();
@@ -2003,12 +2268,27 @@ class Container extends ComponentRender {
2003
2268
  * Adds height 100% to container.
2004
2269
  */
2005
2270
  this.fillHeight = false;
2271
+ /**
2272
+ * Sets the height for the component.
2273
+ */
2274
+ this.height = 'auto';
2275
+ /**
2276
+ * Sets the maximum height for the component.
2277
+ */
2278
+ this.maxHeight = 'none';
2279
+ /**
2280
+ * Sets the minimum height for the component.
2281
+ */
2282
+ this.minHeight = 'none';
2006
2283
  /**
2007
2284
  * Removes viewport maximum-width size breakpoints.
2008
2285
  */
2009
2286
  this.fluid = true;
2010
2287
  this.fluid = this.getInitValue('fluid', props.fluid, this.fluid);
2011
2288
  this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
2289
+ this.height = this.getInitValue('height', props.height, this.height);
2290
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
2291
+ this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
2012
2292
  this.createAccessors();
2013
2293
  }
2014
2294
  }
@@ -2346,6 +2626,14 @@ class Dialog extends Component {
2346
2626
  * Dialog type (normal, success, error, warning, info)
2347
2627
  */
2348
2628
  this.type = 'normal';
2629
+ /**
2630
+ * Confirm button component name
2631
+ */
2632
+ this.confirmButton = 'dialogButton';
2633
+ /**
2634
+ * Deny button component name
2635
+ */
2636
+ this.denyButton = undefined;
2349
2637
  /**
2350
2638
  * Default dialog buttons
2351
2639
  * @private
@@ -2357,6 +2645,8 @@ class Dialog extends Component {
2357
2645
  events: { click: () => this.hide() },
2358
2646
  }];
2359
2647
  this.defaultValues = {
2648
+ confirmButton: this.confirmButton,
2649
+ denyButton: this.denyButton,
2360
2650
  name: this.name,
2361
2651
  maxWidth: this.maxWidth,
2362
2652
  persistent: this.persistent,
@@ -2364,6 +2654,38 @@ class Dialog extends Component {
2364
2654
  title: this.title,
2365
2655
  text: this.text,
2366
2656
  };
2657
+ this.clickDefaultButtonKeyMapping = {
2658
+ enter: {
2659
+ event: () => {
2660
+ if (this.confirmButton) {
2661
+ const confirmButton = Metadata.getInstance(this.confirmButton);
2662
+ if (confirmButton
2663
+ && confirmButton.events
2664
+ && confirmButton.events.click
2665
+ && typeof confirmButton.events.click === 'function') {
2666
+ confirmButton.events.click({ component: new Button(confirmButton) });
2667
+ }
2668
+ }
2669
+ },
2670
+ stop: true,
2671
+ },
2672
+ esc: {
2673
+ event: () => {
2674
+ if (this.denyButton) {
2675
+ const denyButton = Metadata.getInstance(this.denyButton);
2676
+ if (denyButton
2677
+ && denyButton.events
2678
+ && denyButton.events.click
2679
+ && typeof denyButton.events.click === 'function')
2680
+ denyButton.events.click({ component: new Button(denyButton) });
2681
+ }
2682
+ else {
2683
+ this.hide();
2684
+ }
2685
+ },
2686
+ stop: true,
2687
+ },
2688
+ };
2367
2689
  this.assignDialogProperties(props);
2368
2690
  this.createAccessors();
2369
2691
  }
@@ -2373,6 +2695,8 @@ class Dialog extends Component {
2373
2695
  */
2374
2696
  assignDialogProperties(dialog) {
2375
2697
  this.buttons = dialog.buttons && dialog.buttons.length ? dialog.buttons : this.defaultButtons;
2698
+ this.confirmButton = this.getInitValue('confirmButton', dialog.confirmButton, this.defaultValues.confirmButton);
2699
+ this.denyButton = this.getInitValue('denyButton', dialog.denyButton, this.defaultValues.denyButton);
2376
2700
  this.name = this.getInitValue('name', dialog.name, this.defaultValues.name);
2377
2701
  this.maxWidth = this.getInitValue('maxWidth', dialog.maxWidth, this.defaultValues.maxWidth);
2378
2702
  this.persistent = this.getInitValue('persistent', dialog.persistent, this.defaultValues.persistent);
@@ -2385,6 +2709,7 @@ class Dialog extends Component {
2385
2709
  * Displays dialog
2386
2710
  */
2387
2711
  show() {
2712
+ KeyMap.bind(this.clickDefaultButtonKeyMapping, this);
2388
2713
  this.isVisible = true;
2389
2714
  }
2390
2715
  /**
@@ -2392,6 +2717,7 @@ class Dialog extends Component {
2392
2717
  */
2393
2718
  hide() {
2394
2719
  this.isVisible = false;
2720
+ KeyMap.unbind(this.clickDefaultButtonKeyMapping, this);
2395
2721
  }
2396
2722
  }
2397
2723
 
@@ -2488,61 +2814,34 @@ class ModalService {
2488
2814
  */
2489
2815
  ModalService.modals = [];
2490
2816
 
2491
- class Loading extends Component {
2492
- /*
2493
- * Creates a new Loading Overlay
2494
- * @param props Modal structure
2495
- */
2496
- constructor(props) {
2497
- super(props);
2498
- /**
2499
- * text to show in Loader Overlay
2500
- */
2501
- this.text = 'Loading';
2502
- this.isVisible = false;
2503
- this.zIndex = 999;
2504
- this.text = this.getInitValue('text', props.text, this.text);
2505
- this.zIndex = this.getInitValue('zIndex', props.zIndex, this.zIndex);
2506
- this.defaultText = this.text;
2507
- }
2508
- /**
2509
- * Displays overlay
2510
- */
2511
- show(text) {
2512
- if (text)
2513
- this.text = text;
2514
- else
2515
- this.text = this.defaultText;
2516
- this.isVisible = true;
2517
- }
2518
- /**
2519
- * Close overlay
2520
- */
2521
- hide() {
2522
- this.isVisible = false;
2523
- }
2524
- }
2525
-
2526
2817
  /**
2527
2818
  * Loading Service Class
2528
2819
  */
2529
2820
  class LoadingService {
2821
+ /**
2822
+ * Creates a new loading instance
2823
+ * @param loading loading structure
2824
+ */
2825
+ static create(CreateLoading, props) {
2826
+ const instance = new CreateLoading(props);
2827
+ this.loading = instance;
2828
+ return instance;
2829
+ }
2530
2830
  /**
2531
2831
  * Displays a Loading.
2532
2832
  * If has an opened Loading it will be closed.
2533
2833
  * @param Loading loading structure
2534
2834
  */
2535
2835
  static show(text) {
2536
- this.instance.show(text);
2836
+ this.loading.show(text);
2537
2837
  }
2538
2838
  /**
2539
2839
  * Hides current Loading
2540
2840
  */
2541
2841
  static hide() {
2542
- this.instance.hide();
2842
+ this.loading.hide();
2543
2843
  }
2544
- }
2545
- LoadingService.instance = new Loading({ name: 'loading-instance' });
2844
+ }
2546
2845
 
2547
2846
  /**
2548
2847
  * Base class for Dashboard component.
@@ -3149,8 +3448,9 @@ class Date$1 extends TextInput {
3149
3448
  return !this.dateError || I18n.translate('VALIDATION_INVALID_DATE');
3150
3449
  }
3151
3450
  click(event, element) {
3152
- super.click(event, element);
3153
- if (!event.defaultPrevented) {
3451
+ const clickEvent = event || new MouseEvent('click');
3452
+ super.click(clickEvent, element);
3453
+ if (!clickEvent.defaultPrevented) {
3154
3454
  this.showDatePicker = !this.showDatePicker;
3155
3455
  }
3156
3456
  }
@@ -3463,7 +3763,7 @@ class DateRange extends TextInput {
3463
3763
  const lastValue = this.value;
3464
3764
  this.dateError = false;
3465
3765
  this.value = this.parseISODateRangeValue(newValue);
3466
- if (!isEqual(lastValue, this.value))
3766
+ if (!Utils.isEqual(lastValue, this.value))
3467
3767
  this.change(this.value);
3468
3768
  }
3469
3769
  formatISODateRangeValue(dates) {
@@ -3498,8 +3798,9 @@ class DateRange extends TextInput {
3498
3798
  return !this.dateError || I18n.translate('VALIDATION_INVALID_DATE');
3499
3799
  }
3500
3800
  click(event, element) {
3501
- super.click(event, element);
3502
- if (!event.defaultPrevented) {
3801
+ const clickEvent = event || new MouseEvent('click');
3802
+ super.click(clickEvent, element);
3803
+ if (!clickEvent.defaultPrevented) {
3503
3804
  this.showDatePicker = !this.showDatePicker;
3504
3805
  }
3505
3806
  }
@@ -3721,6 +4022,10 @@ class Dropdown extends ComponentRender {
3721
4022
  * Applies position fixed to the dropdown.
3722
4023
  */
3723
4024
  this.fixed = false;
4025
+ /**
4026
+ * Sets the height for the dropdown.
4027
+ */
4028
+ this.height = 'auto';
3724
4029
  /**
3725
4030
  * Offset the menu on the x-axis.
3726
4031
  */
@@ -3746,6 +4051,7 @@ class Dropdown extends ComponentRender {
3746
4051
  this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
3747
4052
  this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
3748
4053
  this.hover = this.getInitValue('hover', props.hover, this.hover);
4054
+ this.height = this.getInitValue('height', props.height, this.height);
3749
4055
  this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
3750
4056
  this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
3751
4057
  this.maxWidth = this.getInitValue('maxWidth', props.maxWidth, this.maxWidth);
@@ -3867,7 +4173,7 @@ class FileInput extends TextInput {
3867
4173
  * Triggered when a removable chip is clicked
3868
4174
  * @param event DOM event
3869
4175
  * @param index Chip index
3870
- * @param element HTMLElement
4176
+ * @param element any
3871
4177
  */
3872
4178
  chipClick(event, index, element) {
3873
4179
  event.stopImmediatePropagation();
@@ -4007,12 +4313,18 @@ class Frame extends ComponentRender {
4007
4313
  this.override = {};
4008
4314
  this.cache = false;
4009
4315
  this.cacheDuration = 2 * 60 * 60 * 1000;
4316
+ this.height = 'auto';
4317
+ this.maxHeight = 'none';
4318
+ this.minHeight = 'none';
4010
4319
  this.headerName = 'sw-fetched-on';
4011
4320
  this.path = props.path;
4012
4321
  this.local = props.local === true;
4013
4322
  this.override = props.override || this.override;
4014
4323
  this.cache = props.cache || this.cache;
4015
4324
  this.cacheDuration = this.getInitValue('cacheDuration', props.cacheDuration, this.cacheDuration);
4325
+ this.height = this.getInitValue('height', props.height, this.height);
4326
+ this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
4327
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
4016
4328
  this.createAccessors();
4017
4329
  this.getMetadata();
4018
4330
  }
@@ -4149,6 +4461,8 @@ class Column extends Component {
4149
4461
  this.componentProps = {};
4150
4462
  /** column style property */
4151
4463
  this.style = {};
4464
+ /** Type of XLS */
4465
+ this.xlsType = '';
4152
4466
  /* Stores lookup data to prevent unnecessary requests */
4153
4467
  this.lookupData = {};
4154
4468
  /* Stores lookup data count (only to be reactive and force column update) */
@@ -4191,6 +4505,7 @@ class Column extends Component {
4191
4505
  this.loading = this.getInitValue('loading', props.loading, this.loading);
4192
4506
  this.style = this.getInitValue('style', props.style, this.style);
4193
4507
  this.componentProps = this.getInitValue('componentProps', props.componentProps, this.componentProps);
4508
+ this.xlsType = this.getInitValue('xlsType', props.xlsType, this.xlsType);
4194
4509
  this.conditions = this.getInitValue('conditions', props.conditions, this.conditions);
4195
4510
  this.createConditions();
4196
4511
  this.createActionConditions();
@@ -4529,7 +4844,7 @@ class GridColumn extends Column {
4529
4844
  if (this.componentProps.dataValueOut && ((_a = component.datasource) === null || _a === void 0 ? void 0 : _a.currentRow)) {
4530
4845
  this.componentProps.dataValueOut.forEach((columns) => {
4531
4846
  const { column, columnOnGrid } = columns;
4532
- if (!isEqual(newRow.originalRow[columnOnGrid], component.datasource.currentRow[column])) {
4847
+ if (!Utils.isEqual(newRow.originalRow[columnOnGrid], component.datasource.currentRow[column])) {
4533
4848
  newRow[`${columnOnGrid}_original`] = newRow.originalRow[columnOnGrid];
4534
4849
  newRow[columnOnGrid] = component.datasource.currentRow[column];
4535
4850
  }
@@ -4543,7 +4858,7 @@ class GridColumn extends Column {
4543
4858
  }
4544
4859
  }
4545
4860
  FormatterParserProvider.registerFormatter('column_ZdSelect', ({ column, value, row, componentProps, }) => {
4546
- if (!value)
4861
+ if (value === null || value === undefined)
4547
4862
  return '';
4548
4863
  const { dataText, formatterDataText, dataTextSeparator, dataValue, } = componentProps;
4549
4864
  let currentRow = row;
@@ -4591,7 +4906,7 @@ FormatterParserProvider.registerFormatter('column_ZdSelect', ({ column, value, r
4591
4906
  });
4592
4907
  return dataTextNames.reduce((result, columnName, index) => {
4593
4908
  const rowCell = currentRow[columnName];
4594
- if (rowCell) {
4909
+ if (rowCell !== undefined && rowCell !== null) {
4595
4910
  const separator = index > 0 ? (dataTextSeparator || ' | ') : '';
4596
4911
  const mask = masks[index];
4597
4912
  const maskValue = typeof mask === 'function' ? mask(rowCell) : mask;
@@ -5010,15 +5325,36 @@ class GridEditable extends Grid {
5010
5325
  * @private
5011
5326
  */
5012
5327
  this.editedRows = {};
5328
+ /**
5329
+ * Rows with newRowIdentifier
5330
+ * @private
5331
+ */
5332
+ this.addedRows = {};
5013
5333
  /**
5014
5334
  * Invalid inline components
5015
5335
  * @private
5016
5336
  */
5017
5337
  this.invalidComponents = {};
5338
+ this.cancelEditedRowsKeyMapping = {
5339
+ esc: {
5340
+ event: this.cancelEditedRows.bind(this),
5341
+ stop: true,
5342
+ input: true,
5343
+ active: true,
5344
+ },
5345
+ };
5018
5346
  this.newRowIdentifier = '__added_row';
5019
5347
  this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
5020
5348
  this.createAccessors();
5021
5349
  }
5350
+ onMounted(element) {
5351
+ super.onMounted(element);
5352
+ KeyMap.bind(this.cancelEditedRowsKeyMapping, this, element);
5353
+ }
5354
+ onBeforeDestroy() {
5355
+ super.onBeforeDestroy();
5356
+ KeyMap.unbind(this.cancelEditedRowsKeyMapping, this);
5357
+ }
5022
5358
  /**
5023
5359
  * Get Grid columns objects
5024
5360
  * @param columns Grid columns parameter
@@ -5188,7 +5524,7 @@ class GridEditable extends Grid {
5188
5524
  changeEditableComponent(column, row, value, component) {
5189
5525
  const key = row[this.datasource.uniqueKey];
5190
5526
  const columnName = column.name;
5191
- if (!isEqual(value, row[columnName])) {
5527
+ if (!Utils.isEqual(value, row[columnName])) {
5192
5528
  const newRow = {};
5193
5529
  newRow[key] = Object.assign({}, this.editedRows[key]);
5194
5530
  newRow[key].originalRow = Object.assign({}, row);
@@ -5234,6 +5570,14 @@ class GridEditable extends Grid {
5234
5570
  * Cancels all edited rows and enable grid components
5235
5571
  */
5236
5572
  cancelEditedRows() {
5573
+ return __awaiter(this, void 0, void 0, function* () {
5574
+ yield this.removeAddedRows();
5575
+ this.editing = false;
5576
+ this.editedRows = {};
5577
+ this.invalidComponents = {};
5578
+ });
5579
+ }
5580
+ removeAddedRows() {
5237
5581
  return __awaiter(this, void 0, void 0, function* () {
5238
5582
  const { data } = this.datasource;
5239
5583
  data.forEach((row, index) => {
@@ -5242,21 +5586,26 @@ class GridEditable extends Grid {
5242
5586
  }
5243
5587
  });
5244
5588
  yield this.datasource.updateData(data);
5245
- this.editing = false;
5246
- this.editedRows = {};
5247
- this.invalidComponents = {};
5248
5589
  });
5249
5590
  }
5591
+ addDataRow(row) {
5592
+ if (this.addedRows[row[this.datasource.uniqueKey]])
5593
+ this.datasource.post(row);
5594
+ else
5595
+ this.datasource.put(row);
5596
+ }
5250
5597
  /**
5251
5598
  * Saves all edited rows if they are valid
5252
5599
  * @throws Will throw when it finds an invalid row
5253
5600
  */
5254
5601
  saveEditedRows() {
5255
5602
  return __awaiter(this, void 0, void 0, function* () {
5256
- const response = yield Promise.all(this.getEditedRows().map((row) => this.datasource.put(row)));
5603
+ yield this.removeAddedRows();
5604
+ const response = yield Promise.all(this.getEditedRows().map((row) => this.addDataRow(row)));
5257
5605
  this.editing = false;
5258
5606
  this.editedRows = {};
5259
5607
  this.invalidComponents = {};
5608
+ this.addedRows = {};
5260
5609
  yield this.datasource.get();
5261
5610
  return response;
5262
5611
  });
@@ -5268,8 +5617,11 @@ class GridEditable extends Grid {
5268
5617
  getEditedRows() {
5269
5618
  const editedRows = [];
5270
5619
  Object.keys(this.editedRows).forEach((key) => {
5620
+ this.addedRows = {};
5271
5621
  const row = Object.assign(Object.assign({}, this.editedRows[key].originalRow), this.editedRows[key]);
5272
5622
  delete row.originalRow;
5623
+ if (row[this.newRowIdentifier])
5624
+ this.addedRows[key] = row;
5273
5625
  delete row[this.newRowIdentifier];
5274
5626
  Object.keys(row).forEach((attr) => {
5275
5627
  if (Object.prototype.hasOwnProperty.call(row, `${attr}_original`)) {
@@ -6308,10 +6660,10 @@ class Select extends TextInput {
6308
6660
  }
6309
6661
  }
6310
6662
  FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTextSeparator = ' | ', }) => {
6311
- if (!value && value !== 0) {
6663
+ if (value === null || value === undefined) {
6312
6664
  return null;
6313
6665
  }
6314
- if (typeof value === 'string' || typeof value === 'number') {
6666
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
6315
6667
  return value;
6316
6668
  }
6317
6669
  const dataTextArr = Array.isArray(dataText) ? dataText : [dataText];
@@ -6334,7 +6686,7 @@ FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTe
6334
6686
  }
6335
6687
  });
6336
6688
  return dataTextNames.reduce((result, column, index) => {
6337
- if (value[column]) {
6689
+ if (value[column] !== null && value[column] !== undefined) {
6338
6690
  const separator = index > 0 ? dataTextSeparator : '';
6339
6691
  let masked = value[column];
6340
6692
  if (masks[index]) {
@@ -6553,6 +6905,18 @@ class List extends ComponentRender {
6553
6905
  * Will only collapse when explicitly closed.
6554
6906
  */
6555
6907
  this.expand = false;
6908
+ /**
6909
+ * Sets the height for the component.
6910
+ */
6911
+ this.height = 'auto';
6912
+ /**
6913
+ * Sets the maxHeight for the component.
6914
+ */
6915
+ this.maxHeight = 'none';
6916
+ /**
6917
+ * Sets the minHeight for the component.
6918
+ */
6919
+ this.minHeight = 'none';
6556
6920
  this.dark = this.getInitValue('dark', props.dark, this.dark);
6557
6921
  this.dense = this.getInitValue('dense', props.dense, this.dense);
6558
6922
  this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
@@ -6564,6 +6928,9 @@ class List extends ComponentRender {
6564
6928
  this.color = this.getInitValue('color', props.color, this.color);
6565
6929
  this.elevation = this.getInitValue('elevation', props.elevation, this.elevation);
6566
6930
  this.expand = this.getInitValue('expand', props.expand, this.expand);
6931
+ this.height = this.getInitValue('height', props.height, this.height);
6932
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
6933
+ this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
6567
6934
  this.createAccessors();
6568
6935
  }
6569
6936
  /**
@@ -6657,6 +7024,41 @@ class ListGroup extends ListItem {
6657
7024
  }
6658
7025
  }
6659
7026
 
7027
+ class Loading extends Component {
7028
+ /*
7029
+ * Creates a new Loading Overlay
7030
+ * @param props Modal structure
7031
+ */
7032
+ constructor(props) {
7033
+ super(props);
7034
+ /**
7035
+ * text to show in Loader Overlay
7036
+ */
7037
+ this.text = 'Loading';
7038
+ this.isVisible = false;
7039
+ this.zIndex = 999;
7040
+ this.text = this.getInitValue('text', props.text, this.text);
7041
+ this.zIndex = this.getInitValue('zIndex', props.zIndex, this.zIndex);
7042
+ this.defaultText = this.text;
7043
+ }
7044
+ /**
7045
+ * Displays overlay
7046
+ */
7047
+ show(text) {
7048
+ if (text)
7049
+ this.text = text;
7050
+ else
7051
+ this.text = this.defaultText;
7052
+ this.isVisible = true;
7053
+ }
7054
+ /**
7055
+ * Close overlay
7056
+ */
7057
+ hide() {
7058
+ this.isVisible = false;
7059
+ }
7060
+ }
7061
+
6660
7062
  /**
6661
7063
  * Base class for Login component.
6662
7064
  */
@@ -7013,6 +7415,8 @@ class Menu extends ComponentRender {
7013
7415
  this.filteredMenuItems = [];
7014
7416
  /** Search value */
7015
7417
  this.searchValue = '';
7418
+ /** Store the current item focused */
7419
+ this.currentItem = null;
7016
7420
  this.app = this.getInitValue('app', props.app, this.app);
7017
7421
  this.clipped = this.getInitValue('clipped', props.clipped, this.clipped);
7018
7422
  this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
@@ -7245,7 +7649,7 @@ class Menu extends ComponentRender {
7245
7649
  if (item.component === 'ZdMenuGroup') {
7246
7650
  this.searchItems(item.items);
7247
7651
  }
7248
- else if (normalize(I18n.translate(item.label)).indexOf(normalize(this.searchValue)) !== -1) {
7652
+ else if (Utils.normalize(I18n.translate(item.label)).indexOf(Utils.normalize(this.searchValue)) !== -1) {
7249
7653
  this.filteredMenuItems.push(item);
7250
7654
  }
7251
7655
  }
@@ -7288,9 +7692,21 @@ class MenuLink extends ComponentRender {
7288
7692
  */
7289
7693
  click(event) {
7290
7694
  let preventDefault = false;
7291
- preventDefault = this.callEvent('click', { event, component: this });
7695
+ preventDefault = this.callEvent('click', {
7696
+ event: (event || new MouseEvent('click')),
7697
+ component: this,
7698
+ });
7292
7699
  if (preventDefault) {
7293
- event.preventDefault();
7700
+ event === null || event === void 0 ? void 0 : event.preventDefault();
7701
+ }
7702
+ this.setFocus();
7703
+ }
7704
+ /**
7705
+ * Event triggered when this item is focus
7706
+ */
7707
+ focus() {
7708
+ if (this.parentMenu) {
7709
+ this.parentMenu.currentItem = this;
7294
7710
  }
7295
7711
  }
7296
7712
  /**
@@ -7359,6 +7775,29 @@ class MenuGroup extends ComponentRender {
7359
7775
  close() {
7360
7776
  this.opened = false;
7361
7777
  }
7778
+ /**
7779
+ * Event triggered when this item is clicked
7780
+ */
7781
+ click(event) {
7782
+ let preventDefault = false;
7783
+ preventDefault = this.callEvent('click', {
7784
+ event: (event || new MouseEvent('click')),
7785
+ component: this,
7786
+ });
7787
+ if (preventDefault) {
7788
+ event === null || event === void 0 ? void 0 : event.preventDefault();
7789
+ }
7790
+ this.setFocus();
7791
+ }
7792
+ /**
7793
+ * Event triggered when this item is focus
7794
+ */
7795
+ focus(event) {
7796
+ this.callEvent('focus', { event, component: this });
7797
+ if (this.parentMenu) {
7798
+ this.parentMenu.currentItem = this;
7799
+ }
7800
+ }
7362
7801
  }
7363
7802
 
7364
7803
  /**
@@ -7436,10 +7875,20 @@ class Modal extends Component {
7436
7875
  * If true the modal won't close when overlay is clicked
7437
7876
  */
7438
7877
  this.persistent = false;
7878
+ /**
7879
+ * Allows modal to be dragged around in the screen
7880
+ */
7881
+ this.draggable = false;
7882
+ /**
7883
+ * Css selector of the drag handle
7884
+ */
7885
+ this.dragHandle = '';
7439
7886
  this.title = this.getInitValue('title', props.title, this.title);
7440
7887
  this.fullscreen = this.getInitValue('fullscreen', props.fullscreen, this.fullscreen);
7441
7888
  this.grid = this.getInitValue('grid', props.grid, this.grid);
7442
7889
  this.persistent = this.getInitValue('persistent', props.persistent, this.persistent);
7890
+ this.draggable = this.getInitValue('draggable', props.draggable, this.draggable);
7891
+ this.dragHandle = this.getInitValue('dragHandle', props.dragHandle, this.dragHandle);
7443
7892
  this.isVisible = false;
7444
7893
  this.createAccessors();
7445
7894
  }
@@ -8881,8 +9330,13 @@ class SelectTreeMultiple extends SelectTree {
8881
9330
  */
8882
9331
  this.selectedNodes = [];
8883
9332
  this.selectValue = [];
9333
+ /**
9334
+ * Changes the behavior of checked nodes that will be displayed in the array of values
9335
+ */
9336
+ this.valueConsistsOf = 'LEAF_PRIORITY';
8884
9337
  this.flat = this.getInitValue('flat', props.flat, this.flat);
8885
9338
  this.limit = this.getInitValue('limit', props.limit, this.limit);
9339
+ this.valueConsistsOf = this.getInitValue('valueConsistsOf', props.valueConsistsOf, this.valueConsistsOf);
8886
9340
  this.createAccessors();
8887
9341
  }
8888
9342
  /**
@@ -9306,6 +9760,7 @@ class Tabs extends ComponentRender {
9306
9760
  this.tabs = [];
9307
9761
  this.tabs = this.getTabs(props.tabs || []);
9308
9762
  this.activeTab = this.getInitValue('activeTab', props.activeTab, this.activeTab);
9763
+ this.height = this.getInitValue('height', props.height, this.height);
9309
9764
  this.createAccessors();
9310
9765
  }
9311
9766
  getTabs(tabs) {
@@ -9701,8 +10156,11 @@ class Time extends TextInput {
9701
10156
  || I18n.translate('VALIDATION_TIME_NOT_ALLOWED');
9702
10157
  }
9703
10158
  click(event) {
9704
- this.callEvent('click', { event, component: this });
9705
- if (!event.defaultPrevented) {
10159
+ this.callEvent('click', {
10160
+ event: (event || new MouseEvent('click')),
10161
+ component: this,
10162
+ });
10163
+ if (!(event === null || event === void 0 ? void 0 : event.defaultPrevented)) {
9706
10164
  this.showTimePicker = !this.showTimePicker;
9707
10165
  }
9708
10166
  }
@@ -9828,6 +10286,10 @@ class Tree extends ComponentRender {
9828
10286
  * Components that will be rendered on toolbar slot
9829
10287
  */
9830
10288
  this.toolbarSlot = [];
10289
+ /**
10290
+ * Components that will be rendered on title slot
10291
+ */
10292
+ this.titleSlot = [];
9831
10293
  /** Datasource parent field */
9832
10294
  this.parentField = '';
9833
10295
  /** Datasource title field */
@@ -9838,11 +10300,21 @@ class Tree extends ComponentRender {
9838
10300
  * Defines if the tree will be opened or not (true/false) or if it should open only until a specific level
9839
10301
  */
9840
10302
  this.openLevelOnLoad = false;
10303
+ /**
10304
+ * Allow row check
10305
+ */
10306
+ this.checkbox = false;
9841
10307
  /**
9842
10308
  * Defines if should wait and not execute GET method when Datasource is created
9843
10309
  */
9844
10310
  this.lazyLoad = true;
9845
- this.nodes = props.nodes || this.nodes;
10311
+ /**
10312
+ * Dictionary of nodePath ponting to Dictionary of path pointing to the condition (applied) return value
10313
+ */
10314
+ this.appliedConditions = {};
10315
+ /* Conditions of tree */
10316
+ this.factoredConditions = {};
10317
+ this.nodes = this.initNodes(props.nodes || this.nodes);
9846
10318
  this.itemIconName = this.getInitValue('itemIconName', props.itemIconName, this.itemIconName);
9847
10319
  this.groupIconName = this.getInitValue('groupIconName', props.groupIconName, this.groupIconName);
9848
10320
  this.openedIconName = this.getInitValue('openedIconName', props.openedIconName, this.openedIconName);
@@ -9853,8 +10325,16 @@ class Tree extends ComponentRender {
9853
10325
  this.titleField = this.getInitValue('titleField', props.titleField, this.titleField);
9854
10326
  this.dataField = this.getInitValue('dataField', props.dataField, this.dataField);
9855
10327
  this.openLevelOnLoad = this.getInitValue('openLevelOnLoad', props.openLevelOnLoad, this.openLevelOnLoad);
10328
+ this.checkbox = this.getInitValue('checkbox', props.checkbox, this.checkbox);
9856
10329
  this.afterTitleSlot = props.afterTitleSlot || this.afterTitleSlot;
9857
10330
  this.toolbarSlot = props.toolbarSlot || this.toolbarSlot;
10331
+ this.titleSlot = props.titleSlot || this.titleSlot;
10332
+ if (props.afterTitleSlot) {
10333
+ this.createConditions([props.afterTitleSlot]);
10334
+ }
10335
+ if (props.titleSlot) {
10336
+ this.createConditions(props.titleSlot);
10337
+ }
9858
10338
  if (props.datasource && Object.keys(props.datasource).length) {
9859
10339
  this.lazyLoad = props.datasource.lazyLoad !== false;
9860
10340
  this.datasource = DatasourceFactory.factory(Object.assign(Object.assign({}, props.datasource), { searchIn: props.datasource.searchIn || [this.titleField, this.dataField].filter(Boolean), lazyLoad: true, loadAll: true }));
@@ -9862,6 +10342,12 @@ class Tree extends ComponentRender {
9862
10342
  }
9863
10343
  this.createAccessors();
9864
10344
  }
10345
+ /**
10346
+ * Initialize all the properties of the declared nodes (reactivity)
10347
+ */
10348
+ initNodes(nodes) {
10349
+ 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 || []) })));
10350
+ }
9865
10351
  /** Nodes */
9866
10352
  get nodes() {
9867
10353
  return this.nodesValue;
@@ -9872,6 +10358,16 @@ class Tree extends ComponentRender {
9872
10358
  }
9873
10359
  this.nodesValue = value;
9874
10360
  }
10361
+ getCheckedNodes() {
10362
+ const selectedNodes = [];
10363
+ this.tree.traverse((node) => {
10364
+ const instanceNode = this.getNode(node.path || []);
10365
+ if (instanceNode === null || instanceNode === void 0 ? void 0 : instanceNode.isChecked) {
10366
+ selectedNodes.push(instanceNode);
10367
+ }
10368
+ });
10369
+ return selectedNodes;
10370
+ }
9875
10371
  /** Returns the selected nodes */
9876
10372
  get selectedNodes() {
9877
10373
  var _a;
@@ -9970,16 +10466,87 @@ class Tree extends ComponentRender {
9970
10466
  setTree(tree) {
9971
10467
  this.tree = tree;
9972
10468
  }
9973
- /** Get the conditions function to be applied to each column depending on the node */
9974
- getConditions(conditions) {
9975
- const cond = Event.factory(conditions);
9976
- return (node) => {
9977
- const appliedConditions = {};
9978
- Object.keys(conditions).forEach((condition) => {
9979
- appliedConditions[condition] = cond[condition](node);
9980
- });
9981
- return appliedConditions;
9982
- };
10469
+ /**
10470
+ * Return plain conditions object
10471
+ * @param conditions Conditions object
10472
+ * @param parentPath Path to parent property
10473
+ */
10474
+ getPlainConditions(conditions, parentPath = '') {
10475
+ let plainData = {};
10476
+ Object.keys(conditions).forEach((key) => {
10477
+ const fullKey = parentPath ? [parentPath, key].join('.') : key;
10478
+ if (typeof conditions[key] === 'object') {
10479
+ plainData = Object.assign(Object.assign({}, plainData), this.getPlainConditions(conditions[key], fullKey));
10480
+ }
10481
+ else {
10482
+ plainData[fullKey] = conditions[key];
10483
+ }
10484
+ });
10485
+ return plainData;
10486
+ }
10487
+ createConditions(children, parentPath = '') {
10488
+ children.forEach((child) => {
10489
+ const path = parentPath ? `${parentPath}.${child.name}` : child.name;
10490
+ if (child.conditions) {
10491
+ const plainConditions = this.getPlainConditions(child.conditions);
10492
+ this.factoredConditions[path] = Event.factory(plainConditions);
10493
+ }
10494
+ if (child.children) {
10495
+ this.createConditions(child.children, path);
10496
+ }
10497
+ });
10498
+ }
10499
+ applyCondition(node, factoredConditions) {
10500
+ const appliedConditions = {};
10501
+ Object.keys(factoredConditions).forEach((condition) => {
10502
+ const conditionFunction = factoredConditions[condition];
10503
+ set(appliedConditions, condition, conditionFunction(node));
10504
+ });
10505
+ return appliedConditions;
10506
+ }
10507
+ applyChildCondition(node, factoredConditions = this.factoredConditions) {
10508
+ const appliedConditions = {};
10509
+ Object.keys(factoredConditions).forEach((comp) => {
10510
+ const conditions = this.factoredConditions[comp];
10511
+ appliedConditions[comp] = Object.assign({}, this.applyCondition(node, conditions));
10512
+ });
10513
+ return appliedConditions;
10514
+ }
10515
+ reapplyConditions(node) {
10516
+ const nodePath = node.pathStr;
10517
+ if (!nodePath)
10518
+ return {};
10519
+ const appliedConditions = Object.assign({}, this.appliedConditions);
10520
+ appliedConditions[nodePath] = this.applyChildCondition(node);
10521
+ this.appliedConditions = appliedConditions;
10522
+ return this.appliedConditions[nodePath];
10523
+ }
10524
+ getSlotComponent(slot, node, parentPath = '') {
10525
+ const slotArr = Array.isArray(slot) ? slot : [slot];
10526
+ const newComponents = [];
10527
+ slotArr.forEach((component) => {
10528
+ var _a;
10529
+ if (!component)
10530
+ return;
10531
+ const nodePath = node.pathStr;
10532
+ if (!nodePath)
10533
+ return;
10534
+ const compName = component.name;
10535
+ const instanceName = `${compName}_${nodePath}`;
10536
+ const path = parentPath ? `${parentPath}.${compName}` : compName;
10537
+ const newComponent = merge({}, component, (_a = this.appliedConditions[nodePath]) === null || _a === void 0 ? void 0 : _a[path]);
10538
+ const newChildren = this.getSlotComponent(newComponent.children || [], node, path);
10539
+ newComponent.name = instanceName;
10540
+ newComponent.children = newChildren;
10541
+ try {
10542
+ Metadata.updateInstance(instanceName, newComponent);
10543
+ }
10544
+ catch (e) {
10545
+ // do nothing
10546
+ }
10547
+ newComponents.push(newComponent);
10548
+ });
10549
+ return newComponents;
9983
10550
  }
9984
10551
  /** Triggers when dragging nodes have been dropped */
9985
10552
  nodeDrop(nodes, position, event, element) {
@@ -10007,6 +10574,12 @@ class Tree extends ComponentRender {
10007
10574
  event, element, component: this, node,
10008
10575
  });
10009
10576
  }
10577
+ /** Triggers when a node has been checked/unchecked */
10578
+ nodeCheck(node, event, element) {
10579
+ this.callEvent('onNodeCheck', {
10580
+ event, element, component: this, node,
10581
+ });
10582
+ }
10010
10583
  clearSelection(nodes) {
10011
10584
  const nodesArray = nodes || this.nodes;
10012
10585
  nodesArray.forEach((node) => {
@@ -10016,6 +10589,19 @@ class Tree extends ComponentRender {
10016
10589
  }
10017
10590
  });
10018
10591
  }
10592
+ getNode(path) {
10593
+ return this.searchPath(this.nodes, path);
10594
+ }
10595
+ getParentNode(node) {
10596
+ var _a;
10597
+ return this.getNode(((_a = node.path) === null || _a === void 0 ? void 0 : _a.slice(0, -1)) || []);
10598
+ }
10599
+ searchPath(nodes, path) {
10600
+ const currentNode = (path[0] > -1 && path[0] < nodes.length) ? nodes[path[0]] : undefined;
10601
+ if (currentNode && path.length > 1)
10602
+ return this.searchPath(currentNode.children || [], path.slice(1));
10603
+ return currentNode;
10604
+ }
10019
10605
  }
10020
10606
 
10021
10607
  /**
@@ -10194,9 +10780,25 @@ class TreeGridEditable extends TreeGrid {
10194
10780
  * Enter edit mode on double click
10195
10781
  */
10196
10782
  this.doubleClickEdit = false;
10783
+ this.cancelEditedRowsKeyMapping = {
10784
+ esc: {
10785
+ event: this.cancelEditedRows.bind(this),
10786
+ stop: true,
10787
+ input: true,
10788
+ active: true,
10789
+ },
10790
+ };
10197
10791
  this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
10198
10792
  this.createAccessors();
10199
10793
  }
10794
+ onMounted(element) {
10795
+ super.onMounted(element);
10796
+ KeyMap.bind(this.cancelEditedRowsKeyMapping, this, element);
10797
+ }
10798
+ onBeforeDestroy() {
10799
+ super.onBeforeDestroy();
10800
+ KeyMap.unbind(this.cancelEditedRowsKeyMapping, this);
10801
+ }
10200
10802
  /**
10201
10803
  * Get Grid columns objects
10202
10804
  * @param columns Grid columns parameter
@@ -10365,7 +10967,7 @@ class TreeGridEditable extends TreeGrid {
10365
10967
  changeEditableComponent(column, row, value, component) {
10366
10968
  const key = row[this.datasource.uniqueKey];
10367
10969
  const columnName = column.name;
10368
- if (!isEqual(value, row[columnName])) {
10970
+ if (!Utils.isEqual(value, row[columnName])) {
10369
10971
  const newRow = {};
10370
10972
  newRow[key] = Object.assign({}, this.editedRows[key]);
10371
10973
  newRow[key].originalRow = Object.assign({}, row);
@@ -10639,7 +11241,7 @@ Icons.mdiIcons = {
10639
11241
  tableColumns: 'mdi-table-headers-eye',
10640
11242
  unfold: 'mdi-unfold-more-horizontal',
10641
11243
  warning: 'mdi-exclamation',
10642
- zoom: 'mdi-magnify-scan',
11244
+ zoom: 'mdi-magnify',
10643
11245
  zoomIn: 'mdi-plus-circle-outline',
10644
11246
  zoomPanning: 'mdi-hand-back-right-outline',
10645
11247
  zoomOut: 'mdi-minus-circle-outline',
@@ -10737,11 +11339,23 @@ const defaultTheme = {
10737
11339
  zeedhi: {
10738
11340
  light: {
10739
11341
  'font-color': 'var(--v-grey-darken2)',
10740
- 'background-base': '#F6F6F6',
11342
+ 'background-base': '#FDFDFD',
11343
+ 'background-base-2': '#F6F6F6',
11344
+ 'background-base-3': '#EEE',
11345
+ 'scrollbar-track': 'var(--v-grey-lighten5)',
11346
+ 'scrollbar-thumb': 'var(--v-grey-lighten4)',
11347
+ 'badge-background-color': '#f44336',
11348
+ 'badge-text-color': '#fff',
10741
11349
  },
10742
11350
  dark: {
10743
11351
  'font-color': 'var(--v-grey-lighten3)',
10744
- 'background-base': '#121212',
11352
+ 'background-base': '#1E1E1E',
11353
+ 'background-base-2': 'var(--v-grey-darken2)',
11354
+ 'background-base-3': 'var(--v-grey-darken4)',
11355
+ 'scrollbar-track': 'var(--v-grey-darken3)',
11356
+ 'scrollbar-thumb': 'var(--v-grey-base)',
11357
+ 'badge-background-color': '#f44336',
11358
+ 'badge-text-color': '#fff',
10745
11359
  },
10746
11360
  variables: {
10747
11361
  'default-padding': '16px',
@@ -10759,8 +11373,6 @@ const defaultTheme = {
10759
11373
  'font-body4-weight': '500',
10760
11374
  'font-caption-size': '11px',
10761
11375
  'font-caption-weight': '400',
10762
- 'badge-background-color': '#f44336',
10763
- 'badge-text-color': '#fff',
10764
11376
  },
10765
11377
  },
10766
11378
  };
@@ -11015,6 +11627,7 @@ class BaseReport {
11015
11627
  sequence: index,
11016
11628
  format: this.getFormatOfColumn(col),
11017
11629
  size: `${size}%`,
11630
+ xlsType: col.xlsType,
11018
11631
  };
11019
11632
  return Object.assign(Object.assign({}, result), { [col.name]: row });
11020
11633
  }, {});