jsuites 5.0.21 → 5.0.23
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/jsuites.js +88 -23
- package/package.json +1 -1
package/dist/jsuites.js
CHANGED
|
@@ -4207,7 +4207,7 @@ function Calendar() {
|
|
|
4207
4207
|
}
|
|
4208
4208
|
}
|
|
4209
4209
|
|
|
4210
|
-
if (d.indexOf('GMT') === -1) {
|
|
4210
|
+
if (d.indexOf('GMT') === -1 && d.indexOf('Z') === -1) {
|
|
4211
4211
|
d += ' GMT';
|
|
4212
4212
|
}
|
|
4213
4213
|
|
|
@@ -9701,6 +9701,8 @@ function Floating() {
|
|
|
9701
9701
|
|
|
9702
9702
|
/* harmony default export */ var floating = (Floating());
|
|
9703
9703
|
;// CONCATENATED MODULE: ./src/plugins/validations.js
|
|
9704
|
+
|
|
9705
|
+
|
|
9704
9706
|
function Validations() {
|
|
9705
9707
|
/**
|
|
9706
9708
|
* Options: Object,
|
|
@@ -9710,11 +9712,11 @@ function Validations() {
|
|
|
9710
9712
|
* Value
|
|
9711
9713
|
*/
|
|
9712
9714
|
|
|
9713
|
-
|
|
9715
|
+
const isNumeric = function(num) {
|
|
9714
9716
|
return !isNaN(num) && num !== null && num !== '';
|
|
9715
9717
|
}
|
|
9716
9718
|
|
|
9717
|
-
|
|
9719
|
+
const numberCriterias = {
|
|
9718
9720
|
'between': function(value, range) {
|
|
9719
9721
|
return value >= range[0] && value <= range[1];
|
|
9720
9722
|
},
|
|
@@ -9741,13 +9743,16 @@ function Validations() {
|
|
|
9741
9743
|
},
|
|
9742
9744
|
}
|
|
9743
9745
|
|
|
9744
|
-
|
|
9746
|
+
const dateCriterias = {
|
|
9745
9747
|
'valid date': function() {
|
|
9746
9748
|
return true;
|
|
9747
9749
|
},
|
|
9748
9750
|
'=': function(value, range) {
|
|
9749
9751
|
return value === range[0];
|
|
9750
9752
|
},
|
|
9753
|
+
'!=': function(value, range) {
|
|
9754
|
+
return value !== range[0];
|
|
9755
|
+
},
|
|
9751
9756
|
'<': function(value, range) {
|
|
9752
9757
|
return value < range[0];
|
|
9753
9758
|
},
|
|
@@ -9768,7 +9773,7 @@ function Validations() {
|
|
|
9768
9773
|
},
|
|
9769
9774
|
}
|
|
9770
9775
|
|
|
9771
|
-
|
|
9776
|
+
const textCriterias = {
|
|
9772
9777
|
'contains': function(value, range) {
|
|
9773
9778
|
return value.includes(range[0]);
|
|
9774
9779
|
},
|
|
@@ -9784,6 +9789,9 @@ function Validations() {
|
|
|
9784
9789
|
'=': function(value, range) {
|
|
9785
9790
|
return value === range[0];
|
|
9786
9791
|
},
|
|
9792
|
+
'!=': function(value, range) {
|
|
9793
|
+
return value !== range[0];
|
|
9794
|
+
},
|
|
9787
9795
|
'valid email': function(value) {
|
|
9788
9796
|
var pattern = new RegExp(/^[^\s@]+@[^\s@]+\.[^\s@]+$/);
|
|
9789
9797
|
|
|
@@ -9797,12 +9805,11 @@ function Validations() {
|
|
|
9797
9805
|
}
|
|
9798
9806
|
|
|
9799
9807
|
// Component router
|
|
9800
|
-
|
|
9808
|
+
const component = function(value, options) {
|
|
9801
9809
|
if (typeof(component[options.type]) === 'function') {
|
|
9802
9810
|
if (options.allowBlank && value === '') {
|
|
9803
9811
|
return true;
|
|
9804
9812
|
}
|
|
9805
|
-
|
|
9806
9813
|
return component[options.type](value, options);
|
|
9807
9814
|
}
|
|
9808
9815
|
return null;
|
|
@@ -9815,7 +9822,7 @@ function Validations() {
|
|
|
9815
9822
|
|
|
9816
9823
|
component.email = function(data) {
|
|
9817
9824
|
var pattern = new RegExp(/^[^\s@]+@[^\s@]+\.[^\s@]+$/);
|
|
9818
|
-
return data && pattern.test(data) ? true : false;
|
|
9825
|
+
return data && pattern.test(data) ? true : false;
|
|
9819
9826
|
}
|
|
9820
9827
|
|
|
9821
9828
|
component.required = function(data) {
|
|
@@ -9823,19 +9830,19 @@ function Validations() {
|
|
|
9823
9830
|
}
|
|
9824
9831
|
|
|
9825
9832
|
component.exist = function(data, options) {
|
|
9826
|
-
return !!data.toString();
|
|
9833
|
+
return !!data.toString().trim();
|
|
9827
9834
|
}
|
|
9828
9835
|
|
|
9829
9836
|
component['not exist'] = function(data, options) {
|
|
9830
|
-
return !data.toString();
|
|
9837
|
+
return !data.toString().trim();
|
|
9831
9838
|
}
|
|
9832
9839
|
|
|
9833
9840
|
component.empty = function(data) {
|
|
9834
|
-
return !data.toString();
|
|
9841
|
+
return !data.toString().trim();
|
|
9835
9842
|
}
|
|
9836
9843
|
|
|
9837
9844
|
component.notEmpty = function(data) {
|
|
9838
|
-
return !!data.toString();
|
|
9845
|
+
return !!data.toString().trim();
|
|
9839
9846
|
}
|
|
9840
9847
|
|
|
9841
9848
|
component.number = function(data, options) {
|
|
@@ -9851,7 +9858,7 @@ function Validations() {
|
|
|
9851
9858
|
return false;
|
|
9852
9859
|
}
|
|
9853
9860
|
|
|
9854
|
-
|
|
9861
|
+
let values = options.value.map(function(num) {
|
|
9855
9862
|
return parseFloat(num);
|
|
9856
9863
|
})
|
|
9857
9864
|
|
|
@@ -9859,29 +9866,83 @@ function Validations() {
|
|
|
9859
9866
|
};
|
|
9860
9867
|
|
|
9861
9868
|
component.login = function(data) {
|
|
9862
|
-
|
|
9869
|
+
let pattern = new RegExp(/^[a-zA-Z0-9._-]+$/);
|
|
9863
9870
|
return data && pattern.test(data) ? true : false;
|
|
9864
9871
|
}
|
|
9865
9872
|
|
|
9866
9873
|
component.list = function(data, options) {
|
|
9867
|
-
|
|
9874
|
+
let dataType = typeof data;
|
|
9868
9875
|
if (dataType !== 'string' && dataType !== 'number') {
|
|
9869
9876
|
return false;
|
|
9870
9877
|
}
|
|
9878
|
+
let list;
|
|
9871
9879
|
if (typeof(options.value[0]) === 'string') {
|
|
9872
|
-
|
|
9880
|
+
list = options.value[0].split(',');
|
|
9873
9881
|
} else {
|
|
9874
|
-
|
|
9882
|
+
list = options.value[0];
|
|
9875
9883
|
}
|
|
9876
9884
|
|
|
9877
|
-
|
|
9878
|
-
return
|
|
9879
|
-
}
|
|
9885
|
+
if (! Array.isArray(list)) {
|
|
9886
|
+
return false;
|
|
9887
|
+
} else {
|
|
9888
|
+
let validOption = list.findIndex(function (item) {
|
|
9889
|
+
return item == data;
|
|
9890
|
+
});
|
|
9880
9891
|
|
|
9881
|
-
|
|
9892
|
+
return validOption > -1;
|
|
9893
|
+
}
|
|
9882
9894
|
}
|
|
9883
9895
|
|
|
9896
|
+
const getCurrentDateWithoutTime = function() {
|
|
9897
|
+
let date = new Date();
|
|
9898
|
+
date.setHours(0, 0, 0, 0);
|
|
9899
|
+
return date;
|
|
9900
|
+
}
|
|
9901
|
+
|
|
9902
|
+
const relativeDates = {
|
|
9903
|
+
'one year ago': function() {
|
|
9904
|
+
let date = getCurrentDateWithoutTime();
|
|
9905
|
+
|
|
9906
|
+
date.setFullYear(date.getFullYear() - 1);
|
|
9907
|
+
|
|
9908
|
+
return date;
|
|
9909
|
+
},
|
|
9910
|
+
'one month ago': function() {
|
|
9911
|
+
let date = getCurrentDateWithoutTime();
|
|
9912
|
+
|
|
9913
|
+
date.setMonth(date.getMonth() - 1);
|
|
9914
|
+
|
|
9915
|
+
return date;
|
|
9916
|
+
},
|
|
9917
|
+
'one week ago': function() {
|
|
9918
|
+
let date = getCurrentDateWithoutTime();
|
|
9919
|
+
|
|
9920
|
+
date.setDate(date.getDate() - 7);
|
|
9921
|
+
|
|
9922
|
+
return date;
|
|
9923
|
+
},
|
|
9924
|
+
yesterday: function() {
|
|
9925
|
+
let date = getCurrentDateWithoutTime();
|
|
9926
|
+
|
|
9927
|
+
date.setDate(date.getDate() - 1);
|
|
9928
|
+
|
|
9929
|
+
return date;
|
|
9930
|
+
},
|
|
9931
|
+
today: getCurrentDateWithoutTime,
|
|
9932
|
+
tomorrow: function() {
|
|
9933
|
+
let date = getCurrentDateWithoutTime();
|
|
9934
|
+
|
|
9935
|
+
date.setDate(date.getDate() + 1);
|
|
9936
|
+
|
|
9937
|
+
return date;
|
|
9938
|
+
},
|
|
9939
|
+
};
|
|
9940
|
+
|
|
9884
9941
|
component.date = function(data, options) {
|
|
9942
|
+
if (isNumeric(data) && data > 0 && data < 1000000) {
|
|
9943
|
+
data = helpers_date.numToDate(data);
|
|
9944
|
+
}
|
|
9945
|
+
|
|
9885
9946
|
if (new Date(data) == 'Invalid Date') {
|
|
9886
9947
|
return false;
|
|
9887
9948
|
}
|
|
@@ -9894,7 +9955,11 @@ function Validations() {
|
|
|
9894
9955
|
return false;
|
|
9895
9956
|
}
|
|
9896
9957
|
|
|
9897
|
-
|
|
9958
|
+
let values = options.value.map(function(date) {
|
|
9959
|
+
if (typeof date === 'string' && relativeDates[date]) {
|
|
9960
|
+
return relativeDates[date]().getTime();
|
|
9961
|
+
}
|
|
9962
|
+
|
|
9898
9963
|
return new Date(date).getTime();
|
|
9899
9964
|
});
|
|
9900
9965
|
|
|
@@ -12588,7 +12653,7 @@ var jSuites = {
|
|
|
12588
12653
|
...dictionary,
|
|
12589
12654
|
...helpers,
|
|
12590
12655
|
/** Current version */
|
|
12591
|
-
version: '5.0.
|
|
12656
|
+
version: '5.0.23',
|
|
12592
12657
|
/** Bind new extensions to Jsuites */
|
|
12593
12658
|
setExtensions: function(o) {
|
|
12594
12659
|
if (typeof(o) == 'object') {
|
package/package.json
CHANGED