@grapecity/wijmo.grid.grouppanel
Advanced tools
Comparing version 5.20242.21 to 5.20242.30
/*! | ||
* | ||
* Wijmo Library 5.20242.21 | ||
* Wijmo Library 5.20242.30 | ||
* https://developer.mescius.com/wijmo | ||
@@ -14,2 +14,2 @@ * | ||
"use strict";var __importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.hasOwnProperty.call(e,i)&&(t[i]=e[i]);t.default=e;return t};Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_1=require("@grapecity/wijmo"),wijmo_grid_1=require("@grapecity/wijmo.grid"),selfModule=__importStar(require("@grapecity/wijmo.grid.grouppanel"));function softGridFilter(){return wijmo_1._getModule("wijmo.grid.filter")}exports.softGridFilter=softGridFilter;wijmo_1._addCultureInfo("GroupPanel",{dragDrop:"Drag and Drop columns here to create Groups."});class GroupPanel extends wijmo_1.Control{constructor(e,t){super(e);this._hideGroupedCols=!0;this._showDragGlyphs=!0;this._maxGroups=6;this._hiddenCols=[];this._placeholder=null;this._dragEndBnd=this._dragEnd.bind(this);this._focusGd=null;let i=this.getTemplate();this.applyTemplate("wj-grouppanel wj-control",i,{_divMarkers:"div-markers",_divPH:"div-ph"});wijmo_1.setCss(this._divMarkers.parentElement,{width:"100%",height:"100%",minHeight:"1em",overflow:"hidden",cursor:"default"});let r=this.hostElement,s=this.addEventListener.bind(this);s(r,"dragstart",this._dragStart.bind(this));s(r,"dragover",this._dragOver.bind(this));s(r,"drop",this._drop.bind(this));s(r,"dragend",this._dragEndBnd);s(r,"click",this._click.bind(this));this.initialize(t)}get hideGroupedColumns(){return this._hideGroupedCols}set hideGroupedColumns(e){e!=this._hideGroupedCols&&(this._hideGroupedCols=wijmo_1.asBoolean(e))}get showDragGlyphs(){return this._showDragGlyphs}set showDragGlyphs(e){if(e!=this._showDragGlyphs){this._showDragGlyphs=wijmo_1.asBoolean(e);this.refresh()}}get maxGroups(){return this._maxGroups}set maxGroups(e){if(e!=this._maxGroups){this._maxGroups=wijmo_1.asNumber(e);let t=this._gds,i=this._maxGroups;t&&i>-1&&i<t.length&&t.splice(i,t.length-i)}}get placeholder(){return this._placeholder}set placeholder(e){if(e!=this._placeholder){this._placeholder=e;this.invalidate()}}get grid(){return this._g}set grid(e){if((e=wijmo_1.asType(e,wijmo_grid_1.FlexGrid,!0))!=this._g){let t=this._g;if(t){t.draggingColumn.removeHandler(this._draggingColumn);t.itemsSourceChanging.removeHandler(this._itemsSourceChanging);t.itemsSourceChanged.removeHandler(this._itemsSourceChanged);t.columns.collectionChanged.removeHandler(this._itemsSourceChanged);t.removeEventListener(t.hostElement,"dragend",this._dragEndBnd)}t=this._g=e;this._hiddenCols=[];if(t){t.draggingColumn.addHandler(this._draggingColumn,this);t.itemsSourceChanging.addHandler(this._itemsSourceChanging,this);t.itemsSourceChanged.addHandler(this._itemsSourceChanged,this);t.columns.collectionChanged.addHandler(this._itemsSourceChanged,this);t.addEventListener(t.hostElement,"dragend",this._dragEndBnd)}this._itemsSourceChanged(t,null)}}get collectionView(){return this._g?this._g.collectionView:null}get filter(){return this._filter}set filter(e){if((e=wijmo_1.asType(e,softGridFilter().FlexGridFilter,!0))!=this._filter){let t=this._filter;if(t){t.filterApplied.removeHandler(this.refresh,this);t.filterChanged.removeHandler(this._filterChanged,this)}if(t=this._filter=e){t.filterApplied.addHandler(this.refresh,this);t.filterChanged.addHandler(this._filterChanged,this)}this.refresh()}}get groupDescriptionCreator(){return this._gdc}set groupDescriptionCreator(e){this._gdc=e}refresh(){super.refresh();this._divMarkers.innerHTML="";this._dragMarker=this._dragCol=null;if(this._gds){let t=this._g,i=t.columnHeaders;for(let r=0;r<this._gds.length;r++){let s=this._gds[r],l=-1,n=-1;if(s instanceof wijmo_1.PropertyGroupDescription)for(let e=i.rows.length-1;e>=0&&n<0;e--)for(let r=0;r<i.columns.length&&n<0;r++){let o=t._getBindingColumn(i,e,i.columns[r]);if(o&&o.binding==s.propertyName){n=r;l=e;break}}if(n>-1&&l>-1){let r=document.createElement("button");t.cellFactory.updateCell(this._g.columnHeaders,l,n,r);r.setAttribute("class","wj-cell wj-header wj-groupmarker");r.setAttribute("role","button");r.setAttribute("tabindex","0");r.addEventListener("focus",()=>{this._focusGd=s});this._focusGd===s&&this._focus&&setTimeout(()=>{r.focus()},50);r.addEventListener("keydown",e=>{if(!(46!==e.keyCode||e.altKey||e.shiftKey||e.ctrlKey||e.metaKey)){const t=e.path.find(e=>e.classList.contains("wj-groupmarker"));Array.from(t.children).find(e=>e.classList.contains("wj-remove")).click()}});wijmo_1.setCss(r,{position:"static",display:"inline-block",verticalAlign:"top",left:"",right:"",top:"",width:"",height:"",paddingLeft:"",paddingRight:""});wijmo_1.removeChild(r.querySelector(".wj-elem-filter"));wijmo_1.removeChild(r.querySelector(".wj-column-selector"));if(this.showDragGlyphs){var e=wijmo_1.createElement('<span class="wj-glyph-drag"></span>');r.insertBefore(e,r.firstChild)}let o=t._getBindingColumn(i,l,i.columns[n]),d=this._getColumnFilter(o);if(d){let e=wijmo_1.createElement('<span class="wj-filter wj-glyph-filter"></span>',r);wijmo_1.toggleClass(e,"wj-filter-on",d.isActive);wijmo_1.toggleClass(e,"wj-filter-off",!d.isActive)}wijmo_1.createElement('<span class="wj-remove">×</span>',r);this._divMarkers.appendChild(r);if(o&&this.hideGroupedColumns){const e=[];if(this.grid.layoutDefinition){this.grid.layoutDefinition.forEach(t=>t.cells.forEach(t=>e.push(t.binding)))}if(!e.includes(o._binding.path)){o.visible=!1;this._hiddenCols.push(o)}}}}this._divPH.textContent=null!=this._placeholder?this._placeholder:wijmo_1.culture.GroupPanel.dragDrop;let r=this._divMarkers.children.length>0;this._divPH.style.display=r?"none":"";this._divMarkers.style.display=r?"":"none"}}hitTest(e){let t=e instanceof HTMLElement?e:e instanceof MouseEvent?e.target:null;wijmo_1.assert(null!=t,"MouseEvent or Element expected");let i=wijmo_1.closest(t,".wj-cell");if(wijmo_1.hasClass(i,"wj-cell")){let e=this._getElementIndex(i);return this._gds&&e>-1?this._gds[e]:null}return null}_filterChanged(){this._filterMarker=null}_getColumnFilter(e){let t=this._filter,i=null;t&&(i=t.filterColumns&&t.filterColumns.indexOf(e.binding)<0?null:t.getColumnFilter(e));return i}_editFilter(e){let t=this._gds,i=this._getElementIndex(e),r=t&&i>-1?t[i]:null,s=r instanceof wijmo_1.PropertyGroupDescription?r.propertyName:null,l=s?this._g.getColumn(s):null;l&&this._filter.editColumnFilter(l,null,e)}_addGroup(e,t){let i=this._getIndex(t),r=this._gds,s=this._maxGroups;for(let t=0;t<r.length;t++){let s=r[t];if(s instanceof wijmo_1.PropertyGroupDescription&&s.propertyName==e.binding){r.removeAt(t);t<i&&i--;break}}if(s>-1)for(let e=s-1;e<r.length;e++){this._removeGroup(e,r);e<i&&i--}if(s<0||r.length<s){let t=this._gdc?this._gdc(e.binding):null;t||(t=new wijmo_1.PropertyGroupDescription(e.binding));r.insert(i,t);if(e&&this.hideGroupedColumns){e.visible=!1;this._hiddenCols.push(e)}}}_moveGroup(e,t){let i=this._gds,r=this._getElementIndex(this._dragMarker),s=this._getIndex(t);s>r&&s--;s>=this._gds.length&&(s=this._gds.length);r!=s&&i.deferUpdate(()=>{let e=i[r];i.removeAt(r);i.insert(s,e)})}_removeGroup(e,t=this._gds){let i=t&&e>-1?t[e]:null,r=i instanceof wijmo_1.PropertyGroupDescription?i.propertyName:null,s=r?this._g.columns.getColumn(r):null;if(s){s.visible=!0;let e=this._hiddenCols,t=e.indexOf(s);t>-1&&e.splice(t,1)}i&&t.removeAt(e)}_getIndex(e){let t=e.clientX,i=this._divMarkers.children;for(let e=0;e<i.length;e++){let r=i[e].getBoundingClientRect();if((t-r.left)*(t-r.right)<0)return e}return i.length}_getElementIndex(e){if(e&&e.parentElement){let t=e.parentElement.children;for(let i=0;i<t.length;i++)if(t[i]==e)return i}return-1}_draggingColumn(e,t){let i=this._g,r=i._getBindingColumn(t.panel,t.row,i.columns[t.col]);this._dragCol=r.binding?r:null}_itemsSourceChanging(e,t){this._hiddenCols.forEach(e=>{e.visible=!0});this._hiddenCols=[]}_itemsSourceChanged(e,t){this._view&&this._view.collectionChanged.removeHandler(this._collectionChanged);this._view=this._g?this._g.collectionView:null;this._gds=this._view?this._view.groupDescriptions:null;this._view&&this._view.collectionChanged.addHandler(this._collectionChanged,this);this.invalidate()}_collectionChanged(e,t){t.action==wijmo_1.NotifyCollectionChangedAction.Reset&&this.invalidate()}_dragStart(e){wijmo_1._startDrag(e.dataTransfer,"move");this._dragMarker=e.target;this._dragCol=null}_dragOver(e){if(this._dragCol||this._dragMarker){e.dataTransfer.dropEffect="move";e.preventDefault();e.stopPropagation()}}_drop(e){this._dragMarker?this._moveGroup(this._dragMarker,e):this._dragCol&&this._addGroup(this._dragCol,e)}_dragEnd(e){this._dragMarker=this._dragCol=null}_click(e){let t=e.target,i=wijmo_1.closest(t,".wj-cell");if(wijmo_1.hasClass(i,"wj-cell"))if(wijmo_1.hasClass(t,"wj-filter")){if(i!=this._filterMarker){this._editFilter(i);this._filterMarker=i;return}}else if(wijmo_1.hasClass(t,"wj-remove")){let e=this._getElementIndex(i);this._removeGroup(e)}else this._updateSort(e,i);this._filterMarker=null;this.hostElement.focus()}_updateSort(e,t){let i=this._g,r=i.collectionView;if(!r||!r.canSort||i.allowSorting==wijmo_grid_1.AllowSorting.None)return;let s=this._getElementIndex(t),l=this._gds[s],n=l instanceof wijmo_1.PropertyGroupDescription?l.propertyName:null,o=n?i.getColumn(n):null;if(!o||!o.allowSorting)return;let d=o.sortMemberPath||o.binding,h=-1,a=r.sortDescriptions;for(let e=0;e<a.length;e++)if(a[e].property==d){h=e;break}let g=new wijmo_grid_1.CellRangeEventArgs(i.columnHeaders,new wijmo_grid_1.CellRange(0,o.index),e);if(i.onSortingColumn(g)){let t=e.ctrlKey||e.metaKey,r=e.shiftKey;a.deferUpdate(()=>{if(t&&r)a.clear();else if(h<0){this._g.allowSorting!=wijmo_grid_1.AllowSorting.MultiColumn&&a.clear();let e=new wijmo_1.SortDescription(d,!0);a.push(e)}else{let e=a[h].ascending;if(t||this.isTouching&&!e)a.splice(h,1);else{let t=new wijmo_1.SortDescription(d,!e);a.splice(h,1,t)}}});i.onSortedColumn(g)}}}GroupPanel.controlTemplate='<div><div wj-part="div-ph"></div><div wj-part="div-markers"></div></div>';exports.GroupPanel=GroupPanel;wijmo_1._registerModule("wijmo.grid.grouppanel",selfModule); | ||
"use strict";var __importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var i={};if(null!=e)for(var t in e)Object.hasOwnProperty.call(e,t)&&(i[t]=e[t]);i.default=e;return i};Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_1=require("@grapecity/wijmo"),wijmo_grid_1=require("@grapecity/wijmo.grid"),wijmo_grid_filter_1=require("@grapecity/wijmo.grid.filter"),selfModule=__importStar(require("@grapecity/wijmo.grid.grouppanel"));exports.GroupPanelClsNames={groupMarker:"wj-groupmarker",hostElement:"wj-grouppanel"};function softGridFilter(){return wijmo_1._getModule("wijmo.grid.filter")}exports.softGridFilter=softGridFilter;wijmo_1._addCultureInfo("GroupPanel",{dragDrop:"Drag and Drop columns here to create Groups."});class GroupPanel extends wijmo_1.Control{constructor(e,i){super(e);this._hideGroupedCols=!0;this._showDragGlyphs=!0;this._maxGroups=6;this._hiddenCols=[];this._placeholder=null;this._dragEndBnd=this._dragEnd.bind(this);this._focusGd=null;let t=this.getTemplate();this.applyTemplate(`${exports.GroupPanelClsNames.hostElement} ${wijmo_1.ControlClsNames.hostElement}`,t,{_divMarkers:"div-markers",_divPH:"div-ph"});wijmo_1.setCss(this._divMarkers.parentElement,{width:"100%",height:"100%",minHeight:"1em",overflow:"hidden",cursor:"default"});let r=this.hostElement,l=this.addEventListener.bind(this);l(r,"dragstart",this._dragStart.bind(this));l(r,"dragover",this._dragOver.bind(this));l(r,"drop",this._drop.bind(this));l(r,"dragend",this._dragEndBnd);l(r,"click",this._click.bind(this));this.initialize(i)}static get controlTemplate(){GroupPanel._ctrlTemplate||(GroupPanel._ctrlTemplate='<div><div wj-part="div-ph"></div><div wj-part="div-markers"></div></div>');return GroupPanel._ctrlTemplate}static set controlTemplate(e){GroupPanel._ctrlTemplate=e}get hideGroupedColumns(){return this._hideGroupedCols}set hideGroupedColumns(e){e!=this._hideGroupedCols&&(this._hideGroupedCols=wijmo_1.asBoolean(e))}get showDragGlyphs(){return this._showDragGlyphs}set showDragGlyphs(e){if(e!=this._showDragGlyphs){this._showDragGlyphs=wijmo_1.asBoolean(e);this.refresh()}}get maxGroups(){return this._maxGroups}set maxGroups(e){if(e!=this._maxGroups){this._maxGroups=wijmo_1.asNumber(e);let i=this._gds,t=this._maxGroups;i&&t>-1&&t<i.length&&i.splice(t,i.length-t)}}get placeholder(){return this._placeholder}set placeholder(e){if(e!=this._placeholder){this._placeholder=e;this.invalidate()}}get grid(){return this._g}set grid(e){if((e=wijmo_1.asType(e,wijmo_grid_1.FlexGrid,!0))!=this._g){let i=this._g;if(i){i.draggingColumn.removeHandler(this._draggingColumn);i.itemsSourceChanging.removeHandler(this._itemsSourceChanging);i.itemsSourceChanged.removeHandler(this._itemsSourceChanged);i.columns.collectionChanged.removeHandler(this._itemsSourceChanged);i.removeEventListener(i.hostElement,"dragend",this._dragEndBnd)}i=this._g=e;this._hiddenCols=[];if(i){i.draggingColumn.addHandler(this._draggingColumn,this);i.itemsSourceChanging.addHandler(this._itemsSourceChanging,this);i.itemsSourceChanged.addHandler(this._itemsSourceChanged,this);i.columns.collectionChanged.addHandler(this._itemsSourceChanged,this);i.addEventListener(i.hostElement,"dragend",this._dragEndBnd)}this._itemsSourceChanged(i,null)}}get collectionView(){return this._g?this._g.collectionView:null}get filter(){return this._filter}set filter(e){if((e=wijmo_1.asType(e,softGridFilter().FlexGridFilter,!0))!=this._filter){let i=this._filter;if(i){i.filterApplied.removeHandler(this.refresh,this);i.filterChanged.removeHandler(this._filterChanged,this)}if(i=this._filter=e){i.filterApplied.addHandler(this.refresh,this);i.filterChanged.addHandler(this._filterChanged,this)}this.refresh()}}get groupDescriptionCreator(){return this._gdc}set groupDescriptionCreator(e){this._gdc=e}refresh(){super.refresh();this._divMarkers.innerHTML="";this._dragMarker=this._dragCol=null;if(this._gds){let i=this._g,t=i.columnHeaders;for(let r=0;r<this._gds.length;r++){let l=this._gds[r],s=-1,o=-1;if(l instanceof wijmo_1.PropertyGroupDescription)for(let e=t.rows.length-1;e>=0&&o<0;e--)for(let r=0;r<t.columns.length&&o<0;r++){let n=i._getBindingColumn(t,e,t.columns[r]);if(n&&n.binding==l.propertyName){o=r;s=e;break}}if(o>-1&&s>-1){let r=document.createElement("button");i.cellFactory.updateCell(this._g.columnHeaders,s,o,r);r.setAttribute("class",`${wijmo_grid_1.FlexGridClsNames.cell} ${wijmo_grid_1.FlexGridClsNames.header} ${exports.GroupPanelClsNames.groupMarker}`);r.setAttribute("role","button");r.setAttribute("tabindex","0");r.addEventListener("focus",()=>{this._focusGd=l});this._focusGd===l&&this._focus&&setTimeout(()=>{r.focus()},50);r.addEventListener("keydown",e=>{if(!(46!==e.keyCode||e.altKey||e.shiftKey||e.ctrlKey||e.metaKey)){const i=e.path.find(e=>e.classList.contains(exports.GroupPanelClsNames.groupMarker));Array.from(i.children).find(e=>e.classList.contains(wijmo_1.UtilitesClsNames.remove)).click()}});wijmo_1.setCss(r,{position:"static",display:"inline-block",verticalAlign:"top",left:"",right:"",top:"",width:"",height:"",paddingLeft:"",paddingRight:""});wijmo_1.removeChild(r.querySelector(`.${wijmo_grid_filter_1.FlexGridFilterClsNames.elemFilter}`));wijmo_1.removeChild(r.querySelector(".wj-column-selector"));if(this.showDragGlyphs){var e=wijmo_1.createElement(`<span class=${wijmo_1.GlyphClsNames.drag}></span>`);r.insertBefore(e,r.firstChild)}let n=i._getBindingColumn(t,s,t.columns[o]),d=this._getColumnFilter(n);if(d){let e=wijmo_1.createElement(`<span class="${wijmo_grid_filter_1.FlexGridFilterClsNames.filter} ${wijmo_1.GlyphClsNames.filter}"></span>`,r);wijmo_1.toggleClass(e,wijmo_grid_filter_1.FlexGridFilterClsNames.filterOn,d.isActive);wijmo_1.toggleClass(e,wijmo_grid_filter_1.FlexGridFilterClsNames.filterOff,!d.isActive)}wijmo_1.createElement(`<span class="${wijmo_1.UtilitesClsNames.remove}">×</span>`,r);this._divMarkers.appendChild(r);if(n&&this.hideGroupedColumns){const e=[];if(this.grid.layoutDefinition){this.grid.layoutDefinition.forEach(i=>i.cells.forEach(i=>e.push(i.binding)))}if(!e.includes(n._binding.path)){n.visible=!1;this._hiddenCols.push(n)}}}}this._divPH.textContent=null!=this._placeholder?this._placeholder:wijmo_1.culture.GroupPanel.dragDrop;let r=this._divMarkers.children.length>0;this._divPH.style.display=r?"none":"";this._divMarkers.style.display=r?"":"none"}}hitTest(e){let i=e instanceof HTMLElement?e:e instanceof MouseEvent?e.target:null;wijmo_1.assert(null!=i,"MouseEvent or Element expected");let t=wijmo_1.closest(i,`.${wijmo_grid_1.FlexGridClsNames.cell}`);if(wijmo_1.hasClass(t,wijmo_grid_1.FlexGridClsNames.cell)){let e=this._getElementIndex(t);return this._gds&&e>-1?this._gds[e]:null}return null}_filterChanged(){this._filterMarker=null}_getColumnFilter(e){let i=this._filter,t=null;i&&(t=i.filterColumns&&i.filterColumns.indexOf(e.binding)<0?null:i.getColumnFilter(e));return t}_editFilter(e){let i=this._gds,t=this._getElementIndex(e),r=i&&t>-1?i[t]:null,l=r instanceof wijmo_1.PropertyGroupDescription?r.propertyName:null,s=l?this._g.getColumn(l):null;s&&this._filter.editColumnFilter(s,null,e)}_addGroup(e,i){let t=this._getIndex(i),r=this._gds,l=this._maxGroups;for(let i=0;i<r.length;i++){let l=r[i];if(l instanceof wijmo_1.PropertyGroupDescription&&l.propertyName==e.binding){r.removeAt(i);i<t&&t--;break}}if(l>-1)for(let e=l-1;e<r.length;e++){this._removeGroup(e,r);e<t&&t--}if(l<0||r.length<l){let i=this._gdc?this._gdc(e.binding):null;i||(i=new wijmo_1.PropertyGroupDescription(e.binding));r.insert(t,i);if(e&&this.hideGroupedColumns){e.visible=!1;this._hiddenCols.push(e)}}}_moveGroup(e,i){let t=this._gds,r=this._getElementIndex(this._dragMarker),l=this._getIndex(i);l>r&&l--;l>=this._gds.length&&(l=this._gds.length);r!=l&&t.deferUpdate(()=>{let e=t[r];t.removeAt(r);t.insert(l,e)})}_removeGroup(e,i=this._gds){let t=i&&e>-1?i[e]:null,r=t instanceof wijmo_1.PropertyGroupDescription?t.propertyName:null,l=r?this._g.columns.getColumn(r):null;if(l){l.visible=!0;let e=this._hiddenCols,i=e.indexOf(l);i>-1&&e.splice(i,1)}t&&i.removeAt(e)}_getIndex(e){let i=e.clientX,t=this._divMarkers.children;for(let e=0;e<t.length;e++){let r=t[e].getBoundingClientRect();if((i-r.left)*(i-r.right)<0)return e}return t.length}_getElementIndex(e){if(e&&e.parentElement){let i=e.parentElement.children;for(let t=0;t<i.length;t++)if(i[t]==e)return t}return-1}_draggingColumn(e,i){let t=this._g,r=t._getBindingColumn(i.panel,i.row,t.columns[i.col]);this._dragCol=r.binding?r:null}_itemsSourceChanging(e,i){this._hiddenCols.forEach(e=>{e.visible=!0});this._hiddenCols=[]}_itemsSourceChanged(e,i){this._view&&this._view.collectionChanged.removeHandler(this._collectionChanged);this._view=this._g?this._g.collectionView:null;this._gds=this._view?this._view.groupDescriptions:null;this._view&&this._view.collectionChanged.addHandler(this._collectionChanged,this);this.invalidate()}_collectionChanged(e,i){i.action==wijmo_1.NotifyCollectionChangedAction.Reset&&this.invalidate()}_dragStart(e){wijmo_1._startDrag(e.dataTransfer,"move");this._dragMarker=e.target;this._dragCol=null}_dragOver(e){if(this._dragCol||this._dragMarker){e.dataTransfer.dropEffect="move";e.preventDefault();e.stopPropagation()}}_drop(e){this._dragMarker?this._moveGroup(this._dragMarker,e):this._dragCol&&this._addGroup(this._dragCol,e)}_dragEnd(e){this._dragMarker=this._dragCol=null}_click(e){let i=e.target,t=wijmo_1.closest(i,`.${wijmo_grid_1.FlexGridClsNames.cell}`);if(wijmo_1.hasClass(t,wijmo_grid_1.FlexGridClsNames.cell))if(wijmo_1.hasClass(i,wijmo_grid_filter_1.FlexGridFilterClsNames.filter)){if(t!=this._filterMarker){this._editFilter(t);this._filterMarker=t;return}}else if(wijmo_1.hasClass(i,wijmo_1.UtilitesClsNames.remove)){let e=this._getElementIndex(t);this._removeGroup(e)}else this._updateSort(e,t);this._filterMarker=null;this.hostElement.focus()}_updateSort(e,i){let t=this._g,r=t.collectionView;if(!r||!r.canSort||t.allowSorting==wijmo_grid_1.AllowSorting.None)return;let l=this._getElementIndex(i),s=this._gds[l],o=s instanceof wijmo_1.PropertyGroupDescription?s.propertyName:null,n=o?t.getColumn(o):null;if(!n||!n.allowSorting)return;let d=n.sortMemberPath||n.binding,a=-1,h=r.sortDescriptions;for(let e=0;e<h.length;e++)if(h[e].property==d){a=e;break}let _=new wijmo_grid_1.CellRangeEventArgs(t.columnHeaders,new wijmo_grid_1.CellRange(0,n.index),e);if(t.onSortingColumn(_)){let i=e.ctrlKey||e.metaKey,r=e.shiftKey;h.deferUpdate(()=>{if(i&&r)h.clear();else if(a<0){this._g.allowSorting!=wijmo_grid_1.AllowSorting.MultiColumn&&h.clear();let e=new wijmo_1.SortDescription(d,!0);h.push(e)}else{let e=h[a].ascending;if(i||this.isTouching&&!e)h.splice(a,1);else{let i=new wijmo_1.SortDescription(d,!e);h.splice(a,1,i)}}});t.onSortedColumn(_)}}}GroupPanel._ctrlTemplate="";exports.GroupPanel=GroupPanel;wijmo_1._registerModule("wijmo.grid.grouppanel",selfModule); |
/*! | ||
* | ||
* Wijmo Library 5.20242.21 | ||
* Wijmo Library 5.20242.30 | ||
* https://developer.mescius.com/wijmo | ||
@@ -14,2 +14,2 @@ * | ||
import{_getModule,Control,SortDescription,PropertyGroupDescription,NotifyCollectionChangedAction,assert,asBoolean,asNumber,asType,setCss,toggleClass,culture,_addCultureInfo,createElement,removeChild,_startDrag,hasClass,closest,_registerModule}from"@grapecity/wijmo";import{FlexGrid,CellRange,CellRangeEventArgs,AllowSorting}from"@grapecity/wijmo.grid";import*as selfModule from"@grapecity/wijmo.grid.grouppanel";export function softGridFilter(){return _getModule("wijmo.grid.filter")}_addCultureInfo("GroupPanel",{dragDrop:"Drag and Drop columns here to create Groups."});export class GroupPanel extends Control{constructor(e,t){super(e);this._hideGroupedCols=!0;this._showDragGlyphs=!0;this._maxGroups=6;this._hiddenCols=[];this._placeholder=null;this._dragEndBnd=this._dragEnd.bind(this);this._focusGd=null;let i=this.getTemplate();this.applyTemplate("wj-grouppanel wj-control",i,{_divMarkers:"div-markers",_divPH:"div-ph"});setCss(this._divMarkers.parentElement,{width:"100%",height:"100%",minHeight:"1em",overflow:"hidden",cursor:"default"});let r=this.hostElement,s=this.addEventListener.bind(this);s(r,"dragstart",this._dragStart.bind(this));s(r,"dragover",this._dragOver.bind(this));s(r,"drop",this._drop.bind(this));s(r,"dragend",this._dragEndBnd);s(r,"click",this._click.bind(this));this.initialize(t)}get hideGroupedColumns(){return this._hideGroupedCols}set hideGroupedColumns(e){e!=this._hideGroupedCols&&(this._hideGroupedCols=asBoolean(e))}get showDragGlyphs(){return this._showDragGlyphs}set showDragGlyphs(e){if(e!=this._showDragGlyphs){this._showDragGlyphs=asBoolean(e);this.refresh()}}get maxGroups(){return this._maxGroups}set maxGroups(e){if(e!=this._maxGroups){this._maxGroups=asNumber(e);let t=this._gds,i=this._maxGroups;t&&i>-1&&i<t.length&&t.splice(i,t.length-i)}}get placeholder(){return this._placeholder}set placeholder(e){if(e!=this._placeholder){this._placeholder=e;this.invalidate()}}get grid(){return this._g}set grid(e){if((e=asType(e,FlexGrid,!0))!=this._g){let t=this._g;if(t){t.draggingColumn.removeHandler(this._draggingColumn);t.itemsSourceChanging.removeHandler(this._itemsSourceChanging);t.itemsSourceChanged.removeHandler(this._itemsSourceChanged);t.columns.collectionChanged.removeHandler(this._itemsSourceChanged);t.removeEventListener(t.hostElement,"dragend",this._dragEndBnd)}t=this._g=e;this._hiddenCols=[];if(t){t.draggingColumn.addHandler(this._draggingColumn,this);t.itemsSourceChanging.addHandler(this._itemsSourceChanging,this);t.itemsSourceChanged.addHandler(this._itemsSourceChanged,this);t.columns.collectionChanged.addHandler(this._itemsSourceChanged,this);t.addEventListener(t.hostElement,"dragend",this._dragEndBnd)}this._itemsSourceChanged(t,null)}}get collectionView(){return this._g?this._g.collectionView:null}get filter(){return this._filter}set filter(e){if((e=asType(e,softGridFilter().FlexGridFilter,!0))!=this._filter){let t=this._filter;if(t){t.filterApplied.removeHandler(this.refresh,this);t.filterChanged.removeHandler(this._filterChanged,this)}if(t=this._filter=e){t.filterApplied.addHandler(this.refresh,this);t.filterChanged.addHandler(this._filterChanged,this)}this.refresh()}}get groupDescriptionCreator(){return this._gdc}set groupDescriptionCreator(e){this._gdc=e}refresh(){super.refresh();this._divMarkers.innerHTML="";this._dragMarker=this._dragCol=null;if(this._gds){let t=this._g,i=t.columnHeaders;for(let r=0;r<this._gds.length;r++){let s=this._gds[r],l=-1,n=-1;if(s instanceof PropertyGroupDescription)for(let e=i.rows.length-1;e>=0&&n<0;e--)for(let r=0;r<i.columns.length&&n<0;r++){let o=t._getBindingColumn(i,e,i.columns[r]);if(o&&o.binding==s.propertyName){n=r;l=e;break}}if(n>-1&&l>-1){let r=document.createElement("button");t.cellFactory.updateCell(this._g.columnHeaders,l,n,r);r.setAttribute("class","wj-cell wj-header wj-groupmarker");r.setAttribute("role","button");r.setAttribute("tabindex","0");r.addEventListener("focus",()=>{this._focusGd=s});this._focusGd===s&&this._focus&&setTimeout(()=>{r.focus()},50);r.addEventListener("keydown",e=>{if(!(46!==e.keyCode||e.altKey||e.shiftKey||e.ctrlKey||e.metaKey)){const t=e.path.find(e=>e.classList.contains("wj-groupmarker"));Array.from(t.children).find(e=>e.classList.contains("wj-remove")).click()}});setCss(r,{position:"static",display:"inline-block",verticalAlign:"top",left:"",right:"",top:"",width:"",height:"",paddingLeft:"",paddingRight:""});removeChild(r.querySelector(".wj-elem-filter"));removeChild(r.querySelector(".wj-column-selector"));if(this.showDragGlyphs){var e=createElement('<span class="wj-glyph-drag"></span>');r.insertBefore(e,r.firstChild)}let o=t._getBindingColumn(i,l,i.columns[n]),h=this._getColumnFilter(o);if(h){let e=createElement('<span class="wj-filter wj-glyph-filter"></span>',r);toggleClass(e,"wj-filter-on",h.isActive);toggleClass(e,"wj-filter-off",!h.isActive)}createElement('<span class="wj-remove">×</span>',r);this._divMarkers.appendChild(r);if(o&&this.hideGroupedColumns){const e=[];if(this.grid.layoutDefinition){this.grid.layoutDefinition.forEach(t=>t.cells.forEach(t=>e.push(t.binding)))}if(!e.includes(o._binding.path)){o.visible=!1;this._hiddenCols.push(o)}}}}this._divPH.textContent=null!=this._placeholder?this._placeholder:culture.GroupPanel.dragDrop;let r=this._divMarkers.children.length>0;this._divPH.style.display=r?"none":"";this._divMarkers.style.display=r?"":"none"}}hitTest(e){let t=e instanceof HTMLElement?e:e instanceof MouseEvent?e.target:null;assert(null!=t,"MouseEvent or Element expected");let i=closest(t,".wj-cell");if(hasClass(i,"wj-cell")){let e=this._getElementIndex(i);return this._gds&&e>-1?this._gds[e]:null}return null}_filterChanged(){this._filterMarker=null}_getColumnFilter(e){let t=this._filter,i=null;t&&(i=t.filterColumns&&t.filterColumns.indexOf(e.binding)<0?null:t.getColumnFilter(e));return i}_editFilter(e){let t=this._gds,i=this._getElementIndex(e),r=t&&i>-1?t[i]:null,s=r instanceof PropertyGroupDescription?r.propertyName:null,l=s?this._g.getColumn(s):null;l&&this._filter.editColumnFilter(l,null,e)}_addGroup(e,t){let i=this._getIndex(t),r=this._gds,s=this._maxGroups;for(let t=0;t<r.length;t++){let s=r[t];if(s instanceof PropertyGroupDescription&&s.propertyName==e.binding){r.removeAt(t);t<i&&i--;break}}if(s>-1)for(let e=s-1;e<r.length;e++){this._removeGroup(e,r);e<i&&i--}if(s<0||r.length<s){let t=this._gdc?this._gdc(e.binding):null;t||(t=new PropertyGroupDescription(e.binding));r.insert(i,t);if(e&&this.hideGroupedColumns){e.visible=!1;this._hiddenCols.push(e)}}}_moveGroup(e,t){let i=this._gds,r=this._getElementIndex(this._dragMarker),s=this._getIndex(t);s>r&&s--;s>=this._gds.length&&(s=this._gds.length);r!=s&&i.deferUpdate(()=>{let e=i[r];i.removeAt(r);i.insert(s,e)})}_removeGroup(e,t=this._gds){let i=t&&e>-1?t[e]:null,r=i instanceof PropertyGroupDescription?i.propertyName:null,s=r?this._g.columns.getColumn(r):null;if(s){s.visible=!0;let e=this._hiddenCols,t=e.indexOf(s);t>-1&&e.splice(t,1)}i&&t.removeAt(e)}_getIndex(e){let t=e.clientX,i=this._divMarkers.children;for(let e=0;e<i.length;e++){let r=i[e].getBoundingClientRect();if((t-r.left)*(t-r.right)<0)return e}return i.length}_getElementIndex(e){if(e&&e.parentElement){let t=e.parentElement.children;for(let i=0;i<t.length;i++)if(t[i]==e)return i}return-1}_draggingColumn(e,t){let i=this._g,r=i._getBindingColumn(t.panel,t.row,i.columns[t.col]);this._dragCol=r.binding?r:null}_itemsSourceChanging(e,t){this._hiddenCols.forEach(e=>{e.visible=!0});this._hiddenCols=[]}_itemsSourceChanged(e,t){this._view&&this._view.collectionChanged.removeHandler(this._collectionChanged);this._view=this._g?this._g.collectionView:null;this._gds=this._view?this._view.groupDescriptions:null;this._view&&this._view.collectionChanged.addHandler(this._collectionChanged,this);this.invalidate()}_collectionChanged(e,t){t.action==NotifyCollectionChangedAction.Reset&&this.invalidate()}_dragStart(e){_startDrag(e.dataTransfer,"move");this._dragMarker=e.target;this._dragCol=null}_dragOver(e){if(this._dragCol||this._dragMarker){e.dataTransfer.dropEffect="move";e.preventDefault();e.stopPropagation()}}_drop(e){this._dragMarker?this._moveGroup(this._dragMarker,e):this._dragCol&&this._addGroup(this._dragCol,e)}_dragEnd(e){this._dragMarker=this._dragCol=null}_click(e){let t=e.target,i=closest(t,".wj-cell");if(hasClass(i,"wj-cell"))if(hasClass(t,"wj-filter")){if(i!=this._filterMarker){this._editFilter(i);this._filterMarker=i;return}}else if(hasClass(t,"wj-remove")){let e=this._getElementIndex(i);this._removeGroup(e)}else this._updateSort(e,i);this._filterMarker=null;this.hostElement.focus()}_updateSort(e,t){let i=this._g,r=i.collectionView;if(!r||!r.canSort||i.allowSorting==AllowSorting.None)return;let s=this._getElementIndex(t),l=this._gds[s],n=l instanceof PropertyGroupDescription?l.propertyName:null,o=n?i.getColumn(n):null;if(!o||!o.allowSorting)return;let h=o.sortMemberPath||o.binding,d=-1,a=r.sortDescriptions;for(let e=0;e<a.length;e++)if(a[e].property==h){d=e;break}let g=new CellRangeEventArgs(i.columnHeaders,new CellRange(0,o.index),e);if(i.onSortingColumn(g)){let t=e.ctrlKey||e.metaKey,r=e.shiftKey;a.deferUpdate(()=>{if(t&&r)a.clear();else if(d<0){this._g.allowSorting!=AllowSorting.MultiColumn&&a.clear();let e=new SortDescription(h,!0);a.push(e)}else{let e=a[d].ascending;if(t||this.isTouching&&!e)a.splice(d,1);else{let t=new SortDescription(h,!e);a.splice(d,1,t)}}});i.onSortedColumn(g)}}}GroupPanel.controlTemplate='<div><div wj-part="div-ph"></div><div wj-part="div-markers"></div></div>';_registerModule("wijmo.grid.grouppanel",selfModule); | ||
import{_getModule,Control,SortDescription,PropertyGroupDescription,NotifyCollectionChangedAction,assert,asBoolean,asNumber,asType,setCss,toggleClass,culture,_addCultureInfo,createElement,removeChild,_startDrag,hasClass,closest,GlyphClsNames,ControlClsNames,UtilitesClsNames,_registerModule}from"@grapecity/wijmo";import{FlexGrid,CellRange,CellRangeEventArgs,AllowSorting,FlexGridClsNames}from"@grapecity/wijmo.grid";import{FlexGridFilterClsNames}from"@grapecity/wijmo.grid.filter";import*as selfModule from"@grapecity/wijmo.grid.grouppanel";export const GroupPanelClsNames={groupMarker:"wj-groupmarker",hostElement:"wj-grouppanel"};export function softGridFilter(){return _getModule("wijmo.grid.filter")}_addCultureInfo("GroupPanel",{dragDrop:"Drag and Drop columns here to create Groups."});export class GroupPanel extends Control{constructor(e,t){super(e);this._hideGroupedCols=!0;this._showDragGlyphs=!0;this._maxGroups=6;this._hiddenCols=[];this._placeholder=null;this._dragEndBnd=this._dragEnd.bind(this);this._focusGd=null;let i=this.getTemplate();this.applyTemplate(`${GroupPanelClsNames.hostElement} ${ControlClsNames.hostElement}`,i,{_divMarkers:"div-markers",_divPH:"div-ph"});setCss(this._divMarkers.parentElement,{width:"100%",height:"100%",minHeight:"1em",overflow:"hidden",cursor:"default"});let s=this.hostElement,r=this.addEventListener.bind(this);r(s,"dragstart",this._dragStart.bind(this));r(s,"dragover",this._dragOver.bind(this));r(s,"drop",this._drop.bind(this));r(s,"dragend",this._dragEndBnd);r(s,"click",this._click.bind(this));this.initialize(t)}static get controlTemplate(){GroupPanel._ctrlTemplate||(GroupPanel._ctrlTemplate='<div><div wj-part="div-ph"></div><div wj-part="div-markers"></div></div>');return GroupPanel._ctrlTemplate}static set controlTemplate(e){GroupPanel._ctrlTemplate=e}get hideGroupedColumns(){return this._hideGroupedCols}set hideGroupedColumns(e){e!=this._hideGroupedCols&&(this._hideGroupedCols=asBoolean(e))}get showDragGlyphs(){return this._showDragGlyphs}set showDragGlyphs(e){if(e!=this._showDragGlyphs){this._showDragGlyphs=asBoolean(e);this.refresh()}}get maxGroups(){return this._maxGroups}set maxGroups(e){if(e!=this._maxGroups){this._maxGroups=asNumber(e);let t=this._gds,i=this._maxGroups;t&&i>-1&&i<t.length&&t.splice(i,t.length-i)}}get placeholder(){return this._placeholder}set placeholder(e){if(e!=this._placeholder){this._placeholder=e;this.invalidate()}}get grid(){return this._g}set grid(e){if((e=asType(e,FlexGrid,!0))!=this._g){let t=this._g;if(t){t.draggingColumn.removeHandler(this._draggingColumn);t.itemsSourceChanging.removeHandler(this._itemsSourceChanging);t.itemsSourceChanged.removeHandler(this._itemsSourceChanged);t.columns.collectionChanged.removeHandler(this._itemsSourceChanged);t.removeEventListener(t.hostElement,"dragend",this._dragEndBnd)}t=this._g=e;this._hiddenCols=[];if(t){t.draggingColumn.addHandler(this._draggingColumn,this);t.itemsSourceChanging.addHandler(this._itemsSourceChanging,this);t.itemsSourceChanged.addHandler(this._itemsSourceChanged,this);t.columns.collectionChanged.addHandler(this._itemsSourceChanged,this);t.addEventListener(t.hostElement,"dragend",this._dragEndBnd)}this._itemsSourceChanged(t,null)}}get collectionView(){return this._g?this._g.collectionView:null}get filter(){return this._filter}set filter(e){if((e=asType(e,softGridFilter().FlexGridFilter,!0))!=this._filter){let t=this._filter;if(t){t.filterApplied.removeHandler(this.refresh,this);t.filterChanged.removeHandler(this._filterChanged,this)}if(t=this._filter=e){t.filterApplied.addHandler(this.refresh,this);t.filterChanged.addHandler(this._filterChanged,this)}this.refresh()}}get groupDescriptionCreator(){return this._gdc}set groupDescriptionCreator(e){this._gdc=e}refresh(){super.refresh();this._divMarkers.innerHTML="";this._dragMarker=this._dragCol=null;if(this._gds){let t=this._g,i=t.columnHeaders;for(let s=0;s<this._gds.length;s++){let r=this._gds[s],l=-1,n=-1;if(r instanceof PropertyGroupDescription)for(let e=i.rows.length-1;e>=0&&n<0;e--)for(let s=0;s<i.columns.length&&n<0;s++){let o=t._getBindingColumn(i,e,i.columns[s]);if(o&&o.binding==r.propertyName){n=s;l=e;break}}if(n>-1&&l>-1){let s=document.createElement("button");t.cellFactory.updateCell(this._g.columnHeaders,l,n,s);s.setAttribute("class",`${FlexGridClsNames.cell} ${FlexGridClsNames.header} ${GroupPanelClsNames.groupMarker}`);s.setAttribute("role","button");s.setAttribute("tabindex","0");s.addEventListener("focus",()=>{this._focusGd=r});this._focusGd===r&&this._focus&&setTimeout(()=>{s.focus()},50);s.addEventListener("keydown",e=>{if(!(46!==e.keyCode||e.altKey||e.shiftKey||e.ctrlKey||e.metaKey)){const t=e.path.find(e=>e.classList.contains(GroupPanelClsNames.groupMarker));Array.from(t.children).find(e=>e.classList.contains(UtilitesClsNames.remove)).click()}});setCss(s,{position:"static",display:"inline-block",verticalAlign:"top",left:"",right:"",top:"",width:"",height:"",paddingLeft:"",paddingRight:""});removeChild(s.querySelector(`.${FlexGridFilterClsNames.elemFilter}`));removeChild(s.querySelector(".wj-column-selector"));if(this.showDragGlyphs){var e=createElement(`<span class=${GlyphClsNames.drag}></span>`);s.insertBefore(e,s.firstChild)}let o=t._getBindingColumn(i,l,i.columns[n]),a=this._getColumnFilter(o);if(a){let e=createElement(`<span class="${FlexGridFilterClsNames.filter} ${GlyphClsNames.filter}"></span>`,s);toggleClass(e,FlexGridFilterClsNames.filterOn,a.isActive);toggleClass(e,FlexGridFilterClsNames.filterOff,!a.isActive)}createElement(`<span class="${UtilitesClsNames.remove}">×</span>`,s);this._divMarkers.appendChild(s);if(o&&this.hideGroupedColumns){const e=[];if(this.grid.layoutDefinition){this.grid.layoutDefinition.forEach(t=>t.cells.forEach(t=>e.push(t.binding)))}if(!e.includes(o._binding.path)){o.visible=!1;this._hiddenCols.push(o)}}}}this._divPH.textContent=null!=this._placeholder?this._placeholder:culture.GroupPanel.dragDrop;let s=this._divMarkers.children.length>0;this._divPH.style.display=s?"none":"";this._divMarkers.style.display=s?"":"none"}}hitTest(e){let t=e instanceof HTMLElement?e:e instanceof MouseEvent?e.target:null;assert(null!=t,"MouseEvent or Element expected");let i=closest(t,`.${FlexGridClsNames.cell}`);if(hasClass(i,FlexGridClsNames.cell)){let e=this._getElementIndex(i);return this._gds&&e>-1?this._gds[e]:null}return null}_filterChanged(){this._filterMarker=null}_getColumnFilter(e){let t=this._filter,i=null;t&&(i=t.filterColumns&&t.filterColumns.indexOf(e.binding)<0?null:t.getColumnFilter(e));return i}_editFilter(e){let t=this._gds,i=this._getElementIndex(e),s=t&&i>-1?t[i]:null,r=s instanceof PropertyGroupDescription?s.propertyName:null,l=r?this._g.getColumn(r):null;l&&this._filter.editColumnFilter(l,null,e)}_addGroup(e,t){let i=this._getIndex(t),s=this._gds,r=this._maxGroups;for(let t=0;t<s.length;t++){let r=s[t];if(r instanceof PropertyGroupDescription&&r.propertyName==e.binding){s.removeAt(t);t<i&&i--;break}}if(r>-1)for(let e=r-1;e<s.length;e++){this._removeGroup(e,s);e<i&&i--}if(r<0||s.length<r){let t=this._gdc?this._gdc(e.binding):null;t||(t=new PropertyGroupDescription(e.binding));s.insert(i,t);if(e&&this.hideGroupedColumns){e.visible=!1;this._hiddenCols.push(e)}}}_moveGroup(e,t){let i=this._gds,s=this._getElementIndex(this._dragMarker),r=this._getIndex(t);r>s&&r--;r>=this._gds.length&&(r=this._gds.length);s!=r&&i.deferUpdate(()=>{let e=i[s];i.removeAt(s);i.insert(r,e)})}_removeGroup(e,t=this._gds){let i=t&&e>-1?t[e]:null,s=i instanceof PropertyGroupDescription?i.propertyName:null,r=s?this._g.columns.getColumn(s):null;if(r){r.visible=!0;let e=this._hiddenCols,t=e.indexOf(r);t>-1&&e.splice(t,1)}i&&t.removeAt(e)}_getIndex(e){let t=e.clientX,i=this._divMarkers.children;for(let e=0;e<i.length;e++){let s=i[e].getBoundingClientRect();if((t-s.left)*(t-s.right)<0)return e}return i.length}_getElementIndex(e){if(e&&e.parentElement){let t=e.parentElement.children;for(let i=0;i<t.length;i++)if(t[i]==e)return i}return-1}_draggingColumn(e,t){let i=this._g,s=i._getBindingColumn(t.panel,t.row,i.columns[t.col]);this._dragCol=s.binding?s:null}_itemsSourceChanging(e,t){this._hiddenCols.forEach(e=>{e.visible=!0});this._hiddenCols=[]}_itemsSourceChanged(e,t){this._view&&this._view.collectionChanged.removeHandler(this._collectionChanged);this._view=this._g?this._g.collectionView:null;this._gds=this._view?this._view.groupDescriptions:null;this._view&&this._view.collectionChanged.addHandler(this._collectionChanged,this);this.invalidate()}_collectionChanged(e,t){t.action==NotifyCollectionChangedAction.Reset&&this.invalidate()}_dragStart(e){_startDrag(e.dataTransfer,"move");this._dragMarker=e.target;this._dragCol=null}_dragOver(e){if(this._dragCol||this._dragMarker){e.dataTransfer.dropEffect="move";e.preventDefault();e.stopPropagation()}}_drop(e){this._dragMarker?this._moveGroup(this._dragMarker,e):this._dragCol&&this._addGroup(this._dragCol,e)}_dragEnd(e){this._dragMarker=this._dragCol=null}_click(e){let t=e.target,i=closest(t,`.${FlexGridClsNames.cell}`);if(hasClass(i,FlexGridClsNames.cell))if(hasClass(t,FlexGridFilterClsNames.filter)){if(i!=this._filterMarker){this._editFilter(i);this._filterMarker=i;return}}else if(hasClass(t,UtilitesClsNames.remove)){let e=this._getElementIndex(i);this._removeGroup(e)}else this._updateSort(e,i);this._filterMarker=null;this.hostElement.focus()}_updateSort(e,t){let i=this._g,s=i.collectionView;if(!s||!s.canSort||i.allowSorting==AllowSorting.None)return;let r=this._getElementIndex(t),l=this._gds[r],n=l instanceof PropertyGroupDescription?l.propertyName:null,o=n?i.getColumn(n):null;if(!o||!o.allowSorting)return;let a=o.sortMemberPath||o.binding,d=-1,h=s.sortDescriptions;for(let e=0;e<h.length;e++)if(h[e].property==a){d=e;break}let g=new CellRangeEventArgs(i.columnHeaders,new CellRange(0,o.index),e);if(i.onSortingColumn(g)){let t=e.ctrlKey||e.metaKey,s=e.shiftKey;h.deferUpdate(()=>{if(t&&s)h.clear();else if(d<0){this._g.allowSorting!=AllowSorting.MultiColumn&&h.clear();let e=new SortDescription(a,!0);h.push(e)}else{let e=h[d].ascending;if(t||this.isTouching&&!e)h.splice(d,1);else{let t=new SortDescription(a,!e);h.splice(d,1,t)}}});i.onSortedColumn(g)}}}GroupPanel._ctrlTemplate="";_registerModule("wijmo.grid.grouppanel",selfModule); |
/*! | ||
* | ||
* Wijmo Library 5.20242.21 | ||
* Wijmo Library 5.20242.30 | ||
* https://developer.mescius.com/wijmo | ||
@@ -14,2 +14,2 @@ * | ||
var __extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}();import{_getModule,Control,SortDescription,PropertyGroupDescription,NotifyCollectionChangedAction,assert,asBoolean,asNumber,asType,setCss,toggleClass,culture,_addCultureInfo,createElement,removeChild,_startDrag,hasClass,closest,_registerModule}from"@grapecity/wijmo";import{FlexGrid,CellRange,CellRangeEventArgs,AllowSorting}from"@grapecity/wijmo.grid";import*as selfModule from"@grapecity/wijmo.grid.grouppanel";export function softGridFilter(){return _getModule("wijmo.grid.filter")}_addCultureInfo("GroupPanel",{dragDrop:"Drag and Drop columns here to create Groups."});var GroupPanel=function(e){__extends(GroupPanel,e);function GroupPanel(t,r){var i=e.call(this,t)||this;i._hideGroupedCols=!0;i._showDragGlyphs=!0;i._maxGroups=6;i._hiddenCols=[];i._placeholder=null;i._dragEndBnd=i._dragEnd.bind(i);i._focusGd=null;var n=i.getTemplate();i.applyTemplate("wj-grouppanel wj-control",n,{_divMarkers:"div-markers",_divPH:"div-ph"});setCss(i._divMarkers.parentElement,{width:"100%",height:"100%",minHeight:"1em",overflow:"hidden",cursor:"default"});var o=i.hostElement,l=i.addEventListener.bind(i);l(o,"dragstart",i._dragStart.bind(i));l(o,"dragover",i._dragOver.bind(i));l(o,"drop",i._drop.bind(i));l(o,"dragend",i._dragEndBnd);l(o,"click",i._click.bind(i));i.initialize(r);return i}Object.defineProperty(GroupPanel.prototype,"hideGroupedColumns",{get:function(){return this._hideGroupedCols},set:function(e){e!=this._hideGroupedCols&&(this._hideGroupedCols=asBoolean(e))},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"showDragGlyphs",{get:function(){return this._showDragGlyphs},set:function(e){if(e!=this._showDragGlyphs){this._showDragGlyphs=asBoolean(e);this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"maxGroups",{get:function(){return this._maxGroups},set:function(e){if(e!=this._maxGroups){this._maxGroups=asNumber(e);var t=this._gds,r=this._maxGroups;t&&r>-1&&r<t.length&&t.splice(r,t.length-r)}},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"placeholder",{get:function(){return this._placeholder},set:function(e){if(e!=this._placeholder){this._placeholder=e;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"grid",{get:function(){return this._g},set:function(e){if((e=asType(e,FlexGrid,!0))!=this._g){var t=this._g;if(t){t.draggingColumn.removeHandler(this._draggingColumn);t.itemsSourceChanging.removeHandler(this._itemsSourceChanging);t.itemsSourceChanged.removeHandler(this._itemsSourceChanged);t.columns.collectionChanged.removeHandler(this._itemsSourceChanged);t.removeEventListener(t.hostElement,"dragend",this._dragEndBnd)}t=this._g=e;this._hiddenCols=[];if(t){t.draggingColumn.addHandler(this._draggingColumn,this);t.itemsSourceChanging.addHandler(this._itemsSourceChanging,this);t.itemsSourceChanged.addHandler(this._itemsSourceChanged,this);t.columns.collectionChanged.addHandler(this._itemsSourceChanged,this);t.addEventListener(t.hostElement,"dragend",this._dragEndBnd)}this._itemsSourceChanged(t,null)}},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"collectionView",{get:function(){return this._g?this._g.collectionView:null},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"filter",{get:function(){return this._filter},set:function(e){if((e=asType(e,softGridFilter().FlexGridFilter,!0))!=this._filter){var t=this._filter;if(t){t.filterApplied.removeHandler(this.refresh,this);t.filterChanged.removeHandler(this._filterChanged,this)}if(t=this._filter=e){t.filterApplied.addHandler(this.refresh,this);t.filterChanged.addHandler(this._filterChanged,this)}this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"groupDescriptionCreator",{get:function(){return this._gdc},set:function(e){this._gdc=e},enumerable:!0,configurable:!0});GroupPanel.prototype.refresh=function(){var t=this;e.prototype.refresh.call(this);this._divMarkers.innerHTML="";this._dragMarker=this._dragCol=null;if(this._gds){for(var r,i=this._g,n=i.columnHeaders,_loop_1=function(e){var l=o._gds[e],s=-1,a=-1;if(l instanceof PropertyGroupDescription)for(var d=n.rows.length-1;d>=0&&a<0;d--)for(var u=0;u<n.columns.length&&a<0;u++){if((p=i._getBindingColumn(n,d,n.columns[u]))&&p.binding==l.propertyName){a=u;s=d;break}}if(a>-1&&s>-1){var h=document.createElement("button");i.cellFactory.updateCell(o._g.columnHeaders,s,a,h);h.setAttribute("class","wj-cell wj-header wj-groupmarker");h.setAttribute("role","button");h.setAttribute("tabindex","0");h.addEventListener("focus",(function(){t._focusGd=l}));o._focusGd===l&&o._focus&&setTimeout((function(){h.focus()}),50);h.addEventListener("keydown",(function(e){if(!(46!==e.keyCode||e.altKey||e.shiftKey||e.ctrlKey||e.metaKey)){var t=e.path.find((function(e){return e.classList.contains("wj-groupmarker")}));Array.from(t.children).find((function(e){return e.classList.contains("wj-remove")})).click()}}));setCss(h,{position:"static",display:"inline-block",verticalAlign:"top",left:"",right:"",top:"",width:"",height:"",paddingLeft:"",paddingRight:""});removeChild(h.querySelector(".wj-elem-filter"));removeChild(h.querySelector(".wj-column-selector"));if(o.showDragGlyphs){r=createElement('<span class="wj-glyph-drag"></span>');h.insertBefore(r,h.firstChild)}var p=i._getBindingColumn(n,s,n.columns[a]),c=o._getColumnFilter(p);if(c){var g=createElement('<span class="wj-filter wj-glyph-filter"></span>',h);toggleClass(g,"wj-filter-on",c.isActive);toggleClass(g,"wj-filter-off",!c.isActive)}createElement('<span class="wj-remove">×</span>',h);o._divMarkers.appendChild(h);if(p&&o.hideGroupedColumns){var f=[];if(o.grid.layoutDefinition){o.grid.layoutDefinition.forEach((function(e){return e.cells.forEach((function(e){return f.push(e.binding)}))}))}if(!f.includes(p._binding.path)){p.visible=!1;o._hiddenCols.push(p)}}}},o=this,l=0;l<this._gds.length;l++)_loop_1(l);this._divPH.textContent=null!=this._placeholder?this._placeholder:culture.GroupPanel.dragDrop;var s=this._divMarkers.children.length>0;this._divPH.style.display=s?"none":"";this._divMarkers.style.display=s?"":"none"}};GroupPanel.prototype.hitTest=function(e){var t=e instanceof HTMLElement?e:e instanceof MouseEvent?e.target:null;assert(null!=t,"MouseEvent or Element expected");var r=closest(t,".wj-cell");if(hasClass(r,"wj-cell")){var i=this._getElementIndex(r);return this._gds&&i>-1?this._gds[i]:null}return null};GroupPanel.prototype._filterChanged=function(){this._filterMarker=null};GroupPanel.prototype._getColumnFilter=function(e){var t=this._filter,r=null;t&&(r=t.filterColumns&&t.filterColumns.indexOf(e.binding)<0?null:t.getColumnFilter(e));return r};GroupPanel.prototype._editFilter=function(e){var t=this._gds,r=this._getElementIndex(e),i=t&&r>-1?t[r]:null,n=i instanceof PropertyGroupDescription?i.propertyName:null,o=n?this._g.getColumn(n):null;o&&this._filter.editColumnFilter(o,null,e)};GroupPanel.prototype._addGroup=function(e,t){for(var r=this._getIndex(t),i=this._gds,n=this._maxGroups,o=0;o<i.length;o++){var l=i[o];if(l instanceof PropertyGroupDescription&&l.propertyName==e.binding){i.removeAt(o);o<r&&r--;break}}if(n>-1)for(o=n-1;o<i.length;o++){this._removeGroup(o,i);o<r&&r--}if(n<0||i.length<n){var s=this._gdc?this._gdc(e.binding):null;s||(s=new PropertyGroupDescription(e.binding));i.insert(r,s);if(e&&this.hideGroupedColumns){e.visible=!1;this._hiddenCols.push(e)}}};GroupPanel.prototype._moveGroup=function(e,t){var r=this._gds,i=this._getElementIndex(this._dragMarker),n=this._getIndex(t);n>i&&n--;n>=this._gds.length&&(n=this._gds.length);i!=n&&r.deferUpdate((function(){var e=r[i];r.removeAt(i);r.insert(n,e)}))};GroupPanel.prototype._removeGroup=function(e,t){void 0===t&&(t=this._gds);var r=t&&e>-1?t[e]:null,i=r instanceof PropertyGroupDescription?r.propertyName:null,n=i?this._g.columns.getColumn(i):null;if(n){n.visible=!0;var o=this._hiddenCols,l=o.indexOf(n);l>-1&&o.splice(l,1)}r&&t.removeAt(e)};GroupPanel.prototype._getIndex=function(e){for(var t=e.clientX,r=this._divMarkers.children,i=0;i<r.length;i++){var n=r[i].getBoundingClientRect();if((t-n.left)*(t-n.right)<0)return i}return r.length};GroupPanel.prototype._getElementIndex=function(e){if(e&&e.parentElement)for(var t=e.parentElement.children,r=0;r<t.length;r++)if(t[r]==e)return r;return-1};GroupPanel.prototype._draggingColumn=function(e,t){var r=this._g,i=r._getBindingColumn(t.panel,t.row,r.columns[t.col]);this._dragCol=i.binding?i:null};GroupPanel.prototype._itemsSourceChanging=function(e,t){this._hiddenCols.forEach((function(e){e.visible=!0}));this._hiddenCols=[]};GroupPanel.prototype._itemsSourceChanged=function(e,t){this._view&&this._view.collectionChanged.removeHandler(this._collectionChanged);this._view=this._g?this._g.collectionView:null;this._gds=this._view?this._view.groupDescriptions:null;this._view&&this._view.collectionChanged.addHandler(this._collectionChanged,this);this.invalidate()};GroupPanel.prototype._collectionChanged=function(e,t){t.action==NotifyCollectionChangedAction.Reset&&this.invalidate()};GroupPanel.prototype._dragStart=function(e){_startDrag(e.dataTransfer,"move");this._dragMarker=e.target;this._dragCol=null};GroupPanel.prototype._dragOver=function(e){if(this._dragCol||this._dragMarker){e.dataTransfer.dropEffect="move";e.preventDefault();e.stopPropagation()}};GroupPanel.prototype._drop=function(e){this._dragMarker?this._moveGroup(this._dragMarker,e):this._dragCol&&this._addGroup(this._dragCol,e)};GroupPanel.prototype._dragEnd=function(e){this._dragMarker=this._dragCol=null};GroupPanel.prototype._click=function(e){var t=e.target,r=closest(t,".wj-cell");if(hasClass(r,"wj-cell"))if(hasClass(t,"wj-filter")){if(r!=this._filterMarker){this._editFilter(r);this._filterMarker=r;return}}else if(hasClass(t,"wj-remove")){var i=this._getElementIndex(r);this._removeGroup(i)}else this._updateSort(e,r);this._filterMarker=null;this.hostElement.focus()};GroupPanel.prototype._updateSort=function(e,t){var r=this,i=this._g,n=i.collectionView;if(n&&n.canSort&&i.allowSorting!=AllowSorting.None){var o=this._getElementIndex(t),l=this._gds[o],s=l instanceof PropertyGroupDescription?l.propertyName:null,a=s?i.getColumn(s):null;if(a&&a.allowSorting){for(var d=a.sortMemberPath||a.binding,u=-1,h=n.sortDescriptions,p=0;p<h.length;p++)if(h[p].property==d){u=p;break}var c=new CellRangeEventArgs(i.columnHeaders,new CellRange(0,a.index),e);if(i.onSortingColumn(c)){var g=e.ctrlKey||e.metaKey,f=e.shiftKey;h.deferUpdate((function(){if(g&&f)h.clear();else if(u<0){r._g.allowSorting!=AllowSorting.MultiColumn&&h.clear();var e=new SortDescription(d,!0);h.push(e)}else{var t=h[u].ascending;if(g||r.isTouching&&!t)h.splice(u,1);else{e=new SortDescription(d,!t);h.splice(u,1,e)}}}));i.onSortedColumn(c)}}}};GroupPanel.controlTemplate='<div><div wj-part="div-ph"></div><div wj-part="div-markers"></div></div>';return GroupPanel}(Control);export{GroupPanel};_registerModule("wijmo.grid.grouppanel",selfModule); | ||
var __extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}();import{_getModule,Control,SortDescription,PropertyGroupDescription,NotifyCollectionChangedAction,assert,asBoolean,asNumber,asType,setCss,toggleClass,culture,_addCultureInfo,createElement,removeChild,_startDrag,hasClass,closest,GlyphClsNames,ControlClsNames,UtilitesClsNames,_registerModule}from"@grapecity/wijmo";import{FlexGrid,CellRange,CellRangeEventArgs,AllowSorting,FlexGridClsNames}from"@grapecity/wijmo.grid";import{FlexGridFilterClsNames}from"@grapecity/wijmo.grid.filter";import*as selfModule from"@grapecity/wijmo.grid.grouppanel";export var GroupPanelClsNames={groupMarker:"wj-groupmarker",hostElement:"wj-grouppanel"};export function softGridFilter(){return _getModule("wijmo.grid.filter")}_addCultureInfo("GroupPanel",{dragDrop:"Drag and Drop columns here to create Groups."});var GroupPanel=function(e){__extends(GroupPanel,e);function GroupPanel(t,r){var i=e.call(this,t)||this;i._hideGroupedCols=!0;i._showDragGlyphs=!0;i._maxGroups=6;i._hiddenCols=[];i._placeholder=null;i._dragEndBnd=i._dragEnd.bind(i);i._focusGd=null;var n=i.getTemplate();i.applyTemplate(GroupPanelClsNames.hostElement+" "+ControlClsNames.hostElement,n,{_divMarkers:"div-markers",_divPH:"div-ph"});setCss(i._divMarkers.parentElement,{width:"100%",height:"100%",minHeight:"1em",overflow:"hidden",cursor:"default"});var o=i.hostElement,l=i.addEventListener.bind(i);l(o,"dragstart",i._dragStart.bind(i));l(o,"dragover",i._dragOver.bind(i));l(o,"drop",i._drop.bind(i));l(o,"dragend",i._dragEndBnd);l(o,"click",i._click.bind(i));i.initialize(r);return i}Object.defineProperty(GroupPanel,"controlTemplate",{get:function(){GroupPanel._ctrlTemplate||(GroupPanel._ctrlTemplate='<div><div wj-part="div-ph"></div><div wj-part="div-markers"></div></div>');return GroupPanel._ctrlTemplate},set:function(e){GroupPanel._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"hideGroupedColumns",{get:function(){return this._hideGroupedCols},set:function(e){e!=this._hideGroupedCols&&(this._hideGroupedCols=asBoolean(e))},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"showDragGlyphs",{get:function(){return this._showDragGlyphs},set:function(e){if(e!=this._showDragGlyphs){this._showDragGlyphs=asBoolean(e);this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"maxGroups",{get:function(){return this._maxGroups},set:function(e){if(e!=this._maxGroups){this._maxGroups=asNumber(e);var t=this._gds,r=this._maxGroups;t&&r>-1&&r<t.length&&t.splice(r,t.length-r)}},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"placeholder",{get:function(){return this._placeholder},set:function(e){if(e!=this._placeholder){this._placeholder=e;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"grid",{get:function(){return this._g},set:function(e){if((e=asType(e,FlexGrid,!0))!=this._g){var t=this._g;if(t){t.draggingColumn.removeHandler(this._draggingColumn);t.itemsSourceChanging.removeHandler(this._itemsSourceChanging);t.itemsSourceChanged.removeHandler(this._itemsSourceChanged);t.columns.collectionChanged.removeHandler(this._itemsSourceChanged);t.removeEventListener(t.hostElement,"dragend",this._dragEndBnd)}t=this._g=e;this._hiddenCols=[];if(t){t.draggingColumn.addHandler(this._draggingColumn,this);t.itemsSourceChanging.addHandler(this._itemsSourceChanging,this);t.itemsSourceChanged.addHandler(this._itemsSourceChanged,this);t.columns.collectionChanged.addHandler(this._itemsSourceChanged,this);t.addEventListener(t.hostElement,"dragend",this._dragEndBnd)}this._itemsSourceChanged(t,null)}},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"collectionView",{get:function(){return this._g?this._g.collectionView:null},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"filter",{get:function(){return this._filter},set:function(e){if((e=asType(e,softGridFilter().FlexGridFilter,!0))!=this._filter){var t=this._filter;if(t){t.filterApplied.removeHandler(this.refresh,this);t.filterChanged.removeHandler(this._filterChanged,this)}if(t=this._filter=e){t.filterApplied.addHandler(this.refresh,this);t.filterChanged.addHandler(this._filterChanged,this)}this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"groupDescriptionCreator",{get:function(){return this._gdc},set:function(e){this._gdc=e},enumerable:!0,configurable:!0});GroupPanel.prototype.refresh=function(){var t=this;e.prototype.refresh.call(this);this._divMarkers.innerHTML="";this._dragMarker=this._dragCol=null;if(this._gds){for(var r,i=this._g,n=i.columnHeaders,_loop_1=function(e){var l=o._gds[e],s=-1,a=-1;if(l instanceof PropertyGroupDescription)for(var d=n.rows.length-1;d>=0&&a<0;d--)for(var u=0;u<n.columns.length&&a<0;u++){if((h=i._getBindingColumn(n,d,n.columns[u]))&&h.binding==l.propertyName){a=u;s=d;break}}if(a>-1&&s>-1){var p=document.createElement("button");i.cellFactory.updateCell(o._g.columnHeaders,s,a,p);p.setAttribute("class",FlexGridClsNames.cell+" "+FlexGridClsNames.header+" "+GroupPanelClsNames.groupMarker);p.setAttribute("role","button");p.setAttribute("tabindex","0");p.addEventListener("focus",(function(){t._focusGd=l}));o._focusGd===l&&o._focus&&setTimeout((function(){p.focus()}),50);p.addEventListener("keydown",(function(e){if(!(46!==e.keyCode||e.altKey||e.shiftKey||e.ctrlKey||e.metaKey)){var t=e.path.find((function(e){return e.classList.contains(GroupPanelClsNames.groupMarker)}));Array.from(t.children).find((function(e){return e.classList.contains(UtilitesClsNames.remove)})).click()}}));setCss(p,{position:"static",display:"inline-block",verticalAlign:"top",left:"",right:"",top:"",width:"",height:"",paddingLeft:"",paddingRight:""});removeChild(p.querySelector("."+FlexGridFilterClsNames.elemFilter));removeChild(p.querySelector(".wj-column-selector"));if(o.showDragGlyphs){r=createElement("<span class="+GlyphClsNames.drag+"></span>");p.insertBefore(r,p.firstChild)}var h=i._getBindingColumn(n,s,n.columns[a]),c=o._getColumnFilter(h);if(c){var g=createElement('<span class="'+FlexGridFilterClsNames.filter+" "+GlyphClsNames.filter+'"></span>',p);toggleClass(g,FlexGridFilterClsNames.filterOn,c.isActive);toggleClass(g,FlexGridFilterClsNames.filterOff,!c.isActive)}createElement('<span class="'+UtilitesClsNames.remove+'">×</span>',p);o._divMarkers.appendChild(p);if(h&&o.hideGroupedColumns){var f=[];if(o.grid.layoutDefinition){o.grid.layoutDefinition.forEach((function(e){return e.cells.forEach((function(e){return f.push(e.binding)}))}))}if(!f.includes(h._binding.path)){h.visible=!1;o._hiddenCols.push(h)}}}},o=this,l=0;l<this._gds.length;l++)_loop_1(l);this._divPH.textContent=null!=this._placeholder?this._placeholder:culture.GroupPanel.dragDrop;var s=this._divMarkers.children.length>0;this._divPH.style.display=s?"none":"";this._divMarkers.style.display=s?"":"none"}};GroupPanel.prototype.hitTest=function(e){var t=e instanceof HTMLElement?e:e instanceof MouseEvent?e.target:null;assert(null!=t,"MouseEvent or Element expected");var r=closest(t,"."+FlexGridClsNames.cell);if(hasClass(r,FlexGridClsNames.cell)){var i=this._getElementIndex(r);return this._gds&&i>-1?this._gds[i]:null}return null};GroupPanel.prototype._filterChanged=function(){this._filterMarker=null};GroupPanel.prototype._getColumnFilter=function(e){var t=this._filter,r=null;t&&(r=t.filterColumns&&t.filterColumns.indexOf(e.binding)<0?null:t.getColumnFilter(e));return r};GroupPanel.prototype._editFilter=function(e){var t=this._gds,r=this._getElementIndex(e),i=t&&r>-1?t[r]:null,n=i instanceof PropertyGroupDescription?i.propertyName:null,o=n?this._g.getColumn(n):null;o&&this._filter.editColumnFilter(o,null,e)};GroupPanel.prototype._addGroup=function(e,t){for(var r=this._getIndex(t),i=this._gds,n=this._maxGroups,o=0;o<i.length;o++){var l=i[o];if(l instanceof PropertyGroupDescription&&l.propertyName==e.binding){i.removeAt(o);o<r&&r--;break}}if(n>-1)for(o=n-1;o<i.length;o++){this._removeGroup(o,i);o<r&&r--}if(n<0||i.length<n){var s=this._gdc?this._gdc(e.binding):null;s||(s=new PropertyGroupDescription(e.binding));i.insert(r,s);if(e&&this.hideGroupedColumns){e.visible=!1;this._hiddenCols.push(e)}}};GroupPanel.prototype._moveGroup=function(e,t){var r=this._gds,i=this._getElementIndex(this._dragMarker),n=this._getIndex(t);n>i&&n--;n>=this._gds.length&&(n=this._gds.length);i!=n&&r.deferUpdate((function(){var e=r[i];r.removeAt(i);r.insert(n,e)}))};GroupPanel.prototype._removeGroup=function(e,t){void 0===t&&(t=this._gds);var r=t&&e>-1?t[e]:null,i=r instanceof PropertyGroupDescription?r.propertyName:null,n=i?this._g.columns.getColumn(i):null;if(n){n.visible=!0;var o=this._hiddenCols,l=o.indexOf(n);l>-1&&o.splice(l,1)}r&&t.removeAt(e)};GroupPanel.prototype._getIndex=function(e){for(var t=e.clientX,r=this._divMarkers.children,i=0;i<r.length;i++){var n=r[i].getBoundingClientRect();if((t-n.left)*(t-n.right)<0)return i}return r.length};GroupPanel.prototype._getElementIndex=function(e){if(e&&e.parentElement)for(var t=e.parentElement.children,r=0;r<t.length;r++)if(t[r]==e)return r;return-1};GroupPanel.prototype._draggingColumn=function(e,t){var r=this._g,i=r._getBindingColumn(t.panel,t.row,r.columns[t.col]);this._dragCol=i.binding?i:null};GroupPanel.prototype._itemsSourceChanging=function(e,t){this._hiddenCols.forEach((function(e){e.visible=!0}));this._hiddenCols=[]};GroupPanel.prototype._itemsSourceChanged=function(e,t){this._view&&this._view.collectionChanged.removeHandler(this._collectionChanged);this._view=this._g?this._g.collectionView:null;this._gds=this._view?this._view.groupDescriptions:null;this._view&&this._view.collectionChanged.addHandler(this._collectionChanged,this);this.invalidate()};GroupPanel.prototype._collectionChanged=function(e,t){t.action==NotifyCollectionChangedAction.Reset&&this.invalidate()};GroupPanel.prototype._dragStart=function(e){_startDrag(e.dataTransfer,"move");this._dragMarker=e.target;this._dragCol=null};GroupPanel.prototype._dragOver=function(e){if(this._dragCol||this._dragMarker){e.dataTransfer.dropEffect="move";e.preventDefault();e.stopPropagation()}};GroupPanel.prototype._drop=function(e){this._dragMarker?this._moveGroup(this._dragMarker,e):this._dragCol&&this._addGroup(this._dragCol,e)};GroupPanel.prototype._dragEnd=function(e){this._dragMarker=this._dragCol=null};GroupPanel.prototype._click=function(e){var t=e.target,r=closest(t,"."+FlexGridClsNames.cell);if(hasClass(r,FlexGridClsNames.cell))if(hasClass(t,FlexGridFilterClsNames.filter)){if(r!=this._filterMarker){this._editFilter(r);this._filterMarker=r;return}}else if(hasClass(t,UtilitesClsNames.remove)){var i=this._getElementIndex(r);this._removeGroup(i)}else this._updateSort(e,r);this._filterMarker=null;this.hostElement.focus()};GroupPanel.prototype._updateSort=function(e,t){var r=this,i=this._g,n=i.collectionView;if(n&&n.canSort&&i.allowSorting!=AllowSorting.None){var o=this._getElementIndex(t),l=this._gds[o],s=l instanceof PropertyGroupDescription?l.propertyName:null,a=s?i.getColumn(s):null;if(a&&a.allowSorting){for(var d=a.sortMemberPath||a.binding,u=-1,p=n.sortDescriptions,h=0;h<p.length;h++)if(p[h].property==d){u=h;break}var c=new CellRangeEventArgs(i.columnHeaders,new CellRange(0,a.index),e);if(i.onSortingColumn(c)){var g=e.ctrlKey||e.metaKey,f=e.shiftKey;p.deferUpdate((function(){if(g&&f)p.clear();else if(u<0){r._g.allowSorting!=AllowSorting.MultiColumn&&p.clear();var e=new SortDescription(d,!0);p.push(e)}else{var t=p[u].ascending;if(g||r.isTouching&&!t)p.splice(u,1);else{e=new SortDescription(d,!t);p.splice(u,1,e)}}}));i.onSortedColumn(c)}}}};GroupPanel._ctrlTemplate="";return GroupPanel}(Control);export{GroupPanel};_registerModule("wijmo.grid.grouppanel",selfModule); |
/*! | ||
* | ||
* Wijmo Library 5.20242.21 | ||
* Wijmo Library 5.20242.30 | ||
* https://developer.mescius.com/wijmo | ||
@@ -26,2 +26,6 @@ * | ||
import * as gridFilter from '@grapecity/wijmo.grid.filter'; | ||
export declare const GroupPanelClsNames: { | ||
groupMarker: string; | ||
hostElement: string; | ||
}; | ||
export declare function softGridFilter(): typeof gridFilter; | ||
@@ -90,2 +94,3 @@ /** | ||
_focusGd: GroupDescription; | ||
static _ctrlTemplate: string; | ||
/** | ||
@@ -92,0 +97,0 @@ * Gets or sets the template used to instantiate {@link GroupPanel} controls. |
/*! | ||
* | ||
* Wijmo Library 5.20242.21 | ||
* Wijmo Library 5.20242.30 | ||
* https://developer.mescius.com/wijmo | ||
@@ -14,2 +14,2 @@ * | ||
"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}(),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);t.default=e;return t};Object.defineProperty(exports,"__esModule",{value:!0});var wijmo_1=require("@grapecity/wijmo"),wijmo_grid_1=require("@grapecity/wijmo.grid"),selfModule=__importStar(require("@grapecity/wijmo.grid.grouppanel"));function softGridFilter(){return wijmo_1._getModule("wijmo.grid.filter")}exports.softGridFilter=softGridFilter;wijmo_1._addCultureInfo("GroupPanel",{dragDrop:"Drag and Drop columns here to create Groups."});var GroupPanel=function(e){__extends(GroupPanel,e);function GroupPanel(t,r){var i=e.call(this,t)||this;i._hideGroupedCols=!0;i._showDragGlyphs=!0;i._maxGroups=6;i._hiddenCols=[];i._placeholder=null;i._dragEndBnd=i._dragEnd.bind(i);i._focusGd=null;var n=i.getTemplate();i.applyTemplate("wj-grouppanel wj-control",n,{_divMarkers:"div-markers",_divPH:"div-ph"});wijmo_1.setCss(i._divMarkers.parentElement,{width:"100%",height:"100%",minHeight:"1em",overflow:"hidden",cursor:"default"});var o=i.hostElement,l=i.addEventListener.bind(i);l(o,"dragstart",i._dragStart.bind(i));l(o,"dragover",i._dragOver.bind(i));l(o,"drop",i._drop.bind(i));l(o,"dragend",i._dragEndBnd);l(o,"click",i._click.bind(i));i.initialize(r);return i}Object.defineProperty(GroupPanel.prototype,"hideGroupedColumns",{get:function(){return this._hideGroupedCols},set:function(e){e!=this._hideGroupedCols&&(this._hideGroupedCols=wijmo_1.asBoolean(e))},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"showDragGlyphs",{get:function(){return this._showDragGlyphs},set:function(e){if(e!=this._showDragGlyphs){this._showDragGlyphs=wijmo_1.asBoolean(e);this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"maxGroups",{get:function(){return this._maxGroups},set:function(e){if(e!=this._maxGroups){this._maxGroups=wijmo_1.asNumber(e);var t=this._gds,r=this._maxGroups;t&&r>-1&&r<t.length&&t.splice(r,t.length-r)}},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"placeholder",{get:function(){return this._placeholder},set:function(e){if(e!=this._placeholder){this._placeholder=e;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"grid",{get:function(){return this._g},set:function(e){if((e=wijmo_1.asType(e,wijmo_grid_1.FlexGrid,!0))!=this._g){var t=this._g;if(t){t.draggingColumn.removeHandler(this._draggingColumn);t.itemsSourceChanging.removeHandler(this._itemsSourceChanging);t.itemsSourceChanged.removeHandler(this._itemsSourceChanged);t.columns.collectionChanged.removeHandler(this._itemsSourceChanged);t.removeEventListener(t.hostElement,"dragend",this._dragEndBnd)}t=this._g=e;this._hiddenCols=[];if(t){t.draggingColumn.addHandler(this._draggingColumn,this);t.itemsSourceChanging.addHandler(this._itemsSourceChanging,this);t.itemsSourceChanged.addHandler(this._itemsSourceChanged,this);t.columns.collectionChanged.addHandler(this._itemsSourceChanged,this);t.addEventListener(t.hostElement,"dragend",this._dragEndBnd)}this._itemsSourceChanged(t,null)}},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"collectionView",{get:function(){return this._g?this._g.collectionView:null},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"filter",{get:function(){return this._filter},set:function(e){if((e=wijmo_1.asType(e,softGridFilter().FlexGridFilter,!0))!=this._filter){var t=this._filter;if(t){t.filterApplied.removeHandler(this.refresh,this);t.filterChanged.removeHandler(this._filterChanged,this)}if(t=this._filter=e){t.filterApplied.addHandler(this.refresh,this);t.filterChanged.addHandler(this._filterChanged,this)}this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"groupDescriptionCreator",{get:function(){return this._gdc},set:function(e){this._gdc=e},enumerable:!0,configurable:!0});GroupPanel.prototype.refresh=function(){var t=this;e.prototype.refresh.call(this);this._divMarkers.innerHTML="";this._dragMarker=this._dragCol=null;if(this._gds){for(var r,i=this._g,n=i.columnHeaders,_loop_1=function(e){var l=o._gds[e],s=-1,a=-1;if(l instanceof wijmo_1.PropertyGroupDescription)for(var d=n.rows.length-1;d>=0&&a<0;d--)for(var u=0;u<n.columns.length&&a<0;u++){if((p=i._getBindingColumn(n,d,n.columns[u]))&&p.binding==l.propertyName){a=u;s=d;break}}if(a>-1&&s>-1){var h=document.createElement("button");i.cellFactory.updateCell(o._g.columnHeaders,s,a,h);h.setAttribute("class","wj-cell wj-header wj-groupmarker");h.setAttribute("role","button");h.setAttribute("tabindex","0");h.addEventListener("focus",(function(){t._focusGd=l}));o._focusGd===l&&o._focus&&setTimeout((function(){h.focus()}),50);h.addEventListener("keydown",(function(e){if(!(46!==e.keyCode||e.altKey||e.shiftKey||e.ctrlKey||e.metaKey)){var t=e.path.find((function(e){return e.classList.contains("wj-groupmarker")}));Array.from(t.children).find((function(e){return e.classList.contains("wj-remove")})).click()}}));wijmo_1.setCss(h,{position:"static",display:"inline-block",verticalAlign:"top",left:"",right:"",top:"",width:"",height:"",paddingLeft:"",paddingRight:""});wijmo_1.removeChild(h.querySelector(".wj-elem-filter"));wijmo_1.removeChild(h.querySelector(".wj-column-selector"));if(o.showDragGlyphs){r=wijmo_1.createElement('<span class="wj-glyph-drag"></span>');h.insertBefore(r,h.firstChild)}var p=i._getBindingColumn(n,s,n.columns[a]),_=o._getColumnFilter(p);if(_){var c=wijmo_1.createElement('<span class="wj-filter wj-glyph-filter"></span>',h);wijmo_1.toggleClass(c,"wj-filter-on",_.isActive);wijmo_1.toggleClass(c,"wj-filter-off",!_.isActive)}wijmo_1.createElement('<span class="wj-remove">×</span>',h);o._divMarkers.appendChild(h);if(p&&o.hideGroupedColumns){var g=[];if(o.grid.layoutDefinition){o.grid.layoutDefinition.forEach((function(e){return e.cells.forEach((function(e){return g.push(e.binding)}))}))}if(!g.includes(p._binding.path)){p.visible=!1;o._hiddenCols.push(p)}}}},o=this,l=0;l<this._gds.length;l++)_loop_1(l);this._divPH.textContent=null!=this._placeholder?this._placeholder:wijmo_1.culture.GroupPanel.dragDrop;var s=this._divMarkers.children.length>0;this._divPH.style.display=s?"none":"";this._divMarkers.style.display=s?"":"none"}};GroupPanel.prototype.hitTest=function(e){var t=e instanceof HTMLElement?e:e instanceof MouseEvent?e.target:null;wijmo_1.assert(null!=t,"MouseEvent or Element expected");var r=wijmo_1.closest(t,".wj-cell");if(wijmo_1.hasClass(r,"wj-cell")){var i=this._getElementIndex(r);return this._gds&&i>-1?this._gds[i]:null}return null};GroupPanel.prototype._filterChanged=function(){this._filterMarker=null};GroupPanel.prototype._getColumnFilter=function(e){var t=this._filter,r=null;t&&(r=t.filterColumns&&t.filterColumns.indexOf(e.binding)<0?null:t.getColumnFilter(e));return r};GroupPanel.prototype._editFilter=function(e){var t=this._gds,r=this._getElementIndex(e),i=t&&r>-1?t[r]:null,n=i instanceof wijmo_1.PropertyGroupDescription?i.propertyName:null,o=n?this._g.getColumn(n):null;o&&this._filter.editColumnFilter(o,null,e)};GroupPanel.prototype._addGroup=function(e,t){for(var r=this._getIndex(t),i=this._gds,n=this._maxGroups,o=0;o<i.length;o++){var l=i[o];if(l instanceof wijmo_1.PropertyGroupDescription&&l.propertyName==e.binding){i.removeAt(o);o<r&&r--;break}}if(n>-1)for(o=n-1;o<i.length;o++){this._removeGroup(o,i);o<r&&r--}if(n<0||i.length<n){var s=this._gdc?this._gdc(e.binding):null;s||(s=new wijmo_1.PropertyGroupDescription(e.binding));i.insert(r,s);if(e&&this.hideGroupedColumns){e.visible=!1;this._hiddenCols.push(e)}}};GroupPanel.prototype._moveGroup=function(e,t){var r=this._gds,i=this._getElementIndex(this._dragMarker),n=this._getIndex(t);n>i&&n--;n>=this._gds.length&&(n=this._gds.length);i!=n&&r.deferUpdate((function(){var e=r[i];r.removeAt(i);r.insert(n,e)}))};GroupPanel.prototype._removeGroup=function(e,t){void 0===t&&(t=this._gds);var r=t&&e>-1?t[e]:null,i=r instanceof wijmo_1.PropertyGroupDescription?r.propertyName:null,n=i?this._g.columns.getColumn(i):null;if(n){n.visible=!0;var o=this._hiddenCols,l=o.indexOf(n);l>-1&&o.splice(l,1)}r&&t.removeAt(e)};GroupPanel.prototype._getIndex=function(e){for(var t=e.clientX,r=this._divMarkers.children,i=0;i<r.length;i++){var n=r[i].getBoundingClientRect();if((t-n.left)*(t-n.right)<0)return i}return r.length};GroupPanel.prototype._getElementIndex=function(e){if(e&&e.parentElement)for(var t=e.parentElement.children,r=0;r<t.length;r++)if(t[r]==e)return r;return-1};GroupPanel.prototype._draggingColumn=function(e,t){var r=this._g,i=r._getBindingColumn(t.panel,t.row,r.columns[t.col]);this._dragCol=i.binding?i:null};GroupPanel.prototype._itemsSourceChanging=function(e,t){this._hiddenCols.forEach((function(e){e.visible=!0}));this._hiddenCols=[]};GroupPanel.prototype._itemsSourceChanged=function(e,t){this._view&&this._view.collectionChanged.removeHandler(this._collectionChanged);this._view=this._g?this._g.collectionView:null;this._gds=this._view?this._view.groupDescriptions:null;this._view&&this._view.collectionChanged.addHandler(this._collectionChanged,this);this.invalidate()};GroupPanel.prototype._collectionChanged=function(e,t){t.action==wijmo_1.NotifyCollectionChangedAction.Reset&&this.invalidate()};GroupPanel.prototype._dragStart=function(e){wijmo_1._startDrag(e.dataTransfer,"move");this._dragMarker=e.target;this._dragCol=null};GroupPanel.prototype._dragOver=function(e){if(this._dragCol||this._dragMarker){e.dataTransfer.dropEffect="move";e.preventDefault();e.stopPropagation()}};GroupPanel.prototype._drop=function(e){this._dragMarker?this._moveGroup(this._dragMarker,e):this._dragCol&&this._addGroup(this._dragCol,e)};GroupPanel.prototype._dragEnd=function(e){this._dragMarker=this._dragCol=null};GroupPanel.prototype._click=function(e){var t=e.target,r=wijmo_1.closest(t,".wj-cell");if(wijmo_1.hasClass(r,"wj-cell"))if(wijmo_1.hasClass(t,"wj-filter")){if(r!=this._filterMarker){this._editFilter(r);this._filterMarker=r;return}}else if(wijmo_1.hasClass(t,"wj-remove")){var i=this._getElementIndex(r);this._removeGroup(i)}else this._updateSort(e,r);this._filterMarker=null;this.hostElement.focus()};GroupPanel.prototype._updateSort=function(e,t){var r=this,i=this._g,n=i.collectionView;if(n&&n.canSort&&i.allowSorting!=wijmo_grid_1.AllowSorting.None){var o=this._getElementIndex(t),l=this._gds[o],s=l instanceof wijmo_1.PropertyGroupDescription?l.propertyName:null,a=s?i.getColumn(s):null;if(a&&a.allowSorting){for(var d=a.sortMemberPath||a.binding,u=-1,h=n.sortDescriptions,p=0;p<h.length;p++)if(h[p].property==d){u=p;break}var _=new wijmo_grid_1.CellRangeEventArgs(i.columnHeaders,new wijmo_grid_1.CellRange(0,a.index),e);if(i.onSortingColumn(_)){var c=e.ctrlKey||e.metaKey,g=e.shiftKey;h.deferUpdate((function(){if(c&&g)h.clear();else if(u<0){r._g.allowSorting!=wijmo_grid_1.AllowSorting.MultiColumn&&h.clear();var e=new wijmo_1.SortDescription(d,!0);h.push(e)}else{var t=h[u].ascending;if(c||r.isTouching&&!t)h.splice(u,1);else{e=new wijmo_1.SortDescription(d,!t);h.splice(u,1,e)}}}));i.onSortedColumn(_)}}}};GroupPanel.controlTemplate='<div><div wj-part="div-ph"></div><div wj-part="div-markers"></div></div>';return GroupPanel}(wijmo_1.Control);exports.GroupPanel=GroupPanel;wijmo_1._registerModule("wijmo.grid.grouppanel",selfModule); | ||
"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}(),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);t.default=e;return t};Object.defineProperty(exports,"__esModule",{value:!0});var wijmo_1=require("@grapecity/wijmo"),wijmo_grid_1=require("@grapecity/wijmo.grid"),wijmo_grid_filter_1=require("@grapecity/wijmo.grid.filter"),selfModule=__importStar(require("@grapecity/wijmo.grid.grouppanel"));exports.GroupPanelClsNames={groupMarker:"wj-groupmarker",hostElement:"wj-grouppanel"};function softGridFilter(){return wijmo_1._getModule("wijmo.grid.filter")}exports.softGridFilter=softGridFilter;wijmo_1._addCultureInfo("GroupPanel",{dragDrop:"Drag and Drop columns here to create Groups."});var GroupPanel=function(e){__extends(GroupPanel,e);function GroupPanel(t,r){var i=e.call(this,t)||this;i._hideGroupedCols=!0;i._showDragGlyphs=!0;i._maxGroups=6;i._hiddenCols=[];i._placeholder=null;i._dragEndBnd=i._dragEnd.bind(i);i._focusGd=null;var o=i.getTemplate();i.applyTemplate(exports.GroupPanelClsNames.hostElement+" "+wijmo_1.ControlClsNames.hostElement,o,{_divMarkers:"div-markers",_divPH:"div-ph"});wijmo_1.setCss(i._divMarkers.parentElement,{width:"100%",height:"100%",minHeight:"1em",overflow:"hidden",cursor:"default"});var n=i.hostElement,l=i.addEventListener.bind(i);l(n,"dragstart",i._dragStart.bind(i));l(n,"dragover",i._dragOver.bind(i));l(n,"drop",i._drop.bind(i));l(n,"dragend",i._dragEndBnd);l(n,"click",i._click.bind(i));i.initialize(r);return i}Object.defineProperty(GroupPanel,"controlTemplate",{get:function(){GroupPanel._ctrlTemplate||(GroupPanel._ctrlTemplate='<div><div wj-part="div-ph"></div><div wj-part="div-markers"></div></div>');return GroupPanel._ctrlTemplate},set:function(e){GroupPanel._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"hideGroupedColumns",{get:function(){return this._hideGroupedCols},set:function(e){e!=this._hideGroupedCols&&(this._hideGroupedCols=wijmo_1.asBoolean(e))},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"showDragGlyphs",{get:function(){return this._showDragGlyphs},set:function(e){if(e!=this._showDragGlyphs){this._showDragGlyphs=wijmo_1.asBoolean(e);this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"maxGroups",{get:function(){return this._maxGroups},set:function(e){if(e!=this._maxGroups){this._maxGroups=wijmo_1.asNumber(e);var t=this._gds,r=this._maxGroups;t&&r>-1&&r<t.length&&t.splice(r,t.length-r)}},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"placeholder",{get:function(){return this._placeholder},set:function(e){if(e!=this._placeholder){this._placeholder=e;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"grid",{get:function(){return this._g},set:function(e){if((e=wijmo_1.asType(e,wijmo_grid_1.FlexGrid,!0))!=this._g){var t=this._g;if(t){t.draggingColumn.removeHandler(this._draggingColumn);t.itemsSourceChanging.removeHandler(this._itemsSourceChanging);t.itemsSourceChanged.removeHandler(this._itemsSourceChanged);t.columns.collectionChanged.removeHandler(this._itemsSourceChanged);t.removeEventListener(t.hostElement,"dragend",this._dragEndBnd)}t=this._g=e;this._hiddenCols=[];if(t){t.draggingColumn.addHandler(this._draggingColumn,this);t.itemsSourceChanging.addHandler(this._itemsSourceChanging,this);t.itemsSourceChanged.addHandler(this._itemsSourceChanged,this);t.columns.collectionChanged.addHandler(this._itemsSourceChanged,this);t.addEventListener(t.hostElement,"dragend",this._dragEndBnd)}this._itemsSourceChanged(t,null)}},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"collectionView",{get:function(){return this._g?this._g.collectionView:null},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"filter",{get:function(){return this._filter},set:function(e){if((e=wijmo_1.asType(e,softGridFilter().FlexGridFilter,!0))!=this._filter){var t=this._filter;if(t){t.filterApplied.removeHandler(this.refresh,this);t.filterChanged.removeHandler(this._filterChanged,this)}if(t=this._filter=e){t.filterApplied.addHandler(this.refresh,this);t.filterChanged.addHandler(this._filterChanged,this)}this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"groupDescriptionCreator",{get:function(){return this._gdc},set:function(e){this._gdc=e},enumerable:!0,configurable:!0});GroupPanel.prototype.refresh=function(){var t=this;e.prototype.refresh.call(this);this._divMarkers.innerHTML="";this._dragMarker=this._dragCol=null;if(this._gds){for(var r,i=this._g,o=i.columnHeaders,_loop_1=function(e){var l=n._gds[e],s=-1,a=-1;if(l instanceof wijmo_1.PropertyGroupDescription)for(var d=o.rows.length-1;d>=0&&a<0;d--)for(var u=0;u<o.columns.length&&a<0;u++){if((p=i._getBindingColumn(o,d,o.columns[u]))&&p.binding==l.propertyName){a=u;s=d;break}}if(a>-1&&s>-1){var _=document.createElement("button");i.cellFactory.updateCell(n._g.columnHeaders,s,a,_);_.setAttribute("class",wijmo_grid_1.FlexGridClsNames.cell+" "+wijmo_grid_1.FlexGridClsNames.header+" "+exports.GroupPanelClsNames.groupMarker);_.setAttribute("role","button");_.setAttribute("tabindex","0");_.addEventListener("focus",(function(){t._focusGd=l}));n._focusGd===l&&n._focus&&setTimeout((function(){_.focus()}),50);_.addEventListener("keydown",(function(e){if(!(46!==e.keyCode||e.altKey||e.shiftKey||e.ctrlKey||e.metaKey)){var t=e.path.find((function(e){return e.classList.contains(exports.GroupPanelClsNames.groupMarker)}));Array.from(t.children).find((function(e){return e.classList.contains(wijmo_1.UtilitesClsNames.remove)})).click()}}));wijmo_1.setCss(_,{position:"static",display:"inline-block",verticalAlign:"top",left:"",right:"",top:"",width:"",height:"",paddingLeft:"",paddingRight:""});wijmo_1.removeChild(_.querySelector("."+wijmo_grid_filter_1.FlexGridFilterClsNames.elemFilter));wijmo_1.removeChild(_.querySelector(".wj-column-selector"));if(n.showDragGlyphs){r=wijmo_1.createElement("<span class="+wijmo_1.GlyphClsNames.drag+"></span>");_.insertBefore(r,_.firstChild)}var p=i._getBindingColumn(o,s,o.columns[a]),h=n._getColumnFilter(p);if(h){var c=wijmo_1.createElement('<span class="'+wijmo_grid_filter_1.FlexGridFilterClsNames.filter+" "+wijmo_1.GlyphClsNames.filter+'"></span>',_);wijmo_1.toggleClass(c,wijmo_grid_filter_1.FlexGridFilterClsNames.filterOn,h.isActive);wijmo_1.toggleClass(c,wijmo_grid_filter_1.FlexGridFilterClsNames.filterOff,!h.isActive)}wijmo_1.createElement('<span class="'+wijmo_1.UtilitesClsNames.remove+'">×</span>',_);n._divMarkers.appendChild(_);if(p&&n.hideGroupedColumns){var g=[];if(n.grid.layoutDefinition){n.grid.layoutDefinition.forEach((function(e){return e.cells.forEach((function(e){return g.push(e.binding)}))}))}if(!g.includes(p._binding.path)){p.visible=!1;n._hiddenCols.push(p)}}}},n=this,l=0;l<this._gds.length;l++)_loop_1(l);this._divPH.textContent=null!=this._placeholder?this._placeholder:wijmo_1.culture.GroupPanel.dragDrop;var s=this._divMarkers.children.length>0;this._divPH.style.display=s?"none":"";this._divMarkers.style.display=s?"":"none"}};GroupPanel.prototype.hitTest=function(e){var t=e instanceof HTMLElement?e:e instanceof MouseEvent?e.target:null;wijmo_1.assert(null!=t,"MouseEvent or Element expected");var r=wijmo_1.closest(t,"."+wijmo_grid_1.FlexGridClsNames.cell);if(wijmo_1.hasClass(r,wijmo_grid_1.FlexGridClsNames.cell)){var i=this._getElementIndex(r);return this._gds&&i>-1?this._gds[i]:null}return null};GroupPanel.prototype._filterChanged=function(){this._filterMarker=null};GroupPanel.prototype._getColumnFilter=function(e){var t=this._filter,r=null;t&&(r=t.filterColumns&&t.filterColumns.indexOf(e.binding)<0?null:t.getColumnFilter(e));return r};GroupPanel.prototype._editFilter=function(e){var t=this._gds,r=this._getElementIndex(e),i=t&&r>-1?t[r]:null,o=i instanceof wijmo_1.PropertyGroupDescription?i.propertyName:null,n=o?this._g.getColumn(o):null;n&&this._filter.editColumnFilter(n,null,e)};GroupPanel.prototype._addGroup=function(e,t){for(var r=this._getIndex(t),i=this._gds,o=this._maxGroups,n=0;n<i.length;n++){var l=i[n];if(l instanceof wijmo_1.PropertyGroupDescription&&l.propertyName==e.binding){i.removeAt(n);n<r&&r--;break}}if(o>-1)for(n=o-1;n<i.length;n++){this._removeGroup(n,i);n<r&&r--}if(o<0||i.length<o){var s=this._gdc?this._gdc(e.binding):null;s||(s=new wijmo_1.PropertyGroupDescription(e.binding));i.insert(r,s);if(e&&this.hideGroupedColumns){e.visible=!1;this._hiddenCols.push(e)}}};GroupPanel.prototype._moveGroup=function(e,t){var r=this._gds,i=this._getElementIndex(this._dragMarker),o=this._getIndex(t);o>i&&o--;o>=this._gds.length&&(o=this._gds.length);i!=o&&r.deferUpdate((function(){var e=r[i];r.removeAt(i);r.insert(o,e)}))};GroupPanel.prototype._removeGroup=function(e,t){void 0===t&&(t=this._gds);var r=t&&e>-1?t[e]:null,i=r instanceof wijmo_1.PropertyGroupDescription?r.propertyName:null,o=i?this._g.columns.getColumn(i):null;if(o){o.visible=!0;var n=this._hiddenCols,l=n.indexOf(o);l>-1&&n.splice(l,1)}r&&t.removeAt(e)};GroupPanel.prototype._getIndex=function(e){for(var t=e.clientX,r=this._divMarkers.children,i=0;i<r.length;i++){var o=r[i].getBoundingClientRect();if((t-o.left)*(t-o.right)<0)return i}return r.length};GroupPanel.prototype._getElementIndex=function(e){if(e&&e.parentElement)for(var t=e.parentElement.children,r=0;r<t.length;r++)if(t[r]==e)return r;return-1};GroupPanel.prototype._draggingColumn=function(e,t){var r=this._g,i=r._getBindingColumn(t.panel,t.row,r.columns[t.col]);this._dragCol=i.binding?i:null};GroupPanel.prototype._itemsSourceChanging=function(e,t){this._hiddenCols.forEach((function(e){e.visible=!0}));this._hiddenCols=[]};GroupPanel.prototype._itemsSourceChanged=function(e,t){this._view&&this._view.collectionChanged.removeHandler(this._collectionChanged);this._view=this._g?this._g.collectionView:null;this._gds=this._view?this._view.groupDescriptions:null;this._view&&this._view.collectionChanged.addHandler(this._collectionChanged,this);this.invalidate()};GroupPanel.prototype._collectionChanged=function(e,t){t.action==wijmo_1.NotifyCollectionChangedAction.Reset&&this.invalidate()};GroupPanel.prototype._dragStart=function(e){wijmo_1._startDrag(e.dataTransfer,"move");this._dragMarker=e.target;this._dragCol=null};GroupPanel.prototype._dragOver=function(e){if(this._dragCol||this._dragMarker){e.dataTransfer.dropEffect="move";e.preventDefault();e.stopPropagation()}};GroupPanel.prototype._drop=function(e){this._dragMarker?this._moveGroup(this._dragMarker,e):this._dragCol&&this._addGroup(this._dragCol,e)};GroupPanel.prototype._dragEnd=function(e){this._dragMarker=this._dragCol=null};GroupPanel.prototype._click=function(e){var t=e.target,r=wijmo_1.closest(t,"."+wijmo_grid_1.FlexGridClsNames.cell);if(wijmo_1.hasClass(r,wijmo_grid_1.FlexGridClsNames.cell))if(wijmo_1.hasClass(t,wijmo_grid_filter_1.FlexGridFilterClsNames.filter)){if(r!=this._filterMarker){this._editFilter(r);this._filterMarker=r;return}}else if(wijmo_1.hasClass(t,wijmo_1.UtilitesClsNames.remove)){var i=this._getElementIndex(r);this._removeGroup(i)}else this._updateSort(e,r);this._filterMarker=null;this.hostElement.focus()};GroupPanel.prototype._updateSort=function(e,t){var r=this,i=this._g,o=i.collectionView;if(o&&o.canSort&&i.allowSorting!=wijmo_grid_1.AllowSorting.None){var n=this._getElementIndex(t),l=this._gds[n],s=l instanceof wijmo_1.PropertyGroupDescription?l.propertyName:null,a=s?i.getColumn(s):null;if(a&&a.allowSorting){for(var d=a.sortMemberPath||a.binding,u=-1,_=o.sortDescriptions,p=0;p<_.length;p++)if(_[p].property==d){u=p;break}var h=new wijmo_grid_1.CellRangeEventArgs(i.columnHeaders,new wijmo_grid_1.CellRange(0,a.index),e);if(i.onSortingColumn(h)){var c=e.ctrlKey||e.metaKey,g=e.shiftKey;_.deferUpdate((function(){if(c&&g)_.clear();else if(u<0){r._g.allowSorting!=wijmo_grid_1.AllowSorting.MultiColumn&&_.clear();var e=new wijmo_1.SortDescription(d,!0);_.push(e)}else{var t=_[u].ascending;if(c||r.isTouching&&!t)_.splice(u,1);else{e=new wijmo_1.SortDescription(d,!t);_.splice(u,1,e)}}}));i.onSortedColumn(h)}}}};GroupPanel._ctrlTemplate="";return GroupPanel}(wijmo_1.Control);exports.GroupPanel=GroupPanel;wijmo_1._registerModule("wijmo.grid.grouppanel",selfModule); |
{ | ||
"name": "@grapecity/wijmo.grid.grouppanel", | ||
"version": "5.20242.21", | ||
"version": "5.20242.30", | ||
"description": "UI library for pure JS, Angular, React, Vue and more...", | ||
@@ -10,6 +10,6 @@ "author": "MESCIUS inc", | ||
"dependencies": { | ||
"@grapecity/wijmo": "5.20242.21", | ||
"@grapecity/wijmo.input": "5.20242.21", | ||
"@grapecity/wijmo.grid": "5.20242.21", | ||
"@grapecity/wijmo.grid.filter": "5.20242.21" | ||
"@grapecity/wijmo": "5.20242.30", | ||
"@grapecity/wijmo.input": "5.20242.30", | ||
"@grapecity/wijmo.grid": "5.20242.30", | ||
"@grapecity/wijmo.grid.filter": "5.20242.30" | ||
}, | ||
@@ -16,0 +16,0 @@ "homepage": "https://developer.mescius.com/wijmo", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
107282
272
1
+ Added@grapecity/wijmo@5.20242.30(transitive)
+ Added@grapecity/wijmo.grid@5.20242.30(transitive)
+ Added@grapecity/wijmo.grid.filter@5.20242.30(transitive)
+ Added@grapecity/wijmo.input@5.20242.30(transitive)
+ Added@grapecity/wijmo.styles@5.20242.30(transitive)
- Removed@grapecity/wijmo@5.20242.21(transitive)
- Removed@grapecity/wijmo.grid@5.20242.21(transitive)
- Removed@grapecity/wijmo.grid.filter@5.20242.21(transitive)
- Removed@grapecity/wijmo.input@5.20242.21(transitive)
- Removed@grapecity/wijmo.styles@5.20242.21(transitive)
Updated@grapecity/wijmo@5.20242.30