jsuites 5.8.5 → 5.9.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/jsuites.js +360 -321
- package/package.json +1 -1
package/dist/jsuites.js
CHANGED
|
@@ -4483,6 +4483,7 @@ function Palette() {
|
|
|
4483
4483
|
|
|
4484
4484
|
|
|
4485
4485
|
|
|
4486
|
+
|
|
4486
4487
|
function Tabs(el, options) {
|
|
4487
4488
|
var obj = {};
|
|
4488
4489
|
obj.options = {};
|
|
@@ -4595,12 +4596,15 @@ function Tabs(el, options) {
|
|
|
4595
4596
|
}
|
|
4596
4597
|
// Remote selected
|
|
4597
4598
|
obj.headers.children[i].classList.remove('jtabs-selected');
|
|
4599
|
+
obj.headers.children[i].removeAttribute('aria-selected')
|
|
4598
4600
|
if (obj.content.children[i]) {
|
|
4599
4601
|
obj.content.children[i].classList.remove('jtabs-selected');
|
|
4600
4602
|
}
|
|
4601
4603
|
}
|
|
4602
4604
|
|
|
4603
4605
|
obj.headers.children[index].classList.add('jtabs-selected');
|
|
4606
|
+
obj.headers.children[index].setAttribute('aria-selected', 'true')
|
|
4607
|
+
|
|
4604
4608
|
if (obj.content.children[index]) {
|
|
4605
4609
|
obj.content.children[index].classList.add('jtabs-selected');
|
|
4606
4610
|
}
|
|
@@ -4719,11 +4723,20 @@ function Tabs(el, options) {
|
|
|
4719
4723
|
}
|
|
4720
4724
|
|
|
4721
4725
|
if (title) {
|
|
4726
|
+
let headerId = helpers.guid();
|
|
4727
|
+
let contentId = helpers.guid();
|
|
4722
4728
|
// Add content
|
|
4723
4729
|
var div = document.createElement('div');
|
|
4730
|
+
div.setAttribute('id', contentId);
|
|
4731
|
+
div.setAttribute('role', 'tabpanel');
|
|
4732
|
+
div.setAttribute('aria-labelledby', headerId);
|
|
4724
4733
|
|
|
4725
4734
|
// Add headers
|
|
4726
4735
|
var h = document.createElement('div');
|
|
4736
|
+
h.setAttribute('id', headerId);
|
|
4737
|
+
h.setAttribute('role', 'tab');
|
|
4738
|
+
h.setAttribute('aria-controls', contentId);
|
|
4739
|
+
|
|
4727
4740
|
h.innerHTML = title;
|
|
4728
4741
|
h.content = div;
|
|
4729
4742
|
|
|
@@ -4832,7 +4845,10 @@ function Tabs(el, options) {
|
|
|
4832
4845
|
obj.headers = document.createElement('div');
|
|
4833
4846
|
obj.content = document.createElement('div');
|
|
4834
4847
|
obj.headers.classList.add('jtabs-headers');
|
|
4848
|
+
obj.headers.setAttribute('role', 'tablist');
|
|
4835
4849
|
obj.content.classList.add('jtabs-content');
|
|
4850
|
+
obj.content.setAttribute('role', 'region');
|
|
4851
|
+
obj.content.setAttribute('aria-label', 'Tab Panels');
|
|
4836
4852
|
|
|
4837
4853
|
if (obj.options.palette) {
|
|
4838
4854
|
el.classList.add('jtabs-modern');
|
|
@@ -5500,6 +5516,11 @@ function Color(el, options) {
|
|
|
5500
5516
|
input.max = 255;
|
|
5501
5517
|
input.value = 0;
|
|
5502
5518
|
|
|
5519
|
+
input.setAttribute('aria-label', "Color value");
|
|
5520
|
+
input.setAttribute('aria-valuemin', "0");
|
|
5521
|
+
input.setAttribute('aria-valuemax', "255");
|
|
5522
|
+
input.setAttribute('aria-valuenow', "0");
|
|
5523
|
+
|
|
5503
5524
|
inputContainer.appendChild(label);
|
|
5504
5525
|
subContainer.appendChild(input);
|
|
5505
5526
|
|
|
@@ -7788,325 +7809,334 @@ function Dropdown() {
|
|
|
7788
7809
|
|
|
7789
7810
|
/* harmony default export */ var dropdown = (Dropdown());
|
|
7790
7811
|
;// CONCATENATED MODULE: ./src/plugins/picker.js
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
function Picker(el, options) {
|
|
7795
|
-
// Already created, update options
|
|
7796
|
-
if (el.picker) {
|
|
7797
|
-
return el.picker.setOptions(options, true);
|
|
7798
|
-
}
|
|
7799
|
-
|
|
7800
|
-
// New instance
|
|
7801
|
-
var obj = { type: 'picker' };
|
|
7802
|
-
obj.options = {};
|
|
7803
|
-
|
|
7804
|
-
var dropdownHeader = null;
|
|
7805
|
-
var dropdownContent = null;
|
|
7806
|
-
|
|
7807
|
-
/**
|
|
7808
|
-
* The element passed is a DOM element
|
|
7809
|
-
*/
|
|
7810
|
-
var isDOM = function(o) {
|
|
7811
|
-
return (o instanceof Element || o instanceof HTMLDocument);
|
|
7812
|
-
}
|
|
7813
|
-
|
|
7814
|
-
/**
|
|
7815
|
-
* Create the content options
|
|
7816
|
-
*/
|
|
7817
|
-
var createContent = function() {
|
|
7818
|
-
dropdownContent.innerHTML = '';
|
|
7819
|
-
|
|
7820
|
-
// Create items
|
|
7821
|
-
var keys = Object.keys(obj.options.data);
|
|
7822
|
-
|
|
7823
|
-
// Go though all options
|
|
7824
|
-
for (var i = 0; i < keys.length; i++) {
|
|
7825
|
-
// Item
|
|
7826
|
-
var dropdownItem = document.createElement('div');
|
|
7827
|
-
dropdownItem.classList.add('jpicker-item');
|
|
7828
|
-
dropdownItem.
|
|
7829
|
-
dropdownItem.
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
dropdownContent.style.
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
dropdownContent.
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
dropdownContent.
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
dropdownHeader.
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
tracking
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
el.focus
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
var
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
var
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
dropdownContent.style.
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
tracking
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
|
|
8087
|
-
|
|
8088
|
-
|
|
8089
|
-
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
//
|
|
8104
|
-
el.
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
7812
|
+
|
|
7813
|
+
|
|
7814
|
+
|
|
7815
|
+
function Picker(el, options) {
|
|
7816
|
+
// Already created, update options
|
|
7817
|
+
if (el.picker) {
|
|
7818
|
+
return el.picker.setOptions(options, true);
|
|
7819
|
+
}
|
|
7820
|
+
|
|
7821
|
+
// New instance
|
|
7822
|
+
var obj = { type: 'picker' };
|
|
7823
|
+
obj.options = {};
|
|
7824
|
+
|
|
7825
|
+
var dropdownHeader = null;
|
|
7826
|
+
var dropdownContent = null;
|
|
7827
|
+
|
|
7828
|
+
/**
|
|
7829
|
+
* The element passed is a DOM element
|
|
7830
|
+
*/
|
|
7831
|
+
var isDOM = function(o) {
|
|
7832
|
+
return (o instanceof Element || o instanceof HTMLDocument);
|
|
7833
|
+
}
|
|
7834
|
+
|
|
7835
|
+
/**
|
|
7836
|
+
* Create the content options
|
|
7837
|
+
*/
|
|
7838
|
+
var createContent = function() {
|
|
7839
|
+
dropdownContent.innerHTML = '';
|
|
7840
|
+
|
|
7841
|
+
// Create items
|
|
7842
|
+
var keys = Object.keys(obj.options.data);
|
|
7843
|
+
|
|
7844
|
+
// Go though all options
|
|
7845
|
+
for (var i = 0; i < keys.length; i++) {
|
|
7846
|
+
// Item
|
|
7847
|
+
var dropdownItem = document.createElement('div');
|
|
7848
|
+
dropdownItem.classList.add('jpicker-item');
|
|
7849
|
+
dropdownItem.setAttribute('role', 'option');
|
|
7850
|
+
dropdownItem.k = keys[i];
|
|
7851
|
+
dropdownItem.v = obj.options.data[keys[i]];
|
|
7852
|
+
// Label
|
|
7853
|
+
var item = obj.getLabel(keys[i], dropdownItem);
|
|
7854
|
+
if (isDOM(item)) {
|
|
7855
|
+
dropdownItem.appendChild(item);
|
|
7856
|
+
} else {
|
|
7857
|
+
dropdownItem.innerHTML = item;
|
|
7858
|
+
}
|
|
7859
|
+
// Append
|
|
7860
|
+
dropdownContent.appendChild(dropdownItem);
|
|
7861
|
+
}
|
|
7862
|
+
}
|
|
7863
|
+
|
|
7864
|
+
/**
|
|
7865
|
+
* Set or reset the options for the picker
|
|
7866
|
+
*/
|
|
7867
|
+
obj.setOptions = function(options, reset) {
|
|
7868
|
+
// Default configuration
|
|
7869
|
+
var defaults = {
|
|
7870
|
+
value: 0,
|
|
7871
|
+
data: null,
|
|
7872
|
+
render: null,
|
|
7873
|
+
onchange: null,
|
|
7874
|
+
onmouseover: null,
|
|
7875
|
+
onselect: null,
|
|
7876
|
+
onopen: null,
|
|
7877
|
+
onclose: null,
|
|
7878
|
+
onload: null,
|
|
7879
|
+
width: null,
|
|
7880
|
+
header: true,
|
|
7881
|
+
right: false,
|
|
7882
|
+
bottom: false,
|
|
7883
|
+
content: false,
|
|
7884
|
+
columns: null,
|
|
7885
|
+
grid: null,
|
|
7886
|
+
height: null,
|
|
7887
|
+
}
|
|
7888
|
+
|
|
7889
|
+
// Legacy purpose only
|
|
7890
|
+
if (options && options.options) {
|
|
7891
|
+
options.data = options.options;
|
|
7892
|
+
}
|
|
7893
|
+
|
|
7894
|
+
// Loop through the initial configuration
|
|
7895
|
+
for (var property in defaults) {
|
|
7896
|
+
if (options && options.hasOwnProperty(property)) {
|
|
7897
|
+
obj.options[property] = options[property];
|
|
7898
|
+
} else {
|
|
7899
|
+
if (typeof(obj.options[property]) == 'undefined' || reset === true) {
|
|
7900
|
+
obj.options[property] = defaults[property];
|
|
7901
|
+
}
|
|
7902
|
+
}
|
|
7903
|
+
}
|
|
7904
|
+
|
|
7905
|
+
// Start using the options
|
|
7906
|
+
if (obj.options.header === false) {
|
|
7907
|
+
dropdownHeader.style.display = 'none';
|
|
7908
|
+
} else {
|
|
7909
|
+
dropdownHeader.style.display = '';
|
|
7910
|
+
}
|
|
7911
|
+
|
|
7912
|
+
// Width
|
|
7913
|
+
if (obj.options.width) {
|
|
7914
|
+
dropdownHeader.style.width = parseInt(obj.options.width) + 'px';
|
|
7915
|
+
} else {
|
|
7916
|
+
dropdownHeader.style.width = '';
|
|
7917
|
+
}
|
|
7918
|
+
|
|
7919
|
+
// Height
|
|
7920
|
+
if (obj.options.height) {
|
|
7921
|
+
dropdownContent.style.maxHeight = obj.options.height + 'px';
|
|
7922
|
+
dropdownContent.style.overflow = 'scroll';
|
|
7923
|
+
} else {
|
|
7924
|
+
dropdownContent.style.overflow = '';
|
|
7925
|
+
}
|
|
7926
|
+
|
|
7927
|
+
if (obj.options.columns > 0) {
|
|
7928
|
+
if (! obj.options.grid) {
|
|
7929
|
+
dropdownContent.classList.add('jpicker-columns');
|
|
7930
|
+
dropdownContent.style.width = obj.options.width ? obj.options.width : 36 * obj.options.columns + 'px';
|
|
7931
|
+
} else {
|
|
7932
|
+
dropdownContent.classList.add('jpicker-grid');
|
|
7933
|
+
dropdownContent.style.gridTemplateColumns = 'repeat(' + obj.options.grid + ', 1fr)';
|
|
7934
|
+
}
|
|
7935
|
+
}
|
|
7936
|
+
|
|
7937
|
+
if (isNaN(parseInt(obj.options.value))) {
|
|
7938
|
+
obj.options.value = 0;
|
|
7939
|
+
}
|
|
7940
|
+
|
|
7941
|
+
// Create list from data
|
|
7942
|
+
createContent();
|
|
7943
|
+
|
|
7944
|
+
// Set value
|
|
7945
|
+
obj.setValue(obj.options.value);
|
|
7946
|
+
|
|
7947
|
+
// Set options all returns the own instance
|
|
7948
|
+
return obj;
|
|
7949
|
+
}
|
|
7950
|
+
|
|
7951
|
+
obj.getValue = function() {
|
|
7952
|
+
return obj.options.value;
|
|
7953
|
+
}
|
|
7954
|
+
|
|
7955
|
+
obj.setValue = function(k, e) {
|
|
7956
|
+
// Set label
|
|
7957
|
+
obj.setLabel(k);
|
|
7958
|
+
|
|
7959
|
+
// Update value
|
|
7960
|
+
obj.options.value = String(k);
|
|
7961
|
+
|
|
7962
|
+
// Lemonade JS
|
|
7963
|
+
if (el.value != obj.options.value) {
|
|
7964
|
+
el.value = obj.options.value;
|
|
7965
|
+
if (typeof(el.oninput) == 'function') {
|
|
7966
|
+
el.oninput({
|
|
7967
|
+
type: 'input',
|
|
7968
|
+
target: el,
|
|
7969
|
+
value: el.value
|
|
7970
|
+
});
|
|
7971
|
+
}
|
|
7972
|
+
}
|
|
7973
|
+
|
|
7974
|
+
if (dropdownContent.children[k] && dropdownContent.children[k].getAttribute('type') !== 'generic') {
|
|
7975
|
+
obj.close();
|
|
7976
|
+
}
|
|
7977
|
+
|
|
7978
|
+
// Call method
|
|
7979
|
+
if (e) {
|
|
7980
|
+
if (typeof (obj.options.onchange) == 'function') {
|
|
7981
|
+
var v = obj.options.data[k];
|
|
7982
|
+
|
|
7983
|
+
obj.options.onchange(el, obj, v, v, k, e);
|
|
7984
|
+
}
|
|
7985
|
+
}
|
|
7986
|
+
}
|
|
7987
|
+
|
|
7988
|
+
obj.getLabel = function(v, item) {
|
|
7989
|
+
var label = obj.options.data[v] || null;
|
|
7990
|
+
if (typeof(obj.options.render) == 'function') {
|
|
7991
|
+
label = obj.options.render(label, item);
|
|
7992
|
+
}
|
|
7993
|
+
return label;
|
|
7994
|
+
}
|
|
7995
|
+
|
|
7996
|
+
obj.setLabel = function(v) {
|
|
7997
|
+
var item;
|
|
7998
|
+
|
|
7999
|
+
if (obj.options.content) {
|
|
8000
|
+
item = '<i class="material-icons">' + obj.options.content + '</i>';
|
|
8001
|
+
} else {
|
|
8002
|
+
item = obj.getLabel(v, null);
|
|
8003
|
+
}
|
|
8004
|
+
// Label
|
|
8005
|
+
if (isDOM(item)) {
|
|
8006
|
+
dropdownHeader.innerHTML = '';
|
|
8007
|
+
dropdownHeader.appendChild(item);
|
|
8008
|
+
} else {
|
|
8009
|
+
dropdownHeader.innerHTML = item;
|
|
8010
|
+
}
|
|
8011
|
+
}
|
|
8012
|
+
|
|
8013
|
+
obj.open = function() {
|
|
8014
|
+
if (! el.classList.contains('jpicker-focus')) {
|
|
8015
|
+
// Start tracking the element
|
|
8016
|
+
tracking(obj, true);
|
|
8017
|
+
|
|
8018
|
+
// Open picker
|
|
8019
|
+
el.classList.add('jpicker-focus');
|
|
8020
|
+
el.focus();
|
|
8021
|
+
|
|
8022
|
+
var top = 0;
|
|
8023
|
+
var left = 0;
|
|
8024
|
+
|
|
8025
|
+
dropdownContent.style.marginLeft = '';
|
|
8026
|
+
|
|
8027
|
+
var rectHeader = dropdownHeader.getBoundingClientRect();
|
|
8028
|
+
var rectContent = dropdownContent.getBoundingClientRect();
|
|
8029
|
+
|
|
8030
|
+
if (window.innerHeight < rectHeader.bottom + rectContent.height || obj.options.bottom) {
|
|
8031
|
+
top = -1 * (rectContent.height + 4);
|
|
8032
|
+
} else {
|
|
8033
|
+
top = rectHeader.height + 4;
|
|
8034
|
+
}
|
|
8035
|
+
|
|
8036
|
+
if (obj.options.right === true) {
|
|
8037
|
+
left = -1 * rectContent.width + rectHeader.width;
|
|
8038
|
+
}
|
|
8039
|
+
|
|
8040
|
+
if (rectContent.left + left < 0) {
|
|
8041
|
+
left = left + rectContent.left + 10;
|
|
8042
|
+
}
|
|
8043
|
+
if (rectContent.left + rectContent.width > window.innerWidth) {
|
|
8044
|
+
left = -1 * (10 + rectContent.left + rectContent.width - window.innerWidth);
|
|
8045
|
+
}
|
|
8046
|
+
|
|
8047
|
+
dropdownContent.style.marginTop = parseInt(top) + 'px';
|
|
8048
|
+
dropdownContent.style.marginLeft = parseInt(left) + 'px';
|
|
8049
|
+
|
|
8050
|
+
//dropdownContent.style.marginTop
|
|
8051
|
+
if (typeof obj.options.onopen == 'function') {
|
|
8052
|
+
obj.options.onopen(el, obj);
|
|
8053
|
+
}
|
|
8054
|
+
}
|
|
8055
|
+
}
|
|
8056
|
+
|
|
8057
|
+
obj.close = function() {
|
|
8058
|
+
if (el.classList.contains('jpicker-focus')) {
|
|
8059
|
+
el.classList.remove('jpicker-focus');
|
|
8060
|
+
|
|
8061
|
+
// Start tracking the element
|
|
8062
|
+
tracking(obj, false);
|
|
8063
|
+
|
|
8064
|
+
if (typeof obj.options.onclose == 'function') {
|
|
8065
|
+
obj.options.onclose(el, obj);
|
|
8066
|
+
}
|
|
8067
|
+
}
|
|
8068
|
+
}
|
|
8069
|
+
|
|
8070
|
+
/**
|
|
8071
|
+
* Create floating picker
|
|
8072
|
+
*/
|
|
8073
|
+
var init = function() {
|
|
8074
|
+
let id = helpers.guid();
|
|
8075
|
+
|
|
8076
|
+
// Class
|
|
8077
|
+
el.classList.add('jpicker');
|
|
8078
|
+
el.setAttribute('role', 'combobox');
|
|
8079
|
+
el.setAttribute('aria-haspopup', 'listbox');
|
|
8080
|
+
el.setAttribute('aria-expanded', 'false');
|
|
8081
|
+
el.setAttribute('aria-controls', id);
|
|
8082
|
+
el.setAttribute('tabindex', '0');
|
|
8083
|
+
el.onmousedown = function(e) {
|
|
8084
|
+
if (! el.classList.contains('jpicker-focus')) {
|
|
8085
|
+
obj.open();
|
|
8086
|
+
}
|
|
8087
|
+
}
|
|
8088
|
+
|
|
8089
|
+
// Dropdown Header
|
|
8090
|
+
dropdownHeader = document.createElement('div');
|
|
8091
|
+
dropdownHeader.classList.add('jpicker-header');
|
|
8092
|
+
|
|
8093
|
+
// Dropdown content
|
|
8094
|
+
dropdownContent = document.createElement('div');
|
|
8095
|
+
dropdownContent.setAttribute('id', id);
|
|
8096
|
+
dropdownContent.setAttribute('role', 'listbox');
|
|
8097
|
+
dropdownContent.classList.add('jpicker-content');
|
|
8098
|
+
dropdownContent.onclick = function(e) {
|
|
8099
|
+
var item = helpers.findElement(e.target, 'jpicker-item');
|
|
8100
|
+
if (item) {
|
|
8101
|
+
if (item.parentNode === dropdownContent) {
|
|
8102
|
+
// Update label
|
|
8103
|
+
obj.setValue(item.k, e);
|
|
8104
|
+
}
|
|
8105
|
+
}
|
|
8106
|
+
}
|
|
8107
|
+
// Append content and header
|
|
8108
|
+
el.appendChild(dropdownHeader);
|
|
8109
|
+
el.appendChild(dropdownContent);
|
|
8110
|
+
|
|
8111
|
+
// Default value
|
|
8112
|
+
el.value = options.value || 0;
|
|
8113
|
+
|
|
8114
|
+
// Set options
|
|
8115
|
+
obj.setOptions(options);
|
|
8116
|
+
|
|
8117
|
+
if (typeof(obj.options.onload) == 'function') {
|
|
8118
|
+
obj.options.onload(el, obj);
|
|
8119
|
+
}
|
|
8120
|
+
|
|
8121
|
+
// Change
|
|
8122
|
+
el.change = obj.setValue;
|
|
8123
|
+
|
|
8124
|
+
// Global generic value handler
|
|
8125
|
+
el.val = function(val) {
|
|
8126
|
+
if (val === undefined) {
|
|
8127
|
+
return obj.getValue();
|
|
8128
|
+
} else {
|
|
8129
|
+
obj.setValue(val);
|
|
8130
|
+
}
|
|
8131
|
+
}
|
|
8132
|
+
|
|
8133
|
+
// Reference
|
|
8134
|
+
el.picker = obj;
|
|
8135
|
+
}
|
|
8136
|
+
|
|
8137
|
+
init();
|
|
8138
|
+
|
|
8139
|
+
return obj;
|
|
8110
8140
|
}
|
|
8111
8141
|
;// CONCATENATED MODULE: ./src/plugins/toolbar.js
|
|
8112
8142
|
|
|
@@ -8225,6 +8255,7 @@ function Toolbar(el, options) {
|
|
|
8225
8255
|
|
|
8226
8256
|
if (items[i].tooltip) {
|
|
8227
8257
|
toolbarItem.setAttribute('title', items[i].tooltip);
|
|
8258
|
+
toolbarItem.setAttribute('aria-label', items[i].tooltip);
|
|
8228
8259
|
}
|
|
8229
8260
|
|
|
8230
8261
|
// Id
|
|
@@ -8264,6 +8295,7 @@ function Toolbar(el, options) {
|
|
|
8264
8295
|
}
|
|
8265
8296
|
}
|
|
8266
8297
|
toolbarIcon.innerHTML = items[i].content ? items[i].content : '';
|
|
8298
|
+
toolbarItem.setAttribute('role', 'button');
|
|
8267
8299
|
toolbarItem.appendChild(toolbarIcon);
|
|
8268
8300
|
|
|
8269
8301
|
// Badge options
|
|
@@ -10185,9 +10217,16 @@ function Validations() {
|
|
|
10185
10217
|
}
|
|
10186
10218
|
|
|
10187
10219
|
component.textLength = function(data, options) {
|
|
10188
|
-
|
|
10220
|
+
let textLength;
|
|
10221
|
+
if (typeof data === 'string') {
|
|
10222
|
+
textLength = data.length;
|
|
10223
|
+
} else if (typeof data !== 'undefined' && data !== null && typeof data.toString === 'function') {
|
|
10224
|
+
textLength = data.toString().length;
|
|
10225
|
+
} else {
|
|
10226
|
+
textLength = 0;
|
|
10227
|
+
}
|
|
10189
10228
|
|
|
10190
|
-
return component.number(
|
|
10229
|
+
return component.number(textLength, options);
|
|
10191
10230
|
}
|
|
10192
10231
|
|
|
10193
10232
|
return component;
|
package/package.json
CHANGED