jsuites 4.10.5 → 4.11.2
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.basic.js +129 -22
- package/dist/jsuites.js +340 -129
- package/package.json +1 -1
package/dist/jsuites.basic.js
CHANGED
|
@@ -1189,6 +1189,7 @@ jSuites.calendar = (function(el, options) {
|
|
|
1189
1189
|
|
|
1190
1190
|
if (element.classList.contains('jcalendar-set-month')) {
|
|
1191
1191
|
obj.date[1] = v;
|
|
1192
|
+
obj.date[2] = 1; // first day of the month
|
|
1192
1193
|
} else {
|
|
1193
1194
|
obj.date[2] = element.innerText;
|
|
1194
1195
|
}
|
|
@@ -4880,6 +4881,7 @@ jSuites.editor = (function(el, options) {
|
|
|
4880
4881
|
onkeyup: null,
|
|
4881
4882
|
onkeydown: null,
|
|
4882
4883
|
onchange: null,
|
|
4884
|
+
userSearch: null,
|
|
4883
4885
|
};
|
|
4884
4886
|
|
|
4885
4887
|
// Loop through our object
|
|
@@ -4958,7 +4960,7 @@ jSuites.editor = (function(el, options) {
|
|
|
4958
4960
|
if (obj.options.value) {
|
|
4959
4961
|
var value = obj.options.value;
|
|
4960
4962
|
} else {
|
|
4961
|
-
var value = el.innerHTML ? el.innerHTML : '';
|
|
4963
|
+
var value = el.innerHTML ? el.innerHTML : '';
|
|
4962
4964
|
}
|
|
4963
4965
|
|
|
4964
4966
|
if (! value) {
|
|
@@ -4969,7 +4971,7 @@ jSuites.editor = (function(el, options) {
|
|
|
4969
4971
|
* Onchange event controllers
|
|
4970
4972
|
*/
|
|
4971
4973
|
var change = function(e) {
|
|
4972
|
-
if (typeof(obj.options.onchange) == 'function') {
|
|
4974
|
+
if (typeof(obj.options.onchange) == 'function') {
|
|
4973
4975
|
obj.options.onchange(el, obj, e);
|
|
4974
4976
|
}
|
|
4975
4977
|
|
|
@@ -4989,6 +4991,25 @@ jSuites.editor = (function(el, options) {
|
|
|
4989
4991
|
}
|
|
4990
4992
|
}
|
|
4991
4993
|
|
|
4994
|
+
// Create node
|
|
4995
|
+
var createUserSearchNode = function() {
|
|
4996
|
+
// Get coordinates from caret
|
|
4997
|
+
var sel = window.getSelection ? window.getSelection() : document.selection;
|
|
4998
|
+
var range = sel.getRangeAt(0);
|
|
4999
|
+
range.deleteContents();
|
|
5000
|
+
// Append text node
|
|
5001
|
+
var input = document.createElement('a');
|
|
5002
|
+
input.innerText = '@';
|
|
5003
|
+
input.searchable = true;
|
|
5004
|
+
range.insertNode(input);
|
|
5005
|
+
var node = range.getBoundingClientRect();
|
|
5006
|
+
range.collapse(false);
|
|
5007
|
+
// Position
|
|
5008
|
+
userSearch.style.position = 'fixed';
|
|
5009
|
+
userSearch.style.top = node.top + node.height + 10 + 'px';
|
|
5010
|
+
userSearch.style.left = node.left + 2 + 'px';
|
|
5011
|
+
}
|
|
5012
|
+
|
|
4992
5013
|
/**
|
|
4993
5014
|
* Extract images from a HTML string
|
|
4994
5015
|
*/
|
|
@@ -5019,10 +5040,10 @@ jSuites.editor = (function(el, options) {
|
|
|
5019
5040
|
range = sel.getRangeAt(0);
|
|
5020
5041
|
var selectedText = range.toString();
|
|
5021
5042
|
range.deleteContents();
|
|
5022
|
-
range.insertNode(newNode);
|
|
5043
|
+
range.insertNode(newNode);
|
|
5023
5044
|
// move the cursor after element
|
|
5024
5045
|
range.setStartAfter(newNode);
|
|
5025
|
-
range.setEndAfter(newNode);
|
|
5046
|
+
range.setEndAfter(newNode);
|
|
5026
5047
|
sel.removeAllRanges();
|
|
5027
5048
|
sel.addRange(range);
|
|
5028
5049
|
}
|
|
@@ -5104,7 +5125,7 @@ jSuites.editor = (function(el, options) {
|
|
|
5104
5125
|
var html = editor.innerHTML.replace(/\n/g, ' ');
|
|
5105
5126
|
var container = document.createElement('div');
|
|
5106
5127
|
container.innerHTML = html;
|
|
5107
|
-
var text = container.innerText;
|
|
5128
|
+
var text = container.innerText;
|
|
5108
5129
|
var url = jSuites.editor.detectUrl(text);
|
|
5109
5130
|
|
|
5110
5131
|
if (url) {
|
|
@@ -5250,8 +5271,31 @@ jSuites.editor = (function(el, options) {
|
|
|
5250
5271
|
}
|
|
5251
5272
|
}
|
|
5252
5273
|
|
|
5274
|
+
// Users
|
|
5275
|
+
if (userSearch) {
|
|
5276
|
+
// Get tag users
|
|
5277
|
+
var tagged = editor.querySelectorAll('a[data-user]');
|
|
5278
|
+
if (tagged.length) {
|
|
5279
|
+
data.users = [];
|
|
5280
|
+
for (var i = 0; i < tagged.length; i++) {
|
|
5281
|
+
var userId = tagged[i].getAttribute('data-user');
|
|
5282
|
+
if (userId) {
|
|
5283
|
+
data.users.push(userId);
|
|
5284
|
+
}
|
|
5285
|
+
}
|
|
5286
|
+
data.users = data.users.join(',');
|
|
5287
|
+
}
|
|
5288
|
+
}
|
|
5289
|
+
|
|
5253
5290
|
// Get content
|
|
5254
|
-
var
|
|
5291
|
+
var d = document.createElement('div');
|
|
5292
|
+
d.innerHTML = editor.innerHTML;
|
|
5293
|
+
var s = d.querySelector('.jsnippet');
|
|
5294
|
+
if (s) {
|
|
5295
|
+
s.remove();
|
|
5296
|
+
}
|
|
5297
|
+
|
|
5298
|
+
var text = d.innerHTML;
|
|
5255
5299
|
text = text.replace(/<br>/g, "\n");
|
|
5256
5300
|
text = text.replace(/<\/div>/g, "<\/div>\n");
|
|
5257
5301
|
text = text.replace(/<(?:.|\n)*?>/gm, "");
|
|
@@ -5410,13 +5454,8 @@ jSuites.editor = (function(el, options) {
|
|
|
5410
5454
|
editor.removeEventListener('dragover', editorDragOver);
|
|
5411
5455
|
editor.removeEventListener('drop', editorDrop);
|
|
5412
5456
|
editor.removeEventListener('paste', editorPaste);
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
editor.removeEventListener('blur', editorBlur);
|
|
5416
|
-
}
|
|
5417
|
-
if (typeof(obj.options.onfocus) == 'function') {
|
|
5418
|
-
editor.removeEventListener('focus', editorFocus);
|
|
5419
|
-
}
|
|
5457
|
+
editor.removeEventListener('blur', editorBlur);
|
|
5458
|
+
editor.removeEventListener('focus', editorFocus);
|
|
5420
5459
|
|
|
5421
5460
|
el.editor = null;
|
|
5422
5461
|
el.classList.remove('jeditor-container');
|
|
@@ -5480,7 +5519,7 @@ jSuites.editor = (function(el, options) {
|
|
|
5480
5519
|
} else {
|
|
5481
5520
|
editorAction = true;
|
|
5482
5521
|
}
|
|
5483
|
-
} else {
|
|
5522
|
+
} else {
|
|
5484
5523
|
if (e.target.classList.contains('jsnippet')) {
|
|
5485
5524
|
close(e.target);
|
|
5486
5525
|
} else if (e.target.parentNode.classList.contains('jsnippet')) {
|
|
@@ -5549,7 +5588,23 @@ jSuites.editor = (function(el, options) {
|
|
|
5549
5588
|
editor.innerHTML = '<div><br></div>';
|
|
5550
5589
|
}
|
|
5551
5590
|
|
|
5552
|
-
if (
|
|
5591
|
+
if (userSearch) {
|
|
5592
|
+
var t = jSuites.getNode();
|
|
5593
|
+
if (t) {
|
|
5594
|
+
if (t.searchable === true) {
|
|
5595
|
+
if (t.innerText && t.innerText.substr(0,1) == '@') {
|
|
5596
|
+
userSearchInstance(t.innerText.substr(1));
|
|
5597
|
+
}
|
|
5598
|
+
} else if (t.searchable === false) {
|
|
5599
|
+
if (t.innerText !== t.getAttribute('data-label')) {
|
|
5600
|
+
t.searchable = true;
|
|
5601
|
+
t.removeAttribute('href');
|
|
5602
|
+
}
|
|
5603
|
+
}
|
|
5604
|
+
}
|
|
5605
|
+
}
|
|
5606
|
+
|
|
5607
|
+
if (typeof(obj.options.onkeyup) == 'function') {
|
|
5553
5608
|
obj.options.onkeyup(el, obj, e);
|
|
5554
5609
|
}
|
|
5555
5610
|
}
|
|
@@ -5561,7 +5616,18 @@ jSuites.editor = (function(el, options) {
|
|
|
5561
5616
|
verifyEditor();
|
|
5562
5617
|
}
|
|
5563
5618
|
|
|
5564
|
-
if (
|
|
5619
|
+
if (userSearch) {
|
|
5620
|
+
if (e.key == '@') {
|
|
5621
|
+
createUserSearchNode(editor);
|
|
5622
|
+
e.preventDefault();
|
|
5623
|
+
} else {
|
|
5624
|
+
if (userSearchInstance.isOpened()) {
|
|
5625
|
+
userSearchInstance.keydown(e);
|
|
5626
|
+
}
|
|
5627
|
+
}
|
|
5628
|
+
}
|
|
5629
|
+
|
|
5630
|
+
if (typeof(obj.options.onkeydown) == 'function') {
|
|
5565
5631
|
obj.options.onkeydown(el, obj, e);
|
|
5566
5632
|
}
|
|
5567
5633
|
|
|
@@ -5653,7 +5719,7 @@ jSuites.editor = (function(el, options) {
|
|
|
5653
5719
|
var span = document.createElement('span');
|
|
5654
5720
|
span.innerHTML = d.firstChild.innerHTML;
|
|
5655
5721
|
return span;
|
|
5656
|
-
}
|
|
5722
|
+
}
|
|
5657
5723
|
|
|
5658
5724
|
var editorPaste = function(e) {
|
|
5659
5725
|
if (obj.options.filterPaste == true) {
|
|
@@ -5747,7 +5813,7 @@ jSuites.editor = (function(el, options) {
|
|
|
5747
5813
|
var html = (e.originalEvent || e).dataTransfer.getData('text/html');
|
|
5748
5814
|
var text = (e.originalEvent || e).dataTransfer.getData('text/plain');
|
|
5749
5815
|
var file = (e.originalEvent || e).dataTransfer.files;
|
|
5750
|
-
|
|
5816
|
+
|
|
5751
5817
|
if (file.length) {
|
|
5752
5818
|
obj.addFile(file);
|
|
5753
5819
|
} else if (text) {
|
|
@@ -5760,6 +5826,10 @@ jSuites.editor = (function(el, options) {
|
|
|
5760
5826
|
}
|
|
5761
5827
|
|
|
5762
5828
|
var editorBlur = function(e) {
|
|
5829
|
+
if (userSearch && userSearchInstance.isOpened()) {
|
|
5830
|
+
userSearchInstance.close();
|
|
5831
|
+
}
|
|
5832
|
+
|
|
5763
5833
|
// Blur
|
|
5764
5834
|
if (typeof(obj.options.onblur) == 'function') {
|
|
5765
5835
|
obj.options.onblur(el, obj, e);
|
|
@@ -5821,6 +5891,33 @@ jSuites.editor = (function(el, options) {
|
|
|
5821
5891
|
});
|
|
5822
5892
|
}
|
|
5823
5893
|
|
|
5894
|
+
// Add user search
|
|
5895
|
+
var userSearch = null;
|
|
5896
|
+
var userSearchInstance = null;
|
|
5897
|
+
if (obj.options.userSearch) {
|
|
5898
|
+
userSearch = document.createElement('div');
|
|
5899
|
+
el.appendChild(userSearch);
|
|
5900
|
+
|
|
5901
|
+
// Component
|
|
5902
|
+
userSearchInstance = jSuites.search(userSearch, {
|
|
5903
|
+
data: obj.options.userSearch,
|
|
5904
|
+
placeholder: jSuites.translate('Type the name a user'),
|
|
5905
|
+
onselect: function(a,b,c,d) {
|
|
5906
|
+
if (userSearchInstance.isOpened()) {
|
|
5907
|
+
var t = jSuites.getNode();
|
|
5908
|
+
if (t && t.searchable == true && (t.innerText.trim() && t.innerText.substr(1))) {
|
|
5909
|
+
t.innerText = '@' + c;
|
|
5910
|
+
t.href = '/' + c;
|
|
5911
|
+
t.setAttribute('data-user', d);
|
|
5912
|
+
t.setAttribute('data-label', t.innerText);
|
|
5913
|
+
t.searchable = false;
|
|
5914
|
+
jSuites.focus(t);
|
|
5915
|
+
}
|
|
5916
|
+
}
|
|
5917
|
+
}
|
|
5918
|
+
});
|
|
5919
|
+
}
|
|
5920
|
+
|
|
5824
5921
|
// Focus to the editor
|
|
5825
5922
|
if (obj.options.focus) {
|
|
5826
5923
|
jSuites.editor.setCursor(editor, obj.options.focus == 'initial' ? true : false);
|
|
@@ -7525,7 +7622,14 @@ jSuites.mask = (function() {
|
|
|
7525
7622
|
}
|
|
7526
7623
|
// New entry
|
|
7527
7624
|
if (parseInt(v) >= 0 && parseInt(v) < 10) {
|
|
7528
|
-
|
|
7625
|
+
// Replace the zero for a number
|
|
7626
|
+
if (this.values[this.index] == '0' && v > 0) {
|
|
7627
|
+
this.values[this.index] = '';
|
|
7628
|
+
} else if (this.values[this.index] == '-0' && v > 0) {
|
|
7629
|
+
this.values[this.index] = '-';
|
|
7630
|
+
}
|
|
7631
|
+
// Don't add up zeros because does not mean anything here
|
|
7632
|
+
if ((this.values[this.index] != '0' && this.values[this.index] != '-0') || v == decimal) {
|
|
7529
7633
|
this.values[this.index] += v;
|
|
7530
7634
|
}
|
|
7531
7635
|
} else if (decimal && v == decimal) {
|
|
@@ -7918,7 +8022,7 @@ jSuites.mask = (function() {
|
|
|
7918
8022
|
o.methods = getMethods.call(o, o.tokens);
|
|
7919
8023
|
// Go through all tokes
|
|
7920
8024
|
while (o.position < o.value.length && typeof(o.tokens[o.index]) !== 'undefined') {
|
|
7921
|
-
// Get the
|
|
8025
|
+
// Get the appropriate parser
|
|
7922
8026
|
parse.call(o);
|
|
7923
8027
|
}
|
|
7924
8028
|
|
|
@@ -8044,8 +8148,11 @@ jSuites.mask = (function() {
|
|
|
8044
8148
|
type = getType.call(options, options.mask);
|
|
8045
8149
|
}
|
|
8046
8150
|
|
|
8151
|
+
if (type === 'general') {
|
|
8152
|
+
var o = obj(v, options, true);
|
|
8047
8153
|
|
|
8048
|
-
|
|
8154
|
+
value = v;
|
|
8155
|
+
} else if (type === 'datetime') {
|
|
8049
8156
|
if (v instanceof Date) {
|
|
8050
8157
|
var t = jSuites.calendar.getDateString(value, options.mask);
|
|
8051
8158
|
}
|
|
@@ -8665,7 +8772,7 @@ jSuites.picker = (function(el, options) {
|
|
|
8665
8772
|
obj.setValue(item.k);
|
|
8666
8773
|
// Call method
|
|
8667
8774
|
if (typeof(obj.options.onchange) == 'function') {
|
|
8668
|
-
obj.options.onchange.call(obj, el, obj, item.v, item.v, item.k);
|
|
8775
|
+
obj.options.onchange.call(obj, el, obj, item.v, item.v, item.k, e);
|
|
8669
8776
|
}
|
|
8670
8777
|
}
|
|
8671
8778
|
}
|
package/dist/jsuites.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
var jSuites = function(options) {
|
|
19
19
|
var obj = {}
|
|
20
|
-
var version = '4.
|
|
20
|
+
var version = '4.11.2';
|
|
21
21
|
|
|
22
22
|
var find = function(DOMElement, component) {
|
|
23
23
|
if (DOMElement[component.type] && DOMElement[component.type] == component) {
|
|
@@ -1200,6 +1200,7 @@ jSuites.calendar = (function(el, options) {
|
|
|
1200
1200
|
|
|
1201
1201
|
if (element.classList.contains('jcalendar-set-month')) {
|
|
1202
1202
|
obj.date[1] = v;
|
|
1203
|
+
obj.date[2] = 1; // first day of the month
|
|
1203
1204
|
} else {
|
|
1204
1205
|
obj.date[2] = element.innerText;
|
|
1205
1206
|
}
|
|
@@ -4891,6 +4892,7 @@ jSuites.editor = (function(el, options) {
|
|
|
4891
4892
|
onkeyup: null,
|
|
4892
4893
|
onkeydown: null,
|
|
4893
4894
|
onchange: null,
|
|
4895
|
+
userSearch: null,
|
|
4894
4896
|
};
|
|
4895
4897
|
|
|
4896
4898
|
// Loop through our object
|
|
@@ -4969,7 +4971,7 @@ jSuites.editor = (function(el, options) {
|
|
|
4969
4971
|
if (obj.options.value) {
|
|
4970
4972
|
var value = obj.options.value;
|
|
4971
4973
|
} else {
|
|
4972
|
-
var value = el.innerHTML ? el.innerHTML : '';
|
|
4974
|
+
var value = el.innerHTML ? el.innerHTML : '';
|
|
4973
4975
|
}
|
|
4974
4976
|
|
|
4975
4977
|
if (! value) {
|
|
@@ -4980,7 +4982,7 @@ jSuites.editor = (function(el, options) {
|
|
|
4980
4982
|
* Onchange event controllers
|
|
4981
4983
|
*/
|
|
4982
4984
|
var change = function(e) {
|
|
4983
|
-
if (typeof(obj.options.onchange) == 'function') {
|
|
4985
|
+
if (typeof(obj.options.onchange) == 'function') {
|
|
4984
4986
|
obj.options.onchange(el, obj, e);
|
|
4985
4987
|
}
|
|
4986
4988
|
|
|
@@ -5000,6 +5002,25 @@ jSuites.editor = (function(el, options) {
|
|
|
5000
5002
|
}
|
|
5001
5003
|
}
|
|
5002
5004
|
|
|
5005
|
+
// Create node
|
|
5006
|
+
var createUserSearchNode = function() {
|
|
5007
|
+
// Get coordinates from caret
|
|
5008
|
+
var sel = window.getSelection ? window.getSelection() : document.selection;
|
|
5009
|
+
var range = sel.getRangeAt(0);
|
|
5010
|
+
range.deleteContents();
|
|
5011
|
+
// Append text node
|
|
5012
|
+
var input = document.createElement('a');
|
|
5013
|
+
input.innerText = '@';
|
|
5014
|
+
input.searchable = true;
|
|
5015
|
+
range.insertNode(input);
|
|
5016
|
+
var node = range.getBoundingClientRect();
|
|
5017
|
+
range.collapse(false);
|
|
5018
|
+
// Position
|
|
5019
|
+
userSearch.style.position = 'fixed';
|
|
5020
|
+
userSearch.style.top = node.top + node.height + 10 + 'px';
|
|
5021
|
+
userSearch.style.left = node.left + 2 + 'px';
|
|
5022
|
+
}
|
|
5023
|
+
|
|
5003
5024
|
/**
|
|
5004
5025
|
* Extract images from a HTML string
|
|
5005
5026
|
*/
|
|
@@ -5030,10 +5051,10 @@ jSuites.editor = (function(el, options) {
|
|
|
5030
5051
|
range = sel.getRangeAt(0);
|
|
5031
5052
|
var selectedText = range.toString();
|
|
5032
5053
|
range.deleteContents();
|
|
5033
|
-
range.insertNode(newNode);
|
|
5054
|
+
range.insertNode(newNode);
|
|
5034
5055
|
// move the cursor after element
|
|
5035
5056
|
range.setStartAfter(newNode);
|
|
5036
|
-
range.setEndAfter(newNode);
|
|
5057
|
+
range.setEndAfter(newNode);
|
|
5037
5058
|
sel.removeAllRanges();
|
|
5038
5059
|
sel.addRange(range);
|
|
5039
5060
|
}
|
|
@@ -5115,7 +5136,7 @@ jSuites.editor = (function(el, options) {
|
|
|
5115
5136
|
var html = editor.innerHTML.replace(/\n/g, ' ');
|
|
5116
5137
|
var container = document.createElement('div');
|
|
5117
5138
|
container.innerHTML = html;
|
|
5118
|
-
var text = container.innerText;
|
|
5139
|
+
var text = container.innerText;
|
|
5119
5140
|
var url = jSuites.editor.detectUrl(text);
|
|
5120
5141
|
|
|
5121
5142
|
if (url) {
|
|
@@ -5261,8 +5282,31 @@ jSuites.editor = (function(el, options) {
|
|
|
5261
5282
|
}
|
|
5262
5283
|
}
|
|
5263
5284
|
|
|
5285
|
+
// Users
|
|
5286
|
+
if (userSearch) {
|
|
5287
|
+
// Get tag users
|
|
5288
|
+
var tagged = editor.querySelectorAll('a[data-user]');
|
|
5289
|
+
if (tagged.length) {
|
|
5290
|
+
data.users = [];
|
|
5291
|
+
for (var i = 0; i < tagged.length; i++) {
|
|
5292
|
+
var userId = tagged[i].getAttribute('data-user');
|
|
5293
|
+
if (userId) {
|
|
5294
|
+
data.users.push(userId);
|
|
5295
|
+
}
|
|
5296
|
+
}
|
|
5297
|
+
data.users = data.users.join(',');
|
|
5298
|
+
}
|
|
5299
|
+
}
|
|
5300
|
+
|
|
5264
5301
|
// Get content
|
|
5265
|
-
var
|
|
5302
|
+
var d = document.createElement('div');
|
|
5303
|
+
d.innerHTML = editor.innerHTML;
|
|
5304
|
+
var s = d.querySelector('.jsnippet');
|
|
5305
|
+
if (s) {
|
|
5306
|
+
s.remove();
|
|
5307
|
+
}
|
|
5308
|
+
|
|
5309
|
+
var text = d.innerHTML;
|
|
5266
5310
|
text = text.replace(/<br>/g, "\n");
|
|
5267
5311
|
text = text.replace(/<\/div>/g, "<\/div>\n");
|
|
5268
5312
|
text = text.replace(/<(?:.|\n)*?>/gm, "");
|
|
@@ -5421,13 +5465,8 @@ jSuites.editor = (function(el, options) {
|
|
|
5421
5465
|
editor.removeEventListener('dragover', editorDragOver);
|
|
5422
5466
|
editor.removeEventListener('drop', editorDrop);
|
|
5423
5467
|
editor.removeEventListener('paste', editorPaste);
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
editor.removeEventListener('blur', editorBlur);
|
|
5427
|
-
}
|
|
5428
|
-
if (typeof(obj.options.onfocus) == 'function') {
|
|
5429
|
-
editor.removeEventListener('focus', editorFocus);
|
|
5430
|
-
}
|
|
5468
|
+
editor.removeEventListener('blur', editorBlur);
|
|
5469
|
+
editor.removeEventListener('focus', editorFocus);
|
|
5431
5470
|
|
|
5432
5471
|
el.editor = null;
|
|
5433
5472
|
el.classList.remove('jeditor-container');
|
|
@@ -5491,7 +5530,7 @@ jSuites.editor = (function(el, options) {
|
|
|
5491
5530
|
} else {
|
|
5492
5531
|
editorAction = true;
|
|
5493
5532
|
}
|
|
5494
|
-
} else {
|
|
5533
|
+
} else {
|
|
5495
5534
|
if (e.target.classList.contains('jsnippet')) {
|
|
5496
5535
|
close(e.target);
|
|
5497
5536
|
} else if (e.target.parentNode.classList.contains('jsnippet')) {
|
|
@@ -5560,7 +5599,23 @@ jSuites.editor = (function(el, options) {
|
|
|
5560
5599
|
editor.innerHTML = '<div><br></div>';
|
|
5561
5600
|
}
|
|
5562
5601
|
|
|
5563
|
-
if (
|
|
5602
|
+
if (userSearch) {
|
|
5603
|
+
var t = jSuites.getNode();
|
|
5604
|
+
if (t) {
|
|
5605
|
+
if (t.searchable === true) {
|
|
5606
|
+
if (t.innerText && t.innerText.substr(0,1) == '@') {
|
|
5607
|
+
userSearchInstance(t.innerText.substr(1));
|
|
5608
|
+
}
|
|
5609
|
+
} else if (t.searchable === false) {
|
|
5610
|
+
if (t.innerText !== t.getAttribute('data-label')) {
|
|
5611
|
+
t.searchable = true;
|
|
5612
|
+
t.removeAttribute('href');
|
|
5613
|
+
}
|
|
5614
|
+
}
|
|
5615
|
+
}
|
|
5616
|
+
}
|
|
5617
|
+
|
|
5618
|
+
if (typeof(obj.options.onkeyup) == 'function') {
|
|
5564
5619
|
obj.options.onkeyup(el, obj, e);
|
|
5565
5620
|
}
|
|
5566
5621
|
}
|
|
@@ -5572,7 +5627,18 @@ jSuites.editor = (function(el, options) {
|
|
|
5572
5627
|
verifyEditor();
|
|
5573
5628
|
}
|
|
5574
5629
|
|
|
5575
|
-
if (
|
|
5630
|
+
if (userSearch) {
|
|
5631
|
+
if (e.key == '@') {
|
|
5632
|
+
createUserSearchNode(editor);
|
|
5633
|
+
e.preventDefault();
|
|
5634
|
+
} else {
|
|
5635
|
+
if (userSearchInstance.isOpened()) {
|
|
5636
|
+
userSearchInstance.keydown(e);
|
|
5637
|
+
}
|
|
5638
|
+
}
|
|
5639
|
+
}
|
|
5640
|
+
|
|
5641
|
+
if (typeof(obj.options.onkeydown) == 'function') {
|
|
5576
5642
|
obj.options.onkeydown(el, obj, e);
|
|
5577
5643
|
}
|
|
5578
5644
|
|
|
@@ -5664,7 +5730,7 @@ jSuites.editor = (function(el, options) {
|
|
|
5664
5730
|
var span = document.createElement('span');
|
|
5665
5731
|
span.innerHTML = d.firstChild.innerHTML;
|
|
5666
5732
|
return span;
|
|
5667
|
-
}
|
|
5733
|
+
}
|
|
5668
5734
|
|
|
5669
5735
|
var editorPaste = function(e) {
|
|
5670
5736
|
if (obj.options.filterPaste == true) {
|
|
@@ -5758,7 +5824,7 @@ jSuites.editor = (function(el, options) {
|
|
|
5758
5824
|
var html = (e.originalEvent || e).dataTransfer.getData('text/html');
|
|
5759
5825
|
var text = (e.originalEvent || e).dataTransfer.getData('text/plain');
|
|
5760
5826
|
var file = (e.originalEvent || e).dataTransfer.files;
|
|
5761
|
-
|
|
5827
|
+
|
|
5762
5828
|
if (file.length) {
|
|
5763
5829
|
obj.addFile(file);
|
|
5764
5830
|
} else if (text) {
|
|
@@ -5771,6 +5837,10 @@ jSuites.editor = (function(el, options) {
|
|
|
5771
5837
|
}
|
|
5772
5838
|
|
|
5773
5839
|
var editorBlur = function(e) {
|
|
5840
|
+
if (userSearch && userSearchInstance.isOpened()) {
|
|
5841
|
+
userSearchInstance.close();
|
|
5842
|
+
}
|
|
5843
|
+
|
|
5774
5844
|
// Blur
|
|
5775
5845
|
if (typeof(obj.options.onblur) == 'function') {
|
|
5776
5846
|
obj.options.onblur(el, obj, e);
|
|
@@ -5832,6 +5902,33 @@ jSuites.editor = (function(el, options) {
|
|
|
5832
5902
|
});
|
|
5833
5903
|
}
|
|
5834
5904
|
|
|
5905
|
+
// Add user search
|
|
5906
|
+
var userSearch = null;
|
|
5907
|
+
var userSearchInstance = null;
|
|
5908
|
+
if (obj.options.userSearch) {
|
|
5909
|
+
userSearch = document.createElement('div');
|
|
5910
|
+
el.appendChild(userSearch);
|
|
5911
|
+
|
|
5912
|
+
// Component
|
|
5913
|
+
userSearchInstance = jSuites.search(userSearch, {
|
|
5914
|
+
data: obj.options.userSearch,
|
|
5915
|
+
placeholder: jSuites.translate('Type the name a user'),
|
|
5916
|
+
onselect: function(a,b,c,d) {
|
|
5917
|
+
if (userSearchInstance.isOpened()) {
|
|
5918
|
+
var t = jSuites.getNode();
|
|
5919
|
+
if (t && t.searchable == true && (t.innerText.trim() && t.innerText.substr(1))) {
|
|
5920
|
+
t.innerText = '@' + c;
|
|
5921
|
+
t.href = '/' + c;
|
|
5922
|
+
t.setAttribute('data-user', d);
|
|
5923
|
+
t.setAttribute('data-label', t.innerText);
|
|
5924
|
+
t.searchable = false;
|
|
5925
|
+
jSuites.focus(t);
|
|
5926
|
+
}
|
|
5927
|
+
}
|
|
5928
|
+
}
|
|
5929
|
+
});
|
|
5930
|
+
}
|
|
5931
|
+
|
|
5835
5932
|
// Focus to the editor
|
|
5836
5933
|
if (obj.options.focus) {
|
|
5837
5934
|
jSuites.editor.setCursor(editor, obj.options.focus == 'initial' ? true : false);
|
|
@@ -7950,7 +8047,14 @@ jSuites.mask = (function() {
|
|
|
7950
8047
|
}
|
|
7951
8048
|
// New entry
|
|
7952
8049
|
if (parseInt(v) >= 0 && parseInt(v) < 10) {
|
|
7953
|
-
|
|
8050
|
+
// Replace the zero for a number
|
|
8051
|
+
if (this.values[this.index] == '0' && v > 0) {
|
|
8052
|
+
this.values[this.index] = '';
|
|
8053
|
+
} else if (this.values[this.index] == '-0' && v > 0) {
|
|
8054
|
+
this.values[this.index] = '-';
|
|
8055
|
+
}
|
|
8056
|
+
// Don't add up zeros because does not mean anything here
|
|
8057
|
+
if ((this.values[this.index] != '0' && this.values[this.index] != '-0') || v == decimal) {
|
|
7954
8058
|
this.values[this.index] += v;
|
|
7955
8059
|
}
|
|
7956
8060
|
} else if (decimal && v == decimal) {
|
|
@@ -8343,7 +8447,7 @@ jSuites.mask = (function() {
|
|
|
8343
8447
|
o.methods = getMethods.call(o, o.tokens);
|
|
8344
8448
|
// Go through all tokes
|
|
8345
8449
|
while (o.position < o.value.length && typeof(o.tokens[o.index]) !== 'undefined') {
|
|
8346
|
-
// Get the
|
|
8450
|
+
// Get the appropriate parser
|
|
8347
8451
|
parse.call(o);
|
|
8348
8452
|
}
|
|
8349
8453
|
|
|
@@ -8469,8 +8573,11 @@ jSuites.mask = (function() {
|
|
|
8469
8573
|
type = getType.call(options, options.mask);
|
|
8470
8574
|
}
|
|
8471
8575
|
|
|
8576
|
+
if (type === 'general') {
|
|
8577
|
+
var o = obj(v, options, true);
|
|
8472
8578
|
|
|
8473
|
-
|
|
8579
|
+
value = v;
|
|
8580
|
+
} else if (type === 'datetime') {
|
|
8474
8581
|
if (v instanceof Date) {
|
|
8475
8582
|
var t = jSuites.calendar.getDateString(value, options.mask);
|
|
8476
8583
|
}
|
|
@@ -8773,6 +8880,24 @@ jSuites.modal = (function(el, options) {
|
|
|
8773
8880
|
});
|
|
8774
8881
|
|
|
8775
8882
|
document.addEventListener('mouseup', function(e) {
|
|
8883
|
+
var item = jSuites.findElement(e.target, 'jmodal');
|
|
8884
|
+
if (item) {
|
|
8885
|
+
// Get target info
|
|
8886
|
+
var rect = item.getBoundingClientRect();
|
|
8887
|
+
|
|
8888
|
+
if (e.changedTouches && e.changedTouches[0]) {
|
|
8889
|
+
var x = e.changedTouches[0].clientX;
|
|
8890
|
+
var y = e.changedTouches[0].clientY;
|
|
8891
|
+
} else {
|
|
8892
|
+
var x = e.clientX;
|
|
8893
|
+
var y = e.clientY;
|
|
8894
|
+
}
|
|
8895
|
+
|
|
8896
|
+
if (rect.width - (x - rect.left) < 50 && (y - rect.top) < 50) {
|
|
8897
|
+
item.parentNode.modal.close();
|
|
8898
|
+
}
|
|
8899
|
+
}
|
|
8900
|
+
|
|
8776
8901
|
if (tracker) {
|
|
8777
8902
|
tracker.element.style.cursor = 'auto';
|
|
8778
8903
|
tracker = null;
|
|
@@ -8794,7 +8919,7 @@ jSuites.modal = (function(el, options) {
|
|
|
8794
8919
|
}
|
|
8795
8920
|
|
|
8796
8921
|
if (rect.width - (x - rect.left) < 50 && (y - rect.top) < 50) {
|
|
8797
|
-
|
|
8922
|
+
// Do nothing
|
|
8798
8923
|
} else {
|
|
8799
8924
|
if (e.target.getAttribute('title') && (y - rect.top) < 50) {
|
|
8800
8925
|
if (document.selection) {
|
|
@@ -9319,7 +9444,7 @@ jSuites.picker = (function(el, options) {
|
|
|
9319
9444
|
obj.setValue(item.k);
|
|
9320
9445
|
// Call method
|
|
9321
9446
|
if (typeof(obj.options.onchange) == 'function') {
|
|
9322
|
-
obj.options.onchange.call(obj, el, obj, item.v, item.v, item.k);
|
|
9447
|
+
obj.options.onchange.call(obj, el, obj, item.v, item.v, item.k, e);
|
|
9323
9448
|
}
|
|
9324
9449
|
}
|
|
9325
9450
|
}
|
|
@@ -9764,8 +9889,10 @@ jSuites.search = (function(el, options) {
|
|
|
9764
9889
|
obj.options = {
|
|
9765
9890
|
data: options.data || null,
|
|
9766
9891
|
input: options.input || null,
|
|
9892
|
+
searchByNode: options.searchByNode || null,
|
|
9767
9893
|
onselect: options.onselect || null,
|
|
9768
9894
|
forceSelect: options.forceSelect,
|
|
9895
|
+
onbeforesearch: options.onbeforesearch || null,
|
|
9769
9896
|
};
|
|
9770
9897
|
|
|
9771
9898
|
obj.selectIndex = function(item) {
|
|
@@ -9839,15 +9966,33 @@ jSuites.search = (function(el, options) {
|
|
|
9839
9966
|
}
|
|
9840
9967
|
|
|
9841
9968
|
obj.keyup = function(e) {
|
|
9842
|
-
if (obj.options.
|
|
9843
|
-
|
|
9969
|
+
if (! obj.options.searchByNode) {
|
|
9970
|
+
if (obj.options.input.tagName === 'DIV') {
|
|
9971
|
+
var terms = obj.options.input.innerText;
|
|
9972
|
+
} else {
|
|
9973
|
+
var terms = obj.options.input.value;
|
|
9974
|
+
}
|
|
9844
9975
|
} else {
|
|
9845
9976
|
// Current node
|
|
9846
9977
|
var node = jSuites.getNode();
|
|
9847
9978
|
if (node) {
|
|
9848
|
-
|
|
9979
|
+
var terms = node.innerText;
|
|
9849
9980
|
}
|
|
9850
9981
|
}
|
|
9982
|
+
|
|
9983
|
+
if (typeof(obj.options.onbeforesearch) == 'function') {
|
|
9984
|
+
var ret = obj.options.onbeforesearch(obj, terms);
|
|
9985
|
+
if (ret) {
|
|
9986
|
+
terms = ret;
|
|
9987
|
+
} else {
|
|
9988
|
+
if (ret === false) {
|
|
9989
|
+
// Ignore event
|
|
9990
|
+
return;
|
|
9991
|
+
}
|
|
9992
|
+
}
|
|
9993
|
+
}
|
|
9994
|
+
|
|
9995
|
+
obj(terms);
|
|
9851
9996
|
}
|
|
9852
9997
|
|
|
9853
9998
|
// Add events
|
|
@@ -11705,136 +11850,202 @@ jSuites.toolbar = (function(el, options) {
|
|
|
11705
11850
|
return obj;
|
|
11706
11851
|
});
|
|
11707
11852
|
|
|
11708
|
-
jSuites.validations = function(
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
|
|
11712
|
-
|
|
11713
|
-
|
|
11853
|
+
jSuites.validations = (function() {
|
|
11854
|
+
/**
|
|
11855
|
+
* Options: Object,
|
|
11856
|
+
* Properties:
|
|
11857
|
+
* Constraint,
|
|
11858
|
+
* Reference,
|
|
11859
|
+
* Value
|
|
11860
|
+
*/
|
|
11714
11861
|
|
|
11715
|
-
|
|
11716
|
-
|
|
11717
|
-
|
|
11718
|
-
return data && pattern.test(data) ? true : false;
|
|
11719
|
-
}
|
|
11862
|
+
var isNumeric = function(num) {
|
|
11863
|
+
return !isNaN(num) && num !== null && num !== '';
|
|
11864
|
+
}
|
|
11720
11865
|
|
|
11721
|
-
|
|
11722
|
-
|
|
11723
|
-
|
|
11866
|
+
var numberCriterias = {
|
|
11867
|
+
'between': function(value, range) {
|
|
11868
|
+
return value >= range[0] && value <= range[1];
|
|
11869
|
+
},
|
|
11870
|
+
'not between': function(value, range) {
|
|
11871
|
+
return value < range[0] || value > range[1];
|
|
11872
|
+
},
|
|
11873
|
+
'<': function(value, range) {
|
|
11874
|
+
return value < range[0];
|
|
11875
|
+
},
|
|
11876
|
+
'<=': function(value, range) {
|
|
11877
|
+
return value <= range[0];
|
|
11878
|
+
},
|
|
11879
|
+
'>': function(value, range) {
|
|
11880
|
+
return value > range[0];
|
|
11881
|
+
},
|
|
11882
|
+
'>=': function(value, range) {
|
|
11883
|
+
return value >= range[0];
|
|
11884
|
+
},
|
|
11885
|
+
'=': function(value, range) {
|
|
11886
|
+
return value === range[0];
|
|
11887
|
+
},
|
|
11888
|
+
'!=': function(value, range) {
|
|
11889
|
+
return value !== range[0];
|
|
11890
|
+
},
|
|
11891
|
+
}
|
|
11724
11892
|
|
|
11725
|
-
|
|
11726
|
-
|
|
11727
|
-
|
|
11893
|
+
var dateCriterias = {
|
|
11894
|
+
'valid date': function() {
|
|
11895
|
+
return true;
|
|
11896
|
+
},
|
|
11897
|
+
'=': function(value, range) {
|
|
11898
|
+
return value === range[0];
|
|
11899
|
+
},
|
|
11900
|
+
'<': function(value, range) {
|
|
11901
|
+
return value < range[0];
|
|
11902
|
+
},
|
|
11903
|
+
'<=': function(value, range) {
|
|
11904
|
+
return value <= range[0];
|
|
11905
|
+
},
|
|
11906
|
+
'>': function(value, range) {
|
|
11907
|
+
return value > range[0];
|
|
11908
|
+
},
|
|
11909
|
+
'>=': function(value, range) {
|
|
11910
|
+
return value >= range[0];
|
|
11911
|
+
},
|
|
11912
|
+
'between': function(value, range) {
|
|
11913
|
+
return value >= range[0] && value <= range[1];
|
|
11914
|
+
},
|
|
11915
|
+
'not between': function(value, range) {
|
|
11916
|
+
return value < range[0] || value > range[1];
|
|
11917
|
+
},
|
|
11918
|
+
}
|
|
11728
11919
|
|
|
11729
|
-
|
|
11730
|
-
|
|
11731
|
-
|
|
11732
|
-
}
|
|
11920
|
+
var textCriterias = {
|
|
11921
|
+
'contains': function(value, range) {
|
|
11922
|
+
return value.includes(range[0]);
|
|
11923
|
+
},
|
|
11924
|
+
'not contains': function(value, range) {
|
|
11925
|
+
return !value.includes(range[0]);
|
|
11926
|
+
},
|
|
11927
|
+
'=': function(value, range) {
|
|
11928
|
+
return value === range[0];
|
|
11929
|
+
},
|
|
11930
|
+
'valid email': function(value) {
|
|
11931
|
+
var pattern = new RegExp(/^[^\s@]+@[^\s@]+\.[^\s@]+$/);
|
|
11733
11932
|
|
|
11734
|
-
|
|
11735
|
-
|
|
11736
|
-
|
|
11737
|
-
*
|
|
11738
|
-
* Reference,
|
|
11739
|
-
* Value
|
|
11740
|
-
*/
|
|
11933
|
+
return pattern.test(value);
|
|
11934
|
+
},
|
|
11935
|
+
'valid url': function(value) {
|
|
11936
|
+
var pattern = new RegExp(/(((https?:\/\/)|(www\.))[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]+)/ig);
|
|
11741
11937
|
|
|
11742
|
-
|
|
11743
|
-
|
|
11744
|
-
return data === options.reference;
|
|
11745
|
-
}
|
|
11746
|
-
if (options.constraint === '<') {
|
|
11747
|
-
return data < options.reference;
|
|
11748
|
-
}
|
|
11749
|
-
if (options.constraint === '<=') {
|
|
11750
|
-
return data <= options.reference;
|
|
11938
|
+
return pattern.test(value);
|
|
11939
|
+
},
|
|
11751
11940
|
}
|
|
11752
|
-
|
|
11753
|
-
|
|
11941
|
+
|
|
11942
|
+
// Component router
|
|
11943
|
+
var component = function(value, options) {
|
|
11944
|
+
if (typeof(component[options.type]) === 'function') {
|
|
11945
|
+
if (options.allowBlank && value === '') {
|
|
11946
|
+
return true;
|
|
11947
|
+
}
|
|
11948
|
+
|
|
11949
|
+
return component[options.type](value, options);
|
|
11950
|
+
}
|
|
11951
|
+
return null;
|
|
11754
11952
|
}
|
|
11755
|
-
|
|
11756
|
-
|
|
11953
|
+
|
|
11954
|
+
component.url = function() {
|
|
11955
|
+
var pattern = new RegExp(/(((https?:\/\/)|(www\.))[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]+)/ig);
|
|
11956
|
+
return pattern.test(data) ? true : false;
|
|
11757
11957
|
}
|
|
11758
|
-
|
|
11759
|
-
|
|
11958
|
+
|
|
11959
|
+
component.email = function(data) {
|
|
11960
|
+
var pattern = new RegExp(/^[^\s@]+@[^\s@]+\.[^\s@]+$/);
|
|
11961
|
+
return data && pattern.test(data) ? true : false;
|
|
11760
11962
|
}
|
|
11761
|
-
|
|
11762
|
-
|
|
11963
|
+
|
|
11964
|
+
component.required = function(data) {
|
|
11965
|
+
return data.trim() ? true : false;
|
|
11763
11966
|
}
|
|
11967
|
+
|
|
11968
|
+
component.number = function(data, options) {
|
|
11969
|
+
if (! isNumeric(data)) {
|
|
11970
|
+
return false;
|
|
11971
|
+
}
|
|
11764
11972
|
|
|
11765
|
-
|
|
11766
|
-
|
|
11973
|
+
if (!options || !options.criteria) {
|
|
11974
|
+
return true;
|
|
11975
|
+
}
|
|
11767
11976
|
|
|
11768
|
-
|
|
11769
|
-
|
|
11770
|
-
|
|
11771
|
-
|
|
11977
|
+
if (!numberCriterias[options.criteria]) {
|
|
11978
|
+
return false;
|
|
11979
|
+
}
|
|
11980
|
+
|
|
11981
|
+
return numberCriterias[options.criteria](
|
|
11982
|
+
data,
|
|
11983
|
+
options.value.map(function(num) {
|
|
11984
|
+
return parseFloat(num);
|
|
11985
|
+
}),
|
|
11986
|
+
);
|
|
11987
|
+
};
|
|
11772
11988
|
|
|
11773
|
-
|
|
11774
|
-
|
|
11989
|
+
component.login = function(data) {
|
|
11990
|
+
var pattern = new RegExp(/^[a-zA-Z0-9\_\-\.\s+]+$/);
|
|
11991
|
+
return data && pattern.test(data) ? true : false;
|
|
11775
11992
|
}
|
|
11776
11993
|
|
|
11777
|
-
|
|
11778
|
-
|
|
11994
|
+
component.list = function(data, options) {
|
|
11995
|
+
var dataType = typeof data;
|
|
11996
|
+
if (dataType !== 'string' && dataType !== 'number') {
|
|
11997
|
+
return false;
|
|
11998
|
+
}
|
|
11779
11999
|
|
|
11780
|
-
|
|
11781
|
-
|
|
11782
|
-
|
|
12000
|
+
var validOption = options.value[0].split(',').findIndex(function name(item) {
|
|
12001
|
+
return item == data;
|
|
12002
|
+
});
|
|
12003
|
+
|
|
12004
|
+
return validOption > -1;
|
|
11783
12005
|
}
|
|
11784
12006
|
|
|
11785
|
-
|
|
11786
|
-
|
|
11787
|
-
|
|
11788
|
-
|
|
12007
|
+
component.date = function(data, options) {
|
|
12008
|
+
if (new Date(data) == 'Invalid Date') {
|
|
12009
|
+
return false;
|
|
12010
|
+
}
|
|
11789
12011
|
|
|
11790
|
-
if (
|
|
11791
|
-
|
|
11792
|
-
|
|
11793
|
-
|
|
11794
|
-
|
|
11795
|
-
|
|
12012
|
+
if (!options || !options.criteria) {
|
|
12013
|
+
return true;
|
|
12014
|
+
}
|
|
12015
|
+
|
|
12016
|
+
if (!dateCriterias[options.criteria]) {
|
|
12017
|
+
return false;
|
|
11796
12018
|
}
|
|
11797
12019
|
|
|
11798
|
-
return
|
|
12020
|
+
return dateCriterias[options.criteria](
|
|
12021
|
+
new Date(data).getTime(),
|
|
12022
|
+
options.value.map(function(date) {
|
|
12023
|
+
return new Date(date).getTime();
|
|
12024
|
+
}),
|
|
12025
|
+
);
|
|
11799
12026
|
}
|
|
11800
|
-
return null;
|
|
11801
|
-
}
|
|
11802
12027
|
|
|
11803
|
-
|
|
11804
|
-
|
|
11805
|
-
|
|
11806
|
-
|
|
11807
|
-
}
|
|
12028
|
+
component.text = function(data, options) {
|
|
12029
|
+
if (typeof data !== 'string') {
|
|
12030
|
+
return false;
|
|
12031
|
+
}
|
|
11808
12032
|
|
|
11809
|
-
|
|
11810
|
-
|
|
11811
|
-
|
|
11812
|
-
}
|
|
12033
|
+
if (!options || !options.criteria) {
|
|
12034
|
+
return true;
|
|
12035
|
+
}
|
|
11813
12036
|
|
|
11814
|
-
|
|
11815
|
-
|
|
11816
|
-
|
|
11817
|
-
|
|
11818
|
-
return
|
|
11819
|
-
|
|
11820
|
-
|
|
11821
|
-
|
|
11822
|
-
}
|
|
11823
|
-
if (options.constraint === 'not contain') {
|
|
11824
|
-
return !data.includes(options.reference);
|
|
11825
|
-
}
|
|
11826
|
-
if (options.constraint === 'email') {
|
|
11827
|
-
return jSuites.validations.email(data);
|
|
11828
|
-
}
|
|
11829
|
-
if (options.constraint === 'url') {
|
|
11830
|
-
var pattern = new RegExp(/(((https?:\/\/)|(www\.))[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]+)/ig);
|
|
11831
|
-
return pattern.test(data) ? true : false;
|
|
12037
|
+
if (!textCriterias[options.criteria]) {
|
|
12038
|
+
return false;
|
|
12039
|
+
}
|
|
12040
|
+
|
|
12041
|
+
return textCriterias[options.criteria](
|
|
12042
|
+
data,
|
|
12043
|
+
options.value,
|
|
12044
|
+
);
|
|
11832
12045
|
}
|
|
11833
|
-
return null;
|
|
11834
|
-
}
|
|
11835
12046
|
|
|
11836
|
-
|
|
11837
|
-
}
|
|
12047
|
+
return component;
|
|
12048
|
+
})();
|
|
11838
12049
|
|
|
11839
12050
|
|
|
11840
12051
|
|
package/package.json
CHANGED