@zeedhi/common 1.79.1 → 1.80.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.
- package/dist/zd-common.esm.js +205 -37
- package/dist/zd-common.umd.js +204 -36
- package/package.json +2 -2
- package/types/components/zd-alert/alert.d.ts +2 -0
- package/types/components/zd-alert/interfaces.d.ts +1 -0
- package/types/components/zd-date/date-range.d.ts +9 -0
- package/types/components/zd-date/date.d.ts +9 -0
- package/types/components/zd-date/interfaces.d.ts +2 -0
- package/types/components/zd-tabs/interfaces.d.ts +1 -0
- package/types/components/zd-tabs/tabs.d.ts +4 -0
- package/types/components/zd-text/interfaces.d.ts +6 -0
- package/types/components/zd-text/text.d.ts +2 -1
- package/types/services/zd-alert/alert-queue.d.ts +13 -0
- package/types/services/zd-alert/alert-replace.d.ts +5 -0
- package/types/services/zd-alert/alert-service.d.ts +19 -11
- package/types/services/zd-alert/alert-stack.d.ts +9 -0
- package/types/services/zd-alert/interfaces.d.ts +6 -0
package/dist/zd-common.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccessorManager, Event, KeyMap, Metadata, Accessor, I18n, FormatterParserProvider, Validation, Mask, DatasourceFactory, MethodNotAssignedError, Loader, Config, dayjs, Utils, DateHelper, Router, InstanceNotFoundError, Cookie, Http, URL as URL$1, VersionService } from '@zeedhi/core';
|
|
1
|
+
import { AccessorManager, Event, KeyMap, Metadata, Accessor, I18n, FormatterParserProvider, Validation, Mask, DatasourceFactory, MethodNotAssignedError, Loader, Config, dayjs, Utils, DateHelper, Router, InstanceNotFoundError, MemoryDatasource, Cookie, Http, URL as URL$1, VersionService } from '@zeedhi/core';
|
|
2
2
|
import merge from 'lodash.merge';
|
|
3
3
|
import cloneDeep from 'lodash.clonedeep';
|
|
4
4
|
import debounce from 'lodash.debounce';
|
|
@@ -350,6 +350,7 @@ class Alert extends Component {
|
|
|
350
350
|
* Stacks alert content vertically (mobile)
|
|
351
351
|
*/
|
|
352
352
|
this.vertical = false;
|
|
353
|
+
this.id = 0;
|
|
353
354
|
this.defaultValues = {
|
|
354
355
|
name: this.name,
|
|
355
356
|
dark: this.dark,
|
|
@@ -367,6 +368,7 @@ class Alert extends Component {
|
|
|
367
368
|
showDismiss: this.showDismiss,
|
|
368
369
|
dismissColor: this.dismissColor,
|
|
369
370
|
buttonsSlot: this.buttonsSlot,
|
|
371
|
+
id: this.id,
|
|
370
372
|
};
|
|
371
373
|
this.assignAlertProperties(props);
|
|
372
374
|
this.createAccessors();
|
|
@@ -392,6 +394,7 @@ class Alert extends Component {
|
|
|
392
394
|
this.showDismiss = this.getInitValue('showDismiss', alert.showDismiss, this.defaultValues.showDismiss);
|
|
393
395
|
this.dismissColor = this.getInitValue('dismissColor', alert.dismissColor, this.defaultValues.dismissColor);
|
|
394
396
|
this.buttonsSlot = alert.buttonsSlot || this.defaultValues.buttonsSlot;
|
|
397
|
+
this.id = alert.id || this.defaultValues.id;
|
|
395
398
|
this.isVisible = false;
|
|
396
399
|
}
|
|
397
400
|
/**
|
|
@@ -2794,12 +2797,7 @@ class Number$1 extends TextInput {
|
|
|
2794
2797
|
*/
|
|
2795
2798
|
constructor(props) {
|
|
2796
2799
|
super(props);
|
|
2797
|
-
this.defaultMask = Config.masks.numberMask || {
|
|
2798
|
-
decimalCharacter: ',',
|
|
2799
|
-
decimalCharacterAlternative: '.',
|
|
2800
|
-
decimalPlaces: 2,
|
|
2801
|
-
digitGroupSeparator: '.',
|
|
2802
|
-
};
|
|
2800
|
+
this.defaultMask = Config.masks.numberMask || {};
|
|
2803
2801
|
/*
|
|
2804
2802
|
* Defines how the field content should be aligned.
|
|
2805
2803
|
*/
|
|
@@ -2826,7 +2824,7 @@ class Number$1 extends TextInput {
|
|
|
2826
2824
|
this.localValue = value;
|
|
2827
2825
|
if (this.maskValid && this.localValue !== undefined && this.localValue !== null) {
|
|
2828
2826
|
this.formattedValue = AutoNumeric.format(this.localValue, this.mask);
|
|
2829
|
-
if (this.autoNumericObj) {
|
|
2827
|
+
if (this.autoNumericObj && value !== this.autoNumericObj.rawValue) {
|
|
2830
2828
|
this.autoNumericObj.setValue(value);
|
|
2831
2829
|
}
|
|
2832
2830
|
}
|
|
@@ -2896,7 +2894,7 @@ FormatterParserProvider.registerParser('ZdNumber', (value, { mask = Config.masks
|
|
|
2896
2894
|
class Currency extends Number$1 {
|
|
2897
2895
|
constructor(props) {
|
|
2898
2896
|
super(props);
|
|
2899
|
-
this.defaultMask = Config.masks.currencyMask;
|
|
2897
|
+
this.defaultMask = Object.assign(Object.assign({}, Config.masks.numberMask), Config.masks.currencyMask);
|
|
2900
2898
|
this.formatterFn = FormatterParserProvider.getFormatter('ZdCurrency');
|
|
2901
2899
|
this.parserFn = FormatterParserProvider.getParser('ZdCurrency');
|
|
2902
2900
|
this.mask = this.getInitValue('mask', props.mask, this.defaultMask);
|
|
@@ -2904,46 +2902,146 @@ class Currency extends Number$1 {
|
|
|
2904
2902
|
this.validateMask();
|
|
2905
2903
|
}
|
|
2906
2904
|
}
|
|
2907
|
-
FormatterParserProvider.registerFormatter('ZdCurrency', (value, { mask = Config.masks.currencyMask, } = {}) =>
|
|
2908
|
-
|
|
2905
|
+
FormatterParserProvider.registerFormatter('ZdCurrency', (value, { mask = Object.assign(Object.assign({}, Config.masks.numberMask), Config.masks.currencyMask), } = {}) => {
|
|
2906
|
+
let maskDef = mask;
|
|
2907
|
+
if (Accessor.isAccessorDefinition(maskDef)) {
|
|
2908
|
+
const [controller, accessor] = Accessor.getAccessor(maskDef);
|
|
2909
|
+
maskDef = Loader.getInstance(controller)[accessor];
|
|
2910
|
+
}
|
|
2911
|
+
const maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.unformat(value)) : maskDef;
|
|
2912
|
+
return value === null ? '' : AutoNumeric.format(value, maskValue);
|
|
2913
|
+
});
|
|
2914
|
+
FormatterParserProvider.registerParser('ZdCurrency', (value, { mask = Object.assign(Object.assign({}, Config.masks.numberMask), Config.masks.currencyMask), } = {}) => {
|
|
2915
|
+
let maskDef = mask;
|
|
2916
|
+
if (Accessor.isAccessorDefinition(maskDef)) {
|
|
2917
|
+
const [controller, accessor] = Accessor.getAccessor(maskDef);
|
|
2918
|
+
maskDef = Loader.getInstance(controller)[accessor];
|
|
2919
|
+
}
|
|
2920
|
+
const maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
|
|
2921
|
+
return value === '' ? null : AutoNumeric.unformat(value, maskValue);
|
|
2922
|
+
});
|
|
2923
|
+
|
|
2924
|
+
class AlertQueue {
|
|
2925
|
+
constructor() {
|
|
2926
|
+
this.queue = [];
|
|
2927
|
+
this.visibleInstances = [];
|
|
2928
|
+
}
|
|
2929
|
+
show(alert) {
|
|
2930
|
+
this.queue.push(alert);
|
|
2931
|
+
if ((this.visibleInstances.length === 0 || !this.visibleInstances[0].isVisible)
|
|
2932
|
+
&& this.queue.length === 1) {
|
|
2933
|
+
this.display(alert);
|
|
2934
|
+
}
|
|
2935
|
+
return 0;
|
|
2936
|
+
}
|
|
2937
|
+
/**
|
|
2938
|
+
* Displays an alert
|
|
2939
|
+
* @param alert Alert Structure
|
|
2940
|
+
*/
|
|
2941
|
+
display(alert) {
|
|
2942
|
+
if (this.visibleInstances.length === 0) {
|
|
2943
|
+
this.visibleInstances.push(new Alert({ name: 'alert-instance', id: 0 }));
|
|
2944
|
+
}
|
|
2945
|
+
this.visibleInstances[0].assignAlertProperties(alert);
|
|
2946
|
+
this.visibleInstances[0].show();
|
|
2947
|
+
return 0;
|
|
2948
|
+
}
|
|
2949
|
+
remove(index) {
|
|
2950
|
+
this.queue.splice(index, 1);
|
|
2951
|
+
if (index === 0 && this.queue[0]) {
|
|
2952
|
+
setTimeout(() => this.display(this.queue[0]), 200);
|
|
2953
|
+
}
|
|
2954
|
+
}
|
|
2955
|
+
}
|
|
2956
|
+
|
|
2957
|
+
class AlertReplace extends AlertQueue {
|
|
2958
|
+
show(alert) {
|
|
2959
|
+
super.show(alert);
|
|
2960
|
+
this.visibleInstances[0].hide();
|
|
2961
|
+
this.remove(0);
|
|
2962
|
+
setTimeout(() => this.display(alert), 200);
|
|
2963
|
+
return 0;
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
|
|
2967
|
+
class AlertStack {
|
|
2968
|
+
constructor() {
|
|
2969
|
+
this.queue = [];
|
|
2970
|
+
this.visibleInstances = [];
|
|
2971
|
+
}
|
|
2972
|
+
show(alert) {
|
|
2973
|
+
this.queue.push(alert);
|
|
2974
|
+
return this.display(alert);
|
|
2975
|
+
}
|
|
2976
|
+
display(alert) {
|
|
2977
|
+
const lastAlert = this.visibleInstances.slice(-1)[0];
|
|
2978
|
+
const lastId = (lastAlert === null || lastAlert === void 0 ? void 0 : lastAlert.id) || 0;
|
|
2979
|
+
const id = lastId + 1;
|
|
2980
|
+
const instance = new Alert(Object.assign(Object.assign({}, alert), { id }));
|
|
2981
|
+
this.visibleInstances.push(instance);
|
|
2982
|
+
instance.show();
|
|
2983
|
+
return id;
|
|
2984
|
+
}
|
|
2985
|
+
remove(index) {
|
|
2986
|
+
this.queue.splice(index, 1);
|
|
2987
|
+
this.visibleInstances.splice(index, 1);
|
|
2988
|
+
}
|
|
2989
|
+
}
|
|
2909
2990
|
|
|
2910
2991
|
/**
|
|
2911
2992
|
* Alert Service Class
|
|
2912
2993
|
*/
|
|
2913
2994
|
class AlertService {
|
|
2995
|
+
static instantiateManager(multiple) {
|
|
2996
|
+
if (multiple === 'queue') {
|
|
2997
|
+
this.alertsManager = new AlertQueue();
|
|
2998
|
+
return;
|
|
2999
|
+
}
|
|
3000
|
+
if (multiple === 'stack') {
|
|
3001
|
+
this.alertsManager = new AlertStack();
|
|
3002
|
+
return;
|
|
3003
|
+
}
|
|
3004
|
+
this.alertsManager = new AlertReplace();
|
|
3005
|
+
}
|
|
2914
3006
|
/**
|
|
2915
3007
|
* Displays an alert.
|
|
2916
3008
|
* If has an opened alert it will be closed.
|
|
2917
3009
|
* @param alert Alert structure
|
|
2918
3010
|
*/
|
|
2919
3011
|
static show(alert) {
|
|
2920
|
-
|
|
2921
|
-
this.hide();
|
|
2922
|
-
setTimeout(() => this.display(alert), 200);
|
|
2923
|
-
}
|
|
2924
|
-
else {
|
|
2925
|
-
this.display(alert);
|
|
2926
|
-
}
|
|
3012
|
+
return this.alertsManager.show(alert);
|
|
2927
3013
|
}
|
|
2928
3014
|
/**
|
|
2929
|
-
* Hides
|
|
3015
|
+
* Hides alert by index. Default index is 0
|
|
2930
3016
|
*/
|
|
2931
|
-
static hide() {
|
|
2932
|
-
this.
|
|
3017
|
+
static hide(index = 0) {
|
|
3018
|
+
this.alertsManager.visibleInstances[index].hide();
|
|
3019
|
+
this.remove(index);
|
|
2933
3020
|
}
|
|
2934
3021
|
/**
|
|
2935
|
-
*
|
|
2936
|
-
* @param
|
|
3022
|
+
* Hides alert by alert id (returned by the `show` method)
|
|
3023
|
+
* @param id
|
|
2937
3024
|
*/
|
|
2938
|
-
static
|
|
2939
|
-
this.
|
|
2940
|
-
this.
|
|
3025
|
+
static hideById(id) {
|
|
3026
|
+
const index = this.alertsManager.visibleInstances.findIndex((instance) => instance.id === id);
|
|
3027
|
+
this.hide(index);
|
|
2941
3028
|
}
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
3029
|
+
/**
|
|
3030
|
+
* Hides all of the alerts
|
|
3031
|
+
*/
|
|
3032
|
+
static hideAll() {
|
|
3033
|
+
const { length } = this.alertsManager.visibleInstances;
|
|
3034
|
+
for (let i = 0; i < length; i += 1)
|
|
3035
|
+
this.remove(0);
|
|
3036
|
+
}
|
|
3037
|
+
/**
|
|
3038
|
+
* Removes an alert from the alert queue
|
|
3039
|
+
* @param index index of the alert to be removed
|
|
3040
|
+
*/
|
|
3041
|
+
static remove(index) {
|
|
3042
|
+
this.alertsManager.remove(index);
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
2947
3045
|
|
|
2948
3046
|
/**
|
|
2949
3047
|
* Base class for Dialog component.
|
|
@@ -3746,6 +3844,14 @@ class Date$1 extends TextInput {
|
|
|
3746
3844
|
* Helper value.
|
|
3747
3845
|
*/
|
|
3748
3846
|
this.helperValue = '';
|
|
3847
|
+
/**
|
|
3848
|
+
* Max value allowed.
|
|
3849
|
+
*/
|
|
3850
|
+
this.max = '';
|
|
3851
|
+
/**
|
|
3852
|
+
* Min value allowed.
|
|
3853
|
+
*/
|
|
3854
|
+
this.min = '';
|
|
3749
3855
|
/**
|
|
3750
3856
|
* Width of the picker.
|
|
3751
3857
|
*/
|
|
@@ -3773,6 +3879,8 @@ class Date$1 extends TextInput {
|
|
|
3773
3879
|
this.pickerType = this.getInitValue('pickerType', props.pickerType, this.pickerType);
|
|
3774
3880
|
this.helperOptions = this.getInitValue('helperOptions', props.helperOptions, this.helperOptions);
|
|
3775
3881
|
this.helperValue = this.getInitValue('helperValue', props.helperValue, this.helperValue);
|
|
3882
|
+
this.min = this.getInitValue('min', props.min, this.min);
|
|
3883
|
+
this.max = this.getInitValue('max', props.max, this.max);
|
|
3776
3884
|
this.width = this.getInitValue('width', props.width, this.width);
|
|
3777
3885
|
this.mask = this.getInitValue('mask', props.mask, undefined);
|
|
3778
3886
|
this.createAccessors();
|
|
@@ -3856,6 +3964,28 @@ class Date$1 extends TextInput {
|
|
|
3856
3964
|
this.value = this.internalValue; // forces value accessor to be called if necessary
|
|
3857
3965
|
}
|
|
3858
3966
|
isValidDate(value, format, strict = true) {
|
|
3967
|
+
const date = dayjs(value, format, strict);
|
|
3968
|
+
const isValidFormat = date.isValid();
|
|
3969
|
+
if (!isValidFormat)
|
|
3970
|
+
return false;
|
|
3971
|
+
const minDate = this.min ? dayjs(this.min, this.dateFormat) : null;
|
|
3972
|
+
const isValidMin = !minDate || date.isAfter(minDate) || date.isSame(minDate);
|
|
3973
|
+
if (!isValidMin)
|
|
3974
|
+
return false;
|
|
3975
|
+
const maxDate = this.max ? dayjs(this.max, this.dateFormat) : null;
|
|
3976
|
+
const isValidMax = !maxDate || date.isBefore(maxDate) || date.isSame(maxDate);
|
|
3977
|
+
if (!isValidMax)
|
|
3978
|
+
return false;
|
|
3979
|
+
const isAllowedDate = this.allowedDates === undefined
|
|
3980
|
+
|| (this.allowedDates instanceof Function
|
|
3981
|
+
&& this.allowedDates(dayjs(value, format).format(this.dateFormat)))
|
|
3982
|
+
|| (Array.isArray(this.allowedDates)
|
|
3983
|
+
&& this.allowedDates.indexOf(dayjs(value, format).format(this.dateFormat)) !== -1);
|
|
3984
|
+
if (!isAllowedDate)
|
|
3985
|
+
return false;
|
|
3986
|
+
return true;
|
|
3987
|
+
}
|
|
3988
|
+
isValidFormatDate(value, format, strict = true) {
|
|
3859
3989
|
return dayjs(value, format, strict).isValid();
|
|
3860
3990
|
}
|
|
3861
3991
|
get isoValue() {
|
|
@@ -3869,13 +3999,13 @@ class Date$1 extends TextInput {
|
|
|
3869
3999
|
this.change(this.value);
|
|
3870
4000
|
}
|
|
3871
4001
|
formatISODateValue(value) {
|
|
3872
|
-
if (value && this.
|
|
4002
|
+
if (value && this.isValidFormatDate(value, this.dateFormat)) {
|
|
3873
4003
|
return dayjs(value, this.dateFormat).format(this.isoFormat);
|
|
3874
4004
|
}
|
|
3875
4005
|
return '';
|
|
3876
4006
|
}
|
|
3877
4007
|
parseISODateValue(value) {
|
|
3878
|
-
if (value && this.
|
|
4008
|
+
if (value && this.isValidFormatDate(value, this.isoFormat)) {
|
|
3879
4009
|
return dayjs(value, this.isoFormat).format(this.dateFormat);
|
|
3880
4010
|
}
|
|
3881
4011
|
return null;
|
|
@@ -4100,6 +4230,14 @@ class DateRange extends TextInput {
|
|
|
4100
4230
|
* Helper options.
|
|
4101
4231
|
*/
|
|
4102
4232
|
this.helperOptions = [];
|
|
4233
|
+
/**
|
|
4234
|
+
* Max value allowed.
|
|
4235
|
+
*/
|
|
4236
|
+
this.max = '';
|
|
4237
|
+
/**
|
|
4238
|
+
* Min value allowed.
|
|
4239
|
+
*/
|
|
4240
|
+
this.min = '';
|
|
4103
4241
|
/**
|
|
4104
4242
|
* Helper value.
|
|
4105
4243
|
*/
|
|
@@ -4127,6 +4265,8 @@ class DateRange extends TextInput {
|
|
|
4127
4265
|
this.mask = this.getInitValue('mask', props.mask, undefined);
|
|
4128
4266
|
this.helperOptions = this.getInitValue('helperOptions', props.helperOptions, this.helperOptions);
|
|
4129
4267
|
this.helperValue = this.getInitValue('helperValue', props.helperValue, this.helperValue);
|
|
4268
|
+
this.min = this.getInitValue('min', props.min, this.min);
|
|
4269
|
+
this.max = this.getInitValue('max', props.max, this.max);
|
|
4130
4270
|
this.createAccessors();
|
|
4131
4271
|
this.unitMask = this.mask;
|
|
4132
4272
|
this.initialMask = this.getInitialMask();
|
|
@@ -4223,6 +4363,21 @@ class DateRange extends TextInput {
|
|
|
4223
4363
|
return [value];
|
|
4224
4364
|
}
|
|
4225
4365
|
isValidDate(value, format, strict = true) {
|
|
4366
|
+
const date = dayjs(value, format, strict);
|
|
4367
|
+
const isValidFormat = date.isValid();
|
|
4368
|
+
if (!isValidFormat)
|
|
4369
|
+
return false;
|
|
4370
|
+
const minDate = this.min ? dayjs(this.min, this.dateFormat) : null;
|
|
4371
|
+
const isValidMin = !minDate || date.isAfter(minDate) || date.isSame(minDate);
|
|
4372
|
+
if (!isValidMin)
|
|
4373
|
+
return false;
|
|
4374
|
+
const maxDate = this.max ? dayjs(this.max, this.dateFormat) : null;
|
|
4375
|
+
const isValidMax = !maxDate || date.isBefore(maxDate) || date.isSame(maxDate);
|
|
4376
|
+
if (!isValidMax)
|
|
4377
|
+
return false;
|
|
4378
|
+
return true;
|
|
4379
|
+
}
|
|
4380
|
+
isValidFormatDate(value, format, strict = true) {
|
|
4226
4381
|
return dayjs(value, format, strict).isValid();
|
|
4227
4382
|
}
|
|
4228
4383
|
get isoRangeValue() {
|
|
@@ -4243,7 +4398,7 @@ class DateRange extends TextInput {
|
|
|
4243
4398
|
splitedValue = this.splitValues(dates);
|
|
4244
4399
|
const formattedValue = [];
|
|
4245
4400
|
splitedValue.forEach((value) => {
|
|
4246
|
-
if (value && this.
|
|
4401
|
+
if (value && this.isValidFormatDate(value, this.dateFormat)) {
|
|
4247
4402
|
formattedValue.push(dayjs(value, this.dateFormat, true).format(this.isoFormat));
|
|
4248
4403
|
}
|
|
4249
4404
|
});
|
|
@@ -4253,7 +4408,7 @@ class DateRange extends TextInput {
|
|
|
4253
4408
|
const parsedValue = [];
|
|
4254
4409
|
if (values.length) {
|
|
4255
4410
|
values.forEach((value) => {
|
|
4256
|
-
if (value && this.
|
|
4411
|
+
if (value && this.isValidFormatDate(value, this.isoFormat)) {
|
|
4257
4412
|
parsedValue.push(dayjs(value, this.isoFormat, true).format(this.dateFormat));
|
|
4258
4413
|
}
|
|
4259
4414
|
});
|
|
@@ -6065,6 +6220,7 @@ class Grid extends Iterable {
|
|
|
6065
6220
|
const instance = Metadata.updateInstance(instanceName, updatedComponent);
|
|
6066
6221
|
if (newClickEvt)
|
|
6067
6222
|
instance.events.click = newClickEvt;
|
|
6223
|
+
return instance;
|
|
6068
6224
|
}
|
|
6069
6225
|
catch (e) {
|
|
6070
6226
|
if (!newComponent.events) {
|
|
@@ -6072,8 +6228,8 @@ class Grid extends Iterable {
|
|
|
6072
6228
|
}
|
|
6073
6229
|
if (newClickEvt)
|
|
6074
6230
|
newComponent.events.click = newClickEvt;
|
|
6231
|
+
return newComponent;
|
|
6075
6232
|
}
|
|
6076
|
-
return newComponent;
|
|
6077
6233
|
}
|
|
6078
6234
|
changeDefaultSlotNames(slot) {
|
|
6079
6235
|
const strMetadata = JSON.stringify(slot);
|
|
@@ -6526,7 +6682,13 @@ class GridEditable extends Grid {
|
|
|
6526
6682
|
*/
|
|
6527
6683
|
addNewRow(row, position = 'end') {
|
|
6528
6684
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6529
|
-
|
|
6685
|
+
let data;
|
|
6686
|
+
if (this.datasource instanceof MemoryDatasource) {
|
|
6687
|
+
data = this.datasource.allData;
|
|
6688
|
+
}
|
|
6689
|
+
else {
|
|
6690
|
+
data = this.datasource.data;
|
|
6691
|
+
}
|
|
6530
6692
|
row[this.newRowIdentifier] = true;
|
|
6531
6693
|
if (position === 'start') {
|
|
6532
6694
|
data.unshift(row);
|
|
@@ -11183,12 +11345,17 @@ class Tabs extends ComponentRender {
|
|
|
11183
11345
|
* Set component height to fill all space available
|
|
11184
11346
|
*/
|
|
11185
11347
|
this.fillHeight = false;
|
|
11348
|
+
/**
|
|
11349
|
+
* Disable touch support.
|
|
11350
|
+
*/
|
|
11351
|
+
this.touchless = false;
|
|
11186
11352
|
this.tabs = this.getTabs(props.tabs || []);
|
|
11187
11353
|
this.activeTab = this.getInitValue('activeTab', props.activeTab, this.activeTabValue);
|
|
11188
11354
|
this.height = this.getInitValue('height', props.height, this.height);
|
|
11189
11355
|
this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
|
|
11190
11356
|
this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
|
|
11191
11357
|
this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
|
|
11358
|
+
this.touchless = this.getInitValue('touchless', props.touchless, this.touchless);
|
|
11192
11359
|
this.createAccessors();
|
|
11193
11360
|
}
|
|
11194
11361
|
get activeTab() {
|
|
@@ -11294,6 +11461,7 @@ class Text extends ComponentRender {
|
|
|
11294
11461
|
this.compile = props.compile === true;
|
|
11295
11462
|
this.tag = this.getInitValue('tag', props.tag, this.tag);
|
|
11296
11463
|
this.text = this.getInitValue('text', props.text, this.text);
|
|
11464
|
+
this.textResize = this.getInitValue('textResize', props.textResize, this.textResize);
|
|
11297
11465
|
this.createAccessors();
|
|
11298
11466
|
}
|
|
11299
11467
|
}
|
package/dist/zd-common.umd.js
CHANGED
|
@@ -357,6 +357,7 @@
|
|
|
357
357
|
* Stacks alert content vertically (mobile)
|
|
358
358
|
*/
|
|
359
359
|
this.vertical = false;
|
|
360
|
+
this.id = 0;
|
|
360
361
|
this.defaultValues = {
|
|
361
362
|
name: this.name,
|
|
362
363
|
dark: this.dark,
|
|
@@ -374,6 +375,7 @@
|
|
|
374
375
|
showDismiss: this.showDismiss,
|
|
375
376
|
dismissColor: this.dismissColor,
|
|
376
377
|
buttonsSlot: this.buttonsSlot,
|
|
378
|
+
id: this.id,
|
|
377
379
|
};
|
|
378
380
|
this.assignAlertProperties(props);
|
|
379
381
|
this.createAccessors();
|
|
@@ -399,6 +401,7 @@
|
|
|
399
401
|
this.showDismiss = this.getInitValue('showDismiss', alert.showDismiss, this.defaultValues.showDismiss);
|
|
400
402
|
this.dismissColor = this.getInitValue('dismissColor', alert.dismissColor, this.defaultValues.dismissColor);
|
|
401
403
|
this.buttonsSlot = alert.buttonsSlot || this.defaultValues.buttonsSlot;
|
|
404
|
+
this.id = alert.id || this.defaultValues.id;
|
|
402
405
|
this.isVisible = false;
|
|
403
406
|
}
|
|
404
407
|
/**
|
|
@@ -2801,12 +2804,7 @@
|
|
|
2801
2804
|
*/
|
|
2802
2805
|
constructor(props) {
|
|
2803
2806
|
super(props);
|
|
2804
|
-
this.defaultMask = core.Config.masks.numberMask || {
|
|
2805
|
-
decimalCharacter: ',',
|
|
2806
|
-
decimalCharacterAlternative: '.',
|
|
2807
|
-
decimalPlaces: 2,
|
|
2808
|
-
digitGroupSeparator: '.',
|
|
2809
|
-
};
|
|
2807
|
+
this.defaultMask = core.Config.masks.numberMask || {};
|
|
2810
2808
|
/*
|
|
2811
2809
|
* Defines how the field content should be aligned.
|
|
2812
2810
|
*/
|
|
@@ -2833,7 +2831,7 @@
|
|
|
2833
2831
|
this.localValue = value;
|
|
2834
2832
|
if (this.maskValid && this.localValue !== undefined && this.localValue !== null) {
|
|
2835
2833
|
this.formattedValue = AutoNumeric.format(this.localValue, this.mask);
|
|
2836
|
-
if (this.autoNumericObj) {
|
|
2834
|
+
if (this.autoNumericObj && value !== this.autoNumericObj.rawValue) {
|
|
2837
2835
|
this.autoNumericObj.setValue(value);
|
|
2838
2836
|
}
|
|
2839
2837
|
}
|
|
@@ -2903,7 +2901,7 @@
|
|
|
2903
2901
|
class Currency extends Number$1 {
|
|
2904
2902
|
constructor(props) {
|
|
2905
2903
|
super(props);
|
|
2906
|
-
this.defaultMask = core.Config.masks.currencyMask;
|
|
2904
|
+
this.defaultMask = Object.assign(Object.assign({}, core.Config.masks.numberMask), core.Config.masks.currencyMask);
|
|
2907
2905
|
this.formatterFn = core.FormatterParserProvider.getFormatter('ZdCurrency');
|
|
2908
2906
|
this.parserFn = core.FormatterParserProvider.getParser('ZdCurrency');
|
|
2909
2907
|
this.mask = this.getInitValue('mask', props.mask, this.defaultMask);
|
|
@@ -2911,46 +2909,146 @@
|
|
|
2911
2909
|
this.validateMask();
|
|
2912
2910
|
}
|
|
2913
2911
|
}
|
|
2914
|
-
core.FormatterParserProvider.registerFormatter('ZdCurrency', (value, { mask = core.Config.masks.currencyMask, } = {}) =>
|
|
2915
|
-
|
|
2912
|
+
core.FormatterParserProvider.registerFormatter('ZdCurrency', (value, { mask = Object.assign(Object.assign({}, core.Config.masks.numberMask), core.Config.masks.currencyMask), } = {}) => {
|
|
2913
|
+
let maskDef = mask;
|
|
2914
|
+
if (core.Accessor.isAccessorDefinition(maskDef)) {
|
|
2915
|
+
const [controller, accessor] = core.Accessor.getAccessor(maskDef);
|
|
2916
|
+
maskDef = core.Loader.getInstance(controller)[accessor];
|
|
2917
|
+
}
|
|
2918
|
+
const maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.unformat(value)) : maskDef;
|
|
2919
|
+
return value === null ? '' : AutoNumeric.format(value, maskValue);
|
|
2920
|
+
});
|
|
2921
|
+
core.FormatterParserProvider.registerParser('ZdCurrency', (value, { mask = Object.assign(Object.assign({}, core.Config.masks.numberMask), core.Config.masks.currencyMask), } = {}) => {
|
|
2922
|
+
let maskDef = mask;
|
|
2923
|
+
if (core.Accessor.isAccessorDefinition(maskDef)) {
|
|
2924
|
+
const [controller, accessor] = core.Accessor.getAccessor(maskDef);
|
|
2925
|
+
maskDef = core.Loader.getInstance(controller)[accessor];
|
|
2926
|
+
}
|
|
2927
|
+
const maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
|
|
2928
|
+
return value === '' ? null : AutoNumeric.unformat(value, maskValue);
|
|
2929
|
+
});
|
|
2930
|
+
|
|
2931
|
+
class AlertQueue {
|
|
2932
|
+
constructor() {
|
|
2933
|
+
this.queue = [];
|
|
2934
|
+
this.visibleInstances = [];
|
|
2935
|
+
}
|
|
2936
|
+
show(alert) {
|
|
2937
|
+
this.queue.push(alert);
|
|
2938
|
+
if ((this.visibleInstances.length === 0 || !this.visibleInstances[0].isVisible)
|
|
2939
|
+
&& this.queue.length === 1) {
|
|
2940
|
+
this.display(alert);
|
|
2941
|
+
}
|
|
2942
|
+
return 0;
|
|
2943
|
+
}
|
|
2944
|
+
/**
|
|
2945
|
+
* Displays an alert
|
|
2946
|
+
* @param alert Alert Structure
|
|
2947
|
+
*/
|
|
2948
|
+
display(alert) {
|
|
2949
|
+
if (this.visibleInstances.length === 0) {
|
|
2950
|
+
this.visibleInstances.push(new Alert({ name: 'alert-instance', id: 0 }));
|
|
2951
|
+
}
|
|
2952
|
+
this.visibleInstances[0].assignAlertProperties(alert);
|
|
2953
|
+
this.visibleInstances[0].show();
|
|
2954
|
+
return 0;
|
|
2955
|
+
}
|
|
2956
|
+
remove(index) {
|
|
2957
|
+
this.queue.splice(index, 1);
|
|
2958
|
+
if (index === 0 && this.queue[0]) {
|
|
2959
|
+
setTimeout(() => this.display(this.queue[0]), 200);
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
}
|
|
2963
|
+
|
|
2964
|
+
class AlertReplace extends AlertQueue {
|
|
2965
|
+
show(alert) {
|
|
2966
|
+
super.show(alert);
|
|
2967
|
+
this.visibleInstances[0].hide();
|
|
2968
|
+
this.remove(0);
|
|
2969
|
+
setTimeout(() => this.display(alert), 200);
|
|
2970
|
+
return 0;
|
|
2971
|
+
}
|
|
2972
|
+
}
|
|
2973
|
+
|
|
2974
|
+
class AlertStack {
|
|
2975
|
+
constructor() {
|
|
2976
|
+
this.queue = [];
|
|
2977
|
+
this.visibleInstances = [];
|
|
2978
|
+
}
|
|
2979
|
+
show(alert) {
|
|
2980
|
+
this.queue.push(alert);
|
|
2981
|
+
return this.display(alert);
|
|
2982
|
+
}
|
|
2983
|
+
display(alert) {
|
|
2984
|
+
const lastAlert = this.visibleInstances.slice(-1)[0];
|
|
2985
|
+
const lastId = (lastAlert === null || lastAlert === void 0 ? void 0 : lastAlert.id) || 0;
|
|
2986
|
+
const id = lastId + 1;
|
|
2987
|
+
const instance = new Alert(Object.assign(Object.assign({}, alert), { id }));
|
|
2988
|
+
this.visibleInstances.push(instance);
|
|
2989
|
+
instance.show();
|
|
2990
|
+
return id;
|
|
2991
|
+
}
|
|
2992
|
+
remove(index) {
|
|
2993
|
+
this.queue.splice(index, 1);
|
|
2994
|
+
this.visibleInstances.splice(index, 1);
|
|
2995
|
+
}
|
|
2996
|
+
}
|
|
2916
2997
|
|
|
2917
2998
|
/**
|
|
2918
2999
|
* Alert Service Class
|
|
2919
3000
|
*/
|
|
2920
3001
|
class AlertService {
|
|
3002
|
+
static instantiateManager(multiple) {
|
|
3003
|
+
if (multiple === 'queue') {
|
|
3004
|
+
this.alertsManager = new AlertQueue();
|
|
3005
|
+
return;
|
|
3006
|
+
}
|
|
3007
|
+
if (multiple === 'stack') {
|
|
3008
|
+
this.alertsManager = new AlertStack();
|
|
3009
|
+
return;
|
|
3010
|
+
}
|
|
3011
|
+
this.alertsManager = new AlertReplace();
|
|
3012
|
+
}
|
|
2921
3013
|
/**
|
|
2922
3014
|
* Displays an alert.
|
|
2923
3015
|
* If has an opened alert it will be closed.
|
|
2924
3016
|
* @param alert Alert structure
|
|
2925
3017
|
*/
|
|
2926
3018
|
static show(alert) {
|
|
2927
|
-
|
|
2928
|
-
this.hide();
|
|
2929
|
-
setTimeout(() => this.display(alert), 200);
|
|
2930
|
-
}
|
|
2931
|
-
else {
|
|
2932
|
-
this.display(alert);
|
|
2933
|
-
}
|
|
3019
|
+
return this.alertsManager.show(alert);
|
|
2934
3020
|
}
|
|
2935
3021
|
/**
|
|
2936
|
-
* Hides
|
|
3022
|
+
* Hides alert by index. Default index is 0
|
|
2937
3023
|
*/
|
|
2938
|
-
static hide() {
|
|
2939
|
-
this.
|
|
3024
|
+
static hide(index = 0) {
|
|
3025
|
+
this.alertsManager.visibleInstances[index].hide();
|
|
3026
|
+
this.remove(index);
|
|
2940
3027
|
}
|
|
2941
3028
|
/**
|
|
2942
|
-
*
|
|
2943
|
-
* @param
|
|
3029
|
+
* Hides alert by alert id (returned by the `show` method)
|
|
3030
|
+
* @param id
|
|
2944
3031
|
*/
|
|
2945
|
-
static
|
|
2946
|
-
this.
|
|
2947
|
-
this.
|
|
3032
|
+
static hideById(id) {
|
|
3033
|
+
const index = this.alertsManager.visibleInstances.findIndex((instance) => instance.id === id);
|
|
3034
|
+
this.hide(index);
|
|
2948
3035
|
}
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
3036
|
+
/**
|
|
3037
|
+
* Hides all of the alerts
|
|
3038
|
+
*/
|
|
3039
|
+
static hideAll() {
|
|
3040
|
+
const { length } = this.alertsManager.visibleInstances;
|
|
3041
|
+
for (let i = 0; i < length; i += 1)
|
|
3042
|
+
this.remove(0);
|
|
3043
|
+
}
|
|
3044
|
+
/**
|
|
3045
|
+
* Removes an alert from the alert queue
|
|
3046
|
+
* @param index index of the alert to be removed
|
|
3047
|
+
*/
|
|
3048
|
+
static remove(index) {
|
|
3049
|
+
this.alertsManager.remove(index);
|
|
3050
|
+
}
|
|
3051
|
+
}
|
|
2954
3052
|
|
|
2955
3053
|
/**
|
|
2956
3054
|
* Base class for Dialog component.
|
|
@@ -3753,6 +3851,14 @@
|
|
|
3753
3851
|
* Helper value.
|
|
3754
3852
|
*/
|
|
3755
3853
|
this.helperValue = '';
|
|
3854
|
+
/**
|
|
3855
|
+
* Max value allowed.
|
|
3856
|
+
*/
|
|
3857
|
+
this.max = '';
|
|
3858
|
+
/**
|
|
3859
|
+
* Min value allowed.
|
|
3860
|
+
*/
|
|
3861
|
+
this.min = '';
|
|
3756
3862
|
/**
|
|
3757
3863
|
* Width of the picker.
|
|
3758
3864
|
*/
|
|
@@ -3780,6 +3886,8 @@
|
|
|
3780
3886
|
this.pickerType = this.getInitValue('pickerType', props.pickerType, this.pickerType);
|
|
3781
3887
|
this.helperOptions = this.getInitValue('helperOptions', props.helperOptions, this.helperOptions);
|
|
3782
3888
|
this.helperValue = this.getInitValue('helperValue', props.helperValue, this.helperValue);
|
|
3889
|
+
this.min = this.getInitValue('min', props.min, this.min);
|
|
3890
|
+
this.max = this.getInitValue('max', props.max, this.max);
|
|
3783
3891
|
this.width = this.getInitValue('width', props.width, this.width);
|
|
3784
3892
|
this.mask = this.getInitValue('mask', props.mask, undefined);
|
|
3785
3893
|
this.createAccessors();
|
|
@@ -3863,6 +3971,28 @@
|
|
|
3863
3971
|
this.value = this.internalValue; // forces value accessor to be called if necessary
|
|
3864
3972
|
}
|
|
3865
3973
|
isValidDate(value, format, strict = true) {
|
|
3974
|
+
const date = core.dayjs(value, format, strict);
|
|
3975
|
+
const isValidFormat = date.isValid();
|
|
3976
|
+
if (!isValidFormat)
|
|
3977
|
+
return false;
|
|
3978
|
+
const minDate = this.min ? core.dayjs(this.min, this.dateFormat) : null;
|
|
3979
|
+
const isValidMin = !minDate || date.isAfter(minDate) || date.isSame(minDate);
|
|
3980
|
+
if (!isValidMin)
|
|
3981
|
+
return false;
|
|
3982
|
+
const maxDate = this.max ? core.dayjs(this.max, this.dateFormat) : null;
|
|
3983
|
+
const isValidMax = !maxDate || date.isBefore(maxDate) || date.isSame(maxDate);
|
|
3984
|
+
if (!isValidMax)
|
|
3985
|
+
return false;
|
|
3986
|
+
const isAllowedDate = this.allowedDates === undefined
|
|
3987
|
+
|| (this.allowedDates instanceof Function
|
|
3988
|
+
&& this.allowedDates(core.dayjs(value, format).format(this.dateFormat)))
|
|
3989
|
+
|| (Array.isArray(this.allowedDates)
|
|
3990
|
+
&& this.allowedDates.indexOf(core.dayjs(value, format).format(this.dateFormat)) !== -1);
|
|
3991
|
+
if (!isAllowedDate)
|
|
3992
|
+
return false;
|
|
3993
|
+
return true;
|
|
3994
|
+
}
|
|
3995
|
+
isValidFormatDate(value, format, strict = true) {
|
|
3866
3996
|
return core.dayjs(value, format, strict).isValid();
|
|
3867
3997
|
}
|
|
3868
3998
|
get isoValue() {
|
|
@@ -3876,13 +4006,13 @@
|
|
|
3876
4006
|
this.change(this.value);
|
|
3877
4007
|
}
|
|
3878
4008
|
formatISODateValue(value) {
|
|
3879
|
-
if (value && this.
|
|
4009
|
+
if (value && this.isValidFormatDate(value, this.dateFormat)) {
|
|
3880
4010
|
return core.dayjs(value, this.dateFormat).format(this.isoFormat);
|
|
3881
4011
|
}
|
|
3882
4012
|
return '';
|
|
3883
4013
|
}
|
|
3884
4014
|
parseISODateValue(value) {
|
|
3885
|
-
if (value && this.
|
|
4015
|
+
if (value && this.isValidFormatDate(value, this.isoFormat)) {
|
|
3886
4016
|
return core.dayjs(value, this.isoFormat).format(this.dateFormat);
|
|
3887
4017
|
}
|
|
3888
4018
|
return null;
|
|
@@ -4107,6 +4237,14 @@
|
|
|
4107
4237
|
* Helper options.
|
|
4108
4238
|
*/
|
|
4109
4239
|
this.helperOptions = [];
|
|
4240
|
+
/**
|
|
4241
|
+
* Max value allowed.
|
|
4242
|
+
*/
|
|
4243
|
+
this.max = '';
|
|
4244
|
+
/**
|
|
4245
|
+
* Min value allowed.
|
|
4246
|
+
*/
|
|
4247
|
+
this.min = '';
|
|
4110
4248
|
/**
|
|
4111
4249
|
* Helper value.
|
|
4112
4250
|
*/
|
|
@@ -4134,6 +4272,8 @@
|
|
|
4134
4272
|
this.mask = this.getInitValue('mask', props.mask, undefined);
|
|
4135
4273
|
this.helperOptions = this.getInitValue('helperOptions', props.helperOptions, this.helperOptions);
|
|
4136
4274
|
this.helperValue = this.getInitValue('helperValue', props.helperValue, this.helperValue);
|
|
4275
|
+
this.min = this.getInitValue('min', props.min, this.min);
|
|
4276
|
+
this.max = this.getInitValue('max', props.max, this.max);
|
|
4137
4277
|
this.createAccessors();
|
|
4138
4278
|
this.unitMask = this.mask;
|
|
4139
4279
|
this.initialMask = this.getInitialMask();
|
|
@@ -4230,6 +4370,21 @@
|
|
|
4230
4370
|
return [value];
|
|
4231
4371
|
}
|
|
4232
4372
|
isValidDate(value, format, strict = true) {
|
|
4373
|
+
const date = core.dayjs(value, format, strict);
|
|
4374
|
+
const isValidFormat = date.isValid();
|
|
4375
|
+
if (!isValidFormat)
|
|
4376
|
+
return false;
|
|
4377
|
+
const minDate = this.min ? core.dayjs(this.min, this.dateFormat) : null;
|
|
4378
|
+
const isValidMin = !minDate || date.isAfter(minDate) || date.isSame(minDate);
|
|
4379
|
+
if (!isValidMin)
|
|
4380
|
+
return false;
|
|
4381
|
+
const maxDate = this.max ? core.dayjs(this.max, this.dateFormat) : null;
|
|
4382
|
+
const isValidMax = !maxDate || date.isBefore(maxDate) || date.isSame(maxDate);
|
|
4383
|
+
if (!isValidMax)
|
|
4384
|
+
return false;
|
|
4385
|
+
return true;
|
|
4386
|
+
}
|
|
4387
|
+
isValidFormatDate(value, format, strict = true) {
|
|
4233
4388
|
return core.dayjs(value, format, strict).isValid();
|
|
4234
4389
|
}
|
|
4235
4390
|
get isoRangeValue() {
|
|
@@ -4250,7 +4405,7 @@
|
|
|
4250
4405
|
splitedValue = this.splitValues(dates);
|
|
4251
4406
|
const formattedValue = [];
|
|
4252
4407
|
splitedValue.forEach((value) => {
|
|
4253
|
-
if (value && this.
|
|
4408
|
+
if (value && this.isValidFormatDate(value, this.dateFormat)) {
|
|
4254
4409
|
formattedValue.push(core.dayjs(value, this.dateFormat, true).format(this.isoFormat));
|
|
4255
4410
|
}
|
|
4256
4411
|
});
|
|
@@ -4260,7 +4415,7 @@
|
|
|
4260
4415
|
const parsedValue = [];
|
|
4261
4416
|
if (values.length) {
|
|
4262
4417
|
values.forEach((value) => {
|
|
4263
|
-
if (value && this.
|
|
4418
|
+
if (value && this.isValidFormatDate(value, this.isoFormat)) {
|
|
4264
4419
|
parsedValue.push(core.dayjs(value, this.isoFormat, true).format(this.dateFormat));
|
|
4265
4420
|
}
|
|
4266
4421
|
});
|
|
@@ -6072,6 +6227,7 @@
|
|
|
6072
6227
|
const instance = core.Metadata.updateInstance(instanceName, updatedComponent);
|
|
6073
6228
|
if (newClickEvt)
|
|
6074
6229
|
instance.events.click = newClickEvt;
|
|
6230
|
+
return instance;
|
|
6075
6231
|
}
|
|
6076
6232
|
catch (e) {
|
|
6077
6233
|
if (!newComponent.events) {
|
|
@@ -6079,8 +6235,8 @@
|
|
|
6079
6235
|
}
|
|
6080
6236
|
if (newClickEvt)
|
|
6081
6237
|
newComponent.events.click = newClickEvt;
|
|
6238
|
+
return newComponent;
|
|
6082
6239
|
}
|
|
6083
|
-
return newComponent;
|
|
6084
6240
|
}
|
|
6085
6241
|
changeDefaultSlotNames(slot) {
|
|
6086
6242
|
const strMetadata = JSON.stringify(slot);
|
|
@@ -6533,7 +6689,13 @@
|
|
|
6533
6689
|
*/
|
|
6534
6690
|
addNewRow(row, position = 'end') {
|
|
6535
6691
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6536
|
-
|
|
6692
|
+
let data;
|
|
6693
|
+
if (this.datasource instanceof core.MemoryDatasource) {
|
|
6694
|
+
data = this.datasource.allData;
|
|
6695
|
+
}
|
|
6696
|
+
else {
|
|
6697
|
+
data = this.datasource.data;
|
|
6698
|
+
}
|
|
6537
6699
|
row[this.newRowIdentifier] = true;
|
|
6538
6700
|
if (position === 'start') {
|
|
6539
6701
|
data.unshift(row);
|
|
@@ -11190,12 +11352,17 @@
|
|
|
11190
11352
|
* Set component height to fill all space available
|
|
11191
11353
|
*/
|
|
11192
11354
|
this.fillHeight = false;
|
|
11355
|
+
/**
|
|
11356
|
+
* Disable touch support.
|
|
11357
|
+
*/
|
|
11358
|
+
this.touchless = false;
|
|
11193
11359
|
this.tabs = this.getTabs(props.tabs || []);
|
|
11194
11360
|
this.activeTab = this.getInitValue('activeTab', props.activeTab, this.activeTabValue);
|
|
11195
11361
|
this.height = this.getInitValue('height', props.height, this.height);
|
|
11196
11362
|
this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
|
|
11197
11363
|
this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
|
|
11198
11364
|
this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
|
|
11365
|
+
this.touchless = this.getInitValue('touchless', props.touchless, this.touchless);
|
|
11199
11366
|
this.createAccessors();
|
|
11200
11367
|
}
|
|
11201
11368
|
get activeTab() {
|
|
@@ -11301,6 +11468,7 @@
|
|
|
11301
11468
|
this.compile = props.compile === true;
|
|
11302
11469
|
this.tag = this.getInitValue('tag', props.tag, this.tag);
|
|
11303
11470
|
this.text = this.getInitValue('text', props.text, this.text);
|
|
11471
|
+
this.textResize = this.getInitValue('textResize', props.textResize, this.textResize);
|
|
11304
11472
|
this.createAccessors();
|
|
11305
11473
|
}
|
|
11306
11474
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeedhi/common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.80.1",
|
|
4
4
|
"description": "Zeedhi Common",
|
|
5
5
|
"author": "Zeedhi <zeedhi@teknisa.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"lodash.times": "4.3.*",
|
|
42
42
|
"mockdate": "3.0.*"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "a8219aae6129d4d736eb08a28ef2763b6dcd9a36"
|
|
45
45
|
}
|
|
@@ -60,6 +60,7 @@ export declare class Alert extends Component implements IAlert {
|
|
|
60
60
|
* Stacks alert content vertically (mobile)
|
|
61
61
|
*/
|
|
62
62
|
vertical: boolean;
|
|
63
|
+
id: number;
|
|
63
64
|
protected defaultValues: {
|
|
64
65
|
name: string;
|
|
65
66
|
dark: boolean;
|
|
@@ -77,6 +78,7 @@ export declare class Alert extends Component implements IAlert {
|
|
|
77
78
|
showDismiss: boolean;
|
|
78
79
|
dismissColor: string;
|
|
79
80
|
buttonsSlot: IButton[];
|
|
81
|
+
id: number;
|
|
80
82
|
};
|
|
81
83
|
/**
|
|
82
84
|
* Creates a new Alert
|
|
@@ -57,6 +57,14 @@ export declare class DateRange extends TextInput implements IDateRange {
|
|
|
57
57
|
* Helper options.
|
|
58
58
|
*/
|
|
59
59
|
helperOptions?: string[];
|
|
60
|
+
/**
|
|
61
|
+
* Max value allowed.
|
|
62
|
+
*/
|
|
63
|
+
max?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Min value allowed.
|
|
66
|
+
*/
|
|
67
|
+
min?: string;
|
|
60
68
|
/**
|
|
61
69
|
* Helper value.
|
|
62
70
|
*/
|
|
@@ -91,6 +99,7 @@ export declare class DateRange extends TextInput implements IDateRange {
|
|
|
91
99
|
isValidDateArray(format: string, values?: string[]): boolean;
|
|
92
100
|
private splitValues;
|
|
93
101
|
isValidDate(value: string, format: string, strict?: boolean): boolean;
|
|
102
|
+
isValidFormatDate(value: string, format: string, strict?: boolean): boolean;
|
|
94
103
|
get isoRangeValue(): string[];
|
|
95
104
|
set isoRangeValue(newValue: string[]);
|
|
96
105
|
formatISODateRangeValue(dates: string[] | string): string[];
|
|
@@ -64,6 +64,14 @@ export declare class Date extends TextInput implements IDate {
|
|
|
64
64
|
* Helper value.
|
|
65
65
|
*/
|
|
66
66
|
helperValue?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Max value allowed.
|
|
69
|
+
*/
|
|
70
|
+
max?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Min value allowed.
|
|
73
|
+
*/
|
|
74
|
+
min?: string;
|
|
67
75
|
/**
|
|
68
76
|
* Width of the picker.
|
|
69
77
|
*/
|
|
@@ -101,6 +109,7 @@ export declare class Date extends TextInput implements IDate {
|
|
|
101
109
|
protected maskFormat(format: string): string;
|
|
102
110
|
setDateValue(displayValue: string): void;
|
|
103
111
|
isValidDate(value: string, format: string, strict?: boolean): boolean;
|
|
112
|
+
isValidFormatDate(value: string, format: string, strict?: boolean): boolean;
|
|
104
113
|
get isoValue(): string;
|
|
105
114
|
set isoValue(newValue: string);
|
|
106
115
|
formatISODateValue(value: string): string;
|
|
@@ -27,6 +27,10 @@ export declare class Tabs extends ComponentRender implements ITabs {
|
|
|
27
27
|
* Set component height to fill all space available
|
|
28
28
|
*/
|
|
29
29
|
fillHeight: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Disable touch support.
|
|
32
|
+
*/
|
|
33
|
+
touchless: boolean;
|
|
30
34
|
/**
|
|
31
35
|
* Create a new Tabs.
|
|
32
36
|
* @param props Tabs properties
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IText } from './interfaces';
|
|
1
|
+
import { IText, ITextResize } from './interfaces';
|
|
2
2
|
import { ComponentRender } from '../zd-component/component-render';
|
|
3
3
|
/**
|
|
4
4
|
* Base class for Text component.
|
|
@@ -7,6 +7,7 @@ export declare class Text extends ComponentRender implements IText {
|
|
|
7
7
|
compile: boolean;
|
|
8
8
|
tag: string;
|
|
9
9
|
text: string | string[];
|
|
10
|
+
textResize?: ITextResize;
|
|
10
11
|
/**
|
|
11
12
|
* Creates a new Text.
|
|
12
13
|
* @param props Text properties
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Alert, IAlert } from '../../components';
|
|
2
|
+
import { IAlertsManager } from './interfaces';
|
|
3
|
+
export declare class AlertQueue implements IAlertsManager {
|
|
4
|
+
protected queue: IAlert[];
|
|
5
|
+
visibleInstances: Alert[];
|
|
6
|
+
show(alert: IAlert): number;
|
|
7
|
+
/**
|
|
8
|
+
* Displays an alert
|
|
9
|
+
* @param alert Alert Structure
|
|
10
|
+
*/
|
|
11
|
+
protected display(alert: IAlert): number;
|
|
12
|
+
remove(index: number): void;
|
|
13
|
+
}
|
|
@@ -1,26 +1,34 @@
|
|
|
1
|
-
import { Alert } from '../../components/zd-alert/alert';
|
|
2
1
|
import { IAlert } from '../../components/zd-alert/interfaces';
|
|
2
|
+
import { IAlertsManager } from './interfaces';
|
|
3
|
+
export declare type Multiple = 'replace' | 'stack' | 'queue';
|
|
3
4
|
/**
|
|
4
5
|
* Alert Service Class
|
|
5
6
|
*/
|
|
6
7
|
export declare class AlertService {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*/
|
|
10
|
-
static instance: Alert;
|
|
8
|
+
static alertsManager: IAlertsManager;
|
|
9
|
+
static instantiateManager(multiple: Multiple): void;
|
|
11
10
|
/**
|
|
12
11
|
* Displays an alert.
|
|
13
12
|
* If has an opened alert it will be closed.
|
|
14
13
|
* @param alert Alert structure
|
|
15
14
|
*/
|
|
16
|
-
static show(alert: IAlert):
|
|
15
|
+
static show(alert: IAlert): number;
|
|
16
|
+
/**
|
|
17
|
+
* Hides alert by index. Default index is 0
|
|
18
|
+
*/
|
|
19
|
+
static hide(index?: number): void;
|
|
20
|
+
/**
|
|
21
|
+
* Hides alert by alert id (returned by the `show` method)
|
|
22
|
+
* @param id
|
|
23
|
+
*/
|
|
24
|
+
static hideById(id: number): void;
|
|
17
25
|
/**
|
|
18
|
-
* Hides
|
|
26
|
+
* Hides all of the alerts
|
|
19
27
|
*/
|
|
20
|
-
static
|
|
28
|
+
static hideAll(): void;
|
|
21
29
|
/**
|
|
22
|
-
*
|
|
23
|
-
* @param alert
|
|
30
|
+
* Removes an alert from the alert queue
|
|
31
|
+
* @param index index of the alert to be removed
|
|
24
32
|
*/
|
|
25
|
-
|
|
33
|
+
static remove(index: number): void;
|
|
26
34
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Alert, IAlert } from '../../components';
|
|
2
|
+
import { IAlertsManager } from './interfaces';
|
|
3
|
+
export declare class AlertStack implements IAlertsManager {
|
|
4
|
+
protected queue: IAlert[];
|
|
5
|
+
visibleInstances: Alert[];
|
|
6
|
+
show(alert: IAlert): number;
|
|
7
|
+
private display;
|
|
8
|
+
remove(index: number): void;
|
|
9
|
+
}
|