@zeedhi/common 1.46.0 → 1.48.1

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;
@@ -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 });
@@ -1767,14 +1773,39 @@ class Input extends ComponentRender {
1767
1773
  this.rules = Object.values(this.parsedValidations)
1768
1774
  .map((validation) => () => validation(this.value));
1769
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
+ }
1770
1788
  /**
1771
1789
  * Input displayed value.
1772
1790
  */
1773
1791
  get displayValue() {
1774
- return this.formatter(this.value);
1792
+ return this.internalDisplayValue;
1775
1793
  }
1776
1794
  set displayValue(value) {
1777
- 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
+ }
1778
1809
  }
1779
1810
  /**
1780
1811
  * Retrieves a formatted value.
@@ -2863,6 +2894,7 @@ class Dashboard extends ComponentRender {
2863
2894
  this.cards = [];
2864
2895
  /* Card ID to be deleted */
2865
2896
  this.deleteCardId = '';
2897
+ this.overrideNamedProps = {};
2866
2898
  /* Remove the paddings of the dashboard */
2867
2899
  this.removePadding = false;
2868
2900
  /* Height of the dashboard */
@@ -3071,6 +3103,7 @@ class Dashboard extends ComponentRender {
3071
3103
  this.editingMode = this.getInitValue('editingMode', props.editingMode, this.editingMode);
3072
3104
  this.moveMode = this.getInitValue('moveMode', props.moveMode, this.moveMode);
3073
3105
  this.cards = props.cards || this.cards;
3106
+ this.overrideNamedProps = props.overrideNamedProps || this.overrideNamedProps;
3074
3107
  this.removePadding = this.getInitValue('removePadding', props.removePadding, this.removePadding);
3075
3108
  this.height = this.getInitValue('height', props.height, this.height);
3076
3109
  this.heightAdjust = this.getInitValue('heightAdjust', props.heightAdjust, this.heightAdjust);
@@ -3208,6 +3241,7 @@ class Dashboard extends ComponentRender {
3208
3241
  component: 'ZdFrame',
3209
3242
  path: card.path,
3210
3243
  local: card.local,
3244
+ overrideNamedProps: card.overrideNamedProps,
3211
3245
  };
3212
3246
  }
3213
3247
  /* Return footer rightSlot props for view layer */
@@ -3316,6 +3350,14 @@ class Date$1 extends TextInput {
3316
3350
  * Determines the type of the picker - date for date picker, month for month picker.
3317
3351
  */
3318
3352
  this.pickerType = 'date';
3353
+ /**
3354
+ * Helper options.
3355
+ */
3356
+ this.helperOptions = [];
3357
+ /**
3358
+ * Helper value.
3359
+ */
3360
+ this.helperValue = '';
3319
3361
  /**
3320
3362
  * Width of the picker.
3321
3363
  */
@@ -3324,6 +3366,8 @@ class Date$1 extends TextInput {
3324
3366
  this.dateError = false;
3325
3367
  this.formatterFn = FormatterParserProvider.getFormatter('ZdDate');
3326
3368
  this.parserFn = FormatterParserProvider.getParser('ZdDate');
3369
+ this.previousHint = '';
3370
+ this.previousPersistentHint = false;
3327
3371
  this.allowedDates = this.getInitValue('allowedDates', props.allowedDates, this.allowedDates);
3328
3372
  this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, 'calendar');
3329
3373
  this.autocomplete = this.getInitValue('autocomplete', props.autocomplete, this.autocomplete);
@@ -3339,6 +3383,8 @@ class Date$1 extends TextInput {
3339
3383
  this.showDatePicker = this.getInitValue('showDatePicker', props.showDatePicker, this.showDatePicker);
3340
3384
  this.showWeek = this.getInitValue('showWeek', props.showWeek, this.showWeek);
3341
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);
3342
3388
  if (this.pickerType === 'month') {
3343
3389
  this.isoFormat = 'YYYY-MM';
3344
3390
  }
@@ -3376,12 +3422,12 @@ class Date$1 extends TextInput {
3376
3422
  }
3377
3423
  }
3378
3424
  get displayValue() {
3379
- return this.formatter(this.value);
3425
+ return this.internalDisplayValue;
3380
3426
  }
3381
3427
  set displayValue(newValue) {
3382
3428
  this.dateError = false;
3383
- const dateValue = newValue;
3384
- this.value = this.parser(dateValue);
3429
+ this.internalDisplayValue = newValue;
3430
+ this.internalValue = this.parser(newValue);
3385
3431
  }
3386
3432
  /**
3387
3433
  * Assign the updated mask to mask property
@@ -3406,14 +3452,16 @@ class Date$1 extends TextInput {
3406
3452
  setDateValue(displayValue) {
3407
3453
  const lastValue = this.displayValue;
3408
3454
  if (this.isValidDate(displayValue, this.displayFormat)) {
3409
- this.displayValue = displayValue;
3455
+ this.internalDisplayValue = displayValue;
3456
+ this.internalValue = this.parser(displayValue);
3410
3457
  this.dateError = false;
3411
3458
  if (lastValue !== this.displayValue)
3412
3459
  this.change(this.value);
3413
3460
  }
3414
3461
  else {
3415
3462
  if (!displayValue) {
3416
- this.displayValue = displayValue;
3463
+ this.internalDisplayValue = displayValue;
3464
+ this.internalValue = null;
3417
3465
  if (lastValue !== this.displayValue)
3418
3466
  this.change(this.value);
3419
3467
  }
@@ -3457,7 +3505,7 @@ class Date$1 extends TextInput {
3457
3505
  }
3458
3506
  blur(event, element) {
3459
3507
  this.removeDateMask();
3460
- this.setDateValue(this.displayValue);
3508
+ this.setDateValue(this.formatter(this.value));
3461
3509
  super.blur(event, element);
3462
3510
  this.showDatePicker = false;
3463
3511
  }
@@ -3473,6 +3521,7 @@ class Date$1 extends TextInput {
3473
3521
  return;
3474
3522
  setTimeout(() => {
3475
3523
  this.mask = this.initialMask;
3524
+ this.internalDisplayValue = dayjs(this.value, this.dateFormat).format(this.inputFormat || this.displayFormat);
3476
3525
  });
3477
3526
  }
3478
3527
  /**
@@ -3515,6 +3564,20 @@ class Date$1 extends TextInput {
3515
3564
  const chars = replaced.split('');
3516
3565
  return chars.length ? chars.every((char) => Mask.isMaskDelimiter(char)) : true;
3517
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
+ }
3518
3581
  }
3519
3582
  FormatterParserProvider.registerFormatter('ZdDate', (value, { dateFormat = Config.dateFormat, displayFormat = Config.displayFormat, inputFormat = Config.dateInputFormat, mask = '', initialMask, isSimpleDisplay = false, } = {}) => {
3520
3583
  if (!value) {
@@ -3644,10 +3707,20 @@ class DateRange extends TextInput {
3644
3707
  * Width of the picker.
3645
3708
  */
3646
3709
  this.width = 248;
3710
+ /**
3711
+ * Helper options.
3712
+ */
3713
+ this.helperOptions = [];
3714
+ /**
3715
+ * Helper value.
3716
+ */
3717
+ this.helperValue = '';
3647
3718
  this.isoFormat = 'YYYY-MM-DD';
3648
3719
  this.dateError = false;
3649
3720
  this.formatterFn = FormatterParserProvider.getFormatter('ZdDateRange');
3650
3721
  this.parserFn = FormatterParserProvider.getParser('ZdDateRange');
3722
+ this.previousHint = '';
3723
+ this.previousPersistentHint = false;
3651
3724
  this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, 'calendar');
3652
3725
  this.autocomplete = this.getInitValue('autocomplete', props.autocomplete, this.autocomplete);
3653
3726
  this.dateFormat = this.getInitValue('dateFormat', props.dateFormat, this.dateFormat);
@@ -3663,6 +3736,8 @@ class DateRange extends TextInput {
3663
3736
  this.splitter = this.getInitValue('splitter', props.splitter, this.splitter);
3664
3737
  this.width = this.getInitValue('width', props.width, this.width);
3665
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);
3666
3741
  this.createAccessors();
3667
3742
  this.unitMask = this.mask;
3668
3743
  this.initialMask = this.getInitialMask();
@@ -3689,15 +3764,15 @@ class DateRange extends TextInput {
3689
3764
  formatter(value) { return this.formatterFn(value, this); }
3690
3765
  parser(value) { return this.parserFn(value, this); }
3691
3766
  get displayValue() {
3692
- return this.formatter(this.value);
3767
+ return this.internalDisplayValue;
3693
3768
  }
3694
3769
  set displayValue(newValue) {
3695
3770
  this.dateError = false;
3696
- const dateValue = newValue;
3697
- if (dateValue)
3698
- this.value = this.parser(dateValue);
3771
+ this.internalDisplayValue = newValue;
3772
+ if (newValue)
3773
+ this.internalValue = this.parser(newValue);
3699
3774
  else
3700
- this.value = [];
3775
+ this.internalValue = [];
3701
3776
  }
3702
3777
  /**
3703
3778
  * Assign the updated mask to mask property
@@ -3723,14 +3798,16 @@ class DateRange extends TextInput {
3723
3798
  const lastValue = this.displayValue;
3724
3799
  const values = this.splitValues(displayValue);
3725
3800
  if (this.isValidDateArray(this.displayFormat, values)) {
3726
- this.displayValue = displayValue;
3801
+ this.internalDisplayValue = displayValue;
3802
+ this.internalValue = this.parser(displayValue);
3727
3803
  this.dateError = false;
3728
3804
  if (lastValue !== this.displayValue)
3729
3805
  this.change(this.value);
3730
3806
  }
3731
3807
  else {
3732
3808
  if (!displayValue) {
3733
- this.displayValue = displayValue;
3809
+ this.internalDisplayValue = displayValue;
3810
+ this.internalValue = [];
3734
3811
  if (lastValue !== this.displayValue)
3735
3812
  this.change(this.value);
3736
3813
  }
@@ -3806,11 +3883,13 @@ class DateRange extends TextInput {
3806
3883
  }
3807
3884
  }
3808
3885
  blur(event, element) {
3809
- this.value = this.sortDates(this.value);
3810
- this.removeDateMask();
3811
- this.setDateValue(this.displayValue);
3812
- super.blur(event, element);
3813
- 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
+ }
3814
3893
  }
3815
3894
  focus(event, element) {
3816
3895
  this.addDateMask();
@@ -3824,6 +3903,13 @@ class DateRange extends TextInput {
3824
3903
  return;
3825
3904
  setTimeout(() => {
3826
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}`;
3827
3913
  });
3828
3914
  }
3829
3915
  /**
@@ -3866,6 +3952,20 @@ class DateRange extends TextInput {
3866
3952
  const chars = replaced.split('');
3867
3953
  return chars.length ? chars.every((char) => Mask.isMaskDelimiter(char)) : true;
3868
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
+ }
3869
3969
  }
3870
3970
  FormatterParserProvider.registerFormatter('ZdDateRange', (value, { dateFormat = Config.dateFormat, displayFormat = Config.displayFormat, inputFormat = Config.dateInputFormat, initialMask, splitter = ' ~ ', unitMask = '', mask = '', isSimpleDisplay = false, } = {}) => {
3871
3971
  if (!value || value.length === 0 || (value.length === 1 && !value[0])) {
@@ -4312,6 +4412,7 @@ class Frame extends ComponentRender {
4312
4412
  this.local = false;
4313
4413
  this.metadata = {};
4314
4414
  this.override = {};
4415
+ this.overrideNamedProps = {};
4315
4416
  this.cache = false;
4316
4417
  this.cacheDuration = 2 * 60 * 60 * 1000;
4317
4418
  this.height = 'auto';
@@ -4321,6 +4422,7 @@ class Frame extends ComponentRender {
4321
4422
  this.path = props.path;
4322
4423
  this.local = props.local === true;
4323
4424
  this.override = props.override || this.override;
4425
+ this.overrideNamedProps = props.overrideNamedProps || this.overrideNamedProps;
4324
4426
  this.cache = props.cache || this.cache;
4325
4427
  this.cacheDuration = this.getInitValue('cacheDuration', props.cacheDuration, this.cacheDuration);
4326
4428
  this.height = this.getInitValue('height', props.height, this.height);
@@ -4336,6 +4438,9 @@ class Frame extends ComponentRender {
4336
4438
  if (typeof page !== 'object')
4337
4439
  throw new Error();
4338
4440
  this.metadata = merge(page, this.override);
4441
+ if (Object.keys(this.overrideNamedProps).length !== 0) {
4442
+ this.metadata = this.overrideNamedPropsFunc(this.metadata);
4443
+ }
4339
4444
  }
4340
4445
  catch (_a) {
4341
4446
  this.notFoundError();
@@ -4346,6 +4451,13 @@ class Frame extends ComponentRender {
4346
4451
  }
4347
4452
  });
4348
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
+ }
4349
4461
  reload() {
4350
4462
  return __awaiter(this, void 0, void 0, function* () {
4351
4463
  this.loading = true;
@@ -6216,6 +6328,10 @@ class Select extends TextInput {
6216
6328
  * Maximum height of select menu
6217
6329
  */
6218
6330
  this.menuMaxHeight = 304;
6331
+ /**
6332
+ * Maximum width of select menu
6333
+ */
6334
+ this.menuMaxWidth = 'auto';
6219
6335
  /**
6220
6336
  * Input select value
6221
6337
  */
@@ -6275,6 +6391,7 @@ class Select extends TextInput {
6275
6391
  this.dataValue = this.getInitValue('dataValue', props.dataValue, this.dataValue);
6276
6392
  this.dataDisabled = this.getInitValue('dataDisabled', props.dataDisabled, this.dataDisabled);
6277
6393
  this.menuMaxHeight = this.getInitValue('menuMaxHeight', props.menuMaxHeight, this.menuMaxHeight);
6394
+ this.menuMaxWidth = this.getInitValue('menuMaxWidth', props.menuMaxWidth, this.menuMaxWidth);
6278
6395
  this.returnObject = this.getInitValue('returnObject', props.returnObject, this.returnObject);
6279
6396
  this.autocomplete = this.getInitValue('autocomplete', props.autocomplete, this.autocomplete);
6280
6397
  this.disabledItems = this.getInitValue('disabledItems', props.disabledItems, this.disabledItems);
@@ -6370,8 +6487,10 @@ class Select extends TextInput {
6370
6487
  getItemsBySearchValue(value, searchIn) {
6371
6488
  return __awaiter(this, void 0, void 0, function* () {
6372
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;
6373
6491
  const datasource = DatasourceFactory.factory(config);
6374
6492
  const items = yield datasource.get();
6493
+ this.datasource.loading = false;
6375
6494
  datasource.destroy();
6376
6495
  return items.find(this.getCondition(value));
6377
6496
  });
@@ -9320,23 +9439,21 @@ class SelectTree extends TextInput {
9320
9439
  return this.selectValue;
9321
9440
  }
9322
9441
  set value(value) {
9323
- this.selectValue = value;
9442
+ this.setValue(value);
9324
9443
  }
9325
9444
  setValue(value) {
9326
- if (this.returnObject) {
9327
- if (typeof value !== 'object') {
9328
- this.value = { id: value };
9329
- }
9330
- else {
9331
- this.value = { id: value[this.dataValue] };
9332
- }
9445
+ let val = value;
9446
+ if (typeof value === 'object' && !Array.isArray(value) && value !== null) {
9447
+ val = value[this.dataValue];
9333
9448
  }
9334
- else if (typeof value === 'object') {
9335
- this.value = value[this.dataValue];
9449
+ else if (!value && value !== 0) {
9450
+ val = null;
9336
9451
  }
9337
- else {
9338
- this.value = value;
9452
+ if (this.returnObject) {
9453
+ this.selectValue = val ? { id: val } : null;
9454
+ return;
9339
9455
  }
9456
+ this.selectValue = val;
9340
9457
  }
9341
9458
  }
9342
9459
 
@@ -9759,6 +9876,7 @@ class Tab extends Component {
9759
9876
  this.tabTitle = '';
9760
9877
  this.tabTitle = this.getInitValue('tabTitle', props.tabTitle, this.tabTitle);
9761
9878
  this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
9879
+ this.flex = this.getInitValue('flex', props.flex, this.flex);
9762
9880
  this.createAccessors();
9763
9881
  }
9764
9882
  }
@@ -9789,13 +9907,26 @@ class Tabs extends ComponentRender {
9789
9907
  */
9790
9908
  constructor(props) {
9791
9909
  super(props);
9792
- this.activeTab = 0;
9910
+ this.activeTabValue = 0;
9793
9911
  this.tabs = [];
9794
9912
  this.tabs = this.getTabs(props.tabs || []);
9795
- this.activeTab = this.getInitValue('activeTab', props.activeTab, this.activeTab);
9913
+ this.activeTab = this.getInitValue('activeTab', props.activeTab, this.activeTabValue);
9796
9914
  this.height = this.getInitValue('height', props.height, this.height);
9797
9915
  this.createAccessors();
9798
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
+ }
9799
9930
  getTabs(tabs) {
9800
9931
  return tabs.map((tab) => new Tab(tab));
9801
9932
  }
@@ -47,6 +47,10 @@
47
47
  * Set css in line with cssStyle.
48
48
  */
49
49
  this.cssStyle = '';
50
+ /**
51
+ * Directives registered to the component.
52
+ */
53
+ this.directives = {};
50
54
  /**
51
55
  * Events registered to the component.
52
56
  */
@@ -77,12 +81,16 @@
77
81
  this.events = core.Event.factory(props.events || this.events);
78
82
  this.cssClass = this.getInitValue('cssClass', props.cssClass, this.cssClass);
79
83
  this.cssStyle = this.getInitValue('cssStyle', props.cssStyle, this.cssStyle);
84
+ this.directives = this.getInitValue('directives', props.directives, this.directives);
80
85
  this.isVisible = this.getInitValue('isVisible', props.isVisible, this.isVisible);
81
86
  this.dark = this.getInitValue('dark', props.dark, this.dark);
82
87
  this.light = this.getInitValue('light', props.light, this.light);
83
88
  this.children = Array.isArray(props.children) ? props.children : this.children;
84
89
  this.keyMap = core.KeyMap.factory(props.keyMap || this.keyMap);
85
90
  this.createAccessors();
91
+ Object.keys(this.directives).forEach((key) => {
92
+ this.directives[key] = core.Event.factory(this.directives[key]);
93
+ });
86
94
  }
87
95
  setViewFocus(viewFocus) {
88
96
  this.viewFocus = viewFocus;
@@ -1656,10 +1664,6 @@
1656
1664
  * Used to watch a value from store.
1657
1665
  */
1658
1666
  this.storePath = '';
1659
- /**
1660
- * Internal input value.
1661
- */
1662
- this.value = null;
1663
1667
  /**
1664
1668
  * Input validations.
1665
1669
  */
@@ -1670,6 +1674,8 @@
1670
1674
  this.parsedValidations = {};
1671
1675
  this.formatterFn = core.FormatterParserProvider.getFormatter('ZdInput');
1672
1676
  this.parserFn = core.FormatterParserProvider.getParser('ZdInput');
1677
+ this.internalDisplayValue = '';
1678
+ this.internalValue = null;
1673
1679
  this.lastInputValue = undefined;
1674
1680
  this.callInputEvent = debounce__default["default"](({ event, element, component }) => {
1675
1681
  this.callEvent('input', { event, element, component });
@@ -1774,14 +1780,39 @@
1774
1780
  this.rules = Object.values(this.parsedValidations)
1775
1781
  .map((validation) => () => validation(this.value));
1776
1782
  }
1783
+ /**
1784
+ * Input value.
1785
+ */
1786
+ get value() {
1787
+ return this.internalValue;
1788
+ }
1789
+ set value(value) {
1790
+ if (this.internalValue !== value) {
1791
+ this.internalDisplayValue = this.formatter(value);
1792
+ this.internalValue = value;
1793
+ }
1794
+ }
1777
1795
  /**
1778
1796
  * Input displayed value.
1779
1797
  */
1780
1798
  get displayValue() {
1781
- return this.formatter(this.value);
1799
+ return this.internalDisplayValue;
1782
1800
  }
1783
1801
  set displayValue(value) {
1784
- this.value = this.parser(value);
1802
+ if (this.internalDisplayValue !== value) {
1803
+ this.internalValue = this.parser(value);
1804
+ let { mask } = this;
1805
+ if (mask) {
1806
+ if (typeof mask === 'function') {
1807
+ mask = mask(this.internalValue);
1808
+ }
1809
+ this.internalDisplayValue = core.Mask.convertAll(mask, value);
1810
+ this.internalValue = this.parser(this.internalDisplayValue);
1811
+ }
1812
+ else {
1813
+ this.internalDisplayValue = value;
1814
+ }
1815
+ }
1785
1816
  }
1786
1817
  /**
1787
1818
  * Retrieves a formatted value.
@@ -2870,6 +2901,7 @@
2870
2901
  this.cards = [];
2871
2902
  /* Card ID to be deleted */
2872
2903
  this.deleteCardId = '';
2904
+ this.overrideNamedProps = {};
2873
2905
  /* Remove the paddings of the dashboard */
2874
2906
  this.removePadding = false;
2875
2907
  /* Height of the dashboard */
@@ -3078,6 +3110,7 @@
3078
3110
  this.editingMode = this.getInitValue('editingMode', props.editingMode, this.editingMode);
3079
3111
  this.moveMode = this.getInitValue('moveMode', props.moveMode, this.moveMode);
3080
3112
  this.cards = props.cards || this.cards;
3113
+ this.overrideNamedProps = props.overrideNamedProps || this.overrideNamedProps;
3081
3114
  this.removePadding = this.getInitValue('removePadding', props.removePadding, this.removePadding);
3082
3115
  this.height = this.getInitValue('height', props.height, this.height);
3083
3116
  this.heightAdjust = this.getInitValue('heightAdjust', props.heightAdjust, this.heightAdjust);
@@ -3215,6 +3248,7 @@
3215
3248
  component: 'ZdFrame',
3216
3249
  path: card.path,
3217
3250
  local: card.local,
3251
+ overrideNamedProps: card.overrideNamedProps,
3218
3252
  };
3219
3253
  }
3220
3254
  /* Return footer rightSlot props for view layer */
@@ -3323,6 +3357,14 @@
3323
3357
  * Determines the type of the picker - date for date picker, month for month picker.
3324
3358
  */
3325
3359
  this.pickerType = 'date';
3360
+ /**
3361
+ * Helper options.
3362
+ */
3363
+ this.helperOptions = [];
3364
+ /**
3365
+ * Helper value.
3366
+ */
3367
+ this.helperValue = '';
3326
3368
  /**
3327
3369
  * Width of the picker.
3328
3370
  */
@@ -3331,6 +3373,8 @@
3331
3373
  this.dateError = false;
3332
3374
  this.formatterFn = core.FormatterParserProvider.getFormatter('ZdDate');
3333
3375
  this.parserFn = core.FormatterParserProvider.getParser('ZdDate');
3376
+ this.previousHint = '';
3377
+ this.previousPersistentHint = false;
3334
3378
  this.allowedDates = this.getInitValue('allowedDates', props.allowedDates, this.allowedDates);
3335
3379
  this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, 'calendar');
3336
3380
  this.autocomplete = this.getInitValue('autocomplete', props.autocomplete, this.autocomplete);
@@ -3346,6 +3390,8 @@
3346
3390
  this.showDatePicker = this.getInitValue('showDatePicker', props.showDatePicker, this.showDatePicker);
3347
3391
  this.showWeek = this.getInitValue('showWeek', props.showWeek, this.showWeek);
3348
3392
  this.pickerType = this.getInitValue('pickerType', props.pickerType, this.pickerType);
3393
+ this.helperOptions = this.getInitValue('helperOptions', props.helperOptions, this.helperOptions);
3394
+ this.helperValue = this.getInitValue('helperValue', props.helperValue, this.helperValue);
3349
3395
  if (this.pickerType === 'month') {
3350
3396
  this.isoFormat = 'YYYY-MM';
3351
3397
  }
@@ -3383,12 +3429,12 @@
3383
3429
  }
3384
3430
  }
3385
3431
  get displayValue() {
3386
- return this.formatter(this.value);
3432
+ return this.internalDisplayValue;
3387
3433
  }
3388
3434
  set displayValue(newValue) {
3389
3435
  this.dateError = false;
3390
- const dateValue = newValue;
3391
- this.value = this.parser(dateValue);
3436
+ this.internalDisplayValue = newValue;
3437
+ this.internalValue = this.parser(newValue);
3392
3438
  }
3393
3439
  /**
3394
3440
  * Assign the updated mask to mask property
@@ -3413,14 +3459,16 @@
3413
3459
  setDateValue(displayValue) {
3414
3460
  const lastValue = this.displayValue;
3415
3461
  if (this.isValidDate(displayValue, this.displayFormat)) {
3416
- this.displayValue = displayValue;
3462
+ this.internalDisplayValue = displayValue;
3463
+ this.internalValue = this.parser(displayValue);
3417
3464
  this.dateError = false;
3418
3465
  if (lastValue !== this.displayValue)
3419
3466
  this.change(this.value);
3420
3467
  }
3421
3468
  else {
3422
3469
  if (!displayValue) {
3423
- this.displayValue = displayValue;
3470
+ this.internalDisplayValue = displayValue;
3471
+ this.internalValue = null;
3424
3472
  if (lastValue !== this.displayValue)
3425
3473
  this.change(this.value);
3426
3474
  }
@@ -3464,7 +3512,7 @@
3464
3512
  }
3465
3513
  blur(event, element) {
3466
3514
  this.removeDateMask();
3467
- this.setDateValue(this.displayValue);
3515
+ this.setDateValue(this.formatter(this.value));
3468
3516
  super.blur(event, element);
3469
3517
  this.showDatePicker = false;
3470
3518
  }
@@ -3480,6 +3528,7 @@
3480
3528
  return;
3481
3529
  setTimeout(() => {
3482
3530
  this.mask = this.initialMask;
3531
+ this.internalDisplayValue = core.dayjs(this.value, this.dateFormat).format(this.inputFormat || this.displayFormat);
3483
3532
  });
3484
3533
  }
3485
3534
  /**
@@ -3522,6 +3571,20 @@
3522
3571
  const chars = replaced.split('');
3523
3572
  return chars.length ? chars.every((char) => core.Mask.isMaskDelimiter(char)) : true;
3524
3573
  }
3574
+ updateHelperHint() {
3575
+ if (this.helperValue) {
3576
+ this.previousHint = this.hint;
3577
+ this.previousPersistentHint = this.persistentHint;
3578
+ this.hint = core.DateHelper.getLabel(this.helperValue);
3579
+ this.persistentHint = true;
3580
+ }
3581
+ }
3582
+ change(event, element) {
3583
+ super.change(event, element);
3584
+ this.helperValue = '';
3585
+ this.hint = this.previousHint;
3586
+ this.persistentHint = this.previousPersistentHint;
3587
+ }
3525
3588
  }
3526
3589
  core.FormatterParserProvider.registerFormatter('ZdDate', (value, { dateFormat = core.Config.dateFormat, displayFormat = core.Config.displayFormat, inputFormat = core.Config.dateInputFormat, mask = '', initialMask, isSimpleDisplay = false, } = {}) => {
3527
3590
  if (!value) {
@@ -3651,10 +3714,20 @@
3651
3714
  * Width of the picker.
3652
3715
  */
3653
3716
  this.width = 248;
3717
+ /**
3718
+ * Helper options.
3719
+ */
3720
+ this.helperOptions = [];
3721
+ /**
3722
+ * Helper value.
3723
+ */
3724
+ this.helperValue = '';
3654
3725
  this.isoFormat = 'YYYY-MM-DD';
3655
3726
  this.dateError = false;
3656
3727
  this.formatterFn = core.FormatterParserProvider.getFormatter('ZdDateRange');
3657
3728
  this.parserFn = core.FormatterParserProvider.getParser('ZdDateRange');
3729
+ this.previousHint = '';
3730
+ this.previousPersistentHint = false;
3658
3731
  this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, 'calendar');
3659
3732
  this.autocomplete = this.getInitValue('autocomplete', props.autocomplete, this.autocomplete);
3660
3733
  this.dateFormat = this.getInitValue('dateFormat', props.dateFormat, this.dateFormat);
@@ -3670,6 +3743,8 @@
3670
3743
  this.splitter = this.getInitValue('splitter', props.splitter, this.splitter);
3671
3744
  this.width = this.getInitValue('width', props.width, this.width);
3672
3745
  this.mask = this.getInitValue('mask', props.mask, undefined);
3746
+ this.helperOptions = this.getInitValue('helperOptions', props.helperOptions, this.helperOptions);
3747
+ this.helperValue = this.getInitValue('helperValue', props.helperValue, this.helperValue);
3673
3748
  this.createAccessors();
3674
3749
  this.unitMask = this.mask;
3675
3750
  this.initialMask = this.getInitialMask();
@@ -3696,15 +3771,15 @@
3696
3771
  formatter(value) { return this.formatterFn(value, this); }
3697
3772
  parser(value) { return this.parserFn(value, this); }
3698
3773
  get displayValue() {
3699
- return this.formatter(this.value);
3774
+ return this.internalDisplayValue;
3700
3775
  }
3701
3776
  set displayValue(newValue) {
3702
3777
  this.dateError = false;
3703
- const dateValue = newValue;
3704
- if (dateValue)
3705
- this.value = this.parser(dateValue);
3778
+ this.internalDisplayValue = newValue;
3779
+ if (newValue)
3780
+ this.internalValue = this.parser(newValue);
3706
3781
  else
3707
- this.value = [];
3782
+ this.internalValue = [];
3708
3783
  }
3709
3784
  /**
3710
3785
  * Assign the updated mask to mask property
@@ -3730,14 +3805,16 @@
3730
3805
  const lastValue = this.displayValue;
3731
3806
  const values = this.splitValues(displayValue);
3732
3807
  if (this.isValidDateArray(this.displayFormat, values)) {
3733
- this.displayValue = displayValue;
3808
+ this.internalDisplayValue = displayValue;
3809
+ this.internalValue = this.parser(displayValue);
3734
3810
  this.dateError = false;
3735
3811
  if (lastValue !== this.displayValue)
3736
3812
  this.change(this.value);
3737
3813
  }
3738
3814
  else {
3739
3815
  if (!displayValue) {
3740
- this.displayValue = displayValue;
3816
+ this.internalDisplayValue = displayValue;
3817
+ this.internalValue = [];
3741
3818
  if (lastValue !== this.displayValue)
3742
3819
  this.change(this.value);
3743
3820
  }
@@ -3813,11 +3890,13 @@
3813
3890
  }
3814
3891
  }
3815
3892
  blur(event, element) {
3816
- this.value = this.sortDates(this.value);
3817
- this.removeDateMask();
3818
- this.setDateValue(this.displayValue);
3819
- super.blur(event, element);
3820
- this.showDatePicker = false;
3893
+ if (this.value) {
3894
+ this.value = this.sortDates(this.value);
3895
+ this.removeDateMask();
3896
+ this.setDateValue(this.formatter(this.value));
3897
+ super.blur(event, element);
3898
+ this.showDatePicker = false;
3899
+ }
3821
3900
  }
3822
3901
  focus(event, element) {
3823
3902
  this.addDateMask();
@@ -3831,6 +3910,13 @@
3831
3910
  return;
3832
3911
  setTimeout(() => {
3833
3912
  this.mask = this.initialMask;
3913
+ const firstDate = this.value[0]
3914
+ ? core.dayjs(this.value[0], this.dateFormat).format(this.inputFormat || this.displayFormat)
3915
+ : '';
3916
+ const lastDate = this.value[1]
3917
+ ? core.dayjs(this.value[1], this.dateFormat).format(this.inputFormat || this.displayFormat)
3918
+ : '';
3919
+ this.internalDisplayValue = `${firstDate}${lastDate ? this.splitter : ''}${lastDate}`;
3834
3920
  });
3835
3921
  }
3836
3922
  /**
@@ -3873,6 +3959,20 @@
3873
3959
  const chars = replaced.split('');
3874
3960
  return chars.length ? chars.every((char) => core.Mask.isMaskDelimiter(char)) : true;
3875
3961
  }
3962
+ updateHelperHint() {
3963
+ if (this.helperValue) {
3964
+ this.previousHint = this.hint;
3965
+ this.previousPersistentHint = this.persistentHint;
3966
+ this.hint = core.DateHelper.getLabel(this.helperValue);
3967
+ this.persistentHint = true;
3968
+ }
3969
+ }
3970
+ change(event, element) {
3971
+ super.change(event, element);
3972
+ this.helperValue = '';
3973
+ this.hint = this.previousHint;
3974
+ this.persistentHint = this.previousPersistentHint;
3975
+ }
3876
3976
  }
3877
3977
  core.FormatterParserProvider.registerFormatter('ZdDateRange', (value, { dateFormat = core.Config.dateFormat, displayFormat = core.Config.displayFormat, inputFormat = core.Config.dateInputFormat, initialMask, splitter = ' ~ ', unitMask = '', mask = '', isSimpleDisplay = false, } = {}) => {
3878
3978
  if (!value || value.length === 0 || (value.length === 1 && !value[0])) {
@@ -4319,6 +4419,7 @@
4319
4419
  this.local = false;
4320
4420
  this.metadata = {};
4321
4421
  this.override = {};
4422
+ this.overrideNamedProps = {};
4322
4423
  this.cache = false;
4323
4424
  this.cacheDuration = 2 * 60 * 60 * 1000;
4324
4425
  this.height = 'auto';
@@ -4328,6 +4429,7 @@
4328
4429
  this.path = props.path;
4329
4430
  this.local = props.local === true;
4330
4431
  this.override = props.override || this.override;
4432
+ this.overrideNamedProps = props.overrideNamedProps || this.overrideNamedProps;
4331
4433
  this.cache = props.cache || this.cache;
4332
4434
  this.cacheDuration = this.getInitValue('cacheDuration', props.cacheDuration, this.cacheDuration);
4333
4435
  this.height = this.getInitValue('height', props.height, this.height);
@@ -4343,6 +4445,9 @@
4343
4445
  if (typeof page !== 'object')
4344
4446
  throw new Error();
4345
4447
  this.metadata = merge__default["default"](page, this.override);
4448
+ if (Object.keys(this.overrideNamedProps).length !== 0) {
4449
+ this.metadata = this.overrideNamedPropsFunc(this.metadata);
4450
+ }
4346
4451
  }
4347
4452
  catch (_a) {
4348
4453
  this.notFoundError();
@@ -4353,6 +4458,13 @@
4353
4458
  }
4354
4459
  });
4355
4460
  }
4461
+ overrideNamedPropsFunc(metadata) {
4462
+ let strMatadata = JSON.stringify(metadata);
4463
+ Object.keys(this.overrideNamedProps).forEach((key) => {
4464
+ strMatadata = strMatadata.replace(RegExp(`<<${key}>>`, 'g'), this.overrideNamedProps[key]);
4465
+ });
4466
+ return JSON.parse(strMatadata);
4467
+ }
4356
4468
  reload() {
4357
4469
  return __awaiter(this, void 0, void 0, function* () {
4358
4470
  this.loading = true;
@@ -6223,6 +6335,10 @@
6223
6335
  * Maximum height of select menu
6224
6336
  */
6225
6337
  this.menuMaxHeight = 304;
6338
+ /**
6339
+ * Maximum width of select menu
6340
+ */
6341
+ this.menuMaxWidth = 'auto';
6226
6342
  /**
6227
6343
  * Input select value
6228
6344
  */
@@ -6282,6 +6398,7 @@
6282
6398
  this.dataValue = this.getInitValue('dataValue', props.dataValue, this.dataValue);
6283
6399
  this.dataDisabled = this.getInitValue('dataDisabled', props.dataDisabled, this.dataDisabled);
6284
6400
  this.menuMaxHeight = this.getInitValue('menuMaxHeight', props.menuMaxHeight, this.menuMaxHeight);
6401
+ this.menuMaxWidth = this.getInitValue('menuMaxWidth', props.menuMaxWidth, this.menuMaxWidth);
6285
6402
  this.returnObject = this.getInitValue('returnObject', props.returnObject, this.returnObject);
6286
6403
  this.autocomplete = this.getInitValue('autocomplete', props.autocomplete, this.autocomplete);
6287
6404
  this.disabledItems = this.getInitValue('disabledItems', props.disabledItems, this.disabledItems);
@@ -6377,8 +6494,10 @@
6377
6494
  getItemsBySearchValue(value, searchIn) {
6378
6495
  return __awaiter(this, void 0, void 0, function* () {
6379
6496
  const config = Object.assign(Object.assign(Object.assign({}, this.datasource.clone()), this.dsSearch[this.searchParam](value, searchIn)), { lazyLoad: true });
6497
+ this.datasource.loading = true;
6380
6498
  const datasource = core.DatasourceFactory.factory(config);
6381
6499
  const items = yield datasource.get();
6500
+ this.datasource.loading = false;
6382
6501
  datasource.destroy();
6383
6502
  return items.find(this.getCondition(value));
6384
6503
  });
@@ -9327,23 +9446,21 @@
9327
9446
  return this.selectValue;
9328
9447
  }
9329
9448
  set value(value) {
9330
- this.selectValue = value;
9449
+ this.setValue(value);
9331
9450
  }
9332
9451
  setValue(value) {
9333
- if (this.returnObject) {
9334
- if (typeof value !== 'object') {
9335
- this.value = { id: value };
9336
- }
9337
- else {
9338
- this.value = { id: value[this.dataValue] };
9339
- }
9452
+ let val = value;
9453
+ if (typeof value === 'object' && !Array.isArray(value) && value !== null) {
9454
+ val = value[this.dataValue];
9340
9455
  }
9341
- else if (typeof value === 'object') {
9342
- this.value = value[this.dataValue];
9456
+ else if (!value && value !== 0) {
9457
+ val = null;
9343
9458
  }
9344
- else {
9345
- this.value = value;
9459
+ if (this.returnObject) {
9460
+ this.selectValue = val ? { id: val } : null;
9461
+ return;
9346
9462
  }
9463
+ this.selectValue = val;
9347
9464
  }
9348
9465
  }
9349
9466
 
@@ -9766,6 +9883,7 @@
9766
9883
  this.tabTitle = '';
9767
9884
  this.tabTitle = this.getInitValue('tabTitle', props.tabTitle, this.tabTitle);
9768
9885
  this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
9886
+ this.flex = this.getInitValue('flex', props.flex, this.flex);
9769
9887
  this.createAccessors();
9770
9888
  }
9771
9889
  }
@@ -9796,13 +9914,26 @@
9796
9914
  */
9797
9915
  constructor(props) {
9798
9916
  super(props);
9799
- this.activeTab = 0;
9917
+ this.activeTabValue = 0;
9800
9918
  this.tabs = [];
9801
9919
  this.tabs = this.getTabs(props.tabs || []);
9802
- this.activeTab = this.getInitValue('activeTab', props.activeTab, this.activeTab);
9920
+ this.activeTab = this.getInitValue('activeTab', props.activeTab, this.activeTabValue);
9803
9921
  this.height = this.getInitValue('height', props.height, this.height);
9804
9922
  this.createAccessors();
9805
9923
  }
9924
+ get activeTab() {
9925
+ var _a;
9926
+ if (this.activeTabValue >= 0 && !((_a = this.tabs[this.activeTabValue]) === null || _a === void 0 ? void 0 : _a.isVisible)) {
9927
+ const firstTabIndex = this.tabs.findIndex((tab) => tab.isVisible);
9928
+ if (firstTabIndex > -1) {
9929
+ this.activeTabValue = firstTabIndex;
9930
+ }
9931
+ }
9932
+ return this.activeTabValue;
9933
+ }
9934
+ set activeTab(index) {
9935
+ this.activeTabValue = index;
9936
+ }
9806
9937
  getTabs(tabs) {
9807
9938
  return tabs.map((tab) => new Tab(tab));
9808
9939
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.46.0",
3
+ "version": "1.48.1",
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": "0133e8028e0b9b5876c2bb24b9a8c4d687d22dd8"
40
+ "gitHead": "8ac65de099ea963d8d4142294dfed80025f5755d"
41
41
  }
@@ -1,5 +1,5 @@
1
1
  import { IKeyMap } from '@zeedhi/core';
2
- import { IComponent, IComponentEvents } from './interfaces';
2
+ import { IComponent, IComponentDirectives, IComponentEvents } from './interfaces';
3
3
  /**
4
4
  * Base class for all Zeedhi components.
5
5
  */
@@ -22,6 +22,10 @@ export declare class Component implements IComponent {
22
22
  * Set css in line with cssStyle.
23
23
  */
24
24
  cssStyle: string | object;
25
+ /**
26
+ * Directives registered to the component.
27
+ */
28
+ directives: IComponentDirectives;
25
29
  /**
26
30
  * Events registered to the component.
27
31
  */
@@ -12,6 +12,7 @@ export interface IComponent {
12
12
  cssClass?: string;
13
13
  cssStyle?: string | object;
14
14
  events?: IComponentEvents;
15
+ directives?: IComponentDirectives;
15
16
  isVisible?: boolean | string;
16
17
  dark?: boolean;
17
18
  light?: boolean;
@@ -34,3 +35,7 @@ export interface IComponentEvents<T = IEventParam<any>> extends IEvents<T> {
34
35
  onBeforeDestroy?: IEvent<T> | string;
35
36
  onDestroyed?: IEvent<T> | string;
36
37
  }
38
+ export interface IComponentDirectives {
39
+ touch?: IComponentEvents;
40
+ [key: string]: IComponentEvents | undefined;
41
+ }
@@ -14,6 +14,7 @@ export declare class Dashboard extends ComponentRender implements IDashboard {
14
14
  addModal?: Modal;
15
15
  editModal?: Modal;
16
16
  deleteCardId: string;
17
+ overrideNamedProps: any;
17
18
  removePadding: boolean;
18
19
  height: string | number;
19
20
  heightAdjust: string | number;
@@ -41,11 +42,13 @@ export declare class Dashboard extends ComponentRender implements IDashboard {
41
42
  component?: undefined;
42
43
  path?: undefined;
43
44
  local?: undefined;
45
+ overrideNamedProps?: undefined;
44
46
  } | {
45
47
  name: string;
46
48
  component: string;
47
49
  path: string;
48
50
  local: boolean;
51
+ overrideNamedProps: any;
49
52
  };
50
53
  getFooterRightSlot(cardId: string): ({
51
54
  name: string;
@@ -27,4 +27,5 @@ export interface IDashboardCard {
27
27
  width: number;
28
28
  flat?: boolean;
29
29
  events?: ICardEvents;
30
+ overrideNamedProps?: any;
30
31
  }
@@ -53,6 +53,14 @@ export declare class DateRange extends TextInput implements IDateRange {
53
53
  * Width of the picker.
54
54
  */
55
55
  width: number | string;
56
+ /**
57
+ * Helper options.
58
+ */
59
+ helperOptions?: string[];
60
+ /**
61
+ * Helper value.
62
+ */
63
+ helperValue?: string;
56
64
  protected isoFormat: string;
57
65
  protected dateError: boolean;
58
66
  protected formatterFn: Function;
@@ -117,4 +125,8 @@ export declare class DateRange extends TextInput implements IDateRange {
117
125
  * @returns true if it is simple, false otherwise
118
126
  */
119
127
  protected isSimpleFormat(format: string): boolean;
128
+ private previousHint;
129
+ private previousPersistentHint;
130
+ updateHelperHint(): void;
131
+ change(event?: Event, element?: any): void;
120
132
  }
@@ -56,6 +56,14 @@ export declare class Date extends TextInput implements IDate {
56
56
  * Determines the type of the picker - date for date picker, month for month picker.
57
57
  */
58
58
  pickerType: string;
59
+ /**
60
+ * Helper options.
61
+ */
62
+ helperOptions?: string[];
63
+ /**
64
+ * Helper value.
65
+ */
66
+ helperValue?: string;
59
67
  /**
60
68
  * Width of the picker.
61
69
  */
@@ -126,4 +134,8 @@ export declare class Date extends TextInput implements IDate {
126
134
  * @returns true if it is simple, false otherwise
127
135
  */
128
136
  protected isSimpleFormat(format: string): boolean;
137
+ private previousHint;
138
+ private previousPersistentHint;
139
+ updateHelperHint(): void;
140
+ change(event?: Event, element?: any): void;
129
141
  }
@@ -22,6 +22,8 @@ export interface IDate extends ITextInput {
22
22
  showWeek?: boolean;
23
23
  width?: number | string;
24
24
  orderedDates?: boolean;
25
+ helperOptions?: string[];
26
+ helperValue?: string;
25
27
  }
26
28
  export interface IDateRange extends IDate {
27
29
  splitter?: string;
@@ -63,7 +63,7 @@ export declare class FileInput extends TextInput implements IFileInput {
63
63
  /**
64
64
  * Field value.
65
65
  */
66
- private internalValue;
66
+ protected internalValue: any;
67
67
  selectFileButton: IButton;
68
68
  /**
69
69
  * Create a new FileInput
@@ -66,22 +66,16 @@ export declare class Form extends ComponentRender implements IForm {
66
66
  get childrenProps(): {
67
67
  [key: string]: any;
68
68
  children?: import("..").IComponentRender[] | undefined;
69
- component: string; /**
70
- * Applies the justify-content css property.
71
- * Available options are start, center, end, space-between and space-around.
72
- */
69
+ component: string;
73
70
  componentId?: number | undefined;
74
71
  cssClass?: string | undefined;
75
72
  cssStyle?: string | object | undefined;
76
73
  events?: import("..").IComponentEvents<import("@zeedhi/core").IEventParam<any>> | undefined;
74
+ directives?: import("..").IComponentDirectives | undefined;
77
75
  isVisible?: string | boolean | undefined;
78
76
  dark?: boolean | undefined;
79
77
  light?: boolean | undefined;
80
78
  keyMap?: import("@zeedhi/core").IKeyMap<import("@zeedhi/core").IEventParam<any>> | undefined;
81
- /**
82
- * Applies the align-items css property.
83
- * Available options are start, center, end, space-between, space-around and stretch.
84
- */
85
79
  name: string;
86
80
  parent?: import("..").Component | undefined;
87
81
  }[];
@@ -8,6 +8,7 @@ export declare class Frame extends ComponentRender implements IFrame {
8
8
  local: boolean;
9
9
  metadata: Object;
10
10
  override: Object;
11
+ overrideNamedProps: any;
11
12
  path: string;
12
13
  cache: boolean;
13
14
  events: IFrameEvents;
@@ -23,6 +24,7 @@ export declare class Frame extends ComponentRender implements IFrame {
23
24
  */
24
25
  constructor(props: IFrame);
25
26
  private getMetadata;
27
+ overrideNamedPropsFunc(metadata: object): any;
26
28
  reload(): Promise<void>;
27
29
  protected notFoundError(): void;
28
30
  private requestPage;
@@ -9,6 +9,7 @@ export interface IFrame extends IComponentRender {
9
9
  path: string;
10
10
  local?: boolean;
11
11
  override?: Object;
12
+ overrideNamedProps?: any;
12
13
  cache?: boolean;
13
14
  cacheDuration?: number;
14
15
  height?: number | string;
@@ -22,11 +22,15 @@ export declare class GridColumn extends Column implements IGridColumn {
22
22
  cssClass?: string | undefined;
23
23
  cssStyle?: string | object | undefined;
24
24
  events?: import("..").IComponentEvents<import("@zeedhi/core").IEventParam<any>> | undefined;
25
+ directives?: import("..").IComponentDirectives | undefined;
25
26
  isVisible?: string | boolean | undefined;
26
27
  dark?: boolean | undefined;
27
28
  light?: boolean | undefined;
28
29
  keyMap?: import("@zeedhi/core").IKeyMap<import("@zeedhi/core").IEventParam<any>> | undefined;
29
- name: string;
30
+ name: string; /**
31
+ * Creates a new Grid Column.
32
+ * @param props Grid column properties
33
+ */
30
34
  parent?: import("..").Component | undefined;
31
35
  }[];
32
36
  /**
@@ -98,10 +98,6 @@ export declare class Input extends ComponentRender implements IInput {
98
98
  * Used to watch a value from store.
99
99
  */
100
100
  storePath: string;
101
- /**
102
- * Internal input value.
103
- */
104
- value: any;
105
101
  /**
106
102
  * Input validations.
107
103
  */
@@ -120,6 +116,8 @@ export declare class Input extends ComponentRender implements IInput {
120
116
  private parsedValidations;
121
117
  protected formatterFn: Function;
122
118
  protected parserFn: Function;
119
+ protected internalDisplayValue: string;
120
+ protected internalValue: any;
123
121
  /**
124
122
  * Creates a new Input.
125
123
  * @param props Input properties
@@ -166,6 +164,11 @@ export declare class Input extends ComponentRender implements IInput {
166
164
  * Updates input rules.
167
165
  */
168
166
  private updateRules;
167
+ /**
168
+ * Input value.
169
+ */
170
+ get value(): any;
171
+ set value(value: any);
169
172
  /**
170
173
  * Input displayed value.
171
174
  */
@@ -9,6 +9,7 @@ export interface ISelect extends ITextInput {
9
9
  dataValue?: string;
10
10
  dataDisabled?: string;
11
11
  menuMaxHeight?: string | number;
12
+ menuMaxWidth?: string | number;
12
13
  preventLoadOnFocus?: boolean;
13
14
  returnObject?: boolean;
14
15
  itemBeforeSlot?: IComponentRender[];
@@ -42,6 +42,10 @@ export declare class Select extends TextInput implements ISelect {
42
42
  * Maximum height of select menu
43
43
  */
44
44
  menuMaxHeight: string | number;
45
+ /**
46
+ * Maximum width of select menu
47
+ */
48
+ menuMaxWidth: string | number;
45
49
  /**
46
50
  * Input select value
47
51
  */
@@ -13,6 +13,7 @@ export interface ITabsEvents<T = ITabsEventParam | ITabsBeforeChangeEventParam |
13
13
  export interface ITab extends IComponent {
14
14
  tabTitle: string;
15
15
  disabled?: boolean;
16
+ flex?: boolean;
16
17
  }
17
18
  export interface ITabs extends IComponentRender {
18
19
  activeTab?: number;
@@ -6,6 +6,10 @@ import { Component } from '../zd-component/component';
6
6
  export declare class Tab extends Component implements ITab {
7
7
  disabled: boolean;
8
8
  tabTitle: string;
9
+ /**
10
+ * Defines if is flex mode.
11
+ */
12
+ flex?: boolean;
9
13
  /**
10
14
  * Create a new Tab.
11
15
  * @param props Tab properties
@@ -5,7 +5,7 @@ import { ComponentRender } from '../zd-component/component-render';
5
5
  * Base class for Tabs component.
6
6
  */
7
7
  export declare class Tabs extends ComponentRender implements ITabs {
8
- activeTab: number;
8
+ activeTabValue: number;
9
9
  events: ITabsEvents;
10
10
  tabs: Tab[];
11
11
  /**
@@ -17,6 +17,8 @@ export declare class Tabs extends ComponentRender implements ITabs {
17
17
  * @param props Tabs properties
18
18
  */
19
19
  constructor(props: ITabs);
20
+ get activeTab(): number;
21
+ set activeTab(index: number);
20
22
  private getTabs;
21
23
  getTab(name: string): Tab;
22
24
  /**