@zeedhi/common 1.42.0 → 1.43.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.
@@ -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';
@@ -437,6 +437,26 @@ class ApexChart extends ComponentRender {
437
437
  reset: 'zoomReset',
438
438
  },
439
439
  },
440
+ events: {
441
+ animationEnd: this.animationEndEvent.bind(this),
442
+ beforeMount: this.beforeMountEvent.bind(this),
443
+ mounted: this.mountedEvent.bind(this),
444
+ updated: this.updatedEvent.bind(this),
445
+ click: this.clickEvent.bind(this),
446
+ mouseMove: this.mouseMoveEvent.bind(this),
447
+ mouseLeave: this.mouseLeaveEvent.bind(this),
448
+ legendClick: this.legendClickEvent.bind(this),
449
+ markerClick: this.markerClickEvent.bind(this),
450
+ selection: this.selectionEvent.bind(this),
451
+ dataPointSelection: this.dataPointSelectionEvent.bind(this),
452
+ dataPointMouseEnter: this.dataPointMouseEnterEvent.bind(this),
453
+ dataPointMouseLeave: this.dataPointMouseLeaveEvent.bind(this),
454
+ beforeZoom: this.beforeZoomEvent.bind(this),
455
+ beforeResetZoom: this.beforeResetZoomEvent.bind(this),
456
+ zoomed: this.zoomedEvent.bind(this),
457
+ scrolled: this.scrolledEvent.bind(this),
458
+ brushScrolled: this.brushScrolledEvent.bind(this),
459
+ },
440
460
  },
441
461
  };
442
462
  this.chartType = this.getInitValue('chartType', props.chartType, this.chartType);
@@ -479,6 +499,223 @@ class ApexChart extends ComponentRender {
479
499
  }
480
500
  return Promise.resolve();
481
501
  }
502
+ /**
503
+ * Fires when the chart’s initial animation is finished
504
+ * @param chartContext
505
+ * @param config
506
+ * @param element DOM Element
507
+ */
508
+ animationEndEvent(chartContext, options) {
509
+ this.callEvent('chartAnimationEnd', { component: this, chartContext, options });
510
+ }
511
+ /**
512
+ * Fires before the chart has been drawn on screen
513
+ * @param chartContext
514
+ * @param config
515
+ * @param element DOM Element
516
+ */
517
+ beforeMountEvent(chartContext, config) {
518
+ this.callEvent('chartBeforeMount', {
519
+ component: this, chartContext, config,
520
+ });
521
+ }
522
+ /**
523
+ * Fires after the chart has been drawn on screen
524
+ * @param chartContext
525
+ * @param config
526
+ * @param element DOM Element
527
+ */
528
+ mountedEvent(chartContext, config) {
529
+ this.callEvent('chartMounted', {
530
+ component: this, chartContext, config,
531
+ });
532
+ }
533
+ /**
534
+ * Fires when the chart has been dynamically updated either with
535
+ * updateOptions() or updateSeries() functions
536
+ * @param chartContext
537
+ * @param config
538
+ * @param element DOM Element
539
+ */
540
+ updatedEvent(chartContext, config) {
541
+ this.callEvent('chartUpdated', {
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 event Event that triggered the click event
549
+ * @param chartContext
550
+ * @param config
551
+ * @param element DOM Element
552
+ */
553
+ clickEvent(event, chartContext, config) {
554
+ this.callEvent('chartClick', {
555
+ event, component: this, chartContext, config,
556
+ });
557
+ }
558
+ /**
559
+ * Fires when user moves mouse on any area of the chart.
560
+ * @param event Event that triggered the click event
561
+ * @param chartContext
562
+ * @param config
563
+ * @param element DOM Element
564
+ */
565
+ mouseMoveEvent(event, chartContext, config) {
566
+ this.callEvent('chartMouseMove', {
567
+ event, component: this, chartContext, config,
568
+ });
569
+ }
570
+ /**
571
+ * Fires when user moves mouse on any area of the chart.
572
+ * @param event Event that triggered the mouse leave
573
+ * @param chartContext
574
+ * @param config New config
575
+ * @param element DOM Element
576
+ */
577
+ mouseLeaveEvent(event, chartContext, config) {
578
+ this.callEvent('chartMouseLeave', {
579
+ event, component: this, chartContext, config,
580
+ });
581
+ }
582
+ /**
583
+ * Fires when user moves mouse on any area of the chart.
584
+ * @param chartContext
585
+ * @param seriesIndex
586
+ * @param config
587
+ * @param element DOM Element
588
+ */
589
+ legendClickEvent(chartContext, seriesIndex, config) {
590
+ this.callEvent('chartLegendClick', {
591
+ component: this, chartContext, seriesIndex, config,
592
+ });
593
+ }
594
+ /**
595
+ * Fires when user moves mouse on any area of the chart.
596
+ * @param event Event that triggered the marker click
597
+ * @param chartContext
598
+ * @param option New config
599
+ * @param element DOM Element
600
+ */
601
+ markerClickEvent(event, chartContext, config) {
602
+ this.callEvent('chartMarkerClick', {
603
+ event, component: this, chartContext, config,
604
+ });
605
+ }
606
+ /**
607
+ * Fires when user selects rect using the selection tool.
608
+ * The second argument
609
+ * @param chartContext
610
+ * @param config contains the yaxis and xaxis coordinates where user made the selection
611
+ * @param element DOM Element
612
+ */
613
+ selectionEvent(chartContext, config) {
614
+ this.callEvent('chartSelection', {
615
+ component: this, chartContext, config,
616
+ });
617
+ }
618
+ /**
619
+ * Fires when user clicks on a datapoint (bar/column/marker/bubble/donut-slice).
620
+ * @param event Event that triggered when user clicks on a datapoint
621
+ * @param chartContext
622
+ * @param config The config object, also includes additional information like
623
+ * which dataPointIndex was selected of which series.
624
+ * @param element DOM Element
625
+ */
626
+ dataPointSelectionEvent(event, chartContext, config) {
627
+ this.callEvent('chartDataPointSelection', {
628
+ event, component: this, chartContext, config,
629
+ });
630
+ }
631
+ /**
632
+ * Fires when user clicks on a datapoint (bar/column/marker/bubble/donut-slice).
633
+ * @param event Event that triggered when user’s mouse enter on a datapoint
634
+ * @param chartContext
635
+ * @param config The config object, also includes additional information like
636
+ * which dataPointIndex was hovered of particular series.
637
+ * @param element DOM Element
638
+ */
639
+ dataPointMouseEnterEvent(event, chartContext, config) {
640
+ this.callEvent('chartDataPointMouseEnter', {
641
+ event, component: this, chartContext, config,
642
+ });
643
+ }
644
+ /**
645
+ * MouseLeave event for a datapoint (bar/column/marker/bubble/donut-slice).
646
+ * @param event Event that triggered the beforeSlide event
647
+ * @param chartContext
648
+ * @param config
649
+ * @param element DOM Element
650
+ */
651
+ dataPointMouseLeaveEvent(event, chartContext, config) {
652
+ this.callEvent('chartDataPointMouseLeave', {
653
+ event, component: this, chartContext, config,
654
+ });
655
+ }
656
+ /**
657
+ * This function, if defined, runs just before zooming in/out of the chart
658
+ * allowing you to set a custom range for zooming in/out.
659
+ * @param chartContext
660
+ * @param config { min: timestamp, max: timestamp }
661
+ * @param element DOM Element
662
+ */
663
+ beforeZoomEvent(chartContext, config) {
664
+ this.callEvent('chartBeforeZoom', {
665
+ component: this, chartContext, config,
666
+ });
667
+ }
668
+ /**
669
+ * This function, if defined, runs just before the user hits the HOME button
670
+ * on the toolbar to reset the chart to it’s original state. The function
671
+ * allows you to set a custom axes range for the initial view of the chart.
672
+ * @param chartContext
673
+ * @param config { min: timestamp, max: timestamp }
674
+ * @param element DOM Element
675
+ */
676
+ beforeResetZoomEvent(chartContext, config) {
677
+ this.callEvent('chartBeforeResetZoom', {
678
+ component: this, chartContext, config,
679
+ });
680
+ }
681
+ /**
682
+ * Fires when user zooms in/out the chart using either the selection zooming
683
+ * tool or zoom in/out buttons.
684
+ * The 2nd argument includes information of the new xaxis/yaxis generated after zooming.
685
+ * @param chartContext
686
+ * @param config { min: timestamp, max: timestamp }
687
+ * @param element DOM Element
688
+ */
689
+ zoomedEvent(chartContext, config) {
690
+ this.callEvent('chartZoomed', {
691
+ component: this, chartContext, config,
692
+ });
693
+ }
694
+ /**
695
+ * Fires when user scrolls using the pan tool.
696
+ * The 2nd argument includes information of the new xaxis generated after scrolling.
697
+ * @param chartContext
698
+ * @param config { xaxis: any }
699
+ * @param element DOM Element
700
+ */
701
+ scrolledEvent(chartContext, config) {
702
+ this.callEvent('chartScrolled', {
703
+ component: this, chartContext, config,
704
+ });
705
+ }
706
+ /**
707
+ * Fires when user drags the brush in a brush chart.
708
+ * The 2nd argument includes information of the new axes generated after
709
+ * scrolling the brush.
710
+ * @param chartContext
711
+ * @param config { xaxis: any, yaxis: any }
712
+ * @param element DOM Element
713
+ */
714
+ brushScrolledEvent(chartContext, config) {
715
+ this.callEvent('chartBrushScrolled', {
716
+ component: this, chartContext, config,
717
+ });
718
+ }
482
719
  updateToolbarIcons() {
483
720
  var _a, _b, _c;
484
721
  if (!this.viewGetIconHTML)
@@ -863,6 +1100,16 @@ class Carousel extends ComponentRender {
863
1100
  * '30em', '400', 400. Values without measurement unit will be notated in pixels by default
864
1101
  */
865
1102
  this.height = 'auto';
1103
+ /**
1104
+ * Sets the carousel max height. Example values: 'auto', '100%', '400px',
1105
+ * '30em', '400', 400. Values without measurement unit will be notated in pixels by default
1106
+ */
1107
+ this.maxHeight = 'none';
1108
+ /**
1109
+ * Sets the carousel min height. Example values: 'auto', '100%', '400px',
1110
+ * '30em', '400', 400. Values without measurement unit will be notated in pixels by default
1111
+ */
1112
+ this.minHeight = 'none';
866
1113
  /**
867
1114
  * Configures the carousel as infinite (the slide after the last one is the first slide, and vice-versa)
868
1115
  */
@@ -954,6 +1201,8 @@ class Carousel extends ComponentRender {
954
1201
  this.buttonsOutside = this.getInitValue('buttonsOutside', props.buttonsOutside, this.buttonsOutside);
955
1202
  this.center = this.getInitValue('center', props.center, this.center);
956
1203
  this.height = this.getInitValue('height', props.height, this.height);
1204
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
1205
+ this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
957
1206
  this.infiniteScroll = this.getInitValue('infiniteScroll', props.infiniteScroll, this.infiniteScroll);
958
1207
  this.initialSlide = this.getInitValue('initialSlide', props.initialSlide, this.initialSlide);
959
1208
  this.currentSlide = this.getInitValue('currentSlide', props.currentSlide, this.initialSlide);
@@ -1189,6 +1438,7 @@ class Form extends ComponentRender {
1189
1438
  this.internalValue = {};
1190
1439
  this.align = this.getInitValue('align', props.align, this.align);
1191
1440
  this.justify = this.getInitValue('justify', props.justify, this.justify);
1441
+ this.height = this.getInitValue('height', props.height, this.height);
1192
1442
  this.internalValue = this.getInitValue('value', props.value, this.value);
1193
1443
  this.createAccessors();
1194
1444
  }
@@ -1778,6 +2028,10 @@ class CodeEditor extends ComponentRender {
1778
2028
  * Max height in pixels. 'none' means no limit.
1779
2029
  */
1780
2030
  this.maxHeight = 'none';
2031
+ /**
2032
+ * Max height in pixels. 'none' means no limit.
2033
+ */
2034
+ this.height = 'auto';
1781
2035
  /**
1782
2036
  * Language code to be used for highlight (js|javascript, css, html, json, ts|typescript, bash|shell)
1783
2037
  * Other languages must be imported above
@@ -1797,6 +2051,7 @@ class CodeEditor extends ComponentRender {
1797
2051
  this.staticCode = this.getInitValue('staticCode', props.staticCode, this.staticCodeValue);
1798
2052
  this.copyIcon = this.getInitValue('copyIcon', props.copyIcon, this.copyIcon);
1799
2053
  this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
2054
+ this.height = this.getInitValue('height', props.height, this.height);
1800
2055
  this.language = this.getInitValue('language', props.language, this.language);
1801
2056
  this.showLineNumbers = this.getInitValue('showLineNumbers', props.showLineNumbers, this.showLineNumbers);
1802
2057
  this.createAccessors();
@@ -2003,12 +2258,27 @@ class Container extends ComponentRender {
2003
2258
  * Adds height 100% to container.
2004
2259
  */
2005
2260
  this.fillHeight = false;
2261
+ /**
2262
+ * Sets the height for the component.
2263
+ */
2264
+ this.height = 'auto';
2265
+ /**
2266
+ * Sets the maximum height for the component.
2267
+ */
2268
+ this.maxHeight = 'none';
2269
+ /**
2270
+ * Sets the minimum height for the component.
2271
+ */
2272
+ this.minHeight = 'none';
2006
2273
  /**
2007
2274
  * Removes viewport maximum-width size breakpoints.
2008
2275
  */
2009
2276
  this.fluid = true;
2010
2277
  this.fluid = this.getInitValue('fluid', props.fluid, this.fluid);
2011
2278
  this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
2279
+ this.height = this.getInitValue('height', props.height, this.height);
2280
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
2281
+ this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
2012
2282
  this.createAccessors();
2013
2283
  }
2014
2284
  }
@@ -2346,6 +2616,14 @@ class Dialog extends Component {
2346
2616
  * Dialog type (normal, success, error, warning, info)
2347
2617
  */
2348
2618
  this.type = 'normal';
2619
+ /**
2620
+ * Confirm button component name
2621
+ */
2622
+ this.confirmButton = 'dialogButton';
2623
+ /**
2624
+ * Deny button component name
2625
+ */
2626
+ this.denyButton = undefined;
2349
2627
  /**
2350
2628
  * Default dialog buttons
2351
2629
  * @private
@@ -2357,6 +2635,8 @@ class Dialog extends Component {
2357
2635
  events: { click: () => this.hide() },
2358
2636
  }];
2359
2637
  this.defaultValues = {
2638
+ confirmButton: this.confirmButton,
2639
+ denyButton: this.denyButton,
2360
2640
  name: this.name,
2361
2641
  maxWidth: this.maxWidth,
2362
2642
  persistent: this.persistent,
@@ -2364,6 +2644,38 @@ class Dialog extends Component {
2364
2644
  title: this.title,
2365
2645
  text: this.text,
2366
2646
  };
2647
+ this.clickDefaultButtonKeyMapping = {
2648
+ enter: {
2649
+ event: () => {
2650
+ if (this.confirmButton) {
2651
+ const confirmButton = Metadata.getInstance(this.confirmButton);
2652
+ if (confirmButton
2653
+ && confirmButton.events
2654
+ && confirmButton.events.click
2655
+ && typeof confirmButton.events.click === 'function') {
2656
+ confirmButton.events.click({ component: new Button(confirmButton) });
2657
+ }
2658
+ }
2659
+ },
2660
+ stop: true,
2661
+ },
2662
+ esc: {
2663
+ event: () => {
2664
+ if (this.denyButton) {
2665
+ const denyButton = Metadata.getInstance(this.denyButton);
2666
+ if (denyButton
2667
+ && denyButton.events
2668
+ && denyButton.events.click
2669
+ && typeof denyButton.events.click === 'function')
2670
+ denyButton.events.click({ component: new Button(denyButton) });
2671
+ }
2672
+ else {
2673
+ this.hide();
2674
+ }
2675
+ },
2676
+ stop: true,
2677
+ },
2678
+ };
2367
2679
  this.assignDialogProperties(props);
2368
2680
  this.createAccessors();
2369
2681
  }
@@ -2373,6 +2685,8 @@ class Dialog extends Component {
2373
2685
  */
2374
2686
  assignDialogProperties(dialog) {
2375
2687
  this.buttons = dialog.buttons && dialog.buttons.length ? dialog.buttons : this.defaultButtons;
2688
+ this.confirmButton = this.getInitValue('confirmButton', dialog.confirmButton, this.defaultValues.confirmButton);
2689
+ this.denyButton = this.getInitValue('denyButton', dialog.denyButton, this.defaultValues.denyButton);
2376
2690
  this.name = this.getInitValue('name', dialog.name, this.defaultValues.name);
2377
2691
  this.maxWidth = this.getInitValue('maxWidth', dialog.maxWidth, this.defaultValues.maxWidth);
2378
2692
  this.persistent = this.getInitValue('persistent', dialog.persistent, this.defaultValues.persistent);
@@ -2385,6 +2699,7 @@ class Dialog extends Component {
2385
2699
  * Displays dialog
2386
2700
  */
2387
2701
  show() {
2702
+ KeyMap.bind(this.clickDefaultButtonKeyMapping, this);
2388
2703
  this.isVisible = true;
2389
2704
  }
2390
2705
  /**
@@ -2392,6 +2707,7 @@ class Dialog extends Component {
2392
2707
  */
2393
2708
  hide() {
2394
2709
  this.isVisible = false;
2710
+ KeyMap.unbind(this.clickDefaultButtonKeyMapping, this);
2395
2711
  }
2396
2712
  }
2397
2713
 
@@ -3463,7 +3779,7 @@ class DateRange extends TextInput {
3463
3779
  const lastValue = this.value;
3464
3780
  this.dateError = false;
3465
3781
  this.value = this.parseISODateRangeValue(newValue);
3466
- if (!isEqual(lastValue, this.value))
3782
+ if (!Utils.isEqual(lastValue, this.value))
3467
3783
  this.change(this.value);
3468
3784
  }
3469
3785
  formatISODateRangeValue(dates) {
@@ -3721,6 +4037,10 @@ class Dropdown extends ComponentRender {
3721
4037
  * Applies position fixed to the dropdown.
3722
4038
  */
3723
4039
  this.fixed = false;
4040
+ /**
4041
+ * Sets the height for the dropdown.
4042
+ */
4043
+ this.height = 'auto';
3724
4044
  /**
3725
4045
  * Offset the menu on the x-axis.
3726
4046
  */
@@ -3746,6 +4066,7 @@ class Dropdown extends ComponentRender {
3746
4066
  this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
3747
4067
  this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
3748
4068
  this.hover = this.getInitValue('hover', props.hover, this.hover);
4069
+ this.height = this.getInitValue('height', props.height, this.height);
3749
4070
  this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
3750
4071
  this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
3751
4072
  this.maxWidth = this.getInitValue('maxWidth', props.maxWidth, this.maxWidth);
@@ -4007,12 +4328,18 @@ class Frame extends ComponentRender {
4007
4328
  this.override = {};
4008
4329
  this.cache = false;
4009
4330
  this.cacheDuration = 2 * 60 * 60 * 1000;
4331
+ this.height = 'auto';
4332
+ this.maxHeight = 'none';
4333
+ this.minHeight = 'none';
4010
4334
  this.headerName = 'sw-fetched-on';
4011
4335
  this.path = props.path;
4012
4336
  this.local = props.local === true;
4013
4337
  this.override = props.override || this.override;
4014
4338
  this.cache = props.cache || this.cache;
4015
4339
  this.cacheDuration = this.getInitValue('cacheDuration', props.cacheDuration, this.cacheDuration);
4340
+ this.height = this.getInitValue('height', props.height, this.height);
4341
+ this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
4342
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
4016
4343
  this.createAccessors();
4017
4344
  this.getMetadata();
4018
4345
  }
@@ -4529,7 +4856,7 @@ class GridColumn extends Column {
4529
4856
  if (this.componentProps.dataValueOut && ((_a = component.datasource) === null || _a === void 0 ? void 0 : _a.currentRow)) {
4530
4857
  this.componentProps.dataValueOut.forEach((columns) => {
4531
4858
  const { column, columnOnGrid } = columns;
4532
- if (!isEqual(newRow.originalRow[columnOnGrid], component.datasource.currentRow[column])) {
4859
+ if (!Utils.isEqual(newRow.originalRow[columnOnGrid], component.datasource.currentRow[column])) {
4533
4860
  newRow[`${columnOnGrid}_original`] = newRow.originalRow[columnOnGrid];
4534
4861
  newRow[columnOnGrid] = component.datasource.currentRow[column];
4535
4862
  }
@@ -5010,15 +5337,36 @@ class GridEditable extends Grid {
5010
5337
  * @private
5011
5338
  */
5012
5339
  this.editedRows = {};
5340
+ /**
5341
+ * Rows with newRowIdentifier
5342
+ * @private
5343
+ */
5344
+ this.addedRows = {};
5013
5345
  /**
5014
5346
  * Invalid inline components
5015
5347
  * @private
5016
5348
  */
5017
5349
  this.invalidComponents = {};
5350
+ this.cancelEditedRowsKeyMapping = {
5351
+ esc: {
5352
+ event: this.cancelEditedRows.bind(this),
5353
+ stop: true,
5354
+ input: true,
5355
+ active: true,
5356
+ },
5357
+ };
5018
5358
  this.newRowIdentifier = '__added_row';
5019
5359
  this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
5020
5360
  this.createAccessors();
5021
5361
  }
5362
+ onMounted(element) {
5363
+ super.onMounted(element);
5364
+ KeyMap.bind(this.cancelEditedRowsKeyMapping, this, element);
5365
+ }
5366
+ onBeforeDestroy() {
5367
+ super.onBeforeDestroy();
5368
+ KeyMap.unbind(this.cancelEditedRowsKeyMapping, this);
5369
+ }
5022
5370
  /**
5023
5371
  * Get Grid columns objects
5024
5372
  * @param columns Grid columns parameter
@@ -5188,7 +5536,7 @@ class GridEditable extends Grid {
5188
5536
  changeEditableComponent(column, row, value, component) {
5189
5537
  const key = row[this.datasource.uniqueKey];
5190
5538
  const columnName = column.name;
5191
- if (!isEqual(value, row[columnName])) {
5539
+ if (!Utils.isEqual(value, row[columnName])) {
5192
5540
  const newRow = {};
5193
5541
  newRow[key] = Object.assign({}, this.editedRows[key]);
5194
5542
  newRow[key].originalRow = Object.assign({}, row);
@@ -5234,6 +5582,14 @@ class GridEditable extends Grid {
5234
5582
  * Cancels all edited rows and enable grid components
5235
5583
  */
5236
5584
  cancelEditedRows() {
5585
+ return __awaiter(this, void 0, void 0, function* () {
5586
+ yield this.removeAddedRows();
5587
+ this.editing = false;
5588
+ this.editedRows = {};
5589
+ this.invalidComponents = {};
5590
+ });
5591
+ }
5592
+ removeAddedRows() {
5237
5593
  return __awaiter(this, void 0, void 0, function* () {
5238
5594
  const { data } = this.datasource;
5239
5595
  data.forEach((row, index) => {
@@ -5242,21 +5598,26 @@ class GridEditable extends Grid {
5242
5598
  }
5243
5599
  });
5244
5600
  yield this.datasource.updateData(data);
5245
- this.editing = false;
5246
- this.editedRows = {};
5247
- this.invalidComponents = {};
5248
5601
  });
5249
5602
  }
5603
+ addDataRow(row) {
5604
+ if (this.addedRows[row[this.datasource.uniqueKey]])
5605
+ this.datasource.post(row);
5606
+ else
5607
+ this.datasource.put(row);
5608
+ }
5250
5609
  /**
5251
5610
  * Saves all edited rows if they are valid
5252
5611
  * @throws Will throw when it finds an invalid row
5253
5612
  */
5254
5613
  saveEditedRows() {
5255
5614
  return __awaiter(this, void 0, void 0, function* () {
5256
- const response = yield Promise.all(this.getEditedRows().map((row) => this.datasource.put(row)));
5615
+ yield this.removeAddedRows();
5616
+ const response = yield Promise.all(this.getEditedRows().map((row) => this.addDataRow(row)));
5257
5617
  this.editing = false;
5258
5618
  this.editedRows = {};
5259
5619
  this.invalidComponents = {};
5620
+ this.addedRows = {};
5260
5621
  yield this.datasource.get();
5261
5622
  return response;
5262
5623
  });
@@ -5268,8 +5629,11 @@ class GridEditable extends Grid {
5268
5629
  getEditedRows() {
5269
5630
  const editedRows = [];
5270
5631
  Object.keys(this.editedRows).forEach((key) => {
5632
+ this.addedRows = {};
5271
5633
  const row = Object.assign(Object.assign({}, this.editedRows[key].originalRow), this.editedRows[key]);
5272
5634
  delete row.originalRow;
5635
+ if (row[this.newRowIdentifier])
5636
+ this.addedRows[key] = row;
5273
5637
  delete row[this.newRowIdentifier];
5274
5638
  Object.keys(row).forEach((attr) => {
5275
5639
  if (Object.prototype.hasOwnProperty.call(row, `${attr}_original`)) {
@@ -6553,6 +6917,18 @@ class List extends ComponentRender {
6553
6917
  * Will only collapse when explicitly closed.
6554
6918
  */
6555
6919
  this.expand = false;
6920
+ /**
6921
+ * Sets the height for the component.
6922
+ */
6923
+ this.height = 'auto';
6924
+ /**
6925
+ * Sets the maxHeight for the component.
6926
+ */
6927
+ this.maxHeight = 'none';
6928
+ /**
6929
+ * Sets the minHeight for the component.
6930
+ */
6931
+ this.minHeight = 'none';
6556
6932
  this.dark = this.getInitValue('dark', props.dark, this.dark);
6557
6933
  this.dense = this.getInitValue('dense', props.dense, this.dense);
6558
6934
  this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
@@ -6564,6 +6940,9 @@ class List extends ComponentRender {
6564
6940
  this.color = this.getInitValue('color', props.color, this.color);
6565
6941
  this.elevation = this.getInitValue('elevation', props.elevation, this.elevation);
6566
6942
  this.expand = this.getInitValue('expand', props.expand, this.expand);
6943
+ this.height = this.getInitValue('height', props.height, this.height);
6944
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
6945
+ this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
6567
6946
  this.createAccessors();
6568
6947
  }
6569
6948
  /**
@@ -7245,7 +7624,7 @@ class Menu extends ComponentRender {
7245
7624
  if (item.component === 'ZdMenuGroup') {
7246
7625
  this.searchItems(item.items);
7247
7626
  }
7248
- else if (normalize(I18n.translate(item.label)).indexOf(normalize(this.searchValue)) !== -1) {
7627
+ else if (Utils.normalize(I18n.translate(item.label)).indexOf(Utils.normalize(this.searchValue)) !== -1) {
7249
7628
  this.filteredMenuItems.push(item);
7250
7629
  }
7251
7630
  }
@@ -9306,6 +9685,7 @@ class Tabs extends ComponentRender {
9306
9685
  this.tabs = [];
9307
9686
  this.tabs = this.getTabs(props.tabs || []);
9308
9687
  this.activeTab = this.getInitValue('activeTab', props.activeTab, this.activeTab);
9688
+ this.height = this.getInitValue('height', props.height, this.height);
9309
9689
  this.createAccessors();
9310
9690
  }
9311
9691
  getTabs(tabs) {
@@ -10194,9 +10574,25 @@ class TreeGridEditable extends TreeGrid {
10194
10574
  * Enter edit mode on double click
10195
10575
  */
10196
10576
  this.doubleClickEdit = false;
10577
+ this.cancelEditedRowsKeyMapping = {
10578
+ esc: {
10579
+ event: this.cancelEditedRows.bind(this),
10580
+ stop: true,
10581
+ input: true,
10582
+ active: true,
10583
+ },
10584
+ };
10197
10585
  this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
10198
10586
  this.createAccessors();
10199
10587
  }
10588
+ onMounted(element) {
10589
+ super.onMounted(element);
10590
+ KeyMap.bind(this.cancelEditedRowsKeyMapping, this, element);
10591
+ }
10592
+ onBeforeDestroy() {
10593
+ super.onBeforeDestroy();
10594
+ KeyMap.unbind(this.cancelEditedRowsKeyMapping, this);
10595
+ }
10200
10596
  /**
10201
10597
  * Get Grid columns objects
10202
10598
  * @param columns Grid columns parameter
@@ -10365,7 +10761,7 @@ class TreeGridEditable extends TreeGrid {
10365
10761
  changeEditableComponent(column, row, value, component) {
10366
10762
  const key = row[this.datasource.uniqueKey];
10367
10763
  const columnName = column.name;
10368
- if (!isEqual(value, row[columnName])) {
10764
+ if (!Utils.isEqual(value, row[columnName])) {
10369
10765
  const newRow = {};
10370
10766
  newRow[key] = Object.assign({}, this.editedRows[key]);
10371
10767
  newRow[key].originalRow = Object.assign({}, row);
@@ -10738,10 +11134,14 @@ const defaultTheme = {
10738
11134
  light: {
10739
11135
  'font-color': 'var(--v-grey-darken2)',
10740
11136
  'background-base': '#F6F6F6',
11137
+ 'scrollbar-track': 'var(--v-grey-lighten5)',
11138
+ 'scrollbar-thumb': 'var(--v-grey-lighten4)',
10741
11139
  },
10742
11140
  dark: {
10743
11141
  'font-color': 'var(--v-grey-lighten3)',
10744
11142
  'background-base': '#121212',
11143
+ 'scrollbar-track': 'var(--v-grey-darken3)',
11144
+ 'scrollbar-thumb': 'var(--v-grey-base)',
10745
11145
  },
10746
11146
  variables: {
10747
11147
  'default-padding': '16px',