@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.
@@ -444,6 +444,26 @@
444
444
  reset: 'zoomReset',
445
445
  },
446
446
  },
447
+ events: {
448
+ animationEnd: this.animationEndEvent.bind(this),
449
+ beforeMount: this.beforeMountEvent.bind(this),
450
+ mounted: this.mountedEvent.bind(this),
451
+ updated: this.updatedEvent.bind(this),
452
+ click: this.clickEvent.bind(this),
453
+ mouseMove: this.mouseMoveEvent.bind(this),
454
+ mouseLeave: this.mouseLeaveEvent.bind(this),
455
+ legendClick: this.legendClickEvent.bind(this),
456
+ markerClick: this.markerClickEvent.bind(this),
457
+ selection: this.selectionEvent.bind(this),
458
+ dataPointSelection: this.dataPointSelectionEvent.bind(this),
459
+ dataPointMouseEnter: this.dataPointMouseEnterEvent.bind(this),
460
+ dataPointMouseLeave: this.dataPointMouseLeaveEvent.bind(this),
461
+ beforeZoom: this.beforeZoomEvent.bind(this),
462
+ beforeResetZoom: this.beforeResetZoomEvent.bind(this),
463
+ zoomed: this.zoomedEvent.bind(this),
464
+ scrolled: this.scrolledEvent.bind(this),
465
+ brushScrolled: this.brushScrolledEvent.bind(this),
466
+ },
447
467
  },
448
468
  };
449
469
  this.chartType = this.getInitValue('chartType', props.chartType, this.chartType);
@@ -486,6 +506,223 @@
486
506
  }
487
507
  return Promise.resolve();
488
508
  }
509
+ /**
510
+ * Fires when the chart’s initial animation is finished
511
+ * @param chartContext
512
+ * @param config
513
+ * @param element DOM Element
514
+ */
515
+ animationEndEvent(chartContext, options) {
516
+ this.callEvent('chartAnimationEnd', { component: this, chartContext, options });
517
+ }
518
+ /**
519
+ * Fires before the chart has been drawn on screen
520
+ * @param chartContext
521
+ * @param config
522
+ * @param element DOM Element
523
+ */
524
+ beforeMountEvent(chartContext, config) {
525
+ this.callEvent('chartBeforeMount', {
526
+ component: this, chartContext, config,
527
+ });
528
+ }
529
+ /**
530
+ * Fires after the chart has been drawn on screen
531
+ * @param chartContext
532
+ * @param config
533
+ * @param element DOM Element
534
+ */
535
+ mountedEvent(chartContext, config) {
536
+ this.callEvent('chartMounted', {
537
+ component: this, chartContext, config,
538
+ });
539
+ }
540
+ /**
541
+ * Fires when the chart has been dynamically updated either with
542
+ * updateOptions() or updateSeries() functions
543
+ * @param chartContext
544
+ * @param config
545
+ * @param element DOM Element
546
+ */
547
+ updatedEvent(chartContext, config) {
548
+ this.callEvent('chartUpdated', {
549
+ component: this, chartContext, config,
550
+ });
551
+ }
552
+ /**
553
+ * Fires when the chart has been dynamically updated either with
554
+ * updateOptions() or updateSeries() functions
555
+ * @param event Event that triggered the click event
556
+ * @param chartContext
557
+ * @param config
558
+ * @param element DOM Element
559
+ */
560
+ clickEvent(event, chartContext, config) {
561
+ this.callEvent('chartClick', {
562
+ event, component: this, chartContext, config,
563
+ });
564
+ }
565
+ /**
566
+ * Fires when user moves mouse on any area of the chart.
567
+ * @param event Event that triggered the click event
568
+ * @param chartContext
569
+ * @param config
570
+ * @param element DOM Element
571
+ */
572
+ mouseMoveEvent(event, chartContext, config) {
573
+ this.callEvent('chartMouseMove', {
574
+ event, component: this, chartContext, config,
575
+ });
576
+ }
577
+ /**
578
+ * Fires when user moves mouse on any area of the chart.
579
+ * @param event Event that triggered the mouse leave
580
+ * @param chartContext
581
+ * @param config New config
582
+ * @param element DOM Element
583
+ */
584
+ mouseLeaveEvent(event, chartContext, config) {
585
+ this.callEvent('chartMouseLeave', {
586
+ event, component: this, chartContext, config,
587
+ });
588
+ }
589
+ /**
590
+ * Fires when user moves mouse on any area of the chart.
591
+ * @param chartContext
592
+ * @param seriesIndex
593
+ * @param config
594
+ * @param element DOM Element
595
+ */
596
+ legendClickEvent(chartContext, seriesIndex, config) {
597
+ this.callEvent('chartLegendClick', {
598
+ component: this, chartContext, seriesIndex, config,
599
+ });
600
+ }
601
+ /**
602
+ * Fires when user moves mouse on any area of the chart.
603
+ * @param event Event that triggered the marker click
604
+ * @param chartContext
605
+ * @param option New config
606
+ * @param element DOM Element
607
+ */
608
+ markerClickEvent(event, chartContext, config) {
609
+ this.callEvent('chartMarkerClick', {
610
+ event, component: this, chartContext, config,
611
+ });
612
+ }
613
+ /**
614
+ * Fires when user selects rect using the selection tool.
615
+ * The second argument
616
+ * @param chartContext
617
+ * @param config contains the yaxis and xaxis coordinates where user made the selection
618
+ * @param element DOM Element
619
+ */
620
+ selectionEvent(chartContext, config) {
621
+ this.callEvent('chartSelection', {
622
+ component: this, chartContext, config,
623
+ });
624
+ }
625
+ /**
626
+ * Fires when user clicks on a datapoint (bar/column/marker/bubble/donut-slice).
627
+ * @param event Event that triggered when user clicks on a datapoint
628
+ * @param chartContext
629
+ * @param config The config object, also includes additional information like
630
+ * which dataPointIndex was selected of which series.
631
+ * @param element DOM Element
632
+ */
633
+ dataPointSelectionEvent(event, chartContext, config) {
634
+ this.callEvent('chartDataPointSelection', {
635
+ event, component: this, chartContext, config,
636
+ });
637
+ }
638
+ /**
639
+ * Fires when user clicks on a datapoint (bar/column/marker/bubble/donut-slice).
640
+ * @param event Event that triggered when user’s mouse enter on a datapoint
641
+ * @param chartContext
642
+ * @param config The config object, also includes additional information like
643
+ * which dataPointIndex was hovered of particular series.
644
+ * @param element DOM Element
645
+ */
646
+ dataPointMouseEnterEvent(event, chartContext, config) {
647
+ this.callEvent('chartDataPointMouseEnter', {
648
+ event, component: this, chartContext, config,
649
+ });
650
+ }
651
+ /**
652
+ * MouseLeave event for a datapoint (bar/column/marker/bubble/donut-slice).
653
+ * @param event Event that triggered the beforeSlide event
654
+ * @param chartContext
655
+ * @param config
656
+ * @param element DOM Element
657
+ */
658
+ dataPointMouseLeaveEvent(event, chartContext, config) {
659
+ this.callEvent('chartDataPointMouseLeave', {
660
+ event, component: this, chartContext, config,
661
+ });
662
+ }
663
+ /**
664
+ * This function, if defined, runs just before zooming in/out of the chart
665
+ * allowing you to set a custom range for zooming in/out.
666
+ * @param chartContext
667
+ * @param config { min: timestamp, max: timestamp }
668
+ * @param element DOM Element
669
+ */
670
+ beforeZoomEvent(chartContext, config) {
671
+ this.callEvent('chartBeforeZoom', {
672
+ component: this, chartContext, config,
673
+ });
674
+ }
675
+ /**
676
+ * This function, if defined, runs just before the user hits the HOME button
677
+ * on the toolbar to reset the chart to it’s original state. The function
678
+ * allows you to set a custom axes range for the initial view of the chart.
679
+ * @param chartContext
680
+ * @param config { min: timestamp, max: timestamp }
681
+ * @param element DOM Element
682
+ */
683
+ beforeResetZoomEvent(chartContext, config) {
684
+ this.callEvent('chartBeforeResetZoom', {
685
+ component: this, chartContext, config,
686
+ });
687
+ }
688
+ /**
689
+ * Fires when user zooms in/out the chart using either the selection zooming
690
+ * tool or zoom in/out buttons.
691
+ * The 2nd argument includes information of the new xaxis/yaxis generated after zooming.
692
+ * @param chartContext
693
+ * @param config { min: timestamp, max: timestamp }
694
+ * @param element DOM Element
695
+ */
696
+ zoomedEvent(chartContext, config) {
697
+ this.callEvent('chartZoomed', {
698
+ component: this, chartContext, config,
699
+ });
700
+ }
701
+ /**
702
+ * Fires when user scrolls using the pan tool.
703
+ * The 2nd argument includes information of the new xaxis generated after scrolling.
704
+ * @param chartContext
705
+ * @param config { xaxis: any }
706
+ * @param element DOM Element
707
+ */
708
+ scrolledEvent(chartContext, config) {
709
+ this.callEvent('chartScrolled', {
710
+ component: this, chartContext, config,
711
+ });
712
+ }
713
+ /**
714
+ * Fires when user drags the brush in a brush chart.
715
+ * The 2nd argument includes information of the new axes generated after
716
+ * scrolling the brush.
717
+ * @param chartContext
718
+ * @param config { xaxis: any, yaxis: any }
719
+ * @param element DOM Element
720
+ */
721
+ brushScrolledEvent(chartContext, config) {
722
+ this.callEvent('chartBrushScrolled', {
723
+ component: this, chartContext, config,
724
+ });
725
+ }
489
726
  updateToolbarIcons() {
490
727
  var _a, _b, _c;
491
728
  if (!this.viewGetIconHTML)
@@ -870,6 +1107,16 @@
870
1107
  * '30em', '400', 400. Values without measurement unit will be notated in pixels by default
871
1108
  */
872
1109
  this.height = 'auto';
1110
+ /**
1111
+ * Sets the carousel max height. Example values: 'auto', '100%', '400px',
1112
+ * '30em', '400', 400. Values without measurement unit will be notated in pixels by default
1113
+ */
1114
+ this.maxHeight = 'none';
1115
+ /**
1116
+ * Sets the carousel min height. Example values: 'auto', '100%', '400px',
1117
+ * '30em', '400', 400. Values without measurement unit will be notated in pixels by default
1118
+ */
1119
+ this.minHeight = 'none';
873
1120
  /**
874
1121
  * Configures the carousel as infinite (the slide after the last one is the first slide, and vice-versa)
875
1122
  */
@@ -961,6 +1208,8 @@
961
1208
  this.buttonsOutside = this.getInitValue('buttonsOutside', props.buttonsOutside, this.buttonsOutside);
962
1209
  this.center = this.getInitValue('center', props.center, this.center);
963
1210
  this.height = this.getInitValue('height', props.height, this.height);
1211
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
1212
+ this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
964
1213
  this.infiniteScroll = this.getInitValue('infiniteScroll', props.infiniteScroll, this.infiniteScroll);
965
1214
  this.initialSlide = this.getInitValue('initialSlide', props.initialSlide, this.initialSlide);
966
1215
  this.currentSlide = this.getInitValue('currentSlide', props.currentSlide, this.initialSlide);
@@ -1196,6 +1445,7 @@
1196
1445
  this.internalValue = {};
1197
1446
  this.align = this.getInitValue('align', props.align, this.align);
1198
1447
  this.justify = this.getInitValue('justify', props.justify, this.justify);
1448
+ this.height = this.getInitValue('height', props.height, this.height);
1199
1449
  this.internalValue = this.getInitValue('value', props.value, this.value);
1200
1450
  this.createAccessors();
1201
1451
  }
@@ -1785,6 +2035,10 @@
1785
2035
  * Max height in pixels. 'none' means no limit.
1786
2036
  */
1787
2037
  this.maxHeight = 'none';
2038
+ /**
2039
+ * Max height in pixels. 'none' means no limit.
2040
+ */
2041
+ this.height = 'auto';
1788
2042
  /**
1789
2043
  * Language code to be used for highlight (js|javascript, css, html, json, ts|typescript, bash|shell)
1790
2044
  * Other languages must be imported above
@@ -1804,6 +2058,7 @@
1804
2058
  this.staticCode = this.getInitValue('staticCode', props.staticCode, this.staticCodeValue);
1805
2059
  this.copyIcon = this.getInitValue('copyIcon', props.copyIcon, this.copyIcon);
1806
2060
  this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
2061
+ this.height = this.getInitValue('height', props.height, this.height);
1807
2062
  this.language = this.getInitValue('language', props.language, this.language);
1808
2063
  this.showLineNumbers = this.getInitValue('showLineNumbers', props.showLineNumbers, this.showLineNumbers);
1809
2064
  this.createAccessors();
@@ -2010,12 +2265,27 @@
2010
2265
  * Adds height 100% to container.
2011
2266
  */
2012
2267
  this.fillHeight = false;
2268
+ /**
2269
+ * Sets the height for the component.
2270
+ */
2271
+ this.height = 'auto';
2272
+ /**
2273
+ * Sets the maximum height for the component.
2274
+ */
2275
+ this.maxHeight = 'none';
2276
+ /**
2277
+ * Sets the minimum height for the component.
2278
+ */
2279
+ this.minHeight = 'none';
2013
2280
  /**
2014
2281
  * Removes viewport maximum-width size breakpoints.
2015
2282
  */
2016
2283
  this.fluid = true;
2017
2284
  this.fluid = this.getInitValue('fluid', props.fluid, this.fluid);
2018
2285
  this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
2286
+ this.height = this.getInitValue('height', props.height, this.height);
2287
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
2288
+ this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
2019
2289
  this.createAccessors();
2020
2290
  }
2021
2291
  }
@@ -2353,6 +2623,14 @@
2353
2623
  * Dialog type (normal, success, error, warning, info)
2354
2624
  */
2355
2625
  this.type = 'normal';
2626
+ /**
2627
+ * Confirm button component name
2628
+ */
2629
+ this.confirmButton = 'dialogButton';
2630
+ /**
2631
+ * Deny button component name
2632
+ */
2633
+ this.denyButton = undefined;
2356
2634
  /**
2357
2635
  * Default dialog buttons
2358
2636
  * @private
@@ -2364,6 +2642,8 @@
2364
2642
  events: { click: () => this.hide() },
2365
2643
  }];
2366
2644
  this.defaultValues = {
2645
+ confirmButton: this.confirmButton,
2646
+ denyButton: this.denyButton,
2367
2647
  name: this.name,
2368
2648
  maxWidth: this.maxWidth,
2369
2649
  persistent: this.persistent,
@@ -2371,6 +2651,38 @@
2371
2651
  title: this.title,
2372
2652
  text: this.text,
2373
2653
  };
2654
+ this.clickDefaultButtonKeyMapping = {
2655
+ enter: {
2656
+ event: () => {
2657
+ if (this.confirmButton) {
2658
+ const confirmButton = core.Metadata.getInstance(this.confirmButton);
2659
+ if (confirmButton
2660
+ && confirmButton.events
2661
+ && confirmButton.events.click
2662
+ && typeof confirmButton.events.click === 'function') {
2663
+ confirmButton.events.click({ component: new Button(confirmButton) });
2664
+ }
2665
+ }
2666
+ },
2667
+ stop: true,
2668
+ },
2669
+ esc: {
2670
+ event: () => {
2671
+ if (this.denyButton) {
2672
+ const denyButton = core.Metadata.getInstance(this.denyButton);
2673
+ if (denyButton
2674
+ && denyButton.events
2675
+ && denyButton.events.click
2676
+ && typeof denyButton.events.click === 'function')
2677
+ denyButton.events.click({ component: new Button(denyButton) });
2678
+ }
2679
+ else {
2680
+ this.hide();
2681
+ }
2682
+ },
2683
+ stop: true,
2684
+ },
2685
+ };
2374
2686
  this.assignDialogProperties(props);
2375
2687
  this.createAccessors();
2376
2688
  }
@@ -2380,6 +2692,8 @@
2380
2692
  */
2381
2693
  assignDialogProperties(dialog) {
2382
2694
  this.buttons = dialog.buttons && dialog.buttons.length ? dialog.buttons : this.defaultButtons;
2695
+ this.confirmButton = this.getInitValue('confirmButton', dialog.confirmButton, this.defaultValues.confirmButton);
2696
+ this.denyButton = this.getInitValue('denyButton', dialog.denyButton, this.defaultValues.denyButton);
2383
2697
  this.name = this.getInitValue('name', dialog.name, this.defaultValues.name);
2384
2698
  this.maxWidth = this.getInitValue('maxWidth', dialog.maxWidth, this.defaultValues.maxWidth);
2385
2699
  this.persistent = this.getInitValue('persistent', dialog.persistent, this.defaultValues.persistent);
@@ -2392,6 +2706,7 @@
2392
2706
  * Displays dialog
2393
2707
  */
2394
2708
  show() {
2709
+ core.KeyMap.bind(this.clickDefaultButtonKeyMapping, this);
2395
2710
  this.isVisible = true;
2396
2711
  }
2397
2712
  /**
@@ -2399,6 +2714,7 @@
2399
2714
  */
2400
2715
  hide() {
2401
2716
  this.isVisible = false;
2717
+ core.KeyMap.unbind(this.clickDefaultButtonKeyMapping, this);
2402
2718
  }
2403
2719
  }
2404
2720
 
@@ -3470,7 +3786,7 @@
3470
3786
  const lastValue = this.value;
3471
3787
  this.dateError = false;
3472
3788
  this.value = this.parseISODateRangeValue(newValue);
3473
- if (!core.isEqual(lastValue, this.value))
3789
+ if (!core.Utils.isEqual(lastValue, this.value))
3474
3790
  this.change(this.value);
3475
3791
  }
3476
3792
  formatISODateRangeValue(dates) {
@@ -3728,6 +4044,10 @@
3728
4044
  * Applies position fixed to the dropdown.
3729
4045
  */
3730
4046
  this.fixed = false;
4047
+ /**
4048
+ * Sets the height for the dropdown.
4049
+ */
4050
+ this.height = 'auto';
3731
4051
  /**
3732
4052
  * Offset the menu on the x-axis.
3733
4053
  */
@@ -3753,6 +4073,7 @@
3753
4073
  this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
3754
4074
  this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
3755
4075
  this.hover = this.getInitValue('hover', props.hover, this.hover);
4076
+ this.height = this.getInitValue('height', props.height, this.height);
3756
4077
  this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
3757
4078
  this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
3758
4079
  this.maxWidth = this.getInitValue('maxWidth', props.maxWidth, this.maxWidth);
@@ -4014,12 +4335,18 @@
4014
4335
  this.override = {};
4015
4336
  this.cache = false;
4016
4337
  this.cacheDuration = 2 * 60 * 60 * 1000;
4338
+ this.height = 'auto';
4339
+ this.maxHeight = 'none';
4340
+ this.minHeight = 'none';
4017
4341
  this.headerName = 'sw-fetched-on';
4018
4342
  this.path = props.path;
4019
4343
  this.local = props.local === true;
4020
4344
  this.override = props.override || this.override;
4021
4345
  this.cache = props.cache || this.cache;
4022
4346
  this.cacheDuration = this.getInitValue('cacheDuration', props.cacheDuration, this.cacheDuration);
4347
+ this.height = this.getInitValue('height', props.height, this.height);
4348
+ this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
4349
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
4023
4350
  this.createAccessors();
4024
4351
  this.getMetadata();
4025
4352
  }
@@ -4536,7 +4863,7 @@
4536
4863
  if (this.componentProps.dataValueOut && ((_a = component.datasource) === null || _a === void 0 ? void 0 : _a.currentRow)) {
4537
4864
  this.componentProps.dataValueOut.forEach((columns) => {
4538
4865
  const { column, columnOnGrid } = columns;
4539
- if (!core.isEqual(newRow.originalRow[columnOnGrid], component.datasource.currentRow[column])) {
4866
+ if (!core.Utils.isEqual(newRow.originalRow[columnOnGrid], component.datasource.currentRow[column])) {
4540
4867
  newRow[`${columnOnGrid}_original`] = newRow.originalRow[columnOnGrid];
4541
4868
  newRow[columnOnGrid] = component.datasource.currentRow[column];
4542
4869
  }
@@ -5017,15 +5344,36 @@
5017
5344
  * @private
5018
5345
  */
5019
5346
  this.editedRows = {};
5347
+ /**
5348
+ * Rows with newRowIdentifier
5349
+ * @private
5350
+ */
5351
+ this.addedRows = {};
5020
5352
  /**
5021
5353
  * Invalid inline components
5022
5354
  * @private
5023
5355
  */
5024
5356
  this.invalidComponents = {};
5357
+ this.cancelEditedRowsKeyMapping = {
5358
+ esc: {
5359
+ event: this.cancelEditedRows.bind(this),
5360
+ stop: true,
5361
+ input: true,
5362
+ active: true,
5363
+ },
5364
+ };
5025
5365
  this.newRowIdentifier = '__added_row';
5026
5366
  this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
5027
5367
  this.createAccessors();
5028
5368
  }
5369
+ onMounted(element) {
5370
+ super.onMounted(element);
5371
+ core.KeyMap.bind(this.cancelEditedRowsKeyMapping, this, element);
5372
+ }
5373
+ onBeforeDestroy() {
5374
+ super.onBeforeDestroy();
5375
+ core.KeyMap.unbind(this.cancelEditedRowsKeyMapping, this);
5376
+ }
5029
5377
  /**
5030
5378
  * Get Grid columns objects
5031
5379
  * @param columns Grid columns parameter
@@ -5195,7 +5543,7 @@
5195
5543
  changeEditableComponent(column, row, value, component) {
5196
5544
  const key = row[this.datasource.uniqueKey];
5197
5545
  const columnName = column.name;
5198
- if (!core.isEqual(value, row[columnName])) {
5546
+ if (!core.Utils.isEqual(value, row[columnName])) {
5199
5547
  const newRow = {};
5200
5548
  newRow[key] = Object.assign({}, this.editedRows[key]);
5201
5549
  newRow[key].originalRow = Object.assign({}, row);
@@ -5241,6 +5589,14 @@
5241
5589
  * Cancels all edited rows and enable grid components
5242
5590
  */
5243
5591
  cancelEditedRows() {
5592
+ return __awaiter(this, void 0, void 0, function* () {
5593
+ yield this.removeAddedRows();
5594
+ this.editing = false;
5595
+ this.editedRows = {};
5596
+ this.invalidComponents = {};
5597
+ });
5598
+ }
5599
+ removeAddedRows() {
5244
5600
  return __awaiter(this, void 0, void 0, function* () {
5245
5601
  const { data } = this.datasource;
5246
5602
  data.forEach((row, index) => {
@@ -5249,21 +5605,26 @@
5249
5605
  }
5250
5606
  });
5251
5607
  yield this.datasource.updateData(data);
5252
- this.editing = false;
5253
- this.editedRows = {};
5254
- this.invalidComponents = {};
5255
5608
  });
5256
5609
  }
5610
+ addDataRow(row) {
5611
+ if (this.addedRows[row[this.datasource.uniqueKey]])
5612
+ this.datasource.post(row);
5613
+ else
5614
+ this.datasource.put(row);
5615
+ }
5257
5616
  /**
5258
5617
  * Saves all edited rows if they are valid
5259
5618
  * @throws Will throw when it finds an invalid row
5260
5619
  */
5261
5620
  saveEditedRows() {
5262
5621
  return __awaiter(this, void 0, void 0, function* () {
5263
- const response = yield Promise.all(this.getEditedRows().map((row) => this.datasource.put(row)));
5622
+ yield this.removeAddedRows();
5623
+ const response = yield Promise.all(this.getEditedRows().map((row) => this.addDataRow(row)));
5264
5624
  this.editing = false;
5265
5625
  this.editedRows = {};
5266
5626
  this.invalidComponents = {};
5627
+ this.addedRows = {};
5267
5628
  yield this.datasource.get();
5268
5629
  return response;
5269
5630
  });
@@ -5275,8 +5636,11 @@
5275
5636
  getEditedRows() {
5276
5637
  const editedRows = [];
5277
5638
  Object.keys(this.editedRows).forEach((key) => {
5639
+ this.addedRows = {};
5278
5640
  const row = Object.assign(Object.assign({}, this.editedRows[key].originalRow), this.editedRows[key]);
5279
5641
  delete row.originalRow;
5642
+ if (row[this.newRowIdentifier])
5643
+ this.addedRows[key] = row;
5280
5644
  delete row[this.newRowIdentifier];
5281
5645
  Object.keys(row).forEach((attr) => {
5282
5646
  if (Object.prototype.hasOwnProperty.call(row, `${attr}_original`)) {
@@ -6560,6 +6924,18 @@
6560
6924
  * Will only collapse when explicitly closed.
6561
6925
  */
6562
6926
  this.expand = false;
6927
+ /**
6928
+ * Sets the height for the component.
6929
+ */
6930
+ this.height = 'auto';
6931
+ /**
6932
+ * Sets the maxHeight for the component.
6933
+ */
6934
+ this.maxHeight = 'none';
6935
+ /**
6936
+ * Sets the minHeight for the component.
6937
+ */
6938
+ this.minHeight = 'none';
6563
6939
  this.dark = this.getInitValue('dark', props.dark, this.dark);
6564
6940
  this.dense = this.getInitValue('dense', props.dense, this.dense);
6565
6941
  this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
@@ -6571,6 +6947,9 @@
6571
6947
  this.color = this.getInitValue('color', props.color, this.color);
6572
6948
  this.elevation = this.getInitValue('elevation', props.elevation, this.elevation);
6573
6949
  this.expand = this.getInitValue('expand', props.expand, this.expand);
6950
+ this.height = this.getInitValue('height', props.height, this.height);
6951
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
6952
+ this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
6574
6953
  this.createAccessors();
6575
6954
  }
6576
6955
  /**
@@ -7252,7 +7631,7 @@
7252
7631
  if (item.component === 'ZdMenuGroup') {
7253
7632
  this.searchItems(item.items);
7254
7633
  }
7255
- else if (core.normalize(core.I18n.translate(item.label)).indexOf(core.normalize(this.searchValue)) !== -1) {
7634
+ else if (core.Utils.normalize(core.I18n.translate(item.label)).indexOf(core.Utils.normalize(this.searchValue)) !== -1) {
7256
7635
  this.filteredMenuItems.push(item);
7257
7636
  }
7258
7637
  }
@@ -9313,6 +9692,7 @@
9313
9692
  this.tabs = [];
9314
9693
  this.tabs = this.getTabs(props.tabs || []);
9315
9694
  this.activeTab = this.getInitValue('activeTab', props.activeTab, this.activeTab);
9695
+ this.height = this.getInitValue('height', props.height, this.height);
9316
9696
  this.createAccessors();
9317
9697
  }
9318
9698
  getTabs(tabs) {
@@ -10201,9 +10581,25 @@
10201
10581
  * Enter edit mode on double click
10202
10582
  */
10203
10583
  this.doubleClickEdit = false;
10584
+ this.cancelEditedRowsKeyMapping = {
10585
+ esc: {
10586
+ event: this.cancelEditedRows.bind(this),
10587
+ stop: true,
10588
+ input: true,
10589
+ active: true,
10590
+ },
10591
+ };
10204
10592
  this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
10205
10593
  this.createAccessors();
10206
10594
  }
10595
+ onMounted(element) {
10596
+ super.onMounted(element);
10597
+ core.KeyMap.bind(this.cancelEditedRowsKeyMapping, this, element);
10598
+ }
10599
+ onBeforeDestroy() {
10600
+ super.onBeforeDestroy();
10601
+ core.KeyMap.unbind(this.cancelEditedRowsKeyMapping, this);
10602
+ }
10207
10603
  /**
10208
10604
  * Get Grid columns objects
10209
10605
  * @param columns Grid columns parameter
@@ -10372,7 +10768,7 @@
10372
10768
  changeEditableComponent(column, row, value, component) {
10373
10769
  const key = row[this.datasource.uniqueKey];
10374
10770
  const columnName = column.name;
10375
- if (!core.isEqual(value, row[columnName])) {
10771
+ if (!core.Utils.isEqual(value, row[columnName])) {
10376
10772
  const newRow = {};
10377
10773
  newRow[key] = Object.assign({}, this.editedRows[key]);
10378
10774
  newRow[key].originalRow = Object.assign({}, row);
@@ -10745,10 +11141,14 @@
10745
11141
  light: {
10746
11142
  'font-color': 'var(--v-grey-darken2)',
10747
11143
  'background-base': '#F6F6F6',
11144
+ 'scrollbar-track': 'var(--v-grey-lighten5)',
11145
+ 'scrollbar-thumb': 'var(--v-grey-lighten4)',
10748
11146
  },
10749
11147
  dark: {
10750
11148
  'font-color': 'var(--v-grey-lighten3)',
10751
11149
  'background-base': '#121212',
11150
+ 'scrollbar-track': 'var(--v-grey-darken3)',
11151
+ 'scrollbar-thumb': 'var(--v-grey-base)',
10752
11152
  },
10753
11153
  variables: {
10754
11154
  'default-padding': '16px',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.42.0",
3
+ "version": "1.43.0",
4
4
  "description": "Zeedhi Common",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -37,5 +37,5 @@
37
37
  "lodash.times": "^4.3.2",
38
38
  "mockdate": "^3.0.2"
39
39
  },
40
- "gitHead": "1b3927e4fa74176f8c1dcfa909db8d89d39711e5"
40
+ "gitHead": "29c0d1651d7e00dba4a4e582c1c1ffd8b466107e"
41
41
  }