jqwidgets-ng 17.1.1 → 18.0.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/ReleaseNotes.txt +125 -5
- package/jqwidgets/globalization/globalize.culture.cs-CZ.js +87 -87
- package/jqwidgets/globalization/globalize.culture.de-DE.js +83 -83
- package/jqwidgets/globalization/globalize.culture.en-CA.js +51 -51
- package/jqwidgets/globalization/globalize.culture.en-US.js +35 -35
- package/jqwidgets/globalization/globalize.culture.fr-FR.js +81 -81
- package/jqwidgets/globalization/globalize.culture.he-IL.js +99 -99
- package/jqwidgets/globalization/globalize.culture.hr-HR.js +83 -83
- package/jqwidgets/globalization/globalize.culture.hu-HU.js +82 -82
- package/jqwidgets/globalization/globalize.culture.it-IT.js +81 -81
- package/jqwidgets/globalization/globalize.culture.ja-JP.js +102 -102
- package/jqwidgets/globalization/globalize.culture.lt.js +85 -85
- package/jqwidgets/globalization/globalize.culture.ru-RU.js +84 -84
- package/jqwidgets/globalization/globalize.culture.sa-IN.js +73 -73
- package/jqwidgets/globalization/globalize.js +1591 -1591
- package/jqwidgets/jqxgantt.api.js +381 -381
- package/jqwidgets/jqxsplitlayout.js +6 -2445
- package/jqwidgets/styles/font/jqx-icons.svg +268 -268
- package/jqwidgets/styles/gantt/font/jqx-icons.svg +332 -332
- package/jqwidgets/styles/gantt/jqx.gantt.css +18667 -18667
- package/jqwidgets/styles/jqx.base.css +34 -34
- package/jqwidgets/styles/jqx.fluent.css +3563 -3563
- package/jqwidgets/styles/jqx.fluent_old.css +1262 -1262
- package/jqwidgets/styles/theme.css +293 -293
- package/package.json +3 -3
|
@@ -1,2448 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
jQWidgets v18.0.0 (2023-Nov)
|
|
3
|
+
Copyright (c) 2011-2023 jQWidgets.
|
|
4
|
+
License: https://jqwidgets.com/license/
|
|
5
|
+
*/
|
|
2
6
|
/* eslint-disable */
|
|
3
|
-
if (!window.JQX) {
|
|
4
|
-
window.JQX = {
|
|
5
|
-
Utilities: {
|
|
6
|
-
Core: {
|
|
7
|
-
isMobile() {
|
|
8
|
-
var isMobile = /(iphone|ipod|ipad|android|iemobile|blackberry|bada)/.test(window.navigator.userAgent.toLowerCase());
|
|
9
|
-
var iOS = function () {
|
|
10
|
-
return [
|
|
11
|
-
'iPad Simulator',
|
|
12
|
-
'iPhone Simulator',
|
|
13
|
-
'iPod Simulator',
|
|
14
|
-
'iPad',
|
|
15
|
-
'iPhone',
|
|
16
|
-
'iPod'
|
|
17
|
-
].includes(navigator.platform)
|
|
18
|
-
// iPad on iOS 13 detection
|
|
19
|
-
|| (navigator.userAgent.includes('Mac') && 'ontouchend' in document)
|
|
20
|
-
}
|
|
21
7
|
|
|
22
|
-
if (!isMobile) {
|
|
23
|
-
return iOS();
|
|
24
|
-
}
|
|
8
|
+
function _typeof(b){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){a=function a(c){return typeof c}}else{a=function a(c){return c&&typeof Symbol==="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c}}return a(b)}function _get(d,c,b){if(typeof Reflect!=="undefined"&&Reflect.get){a=Reflect.get}else{a=function a(h,g,f){var e=_superPropBase(h,g);if(!e){return}var i=Object.getOwnPropertyDescriptor(e,g);if(i.get){return i.get.call(f)}return i.value}}return a(d,c,b||d)}function _superPropBase(a,b){while(!Object.prototype.hasOwnProperty.call(a,b)){a=_getPrototypeOf(a);if(a===null){break}}return a}function _classCallCheck(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(d,b){for(var a=0;a<b.length;a++){var c=b[a];c.enumerable=c.enumerable||false;c.configurable=true;if("value" in c){c.writable=true}Object.defineProperty(d,c.key,c)}}function _createClass(c,a,b){if(a){_defineProperties(c.prototype,a)}if(b){_defineProperties(c,b)}return c}function _inherits(b,a){if(typeof a!=="function"&&a!==null){throw new TypeError("Super expression must either be null or a function")}b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,writable:true,configurable:true}});if(a){_setPrototypeOf(b,a)}}function _createSuper(b){var c=_isNativeReflectConstruct();return function a(){var e=_getPrototypeOf(b),d;if(c){var f=_getPrototypeOf(this).constructor;d=Reflect.construct(e,arguments,f)}else{d=e.apply(this,arguments)}return _possibleConstructorReturn(this,d)}}function _possibleConstructorReturn(a,b){if(b&&(_typeof(b)==="object"||typeof b==="function")){return b}return _assertThisInitialized(a)}function _assertThisInitialized(a){if(a===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return a}function _wrapNativeSuper(a){var c=typeof Map==="function"?new Map():undefined;b=function b(d){if(d===null||!_isNativeFunction(d)){return d}if(typeof d!=="function"){throw new TypeError("Super expression must either be null or a function")}if(typeof c!=="undefined"){if(c.has(d)){return c.get(d)}c.set(d,e)}function e(){return _construct(d,arguments,_getPrototypeOf(this).constructor)}e.prototype=Object.create(d.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});return _setPrototypeOf(e,d)};return b(a)}function _construct(d,c,b){if(_isNativeReflectConstruct()){a=Reflect.construct}else{a=function a(i,h,g){var f=[null];f.push.apply(f,h);var j=Function.bind.apply(i,f);var e=new j();if(g){_setPrototypeOf(e,g.prototype)}return e}}return a.apply(null,arguments)}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct){return false}if(Reflect.construct.sham){return false}if(typeof Proxy==="function"){return true}try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(a){return false}}function _isNativeFunction(a){return Function.toString.call(a).indexOf("[native code]")!==-1}function _setPrototypeOf(b,a){c=Object.setPrototypeOf||function c(e,d){e.__proto__=d;return e};return c(b,a)}function _getPrototypeOf(b){a=Object.setPrototypeOf?Object.getPrototypeOf:function a(c){return c.__proto__||Object.getPrototypeOf(c)};return a(b)}if(!window.JQX){window.JQX={Utilities:{Core:{isMobile:function isMobile(){var a=/(iphone|ipod|ipad|android|iemobile|blackberry|bada)/.test(window.navigator.userAgent.toLowerCase());var b=function b(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend" in document};if(!a){return b()}return a}}}}}var LayoutItem=function(e){_inherits(j,e);var i=_createSuper(j);function j(){var k;_classCallCheck(this,j);k=i.call(this);k._properties={min:50,label:"Item",modifiers:["resize","drag","close"],size:null};return k}_createClass(j,[{key:"_setProperty",value:function d(n,m){var l=this;if(l._properties[n]===m){return}l._properties[n]=m;l._updating=true;if(n==="disabled"||n==="modifiers"){if(m){l.setAttribute(n,m)}else{l.removeAttribute(n)}}else{if(m===null){l.removeAttribute(n)}else{l.setAttribute(n,m)}}if(!l.isCompleted){return}var k=l.closest("jqx-layout");if(k){if(!k._resizeDetails&&!k._updating&&k.isRendered){k.refresh()}}l._updating=false}},{key:"label",get:function b(){return this._properties.label},set:function h(k){this._setProperty("label",k)}},{key:"modifiers",get:function b(){return this._properties.modifiers},set:function h(k){this._setProperty("modifiers",k)}},{key:"min",get:function b(){return this._properties.min},set:function h(k){this._setProperty("min",k)}},{key:"size",get:function b(){return this._properties.size},set:function h(k){if(k!==null){if(typeof k==="string"){this._setProperty("size",k)}else{this._setProperty("size",Math.max(this.min,k))}}else{this._setProperty("size",k)}}},{key:"attributeChangedCallback",value:function f(l,k,n){var m=this;if(k===n){return}if(!m.isCompleted){return}if(l==="size"){if(!m._updating){if(n===null){this[l]=null;return}m[l]=Math.max(m.min,parseInt(n))}}else{m[l]=n}}},{key:"connectedCallback",value:function g(){if(!this.isCompleted){this.render()}}},{key:"whenRendered",value:function c(l){var k=this;if(k.isRendered){l();return}if(!k.whenRenderedCallbacks){k.whenRenderedCallbacks=[]}k.whenRenderedCallbacks.push(l)}},{key:"render",value:function a(){var o=this;if(!o.hasAttribute("data-id")){o.setAttribute("data-id","id"+Math.random().toString(16).slice(2))}if(!o.hasAttribute("label")){o.setAttribute("label",o.label)}if(!o.hasAttribute("min")){o.setAttribute("min",o.min)}if(!o.hasAttribute("label")){o.setAttribute("label",o.label)}if(!o.hasAttribute("modifiers")){o.setAttribute("modifiers",o.modifiers)}for(var l=0;l<o.attributes.length;l++){var n=o.attributes[l];var k=n.name;var m=n.value;if(!isNaN(m)&&(k==="min"||k==="size")){o._properties[k]=parseInt(m);continue}o._properties[k]=m}o.classList.add("jqx-layout-item");o.isCompleted=true;if(o.whenRenderedCallbacks){for(var l=0;l<o.whenRenderedCallbacks.length;l++){o.whenRenderedCallbacks[l]()}o.whenRenderedCallbacks=[]}}}],[{key:"observedAttributes",get:function b(){return["min","size","label","modifiers"]}}]);return j}(_wrapNativeSuper(HTMLElement));var LayoutGroup=function(e){_inherits(d,e);var c=_createSuper(d);function d(){var g;_classCallCheck(this,d);g=c.call(this);g._properties.label="Group";g._properties.orientation="vertical";return g}_createClass(d,[{key:"orientation",get:function a(){return this._properties.orientation},set:function f(g){this._setProperty("orientation",g)}},{key:"render",value:function b(){var g=this;_get(_getPrototypeOf(d.prototype),"render",this).call(this);g.className="jqx-layout-group";if(!g.hasAttribute("orientation")){g.setAttribute("orientation",g._properties.orientation)}else{g._properties.orientation=g.getAttribute("orientation")}}}],[{key:"observedAttributes",get:function a(){return["min","size","modifiers","orientation","position"]}}]);return d}(LayoutItem);var TabLayoutGroup=function(d){_inherits(b,d);var e=_createSuper(b);function b(){var g;_classCallCheck(this,b);g=e.call(this);g._properties.position="top";g._properties.label="TabGroup";return g}_createClass(b,[{key:"position",get:function a(){return this._properties.position},set:function f(g){this._setProperty("position",g)}},{key:"render",value:function c(){var g=this;_get(_getPrototypeOf(b.prototype),"render",this).call(this);if(!g.hasAttribute("position")&&g.position){g.setAttribute("position","top")}}}],[{key:"observedAttributes",get:function a(){return["min","size","modifiers","orientation","position"]}}]);return b}(LayoutGroup);var TabLayoutItem=function(b){_inherits(a,b);var c=_createSuper(a);function a(){var d;_classCallCheck(this,a);d=c.call(this);d._properties.label="TabItem";return d}return a}(LayoutGroup);(function(g){g.jqx.jqxWidget("jqxSplitLayout","",{});g.extend(g.jqx._jqxSplitLayout.prototype,{defineInstance:function e(){var h={dataSource:null,ready:null,orientation:"vertical"};if(this===g.jqx._jqxSplitLayout.prototype){return h}g.extend(true,this,h);return h},createInstance:function a(){var h=this;this._properties={dataSource:null,ready:null,orientation:"vertical"};var h=this;h.layout=document.createElement("jqx-split-layout");h.layout.style.width="100%";h.layout.style.height="100%";h.element.className+=h.toThemeProperty("jqx-split-layout-component jqx-rc-all jqx-widget");h.layout.dataSource=h.dataSource;h.layout.orientation=h.orientation;h.layout.ready=h.ready;h.element.appendChild(h.layout)},propertyChangedHandler:function b(i,j,h,l){var k=i;if(h!=l||l instanceof Object){if(!k.layout){return}k.layout[j]=l}},render:function d(){var h=this;if(!h.layout){return}h.layout.render()},refresh:function c(){var h=this;if(!h.layout){return}if(!h.layout.isRendered){return}h.layout.refresh()},dataBind:function f(){var h=this;if(!h.layout){return}h.layout.dataBind()}})})(jqxBaseFramework);var SplitLayout=function(G){_inherits(i,G);var g=_createSuper(i);function i(){var O;_classCallCheck(this,i);O=g.call(this);O._properties={dataSource:null,orientation:"vertical"};return O}_createClass(i,[{key:"orientation",get:function J(){return this._properties.orientation},set:function s(O){this._properties.orientation=O}},{key:"dataSource",get:function J(){return this._properties.dataSource},set:function s(O){this._properties.dataSource=O}},{key:"_dragStart",value:function L(O){O.stopPropagation();O.preventDefault()}},{key:"_leaveHandler",value:function C(){var O=this;if(O._resizeDetails){return}O._handleButtonsVisibility(null);O._hideSplitter();requestAnimationFrame(function(){})}},{key:"_enterHandler",value:function y(){var O=this;if(O._resizeDetails){return}O._handleButtonsVisibility(O._selectedItem);O._updateSplitter();requestAnimationFrame(function(){O.classList.add("outline")})}},{key:"template",value:function j(){return'<div class="jqx-container" id="container" role="presentation"><jqx-layout-group data-id="root" id="itemsContainer"></jqx-layout-group><div root-splitter id="splitter" class="jqx-layout-splitter"></div>'}},{key:"propertyChangedHandler",value:function B(O,P,R){var Q=this;switch(O){case"orientation":if(Q.$.itemsContainer){Q.$.itemsContainer.orientation=Q.orientation}break;case"dataSource":Q.dataBind();break;case"selectedIndex":Q._handleItemClick(Q.getItem(R+""),true);break;default:_get(_getPrototypeOf(i.prototype),"propertyChangedHandler",this).call(this,O,P,R);break}}},{key:"dataBind",value:function p(){var Q=this;Q.$.itemsContainer.innerHTML="";var O="";var P=function P(R,Y){for(var V=0;V<R.length;V++){var ad=R[V];var ae=ad.size;var U=ad.min;var ac=ad.modifiers;var aa=ad.type;var W=ad.position;var T=ad.orientation?ad.orientation:"vertical";var S=ad.id;var ab=ad.label;var Z="";if(S!==undefined){Z+='id="'.concat(S,'" ')}if(ae!==undefined){Z+='size="'.concat(ae,'" ')}if(ab!==undefined){Z+='label="'.concat(ab,'" ')}if(U!==undefined){Z+='min="'.concat(U,'" ')}if(ac!==undefined){Z+='modifiers="'.concat(ac,'" ')}if(W!==undefined){Z+='position="'.concat(W,'" ')}if(ad.items){Z+="orientation=".concat(T," ");if(aa==="tabs"){O+="<jqx-tab-layout-group ".concat(Z,">");P(ad.items,true);O+="</jqx-tab-layout-group>"}else{O+="<jqx-layout-group ".concat(Z,">");P(ad.items);O+="</jqx-layout-group>"}}else{var X=ad.content||"";if(Y){O+="<jqx-tab-layout-item ".concat(Z,">")+X+"</jqx-tab-layout-item>"}else{if(aa==="tabs"){O+="<jqx-tab-layout-group>";O+="<jqx-tab-layout-item ".concat(Z,">")+X+"</jqx-tab-layout-item>";O+="</jqx-tab-layout-group>"}else{O+="<jqx-layout-item ".concat(Z,">")+X+"</jqx-layout-item>"}}}}};P(Q.dataSource);Q.$.itemsContainer.innerHTML=O;Q.refresh()}},{key:"render",value:function w(){var P=this;P.setAttribute("role","group");if(P.selectedIndex){P._handleItemClick(P.getItem(P.selectedIndex+""),true)}var O=function O(){if(!P.dataSource){P.dataSource=P._getDataSource(P._getLayout())}else{P.dataBind()}P.$.itemsContainer.orientation=P.orientation;P.refresh();P._updateSplitter();P.isRendered=true;P.classList.add("outline");if(P.ready){P.ready()}};if(document.readyState==="complete"){O()}else{window.addEventListener("load",function(){O()})}}},{key:"connectedCallback",value:function H(){var P=this;var O=function O(){var Q=document.createDocumentFragment();while(P.childNodes.length){Q.appendChild(P.firstChild)}P.innerHTML=P.template();P.classList.add("jqx-widget");P.$={container:P.querySelector("#container"),itemsContainer:P.querySelector("#itemsContainer"),splitter:P.querySelector("#splitter")};delete P.$.container.id;delete P.$.itemsContainer.id;delete P.$.splitter.id;P.$.itemsContainer.appendChild(Q);P.classList.add("jqx-split-layout");document.addEventListener("pointerdown",function(R){P._documentDownHandler(R)});document.addEventListener("pointermove",function(R){P._documentMoveHandler(R)});document.addEventListener("pointerup",function(R){P._documentUpHandler(R)});document.addEventListener("selectstart",function(R){P._documentSelectStartHandler(R)});document.addEventListener("keyup",function(R){P._keyUpHandler(R)});P.addEventListener("mouseleave",function(R){P._leaveHandler(R)});P.addEventListener("mouseenter",function(R){P._enterHandler(R)});P.addEventListener("dragStart",function(R){P._dragStart(R)});P.render()};if(document.readyState==="complete"){O()}else{window.addEventListener("load",function(){O()})}}},{key:"getItem",value:function c(P){var S=this;if(P===undefined||P===null){return}P=(P+"").split(".");var O=S._getDataSource(S._getLayout()),R;for(var Q=0;Q<P.length;Q++){R=O[P[Q]];if(!R){break}O=R.items}return R}},{key:"_documentDownHandler",value:function D(P){var O=this,Q=P.target;if(O.contains(Q)&&Q.closest){O._target=Q;O._updateSplitter()}}},{key:"_documentMoveHandler",value:function u(ak){var ab=this,au=ak.target,Q=ab._contextMenu;if(Q&&!JQX.Utilities.Core.isMobile){if(Q.querySelector(".jqx-layout-context-menu-item[hover]")){var ai=Q.children;for(var al=0;al<ai.length;al++){ai[al].removeAttribute("hover")}}if(Q.contains(au)&&au.closest&&au.closest(".jqx-layout-context-menu-item")){au.setAttribute("hover","")}}if(ab._dragDetails){var ao=Math.abs(ab._dragDetails.pageX-ak.pageX);var an=Math.abs(ab._dragDetails.pageY-ak.pageY);if(an<=5&&ao<=5){return}if(!ab._dragDetails.feedback.parentElement){document.body.appendChild(ab._dragDetails.feedback);document.body.appendChild(ab._dragDetails.overlay);setTimeout(function(){ab._dragDetails.feedback.classList.add("dragging")},100)}ab._dragDetails.dragging=true;ab._dragDetails.feedback.style.left=ak.pageX-ab._dragDetails.feedback.offsetWidth/2-5+"px";ab._dragDetails.feedback.style.top=ak.pageY-ab._dragDetails.feedback.offsetHeight/2-5+"px";var ag=document.elementsFromPoint(ak.pageX,ak.pageY);var ad=null;var Z=false;for(var al=0;al<ag.length;al++){var S=ag[al];if(ab._dragDetails.feedback.contains(S)){continue}if(S.classList.contains("jqx-layout-tab-strip")){if(ab._dragDetails.element.contains(S)){continue}ad=S.parentElement;Z=true;break}if((S.parentElement===ab._dragDetails.parent||S===ab._dragDetails.parent)&&ab._dragDetails.layoutGroup.items.length===1){continue}if(ab._dragDetails.element.contains(S)){continue}if(S instanceof TabLayoutItem){ad=S.parentElement;break}else{if(S instanceof TabLayoutGroup){ad=S;break}}}var at=function at(aC,aF){var ay=ab.offset(aC);var aA=null;var ax=50;var aE=aF;var aw=aF;if(!aF){aw=aC.offsetWidth/3;aE=aC.offsetHeight/3}else{ax=0}var aD=[{left:ay.left,top:ay.top,right:ay.left+ax,bottom:ay.top+ax,position:"top"},{left:ay.left+ax,top:ay.top,right:ay.left+aC.offsetWidth-ax,bottom:ay.top+aE-ax,position:"top"},{left:ay.left+aC.offsetWidth-ax,top:ay.top,right:ay.left+aC.offsetWidth,bottom:ay.top+ax,position:"top"},{left:ay.left,top:ay.top+ax,right:ay.left+aw,bottom:ay.top+aC.offsetHeight-ax,position:"left"},{left:ay.left+aC.offsetWidth-aw,top:ay.top+ax,right:ay.left+aC.offsetWidth,bottom:ay.top+aC.offsetHeight-ax,position:"right"},{left:ay.left,top:ay.top+aC.offsetHeight-ax,right:ay.left+ax,bottom:ay.top+aC.offsetHeight,position:"bottom"},{left:ay.left+ax,top:ay.top+aC.offsetHeight-aE+ax,right:ay.left+aC.offsetWidth-ax,bottom:ay.top+aC.offsetHeight,position:"bottom"},{left:ay.left+aC.offsetWidth-ax,top:ay.top+aC.offsetHeight-ax,right:ay.left+aC.offsetWidth,bottom:ay.top+aC.offsetHeight,position:"bottom"}];for(var az=0;az<aD.length;az++){var aB=aD[az];if(aB.left<=ak.pageX&&ak.pageX<=aB.right){if(aB.top<=ak.pageY&&ak.pageY<=aB.bottom){aA=aB.position;break}}}return aA};var af=ab.querySelector("jqx-layout-group");var av=at(af,10);var U=null;if(!av){if(!ad){ab._handleDropArea(null)}else{if(Z){if(ad!==ab._dragDetails.parent){av="center";U=ad}}else{av=at(ad)||"center";U=ad}}}else{U=af}if(U){ab._dragDetails.current=U;ab._dragDetails.position=av;ab._handleDropArea(U,av)}}if(ab._resizeDetails){var ao=Math.abs(ab._resizeDetails.clientX-ak.clientX);var an=Math.abs(ab._resizeDetails.clientY-ak.clientY);var T=ab._resizeDetails.splitter;var aq=ab._resizeDetails.item;var ap=ab._resizeDetails.itemRect;var ar=ab._resizeDetails.previousItemRect;var am=ab._resizeDetails.previousItem;var R=ab._resizeDetails.nextItemRect;var aa=ab._resizeDetails.nextItem;var P=parseInt(aq.getAttribute("min"));var ac=function ac(aw){if(aw.classList.contains("jqx-visibility-hidden")){return}aw.style.right="";aw.style.top="";aw.style.left="";aw.style.bottom=""};ac(T);ac(ab.$.splitter);T.classList.remove("error");T.classList.add("active");if(!ab._resizeDetails.dragging){if(T.classList.contains("horizontal")&&an<=5){return}else{if(T.classList.contains("vertical")&&ao<=5){return}}ab._resizeDetails.dragging=true}var aj={clientPos:"clientX",pos:"x",size:"width",near:"left",far:"right",offsetSize:"offsetWidth"};if(T.classList.contains("horizontal")){aj={clientPos:"clientY",pos:"y",size:"height",near:"top",far:"bottom",offsetSize:"offsetHeight"}}var W=function W(ax){var ay=ab.offset(ax);var aw=ab.offset(ab);aw.left++;aw.top++;ab.$.splitter.style.width=ax.offsetWidth+"px";ab.$.splitter.style.height=ax.offsetHeight+"px";ab.$.splitter.className=ax.className;ab.$.splitter.style.left=ay.left-aw.left+"px";ab.$.splitter.style.top=ay.top-aw.top+"px";ax.setAttribute("drag","");ab.$.splitter.setAttribute("drag","")};if(T.classList.contains("last")){var V=ak[aj.clientPos]-ab._resizeDetails.splitterRect[aj.pos];var Y=ap[aj.size]-P;if(V>Y){V=Y;T.classList.add("error")}if(ar){var P=parseInt(am.getAttribute("min"));var X=ar[aj.size]-P;if(V<-X){V=-X;T.classList.add("error")}}T.style[aj.near]=V+"px";var O=aq[aj.offsetSize]-V;aq.setAttribute("size",O);if(am){var ae=aq[aj.offsetSize]+am[aj.offsetSize]-O;am.setAttribute("size",ae)}}else{var V=-ak[aj.clientPos]+ab._resizeDetails.splitterRect[aj.pos];var X=ap[aj.size]-P;if(V>X){V=X;T.classList.add("error")}if(R){var P=parseInt(aa.getAttribute("min"));var Y=-R[aj.size]+P;if(V<Y){V=Y;T.classList.add("error")}}T.style[aj.far]=V+"px";var O=aq[aj.offsetSize]-V;aq.setAttribute("size",O);if(aa){var ah=aa[aj.offsetSize]+aq[aj.offsetSize]-O;aa.setAttribute("size",ah)}}W(T)}}},{key:"_offsetTop",value:function r(O){var P=this;if(!O){return 0}return O.offsetTop+P._offsetTop(O.offsetParent)}},{key:"_offsetLeft",value:function z(O){var P=this;if(!O){return 0}return O.offsetLeft+P._offsetLeft(O.offsetParent)}},{key:"offset",value:function F(O){return{left:this._offsetLeft(O),top:this._offsetTop(O)}}},{key:"_keyUpHandler",value:function M(Q){var P=this;if(Q.key==="Escape"){if(P._dragDetails){P._dragDetails.feedback.remove();P._dragDetails.overlay.remove();P._dragDetails=null;P._handleDropArea(null)}if(P._resizeDetails){var O=P._resizeDetails;O.splitter.classList.contains("last")?O.previousItem.size=O.previousItemSize:O.nextItem.size=O.nextItem.previousItemSize;O.item.size=O.itemSize;P.refresh();P._handleItemClick(O.item);P._resizeDetails=null;return}}else{if(Q.key==="Delete"){if(P._selectedItem){P._removeLayoutItem(P._selectedItem)}}}}},{key:"_endDrag",value:function e(){var T=this;T._handleDropArea(null);if(!T._dragDetails.dragging){T._dragDetails=null;return}var V=T._dragDetails.current;var S=T._dragDetails.element;var O=T._dragDetails.position;T._handleDropArea(null);if(V){T._addTabLayoutItem(V,O,S);T._removeLayoutItem(S);if(V.parentElement&&Array.from(V.parentElement.parentElement.children).filter(function(W){if(W.classList.contains("jqx-layout-group")){return true}return false}).length===1){var R=V.parentElement;var U=R.parentElement;var P=U.parentElement;if(!(U.getAttribute("data-id")==="root"||P.getAttribute("data-id")==="root")&&P!==T){var Q=Array.from(P.children).indexOf(R.parentElement);if(Q>=0){P.insertBefore(R,P.children[Q])}else{P.appendChild(R)}U.remove()}}T.refresh();T._updateSplitter();requestAnimationFrame(function(){T.classList.add("outline");T.querySelectorAll(".jqx-element").forEach(function(W){T.dispatchEvent(new CustomEvent("resize"))})})}T.dispatchEvent(new CustomEvent("stateChange",{type:"insert",item:S}));T._dragDetails.feedback.remove();T._dragDetails.overlay.remove();T._dragDetails=null}},{key:"_documentUpHandler",value:function q(S){var R=this,O=JQX.Utilities.Core.isMobile,T=O?document.elementFromPoint(S.pageX-window.pageXOffset,S.pageY-window.pageYOffset):S.target;if(S.button===2){return}if(R._dragDetails){R._endDrag(S)}if(R._resizeDetails){var Q=R._resizeDetails;if(Q.item){Q.item.style.overflow=""}if(Q.previousItem){Q.previousItem.style.overflow=""}if(Q.nextItem){Q.nextItem.style.overflow=""}R.refresh();R._handleItemClick(Q.item);R._resizeDetails=null;window.dispatchEvent(new Event("resize"));R.querySelectorAll(".jqx-element").forEach(function(U){U.dispatchEvent(new CustomEvent("resize"))});return}if(!R.contains(T)){return}R.classList.add("outline");if(R._target&&!T.item){if(T instanceof TabLayoutItem){R._handleItemClick(T)}else{R._handleItemClick(T.closest(".jqx-layout-item"))}}if(R._target){if(R._target!==T){delete R._target;return}if(!S.button&&T.closest(".jqx-layout-buttons-container")){var P=S.target;R._handleButtonClick(P.item,P.position)}else{if(T.closest(".jqx-layout-context-menu")&&(!O&&!S.button||O)){R._handleMenuItemClick(T.closest(".jqx-layout-context-menu-item"))}}delete R._target}}},{key:"_documentSelectStartHandler",value:function t(P){var O=this;if(O._target){P.preventDefault()}}},{key:"_getDataSource",value:function o(R,W,T){var S=this;var P=[];if(!T){T=0}if(!W){W=""}for(var Q=0;Q<R.length;Q++){var O=R[Q];var V={label:O.label,id:O.getAttribute("data-id"),orientation:O.orientation,size:O.size,min:O.min,type:O.type,modifiers:O.modifiers,position:O.position};O.removeAttribute("index");if(O instanceof LayoutGroup){P.push(V);V.index=W!==""?W+"."+T:T.toString();O.setAttribute("index",V.index);if(O.items){var U=S._getDataSource(O.items,V.index,0);V.items=U}}else{if(O instanceof LayoutItem){if(O.items){var U=S._getDataSource(O.items,W,T);P=P.concat(U)}else{V.index=W!==""?W+"."+T:T.toString();O.setAttribute("index",V.index);P.push(V)}}}T++}return P}},{key:"_getLayout",value:function K(){var S=this;var V=!arguments.length?S.$.itemsContainer:arguments[0];if(S._buttons){S._buttons.remove()}if(S._dropArea){S._dropArea.remove()}var R=S.querySelectorAll(".jqx-layout-splitter");for(var P=0;P<R.length;P++){var U=R[P];if(U!==S.$.splitter){U.remove()}}V.items=Array.from(V.children);V.items=V.items.filter(function(W){return W!==V.tabs&&W.hasAttribute("data-id")});var O=V.items.map(function(X){if(X.classList.contains("jqx-layout-tab-strip")){return null}var W=X;var Y=X instanceof LayoutGroup?X:null;if(Y){W.items=S._getLayout(Y)}return W});if(V!==S.$.itemsContainer){return O.filter(function(W){return W!==null&&W!==V.tabs})}var T=[];var Q=V;Q.items=O.filter(function(W){return W!==null&&W!==V.tabs});T.push(Q);return T}},{key:"_updateSplitter",value:function l(){var R=this;if(R._buttons&&R._dragDetails){R._buttons.remove()}R._removeSplitter();var O=R.querySelectorAll("[data-id]");for(var P=0;P<O.length;P++){var Q=O[P];if(Q.getAttribute("data-id")==="root"){continue}if(Q.hasAttribute("role")){var S=Q.getAttribute("role");if(S==="gridcell"||S==="row"||S==="columnheader"||S==="rowheader"){continue}}Q.setAttribute("hover","");R._handleSplitter(Q)}}},{key:"_hideSplitter",value:function h(){var R=this;var O=R.querySelectorAll("[data-id]");for(var P=0;P<O.length;P++){var Q=O[P];Q.removeAttribute("hover")}}},{key:"_removeSplitter",value:function x(){var Q=this;var P=Q.querySelectorAll(".jqx-layout-splitter");for(var O=0;O<P.length;O++){var R=P[O];if(R!==Q.$.splitter){R.remove()}}Q._hideSplitter()}},{key:"_handleItemClick",value:function I(R){var Q=this,O=Q.selectedIndex;var P=null;if(!R){Q.selectedIndex=null;Q.querySelectorAll("[data-id]").forEach(function(S){S.removeAttribute("selected")});Q._selectedItem=null;return}else{P=R instanceof HTMLElement?R:Q.querySelector("[data-id="+R.id+"]");if(P&&P.readonly){Q.selectedIndex=null;return}Q.querySelectorAll("[data-id]").forEach(function(S){S.removeAttribute("selected")});if(!P){Q.refresh();return}Q.selectedIndex=P.getAttribute("index");P.setAttribute("selected","");P.setAttribute("hover","");Q._selectedItem=P;if(P.classList.contains("jqx-hidden")){Q.refresh()}Q._handleButtonsVisibility(P);if(O!==Q.selectedIndex){Q.dispatchEvent(new CustomEvent("change"))}}Q._updateSplitter()}},{key:"_handleButtonClick",value:function n(R,O){var Q=this,P=Q._addLayoutItem(R,O);Q.dispatchEvent(new CustomEvent("stateChange",{type:"insert",item:P}));Q._handleItemClick(P,true)}},{key:"_removeLayoutItem",value:function k(R){var Q=this;if(R.getAttribute("data-id")==="root"){return}if(R instanceof LayoutItem&&R.parentElement.items.length===1){var P=R.parentElement;var O=P;while(P&&P.items&&P.items.length===1){if(P.getAttribute("data-id")==="root"){break}O=P;P=P.parentElement}if(O.getAttribute("data-id")!=="root"){O.remove()}else{if(Q.allowLiveSplit){O.appendChild(document.createElement("jqx-layout-item"))}}}else{R.remove()}Q.refresh();Q.dispatchEvent(new CustomEvent("stateChange",{type:"delete",item:R}))}},{key:"refresh",value:function N(){var Q=this;if(Q._isUpdating){return}Q.dataSource=Q._getDataSource(Q._getLayout());Q.$.splitter.className="jqx-visibility-hidden jqx-layout-splitter";var R=function R(ab){var ae=Q.getItem(ab.getAttribute("index"));if(!ae){return}ab.style.gridTemplateColumns="";ab.style.gridTemplateRows="";var ac="";var S=0;var Y=0;if(ab instanceof TabLayoutGroup){if(ab.tabs){ab.tabs.remove()}var X=document.createElement("div");X.classList.add("jqx-layout-tab-strip");if(Q._selectedItem&&ab.contains(Q._selectedItem)&&Q._selectedItem instanceof TabLayoutItem){ab.selectedIndex=Math.max(0,ab.items.indexOf(Q._selectedItem))}if(ab.selectedIndex>=ab.children.length){ab.selectedIndex=0}for(var W=0;W<ab.children.length;W++){var T=ab.children[W];var Z=Q.getItem(T.getAttribute("index"));if(!Z){continue}var U=document.createElement("div");U.classList.add("jqx-layout-tab");U.innerHTML="<label>"+Z.label+'</label><span class="jqx-close-button"></span>';X.appendChild(U);T.setAttribute("tab","");T.classList.add("jqx-hidden");U.content=T;U.item=Z;U.group=ae;if(T.modifiers){if(T.modifiers.indexOf("close")===-1){U.querySelector(".jqx-close-button").classList.add("jqx-hidden")}}else{U.querySelector(".jqx-close-button").classList.add("jqx-hidden")}if(undefined===ab.selectedIndex||W===ab.selectedIndex){U.classList.add("selected");T.classList.remove("jqx-hidden");ab.selectedIndex=W}U.onpointerup=function(ag){if(ag.target.classList.contains("jqx-close-button")&&U.close){ab.selectedIndex=0;Q._removeLayoutItem(Q._selectedItem);Q._handleItemClick(parent)}};U.onpointerdown=function(ah){var ag=this.closest(".jqx-layout-group");Q._handleItemClick(this.content);U.close=false;if(!ah.target.classList.contains("jqx-close-button")){if(Z.modifiers&&Z.modifiers.indexOf("drag")>=0&&ag.modifiers.indexOf("drag")>=0){Q._beginDrag(ag,this,ah)}}else{U.close=true}}}ab.tabs=X;if(ae.position==="top"||ae.position==="left"){ab.insertBefore(X,ab.firstChild)}else{ab.appendChild(X)}}else{for(var W=0;W<ab.children.length;W++){var T=ab.children[W];if(T.hasAttribute("size")){var af=T.getAttribute("size");var V=parseFloat(af);var aa=ab.orientation==="vertical"?ab.offsetWidth:ab.offsetHeight;var ad=af.indexOf("%")>=0?parseFloat(af):parseFloat(V/aa*100);S+=ad;Y++;if(Y===ab.children.length){if(S<100){ac+="1fr ";S=100;continue}else{if(S>100){S-=ad;ad=100-S;S=100}}}else{if(S>100||ad===0){Y=ab.children.length;S=0;break}}ac+=ad+"% ";continue}ac+="1fr "}if(Y===ab.children.length){if(S<99||S>100){ac="";for(var W=0;W<ab.children.length;W++){var T=ab.children[W];T.removeAttribute("size");ac+="1fr "}}}if(ab.orientation==="vertical"){ab.style.gridTemplateColumns=ac}else{ab.style.gridTemplateRows=ac}}ab.items=Array.from(ab.children);ab.items=ab.items.filter(function(ag){return ag!==ab.tabs})};var P=Q.querySelectorAll(".jqx-layout-group");for(var O=0;O<P.length;O++){R(P[O])}}},{key:"_beginDrag",value:function A(W,S,O){var T=this;if(T._dragDetails){T._dragDetails.feedback.remove()}var P=document.createElement("div");var Q=document.createElement("div");var U=W.querySelector(".jqx-layout-tab-strip");var V="";if(U){for(var R=0;R<Array.from(U.children).length;R++){if(R===W.selectedIndex){V=U.children[R].innerText}}}P.innerHTML='<jqx-split-layout><jqx-tab-layout-group><jqx-tab-layout-item label="'.concat(V,'"></jqx-tab-layout-item></jqx-tab-layout-group></jqx-split-layout>');T._feedback=P;T._feedback.classList.add("jqx-split-layout-feedback","jqx-split-layout","jqx-widget");Q.classList.add("jqx-split-layout-overlay");T._dragDetails={element:S.content,item:S.item,layoutGroup:S.group,parent:W,overlay:Q,feedback:P,pageX:O.pageX,pageY:O.pageY}}},{key:"moveChildren",value:function v(Q,O){O.innerHTML="";var P=Q;while(P.firstChild){var R=P.firstChild;O.appendChild(R)}}},{key:"createLayoutItem",value:function d(R,O){var S=this;var P=function P(){var V=document.createElement("jqx-layout-item");V.innerHTML="";S.dispatchEvent(new CustomEvent("createItem",{type:"layoutItem",item:V}));return V};var U=function U(){var V=document.createElement("jqx-tab-layout-item");V.innerHTML="";S.dispatchEvent(new CustomEvent("createItem",{type:"tabLayoutItem",item:V}));return V};var T=function T(V){var X=document.createElement("jqx-layout-group");var W=V==="top"||V==="bottom"?"horizontal":"vertical";S.dispatchEvent(new CustomEvent("createGroup",{type:"layoutGroup",item:X}));X.setAttribute("orientation",W);X.orientation=W;return X};var Q=function Q(V){var X=document.createElement("jqx-tab-layout-group");var W=V==="top"||V==="bottom"?"horizontal":"vertical";X.setAttribute("orientation",W);X.orientation=W;S.dispatchEvent(new CustomEvent("tabLayoutGroup",{type:"layoutGroup",item:X}));return X};if(R==="layoutItem"||!R){return P()}else{if(R==="tabLayoutItem"||!R){return U()}else{if(R==="tabLayoutGroup"){return Q(O)}else{return T(O)}}}}},{key:"_addTabLayoutItem",value:function b(S,T,Q){var W=this;var U=W.createLayoutItem("tabLayoutItem");var R=S.closest("jqx-tab-layout-group");var X;if(Q){U.label=Q.label;U.modifiers=Q.modifiers;W.moveChildren(Q,U)}var Z=function Z(ab){for(var aa=0;aa<ab.children.length;aa++){var ac=ab.children[aa];ac.removeAttribute("size")}ab.removeAttribute("size")};var P=function P(aa){S.removeAttribute("size");if(S.querySelector("jqx-layout-group")){W._addLayoutItem(S.querySelector("jqx-layout-group"),aa)}else{X=W.createLayoutItem("layoutGroup",aa);var ab=W.createLayoutItem();W.moveChildren(S,ab);if(aa==="top"||aa==="left"){X.appendChild(W.createLayoutItem());X.appendChild(ab)}else{X.appendChild(ab);X.appendChild(W.createLayoutItem())}S.appendChild(X)}};var O=function O(ab,aa){var ac=S.parentElement;var ad=S;var ae=W.createLayoutItem("layoutGroup",aa);ac.insertBefore(ae,ad);if(aa==="top"||aa==="left"){ae.append(ab);ae.appendChild(ad)}else{ae.appendChild(ad);ae.append(ab)}if(ad.getAttribute("data-id")==="root"){ad.setAttribute("data-id",ae.getAttribute("data-id"));ae.setAttribute("data-id","root");W.$.itemsContainer=ae}Z(ad);Z(ac)};if(Q){switch(T){case"center":if(S instanceof TabLayoutGroup||S instanceof TabLayoutItem){R.appendChild(U)}else{var V=W.createLayoutItem("tabLayoutGroup","top");V.appendChild(U);if(S instanceof LayoutGroup&&!(S instanceof TabLayoutItem)){S.appendChild(V);Z(S)}else{if(S instanceof LayoutItem){X=W.createLayoutItem("layoutGroup");S.parentElement.insertBefore(X,S);X.appendChild(S);X.appendChild(V);Z(X)}}}break;case"left":case"right":var V=W.createLayoutItem("tabLayoutGroup","top");V.appendChild(U);if(S.getAttribute("data-id")==="root"){V.position=T;O(V,T)}else{O(V,T)}break;case"top":case"bottom":var V=W.createLayoutItem("tabLayoutGroup","top");V.appendChild(U);if(S.getAttribute("data-id")==="root"){V.position=T;O(V,T)}else{O(V,T)}break}return}switch(T){case"center":if(S instanceof TabLayoutGroup||S instanceof TabLayoutItem){R.appendChild(U)}else{P()}break;case"left":case"right":if(S instanceof TabLayoutGroup){var Y=S.querySelector("jqx-tab-layout-item");if(Y&&T==="left"){S.insertBefore(U,Y)}else{S.appendChild(U)}}else{if(S instanceof TabLayoutItem){var V=W.createLayoutItem("tabLayoutGroup","top");var R=S.parentElement;V.appendChild(U);X=W.createLayoutItem("layoutGroup");R.parentElement.insertBefore(X,R);if(T==="right"){X.appendChild(R);X.appendChild(V)}else{if(T==="left"){X.appendChild(V);X.appendChild(R)}}}else{if(Q){var V=W.createLayoutItem("tabLayoutGroup","top");V.appendChild(U);if(S instanceof LayoutGroup){S.insertBefore(S.firstChild,V)}else{if(S instanceof LayoutItem){X=W.createLayoutItem("layoutGroup");X.orientation=R.orientation;X.setAttribute("orientation",R.orientation);S.removeAttribute("size");S.parentElement.insertBefore(X,S);X.appendChild(S);X.appendChild(V)}}}else{P(T)}}}break;case"top":case"bottom":if(S instanceof TabLayoutGroup){X=W.createLayoutItem("layoutGroup","top");S.removeAttribute("size");S.parentElement.insertBefore(X,S);if(T==="top"){X.appendChild(W.createLayoutItem());X.appendChild(S)}else{X.appendChild(S);X.appendChild(W.createLayoutItem())}}else{P(T)}break}W.refresh()}},{key:"_addLayoutItem",value:function E(R,S,O){var W=this;if(!R){return}var Z=function Z(ab){for(var aa=0;aa<ab.children.length;aa++){var ac=ab.children[aa];ac.removeAttribute("size")}ab.removeAttribute("size")};var Y=R instanceof TabLayoutItem||R instanceof TabLayoutGroup||O&&O instanceof TabLayoutItem;if(Y){return W._addTabLayoutItem(R,S,O)}var U=W.createLayoutItem();var P=R.closest(".jqx-layout-group");var X;if(O){W.moveChildren(O,U)}if(S==="center"){if(R instanceof LayoutGroup){X=P;X.appendChild(U);Z(X);W.refresh();return U}else{if(R instanceof LayoutItem){X=W.createLayoutItem("layoutGroup");X.orientation=P.orientation;X.setAttribute("orientation",P.orientation);R.removeAttribute("size");R.parentElement.insertBefore(X,R);X.appendChild(R);X.appendChild(U);W.refresh();return X}}}if(P.orientation==="vertical"&&(S==="left"||S==="right")||P.orientation==="horizontal"&&(S==="top"||S==="bottom")){X=P;if(R instanceof LayoutGroup){if(S==="left"||S==="top"){X.insertBefore(U,X.children[0])}else{X.appendChild(U)}Z(R)}else{var T=X.items,Q=Math.max(0,T.indexOf(R)+(S==="top"||S==="left"?0:1));X.insertBefore(U,T[Q]);Z(X)}}else{if(R instanceof LayoutGroup){var P=R.parentElement;X=R;var V=W.createLayoutItem("layoutGroup",S);P.insertBefore(V,X);if(S==="top"||S==="left"){V.append(U);V.appendChild(X)}else{V.appendChild(X);V.append(U)}if(X.getAttribute("data-id")==="root"){X.setAttribute("data-id",V.getAttribute("data-id"));V.setAttribute("data-id","root");W.$.itemsContainer=V}Z(P)}else{X=W.createLayoutItem("layoutGroup",S);P.insertBefore(X,R);if(S==="top"||S==="left"){X.appendChild(U);X.appendChild(R)}else{X.appendChild(R);X.appendChild(U)}Z(X)}}W.refresh();return U}},{key:"_handleButtonsVisibility",value:function a(T){var S=this;if(!S._buttons){S._buttons=document.createElement("div");S._buttons.classList.add("jqx-layout-buttons-container");S._buttons.innerHTML='<div role="button" position="top"></div>\n <div role="button" position="bottom"></div>\n <div role="button" position="center"></div>\n <div role="button" position="left"></div>\n <div role="button" position="right"></div>'}if(!T){if(S._buttons.parentElement){S._buttons.parentElement.removeChild(S._buttons);return}}if(T){var Q=T._buttonPosition||[],R=S._buttons.children;for(var O=0;O<R.length;O++){var P=R[O];P.position=P.getAttribute("position");P.item=T;Q.length&&Q.indexOf(P.getAttribute("position"))<0?P.classList.add("jqx-hidden"):P.classList.remove("jqx-hidden");P.onmouseenter=function(){P.setAttribute("hover","")};P.onmouseleave=function(){P.removeAttribute("hover")}}if(S.allowLiveSplit&&S._buttons.parentElement!==T){T.appendChild(S._buttons)}}}},{key:"_handleDropArea",value:function f(R){var O=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"center";var Q=this;var P=function P(T){var S=50;switch(T){case"left":Q._dropArea.style.top="0px";Q._dropArea.style.left="0px";Q._dropArea.style.width=S+"%";Q._dropArea.style.height="100%";break;case"right":Q._dropArea.style.top="0px";Q._dropArea.style.left="calc(100% - ".concat(S,"%)");Q._dropArea.style.width=S+"%";Q._dropArea.style.height="100%";break;case"top":Q._dropArea.style.top="0px";Q._dropArea.style.left="0px";Q._dropArea.style.width="100%";Q._dropArea.style.height=S+"%";break;case"bottom":Q._dropArea.style.top="calc(100% - ".concat(S,"%)");Q._dropArea.style.left="0px";Q._dropArea.style.width="100%";Q._dropArea.style.height=S+"%";break;case"center":Q._dropArea.style.top="0px";Q._dropArea.style.left="0px";Q._dropArea.style.width="100%";Q._dropArea.style.height="100%";break}};if(Q._dropArea&&Q._dropArea.parentElement===R){P(O);return}if(Q._dropArea){Q._dropArea.remove()}if(!Q._dragDetails||!R){return}Q._dropArea=document.createElement("div");Q._dropArea.classList.add("jqx-layout-drop-area");R.appendChild(Q._dropArea);Q._dropArea.style.opacity=1;P(O)}},{key:"_handleSplitter",value:function m(R){var Q=this;if(!R){return}if(R.hasAttribute("tab")){R=R.parentElement}if(R._splitter){R._splitter.remove()}if(!R._splitter){R._splitter=document.createElement("div")}if(Q._dragDetails&&Q._dragDetails.dragging){R._splitter.remove();return}if(R.modifiers.indexOf("resize")===-1){return}R.appendChild(R._splitter);var P=R.parentElement;if(P){R._splitter.className="jqx-layout-splitter";R._splitter.item=R;R._splitter.removeAttribute("drag");var O=P.orientation;if(R.nextElementSibling&&R.nextElementSibling.hasAttribute("data-id")){R._splitter.classList.add(O)}else{if(R.previousElementSibling&&R.previousElementSibling.hasAttribute("data-id")){R._splitter.classList.add(O);R._splitter.classList.add("last")}}var S=function S(T){T.style.top="";T.style.left="";T.style.bottom="";T.style.right="";T.onpointerdown=function(V){var U=V.target.item;U.style.overflow="hidden";Q._resizeDetails={splitter:V.target,splitterRect:V.target.getBoundingClientRect(),itemRect:U.getBoundingClientRect(),item:U,itemSize:U.size,group:U.parentElement,clientX:V.clientX,clientY:V.clientY};if(Q._selectedItem!==U){Q.querySelectorAll("[data-id]").forEach(function(W){W.removeAttribute("selected")});Q.selectedIndex=U.getAttribute("index");U.setAttribute("selected","");Q._selectedItem=U;Q._handleButtonsVisibility(U)}if(U.previousElementSibling&&U.previousElementSibling.hasAttribute("data-id")){Q._resizeDetails.previousItemRect=U.previousElementSibling.getBoundingClientRect();Q._resizeDetails.previousItem=U.previousElementSibling;Q._resizeDetails.previousItemSize=U.previousElementSibling.size;Q._resizeDetails.previousItem.style.overflow="hidden"}else{Q._resizeDetails.previousItemRect=null;Q._resizeDetails.previousItem=null}if(U.nextElementSibling&&U.nextElementSibling.hasAttribute("data-id")){Q._resizeDetails.nextItemRect=U.nextElementSibling.getBoundingClientRect();Q._resizeDetails.nextItem=U.nextElementSibling;Q._resizeDetails.nextItemSize=U.nextElementSibling.size;Q._resizeDetails.nextItem.style.overflow="hidden"}else{Q._resizeDetails.nextItemRect=null;Q._resizeDetails.nextItem=null}}};S(R._splitter)}}}]);return i}(_wrapNativeSuper(HTMLElement));customElements.define("jqx-layout-group",LayoutGroup);customElements.define("jqx-layout-item",LayoutItem);customElements.define("jqx-tab-layout-group",TabLayoutGroup);customElements.define("jqx-tab-layout-item",TabLayoutItem);customElements.define("jqx-split-layout",SplitLayout);
|
|
25
9
|
|
|
26
|
-
return isMobile;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
class LayoutItem extends HTMLElement {
|
|
35
|
-
constructor() {
|
|
36
|
-
super();
|
|
37
|
-
|
|
38
|
-
this._properties = {
|
|
39
|
-
'min': 50,
|
|
40
|
-
'label': 'Item',
|
|
41
|
-
'modifiers': ['resize', 'drag', 'close'],
|
|
42
|
-
'size': null
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
_setProperty(property, value) {
|
|
47
|
-
var that = this;
|
|
48
|
-
|
|
49
|
-
if (that._properties[property] === value) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
that._properties[property] = value;
|
|
54
|
-
that._updating = true;
|
|
55
|
-
|
|
56
|
-
if (property === 'disabled' || property === 'modifiers') {
|
|
57
|
-
if (value) {
|
|
58
|
-
that.setAttribute(property, value);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
that.removeAttribute(property);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
if (value === null) {
|
|
66
|
-
that.removeAttribute(property);
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
that.setAttribute(property, value);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (!that.isCompleted) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
var layout = that.closest('jqx-layout');
|
|
78
|
-
|
|
79
|
-
if (layout) {
|
|
80
|
-
if (!layout._resizeDetails && !layout._updating && layout.isRendered) {
|
|
81
|
-
layout.refresh();
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
that._updating = false;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
get label() {
|
|
88
|
-
return this._properties['label'];
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
set label(value) {
|
|
92
|
-
this._setProperty('label', value);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
get modifiers() {
|
|
96
|
-
return this._properties['modifiers'];
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
set modifiers(value) {
|
|
100
|
-
this._setProperty('modifiers', value);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
get min() {
|
|
104
|
-
return this._properties['min'];
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
set min(value) {
|
|
108
|
-
this._setProperty('min', value);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
get size() {
|
|
112
|
-
return this._properties['size'];
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
set size(value) {
|
|
116
|
-
if (value !== null) {
|
|
117
|
-
if (typeof value === 'string') {
|
|
118
|
-
this._setProperty('size', value);
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
this._setProperty('size', Math.max(this.min, value));
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
this._setProperty('size', value);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
static get observedAttributes() {
|
|
130
|
-
return ['min', 'size', 'label', 'modifiers'];
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
135
|
-
var that = this;
|
|
136
|
-
|
|
137
|
-
if (oldValue === newValue) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (!that.isCompleted) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (name === 'size') {
|
|
146
|
-
if (!that._updating) {
|
|
147
|
-
if (newValue === null) {
|
|
148
|
-
this[name] = null;
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
that[name] = Math.max(that.min, parseInt(newValue));
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
that[name] = newValue;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
connectedCallback() {
|
|
161
|
-
if (!this.isCompleted) {
|
|
162
|
-
this.render();
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
whenRendered(callback) {
|
|
167
|
-
var that = this;
|
|
168
|
-
|
|
169
|
-
if (that.isRendered) {
|
|
170
|
-
callback();
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
if (!that.whenRenderedCallbacks) {
|
|
175
|
-
that.whenRenderedCallbacks = [];
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
that.whenRenderedCallbacks.push(callback);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
render() {
|
|
182
|
-
var that = this;
|
|
183
|
-
|
|
184
|
-
if (!that.hasAttribute('data-id')) {
|
|
185
|
-
that.setAttribute('data-id', 'id' + Math.random().toString(16).slice(2));
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (!that.hasAttribute('label')) {
|
|
189
|
-
that.setAttribute('label', that.label);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
if (!that.hasAttribute('min')) {
|
|
193
|
-
that.setAttribute('min', that.min);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
if (!that.hasAttribute('label')) {
|
|
197
|
-
that.setAttribute('label', that.label);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
if (!that.hasAttribute('modifiers')) {
|
|
201
|
-
that.setAttribute('modifiers', that.modifiers);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
for (var i = 0; i < that.attributes.length; i++) {
|
|
205
|
-
var attribute = that.attributes[i];
|
|
206
|
-
var attributeName = attribute.name;
|
|
207
|
-
var attributeValue = attribute.value;
|
|
208
|
-
|
|
209
|
-
if (!isNaN(attributeValue) && (attributeName === 'min' || attributeName === 'size')) {
|
|
210
|
-
that._properties[attributeName] = parseInt(attributeValue);
|
|
211
|
-
continue;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
that._properties[attributeName] = attributeValue;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
that.classList.add('jqx-layout-item');
|
|
218
|
-
|
|
219
|
-
that.isCompleted = true;
|
|
220
|
-
|
|
221
|
-
if (that.whenRenderedCallbacks) {
|
|
222
|
-
for (var i = 0; i < that.whenRenderedCallbacks.length; i++) {
|
|
223
|
-
that.whenRenderedCallbacks[i]();
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
that.whenRenderedCallbacks = [];
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
class LayoutGroup extends LayoutItem {
|
|
232
|
-
constructor() {
|
|
233
|
-
super();
|
|
234
|
-
|
|
235
|
-
this._properties['label'] = 'Group';
|
|
236
|
-
this._properties['orientation'] = 'vertical'
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
get orientation() {
|
|
240
|
-
return this._properties.orientation;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
set orientation(value) {
|
|
244
|
-
this._setProperty('orientation', value);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
static get observedAttributes() {
|
|
248
|
-
return ['min', 'size', 'modifiers', 'orientation', 'position'];
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
render() {
|
|
252
|
-
var that = this;
|
|
253
|
-
|
|
254
|
-
super.render();
|
|
255
|
-
|
|
256
|
-
that.className = 'jqx-layout-group';
|
|
257
|
-
|
|
258
|
-
if (!that.hasAttribute('orientation')) {
|
|
259
|
-
that.setAttribute('orientation', that._properties['orientation']);
|
|
260
|
-
}
|
|
261
|
-
else {
|
|
262
|
-
that._properties['orientation'] = that.getAttribute('orientation');
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
class TabLayoutGroup extends LayoutGroup {
|
|
268
|
-
constructor() {
|
|
269
|
-
super();
|
|
270
|
-
this._properties['position'] = 'top'
|
|
271
|
-
this._properties['label'] = 'TabGroup';
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
get position() {
|
|
275
|
-
return this._properties.position;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
set position(value) {
|
|
279
|
-
this._setProperty('position', value);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
render() {
|
|
283
|
-
var that = this;
|
|
284
|
-
|
|
285
|
-
super.render();
|
|
286
|
-
|
|
287
|
-
if (!that.hasAttribute('position') && that.position) {
|
|
288
|
-
that.setAttribute('position', 'top');
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
static get observedAttributes() {
|
|
293
|
-
return ['min', 'size', 'modifiers', 'orientation', 'position'];
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
class TabLayoutItem extends LayoutGroup {
|
|
298
|
-
constructor() {
|
|
299
|
-
super();
|
|
300
|
-
this._properties['label'] = 'TabItem';
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
(function ($) {
|
|
306
|
-
"use strict";
|
|
307
|
-
$.jqx.jqxWidget("jqxSplitLayout", "", {});
|
|
308
|
-
|
|
309
|
-
$.extend($.jqx._jqxSplitLayout.prototype, {
|
|
310
|
-
defineInstance: function () {
|
|
311
|
-
var settings = {
|
|
312
|
-
'dataSource': null,
|
|
313
|
-
'ready': null,
|
|
314
|
-
'orientation': 'vertical'
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
if (this === $.jqx._jqxSplitLayout.prototype) {
|
|
318
|
-
return settings;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
$.extend(true, this, settings);
|
|
322
|
-
return settings;
|
|
323
|
-
},
|
|
324
|
-
|
|
325
|
-
createInstance: function () {
|
|
326
|
-
var that = this;
|
|
327
|
-
this._properties = {
|
|
328
|
-
'dataSource': null,
|
|
329
|
-
'ready': null,
|
|
330
|
-
'orientation': 'vertical'
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
var that = this;
|
|
334
|
-
|
|
335
|
-
that.layout = document.createElement('jqx-split-layout');
|
|
336
|
-
that.layout.style.width = '100%';
|
|
337
|
-
that.layout.style.height = '100%';
|
|
338
|
-
that.element.className += that.toThemeProperty("jqx-split-layout-component jqx-rc-all jqx-widget");
|
|
339
|
-
that.layout.dataSource = that.dataSource;
|
|
340
|
-
that.layout.orientation = that.orientation;
|
|
341
|
-
that.layout.ready = that.ready;
|
|
342
|
-
that.element.appendChild(that.layout);
|
|
343
|
-
},
|
|
344
|
-
|
|
345
|
-
propertyChangedHandler: function (object, key, oldValue, value) {
|
|
346
|
-
var that = object;
|
|
347
|
-
|
|
348
|
-
if (oldValue != value || value instanceof Object) {
|
|
349
|
-
if (!that.layout) {
|
|
350
|
-
return;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
that.layout[key] = value;
|
|
354
|
-
}
|
|
355
|
-
},
|
|
356
|
-
|
|
357
|
-
render: function () {
|
|
358
|
-
var that = this;
|
|
359
|
-
|
|
360
|
-
if (!that.layout) {
|
|
361
|
-
return;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
that.layout.render();
|
|
365
|
-
},
|
|
366
|
-
|
|
367
|
-
refresh() {
|
|
368
|
-
var that = this;
|
|
369
|
-
|
|
370
|
-
if (!that.layout) {
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
if (!that.layout.isRendered) {
|
|
375
|
-
return;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
that.layout.refresh();
|
|
379
|
-
},
|
|
380
|
-
|
|
381
|
-
dataBind() {
|
|
382
|
-
var that = this;
|
|
383
|
-
|
|
384
|
-
if (!that.layout) {
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
that.layout.dataBind();
|
|
389
|
-
}
|
|
390
|
-
});
|
|
391
|
-
})(jqxBaseFramework);
|
|
392
|
-
|
|
393
|
-
class SplitLayout extends HTMLElement {
|
|
394
|
-
constructor() {
|
|
395
|
-
super();
|
|
396
|
-
|
|
397
|
-
this._properties = {
|
|
398
|
-
'dataSource': null,
|
|
399
|
-
'orientation': 'vertical'
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
get orientation() {
|
|
405
|
-
return this._properties['orientation'];
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
set orientation(value) {
|
|
409
|
-
this._properties['orientation'] = value;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
get dataSource() {
|
|
413
|
-
return this._properties['dataSource'];
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
set dataSource(value) {
|
|
417
|
-
this._properties['dataSource'] = value;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
_dragStart(event) {
|
|
422
|
-
event.stopPropagation();
|
|
423
|
-
event.preventDefault();
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
_leaveHandler() {
|
|
427
|
-
var that = this;
|
|
428
|
-
|
|
429
|
-
if (that._resizeDetails) {
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
that._handleButtonsVisibility(null);
|
|
434
|
-
that._hideSplitter();
|
|
435
|
-
|
|
436
|
-
requestAnimationFrame(function () {
|
|
437
|
-
// that.classList.remove('outline');
|
|
438
|
-
})
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
_enterHandler() {
|
|
442
|
-
var that = this;
|
|
443
|
-
|
|
444
|
-
if (that._resizeDetails) {
|
|
445
|
-
return;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
that._handleButtonsVisibility(that._selectedItem);
|
|
449
|
-
|
|
450
|
-
that._updateSplitter();
|
|
451
|
-
|
|
452
|
-
requestAnimationFrame(function () {
|
|
453
|
-
that.classList.add('outline');
|
|
454
|
-
})
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
* Element's HTML template.
|
|
459
|
-
*/
|
|
460
|
-
template() {
|
|
461
|
-
return '<div class="jqx-container" id="container" role="presentation"><jqx-layout-group data-id="root" id="itemsContainer"></jqx-layout-group><div root-splitter id="splitter" class="jqx-layout-splitter"></div>';
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
/**
|
|
465
|
-
* Updates the element when a property is changed.
|
|
466
|
-
* @param {string} propertyName The name of the property.
|
|
467
|
-
* @param {number/string} oldValue The previously entered value. Max, min and value are of type Number. The rest are of type String.
|
|
468
|
-
* @param {number/string} newValue The new entered value. Max, min and value are of type Number. The rest are of type String.
|
|
469
|
-
*/
|
|
470
|
-
propertyChangedHandler(propertyName, oldValue, newValue) {
|
|
471
|
-
var that = this;
|
|
472
|
-
|
|
473
|
-
switch (propertyName) {
|
|
474
|
-
case 'orientation':
|
|
475
|
-
if (that.$.itemsContainer) {
|
|
476
|
-
that.$.itemsContainer.orientation = that.orientation;
|
|
477
|
-
}
|
|
478
|
-
break;
|
|
479
|
-
case 'dataSource':
|
|
480
|
-
that.dataBind();
|
|
481
|
-
break;
|
|
482
|
-
case 'selectedIndex':
|
|
483
|
-
that._handleItemClick(that.getItem(newValue + ''), true);
|
|
484
|
-
break;
|
|
485
|
-
default:
|
|
486
|
-
super.propertyChangedHandler(propertyName, oldValue, newValue);
|
|
487
|
-
break;
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
dataBind() {
|
|
492
|
-
var that = this;
|
|
493
|
-
|
|
494
|
-
that.$.itemsContainer.innerHTML = '';
|
|
495
|
-
|
|
496
|
-
var template = '';
|
|
497
|
-
var processDataSource = function (dataSource, isTabLayoutGroup) {
|
|
498
|
-
for (var i = 0; i < dataSource.length; i++) {
|
|
499
|
-
var item = dataSource[i];
|
|
500
|
-
|
|
501
|
-
var size = item.size;
|
|
502
|
-
var min = item.min;
|
|
503
|
-
var modifiers = item.modifiers;
|
|
504
|
-
var type = item.type;
|
|
505
|
-
var position = item.position;
|
|
506
|
-
var orientation = item.orientation ? item.orientation : 'vertical';
|
|
507
|
-
var id = item.id;
|
|
508
|
-
var label = item.label;
|
|
509
|
-
|
|
510
|
-
var props = '';
|
|
511
|
-
|
|
512
|
-
if (id !== undefined) {
|
|
513
|
-
props += `id="${id}" `
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
if (size !== undefined) {
|
|
517
|
-
props += `size="${size}" `
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
if (label !== undefined) {
|
|
521
|
-
props += `label="${label}" `
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
if (min !== undefined) {
|
|
526
|
-
props += `min="${min}" `
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
if (modifiers !== undefined) {
|
|
530
|
-
props += `modifiers="${modifiers}" `
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
if (position !== undefined) {
|
|
534
|
-
props += `position="${position}" `
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
if (item.items) {
|
|
538
|
-
props += `orientation=${orientation} `
|
|
539
|
-
|
|
540
|
-
if (type === 'tabs') {
|
|
541
|
-
template += `<jqx-tab-layout-group ${props}>`;
|
|
542
|
-
processDataSource(item.items, true);
|
|
543
|
-
template += '</jqx-tab-layout-group>'
|
|
544
|
-
}
|
|
545
|
-
else {
|
|
546
|
-
template += `<jqx-layout-group ${props}>`;
|
|
547
|
-
processDataSource(item.items);
|
|
548
|
-
template += '</jqx-layout-group>'
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
else {
|
|
552
|
-
var content = item.content || '';
|
|
553
|
-
if (isTabLayoutGroup) {
|
|
554
|
-
template += `<jqx-tab-layout-item ${props}>` + content + '</jqx-tab-layout-item>';
|
|
555
|
-
}
|
|
556
|
-
else {
|
|
557
|
-
if (type === 'tabs') {
|
|
558
|
-
template += `<jqx-tab-layout-group>`;
|
|
559
|
-
template += `<jqx-tab-layout-item ${props}>` + content + '</jqx-tab-layout-item>';
|
|
560
|
-
template += '</jqx-tab-layout-group>'
|
|
561
|
-
}
|
|
562
|
-
else {
|
|
563
|
-
template += `<jqx-layout-item ${props}>` + content + '</jqx-layout-item>';
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
processDataSource(that.dataSource);
|
|
571
|
-
that.$.itemsContainer.innerHTML = template;
|
|
572
|
-
that.refresh();
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
/**
|
|
577
|
-
* Element's render funciton
|
|
578
|
-
*/
|
|
579
|
-
render() {
|
|
580
|
-
var that = this;
|
|
581
|
-
|
|
582
|
-
that.setAttribute('role', 'group');
|
|
583
|
-
|
|
584
|
-
if (that.selectedIndex) {
|
|
585
|
-
that._handleItemClick(that.getItem(that.selectedIndex + ''), true);
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
var render = (function () {
|
|
590
|
-
if (!that.dataSource) {
|
|
591
|
-
that.dataSource = that._getDataSource(that._getLayout());
|
|
592
|
-
}
|
|
593
|
-
else {
|
|
594
|
-
that.dataBind();
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
that.$.itemsContainer.orientation = that.orientation;
|
|
598
|
-
|
|
599
|
-
that.refresh();
|
|
600
|
-
that._updateSplitter();
|
|
601
|
-
that.isRendered = true;
|
|
602
|
-
that.classList.add('outline');
|
|
603
|
-
|
|
604
|
-
if (that.ready) {
|
|
605
|
-
that.ready();
|
|
606
|
-
}
|
|
607
|
-
})
|
|
608
|
-
|
|
609
|
-
if (document.readyState === 'complete') {
|
|
610
|
-
render();
|
|
611
|
-
}
|
|
612
|
-
else {
|
|
613
|
-
window.addEventListener('load', (function () {
|
|
614
|
-
render();
|
|
615
|
-
}));
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
connectedCallback() {
|
|
620
|
-
var that = this;
|
|
621
|
-
|
|
622
|
-
var setup = function () {
|
|
623
|
-
var fragment = document.createDocumentFragment();
|
|
624
|
-
|
|
625
|
-
while (that.childNodes.length) {
|
|
626
|
-
fragment.appendChild(that.firstChild);
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
that.innerHTML = that.template();
|
|
630
|
-
that.classList.add('jqx-widget');
|
|
631
|
-
that.$ = {
|
|
632
|
-
container: that.querySelector("#container"),
|
|
633
|
-
itemsContainer: that.querySelector("#itemsContainer"),
|
|
634
|
-
splitter: that.querySelector("#splitter")
|
|
635
|
-
};
|
|
636
|
-
|
|
637
|
-
delete that.$.container.id;
|
|
638
|
-
delete that.$.itemsContainer.id;
|
|
639
|
-
delete that.$.splitter.id;
|
|
640
|
-
|
|
641
|
-
that.$.itemsContainer.appendChild(fragment);
|
|
642
|
-
that.classList.add('jqx-split-layout');
|
|
643
|
-
|
|
644
|
-
document.addEventListener('pointerdown', function (event) {
|
|
645
|
-
that._documentDownHandler(event);
|
|
646
|
-
});
|
|
647
|
-
|
|
648
|
-
document.addEventListener('pointermove', function (event) {
|
|
649
|
-
that._documentMoveHandler(event);
|
|
650
|
-
});
|
|
651
|
-
|
|
652
|
-
document.addEventListener('pointerup', function (event) {
|
|
653
|
-
that._documentUpHandler(event);
|
|
654
|
-
});
|
|
655
|
-
|
|
656
|
-
document.addEventListener('selectstart', function (event) {
|
|
657
|
-
that._documentSelectStartHandler(event);
|
|
658
|
-
});
|
|
659
|
-
|
|
660
|
-
document.addEventListener('keyup', function (event) {
|
|
661
|
-
that._keyUpHandler(event);
|
|
662
|
-
});
|
|
663
|
-
|
|
664
|
-
that.addEventListener('mouseleave', function (event) {
|
|
665
|
-
that._leaveHandler(event);
|
|
666
|
-
});
|
|
667
|
-
|
|
668
|
-
that.addEventListener('mouseenter', function (event) {
|
|
669
|
-
that._enterHandler(event);
|
|
670
|
-
});
|
|
671
|
-
|
|
672
|
-
that.addEventListener('dragStart', function (event) {
|
|
673
|
-
that._dragStart(event);
|
|
674
|
-
});
|
|
675
|
-
|
|
676
|
-
that.render();
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
if (document.readyState === 'complete') {
|
|
680
|
-
setup();
|
|
681
|
-
}
|
|
682
|
-
else {
|
|
683
|
-
window.addEventListener('load', function () {
|
|
684
|
-
setup();
|
|
685
|
-
});
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
/**
|
|
690
|
-
* Returns the Splitter item according to the index
|
|
691
|
-
* @param {any} index - string, e.g. '0.1'
|
|
692
|
-
*/
|
|
693
|
-
getItem(index) {
|
|
694
|
-
var that = this;
|
|
695
|
-
|
|
696
|
-
if (index === undefined || index === null) {
|
|
697
|
-
return;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
index = (index + '').split('.');
|
|
701
|
-
|
|
702
|
-
var items = that._getDataSource(that._getLayout()),
|
|
703
|
-
item;
|
|
704
|
-
|
|
705
|
-
for (var i = 0; i < index.length; i++) {
|
|
706
|
-
item = items[index[i]];
|
|
707
|
-
|
|
708
|
-
if (!item) {
|
|
709
|
-
break;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
items = item.items;
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
return item;
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
/**
|
|
720
|
-
* Document down handler
|
|
721
|
-
* @param {any} event
|
|
722
|
-
*/
|
|
723
|
-
_documentDownHandler(event) {
|
|
724
|
-
var that = this,
|
|
725
|
-
target = event.target;
|
|
726
|
-
|
|
727
|
-
if (that.contains(target) && target.closest) {
|
|
728
|
-
that._target = target;
|
|
729
|
-
that._updateSplitter();
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
/**
|
|
734
|
-
* Document move handler
|
|
735
|
-
* @param {any} event
|
|
736
|
-
*/
|
|
737
|
-
_documentMoveHandler(event) {
|
|
738
|
-
var that = this,
|
|
739
|
-
target = event.target,
|
|
740
|
-
menu = that._contextMenu;
|
|
741
|
-
|
|
742
|
-
if (menu && !JQX.Utilities.Core.isMobile) {
|
|
743
|
-
if (menu.querySelector('.jqx-layout-context-menu-item[hover]')) {
|
|
744
|
-
var items = menu.children;
|
|
745
|
-
|
|
746
|
-
for (var i = 0; i < items.length; i++) {
|
|
747
|
-
items[i].removeAttribute('hover');
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
if (menu.contains(target) && target.closest && target.closest('.jqx-layout-context-menu-item')) {
|
|
752
|
-
target.setAttribute('hover', '');
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
if (that._dragDetails) {
|
|
757
|
-
var offsetX = Math.abs(that._dragDetails.pageX - event.pageX);
|
|
758
|
-
var offsetY = Math.abs(that._dragDetails.pageY - event.pageY);
|
|
759
|
-
|
|
760
|
-
if (offsetY <= 5 && offsetX <= 5) {
|
|
761
|
-
return;
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
if (!that._dragDetails.feedback.parentElement) {
|
|
765
|
-
document.body.appendChild(that._dragDetails.feedback);
|
|
766
|
-
document.body.appendChild(that._dragDetails.overlay)
|
|
767
|
-
setTimeout(function () {
|
|
768
|
-
that._dragDetails.feedback.classList.add('dragging');
|
|
769
|
-
}, 100);
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
that._dragDetails.dragging = true;
|
|
773
|
-
|
|
774
|
-
that._dragDetails.feedback.style.left = event.pageX - that._dragDetails.feedback.offsetWidth / 2 - 5 + 'px';
|
|
775
|
-
that._dragDetails.feedback.style.top = event.pageY - that._dragDetails.feedback.offsetHeight / 2 - 5 + 'px';
|
|
776
|
-
|
|
777
|
-
var elements = document.elementsFromPoint(event.pageX, event.pageY);
|
|
778
|
-
var group = null;
|
|
779
|
-
var isTabStrip = false;
|
|
780
|
-
|
|
781
|
-
for (var i = 0; i < elements.length; i++) {
|
|
782
|
-
var element = elements[i];
|
|
783
|
-
|
|
784
|
-
if (that._dragDetails.feedback.contains(element)) {
|
|
785
|
-
continue;
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
if (element.classList.contains('jqx-layout-tab-strip')) {
|
|
789
|
-
if (that._dragDetails.element.contains(element)) {
|
|
790
|
-
continue;
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
group = element.parentElement;
|
|
794
|
-
isTabStrip = true;
|
|
795
|
-
break;
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
if ((element.parentElement === that._dragDetails.parent || element === that._dragDetails.parent) && that._dragDetails.layoutGroup.items.length === 1) {
|
|
799
|
-
continue;
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
if (that._dragDetails.element.contains(element)) {
|
|
803
|
-
continue;
|
|
804
|
-
}
|
|
805
|
-
|
|
806
|
-
if (element instanceof TabLayoutItem) {
|
|
807
|
-
group = element.parentElement;
|
|
808
|
-
break;
|
|
809
|
-
}
|
|
810
|
-
else if (element instanceof TabLayoutGroup) {
|
|
811
|
-
group = element;
|
|
812
|
-
break;
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
var getPosition = function (group, size) {
|
|
817
|
-
var offset = that.offset(group);
|
|
818
|
-
var position = null;
|
|
819
|
-
var edgeSize = 50;
|
|
820
|
-
|
|
821
|
-
var height = size;
|
|
822
|
-
var width = size;
|
|
823
|
-
|
|
824
|
-
if (!size) {
|
|
825
|
-
width = group.offsetWidth / 3;
|
|
826
|
-
height = group.offsetHeight / 3;
|
|
827
|
-
}
|
|
828
|
-
else {
|
|
829
|
-
edgeSize = 0;
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
var positionRects = [
|
|
833
|
-
{
|
|
834
|
-
left: offset.left,
|
|
835
|
-
top: offset.top,
|
|
836
|
-
right: offset.left + edgeSize,
|
|
837
|
-
bottom: offset.top + edgeSize,
|
|
838
|
-
position: 'top'
|
|
839
|
-
},
|
|
840
|
-
{
|
|
841
|
-
left: offset.left + edgeSize,
|
|
842
|
-
top: offset.top,
|
|
843
|
-
right: offset.left + group.offsetWidth - edgeSize,
|
|
844
|
-
bottom: offset.top + height - edgeSize,
|
|
845
|
-
position: 'top'
|
|
846
|
-
},
|
|
847
|
-
{
|
|
848
|
-
left: offset.left + group.offsetWidth - edgeSize,
|
|
849
|
-
top: offset.top,
|
|
850
|
-
right: offset.left + group.offsetWidth,
|
|
851
|
-
bottom: offset.top + edgeSize,
|
|
852
|
-
position: 'top'
|
|
853
|
-
},
|
|
854
|
-
{
|
|
855
|
-
left: offset.left,
|
|
856
|
-
top: offset.top + edgeSize,
|
|
857
|
-
right: offset.left + width,
|
|
858
|
-
bottom: offset.top + group.offsetHeight - edgeSize,
|
|
859
|
-
position: 'left'
|
|
860
|
-
},
|
|
861
|
-
{
|
|
862
|
-
left: offset.left + group.offsetWidth - width,
|
|
863
|
-
top: offset.top + edgeSize,
|
|
864
|
-
right: offset.left + group.offsetWidth,
|
|
865
|
-
bottom: offset.top + group.offsetHeight - edgeSize,
|
|
866
|
-
position: 'right'
|
|
867
|
-
},
|
|
868
|
-
{
|
|
869
|
-
left: offset.left,
|
|
870
|
-
top: offset.top + group.offsetHeight - edgeSize,
|
|
871
|
-
right: offset.left + edgeSize,
|
|
872
|
-
bottom: offset.top + group.offsetHeight,
|
|
873
|
-
position: 'bottom'
|
|
874
|
-
},
|
|
875
|
-
{
|
|
876
|
-
left: offset.left + edgeSize,
|
|
877
|
-
top: offset.top + group.offsetHeight - height + edgeSize,
|
|
878
|
-
right: offset.left + group.offsetWidth - edgeSize,
|
|
879
|
-
bottom: offset.top + group.offsetHeight,
|
|
880
|
-
position: 'bottom'
|
|
881
|
-
},
|
|
882
|
-
{
|
|
883
|
-
left: offset.left + group.offsetWidth - edgeSize,
|
|
884
|
-
top: offset.top + group.offsetHeight - edgeSize,
|
|
885
|
-
right: offset.left + group.offsetWidth,
|
|
886
|
-
bottom: offset.top + group.offsetHeight,
|
|
887
|
-
position: 'bottom'
|
|
888
|
-
},
|
|
889
|
-
]
|
|
890
|
-
|
|
891
|
-
for (var i = 0; i < positionRects.length; i++) {
|
|
892
|
-
var rect = positionRects[i];
|
|
893
|
-
|
|
894
|
-
if (rect.left <= event.pageX && event.pageX <= rect.right) {
|
|
895
|
-
if (rect.top <= event.pageY && event.pageY <= rect.bottom) {
|
|
896
|
-
position = rect.position;
|
|
897
|
-
break;
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
return position;
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
var rootGroup = that.querySelector('jqx-layout-group');
|
|
906
|
-
|
|
907
|
-
var position = getPosition(rootGroup, 10);
|
|
908
|
-
var currentGroup = null;
|
|
909
|
-
|
|
910
|
-
if (!position) {
|
|
911
|
-
if (!group) {
|
|
912
|
-
that._handleDropArea(null);
|
|
913
|
-
}
|
|
914
|
-
else {
|
|
915
|
-
if (isTabStrip) {
|
|
916
|
-
if (group !== that._dragDetails.parent) {
|
|
917
|
-
position = 'center';
|
|
918
|
-
currentGroup = group;
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
else {
|
|
922
|
-
position = getPosition(group) || 'center';
|
|
923
|
-
currentGroup = group
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
else {
|
|
928
|
-
currentGroup = rootGroup;
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
if (currentGroup) {
|
|
932
|
-
that._dragDetails.current = currentGroup;
|
|
933
|
-
that._dragDetails.position = position;
|
|
934
|
-
that._handleDropArea(currentGroup, position);
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
if (that._resizeDetails) {
|
|
939
|
-
var offsetX = Math.abs(that._resizeDetails.clientX - event.clientX);
|
|
940
|
-
var offsetY = Math.abs(that._resizeDetails.clientY - event.clientY);
|
|
941
|
-
|
|
942
|
-
var splitter = that._resizeDetails.splitter;
|
|
943
|
-
var item = that._resizeDetails.item;
|
|
944
|
-
var itemRect = that._resizeDetails.itemRect;
|
|
945
|
-
var previousItemRect = that._resizeDetails.previousItemRect;
|
|
946
|
-
var previousItem = that._resizeDetails.previousItem;
|
|
947
|
-
var nextItemRect = that._resizeDetails.nextItemRect;
|
|
948
|
-
var nextItem = that._resizeDetails.nextItem;
|
|
949
|
-
var minSize = parseInt(item.getAttribute('min'));
|
|
950
|
-
|
|
951
|
-
var resetSplitter = function (splitter) {
|
|
952
|
-
if (splitter.classList.contains('jqx-visibility-hidden')) {
|
|
953
|
-
return;
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
splitter.style.right = '';
|
|
957
|
-
splitter.style.top = '';
|
|
958
|
-
splitter.style.left = '';
|
|
959
|
-
splitter.style.bottom = '';
|
|
960
|
-
}
|
|
961
|
-
|
|
962
|
-
resetSplitter(splitter);
|
|
963
|
-
resetSplitter(that.$.splitter);
|
|
964
|
-
|
|
965
|
-
splitter.classList.remove('error');
|
|
966
|
-
splitter.classList.add('active');
|
|
967
|
-
|
|
968
|
-
if (!that._resizeDetails.dragging) {
|
|
969
|
-
if (splitter.classList.contains('horizontal') && offsetY <= 5) {
|
|
970
|
-
return;
|
|
971
|
-
}
|
|
972
|
-
else if (splitter.classList.contains('vertical') && offsetX <= 5) {
|
|
973
|
-
return;
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
that._resizeDetails.dragging = true;
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
var normalized = {
|
|
980
|
-
'clientPos': 'clientX',
|
|
981
|
-
'pos': 'x',
|
|
982
|
-
'size': 'width',
|
|
983
|
-
'near': 'left',
|
|
984
|
-
'far': 'right',
|
|
985
|
-
'offsetSize': 'offsetWidth'
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
if (splitter.classList.contains('horizontal')) {
|
|
989
|
-
normalized = {
|
|
990
|
-
'clientPos': 'clientY',
|
|
991
|
-
'pos': 'y',
|
|
992
|
-
'size': 'height',
|
|
993
|
-
'near': 'top',
|
|
994
|
-
'far': 'bottom',
|
|
995
|
-
'offsetSize': 'offsetHeight'
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
var updateSplitter = function (splitter) {
|
|
1000
|
-
var offset = that.offset(splitter);
|
|
1001
|
-
var elementOffset = that.offset(that);
|
|
1002
|
-
|
|
1003
|
-
elementOffset.left++;
|
|
1004
|
-
elementOffset.top++;
|
|
1005
|
-
|
|
1006
|
-
that.$.splitter.style.width = splitter.offsetWidth + 'px';
|
|
1007
|
-
that.$.splitter.style.height = splitter.offsetHeight + 'px';
|
|
1008
|
-
|
|
1009
|
-
that.$.splitter.className = splitter.className;
|
|
1010
|
-
|
|
1011
|
-
that.$.splitter.style.left = offset.left - elementOffset.left + 'px';
|
|
1012
|
-
that.$.splitter.style.top = offset.top - elementOffset.top + 'px';
|
|
1013
|
-
|
|
1014
|
-
splitter.setAttribute('drag', '');
|
|
1015
|
-
that.$.splitter.setAttribute('drag', '');
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
|
-
if (splitter.classList.contains('last')) {
|
|
1019
|
-
var newPosition = event[normalized.clientPos] - that._resizeDetails.splitterRect[normalized.pos];
|
|
1020
|
-
var maxPosition = itemRect[normalized.size] - minSize;
|
|
1021
|
-
|
|
1022
|
-
if (newPosition > maxPosition) {
|
|
1023
|
-
newPosition = maxPosition;
|
|
1024
|
-
splitter.classList.add('error');
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
if (previousItemRect) {
|
|
1028
|
-
var minSize = parseInt(previousItem.getAttribute('min'));
|
|
1029
|
-
|
|
1030
|
-
var minPosition = previousItemRect[normalized.size] - minSize;
|
|
1031
|
-
if (newPosition < -minPosition) {
|
|
1032
|
-
newPosition = -minPosition;
|
|
1033
|
-
splitter.classList.add('error');
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
splitter.style[normalized.near] = newPosition + 'px';
|
|
1038
|
-
|
|
1039
|
-
var newSize = item[normalized.offsetSize] - newPosition;
|
|
1040
|
-
|
|
1041
|
-
item.setAttribute('size', newSize);
|
|
1042
|
-
|
|
1043
|
-
if (previousItem) {
|
|
1044
|
-
var previousItemSize = item[normalized.offsetSize] + previousItem[normalized.offsetSize] - newSize;
|
|
1045
|
-
|
|
1046
|
-
previousItem.setAttribute('size', previousItemSize);
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
else {
|
|
1050
|
-
var newPosition = -event[normalized.clientPos] + that._resizeDetails.splitterRect[normalized.pos];
|
|
1051
|
-
var minPosition = itemRect[normalized.size] - minSize;
|
|
1052
|
-
|
|
1053
|
-
if (newPosition > minPosition) {
|
|
1054
|
-
newPosition = minPosition;
|
|
1055
|
-
splitter.classList.add('error');
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
if (nextItemRect) {
|
|
1059
|
-
var minSize = parseInt(nextItem.getAttribute('min'));
|
|
1060
|
-
|
|
1061
|
-
var maxPosition = -nextItemRect[normalized.size] + minSize;
|
|
1062
|
-
if (newPosition < maxPosition) {
|
|
1063
|
-
newPosition = maxPosition;
|
|
1064
|
-
splitter.classList.add('error');
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
splitter.style[normalized.far] = newPosition + 'px';
|
|
1070
|
-
|
|
1071
|
-
var newSize = item[normalized.offsetSize] - newPosition;
|
|
1072
|
-
|
|
1073
|
-
item.setAttribute('size', newSize);
|
|
1074
|
-
|
|
1075
|
-
if (nextItem) {
|
|
1076
|
-
var nextItemSize = nextItem[normalized.offsetSize] + item[normalized.offsetSize] - newSize;
|
|
1077
|
-
|
|
1078
|
-
nextItem.setAttribute('size', nextItemSize);
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
updateSplitter(splitter);
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
_offsetTop(element) {
|
|
1087
|
-
var that = this;
|
|
1088
|
-
|
|
1089
|
-
if (!element) {
|
|
1090
|
-
return 0;
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
return element.offsetTop + that._offsetTop(element.offsetParent);
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
_offsetLeft(element) {
|
|
1097
|
-
var that = this;
|
|
1098
|
-
|
|
1099
|
-
if (!element) {
|
|
1100
|
-
return 0;
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
|
-
return element.offsetLeft + that._offsetLeft(element.offsetParent);
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
offset(element) {
|
|
1107
|
-
return { left: this._offsetLeft(element), top: this._offsetTop(element) }
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
_keyUpHandler(event) {
|
|
1111
|
-
var that = this;
|
|
1112
|
-
if (event.key === 'Escape') {
|
|
1113
|
-
if (that._dragDetails) {
|
|
1114
|
-
that._dragDetails.feedback.remove();
|
|
1115
|
-
that._dragDetails.overlay.remove();
|
|
1116
|
-
that._dragDetails = null;
|
|
1117
|
-
that._handleDropArea(null);
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
if (that._resizeDetails) {
|
|
1121
|
-
var drag = that._resizeDetails;
|
|
1122
|
-
|
|
1123
|
-
drag.splitter.classList.contains('last') ? drag.previousItem.size = drag.previousItemSize : drag.nextItem.size = drag.nextItem.previousItemSize;
|
|
1124
|
-
drag.item.size = drag.itemSize;
|
|
1125
|
-
|
|
1126
|
-
that.refresh();
|
|
1127
|
-
that._handleItemClick(drag.item);
|
|
1128
|
-
that._resizeDetails = null;
|
|
1129
|
-
return;
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
else if (event.key === 'Delete') {
|
|
1133
|
-
if (that._selectedItem) {
|
|
1134
|
-
that._removeLayoutItem(that._selectedItem);
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
_endDrag() {
|
|
1140
|
-
var that = this;
|
|
1141
|
-
|
|
1142
|
-
that._handleDropArea(null);
|
|
1143
|
-
|
|
1144
|
-
if (!that._dragDetails.dragging) {
|
|
1145
|
-
that._dragDetails = null;
|
|
1146
|
-
return;
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
|
-
var group = that._dragDetails.current;
|
|
1150
|
-
var item = that._dragDetails.element;
|
|
1151
|
-
var position = that._dragDetails.position;
|
|
1152
|
-
|
|
1153
|
-
that._handleDropArea(null);
|
|
1154
|
-
|
|
1155
|
-
if (group) {
|
|
1156
|
-
that._addTabLayoutItem(group, position, item);
|
|
1157
|
-
that._removeLayoutItem(item);
|
|
1158
|
-
|
|
1159
|
-
if (group.parentElement && Array.from(group.parentElement.parentElement.children).filter(function (value) {
|
|
1160
|
-
if (value.classList.contains('jqx-layout-group')) {
|
|
1161
|
-
return true;
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
return false;
|
|
1165
|
-
}).length === 1) {
|
|
1166
|
-
var parent = group.parentElement;
|
|
1167
|
-
var parentGroup = parent.parentElement;
|
|
1168
|
-
var ownerGroup = parentGroup.parentElement;
|
|
1169
|
-
|
|
1170
|
-
if (!(parentGroup.getAttribute('data-id') === 'root' || ownerGroup.getAttribute('data-id') === 'root') && ownerGroup !== that) {
|
|
1171
|
-
var index = Array.from(ownerGroup.children).indexOf(parent.parentElement);
|
|
1172
|
-
|
|
1173
|
-
if (index >= 0) {
|
|
1174
|
-
ownerGroup.insertBefore(parent, ownerGroup.children[index])
|
|
1175
|
-
}
|
|
1176
|
-
else {
|
|
1177
|
-
ownerGroup.appendChild(parent);
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
parentGroup.remove();
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
|
-
that.refresh();
|
|
1185
|
-
that._updateSplitter();
|
|
1186
|
-
|
|
1187
|
-
requestAnimationFrame(function () {
|
|
1188
|
-
that.classList.add('outline');
|
|
1189
|
-
that.querySelectorAll('.jqx-element').forEach(function (control) {
|
|
1190
|
-
that.dispatchEvent(new CustomEvent('resize'));
|
|
1191
|
-
|
|
1192
|
-
});
|
|
1193
|
-
})
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
|
-
that.dispatchEvent(new CustomEvent('stateChange', { type: 'insert', item: item }));
|
|
1197
|
-
|
|
1198
|
-
that._dragDetails.feedback.remove();
|
|
1199
|
-
that._dragDetails.overlay.remove();
|
|
1200
|
-
that._dragDetails = null;
|
|
1201
|
-
}
|
|
1202
|
-
/**
|
|
1203
|
-
* Document up handler
|
|
1204
|
-
* @param {any} event
|
|
1205
|
-
*/
|
|
1206
|
-
_documentUpHandler(event) {
|
|
1207
|
-
var that = this,
|
|
1208
|
-
isMobile = JQX.Utilities.Core.isMobile,
|
|
1209
|
-
target = isMobile ? document.elementFromPoint(event.pageX - window.pageXOffset, event.pageY - window.pageYOffset) : event.target;
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
if (event.button === 2) {
|
|
1213
|
-
return;
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
if (that._dragDetails) {
|
|
1217
|
-
that._endDrag(event);
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
if (that._resizeDetails) {
|
|
1221
|
-
var drag = that._resizeDetails;
|
|
1222
|
-
|
|
1223
|
-
if (drag.item) {
|
|
1224
|
-
drag.item.style.overflow = '';
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
if (drag.previousItem) {
|
|
1228
|
-
drag.previousItem.style.overflow = '';
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
|
-
if (drag.nextItem) {
|
|
1232
|
-
drag.nextItem.style.overflow = '';
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
|
-
that.refresh();
|
|
1236
|
-
that._handleItemClick(drag.item);
|
|
1237
|
-
that._resizeDetails = null;
|
|
1238
|
-
window.dispatchEvent(new Event('resize'));
|
|
1239
|
-
|
|
1240
|
-
that.querySelectorAll('.jqx-element').forEach(function (control) {
|
|
1241
|
-
control.dispatchEvent(new CustomEvent('resize'));
|
|
1242
|
-
});
|
|
1243
|
-
return;
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
if (!that.contains(target)) {
|
|
1247
|
-
return;
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
|
-
that.classList.add('outline');
|
|
1251
|
-
|
|
1252
|
-
if (that._target && !target.item) {
|
|
1253
|
-
if (target instanceof TabLayoutItem) {
|
|
1254
|
-
that._handleItemClick(target);
|
|
1255
|
-
}
|
|
1256
|
-
else {
|
|
1257
|
-
that._handleItemClick(target.closest('.jqx-layout-item'));
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
if (that._target) {
|
|
1262
|
-
if (that._target !== target) {
|
|
1263
|
-
delete that._target;
|
|
1264
|
-
return;
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
if (!event.button && target.closest('.jqx-layout-buttons-container')) {
|
|
1268
|
-
var button = event.target;
|
|
1269
|
-
|
|
1270
|
-
that._handleButtonClick(button.item, button.position);
|
|
1271
|
-
}
|
|
1272
|
-
else if (target.closest('.jqx-layout-context-menu') && (!isMobile && !event.button || isMobile)) {
|
|
1273
|
-
that._handleMenuItemClick(target.closest('.jqx-layout-context-menu-item'));
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
delete that._target;
|
|
1277
|
-
}
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
/**
|
|
1281
|
-
* Document Select Start event handler
|
|
1282
|
-
*/
|
|
1283
|
-
_documentSelectStartHandler(event) {
|
|
1284
|
-
var that = this;
|
|
1285
|
-
|
|
1286
|
-
if (that._target) {
|
|
1287
|
-
event.preventDefault();
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
/**
|
|
1292
|
-
* Adds labels to the items that do not have set
|
|
1293
|
-
* @param {any} data
|
|
1294
|
-
*/
|
|
1295
|
-
_getDataSource(layout, path, index) {
|
|
1296
|
-
var that = this;
|
|
1297
|
-
|
|
1298
|
-
var data = [];
|
|
1299
|
-
|
|
1300
|
-
if (!index) {
|
|
1301
|
-
index = 0;
|
|
1302
|
-
}
|
|
1303
|
-
|
|
1304
|
-
if (!path) {
|
|
1305
|
-
path = '';
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
for (var i = 0; i < layout.length; i++) {
|
|
1309
|
-
var layoutItem = layout[i];
|
|
1310
|
-
|
|
1311
|
-
var item = {
|
|
1312
|
-
label: layoutItem.label,
|
|
1313
|
-
id: layoutItem.getAttribute('data-id'),
|
|
1314
|
-
orientation: layoutItem.orientation,
|
|
1315
|
-
size: layoutItem.size,
|
|
1316
|
-
min: layoutItem.min,
|
|
1317
|
-
type: layoutItem.type,
|
|
1318
|
-
modifiers: layoutItem.modifiers,
|
|
1319
|
-
position: layoutItem.position
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
layoutItem.removeAttribute('index');
|
|
1323
|
-
|
|
1324
|
-
if (layoutItem instanceof LayoutGroup) {
|
|
1325
|
-
data.push(item);
|
|
1326
|
-
|
|
1327
|
-
item.index = path !== '' ? path + '.' + index : index.toString();
|
|
1328
|
-
layoutItem.setAttribute('index', item.index);
|
|
1329
|
-
|
|
1330
|
-
if (layoutItem.items) {
|
|
1331
|
-
var items = that._getDataSource(layoutItem.items, item.index, 0);
|
|
1332
|
-
item.items = items;
|
|
1333
|
-
}
|
|
1334
|
-
}
|
|
1335
|
-
else if (layoutItem instanceof LayoutItem) {
|
|
1336
|
-
if (layoutItem.items) {
|
|
1337
|
-
var items = that._getDataSource(layoutItem.items, path, index);
|
|
1338
|
-
|
|
1339
|
-
data = data.concat(items);
|
|
1340
|
-
}
|
|
1341
|
-
else {
|
|
1342
|
-
item.index = path !== '' ? path + '.' + index : index.toString();
|
|
1343
|
-
layoutItem.setAttribute('index', item.index);
|
|
1344
|
-
|
|
1345
|
-
data.push(item);
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1349
|
-
index++;
|
|
1350
|
-
}
|
|
1351
|
-
|
|
1352
|
-
return data;
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
/**
|
|
1356
|
-
* Generates the JSON array of the current structure of the element
|
|
1357
|
-
*/
|
|
1358
|
-
_getLayout() {
|
|
1359
|
-
var that = this;
|
|
1360
|
-
var group = !arguments.length ? that.$.itemsContainer : arguments[0];
|
|
1361
|
-
|
|
1362
|
-
if (that._buttons) {
|
|
1363
|
-
that._buttons.remove();
|
|
1364
|
-
}
|
|
1365
|
-
|
|
1366
|
-
if (that._dropArea) {
|
|
1367
|
-
that._dropArea.remove();
|
|
1368
|
-
}
|
|
1369
|
-
|
|
1370
|
-
var splitters = that.querySelectorAll('.jqx-layout-splitter');
|
|
1371
|
-
|
|
1372
|
-
for (var i = 0; i < splitters.length; i++) {
|
|
1373
|
-
var splitter = splitters[i];
|
|
1374
|
-
|
|
1375
|
-
if (splitter !== that.$.splitter) {
|
|
1376
|
-
splitter.remove();
|
|
1377
|
-
}
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
|
-
group.items = Array.from(group.children);
|
|
1381
|
-
group.items = group.items.filter(function (value) {
|
|
1382
|
-
return value !== group.tabs && value.hasAttribute('data-id');
|
|
1383
|
-
});
|
|
1384
|
-
|
|
1385
|
-
var items = group.items.map(function (value) {
|
|
1386
|
-
if (value.classList.contains('jqx-layout-tab-strip')) {
|
|
1387
|
-
return null;
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
var item = value;
|
|
1391
|
-
var itemGroup = value instanceof LayoutGroup ? value : null;
|
|
1392
|
-
|
|
1393
|
-
if (itemGroup) {
|
|
1394
|
-
item.items = that._getLayout(itemGroup)
|
|
1395
|
-
}
|
|
1396
|
-
|
|
1397
|
-
return item;
|
|
1398
|
-
});
|
|
1399
|
-
|
|
1400
|
-
if (group !== that.$.itemsContainer) {
|
|
1401
|
-
return items.filter(function (value) {
|
|
1402
|
-
return value !== null && value !== group.tabs
|
|
1403
|
-
});
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1406
|
-
var data = [];
|
|
1407
|
-
var item = group;
|
|
1408
|
-
|
|
1409
|
-
item.items = items.filter(function (value) {
|
|
1410
|
-
return value !== null && value !== group.tabs
|
|
1411
|
-
});
|
|
1412
|
-
|
|
1413
|
-
data.push(item);
|
|
1414
|
-
|
|
1415
|
-
return data;
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
_updateSplitter() {
|
|
1420
|
-
var that = this;
|
|
1421
|
-
|
|
1422
|
-
if (that._buttons && that._dragDetails) {
|
|
1423
|
-
that._buttons.remove();
|
|
1424
|
-
}
|
|
1425
|
-
|
|
1426
|
-
that._removeSplitter();
|
|
1427
|
-
var items = that.querySelectorAll('[data-id]');
|
|
1428
|
-
|
|
1429
|
-
for (var i = 0; i < items.length; i++) {
|
|
1430
|
-
var item = items[i];
|
|
1431
|
-
|
|
1432
|
-
if (item.getAttribute('data-id') === 'root') {
|
|
1433
|
-
continue;
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1436
|
-
if (item.hasAttribute('role')) {
|
|
1437
|
-
var role = item.getAttribute('role');
|
|
1438
|
-
|
|
1439
|
-
if (role === 'gridcell' || role === 'row' || role === 'columnheader' || role === 'rowheader') {
|
|
1440
|
-
continue;
|
|
1441
|
-
}
|
|
1442
|
-
}
|
|
1443
|
-
|
|
1444
|
-
item.setAttribute('hover', '');
|
|
1445
|
-
that._handleSplitter(item);
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1449
|
-
_hideSplitter() {
|
|
1450
|
-
var that = this;
|
|
1451
|
-
|
|
1452
|
-
var items = that.querySelectorAll('[data-id]');
|
|
1453
|
-
|
|
1454
|
-
for (var i = 0; i < items.length; i++) {
|
|
1455
|
-
var item = items[i];
|
|
1456
|
-
|
|
1457
|
-
item.removeAttribute('hover');
|
|
1458
|
-
}
|
|
1459
|
-
}
|
|
1460
|
-
|
|
1461
|
-
_removeSplitter() {
|
|
1462
|
-
var that = this;
|
|
1463
|
-
var splitters = that.querySelectorAll('.jqx-layout-splitter');
|
|
1464
|
-
|
|
1465
|
-
for (var i = 0; i < splitters.length; i++) {
|
|
1466
|
-
var splitter = splitters[i];
|
|
1467
|
-
|
|
1468
|
-
if (splitter !== that.$.splitter) {
|
|
1469
|
-
splitter.remove();
|
|
1470
|
-
}
|
|
1471
|
-
}
|
|
1472
|
-
|
|
1473
|
-
that._hideSplitter();
|
|
1474
|
-
}
|
|
1475
|
-
|
|
1476
|
-
/**
|
|
1477
|
-
* Handles item selection
|
|
1478
|
-
* @param {any} target - target element that was clicked
|
|
1479
|
-
* @param {any} isOnDemand - selection on demand
|
|
1480
|
-
*/
|
|
1481
|
-
_handleItemClick(target) {
|
|
1482
|
-
var that = this,
|
|
1483
|
-
previouslySelectedIndex = that.selectedIndex;
|
|
1484
|
-
|
|
1485
|
-
var item = null;
|
|
1486
|
-
|
|
1487
|
-
if (!target) {
|
|
1488
|
-
that.selectedIndex = null;
|
|
1489
|
-
that.querySelectorAll('[data-id]').forEach(function (i) { i.removeAttribute('selected') });
|
|
1490
|
-
that._selectedItem = null;
|
|
1491
|
-
return;
|
|
1492
|
-
}
|
|
1493
|
-
else {
|
|
1494
|
-
item = target instanceof HTMLElement ? target : that.querySelector('[data-id=' + target.id + ']');
|
|
1495
|
-
|
|
1496
|
-
if (item && item.readonly) {
|
|
1497
|
-
that.selectedIndex = null;
|
|
1498
|
-
return;
|
|
1499
|
-
}
|
|
1500
|
-
|
|
1501
|
-
that.querySelectorAll('[data-id]').forEach(function (i) { i.removeAttribute('selected') });
|
|
1502
|
-
|
|
1503
|
-
if (!item) {
|
|
1504
|
-
that.refresh();
|
|
1505
|
-
return;
|
|
1506
|
-
}
|
|
1507
|
-
|
|
1508
|
-
that.selectedIndex = item.getAttribute('index');
|
|
1509
|
-
|
|
1510
|
-
item.setAttribute('selected', '');
|
|
1511
|
-
item.setAttribute('hover', '');
|
|
1512
|
-
that._selectedItem = item;
|
|
1513
|
-
if (item.classList.contains('jqx-hidden')) {
|
|
1514
|
-
that.refresh();
|
|
1515
|
-
}
|
|
1516
|
-
|
|
1517
|
-
that._handleButtonsVisibility(item);
|
|
1518
|
-
|
|
1519
|
-
if (previouslySelectedIndex !== that.selectedIndex) {
|
|
1520
|
-
that.dispatchEvent(new CustomEvent('change'));
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
|
-
that._updateSplitter();
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
|
-
/**
|
|
1528
|
-
* Handles Layout Button click
|
|
1529
|
-
* @param {any} target
|
|
1530
|
-
*/
|
|
1531
|
-
_handleButtonClick(target, position) {
|
|
1532
|
-
var that = this,
|
|
1533
|
-
newItem = that._addLayoutItem(target, position);
|
|
1534
|
-
|
|
1535
|
-
//Select the new empty item
|
|
1536
|
-
that.dispatchEvent(new CustomEvent('stateChange', { type: 'insert', item: newItem }));
|
|
1537
|
-
|
|
1538
|
-
that._handleItemClick(newItem, true);
|
|
1539
|
-
}
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
_removeLayoutItem(item) {
|
|
1544
|
-
var that = this;
|
|
1545
|
-
|
|
1546
|
-
if (item.getAttribute('data-id') === 'root') {
|
|
1547
|
-
return;
|
|
1548
|
-
}
|
|
1549
|
-
|
|
1550
|
-
if (item instanceof LayoutItem && item.parentElement.items.length === 1) {
|
|
1551
|
-
var parent = item.parentElement;
|
|
1552
|
-
var currentParent = parent;
|
|
1553
|
-
|
|
1554
|
-
while (parent && parent.items && parent.items.length === 1) {
|
|
1555
|
-
if (parent.getAttribute('data-id') === 'root') {
|
|
1556
|
-
break;
|
|
1557
|
-
}
|
|
1558
|
-
|
|
1559
|
-
currentParent = parent;
|
|
1560
|
-
parent = parent.parentElement;
|
|
1561
|
-
}
|
|
1562
|
-
|
|
1563
|
-
if (currentParent.getAttribute('data-id') !== 'root') {
|
|
1564
|
-
currentParent.remove();
|
|
1565
|
-
}
|
|
1566
|
-
else if (that.allowLiveSplit) {
|
|
1567
|
-
currentParent.appendChild(document.createElement('jqx-layout-item'));
|
|
1568
|
-
}
|
|
1569
|
-
}
|
|
1570
|
-
else {
|
|
1571
|
-
item.remove();
|
|
1572
|
-
}
|
|
1573
|
-
|
|
1574
|
-
that.refresh();
|
|
1575
|
-
|
|
1576
|
-
that.dispatchEvent(new CustomEvent('stateChange', { type: 'delete', item: item }));
|
|
1577
|
-
}
|
|
1578
|
-
|
|
1579
|
-
/**
|
|
1580
|
-
* Refreshes the UI Component.
|
|
1581
|
-
*/
|
|
1582
|
-
refresh() {
|
|
1583
|
-
var that = this;
|
|
1584
|
-
|
|
1585
|
-
if (that._isUpdating) {
|
|
1586
|
-
return;
|
|
1587
|
-
}
|
|
1588
|
-
|
|
1589
|
-
that.dataSource = that._getDataSource(that._getLayout());
|
|
1590
|
-
|
|
1591
|
-
that.$.splitter.className = 'jqx-visibility-hidden jqx-layout-splitter';
|
|
1592
|
-
|
|
1593
|
-
var refreshLayoutGroup = function (group) {
|
|
1594
|
-
var item = that.getItem(group.getAttribute('index'));
|
|
1595
|
-
|
|
1596
|
-
if (!item) {
|
|
1597
|
-
return;
|
|
1598
|
-
}
|
|
1599
|
-
group.style.gridTemplateColumns = '';
|
|
1600
|
-
group.style.gridTemplateRows = '';
|
|
1601
|
-
|
|
1602
|
-
var template = '';
|
|
1603
|
-
var percentages = 0;
|
|
1604
|
-
var withSizeCount = 0;
|
|
1605
|
-
|
|
1606
|
-
if (group instanceof TabLayoutGroup) {
|
|
1607
|
-
if (group.tabs) {
|
|
1608
|
-
group.tabs.remove();
|
|
1609
|
-
}
|
|
1610
|
-
|
|
1611
|
-
var header = document.createElement('div');
|
|
1612
|
-
header.classList.add('jqx-layout-tab-strip');
|
|
1613
|
-
|
|
1614
|
-
if (that._selectedItem && group.contains(that._selectedItem) && that._selectedItem instanceof TabLayoutItem) {
|
|
1615
|
-
group.selectedIndex = Math.max(0, group.items.indexOf(that._selectedItem));
|
|
1616
|
-
}
|
|
1617
|
-
|
|
1618
|
-
if (group.selectedIndex >= group.children.length) {
|
|
1619
|
-
group.selectedIndex = 0;
|
|
1620
|
-
}
|
|
1621
|
-
|
|
1622
|
-
for (var i = 0; i < group.children.length; i++) {
|
|
1623
|
-
var child = group.children[i];
|
|
1624
|
-
var childItem = that.getItem(child.getAttribute('index'));
|
|
1625
|
-
|
|
1626
|
-
if (!childItem) {
|
|
1627
|
-
continue;
|
|
1628
|
-
}
|
|
1629
|
-
|
|
1630
|
-
var tab = document.createElement('div');
|
|
1631
|
-
tab.classList.add('jqx-layout-tab');
|
|
1632
|
-
tab.innerHTML = '<label>' + childItem.label + '</label><span class="jqx-close-button"></span>';
|
|
1633
|
-
header.appendChild(tab);
|
|
1634
|
-
child.setAttribute('tab', '');
|
|
1635
|
-
child.classList.add('jqx-hidden');
|
|
1636
|
-
tab.content = child;
|
|
1637
|
-
tab.item = childItem;
|
|
1638
|
-
tab.group = item;
|
|
1639
|
-
|
|
1640
|
-
if (child.modifiers) {
|
|
1641
|
-
if (child.modifiers.indexOf('close') === -1) {
|
|
1642
|
-
tab.querySelector('.jqx-close-button').classList.add('jqx-hidden');
|
|
1643
|
-
}
|
|
1644
|
-
}
|
|
1645
|
-
else {
|
|
1646
|
-
tab.querySelector('.jqx-close-button').classList.add('jqx-hidden');
|
|
1647
|
-
}
|
|
1648
|
-
|
|
1649
|
-
if (undefined === group.selectedIndex || i === group.selectedIndex) {
|
|
1650
|
-
tab.classList.add('selected');
|
|
1651
|
-
child.classList.remove('jqx-hidden');
|
|
1652
|
-
group.selectedIndex = i;
|
|
1653
|
-
}
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
tab.onpointerup = function (event) {
|
|
1657
|
-
if (event.target.classList.contains('jqx-close-button') && tab.close) {
|
|
1658
|
-
group.selectedIndex = 0;
|
|
1659
|
-
that._removeLayoutItem(that._selectedItem);
|
|
1660
|
-
that._handleItemClick(parent);
|
|
1661
|
-
}
|
|
1662
|
-
}
|
|
1663
|
-
tab.onpointerdown = function (event) {
|
|
1664
|
-
var parent = this.closest('.jqx-layout-group');
|
|
1665
|
-
that._handleItemClick(this.content);
|
|
1666
|
-
tab.close = false;
|
|
1667
|
-
if (!event.target.classList.contains('jqx-close-button')) {
|
|
1668
|
-
if (childItem.modifiers && childItem.modifiers.indexOf('drag') >= 0 && parent.modifiers.indexOf('drag') >= 0) {
|
|
1669
|
-
that._beginDrag(parent, this, event);
|
|
1670
|
-
}
|
|
1671
|
-
}
|
|
1672
|
-
else {
|
|
1673
|
-
tab.close = true;
|
|
1674
|
-
}
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
|
-
}
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
group.tabs = header;
|
|
1681
|
-
|
|
1682
|
-
if (item.position === 'top' || item.position === 'left') {
|
|
1683
|
-
group.insertBefore(header, group.firstChild);
|
|
1684
|
-
}
|
|
1685
|
-
else {
|
|
1686
|
-
group.appendChild(header);
|
|
1687
|
-
}
|
|
1688
|
-
}
|
|
1689
|
-
else {
|
|
1690
|
-
for (var i = 0; i < group.children.length; i++) {
|
|
1691
|
-
var child = group.children[i];
|
|
1692
|
-
|
|
1693
|
-
if (child.hasAttribute('size')) {
|
|
1694
|
-
var size = child.getAttribute('size');
|
|
1695
|
-
|
|
1696
|
-
var pixels = parseFloat(size);
|
|
1697
|
-
var groupSize = group.orientation === 'vertical' ? group.offsetWidth : group.offsetHeight;
|
|
1698
|
-
var percentage = size.indexOf('%') >= 0 ? parseFloat(size) : parseFloat((pixels / groupSize) * 100);
|
|
1699
|
-
|
|
1700
|
-
percentages += percentage;
|
|
1701
|
-
withSizeCount++;
|
|
1702
|
-
|
|
1703
|
-
if (withSizeCount === group.children.length) {
|
|
1704
|
-
if (percentages < 100) {
|
|
1705
|
-
template += '1fr ';
|
|
1706
|
-
percentages = 100;
|
|
1707
|
-
continue;
|
|
1708
|
-
}
|
|
1709
|
-
else if (percentages > 100) {
|
|
1710
|
-
percentages -= percentage;
|
|
1711
|
-
percentage = 100 - percentages;
|
|
1712
|
-
percentages = 100;
|
|
1713
|
-
}
|
|
1714
|
-
}
|
|
1715
|
-
else if (percentages > 100 || percentage === 0) {
|
|
1716
|
-
withSizeCount = group.children.length;
|
|
1717
|
-
percentages = 0;
|
|
1718
|
-
break;
|
|
1719
|
-
}
|
|
1720
|
-
|
|
1721
|
-
template += percentage + '% ';
|
|
1722
|
-
continue;
|
|
1723
|
-
}
|
|
1724
|
-
|
|
1725
|
-
template += '1fr ';
|
|
1726
|
-
}
|
|
1727
|
-
|
|
1728
|
-
if (withSizeCount === group.children.length) {
|
|
1729
|
-
if (percentages < 99 || percentages > 100) {
|
|
1730
|
-
template = '';
|
|
1731
|
-
|
|
1732
|
-
for (var i = 0; i < group.children.length; i++) {
|
|
1733
|
-
var child = group.children[i];
|
|
1734
|
-
|
|
1735
|
-
child.removeAttribute('size');
|
|
1736
|
-
template += '1fr ';
|
|
1737
|
-
}
|
|
1738
|
-
}
|
|
1739
|
-
}
|
|
1740
|
-
|
|
1741
|
-
if (group.orientation === 'vertical') {
|
|
1742
|
-
group.style.gridTemplateColumns = template;
|
|
1743
|
-
}
|
|
1744
|
-
else {
|
|
1745
|
-
group.style.gridTemplateRows = template;
|
|
1746
|
-
}
|
|
1747
|
-
}
|
|
1748
|
-
|
|
1749
|
-
group.items = Array.from(group.children);
|
|
1750
|
-
group.items = group.items.filter(function (value) {
|
|
1751
|
-
return value !== group.tabs;
|
|
1752
|
-
});
|
|
1753
|
-
}
|
|
1754
|
-
|
|
1755
|
-
var layoutGroups = that.querySelectorAll('.jqx-layout-group');
|
|
1756
|
-
|
|
1757
|
-
for (var i = 0; i < layoutGroups.length; i++) {
|
|
1758
|
-
refreshLayoutGroup(layoutGroups[i]);
|
|
1759
|
-
}
|
|
1760
|
-
}
|
|
1761
|
-
|
|
1762
|
-
_beginDrag(parent, element, event) {
|
|
1763
|
-
var that = this;
|
|
1764
|
-
|
|
1765
|
-
if (that._dragDetails) {
|
|
1766
|
-
that._dragDetails.feedback.remove();
|
|
1767
|
-
}
|
|
1768
|
-
|
|
1769
|
-
var feedback = document.createElement('div');
|
|
1770
|
-
var overlay = document.createElement('div');
|
|
1771
|
-
var tabs = parent.querySelector('.jqx-layout-tab-strip');
|
|
1772
|
-
var label = '';
|
|
1773
|
-
|
|
1774
|
-
if (tabs) {
|
|
1775
|
-
for (var i = 0; i < Array.from(tabs.children).length; i++) {
|
|
1776
|
-
if (i === parent.selectedIndex) {
|
|
1777
|
-
label = tabs.children[i].innerText;
|
|
1778
|
-
}
|
|
1779
|
-
}
|
|
1780
|
-
}
|
|
1781
|
-
|
|
1782
|
-
feedback.innerHTML = `<jqx-split-layout><jqx-tab-layout-group><jqx-tab-layout-item label="${label}"></jqx-tab-layout-item></jqx-tab-layout-group></jqx-split-layout>`
|
|
1783
|
-
that._feedback = feedback;
|
|
1784
|
-
that._feedback.classList.add('jqx-split-layout-feedback', 'jqx-split-layout', 'jqx-widget');
|
|
1785
|
-
|
|
1786
|
-
overlay.classList.add('jqx-split-layout-overlay');
|
|
1787
|
-
|
|
1788
|
-
that._dragDetails = {
|
|
1789
|
-
element: element.content,
|
|
1790
|
-
item: element.item,
|
|
1791
|
-
layoutGroup: element.group,
|
|
1792
|
-
parent: parent,
|
|
1793
|
-
overlay: overlay,
|
|
1794
|
-
feedback: feedback,
|
|
1795
|
-
pageX: event.pageX,
|
|
1796
|
-
pageY: event.pageY
|
|
1797
|
-
}
|
|
1798
|
-
}
|
|
1799
|
-
|
|
1800
|
-
moveChildren(oldItem, newItem) {
|
|
1801
|
-
newItem.innerHTML = '';
|
|
1802
|
-
var content = oldItem;
|
|
1803
|
-
|
|
1804
|
-
while (content.firstChild) {
|
|
1805
|
-
var child = content.firstChild;
|
|
1806
|
-
newItem.appendChild(child);
|
|
1807
|
-
}
|
|
1808
|
-
}
|
|
1809
|
-
|
|
1810
|
-
createLayoutItem(type, position) {
|
|
1811
|
-
var that = this;
|
|
1812
|
-
|
|
1813
|
-
var getLayoutItem = function () {
|
|
1814
|
-
var item = document.createElement('jqx-layout-item');
|
|
1815
|
-
|
|
1816
|
-
item.innerHTML = '';
|
|
1817
|
-
|
|
1818
|
-
that.dispatchEvent(new CustomEvent('createItem', { type: 'layoutItem', item: item }));
|
|
1819
|
-
|
|
1820
|
-
return item;
|
|
1821
|
-
}
|
|
1822
|
-
|
|
1823
|
-
var getTabLayoutItem = function () {
|
|
1824
|
-
var item = document.createElement('jqx-tab-layout-item');
|
|
1825
|
-
|
|
1826
|
-
item.innerHTML = '';
|
|
1827
|
-
|
|
1828
|
-
that.dispatchEvent(new CustomEvent('createItem', { type: 'tabLayoutItem', item: item }));
|
|
1829
|
-
|
|
1830
|
-
return item;
|
|
1831
|
-
}
|
|
1832
|
-
|
|
1833
|
-
var getLayoutGroup = function (position) {
|
|
1834
|
-
var item = document.createElement('jqx-layout-group');
|
|
1835
|
-
var orientation = position === 'top' || position === 'bottom' ? 'horizontal' : 'vertical';
|
|
1836
|
-
|
|
1837
|
-
that.dispatchEvent(new CustomEvent('createGroup', { type: 'layoutGroup', item: item }));
|
|
1838
|
-
|
|
1839
|
-
item.setAttribute('orientation', orientation);
|
|
1840
|
-
item.orientation = orientation;
|
|
1841
|
-
|
|
1842
|
-
return item;
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1845
|
-
var getTabLayoutGroup = function (position) {
|
|
1846
|
-
var item = document.createElement('jqx-tab-layout-group');
|
|
1847
|
-
var orientation = position === 'top' || position === 'bottom' ? 'horizontal' : 'vertical';
|
|
1848
|
-
|
|
1849
|
-
item.setAttribute('orientation', orientation);
|
|
1850
|
-
item.orientation = orientation;
|
|
1851
|
-
|
|
1852
|
-
that.dispatchEvent(new CustomEvent('tabLayoutGroup', { type: 'layoutGroup', item: item }));
|
|
1853
|
-
|
|
1854
|
-
return item;
|
|
1855
|
-
}
|
|
1856
|
-
|
|
1857
|
-
if (type === 'layoutItem' || !type) {
|
|
1858
|
-
return getLayoutItem();
|
|
1859
|
-
}
|
|
1860
|
-
else if (type === 'tabLayoutItem' || !type) {
|
|
1861
|
-
return getTabLayoutItem();
|
|
1862
|
-
}
|
|
1863
|
-
else if (type === 'tabLayoutGroup') {
|
|
1864
|
-
return getTabLayoutGroup(position);
|
|
1865
|
-
}
|
|
1866
|
-
else {
|
|
1867
|
-
return getLayoutGroup(position);
|
|
1868
|
-
}
|
|
1869
|
-
}
|
|
1870
|
-
|
|
1871
|
-
_addTabLayoutItem(targetItem, position, myItem) {
|
|
1872
|
-
var that = this;
|
|
1873
|
-
var newItem = that.createLayoutItem('tabLayoutItem');
|
|
1874
|
-
|
|
1875
|
-
var parentLayoutGroup = targetItem.closest('jqx-tab-layout-group');
|
|
1876
|
-
var layoutGroup;
|
|
1877
|
-
|
|
1878
|
-
if (myItem) {
|
|
1879
|
-
newItem.label = myItem.label;
|
|
1880
|
-
newItem.modifiers = myItem.modifiers;
|
|
1881
|
-
that.moveChildren(myItem, newItem);
|
|
1882
|
-
}
|
|
1883
|
-
|
|
1884
|
-
var resetGroup = function (group) {
|
|
1885
|
-
for (var i = 0; i < group.children.length; i++) {
|
|
1886
|
-
var child = group.children[i];
|
|
1887
|
-
|
|
1888
|
-
child.removeAttribute('size');
|
|
1889
|
-
}
|
|
1890
|
-
|
|
1891
|
-
group.removeAttribute('size');
|
|
1892
|
-
}
|
|
1893
|
-
|
|
1894
|
-
var addTabItemChild = function (position) {
|
|
1895
|
-
targetItem.removeAttribute('size');
|
|
1896
|
-
|
|
1897
|
-
if (targetItem.querySelector('jqx-layout-group')) {
|
|
1898
|
-
that._addLayoutItem(targetItem.querySelector('jqx-layout-group'), position);
|
|
1899
|
-
}
|
|
1900
|
-
else {
|
|
1901
|
-
layoutGroup = that.createLayoutItem('layoutGroup', position);
|
|
1902
|
-
|
|
1903
|
-
var newLayoutItem = that.createLayoutItem();
|
|
1904
|
-
that.moveChildren(targetItem, newLayoutItem)
|
|
1905
|
-
|
|
1906
|
-
if (position === 'top' || position === 'left') {
|
|
1907
|
-
layoutGroup.appendChild(that.createLayoutItem());
|
|
1908
|
-
layoutGroup.appendChild(newLayoutItem);
|
|
1909
|
-
}
|
|
1910
|
-
else {
|
|
1911
|
-
layoutGroup.appendChild(newLayoutItem);
|
|
1912
|
-
layoutGroup.appendChild(that.createLayoutItem());
|
|
1913
|
-
}
|
|
1914
|
-
|
|
1915
|
-
targetItem.appendChild(layoutGroup);
|
|
1916
|
-
}
|
|
1917
|
-
}
|
|
1918
|
-
|
|
1919
|
-
var addRootTab = function (tabLayoutGroup, position) {
|
|
1920
|
-
|
|
1921
|
-
var parentLayoutGroup = targetItem.parentElement;
|
|
1922
|
-
var layoutGroup = targetItem;
|
|
1923
|
-
var newLayoutGroup = that.createLayoutItem('layoutGroup', position);
|
|
1924
|
-
|
|
1925
|
-
parentLayoutGroup.insertBefore(newLayoutGroup, layoutGroup);
|
|
1926
|
-
|
|
1927
|
-
if (position === 'top' || position === 'left') {
|
|
1928
|
-
newLayoutGroup.append(tabLayoutGroup);
|
|
1929
|
-
newLayoutGroup.appendChild(layoutGroup);
|
|
1930
|
-
}
|
|
1931
|
-
else {
|
|
1932
|
-
newLayoutGroup.appendChild(layoutGroup);
|
|
1933
|
-
newLayoutGroup.append(tabLayoutGroup);
|
|
1934
|
-
}
|
|
1935
|
-
|
|
1936
|
-
if (layoutGroup.getAttribute('data-id') === 'root') {
|
|
1937
|
-
layoutGroup.setAttribute('data-id', newLayoutGroup.getAttribute('data-id'));
|
|
1938
|
-
newLayoutGroup.setAttribute('data-id', 'root');
|
|
1939
|
-
that.$.itemsContainer = newLayoutGroup;
|
|
1940
|
-
}
|
|
1941
|
-
|
|
1942
|
-
resetGroup(layoutGroup);
|
|
1943
|
-
resetGroup(parentLayoutGroup);
|
|
1944
|
-
}
|
|
1945
|
-
|
|
1946
|
-
if (myItem) {
|
|
1947
|
-
switch (position) {
|
|
1948
|
-
case 'center': {
|
|
1949
|
-
if (targetItem instanceof TabLayoutGroup || targetItem instanceof TabLayoutItem) {
|
|
1950
|
-
parentLayoutGroup.appendChild(newItem);
|
|
1951
|
-
}
|
|
1952
|
-
else {
|
|
1953
|
-
var tabLayoutGroup = that.createLayoutItem('tabLayoutGroup', 'top');
|
|
1954
|
-
tabLayoutGroup.appendChild(newItem);
|
|
1955
|
-
|
|
1956
|
-
if (targetItem instanceof LayoutGroup && !(targetItem instanceof TabLayoutItem)) {
|
|
1957
|
-
targetItem.appendChild(tabLayoutGroup);
|
|
1958
|
-
resetGroup(targetItem);
|
|
1959
|
-
}
|
|
1960
|
-
else if (targetItem instanceof LayoutItem) {
|
|
1961
|
-
layoutGroup = that.createLayoutItem('layoutGroup');
|
|
1962
|
-
|
|
1963
|
-
targetItem.parentElement.insertBefore(layoutGroup, targetItem);
|
|
1964
|
-
layoutGroup.appendChild(targetItem);
|
|
1965
|
-
layoutGroup.appendChild(tabLayoutGroup);
|
|
1966
|
-
resetGroup(layoutGroup);
|
|
1967
|
-
}
|
|
1968
|
-
}
|
|
1969
|
-
}
|
|
1970
|
-
break;
|
|
1971
|
-
case 'left':
|
|
1972
|
-
case 'right': {
|
|
1973
|
-
var tabLayoutGroup = that.createLayoutItem('tabLayoutGroup', 'top');
|
|
1974
|
-
tabLayoutGroup.appendChild(newItem);
|
|
1975
|
-
if (targetItem.getAttribute('data-id') === 'root') {
|
|
1976
|
-
tabLayoutGroup.position = position;
|
|
1977
|
-
addRootTab(tabLayoutGroup, position);
|
|
1978
|
-
}
|
|
1979
|
-
else {
|
|
1980
|
-
addRootTab(tabLayoutGroup, position);
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1983
|
-
break;
|
|
1984
|
-
case 'top':
|
|
1985
|
-
case 'bottom': {
|
|
1986
|
-
var tabLayoutGroup = that.createLayoutItem('tabLayoutGroup', 'top');
|
|
1987
|
-
tabLayoutGroup.appendChild(newItem);
|
|
1988
|
-
|
|
1989
|
-
if (targetItem.getAttribute('data-id') === 'root') {
|
|
1990
|
-
tabLayoutGroup.position = position;
|
|
1991
|
-
addRootTab(tabLayoutGroup, position);
|
|
1992
|
-
}
|
|
1993
|
-
else {
|
|
1994
|
-
addRootTab(tabLayoutGroup, position);
|
|
1995
|
-
}
|
|
1996
|
-
break;
|
|
1997
|
-
}
|
|
1998
|
-
}
|
|
1999
|
-
|
|
2000
|
-
return;
|
|
2001
|
-
}
|
|
2002
|
-
|
|
2003
|
-
switch (position) {
|
|
2004
|
-
case 'center':
|
|
2005
|
-
if (targetItem instanceof TabLayoutGroup || targetItem instanceof TabLayoutItem) {
|
|
2006
|
-
parentLayoutGroup.appendChild(newItem);
|
|
2007
|
-
}
|
|
2008
|
-
else {
|
|
2009
|
-
addTabItemChild();
|
|
2010
|
-
}
|
|
2011
|
-
break;
|
|
2012
|
-
case 'left':
|
|
2013
|
-
case 'right':
|
|
2014
|
-
if (targetItem instanceof TabLayoutGroup) {
|
|
2015
|
-
var firstItem = targetItem.querySelector('jqx-tab-layout-item');
|
|
2016
|
-
|
|
2017
|
-
if (firstItem && position === 'left') {
|
|
2018
|
-
targetItem.insertBefore(newItem, firstItem);
|
|
2019
|
-
}
|
|
2020
|
-
else {
|
|
2021
|
-
targetItem.appendChild(newItem);
|
|
2022
|
-
}
|
|
2023
|
-
}
|
|
2024
|
-
else if (targetItem instanceof TabLayoutItem) {
|
|
2025
|
-
var tabLayoutGroup = that.createLayoutItem('tabLayoutGroup', 'top');
|
|
2026
|
-
var parentLayoutGroup = targetItem.parentElement;
|
|
2027
|
-
|
|
2028
|
-
tabLayoutGroup.appendChild(newItem);
|
|
2029
|
-
|
|
2030
|
-
layoutGroup = that.createLayoutItem('layoutGroup');
|
|
2031
|
-
|
|
2032
|
-
parentLayoutGroup.parentElement.insertBefore(layoutGroup, parentLayoutGroup);
|
|
2033
|
-
|
|
2034
|
-
if (position === 'right') {
|
|
2035
|
-
layoutGroup.appendChild(parentLayoutGroup);
|
|
2036
|
-
layoutGroup.appendChild(tabLayoutGroup);
|
|
2037
|
-
}
|
|
2038
|
-
else if (position === 'left') {
|
|
2039
|
-
layoutGroup.appendChild(tabLayoutGroup);
|
|
2040
|
-
layoutGroup.appendChild(parentLayoutGroup);
|
|
2041
|
-
}
|
|
2042
|
-
}
|
|
2043
|
-
else if (myItem) {
|
|
2044
|
-
var tabLayoutGroup = that.createLayoutItem('tabLayoutGroup', 'top');
|
|
2045
|
-
tabLayoutGroup.appendChild(newItem);
|
|
2046
|
-
|
|
2047
|
-
if (targetItem instanceof LayoutGroup) {
|
|
2048
|
-
targetItem.insertBefore(targetItem.firstChild, tabLayoutGroup);
|
|
2049
|
-
}
|
|
2050
|
-
else if (targetItem instanceof LayoutItem) {
|
|
2051
|
-
layoutGroup = that.createLayoutItem('layoutGroup');
|
|
2052
|
-
layoutGroup.orientation = parentLayoutGroup.orientation;
|
|
2053
|
-
layoutGroup.setAttribute('orientation', parentLayoutGroup.orientation);
|
|
2054
|
-
|
|
2055
|
-
targetItem.removeAttribute('size');
|
|
2056
|
-
targetItem.parentElement.insertBefore(layoutGroup, targetItem);
|
|
2057
|
-
layoutGroup.appendChild(targetItem);
|
|
2058
|
-
layoutGroup.appendChild(tabLayoutGroup);
|
|
2059
|
-
}
|
|
2060
|
-
}
|
|
2061
|
-
else {
|
|
2062
|
-
addTabItemChild(position);
|
|
2063
|
-
}
|
|
2064
|
-
break;
|
|
2065
|
-
case 'top':
|
|
2066
|
-
case 'bottom':
|
|
2067
|
-
if (targetItem instanceof TabLayoutGroup) {
|
|
2068
|
-
layoutGroup = that.createLayoutItem('layoutGroup', 'top');
|
|
2069
|
-
targetItem.removeAttribute('size');
|
|
2070
|
-
|
|
2071
|
-
targetItem.parentElement.insertBefore(layoutGroup, targetItem);
|
|
2072
|
-
|
|
2073
|
-
if (position === 'top') {
|
|
2074
|
-
layoutGroup.appendChild(that.createLayoutItem());
|
|
2075
|
-
layoutGroup.appendChild(targetItem);
|
|
2076
|
-
}
|
|
2077
|
-
else {
|
|
2078
|
-
layoutGroup.appendChild(targetItem);
|
|
2079
|
-
layoutGroup.appendChild(that.createLayoutItem());
|
|
2080
|
-
}
|
|
2081
|
-
}
|
|
2082
|
-
else {
|
|
2083
|
-
addTabItemChild(position);
|
|
2084
|
-
}
|
|
2085
|
-
break;
|
|
2086
|
-
}
|
|
2087
|
-
|
|
2088
|
-
that.refresh();
|
|
2089
|
-
}
|
|
2090
|
-
|
|
2091
|
-
/**
|
|
2092
|
-
* Creates a new item by splitting the target Splitter
|
|
2093
|
-
*/
|
|
2094
|
-
_addLayoutItem(targetItem, position, myItem) {
|
|
2095
|
-
var that = this;
|
|
2096
|
-
|
|
2097
|
-
if (!targetItem) {
|
|
2098
|
-
return;
|
|
2099
|
-
}
|
|
2100
|
-
|
|
2101
|
-
var resetGroup = function (group) {
|
|
2102
|
-
for (var i = 0; i < group.children.length; i++) {
|
|
2103
|
-
var child = group.children[i];
|
|
2104
|
-
|
|
2105
|
-
child.removeAttribute('size');
|
|
2106
|
-
}
|
|
2107
|
-
|
|
2108
|
-
group.removeAttribute('size');
|
|
2109
|
-
}
|
|
2110
|
-
|
|
2111
|
-
var isTabItem = targetItem instanceof TabLayoutItem || targetItem instanceof TabLayoutGroup || (myItem && myItem instanceof TabLayoutItem);
|
|
2112
|
-
|
|
2113
|
-
if (isTabItem) {
|
|
2114
|
-
return that._addTabLayoutItem(targetItem, position, myItem);
|
|
2115
|
-
}
|
|
2116
|
-
|
|
2117
|
-
var newItem = that.createLayoutItem();
|
|
2118
|
-
|
|
2119
|
-
var parentLayoutGroup = targetItem.closest('.jqx-layout-group');
|
|
2120
|
-
var layoutGroup;
|
|
2121
|
-
|
|
2122
|
-
if (myItem) {
|
|
2123
|
-
that.moveChildren(myItem, newItem);
|
|
2124
|
-
}
|
|
2125
|
-
|
|
2126
|
-
if (position === 'center') {
|
|
2127
|
-
if (targetItem instanceof LayoutGroup) {
|
|
2128
|
-
layoutGroup = parentLayoutGroup;
|
|
2129
|
-
layoutGroup.appendChild(newItem);
|
|
2130
|
-
|
|
2131
|
-
resetGroup(layoutGroup);
|
|
2132
|
-
that.refresh();
|
|
2133
|
-
|
|
2134
|
-
return newItem;
|
|
2135
|
-
}
|
|
2136
|
-
else if (targetItem instanceof LayoutItem) {
|
|
2137
|
-
layoutGroup = that.createLayoutItem('layoutGroup');
|
|
2138
|
-
layoutGroup.orientation = parentLayoutGroup.orientation;
|
|
2139
|
-
layoutGroup.setAttribute('orientation', parentLayoutGroup.orientation);
|
|
2140
|
-
|
|
2141
|
-
targetItem.removeAttribute('size');
|
|
2142
|
-
targetItem.parentElement.insertBefore(layoutGroup, targetItem);
|
|
2143
|
-
layoutGroup.appendChild(targetItem);
|
|
2144
|
-
layoutGroup.appendChild(newItem);
|
|
2145
|
-
|
|
2146
|
-
that.refresh();
|
|
2147
|
-
|
|
2148
|
-
return layoutGroup;
|
|
2149
|
-
}
|
|
2150
|
-
}
|
|
2151
|
-
|
|
2152
|
-
if (parentLayoutGroup.orientation === 'vertical' && (position === 'left' || position === 'right') ||
|
|
2153
|
-
parentLayoutGroup.orientation === 'horizontal' && (position === 'top' || position === 'bottom')) {
|
|
2154
|
-
layoutGroup = parentLayoutGroup;
|
|
2155
|
-
|
|
2156
|
-
if (targetItem instanceof LayoutGroup) {
|
|
2157
|
-
if (position === 'left' || position === 'top') {
|
|
2158
|
-
layoutGroup.insertBefore(newItem, layoutGroup.children[0]);
|
|
2159
|
-
}
|
|
2160
|
-
else {
|
|
2161
|
-
layoutGroup.appendChild(newItem);
|
|
2162
|
-
}
|
|
2163
|
-
|
|
2164
|
-
resetGroup(targetItem);
|
|
2165
|
-
}
|
|
2166
|
-
else {
|
|
2167
|
-
var layoutGroupItems = layoutGroup.items,
|
|
2168
|
-
newItemIndex = Math.max(0, layoutGroupItems.indexOf(targetItem) + (position === 'top' || position === 'left' ? 0 : 1));
|
|
2169
|
-
|
|
2170
|
-
layoutGroup.insertBefore(newItem, layoutGroupItems[newItemIndex]);
|
|
2171
|
-
resetGroup(layoutGroup);
|
|
2172
|
-
}
|
|
2173
|
-
}
|
|
2174
|
-
else {
|
|
2175
|
-
if (targetItem instanceof LayoutGroup) {
|
|
2176
|
-
var parentLayoutGroup = targetItem.parentElement;
|
|
2177
|
-
layoutGroup = targetItem;
|
|
2178
|
-
var newLayoutGroup = that.createLayoutItem('layoutGroup', position);
|
|
2179
|
-
|
|
2180
|
-
parentLayoutGroup.insertBefore(newLayoutGroup, layoutGroup);
|
|
2181
|
-
|
|
2182
|
-
if (position === 'top' || position === 'left') {
|
|
2183
|
-
newLayoutGroup.append(newItem);
|
|
2184
|
-
newLayoutGroup.appendChild(layoutGroup);
|
|
2185
|
-
}
|
|
2186
|
-
else {
|
|
2187
|
-
newLayoutGroup.appendChild(layoutGroup);
|
|
2188
|
-
newLayoutGroup.append(newItem);
|
|
2189
|
-
}
|
|
2190
|
-
|
|
2191
|
-
if (layoutGroup.getAttribute('data-id') === 'root') {
|
|
2192
|
-
layoutGroup.setAttribute('data-id', newLayoutGroup.getAttribute('data-id'));
|
|
2193
|
-
newLayoutGroup.setAttribute('data-id', 'root');
|
|
2194
|
-
that.$.itemsContainer = newLayoutGroup;
|
|
2195
|
-
}
|
|
2196
|
-
|
|
2197
|
-
resetGroup(parentLayoutGroup);
|
|
2198
|
-
}
|
|
2199
|
-
else {
|
|
2200
|
-
layoutGroup = that.createLayoutItem('layoutGroup', position);
|
|
2201
|
-
|
|
2202
|
-
parentLayoutGroup.insertBefore(layoutGroup, targetItem);
|
|
2203
|
-
|
|
2204
|
-
if (position === 'top' || position === 'left') {
|
|
2205
|
-
layoutGroup.appendChild(newItem);
|
|
2206
|
-
layoutGroup.appendChild(targetItem);
|
|
2207
|
-
}
|
|
2208
|
-
else {
|
|
2209
|
-
layoutGroup.appendChild(targetItem);
|
|
2210
|
-
layoutGroup.appendChild(newItem);
|
|
2211
|
-
}
|
|
2212
|
-
|
|
2213
|
-
resetGroup(layoutGroup);
|
|
2214
|
-
}
|
|
2215
|
-
}
|
|
2216
|
-
|
|
2217
|
-
that.refresh();
|
|
2218
|
-
|
|
2219
|
-
return newItem;
|
|
2220
|
-
}
|
|
2221
|
-
|
|
2222
|
-
/**
|
|
2223
|
-
* Shows/Hides the Add buttons
|
|
2224
|
-
* @param {any} item
|
|
2225
|
-
*/
|
|
2226
|
-
_handleButtonsVisibility(item) {
|
|
2227
|
-
var that = this;
|
|
2228
|
-
|
|
2229
|
-
if (!that._buttons) {
|
|
2230
|
-
that._buttons = document.createElement('div');
|
|
2231
|
-
that._buttons.classList.add('jqx-layout-buttons-container');
|
|
2232
|
-
that._buttons.innerHTML = `<div role="button" position="top"></div>
|
|
2233
|
-
<div role="button" position="bottom"></div>
|
|
2234
|
-
<div role="button" position="center"></div>
|
|
2235
|
-
<div role="button" position="left"></div>
|
|
2236
|
-
<div role="button" position="right"></div>`;
|
|
2237
|
-
|
|
2238
|
-
}
|
|
2239
|
-
|
|
2240
|
-
if (!item) {
|
|
2241
|
-
if (that._buttons.parentElement) {
|
|
2242
|
-
that._buttons.parentElement.removeChild(that._buttons);
|
|
2243
|
-
|
|
2244
|
-
return;
|
|
2245
|
-
}
|
|
2246
|
-
}
|
|
2247
|
-
|
|
2248
|
-
if (item) {
|
|
2249
|
-
var buttonPosition = item._buttonPosition || [],
|
|
2250
|
-
buttons = that._buttons.children;
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
for (var b = 0; b < buttons.length; b++) {
|
|
2254
|
-
var button = buttons[b];
|
|
2255
|
-
|
|
2256
|
-
button.position = button.getAttribute('position');
|
|
2257
|
-
button.item = item;
|
|
2258
|
-
buttonPosition.length && buttonPosition.indexOf(button.getAttribute('position')) < 0 ? button.classList.add('jqx-hidden') : button.classList.remove('jqx-hidden');
|
|
2259
|
-
|
|
2260
|
-
button.onmouseenter = function () {
|
|
2261
|
-
button.setAttribute('hover', '');
|
|
2262
|
-
}
|
|
2263
|
-
button.onmouseleave = function () {
|
|
2264
|
-
button.removeAttribute('hover')
|
|
2265
|
-
}
|
|
2266
|
-
}
|
|
2267
|
-
|
|
2268
|
-
if (that.allowLiveSplit && that._buttons.parentElement !== item) {
|
|
2269
|
-
item.appendChild(that._buttons);
|
|
2270
|
-
}
|
|
2271
|
-
}
|
|
2272
|
-
}
|
|
2273
|
-
|
|
2274
|
-
_handleDropArea(item, position = 'center') {
|
|
2275
|
-
var that = this;
|
|
2276
|
-
|
|
2277
|
-
var positionDropArea = function (position) {
|
|
2278
|
-
var areaSize = 50;
|
|
2279
|
-
|
|
2280
|
-
switch (position) {
|
|
2281
|
-
case 'left':
|
|
2282
|
-
that._dropArea.style.top = '0px';
|
|
2283
|
-
that._dropArea.style.left = '0px';
|
|
2284
|
-
that._dropArea.style.width = areaSize + '%';
|
|
2285
|
-
that._dropArea.style.height = '100%';
|
|
2286
|
-
break;
|
|
2287
|
-
case 'right':
|
|
2288
|
-
that._dropArea.style.top = '0px';
|
|
2289
|
-
that._dropArea.style.left = `calc(100% - ${areaSize}%)`;
|
|
2290
|
-
that._dropArea.style.width = areaSize + '%';
|
|
2291
|
-
that._dropArea.style.height = '100%';
|
|
2292
|
-
break;
|
|
2293
|
-
case 'top':
|
|
2294
|
-
that._dropArea.style.top = '0px';
|
|
2295
|
-
that._dropArea.style.left = '0px';
|
|
2296
|
-
that._dropArea.style.width = '100%';
|
|
2297
|
-
that._dropArea.style.height = areaSize + '%';
|
|
2298
|
-
break;
|
|
2299
|
-
case 'bottom':
|
|
2300
|
-
that._dropArea.style.top = `calc(100% - ${areaSize}%)`;
|
|
2301
|
-
that._dropArea.style.left = '0px';
|
|
2302
|
-
that._dropArea.style.width = '100%';
|
|
2303
|
-
that._dropArea.style.height = areaSize + '%';
|
|
2304
|
-
break;
|
|
2305
|
-
case 'center':
|
|
2306
|
-
that._dropArea.style.top = '0px';
|
|
2307
|
-
that._dropArea.style.left = '0px';
|
|
2308
|
-
that._dropArea.style.width = '100%';
|
|
2309
|
-
that._dropArea.style.height = '100%';
|
|
2310
|
-
break;
|
|
2311
|
-
}
|
|
2312
|
-
}
|
|
2313
|
-
|
|
2314
|
-
if (that._dropArea && that._dropArea.parentElement === item) {
|
|
2315
|
-
positionDropArea(position);
|
|
2316
|
-
return;
|
|
2317
|
-
}
|
|
2318
|
-
|
|
2319
|
-
if (that._dropArea) {
|
|
2320
|
-
that._dropArea.remove();
|
|
2321
|
-
}
|
|
2322
|
-
|
|
2323
|
-
if (!that._dragDetails || !item) {
|
|
2324
|
-
return;
|
|
2325
|
-
}
|
|
2326
|
-
|
|
2327
|
-
that._dropArea = document.createElement('div');
|
|
2328
|
-
that._dropArea.classList.add('jqx-layout-drop-area');
|
|
2329
|
-
|
|
2330
|
-
item.appendChild(that._dropArea);
|
|
2331
|
-
|
|
2332
|
-
that._dropArea.style.opacity = 1;
|
|
2333
|
-
positionDropArea(position);
|
|
2334
|
-
}
|
|
2335
|
-
|
|
2336
|
-
_handleSplitter(item) {
|
|
2337
|
-
var that = this;
|
|
2338
|
-
|
|
2339
|
-
if (!item) {
|
|
2340
|
-
return;
|
|
2341
|
-
}
|
|
2342
|
-
|
|
2343
|
-
if (item.hasAttribute('tab')) {
|
|
2344
|
-
item = item.parentElement;
|
|
2345
|
-
}
|
|
2346
|
-
|
|
2347
|
-
if (item._splitter) {
|
|
2348
|
-
item._splitter.remove();
|
|
2349
|
-
}
|
|
2350
|
-
|
|
2351
|
-
if (!item._splitter) {
|
|
2352
|
-
item._splitter = document.createElement('div');
|
|
2353
|
-
}
|
|
2354
|
-
|
|
2355
|
-
if (that._dragDetails && that._dragDetails.dragging) {
|
|
2356
|
-
item._splitter.remove();
|
|
2357
|
-
return;
|
|
2358
|
-
}
|
|
2359
|
-
|
|
2360
|
-
if (item.modifiers.indexOf('resize') === -1) {
|
|
2361
|
-
return;
|
|
2362
|
-
}
|
|
2363
|
-
|
|
2364
|
-
item.appendChild(item._splitter);
|
|
2365
|
-
|
|
2366
|
-
var layoutGroup = item.parentElement;
|
|
2367
|
-
|
|
2368
|
-
if (layoutGroup) {
|
|
2369
|
-
item._splitter.className = 'jqx-layout-splitter';
|
|
2370
|
-
|
|
2371
|
-
item._splitter.item = item;
|
|
2372
|
-
|
|
2373
|
-
item._splitter.removeAttribute('drag');
|
|
2374
|
-
|
|
2375
|
-
var orientation = layoutGroup.orientation;
|
|
2376
|
-
|
|
2377
|
-
if (item.nextElementSibling && item.nextElementSibling.hasAttribute('data-id')) {
|
|
2378
|
-
item._splitter.classList.add(orientation);
|
|
2379
|
-
}
|
|
2380
|
-
else if (item.previousElementSibling && item.previousElementSibling.hasAttribute('data-id')) {
|
|
2381
|
-
item._splitter.classList.add(orientation);
|
|
2382
|
-
item._splitter.classList.add('last');
|
|
2383
|
-
}
|
|
2384
|
-
|
|
2385
|
-
var handleResize = function (splitter) {
|
|
2386
|
-
splitter.style.top = '';
|
|
2387
|
-
splitter.style.left = '';
|
|
2388
|
-
splitter.style.bottom = '';
|
|
2389
|
-
splitter.style.right = '';
|
|
2390
|
-
|
|
2391
|
-
splitter.onpointerdown = function (event) {
|
|
2392
|
-
var item = event.target.item;
|
|
2393
|
-
item.style.overflow = 'hidden';
|
|
2394
|
-
|
|
2395
|
-
that._resizeDetails = {
|
|
2396
|
-
splitter: event.target,
|
|
2397
|
-
splitterRect: event.target.getBoundingClientRect(),
|
|
2398
|
-
itemRect: item.getBoundingClientRect(),
|
|
2399
|
-
item: item,
|
|
2400
|
-
itemSize: item.size,
|
|
2401
|
-
group: item.parentElement,
|
|
2402
|
-
clientX: event.clientX,
|
|
2403
|
-
clientY: event.clientY
|
|
2404
|
-
}
|
|
2405
|
-
|
|
2406
|
-
if (that._selectedItem !== item) {
|
|
2407
|
-
that.querySelectorAll('[data-id]').forEach(function (i) { i.removeAttribute('selected') });
|
|
2408
|
-
that.selectedIndex = item.getAttribute('index');
|
|
2409
|
-
item.setAttribute('selected', '');
|
|
2410
|
-
that._selectedItem = item;
|
|
2411
|
-
that._handleButtonsVisibility(item);
|
|
2412
|
-
}
|
|
2413
|
-
|
|
2414
|
-
if (item.previousElementSibling && item.previousElementSibling.hasAttribute('data-id')) {
|
|
2415
|
-
that._resizeDetails.previousItemRect = item.previousElementSibling.getBoundingClientRect();
|
|
2416
|
-
that._resizeDetails.previousItem = item.previousElementSibling;
|
|
2417
|
-
that._resizeDetails.previousItemSize = item.previousElementSibling.size;
|
|
2418
|
-
that._resizeDetails.previousItem.style.overflow = 'hidden';
|
|
2419
|
-
}
|
|
2420
|
-
else {
|
|
2421
|
-
that._resizeDetails.previousItemRect = null;
|
|
2422
|
-
that._resizeDetails.previousItem = null;
|
|
2423
|
-
}
|
|
2424
|
-
|
|
2425
|
-
if (item.nextElementSibling && item.nextElementSibling.hasAttribute('data-id')) {
|
|
2426
|
-
that._resizeDetails.nextItemRect = item.nextElementSibling.getBoundingClientRect();
|
|
2427
|
-
that._resizeDetails.nextItem = item.nextElementSibling;
|
|
2428
|
-
that._resizeDetails.nextItemSize = item.nextElementSibling.size;
|
|
2429
|
-
that._resizeDetails.nextItem.style.overflow = 'hidden';
|
|
2430
|
-
}
|
|
2431
|
-
else {
|
|
2432
|
-
that._resizeDetails.nextItemRect = null;
|
|
2433
|
-
that._resizeDetails.nextItem = null;
|
|
2434
|
-
}
|
|
2435
|
-
}
|
|
2436
|
-
}
|
|
2437
|
-
|
|
2438
|
-
handleResize(item._splitter);
|
|
2439
|
-
}
|
|
2440
|
-
}
|
|
2441
|
-
}
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
customElements.define('jqx-layout-group', LayoutGroup);
|
|
2445
|
-
customElements.define('jqx-layout-item', LayoutItem);
|
|
2446
|
-
customElements.define('jqx-tab-layout-group', TabLayoutGroup);
|
|
2447
|
-
customElements.define('jqx-tab-layout-item', TabLayoutItem);
|
|
2448
|
-
customElements.define('jqx-split-layout', SplitLayout);
|