@zeedhi/common 1.45.1 → 1.48.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, Utils, Router, InstanceNotFoundError, Http, Cookie, URL as URL$1 } from '@zeedhi/core';
1
+ import { AccessorManager, Event, KeyMap, Metadata, FormatterParserProvider, Validation, Mask, Accessor, DatasourceFactory, I18n, MethodNotAssignedError, Loader, Config, dayjs, DateHelper, 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';
@@ -40,6 +40,10 @@ class Component {
40
40
  * Set css in line with cssStyle.
41
41
  */
42
42
  this.cssStyle = '';
43
+ /**
44
+ * Directives registered to the component.
45
+ */
46
+ this.directives = {};
43
47
  /**
44
48
  * Events registered to the component.
45
49
  */
@@ -70,12 +74,16 @@ class Component {
70
74
  this.events = Event.factory(props.events || this.events);
71
75
  this.cssClass = this.getInitValue('cssClass', props.cssClass, this.cssClass);
72
76
  this.cssStyle = this.getInitValue('cssStyle', props.cssStyle, this.cssStyle);
77
+ this.directives = this.getInitValue('directives', props.directives, this.directives);
73
78
  this.isVisible = this.getInitValue('isVisible', props.isVisible, this.isVisible);
74
79
  this.dark = this.getInitValue('dark', props.dark, this.dark);
75
80
  this.light = this.getInitValue('light', props.light, this.light);
76
81
  this.children = Array.isArray(props.children) ? props.children : this.children;
77
82
  this.keyMap = KeyMap.factory(props.keyMap || this.keyMap);
78
83
  this.createAccessors();
84
+ Object.keys(this.directives).forEach((key) => {
85
+ this.directives[key] = Event.factory(this.directives[key]);
86
+ });
79
87
  }
80
88
  setViewFocus(viewFocus) {
81
89
  this.viewFocus = viewFocus;
@@ -495,7 +503,7 @@ class ApexChart extends ComponentRender {
495
503
  * @param options New options
496
504
  */
497
505
  updateChart(options) {
498
- this.options = Object.assign(Object.assign({}, this.options), options);
506
+ merge(this.options, options);
499
507
  if (options.series) {
500
508
  this.series = this.options.series;
501
509
  }
@@ -1649,10 +1657,6 @@ class Input extends ComponentRender {
1649
1657
  * Used to watch a value from store.
1650
1658
  */
1651
1659
  this.storePath = '';
1652
- /**
1653
- * Internal input value.
1654
- */
1655
- this.value = null;
1656
1660
  /**
1657
1661
  * Input validations.
1658
1662
  */
@@ -1663,6 +1667,8 @@ class Input extends ComponentRender {
1663
1667
  this.parsedValidations = {};
1664
1668
  this.formatterFn = FormatterParserProvider.getFormatter('ZdInput');
1665
1669
  this.parserFn = FormatterParserProvider.getParser('ZdInput');
1670
+ this.internalDisplayValue = '';
1671
+ this.internalValue = null;
1666
1672
  this.lastInputValue = undefined;
1667
1673
  this.callInputEvent = debounce(({ event, element, component }) => {
1668
1674
  this.callEvent('input', { event, element, component });
@@ -1757,7 +1763,8 @@ class Input extends ComponentRender {
1757
1763
  * Removes all input validation.
1758
1764
  */
1759
1765
  clearValidations() {
1760
- Object.keys(this.validations).forEach((name) => this.removeValidation(name));
1766
+ this.validations = {};
1767
+ this.rules = [];
1761
1768
  }
1762
1769
  /**
1763
1770
  * Updates input rules.
@@ -1766,14 +1773,39 @@ class Input extends ComponentRender {
1766
1773
  this.rules = Object.values(this.parsedValidations)
1767
1774
  .map((validation) => () => validation(this.value));
1768
1775
  }
1776
+ /**
1777
+ * Input value.
1778
+ */
1779
+ get value() {
1780
+ return this.internalValue;
1781
+ }
1782
+ set value(value) {
1783
+ if (this.internalValue !== value) {
1784
+ this.internalDisplayValue = this.formatter(value);
1785
+ this.internalValue = value;
1786
+ }
1787
+ }
1769
1788
  /**
1770
1789
  * Input displayed value.
1771
1790
  */
1772
1791
  get displayValue() {
1773
- return this.formatter(this.value);
1792
+ return this.internalDisplayValue;
1774
1793
  }
1775
1794
  set displayValue(value) {
1776
- this.value = this.parser(value);
1795
+ if (this.internalDisplayValue !== value) {
1796
+ this.internalValue = this.parser(value);
1797
+ let { mask } = this;
1798
+ if (mask) {
1799
+ if (typeof mask === 'function') {
1800
+ mask = mask(this.internalValue);
1801
+ }
1802
+ this.internalDisplayValue = Mask.convertAll(mask, value);
1803
+ this.internalValue = this.parser(this.internalDisplayValue);
1804
+ }
1805
+ else {
1806
+ this.internalDisplayValue = value;
1807
+ }
1808
+ }
1777
1809
  }
1778
1810
  /**
1779
1811
  * Retrieves a formatted value.
@@ -2862,6 +2894,7 @@ class Dashboard extends ComponentRender {
2862
2894
  this.cards = [];
2863
2895
  /* Card ID to be deleted */
2864
2896
  this.deleteCardId = '';
2897
+ this.overrideNamedProps = {};
2865
2898
  /* Remove the paddings of the dashboard */
2866
2899
  this.removePadding = false;
2867
2900
  /* Height of the dashboard */
@@ -3070,6 +3103,7 @@ class Dashboard extends ComponentRender {
3070
3103
  this.editingMode = this.getInitValue('editingMode', props.editingMode, this.editingMode);
3071
3104
  this.moveMode = this.getInitValue('moveMode', props.moveMode, this.moveMode);
3072
3105
  this.cards = props.cards || this.cards;
3106
+ this.overrideNamedProps = props.overrideNamedProps || this.overrideNamedProps;
3073
3107
  this.removePadding = this.getInitValue('removePadding', props.removePadding, this.removePadding);
3074
3108
  this.height = this.getInitValue('height', props.height, this.height);
3075
3109
  this.heightAdjust = this.getInitValue('heightAdjust', props.heightAdjust, this.heightAdjust);
@@ -3207,6 +3241,7 @@ class Dashboard extends ComponentRender {
3207
3241
  component: 'ZdFrame',
3208
3242
  path: card.path,
3209
3243
  local: card.local,
3244
+ overrideNamedProps: card.overrideNamedProps,
3210
3245
  };
3211
3246
  }
3212
3247
  /* Return footer rightSlot props for view layer */
@@ -3315,6 +3350,14 @@ class Date$1 extends TextInput {
3315
3350
  * Determines the type of the picker - date for date picker, month for month picker.
3316
3351
  */
3317
3352
  this.pickerType = 'date';
3353
+ /**
3354
+ * Helper options.
3355
+ */
3356
+ this.helperOptions = [];
3357
+ /**
3358
+ * Helper value.
3359
+ */
3360
+ this.helperValue = '';
3318
3361
  /**
3319
3362
  * Width of the picker.
3320
3363
  */
@@ -3323,6 +3366,8 @@ class Date$1 extends TextInput {
3323
3366
  this.dateError = false;
3324
3367
  this.formatterFn = FormatterParserProvider.getFormatter('ZdDate');
3325
3368
  this.parserFn = FormatterParserProvider.getParser('ZdDate');
3369
+ this.previousHint = '';
3370
+ this.previousPersistentHint = false;
3326
3371
  this.allowedDates = this.getInitValue('allowedDates', props.allowedDates, this.allowedDates);
3327
3372
  this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, 'calendar');
3328
3373
  this.autocomplete = this.getInitValue('autocomplete', props.autocomplete, this.autocomplete);
@@ -3338,6 +3383,8 @@ class Date$1 extends TextInput {
3338
3383
  this.showDatePicker = this.getInitValue('showDatePicker', props.showDatePicker, this.showDatePicker);
3339
3384
  this.showWeek = this.getInitValue('showWeek', props.showWeek, this.showWeek);
3340
3385
  this.pickerType = this.getInitValue('pickerType', props.pickerType, this.pickerType);
3386
+ this.helperOptions = this.getInitValue('helperOptions', props.helperOptions, this.helperOptions);
3387
+ this.helperValue = this.getInitValue('helperValue', props.helperValue, this.helperValue);
3341
3388
  if (this.pickerType === 'month') {
3342
3389
  this.isoFormat = 'YYYY-MM';
3343
3390
  }
@@ -3375,12 +3422,12 @@ class Date$1 extends TextInput {
3375
3422
  }
3376
3423
  }
3377
3424
  get displayValue() {
3378
- return this.formatter(this.value);
3425
+ return this.internalDisplayValue;
3379
3426
  }
3380
3427
  set displayValue(newValue) {
3381
3428
  this.dateError = false;
3382
- const dateValue = newValue;
3383
- this.value = this.parser(dateValue);
3429
+ this.internalDisplayValue = newValue;
3430
+ this.internalValue = this.parser(newValue);
3384
3431
  }
3385
3432
  /**
3386
3433
  * Assign the updated mask to mask property
@@ -3405,14 +3452,16 @@ class Date$1 extends TextInput {
3405
3452
  setDateValue(displayValue) {
3406
3453
  const lastValue = this.displayValue;
3407
3454
  if (this.isValidDate(displayValue, this.displayFormat)) {
3408
- this.displayValue = displayValue;
3455
+ this.internalDisplayValue = displayValue;
3456
+ this.internalValue = this.parser(displayValue);
3409
3457
  this.dateError = false;
3410
3458
  if (lastValue !== this.displayValue)
3411
3459
  this.change(this.value);
3412
3460
  }
3413
3461
  else {
3414
3462
  if (!displayValue) {
3415
- this.displayValue = displayValue;
3463
+ this.internalDisplayValue = displayValue;
3464
+ this.internalValue = null;
3416
3465
  if (lastValue !== this.displayValue)
3417
3466
  this.change(this.value);
3418
3467
  }
@@ -3456,7 +3505,7 @@ class Date$1 extends TextInput {
3456
3505
  }
3457
3506
  blur(event, element) {
3458
3507
  this.removeDateMask();
3459
- this.setDateValue(this.displayValue);
3508
+ this.setDateValue(this.formatter(this.value));
3460
3509
  super.blur(event, element);
3461
3510
  this.showDatePicker = false;
3462
3511
  }
@@ -3472,6 +3521,7 @@ class Date$1 extends TextInput {
3472
3521
  return;
3473
3522
  setTimeout(() => {
3474
3523
  this.mask = this.initialMask;
3524
+ this.internalDisplayValue = dayjs(this.value, this.dateFormat).format(this.inputFormat || this.displayFormat);
3475
3525
  });
3476
3526
  }
3477
3527
  /**
@@ -3514,6 +3564,20 @@ class Date$1 extends TextInput {
3514
3564
  const chars = replaced.split('');
3515
3565
  return chars.length ? chars.every((char) => Mask.isMaskDelimiter(char)) : true;
3516
3566
  }
3567
+ updateHelperHint() {
3568
+ if (this.helperValue) {
3569
+ this.previousHint = this.hint;
3570
+ this.previousPersistentHint = this.persistentHint;
3571
+ this.hint = DateHelper.getLabel(this.helperValue);
3572
+ this.persistentHint = true;
3573
+ }
3574
+ }
3575
+ change(event, element) {
3576
+ super.change(event, element);
3577
+ this.helperValue = '';
3578
+ this.hint = this.previousHint;
3579
+ this.persistentHint = this.previousPersistentHint;
3580
+ }
3517
3581
  }
3518
3582
  FormatterParserProvider.registerFormatter('ZdDate', (value, { dateFormat = Config.dateFormat, displayFormat = Config.displayFormat, inputFormat = Config.dateInputFormat, mask = '', initialMask, isSimpleDisplay = false, } = {}) => {
3519
3583
  if (!value) {
@@ -3643,10 +3707,20 @@ class DateRange extends TextInput {
3643
3707
  * Width of the picker.
3644
3708
  */
3645
3709
  this.width = 248;
3710
+ /**
3711
+ * Helper options.
3712
+ */
3713
+ this.helperOptions = [];
3714
+ /**
3715
+ * Helper value.
3716
+ */
3717
+ this.helperValue = '';
3646
3718
  this.isoFormat = 'YYYY-MM-DD';
3647
3719
  this.dateError = false;
3648
3720
  this.formatterFn = FormatterParserProvider.getFormatter('ZdDateRange');
3649
3721
  this.parserFn = FormatterParserProvider.getParser('ZdDateRange');
3722
+ this.previousHint = '';
3723
+ this.previousPersistentHint = false;
3650
3724
  this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, 'calendar');
3651
3725
  this.autocomplete = this.getInitValue('autocomplete', props.autocomplete, this.autocomplete);
3652
3726
  this.dateFormat = this.getInitValue('dateFormat', props.dateFormat, this.dateFormat);
@@ -3662,6 +3736,8 @@ class DateRange extends TextInput {
3662
3736
  this.splitter = this.getInitValue('splitter', props.splitter, this.splitter);
3663
3737
  this.width = this.getInitValue('width', props.width, this.width);
3664
3738
  this.mask = this.getInitValue('mask', props.mask, undefined);
3739
+ this.helperOptions = this.getInitValue('helperOptions', props.helperOptions, this.helperOptions);
3740
+ this.helperValue = this.getInitValue('helperValue', props.helperValue, this.helperValue);
3665
3741
  this.createAccessors();
3666
3742
  this.unitMask = this.mask;
3667
3743
  this.initialMask = this.getInitialMask();
@@ -3688,15 +3764,15 @@ class DateRange extends TextInput {
3688
3764
  formatter(value) { return this.formatterFn(value, this); }
3689
3765
  parser(value) { return this.parserFn(value, this); }
3690
3766
  get displayValue() {
3691
- return this.formatter(this.value);
3767
+ return this.internalDisplayValue;
3692
3768
  }
3693
3769
  set displayValue(newValue) {
3694
3770
  this.dateError = false;
3695
- const dateValue = newValue;
3696
- if (dateValue)
3697
- this.value = this.parser(dateValue);
3771
+ this.internalDisplayValue = newValue;
3772
+ if (newValue)
3773
+ this.internalValue = this.parser(newValue);
3698
3774
  else
3699
- this.value = [];
3775
+ this.internalValue = [];
3700
3776
  }
3701
3777
  /**
3702
3778
  * Assign the updated mask to mask property
@@ -3722,14 +3798,16 @@ class DateRange extends TextInput {
3722
3798
  const lastValue = this.displayValue;
3723
3799
  const values = this.splitValues(displayValue);
3724
3800
  if (this.isValidDateArray(this.displayFormat, values)) {
3725
- this.displayValue = displayValue;
3801
+ this.internalDisplayValue = displayValue;
3802
+ this.internalValue = this.parser(displayValue);
3726
3803
  this.dateError = false;
3727
3804
  if (lastValue !== this.displayValue)
3728
3805
  this.change(this.value);
3729
3806
  }
3730
3807
  else {
3731
3808
  if (!displayValue) {
3732
- this.displayValue = displayValue;
3809
+ this.internalDisplayValue = displayValue;
3810
+ this.internalValue = [];
3733
3811
  if (lastValue !== this.displayValue)
3734
3812
  this.change(this.value);
3735
3813
  }
@@ -3805,11 +3883,13 @@ class DateRange extends TextInput {
3805
3883
  }
3806
3884
  }
3807
3885
  blur(event, element) {
3808
- this.value = this.sortDates(this.value);
3809
- this.removeDateMask();
3810
- this.setDateValue(this.displayValue);
3811
- super.blur(event, element);
3812
- this.showDatePicker = false;
3886
+ if (this.value) {
3887
+ this.value = this.sortDates(this.value);
3888
+ this.removeDateMask();
3889
+ this.setDateValue(this.formatter(this.value));
3890
+ super.blur(event, element);
3891
+ this.showDatePicker = false;
3892
+ }
3813
3893
  }
3814
3894
  focus(event, element) {
3815
3895
  this.addDateMask();
@@ -3823,6 +3903,13 @@ class DateRange extends TextInput {
3823
3903
  return;
3824
3904
  setTimeout(() => {
3825
3905
  this.mask = this.initialMask;
3906
+ const firstDate = this.value[0]
3907
+ ? dayjs(this.value[0], this.dateFormat).format(this.inputFormat || this.displayFormat)
3908
+ : '';
3909
+ const lastDate = this.value[1]
3910
+ ? dayjs(this.value[1], this.dateFormat).format(this.inputFormat || this.displayFormat)
3911
+ : '';
3912
+ this.internalDisplayValue = `${firstDate}${lastDate ? this.splitter : ''}${lastDate}`;
3826
3913
  });
3827
3914
  }
3828
3915
  /**
@@ -3865,6 +3952,20 @@ class DateRange extends TextInput {
3865
3952
  const chars = replaced.split('');
3866
3953
  return chars.length ? chars.every((char) => Mask.isMaskDelimiter(char)) : true;
3867
3954
  }
3955
+ updateHelperHint() {
3956
+ if (this.helperValue) {
3957
+ this.previousHint = this.hint;
3958
+ this.previousPersistentHint = this.persistentHint;
3959
+ this.hint = DateHelper.getLabel(this.helperValue);
3960
+ this.persistentHint = true;
3961
+ }
3962
+ }
3963
+ change(event, element) {
3964
+ super.change(event, element);
3965
+ this.helperValue = '';
3966
+ this.hint = this.previousHint;
3967
+ this.persistentHint = this.previousPersistentHint;
3968
+ }
3868
3969
  }
3869
3970
  FormatterParserProvider.registerFormatter('ZdDateRange', (value, { dateFormat = Config.dateFormat, displayFormat = Config.displayFormat, inputFormat = Config.dateInputFormat, initialMask, splitter = ' ~ ', unitMask = '', mask = '', isSimpleDisplay = false, } = {}) => {
3870
3971
  if (!value || value.length === 0 || (value.length === 1 && !value[0])) {
@@ -4311,6 +4412,7 @@ class Frame extends ComponentRender {
4311
4412
  this.local = false;
4312
4413
  this.metadata = {};
4313
4414
  this.override = {};
4415
+ this.overrideNamedProps = {};
4314
4416
  this.cache = false;
4315
4417
  this.cacheDuration = 2 * 60 * 60 * 1000;
4316
4418
  this.height = 'auto';
@@ -4320,6 +4422,7 @@ class Frame extends ComponentRender {
4320
4422
  this.path = props.path;
4321
4423
  this.local = props.local === true;
4322
4424
  this.override = props.override || this.override;
4425
+ this.overrideNamedProps = props.overrideNamedProps || this.overrideNamedProps;
4323
4426
  this.cache = props.cache || this.cache;
4324
4427
  this.cacheDuration = this.getInitValue('cacheDuration', props.cacheDuration, this.cacheDuration);
4325
4428
  this.height = this.getInitValue('height', props.height, this.height);
@@ -4335,6 +4438,9 @@ class Frame extends ComponentRender {
4335
4438
  if (typeof page !== 'object')
4336
4439
  throw new Error();
4337
4440
  this.metadata = merge(page, this.override);
4441
+ if (Object.keys(this.overrideNamedProps).length !== 0) {
4442
+ this.metadata = this.overrideNamedPropsFunc(this.metadata);
4443
+ }
4338
4444
  }
4339
4445
  catch (_a) {
4340
4446
  this.notFoundError();
@@ -4345,6 +4451,13 @@ class Frame extends ComponentRender {
4345
4451
  }
4346
4452
  });
4347
4453
  }
4454
+ overrideNamedPropsFunc(metadata) {
4455
+ let strMatadata = JSON.stringify(metadata);
4456
+ Object.keys(this.overrideNamedProps).forEach((key) => {
4457
+ strMatadata = strMatadata.replace(RegExp(`<<${key}>>`, 'g'), this.overrideNamedProps[key]);
4458
+ });
4459
+ return JSON.parse(strMatadata);
4460
+ }
4348
4461
  reload() {
4349
4462
  return __awaiter(this, void 0, void 0, function* () {
4350
4463
  this.loading = true;
@@ -4947,6 +5060,9 @@ class Grid extends Iterable {
4947
5060
  this.toolbarSlot = [
4948
5061
  { name: '<<NAME>>_gridSearch', component: 'ZdSearch' },
4949
5062
  ];
5063
+ this.loadingText = 'LOADING';
5064
+ this.noDataText = 'NO_DATA';
5065
+ this.noResultsText = 'NO_RESULT';
4950
5066
  /**
4951
5067
  * Components that will be rendered in no-data case
4952
5068
  */
@@ -4955,7 +5071,7 @@ class Grid extends Iterable {
4955
5071
  name: '<<NAME>>_no-data',
4956
5072
  component: 'ZdText',
4957
5073
  cssClass: 'no-data',
4958
- text: 'NO_DATA',
5074
+ text: this.noDataText,
4959
5075
  },
4960
5076
  ];
4961
5077
  /**
@@ -4966,7 +5082,7 @@ class Grid extends Iterable {
4966
5082
  name: '<<NAME>>_no-result',
4967
5083
  component: 'ZdText',
4968
5084
  cssClass: 'no-result',
4969
- text: 'NO_RESULT',
5085
+ text: this.noResultsText,
4970
5086
  },
4971
5087
  ];
4972
5088
  /**
@@ -5070,6 +5186,7 @@ class Grid extends Iterable {
5070
5186
  this.headerCellTextColor = this.getInitValue('headerCellTextColor', props.headerCellTextColor, this.headerCellTextColor);
5071
5187
  this.dragColumns = this.getInitValue('dragColumns', props.dragColumns, this.dragColumns);
5072
5188
  this.resizeColumns = this.getInitValue('resizeColumns', props.resizeColumns, this.resizeColumns);
5189
+ this.loadingText = this.getInitValue('loadingText', props.loadingText, this.loadingText);
5073
5190
  this.toolbarSlot = props.toolbarSlot || this.toolbarSlot;
5074
5191
  this.footerSlot = props.footerSlot || this.footerSlot;
5075
5192
  this.noDataSlot = props.noDataSlot || this.noDataSlot;
@@ -5079,6 +5196,8 @@ class Grid extends Iterable {
5079
5196
  this.footerSlot = this.changeDefaultSlotNames(this.footerSlot);
5080
5197
  this.toolbarSlot = this.changeDefaultSlotNames(this.toolbarSlot);
5081
5198
  this.noResultSlot = this.changeDefaultSlotNames(this.noResultSlot);
5199
+ this.noDataText = this.getInitValue('noDataText', props.noDataText, this.noDataText);
5200
+ this.noResultsText = this.getInitValue('noResultsText', props.noResultsText, this.noResultsText);
5082
5201
  this.createAccessors();
5083
5202
  }
5084
5203
  onMounted(element) {
@@ -6209,6 +6328,10 @@ class Select extends TextInput {
6209
6328
  * Maximum height of select menu
6210
6329
  */
6211
6330
  this.menuMaxHeight = 304;
6331
+ /**
6332
+ * Maximum width of select menu
6333
+ */
6334
+ this.menuMaxWidth = 'auto';
6212
6335
  /**
6213
6336
  * Input select value
6214
6337
  */
@@ -6268,6 +6391,7 @@ class Select extends TextInput {
6268
6391
  this.dataValue = this.getInitValue('dataValue', props.dataValue, this.dataValue);
6269
6392
  this.dataDisabled = this.getInitValue('dataDisabled', props.dataDisabled, this.dataDisabled);
6270
6393
  this.menuMaxHeight = this.getInitValue('menuMaxHeight', props.menuMaxHeight, this.menuMaxHeight);
6394
+ this.menuMaxWidth = this.getInitValue('menuMaxWidth', props.menuMaxWidth, this.menuMaxWidth);
6271
6395
  this.returnObject = this.getInitValue('returnObject', props.returnObject, this.returnObject);
6272
6396
  this.autocomplete = this.getInitValue('autocomplete', props.autocomplete, this.autocomplete);
6273
6397
  this.disabledItems = this.getInitValue('disabledItems', props.disabledItems, this.disabledItems);
@@ -6363,8 +6487,10 @@ class Select extends TextInput {
6363
6487
  getItemsBySearchValue(value, searchIn) {
6364
6488
  return __awaiter(this, void 0, void 0, function* () {
6365
6489
  const config = Object.assign(Object.assign(Object.assign({}, this.datasource.clone()), this.dsSearch[this.searchParam](value, searchIn)), { lazyLoad: true });
6490
+ this.datasource.loading = true;
6366
6491
  const datasource = DatasourceFactory.factory(config);
6367
6492
  const items = yield datasource.get();
6493
+ this.datasource.loading = false;
6368
6494
  datasource.destroy();
6369
6495
  return items.find(this.getCondition(value));
6370
6496
  });
@@ -8267,6 +8393,12 @@ class RangeSlider extends Input {
8267
8393
  this.vertical = this.getInitValue('vertical', props.vertical, this.vertical);
8268
8394
  this.createAccessors();
8269
8395
  }
8396
+ get value() {
8397
+ return this.rangeSliderValue === null ? undefined : this.rangeSliderValue;
8398
+ }
8399
+ set value(value) {
8400
+ this.rangeSliderValue = value;
8401
+ }
8270
8402
  }
8271
8403
 
8272
8404
  /**
@@ -9307,23 +9439,21 @@ class SelectTree extends TextInput {
9307
9439
  return this.selectValue;
9308
9440
  }
9309
9441
  set value(value) {
9310
- this.selectValue = value;
9442
+ this.setValue(value);
9311
9443
  }
9312
9444
  setValue(value) {
9313
- if (this.returnObject) {
9314
- if (typeof value !== 'object') {
9315
- this.value = { id: value };
9316
- }
9317
- else {
9318
- this.value = { id: value[this.dataValue] };
9319
- }
9445
+ let val = value;
9446
+ if (typeof value === 'object' && !Array.isArray(value) && value !== null) {
9447
+ val = value[this.dataValue];
9320
9448
  }
9321
- else if (typeof value === 'object') {
9322
- this.value = value[this.dataValue];
9449
+ else if (!value && value !== 0) {
9450
+ val = null;
9323
9451
  }
9324
- else {
9325
- this.value = value;
9452
+ if (this.returnObject) {
9453
+ this.selectValue = val ? { id: val } : null;
9454
+ return;
9326
9455
  }
9456
+ this.selectValue = val;
9327
9457
  }
9328
9458
  }
9329
9459
 
@@ -9746,6 +9876,7 @@ class Tab extends Component {
9746
9876
  this.tabTitle = '';
9747
9877
  this.tabTitle = this.getInitValue('tabTitle', props.tabTitle, this.tabTitle);
9748
9878
  this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
9879
+ this.flex = this.getInitValue('flex', props.flex, this.flex);
9749
9880
  this.createAccessors();
9750
9881
  }
9751
9882
  }
@@ -9776,13 +9907,26 @@ class Tabs extends ComponentRender {
9776
9907
  */
9777
9908
  constructor(props) {
9778
9909
  super(props);
9779
- this.activeTab = 0;
9910
+ this.activeTabValue = 0;
9780
9911
  this.tabs = [];
9781
9912
  this.tabs = this.getTabs(props.tabs || []);
9782
- this.activeTab = this.getInitValue('activeTab', props.activeTab, this.activeTab);
9913
+ this.activeTab = this.getInitValue('activeTab', props.activeTab, this.activeTabValue);
9783
9914
  this.height = this.getInitValue('height', props.height, this.height);
9784
9915
  this.createAccessors();
9785
9916
  }
9917
+ get activeTab() {
9918
+ var _a;
9919
+ if (this.activeTabValue >= 0 && !((_a = this.tabs[this.activeTabValue]) === null || _a === void 0 ? void 0 : _a.isVisible)) {
9920
+ const firstTabIndex = this.tabs.findIndex((tab) => tab.isVisible);
9921
+ if (firstTabIndex > -1) {
9922
+ this.activeTabValue = firstTabIndex;
9923
+ }
9924
+ }
9925
+ return this.activeTabValue;
9926
+ }
9927
+ set activeTab(index) {
9928
+ this.activeTabValue = index;
9929
+ }
9786
9930
  getTabs(tabs) {
9787
9931
  return tabs.map((tab) => new Tab(tab));
9788
9932
  }
@@ -10316,6 +10460,8 @@ class Tree extends ComponentRender {
10316
10460
  this.titleField = '';
10317
10461
  /** Datasource data field */
10318
10462
  this.dataField = '';
10463
+ /** Datasource checked field */
10464
+ this.checkedField = 'checked';
10319
10465
  /**
10320
10466
  * Defines if the tree will be opened or not (true/false) or if it should open only until a specific level
10321
10467
  */
@@ -10334,7 +10480,6 @@ class Tree extends ComponentRender {
10334
10480
  this.appliedConditions = {};
10335
10481
  /* Conditions of tree */
10336
10482
  this.factoredConditions = {};
10337
- this.nodes = this.initNodes(props.nodes || this.nodes);
10338
10483
  this.itemIconName = this.getInitValue('itemIconName', props.itemIconName, this.itemIconName);
10339
10484
  this.groupIconName = this.getInitValue('groupIconName', props.groupIconName, this.groupIconName);
10340
10485
  this.openedIconName = this.getInitValue('openedIconName', props.openedIconName, this.openedIconName);
@@ -10344,6 +10489,7 @@ class Tree extends ComponentRender {
10344
10489
  this.parentField = this.getInitValue('parentField', props.parentField, this.parentField);
10345
10490
  this.titleField = this.getInitValue('titleField', props.titleField, this.titleField);
10346
10491
  this.dataField = this.getInitValue('dataField', props.dataField, this.dataField);
10492
+ this.checkedField = this.getInitValue('checkedField', props.checkedField, this.checkedField);
10347
10493
  this.openLevelOnLoad = this.getInitValue('openLevelOnLoad', props.openLevelOnLoad, this.openLevelOnLoad);
10348
10494
  this.checkbox = this.getInitValue('checkbox', props.checkbox, this.checkbox);
10349
10495
  this.afterTitleSlot = props.afterTitleSlot || this.afterTitleSlot;
@@ -10361,29 +10507,46 @@ class Tree extends ComponentRender {
10361
10507
  this.createDataStructure();
10362
10508
  }
10363
10509
  this.createAccessors();
10510
+ this.nodes = props.nodes || this.nodes;
10364
10511
  }
10365
10512
  /**
10366
10513
  * Initialize all the properties of the declared nodes (reactivity)
10367
10514
  */
10368
- initNodes(nodes) {
10369
- 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 || []) })));
10515
+ initNodes(nodes, override) {
10516
+ return nodes.map((node) => {
10517
+ let newNode = {
10518
+ title: '',
10519
+ isLeaf: false,
10520
+ isExpanded: true,
10521
+ isSelected: false,
10522
+ isDraggable: true,
10523
+ isSelectable: true,
10524
+ data: {
10525
+ [this.checkedField]: false,
10526
+ },
10527
+ children: [],
10528
+ };
10529
+ newNode = merge(newNode, node, override);
10530
+ newNode.children = this.initNodes(node.children || [], override);
10531
+ return newNode;
10532
+ });
10370
10533
  }
10371
10534
  /** Nodes */
10372
10535
  get nodes() {
10373
10536
  return this.nodesValue;
10374
10537
  }
10375
10538
  set nodes(value) {
10539
+ let override = {};
10376
10540
  if (!this.allowDragDrop) {
10377
- this.removeDraggable(value);
10541
+ override = { isDraggable: false };
10378
10542
  }
10379
- this.nodesValue = value;
10543
+ this.nodesValue = this.initNodes(value, override);
10380
10544
  }
10381
10545
  getCheckedNodes() {
10382
10546
  const selectedNodes = [];
10383
10547
  this.tree.traverse((node) => {
10384
- const instanceNode = this.getNode(node.path || []);
10385
- if (instanceNode === null || instanceNode === void 0 ? void 0 : instanceNode.isChecked) {
10386
- selectedNodes.push(instanceNode);
10548
+ if (node.data && node.data[this.checkedField]) {
10549
+ selectedNodes.push(node);
10387
10550
  }
10388
10551
  });
10389
10552
  return selectedNodes;
@@ -10436,15 +10599,16 @@ class Tree extends ComponentRender {
10436
10599
  }
10437
10600
  /** Insert nodes by the current cursor position */
10438
10601
  insertNode(newNode) {
10602
+ const initNode = this.initNodes([newNode])[0];
10439
10603
  if (this.selectedNodes.length) {
10440
10604
  const cursorPosition = {
10441
10605
  node: this.selectedNodes[0],
10442
10606
  placement: 'inside',
10443
10607
  };
10444
- this.tree.insert(cursorPosition, newNode);
10608
+ this.tree.insert(cursorPosition, initNode);
10445
10609
  }
10446
10610
  else {
10447
- this.nodes.push(newNode);
10611
+ this.nodes.push(initNode);
10448
10612
  }
10449
10613
  }
10450
10614
  importNodes(nodes) {
@@ -10474,15 +10638,6 @@ class Tree extends ComponentRender {
10474
10638
  updateNodeData(node, value) {
10475
10639
  this.tree.updateNode(node.path, value);
10476
10640
  }
10477
- removeDraggable(items) {
10478
- items.forEach((item) => {
10479
- var _a;
10480
- item.isDraggable = false;
10481
- if ((_a = item.children) === null || _a === void 0 ? void 0 : _a.length) {
10482
- this.removeDraggable(item.children);
10483
- }
10484
- });
10485
- }
10486
10641
  setTree(tree) {
10487
10642
  this.tree = tree;
10488
10643
  }
@@ -10614,7 +10769,7 @@ class Tree extends ComponentRender {
10614
10769
  }
10615
10770
  getParentNode(node) {
10616
10771
  var _a;
10617
- return this.getNode(((_a = node.path) === null || _a === void 0 ? void 0 : _a.slice(0, -1)) || []);
10772
+ return this.tree.getNode(((_a = node.path) === null || _a === void 0 ? void 0 : _a.slice(0, -1)) || []);
10618
10773
  }
10619
10774
  searchPath(nodes, path) {
10620
10775
  const currentNode = (path[0] > -1 && path[0] < nodes.length) ? nodes[path[0]] : undefined;
@@ -10809,6 +10964,7 @@ class TreeGridEditable extends TreeGrid {
10809
10964
  },
10810
10965
  };
10811
10966
  this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
10967
+ this.noDataSlot = this.changeDefaultSlotNames(this.noDataSlot);
10812
10968
  this.createAccessors();
10813
10969
  }
10814
10970
  onMounted(element) {