@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.
- package/dist/zd-common.esm.js +219 -63
- package/dist/zd-common.umd.js +218 -62
- package/package.json +2 -2
- package/types/components/zd-component/component.d.ts +5 -1
- package/types/components/zd-component/interfaces.d.ts +5 -0
- package/types/components/zd-dashboard/dashboard.d.ts +3 -0
- package/types/components/zd-dashboard/interfaces.d.ts +1 -0
- package/types/components/zd-date/date-range.d.ts +12 -0
- package/types/components/zd-date/date.d.ts +12 -0
- package/types/components/zd-date/interfaces.d.ts +2 -0
- package/types/components/zd-file-input/file-input.d.ts +1 -1
- package/types/components/zd-form/form.d.ts +2 -8
- package/types/components/zd-frame/frame.d.ts +2 -0
- package/types/components/zd-frame/interfaces.d.ts +1 -0
- package/types/components/zd-grid/grid-column.d.ts +5 -1
- package/types/components/zd-grid/grid.d.ts +4 -1
- package/types/components/zd-grid/interfaces.d.ts +3 -0
- package/types/components/zd-input/input.d.ts +7 -4
- package/types/components/zd-range-slider/range-slider.d.ts +3 -0
- package/types/components/zd-select/interfaces.d.ts +1 -0
- package/types/components/zd-select/select.d.ts +4 -0
- package/types/components/zd-tabs/interfaces.d.ts +1 -0
- package/types/components/zd-tabs/tab.d.ts +4 -0
- package/types/components/zd-tabs/tabs.d.ts +3 -1
- package/types/components/zd-tree/interfaces.d.ts +1 -1
- package/types/components/zd-tree/tree.d.ts +5 -4
package/dist/zd-common.umd.js
CHANGED
|
@@ -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;
|
|
@@ -502,7 +510,7 @@
|
|
|
502
510
|
* @param options New options
|
|
503
511
|
*/
|
|
504
512
|
updateChart(options) {
|
|
505
|
-
|
|
513
|
+
merge__default["default"](this.options, options);
|
|
506
514
|
if (options.series) {
|
|
507
515
|
this.series = this.options.series;
|
|
508
516
|
}
|
|
@@ -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 });
|
|
@@ -1764,7 +1770,8 @@
|
|
|
1764
1770
|
* Removes all input validation.
|
|
1765
1771
|
*/
|
|
1766
1772
|
clearValidations() {
|
|
1767
|
-
|
|
1773
|
+
this.validations = {};
|
|
1774
|
+
this.rules = [];
|
|
1768
1775
|
}
|
|
1769
1776
|
/**
|
|
1770
1777
|
* Updates input rules.
|
|
@@ -1773,14 +1780,39 @@
|
|
|
1773
1780
|
this.rules = Object.values(this.parsedValidations)
|
|
1774
1781
|
.map((validation) => () => validation(this.value));
|
|
1775
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
|
+
}
|
|
1776
1795
|
/**
|
|
1777
1796
|
* Input displayed value.
|
|
1778
1797
|
*/
|
|
1779
1798
|
get displayValue() {
|
|
1780
|
-
return this.
|
|
1799
|
+
return this.internalDisplayValue;
|
|
1781
1800
|
}
|
|
1782
1801
|
set displayValue(value) {
|
|
1783
|
-
this.
|
|
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
|
+
}
|
|
1784
1816
|
}
|
|
1785
1817
|
/**
|
|
1786
1818
|
* Retrieves a formatted value.
|
|
@@ -2869,6 +2901,7 @@
|
|
|
2869
2901
|
this.cards = [];
|
|
2870
2902
|
/* Card ID to be deleted */
|
|
2871
2903
|
this.deleteCardId = '';
|
|
2904
|
+
this.overrideNamedProps = {};
|
|
2872
2905
|
/* Remove the paddings of the dashboard */
|
|
2873
2906
|
this.removePadding = false;
|
|
2874
2907
|
/* Height of the dashboard */
|
|
@@ -3077,6 +3110,7 @@
|
|
|
3077
3110
|
this.editingMode = this.getInitValue('editingMode', props.editingMode, this.editingMode);
|
|
3078
3111
|
this.moveMode = this.getInitValue('moveMode', props.moveMode, this.moveMode);
|
|
3079
3112
|
this.cards = props.cards || this.cards;
|
|
3113
|
+
this.overrideNamedProps = props.overrideNamedProps || this.overrideNamedProps;
|
|
3080
3114
|
this.removePadding = this.getInitValue('removePadding', props.removePadding, this.removePadding);
|
|
3081
3115
|
this.height = this.getInitValue('height', props.height, this.height);
|
|
3082
3116
|
this.heightAdjust = this.getInitValue('heightAdjust', props.heightAdjust, this.heightAdjust);
|
|
@@ -3214,6 +3248,7 @@
|
|
|
3214
3248
|
component: 'ZdFrame',
|
|
3215
3249
|
path: card.path,
|
|
3216
3250
|
local: card.local,
|
|
3251
|
+
overrideNamedProps: card.overrideNamedProps,
|
|
3217
3252
|
};
|
|
3218
3253
|
}
|
|
3219
3254
|
/* Return footer rightSlot props for view layer */
|
|
@@ -3322,6 +3357,14 @@
|
|
|
3322
3357
|
* Determines the type of the picker - date for date picker, month for month picker.
|
|
3323
3358
|
*/
|
|
3324
3359
|
this.pickerType = 'date';
|
|
3360
|
+
/**
|
|
3361
|
+
* Helper options.
|
|
3362
|
+
*/
|
|
3363
|
+
this.helperOptions = [];
|
|
3364
|
+
/**
|
|
3365
|
+
* Helper value.
|
|
3366
|
+
*/
|
|
3367
|
+
this.helperValue = '';
|
|
3325
3368
|
/**
|
|
3326
3369
|
* Width of the picker.
|
|
3327
3370
|
*/
|
|
@@ -3330,6 +3373,8 @@
|
|
|
3330
3373
|
this.dateError = false;
|
|
3331
3374
|
this.formatterFn = core.FormatterParserProvider.getFormatter('ZdDate');
|
|
3332
3375
|
this.parserFn = core.FormatterParserProvider.getParser('ZdDate');
|
|
3376
|
+
this.previousHint = '';
|
|
3377
|
+
this.previousPersistentHint = false;
|
|
3333
3378
|
this.allowedDates = this.getInitValue('allowedDates', props.allowedDates, this.allowedDates);
|
|
3334
3379
|
this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, 'calendar');
|
|
3335
3380
|
this.autocomplete = this.getInitValue('autocomplete', props.autocomplete, this.autocomplete);
|
|
@@ -3345,6 +3390,8 @@
|
|
|
3345
3390
|
this.showDatePicker = this.getInitValue('showDatePicker', props.showDatePicker, this.showDatePicker);
|
|
3346
3391
|
this.showWeek = this.getInitValue('showWeek', props.showWeek, this.showWeek);
|
|
3347
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);
|
|
3348
3395
|
if (this.pickerType === 'month') {
|
|
3349
3396
|
this.isoFormat = 'YYYY-MM';
|
|
3350
3397
|
}
|
|
@@ -3382,12 +3429,12 @@
|
|
|
3382
3429
|
}
|
|
3383
3430
|
}
|
|
3384
3431
|
get displayValue() {
|
|
3385
|
-
return this.
|
|
3432
|
+
return this.internalDisplayValue;
|
|
3386
3433
|
}
|
|
3387
3434
|
set displayValue(newValue) {
|
|
3388
3435
|
this.dateError = false;
|
|
3389
|
-
|
|
3390
|
-
this.
|
|
3436
|
+
this.internalDisplayValue = newValue;
|
|
3437
|
+
this.internalValue = this.parser(newValue);
|
|
3391
3438
|
}
|
|
3392
3439
|
/**
|
|
3393
3440
|
* Assign the updated mask to mask property
|
|
@@ -3412,14 +3459,16 @@
|
|
|
3412
3459
|
setDateValue(displayValue) {
|
|
3413
3460
|
const lastValue = this.displayValue;
|
|
3414
3461
|
if (this.isValidDate(displayValue, this.displayFormat)) {
|
|
3415
|
-
this.
|
|
3462
|
+
this.internalDisplayValue = displayValue;
|
|
3463
|
+
this.internalValue = this.parser(displayValue);
|
|
3416
3464
|
this.dateError = false;
|
|
3417
3465
|
if (lastValue !== this.displayValue)
|
|
3418
3466
|
this.change(this.value);
|
|
3419
3467
|
}
|
|
3420
3468
|
else {
|
|
3421
3469
|
if (!displayValue) {
|
|
3422
|
-
this.
|
|
3470
|
+
this.internalDisplayValue = displayValue;
|
|
3471
|
+
this.internalValue = null;
|
|
3423
3472
|
if (lastValue !== this.displayValue)
|
|
3424
3473
|
this.change(this.value);
|
|
3425
3474
|
}
|
|
@@ -3463,7 +3512,7 @@
|
|
|
3463
3512
|
}
|
|
3464
3513
|
blur(event, element) {
|
|
3465
3514
|
this.removeDateMask();
|
|
3466
|
-
this.setDateValue(this.
|
|
3515
|
+
this.setDateValue(this.formatter(this.value));
|
|
3467
3516
|
super.blur(event, element);
|
|
3468
3517
|
this.showDatePicker = false;
|
|
3469
3518
|
}
|
|
@@ -3479,6 +3528,7 @@
|
|
|
3479
3528
|
return;
|
|
3480
3529
|
setTimeout(() => {
|
|
3481
3530
|
this.mask = this.initialMask;
|
|
3531
|
+
this.internalDisplayValue = core.dayjs(this.value, this.dateFormat).format(this.inputFormat || this.displayFormat);
|
|
3482
3532
|
});
|
|
3483
3533
|
}
|
|
3484
3534
|
/**
|
|
@@ -3521,6 +3571,20 @@
|
|
|
3521
3571
|
const chars = replaced.split('');
|
|
3522
3572
|
return chars.length ? chars.every((char) => core.Mask.isMaskDelimiter(char)) : true;
|
|
3523
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
|
+
}
|
|
3524
3588
|
}
|
|
3525
3589
|
core.FormatterParserProvider.registerFormatter('ZdDate', (value, { dateFormat = core.Config.dateFormat, displayFormat = core.Config.displayFormat, inputFormat = core.Config.dateInputFormat, mask = '', initialMask, isSimpleDisplay = false, } = {}) => {
|
|
3526
3590
|
if (!value) {
|
|
@@ -3650,10 +3714,20 @@
|
|
|
3650
3714
|
* Width of the picker.
|
|
3651
3715
|
*/
|
|
3652
3716
|
this.width = 248;
|
|
3717
|
+
/**
|
|
3718
|
+
* Helper options.
|
|
3719
|
+
*/
|
|
3720
|
+
this.helperOptions = [];
|
|
3721
|
+
/**
|
|
3722
|
+
* Helper value.
|
|
3723
|
+
*/
|
|
3724
|
+
this.helperValue = '';
|
|
3653
3725
|
this.isoFormat = 'YYYY-MM-DD';
|
|
3654
3726
|
this.dateError = false;
|
|
3655
3727
|
this.formatterFn = core.FormatterParserProvider.getFormatter('ZdDateRange');
|
|
3656
3728
|
this.parserFn = core.FormatterParserProvider.getParser('ZdDateRange');
|
|
3729
|
+
this.previousHint = '';
|
|
3730
|
+
this.previousPersistentHint = false;
|
|
3657
3731
|
this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, 'calendar');
|
|
3658
3732
|
this.autocomplete = this.getInitValue('autocomplete', props.autocomplete, this.autocomplete);
|
|
3659
3733
|
this.dateFormat = this.getInitValue('dateFormat', props.dateFormat, this.dateFormat);
|
|
@@ -3669,6 +3743,8 @@
|
|
|
3669
3743
|
this.splitter = this.getInitValue('splitter', props.splitter, this.splitter);
|
|
3670
3744
|
this.width = this.getInitValue('width', props.width, this.width);
|
|
3671
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);
|
|
3672
3748
|
this.createAccessors();
|
|
3673
3749
|
this.unitMask = this.mask;
|
|
3674
3750
|
this.initialMask = this.getInitialMask();
|
|
@@ -3695,15 +3771,15 @@
|
|
|
3695
3771
|
formatter(value) { return this.formatterFn(value, this); }
|
|
3696
3772
|
parser(value) { return this.parserFn(value, this); }
|
|
3697
3773
|
get displayValue() {
|
|
3698
|
-
return this.
|
|
3774
|
+
return this.internalDisplayValue;
|
|
3699
3775
|
}
|
|
3700
3776
|
set displayValue(newValue) {
|
|
3701
3777
|
this.dateError = false;
|
|
3702
|
-
|
|
3703
|
-
if (
|
|
3704
|
-
this.
|
|
3778
|
+
this.internalDisplayValue = newValue;
|
|
3779
|
+
if (newValue)
|
|
3780
|
+
this.internalValue = this.parser(newValue);
|
|
3705
3781
|
else
|
|
3706
|
-
this.
|
|
3782
|
+
this.internalValue = [];
|
|
3707
3783
|
}
|
|
3708
3784
|
/**
|
|
3709
3785
|
* Assign the updated mask to mask property
|
|
@@ -3729,14 +3805,16 @@
|
|
|
3729
3805
|
const lastValue = this.displayValue;
|
|
3730
3806
|
const values = this.splitValues(displayValue);
|
|
3731
3807
|
if (this.isValidDateArray(this.displayFormat, values)) {
|
|
3732
|
-
this.
|
|
3808
|
+
this.internalDisplayValue = displayValue;
|
|
3809
|
+
this.internalValue = this.parser(displayValue);
|
|
3733
3810
|
this.dateError = false;
|
|
3734
3811
|
if (lastValue !== this.displayValue)
|
|
3735
3812
|
this.change(this.value);
|
|
3736
3813
|
}
|
|
3737
3814
|
else {
|
|
3738
3815
|
if (!displayValue) {
|
|
3739
|
-
this.
|
|
3816
|
+
this.internalDisplayValue = displayValue;
|
|
3817
|
+
this.internalValue = [];
|
|
3740
3818
|
if (lastValue !== this.displayValue)
|
|
3741
3819
|
this.change(this.value);
|
|
3742
3820
|
}
|
|
@@ -3812,11 +3890,13 @@
|
|
|
3812
3890
|
}
|
|
3813
3891
|
}
|
|
3814
3892
|
blur(event, element) {
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
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
|
+
}
|
|
3820
3900
|
}
|
|
3821
3901
|
focus(event, element) {
|
|
3822
3902
|
this.addDateMask();
|
|
@@ -3830,6 +3910,13 @@
|
|
|
3830
3910
|
return;
|
|
3831
3911
|
setTimeout(() => {
|
|
3832
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}`;
|
|
3833
3920
|
});
|
|
3834
3921
|
}
|
|
3835
3922
|
/**
|
|
@@ -3872,6 +3959,20 @@
|
|
|
3872
3959
|
const chars = replaced.split('');
|
|
3873
3960
|
return chars.length ? chars.every((char) => core.Mask.isMaskDelimiter(char)) : true;
|
|
3874
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
|
+
}
|
|
3875
3976
|
}
|
|
3876
3977
|
core.FormatterParserProvider.registerFormatter('ZdDateRange', (value, { dateFormat = core.Config.dateFormat, displayFormat = core.Config.displayFormat, inputFormat = core.Config.dateInputFormat, initialMask, splitter = ' ~ ', unitMask = '', mask = '', isSimpleDisplay = false, } = {}) => {
|
|
3877
3978
|
if (!value || value.length === 0 || (value.length === 1 && !value[0])) {
|
|
@@ -4318,6 +4419,7 @@
|
|
|
4318
4419
|
this.local = false;
|
|
4319
4420
|
this.metadata = {};
|
|
4320
4421
|
this.override = {};
|
|
4422
|
+
this.overrideNamedProps = {};
|
|
4321
4423
|
this.cache = false;
|
|
4322
4424
|
this.cacheDuration = 2 * 60 * 60 * 1000;
|
|
4323
4425
|
this.height = 'auto';
|
|
@@ -4327,6 +4429,7 @@
|
|
|
4327
4429
|
this.path = props.path;
|
|
4328
4430
|
this.local = props.local === true;
|
|
4329
4431
|
this.override = props.override || this.override;
|
|
4432
|
+
this.overrideNamedProps = props.overrideNamedProps || this.overrideNamedProps;
|
|
4330
4433
|
this.cache = props.cache || this.cache;
|
|
4331
4434
|
this.cacheDuration = this.getInitValue('cacheDuration', props.cacheDuration, this.cacheDuration);
|
|
4332
4435
|
this.height = this.getInitValue('height', props.height, this.height);
|
|
@@ -4342,6 +4445,9 @@
|
|
|
4342
4445
|
if (typeof page !== 'object')
|
|
4343
4446
|
throw new Error();
|
|
4344
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
|
+
}
|
|
4345
4451
|
}
|
|
4346
4452
|
catch (_a) {
|
|
4347
4453
|
this.notFoundError();
|
|
@@ -4352,6 +4458,13 @@
|
|
|
4352
4458
|
}
|
|
4353
4459
|
});
|
|
4354
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
|
+
}
|
|
4355
4468
|
reload() {
|
|
4356
4469
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4357
4470
|
this.loading = true;
|
|
@@ -4954,6 +5067,9 @@
|
|
|
4954
5067
|
this.toolbarSlot = [
|
|
4955
5068
|
{ name: '<<NAME>>_gridSearch', component: 'ZdSearch' },
|
|
4956
5069
|
];
|
|
5070
|
+
this.loadingText = 'LOADING';
|
|
5071
|
+
this.noDataText = 'NO_DATA';
|
|
5072
|
+
this.noResultsText = 'NO_RESULT';
|
|
4957
5073
|
/**
|
|
4958
5074
|
* Components that will be rendered in no-data case
|
|
4959
5075
|
*/
|
|
@@ -4962,7 +5078,7 @@
|
|
|
4962
5078
|
name: '<<NAME>>_no-data',
|
|
4963
5079
|
component: 'ZdText',
|
|
4964
5080
|
cssClass: 'no-data',
|
|
4965
|
-
text:
|
|
5081
|
+
text: this.noDataText,
|
|
4966
5082
|
},
|
|
4967
5083
|
];
|
|
4968
5084
|
/**
|
|
@@ -4973,7 +5089,7 @@
|
|
|
4973
5089
|
name: '<<NAME>>_no-result',
|
|
4974
5090
|
component: 'ZdText',
|
|
4975
5091
|
cssClass: 'no-result',
|
|
4976
|
-
text:
|
|
5092
|
+
text: this.noResultsText,
|
|
4977
5093
|
},
|
|
4978
5094
|
];
|
|
4979
5095
|
/**
|
|
@@ -5077,6 +5193,7 @@
|
|
|
5077
5193
|
this.headerCellTextColor = this.getInitValue('headerCellTextColor', props.headerCellTextColor, this.headerCellTextColor);
|
|
5078
5194
|
this.dragColumns = this.getInitValue('dragColumns', props.dragColumns, this.dragColumns);
|
|
5079
5195
|
this.resizeColumns = this.getInitValue('resizeColumns', props.resizeColumns, this.resizeColumns);
|
|
5196
|
+
this.loadingText = this.getInitValue('loadingText', props.loadingText, this.loadingText);
|
|
5080
5197
|
this.toolbarSlot = props.toolbarSlot || this.toolbarSlot;
|
|
5081
5198
|
this.footerSlot = props.footerSlot || this.footerSlot;
|
|
5082
5199
|
this.noDataSlot = props.noDataSlot || this.noDataSlot;
|
|
@@ -5086,6 +5203,8 @@
|
|
|
5086
5203
|
this.footerSlot = this.changeDefaultSlotNames(this.footerSlot);
|
|
5087
5204
|
this.toolbarSlot = this.changeDefaultSlotNames(this.toolbarSlot);
|
|
5088
5205
|
this.noResultSlot = this.changeDefaultSlotNames(this.noResultSlot);
|
|
5206
|
+
this.noDataText = this.getInitValue('noDataText', props.noDataText, this.noDataText);
|
|
5207
|
+
this.noResultsText = this.getInitValue('noResultsText', props.noResultsText, this.noResultsText);
|
|
5089
5208
|
this.createAccessors();
|
|
5090
5209
|
}
|
|
5091
5210
|
onMounted(element) {
|
|
@@ -6216,6 +6335,10 @@
|
|
|
6216
6335
|
* Maximum height of select menu
|
|
6217
6336
|
*/
|
|
6218
6337
|
this.menuMaxHeight = 304;
|
|
6338
|
+
/**
|
|
6339
|
+
* Maximum width of select menu
|
|
6340
|
+
*/
|
|
6341
|
+
this.menuMaxWidth = 'auto';
|
|
6219
6342
|
/**
|
|
6220
6343
|
* Input select value
|
|
6221
6344
|
*/
|
|
@@ -6275,6 +6398,7 @@
|
|
|
6275
6398
|
this.dataValue = this.getInitValue('dataValue', props.dataValue, this.dataValue);
|
|
6276
6399
|
this.dataDisabled = this.getInitValue('dataDisabled', props.dataDisabled, this.dataDisabled);
|
|
6277
6400
|
this.menuMaxHeight = this.getInitValue('menuMaxHeight', props.menuMaxHeight, this.menuMaxHeight);
|
|
6401
|
+
this.menuMaxWidth = this.getInitValue('menuMaxWidth', props.menuMaxWidth, this.menuMaxWidth);
|
|
6278
6402
|
this.returnObject = this.getInitValue('returnObject', props.returnObject, this.returnObject);
|
|
6279
6403
|
this.autocomplete = this.getInitValue('autocomplete', props.autocomplete, this.autocomplete);
|
|
6280
6404
|
this.disabledItems = this.getInitValue('disabledItems', props.disabledItems, this.disabledItems);
|
|
@@ -6370,8 +6494,10 @@
|
|
|
6370
6494
|
getItemsBySearchValue(value, searchIn) {
|
|
6371
6495
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6372
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;
|
|
6373
6498
|
const datasource = core.DatasourceFactory.factory(config);
|
|
6374
6499
|
const items = yield datasource.get();
|
|
6500
|
+
this.datasource.loading = false;
|
|
6375
6501
|
datasource.destroy();
|
|
6376
6502
|
return items.find(this.getCondition(value));
|
|
6377
6503
|
});
|
|
@@ -8274,6 +8400,12 @@
|
|
|
8274
8400
|
this.vertical = this.getInitValue('vertical', props.vertical, this.vertical);
|
|
8275
8401
|
this.createAccessors();
|
|
8276
8402
|
}
|
|
8403
|
+
get value() {
|
|
8404
|
+
return this.rangeSliderValue === null ? undefined : this.rangeSliderValue;
|
|
8405
|
+
}
|
|
8406
|
+
set value(value) {
|
|
8407
|
+
this.rangeSliderValue = value;
|
|
8408
|
+
}
|
|
8277
8409
|
}
|
|
8278
8410
|
|
|
8279
8411
|
/**
|
|
@@ -9314,23 +9446,21 @@
|
|
|
9314
9446
|
return this.selectValue;
|
|
9315
9447
|
}
|
|
9316
9448
|
set value(value) {
|
|
9317
|
-
this.
|
|
9449
|
+
this.setValue(value);
|
|
9318
9450
|
}
|
|
9319
9451
|
setValue(value) {
|
|
9320
|
-
|
|
9321
|
-
|
|
9322
|
-
|
|
9323
|
-
}
|
|
9324
|
-
else {
|
|
9325
|
-
this.value = { id: value[this.dataValue] };
|
|
9326
|
-
}
|
|
9452
|
+
let val = value;
|
|
9453
|
+
if (typeof value === 'object' && !Array.isArray(value) && value !== null) {
|
|
9454
|
+
val = value[this.dataValue];
|
|
9327
9455
|
}
|
|
9328
|
-
else if (
|
|
9329
|
-
|
|
9456
|
+
else if (!value && value !== 0) {
|
|
9457
|
+
val = null;
|
|
9330
9458
|
}
|
|
9331
|
-
|
|
9332
|
-
this.
|
|
9459
|
+
if (this.returnObject) {
|
|
9460
|
+
this.selectValue = val ? { id: val } : null;
|
|
9461
|
+
return;
|
|
9333
9462
|
}
|
|
9463
|
+
this.selectValue = val;
|
|
9334
9464
|
}
|
|
9335
9465
|
}
|
|
9336
9466
|
|
|
@@ -9753,6 +9883,7 @@
|
|
|
9753
9883
|
this.tabTitle = '';
|
|
9754
9884
|
this.tabTitle = this.getInitValue('tabTitle', props.tabTitle, this.tabTitle);
|
|
9755
9885
|
this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
|
|
9886
|
+
this.flex = this.getInitValue('flex', props.flex, this.flex);
|
|
9756
9887
|
this.createAccessors();
|
|
9757
9888
|
}
|
|
9758
9889
|
}
|
|
@@ -9783,13 +9914,26 @@
|
|
|
9783
9914
|
*/
|
|
9784
9915
|
constructor(props) {
|
|
9785
9916
|
super(props);
|
|
9786
|
-
this.
|
|
9917
|
+
this.activeTabValue = 0;
|
|
9787
9918
|
this.tabs = [];
|
|
9788
9919
|
this.tabs = this.getTabs(props.tabs || []);
|
|
9789
|
-
this.activeTab = this.getInitValue('activeTab', props.activeTab, this.
|
|
9920
|
+
this.activeTab = this.getInitValue('activeTab', props.activeTab, this.activeTabValue);
|
|
9790
9921
|
this.height = this.getInitValue('height', props.height, this.height);
|
|
9791
9922
|
this.createAccessors();
|
|
9792
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
|
+
}
|
|
9793
9937
|
getTabs(tabs) {
|
|
9794
9938
|
return tabs.map((tab) => new Tab(tab));
|
|
9795
9939
|
}
|
|
@@ -10323,6 +10467,8 @@
|
|
|
10323
10467
|
this.titleField = '';
|
|
10324
10468
|
/** Datasource data field */
|
|
10325
10469
|
this.dataField = '';
|
|
10470
|
+
/** Datasource checked field */
|
|
10471
|
+
this.checkedField = 'checked';
|
|
10326
10472
|
/**
|
|
10327
10473
|
* Defines if the tree will be opened or not (true/false) or if it should open only until a specific level
|
|
10328
10474
|
*/
|
|
@@ -10341,7 +10487,6 @@
|
|
|
10341
10487
|
this.appliedConditions = {};
|
|
10342
10488
|
/* Conditions of tree */
|
|
10343
10489
|
this.factoredConditions = {};
|
|
10344
|
-
this.nodes = this.initNodes(props.nodes || this.nodes);
|
|
10345
10490
|
this.itemIconName = this.getInitValue('itemIconName', props.itemIconName, this.itemIconName);
|
|
10346
10491
|
this.groupIconName = this.getInitValue('groupIconName', props.groupIconName, this.groupIconName);
|
|
10347
10492
|
this.openedIconName = this.getInitValue('openedIconName', props.openedIconName, this.openedIconName);
|
|
@@ -10351,6 +10496,7 @@
|
|
|
10351
10496
|
this.parentField = this.getInitValue('parentField', props.parentField, this.parentField);
|
|
10352
10497
|
this.titleField = this.getInitValue('titleField', props.titleField, this.titleField);
|
|
10353
10498
|
this.dataField = this.getInitValue('dataField', props.dataField, this.dataField);
|
|
10499
|
+
this.checkedField = this.getInitValue('checkedField', props.checkedField, this.checkedField);
|
|
10354
10500
|
this.openLevelOnLoad = this.getInitValue('openLevelOnLoad', props.openLevelOnLoad, this.openLevelOnLoad);
|
|
10355
10501
|
this.checkbox = this.getInitValue('checkbox', props.checkbox, this.checkbox);
|
|
10356
10502
|
this.afterTitleSlot = props.afterTitleSlot || this.afterTitleSlot;
|
|
@@ -10368,29 +10514,46 @@
|
|
|
10368
10514
|
this.createDataStructure();
|
|
10369
10515
|
}
|
|
10370
10516
|
this.createAccessors();
|
|
10517
|
+
this.nodes = props.nodes || this.nodes;
|
|
10371
10518
|
}
|
|
10372
10519
|
/**
|
|
10373
10520
|
* Initialize all the properties of the declared nodes (reactivity)
|
|
10374
10521
|
*/
|
|
10375
|
-
initNodes(nodes) {
|
|
10376
|
-
return nodes.map((node) =>
|
|
10522
|
+
initNodes(nodes, override) {
|
|
10523
|
+
return nodes.map((node) => {
|
|
10524
|
+
let newNode = {
|
|
10525
|
+
title: '',
|
|
10526
|
+
isLeaf: false,
|
|
10527
|
+
isExpanded: true,
|
|
10528
|
+
isSelected: false,
|
|
10529
|
+
isDraggable: true,
|
|
10530
|
+
isSelectable: true,
|
|
10531
|
+
data: {
|
|
10532
|
+
[this.checkedField]: false,
|
|
10533
|
+
},
|
|
10534
|
+
children: [],
|
|
10535
|
+
};
|
|
10536
|
+
newNode = merge__default["default"](newNode, node, override);
|
|
10537
|
+
newNode.children = this.initNodes(node.children || [], override);
|
|
10538
|
+
return newNode;
|
|
10539
|
+
});
|
|
10377
10540
|
}
|
|
10378
10541
|
/** Nodes */
|
|
10379
10542
|
get nodes() {
|
|
10380
10543
|
return this.nodesValue;
|
|
10381
10544
|
}
|
|
10382
10545
|
set nodes(value) {
|
|
10546
|
+
let override = {};
|
|
10383
10547
|
if (!this.allowDragDrop) {
|
|
10384
|
-
|
|
10548
|
+
override = { isDraggable: false };
|
|
10385
10549
|
}
|
|
10386
|
-
this.nodesValue = value;
|
|
10550
|
+
this.nodesValue = this.initNodes(value, override);
|
|
10387
10551
|
}
|
|
10388
10552
|
getCheckedNodes() {
|
|
10389
10553
|
const selectedNodes = [];
|
|
10390
10554
|
this.tree.traverse((node) => {
|
|
10391
|
-
|
|
10392
|
-
|
|
10393
|
-
selectedNodes.push(instanceNode);
|
|
10555
|
+
if (node.data && node.data[this.checkedField]) {
|
|
10556
|
+
selectedNodes.push(node);
|
|
10394
10557
|
}
|
|
10395
10558
|
});
|
|
10396
10559
|
return selectedNodes;
|
|
@@ -10443,15 +10606,16 @@
|
|
|
10443
10606
|
}
|
|
10444
10607
|
/** Insert nodes by the current cursor position */
|
|
10445
10608
|
insertNode(newNode) {
|
|
10609
|
+
const initNode = this.initNodes([newNode])[0];
|
|
10446
10610
|
if (this.selectedNodes.length) {
|
|
10447
10611
|
const cursorPosition = {
|
|
10448
10612
|
node: this.selectedNodes[0],
|
|
10449
10613
|
placement: 'inside',
|
|
10450
10614
|
};
|
|
10451
|
-
this.tree.insert(cursorPosition,
|
|
10615
|
+
this.tree.insert(cursorPosition, initNode);
|
|
10452
10616
|
}
|
|
10453
10617
|
else {
|
|
10454
|
-
this.nodes.push(
|
|
10618
|
+
this.nodes.push(initNode);
|
|
10455
10619
|
}
|
|
10456
10620
|
}
|
|
10457
10621
|
importNodes(nodes) {
|
|
@@ -10481,15 +10645,6 @@
|
|
|
10481
10645
|
updateNodeData(node, value) {
|
|
10482
10646
|
this.tree.updateNode(node.path, value);
|
|
10483
10647
|
}
|
|
10484
|
-
removeDraggable(items) {
|
|
10485
|
-
items.forEach((item) => {
|
|
10486
|
-
var _a;
|
|
10487
|
-
item.isDraggable = false;
|
|
10488
|
-
if ((_a = item.children) === null || _a === void 0 ? void 0 : _a.length) {
|
|
10489
|
-
this.removeDraggable(item.children);
|
|
10490
|
-
}
|
|
10491
|
-
});
|
|
10492
|
-
}
|
|
10493
10648
|
setTree(tree) {
|
|
10494
10649
|
this.tree = tree;
|
|
10495
10650
|
}
|
|
@@ -10621,7 +10776,7 @@
|
|
|
10621
10776
|
}
|
|
10622
10777
|
getParentNode(node) {
|
|
10623
10778
|
var _a;
|
|
10624
|
-
return this.getNode(((_a = node.path) === null || _a === void 0 ? void 0 : _a.slice(0, -1)) || []);
|
|
10779
|
+
return this.tree.getNode(((_a = node.path) === null || _a === void 0 ? void 0 : _a.slice(0, -1)) || []);
|
|
10625
10780
|
}
|
|
10626
10781
|
searchPath(nodes, path) {
|
|
10627
10782
|
const currentNode = (path[0] > -1 && path[0] < nodes.length) ? nodes[path[0]] : undefined;
|
|
@@ -10816,6 +10971,7 @@
|
|
|
10816
10971
|
},
|
|
10817
10972
|
};
|
|
10818
10973
|
this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
|
|
10974
|
+
this.noDataSlot = this.changeDefaultSlotNames(this.noDataSlot);
|
|
10819
10975
|
this.createAccessors();
|
|
10820
10976
|
}
|
|
10821
10977
|
onMounted(element) {
|